UNPKG

prisma-zod-generator

Version:

Prisma 2+ generator to emit Zod schemas from your Prisma schema

102 lines 2.94 kB
"use strict"; /** * Variant Management System Types * Defines TypeScript interfaces for schema variant generation system */ Object.defineProperty(exports, "__esModule", { value: true }); exports.DEFAULT_SCHEMA_OPTIONS = exports.DEFAULT_VALIDATION_CUSTOMIZATIONS = exports.DEFAULT_FIELD_EXCLUSIONS = exports.DEFAULT_NAMING_CONFIGS = exports.VariantType = void 0; /** * Supported schema variant types */ var VariantType; (function (VariantType) { VariantType["PURE"] = "pure"; VariantType["INPUT"] = "input"; VariantType["RESULT"] = "result"; })(VariantType || (exports.VariantType = VariantType = {})); /** * Default naming configurations for each variant type */ exports.DEFAULT_NAMING_CONFIGS = { [VariantType.PURE]: { suffix: '.model.ts', schemaNameSuffix: 'Model', typeNameSuffix: 'ModelType', }, [VariantType.INPUT]: { suffix: '.input.ts', schemaNameSuffix: 'Input', typeNameSuffix: 'InputType', }, [VariantType.RESULT]: { suffix: '.result.ts', schemaNameSuffix: 'Result', typeNameSuffix: 'ResultType', }, }; /** * Default field exclusion rules for each variant type */ exports.DEFAULT_FIELD_EXCLUSIONS = { [VariantType.PURE]: { excludeFields: [], excludeRelations: false, excludeAutoGenerated: false, }, [VariantType.INPUT]: { excludeFields: ['id', 'createdAt', 'updatedAt'], excludeRelations: true, excludeAutoGenerated: true, }, [VariantType.RESULT]: { excludeFields: [], excludeRelations: false, excludeAutoGenerated: false, }, }; /** * Default validation customizations for each variant type */ exports.DEFAULT_VALIDATION_CUSTOMIZATIONS = { [VariantType.PURE]: { disableInlineValidations: false, partial: false, }, [VariantType.INPUT]: { disableInlineValidations: false, partial: false, additionalValidations: { // Add stricter validations for input email: ['email()'], password: ['min(8)', 'regex(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)/)'], }, }, [VariantType.RESULT]: { disableInlineValidations: true, // Results don't need validation partial: false, }, }; /** * Default schema generation options for each variant type */ exports.DEFAULT_SCHEMA_OPTIONS = { [VariantType.PURE]: { includeDocumentation: true, includeExamples: true, generateTypes: true, includeStatistics: true, }, [VariantType.INPUT]: { includeDocumentation: true, includeExamples: false, generateTypes: true, includeStatistics: false, }, [VariantType.RESULT]: { includeDocumentation: false, includeExamples: false, generateTypes: true, includeStatistics: false, }, }; //# sourceMappingURL=variants.js.map