/** * PZG Pro - Server Actions Generator (DMMF-based) * * Generate typed Next.js Server Actions and React hooks from DMMF data */ import { ProFeatureBase } from '../../core/ProFeatureBase'; import { ProGeneratorContext } from '../../core/ProGeneratorContext'; export interface ServerActionsConfig { outputPath?: string; enableOptimisticUpdates?: boolean; enableCacheRevalidation?: boolean; enableErrorBoundaries?: boolean; actions?: string[]; } export declare class ServerActionsGenerator extends ProFeatureBase { private config; constructor(context: ProGeneratorContext, config?: ServerActionsConfig); protected getFeatureName(): string; protected generateFeature(): Promise; /** * Generate the Zod schemas the actions validate against. * * Self-contained on purpose: enum members are inlined as string literals * rather than referencing the Prisma enum, so the module needs no import * beyond zod and cannot break on a missing type. */ private generateModelSchemas; /** * Generate server actions for a model */ private generateModelActions; /** * Generate create action for a model */ private generateCreateAction; /** * Generate update action for a model */ /** * How a model is addressed by primary key. * * Four sites took `pkFields[0]` with the comment "Assume single PK for simplicity". On a model with * `@@id([userId, tenantId])` — a join table, the common case — that emitted * `where: { userId: userId }` from a signature accepting only the first argument, which Prisma's own * types reject: TS2322, "Property 'userId_tenantId' is missing in type '{ userId: string; }'". The * pack emitted code that could not compile, and the caller could not supply the second key. * * Prisma addresses a compound key under one property, named by `@@id(name:)` or by joining the * fields with an underscore. */ private primaryKeyAccess; private generateUpdateAction; /** * Generate delete action for a model */ private generateDeleteAction; /** * Generate findMany action for a model */ private generateFindManyAction; /** * Generate findUnique action for a model */ private generateFindUniqueAction; /** * Find related models for imports */ private findRelatedModels; /** * Generate React hooks for a model */ private generateModelHooks; /** * Generate create hook for a model */ private generateCreateHook; /** * Generate update hook for a model */ private generateUpdateHook; /** * Generate delete hook for a model */ private generateDeleteHook; /** * Generate findMany hook for a model */ private generateFindManyHook; /** * Generate findUnique hook for a model */ private generateFindUniqueHook; /** * Generate TypeScript types for a model */ private generateModelTypes; /** * Generate prisma client file */ private generatePrismaClient; /** * Generate shared utilities */ private generateSharedUtils; /** * Generate index files */ private generateIndexFiles; /** * Helper methods */ private getCreateFields; private getActionImports; private generateFormDataValidation; private generateDataValidation; private generateRevalidation; private generateUsageREADME; }