@rawan-temo/prisma-zod-generator 3.3.1-config-coercion.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +9 -0
- package/.env.example +22 -0
- package/.github/CODEOWNERS +7 -0
- package/.github/DISCUSSION_TEMPLATE/general.yml +39 -0
- package/.github/FUNDING.yml +1 -0
- package/.github/ISSUE_TEMPLATE/bug_report.yml +90 -0
- package/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/.github/ISSUE_TEMPLATE/feature_request.yml +93 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +36 -0
- package/.github/workflows/README.md +97 -0
- package/.github/workflows/ci.yml +270 -0
- package/.github/workflows/docs.yml +98 -0
- package/.github/workflows/semantic-release.yml +209 -0
- package/.gitmodules +4 -0
- package/.husky/commit-msg +44 -0
- package/.husky/post-checkout +2 -0
- package/.husky/post-merge +2 -0
- package/.husky/pre-push +24 -0
- package/.nvmrc +1 -0
- package/.prettierignore +19 -0
- package/.prettierrc +10 -0
- package/.releaserc.json +106 -0
- package/AGENTS.md +119 -0
- package/CHANGELOG.md +1730 -0
- package/CLAUDE.md +121 -0
- package/CONTRIBUTING.md +279 -0
- package/DOCKER.md +84 -0
- package/LICENSE +21 -0
- package/LICENSE-PRO.md +246 -0
- package/README.md +244 -0
- package/SECURITY.md +34 -0
- package/app/generated/browser.ts +39 -0
- package/app/generated/client.ts +61 -0
- package/app/generated/commonInputTypes.ts +457 -0
- package/app/generated/enums.ts +29 -0
- package/app/generated/internal/class.ts +234 -0
- package/app/generated/internal/prismaNamespace.ts +1170 -0
- package/app/generated/internal/prismaNamespaceBrowser.ts +159 -0
- package/app/generated/models/Profile.ts +1395 -0
- package/app/generated/models/Project.ts +1488 -0
- package/app/generated/models/Task.ts +1643 -0
- package/app/generated/models/User.ts +2021 -0
- package/app/generated/models.ts +15 -0
- package/docker-compose.yml +93 -0
- package/docs/assets/diagrams/diagram-01-23b43096d1.svg +1 -0
- package/eslint.config.mjs +99 -0
- package/lib/cli/license-check.d.ts +6 -0
- package/lib/cli/license-check.js +60 -0
- package/lib/cli/license-check.js.map +1 -0
- package/lib/cli/pzg-pro-generator.d.ts +59 -0
- package/lib/cli/pzg-pro-generator.js +431 -0
- package/lib/cli/pzg-pro-generator.js.map +1 -0
- package/lib/cli/pzg-pro.d.ts +18 -0
- package/lib/cli/pzg-pro.js +111 -0
- package/lib/cli/pzg-pro.js.map +1 -0
- package/lib/config/defaults.d.ts +83 -0
- package/lib/config/defaults.js +406 -0
- package/lib/config/defaults.js.map +1 -0
- package/lib/config/generator-options.d.ts +104 -0
- package/lib/config/generator-options.js +353 -0
- package/lib/config/generator-options.js.map +1 -0
- package/lib/config/parser.d.ts +386 -0
- package/lib/config/parser.js +264 -0
- package/lib/config/parser.js.map +1 -0
- package/lib/config/schema.d.ts +94 -0
- package/lib/config/schema.js +963 -0
- package/lib/config/schema.js.map +1 -0
- package/lib/config/typed-json.d.ts +132 -0
- package/lib/config/typed-json.js +121 -0
- package/lib/config/typed-json.js.map +1 -0
- package/lib/config/validator.d.ts +79 -0
- package/lib/config/validator.js +370 -0
- package/lib/config/validator.js.map +1 -0
- package/lib/generator.d.ts +5 -0
- package/lib/generator.js +70 -0
- package/lib/generator.js.map +1 -0
- package/lib/generators/model.d.ts +572 -0
- package/lib/generators/model.js +2577 -0
- package/lib/generators/model.js.map +1 -0
- package/lib/generators/results.d.ts +328 -0
- package/lib/generators/results.js +814 -0
- package/lib/generators/results.js.map +1 -0
- package/lib/generators/typed-field-update-operations.d.ts +89 -0
- package/lib/generators/typed-field-update-operations.js +185 -0
- package/lib/generators/typed-field-update-operations.js.map +1 -0
- package/lib/generators/typed-json-namespace.d.ts +124 -0
- package/lib/generators/typed-json-namespace.js +294 -0
- package/lib/generators/typed-json-namespace.js.map +1 -0
- package/lib/helpers/aggregate-helpers.d.ts +11 -0
- package/lib/helpers/aggregate-helpers.js +82 -0
- package/lib/helpers/aggregate-helpers.js.map +1 -0
- package/lib/helpers/comments-helpers.d.ts +6 -0
- package/lib/helpers/comments-helpers.js +98 -0
- package/lib/helpers/comments-helpers.js.map +1 -0
- package/lib/helpers/decimal-helpers.d.ts +41 -0
- package/lib/helpers/decimal-helpers.js +115 -0
- package/lib/helpers/decimal-helpers.js.map +1 -0
- package/lib/helpers/helpers.d.ts +12 -0
- package/lib/helpers/helpers.js +85 -0
- package/lib/helpers/helpers.js.map +1 -0
- package/lib/helpers/include-helpers.d.ts +6 -0
- package/lib/helpers/include-helpers.js +110 -0
- package/lib/helpers/include-helpers.js.map +1 -0
- package/lib/helpers/index.d.ts +7 -0
- package/lib/helpers/index.js +24 -0
- package/lib/helpers/index.js.map +1 -0
- package/lib/helpers/json-helpers.d.ts +18 -0
- package/lib/helpers/json-helpers.js +50 -0
- package/lib/helpers/json-helpers.js.map +1 -0
- package/lib/helpers/model-helpers.d.ts +41 -0
- package/lib/helpers/model-helpers.js +155 -0
- package/lib/helpers/model-helpers.js.map +1 -0
- package/lib/helpers/modelArgs-helpers.d.ts +2 -0
- package/lib/helpers/modelArgs-helpers.js +63 -0
- package/lib/helpers/modelArgs-helpers.js.map +1 -0
- package/lib/helpers/mongodb-helpers.d.ts +7 -0
- package/lib/helpers/mongodb-helpers.js +91 -0
- package/lib/helpers/mongodb-helpers.js.map +1 -0
- package/lib/helpers/select-helpers.d.ts +2 -0
- package/lib/helpers/select-helpers.js +231 -0
- package/lib/helpers/select-helpers.js.map +1 -0
- package/lib/helpers/whereUniqueInput-helpers.d.ts +2 -0
- package/lib/helpers/whereUniqueInput-helpers.js +44 -0
- package/lib/helpers/whereUniqueInput-helpers.js.map +1 -0
- package/lib/helpers/zod-integration.d.ts +82 -0
- package/lib/helpers/zod-integration.js +262 -0
- package/lib/helpers/zod-integration.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/lib/license.d.ts +56 -0
- package/lib/license.js +498 -0
- package/lib/license.js.map +1 -0
- package/lib/parsers/zod-comments.d.ts +230 -0
- package/lib/parsers/zod-comments.js +2723 -0
- package/lib/parsers/zod-comments.js.map +1 -0
- package/lib/prisma-generator.d.ts +20 -0
- package/lib/prisma-generator.js +2661 -0
- package/lib/prisma-generator.js.map +1 -0
- package/lib/transformer.d.ts +678 -0
- package/lib/transformer.js +4436 -0
- package/lib/transformer.js.map +1 -0
- package/lib/typed-json/annotation-parser.d.ts +60 -0
- package/lib/typed-json/annotation-parser.js +200 -0
- package/lib/typed-json/annotation-parser.js.map +1 -0
- package/lib/typed-json/emission.d.ts +115 -0
- package/lib/typed-json/emission.js +231 -0
- package/lib/typed-json/emission.js.map +1 -0
- package/lib/typed-json/index.d.ts +29 -0
- package/lib/typed-json/index.js +46 -0
- package/lib/typed-json/index.js.map +1 -0
- package/lib/typed-json/resolver.d.ts +112 -0
- package/lib/typed-json/resolver.js +238 -0
- package/lib/typed-json/resolver.js.map +1 -0
- package/lib/typed-json/ts-type-to-zod.d.ts +58 -0
- package/lib/typed-json/ts-type-to-zod.js +640 -0
- package/lib/typed-json/ts-type-to-zod.js.map +1 -0
- package/lib/types/safety.d.ts +85 -0
- package/lib/types/safety.js +6 -0
- package/lib/types/safety.js.map +1 -0
- package/lib/types/variants.d.ts +134 -0
- package/lib/types/variants.js +27 -0
- package/lib/types/variants.js.map +1 -0
- package/lib/types.d.ts +13 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/businessSecurity.d.ts +48 -0
- package/lib/utils/businessSecurity.js +129 -0
- package/lib/utils/businessSecurity.js.map +1 -0
- package/lib/utils/circular-dependency-detector.d.ts +42 -0
- package/lib/utils/circular-dependency-detector.js +175 -0
- package/lib/utils/circular-dependency-detector.js.map +1 -0
- package/lib/utils/coercion.d.ts +37 -0
- package/lib/utils/coercion.js +81 -0
- package/lib/utils/coercion.js.map +1 -0
- package/lib/utils/dosProtection.d.ts +24 -0
- package/lib/utils/dosProtection.js +32 -0
- package/lib/utils/dosProtection.js.map +1 -0
- package/lib/utils/errorHandling.d.ts +23 -0
- package/lib/utils/errorHandling.js +79 -0
- package/lib/utils/errorHandling.js.map +1 -0
- package/lib/utils/formatFile.d.ts +19 -0
- package/lib/utils/formatFile.js +80 -0
- package/lib/utils/formatFile.js.map +1 -0
- package/lib/utils/logger.d.ts +8 -0
- package/lib/utils/logger.js +39 -0
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/naming-resolver.d.ts +38 -0
- package/lib/utils/naming-resolver.js +216 -0
- package/lib/utils/naming-resolver.js.map +1 -0
- package/lib/utils/prismaImport.d.ts +1 -0
- package/lib/utils/prismaImport.js +13 -0
- package/lib/utils/prismaImport.js.map +1 -0
- package/lib/utils/safeOutputManagement.d.ts +20 -0
- package/lib/utils/safeOutputManagement.js +442 -0
- package/lib/utils/safeOutputManagement.js.map +1 -0
- package/lib/utils/safetyConfigResolver.d.ts +17 -0
- package/lib/utils/safetyConfigResolver.js +254 -0
- package/lib/utils/safetyConfigResolver.js.map +1 -0
- package/lib/utils/singleFileAggregator.d.ts +5 -0
- package/lib/utils/singleFileAggregator.js +403 -0
- package/lib/utils/singleFileAggregator.js.map +1 -0
- package/lib/utils/strict-mode-resolver.d.ts +78 -0
- package/lib/utils/strict-mode-resolver.js +230 -0
- package/lib/utils/strict-mode-resolver.js.map +1 -0
- package/lib/utils/writeFileSafely.d.ts +1 -0
- package/lib/utils/writeFileSafely.js +110 -0
- package/lib/utils/writeFileSafely.js.map +1 -0
- package/lib/utils/writeIndexFile.d.ts +2 -0
- package/lib/utils/writeIndexFile.js +113 -0
- package/lib/utils/writeIndexFile.js.map +1 -0
- package/llms.txt +12720 -0
- package/package/package.json +152 -0
- package/package.json +151 -0
- package/package.sh +98 -0
- package/prisma/schema.prisma +160 -0
- package/prisma/utils/multi-provider-test-runner.ts +791 -0
- package/prisma/utils/provider-config.ts +547 -0
- package/prisma/zod-generator.config.json +40 -0
- package/prisma.config.ts +15 -0
- package/recipes/.gitkeep +1 -0
- package/recipes/README.md +44 -0
- package/recipes/api-result-schemas/README.md +12 -0
- package/recipes/api-result-schemas/schema.prisma +6 -0
- package/recipes/api-result-schemas/zod-generator.config.json +10 -0
- package/recipes/circular-dependency-exclusion/README.md +71 -0
- package/recipes/circular-dependency-exclusion/schema.prisma +95 -0
- package/recipes/circular-dependency-exclusion/zod-generator.config.json +28 -0
- package/recipes/crud-only/README.md +24 -0
- package/recipes/crud-only/schema.prisma +31 -0
- package/recipes/crud-only/zod-generator.config.json +11 -0
- package/recipes/granular-per-model/README.md +12 -0
- package/recipes/granular-per-model/schema.prisma +6 -0
- package/recipes/granular-per-model/zod-generator.config.json +17 -0
- package/recipes/hide-fields/README.md +12 -0
- package/recipes/hide-fields/schema.prisma +6 -0
- package/recipes/hide-fields/zod-generator.config.json +19 -0
- package/recipes/input-variant-only/README.md +25 -0
- package/recipes/input-variant-only/schema.prisma +30 -0
- package/recipes/input-variant-only/zod-generator.config.json +16 -0
- package/recipes/json-friendly-datetime/README.md +56 -0
- package/recipes/json-friendly-datetime/schema.prisma +38 -0
- package/recipes/json-friendly-datetime/zod-generator.config.json +18 -0
- package/recipes/minimal-crud/README.md +12 -0
- package/recipes/minimal-crud/schema.prisma +7 -0
- package/recipes/minimal-crud/zod-generator.config.json +9 -0
- package/recipes/models-only/README.md +12 -0
- package/recipes/models-only/schema.prisma +6 -0
- package/recipes/models-only/zod-generator.config.json +11 -0
- package/recipes/optional-field-behavior/README.md +42 -0
- package/recipes/optional-field-behavior/nullable.config.json +7 -0
- package/recipes/optional-field-behavior/optional-strict.config.json +7 -0
- package/recipes/optional-field-behavior/schema.prisma +49 -0
- package/recipes/optional-field-behavior/zod-generator.config.json +7 -0
- package/recipes/pure-models-lean/README.md +84 -0
- package/recipes/pure-models-lean/schema.prisma +22 -0
- package/recipes/pure-models-lean/zod-generator.config.json +6 -0
- package/recipes/result-variant-only/README.md +25 -0
- package/recipes/result-variant-only/schema.prisma +29 -0
- package/recipes/result-variant-only/zod-generator.config.json +16 -0
- package/recipes/single-file/README.md +12 -0
- package/recipes/single-file/schema.prisma +8 -0
- package/recipes/single-file/zod-generator.config.json +12 -0
- package/recipes/trpc-optimized/schema.prisma +9 -0
- package/recipes/trpc-optimized/zod-generator.config.json +14 -0
- package/recipes/zod-imports/README.md +19 -0
- package/recipes/zod-imports/zod-generator.auto.json +3 -0
- package/recipes/zod-imports/zod-generator.v3.json +3 -0
- package/recipes/zod-imports/zod-generator.v4.json +3 -0
- package/scripts/agent-banner.js +37 -0
- package/scripts/clean-test-envs.js +102 -0
- package/scripts/generate-jsonschema.ts +14 -0
- package/scripts/generate-llms-txt.mjs +400 -0
- package/scripts/obfuscate-pro.js +171 -0
- package/scripts/postinstall.js +19 -0
- package/scripts/render-mermaid.ts +174 -0
- package/scripts/tree-shake.js +131 -0
- package/scripts/verify-checksums.js +169 -0
- package/scripts/verify-package-consumer.mjs +198 -0
- package/src/cli/license-check.ts +66 -0
- package/src/cli/pzg-pro-generator.ts +672 -0
- package/src/cli/pzg-pro.ts +119 -0
- package/src/config/defaults.ts +508 -0
- package/src/config/generator-options.ts +522 -0
- package/src/config/parser.ts +721 -0
- package/src/config/schema.ts +1046 -0
- package/src/config/typed-json.ts +219 -0
- package/src/config/validator.ts +469 -0
- package/src/generator.ts +43 -0
- package/src/generators/model.ts +3486 -0
- package/src/generators/results.ts +1045 -0
- package/src/generators/typed-field-update-operations.ts +250 -0
- package/src/generators/typed-json-namespace.ts +413 -0
- package/src/helpers/aggregate-helpers.ts +94 -0
- package/src/helpers/comments-helpers.ts +120 -0
- package/src/helpers/decimal-helpers.ts +136 -0
- package/src/helpers/helpers.ts +116 -0
- package/src/helpers/include-helpers.ts +140 -0
- package/src/helpers/index.ts +7 -0
- package/src/helpers/json-helpers.ts +46 -0
- package/src/helpers/model-helpers.ts +152 -0
- package/src/helpers/modelArgs-helpers.ts +79 -0
- package/src/helpers/mongodb-helpers.ts +108 -0
- package/src/helpers/select-helpers.ts +286 -0
- package/src/helpers/whereUniqueInput-helpers.ts +41 -0
- package/src/helpers/zod-integration.ts +375 -0
- package/src/index.ts +10 -0
- package/src/license.ts +634 -0
- package/src/parsers/zod-comments.ts +3181 -0
- package/src/prisma-generator.ts +3254 -0
- package/src/transformer.ts +5717 -0
- package/src/typed-json/annotation-parser.ts +252 -0
- package/src/typed-json/emission.ts +239 -0
- package/src/typed-json/index.ts +69 -0
- package/src/typed-json/resolver.ts +329 -0
- package/src/typed-json/ts-type-to-zod.ts +715 -0
- package/src/types/prisma-internals-augment.d.ts +17 -0
- package/src/types/safety.ts +102 -0
- package/src/types/variants.ts +193 -0
- package/src/types.ts +13 -0
- package/src/utils/businessSecurity.ts +163 -0
- package/src/utils/circular-dependency-detector.ts +218 -0
- package/src/utils/dosProtection.ts +29 -0
- package/src/utils/errorHandling.ts +85 -0
- package/src/utils/formatFile.ts +77 -0
- package/src/utils/logger.ts +35 -0
- package/src/utils/naming-resolver.ts +294 -0
- package/src/utils/prismaImport.ts +7 -0
- package/src/utils/safeOutputManagement.ts +538 -0
- package/src/utils/safetyConfigResolver.ts +296 -0
- package/src/utils/singleFileAggregator.ts +450 -0
- package/src/utils/strict-mode-resolver.ts +287 -0
- package/src/utils/writeFileSafely.ts +113 -0
- package/src/utils/writeIndexFile.ts +71 -0
- package/test-report.json +8536 -0
- package/tests/README.md +226 -0
- package/tests/__snapshots__/typed-json-corpus-conformance.test.ts.snap +34 -0
- package/tests/__snapshots__/typed-json-pjtg-corpus.test.ts.snap +56 -0
- package/tests/aggregate-groupby.test.ts +345 -0
- package/tests/aggregate-result-shape.test.ts +258 -0
- package/tests/array-fields.test.ts +718 -0
- package/tests/business-security-gate.test.ts +163 -0
- package/tests/circular-dependency-exclusion.test.ts +734 -0
- package/tests/cli-commands.test.ts +134 -0
- package/tests/compat/pjtg/UPSTREAM-LICENSE +21 -0
- package/tests/compat/pjtg/schemas/any.prisma +19 -0
- package/tests/compat/pjtg/schemas/array.prisma +19 -0
- package/tests/compat/pjtg/schemas/cockroach.prisma +35 -0
- package/tests/compat/pjtg/schemas/extensions.prisma +21 -0
- package/tests/compat/pjtg/schemas/literal.prisma +26 -0
- package/tests/compat/pjtg/schemas/mongo.prisma +49 -0
- package/tests/compat/pjtg/schemas/mssql.prisma +25 -0
- package/tests/compat/pjtg/schemas/multiple-clients.prisma +31 -0
- package/tests/compat/pjtg/schemas/mysql.prisma +35 -0
- package/tests/compat/pjtg/schemas/normal-prisma-client.prisma +40 -0
- package/tests/compat/pjtg/schemas/normal.prisma +36 -0
- package/tests/compat/pjtg/schemas/nullable.prisma +29 -0
- package/tests/compat/pjtg/schemas/number.prisma +26 -0
- package/tests/compat/pjtg/schemas/skip.prisma +27 -0
- package/tests/compat/pjtg/schemas/sqlite.prisma +25 -0
- package/tests/compat/pjtg/schemas/string.prisma +29 -0
- package/tests/compat/pjtg/schemas/unknown.prisma +22 -0
- package/tests/compat/pjtg/schemas/use-type.prisma +26 -0
- package/tests/compat/pjtg/types/any.test-d.ts +12 -0
- package/tests/compat/pjtg/types/array.test-d.ts +29 -0
- package/tests/compat/pjtg/types/cockroach.test-d.ts +73 -0
- package/tests/compat/pjtg/types/extensions.test-d.ts +47 -0
- package/tests/compat/pjtg/types/literal.test-d.ts +107 -0
- package/tests/compat/pjtg/types/mongo.test-d.ts +170 -0
- package/tests/compat/pjtg/types/mssql.test-d.ts +22 -0
- package/tests/compat/pjtg/types/multiple-clients.test-d.ts +148 -0
- package/tests/compat/pjtg/types/mysql.test-d.ts +73 -0
- package/tests/compat/pjtg/types/normal-prisma-client.test-d.ts +120 -0
- package/tests/compat/pjtg/types/normal.test-d.ts +295 -0
- package/tests/compat/pjtg/types/nullable.test-d.ts +60 -0
- package/tests/compat/pjtg/types/number.test-d.ts +227 -0
- package/tests/compat/pjtg/types/skip.test-d.ts +27 -0
- package/tests/compat/pjtg/types/sqlite.test-d.ts +22 -0
- package/tests/compat/pjtg/types/string.test-d.ts +143 -0
- package/tests/compat/pjtg/types/unknown.test-d.ts +25 -0
- package/tests/compat/pjtg/types/use-type.test-d.ts +117 -0
- package/tests/compound-unique-key-collision.test.ts +277 -0
- package/tests/comprehensive-schema-coverage.test.ts +403 -0
- package/tests/config-schema-completeness.test.ts +94 -0
- package/tests/config.test.ts +372 -0
- package/tests/count-output-type-select-where.test.ts +112 -0
- package/tests/custom-prisma-client-output.test.ts +170 -0
- package/tests/debug-issue-304.test.ts +44 -0
- package/tests/decimal-input-schemas.test.ts +498 -0
- package/tests/decimal-support.test.ts +582 -0
- package/tests/emit-controls.test.ts +240 -0
- package/tests/emitted-json-helpers.test.ts +132 -0
- package/tests/enum-array-zod-annotations.test.ts +66 -0
- package/tests/environment-cleanup.test.ts +40 -0
- package/tests/error-handling.test.ts +128 -0
- package/tests/field-exclusion.test.ts +1074 -0
- package/tests/filtering.test.ts +919 -0
- package/tests/generated-output-compiles.test.ts +177 -0
- package/tests/generated-schema-runtime.test.ts +185 -0
- package/tests/generated-schema.test.ts +59 -0
- package/tests/generator-options.test.ts +122 -0
- package/tests/groupby-count-literal.test.ts +38 -0
- package/tests/groupby-result-shape.test.ts +149 -0
- package/tests/helpers/global-setup.ts +117 -0
- package/tests/helpers/index.ts +94 -0
- package/tests/helpers/mock-generators.ts +896 -0
- package/tests/helpers/prisma-generate.ts +81 -0
- package/tests/helpers/test-utils.ts +580 -0
- package/tests/helpers/user-post-objects-fixture.ts +90 -0
- package/tests/integration-basic.test.ts +310 -0
- package/tests/integration.test.ts +1234 -0
- package/tests/invalid-zod-annotations.test.ts +78 -0
- package/tests/issue-118-output-directory.test.ts +188 -0
- package/tests/issue-119-regression.test.ts +193 -0
- package/tests/issue-193-enum-imports-custom-variants.test.ts +79 -0
- package/tests/issue-194-zod-custom-use-chained.test.ts +71 -0
- package/tests/issue-196-json-helper-import-path.test.ts +64 -0
- package/tests/issue-225-meta-describe.test.ts +114 -0
- package/tests/issue-227-single-file-imports.test.ts +325 -0
- package/tests/issue-227-zod-annotations.test.ts +366 -0
- package/tests/issue-233-zod-v4-string-formats.test.ts +600 -0
- package/tests/issue-304-custom-naming-imports.test.ts +163 -0
- package/tests/issue-335-single-file-custom-imports.test.ts +104 -0
- package/tests/issue-364-input-json-value-type.test.ts +73 -0
- package/tests/issue-367-decimal-client-safe.test.ts +148 -0
- package/tests/issue-368-variant-datetime-strategy.test.ts +143 -0
- package/tests/issue-370-custom-zod-import-path.test.ts +129 -0
- package/tests/issue-375-shadcn-form-compat.test.ts +104 -0
- package/tests/issue-376-result-relation-schemas.test.ts +308 -0
- package/tests/issue-377-zod-v4-runtime-recursion.test.ts +111 -0
- package/tests/issue-378-unused-prisma-imports.test.ts +199 -0
- package/tests/issue-382-raw-suffix-model.test.ts +121 -0
- package/tests/issue-386-typed-json-fields.test.ts +137 -0
- package/tests/issue-387-select-relation-args.test.ts +182 -0
- package/tests/issue-390-nodenext-import-extensions.test.ts +93 -0
- package/tests/issue-395-result-decimal-mode.test.ts +136 -0
- package/tests/issue-396-global-exclusions-array.test.ts +93 -0
- package/tests/json-config-output-precedence.test.ts +75 -0
- package/tests/json-schema-compatibility.test.ts +972 -0
- package/tests/license-validation.test.ts +110 -0
- package/tests/manifest-path-containment.test.ts +102 -0
- package/tests/minimal-mode.test.ts +812 -0
- package/tests/mongodb-composite-types.test.ts +108 -0
- package/tests/mongodb-schema-coverage.test.ts +403 -0
- package/tests/multi-provider/README.md +240 -0
- package/tests/multi-provider/multi-provider.test.ts +241 -0
- package/tests/multi-provider/provider-test-suite.ts +451 -0
- package/tests/multi-provider/schemas/mongodb/generated/.prisma-zod-generator-manifest.json +266 -0
- package/tests/multi-provider/schemas/mongodb/generated/helpers/json-helpers.ts +28 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/aggregateMongoPost.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/aggregateMongoProfile.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/aggregateMongoUser.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/countMongoPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/countMongoProfile.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/countMongoUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/createManyMongoPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/createManyMongoProfile.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/createManyMongoUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/createOneMongoPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/createOneMongoProfile.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/createOneMongoUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/deleteManyMongoPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/deleteManyMongoProfile.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/deleteManyMongoUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/deleteOneMongoPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/deleteOneMongoProfile.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/deleteOneMongoUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/enums/MongoPostScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/enums/MongoProfileScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/enums/MongoUserScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/enums/QueryMode.schema.ts +5 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/enums/SortOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findFirstMongoPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findFirstMongoProfile.schema.ts +29 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findFirstMongoUser.schema.ts +35 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findFirstOrThrowMongoPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findFirstOrThrowMongoProfile.schema.ts +29 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findFirstOrThrowMongoUser.schema.ts +35 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findManyMongoPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findManyMongoProfile.schema.ts +29 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findManyMongoUser.schema.ts +35 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findUniqueMongoPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findUniqueMongoProfile.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findUniqueMongoUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findUniqueOrThrowMongoPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findUniqueOrThrowMongoProfile.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/findUniqueOrThrowMongoUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/groupByMongoPost.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/groupByMongoProfile.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/groupByMongoUser.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/index.ts +104 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/BoolFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/BoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/BoolWithAggregatesFilter.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/DateTimeFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/DateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/DateTimeWithAggregatesFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCountAggregateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCountOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCreateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCreateManyAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCreateManyAuthorInputEnvelope.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCreateManyInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCreateOrConnectWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostCreateWithoutAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostInclude.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostListRelationFilter.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostMaxAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostMaxOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostMinAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostMinOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostOrderByRelationAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostOrderByWithAggregationInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostOrderByWithRelationInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostScalarWhereInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostScalarWhereWithAggregatesInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostSelect.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedCreateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedCreateWithoutAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedUpdateInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedUpdateManyInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedUpdateManyWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUncheckedUpdateWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUpdateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUpdateManyMutationInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUpdateManyWithWhereWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUpdateWithWhereUniqueWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUpdateWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostUpsertWithWhereUniqueWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostWhereInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoPostWhereUniqueInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileCountAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileCountOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileCreateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileCreateManyInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileCreateNestedOneWithoutUserInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileCreateOrConnectWithoutUserInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileCreateWithoutUserInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileInclude.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileMaxAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileMaxOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileMinAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileMinOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileNullableScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileOrderByWithAggregationInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileOrderByWithRelationInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileScalarWhereWithAggregatesInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileSelect.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUncheckedCreateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUncheckedCreateNestedOneWithoutUserInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUncheckedCreateWithoutUserInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUncheckedUpdateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUncheckedUpdateManyInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUncheckedUpdateOneWithoutUserNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUncheckedUpdateWithoutUserInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUpdateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUpdateManyMutationInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUpdateOneWithoutUserNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUpdateToOneWithWhereWithoutUserInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUpdateWithoutUserInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileUpsertWithoutUserInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileWhereInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoProfileWhereUniqueInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCountAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCountOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCountOutputTypeArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCountOutputTypeCountPostsArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCountOutputTypeSelect.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateManyInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateNestedOneWithoutPostsInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateNestedOneWithoutProfileInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateOrConnectWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateOrConnectWithoutProfileInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserCreateWithoutProfileInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserInclude.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserMaxAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserMaxOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserMinAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserMinOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserOrderByWithAggregationInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserOrderByWithRelationInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserScalarWhereWithAggregatesInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserSelect.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUncheckedCreateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUncheckedCreateWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUncheckedCreateWithoutProfileInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUncheckedUpdateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUncheckedUpdateManyInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUncheckedUpdateWithoutPostsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUncheckedUpdateWithoutProfileInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateManyMutationInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateOneRequiredWithoutPostsNestedInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateOneRequiredWithoutProfileNestedInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateToOneWithWhereWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateToOneWithWhereWithoutProfileInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateWithoutPostsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpdateWithoutProfileInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpsertWithoutPostsInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserUpsertWithoutProfileInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserWhereInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/MongoUserWhereUniqueInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedBoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedBoolWithAggregatesFilter.schema.ts +14 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedDateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedDateTimeWithAggregatesFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedIntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedIntNullableFilter.schema.ts +17 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedStringFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedStringNullableFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedStringNullableWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NestedStringWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/NullableStringFieldUpdateOperationsInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/StringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/StringFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/StringNullableFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/StringNullableWithAggregatesFilter.schema.ts +27 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/StringWithAggregatesFilter.schema.ts +26 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/aggregateMongoPostRaw.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/aggregateMongoProfileRaw.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/aggregateMongoUserRaw.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/findMongoPostRaw.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/findMongoProfileRaw.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/findMongoUserRaw.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/objects/index.ts +148 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostAggregateResult.schema.ts +26 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostCreateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostDeleteResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostFindFirstResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostFindManyResult.schema.ts +20 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostFindUniqueResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostGroupByResult.schema.ts +34 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostUpdateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoPostUpsertResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileAggregateResult.schema.ts +17 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileCreateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileDeleteResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileFindFirstResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileFindManyResult.schema.ts +17 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileFindUniqueResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileGroupByResult.schema.ts +22 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileUpdateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoProfileUpsertResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserAggregateResult.schema.ts +17 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserCreateResult.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserDeleteResult.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserFindFirstResult.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserFindManyResult.schema.ts +18 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserFindUniqueResult.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserGroupByResult.schema.ts +22 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserUpdateResult.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/MongoUserUpsertResult.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/results/index.ts +39 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/updateManyMongoPost.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/updateManyMongoProfile.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/updateManyMongoUser.schema.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/updateOneMongoPost.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/updateOneMongoProfile.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/updateOneMongoUser.schema.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/upsertOneMongoPost.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/upsertOneMongoProfile.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/upsertOneMongoUser.schema.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/index.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/input/MongoPost.input.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/input/MongoProfile.input.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/input/MongoUser.input.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/input/index.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/pure/MongoPost.pure.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/pure/MongoProfile.pure.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/pure/MongoUser.pure.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/pure/index.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/result/MongoPost.result.ts +13 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/result/MongoProfile.result.ts +10 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/result/MongoUser.result.ts +11 -0
- package/tests/multi-provider/schemas/mongodb/generated/schemas/variants/result/index.ts +8 -0
- package/tests/multi-provider/schemas/mongodb/prisma.config.mjs +8 -0
- package/tests/multi-provider/schemas/mongodb/schema.prisma +38 -0
- package/tests/multi-provider/schemas/mysql/generated/.prisma-zod-generator-manifest.json +210 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/aggregateMySQLPost.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/aggregateMySQLUser.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/countMySQLPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/countMySQLUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/createManyMySQLPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/createManyMySQLUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/createOneMySQLPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/createOneMySQLUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/deleteManyMySQLPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/deleteManyMySQLUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/deleteOneMySQLPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/deleteOneMySQLUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/enums/MySQLPostOrderByRelevanceFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/enums/MySQLPostScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/enums/MySQLUserOrderByRelevanceFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/enums/MySQLUserScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/enums/NullsOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/enums/SortOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/enums/TransactionIsolationLevel.schema.ts +5 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findFirstMySQLPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findFirstMySQLUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findFirstOrThrowMySQLPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findFirstOrThrowMySQLUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findManyMySQLPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findManyMySQLUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findUniqueMySQLPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findUniqueMySQLUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findUniqueOrThrowMySQLPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/findUniqueOrThrowMySQLUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/groupByMySQLPost.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/groupByMySQLUser.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/index.ts +75 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/BoolFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/BoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/BoolWithAggregatesFilter.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/DateTimeFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/DateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/DateTimeWithAggregatesFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/IntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/IntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/IntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/IntNullableWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/IntWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostAvgAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostAvgOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCountAggregateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCountOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCreateInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCreateManyAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCreateManyAuthorInputEnvelope.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCreateManyInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCreateOrConnectWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostCreateWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostInclude.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostListRelationFilter.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostMaxAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostMaxOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostMinAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostMinOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostOrderByRelationAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostOrderByRelevanceInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostOrderByWithAggregationInput.schema.ts +25 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostOrderByWithRelationInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostScalarWhereInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostScalarWhereWithAggregatesInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostSelect.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostSumAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostSumOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedCreateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedCreateWithoutAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedUpdateInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedUpdateManyInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedUpdateManyWithoutAuthorInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUncheckedUpdateWithoutAuthorInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUpdateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUpdateManyMutationInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUpdateManyWithWhereWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUpdateWithWhereUniqueWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUpdateWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostUpsertWithWhereUniqueWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostWhereInput.schema.ts +25 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLPostWhereUniqueInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserAvgAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserAvgOrderByAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCountAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCountOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCountOutputTypeArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCountOutputTypeCountPostsArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCountOutputTypeSelect.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCreateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCreateManyInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCreateNestedOneWithoutPostsInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCreateOrConnectWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserCreateWithoutPostsInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserInclude.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserMaxAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserMaxOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserMinAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserMinOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserNullableScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserOrderByRelevanceInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserOrderByWithAggregationInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserOrderByWithRelationInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserScalarWhereWithAggregatesInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserSelect.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserSumAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserSumOrderByAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUncheckedCreateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUncheckedCreateWithoutPostsInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUncheckedUpdateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUncheckedUpdateManyInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUncheckedUpdateWithoutPostsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUpdateInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUpdateManyMutationInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUpdateOneWithoutPostsNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUpdateToOneWithWhereWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUpdateWithoutPostsInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserUpsertWithoutPostsInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserWhereInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/MySQLUserWhereUniqueInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedBoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedBoolWithAggregatesFilter.schema.ts +14 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedDateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedDateTimeWithAggregatesFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedFloatFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedFloatNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedIntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedIntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedIntNullableWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedIntWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedStringFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedStringNullableFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedStringNullableWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NestedStringWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NullableIntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/NullableStringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/SortOrderInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/StringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/StringFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/StringNullableFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/StringNullableWithAggregatesFilter.schema.ts +25 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/StringWithAggregatesFilter.schema.ts +25 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/objects/index.ts +121 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostAggregateResult.schema.ts +34 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostCreateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostDeleteResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostFindFirstResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostFindManyResult.schema.ts +20 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostFindUniqueResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostGroupByResult.schema.ts +42 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostUpdateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLPostUpsertResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserAggregateResult.schema.ts +23 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserCreateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserDeleteResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserFindFirstResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserFindManyResult.schema.ts +17 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserFindUniqueResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserGroupByResult.schema.ts +28 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserUpdateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/MySQLUserUpsertResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/results/index.ts +26 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/updateManyMySQLPost.schema.ts +8 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/updateManyMySQLUser.schema.ts +8 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/updateOneMySQLPost.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/updateOneMySQLUser.schema.ts +11 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/upsertOneMySQLPost.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/upsertOneMySQLUser.schema.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/index.ts +8 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/input/MySQLPost.input.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/input/MySQLUser.input.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/input/index.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/pure/MySQLPost.pure.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/pure/MySQLUser.pure.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/pure/index.ts +7 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/result/MySQLPost.result.ts +13 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/result/MySQLUser.result.ts +10 -0
- package/tests/multi-provider/schemas/mysql/generated/schemas/variants/result/index.ts +7 -0
- package/tests/multi-provider/schemas/mysql/prisma.config.mjs +8 -0
- package/tests/multi-provider/schemas/mysql/schema.prisma +30 -0
- package/tests/multi-provider/schemas/postgresql/generated/.prisma-zod-generator-manifest.json +319 -0
- package/tests/multi-provider/schemas/postgresql/generated/helpers/json-helpers.ts +28 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/aggregatePostgreSQLPost.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/aggregatePostgreSQLProfile.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/aggregatePostgreSQLUser.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/countPostgreSQLPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/countPostgreSQLProfile.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/countPostgreSQLUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createManyAndReturnPostgreSQLPost.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createManyAndReturnPostgreSQLProfile.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createManyAndReturnPostgreSQLUser.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createManyPostgreSQLPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createManyPostgreSQLProfile.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createManyPostgreSQLUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createOnePostgreSQLPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createOnePostgreSQLProfile.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/createOnePostgreSQLUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/deleteManyPostgreSQLPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/deleteManyPostgreSQLProfile.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/deleteManyPostgreSQLUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/deleteOnePostgreSQLPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/deleteOnePostgreSQLProfile.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/deleteOnePostgreSQLUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/JsonNullValueFilter.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/NullableJsonNullValueInput.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/NullsOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/PostgreSQLPostScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/PostgreSQLProfileScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/PostgreSQLUserRole.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/PostgreSQLUserScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/QueryMode.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/SortOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/enums/TransactionIsolationLevel.schema.ts +5 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findFirstOrThrowPostgreSQLPost.schema.ts +43 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findFirstOrThrowPostgreSQLProfile.schema.ts +29 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findFirstOrThrowPostgreSQLUser.schema.ts +41 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findFirstPostgreSQLPost.schema.ts +43 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findFirstPostgreSQLProfile.schema.ts +29 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findFirstPostgreSQLUser.schema.ts +41 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findManyPostgreSQLPost.schema.ts +43 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findManyPostgreSQLProfile.schema.ts +29 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findManyPostgreSQLUser.schema.ts +41 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findUniqueOrThrowPostgreSQLPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findUniqueOrThrowPostgreSQLProfile.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findUniqueOrThrowPostgreSQLUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findUniquePostgreSQLPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findUniquePostgreSQLProfile.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/findUniquePostgreSQLUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/groupByPostgreSQLPost.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/groupByPostgreSQLProfile.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/groupByPostgreSQLUser.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/index.ts +115 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BigIntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BigIntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BigIntWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BoolFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BoolWithAggregatesFilter.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BytesNullableFilter.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/BytesNullableWithAggregatesFilter.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/DateTimeFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/DateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/DateTimeWithAggregatesFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/EnumPostgreSQLUserRoleNullableFilter.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/EnumPostgreSQLUserRoleNullableWithAggregatesFilter.schema.ts +18 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/IntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/IntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/IntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/IntNullableListFilter.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/IntNullableWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/IntWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/JsonNullableFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/JsonNullableWithAggregatesFilter.schema.ts +29 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedBigIntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedBigIntWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedBoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedBoolWithAggregatesFilter.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedBytesNullableFilter.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedBytesNullableWithAggregatesFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedDateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedDateTimeWithAggregatesFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedEnumPostgreSQLUserRoleNullableFilter.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedEnumPostgreSQLUserRoleNullableWithAggregatesFilter.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedFloatFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedFloatNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedIntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedIntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedIntNullableWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedIntWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedJsonNullableFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedStringFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedStringNullableFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedStringNullableWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NestedStringWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NullableBytesFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NullableEnumPostgreSQLUserRoleFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NullableIntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/NullableStringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostAvgAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostAvgOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCountAggregateInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCountOrderByAggregateInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCreateInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCreateManyAuthorInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCreateManyAuthorInputEnvelope.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCreateManyInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCreateOrConnectWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostCreateWithoutAuthorInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostInclude.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostListRelationFilter.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostMaxAggregateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostMaxOrderByAggregateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostMinAggregateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostMinOrderByAggregateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostOrderByRelationAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostOrderByWithAggregationInput.schema.ts +29 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostOrderByWithRelationInput.schema.ts +21 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostScalarWhereInput.schema.ts +29 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostScalarWhereWithAggregatesInput.schema.ts +29 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostSelect.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostSumAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostSumOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedCreateInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedCreateWithoutAuthorInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedUpdateInput.schema.ts +28 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedUpdateManyInput.schema.ts +28 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedUpdateManyWithoutAuthorInput.schema.ts +26 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUncheckedUpdateWithoutAuthorInput.schema.ts +26 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUpdateInput.schema.ts +26 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUpdateManyMutationInput.schema.ts +24 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUpdateManyWithWhereWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUpdateWithWhereUniqueWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUpdateWithoutAuthorInput.schema.ts +24 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostUpsertWithWhereUniqueWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostWhereInput.schema.ts +32 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLPostWhereUniqueInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileAvgAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileAvgOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileCountAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileCountOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileCreateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileCreateManyInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileCreateNestedOneWithoutUserInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileCreateOrConnectWithoutUserInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileCreateWithoutUserInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileInclude.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileMaxAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileMaxOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileMinAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileMinOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileNullableScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileOrderByWithAggregationInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileOrderByWithRelationInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileScalarWhereWithAggregatesInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileSelect.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileSumAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileSumOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUncheckedCreateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUncheckedCreateNestedOneWithoutUserInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUncheckedCreateWithoutUserInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUncheckedUpdateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUncheckedUpdateManyInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUncheckedUpdateOneWithoutUserNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUncheckedUpdateWithoutUserInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUpdateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUpdateManyMutationInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUpdateOneWithoutUserNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUpdateToOneWithWhereWithoutUserInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUpdateWithoutUserInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileUpsertWithoutUserInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileWhereInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLProfileWhereUniqueInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserAvgAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserAvgOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCountAggregateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCountOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCountOutputTypeArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCountOutputTypeCountPostsArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCountOutputTypeSelect.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateManyInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateNestedOneWithoutPostsInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateNestedOneWithoutProfileInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateOrConnectWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateOrConnectWithoutProfileInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateWithoutPostsInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreateWithoutProfileInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreatescoresInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserCreatetagsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserInclude.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserMaxAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserMaxOrderByAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserMinAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserMinOrderByAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserNullableScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserOrderByWithAggregationInput.schema.ts +25 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserOrderByWithRelationInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserScalarWhereWithAggregatesInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserSelect.schema.ts +19 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserSumAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserSumOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUncheckedCreateInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUncheckedCreateWithoutPostsInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUncheckedCreateWithoutProfileInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUncheckedUpdateInput.schema.ts +24 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUncheckedUpdateManyInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUncheckedUpdateWithoutPostsInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUncheckedUpdateWithoutProfileInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateManyMutationInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateOneRequiredWithoutProfileNestedInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateOneWithoutPostsNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateToOneWithWhereWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateToOneWithWhereWithoutProfileInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateWithoutPostsInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdateWithoutProfileInput.schema.ts +20 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdatescoresInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpdatetagsInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpsertWithoutPostsInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserUpsertWithoutProfileInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserWhereInput.schema.ts +28 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/PostgreSQLUserWhereUniqueInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/SortOrderInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/StringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/StringFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/StringNullableFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/StringNullableListFilter.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/StringNullableWithAggregatesFilter.schema.ts +26 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/StringWithAggregatesFilter.schema.ts +26 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/objects/index.ts +190 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostAggregateResult.schema.ts +46 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostCreateResult.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostDeleteResult.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostFindFirstResult.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostFindManyResult.schema.ts +24 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostFindUniqueResult.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostGroupByResult.schema.ts +58 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostUpdateResult.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLPostUpsertResult.schema.ts +14 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileAggregateResult.schema.ts +25 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileCreateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileDeleteResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileFindFirstResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileFindManyResult.schema.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileFindUniqueResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileGroupByResult.schema.ts +30 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileUpdateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLProfileUpsertResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserAggregateResult.schema.ts +30 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserCreateResult.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserDeleteResult.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserFindFirstResult.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserFindManyResult.schema.ts +21 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserFindUniqueResult.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserGroupByResult.schema.ts +38 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserUpdateResult.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/PostgreSQLUserUpsertResult.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/results/index.ts +39 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateManyAndReturnPostgreSQLPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateManyAndReturnPostgreSQLProfile.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateManyAndReturnPostgreSQLUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateManyPostgreSQLPost.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateManyPostgreSQLProfile.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateManyPostgreSQLUser.schema.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateOnePostgreSQLPost.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateOnePostgreSQLProfile.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/updateOnePostgreSQLUser.schema.ts +11 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/upsertOnePostgreSQLPost.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/upsertOnePostgreSQLProfile.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/upsertOnePostgreSQLUser.schema.ts +13 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/index.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/input/PostgreSQLPost.input.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/input/PostgreSQLProfile.input.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/input/PostgreSQLUser.input.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/input/index.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/pure/PostgreSQLPost.pure.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/pure/PostgreSQLProfile.pure.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/pure/PostgreSQLUser.pure.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/pure/index.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/result/PostgreSQLPost.result.ts +17 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/result/PostgreSQLProfile.result.ts +10 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/result/PostgreSQLUser.result.ts +15 -0
- package/tests/multi-provider/schemas/postgresql/generated/schemas/variants/result/index.ts +8 -0
- package/tests/multi-provider/schemas/postgresql/prisma.config.mjs +8 -0
- package/tests/multi-provider/schemas/postgresql/schema.prisma +50 -0
- package/tests/multi-provider/schemas/sqlite/generated/.prisma-zod-generator-manifest.json +206 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/aggregateSQLitePost.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/aggregateSQLiteUser.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/countSQLitePost.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/countSQLiteUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/createManySQLitePost.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/createManySQLiteUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/createOneSQLitePost.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/createOneSQLiteUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/deleteManySQLitePost.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/deleteManySQLiteUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/deleteOneSQLitePost.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/deleteOneSQLiteUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/enums/NullsOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/enums/SQLitePostScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/enums/SQLiteUserScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/enums/SortOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/enums/TransactionIsolationLevel.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findFirstOrThrowSQLitePost.schema.ts +35 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findFirstOrThrowSQLiteUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findFirstSQLitePost.schema.ts +35 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findFirstSQLiteUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findManySQLitePost.schema.ts +35 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findManySQLiteUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findUniqueOrThrowSQLitePost.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findUniqueOrThrowSQLiteUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findUniqueSQLitePost.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/findUniqueSQLiteUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/groupBySQLitePost.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/groupBySQLiteUser.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/index.ts +73 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/BoolFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/BoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/BoolWithAggregatesFilter.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/DateTimeFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/DateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/DateTimeWithAggregatesFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/IntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/IntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/IntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/IntNullableWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/IntWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedBoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedBoolWithAggregatesFilter.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedDateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedDateTimeWithAggregatesFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedFloatFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedFloatNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedIntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedIntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedIntNullableWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedIntWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedStringFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedStringNullableFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedStringNullableWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NestedStringWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NullableIntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/NullableStringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostAvgAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostAvgOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCountAggregateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCountOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCreateInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCreateManyAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCreateManyAuthorInputEnvelope.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCreateManyInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCreateOrConnectWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostCreateWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostInclude.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostListRelationFilter.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostMaxAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostMaxOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostMinAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostMinOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostOrderByRelationAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostOrderByWithAggregationInput.schema.ts +25 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostOrderByWithRelationInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostScalarWhereInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostScalarWhereWithAggregatesInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostSelect.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostSumAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostSumOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedCreateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedCreateWithoutAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedUpdateInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedUpdateManyInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedUpdateManyWithoutAuthorInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUncheckedUpdateWithoutAuthorInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUpdateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUpdateManyMutationInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUpdateManyWithWhereWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUpdateWithWhereUniqueWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUpdateWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostUpsertWithWhereUniqueWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostWhereInput.schema.ts +25 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLitePostWhereUniqueInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserAvgAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserAvgOrderByAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCountAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCountOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCountOutputTypeArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCountOutputTypeCountPostsArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCountOutputTypeSelect.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCreateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCreateManyInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCreateNestedOneWithoutPostsInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCreateOrConnectWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserCreateWithoutPostsInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserInclude.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserMaxAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserMaxOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserMinAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserMinOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserNullableScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserOrderByWithAggregationInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserOrderByWithRelationInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserScalarWhereWithAggregatesInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserSelect.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserSumAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserSumOrderByAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUncheckedCreateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUncheckedCreateWithoutPostsInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUncheckedUpdateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUncheckedUpdateManyInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUncheckedUpdateWithoutPostsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUpdateInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUpdateManyMutationInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUpdateOneWithoutPostsNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUpdateToOneWithWhereWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUpdateWithoutPostsInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserUpsertWithoutPostsInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserWhereInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SQLiteUserWhereUniqueInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/SortOrderInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/StringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/StringFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/StringNullableFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/StringNullableWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/StringWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/objects/index.ts +119 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostAggregateResult.schema.ts +34 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostCreateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostDeleteResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostFindFirstResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostFindManyResult.schema.ts +20 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostFindUniqueResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostGroupByResult.schema.ts +42 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostUpdateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLitePostUpsertResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserAggregateResult.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserCreateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserDeleteResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserFindFirstResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserFindManyResult.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserFindUniqueResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserGroupByResult.schema.ts +28 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserUpdateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/SQLiteUserUpsertResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/results/index.ts +26 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/updateManySQLitePost.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/updateManySQLiteUser.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/updateOneSQLitePost.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/updateOneSQLiteUser.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/upsertOneSQLitePost.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/upsertOneSQLiteUser.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/index.ts +8 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/input/SQLitePost.input.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/input/SQLiteUser.input.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/input/index.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/pure/SQLitePost.pure.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/pure/SQLiteUser.pure.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/pure/index.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/result/SQLitePost.result.ts +13 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/result/SQLiteUser.result.ts +10 -0
- package/tests/multi-provider/schemas/sqlite/generated/schemas/variants/result/index.ts +7 -0
- package/tests/multi-provider/schemas/sqlite/prisma.config.mjs +8 -0
- package/tests/multi-provider/schemas/sqlite/schema.prisma +30 -0
- package/tests/multi-provider/schemas/sqlserver/generated/.prisma-zod-generator-manifest.json +206 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/aggregateSQLServerPost.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/aggregateSQLServerUser.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/countSQLServerPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/countSQLServerUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/createManySQLServerPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/createManySQLServerUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/createOneSQLServerPost.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/createOneSQLServerUser.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/deleteManySQLServerPost.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/deleteManySQLServerUser.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/deleteOneSQLServerPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/deleteOneSQLServerUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/enums/NullsOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/enums/SQLServerPostScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/enums/SQLServerUserScalarFieldEnum.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/enums/SortOrder.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/enums/TransactionIsolationLevel.schema.ts +5 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findFirstOrThrowSQLServerPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findFirstOrThrowSQLServerUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findFirstSQLServerPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findFirstSQLServerUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findManySQLServerPost.schema.ts +35 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findManySQLServerUser.schema.ts +32 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findUniqueOrThrowSQLServerPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findUniqueOrThrowSQLServerUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findUniqueSQLServerPost.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/findUniqueSQLServerUser.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/groupBySQLServerPost.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/groupBySQLServerUser.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/index.ts +73 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/BoolFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/BoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/BoolWithAggregatesFilter.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/DateTimeFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/DateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/DateTimeWithAggregatesFilter.schema.ts +21 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/IntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/IntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/IntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/IntNullableWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/IntWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedBoolFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedBoolWithAggregatesFilter.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedDateTimeFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedDateTimeWithAggregatesFilter.schema.ts +20 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedFloatFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedFloatNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedIntFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedIntNullableFilter.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedIntNullableWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedIntWithAggregatesFilter.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedStringFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedStringNullableFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedStringNullableWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NestedStringWithAggregatesFilter.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NullableIntFieldUpdateOperationsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/NullableStringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostAvgAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostAvgOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCountAggregateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCountOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCreateInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCreateManyAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCreateManyAuthorInputEnvelope.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCreateManyInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCreateOrConnectWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostCreateWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostInclude.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostListRelationFilter.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostMaxAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostMaxOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostMinAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostMinOrderByAggregateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostOrderByRelationAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostOrderByWithAggregationInput.schema.ts +25 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostOrderByWithRelationInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostScalarWhereInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostScalarWhereWithAggregatesInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostSelect.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostSumAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostSumOrderByAggregateInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedCreateInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedCreateNestedManyWithoutAuthorInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedCreateWithoutAuthorInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedUpdateInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedUpdateManyInput.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedUpdateManyWithoutAuthorInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUncheckedUpdateWithoutAuthorInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUpdateInput.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUpdateManyMutationInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUpdateManyWithWhereWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUpdateManyWithoutAuthorNestedInput.schema.ts +27 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUpdateWithWhereUniqueWithoutAuthorInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUpdateWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostUpsertWithWhereUniqueWithoutAuthorInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostWhereInput.schema.ts +25 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerPostWhereUniqueInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserArgs.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserAvgAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserAvgOrderByAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCountAggregateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCountOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCountOutputTypeArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCountOutputTypeCountPostsArgs.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCountOutputTypeSelect.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCreateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCreateManyInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCreateNestedOneWithoutPostsInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCreateOrConnectWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserCreateWithoutPostsInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserInclude.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserMaxAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserMaxOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserMinAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserMinOrderByAggregateInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserNullableScalarRelationFilter.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserOrderByWithAggregationInput.schema.ts +22 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserOrderByWithRelationInput.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserScalarWhereWithAggregatesInput.schema.ts +16 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserSelect.schema.ts +14 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserSumAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserSumOrderByAggregateInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUncheckedCreateInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUncheckedCreateWithoutPostsInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUncheckedUpdateInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUncheckedUpdateManyInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUncheckedUpdateWithoutPostsInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUpdateInput.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUpdateManyMutationInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUpdateOneWithoutPostsNestedInput.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUpdateToOneWithWhereWithoutPostsInput.schema.ts +12 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUpdateWithoutPostsInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserUpsertWithoutPostsInput.schema.ts +15 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserWhereInput.schema.ts +18 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SQLServerUserWhereUniqueInput.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/SortOrderInput.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/StringFieldUpdateOperationsInput.schema.ts +9 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/StringFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/StringNullableFilter.schema.ts +19 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/StringNullableWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/StringWithAggregatesFilter.schema.ts +24 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/objects/index.ts +119 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostAggregateResult.schema.ts +34 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostCreateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostDeleteResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostFindFirstResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostFindManyResult.schema.ts +20 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostFindUniqueResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostGroupByResult.schema.ts +42 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostUpdateResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerPostUpsertResult.schema.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserAggregateResult.schema.ts +23 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserCountResult.schema.ts +2 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserCreateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserCreateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserDeleteManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserDeleteResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserFindFirstResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserFindManyResult.schema.ts +17 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserFindUniqueResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserGroupByResult.schema.ts +28 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserUpdateManyResult.schema.ts +4 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserUpdateResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/SQLServerUserUpsertResult.schema.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/results/index.ts +26 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/updateManySQLServerPost.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/updateManySQLServerUser.schema.ts +8 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/updateOneSQLServerPost.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/updateOneSQLServerUser.schema.ts +11 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/upsertOneSQLServerPost.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/upsertOneSQLServerUser.schema.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/index.ts +8 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/input/SQLServerPost.input.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/input/SQLServerUser.input.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/input/index.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/pure/SQLServerPost.pure.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/pure/SQLServerUser.pure.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/pure/index.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/result/SQLServerPost.result.ts +13 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/result/SQLServerUser.result.ts +10 -0
- package/tests/multi-provider/schemas/sqlserver/generated/schemas/variants/result/index.ts +7 -0
- package/tests/multi-provider/schemas/sqlserver/prisma.config.mjs +8 -0
- package/tests/multi-provider/schemas/sqlserver/schema.prisma +30 -0
- package/tests/naming-customization.test.ts +598 -0
- package/tests/naming-presets-and-emit-controls.test.ts +222 -0
- package/tests/non-ts-artifact-writes.test.ts +87 -0
- package/tests/operation-exclusion.test.ts +587 -0
- package/tests/optional-nullable-behavior.test.ts +140 -0
- package/tests/orderby-zod-annotations.test.ts +201 -0
- package/tests/parse-custom-imports.test.ts +64 -0
- package/tests/prettier-config-resolution.test.ts +74 -0
- package/tests/prisma-client-esm-config.test.ts +879 -0
- package/tests/prisma-client-full-matrix.test.ts +139 -0
- package/tests/prisma-client-path-override.test.ts +136 -0
- package/tests/prisma-client-preview-options.test.ts +135 -0
- package/tests/pro-api-docs-options.test.ts +390 -0
- package/tests/pro-api-docs-path-consistency.test.ts +127 -0
- package/tests/pro-cli-plumbing.test.ts +145 -0
- package/tests/pro-config-parsing.test.ts +146 -0
- package/tests/pro-contract-testing.test.ts +330 -0
- package/tests/pro-data-factories.test.ts +266 -0
- package/tests/pro-dev-bypass.test.ts +79 -0
- package/tests/pro-drift-guard-cli.test.ts +158 -0
- package/tests/pro-drift-guard-report.test.ts +286 -0
- package/tests/pro-emitted-output-compiles.test.ts +290 -0
- package/tests/pro-form-ux-libraries.test.ts +499 -0
- package/tests/pro-license-messaging.test.ts +71 -0
- package/tests/pro-model-filtering.test.ts +132 -0
- package/tests/pro-multi-tenant.test.ts +296 -0
- package/tests/pro-option-validation.test.ts +568 -0
- package/tests/pro-performance-pack.test.ts +709 -0
- package/tests/pro-policies.test.ts +620 -0
- package/tests/pro-postgres-rls.test.ts +262 -0
- package/tests/pro-sdk-publisher.test.ts +570 -0
- package/tests/pro-server-actions.test.ts +355 -0
- package/tests/pro-ui-output-compiles.test.ts +285 -0
- package/tests/pure-models-lean-and-datetime.test.ts +149 -0
- package/tests/pure-models-zod-v4-recursion.test.ts +76 -0
- package/tests/pure-models.test.ts +1877 -0
- package/tests/pzg-skip-env-var.test.ts +89 -0
- package/tests/recipes.test.ts +62 -0
- package/tests/result-nullable-columns.test.ts +180 -0
- package/tests/result-schemas.test.ts +992 -0
- package/tests/safe-output-smart-cleanup.test.ts +105 -0
- package/tests/safety-config-resolver.test.ts +130 -0
- package/tests/schema-test-utils.ts +280 -0
- package/tests/schema-variants.test.ts +1708 -0
- package/tests/select-substring-zod-annotations.test.ts +180 -0
- package/tests/single-file-aggregator.test.ts +128 -0
- package/tests/single-file-mode.test.ts +309 -0
- package/tests/single-file-zod-versions.test.ts +221 -0
- package/tests/snake-case-aggregate-fix.test.ts +486 -0
- package/tests/strict-mode.test.ts +602 -0
- package/tests/transformer-max-constraint.test.ts +25 -0
- package/tests/tsconfig.test.json +26 -0
- package/tests/typecheck-fixtures/README.md +40 -0
- package/tests/typecheck-fixtures/package.json +31 -0
- package/tests/typecheck-fixtures/pnpm-lock.yaml +5114 -0
- package/tests/typed-json-annotation-parser.test.ts +188 -0
- package/tests/typed-json-config.test.ts +252 -0
- package/tests/typed-json-corpus-conformance.test.ts +1871 -0
- package/tests/typed-json-emission.test.ts +801 -0
- package/tests/typed-json-inner-optionality.test.ts +337 -0
- package/tests/typed-json-list-wrappers.test.ts +334 -0
- package/tests/typed-json-namespace.test.ts +633 -0
- package/tests/typed-json-pjtg-corpus.test.ts +530 -0
- package/tests/typed-json-resolver.test.ts +403 -0
- package/tests/typed-json-results.test.ts +564 -0
- package/tests/typed-json-top-level-optionality.test.ts +364 -0
- package/tests/typed-json-ts-type-to-zod.test.ts +469 -0
- package/tests/typed-json-update-operations-collision.test.ts +177 -0
- package/tests/typed-json-update-operations-compile.test.ts +138 -0
- package/tests/typed-json-update-operations.test.ts +314 -0
- package/tests/typed-json-variants.test.ts +248 -0
- package/tests/typescript-inference-lazy-relations.test.ts +142 -0
- package/tests/unchecked-model-name-collision.test.ts +128 -0
- package/tests/upsell-banner.test.ts +203 -0
- package/tests/upstream-mongodb-raw-ops.test.ts +50 -0
- package/tests/variant-input-result-enum.test.ts +62 -0
- package/tests/variant-pure-enum.test.ts +48 -0
- package/tests/write-failures-are-not-swallowed.test.ts +37 -0
- package/tests/zod-coerce-validators.test.ts +103 -0
- package/tests/zod-comments.test.ts +3415 -0
- package/tests/zod-custom-use-more.test.ts +90 -0
- package/tests/zod-custom-use.test.ts +51 -0
- package/tests/zod-imports.test.ts +71 -0
- package/tsconfig.json +25 -0
- package/vitest.config.ts +91 -0
- package/website/README.md +30 -0
- package/website/docs/changelog.md +15 -0
- package/website/docs/config/datetime-strategy.md +281 -0
- package/website/docs/config/dual-exports.md +85 -0
- package/website/docs/config/emission-controls.md +19 -0
- package/website/docs/config/file-layout.md +28 -0
- package/website/docs/config/filtering.md +66 -0
- package/website/docs/config/json-schema-compatibility.md +450 -0
- package/website/docs/config/modes.md +48 -0
- package/website/docs/config/naming.md +177 -0
- package/website/docs/config/optional-fields.md +193 -0
- package/website/docs/config/precedence.md +68 -0
- package/website/docs/config/schema-json.md +68 -0
- package/website/docs/config/strict-mode.md +503 -0
- package/website/docs/config/variants.md +98 -0
- package/website/docs/contributing.md +63 -0
- package/website/docs/features/api-docs.md +187 -0
- package/website/docs/features/contracts.md +152 -0
- package/website/docs/features/factories.md +161 -0
- package/website/docs/features/forms.md +241 -0
- package/website/docs/features/guard.md +86 -0
- package/website/docs/features/multi-tenant.md +158 -0
- package/website/docs/features/overview.md +292 -0
- package/website/docs/features/performance.md +176 -0
- package/website/docs/features/policies.md +287 -0
- package/website/docs/features/postgres-rls.md +198 -0
- package/website/docs/features/sdk.md +211 -0
- package/website/docs/features/server-actions.md +164 -0
- package/website/docs/integrations/overview.md +30 -0
- package/website/docs/integrations/prisma-json-types-generator.md +408 -0
- package/website/docs/intro/concepts.md +61 -0
- package/website/docs/intro/quick-start.md +142 -0
- package/website/docs/intro/what-is.md +97 -0
- package/website/docs/performance.md +49 -0
- package/website/docs/pipeline/mongodb.md +195 -0
- package/website/docs/pipeline/objects-crud.md +35 -0
- package/website/docs/pipeline/pure-models.md +30 -0
- package/website/docs/pipeline/result-schemas.md +199 -0
- package/website/docs/pipeline/select-include.md +192 -0
- package/website/docs/pipeline/single-file.md +25 -0
- package/website/docs/pipeline/special-types.md +129 -0
- package/website/docs/pipeline/zod-comments.md +926 -0
- package/website/docs/recipes/circular-dependency-exclusion.md +151 -0
- package/website/docs/recipes/crud-only.md +31 -0
- package/website/docs/recipes/flexible-api-validation.md +244 -0
- package/website/docs/recipes/granular-per-model.md +37 -0
- package/website/docs/recipes/hide-fields.md +58 -0
- package/website/docs/recipes/input-only.md +59 -0
- package/website/docs/recipes/json-friendly-datetime.md +94 -0
- package/website/docs/recipes/minimal-crud.md +61 -0
- package/website/docs/recipes/models-only.md +38 -0
- package/website/docs/recipes/nodenext-imports.md +62 -0
- package/website/docs/recipes/optional-field-control.md +175 -0
- package/website/docs/recipes/pure-models-lean.md +48 -0
- package/website/docs/recipes/result-only.md +53 -0
- package/website/docs/recipes/safety-custom-configuration.md +351 -0
- package/website/docs/recipes/safety-disable-completely.md +113 -0
- package/website/docs/recipes/safety-force-dangerous-path.md +247 -0
- package/website/docs/recipes/safety-project-migration.md +341 -0
- package/website/docs/recipes/single-file.md +38 -0
- package/website/docs/recipes/trpc-optimized.md +45 -0
- package/website/docs/recipes/zod-import-targets.md +71 -0
- package/website/docs/reference/bytes-json.md +57 -0
- package/website/docs/reference/config-options.md +259 -0
- package/website/docs/reference/default-values.md +176 -0
- package/website/docs/reference/faq.md +98 -0
- package/website/docs/reference/logging-debug.md +59 -0
- package/website/docs/reference/naming-preset-map.md +15 -0
- package/website/docs/reference/pro-cli.md +517 -0
- package/website/docs/reference/safety-system.md +571 -0
- package/website/docs/reference/troubleshooting.md +470 -0
- package/website/docs/reference/where-unique-input.md +57 -0
- package/website/docs/upgrade/pro-migration.md +701 -0
- package/website/docs/upgrade/v3-breaking-changes.md +117 -0
- package/website/docs/upgrade-guide.md +44 -0
- package/website/docs/usage-patterns.md +43 -0
- package/website/docusaurus.config.ts +132 -0
- package/website/package.json +34 -0
- package/website/pnpm-lock.yaml +11207 -0
- package/website/scripts/build-metrics.js +109 -0
- package/website/sidebars.ts +130 -0
- package/website/src/components/FreeTierBanner.module.css +130 -0
- package/website/src/components/FreeTierBanner.tsx +40 -0
- package/website/src/components/Icons.tsx +31 -0
- package/website/src/components/PricingCard.module.css +141 -0
- package/website/src/components/PricingCard.tsx +68 -0
- package/website/src/css/custom.css +940 -0
- package/website/src/data/metrics.json +6 -0
- package/website/src/pages/index.tsx +719 -0
- package/website/src/pages/pricing.module.css +377 -0
- package/website/src/pages/pricing.tsx +604 -0
- package/website/static/img/brand/apple-icon-180.png +0 -0
- package/website/static/img/brand/favicon-16x16.png +0 -0
- package/website/static/img/brand/favicon-24x24.png +0 -0
- package/website/static/img/brand/favicon-32x32.png +0 -0
- package/website/static/img/brand/favicon.ico +0 -0
- package/website/static/img/brand/icon-1024.png +0 -0
- package/website/static/img/brand/icon-128.png +0 -0
- package/website/static/img/brand/icon-16.png +0 -0
- package/website/static/img/brand/icon-180.png +0 -0
- package/website/static/img/brand/icon-192.png +0 -0
- package/website/static/img/brand/icon-24.png +0 -0
- package/website/static/img/brand/icon-256.png +0 -0
- package/website/static/img/brand/icon-32.png +0 -0
- package/website/static/img/brand/icon-48.png +0 -0
- package/website/static/img/brand/icon-512.png +0 -0
- package/website/static/img/brand/icon-64.png +0 -0
- package/website/static/img/brand/icon-96.png +0 -0
- package/website/static/img/brand/icon-manifest.json +25 -0
- package/website/static/img/brand/icon-master.png +0 -0
- package/website/static/img/brand/pwa-icon-192.png +0 -0
- package/website/static/img/brand/pwa-icon-512.png +0 -0
- package/website/static/img/brand/pzg-icon-512.png +0 -0
- package/website/static/img/tiers.png +0 -0
|
@@ -0,0 +1,4436 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const typed_json_1 = require("./config/typed-json");
|
|
8
|
+
const results_1 = require("./generators/results");
|
|
9
|
+
const helpers_1 = require("./helpers");
|
|
10
|
+
const decimal_helpers_1 = require("./helpers/decimal-helpers");
|
|
11
|
+
const model_helpers_1 = require("./helpers/model-helpers");
|
|
12
|
+
const zod_integration_1 = require("./helpers/zod-integration");
|
|
13
|
+
const emission_1 = require("./typed-json/emission");
|
|
14
|
+
const resolver_1 = require("./typed-json/resolver");
|
|
15
|
+
const typed_field_update_operations_1 = require("./generators/typed-field-update-operations");
|
|
16
|
+
const logger_1 = require("./utils/logger");
|
|
17
|
+
const naming_resolver_1 = require("./utils/naming-resolver");
|
|
18
|
+
const singleFileAggregator_1 = require("./utils/singleFileAggregator");
|
|
19
|
+
const strict_mode_resolver_1 = require("./utils/strict-mode-resolver");
|
|
20
|
+
const writeFileSafely_1 = require("./utils/writeFileSafely");
|
|
21
|
+
const writeIndexFile_1 = require("./utils/writeIndexFile");
|
|
22
|
+
/**
|
|
23
|
+
* Placeholder a typed-JSON replacement is swapped for while the optionality strips run
|
|
24
|
+
* over a composed property line. NUL cannot appear in a Zod expression the generator
|
|
25
|
+
* writes or a user configures, so the mask can never collide with real emitted text.
|
|
26
|
+
*/
|
|
27
|
+
const TYPED_JSON_MASK = '\u0000pzgTypedJson';
|
|
28
|
+
/**
|
|
29
|
+
* A run of optionality markers at the very end of a typed-JSON replacement.
|
|
30
|
+
*
|
|
31
|
+
* Anchored at the end on purpose: where the marker sits is the whole boundary between
|
|
32
|
+
* one the emitter decides and one the annotation decides. See `typedJsonSlotExpression`.
|
|
33
|
+
*/
|
|
34
|
+
const TYPED_JSON_TRAILING_OPTIONALITY = /(?:\.(?:optional|nullable|nullish)\(\))+$/;
|
|
35
|
+
class Transformer {
|
|
36
|
+
// Lightweight helpers to safely access optional JSON Schema compatibility settings
|
|
37
|
+
static isJsonSchemaModeEnabled() {
|
|
38
|
+
const cfg = this.getGeneratorConfig();
|
|
39
|
+
return !!(cfg === null || cfg === void 0 ? void 0 : cfg.jsonSchemaCompatible);
|
|
40
|
+
}
|
|
41
|
+
static getJsonSchemaOptions() {
|
|
42
|
+
var _a;
|
|
43
|
+
const cfg = this.getGeneratorConfig();
|
|
44
|
+
return ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.jsonSchemaOptions) !== null && _a !== void 0 ? _a : {});
|
|
45
|
+
}
|
|
46
|
+
constructor(params) {
|
|
47
|
+
var _a, _b, _c, _d, _e, _f;
|
|
48
|
+
this.schemaImports = new Set();
|
|
49
|
+
this.hasJson = false;
|
|
50
|
+
this.hasDecimal = false;
|
|
51
|
+
// Track excluded field names for current object generation to inform typed Omit
|
|
52
|
+
this.lastExcludedFieldNames = null;
|
|
53
|
+
this.name = (_a = params.name) !== null && _a !== void 0 ? _a : '';
|
|
54
|
+
this.fields = (_b = params.fields) !== null && _b !== void 0 ? _b : [];
|
|
55
|
+
this.models = (_c = params.models) !== null && _c !== void 0 ? _c : [];
|
|
56
|
+
this.modelOperations = (_d = params.modelOperations) !== null && _d !== void 0 ? _d : [];
|
|
57
|
+
this.enumTypes = (_e = params.enumTypes) !== null && _e !== void 0 ? _e : [];
|
|
58
|
+
// Process models with Zod integration on initialization
|
|
59
|
+
const generatorConfig = Transformer.getGeneratorConfig();
|
|
60
|
+
const zodVersion = ((_f = generatorConfig === null || generatorConfig === void 0 ? void 0 : generatorConfig.zodImportTarget) !== null && _f !== void 0 ? _f : 'auto');
|
|
61
|
+
this.enhancedModels = (0, zod_integration_1.processModelsWithZodIntegration)(this.models, {
|
|
62
|
+
enableZodAnnotations: true,
|
|
63
|
+
generateFallbackSchemas: true,
|
|
64
|
+
validateTypeCompatibility: true,
|
|
65
|
+
collectDetailedErrors: true,
|
|
66
|
+
zodVersion: zodVersion,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
static setOutputPath(outPath) {
|
|
70
|
+
this.outputPath = outPath;
|
|
71
|
+
}
|
|
72
|
+
static setIsGenerateSelect(isGenerateSelect) {
|
|
73
|
+
this.isGenerateSelect = isGenerateSelect;
|
|
74
|
+
}
|
|
75
|
+
static setIsGenerateInclude(isGenerateInclude) {
|
|
76
|
+
this.isGenerateInclude = isGenerateInclude;
|
|
77
|
+
}
|
|
78
|
+
// Configuration setters
|
|
79
|
+
static setGeneratorConfig(config) {
|
|
80
|
+
this.generatorConfig = config;
|
|
81
|
+
this.strictModeResolver = (0, strict_mode_resolver_1.createStrictModeResolver)(config);
|
|
82
|
+
}
|
|
83
|
+
static getGeneratorConfig() {
|
|
84
|
+
return this.generatorConfig;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* The `typedJson` block with its defaults filled in, or `null` when the user did not
|
|
88
|
+
* configure it.
|
|
89
|
+
*
|
|
90
|
+
* `null` is load-bearing: it is what keeps output byte-identical to 3.0.0 for every
|
|
91
|
+
* configuration that omits the key. Read it, never reconstruct it, so there is one
|
|
92
|
+
* place that decides whether the feature is on.
|
|
93
|
+
*/
|
|
94
|
+
static getTypedJsonConfig() {
|
|
95
|
+
return (0, typed_json_1.resolveTypedJsonConfig)(this.generatorConfig);
|
|
96
|
+
}
|
|
97
|
+
static setTypedFieldUpdateOperationsPlan(plan) {
|
|
98
|
+
this.typedFieldUpdateOperationsPlan = plan;
|
|
99
|
+
}
|
|
100
|
+
static getStrictModeResolver() {
|
|
101
|
+
return this.strictModeResolver;
|
|
102
|
+
}
|
|
103
|
+
static escapeRegExp(value) {
|
|
104
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Check if a model should be generated based on configuration
|
|
108
|
+
*/
|
|
109
|
+
static isModelEnabled(modelName) {
|
|
110
|
+
var _a;
|
|
111
|
+
const config = this.getGeneratorConfig();
|
|
112
|
+
// If no configuration is available, generate all models (default behavior)
|
|
113
|
+
if (!config) {
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
// Check if model has specific configuration
|
|
117
|
+
const modelConfig = (_a = config.models) === null || _a === void 0 ? void 0 : _a[modelName];
|
|
118
|
+
if (modelConfig) {
|
|
119
|
+
// If model config exists, check if it's explicitly enabled/disabled
|
|
120
|
+
return modelConfig.enabled !== false;
|
|
121
|
+
}
|
|
122
|
+
// In minimal mode, do NOT blanket-disable models.
|
|
123
|
+
// Default to enabling models unless explicitly disabled via config.models.
|
|
124
|
+
// This aligns minimal mode with full mode regarding model selection; other constraints
|
|
125
|
+
// (limited operations and pared-down object schemas) are handled elsewhere.
|
|
126
|
+
// Default: enable all models when no explicit model disabling is configured
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get list of enabled models for generation
|
|
131
|
+
*/
|
|
132
|
+
static getEnabledModels(allModels) {
|
|
133
|
+
return allModels.filter((model) => this.isModelEnabled(model.name));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Log information about model filtering
|
|
137
|
+
*/
|
|
138
|
+
static logModelFiltering(allModels) {
|
|
139
|
+
const config = this.getGeneratorConfig();
|
|
140
|
+
if (!config)
|
|
141
|
+
return;
|
|
142
|
+
const enabledModels = this.getEnabledModels(allModels);
|
|
143
|
+
const disabledModels = allModels.filter((model) => !this.isModelEnabled(model.name));
|
|
144
|
+
if (disabledModels.length > 0) {
|
|
145
|
+
logger_1.logger.debug(`🚫 Models excluded from generation: ${disabledModels.map((m) => m.name).join(', ')}`);
|
|
146
|
+
}
|
|
147
|
+
if (config.mode === 'minimal' && enabledModels.length < allModels.length) {
|
|
148
|
+
logger_1.logger.debug(`⚡ Minimal mode: generating ${enabledModels.length}/${allModels.length} models`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Check if a specific operation should be generated for a model
|
|
153
|
+
*/
|
|
154
|
+
static isOperationEnabled(modelName, operationName) {
|
|
155
|
+
var _a, _b;
|
|
156
|
+
const config = this.getGeneratorConfig();
|
|
157
|
+
// If no configuration is available, generate all operations (default behavior)
|
|
158
|
+
if (!config) {
|
|
159
|
+
logger_1.logger.debug(`🔍 Operation check: ${modelName}.${operationName} = true (no config)`);
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
// Map operation names for backward compatibility
|
|
163
|
+
const operationMapping = {
|
|
164
|
+
findMany: ['findMany'],
|
|
165
|
+
findUnique: ['findUnique'],
|
|
166
|
+
findUniqueOrThrow: ['findUniqueOrThrow'],
|
|
167
|
+
findFirst: ['findFirst'],
|
|
168
|
+
findFirstOrThrow: ['findFirstOrThrow'],
|
|
169
|
+
createOne: ['create', 'createOne'],
|
|
170
|
+
createMany: ['create', 'createMany'],
|
|
171
|
+
createManyAndReturn: ['createManyAndReturn'],
|
|
172
|
+
updateOne: ['update', 'updateOne'],
|
|
173
|
+
updateMany: ['update', 'updateMany'],
|
|
174
|
+
updateManyAndReturn: ['updateManyAndReturn'],
|
|
175
|
+
deleteOne: ['delete', 'deleteOne'],
|
|
176
|
+
deleteMany: ['delete', 'deleteMany'],
|
|
177
|
+
upsertOne: ['upsert', 'upsertOne'],
|
|
178
|
+
aggregate: ['aggregate'],
|
|
179
|
+
groupBy: ['groupBy'],
|
|
180
|
+
count: ['count'],
|
|
181
|
+
};
|
|
182
|
+
// Check global operation exclusions first
|
|
183
|
+
if ((_a = config.globalExclusions) === null || _a === void 0 ? void 0 : _a.operations) {
|
|
184
|
+
const mappedOperationNames = operationMapping[operationName] || [operationName];
|
|
185
|
+
const isExcluded = mappedOperationNames.some((opName) => { var _a, _b, _c; return (_c = (_b = (_a = config.globalExclusions) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.includes(opName)) !== null && _c !== void 0 ? _c : false; });
|
|
186
|
+
if (isExcluded) {
|
|
187
|
+
logger_1.logger.debug(`🔍 Operation check: ${modelName}.${operationName} = false (globally excluded: [${config.globalExclusions.operations.join(', ')}])`);
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
// Check if model has specific configuration
|
|
192
|
+
const modelConfig = (_b = config.models) === null || _b === void 0 ? void 0 : _b[modelName];
|
|
193
|
+
if (modelConfig && modelConfig.operations) {
|
|
194
|
+
const allowedOperationNames = operationMapping[operationName] || [operationName];
|
|
195
|
+
const isEnabled = allowedOperationNames.some((opName) => { var _a, _b; return (_b = (_a = modelConfig.operations) === null || _a === void 0 ? void 0 : _a.includes(opName)) !== null && _b !== void 0 ? _b : false; });
|
|
196
|
+
logger_1.logger.debug(`🔍 Operation check: ${modelName}.${operationName} = ${isEnabled} (configured ops: [${modelConfig.operations.join(', ')}])`);
|
|
197
|
+
return isEnabled;
|
|
198
|
+
}
|
|
199
|
+
// For minimal mode, only enable essential operations (no *Many, no upsert, no aggregate/groupBy)
|
|
200
|
+
if (config.mode === 'minimal') {
|
|
201
|
+
// Allow overrides via config.minimalOperations when present
|
|
202
|
+
const configured = config === null || config === void 0 ? void 0 : config.minimalOperations;
|
|
203
|
+
const baseAllowed = configured && Array.isArray(configured) && configured.length > 0
|
|
204
|
+
? configured
|
|
205
|
+
: ['findMany', 'findUnique', 'findFirst', 'create', 'update', 'delete'];
|
|
206
|
+
// Map legacy op names used in model mappings to these canonical names
|
|
207
|
+
const opAliasMap = {
|
|
208
|
+
createOne: 'create',
|
|
209
|
+
updateOne: 'update',
|
|
210
|
+
deleteOne: 'delete',
|
|
211
|
+
upsertOne: 'upsert',
|
|
212
|
+
};
|
|
213
|
+
const canonical = opAliasMap[operationName] || operationName;
|
|
214
|
+
const isEnabled = baseAllowed.includes(canonical);
|
|
215
|
+
logger_1.logger.debug(`🔍 Operation check: ${modelName}.${operationName} -> ${canonical} = ${isEnabled} (minimal mode)`);
|
|
216
|
+
return isEnabled;
|
|
217
|
+
}
|
|
218
|
+
// Provider capability gating for AndReturn operations (not supported on all connectors)
|
|
219
|
+
if (operationName === 'createManyAndReturn' || operationName === 'updateManyAndReturn') {
|
|
220
|
+
const supportsAndReturn = ['postgresql', 'cockroachdb'].includes(this.provider);
|
|
221
|
+
if (!supportsAndReturn) {
|
|
222
|
+
logger_1.logger.debug(`🔍 Operation check: ${modelName}.${operationName} = false (provider=${this.provider} lacks AndReturn support)`);
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Default: enable all operations not explicitly disabled
|
|
227
|
+
logger_1.logger.debug(`🔍 Operation check: ${modelName}.${operationName} = true (default)`);
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get list of enabled operations for a model
|
|
232
|
+
*/
|
|
233
|
+
static getEnabledOperations(modelName, allOperations) {
|
|
234
|
+
return allOperations.filter((operation) => this.isOperationEnabled(modelName, operation));
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Log information about operation filtering for a model
|
|
238
|
+
*/
|
|
239
|
+
static logOperationFiltering(modelName, allOperations) {
|
|
240
|
+
const config = this.getGeneratorConfig();
|
|
241
|
+
if (!config)
|
|
242
|
+
return;
|
|
243
|
+
const enabledOperations = this.getEnabledOperations(modelName, allOperations);
|
|
244
|
+
const disabledOperations = allOperations.filter((op) => !this.isOperationEnabled(modelName, op));
|
|
245
|
+
if (disabledOperations.length > 0) {
|
|
246
|
+
logger_1.logger.debug(` 🔧 ${modelName}: excluded operations [${disabledOperations.join(', ')}]`);
|
|
247
|
+
}
|
|
248
|
+
if (config.mode === 'minimal' && enabledOperations.length < allOperations.length) {
|
|
249
|
+
logger_1.logger.debug(` ⚡ ${modelName}: minimal mode - ${enabledOperations.length}/${allOperations.length} operations`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Check if a field should be included in schema generation
|
|
254
|
+
*/
|
|
255
|
+
static isFieldEnabled(fieldName, modelName, variant) {
|
|
256
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
257
|
+
const config = this.getGeneratorConfig();
|
|
258
|
+
// If no configuration is available, include all fields (default behavior)
|
|
259
|
+
if (!config) {
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
// Start with a flag indicating whether the field should be excluded
|
|
263
|
+
let shouldExclude = false;
|
|
264
|
+
const debugReasons = [];
|
|
265
|
+
// Check global exclusions (basic format - array of strings)
|
|
266
|
+
if (config.globalExclusions && Array.isArray(config.globalExclusions)) {
|
|
267
|
+
if (this.isFieldMatchingPatterns(fieldName, config.globalExclusions)) {
|
|
268
|
+
shouldExclude = true;
|
|
269
|
+
debugReasons.push(`global array exclusion`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// Check global exclusions for the specified variant
|
|
273
|
+
if (variant && ((_a = config.globalExclusions) === null || _a === void 0 ? void 0 : _a[variant])) {
|
|
274
|
+
if (this.isFieldMatchingPatterns(fieldName, config.globalExclusions[variant])) {
|
|
275
|
+
shouldExclude = true;
|
|
276
|
+
debugReasons.push(`global ${variant} exclusion`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// Check model-specific field exclusions and includes
|
|
280
|
+
if (modelName) {
|
|
281
|
+
const modelConfig = (_b = config.models) === null || _b === void 0 ? void 0 : _b[modelName];
|
|
282
|
+
// Check model-specific includes FIRST - these OVERRIDE exclusions (highest precedence)
|
|
283
|
+
const legacyFields = modelConfig;
|
|
284
|
+
if ((_c = legacyFields === null || legacyFields === void 0 ? void 0 : legacyFields.fields) === null || _c === void 0 ? void 0 : _c.include) {
|
|
285
|
+
if (this.isFieldMatchingPatterns(fieldName, legacyFields.fields.include)) {
|
|
286
|
+
logger_1.logger.debug(`🟢 Field enabled: ${modelName}.${fieldName} (${variant}) = true (model include override)`);
|
|
287
|
+
return true; // Include overrides any previous or subsequent exclusion
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
// Check variant-specific exclusions (new format)
|
|
291
|
+
if ((_e = (_d = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.variants) === null || _d === void 0 ? void 0 : _d[variant || 'pure']) === null || _e === void 0 ? void 0 : _e.excludeFields) {
|
|
292
|
+
const ex = ((_g = (_f = modelConfig.variants) === null || _f === void 0 ? void 0 : _f[variant || 'pure']) === null || _g === void 0 ? void 0 : _g.excludeFields) || [];
|
|
293
|
+
if (this.isFieldMatchingPatterns(fieldName, ex)) {
|
|
294
|
+
shouldExclude = true;
|
|
295
|
+
debugReasons.push(`model ${variant} variant exclusion`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
// Check legacy format: fields.exclude (for backward compatibility)
|
|
299
|
+
if ((_h = legacyFields === null || legacyFields === void 0 ? void 0 : legacyFields.fields) === null || _h === void 0 ? void 0 : _h.exclude) {
|
|
300
|
+
logger_1.logger.debug(`🔍 Checking legacy fields.exclude for ${modelName}.${fieldName}: patterns =`, legacyFields.fields.exclude);
|
|
301
|
+
if (this.isFieldMatchingPatterns(fieldName, legacyFields.fields.exclude)) {
|
|
302
|
+
shouldExclude = true;
|
|
303
|
+
debugReasons.push(`model fields.exclude`);
|
|
304
|
+
logger_1.logger.debug(`🚫 Field excluded by legacy fields.exclude: ${modelName}.${fieldName}`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const result = !shouldExclude;
|
|
309
|
+
if (debugReasons.length > 0 ||
|
|
310
|
+
(modelName && ['password', 'views', 'internalId', 'metadata'].includes(fieldName))) {
|
|
311
|
+
logger_1.logger.debug(`🔍 Field check: ${modelName || 'unknown'}.${fieldName} (${variant || 'unknown'}) = ${result} ${debugReasons.length > 0 ? `(${debugReasons.join(', ')})` : '(allowed)'}`);
|
|
312
|
+
}
|
|
313
|
+
// Return the opposite of shouldExclude (if should exclude, return false)
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Check if a field name matches any pattern in the exclusion list
|
|
318
|
+
* Supports wildcards: *field, field*, *field*
|
|
319
|
+
*/
|
|
320
|
+
static isFieldMatchingPatterns(fieldName, patterns) {
|
|
321
|
+
// Debug: Reduced verbosity for performance (uncomment for detailed debugging)
|
|
322
|
+
// console.log(`🔍 Pattern matching: fieldName='${fieldName}', patterns=`, patterns);
|
|
323
|
+
const result = patterns.some((pattern) => {
|
|
324
|
+
// Exact match (no wildcards)
|
|
325
|
+
if (!pattern.includes('*')) {
|
|
326
|
+
const match = fieldName === pattern;
|
|
327
|
+
// console.log(` - Exact match '${pattern}': ${match}`);
|
|
328
|
+
return match;
|
|
329
|
+
}
|
|
330
|
+
// Convert pattern to regex
|
|
331
|
+
const regexPattern = pattern
|
|
332
|
+
.replace(/\./g, '\\.') // Escape dots FIRST
|
|
333
|
+
.replace(/\*/g, '.*'); // Then replace * with .*
|
|
334
|
+
const regex = new RegExp(`^${regexPattern}$`);
|
|
335
|
+
const match = regex.test(fieldName);
|
|
336
|
+
// console.log(` - Regex match '${pattern}' -> /${regexPattern}/: ${match}`);
|
|
337
|
+
return match;
|
|
338
|
+
});
|
|
339
|
+
// console.log(`🔍 Pattern matching result: ${result}`);
|
|
340
|
+
return result;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Filter fields based on configuration and relationship preservation
|
|
344
|
+
*/
|
|
345
|
+
static filterFields(fields, modelName, variant, models, schemaName) {
|
|
346
|
+
const config = (this.getGeneratorConfig() || {});
|
|
347
|
+
const strictCreateInputs = config.strictCreateInputs !== false; // default true
|
|
348
|
+
const preserveRequiredScalarsOnCreate = config.preserveRequiredScalarsOnCreate !== false; // default true
|
|
349
|
+
// Special case: WhereUniqueInput must retain unique identifier fields (e.g., id, unique columns)
|
|
350
|
+
// Do NOT apply variant-based exclusions to this schema type
|
|
351
|
+
const isWhereUniqueInput = !!schemaName && /WhereUniqueInput$/.test(schemaName);
|
|
352
|
+
// Do not apply variant-based field exclusions to base Prisma Create input object schemas when strictCreateInputs is true
|
|
353
|
+
// These must strictly match Prisma types to satisfy typed Zod bindings
|
|
354
|
+
const isBasePrismaCreateInputName = !!schemaName &&
|
|
355
|
+
[
|
|
356
|
+
/^(\w+)CreateInput$/,
|
|
357
|
+
/^(\w+)UncheckedCreateInput$/,
|
|
358
|
+
/^(\w+)CreateManyInput$/,
|
|
359
|
+
/^(\w+)CreateMany\w+Input$/,
|
|
360
|
+
/^(\w+)CreateWithout\w+Input$/,
|
|
361
|
+
/^(\w+)UncheckedCreateWithout\w+Input$/,
|
|
362
|
+
/^(\w+)CreateOrConnectWithout\w+Input$/,
|
|
363
|
+
/^(\w+)CreateNested(?:One|Many)Without\w+Input$/,
|
|
364
|
+
].some((re) => re.test(schemaName));
|
|
365
|
+
const isBasePrismaCreateInput = isBasePrismaCreateInputName && strictCreateInputs;
|
|
366
|
+
const filtered = fields.filter((field) => {
|
|
367
|
+
// Check basic field inclusion rules first
|
|
368
|
+
if (!isWhereUniqueInput &&
|
|
369
|
+
!isBasePrismaCreateInput &&
|
|
370
|
+
!this.isFieldEnabled(field.name, modelName, variant)) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
// In minimal mode, suppress relation and nested object fields in input variants
|
|
374
|
+
// BUT preserve them for base Prisma create inputs to maintain type compatibility
|
|
375
|
+
if (config.mode === 'minimal' && variant === 'input' && !isBasePrismaCreateInput) {
|
|
376
|
+
if (this.isRelationFieldArg(field)) {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
// For relation fields, also check if the related model is enabled
|
|
381
|
+
// This is a safety check for schema args that might represent relation fields
|
|
382
|
+
if (this.isRelationFieldArg(field)) {
|
|
383
|
+
const relatedModelName = this.extractRelatedModelFromFieldArg(field);
|
|
384
|
+
if (relatedModelName && !this.isModelEnabled(relatedModelName)) {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
return true;
|
|
389
|
+
});
|
|
390
|
+
// Handle foreign key preservation when relation fields are excluded
|
|
391
|
+
const result = [...filtered];
|
|
392
|
+
if (modelName && variant === 'input' && !isBasePrismaCreateInput && models) {
|
|
393
|
+
const model = models.find((m) => m.name === modelName);
|
|
394
|
+
if (model) {
|
|
395
|
+
const excludedRelationFields = this.getExcludedRelationFields(fields, filtered, model);
|
|
396
|
+
const foreignKeyFields = this.getForeignKeyFieldsForExcludedRelations(excludedRelationFields, model);
|
|
397
|
+
// Add foreign key fields that aren't already present AND aren't explicitly excluded
|
|
398
|
+
for (const fkField of foreignKeyFields) {
|
|
399
|
+
if (!result.some((field) => field.name === fkField.name)) {
|
|
400
|
+
// Check if the foreign key field is explicitly excluded by configuration
|
|
401
|
+
const isFieldAllowed = this.isFieldEnabled(fkField.name, modelName, variant);
|
|
402
|
+
logger_1.logger.debug(`🔑 Foreign key preservation check: ${modelName}.${fkField.name} (${variant}) = ${isFieldAllowed}`);
|
|
403
|
+
if (isFieldAllowed) {
|
|
404
|
+
logger_1.logger.debug(`🔑 Adding foreign key field: ${modelName}.${fkField.name}`);
|
|
405
|
+
result.push(fkField);
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
logger_1.logger.debug(`🚫 Skipping excluded foreign key field: ${modelName}.${fkField.name}`);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
// If strictCreateInputs is false and this is a Create-like input, optionally re-add required non-auto scalars
|
|
415
|
+
if (!strictCreateInputs &&
|
|
416
|
+
isBasePrismaCreateInputName &&
|
|
417
|
+
preserveRequiredScalarsOnCreate &&
|
|
418
|
+
modelName &&
|
|
419
|
+
models) {
|
|
420
|
+
const model = models.find((m) => m.name === modelName);
|
|
421
|
+
if (model) {
|
|
422
|
+
const requiredScalars = model.fields.filter((f) => f.kind === 'scalar' &&
|
|
423
|
+
f.isRequired === true &&
|
|
424
|
+
f.hasDefaultValue !== true &&
|
|
425
|
+
f.isUpdatedAt !== true);
|
|
426
|
+
for (const f of requiredScalars) {
|
|
427
|
+
if (!result.some((arg) => arg.name === f.name)) {
|
|
428
|
+
// Try to find the corresponding SchemaArg in original fields by name
|
|
429
|
+
const original = fields.find((arg) => arg.name === f.name);
|
|
430
|
+
if (original)
|
|
431
|
+
result.push(original);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return result;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Get excluded relation fields by comparing original and filtered fields
|
|
440
|
+
*/
|
|
441
|
+
static getExcludedRelationFields(originalFields, filteredFields, model) {
|
|
442
|
+
const excludedFieldNames = originalFields
|
|
443
|
+
.filter((originalField) => !filteredFields.some((filteredField) => filteredField.name === originalField.name))
|
|
444
|
+
.map((field) => field.name);
|
|
445
|
+
return model.fields.filter((field) => excludedFieldNames.includes(field.name) &&
|
|
446
|
+
field.kind === 'object' &&
|
|
447
|
+
field.relationFromFields &&
|
|
448
|
+
field.relationFromFields.length > 0);
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Get foreign key schema args for excluded relation fields
|
|
452
|
+
*/
|
|
453
|
+
static getForeignKeyFieldsForExcludedRelations(excludedRelationFields, model) {
|
|
454
|
+
const foreignKeyFields = [];
|
|
455
|
+
for (const relationField of excludedRelationFields) {
|
|
456
|
+
if (!relationField.relationFromFields)
|
|
457
|
+
continue;
|
|
458
|
+
for (const fkFieldName of relationField.relationFromFields) {
|
|
459
|
+
const fkField = model.fields.find((f) => f.name === fkFieldName);
|
|
460
|
+
if (fkField && fkField.kind === 'scalar') {
|
|
461
|
+
const inputTypes = [
|
|
462
|
+
{
|
|
463
|
+
type: fkField.type,
|
|
464
|
+
location: 'scalar',
|
|
465
|
+
isList: fkField.isList,
|
|
466
|
+
},
|
|
467
|
+
];
|
|
468
|
+
const schemaArg = {
|
|
469
|
+
name: fkField.name,
|
|
470
|
+
isRequired: fkField.isRequired,
|
|
471
|
+
isNullable: !fkField.isRequired,
|
|
472
|
+
inputTypes,
|
|
473
|
+
};
|
|
474
|
+
foreignKeyFields.push(schemaArg);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return foreignKeyFields;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Check if a schema arg represents a relation field
|
|
482
|
+
*/
|
|
483
|
+
static isRelationFieldArg(field) {
|
|
484
|
+
// Heuristic: relation-shaped nested inputs and relation filters
|
|
485
|
+
// Detect a wide set of Prisma relation input object patterns
|
|
486
|
+
const relationTypePatterns = [
|
|
487
|
+
// Connect targets for nested relations
|
|
488
|
+
/\w+WhereUniqueInput$/,
|
|
489
|
+
// Nested relation operations
|
|
490
|
+
/\w+CreateNested(?:One|Many)Without\w+Input$/,
|
|
491
|
+
/\w+UpdateNested(?:One|Many)Without\w+Input$/,
|
|
492
|
+
/\w+UpsertNested(?:One|Many)Without\w+Input$/,
|
|
493
|
+
// Without-variants used in nested create/update
|
|
494
|
+
/\w+CreateOrConnectWithout\w+Input$/,
|
|
495
|
+
/\w+CreateWithout\w+Input$/,
|
|
496
|
+
/\w+UncheckedCreateWithout\w+Input$/,
|
|
497
|
+
/\w+UpdateWithout\w+Input$/,
|
|
498
|
+
/\w+UncheckedUpdateWithout\w+Input$/,
|
|
499
|
+
/\w+UpdateToOneWithWhereWithout\w+Input$/,
|
|
500
|
+
/\w+UpdateOneRequiredWithout\w+NestedInput$/,
|
|
501
|
+
/\w+UpdateWithWhereUniqueWithout\w+Input$/,
|
|
502
|
+
/\w+UpdateManyWithWhereWithout\w+Input$/,
|
|
503
|
+
/\w+UpsertWithWhereUniqueWithout\w+Input$/,
|
|
504
|
+
// Relation filter helpers
|
|
505
|
+
/\w+ListRelationFilter$/,
|
|
506
|
+
/\w+RelationFilter$/,
|
|
507
|
+
/\w+ScalarRelationFilter$/,
|
|
508
|
+
// Order by relation inputs
|
|
509
|
+
/OrderByRelation/,
|
|
510
|
+
];
|
|
511
|
+
return field.inputTypes.some((inputType) => {
|
|
512
|
+
if (inputType.location !== 'inputObjectTypes')
|
|
513
|
+
return false;
|
|
514
|
+
const typeName = String(inputType.type);
|
|
515
|
+
return relationTypePatterns.some((re) => re.test(typeName));
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Extract related model name from field arg
|
|
520
|
+
*/
|
|
521
|
+
static extractRelatedModelFromFieldArg(field) {
|
|
522
|
+
for (const inputType of field.inputTypes) {
|
|
523
|
+
if (inputType.location === 'inputObjectTypes') {
|
|
524
|
+
const typeName = inputType.type;
|
|
525
|
+
// Handle specific relation filter patterns first
|
|
526
|
+
if (typeName.includes('ListRelationFilter')) {
|
|
527
|
+
// Extract from "PostListRelationFilter" -> "Post"
|
|
528
|
+
const match = typeName.match(/^(\w+)ListRelationFilter$/);
|
|
529
|
+
if (match)
|
|
530
|
+
return match[1];
|
|
531
|
+
}
|
|
532
|
+
// Extract model name from other types like "PostWhereInput", "UserCreateInput", etc.
|
|
533
|
+
const match = typeName.match(/^(\w+)(?:Where|Create|Update|OrderBy|RelationFilter|CreateNested|UpdateNested)/);
|
|
534
|
+
if (match) {
|
|
535
|
+
return match[1];
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Extract model name from object schema context
|
|
543
|
+
*/
|
|
544
|
+
static extractModelNameFromContext(schemaName) {
|
|
545
|
+
// Try to extract model name from common schema naming patterns
|
|
546
|
+
// More specific patterns should come first to avoid false matches
|
|
547
|
+
const patterns = [
|
|
548
|
+
// Basic input types - more specific patterns first
|
|
549
|
+
/^(\w+)UncheckedCreateInput$/,
|
|
550
|
+
/^(\w+)UncheckedUpdateInput$/,
|
|
551
|
+
/^(\w+)UncheckedUpdateManyInput$/,
|
|
552
|
+
/^(\w+)UpdateManyMutationInput$/,
|
|
553
|
+
/^(\w+)WhereUniqueInput$/,
|
|
554
|
+
/^(\w+)CreateManyInput$/,
|
|
555
|
+
/^(\w+)UpdateManyInput$/,
|
|
556
|
+
/^(\w+)WhereInput$/,
|
|
557
|
+
/^(\w+)CreateInput$/,
|
|
558
|
+
/^(\w+)UpdateInput$/,
|
|
559
|
+
// Order by inputs
|
|
560
|
+
/^(\w+)OrderByWithRelationInput$/,
|
|
561
|
+
/^(\w+)OrderByWithAggregationInput$/,
|
|
562
|
+
/^(\w+)OrderByRelationAggregateInput$/,
|
|
563
|
+
// Filter inputs
|
|
564
|
+
/^(\w+)ScalarWhereInput$/,
|
|
565
|
+
/^(\w+)ScalarWhereWithAggregatesInput$/,
|
|
566
|
+
/^(\w+)ListRelationFilter$/,
|
|
567
|
+
/^(\w+)RelationFilter$/,
|
|
568
|
+
/^(\w+)ScalarRelationFilter$/,
|
|
569
|
+
// Aggregate inputs
|
|
570
|
+
/^(\w+)CountAggregateInput$/,
|
|
571
|
+
/^(\w+)CountOrderByAggregateInput$/,
|
|
572
|
+
/^(\w+)AvgAggregateInput$/,
|
|
573
|
+
/^(\w+)AvgOrderByAggregateInput$/,
|
|
574
|
+
/^(\w+)MaxAggregateInput$/,
|
|
575
|
+
/^(\w+)MaxOrderByAggregateInput$/,
|
|
576
|
+
/^(\w+)MinAggregateInput$/,
|
|
577
|
+
/^(\w+)MinOrderByAggregateInput$/,
|
|
578
|
+
/^(\w+)SumAggregateInput$/,
|
|
579
|
+
/^(\w+)SumOrderByAggregateInput$/,
|
|
580
|
+
// Nested operation inputs
|
|
581
|
+
/^(\w+)CreateNestedOneWithout\w+Input$/,
|
|
582
|
+
/^(\w+)CreateNestedManyWithout\w+Input$/,
|
|
583
|
+
/^(\w+)UpdateNestedOneWithout\w+Input$/,
|
|
584
|
+
/^(\w+)UpdateNestedManyWithout\w+Input$/,
|
|
585
|
+
/^(\w+)UpsertNestedOneWithout\w+Input$/,
|
|
586
|
+
/^(\w+)UpsertNestedManyWithout\w+Input$/,
|
|
587
|
+
/^(\w+)CreateOrConnectWithout\w+Input$/,
|
|
588
|
+
/^(\w+)UpdateOneRequiredWithout\w+NestedInput$/,
|
|
589
|
+
/^(\w+)UpdateToOneWithWhereWithout\w+Input$/,
|
|
590
|
+
/^(\w+)UpsertWithout\w+Input$/,
|
|
591
|
+
/^(\w+)CreateWithout\w+Input$/,
|
|
592
|
+
/^(\w+)UpdateWithout\w+Input$/,
|
|
593
|
+
/^(\w+)UncheckedCreateWithout\w+Input$/,
|
|
594
|
+
/^(\w+)UncheckedUpdateWithout\w+Input$/,
|
|
595
|
+
/^(\w+)UncheckedCreateNestedManyWithout\w+Input$/,
|
|
596
|
+
/^(\w+)UncheckedUpdateManyWithout\w+Input$/,
|
|
597
|
+
/^(\w+)UncheckedUpdateManyWithout\w+NestedInput$/,
|
|
598
|
+
// Many-to-many relation inputs
|
|
599
|
+
/^(\w+)CreateManyAuthorInput$/,
|
|
600
|
+
/^(\w+)CreateManyAuthorInputEnvelope$/,
|
|
601
|
+
/^(\w+)UpdateManyWithWhereWithout\w+Input$/,
|
|
602
|
+
/^(\w+)UpdateWithWhereUniqueWithout\w+Input$/,
|
|
603
|
+
/^(\w+)UpsertWithWhereUniqueWithout\w+Input$/,
|
|
604
|
+
/^(\w+)UpdateManyWithout\w+NestedInput$/,
|
|
605
|
+
// Additional specific patterns found in generated schemas
|
|
606
|
+
/^(\w+)UncheckedUpdateManyInput$/,
|
|
607
|
+
// Args and other schemas
|
|
608
|
+
/^(\w+)Args$/,
|
|
609
|
+
// Pure model schemas (variant schemas)
|
|
610
|
+
/^(\w+)ModelSchema$/,
|
|
611
|
+
// Generic CreateMany relationship patterns (placed at end to avoid interference)
|
|
612
|
+
// Capture the owning model prefix (e.g. AccountCreateManyUserInputEnvelope -> Account)
|
|
613
|
+
/^(\w+)CreateMany\w+InputEnvelope$/,
|
|
614
|
+
/^(\w+)CreateMany\w+Input$/,
|
|
615
|
+
];
|
|
616
|
+
for (const pattern of patterns) {
|
|
617
|
+
const match = schemaName.match(pattern);
|
|
618
|
+
if (match) {
|
|
619
|
+
return match[1];
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Determine schema variant from context
|
|
626
|
+
*/
|
|
627
|
+
static determineSchemaVariant(schemaName) {
|
|
628
|
+
// Determine variant based on schema name patterns
|
|
629
|
+
if (schemaName.includes('Create') ||
|
|
630
|
+
schemaName.includes('Update') ||
|
|
631
|
+
schemaName.includes('Where')) {
|
|
632
|
+
return 'input';
|
|
633
|
+
}
|
|
634
|
+
if (schemaName.includes('Result') || schemaName.includes('Output')) {
|
|
635
|
+
return 'result';
|
|
636
|
+
}
|
|
637
|
+
return 'pure'; // Default variant
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Log information about field filtering
|
|
641
|
+
*/
|
|
642
|
+
static logFieldFiltering(originalCount, filteredCount, modelName, variant) {
|
|
643
|
+
if (originalCount !== filteredCount) {
|
|
644
|
+
const context = modelName ? `${modelName}${variant ? ` (${variant})` : ''}` : 'schema';
|
|
645
|
+
logger_1.logger.debug(` 🎯 ${context}: filtered ${originalCount - filteredCount} fields (${filteredCount}/${originalCount} remaining)`);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Check if a model has relationships to other ENABLED models
|
|
650
|
+
* This is a filtered version of checkModelHasModelRelation that only considers enabled models
|
|
651
|
+
*/
|
|
652
|
+
static checkModelHasEnabledModelRelation(model) {
|
|
653
|
+
const { fields: modelFields } = model;
|
|
654
|
+
for (const modelField of modelFields) {
|
|
655
|
+
if (this.isEnabledRelationField(modelField)) {
|
|
656
|
+
return true;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Check if a relation field points to an enabled model
|
|
663
|
+
*/
|
|
664
|
+
static isEnabledRelationField(modelField) {
|
|
665
|
+
const { kind, relationName, type } = modelField;
|
|
666
|
+
// Must be an object relation field
|
|
667
|
+
if (kind !== 'object' || !relationName) {
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
// Check if the related model is enabled
|
|
671
|
+
const relatedModelName = type;
|
|
672
|
+
return this.isModelEnabled(relatedModelName);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Get list of enabled related models for a given model
|
|
676
|
+
*/
|
|
677
|
+
static getEnabledRelatedModels(model) {
|
|
678
|
+
const relatedModels = new Set();
|
|
679
|
+
for (const field of model.fields) {
|
|
680
|
+
if (this.isEnabledRelationField(field)) {
|
|
681
|
+
relatedModels.add(field.type);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return Array.from(relatedModels);
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Check if a model should have include schemas generated
|
|
688
|
+
* Only if it has relationships to other enabled models
|
|
689
|
+
*/
|
|
690
|
+
static shouldGenerateIncludeSchema(model) {
|
|
691
|
+
const config = this.getGeneratorConfig();
|
|
692
|
+
if ((config === null || config === void 0 ? void 0 : config.mode) === 'minimal')
|
|
693
|
+
return false;
|
|
694
|
+
return Transformer.isGenerateInclude && this.checkModelHasEnabledModelRelation(model);
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Check if a model should have select schemas generated
|
|
698
|
+
*/
|
|
699
|
+
static shouldGenerateSelectSchema(_model) {
|
|
700
|
+
const config = this.getGeneratorConfig();
|
|
701
|
+
if ((config === null || config === void 0 ? void 0 : config.mode) === 'minimal')
|
|
702
|
+
return false;
|
|
703
|
+
return Transformer.isGenerateSelect;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* Log relationship preservation information
|
|
707
|
+
*/
|
|
708
|
+
static logRelationshipPreservation(model) {
|
|
709
|
+
const config = this.getGeneratorConfig();
|
|
710
|
+
if (!config)
|
|
711
|
+
return;
|
|
712
|
+
const enabledRelatedModels = this.getEnabledRelatedModels(model);
|
|
713
|
+
const totalRelationFields = model.fields.filter((f) => f.kind === 'object' && f.relationName).length;
|
|
714
|
+
const enabledRelationFields = model.fields.filter((f) => this.isEnabledRelationField(f)).length;
|
|
715
|
+
if (totalRelationFields > enabledRelationFields) {
|
|
716
|
+
const disabledRelations = totalRelationFields - enabledRelationFields;
|
|
717
|
+
logger_1.logger.debug(` 🔗 ${model.name}: ${disabledRelations} disabled relation(s) to filtered models`);
|
|
718
|
+
}
|
|
719
|
+
if (enabledRelatedModels.length > 0) {
|
|
720
|
+
logger_1.logger.debug(` ✅ ${model.name}: active relations to [${enabledRelatedModels.join(', ')}]`);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
// Dual export setters
|
|
724
|
+
static setExportTypedSchemas(exportTypedSchemas) {
|
|
725
|
+
this.exportTypedSchemas = exportTypedSchemas;
|
|
726
|
+
}
|
|
727
|
+
static setExportZodSchemas(exportZodSchemas) {
|
|
728
|
+
this.exportZodSchemas = exportZodSchemas;
|
|
729
|
+
}
|
|
730
|
+
static setTypedSchemaSuffix(typedSchemaSuffix) {
|
|
731
|
+
this.typedSchemaSuffix = typedSchemaSuffix;
|
|
732
|
+
}
|
|
733
|
+
static setZodSchemaSuffix(zodSchemaSuffix) {
|
|
734
|
+
this.zodSchemaSuffix = zodSchemaSuffix;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Generate the correct object schema name based on export settings
|
|
738
|
+
*/
|
|
739
|
+
static getObjectSchemaName(baseName) {
|
|
740
|
+
return this.exportTypedSchemas
|
|
741
|
+
? `${baseName}ObjectSchema`
|
|
742
|
+
: `${baseName}Object${this.zodSchemaSuffix}`;
|
|
743
|
+
}
|
|
744
|
+
static getOutputPath() {
|
|
745
|
+
return this.outputPath;
|
|
746
|
+
}
|
|
747
|
+
static setCurrentManifest(manifest) {
|
|
748
|
+
this.currentManifest = manifest;
|
|
749
|
+
}
|
|
750
|
+
static getCurrentManifest() {
|
|
751
|
+
return this.currentManifest;
|
|
752
|
+
}
|
|
753
|
+
static setPrismaClientOutputPath(prismaClientCustomPath) {
|
|
754
|
+
this.prismaClientOutputPath = prismaClientCustomPath;
|
|
755
|
+
this.isCustomPrismaClientOutputPath = prismaClientCustomPath !== '@prisma/client';
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Resolve the import specifier for Prisma Client relative to a target directory.
|
|
759
|
+
* Falls back to '@prisma/client' when user did not configure a custom output.
|
|
760
|
+
*/
|
|
761
|
+
static resolvePrismaImportPath(targetDir) {
|
|
762
|
+
if (!this.isCustomPrismaClientOutputPath)
|
|
763
|
+
return '@prisma/client';
|
|
764
|
+
try {
|
|
765
|
+
let prismaClientImportTarget = this.prismaClientOutputPath;
|
|
766
|
+
// For the new Prisma generator (provider = 'prisma-client'), the public entrypoints
|
|
767
|
+
// live in generated `client.*` / `browser.*` files inside the configured output
|
|
768
|
+
// directory. The Prisma output config represents the directory, so we explicitly
|
|
769
|
+
// target a file. We target the browser-safe entrypoint: the server entry (client.*)
|
|
770
|
+
// hard-imports node: builtins (node:process/node:path/node:url/node:buffer) and
|
|
771
|
+
// breaks browser bundles, while browser.* exports everything the generated schemas
|
|
772
|
+
// need (the Prisma namespace with Decimal/DbNull/JsonNull values plus all types).
|
|
773
|
+
if (this.prismaClientProvider === 'prisma-client') {
|
|
774
|
+
const hasFileExtension = path_1.default.extname(prismaClientImportTarget) !== '';
|
|
775
|
+
if (!hasFileExtension) {
|
|
776
|
+
prismaClientImportTarget = path_1.default.join(prismaClientImportTarget, this.resolvePrismaClientEntryBasename());
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
// Compute relative path from the file's directory to the custom client output path
|
|
780
|
+
let rel = path_1.default.relative(targetDir, prismaClientImportTarget).replace(/\\/g, '/');
|
|
781
|
+
if (!rel || rel === '')
|
|
782
|
+
return '@prisma/client';
|
|
783
|
+
// Add file extension if needed (for ESM with importFileExtension)
|
|
784
|
+
const extension = this.getImportFileExtension();
|
|
785
|
+
if (!extension || !/\.[a-z]+$/i.test(rel)) {
|
|
786
|
+
rel = `${rel}${extension}`;
|
|
787
|
+
}
|
|
788
|
+
// Ensure it is a valid relative module specifier (prefix with ./ when needed)
|
|
789
|
+
if (rel.startsWith('.') || rel.startsWith('/'))
|
|
790
|
+
return rel;
|
|
791
|
+
return `./${rel}`;
|
|
792
|
+
}
|
|
793
|
+
catch {
|
|
794
|
+
return '@prisma/client';
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* The `import type { Prisma }` line for CRUD operation schema files, or '' when
|
|
799
|
+
* typed exports are disabled — the typed exports are the only consumers of the
|
|
800
|
+
* Prisma namespace in those files, so the import would otherwise be unused.
|
|
801
|
+
*/
|
|
802
|
+
static prismaTypeImportLine(prismaImportPath) {
|
|
803
|
+
return Transformer.exportTypedSchemas
|
|
804
|
+
? `import type { Prisma } from '${prismaImportPath}';\n`
|
|
805
|
+
: '';
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Determine which generated prisma-client entrypoint to import.
|
|
809
|
+
* Prefers the browser-safe `browser.*` entry so generated schemas can be bundled
|
|
810
|
+
* for client-side use. Falls back to the server `client.*` entry only when an
|
|
811
|
+
* older prisma-client output layout without a browser entry is positively
|
|
812
|
+
* detected on disk. When the client output has not been generated yet, assume
|
|
813
|
+
* the modern layout (browser entry present).
|
|
814
|
+
*/
|
|
815
|
+
static resolvePrismaClientEntryBasename() {
|
|
816
|
+
const outputDir = this.prismaClientOutputPath;
|
|
817
|
+
const cached = this.prismaClientEntryBasenameCache.get(outputDir);
|
|
818
|
+
if (cached)
|
|
819
|
+
return cached;
|
|
820
|
+
// Default to the server entry: `client.*` is always present in a
|
|
821
|
+
// prisma-client output, whereas `browser.*` is not guaranteed. The
|
|
822
|
+
// generators can also run before the client output exists (the directory is
|
|
823
|
+
// then unreadable), and guessing `browser` there emits an import that does
|
|
824
|
+
// not resolve — strictly worse than the server entry, which merely is not
|
|
825
|
+
// browser-optimised. Prefer `browser` only when we can see it on disk.
|
|
826
|
+
let entry = 'client';
|
|
827
|
+
try {
|
|
828
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- lazy require keeps fs out of the module top level
|
|
829
|
+
const fs = require('fs');
|
|
830
|
+
const entries = fs.readdirSync(outputDir);
|
|
831
|
+
const entryFileRegex = /^(browser|client)\.(ts|mts|cts|js|mjs|cjs)$/;
|
|
832
|
+
const hasBrowserEntry = entries.some((name) => { var _a; return ((_a = entryFileRegex.exec(name)) === null || _a === void 0 ? void 0 : _a[1]) === 'browser'; });
|
|
833
|
+
const hasClientEntry = entries.some((name) => { var _a; return ((_a = entryFileRegex.exec(name)) === null || _a === void 0 ? void 0 : _a[1]) === 'client'; });
|
|
834
|
+
if (hasBrowserEntry)
|
|
835
|
+
entry = 'browser';
|
|
836
|
+
else if (hasClientEntry)
|
|
837
|
+
entry = 'client';
|
|
838
|
+
}
|
|
839
|
+
catch {
|
|
840
|
+
// Output directory unreadable or not generated yet: keep the server entry.
|
|
841
|
+
}
|
|
842
|
+
this.prismaClientEntryBasenameCache.set(outputDir, entry);
|
|
843
|
+
return entry;
|
|
844
|
+
}
|
|
845
|
+
static setPrismaClientProvider(provider) {
|
|
846
|
+
this.prismaClientProvider = provider;
|
|
847
|
+
}
|
|
848
|
+
static setPrismaClientConfig(config) {
|
|
849
|
+
this.prismaClientConfig = config;
|
|
850
|
+
}
|
|
851
|
+
static getPrismaClientProvider() {
|
|
852
|
+
return this.prismaClientProvider;
|
|
853
|
+
}
|
|
854
|
+
static getPrismaClientConfig() {
|
|
855
|
+
return this.prismaClientConfig;
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Determines the schemas directory path based on the output path.
|
|
859
|
+
* If the output path already ends with 'schemas', use it directly.
|
|
860
|
+
* Otherwise, append 'schemas' to the output path.
|
|
861
|
+
*/
|
|
862
|
+
static getSchemasPath() {
|
|
863
|
+
const normalizedOutputPath = path_1.default.normalize(this.outputPath);
|
|
864
|
+
const pathSegments = normalizedOutputPath.split(path_1.default.sep);
|
|
865
|
+
const lastSegment = pathSegments[pathSegments.length - 1];
|
|
866
|
+
if (lastSegment === 'schemas') {
|
|
867
|
+
return this.outputPath;
|
|
868
|
+
}
|
|
869
|
+
return path_1.default.join(this.outputPath, 'schemas');
|
|
870
|
+
}
|
|
871
|
+
static async generateIndex() {
|
|
872
|
+
const indexPath = path_1.default.join(Transformer.getSchemasPath(), 'index.ts');
|
|
873
|
+
const importExtension = Transformer.getImportFileExtension();
|
|
874
|
+
await (0, writeIndexFile_1.writeIndexFile)(indexPath, importExtension);
|
|
875
|
+
}
|
|
876
|
+
async generateEnumSchemas() {
|
|
877
|
+
for (const enumType of this.enumTypes) {
|
|
878
|
+
const { name, values } = enumType;
|
|
879
|
+
// Filter out enum schemas for disabled models
|
|
880
|
+
if (this.isEnumSchemaEnabled(name)) {
|
|
881
|
+
// Use enum naming configuration
|
|
882
|
+
const enumNamingConfig = (0, naming_resolver_1.resolveEnumNaming)(Transformer.getGeneratorConfig());
|
|
883
|
+
// Normalize enum name for consistent file naming and exports
|
|
884
|
+
const normalizedEnumName = this.normalizeEnumName(name);
|
|
885
|
+
const enumName = normalizedEnumName || name;
|
|
886
|
+
const fileName = (0, naming_resolver_1.generateFileName)(enumNamingConfig.filePattern, enumName, // Use enum name as model name for naming pattern
|
|
887
|
+
undefined, // No operation
|
|
888
|
+
undefined, // No input type
|
|
889
|
+
enumName);
|
|
890
|
+
const schemaExportName = (0, naming_resolver_1.generateExportName)(enumNamingConfig.exportNamePattern, enumName, // Use enum name as model name for naming pattern
|
|
891
|
+
undefined, // No operation
|
|
892
|
+
undefined, // No input type
|
|
893
|
+
enumName);
|
|
894
|
+
await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer.getSchemasPath(), `enums/${fileName}`), `${this.generateImportZodStatement()}\n` +
|
|
895
|
+
`export const ${schemaExportName} = z.enum([${values
|
|
896
|
+
.map((v) => `'${v}'`)
|
|
897
|
+
.join(', ')}])\n\n` +
|
|
898
|
+
`export type ${enumName} = z.infer<typeof ${schemaExportName}>;`);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Check if an enum schema should be generated based on enabled models
|
|
904
|
+
*/
|
|
905
|
+
isEnumSchemaEnabled(enumName) {
|
|
906
|
+
// Always generate user-defined enums and Prisma built-in enums
|
|
907
|
+
// Only filter model-specific generated enums based on model configuration
|
|
908
|
+
// Check if this is a model-specific enum (like PostScalarFieldEnum)
|
|
909
|
+
const modelName = this.extractModelNameFromEnum(enumName);
|
|
910
|
+
if (modelName) {
|
|
911
|
+
// This is a model-specific enum, check if the model is enabled
|
|
912
|
+
return Transformer.isModelEnabled(modelName);
|
|
913
|
+
}
|
|
914
|
+
// For all other enums (user-defined enums like Status, Role, and Prisma built-ins),
|
|
915
|
+
// always generate them regardless of model configuration
|
|
916
|
+
return true;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Extract model name from enum name
|
|
920
|
+
*/
|
|
921
|
+
extractModelNameFromEnum(enumName) {
|
|
922
|
+
for (const pattern of Transformer.modelEnumPatterns) {
|
|
923
|
+
const match = enumName.match(pattern);
|
|
924
|
+
if (match) {
|
|
925
|
+
return match[1];
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Normalize enum names to match import expectations
|
|
932
|
+
* For model-related enums, use Pascal case model names consistently
|
|
933
|
+
*/
|
|
934
|
+
normalizeEnumName(enumName) {
|
|
935
|
+
// Use shared patterns to detect and normalize model-specific enums
|
|
936
|
+
for (const pattern of Transformer.modelEnumPatterns) {
|
|
937
|
+
const match = enumName.match(pattern);
|
|
938
|
+
if (match) {
|
|
939
|
+
const modelName = match[1];
|
|
940
|
+
const pascalModelName = this.getPascalCaseModelName(modelName);
|
|
941
|
+
// Rebuild enum name with normalized model name
|
|
942
|
+
return enumName.replace(modelName, pascalModelName);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
// Return null for non-model-related enums to use original name
|
|
946
|
+
return null;
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Convert model names to DMMF aggregate input names
|
|
950
|
+
* For doc_parser_agent model: matches Prisma's DMMF format Doc_parser_agentCountAggregateInput
|
|
951
|
+
*/
|
|
952
|
+
getAggregateInputName(modelName, inputSuffix) {
|
|
953
|
+
// Prisma's DMMF uses original model name with first letter capitalized for aggregate inputs
|
|
954
|
+
// doc_parser_agent -> Doc_parser_agentCountAggregateInput (not DocParserAgentCountAggregateInput)
|
|
955
|
+
const capitalizedModelName = modelName.charAt(0).toUpperCase() + modelName.slice(1);
|
|
956
|
+
return `${capitalizedModelName}${inputSuffix}`;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Get the correct Prisma type name for model types
|
|
960
|
+
* Prisma uses the original model name as-is (e.g., doc_parser_agent -> Prisma.doc_parser_agentSelect)
|
|
961
|
+
*/
|
|
962
|
+
getPrismaTypeName(modelName, operationType) {
|
|
963
|
+
/* Special case: Aggregate operations capitalize the first letter of model names.
|
|
964
|
+
This applies to all naming conventions since kebab-case is not allowed in Prisma schemas.*/
|
|
965
|
+
if (operationType === 'Aggregate') {
|
|
966
|
+
return modelName.charAt(0).toUpperCase() + modelName.slice(1);
|
|
967
|
+
}
|
|
968
|
+
// All other operations use the original model name without any case transformation
|
|
969
|
+
return modelName;
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Check if a model has numeric fields that support avg/sum operations
|
|
973
|
+
*/
|
|
974
|
+
modelHasNumericFields(modelName) {
|
|
975
|
+
const dmmfModel = this.models.find((m) => m.name === modelName);
|
|
976
|
+
if (!dmmfModel)
|
|
977
|
+
return false;
|
|
978
|
+
return dmmfModel.fields.some((field) => ['Int', 'Float', 'Decimal', 'BigInt'].includes(field.type));
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* The module `z` is imported from, honouring `zodImportTarget` and `zodImportPath`.
|
|
982
|
+
*
|
|
983
|
+
* Extracted so the typed-JSON namespace file can import `z` from the same place the
|
|
984
|
+
* schemas do. Recomputing it there would make the module path two sources of truth,
|
|
985
|
+
* which is precisely the class of drift this feature exists to remove.
|
|
986
|
+
*/
|
|
987
|
+
static resolveZodImportSpecifier() {
|
|
988
|
+
var _a;
|
|
989
|
+
const config = Transformer.getGeneratorConfig();
|
|
990
|
+
const target = ((_a = config === null || config === void 0 ? void 0 : config.zodImportTarget) !== null && _a !== void 0 ? _a : 'auto');
|
|
991
|
+
const defaultPath = target === 'v4' ? 'zod/v4' : target === 'v3' ? 'zod/v3' : 'zod';
|
|
992
|
+
// A custom module path (issue #370) lets users point z at their own
|
|
993
|
+
// re-export configured with an i18n error map, etc. The binding style still
|
|
994
|
+
// follows zodImportTarget, so the custom module must export z accordingly.
|
|
995
|
+
const custom = typeof (config === null || config === void 0 ? void 0 : config.zodImportPath) === 'string' ? config.zodImportPath.trim() : '';
|
|
996
|
+
if (!custom)
|
|
997
|
+
return defaultPath;
|
|
998
|
+
// Guard the generated string literal: a real module specifier never
|
|
999
|
+
// contains quotes/whitespace. Reject anything else and warn.
|
|
1000
|
+
if (/^[a-zA-Z0-9_@./-]+$/.test(custom))
|
|
1001
|
+
return custom;
|
|
1002
|
+
logger_1.logger.warn(`[prisma-zod-generator] Ignoring invalid zodImportPath "${custom}"; falling back to '${defaultPath}'`);
|
|
1003
|
+
return defaultPath;
|
|
1004
|
+
}
|
|
1005
|
+
generateImportZodStatement() {
|
|
1006
|
+
var _a, _b;
|
|
1007
|
+
// v3 binds a named export (import { z }); auto/v4 bind the namespace.
|
|
1008
|
+
const target = ((_b = (_a = Transformer.getGeneratorConfig()) === null || _a === void 0 ? void 0 : _a.zodImportTarget) !== null && _b !== void 0 ? _b : 'auto');
|
|
1009
|
+
const useNamedBinding = target === 'v3';
|
|
1010
|
+
const path = Transformer.resolveZodImportSpecifier();
|
|
1011
|
+
return useNamedBinding ? `import { z } from '${path}';\n` : `import * as z from '${path}';\n`;
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Generate custom import statements from @zod.import() annotations
|
|
1015
|
+
*
|
|
1016
|
+
* @param customImports - Array of custom import objects
|
|
1017
|
+
* @param outputPath - Current output path for relative import adjustment
|
|
1018
|
+
* @returns Generated import statements string
|
|
1019
|
+
*/
|
|
1020
|
+
generateCustomImportStatements(customImports, outputPath = '') {
|
|
1021
|
+
if (!customImports || customImports.length === 0) {
|
|
1022
|
+
return '';
|
|
1023
|
+
}
|
|
1024
|
+
const importStatements = [];
|
|
1025
|
+
const seenImports = new Set();
|
|
1026
|
+
for (const customImport of customImports) {
|
|
1027
|
+
if (!customImport || !customImport.importStatement) {
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
let importStatement = customImport.importStatement;
|
|
1031
|
+
// Adjust relative paths for multi-file output
|
|
1032
|
+
if (outputPath && customImport.source.startsWith('.')) {
|
|
1033
|
+
importStatement = this.adjustRelativeImportPath(importStatement, outputPath);
|
|
1034
|
+
}
|
|
1035
|
+
// Avoid duplicate imports
|
|
1036
|
+
if (!seenImports.has(importStatement)) {
|
|
1037
|
+
seenImports.add(importStatement);
|
|
1038
|
+
importStatements.push(importStatement);
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
if (importStatements.length === 0) {
|
|
1042
|
+
return '';
|
|
1043
|
+
}
|
|
1044
|
+
// Return imports with proper formatting and newline
|
|
1045
|
+
return importStatements.join(';\n') + ';\n';
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Get custom imports for a specific schema context
|
|
1049
|
+
* This method is called AFTER the schema content is generated to determine which imports are actually needed
|
|
1050
|
+
*
|
|
1051
|
+
* @param modelName - Name of the model
|
|
1052
|
+
* @param schemaContent - The generated schema content to analyze for import usage
|
|
1053
|
+
* @returns Array of custom imports needed for this specific schema
|
|
1054
|
+
*/
|
|
1055
|
+
getCustomImportsForModel(modelName, schemaContent) {
|
|
1056
|
+
if (!modelName)
|
|
1057
|
+
return [];
|
|
1058
|
+
// Find the enhanced model data
|
|
1059
|
+
const enhancedModel = this.enhancedModels.find((em) => em.model.name === modelName);
|
|
1060
|
+
if (!enhancedModel)
|
|
1061
|
+
return [];
|
|
1062
|
+
const usedImports = [];
|
|
1063
|
+
const usedImportSources = new Set();
|
|
1064
|
+
// If schema content is provided, analyze it for actual usage
|
|
1065
|
+
if (schemaContent) {
|
|
1066
|
+
// Collect all potential imports from field-level and model-level
|
|
1067
|
+
const allPotentialImports = [];
|
|
1068
|
+
// Add field-level imports
|
|
1069
|
+
for (const enhancedField of enhancedModel.enhancedFields) {
|
|
1070
|
+
if (enhancedField.customImports) {
|
|
1071
|
+
allPotentialImports.push(...enhancedField.customImports);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
// Add model-level imports
|
|
1075
|
+
if (enhancedModel.modelCustomImports) {
|
|
1076
|
+
allPotentialImports.push(...enhancedModel.modelCustomImports);
|
|
1077
|
+
}
|
|
1078
|
+
// Check which imports are actually used in the schema content
|
|
1079
|
+
for (const potentialImport of allPotentialImports) {
|
|
1080
|
+
if (potentialImport.importedItems) {
|
|
1081
|
+
// Check if any imported function/item is used in the schema content
|
|
1082
|
+
const isUsed = potentialImport.importedItems.some((item) => {
|
|
1083
|
+
if (!item) {
|
|
1084
|
+
return false;
|
|
1085
|
+
}
|
|
1086
|
+
const escaped = Transformer.escapeRegExp(item);
|
|
1087
|
+
const re = new RegExp(`\\b${escaped}\\b`);
|
|
1088
|
+
return re.test(schemaContent);
|
|
1089
|
+
});
|
|
1090
|
+
if (isUsed && !usedImportSources.has(potentialImport.importStatement)) {
|
|
1091
|
+
usedImports.push(potentialImport);
|
|
1092
|
+
usedImportSources.add(potentialImport.importStatement);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
return usedImports;
|
|
1097
|
+
}
|
|
1098
|
+
// Fallback to the old logic if no schema content is provided
|
|
1099
|
+
// Check which fields in this schema actually use custom validation
|
|
1100
|
+
for (const field of this.fields) {
|
|
1101
|
+
const enhancedField = enhancedModel.enhancedFields.find((ef) => ef.field.name === field.name);
|
|
1102
|
+
// Only add imports if the field has custom imports AND the field string contains custom validation logic
|
|
1103
|
+
if (enhancedField && enhancedField.customImports && enhancedField.customImports.length > 0) {
|
|
1104
|
+
// Check if this field actually contains custom validation by looking for function calls
|
|
1105
|
+
const hasCustomValidation = this.fieldContainsCustomValidation(field, enhancedField);
|
|
1106
|
+
if (hasCustomValidation) {
|
|
1107
|
+
for (const customImport of enhancedField.customImports) {
|
|
1108
|
+
// Deduplicate imports by source
|
|
1109
|
+
if (!usedImportSources.has(customImport.importStatement)) {
|
|
1110
|
+
usedImports.push(customImport);
|
|
1111
|
+
usedImportSources.add(customImport.importStatement);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
// Only add model-level imports if this is a schema type that should include model-level validation
|
|
1118
|
+
// Model-level validation (like .refine()) should only be in result/output schemas, not input aggregate schemas
|
|
1119
|
+
const isResultSchema = this.name.includes('Result') ||
|
|
1120
|
+
this.name.includes('ModelSchema') ||
|
|
1121
|
+
(!this.name.includes('Input') &&
|
|
1122
|
+
!this.name.includes('Filter') &&
|
|
1123
|
+
!this.name.includes('OrderBy') &&
|
|
1124
|
+
!this.name.includes('Aggregate'));
|
|
1125
|
+
if (isResultSchema &&
|
|
1126
|
+
enhancedModel.modelCustomImports &&
|
|
1127
|
+
enhancedModel.modelCustomImports.length > 0) {
|
|
1128
|
+
for (const modelImport of enhancedModel.modelCustomImports) {
|
|
1129
|
+
if (!usedImportSources.has(modelImport.importStatement)) {
|
|
1130
|
+
usedImports.push(modelImport);
|
|
1131
|
+
usedImportSources.add(modelImport.importStatement);
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
return usedImports;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* Check if a field actually contains custom validation logic
|
|
1139
|
+
*/
|
|
1140
|
+
fieldContainsCustomValidation(field, enhancedField) {
|
|
1141
|
+
// Check if the enhanced field has a custom schema or custom validation
|
|
1142
|
+
if (enhancedField.hasZodAnnotations && enhancedField.zodSchema) {
|
|
1143
|
+
const zodSchema = enhancedField.zodSchema;
|
|
1144
|
+
// Check if the zodSchema contains function calls from the custom imports
|
|
1145
|
+
if (enhancedField.customImports) {
|
|
1146
|
+
for (const customImport of enhancedField.customImports) {
|
|
1147
|
+
// Check if any of the imported function names are used in the schema
|
|
1148
|
+
for (const importedItem of customImport.importedItems || []) {
|
|
1149
|
+
if (zodSchema.includes(importedItem)) {
|
|
1150
|
+
return true;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
// Check if schema contains .refine() or .transform() which would use custom logic
|
|
1156
|
+
if (zodSchema.includes('.refine(') || zodSchema.includes('.transform(')) {
|
|
1157
|
+
return true;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
// Check if the enhanced field has a custom schema from @zod.import().custom.use()
|
|
1161
|
+
if (enhancedField.customSchema) {
|
|
1162
|
+
return true;
|
|
1163
|
+
}
|
|
1164
|
+
// Convert field to string to check its content as fallback
|
|
1165
|
+
const fieldString = field.toString();
|
|
1166
|
+
// If field is just z.literal(true).optional() or similar basic patterns, it doesn't need custom imports
|
|
1167
|
+
if (fieldString.includes('z.literal(true)') || fieldString.includes('z.lazy(')) {
|
|
1168
|
+
return false;
|
|
1169
|
+
}
|
|
1170
|
+
// Check if field contains function calls from the custom imports as fallback
|
|
1171
|
+
if (enhancedField.customImports) {
|
|
1172
|
+
for (const customImport of enhancedField.customImports) {
|
|
1173
|
+
// Check if any of the imported function names are used in the field
|
|
1174
|
+
for (const importedItem of customImport.importedItems || []) {
|
|
1175
|
+
if (fieldString.includes(importedItem)) {
|
|
1176
|
+
return true;
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Get custom schema for a specific field
|
|
1185
|
+
*
|
|
1186
|
+
* @param fieldName - Name of the field
|
|
1187
|
+
* @returns Custom schema string or null if not found
|
|
1188
|
+
*/
|
|
1189
|
+
getCustomSchemaForField(fieldName) {
|
|
1190
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
1191
|
+
if (!modelName)
|
|
1192
|
+
return null;
|
|
1193
|
+
// Find the enhanced model data
|
|
1194
|
+
const enhancedModel = this.enhancedModels.find((em) => em.model.name === modelName);
|
|
1195
|
+
if (!enhancedModel)
|
|
1196
|
+
return null;
|
|
1197
|
+
// Find the enhanced field data
|
|
1198
|
+
const enhancedField = enhancedModel.enhancedFields.find((ef) => ef.field.name === fieldName);
|
|
1199
|
+
if (!enhancedField)
|
|
1200
|
+
return null;
|
|
1201
|
+
// Return ONLY the custom schema from @zod.import().custom.use() if available
|
|
1202
|
+
// Regular @zod annotations should be handled by wrapWithZodValidators to avoid double-processing
|
|
1203
|
+
if (enhancedField.customSchema) {
|
|
1204
|
+
return enhancedField.customSchema;
|
|
1205
|
+
}
|
|
1206
|
+
return null;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Directory the file being emitted sits in, relative to the generator output directory.
|
|
1210
|
+
*
|
|
1211
|
+
* This is what a relative `typedJson.schemaModule` is rewritten against, so `./json-types`
|
|
1212
|
+
* becomes `../json-types` from `objects/`.
|
|
1213
|
+
*/
|
|
1214
|
+
static typedJsonOutputSubdir(subdir) {
|
|
1215
|
+
var _a;
|
|
1216
|
+
try {
|
|
1217
|
+
// In single-file mode every schema ends up in one bundle, so what matters is where
|
|
1218
|
+
// that bundle lands, not which subdirectory the content came from.
|
|
1219
|
+
const dir = (0, singleFileAggregator_1.isSingleFileEnabled)()
|
|
1220
|
+
? ((_a = Transformer.getGeneratorConfig()) === null || _a === void 0 ? void 0 : _a.placeSingleFileAtRoot) !== false
|
|
1221
|
+
? Transformer.getOutputPath()
|
|
1222
|
+
: Transformer.getSchemasPath()
|
|
1223
|
+
: path_1.default.join(Transformer.getSchemasPath(), subdir);
|
|
1224
|
+
return path_1.default.relative(Transformer.getOutputPath(), dir).split(path_1.default.sep).join('/');
|
|
1225
|
+
}
|
|
1226
|
+
catch {
|
|
1227
|
+
return subdir;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* The model this schema's members take their typed-JSON annotations from.
|
|
1232
|
+
*
|
|
1233
|
+
* `resolveTypedJsonOwnerModel` repairs the one shape the general extraction reads wrong -
|
|
1234
|
+
* `<Model>UncheckedCreateWithout<Relation>Input` and its update twin, which it answers as
|
|
1235
|
+
* a model called `<Model>Unchecked`. The repair lives here, on the typed-JSON path only,
|
|
1236
|
+
* rather than in `extractModelNameFromContext`, because that function also drives file
|
|
1237
|
+
* naming and field filtering: a changed answer there would move bytes for repos that have
|
|
1238
|
+
* never configured `typedJson`.
|
|
1239
|
+
*/
|
|
1240
|
+
typedJsonOwnerModel(extractedName) {
|
|
1241
|
+
return (0, emission_1.resolveTypedJsonOwnerModel)(extractedName, (name) => this.enhancedModels.some((em) => em.model.name === name));
|
|
1242
|
+
}
|
|
1243
|
+
/** The DMMF model field an input-object member refers to, when there is one. */
|
|
1244
|
+
getModelFieldForArg(fieldName) {
|
|
1245
|
+
var _a, _b;
|
|
1246
|
+
const modelName = this.typedJsonOwnerModel(Transformer.extractModelNameFromContext(this.name));
|
|
1247
|
+
if (!modelName)
|
|
1248
|
+
return null;
|
|
1249
|
+
const enhancedModel = this.enhancedModels.find((em) => em.model.name === modelName);
|
|
1250
|
+
if (!enhancedModel)
|
|
1251
|
+
return null;
|
|
1252
|
+
return (_b = (_a = enhancedModel.enhancedFields.find((ef) => ef.field.name === fieldName)) === null || _a === void 0 ? void 0 : _a.field) !== null && _b !== void 0 ? _b : null;
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* The model list field this schema is the `{ set }` / `{ push }` wrapper for, if it is one.
|
|
1256
|
+
*
|
|
1257
|
+
* Prisma emits one of these per list column, named `<Model><Create|Update><field>Input`,
|
|
1258
|
+
* and its members are literally `set` and `push`. So the model cannot be read off the
|
|
1259
|
+
* schema name by `extractModelNameFromContext` - and must not be taught to it, because
|
|
1260
|
+
* that same function drives file naming and field filtering. It is resolved here instead,
|
|
1261
|
+
* against the models actually in the schema.
|
|
1262
|
+
*
|
|
1263
|
+
* The longest matching model name wins, so `Foo` and `FooBar` both existing resolves
|
|
1264
|
+
* `FooBarUpdatetagsInput` to `FooBar.tags` regardless of DMMF order.
|
|
1265
|
+
*/
|
|
1266
|
+
listWrapperTarget() {
|
|
1267
|
+
var _a, _b, _c;
|
|
1268
|
+
if (this.listWrapperTargetCache !== undefined)
|
|
1269
|
+
return this.listWrapperTargetCache;
|
|
1270
|
+
let best = null;
|
|
1271
|
+
for (const enhancedModel of this.enhancedModels) {
|
|
1272
|
+
const modelName = enhancedModel.model.name;
|
|
1273
|
+
if (best && modelName.length <= best.modelName.length)
|
|
1274
|
+
continue;
|
|
1275
|
+
const fieldName = (_b = (_a = this.name) === null || _a === void 0 ? void 0 : _a.match(new RegExp(`^${Transformer.escapeRegExp(modelName)}(?:Create|Update)(.+)Input$`))) === null || _b === void 0 ? void 0 : _b[1];
|
|
1276
|
+
if (!fieldName)
|
|
1277
|
+
continue;
|
|
1278
|
+
const field = (_c = enhancedModel.enhancedFields.find((ef) => ef.field.name === fieldName && ef.field.isList)) === null || _c === void 0 ? void 0 : _c.field;
|
|
1279
|
+
if (field)
|
|
1280
|
+
best = { modelName, field };
|
|
1281
|
+
}
|
|
1282
|
+
this.listWrapperTargetCache = best;
|
|
1283
|
+
return best;
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* The model field an input-object member should take its annotation from, if any.
|
|
1287
|
+
*
|
|
1288
|
+
* Normally that is the field of the same name. A list-operation wrapper is the exception:
|
|
1289
|
+
* `set` and `push` are operations on the wrapped column, so the annotation belongs to
|
|
1290
|
+
* that column. Looking a wrapper's members up by name would find nothing, or - once a
|
|
1291
|
+
* model has a column actually *called* `set` - find an unrelated one and stamp its
|
|
1292
|
+
* annotation onto every wrapper in the model.
|
|
1293
|
+
*/
|
|
1294
|
+
typedJsonTargetForArg(argName) {
|
|
1295
|
+
// A per-field copy of a shared update-operations input. Its name yields no model to
|
|
1296
|
+
// the general extraction, and its `set` member holds a value of the column it was
|
|
1297
|
+
// copied for, so the plan is the only thing that knows which column that is.
|
|
1298
|
+
const copied = Transformer.typedFieldUpdateOperationsPlan.targetFor(this.name, argName);
|
|
1299
|
+
if (copied)
|
|
1300
|
+
return copied;
|
|
1301
|
+
const wrapper = this.listWrapperTarget();
|
|
1302
|
+
if (wrapper) {
|
|
1303
|
+
// Only the operation members. Anything else in one of these files is not a value of
|
|
1304
|
+
// the wrapped column and has no business carrying its annotation.
|
|
1305
|
+
if (!emission_1.LIST_OPERATION_MEMBERS.has(argName))
|
|
1306
|
+
return null;
|
|
1307
|
+
return wrapper.field.documentation ? wrapper : null;
|
|
1308
|
+
}
|
|
1309
|
+
const modelName = this.typedJsonOwnerModel(Transformer.extractModelNameFromContext(this.name));
|
|
1310
|
+
if (!modelName)
|
|
1311
|
+
return null;
|
|
1312
|
+
const field = this.getModelFieldForArg(argName);
|
|
1313
|
+
return (field === null || field === void 0 ? void 0 : field.documentation) ? { modelName, field } : null;
|
|
1314
|
+
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Resolve a PJTG annotation for one input-object member, or `null` to leave it alone.
|
|
1317
|
+
*
|
|
1318
|
+
* Returning `null` is the default in every uncertain case, and `null` means "emit exactly
|
|
1319
|
+
* what 3.0.0 emitted". Nothing here runs at all when `typedJson` is unconfigured.
|
|
1320
|
+
*/
|
|
1321
|
+
typedJsonForField(field, inputType) {
|
|
1322
|
+
const config = Transformer.getTypedJsonConfig();
|
|
1323
|
+
if (!config)
|
|
1324
|
+
return null;
|
|
1325
|
+
if (!(0, emission_1.isTypedJsonInputType)(inputType.type))
|
|
1326
|
+
return null;
|
|
1327
|
+
if ((0, emission_1.isTypedJsonExcludedSchema)(this.name))
|
|
1328
|
+
return null;
|
|
1329
|
+
const target = this.typedJsonTargetForArg(field.name);
|
|
1330
|
+
if (!(target === null || target === void 0 ? void 0 : target.field.documentation))
|
|
1331
|
+
return null;
|
|
1332
|
+
const result = (0, resolver_1.resolveTypedJsonField)({
|
|
1333
|
+
modelName: target.modelName,
|
|
1334
|
+
fieldName: target.field.name,
|
|
1335
|
+
documentation: target.field.documentation,
|
|
1336
|
+
// The DMMF arg carries the list-ness for this position; the model field is a
|
|
1337
|
+
// list even where the arg is a single `push` value.
|
|
1338
|
+
isList: inputType.isList,
|
|
1339
|
+
isOptional: !field.isRequired,
|
|
1340
|
+
outputSubdir: Transformer.typedJsonOutputSubdir('objects'),
|
|
1341
|
+
importExtension: this.getImportFileExtension(),
|
|
1342
|
+
}, config);
|
|
1343
|
+
(0, emission_1.reportTypedJsonResult)(result, () => `${target.modelName}.${target.field.name}`);
|
|
1344
|
+
return result.status === 'resolved' ? result : null;
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Imports the typed-JSON expressions in this file need, merged to one per module and
|
|
1348
|
+
* filtered to the names the file actually mentions.
|
|
1349
|
+
*/
|
|
1350
|
+
getTypedJsonImportsForSchema(modelName, schemaContent) {
|
|
1351
|
+
var _a, _b, _c, _d;
|
|
1352
|
+
const config = Transformer.getTypedJsonConfig();
|
|
1353
|
+
if (!config)
|
|
1354
|
+
return [];
|
|
1355
|
+
// A `{ set }` / `{ push }` wrapper's name does not yield its model to the general
|
|
1356
|
+
// extraction, so it has to be resolved the way the members themselves are. Without
|
|
1357
|
+
// this the wrapper references a schema it never imports - and the same is true of the
|
|
1358
|
+
// `Unchecked` halves of a nested write, whose model the extraction reads wrong.
|
|
1359
|
+
const owner = (_d = (_b = (_a = Transformer.typedFieldUpdateOperationsPlan.ownerOf(this.name)) !== null && _a !== void 0 ? _a : this.typedJsonOwnerModel(modelName)) !== null && _b !== void 0 ? _b : (_c = this.listWrapperTarget()) === null || _c === void 0 ? void 0 : _c.modelName) !== null && _d !== void 0 ? _d : null;
|
|
1360
|
+
if (!owner)
|
|
1361
|
+
return [];
|
|
1362
|
+
const enhancedModel = this.enhancedModels.find((em) => em.model.name === owner);
|
|
1363
|
+
if (!enhancedModel)
|
|
1364
|
+
return [];
|
|
1365
|
+
const collected = [];
|
|
1366
|
+
for (const enhancedField of enhancedModel.enhancedFields) {
|
|
1367
|
+
const documentation = enhancedField.field.documentation;
|
|
1368
|
+
if (!documentation)
|
|
1369
|
+
continue;
|
|
1370
|
+
const result = (0, resolver_1.resolveTypedJsonField)({
|
|
1371
|
+
modelName: owner,
|
|
1372
|
+
fieldName: enhancedField.field.name,
|
|
1373
|
+
documentation,
|
|
1374
|
+
isList: enhancedField.field.isList,
|
|
1375
|
+
outputSubdir: Transformer.typedJsonOutputSubdir('objects'),
|
|
1376
|
+
importExtension: this.getImportFileExtension(),
|
|
1377
|
+
}, config);
|
|
1378
|
+
if (result.status === 'resolved')
|
|
1379
|
+
collected.push(...result.imports);
|
|
1380
|
+
}
|
|
1381
|
+
return (0, emission_1.mergeTypedJsonImports)(collected, schemaContent, (0, singleFileAggregator_1.isSingleFileEnabled)());
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Adjust relative import paths based on output directory structure
|
|
1385
|
+
*
|
|
1386
|
+
* @param importStatement - Original import statement
|
|
1387
|
+
* @param outputPath - Current output path
|
|
1388
|
+
* @returns Adjusted import statement
|
|
1389
|
+
*/
|
|
1390
|
+
adjustRelativeImportPath(importStatement, _outputPath) {
|
|
1391
|
+
// Previous logic attempted to rewrite relative paths heuristically. This is prone to
|
|
1392
|
+
// breaking user-supplied paths, so we now trust the provided statement as-is.
|
|
1393
|
+
return importStatement;
|
|
1394
|
+
}
|
|
1395
|
+
async generateObjectSchema() {
|
|
1396
|
+
const zodObjectSchemaFields = this.generateObjectSchemaFields();
|
|
1397
|
+
const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);
|
|
1398
|
+
// Use input naming configuration for input objects
|
|
1399
|
+
const inputNamingConfig = (0, naming_resolver_1.resolveInputNaming)(Transformer.getGeneratorConfig());
|
|
1400
|
+
// Extract model name and input type from the object name
|
|
1401
|
+
// Use input type as fallback to prevent filename collisions
|
|
1402
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
1403
|
+
const inputType = this.name;
|
|
1404
|
+
const fileName = (0, naming_resolver_1.generateFileName)(inputNamingConfig.filePattern, modelName || inputType, undefined, // No operation
|
|
1405
|
+
inputType);
|
|
1406
|
+
await (0, writeFileSafely_1.writeFileSafely)(path_1.default.join(Transformer.getSchemasPath(), `objects/${fileName}`), objectSchema);
|
|
1407
|
+
}
|
|
1408
|
+
generateObjectSchemaFields() {
|
|
1409
|
+
// Determine context for field filtering
|
|
1410
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
1411
|
+
const variant = Transformer.determineSchemaVariant(this.name);
|
|
1412
|
+
// Debug all schemas being processed
|
|
1413
|
+
logger_1.logger.debug(`🔍 Processing: ${this.name}`);
|
|
1414
|
+
// Debug: Log the raw context name and extracted model name
|
|
1415
|
+
logger_1.logger.debug(`🔍 Schema context: "${this.name}" -> extracted model: "${modelName}"`);
|
|
1416
|
+
// CRITICAL FIX: UpdateManyWithWhereWithout*Input DMMF Bug
|
|
1417
|
+
// Prisma's DMMF is missing the required 'where' field for these types
|
|
1418
|
+
if (/UpdateManyWithWhereWithout\w+Input$/.test(this.name)) {
|
|
1419
|
+
logger_1.logger.debug(`🎯 MATCHED PATTERN: ${this.name}`);
|
|
1420
|
+
logger_1.logger.debug(` - Fields available: [${this.fields.map((f) => f.name).join(', ')}]`);
|
|
1421
|
+
const hasWhereField = this.fields.some((f) => f.name === 'where');
|
|
1422
|
+
logger_1.logger.debug(` - Has where field: ${hasWhereField}`);
|
|
1423
|
+
if (!hasWhereField && modelName) {
|
|
1424
|
+
logger_1.logger.debug(`🔧 FIXING DMMF BUG: Adding missing 'where' field to ${this.name}`);
|
|
1425
|
+
// Create a synthetic 'where' field that references the model's ScalarWhereInput type
|
|
1426
|
+
const syntheticWhereField = {
|
|
1427
|
+
isParameterizable: false,
|
|
1428
|
+
name: 'where',
|
|
1429
|
+
isNullable: false,
|
|
1430
|
+
isRequired: true,
|
|
1431
|
+
inputTypes: [
|
|
1432
|
+
{
|
|
1433
|
+
type: `${modelName}ScalarWhereInput`,
|
|
1434
|
+
namespace: 'prisma',
|
|
1435
|
+
location: 'inputObjectTypes',
|
|
1436
|
+
isList: false,
|
|
1437
|
+
},
|
|
1438
|
+
],
|
|
1439
|
+
};
|
|
1440
|
+
// Inject the missing field
|
|
1441
|
+
this.fields = [...this.fields, syntheticWhereField];
|
|
1442
|
+
logger_1.logger.debug(` ✅ Added synthetic where field for ${modelName}ScalarWhereInput`);
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
// Apply field filtering
|
|
1446
|
+
const originalFieldCount = this.fields.length;
|
|
1447
|
+
let filteredFields = Transformer.filterFields(this.fields, modelName || undefined, variant, this.models, this.name);
|
|
1448
|
+
// Special handling for UpdateManyWithWhereWithout*Input patterns - ensure 'where' field is preserved
|
|
1449
|
+
if (/UpdateManyWithWhereWithout\w+Input$/.test(this.name)) {
|
|
1450
|
+
const whereField = this.fields.find((f) => f.name === 'where');
|
|
1451
|
+
const hasWhereInFiltered = filteredFields.some((f) => f.name === 'where');
|
|
1452
|
+
if (whereField && !hasWhereInFiltered) {
|
|
1453
|
+
logger_1.logger.debug(` - Restoring filtered 'where' field for ${this.name}`);
|
|
1454
|
+
filteredFields = [...filteredFields, whereField];
|
|
1455
|
+
}
|
|
1456
|
+
else if (!whereField) {
|
|
1457
|
+
// If the where field doesn't exist in the original fields, this might indicate a DMMF issue
|
|
1458
|
+
// We need to manually construct the missing where field based on the pattern
|
|
1459
|
+
logger_1.logger.debug(` - 'where' field missing from DMMF for ${this.name}, attempting to fix in prepareObjectSchema`);
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
// Compute excluded field names for this schema context
|
|
1463
|
+
const excluded = this.fields
|
|
1464
|
+
.filter((orig) => !filteredFields.some((f) => f.name === orig.name))
|
|
1465
|
+
.map((f) => f.name);
|
|
1466
|
+
this.lastExcludedFieldNames = excluded.length > 0 ? excluded : [];
|
|
1467
|
+
// Log field filtering if any fields were excluded
|
|
1468
|
+
Transformer.logFieldFiltering(originalFieldCount, filteredFields.length, modelName || undefined, variant);
|
|
1469
|
+
const zodObjectSchemaFields = filteredFields
|
|
1470
|
+
.map((field) => this.generateObjectSchemaField(field))
|
|
1471
|
+
.flatMap((item) => item)
|
|
1472
|
+
.map((item) => {
|
|
1473
|
+
const [zodStringWithMainType, field, skipValidators] = item;
|
|
1474
|
+
const value = skipValidators
|
|
1475
|
+
? zodStringWithMainType
|
|
1476
|
+
: this.generateFieldValidators(zodStringWithMainType, field);
|
|
1477
|
+
return value.trim();
|
|
1478
|
+
});
|
|
1479
|
+
return zodObjectSchemaFields;
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* The replacement text to compose into a property line, given where it is about to land.
|
|
1483
|
+
*
|
|
1484
|
+
* A typed replacement is the user's schema and the emitter does not rewrite it, with one
|
|
1485
|
+
* exception that is not a rewrite so much as a division of labour: a marker at the TOP
|
|
1486
|
+
* LEVEL of the replacement answers a question the emitter has already answered from the
|
|
1487
|
+
* DMMF, and only one of the two answers can be right.
|
|
1488
|
+
*
|
|
1489
|
+
* Every object schema is cast to the Prisma input type for the same operation, so
|
|
1490
|
+
* whether a key may be omitted and whether it admits `null` are facts about the column,
|
|
1491
|
+
* not opinions the annotation gets to hold. `![string | undefined]` on a required column
|
|
1492
|
+
* would make a required key omittable; `![{ a: string } | null]` on a required `Json`
|
|
1493
|
+
* column would accept a bare `null` where `Prisma.<M>CreateInput` says
|
|
1494
|
+
* `JsonNullValueInput | InputJsonValue` and means `Prisma.JsonNull`. Both are payloads
|
|
1495
|
+
* the type the schema is cast to rejects. So a trailing run of markers comes off here and
|
|
1496
|
+
* the emitter's own optional/nullable policy re-applies whatever the column actually
|
|
1497
|
+
* says - which is also why an annotation that agrees with the column no longer emits its
|
|
1498
|
+
* marker twice.
|
|
1499
|
+
*
|
|
1500
|
+
* Nothing else in the replacement is touched. `{ a: string; b?: number }` keeps `b`
|
|
1501
|
+
* optional, and so does an element inside a `z.array(...)` the annotation wrote itself:
|
|
1502
|
+
* those markers are nowhere near the top level and describe the user's own type.
|
|
1503
|
+
*
|
|
1504
|
+
* The `isList` case is the reason this takes an `inputType` rather than working on the
|
|
1505
|
+
* string alone. On a list field the replacement is the ELEMENT schema and
|
|
1506
|
+
* `wrapWithZodValidators` is about to append `.array()` to it, so its trailing marker
|
|
1507
|
+
* ends up under that wrapper describing an element rather than the field. Prisma's
|
|
1508
|
+
* `InputJsonArray` is `ReadonlyArray<InputJsonValue | null>`, so a null element is a
|
|
1509
|
+
* value it really does accept, and the condition below is the same one the wrapper
|
|
1510
|
+
* itself uses to decide whether to append.
|
|
1511
|
+
*/
|
|
1512
|
+
static typedJsonSlotExpression(expression, inputType) {
|
|
1513
|
+
const willWrapInArray = inputType.isList && !expression.includes('.array()');
|
|
1514
|
+
if (willWrapInArray)
|
|
1515
|
+
return expression;
|
|
1516
|
+
return expression.replace(TYPED_JSON_TRAILING_OPTIONALITY, '');
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Run an optionality strip over a composed property line without letting it reach
|
|
1520
|
+
* inside a typed-JSON replacement.
|
|
1521
|
+
*
|
|
1522
|
+
* The strips exist for the OUTER expression and are load-bearing there: every
|
|
1523
|
+
* alternative arrives from `wrapWithZodValidators` already carrying `.optional()`, a
|
|
1524
|
+
* union adds its own tail, and the optional/nullable policy below re-applies exactly
|
|
1525
|
+
* one marker. Left unstripped that composes two markers where the policy allows one.
|
|
1526
|
+
*
|
|
1527
|
+
* Inside a typed replacement is not the emitter's to strip, though. That is the user's
|
|
1528
|
+
* schema, and `{ a: string; b?: number }` means `b` is optional in every artifact that
|
|
1529
|
+
* reads the annotation - the pure model and the result schema both say so. Masking each
|
|
1530
|
+
* replacement to an opaque token keeps the outer strip doing its job while what it
|
|
1531
|
+
* covers passes through byte for byte.
|
|
1532
|
+
*
|
|
1533
|
+
* What it covers is `typedJsonSlotExpression`'s answer, which is the replacement with
|
|
1534
|
+
* the top-level markers the emitter owns already removed. So the two halves compose
|
|
1535
|
+
* rather than fight: the emitter decides the outermost marker, the annotation decides
|
|
1536
|
+
* every marker under it, and neither reaches into the other.
|
|
1537
|
+
*
|
|
1538
|
+
* Nothing is ever collected without a `typedJson` block, so for everyone else this is
|
|
1539
|
+
* exactly `strip(expression)`.
|
|
1540
|
+
*/
|
|
1541
|
+
static withTypedJsonMasked(expression, typedJsonExpressions, strip) {
|
|
1542
|
+
if (typedJsonExpressions.size === 0)
|
|
1543
|
+
return strip(expression);
|
|
1544
|
+
// Longest first: one replacement can contain another (`TagSchema` inside
|
|
1545
|
+
// `z.array(TagSchema)`), and masking the shorter one first would leave the rest of
|
|
1546
|
+
// the longer one exposed to the strip.
|
|
1547
|
+
const masked = [...typedJsonExpressions].sort((a, b) => b.length - a.length);
|
|
1548
|
+
// Delimited at both ends, so restoring token 1 cannot chew the head off token 11.
|
|
1549
|
+
const token = (index) => `${TYPED_JSON_MASK}${index}${TYPED_JSON_MASK}`;
|
|
1550
|
+
let result = expression;
|
|
1551
|
+
masked.forEach((value, index) => {
|
|
1552
|
+
result = result.split(value).join(token(index));
|
|
1553
|
+
});
|
|
1554
|
+
result = strip(result);
|
|
1555
|
+
masked.forEach((value, index) => {
|
|
1556
|
+
result = result.split(token(index)).join(value);
|
|
1557
|
+
});
|
|
1558
|
+
return result;
|
|
1559
|
+
}
|
|
1560
|
+
generateObjectSchemaField(field) {
|
|
1561
|
+
var _a, _b;
|
|
1562
|
+
const lines = field.inputTypes;
|
|
1563
|
+
if (lines.length === 0) {
|
|
1564
|
+
return [];
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Typed replacements used in this property line, kept out of the optionality strips
|
|
1568
|
+
* below. Empty unless `typedJson` is configured, which is what leaves those strips
|
|
1569
|
+
* byte-identical for everybody else.
|
|
1570
|
+
*
|
|
1571
|
+
* What goes in the set is what was composed into the line, which is the replacement
|
|
1572
|
+
* minus whatever `typedJsonSlotExpression` handed back to the emitter. So the mask
|
|
1573
|
+
* protects the user's schema and nothing more: the emitter's own markers, including
|
|
1574
|
+
* the one the annotation duplicated, are still in front of the strips.
|
|
1575
|
+
*/
|
|
1576
|
+
const typedJsonExpressions = new Set();
|
|
1577
|
+
const typedJsonBase = (typedJson, inputType) => {
|
|
1578
|
+
const resolved = typedJson === null || typedJson === void 0 ? void 0 : typedJson.elementExpression;
|
|
1579
|
+
if (!resolved)
|
|
1580
|
+
return undefined;
|
|
1581
|
+
const expression = Transformer.typedJsonSlotExpression(resolved, inputType);
|
|
1582
|
+
typedJsonExpressions.add(expression);
|
|
1583
|
+
return expression;
|
|
1584
|
+
};
|
|
1585
|
+
let alternatives = lines.reduce((result, inputType) => {
|
|
1586
|
+
var _a;
|
|
1587
|
+
// Skip inputTypes that reference blocked schemas in minimal mode
|
|
1588
|
+
if (inputType.location === 'inputObjectTypes' && typeof inputType.type === 'string') {
|
|
1589
|
+
if (!this.isSchemaImportEnabled(inputType.type)) {
|
|
1590
|
+
return result; // Skip this inputType
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
if (inputType.type === 'String') {
|
|
1594
|
+
// Check for custom schema from @zod.import() annotations
|
|
1595
|
+
const typedJson = this.typedJsonForField(field, inputType);
|
|
1596
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1597
|
+
const baseSchema = typedJsonBase(typedJson, inputType) || customSchema || 'z.string()';
|
|
1598
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema || !!typedJson,
|
|
1599
|
+
// `@db.VarChar(n)` appends `.max(n)` to whatever the base is, and
|
|
1600
|
+
// `z.enum([...]).max(8)` throws TypeError the moment the module loads.
|
|
1601
|
+
typedJson ? typedJson.allowsStringLengthConstraints : true));
|
|
1602
|
+
}
|
|
1603
|
+
else if (inputType.type === 'Boolean') {
|
|
1604
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1605
|
+
const baseSchema = customSchema || 'z.boolean()';
|
|
1606
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema));
|
|
1607
|
+
}
|
|
1608
|
+
else if (inputType.type === 'Int') {
|
|
1609
|
+
const typedJson = this.typedJsonForField(field, inputType);
|
|
1610
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1611
|
+
const baseSchema = typedJsonBase(typedJson, inputType) || customSchema || 'z.number().int()';
|
|
1612
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema || !!typedJson));
|
|
1613
|
+
}
|
|
1614
|
+
else if (inputType.type === 'Float') {
|
|
1615
|
+
const typedJson = this.typedJsonForField(field, inputType);
|
|
1616
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1617
|
+
const baseSchema = typedJsonBase(typedJson, inputType) || customSchema || 'z.number()';
|
|
1618
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema || !!typedJson));
|
|
1619
|
+
}
|
|
1620
|
+
else if (inputType.type === 'Decimal') {
|
|
1621
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
1622
|
+
const mode = (cfg === null || cfg === void 0 ? void 0 : cfg.decimalMode) || 'decimal';
|
|
1623
|
+
let decimalExpr = 'z.number()'; // fallback
|
|
1624
|
+
if (mode === 'decimal') {
|
|
1625
|
+
// Use helper schema with union + refine for input validation
|
|
1626
|
+
this.hasDecimal = true; // Track that we need decimal helpers
|
|
1627
|
+
decimalExpr = (0, decimal_helpers_1.generateDecimalInputSchema)('z', (0, decimal_helpers_1.isDecimalJsAvailable)(), field.name);
|
|
1628
|
+
}
|
|
1629
|
+
else if (mode === 'string') {
|
|
1630
|
+
decimalExpr = 'z.string()';
|
|
1631
|
+
}
|
|
1632
|
+
else {
|
|
1633
|
+
decimalExpr = 'z.number()';
|
|
1634
|
+
}
|
|
1635
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1636
|
+
const baseSchema = customSchema || decimalExpr;
|
|
1637
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema));
|
|
1638
|
+
}
|
|
1639
|
+
else if (inputType.type === 'BigInt') {
|
|
1640
|
+
let bigintExpr = 'z.bigint()';
|
|
1641
|
+
// JSON Schema compatibility mode overrides normal behavior
|
|
1642
|
+
if (Transformer.isJsonSchemaModeEnabled()) {
|
|
1643
|
+
const { bigIntFormat } = Transformer.getJsonSchemaOptions();
|
|
1644
|
+
const format = bigIntFormat || 'string';
|
|
1645
|
+
if (format === 'string') {
|
|
1646
|
+
// Allow optional leading minus for negative bigint strings
|
|
1647
|
+
bigintExpr = 'z.string().regex(/^-?\\d+$/, "Invalid bigint string")';
|
|
1648
|
+
}
|
|
1649
|
+
else {
|
|
1650
|
+
bigintExpr = 'z.number().int()'; // Note: May lose precision for very large numbers
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1654
|
+
const baseSchema = customSchema || bigintExpr;
|
|
1655
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema));
|
|
1656
|
+
}
|
|
1657
|
+
else if (inputType.type === 'DateTime') {
|
|
1658
|
+
// Apply configurable DateTime strategy
|
|
1659
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
1660
|
+
const target = ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.zodImportTarget) !== null && _a !== void 0 ? _a : 'auto');
|
|
1661
|
+
let dateExpr = 'z.date()';
|
|
1662
|
+
// JSON Schema compatibility mode overrides all other strategies
|
|
1663
|
+
if (Transformer.isJsonSchemaModeEnabled()) {
|
|
1664
|
+
const { dateTimeFormat } = Transformer.getJsonSchemaOptions();
|
|
1665
|
+
const format = dateTimeFormat || 'isoString';
|
|
1666
|
+
if (format === 'isoDate') {
|
|
1667
|
+
dateExpr = 'z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/, "Invalid ISO date")';
|
|
1668
|
+
}
|
|
1669
|
+
else {
|
|
1670
|
+
// isoString - validate RFC3339 date-time (optional fraction, timezone offsets)
|
|
1671
|
+
dateExpr =
|
|
1672
|
+
'z.string().regex(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$/, "Invalid RFC3339 date-time")';
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
else if ((cfg === null || cfg === void 0 ? void 0 : cfg.dateTimeStrategy) === 'coerce') {
|
|
1676
|
+
dateExpr = 'z.coerce.date()';
|
|
1677
|
+
}
|
|
1678
|
+
else if ((cfg === null || cfg === void 0 ? void 0 : cfg.dateTimeStrategy) === 'isoString') {
|
|
1679
|
+
// For v4, use the modern z.iso.datetime() API, otherwise use regex validation
|
|
1680
|
+
if (target === 'v4') {
|
|
1681
|
+
dateExpr = 'z.iso.datetime().transform(v => new Date(v))';
|
|
1682
|
+
}
|
|
1683
|
+
else {
|
|
1684
|
+
// ISO string validated then transformed to Date
|
|
1685
|
+
dateExpr =
|
|
1686
|
+
'z.string().regex(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$/, "Invalid ISO datetime").transform(v => new Date(v))';
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
else {
|
|
1690
|
+
// No explicit strategy set. If split strategy is enabled, use variant-aware default:
|
|
1691
|
+
// inputs => coerce; pure/result => date
|
|
1692
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.dateTimeSplitStrategy) === true) {
|
|
1693
|
+
const variant = Transformer.determineSchemaVariant(this.name);
|
|
1694
|
+
if (variant === 'input') {
|
|
1695
|
+
dateExpr = 'z.coerce.date()';
|
|
1696
|
+
}
|
|
1697
|
+
else {
|
|
1698
|
+
dateExpr = 'z.date()';
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1703
|
+
const baseSchema = customSchema || dateExpr;
|
|
1704
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema));
|
|
1705
|
+
}
|
|
1706
|
+
else if (inputType.type === 'Json') {
|
|
1707
|
+
const typedJson = this.typedJsonForField(field, inputType);
|
|
1708
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1709
|
+
const baseSchema = typedJsonBase(typedJson, inputType) || customSchema || 'jsonSchema';
|
|
1710
|
+
// A typed field no longer mentions `jsonSchema`, so flagging it would emit an
|
|
1711
|
+
// unused import. Gated on typedJson specifically, not on the resulting expression:
|
|
1712
|
+
// the `@zod.custom.use` path has always set this and must keep doing so, or every
|
|
1713
|
+
// schema using that escape hatch changes.
|
|
1714
|
+
if (!typedJson)
|
|
1715
|
+
this.hasJson = true;
|
|
1716
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema || !!typedJson));
|
|
1717
|
+
}
|
|
1718
|
+
else if (inputType.type === 'True') {
|
|
1719
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1720
|
+
const baseSchema = customSchema || 'z.literal(true)';
|
|
1721
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema));
|
|
1722
|
+
}
|
|
1723
|
+
else if (inputType.type === 'Bytes') {
|
|
1724
|
+
let bytesExpr = 'z.instanceof(Uint8Array)';
|
|
1725
|
+
// JSON Schema compatibility mode overrides normal behavior
|
|
1726
|
+
if (Transformer.isJsonSchemaModeEnabled()) {
|
|
1727
|
+
const { bytesFormat } = Transformer.getJsonSchemaOptions();
|
|
1728
|
+
const format = bytesFormat || 'base64String';
|
|
1729
|
+
if (format === 'base64String') {
|
|
1730
|
+
// Proper 4-char blocks with valid terminal padding
|
|
1731
|
+
bytesExpr =
|
|
1732
|
+
'z.string().regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(?:==)?|[A-Za-z0-9+/]{3}=)?$/, "Invalid base64 string")';
|
|
1733
|
+
}
|
|
1734
|
+
else {
|
|
1735
|
+
// Even number of hex chars
|
|
1736
|
+
bytesExpr = 'z.string().regex(/^(?:[0-9a-fA-F]{2})+$/, "Invalid hex string")';
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
const customSchema = this.getCustomSchemaForField(field.name);
|
|
1740
|
+
const baseSchema = customSchema || bytesExpr;
|
|
1741
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType, !!customSchema));
|
|
1742
|
+
}
|
|
1743
|
+
else {
|
|
1744
|
+
const isEnum = inputType.location === 'enumTypes';
|
|
1745
|
+
if (inputType.namespace === 'prisma' && !isEnum) {
|
|
1746
|
+
// Prisma object/nested input types: use the standard generator path
|
|
1747
|
+
if (inputType.type !== this.name && typeof inputType.type === 'string') {
|
|
1748
|
+
this.addSchemaImport(inputType.type);
|
|
1749
|
+
}
|
|
1750
|
+
result.push(this.generatePrismaStringLine(field, inputType, lines.length));
|
|
1751
|
+
}
|
|
1752
|
+
else if (isEnum) {
|
|
1753
|
+
// Enum types: build the correct enum schema reference then apply @zod validations
|
|
1754
|
+
if (typeof inputType.type === 'string') {
|
|
1755
|
+
// Ensure enum schema import is tracked
|
|
1756
|
+
this.addSchemaImport(inputType.type);
|
|
1757
|
+
}
|
|
1758
|
+
// Resolve enum export name via naming resolver (mirrors generatePrismaStringLine)
|
|
1759
|
+
const enumNamingConfig = (0, naming_resolver_1.resolveEnumNaming)(Transformer.getGeneratorConfig());
|
|
1760
|
+
const enumSchemaLine = (0, naming_resolver_1.generateExportName)(enumNamingConfig.exportNamePattern, inputType.type, undefined, undefined, inputType.type);
|
|
1761
|
+
const baseSchema = enumSchemaLine;
|
|
1762
|
+
result.push(this.wrapWithZodValidators(baseSchema, field, inputType));
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
return result;
|
|
1766
|
+
}, []);
|
|
1767
|
+
if (alternatives.length === 0) {
|
|
1768
|
+
return [];
|
|
1769
|
+
}
|
|
1770
|
+
// If any alternative uses a getter-based property (v4 recursion),
|
|
1771
|
+
// treat it as a complete property entry and skip wrapper/optionality tweaks.
|
|
1772
|
+
const hasGetterAlternative = alternatives.some((alt) => alt.trimStart().startsWith('get '));
|
|
1773
|
+
if (hasGetterAlternative) {
|
|
1774
|
+
const cleaned = alternatives.map((alt) => alt.replace(/,\s*$/, ''));
|
|
1775
|
+
const final = cleaned.join(', ');
|
|
1776
|
+
return [[` ${final}`, field, true]];
|
|
1777
|
+
}
|
|
1778
|
+
if (alternatives.length > 1) {
|
|
1779
|
+
alternatives = alternatives.map((alter) => Transformer.withTypedJsonMasked(alter, typedJsonExpressions, (value) => value.replace('.optional()', '')));
|
|
1780
|
+
}
|
|
1781
|
+
// Check if ALL alternatives already include the field name
|
|
1782
|
+
// This happens when inputsLength === 1 for all alternatives
|
|
1783
|
+
// We check if alternatives start with the field name pattern (spaces + fieldname + colon)
|
|
1784
|
+
const fieldNamePattern = ` ${field.name}:`;
|
|
1785
|
+
const allAlternativesHaveFieldName = alternatives.every((alt) => alt.startsWith(fieldNamePattern));
|
|
1786
|
+
const fieldName = allAlternativesHaveFieldName ? '' : fieldNamePattern;
|
|
1787
|
+
// Base optional marker; union gets a trailing optional which we'll normalize below
|
|
1788
|
+
const opt = !field.isRequired ? '.optional()' : '';
|
|
1789
|
+
let resString = alternatives.length === 1
|
|
1790
|
+
? alternatives.join(', ')
|
|
1791
|
+
: `z.union([${alternatives.join(', ')}])${opt}`;
|
|
1792
|
+
// Policy fix:
|
|
1793
|
+
// - Keep relation fields as optional only (no nullable)
|
|
1794
|
+
// - For non-relation fields that are optional, append .optional().nullable()
|
|
1795
|
+
// - For required-but-nullable fields, append .nullable()
|
|
1796
|
+
const isRelationArg = Transformer.isRelationFieldArg(field) ||
|
|
1797
|
+
[
|
|
1798
|
+
'create',
|
|
1799
|
+
'connectOrCreate',
|
|
1800
|
+
'connect',
|
|
1801
|
+
'disconnect',
|
|
1802
|
+
'delete',
|
|
1803
|
+
'update',
|
|
1804
|
+
'upsert',
|
|
1805
|
+
'set',
|
|
1806
|
+
'updateMany',
|
|
1807
|
+
'deleteMany',
|
|
1808
|
+
'createMany',
|
|
1809
|
+
].includes(field.name);
|
|
1810
|
+
// Strip any existing optional/nullable/nullish from the composed string; we will re-apply
|
|
1811
|
+
resString = Transformer.withTypedJsonMasked(resString, typedJsonExpressions, (value) => value
|
|
1812
|
+
.replace(/\.optional\(\)/g, '')
|
|
1813
|
+
.replace(/\.nullish\(\)/g, '')
|
|
1814
|
+
.replace(/\.nullable\(\)/g, ''));
|
|
1815
|
+
let isRequired = field.isRequired;
|
|
1816
|
+
if (this.name.includes('CreateInput')) {
|
|
1817
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
1818
|
+
if (modelName) {
|
|
1819
|
+
const model = this.models.find((m) => m.name === modelName);
|
|
1820
|
+
if (model) {
|
|
1821
|
+
const modelField = model.fields.find((f) => f.name === field.name);
|
|
1822
|
+
if (modelField) {
|
|
1823
|
+
if (modelField.isUpdatedAt) {
|
|
1824
|
+
return [];
|
|
1825
|
+
}
|
|
1826
|
+
const isListField = modelField.isList;
|
|
1827
|
+
if (isListField) {
|
|
1828
|
+
// Prisma marks list fields (relation or scalar) as required in the datamodel,
|
|
1829
|
+
// but the generated CreateInput/UncheckedCreateInput types expose them as optional.
|
|
1830
|
+
// Treat them as optional to stay aligned with @prisma/client.
|
|
1831
|
+
isRequired = false;
|
|
1832
|
+
}
|
|
1833
|
+
else {
|
|
1834
|
+
// DMMF schema.inputObjectTypes isRequired is the source of truth — it is
|
|
1835
|
+
// exactly what @prisma/client's input types are generated from. The datamodel
|
|
1836
|
+
// recompute may only relax requiredness (e.g. a field with a default becomes
|
|
1837
|
+
// optional); it must never promote a DMMF-optional field to required
|
|
1838
|
+
// (e.g. a to-one relation whose FK scalar has a default).
|
|
1839
|
+
isRequired = field.isRequired && modelField.isRequired && !modelField.hasDefaultValue;
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
if (!isRequired) {
|
|
1846
|
+
resString += '.optional()';
|
|
1847
|
+
}
|
|
1848
|
+
if (field.isNullable && !isRelationArg) {
|
|
1849
|
+
resString += '.nullable()';
|
|
1850
|
+
}
|
|
1851
|
+
// Zod v4 target: object schema references composed eagerly (e.g. inside
|
|
1852
|
+
// z.union([...])) dereference other module-scope consts before they are
|
|
1853
|
+
// initialized (TDZ/undefined crashes on forward or circular references).
|
|
1854
|
+
// Wrap the whole composed expression in a getter so resolution is deferred
|
|
1855
|
+
// to first parse, mirroring v3's z.lazy semantics.
|
|
1856
|
+
const unionTarget = ((_b = (_a = Transformer.getGeneratorConfig()) === null || _a === void 0 ? void 0 : _a.zodImportTarget) !== null && _b !== void 0 ? _b : 'auto');
|
|
1857
|
+
const hasObjectSchemaRef = field.inputTypes.some((it) => it.type === this.name || (it.namespace === 'prisma' && it.location !== 'enumTypes'));
|
|
1858
|
+
if (unionTarget === 'v4' && hasObjectSchemaRef) {
|
|
1859
|
+
return [[` get ${field.name}(){ return ${resString.trim()}; }`, field, true]];
|
|
1860
|
+
}
|
|
1861
|
+
return [[` ${fieldName} ${resString} `, field, true]];
|
|
1862
|
+
}
|
|
1863
|
+
wrapWithZodValidators(mainValidator, field, inputType, skipZodAnnotations = false,
|
|
1864
|
+
/**
|
|
1865
|
+
* Whether a native `@db.VarChar(n)` length may still be appended to the base.
|
|
1866
|
+
*
|
|
1867
|
+
* False only for a typed replacement that is not rooted in `z.string()`. The native-max
|
|
1868
|
+
* block rewrites the leading `z.…(…)` call, so `!['A' | 'B']` on a `String @db.VarChar(8)`
|
|
1869
|
+
* would emit `z.enum(['A','B']).max(8)` - a module that throws `TypeError` on import.
|
|
1870
|
+
*/
|
|
1871
|
+
allowNativeMaxLength = true) {
|
|
1872
|
+
var _a;
|
|
1873
|
+
let line = mainValidator;
|
|
1874
|
+
let hasEnhancedZodSchema = false;
|
|
1875
|
+
// Track when we composed from a dot-prefixed validation chain (e.g., ".min(1)")
|
|
1876
|
+
// This helps us place array() in the correct position for list fields
|
|
1877
|
+
let composedFromChainOnly = false;
|
|
1878
|
+
let composedBaseForChain = null;
|
|
1879
|
+
let composedChainOnly = null;
|
|
1880
|
+
// Re-enabled @zod comment validations
|
|
1881
|
+
try {
|
|
1882
|
+
// Add safety check to prevent infinite loops
|
|
1883
|
+
if (field.name && typeof field.name === 'string' && field.name.length > 0) {
|
|
1884
|
+
const zodValidations = this.extractZodValidationsForField(field.name, field);
|
|
1885
|
+
if (!skipZodAnnotations && zodValidations) {
|
|
1886
|
+
const base = (mainValidator !== null && mainValidator !== void 0 ? mainValidator : '').trim();
|
|
1887
|
+
const chain = zodValidations.trim();
|
|
1888
|
+
const isChainOnly = chain.startsWith('.');
|
|
1889
|
+
// When the annotation is a dot-prefixed chain (e.g., .min(1)),
|
|
1890
|
+
// always compose it with the base (whether the base is a reference
|
|
1891
|
+
// or a z.* constructor). This avoids producing chain-only sequences
|
|
1892
|
+
// like ".min(1)" and preserves proper ordering for lists where
|
|
1893
|
+
// we later need to place array() before the chain.
|
|
1894
|
+
if (base && isChainOnly) {
|
|
1895
|
+
line = `${base}${chain}`;
|
|
1896
|
+
composedFromChainOnly = true;
|
|
1897
|
+
composedBaseForChain = base;
|
|
1898
|
+
composedChainOnly = chain;
|
|
1899
|
+
}
|
|
1900
|
+
else {
|
|
1901
|
+
// Otherwise, use the provided validations as-is (covers full schemas
|
|
1902
|
+
// like z.email(), z.enum([...]), z.array(...).min(), etc.)
|
|
1903
|
+
line = chain;
|
|
1904
|
+
}
|
|
1905
|
+
hasEnhancedZodSchema = true;
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
catch (error) {
|
|
1910
|
+
// If @zod processing fails, continue with the default validator
|
|
1911
|
+
console.warn(`Failed to process @zod comments for field ${field.name}:`, error);
|
|
1912
|
+
}
|
|
1913
|
+
// Apply native type constraints (e.g., @db.VarChar(255) -> .max(255))
|
|
1914
|
+
// Only for String types and only if no enhanced Zod schema is already applied
|
|
1915
|
+
if (inputType.type === 'String' && field.name && allowNativeMaxLength) {
|
|
1916
|
+
const nativeMaxLength = this.extractMaxLengthFromNativeType(field);
|
|
1917
|
+
const existingMaxConstraint = hasEnhancedZodSchema
|
|
1918
|
+
? this.extractExistingMaxConstraint(line)
|
|
1919
|
+
: null;
|
|
1920
|
+
if (nativeMaxLength !== null) {
|
|
1921
|
+
if (hasEnhancedZodSchema && existingMaxConstraint !== null) {
|
|
1922
|
+
// Both native type and @zod.max exist - use the more restrictive one
|
|
1923
|
+
const finalMaxLength = Math.min(nativeMaxLength, existingMaxConstraint);
|
|
1924
|
+
line = this.replaceAllMaxConstraints(line, finalMaxLength);
|
|
1925
|
+
}
|
|
1926
|
+
else if (hasEnhancedZodSchema && existingMaxConstraint === null) {
|
|
1927
|
+
// Enhanced @zod schema exists but no max constraint - add native constraint
|
|
1928
|
+
line = this.replaceAllMaxConstraints(line, nativeMaxLength);
|
|
1929
|
+
}
|
|
1930
|
+
else if (!hasEnhancedZodSchema) {
|
|
1931
|
+
// Only native type constraint exists - apply it to the base validator
|
|
1932
|
+
line = this.replaceAllMaxConstraints(line, nativeMaxLength);
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
if (inputType.isList) {
|
|
1937
|
+
if (inputType.type === 'DateTime') {
|
|
1938
|
+
// In JSON Schema compatibility mode, Date is not representable; use string[]
|
|
1939
|
+
if (Transformer.isJsonSchemaModeEnabled()) {
|
|
1940
|
+
const { dateTimeFormat } = Transformer.getJsonSchemaOptions();
|
|
1941
|
+
const format = dateTimeFormat || 'isoString';
|
|
1942
|
+
const strExpr = format === 'isoDate'
|
|
1943
|
+
? 'z.string().regex(/^\\d{4}-\\d{2}-\\d{2}$/,"Invalid ISO date")'
|
|
1944
|
+
: 'z.string().regex(/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$/,"Invalid RFC3339 date-time")';
|
|
1945
|
+
line = `${strExpr}.array()`;
|
|
1946
|
+
}
|
|
1947
|
+
else {
|
|
1948
|
+
// For DateTime lists, support both Date and ISO datetime arrays
|
|
1949
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
1950
|
+
const target = ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.zodImportTarget) !== null && _a !== void 0 ? _a : 'auto');
|
|
1951
|
+
const datetimeValidator = target === 'v4' ? 'z.iso.datetime()' : 'z.string().datetime()';
|
|
1952
|
+
line = `z.union([z.date().array(), ${datetimeValidator}.array()])`;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
else {
|
|
1956
|
+
// Append array() only once to avoid duplication. Do NOT treat z.array(...)
|
|
1957
|
+
// as an existing .array() call — tests expect a trailing .array() even if
|
|
1958
|
+
// the base is already wrapped with z.array(...).
|
|
1959
|
+
if (!line.includes('.array()')) {
|
|
1960
|
+
if (composedFromChainOnly && composedBaseForChain && composedChainOnly) {
|
|
1961
|
+
// Compose as: Base.array().<chain> then allow the final safety to normalize
|
|
1962
|
+
line = `${composedBaseForChain}.array()${composedChainOnly}`;
|
|
1963
|
+
}
|
|
1964
|
+
else {
|
|
1965
|
+
line += '.array()';
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
// Handle optionality correctly - add .optional() before any validations if field is optional
|
|
1971
|
+
if (!field.isRequired) {
|
|
1972
|
+
if (hasEnhancedZodSchema) {
|
|
1973
|
+
// For enhanced schemas, check if optionality is already handled
|
|
1974
|
+
if (!line.includes('.optional()') && !line.includes('.nullable()')) {
|
|
1975
|
+
// Extract base type and validations, then reorder
|
|
1976
|
+
// For enhanced Zod schemas like "z.string().email()", we need to carefully split
|
|
1977
|
+
// to avoid duplicating the base type in the validations part
|
|
1978
|
+
const baseTypeMatch = line.match(/^(z\.[^.(]+(?:\([^)]*\))?)/);
|
|
1979
|
+
if (baseTypeMatch) {
|
|
1980
|
+
const baseType = baseTypeMatch[1]; // e.g., "z.string"
|
|
1981
|
+
const afterBaseType = line.substring(baseType.length); // e.g., "().email()"
|
|
1982
|
+
const validationsMatch = afterBaseType.match(/^(\(\))?(.*)$/);
|
|
1983
|
+
if (validationsMatch) {
|
|
1984
|
+
const baseCall = validationsMatch[1] || ''; // e.g., "()"
|
|
1985
|
+
const actualValidations = validationsMatch[2]; // e.g., ".email()"
|
|
1986
|
+
line = `${baseType}${baseCall}${actualValidations}.optional()`;
|
|
1987
|
+
}
|
|
1988
|
+
else {
|
|
1989
|
+
line += '.optional()';
|
|
1990
|
+
}
|
|
1991
|
+
}
|
|
1992
|
+
else {
|
|
1993
|
+
line += '.optional()';
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
}
|
|
1997
|
+
else {
|
|
1998
|
+
line += '.optional()';
|
|
1999
|
+
}
|
|
2000
|
+
}
|
|
2001
|
+
// Final safety: collapse any accidental duplicate array() chaining (e.g., .array().array())
|
|
2002
|
+
line = line.replace(/(\.array\(\))+$/, '.array()');
|
|
2003
|
+
return line;
|
|
2004
|
+
}
|
|
2005
|
+
addSchemaImport(name) {
|
|
2006
|
+
// Only add import if the schema is enabled
|
|
2007
|
+
if (this.isSchemaImportEnabled(name)) {
|
|
2008
|
+
this.schemaImports.add(name);
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* Check if a schema import should be included based on minimal mode configuration
|
|
2013
|
+
*/
|
|
2014
|
+
isSchemaImportEnabled(schemaName) {
|
|
2015
|
+
// Skip model checking for enum names - enums are always allowed
|
|
2016
|
+
if (Transformer.enumNames.includes(schemaName)) {
|
|
2017
|
+
return true;
|
|
2018
|
+
}
|
|
2019
|
+
// Allow scalar/enum filter and field update helper types regardless of model gating
|
|
2020
|
+
// These helper types are not tied to a single model in Prisma v6
|
|
2021
|
+
const helperTypePatterns = [
|
|
2022
|
+
/^(?:Enum\w+NullableFilter|Enum\w+Filter)$/,
|
|
2023
|
+
/^(?:\w+NullableFilter|\w+Filter)$/,
|
|
2024
|
+
/^(?:\w+WithAggregatesFilter|Nested\w+Filter|Nested\w+WithAggregatesFilter)$/,
|
|
2025
|
+
/^(?:\w+FieldUpdateOperationsInput|Nullable\w+FieldUpdateOperationsInput)$/,
|
|
2026
|
+
];
|
|
2027
|
+
if (helperTypePatterns.some((p) => p.test(schemaName))) {
|
|
2028
|
+
return true;
|
|
2029
|
+
}
|
|
2030
|
+
// First check if the related model is enabled
|
|
2031
|
+
const modelName = this.extractModelNameFromSchema(schemaName);
|
|
2032
|
+
if (modelName && !Transformer.isModelEnabled(modelName)) {
|
|
2033
|
+
return false; // Don't import schemas for disabled models
|
|
2034
|
+
}
|
|
2035
|
+
const config = Transformer.getGeneratorConfig();
|
|
2036
|
+
if ((config === null || config === void 0 ? void 0 : config.mode) !== 'minimal') {
|
|
2037
|
+
return true; // Allow all imports in non-minimal mode (if model is enabled)
|
|
2038
|
+
}
|
|
2039
|
+
// In minimal mode, check against the same patterns used in isObjectSchemaEnabled
|
|
2040
|
+
const disallowedPatterns = [
|
|
2041
|
+
// Block Include/Select helper schemas entirely in minimal mode
|
|
2042
|
+
/Args$/,
|
|
2043
|
+
/Include$/,
|
|
2044
|
+
/Select$/,
|
|
2045
|
+
/OrderByWithAggregationInput$/,
|
|
2046
|
+
/ScalarWhereWithAggregatesInput$/,
|
|
2047
|
+
/CountAggregateInput$/,
|
|
2048
|
+
/AvgAggregateInput$/,
|
|
2049
|
+
/SumAggregateInput$/,
|
|
2050
|
+
/MinAggregateInput$/,
|
|
2051
|
+
/MaxAggregateInput$/,
|
|
2052
|
+
// Deep or relation-heavy object inputs
|
|
2053
|
+
/CreateNested\w+Input$/,
|
|
2054
|
+
/UpdateNested\w+Input$/,
|
|
2055
|
+
/UpsertNested\w+Input$/,
|
|
2056
|
+
/CreateWithout\w+Input$/,
|
|
2057
|
+
/UncheckedCreateWithout\w+Input$/,
|
|
2058
|
+
/UpdateWithout\w+Input$/,
|
|
2059
|
+
/UncheckedUpdateWithout\w+Input$/,
|
|
2060
|
+
/UpsertWithout\w+Input$/,
|
|
2061
|
+
/UpdateManyWithout\w+NestedInput$/,
|
|
2062
|
+
/UncheckedUpdateManyWithout\w+NestedInput$/,
|
|
2063
|
+
/CreateMany\w+InputEnvelope$/,
|
|
2064
|
+
/ListRelationFilter$/,
|
|
2065
|
+
/RelationFilter$/,
|
|
2066
|
+
/ScalarRelationFilter$/,
|
|
2067
|
+
// Block schemas that depend on blocked Without schemas
|
|
2068
|
+
/CreateOrConnectWithout\w+Input$/,
|
|
2069
|
+
/CreateManyWithout\w+Input$/,
|
|
2070
|
+
/UpdateToOneWithWhereWithout\w+Input$/,
|
|
2071
|
+
/UpdateOneWithout\w+NestedInput$/,
|
|
2072
|
+
/UpdateOneRequiredWithout\w+NestedInput$/,
|
|
2073
|
+
/UpdateManyWithWhereWithout\w+Input$/,
|
|
2074
|
+
/UpdateWithWhereUniqueWithout\w+Input$/,
|
|
2075
|
+
];
|
|
2076
|
+
if (disallowedPatterns.some((p) => p.test(schemaName))) {
|
|
2077
|
+
return false;
|
|
2078
|
+
}
|
|
2079
|
+
return true;
|
|
2080
|
+
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Extract model name from schema name for import filtering
|
|
2083
|
+
*/
|
|
2084
|
+
extractModelNameFromSchema(schemaName) {
|
|
2085
|
+
// Common patterns for Prisma object schema names - same as in prisma-generator.ts
|
|
2086
|
+
const patterns = [
|
|
2087
|
+
// Most specific patterns first to avoid false matches
|
|
2088
|
+
/^(\w+)UncheckedCreateNestedManyWithout\w+Input$/,
|
|
2089
|
+
/^(\w+)UncheckedUpdateManyWithout\w+Input$/,
|
|
2090
|
+
/^(\w+)UncheckedUpdateManyWithout\w+NestedInput$/,
|
|
2091
|
+
/^(\w+)UncheckedCreateWithout\w+Input$/,
|
|
2092
|
+
/^(\w+)UncheckedUpdateWithout\w+Input$/,
|
|
2093
|
+
/^(\w+)CreateNestedOneWithout\w+Input$/,
|
|
2094
|
+
/^(\w+)CreateNestedManyWithout\w+Input$/,
|
|
2095
|
+
/^(\w+)UpdateNestedOneWithout\w+Input$/,
|
|
2096
|
+
/^(\w+)UpdateNestedManyWithout\w+Input$/,
|
|
2097
|
+
/^(\w+)UpsertNestedOneWithout\w+Input$/,
|
|
2098
|
+
/^(\w+)UpsertNestedManyWithout\w+Input$/,
|
|
2099
|
+
/^(\w+)CreateOrConnectWithout\w+Input$/,
|
|
2100
|
+
/^(\w+)UpdateOneRequiredWithout\w+NestedInput$/,
|
|
2101
|
+
/^(\w+)UpdateToOneWithWhereWithout\w+Input$/,
|
|
2102
|
+
/^(\w+)UpsertWithout\w+Input$/,
|
|
2103
|
+
/^(\w+)CreateWithout\w+Input$/,
|
|
2104
|
+
/^(\w+)UpdateWithout\w+Input$/,
|
|
2105
|
+
/^(\w+)UpdateManyWithWhereWithout\w+Input$/,
|
|
2106
|
+
/^(\w+)UpdateWithWhereUniqueWithout\w+Input$/,
|
|
2107
|
+
/^(\w+)UpsertWithWhereUniqueWithout\w+Input$/,
|
|
2108
|
+
/^(\w+)UpdateManyWithout\w+NestedInput$/,
|
|
2109
|
+
/^(\w+)CreateManyAuthorInput$/,
|
|
2110
|
+
/^(\w+)CreateManyAuthorInputEnvelope$/,
|
|
2111
|
+
/^(\w+)ScalarWhereInput$/,
|
|
2112
|
+
// Basic input types - more specific patterns first
|
|
2113
|
+
/^(\w+)UncheckedCreateInput$/,
|
|
2114
|
+
/^(\w+)UncheckedUpdateInput$/,
|
|
2115
|
+
/^(\w+)UncheckedUpdateManyInput$/,
|
|
2116
|
+
/^(\w+)UpdateManyMutationInput$/,
|
|
2117
|
+
/^(\w+)WhereUniqueInput$/,
|
|
2118
|
+
/^(\w+)CreateManyInput$/,
|
|
2119
|
+
/^(\w+)UpdateManyInput$/,
|
|
2120
|
+
/^(\w+)WhereInput$/,
|
|
2121
|
+
/^(\w+)CreateInput$/,
|
|
2122
|
+
/^(\w+)UpdateInput$/,
|
|
2123
|
+
// Order by inputs
|
|
2124
|
+
/^(\w+)OrderByWithRelationInput$/,
|
|
2125
|
+
/^(\w+)OrderByWithAggregationInput$/,
|
|
2126
|
+
/^(\w+)OrderByRelationAggregateInput$/,
|
|
2127
|
+
// Filter inputs
|
|
2128
|
+
/^(\w+)ScalarWhereInput$/,
|
|
2129
|
+
/^(\w+)ScalarWhereWithAggregatesInput$/,
|
|
2130
|
+
/^(\w+)ListRelationFilter$/,
|
|
2131
|
+
/^(\w+)RelationFilter$/,
|
|
2132
|
+
/^(\w+)ScalarRelationFilter$/,
|
|
2133
|
+
// Aggregate inputs
|
|
2134
|
+
/^(\w+)CountAggregateInput$/,
|
|
2135
|
+
/^(\w+)CountOrderByAggregateInput$/,
|
|
2136
|
+
/^(\w+)AvgAggregateInput$/,
|
|
2137
|
+
/^(\w+)AvgOrderByAggregateInput$/,
|
|
2138
|
+
/^(\w+)MaxAggregateInput$/,
|
|
2139
|
+
/^(\w+)MaxOrderByAggregateInput$/,
|
|
2140
|
+
/^(\w+)MinAggregateInput$/,
|
|
2141
|
+
/^(\w+)MinOrderByAggregateInput$/,
|
|
2142
|
+
/^(\w+)SumAggregateInput$/,
|
|
2143
|
+
/^(\w+)SumOrderByAggregateInput$/,
|
|
2144
|
+
// Args and other schemas
|
|
2145
|
+
/^(\w+)Args$/,
|
|
2146
|
+
/^(\w+)CountOutputTypeArgs$/,
|
|
2147
|
+
// Filter types - handle these specially as they may be phantom types
|
|
2148
|
+
/^Enum(\w+)NullableFilter$/,
|
|
2149
|
+
/^Enum(\w+)Filter$/,
|
|
2150
|
+
/^(\w+)NullableFilter$/,
|
|
2151
|
+
/^(\w+)Filter$/,
|
|
2152
|
+
];
|
|
2153
|
+
for (const pattern of patterns) {
|
|
2154
|
+
const match = schemaName.match(pattern);
|
|
2155
|
+
if (match) {
|
|
2156
|
+
return match[1];
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
// Fallback for any other schema names
|
|
2160
|
+
const fallbackMatch = schemaName.match(/^([A-Z][a-zA-Z0-9]*)/);
|
|
2161
|
+
return fallbackMatch ? fallbackMatch[1] : null;
|
|
2162
|
+
}
|
|
2163
|
+
/**
|
|
2164
|
+
* Extract max length constraint from native type (e.g., @db.VarChar(255) -> 255)
|
|
2165
|
+
*/
|
|
2166
|
+
extractMaxLengthFromNativeType(field) {
|
|
2167
|
+
// Check if the field has the enhanced field information with native type
|
|
2168
|
+
if (!this.enhancedModels || !field.name) {
|
|
2169
|
+
return null;
|
|
2170
|
+
}
|
|
2171
|
+
// Extract model name from the current transformer context
|
|
2172
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
2173
|
+
if (!modelName) {
|
|
2174
|
+
return null;
|
|
2175
|
+
}
|
|
2176
|
+
// Find the enhanced model information
|
|
2177
|
+
const enhancedModel = this.enhancedModels.find((em) => em.model.name === modelName);
|
|
2178
|
+
if (!enhancedModel) {
|
|
2179
|
+
return null;
|
|
2180
|
+
}
|
|
2181
|
+
// Find the enhanced field information
|
|
2182
|
+
const enhancedField = enhancedModel.enhancedFields.find((ef) => ef.field.name === field.name);
|
|
2183
|
+
if (!enhancedField || !enhancedField.field.nativeType) {
|
|
2184
|
+
return null;
|
|
2185
|
+
}
|
|
2186
|
+
const nativeType = enhancedField.field.nativeType;
|
|
2187
|
+
// nativeType is an array: [typeName, [param1, param2, ...]]
|
|
2188
|
+
if (!Array.isArray(nativeType) || nativeType.length < 2) {
|
|
2189
|
+
return null;
|
|
2190
|
+
}
|
|
2191
|
+
const [typeName, params] = nativeType;
|
|
2192
|
+
// Handle string length constraints for various native types
|
|
2193
|
+
if (typeof typeName === 'string') {
|
|
2194
|
+
// SQL database string types with explicit length parameters
|
|
2195
|
+
if (Array.isArray(params) && params.length > 0) {
|
|
2196
|
+
const supportedTypes = ['VarChar', 'Char', 'NVarChar', 'NChar', 'VARCHAR', 'CHAR'];
|
|
2197
|
+
if (supportedTypes.includes(typeName)) {
|
|
2198
|
+
const lengthParam = params[0];
|
|
2199
|
+
const maxLength = parseInt(lengthParam, 10);
|
|
2200
|
+
if (!isNaN(maxLength) && maxLength > 0) {
|
|
2201
|
+
return maxLength;
|
|
2202
|
+
}
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
// MongoDB ObjectId has a fixed length (24 hex characters)
|
|
2206
|
+
if (typeName === 'ObjectId') {
|
|
2207
|
+
return 24;
|
|
2208
|
+
}
|
|
2209
|
+
}
|
|
2210
|
+
return null;
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* Extract existing max constraint from @zod validations
|
|
2214
|
+
*/
|
|
2215
|
+
extractExistingMaxConstraint(zodValidation) {
|
|
2216
|
+
if (!zodValidation) {
|
|
2217
|
+
return null;
|
|
2218
|
+
}
|
|
2219
|
+
// Look for all .max(number) in the validation string and return the most restrictive
|
|
2220
|
+
const maxMatches = zodValidation.match(/\.max\((\d+)\)/g);
|
|
2221
|
+
if (maxMatches && maxMatches.length > 0) {
|
|
2222
|
+
let minMax = Infinity;
|
|
2223
|
+
for (const match of maxMatches) {
|
|
2224
|
+
const valueMatch = match.match(/\.max\((\d+)\)/);
|
|
2225
|
+
if (valueMatch) {
|
|
2226
|
+
const maxValue = parseInt(valueMatch[1], 10);
|
|
2227
|
+
if (!isNaN(maxValue) && maxValue > 0) {
|
|
2228
|
+
minMax = Math.min(minMax, maxValue);
|
|
2229
|
+
}
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
return minMax === Infinity ? null : minMax;
|
|
2233
|
+
}
|
|
2234
|
+
return null;
|
|
2235
|
+
}
|
|
2236
|
+
/**
|
|
2237
|
+
* Replace all max constraints in a validation string with a single constraint
|
|
2238
|
+
*/
|
|
2239
|
+
replaceAllMaxConstraints(validationString, newMaxValue) {
|
|
2240
|
+
// Strip any existing .max() constraints
|
|
2241
|
+
const result = validationString.replace(/\.max\(\s*\d+\s*\)/g, '');
|
|
2242
|
+
// Insert after the first Zod constructor call (covers z.string(), z.iso.date(), z.hash(), etc.)
|
|
2243
|
+
const baseCallMatch = result.match(/^(\s*z(?:\.[A-Za-z_]\w*)+\([^)]*\))/);
|
|
2244
|
+
if (baseCallMatch) {
|
|
2245
|
+
return result.replace(baseCallMatch[1], `${baseCallMatch[1]}.max(${newMaxValue})`);
|
|
2246
|
+
}
|
|
2247
|
+
console.warn(`[transformer] Could not find where to insert max constraint in: ${result}`);
|
|
2248
|
+
return result;
|
|
2249
|
+
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Extract @zod validations for a specific field using the enhanced model information
|
|
2252
|
+
*/
|
|
2253
|
+
/**
|
|
2254
|
+
* Whether this member carries a sort direction rather than the column's value.
|
|
2255
|
+
*
|
|
2256
|
+
* `OrderByWithRelationInput`, `OrderByWithAggregationInput` and the five
|
|
2257
|
+
* `<Agg>OrderByAggregateInput` families all take `SortOrder` (plus `SortOrderInput` on a
|
|
2258
|
+
* nullable column, which adds `nulls`). A `@zod.email()` written for the column is a
|
|
2259
|
+
* statement about the column's value and means nothing here, so applying it rejects
|
|
2260
|
+
* `orderBy: { contact: 'asc' }` and accepts `orderBy: { contact: 'a@b.com' }`.
|
|
2261
|
+
*
|
|
2262
|
+
* Asked of the DMMF rather than of the schema name on purpose. The sibling guards above
|
|
2263
|
+
* match `<Model>Select` and `<Agg>AggregateInput` by name, and the Select one shipped as a
|
|
2264
|
+
* substring test that silently dropped every annotation on a model named `SelectionRound`.
|
|
2265
|
+
* A name test here would do the same to `OrderByHistory`. An OrderBy member never offers
|
|
2266
|
+
* the scalar arm and a write or filter member always does, so the DMMF answers this
|
|
2267
|
+
* exactly, whatever the model is called.
|
|
2268
|
+
*/
|
|
2269
|
+
static isSortDirectionMember(field) {
|
|
2270
|
+
const inputTypes = field === null || field === void 0 ? void 0 : field.inputTypes;
|
|
2271
|
+
if (!inputTypes || inputTypes.length === 0)
|
|
2272
|
+
return false;
|
|
2273
|
+
return inputTypes.every((it) => it.type === 'SortOrder' || it.type === 'SortOrderInput');
|
|
2274
|
+
}
|
|
2275
|
+
extractZodValidationsForField(fieldName, field) {
|
|
2276
|
+
if (Transformer.isSortDirectionMember(field)) {
|
|
2277
|
+
return null;
|
|
2278
|
+
}
|
|
2279
|
+
// IMPORTANT: Don't apply field validations to Select schemas
|
|
2280
|
+
// Select schemas should always use boolean types regardless of the original field type
|
|
2281
|
+
//
|
|
2282
|
+
// Anchored, not a substring test. Every schema this guard exists for is a suffix
|
|
2283
|
+
// (`<Model>Select`, `<Model>CountOutputTypeSelect`), while "Select" is an ordinary
|
|
2284
|
+
// thing to find inside a user-chosen model name: `SelectionRound`, `SelectorProfile`,
|
|
2285
|
+
// `PreSelection`. A substring test silently dropped every `@zod` annotation on those
|
|
2286
|
+
// models' objects/ schemas while leaving them working in variants/, so nothing looked
|
|
2287
|
+
// wrong until an unvalidated payload reached the database. Keep it anchored.
|
|
2288
|
+
// `src/typed-json/emission.ts` matches Select schemas the same way.
|
|
2289
|
+
if (this.name && /^\w+Select$/.test(this.name)) {
|
|
2290
|
+
return null;
|
|
2291
|
+
}
|
|
2292
|
+
// IMPORTANT: Don't apply field validations to aggregate input schemas
|
|
2293
|
+
// Aggregate inputs use boolean flags to specify which fields to include in aggregation
|
|
2294
|
+
if (this.name && /(?:Count|Min|Max|Sum|Avg)AggregateInput$/.test(this.name)) {
|
|
2295
|
+
return null;
|
|
2296
|
+
}
|
|
2297
|
+
// Basic validation
|
|
2298
|
+
if (!fieldName || !this.enhancedModels || this.enhancedModels.length === 0) {
|
|
2299
|
+
return null;
|
|
2300
|
+
}
|
|
2301
|
+
// Extract model name from the current transformer context
|
|
2302
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
2303
|
+
if (!modelName) {
|
|
2304
|
+
return null;
|
|
2305
|
+
}
|
|
2306
|
+
// Find the enhanced model information
|
|
2307
|
+
const enhancedModel = this.enhancedModels.find((em) => em.model.name === modelName);
|
|
2308
|
+
if (!enhancedModel) {
|
|
2309
|
+
return null;
|
|
2310
|
+
}
|
|
2311
|
+
// Find the enhanced field information
|
|
2312
|
+
const enhancedField = enhancedModel.enhancedFields.find((ef) => ef.field.name === fieldName);
|
|
2313
|
+
if (!enhancedField) {
|
|
2314
|
+
return null;
|
|
2315
|
+
}
|
|
2316
|
+
// Return the Zod schema if it has annotations and is valid
|
|
2317
|
+
if (enhancedField.hasZodAnnotations && enhancedField.zodSchema) {
|
|
2318
|
+
return enhancedField.zodSchema;
|
|
2319
|
+
}
|
|
2320
|
+
return null;
|
|
2321
|
+
}
|
|
2322
|
+
generatePrismaStringLine(field, inputType, inputsLength) {
|
|
2323
|
+
var _a;
|
|
2324
|
+
const isEnum = inputType.location === 'enumTypes';
|
|
2325
|
+
const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(inputType.type);
|
|
2326
|
+
const objectSchemaLine = isModelQueryType
|
|
2327
|
+
? this.resolveModelQuerySchemaName(modelName, queryName)
|
|
2328
|
+
: Transformer.exportTypedSchemas
|
|
2329
|
+
? `${inputType.type}ObjectSchema`
|
|
2330
|
+
: `${inputType.type}Object${Transformer.zodSchemaSuffix}`;
|
|
2331
|
+
// Use proper enum naming resolution instead of hardcoded "Schema" suffix
|
|
2332
|
+
const enumNamingConfig = (0, naming_resolver_1.resolveEnumNaming)(Transformer.getGeneratorConfig());
|
|
2333
|
+
const enumSchemaLine = (0, naming_resolver_1.generateExportName)(enumNamingConfig.exportNamePattern, inputType.type, // Use enum name as model name for naming pattern
|
|
2334
|
+
undefined, // No operation
|
|
2335
|
+
undefined, // No input type
|
|
2336
|
+
inputType.type);
|
|
2337
|
+
const schema = inputType.type === this.name ? objectSchemaLine : isEnum ? enumSchemaLine : objectSchemaLine;
|
|
2338
|
+
const arr = inputType.isList ? '.array()' : '';
|
|
2339
|
+
const opt = !field.isRequired ? '.optional()' : '';
|
|
2340
|
+
// Only use lazy loading for self-references or complex object schemas that might have circular dependencies
|
|
2341
|
+
// Simple enums like SortOrder don't need lazy loading
|
|
2342
|
+
const isSelfReference = inputType.type === this.name;
|
|
2343
|
+
const needsLazyLoading = isSelfReference || (!isEnum && inputType.namespace === 'prisma');
|
|
2344
|
+
if (needsLazyLoading) {
|
|
2345
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
2346
|
+
const target = ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.zodImportTarget) !== null && _a !== void 0 ? _a : 'auto');
|
|
2347
|
+
if (target === 'v4') {
|
|
2348
|
+
// Prefer Zod v4 getter-based recursion to avoid z.lazy()
|
|
2349
|
+
const ref = isSelfReference ? `${this.name}ObjectSchema` : schema;
|
|
2350
|
+
if (inputsLength === 1) {
|
|
2351
|
+
return ` get ${field.name}(){ return ${ref}${arr}${opt}; },`;
|
|
2352
|
+
}
|
|
2353
|
+
// In unions, return the bare reference; the field name wrapper is applied later
|
|
2354
|
+
return `${ref}${arr}${opt}`;
|
|
2355
|
+
}
|
|
2356
|
+
if (isSelfReference) {
|
|
2357
|
+
// v3 and auto (legacy) use z.lazy
|
|
2358
|
+
return inputsLength === 1
|
|
2359
|
+
? ` ${field.name}: z.lazy(() => ${this.name}ObjectSchema)${arr}${opt}`
|
|
2360
|
+
: `z.lazy(() => ${this.name}ObjectSchema)${arr}${opt}`;
|
|
2361
|
+
}
|
|
2362
|
+
return inputsLength === 1
|
|
2363
|
+
? ` ${field.name}: z.lazy(() => ${schema})${arr}${opt}`
|
|
2364
|
+
: `z.lazy(() => ${schema})${arr}${opt}`;
|
|
2365
|
+
}
|
|
2366
|
+
else {
|
|
2367
|
+
return inputsLength === 1
|
|
2368
|
+
? ` ${field.name}: ${schema}${arr}${opt}`
|
|
2369
|
+
: `${schema}${arr}${opt}`;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
generateFieldValidators(zodStringWithMainType, field) {
|
|
2373
|
+
const { isRequired, isNullable } = field;
|
|
2374
|
+
if (!isRequired) {
|
|
2375
|
+
zodStringWithMainType += '.optional()';
|
|
2376
|
+
}
|
|
2377
|
+
if (isNullable) {
|
|
2378
|
+
zodStringWithMainType += '.nullable()';
|
|
2379
|
+
}
|
|
2380
|
+
return zodStringWithMainType;
|
|
2381
|
+
}
|
|
2382
|
+
prepareObjectSchema(zodObjectSchemaFields) {
|
|
2383
|
+
// Field processing is now handled earlier in generateObjectSchemaFields()
|
|
2384
|
+
// This method just prepares the final schema
|
|
2385
|
+
const finalFields = zodObjectSchemaFields;
|
|
2386
|
+
const objectSchemaBody = this.addFinalWrappers({ zodStringFields: finalFields });
|
|
2387
|
+
// Check if schema has self-references (needs explicit return type to avoid TS7023)
|
|
2388
|
+
const needsReturnType = finalFields.some((field) => field.includes(`z.lazy(() => ${this.name}ObjectSchema)`));
|
|
2389
|
+
// Apply GitHub issue 214 fix: use schema constant pattern for better type inference
|
|
2390
|
+
let objectSchema;
|
|
2391
|
+
if (needsReturnType) {
|
|
2392
|
+
// Use unique variable name to avoid conflicts in single-file mode
|
|
2393
|
+
const uniqueVarName = `${this.name.toLowerCase()}Schema`;
|
|
2394
|
+
const schemaDecl = `const ${uniqueVarName} = ${objectSchemaBody};\n`;
|
|
2395
|
+
objectSchema = `${schemaDecl}${this.generateExportObjectSchemaStatement(uniqueVarName)}\n`;
|
|
2396
|
+
}
|
|
2397
|
+
else {
|
|
2398
|
+
const factoryDecl = `const makeSchema = () => ${objectSchemaBody};\n`;
|
|
2399
|
+
objectSchema = `${factoryDecl}${this.generateExportObjectSchemaStatement('makeSchema()')}\n`;
|
|
2400
|
+
}
|
|
2401
|
+
// Add optional sanity-check block for Zod-only schemas when self recursion exists
|
|
2402
|
+
const hasSelfRecursion = finalFields.some((l) => l.includes(`z.lazy(() => ${this.name}ObjectSchema)`));
|
|
2403
|
+
if (Transformer.exportZodSchemas && hasSelfRecursion) {
|
|
2404
|
+
const sanity = this.generateZodOnlySanityCheck(finalFields);
|
|
2405
|
+
if (sanity)
|
|
2406
|
+
objectSchema += sanity + '\n';
|
|
2407
|
+
}
|
|
2408
|
+
// Get custom imports for this model by analyzing the actual schema content
|
|
2409
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
2410
|
+
const customImports = [
|
|
2411
|
+
...this.getCustomImportsForModel(modelName, objectSchema),
|
|
2412
|
+
...this.getTypedJsonImportsForSchema(modelName, objectSchema),
|
|
2413
|
+
];
|
|
2414
|
+
const baseImports = this.generateObjectSchemaImportStatements(customImports);
|
|
2415
|
+
let jsonImport = '';
|
|
2416
|
+
if (this.hasJson) {
|
|
2417
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
2418
|
+
const isMinimal = (cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal';
|
|
2419
|
+
if (isMinimal) {
|
|
2420
|
+
// Inline lightweight json helpers per file (cheaper in minimal mode, files are separate)
|
|
2421
|
+
jsonImport = `\nconst literalSchema = z.union([z.string(), z.number(), z.boolean()]);\nconst jsonSchema: any = z.lazy(() =>\n z.union([literalSchema, z.array(jsonSchema.nullable()), z.record(z.string(), jsonSchema.nullable())])\n);\n\n`;
|
|
2422
|
+
}
|
|
2423
|
+
else {
|
|
2424
|
+
// Ensure helpers file exists once and compute correct relative path from objects dir → helpers dir
|
|
2425
|
+
Transformer.ensureJsonHelpersFile();
|
|
2426
|
+
try {
|
|
2427
|
+
const objectsDir = path_1.default.join(Transformer.getSchemasPath(), 'objects');
|
|
2428
|
+
const helpersDir = path_1.default.join(Transformer.getOutputPath(), 'helpers');
|
|
2429
|
+
let rel = path_1.default.relative(objectsDir, helpersDir).replace(/\\/g, '/');
|
|
2430
|
+
if (!rel.startsWith('.') && !rel.startsWith('/'))
|
|
2431
|
+
rel = `./${rel}`;
|
|
2432
|
+
const extension = this.getImportFileExtension();
|
|
2433
|
+
jsonImport = `import { JsonValueSchema as jsonSchema } from '${rel}/json-helpers${extension}';\n\n`;
|
|
2434
|
+
}
|
|
2435
|
+
catch {
|
|
2436
|
+
// Fallback to original relative import (pre-change behavior)
|
|
2437
|
+
const extension = this.getImportFileExtension();
|
|
2438
|
+
jsonImport = `import { JsonValueSchema as jsonSchema } from './helpers/json-helpers${extension}';\n\n`;
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
}
|
|
2442
|
+
let decimalImport = '';
|
|
2443
|
+
if (this.hasDecimal) {
|
|
2444
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
2445
|
+
const mode = (cfg === null || cfg === void 0 ? void 0 : cfg.decimalMode) || 'decimal';
|
|
2446
|
+
const isMinimal = (cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal';
|
|
2447
|
+
if (mode === 'decimal') {
|
|
2448
|
+
if (isMinimal) {
|
|
2449
|
+
// Inline decimal helpers per file in minimal mode
|
|
2450
|
+
decimalImport = `\nconst DecimalJSLikeSchema: z.ZodType<Prisma.DecimalJsLike> = z.object({
|
|
2451
|
+
d: z.array(z.number()),
|
|
2452
|
+
e: z.number(),
|
|
2453
|
+
s: z.number(),
|
|
2454
|
+
// Zod v3/v4 compatible callable check
|
|
2455
|
+
toFixed: z.custom<Prisma.DecimalJsLike['toFixed']>((v) => typeof v === 'function'),
|
|
2456
|
+
});
|
|
2457
|
+
|
|
2458
|
+
// Accept canonical decimal strings (+/-, optional fraction, optional exponent), or Infinity/NaN.
|
|
2459
|
+
const DECIMAL_STRING_REGEX = /^(?:[+-]?(?:[0-9]+(?:\\.[0-9]+)?(?:[eE][+\\-]?[0-9]+)?|Infinity)|NaN)$/;
|
|
2460
|
+
|
|
2461
|
+
const isValidDecimalInput = (
|
|
2462
|
+
v?: null | string | number | Prisma.DecimalJsLike,
|
|
2463
|
+
): v is string | number | Prisma.DecimalJsLike => {
|
|
2464
|
+
if (v === undefined || v === null) return false;
|
|
2465
|
+
return (
|
|
2466
|
+
// Cross-runtime-copy safe check (browser and server runtimes bundle separate Decimal classes)
|
|
2467
|
+
Prisma.Decimal.isDecimal(v) ||
|
|
2468
|
+
(typeof v === 'object' &&
|
|
2469
|
+
'd' in v &&
|
|
2470
|
+
'e' in v &&
|
|
2471
|
+
's' in v &&
|
|
2472
|
+
'toFixed' in v) ||
|
|
2473
|
+
(typeof v === 'string' && DECIMAL_STRING_REGEX.test(v)) ||
|
|
2474
|
+
typeof v === 'number'
|
|
2475
|
+
);
|
|
2476
|
+
};
|
|
2477
|
+
|
|
2478
|
+
`;
|
|
2479
|
+
}
|
|
2480
|
+
else {
|
|
2481
|
+
// Import from helpers directory
|
|
2482
|
+
Transformer.ensureDecimalHelpersFile();
|
|
2483
|
+
try {
|
|
2484
|
+
const objectsDir = path_1.default.join(Transformer.getSchemasPath(), 'objects');
|
|
2485
|
+
const helpersDir = path_1.default.join(Transformer.getOutputPath(), 'helpers');
|
|
2486
|
+
let rel = path_1.default.relative(objectsDir, helpersDir).replace(/\\/g, '/');
|
|
2487
|
+
if (!rel.startsWith('.') && !rel.startsWith('/'))
|
|
2488
|
+
rel = `./${rel}`;
|
|
2489
|
+
const extension = this.getImportFileExtension();
|
|
2490
|
+
decimalImport = `import { DecimalJSLikeSchema, isValidDecimalInput } from '${rel}/decimal-helpers${extension}';\n`;
|
|
2491
|
+
}
|
|
2492
|
+
catch {
|
|
2493
|
+
const extension = this.getImportFileExtension();
|
|
2494
|
+
decimalImport = `import { DecimalJSLikeSchema, isValidDecimalInput } from './helpers/decimal-helpers${extension}';\n`;
|
|
2495
|
+
}
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
return `${baseImports}${jsonImport}${decimalImport}${objectSchema}`;
|
|
2500
|
+
}
|
|
2501
|
+
generateExportObjectSchemaStatement(schema) {
|
|
2502
|
+
var _a;
|
|
2503
|
+
let name = this.name;
|
|
2504
|
+
let exportName = this.name;
|
|
2505
|
+
if (Transformer.provider === 'mongodb') {
|
|
2506
|
+
// Only remap when the lookup succeeds so a miss can never crash generation
|
|
2507
|
+
const mapped = Transformer.rawOpsMap[name];
|
|
2508
|
+
if (mapped) {
|
|
2509
|
+
name = mapped;
|
|
2510
|
+
exportName = mapped.replace('Args', '');
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
// Use input naming configuration if available
|
|
2514
|
+
try {
|
|
2515
|
+
const config = Transformer.getGeneratorConfig();
|
|
2516
|
+
const inputNamingConfig = (_a = config === null || config === void 0 ? void 0 : config.naming) === null || _a === void 0 ? void 0 : _a.input;
|
|
2517
|
+
if (inputNamingConfig === null || inputNamingConfig === void 0 ? void 0 : inputNamingConfig.exportNamePattern) {
|
|
2518
|
+
const modelName = Transformer.extractModelNameFromContext(this.name);
|
|
2519
|
+
const inputType = this.name;
|
|
2520
|
+
const customExportName = (0, naming_resolver_1.generateExportName)(inputNamingConfig.exportNamePattern, modelName || inputType, undefined, inputType);
|
|
2521
|
+
if (customExportName) {
|
|
2522
|
+
// Remove schema suffixes from the export variable name; keep Prisma binding independent.
|
|
2523
|
+
exportName = customExportName.replace(/ObjectSchema$|Schema$/, '');
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
catch {
|
|
2528
|
+
// Fallback to default naming if there's an error
|
|
2529
|
+
}
|
|
2530
|
+
// Build dual exports: a typed Prisma-bound schema and a pure Zod schema
|
|
2531
|
+
// Always export the typed name as `${exportName}ObjectSchema` for compatibility
|
|
2532
|
+
const lines = [];
|
|
2533
|
+
const supportsPrismaType = !name.endsWith('Args');
|
|
2534
|
+
if (Transformer.exportTypedSchemas) {
|
|
2535
|
+
if (supportsPrismaType) {
|
|
2536
|
+
// Determine correct Prisma type binding from the intrinsic input name (this.name)
|
|
2537
|
+
const prismaBase = this.name;
|
|
2538
|
+
let prismaType = this.resolvePrismaTypeForObject(prismaBase);
|
|
2539
|
+
// Optionally wrap with Omit<> when strictCreateInputs=false and fields were excluded on Create-like inputs
|
|
2540
|
+
const config = (Transformer.getGeneratorConfig() || {});
|
|
2541
|
+
const strictCreateInputs = config.strictCreateInputs !== false; // default true
|
|
2542
|
+
const isInputVariant = Transformer.determineSchemaVariant(name) === 'input';
|
|
2543
|
+
const isCreateLike = [
|
|
2544
|
+
/^(\w+)CreateInput$/,
|
|
2545
|
+
/^(\w+)UncheckedCreateInput$/,
|
|
2546
|
+
/^(\w+)CreateManyInput$/,
|
|
2547
|
+
/^(\w+)CreateMany\w+Input$/,
|
|
2548
|
+
/^(\w+)CreateWithout\w+Input$/,
|
|
2549
|
+
/^(\w+)UncheckedCreateWithout\w+Input$/,
|
|
2550
|
+
/^(\w+)CreateOrConnectWithout\w+Input$/,
|
|
2551
|
+
/^(\w+)CreateNested(?:One|Many)Without\w+Input$/,
|
|
2552
|
+
].some((re) => re.test(this.name));
|
|
2553
|
+
const excludedNames = this.lastExcludedFieldNames || [];
|
|
2554
|
+
if (!strictCreateInputs &&
|
|
2555
|
+
isInputVariant &&
|
|
2556
|
+
isCreateLike &&
|
|
2557
|
+
excludedNames.length > 0 &&
|
|
2558
|
+
prismaType) {
|
|
2559
|
+
const union = excludedNames.map((n) => `'${n}'`).join(' | ');
|
|
2560
|
+
prismaType = `Omit<${prismaType}, ${union}>`;
|
|
2561
|
+
}
|
|
2562
|
+
if (prismaType) {
|
|
2563
|
+
lines.push(`export const ${exportName}ObjectSchema: z.ZodType<${prismaType}> = ${schema} as unknown as z.ZodType<${prismaType}>;`);
|
|
2564
|
+
}
|
|
2565
|
+
else {
|
|
2566
|
+
// Fallback to untyped if we cannot resolve a safe Prisma type
|
|
2567
|
+
lines.push(`export const ${exportName}ObjectSchema = ${schema};`);
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
else {
|
|
2571
|
+
// Args-like types may not exist on Prisma namespace; export untyped for compatibility
|
|
2572
|
+
lines.push(`export const ${exportName}ObjectSchema = ${schema};`);
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
if (Transformer.exportZodSchemas) {
|
|
2576
|
+
const zodName = `${exportName}Object${Transformer.zodSchemaSuffix}`;
|
|
2577
|
+
lines.push(`export const ${zodName} = ${schema};`);
|
|
2578
|
+
}
|
|
2579
|
+
// Fallback: if neither flag produced output, emit a basic (untyped) export
|
|
2580
|
+
if (lines.length === 0) {
|
|
2581
|
+
lines.push(`export const ${exportName}ObjectSchema = ${schema};`);
|
|
2582
|
+
}
|
|
2583
|
+
return lines.join('\n');
|
|
2584
|
+
}
|
|
2585
|
+
/**
|
|
2586
|
+
* Emit a manual TS type and a `satisfies z.ZodType<...>` check for Zod-only, self-recursive schemas.
|
|
2587
|
+
* This avoids TS7022 and keeps output variable types unchanged.
|
|
2588
|
+
*/
|
|
2589
|
+
generateZodOnlySanityCheck(_finalFields) {
|
|
2590
|
+
// According to the factory pattern spec, we should NOT add satisfies annotations
|
|
2591
|
+
// to pure Zod schemas as they break .extend()/.omit() functionality
|
|
2592
|
+
return '';
|
|
2593
|
+
}
|
|
2594
|
+
/**
|
|
2595
|
+
* Whether generateExportObjectSchemaStatement will emit a `z.ZodType<Prisma.X>`
|
|
2596
|
+
* annotated export for this object schema. Mirrors its decision exactly so the
|
|
2597
|
+
* `import type { Prisma }` line is only emitted when it is actually referenced
|
|
2598
|
+
* (e.g. `<Model>Args` schemas are always exported untyped).
|
|
2599
|
+
*/
|
|
2600
|
+
willGenerateTypedObjectExport() {
|
|
2601
|
+
if (!Transformer.exportTypedSchemas)
|
|
2602
|
+
return false;
|
|
2603
|
+
let name = this.name;
|
|
2604
|
+
if (Transformer.provider === 'mongodb' && (0, helpers_1.isMongodbRawOp)(name)) {
|
|
2605
|
+
name = Transformer.rawOpsMap[name];
|
|
2606
|
+
}
|
|
2607
|
+
return !name.endsWith('Args') && this.resolvePrismaTypeForObject(this.name) !== null;
|
|
2608
|
+
}
|
|
2609
|
+
/**
|
|
2610
|
+
* Resolve the appropriate Prisma type identifier for an object schema export.
|
|
2611
|
+
* In Prisma 6, certain aggregate input types are exported with a `Type` suffix.
|
|
2612
|
+
* Example: Prisma.PlanetCountAggregateInputType instead of Prisma.PlanetCountAggregateInput
|
|
2613
|
+
*/
|
|
2614
|
+
resolvePrismaTypeForObject(exportName) {
|
|
2615
|
+
// No Prisma types for generic Args wrappers here
|
|
2616
|
+
if (exportName.endsWith('Args'))
|
|
2617
|
+
return null;
|
|
2618
|
+
// A per-field copy of a shared update-operations input has no Prisma type of its own.
|
|
2619
|
+
// It is structurally the input it was copied from and binds to that one, so the
|
|
2620
|
+
// emitted file still typechecks against the client.
|
|
2621
|
+
const copiedFrom = Transformer.typedFieldUpdateOperationsPlan.prismaTypeNameFor(exportName);
|
|
2622
|
+
if (copiedFrom)
|
|
2623
|
+
return `Prisma.${copiedFrom}`;
|
|
2624
|
+
// Handle aggregate input objects that use the `Type` suffix
|
|
2625
|
+
if (/(Count|Min|Max|Avg|Sum)AggregateInput$/.test(exportName)) {
|
|
2626
|
+
return `Prisma.${exportName}Type`;
|
|
2627
|
+
}
|
|
2628
|
+
// Default mapping: Prisma.<ExportName>
|
|
2629
|
+
return `Prisma.${exportName}`;
|
|
2630
|
+
}
|
|
2631
|
+
addFinalWrappers({ zodStringFields }) {
|
|
2632
|
+
var _a, _b, _c;
|
|
2633
|
+
const fields = [...zodStringFields];
|
|
2634
|
+
// Base object + strict mode based on configuration
|
|
2635
|
+
const modelName = this.name ? Transformer.extractModelNameFromContext(this.name) : undefined;
|
|
2636
|
+
const strictModeSuffix = ((_a = Transformer.getStrictModeResolver()) === null || _a === void 0 ? void 0 : _a.getObjectStrictModeSuffix(modelName || undefined)) || '';
|
|
2637
|
+
// Zod v4's .strict() clones the schema def and spreads its shape, which invokes
|
|
2638
|
+
// every field getter at module-init time — defeating getter-based recursion and
|
|
2639
|
+
// crashing on forward/circular references. Use z.strictObject instead (identical
|
|
2640
|
+
// strictness semantics; the shape stays lazy until first parse).
|
|
2641
|
+
const isV4 = ((_c = (_b = Transformer.getGeneratorConfig()) === null || _b === void 0 ? void 0 : _b.zodImportTarget) !== null && _c !== void 0 ? _c : 'auto') === 'v4';
|
|
2642
|
+
let base = isV4 && strictModeSuffix === '.strict()'
|
|
2643
|
+
? this.wrapWithZodObject(fields, true)
|
|
2644
|
+
: this.wrapWithZodObject(fields) + strictModeSuffix;
|
|
2645
|
+
// WhereUniqueInput optional refinement (opt-in): require at least one selector
|
|
2646
|
+
if (this.name && /WhereUniqueInput$/.test(this.name)) {
|
|
2647
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
2648
|
+
if (cfg === null || cfg === void 0 ? void 0 : cfg.validateWhereUniqueAtLeastOne) {
|
|
2649
|
+
// Use the current object's top-level field names as valid selector keys
|
|
2650
|
+
// (includes single-field uniques and composite unique selectors)
|
|
2651
|
+
const selectorKeys = Array.from(new Set((this.fields || []).map((f) => f.name).filter(Boolean)));
|
|
2652
|
+
const selectorKeysJson = JSON.stringify(selectorKeys);
|
|
2653
|
+
const refineAtLeastOne = `.superRefine((obj, ctx) => {\n const keys: string[] = ${selectorKeysJson} as string[];\n const present = (k: string) => (obj as any)[k] != null;\n if (!Array.isArray(keys) || keys.length === 0) return;\n if (!keys.some(present)) {\n ctx.addIssue({ code: 'custom', message: 'Provide at least one unique selector' });\n }\n})`;
|
|
2654
|
+
base = base + refineAtLeastOne;
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
return base;
|
|
2658
|
+
}
|
|
2659
|
+
// Legacy method retained for backward compatibility; now returns empty string.
|
|
2660
|
+
static ensureJsonHelpersFile() {
|
|
2661
|
+
if (this.jsonHelpersWritten)
|
|
2662
|
+
return;
|
|
2663
|
+
this.jsonHelpersWritten = true;
|
|
2664
|
+
try {
|
|
2665
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- fallback sync write path for environments without top-level await
|
|
2666
|
+
const fs = require('fs');
|
|
2667
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
2668
|
+
const pathMod = require('path');
|
|
2669
|
+
const helpersDir = pathMod.join(this.outputPath, 'helpers');
|
|
2670
|
+
fs.mkdirSync(helpersDir, { recursive: true });
|
|
2671
|
+
const filePath = pathMod.join(helpersDir, 'json-helpers.ts');
|
|
2672
|
+
const zImport2 = new Transformer({
|
|
2673
|
+
name: '',
|
|
2674
|
+
fields: [],
|
|
2675
|
+
models: [],
|
|
2676
|
+
modelOperations: [],
|
|
2677
|
+
enumTypes: [],
|
|
2678
|
+
}).generateImportZodStatement();
|
|
2679
|
+
// Single source: src/helpers/json-helpers.ts. This was a second copy of that program,
|
|
2680
|
+
// maintained by hand.
|
|
2681
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
2682
|
+
const { generateJsonHelpers } = require('./helpers/json-helpers');
|
|
2683
|
+
const content = `${zImport2}\n${generateJsonHelpers()}`;
|
|
2684
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
2685
|
+
}
|
|
2686
|
+
catch (e) {
|
|
2687
|
+
logger_1.logger.warn(`Failed to write json helpers: ${e}`);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
static ensureDecimalHelpersFile() {
|
|
2691
|
+
if (this.decimalHelpersWritten)
|
|
2692
|
+
return;
|
|
2693
|
+
this.decimalHelpersWritten = true;
|
|
2694
|
+
try {
|
|
2695
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
2696
|
+
const fs = require('fs');
|
|
2697
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
2698
|
+
const pathMod = require('path');
|
|
2699
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
2700
|
+
const { generateDecimalHelpers, isDecimalJsAvailable } = require('./helpers/decimal-helpers');
|
|
2701
|
+
const helpersDir = pathMod.join(this.outputPath, 'helpers');
|
|
2702
|
+
fs.mkdirSync(helpersDir, { recursive: true });
|
|
2703
|
+
const filePath = pathMod.join(helpersDir, 'decimal-helpers.ts');
|
|
2704
|
+
// Check if decimal.js is available
|
|
2705
|
+
const hasDecimalJs = isDecimalJsAvailable();
|
|
2706
|
+
// Generate Zod import
|
|
2707
|
+
const zImport = new Transformer({
|
|
2708
|
+
name: '',
|
|
2709
|
+
fields: [],
|
|
2710
|
+
models: [],
|
|
2711
|
+
modelOperations: [],
|
|
2712
|
+
enumTypes: [],
|
|
2713
|
+
}).generateImportZodStatement();
|
|
2714
|
+
// Generate decimal helpers
|
|
2715
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(helpersDir);
|
|
2716
|
+
const { helperCode, imports } = generateDecimalHelpers(hasDecimalJs, 'z', prismaImportPath);
|
|
2717
|
+
const content = `${zImport}
|
|
2718
|
+
${imports.join('\n')}
|
|
2719
|
+
|
|
2720
|
+
${helperCode}
|
|
2721
|
+
`;
|
|
2722
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
2723
|
+
}
|
|
2724
|
+
catch (e) {
|
|
2725
|
+
logger_1.logger.warn(`Failed to write decimal helpers: ${e}`);
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2728
|
+
generateObjectSchemaImportStatements(customImports = []) {
|
|
2729
|
+
let generatedImports = this.generateImportZodStatement();
|
|
2730
|
+
// Add custom imports from @zod.import() annotations
|
|
2731
|
+
const customImportStatements = this.generateCustomImportStatements(customImports, 'objects');
|
|
2732
|
+
if (customImportStatements) {
|
|
2733
|
+
generatedImports += customImportStatements;
|
|
2734
|
+
}
|
|
2735
|
+
// Import Prisma - use value import if Decimal mode is active, otherwise type-only
|
|
2736
|
+
// (and only when the file's typed export will actually reference Prisma)
|
|
2737
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
2738
|
+
const mode = (cfg === null || cfg === void 0 ? void 0 : cfg.decimalMode) || 'decimal';
|
|
2739
|
+
const needsPrismaValueImport = this.hasDecimal && mode === 'decimal';
|
|
2740
|
+
const needsPrismaTypeImport = !needsPrismaValueImport && this.willGenerateTypedObjectExport();
|
|
2741
|
+
if (needsPrismaValueImport || needsPrismaTypeImport) {
|
|
2742
|
+
const objectsDir = path_1.default.join(Transformer.getSchemasPath(), 'objects');
|
|
2743
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(objectsDir);
|
|
2744
|
+
if (needsPrismaValueImport) {
|
|
2745
|
+
// Value import for instanceof checks in Decimal mode
|
|
2746
|
+
generatedImports += `import { Prisma } from '${prismaImportPath}';\n`;
|
|
2747
|
+
// Also try to import Decimal from decimal.js if available
|
|
2748
|
+
try {
|
|
2749
|
+
require.resolve('decimal.js');
|
|
2750
|
+
generatedImports += `import Decimal from 'decimal.js';\n`;
|
|
2751
|
+
}
|
|
2752
|
+
catch {
|
|
2753
|
+
// decimal.js not installed, skip the import
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
else {
|
|
2757
|
+
// Type-only import for typed schemas
|
|
2758
|
+
generatedImports += `import type { Prisma } from '${prismaImportPath}';\n`;
|
|
2759
|
+
}
|
|
2760
|
+
}
|
|
2761
|
+
generatedImports += this.generateSchemaImports();
|
|
2762
|
+
generatedImports += '\n\n';
|
|
2763
|
+
return generatedImports;
|
|
2764
|
+
}
|
|
2765
|
+
/**
|
|
2766
|
+
* Get the file extension to use for imports based on Prisma client configuration
|
|
2767
|
+
* For ESM with importFileExtension = "js", we need to add .js extension
|
|
2768
|
+
*/
|
|
2769
|
+
getImportFileExtension() {
|
|
2770
|
+
return Transformer.getImportFileExtension();
|
|
2771
|
+
}
|
|
2772
|
+
/**
|
|
2773
|
+
* Convert model name to PascalCase for consistent file naming
|
|
2774
|
+
*/
|
|
2775
|
+
getPascalCaseModelName(modelName) {
|
|
2776
|
+
return modelName
|
|
2777
|
+
.replace(/[_-\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))
|
|
2778
|
+
.replace(/^\w/, (c) => c.toUpperCase());
|
|
2779
|
+
}
|
|
2780
|
+
/**
|
|
2781
|
+
* Resolve an input object import honoring naming.input patterns, aliasing to stable identifiers.
|
|
2782
|
+
*/
|
|
2783
|
+
generateInputImport(inputTypeName, from = 'objects') {
|
|
2784
|
+
try {
|
|
2785
|
+
const cfg = (0, naming_resolver_1.resolveInputNaming)(Transformer.getGeneratorConfig());
|
|
2786
|
+
// Extract model name - fallback to inputTypeName if extraction fails
|
|
2787
|
+
const model = Transformer.extractModelNameFromContext(inputTypeName) || inputTypeName;
|
|
2788
|
+
// Generate the file name using the custom pattern
|
|
2789
|
+
const file = (0, naming_resolver_1.generateFileName)(cfg.filePattern, model, undefined, inputTypeName);
|
|
2790
|
+
const base = file.replace(/\.ts$/, '');
|
|
2791
|
+
// Generate export name using the custom pattern - this already includes the full name
|
|
2792
|
+
const resolvedExportName = (0, naming_resolver_1.generateExportName)(cfg.exportNamePattern, model, undefined, inputTypeName) || inputTypeName;
|
|
2793
|
+
const exportBase = resolvedExportName.replace(/ObjectSchema$|Schema$/, '');
|
|
2794
|
+
const importName = Transformer.exportTypedSchemas
|
|
2795
|
+
? `${exportBase}ObjectSchema`
|
|
2796
|
+
: `${exportBase}Object${Transformer.zodSchemaSuffix}`;
|
|
2797
|
+
// Create alias using the original input type name for consistency
|
|
2798
|
+
const alias = Transformer.exportTypedSchemas
|
|
2799
|
+
? `${inputTypeName}ObjectSchema`
|
|
2800
|
+
: `${inputTypeName}Object${Transformer.zodSchemaSuffix}`;
|
|
2801
|
+
const ext = this.getImportFileExtension();
|
|
2802
|
+
const baseDir = from === 'objects' ? './objects' : '../objects';
|
|
2803
|
+
return `import { ${importName} as ${alias} } from '${baseDir}/${base}${ext}'`;
|
|
2804
|
+
}
|
|
2805
|
+
catch (error) {
|
|
2806
|
+
// Log error for debugging and fallback to legacy naming
|
|
2807
|
+
logger_1.logger.warn('Failed to generate custom input import for', inputTypeName, error);
|
|
2808
|
+
const baseDir = from === 'objects' ? 'root' : 'results';
|
|
2809
|
+
// Use pattern-aware object input import helper as a fallback
|
|
2810
|
+
return this.generateObjectInputImport(inputTypeName, baseDir);
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* Generate enum import honoring naming.enum patterns, aliasing to stable identifiers.
|
|
2815
|
+
*/
|
|
2816
|
+
generateEnumImport(enumName, expectedAlias, from = 'objects') {
|
|
2817
|
+
try {
|
|
2818
|
+
const cfg = (0, naming_resolver_1.resolveEnumNaming)(Transformer.getGeneratorConfig());
|
|
2819
|
+
// Generate the file name using the custom pattern
|
|
2820
|
+
const file = (0, naming_resolver_1.generateFileName)(cfg.filePattern, enumName, undefined, undefined, enumName);
|
|
2821
|
+
const base = file.replace(/\.ts$/, '');
|
|
2822
|
+
// Generate export name using the custom pattern
|
|
2823
|
+
const exportName = (0, naming_resolver_1.generateExportName)(cfg.exportNamePattern, enumName, undefined, undefined, enumName);
|
|
2824
|
+
const ext = this.getImportFileExtension();
|
|
2825
|
+
const baseDir = from === 'objects' ? '../enums' : './enums';
|
|
2826
|
+
const finalAlias = expectedAlias || `${enumName}Schema`;
|
|
2827
|
+
// Only use alias if export name differs from expected alias
|
|
2828
|
+
if (exportName === finalAlias) {
|
|
2829
|
+
return `import { ${exportName} } from '${baseDir}/${base}${ext}'`;
|
|
2830
|
+
}
|
|
2831
|
+
else {
|
|
2832
|
+
return `import { ${exportName} as ${finalAlias} } from '${baseDir}/${base}${ext}'`;
|
|
2833
|
+
}
|
|
2834
|
+
}
|
|
2835
|
+
catch (error) {
|
|
2836
|
+
// Fallback to legacy naming
|
|
2837
|
+
logger_1.logger.warn('Failed to generate custom enum import for', enumName, error);
|
|
2838
|
+
const baseDir = from === 'objects' ? '../enums' : './enums';
|
|
2839
|
+
return `import { ${enumName}Schema } from '${baseDir}/${enumName}.schema${this.getImportFileExtension()}'`;
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Generate input import for object schemas honoring naming.input patterns.
|
|
2844
|
+
* Similar to generateInputImport but for object-to-object imports using './' prefix.
|
|
2845
|
+
*/
|
|
2846
|
+
generateObjectInputImport(inputTypeName, from = 'objects') {
|
|
2847
|
+
try {
|
|
2848
|
+
const cfg = (0, naming_resolver_1.resolveInputNaming)(Transformer.getGeneratorConfig());
|
|
2849
|
+
// Extract model name - fallback to inputTypeName if extraction fails
|
|
2850
|
+
const model = Transformer.extractModelNameFromContext(inputTypeName) || inputTypeName;
|
|
2851
|
+
// Generate the file name using the custom pattern
|
|
2852
|
+
const file = (0, naming_resolver_1.generateFileName)(cfg.filePattern, model, undefined, inputTypeName);
|
|
2853
|
+
const base = file.replace(/\.ts$/, '');
|
|
2854
|
+
// Generate export name using the custom pattern
|
|
2855
|
+
const resolvedExportName = (0, naming_resolver_1.generateExportName)(cfg.exportNamePattern, model, undefined, inputTypeName) || inputTypeName;
|
|
2856
|
+
const exportBase = resolvedExportName.replace(/ObjectSchema$|Schema$/, '');
|
|
2857
|
+
const importName = Transformer.exportTypedSchemas
|
|
2858
|
+
? `${exportBase}ObjectSchema`
|
|
2859
|
+
: `${exportBase}Object${Transformer.zodSchemaSuffix}`;
|
|
2860
|
+
// Create alias using the original input type name for consistency
|
|
2861
|
+
const alias = Transformer.exportTypedSchemas
|
|
2862
|
+
? `${inputTypeName}ObjectSchema`
|
|
2863
|
+
: `${inputTypeName}Object${Transformer.zodSchemaSuffix}`;
|
|
2864
|
+
const ext = this.getImportFileExtension();
|
|
2865
|
+
const baseDir = from === 'objects' ? '.' : from === 'root' ? './objects' : '../objects';
|
|
2866
|
+
return `import { ${importName} as ${alias} } from '${baseDir}/${base}${ext}'`;
|
|
2867
|
+
}
|
|
2868
|
+
catch (error) {
|
|
2869
|
+
// Log error for debugging and fallback to legacy naming
|
|
2870
|
+
logger_1.logger.warn('Failed to generate custom object input import for', inputTypeName, error);
|
|
2871
|
+
const schemaName = Transformer.exportTypedSchemas
|
|
2872
|
+
? `${inputTypeName}ObjectSchema`
|
|
2873
|
+
: `${inputTypeName}Object${Transformer.zodSchemaSuffix}`;
|
|
2874
|
+
const baseDir = from === 'objects' ? '.' : from === 'root' ? './objects' : '../objects';
|
|
2875
|
+
return `import { ${schemaName} } from '${baseDir}/${inputTypeName}.schema${this.getImportFileExtension()}'`;
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
/**
|
|
2879
|
+
* Generate schema file name with collision detection and custom naming support
|
|
2880
|
+
*/
|
|
2881
|
+
static generateSchemaFileName(modelName, operation) {
|
|
2882
|
+
let fileName = `${operation}${modelName}.schema.ts`; // Default fallback
|
|
2883
|
+
try {
|
|
2884
|
+
const schemaNamingConfig = (0, naming_resolver_1.resolveSchemaNaming)(Transformer.getGeneratorConfig());
|
|
2885
|
+
fileName = (0, naming_resolver_1.generateFileName)(schemaNamingConfig.filePattern, modelName, operation);
|
|
2886
|
+
}
|
|
2887
|
+
catch {
|
|
2888
|
+
// Use fallback naming
|
|
2889
|
+
}
|
|
2890
|
+
return fileName;
|
|
2891
|
+
}
|
|
2892
|
+
/**
|
|
2893
|
+
* Check for and handle file path collisions
|
|
2894
|
+
*/
|
|
2895
|
+
static checkSchemaFileCollision(filePath, modelName, operation) {
|
|
2896
|
+
const existingOperation = this.usedSchemaFilePaths.get(filePath);
|
|
2897
|
+
if (existingOperation) {
|
|
2898
|
+
const errorMsg = `Schema file collision detected: Both "${existingOperation.modelName}.${existingOperation.operation}" and "${modelName}.${operation}" would generate file "${filePath}". ` +
|
|
2899
|
+
`This will cause operations to overwrite each other. ` +
|
|
2900
|
+
`Consider including {Operation} in your schema.filePattern (e.g., "{kebab}-{operation}-schema.ts") to avoid collisions.`;
|
|
2901
|
+
logger_1.logger.error(errorMsg);
|
|
2902
|
+
throw new Error(errorMsg);
|
|
2903
|
+
}
|
|
2904
|
+
// Register this path as used
|
|
2905
|
+
this.usedSchemaFilePaths.set(filePath, { modelName, operation });
|
|
2906
|
+
}
|
|
2907
|
+
/**
|
|
2908
|
+
* Generate schema file with collision detection and consistent naming
|
|
2909
|
+
*/
|
|
2910
|
+
static async writeSchemaFile(modelName, operation, content) {
|
|
2911
|
+
const fileName = this.generateSchemaFileName(modelName, operation);
|
|
2912
|
+
const fullPath = path_1.default.join(Transformer.getSchemasPath(), fileName);
|
|
2913
|
+
// Check for collisions
|
|
2914
|
+
this.checkSchemaFileCollision(fullPath, modelName, operation);
|
|
2915
|
+
// Write the file (avoid double index updates; we handle export add explicitly)
|
|
2916
|
+
await (0, writeFileSafely_1.writeFileSafely)(fullPath, content, false);
|
|
2917
|
+
// Add to index exports
|
|
2918
|
+
(0, writeIndexFile_1.addIndexExport)(fullPath);
|
|
2919
|
+
logger_1.logger.debug(`✅ Generated schema: ${fileName}`);
|
|
2920
|
+
}
|
|
2921
|
+
/**
|
|
2922
|
+
* Clear collision detection state (called at start of generation)
|
|
2923
|
+
*/
|
|
2924
|
+
static clearSchemaFileCollisions() {
|
|
2925
|
+
this.usedSchemaFilePaths.clear();
|
|
2926
|
+
}
|
|
2927
|
+
/**
|
|
2928
|
+
* Generate import statement with validation - only if target will be generated
|
|
2929
|
+
*/
|
|
2930
|
+
static generateValidatedImportStatement(importName, importPath, modelName) {
|
|
2931
|
+
// Check if the target schema should be generated
|
|
2932
|
+
if (!Transformer.shouldGenerateImport(importName, modelName)) {
|
|
2933
|
+
return '';
|
|
2934
|
+
}
|
|
2935
|
+
const extension = Transformer.getImportFileExtension();
|
|
2936
|
+
return `import { ${importName} } from '${importPath}${extension}'`;
|
|
2937
|
+
}
|
|
2938
|
+
/**
|
|
2939
|
+
* Check if an import should be generated based on filtering rules
|
|
2940
|
+
*/
|
|
2941
|
+
static shouldGenerateImport(importName, relatedModelName) {
|
|
2942
|
+
// If a related model is specified, check if it's enabled
|
|
2943
|
+
if (relatedModelName && !Transformer.isModelEnabled(relatedModelName)) {
|
|
2944
|
+
return false;
|
|
2945
|
+
}
|
|
2946
|
+
// Check if the import represents a schema that would be filtered out
|
|
2947
|
+
const extractedModelName = Transformer.extractModelFromImportName(importName);
|
|
2948
|
+
if (extractedModelName && !Transformer.isModelEnabled(extractedModelName)) {
|
|
2949
|
+
return false;
|
|
2950
|
+
}
|
|
2951
|
+
// Default: generate the import
|
|
2952
|
+
return true;
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Extract model name from import name
|
|
2956
|
+
*/
|
|
2957
|
+
static extractModelFromImportName(importName) {
|
|
2958
|
+
// Common patterns for import names
|
|
2959
|
+
// NOTE: More specific patterns (with "Unchecked") must come BEFORE general patterns
|
|
2960
|
+
const patterns = [
|
|
2961
|
+
/^(\w+?)UncheckedCreateInputObjectSchema$/,
|
|
2962
|
+
/^(\w+?)UncheckedUpdateInputObjectSchema$/,
|
|
2963
|
+
/^(\w+)WhereInputObjectSchema$/,
|
|
2964
|
+
/^(\w+)WhereUniqueInputObjectSchema$/,
|
|
2965
|
+
/^(\w+)CreateInputObjectSchema$/,
|
|
2966
|
+
/^(\w+)UpdateInputObjectSchema$/,
|
|
2967
|
+
/^(\w+)SelectObjectSchema$/,
|
|
2968
|
+
/^(\w+)IncludeObjectSchema$/,
|
|
2969
|
+
/^(\w+)ScalarFieldEnumSchema$/,
|
|
2970
|
+
/^(\w+)OrderByWithRelationInputObjectSchema$/,
|
|
2971
|
+
/^(\w+)OrderByWithAggregationInputObjectSchema$/,
|
|
2972
|
+
];
|
|
2973
|
+
for (const pattern of patterns) {
|
|
2974
|
+
const match = importName.match(pattern);
|
|
2975
|
+
if (match) {
|
|
2976
|
+
return match[1];
|
|
2977
|
+
}
|
|
2978
|
+
}
|
|
2979
|
+
return null;
|
|
2980
|
+
}
|
|
2981
|
+
/**
|
|
2982
|
+
* Get import file extension (static version)
|
|
2983
|
+
*/
|
|
2984
|
+
static getImportFileExtension() {
|
|
2985
|
+
const isNewPrismaClientGenerator = this.prismaClientProvider === 'prisma-client' ||
|
|
2986
|
+
this.prismaClientConfig.moduleFormat !== undefined ||
|
|
2987
|
+
this.prismaClientConfig.runtime !== undefined;
|
|
2988
|
+
if (isNewPrismaClientGenerator &&
|
|
2989
|
+
this.prismaClientConfig.moduleFormat === 'esm' &&
|
|
2990
|
+
this.prismaClientConfig.importFileExtension) {
|
|
2991
|
+
return `.${this.prismaClientConfig.importFileExtension}`;
|
|
2992
|
+
}
|
|
2993
|
+
return '';
|
|
2994
|
+
}
|
|
2995
|
+
generateSchemaImports() {
|
|
2996
|
+
// Get the file extension to use for imports (for ESM support)
|
|
2997
|
+
const importExtension = this.getImportFileExtension();
|
|
2998
|
+
return [...this.schemaImports]
|
|
2999
|
+
.map((name) => {
|
|
3000
|
+
const { isModelQueryType, modelName, queryName } = this.checkIsModelQueryType(name);
|
|
3001
|
+
if (isModelQueryType) {
|
|
3002
|
+
try {
|
|
3003
|
+
// Use naming resolver to get custom patterns
|
|
3004
|
+
const schemaCfg = (0, naming_resolver_1.resolveSchemaNaming)(Transformer.getGeneratorConfig());
|
|
3005
|
+
// Generate filename using custom pattern
|
|
3006
|
+
const op = queryName.charAt(0).toUpperCase() + queryName.slice(1);
|
|
3007
|
+
const fileName = (0, naming_resolver_1.generateFileName)(schemaCfg.filePattern, modelName, op);
|
|
3008
|
+
const baseName = fileName.replace(/\.ts$/, '');
|
|
3009
|
+
// Generate export name using custom pattern
|
|
3010
|
+
const exportName = (0, naming_resolver_1.generateExportName)(schemaCfg.exportNamePattern, modelName, op);
|
|
3011
|
+
// Use the resolved export name, but alias to what resolveModelQuerySchemaName expects for compatibility
|
|
3012
|
+
const aliasName = this.resolveModelQuerySchemaName(modelName, queryName);
|
|
3013
|
+
return `import { ${exportName} as ${aliasName} } from '../${baseName}${importExtension}'`;
|
|
3014
|
+
}
|
|
3015
|
+
catch {
|
|
3016
|
+
// Fallback to legacy hardcoded naming if naming resolver fails
|
|
3017
|
+
const op = queryName.charAt(0).toUpperCase() + queryName.slice(1);
|
|
3018
|
+
return `import { ${this.resolveModelQuerySchemaName(modelName, queryName)} } from '../${op}${modelName}.schema${importExtension}'`;
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
else if (Transformer.enumNames.includes(name)) {
|
|
3022
|
+
const normalized = this.normalizeEnumName(name);
|
|
3023
|
+
if (normalized && normalized !== name) {
|
|
3024
|
+
// Use naming resolver for normalized enum imports with original name as alias
|
|
3025
|
+
return this.generateEnumImport(normalized, `${name}Schema`);
|
|
3026
|
+
}
|
|
3027
|
+
else {
|
|
3028
|
+
// Use naming resolver for regular enum imports
|
|
3029
|
+
return this.generateEnumImport(name);
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
else {
|
|
3033
|
+
// Use naming resolver for input object imports
|
|
3034
|
+
return this.generateObjectInputImport(name);
|
|
3035
|
+
}
|
|
3036
|
+
})
|
|
3037
|
+
.join(';\r\n');
|
|
3038
|
+
}
|
|
3039
|
+
checkIsModelQueryType(type) {
|
|
3040
|
+
const modelQueryTypeSuffixToQueryName = {
|
|
3041
|
+
FindManyArgs: 'findMany',
|
|
3042
|
+
};
|
|
3043
|
+
for (const modelQueryType of ['FindManyArgs']) {
|
|
3044
|
+
if (type.includes(modelQueryType)) {
|
|
3045
|
+
const modelQueryTypeSuffixIndex = type.indexOf(modelQueryType);
|
|
3046
|
+
return {
|
|
3047
|
+
isModelQueryType: true,
|
|
3048
|
+
modelName: type.substring(0, modelQueryTypeSuffixIndex),
|
|
3049
|
+
queryName: modelQueryTypeSuffixToQueryName[modelQueryType],
|
|
3050
|
+
};
|
|
3051
|
+
}
|
|
3052
|
+
}
|
|
3053
|
+
return { isModelQueryType: false };
|
|
3054
|
+
}
|
|
3055
|
+
resolveModelQuerySchemaName(modelName, queryName) {
|
|
3056
|
+
// Match exported identifiers from generateDualSchemaExports (e.g., PostFindManySchema)
|
|
3057
|
+
const baseName = `${modelName}${queryName[0].toUpperCase()}${queryName.slice(1)}`;
|
|
3058
|
+
return Transformer.exportTypedSchemas
|
|
3059
|
+
? `${baseName}Schema`
|
|
3060
|
+
: `${baseName}${Transformer.zodSchemaSuffix}`;
|
|
3061
|
+
}
|
|
3062
|
+
wrapWithZodObject(zodStringFields, useStrictObject = false) {
|
|
3063
|
+
let wrapped = '';
|
|
3064
|
+
const fieldsText = Array.isArray(zodStringFields)
|
|
3065
|
+
? zodStringFields.filter(Boolean).join(',\n ')
|
|
3066
|
+
: zodStringFields;
|
|
3067
|
+
wrapped += useStrictObject ? 'z.strictObject({' : 'z.object({';
|
|
3068
|
+
wrapped += '\n';
|
|
3069
|
+
wrapped += ' ' + fieldsText;
|
|
3070
|
+
wrapped += '\n';
|
|
3071
|
+
wrapped += '})';
|
|
3072
|
+
return wrapped;
|
|
3073
|
+
}
|
|
3074
|
+
/**
|
|
3075
|
+
* Compose an operation schema object definition with strict-mode handling.
|
|
3076
|
+
* For Zod v4 targets, `.strict()` clones the schema def and spreads its shape,
|
|
3077
|
+
* invoking `get select/include` getters at module-init time and crashing on
|
|
3078
|
+
* circular imports. z.strictObject keeps identical strictness semantics while
|
|
3079
|
+
* leaving the shape lazy until first parse.
|
|
3080
|
+
*/
|
|
3081
|
+
composeObjectDefinition(body, strictSuffix) {
|
|
3082
|
+
var _a, _b;
|
|
3083
|
+
const target = ((_b = (_a = Transformer.getGeneratorConfig()) === null || _a === void 0 ? void 0 : _a.zodImportTarget) !== null && _b !== void 0 ? _b : 'auto');
|
|
3084
|
+
if (target === 'v4' && strictSuffix === '.strict()') {
|
|
3085
|
+
return `z.strictObject({ ${body} })`;
|
|
3086
|
+
}
|
|
3087
|
+
return `z.object({ ${body} })${strictSuffix}`;
|
|
3088
|
+
}
|
|
3089
|
+
async generateModelSchemas() {
|
|
3090
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
3091
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3092
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.emit) && cfg.emit.crud === false) {
|
|
3093
|
+
logger_1.logger.debug('⏭️ emit.crud=false (skipping all CRUD operation schema generation)');
|
|
3094
|
+
return;
|
|
3095
|
+
}
|
|
3096
|
+
// Perform comprehensive filter validation
|
|
3097
|
+
const isValid = Transformer.performFilterValidation(this.models);
|
|
3098
|
+
if (!isValid) {
|
|
3099
|
+
throw new Error('Filter validation failed. Please fix the configuration errors above.');
|
|
3100
|
+
}
|
|
3101
|
+
// Log model filtering information
|
|
3102
|
+
Transformer.logModelFiltering(this.models);
|
|
3103
|
+
// Clear schema file collision tracking at start of generation
|
|
3104
|
+
Transformer.clearSchemaFileCollisions();
|
|
3105
|
+
for (const modelOperation of this.modelOperations) {
|
|
3106
|
+
try {
|
|
3107
|
+
const { model: modelName, findUnique, findFirst, findMany,
|
|
3108
|
+
// @ts-expect-error - Legacy API compatibility
|
|
3109
|
+
createOne, createMany,
|
|
3110
|
+
// @ts-expect-error - Legacy API compatibility
|
|
3111
|
+
deleteOne,
|
|
3112
|
+
// @ts-expect-error - Legacy API compatibility
|
|
3113
|
+
updateOne, deleteMany, updateMany,
|
|
3114
|
+
// @ts-expect-error - Legacy API compatibility
|
|
3115
|
+
upsertOne, aggregate, groupBy, } = modelOperation;
|
|
3116
|
+
// Skip generation for disabled models based on configuration
|
|
3117
|
+
if (!Transformer.isModelEnabled(modelName)) {
|
|
3118
|
+
continue;
|
|
3119
|
+
}
|
|
3120
|
+
// Log operation filtering information for this model
|
|
3121
|
+
const allOperations = [
|
|
3122
|
+
findUnique,
|
|
3123
|
+
findFirst,
|
|
3124
|
+
findMany,
|
|
3125
|
+
createOne,
|
|
3126
|
+
createMany,
|
|
3127
|
+
deleteOne,
|
|
3128
|
+
deleteMany,
|
|
3129
|
+
updateOne,
|
|
3130
|
+
updateMany,
|
|
3131
|
+
upsertOne,
|
|
3132
|
+
aggregate,
|
|
3133
|
+
groupBy,
|
|
3134
|
+
'count',
|
|
3135
|
+
].filter(Boolean); // Remove undefined operations
|
|
3136
|
+
Transformer.logOperationFiltering(modelName, allOperations);
|
|
3137
|
+
const model = (0, helpers_1.findModelByName)(this.models, modelName);
|
|
3138
|
+
const { selectImport, includeImport, selectZodSchemaLine, includeZodSchemaLine, selectZodSchemaLineLazy, includeZodSchemaLineLazy, selectValueExpr, includeValueExpr, } = this.resolveSelectIncludeImportAndZodSchemaLine(model);
|
|
3139
|
+
const { orderByImport, orderByZodSchemaLine } = this.resolveOrderByWithRelationImportAndZodSchemaLine(model);
|
|
3140
|
+
if (findUnique && Transformer.isOperationEnabled(modelName, 'findUnique')) {
|
|
3141
|
+
const imports = [
|
|
3142
|
+
selectImport,
|
|
3143
|
+
includeImport,
|
|
3144
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3145
|
+
];
|
|
3146
|
+
// Add Prisma type import for explicit type binding
|
|
3147
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3148
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3149
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3150
|
+
// Generate dual schema exports for FindUnique operation
|
|
3151
|
+
const strictModeSuffix = ((_a = Transformer.getStrictModeResolver()) === null || _a === void 0 ? void 0 : _a.getOperationStrictModeSuffix(modelName, 'findUnique')) || '';
|
|
3152
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}`, strictModeSuffix);
|
|
3153
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'FindUnique', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}FindUniqueArgs`);
|
|
3154
|
+
// Use the standardized schema file generation with collision detection
|
|
3155
|
+
await Transformer.writeSchemaFile(modelName, 'FindUnique', schemaContent + dualExports);
|
|
3156
|
+
}
|
|
3157
|
+
// Generate findUniqueOrThrow schema (same as findUnique but with error-throwing behavior)
|
|
3158
|
+
if (Transformer.isOperationEnabled(modelName, 'findUniqueOrThrow')) {
|
|
3159
|
+
const imports = [
|
|
3160
|
+
selectImport,
|
|
3161
|
+
includeImport,
|
|
3162
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3163
|
+
];
|
|
3164
|
+
// Add Prisma type import for explicit type binding
|
|
3165
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3166
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3167
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3168
|
+
// Generate dual schema exports for FindUniqueOrThrow operation
|
|
3169
|
+
const strictModeSuffix = ((_b = Transformer.getStrictModeResolver()) === null || _b === void 0 ? void 0 : _b.getOperationStrictModeSuffix(modelName, 'findUniqueOrThrow')) || '';
|
|
3170
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}`, strictModeSuffix);
|
|
3171
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'FindUniqueOrThrow', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}FindUniqueOrThrowArgs`);
|
|
3172
|
+
// Use the standardized schema file generation with collision detection
|
|
3173
|
+
await Transformer.writeSchemaFile(modelName, 'FindUniqueOrThrow', schemaContent + dualExports);
|
|
3174
|
+
}
|
|
3175
|
+
if (Transformer.isOperationEnabled(modelName, 'findFirst')) {
|
|
3176
|
+
const shouldInline = this.shouldInlineSelectSchema(model);
|
|
3177
|
+
// Build imports based on aggressive inlining strategy
|
|
3178
|
+
const baseImports = [
|
|
3179
|
+
includeImport, // Include always external
|
|
3180
|
+
orderByImport,
|
|
3181
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3182
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3183
|
+
this.generateEnumImport(`${this.getPascalCaseModelName(modelName)}ScalarFieldEnum`, `${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema`, 'root'),
|
|
3184
|
+
];
|
|
3185
|
+
// Add select import only if NOT inlining, add inline imports if inlining
|
|
3186
|
+
const imports = shouldInline
|
|
3187
|
+
? [...baseImports, ...this.generateInlineSelectImports(model, 'FindFirst')]
|
|
3188
|
+
: [...baseImports, selectImport];
|
|
3189
|
+
// Determine select field reference based on dual export strategy
|
|
3190
|
+
const cfg1 = Transformer.getGeneratorConfig();
|
|
3191
|
+
const target1 = ((_c = cfg1 === null || cfg1 === void 0 ? void 0 : cfg1.zodImportTarget) !== null && _c !== void 0 ? _c : 'auto');
|
|
3192
|
+
const selectFieldReference = shouldInline
|
|
3193
|
+
? Transformer.exportTypedSchemas
|
|
3194
|
+
? `${modelName}FindFirstSelect${Transformer.typedSchemaSuffix}.optional()`
|
|
3195
|
+
: `${modelName}FindFirstSelect${Transformer.zodSchemaSuffix}.optional()`
|
|
3196
|
+
: selectValueExpr || selectZodSchemaLineLazy.replace('select: ', '').replace(',', '');
|
|
3197
|
+
const selectField = target1 === 'v4'
|
|
3198
|
+
? `get select(){ return ${selectFieldReference}; },`
|
|
3199
|
+
: `select: ${selectFieldReference},`;
|
|
3200
|
+
const includeFieldRef1 = this.resolveIncludeFieldReference(includeValueExpr, includeZodSchemaLineLazy, target1 === 'v4');
|
|
3201
|
+
const includeField = includeFieldRef1
|
|
3202
|
+
? target1 === 'v4'
|
|
3203
|
+
? `get include(){ return ${includeFieldRef1}; },`
|
|
3204
|
+
: `include: ${includeFieldRef1},`
|
|
3205
|
+
: '';
|
|
3206
|
+
const schemaFields = `${selectField} ${includeField} ${orderByZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional(), cursor: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.union([${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema, ${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema.array()]).optional()`
|
|
3207
|
+
.trim()
|
|
3208
|
+
.replace(/,\s*,/g, ',');
|
|
3209
|
+
// Add Prisma type import for explicit type binding
|
|
3210
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3211
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3212
|
+
let schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3213
|
+
// Add inline select schema definitions (dual export pattern)
|
|
3214
|
+
if (shouldInline) {
|
|
3215
|
+
schemaContent += `// Select schema needs to be in file to prevent circular imports\n//------------------------------------------------------\n\n${this.generateDualSelectSchemaExports(model, 'FindFirst')}\n\n`;
|
|
3216
|
+
}
|
|
3217
|
+
// Generate dual schema exports for FindFirst operation
|
|
3218
|
+
const strictModeSuffix = ((_d = Transformer.getStrictModeResolver()) === null || _d === void 0 ? void 0 : _d.getOperationStrictModeSuffix(modelName, 'findFirst')) || '';
|
|
3219
|
+
const schemaObjectDefinition = this.composeObjectDefinition(schemaFields, strictModeSuffix);
|
|
3220
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'FindFirst', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}FindFirstArgs`);
|
|
3221
|
+
// Use the standardized schema file generation with collision detection
|
|
3222
|
+
await Transformer.writeSchemaFile(modelName, 'FindFirst', schemaContent + dualExports);
|
|
3223
|
+
}
|
|
3224
|
+
// Generate findFirstOrThrow schema (same as findFirst but with error-throwing behavior)
|
|
3225
|
+
if (Transformer.isOperationEnabled(modelName, 'findFirstOrThrow')) {
|
|
3226
|
+
const shouldInline = this.shouldInlineSelectSchema(model);
|
|
3227
|
+
// Build imports based on aggressive inlining strategy
|
|
3228
|
+
const baseImports = [
|
|
3229
|
+
includeImport, // Include always external
|
|
3230
|
+
orderByImport,
|
|
3231
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3232
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3233
|
+
this.generateEnumImport(`${this.getPascalCaseModelName(modelName)}ScalarFieldEnum`, `${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema`, 'root'),
|
|
3234
|
+
];
|
|
3235
|
+
// Add select import only if NOT inlining, add inline imports if inlining
|
|
3236
|
+
const imports = shouldInline
|
|
3237
|
+
? [...baseImports, ...this.generateInlineSelectImports(model, 'FindFirstOrThrow')]
|
|
3238
|
+
: [...baseImports, selectImport];
|
|
3239
|
+
// Determine select field reference based on dual export strategy
|
|
3240
|
+
const cfg2 = Transformer.getGeneratorConfig();
|
|
3241
|
+
const target2 = ((_e = cfg2 === null || cfg2 === void 0 ? void 0 : cfg2.zodImportTarget) !== null && _e !== void 0 ? _e : 'auto');
|
|
3242
|
+
const selectFieldReference = shouldInline
|
|
3243
|
+
? Transformer.exportTypedSchemas
|
|
3244
|
+
? `${modelName}FindFirstOrThrowSelect${Transformer.typedSchemaSuffix}.optional()`
|
|
3245
|
+
: `${modelName}FindFirstOrThrowSelect${Transformer.zodSchemaSuffix}.optional()`
|
|
3246
|
+
: selectValueExpr || selectZodSchemaLineLazy.replace('select: ', '').replace(',', '');
|
|
3247
|
+
const selectField = target2 === 'v4'
|
|
3248
|
+
? `get select(){ return ${selectFieldReference}; },`
|
|
3249
|
+
: `select: ${selectFieldReference},`;
|
|
3250
|
+
const includeFieldRef2 = this.resolveIncludeFieldReference(includeValueExpr, includeZodSchemaLineLazy, target2 === 'v4');
|
|
3251
|
+
const includeField = includeFieldRef2
|
|
3252
|
+
? target2 === 'v4'
|
|
3253
|
+
? `get include(){ return ${includeFieldRef2}; },`
|
|
3254
|
+
: `include: ${includeFieldRef2},`
|
|
3255
|
+
: '';
|
|
3256
|
+
const schemaFields = `${selectField} ${includeField} ${orderByZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional(), cursor: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.union([${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema, ${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema.array()]).optional()`
|
|
3257
|
+
.trim()
|
|
3258
|
+
.replace(/,\s*,/g, ',');
|
|
3259
|
+
// Add Prisma type import for explicit type binding
|
|
3260
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3261
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3262
|
+
let schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3263
|
+
// Add inline select schema definitions (dual export pattern)
|
|
3264
|
+
if (shouldInline) {
|
|
3265
|
+
schemaContent += `// Select schema needs to be in file to prevent circular imports\n//------------------------------------------------------\n\n${this.generateDualSelectSchemaExports(model, 'FindFirstOrThrow')}\n\n`;
|
|
3266
|
+
}
|
|
3267
|
+
const strictModeSuffix = ((_f = Transformer.getStrictModeResolver()) === null || _f === void 0 ? void 0 : _f.getOperationStrictModeSuffix(modelName, 'findFirstOrThrow')) || '';
|
|
3268
|
+
const schemaObjectDefinition = this.composeObjectDefinition(schemaFields, strictModeSuffix);
|
|
3269
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'FindFirstOrThrow', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}FindFirstOrThrowArgs`);
|
|
3270
|
+
// Use the standardized schema file generation with collision detection
|
|
3271
|
+
await Transformer.writeSchemaFile(modelName, 'FindFirstOrThrow', schemaContent + dualExports);
|
|
3272
|
+
}
|
|
3273
|
+
if (findMany && Transformer.isOperationEnabled(modelName, 'findMany')) {
|
|
3274
|
+
const shouldInline = this.shouldInlineSelectSchema(model);
|
|
3275
|
+
// Build imports based on aggressive inlining strategy
|
|
3276
|
+
const baseImports = [
|
|
3277
|
+
includeImport, // Include always external
|
|
3278
|
+
orderByImport,
|
|
3279
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3280
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3281
|
+
this.generateEnumImport(`${this.getPascalCaseModelName(modelName)}ScalarFieldEnum`, `${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema`, 'root'),
|
|
3282
|
+
];
|
|
3283
|
+
// Add select import only if NOT inlining, add inline imports if inlining
|
|
3284
|
+
const imports = shouldInline
|
|
3285
|
+
? [...baseImports, ...this.generateInlineSelectImports(model, 'FindMany')]
|
|
3286
|
+
: [...baseImports, selectImport];
|
|
3287
|
+
// Determine select/include field reference based on dual export strategy and zod target
|
|
3288
|
+
const cfg3 = Transformer.getGeneratorConfig();
|
|
3289
|
+
const target3 = ((_g = cfg3 === null || cfg3 === void 0 ? void 0 : cfg3.zodImportTarget) !== null && _g !== void 0 ? _g : 'auto');
|
|
3290
|
+
const selectFieldReference = shouldInline
|
|
3291
|
+
? Transformer.exportTypedSchemas
|
|
3292
|
+
? `${modelName}FindManySelect${Transformer.typedSchemaSuffix}.optional()`
|
|
3293
|
+
: `${modelName}FindManySelect${Transformer.zodSchemaSuffix}.optional()`
|
|
3294
|
+
: selectValueExpr || selectZodSchemaLineLazy.replace('select: ', '').replace(',', '');
|
|
3295
|
+
const selectField = target3 === 'v4'
|
|
3296
|
+
? `get select(){ return ${selectFieldReference}; },`
|
|
3297
|
+
: `select: ${selectFieldReference},`;
|
|
3298
|
+
const includeFieldRef3 = this.resolveIncludeFieldReference(includeValueExpr, includeZodSchemaLineLazy, target3 === 'v4');
|
|
3299
|
+
const includeField = includeFieldRef3
|
|
3300
|
+
? target3 === 'v4'
|
|
3301
|
+
? `get include(){ return ${includeFieldRef3}; },`
|
|
3302
|
+
: `include: ${includeFieldRef3},`
|
|
3303
|
+
: '';
|
|
3304
|
+
const schemaFields = `${selectField} ${includeField} ${orderByZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional(), cursor: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.union([${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema, ${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema.array()]).optional()`
|
|
3305
|
+
.trim()
|
|
3306
|
+
.replace(/,\s*,/g, ',');
|
|
3307
|
+
// Add Prisma type import for explicit type binding
|
|
3308
|
+
const crudDir2 = Transformer.getSchemasPath();
|
|
3309
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir2);
|
|
3310
|
+
let schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3311
|
+
// Add inline select schema definitions (dual export pattern)
|
|
3312
|
+
if (shouldInline) {
|
|
3313
|
+
schemaContent += `// Select schema needs to be in file to prevent circular imports\n//------------------------------------------------------\n\n${this.generateDualSelectSchemaExports(model, 'FindMany')}\n\n`;
|
|
3314
|
+
}
|
|
3315
|
+
// Generate dual schema exports for FindMany operation
|
|
3316
|
+
const strictModeSuffix = ((_h = Transformer.getStrictModeResolver()) === null || _h === void 0 ? void 0 : _h.getOperationStrictModeSuffix(modelName, 'findMany')) || '';
|
|
3317
|
+
const schemaObjectDefinition = this.composeObjectDefinition(schemaFields, strictModeSuffix);
|
|
3318
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'FindMany', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}FindManyArgs`);
|
|
3319
|
+
// Use the standardized schema file generation with collision detection
|
|
3320
|
+
await Transformer.writeSchemaFile(modelName, 'FindMany', schemaContent + dualExports);
|
|
3321
|
+
}
|
|
3322
|
+
// Generate count schema aligned with Prisma <Model>CountArgs
|
|
3323
|
+
if (Transformer.isOperationEnabled(modelName, 'count')) {
|
|
3324
|
+
// Build imports
|
|
3325
|
+
const imports = [
|
|
3326
|
+
orderByImport,
|
|
3327
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3328
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3329
|
+
this.generateInputImport(`${this.getAggregateInputName(modelName, 'CountAggregateInput')}`),
|
|
3330
|
+
];
|
|
3331
|
+
// Add Prisma type import for explicit type binding
|
|
3332
|
+
const crudDirCount = Transformer.getSchemasPath();
|
|
3333
|
+
const prismaImportPathCount = Transformer.resolvePrismaImportPath(crudDirCount);
|
|
3334
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPathCount)}${this.generateImportStatements(imports)}`;
|
|
3335
|
+
const strictModeSuffix = ((_j = Transformer.getStrictModeResolver()) === null || _j === void 0 ? void 0 : _j.getOperationStrictModeSuffix(modelName, 'count')) ||
|
|
3336
|
+
'';
|
|
3337
|
+
const countSchemaObject = this.composeObjectDefinition(`${orderByZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional(), cursor: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}.optional(), take: z.number().optional(), skip: z.number().optional(), select: z.union([ z.literal(true), ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'CountAggregateInput')}`)} ]).optional()`, strictModeSuffix);
|
|
3338
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'Count', countSchemaObject, `Prisma.${this.getPrismaTypeName(modelName)}CountArgs`);
|
|
3339
|
+
// Use the standardized schema file generation with collision detection
|
|
3340
|
+
await Transformer.writeSchemaFile(modelName, 'Count', schemaContent + dualExports);
|
|
3341
|
+
}
|
|
3342
|
+
if (createOne && Transformer.isOperationEnabled(modelName, 'createOne')) {
|
|
3343
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3344
|
+
const isMinimalMode = (cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal';
|
|
3345
|
+
const imports = [selectImport, includeImport];
|
|
3346
|
+
let dataUnion;
|
|
3347
|
+
if (isMinimalMode) {
|
|
3348
|
+
// In minimal mode, prefer UncheckedCreateInput to avoid relation field issues
|
|
3349
|
+
imports.push(this.generateInputImport(`${modelName}UncheckedCreateInput`));
|
|
3350
|
+
dataUnion = Transformer.getObjectSchemaName(`${modelName}UncheckedCreateInput`);
|
|
3351
|
+
}
|
|
3352
|
+
else {
|
|
3353
|
+
// In full mode, use both CreateInput and UncheckedCreateInput
|
|
3354
|
+
imports.push(this.generateInputImport(`${modelName}CreateInput`), this.generateInputImport(`${modelName}UncheckedCreateInput`));
|
|
3355
|
+
dataUnion = `z.union([${Transformer.getObjectSchemaName(`${modelName}CreateInput`)}, ${Transformer.getObjectSchemaName(`${modelName}UncheckedCreateInput`)}])`;
|
|
3356
|
+
}
|
|
3357
|
+
// Add Prisma type import for explicit type binding
|
|
3358
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3359
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3360
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3361
|
+
// Generate dual schema exports for CreateOne operation
|
|
3362
|
+
const strictModeSuffix = ((_k = Transformer.getStrictModeResolver()) === null || _k === void 0 ? void 0 : _k.getOperationStrictModeSuffix(modelName, 'createOne')) || '';
|
|
3363
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} data: ${dataUnion}`, strictModeSuffix);
|
|
3364
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'CreateOne', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}CreateArgs`);
|
|
3365
|
+
// Use the standardized schema file generation with collision detection
|
|
3366
|
+
await Transformer.writeSchemaFile(modelName, 'CreateOne', schemaContent + dualExports);
|
|
3367
|
+
}
|
|
3368
|
+
if (createMany && Transformer.isOperationEnabled(modelName, 'createMany')) {
|
|
3369
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3370
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3371
|
+
logger_1.logger.debug(`⏭️ Minimal mode: skipping ${modelName}.createMany`);
|
|
3372
|
+
}
|
|
3373
|
+
else {
|
|
3374
|
+
const imports = [this.generateInputImport(`${modelName}CreateManyInput`)];
|
|
3375
|
+
// Add Prisma type import for explicit type binding
|
|
3376
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3377
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3378
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3379
|
+
// Generate dual schema exports for CreateMany operation
|
|
3380
|
+
const strictModeSuffix = ((_l = Transformer.getStrictModeResolver()) === null || _l === void 0 ? void 0 : _l.getOperationStrictModeSuffix(modelName, 'createMany')) || '';
|
|
3381
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`data: z.union([ ${Transformer.getObjectSchemaName(`${modelName}CreateManyInput`)}, z.array(${Transformer.getObjectSchemaName(`${modelName}CreateManyInput`)}) ]), ${Transformer.provider === 'postgresql' || Transformer.provider === 'cockroachdb'
|
|
3382
|
+
? 'skipDuplicates: z.boolean().optional()'
|
|
3383
|
+
: ''}`, strictModeSuffix);
|
|
3384
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'CreateMany', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}CreateManyArgs`);
|
|
3385
|
+
// Use the standardized schema file generation with collision detection
|
|
3386
|
+
await Transformer.writeSchemaFile(modelName, 'CreateMany', schemaContent + dualExports);
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
// Generate createManyAndReturn schema (same as createMany but returns created records)
|
|
3390
|
+
if (Transformer.isOperationEnabled(modelName, 'createManyAndReturn')) {
|
|
3391
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3392
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3393
|
+
logger_1.logger.debug(`⏭️ Minimal mode: skipping ${modelName}.createManyAndReturn`);
|
|
3394
|
+
}
|
|
3395
|
+
else {
|
|
3396
|
+
const imports = [selectImport, this.generateInputImport(`${modelName}CreateManyInput`)];
|
|
3397
|
+
// Add Prisma type import for explicit type binding
|
|
3398
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3399
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3400
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3401
|
+
// Generate dual schema exports for CreateManyAndReturn operation
|
|
3402
|
+
const strictModeSuffix = ((_m = Transformer.getStrictModeResolver()) === null || _m === void 0 ? void 0 : _m.getOperationStrictModeSuffix(modelName, 'createManyAndReturn')) || '';
|
|
3403
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} data: z.union([ ${Transformer.getObjectSchemaName(`${modelName}CreateManyInput`)}, z.array(${Transformer.getObjectSchemaName(`${modelName}CreateManyInput`)}) ]), ${Transformer.provider === 'postgresql' || Transformer.provider === 'cockroachdb'
|
|
3404
|
+
? 'skipDuplicates: z.boolean().optional()'
|
|
3405
|
+
: ''}`, strictModeSuffix);
|
|
3406
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'CreateManyAndReturn', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}CreateManyAndReturnArgs`);
|
|
3407
|
+
// Use the standardized schema file generation with collision detection
|
|
3408
|
+
await Transformer.writeSchemaFile(modelName, 'CreateManyAndReturn', schemaContent + dualExports);
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
if (deleteOne && Transformer.isOperationEnabled(modelName, 'deleteOne')) {
|
|
3412
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3413
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3414
|
+
const ops = cfg === null || cfg === void 0 ? void 0 : cfg.minimalOperations;
|
|
3415
|
+
if (Array.isArray(ops) && !ops.includes('delete') && !ops.includes('deleteOne')) {
|
|
3416
|
+
logger_1.logger.debug(`⏭️ Minimal mode (custom ops): skipping ${modelName}.deleteOne`);
|
|
3417
|
+
}
|
|
3418
|
+
else {
|
|
3419
|
+
const imports = [
|
|
3420
|
+
selectImport,
|
|
3421
|
+
includeImport,
|
|
3422
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3423
|
+
];
|
|
3424
|
+
// Add Prisma type import for explicit type binding
|
|
3425
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3426
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3427
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3428
|
+
// Generate dual schema exports for DeleteOne operation
|
|
3429
|
+
const strictModeSuffix = ((_o = Transformer.getStrictModeResolver()) === null || _o === void 0 ? void 0 : _o.getOperationStrictModeSuffix(modelName, 'deleteOne')) || '';
|
|
3430
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}`, strictModeSuffix);
|
|
3431
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'DeleteOne', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}DeleteArgs`);
|
|
3432
|
+
await Transformer.writeSchemaFile(modelName, 'DeleteOne', schemaContent + dualExports);
|
|
3433
|
+
}
|
|
3434
|
+
}
|
|
3435
|
+
else {
|
|
3436
|
+
const imports = [
|
|
3437
|
+
selectImport,
|
|
3438
|
+
includeImport,
|
|
3439
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3440
|
+
];
|
|
3441
|
+
// Add Prisma type import for explicit type binding
|
|
3442
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3443
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3444
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3445
|
+
// Generate dual schema exports for DeleteOne operation
|
|
3446
|
+
const strictModeSuffix = ((_p = Transformer.getStrictModeResolver()) === null || _p === void 0 ? void 0 : _p.getOperationStrictModeSuffix(modelName, 'deleteOne')) || '';
|
|
3447
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}`, strictModeSuffix);
|
|
3448
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'DeleteOne', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}DeleteArgs`);
|
|
3449
|
+
await Transformer.writeSchemaFile(modelName, 'DeleteOne', schemaContent + dualExports);
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
if (deleteMany && Transformer.isOperationEnabled(modelName, 'deleteMany')) {
|
|
3453
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3454
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3455
|
+
logger_1.logger.debug(`⏭️ Minimal mode: skipping ${modelName}.deleteMany`);
|
|
3456
|
+
}
|
|
3457
|
+
else {
|
|
3458
|
+
const imports = [this.generateInputImport(`${modelName}WhereInput`)];
|
|
3459
|
+
// Add Prisma type import for explicit type binding
|
|
3460
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3461
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3462
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3463
|
+
// Generate dual schema exports for DeleteMany operation
|
|
3464
|
+
const strictModeSuffix = ((_q = Transformer.getStrictModeResolver()) === null || _q === void 0 ? void 0 : _q.getOperationStrictModeSuffix(modelName, 'deleteMany')) || '';
|
|
3465
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional()`, strictModeSuffix);
|
|
3466
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'DeleteMany', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}DeleteManyArgs`);
|
|
3467
|
+
await Transformer.writeSchemaFile(modelName, 'DeleteMany', schemaContent + dualExports);
|
|
3468
|
+
}
|
|
3469
|
+
}
|
|
3470
|
+
if (updateOne && Transformer.isOperationEnabled(modelName, 'updateOne')) {
|
|
3471
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3472
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3473
|
+
const ops = cfg === null || cfg === void 0 ? void 0 : cfg.minimalOperations;
|
|
3474
|
+
if (Array.isArray(ops) && !ops.includes('update') && !ops.includes('updateOne')) {
|
|
3475
|
+
logger_1.logger.debug(`⏭️ Minimal mode (custom ops): skipping ${modelName}.updateOne`);
|
|
3476
|
+
// Do not generate
|
|
3477
|
+
}
|
|
3478
|
+
else {
|
|
3479
|
+
const imports = [
|
|
3480
|
+
selectImport,
|
|
3481
|
+
includeImport,
|
|
3482
|
+
this.generateInputImport(`${modelName}UpdateInput`),
|
|
3483
|
+
this.generateInputImport(`${modelName}UncheckedUpdateInput`),
|
|
3484
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3485
|
+
];
|
|
3486
|
+
// Add Prisma type import for explicit type binding
|
|
3487
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3488
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3489
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3490
|
+
// Generate dual schema exports for UpdateOne operation
|
|
3491
|
+
const strictModeSuffix = ((_r = Transformer.getStrictModeResolver()) === null || _r === void 0 ? void 0 : _r.getOperationStrictModeSuffix(modelName, 'updateOne')) || '';
|
|
3492
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${Transformer.getObjectSchemaName(`${modelName}UpdateInput`)}, ${Transformer.getObjectSchemaName(`${modelName}UncheckedUpdateInput`)}]), where: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}`, strictModeSuffix);
|
|
3493
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'UpdateOne', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}UpdateArgs`);
|
|
3494
|
+
await Transformer.writeSchemaFile(modelName, 'UpdateOne', schemaContent + dualExports);
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3497
|
+
else {
|
|
3498
|
+
const imports = [
|
|
3499
|
+
selectImport,
|
|
3500
|
+
includeImport,
|
|
3501
|
+
this.generateInputImport(`${modelName}UpdateInput`),
|
|
3502
|
+
this.generateInputImport(`${modelName}UncheckedUpdateInput`),
|
|
3503
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3504
|
+
];
|
|
3505
|
+
// Add Prisma type import for explicit type binding
|
|
3506
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3507
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3508
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3509
|
+
// Generate dual schema exports for UpdateOne operation
|
|
3510
|
+
const strictModeSuffix = ((_s = Transformer.getStrictModeResolver()) === null || _s === void 0 ? void 0 : _s.getOperationStrictModeSuffix(modelName, 'updateOne')) || '';
|
|
3511
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${Transformer.getObjectSchemaName(`${modelName}UpdateInput`)}, ${Transformer.getObjectSchemaName(`${modelName}UncheckedUpdateInput`)}]), where: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}`, strictModeSuffix);
|
|
3512
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'UpdateOne', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}UpdateArgs`);
|
|
3513
|
+
await Transformer.writeSchemaFile(modelName, 'UpdateOne', schemaContent + dualExports);
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
if (updateMany && Transformer.isOperationEnabled(modelName, 'updateMany')) {
|
|
3517
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3518
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3519
|
+
logger_1.logger.debug(`⏭️ Minimal mode: skipping ${modelName}.updateMany`);
|
|
3520
|
+
}
|
|
3521
|
+
else {
|
|
3522
|
+
const imports = [
|
|
3523
|
+
this.generateInputImport(`${modelName}UpdateManyMutationInput`),
|
|
3524
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3525
|
+
];
|
|
3526
|
+
// Add Prisma type import for explicit type binding
|
|
3527
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3528
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3529
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3530
|
+
// Generate dual schema exports for UpdateMany operation
|
|
3531
|
+
const strictModeSuffix = ((_t = Transformer.getStrictModeResolver()) === null || _t === void 0 ? void 0 : _t.getOperationStrictModeSuffix(modelName, 'updateMany')) || '';
|
|
3532
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`data: ${Transformer.getObjectSchemaName(`${modelName}UpdateManyMutationInput`)}, where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional()`, strictModeSuffix);
|
|
3533
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'UpdateMany', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}UpdateManyArgs`);
|
|
3534
|
+
await Transformer.writeSchemaFile(modelName, 'UpdateMany', schemaContent + dualExports);
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
// Generate updateManyAndReturn schema (same as updateMany but returns updated records)
|
|
3538
|
+
if (Transformer.isOperationEnabled(modelName, 'updateManyAndReturn')) {
|
|
3539
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3540
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3541
|
+
logger_1.logger.debug(`⏭️ Minimal mode: skipping ${modelName}.updateManyAndReturn`);
|
|
3542
|
+
}
|
|
3543
|
+
else {
|
|
3544
|
+
const imports = [
|
|
3545
|
+
selectImport,
|
|
3546
|
+
this.generateInputImport(`${modelName}UpdateManyMutationInput`),
|
|
3547
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3548
|
+
];
|
|
3549
|
+
// Add Prisma type import for explicit type binding
|
|
3550
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3551
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3552
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3553
|
+
// Generate dual schema exports for UpdateManyAndReturn operation
|
|
3554
|
+
const strictModeSuffix = ((_u = Transformer.getStrictModeResolver()) === null || _u === void 0 ? void 0 : _u.getOperationStrictModeSuffix(modelName, 'updateManyAndReturn')) || '';
|
|
3555
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} data: ${Transformer.getObjectSchemaName(`${modelName}UpdateManyMutationInput`)}, where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional()`, strictModeSuffix);
|
|
3556
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'UpdateManyAndReturn', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}UpdateManyAndReturnArgs`);
|
|
3557
|
+
await Transformer.writeSchemaFile(modelName, 'UpdateManyAndReturn', schemaContent + dualExports);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
if (upsertOne && Transformer.isOperationEnabled(modelName, 'upsertOne')) {
|
|
3561
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
3562
|
+
if ((cfg === null || cfg === void 0 ? void 0 : cfg.mode) === 'minimal') {
|
|
3563
|
+
logger_1.logger.debug(`⏭️ Minimal mode: skipping ${modelName}.upsertOne`);
|
|
3564
|
+
}
|
|
3565
|
+
else {
|
|
3566
|
+
const imports = [
|
|
3567
|
+
selectImport,
|
|
3568
|
+
includeImport,
|
|
3569
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3570
|
+
this.generateInputImport(`${modelName}CreateInput`),
|
|
3571
|
+
this.generateInputImport(`${modelName}UncheckedCreateInput`),
|
|
3572
|
+
this.generateInputImport(`${modelName}UpdateInput`),
|
|
3573
|
+
this.generateInputImport(`${modelName}UncheckedUpdateInput`),
|
|
3574
|
+
];
|
|
3575
|
+
// Add Prisma type import for explicit type binding
|
|
3576
|
+
const crudDir = Transformer.getSchemasPath();
|
|
3577
|
+
const prismaImportPath = Transformer.resolvePrismaImportPath(crudDir);
|
|
3578
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPath)}${this.generateImportStatements(imports)}`;
|
|
3579
|
+
// Generate dual schema exports for UpsertOne operation
|
|
3580
|
+
const strictModeSuffix = ((_v = Transformer.getStrictModeResolver()) === null || _v === void 0 ? void 0 : _v.getOperationStrictModeSuffix(modelName, 'upsertOne')) || '';
|
|
3581
|
+
const schemaObjectDefinition = this.composeObjectDefinition(`${selectZodSchemaLine} ${includeZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}, create: z.union([ ${Transformer.getObjectSchemaName(`${modelName}CreateInput`)}, ${Transformer.getObjectSchemaName(`${modelName}UncheckedCreateInput`)} ]), update: z.union([ ${Transformer.getObjectSchemaName(`${modelName}UpdateInput`)}, ${Transformer.getObjectSchemaName(`${modelName}UncheckedUpdateInput`)} ])`, strictModeSuffix);
|
|
3582
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'UpsertOne', schemaObjectDefinition, `Prisma.${this.getPrismaTypeName(modelName)}UpsertArgs`);
|
|
3583
|
+
await Transformer.writeSchemaFile(modelName, 'UpsertOne', schemaContent + dualExports);
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
if (aggregate && Transformer.isOperationEnabled(modelName, 'aggregate')) {
|
|
3587
|
+
const imports = [
|
|
3588
|
+
orderByImport,
|
|
3589
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3590
|
+
this.generateInputImport(`${modelName}WhereUniqueInput`),
|
|
3591
|
+
];
|
|
3592
|
+
const aggregateOperations = [];
|
|
3593
|
+
// All models support count, min, max operations - no complex detection needed
|
|
3594
|
+
imports.push(this.generateInputImport(`${this.getAggregateInputName(modelName, 'CountAggregateInput')}`), this.generateInputImport(`${this.getAggregateInputName(modelName, 'MinAggregateInput')}`), this.generateInputImport(`${this.getAggregateInputName(modelName, 'MaxAggregateInput')}`));
|
|
3595
|
+
// Only include Avg/Sum imports for models with numeric fields
|
|
3596
|
+
const hasNumericFields = this.modelHasNumericFields(modelName);
|
|
3597
|
+
if (hasNumericFields) {
|
|
3598
|
+
imports.push(this.generateInputImport(`${this.getAggregateInputName(modelName, 'AvgAggregateInput')}`), this.generateInputImport(`${this.getAggregateInputName(modelName, 'SumAggregateInput')}`));
|
|
3599
|
+
}
|
|
3600
|
+
aggregateOperations.push(`_count: z.union([ z.literal(true), ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'CountAggregateInput')}`)} ]).optional()`, `_min: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'MinAggregateInput')}`)}.optional()`, `_max: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'MaxAggregateInput')}`)}.optional()`);
|
|
3601
|
+
// Only include _avg and _sum for models with numeric fields
|
|
3602
|
+
if (hasNumericFields) {
|
|
3603
|
+
aggregateOperations.push(`_avg: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'AvgAggregateInput')}`)}.optional()`, `_sum: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'SumAggregateInput')}`)}.optional()`);
|
|
3604
|
+
}
|
|
3605
|
+
// Add Prisma type import for explicit type binding
|
|
3606
|
+
const crudDirAggregate = Transformer.getSchemasPath();
|
|
3607
|
+
const prismaImportPathAggregate = Transformer.resolvePrismaImportPath(crudDirAggregate);
|
|
3608
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPathAggregate)}${this.generateImportStatements(imports)}`;
|
|
3609
|
+
// Generate dual schema exports for Aggregate operation
|
|
3610
|
+
const strictModeSuffix = ((_w = Transformer.getStrictModeResolver()) === null || _w === void 0 ? void 0 : _w.getOperationStrictModeSuffix(modelName, 'aggregate')) || '';
|
|
3611
|
+
const aggregateSchemaObject = this.composeObjectDefinition(`${orderByZodSchemaLine} where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional(), cursor: ${Transformer.getObjectSchemaName(`${modelName}WhereUniqueInput`)}.optional(), take: z.number().optional(), skip: z.number().optional(), ${aggregateOperations.join(', ')}`, strictModeSuffix);
|
|
3612
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'Aggregate', aggregateSchemaObject, `Prisma.${this.getPrismaTypeName(modelName, 'Aggregate')}AggregateArgs`);
|
|
3613
|
+
// Use the standardized schema file generation with collision detection
|
|
3614
|
+
await Transformer.writeSchemaFile(modelName, 'Aggregate', schemaContent + dualExports);
|
|
3615
|
+
}
|
|
3616
|
+
if (groupBy && Transformer.isOperationEnabled(modelName, 'groupBy')) {
|
|
3617
|
+
const imports = [
|
|
3618
|
+
this.generateInputImport(`${modelName}WhereInput`),
|
|
3619
|
+
this.generateInputImport(`${modelName}OrderByWithAggregationInput`),
|
|
3620
|
+
this.generateInputImport(`${modelName}ScalarWhereWithAggregatesInput`),
|
|
3621
|
+
this.generateEnumImport(`${this.getPascalCaseModelName(modelName)}ScalarFieldEnum`, `${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema`, 'root'),
|
|
3622
|
+
this.generateInputImport(`${this.getAggregateInputName(modelName, 'CountAggregateInput')}`),
|
|
3623
|
+
this.generateInputImport(`${this.getAggregateInputName(modelName, 'MinAggregateInput')}`),
|
|
3624
|
+
this.generateInputImport(`${this.getAggregateInputName(modelName, 'MaxAggregateInput')}`),
|
|
3625
|
+
];
|
|
3626
|
+
// Only include Avg/Sum imports for models with numeric fields
|
|
3627
|
+
const hasNumericFieldsForGroupBy = this.modelHasNumericFields(modelName);
|
|
3628
|
+
if (hasNumericFieldsForGroupBy) {
|
|
3629
|
+
imports.push(this.generateInputImport(`${this.getAggregateInputName(modelName, 'AvgAggregateInput')}`), this.generateInputImport(`${this.getAggregateInputName(modelName, 'SumAggregateInput')}`));
|
|
3630
|
+
}
|
|
3631
|
+
// Add Prisma type import for explicit type binding
|
|
3632
|
+
const crudDirGroupBy = Transformer.getSchemasPath();
|
|
3633
|
+
const prismaImportPathGroupBy = Transformer.resolvePrismaImportPath(crudDirGroupBy);
|
|
3634
|
+
const schemaContent = `${Transformer.prismaTypeImportLine(prismaImportPathGroupBy)}${this.generateImportStatements(imports)}`;
|
|
3635
|
+
// Generate dual schema exports for GroupBy operation
|
|
3636
|
+
const baseFields = [
|
|
3637
|
+
`where: ${Transformer.getObjectSchemaName(`${modelName}WhereInput`)}.optional()`,
|
|
3638
|
+
`orderBy: z.union([${Transformer.getObjectSchemaName(`${modelName}OrderByWithAggregationInput`)}, ${Transformer.getObjectSchemaName(`${modelName}OrderByWithAggregationInput`)}.array()]).optional()`,
|
|
3639
|
+
`having: ${Transformer.getObjectSchemaName(`${modelName}ScalarWhereWithAggregatesInput`)}.optional()`,
|
|
3640
|
+
'take: z.number().optional()',
|
|
3641
|
+
'skip: z.number().optional()',
|
|
3642
|
+
`by: z.array(${this.getPascalCaseModelName(modelName)}ScalarFieldEnumSchema)`,
|
|
3643
|
+
`_count: z.union([ z.literal(true), ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'CountAggregateInput')}`)} ]).optional()`,
|
|
3644
|
+
`_min: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'MinAggregateInput')}`)}.optional()`,
|
|
3645
|
+
`_max: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'MaxAggregateInput')}`)}.optional()`,
|
|
3646
|
+
];
|
|
3647
|
+
// Only include _avg and _sum for models with numeric fields
|
|
3648
|
+
if (hasNumericFieldsForGroupBy) {
|
|
3649
|
+
baseFields.push(`_avg: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'AvgAggregateInput')}`)}.optional()`, `_sum: ${Transformer.getObjectSchemaName(`${this.getAggregateInputName(modelName, 'SumAggregateInput')}`)}.optional()`);
|
|
3650
|
+
}
|
|
3651
|
+
const strictModeSuffix = ((_x = Transformer.getStrictModeResolver()) === null || _x === void 0 ? void 0 : _x.getOperationStrictModeSuffix(modelName, 'groupBy')) || '';
|
|
3652
|
+
const groupBySchemaObject = this.composeObjectDefinition(baseFields.join(', '), strictModeSuffix);
|
|
3653
|
+
const dualExports = this.generateDualSchemaExports(modelName, 'GroupBy', groupBySchemaObject, `Prisma.${this.getPrismaTypeName(modelName)}GroupByArgs`);
|
|
3654
|
+
// Use the standardized schema file generation with collision detection
|
|
3655
|
+
await Transformer.writeSchemaFile(modelName, 'GroupBy', schemaContent + dualExports);
|
|
3656
|
+
}
|
|
3657
|
+
}
|
|
3658
|
+
catch (err) {
|
|
3659
|
+
// Log error with contextual information before continuing to next model
|
|
3660
|
+
logger_1.logger.error(`Failed to generate schemas for model "${modelOperation.model}":`, err);
|
|
3661
|
+
continue;
|
|
3662
|
+
}
|
|
3663
|
+
}
|
|
3664
|
+
}
|
|
3665
|
+
/**
|
|
3666
|
+
* Generate result schemas for all enabled models
|
|
3667
|
+
*/
|
|
3668
|
+
async generateResultSchemas() {
|
|
3669
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
3670
|
+
const config = Transformer.getGeneratorConfig();
|
|
3671
|
+
if ((config === null || config === void 0 ? void 0 : config.emit) && config.emit.results === false) {
|
|
3672
|
+
logger_1.logger.debug('⏭️ emit.results=false (skipping result schema generation)');
|
|
3673
|
+
return;
|
|
3674
|
+
}
|
|
3675
|
+
// Check if result schemas are enabled globally
|
|
3676
|
+
if ((config === null || config === void 0 ? void 0 : config.mode) === 'minimal') {
|
|
3677
|
+
logger_1.logger.debug('⏭️ Skipping result schema generation in minimal mode');
|
|
3678
|
+
return;
|
|
3679
|
+
}
|
|
3680
|
+
// `variants` also accepts the array form of custom variants, which has no pure/input/result keys.
|
|
3681
|
+
const builtInVariants = Array.isArray(config === null || config === void 0 ? void 0 : config.variants) ? undefined : config === null || config === void 0 ? void 0 : config.variants;
|
|
3682
|
+
if (((_a = builtInVariants === null || builtInVariants === void 0 ? void 0 : builtInVariants.result) === null || _a === void 0 ? void 0 : _a.enabled) === false) {
|
|
3683
|
+
logger_1.logger.debug('⏭️ Result schema generation is disabled globally');
|
|
3684
|
+
return;
|
|
3685
|
+
}
|
|
3686
|
+
const generatorConfig = Transformer.getGeneratorConfig();
|
|
3687
|
+
if (!generatorConfig) {
|
|
3688
|
+
throw new Error('Generator config not available for result schema generation');
|
|
3689
|
+
}
|
|
3690
|
+
// The typed-JSON context is where the *file* sits, which the generator cannot know:
|
|
3691
|
+
// a relative `typedJson.schemaModule` has to resolve from `results/`, and in
|
|
3692
|
+
// single-file mode from wherever the bundle lands. It is inert unless the user set
|
|
3693
|
+
// `typedJson.applyToResults`.
|
|
3694
|
+
const resultGenerator = new results_1.ResultSchemaGenerator(generatorConfig, {
|
|
3695
|
+
outputSubdir: Transformer.typedJsonOutputSubdir('results'),
|
|
3696
|
+
importExtension: Transformer.getImportFileExtension(),
|
|
3697
|
+
singleFile: (0, singleFileAggregator_1.isSingleFileEnabled)(),
|
|
3698
|
+
});
|
|
3699
|
+
// Determine which pure model schemas (schemas/models/<Model>.schema.ts) are
|
|
3700
|
+
// emitted so relation fields in result schemas can reference them instead of
|
|
3701
|
+
// falling back to z.unknown(). Reuse the exact pure-model emission predicate
|
|
3702
|
+
// (see prisma-generator.ts) and the shared pure-model naming resolver.
|
|
3703
|
+
//
|
|
3704
|
+
// Single-file mode intentionally yields an empty map: the aggregator inlines
|
|
3705
|
+
// every schema into one bundle and strips relative imports, and result
|
|
3706
|
+
// schemas are emitted before pure models in that bundle, so a forward
|
|
3707
|
+
// reference would not resolve. Relations therefore degrade to the safe
|
|
3708
|
+
// z.unknown() fallback in single-file mode.
|
|
3709
|
+
// Mirror BOTH gates that guard pure-model emission in prisma-generator.ts:
|
|
3710
|
+
// 1) the emit gate: emit.pureModels ?? !!pureModels (call site)
|
|
3711
|
+
// 2) generatePureModelSchemas: returns early unless pureModels is truthy
|
|
3712
|
+
// so files exist only when the emit gate is on AND pureModels is truthy.
|
|
3713
|
+
// Using both avoids referencing models/ files that were never written
|
|
3714
|
+
// (e.g. emit.pureModels=true while pureModels is falsy).
|
|
3715
|
+
const emitPureModelsGate = (_c = (_b = generatorConfig.emit) === null || _b === void 0 ? void 0 : _b.pureModels) !== null && _c !== void 0 ? _c : !!generatorConfig.pureModels;
|
|
3716
|
+
const pureModelsEmitted = emitPureModelsGate && !!generatorConfig.pureModels;
|
|
3717
|
+
const importExtension = Transformer.getImportFileExtension();
|
|
3718
|
+
const availablePureModels = new Map();
|
|
3719
|
+
if (pureModelsEmitted && !(0, singleFileAggregator_1.isSingleFileEnabled)()) {
|
|
3720
|
+
const namingResolved = (0, naming_resolver_1.resolvePureModelNaming)(generatorConfig);
|
|
3721
|
+
for (const candidate of this.models) {
|
|
3722
|
+
if (!Transformer.isModelEnabled(candidate.name))
|
|
3723
|
+
continue;
|
|
3724
|
+
const modelFileName = (0, naming_resolver_1.applyPattern)(namingResolved.filePattern, candidate.name, namingResolved.schemaSuffix, namingResolved.typeSuffix);
|
|
3725
|
+
const modelExportName = (0, naming_resolver_1.applyPattern)(namingResolved.exportNamePattern, candidate.name, namingResolved.schemaSuffix, namingResolved.typeSuffix);
|
|
3726
|
+
availablePureModels.set(candidate.name, {
|
|
3727
|
+
exportName: modelExportName,
|
|
3728
|
+
fileBase: modelFileName.replace(/\.ts$/, ''),
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
resultGenerator.setAvailablePureModels(availablePureModels);
|
|
3733
|
+
const opSuffix = (op) => {
|
|
3734
|
+
switch (op) {
|
|
3735
|
+
case 'findUnique':
|
|
3736
|
+
return 'FindUnique';
|
|
3737
|
+
case 'findFirst':
|
|
3738
|
+
return 'FindFirst';
|
|
3739
|
+
case 'findMany':
|
|
3740
|
+
return 'FindMany';
|
|
3741
|
+
case 'create':
|
|
3742
|
+
return 'Create';
|
|
3743
|
+
case 'createMany':
|
|
3744
|
+
return 'CreateMany';
|
|
3745
|
+
case 'update':
|
|
3746
|
+
return 'Update';
|
|
3747
|
+
case 'updateMany':
|
|
3748
|
+
return 'UpdateMany';
|
|
3749
|
+
case 'upsert':
|
|
3750
|
+
return 'Upsert';
|
|
3751
|
+
case 'delete':
|
|
3752
|
+
return 'Delete';
|
|
3753
|
+
case 'deleteMany':
|
|
3754
|
+
return 'DeleteMany';
|
|
3755
|
+
case 'aggregate':
|
|
3756
|
+
return 'Aggregate';
|
|
3757
|
+
case 'groupBy':
|
|
3758
|
+
return 'GroupBy';
|
|
3759
|
+
case 'count':
|
|
3760
|
+
return 'Count';
|
|
3761
|
+
default:
|
|
3762
|
+
return op;
|
|
3763
|
+
}
|
|
3764
|
+
};
|
|
3765
|
+
for (const model of this.models) {
|
|
3766
|
+
// Skip generation for disabled models
|
|
3767
|
+
if (!Transformer.isModelEnabled(model.name)) {
|
|
3768
|
+
continue;
|
|
3769
|
+
}
|
|
3770
|
+
// Check if result schemas are enabled for this specific model
|
|
3771
|
+
const modelConfig = (_d = config === null || config === void 0 ? void 0 : config.models) === null || _d === void 0 ? void 0 : _d[model.name];
|
|
3772
|
+
if (((_f = (_e = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.variants) === null || _e === void 0 ? void 0 : _e.result) === null || _f === void 0 ? void 0 : _f.enabled) === false) {
|
|
3773
|
+
logger_1.logger.debug(`⏭️ Result schema generation is disabled for model: ${model.name}`);
|
|
3774
|
+
continue;
|
|
3775
|
+
}
|
|
3776
|
+
logger_1.logger.debug(`🎯 Generating result schemas for model: ${model.name}`);
|
|
3777
|
+
// Generate all result schemas for this model
|
|
3778
|
+
const resultSchemas = resultGenerator.generateAllResultSchemas(model);
|
|
3779
|
+
// Create results directory if it doesn't exist
|
|
3780
|
+
const resultsPath = path_1.default.join(Transformer.getSchemasPath(), 'results');
|
|
3781
|
+
// Write each result schema to appropriate file
|
|
3782
|
+
for (const resultSchema of resultSchemas) {
|
|
3783
|
+
const fileName = `${model.name}${opSuffix(resultSchema.operationType)}Result.schema.ts`;
|
|
3784
|
+
const filePath = path_1.default.join(resultsPath, fileName);
|
|
3785
|
+
// Generate imports only for schemas that are actually used
|
|
3786
|
+
const imports = [];
|
|
3787
|
+
// Add zod import
|
|
3788
|
+
imports.push(this.generateImportZodStatement());
|
|
3789
|
+
// Only add other imports if they're actually referenced in the schema
|
|
3790
|
+
if (resultSchema.dependencies && resultSchema.dependencies.length > 0) {
|
|
3791
|
+
resultSchema.dependencies.forEach((dep) => {
|
|
3792
|
+
// Derive input base from common exported identifiers
|
|
3793
|
+
const base = dep
|
|
3794
|
+
.replace(/(ObjectSchema|ObjectZodSchema|Schema)$/, '')
|
|
3795
|
+
.replace(/(Select|Include)$/, '$1'); // keep Select/Include tokens
|
|
3796
|
+
const isSelectOrInclude = /(Select|Include)(ObjectSchema|ObjectZodSchema|Schema)?$/.test(dep);
|
|
3797
|
+
imports.push(isSelectOrInclude
|
|
3798
|
+
? this.generateObjectInputImport(base, 'results')
|
|
3799
|
+
: this.generateInputImport(base, 'results'));
|
|
3800
|
+
});
|
|
3801
|
+
}
|
|
3802
|
+
// Import pure model schemas referenced by relation fields from ../models.
|
|
3803
|
+
// These are distinct from `dependencies` (which route through ../objects).
|
|
3804
|
+
if (resultSchema.modelDependencies && resultSchema.modelDependencies.length > 0) {
|
|
3805
|
+
const seenModelImports = new Set();
|
|
3806
|
+
for (const depModelName of resultSchema.modelDependencies) {
|
|
3807
|
+
const info = availablePureModels.get(depModelName);
|
|
3808
|
+
if (!info)
|
|
3809
|
+
continue; // safety: only import models known to be emitted
|
|
3810
|
+
if (seenModelImports.has(info.exportName))
|
|
3811
|
+
continue; // de-dupe
|
|
3812
|
+
seenModelImports.add(info.exportName);
|
|
3813
|
+
imports.push(`import { ${info.exportName} } from '../models/${info.fileBase}${importExtension}';\n`);
|
|
3814
|
+
}
|
|
3815
|
+
}
|
|
3816
|
+
// Typed-JSON replacements, already merged per module and filtered to the names
|
|
3817
|
+
// this file mentions. Empty unless `typedJson.applyToResults` is on, which is
|
|
3818
|
+
// what keeps the emitted bytes identical for everyone who did not ask for this.
|
|
3819
|
+
for (const typedJsonImport of (_g = resultSchema.typedJsonImports) !== null && _g !== void 0 ? _g : []) {
|
|
3820
|
+
imports.push(`${typedJsonImport.importStatement};\n`);
|
|
3821
|
+
}
|
|
3822
|
+
await (0, writeFileSafely_1.writeFileSafely)(filePath, `${imports.join('')}${resultSchema.zodSchema}`);
|
|
3823
|
+
}
|
|
3824
|
+
}
|
|
3825
|
+
// Generate consolidated index file for all result schemas
|
|
3826
|
+
const resultIndexPath = path_1.default.join(Transformer.getSchemasPath(), 'results', 'index.ts');
|
|
3827
|
+
// `importExtension` is already resolved above for this method.
|
|
3828
|
+
const allExports = [];
|
|
3829
|
+
// Collect all result schema exports for all processed models
|
|
3830
|
+
for (const model of this.models) {
|
|
3831
|
+
if (!Transformer.isModelEnabled(model.name)) {
|
|
3832
|
+
continue;
|
|
3833
|
+
}
|
|
3834
|
+
const modelConfig = (_h = config === null || config === void 0 ? void 0 : config.models) === null || _h === void 0 ? void 0 : _h[model.name];
|
|
3835
|
+
if (((_k = (_j = modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.variants) === null || _j === void 0 ? void 0 : _j.result) === null || _k === void 0 ? void 0 : _k.enabled) === false) {
|
|
3836
|
+
continue;
|
|
3837
|
+
}
|
|
3838
|
+
const resultSchemas = resultGenerator.generateAllResultSchemas(model);
|
|
3839
|
+
for (const resultSchema of resultSchemas) {
|
|
3840
|
+
allExports.push(`export { ${resultSchema.schemaName} } from './${model.name}${opSuffix(resultSchema.operationType)}Result.schema${importExtension}';`);
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
if (allExports.length > 0) {
|
|
3844
|
+
await (0, writeFileSafely_1.writeFileSafely)(resultIndexPath, allExports.join('\n') + '\n');
|
|
3845
|
+
// Add results index to main index exports
|
|
3846
|
+
(0, writeIndexFile_1.addIndexExport)(resultIndexPath);
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
generateImportStatements(imports) {
|
|
3850
|
+
var _a;
|
|
3851
|
+
let generatedImports = this.generateImportZodStatement();
|
|
3852
|
+
// Filter out empty, undefined, and invalid imports
|
|
3853
|
+
const validImports = Transformer.cleanAndValidateImports(imports);
|
|
3854
|
+
// Log import management if any filtering occurred
|
|
3855
|
+
Transformer.logImportManagement(imports, validImports, this.name);
|
|
3856
|
+
// Ensure each import has a semicolon and join with newlines
|
|
3857
|
+
const formattedImports = validImports.map((imp) => (imp.endsWith(';') ? imp : imp + ';'));
|
|
3858
|
+
generatedImports += (_a = formattedImports.join('\n')) !== null && _a !== void 0 ? _a : '';
|
|
3859
|
+
generatedImports += '\n\n';
|
|
3860
|
+
return generatedImports;
|
|
3861
|
+
}
|
|
3862
|
+
/**
|
|
3863
|
+
* Clean and validate import array, removing empty and invalid imports
|
|
3864
|
+
*/
|
|
3865
|
+
static cleanAndValidateImports(imports) {
|
|
3866
|
+
return imports
|
|
3867
|
+
.filter((importItem) => {
|
|
3868
|
+
// Remove undefined/null/empty imports
|
|
3869
|
+
if (!importItem || importItem.trim() === '') {
|
|
3870
|
+
return false;
|
|
3871
|
+
}
|
|
3872
|
+
// Extract import information for validation
|
|
3873
|
+
const importInfo = Transformer.parseImportStatement(importItem);
|
|
3874
|
+
if (!importInfo) {
|
|
3875
|
+
return true; // Keep imports we can't parse (might be external libraries)
|
|
3876
|
+
}
|
|
3877
|
+
// Check if the import should be generated based on filtering rules
|
|
3878
|
+
return Transformer.shouldGenerateImport(importInfo.importName, importInfo.relatedModel);
|
|
3879
|
+
})
|
|
3880
|
+
.filter((importItem, index, array) => {
|
|
3881
|
+
// Remove duplicate imports
|
|
3882
|
+
return array.indexOf(importItem) === index;
|
|
3883
|
+
});
|
|
3884
|
+
}
|
|
3885
|
+
/**
|
|
3886
|
+
* Parse import statement to extract information
|
|
3887
|
+
*/
|
|
3888
|
+
static parseImportStatement(importStatement) {
|
|
3889
|
+
// Support: import { X } from '...'; import { X as Y } from '...'; import type { X as Y } from '...'; default imports as fallback
|
|
3890
|
+
const match = importStatement.match(/import\s*(?:type\s*)?\{\s*(\w+)(?:\s+as\s+\w+)?\s*\}\s*from\s*['"]([^'"]+)['"]/) || importStatement.match(/import\s*(?:type\s*)?(\w+)\s*from\s*['"]([^'"]+)['"]/);
|
|
3891
|
+
if (!match) {
|
|
3892
|
+
return null;
|
|
3893
|
+
}
|
|
3894
|
+
const importName = match[1];
|
|
3895
|
+
const importPath = match[2];
|
|
3896
|
+
const relatedModel = Transformer.extractModelFromImportName(importName);
|
|
3897
|
+
return {
|
|
3898
|
+
importName,
|
|
3899
|
+
importPath,
|
|
3900
|
+
relatedModel: relatedModel || undefined,
|
|
3901
|
+
};
|
|
3902
|
+
}
|
|
3903
|
+
/**
|
|
3904
|
+
* Log import management information
|
|
3905
|
+
*/
|
|
3906
|
+
static logImportManagement(originalImports, cleanedImports, context) {
|
|
3907
|
+
const originalCount = originalImports.filter((imp) => imp && imp.trim()).length;
|
|
3908
|
+
const cleanedCount = cleanedImports.length;
|
|
3909
|
+
if (originalCount !== cleanedCount) {
|
|
3910
|
+
const contextStr = context ? ` for ${context}` : '';
|
|
3911
|
+
logger_1.logger.debug(` 📦 Import cleanup${contextStr}: ${originalCount - cleanedCount} filtered (${cleanedCount}/${originalCount} kept)`);
|
|
3912
|
+
}
|
|
3913
|
+
}
|
|
3914
|
+
/**
|
|
3915
|
+
* Validate filter combinations and detect conflicts
|
|
3916
|
+
*/
|
|
3917
|
+
static validateFilterCombinations(allModels) {
|
|
3918
|
+
const config = this.getGeneratorConfig();
|
|
3919
|
+
const result = {
|
|
3920
|
+
isValid: true,
|
|
3921
|
+
warnings: [],
|
|
3922
|
+
errors: [],
|
|
3923
|
+
suggestions: [],
|
|
3924
|
+
};
|
|
3925
|
+
if (!config) {
|
|
3926
|
+
return result; // No configuration to validate
|
|
3927
|
+
}
|
|
3928
|
+
// Check model dependencies and relationships
|
|
3929
|
+
this.validateModelDependencies(allModels, result);
|
|
3930
|
+
// Check operation consistency
|
|
3931
|
+
this.validateOperationConsistency(allModels, result);
|
|
3932
|
+
// Check field exclusion conflicts
|
|
3933
|
+
this.validateFieldExclusions(allModels, result);
|
|
3934
|
+
// Check variant consistency
|
|
3935
|
+
this.validateVariantConsistency(result);
|
|
3936
|
+
// Check mode consistency
|
|
3937
|
+
this.validateModeConsistency(result);
|
|
3938
|
+
return result;
|
|
3939
|
+
}
|
|
3940
|
+
/**
|
|
3941
|
+
* Validate model dependencies and relationships
|
|
3942
|
+
*/
|
|
3943
|
+
static validateModelDependencies(allModels, result) {
|
|
3944
|
+
const config = this.getGeneratorConfig();
|
|
3945
|
+
if (!config)
|
|
3946
|
+
return;
|
|
3947
|
+
for (const model of allModels) {
|
|
3948
|
+
if (!this.isModelEnabled(model.name))
|
|
3949
|
+
continue;
|
|
3950
|
+
// Check if this model has relationships to disabled models
|
|
3951
|
+
const disabledRelations = model.fields.filter((field) => {
|
|
3952
|
+
return field.kind === 'object' && field.relationName && !this.isModelEnabled(field.type);
|
|
3953
|
+
});
|
|
3954
|
+
if (disabledRelations.length > 0) {
|
|
3955
|
+
const disabledModels = disabledRelations.map((f) => f.type);
|
|
3956
|
+
result.warnings.push(`Model "${model.name}" has relations to disabled models: ${disabledModels.join(', ')}. ` +
|
|
3957
|
+
`This may cause incomplete schema generation.`);
|
|
3958
|
+
result.suggestions.push(`Consider enabling models [${disabledModels.join(', ')}] or removing relation fields ` +
|
|
3959
|
+
`[${disabledRelations.map((f) => f.name).join(', ')}] from ${model.name}`);
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
}
|
|
3963
|
+
/**
|
|
3964
|
+
* Validate operation consistency across models
|
|
3965
|
+
*/
|
|
3966
|
+
static validateOperationConsistency(allModels, result) {
|
|
3967
|
+
var _a;
|
|
3968
|
+
const config = this.getGeneratorConfig();
|
|
3969
|
+
if (!config)
|
|
3970
|
+
return;
|
|
3971
|
+
const enabledModels = allModels.filter((m) => this.isModelEnabled(m.name));
|
|
3972
|
+
for (const model of enabledModels) {
|
|
3973
|
+
const modelConfig = (_a = config.models) === null || _a === void 0 ? void 0 : _a[model.name];
|
|
3974
|
+
if (!(modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.operations))
|
|
3975
|
+
continue;
|
|
3976
|
+
// Check for operations that require relationships
|
|
3977
|
+
const requiresRelations = ['aggregate', 'groupBy'];
|
|
3978
|
+
const hasEnabledRelations = (0, model_helpers_1.checkModelHasEnabledModelRelation)(model);
|
|
3979
|
+
for (const operation of requiresRelations) {
|
|
3980
|
+
if (modelConfig.operations.includes(operation) && !hasEnabledRelations) {
|
|
3981
|
+
result.warnings.push(`Model "${model.name}" has "${operation}" operation enabled but no active relationships. ` +
|
|
3982
|
+
`This operation may not function as expected.`);
|
|
3983
|
+
}
|
|
3984
|
+
}
|
|
3985
|
+
// Check for circular dependencies in custom operations
|
|
3986
|
+
if (modelConfig.operations.length === 0) {
|
|
3987
|
+
result.warnings.push(`Model "${model.name}" has no operations enabled. Consider disabling the model entirely.`);
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
/**
|
|
3992
|
+
* Validate field exclusion conflicts
|
|
3993
|
+
*/
|
|
3994
|
+
static validateFieldExclusions(allModels, result) {
|
|
3995
|
+
var _a;
|
|
3996
|
+
const config = this.getGeneratorConfig();
|
|
3997
|
+
if (!config)
|
|
3998
|
+
return;
|
|
3999
|
+
const enabledModels = allModels.filter((m) => this.isModelEnabled(m.name));
|
|
4000
|
+
for (const model of enabledModels) {
|
|
4001
|
+
const modelConfig = (_a = config.models) === null || _a === void 0 ? void 0 : _a[model.name];
|
|
4002
|
+
if (!(modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.variants))
|
|
4003
|
+
continue;
|
|
4004
|
+
// Check each variant for field exclusion conflicts
|
|
4005
|
+
Object.entries(modelConfig.variants).forEach(([variantName, variantConfig]) => {
|
|
4006
|
+
if (!(variantConfig === null || variantConfig === void 0 ? void 0 : variantConfig.excludeFields))
|
|
4007
|
+
return;
|
|
4008
|
+
const variant = variantName;
|
|
4009
|
+
// Check if all fields would be excluded
|
|
4010
|
+
const totalFields = model.fields.length;
|
|
4011
|
+
const excludedFields = variantConfig.excludeFields.length;
|
|
4012
|
+
if (excludedFields >= totalFields) {
|
|
4013
|
+
result.errors.push(`Model "${model.name}" ${variant} variant excludes all fields. This will result in empty schemas.`);
|
|
4014
|
+
result.isValid = false;
|
|
4015
|
+
}
|
|
4016
|
+
// Check for required fields being excluded
|
|
4017
|
+
const requiredFields = model.fields.filter((f) => f.isRequired && f.kind === 'scalar');
|
|
4018
|
+
const excludedRequiredFields = requiredFields.filter((f) => variantConfig.excludeFields && variantConfig.excludeFields.includes(f.name));
|
|
4019
|
+
if (excludedRequiredFields.length > 0 && variant === 'input') {
|
|
4020
|
+
result.warnings.push(`Model "${model.name}" ${variant} variant excludes required fields: ` +
|
|
4021
|
+
`${excludedRequiredFields.map((f) => f.name).join(', ')}. This may cause validation issues.`);
|
|
4022
|
+
}
|
|
4023
|
+
});
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
/**
|
|
4027
|
+
* Validate variant consistency
|
|
4028
|
+
*/
|
|
4029
|
+
static validateVariantConsistency(result) {
|
|
4030
|
+
const config = this.getGeneratorConfig();
|
|
4031
|
+
if (!(config === null || config === void 0 ? void 0 : config.variants))
|
|
4032
|
+
return;
|
|
4033
|
+
// Check if variants are configured but no models use them
|
|
4034
|
+
// `variants` also accepts the array form of custom variants, which has no pure/input/result keys.
|
|
4035
|
+
const builtInForWarning = Array.isArray(config.variants) ? undefined : config.variants;
|
|
4036
|
+
const configuredVariants = Object.keys(builtInForWarning !== null && builtInForWarning !== void 0 ? builtInForWarning : {});
|
|
4037
|
+
const enabledVariants = configuredVariants.filter((variant) => { var _a; return (_a = builtInForWarning === null || builtInForWarning === void 0 ? void 0 : builtInForWarning[variant]) === null || _a === void 0 ? void 0 : _a.enabled; });
|
|
4038
|
+
if (enabledVariants.length === 0) {
|
|
4039
|
+
result.warnings.push('Variants are configured but none are enabled. Consider enabling at least one variant or removing variant configuration.');
|
|
4040
|
+
}
|
|
4041
|
+
// Check for conflicting variant settings
|
|
4042
|
+
if (config.mode === 'minimal' && enabledVariants.includes('result')) {
|
|
4043
|
+
result.warnings.push('Minimal mode with result variant enabled may generate more schemas than expected. ' +
|
|
4044
|
+
'Consider using only pure and input variants in minimal mode.');
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
/**
|
|
4048
|
+
* Validate mode consistency
|
|
4049
|
+
*/
|
|
4050
|
+
static validateModeConsistency(result) {
|
|
4051
|
+
const config = this.getGeneratorConfig();
|
|
4052
|
+
if (!config)
|
|
4053
|
+
return;
|
|
4054
|
+
// Check if minimal mode has models configured
|
|
4055
|
+
if (config.mode === 'minimal' && (!config.models || Object.keys(config.models).length === 0)) {
|
|
4056
|
+
// In minimal mode, absence of explicit model configuration should default to "all models enabled".
|
|
4057
|
+
// Provide a non-blocking suggestion instead of an error so generation can proceed.
|
|
4058
|
+
result.warnings.push('Minimal mode without explicit model configuration: generating schemas for all models with minimal constraints.');
|
|
4059
|
+
result.suggestions.push('Optionally add model configurations to fine-tune which models/operations are emitted in minimal mode.');
|
|
4060
|
+
}
|
|
4061
|
+
// Check if custom mode has meaningful configuration
|
|
4062
|
+
if (config.mode === 'custom' && (!config.models || Object.keys(config.models).length === 0)) {
|
|
4063
|
+
result.warnings.push('Custom mode without model configurations will behave like full mode. Consider adding specific model settings.');
|
|
4064
|
+
}
|
|
4065
|
+
}
|
|
4066
|
+
/**
|
|
4067
|
+
* Log filter validation results
|
|
4068
|
+
*/
|
|
4069
|
+
static logFilterValidation(validationResult) {
|
|
4070
|
+
const { isValid, errors, warnings, suggestions } = validationResult;
|
|
4071
|
+
if (errors.length > 0) {
|
|
4072
|
+
logger_1.logger.warn('❌ Filter Validation Errors:');
|
|
4073
|
+
errors.forEach((error) => logger_1.logger.warn(` • ${error}`));
|
|
4074
|
+
}
|
|
4075
|
+
if (warnings.length > 0) {
|
|
4076
|
+
logger_1.logger.warn('⚠️ Filter Validation Warnings:');
|
|
4077
|
+
warnings.forEach((warning) => logger_1.logger.warn(` • ${warning}`));
|
|
4078
|
+
}
|
|
4079
|
+
if (suggestions.length > 0) {
|
|
4080
|
+
logger_1.logger.info('💡 Suggestions:');
|
|
4081
|
+
suggestions.forEach((suggestion) => logger_1.logger.info(` • ${suggestion}`));
|
|
4082
|
+
}
|
|
4083
|
+
if (isValid && errors.length === 0 && warnings.length === 0) {
|
|
4084
|
+
logger_1.logger.debug('✅ Filter configuration validation passed');
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
/**
|
|
4088
|
+
* Perform comprehensive filter validation
|
|
4089
|
+
*/
|
|
4090
|
+
static performFilterValidation(allModels) {
|
|
4091
|
+
const validationResult = this.validateFilterCombinations(allModels);
|
|
4092
|
+
this.logFilterValidation(validationResult);
|
|
4093
|
+
return validationResult.isValid;
|
|
4094
|
+
}
|
|
4095
|
+
resolveSelectIncludeImportAndZodSchemaLine(model) {
|
|
4096
|
+
var _a;
|
|
4097
|
+
const { name: modelName } = model;
|
|
4098
|
+
// Log relationship preservation information
|
|
4099
|
+
Transformer.logRelationshipPreservation(model);
|
|
4100
|
+
const selectImport = Transformer.shouldGenerateSelectSchema(model)
|
|
4101
|
+
? this.generateObjectInputImport(`${modelName}Select`, 'root')
|
|
4102
|
+
: '';
|
|
4103
|
+
const includeImport = Transformer.shouldGenerateIncludeSchema(model)
|
|
4104
|
+
? this.generateObjectInputImport(`${modelName}Include`, 'root')
|
|
4105
|
+
: '';
|
|
4106
|
+
let selectZodSchemaLine = '';
|
|
4107
|
+
let includeZodSchemaLine = '';
|
|
4108
|
+
let selectZodSchemaLineLazy = '';
|
|
4109
|
+
let includeZodSchemaLineLazy = '';
|
|
4110
|
+
let selectValueExpr = '';
|
|
4111
|
+
let includeValueExpr = '';
|
|
4112
|
+
const cfg = Transformer.getGeneratorConfig();
|
|
4113
|
+
const target = ((_a = cfg === null || cfg === void 0 ? void 0 : cfg.zodImportTarget) !== null && _a !== void 0 ? _a : 'auto');
|
|
4114
|
+
if (Transformer.shouldGenerateSelectSchema(model)) {
|
|
4115
|
+
const selectSchemaName = Transformer.exportTypedSchemas
|
|
4116
|
+
? `${modelName}SelectObjectSchema`
|
|
4117
|
+
: `${modelName}SelectObject${Transformer.zodSchemaSuffix}`;
|
|
4118
|
+
const zodSelectObjectSchema = `${selectSchemaName}.optional()`;
|
|
4119
|
+
selectValueExpr = zodSelectObjectSchema;
|
|
4120
|
+
if (target === 'v4') {
|
|
4121
|
+
selectZodSchemaLine = `get select(){ return ${zodSelectObjectSchema}; },`;
|
|
4122
|
+
selectZodSchemaLineLazy = selectZodSchemaLine;
|
|
4123
|
+
}
|
|
4124
|
+
else {
|
|
4125
|
+
selectZodSchemaLine = `select: ${zodSelectObjectSchema},`;
|
|
4126
|
+
selectZodSchemaLineLazy = `select: z.lazy(() => ${zodSelectObjectSchema}),`;
|
|
4127
|
+
}
|
|
4128
|
+
}
|
|
4129
|
+
if (Transformer.shouldGenerateIncludeSchema(model)) {
|
|
4130
|
+
const includeSchemaName = Transformer.exportTypedSchemas
|
|
4131
|
+
? `${modelName}IncludeObjectSchema`
|
|
4132
|
+
: `${modelName}IncludeObject${Transformer.zodSchemaSuffix}`;
|
|
4133
|
+
const zodIncludeObjectSchema = `${includeSchemaName}.optional()`;
|
|
4134
|
+
includeValueExpr = zodIncludeObjectSchema;
|
|
4135
|
+
if (target === 'v4') {
|
|
4136
|
+
includeZodSchemaLine = `get include(){ return ${zodIncludeObjectSchema}; },`;
|
|
4137
|
+
includeZodSchemaLineLazy = includeZodSchemaLine;
|
|
4138
|
+
}
|
|
4139
|
+
else {
|
|
4140
|
+
includeZodSchemaLine = `include: ${zodIncludeObjectSchema},`;
|
|
4141
|
+
includeZodSchemaLineLazy = `include: z.lazy(() => ${zodIncludeObjectSchema}),`;
|
|
4142
|
+
}
|
|
4143
|
+
}
|
|
4144
|
+
return {
|
|
4145
|
+
selectImport,
|
|
4146
|
+
includeImport,
|
|
4147
|
+
selectZodSchemaLine,
|
|
4148
|
+
includeZodSchemaLine,
|
|
4149
|
+
selectZodSchemaLineLazy,
|
|
4150
|
+
includeZodSchemaLineLazy,
|
|
4151
|
+
selectValueExpr,
|
|
4152
|
+
includeValueExpr,
|
|
4153
|
+
};
|
|
4154
|
+
}
|
|
4155
|
+
resolveIncludeFieldReference(includeValueExpr, includeZodSchemaLineLazy, isV4Target = false) {
|
|
4156
|
+
if (!includeValueExpr && !includeZodSchemaLineLazy) {
|
|
4157
|
+
return '';
|
|
4158
|
+
}
|
|
4159
|
+
if (isV4Target) {
|
|
4160
|
+
return includeValueExpr !== null && includeValueExpr !== void 0 ? includeValueExpr : '';
|
|
4161
|
+
}
|
|
4162
|
+
if (includeZodSchemaLineLazy) {
|
|
4163
|
+
return includeZodSchemaLineLazy.replace('include: ', '').replace(',', '').trim();
|
|
4164
|
+
}
|
|
4165
|
+
return includeValueExpr !== null && includeValueExpr !== void 0 ? includeValueExpr : '';
|
|
4166
|
+
}
|
|
4167
|
+
resolveOrderByWithRelationImportAndZodSchemaLine(model) {
|
|
4168
|
+
var _a;
|
|
4169
|
+
const { name: modelName } = model;
|
|
4170
|
+
let modelOrderBy = '';
|
|
4171
|
+
if (['postgresql', 'mysql'].includes(Transformer.provider) &&
|
|
4172
|
+
((_a = Transformer.previewFeatures) === null || _a === void 0 ? void 0 : _a.includes('fullTextSearch'))) {
|
|
4173
|
+
modelOrderBy = `${modelName}OrderByWithRelationAndSearchRelevanceInput`;
|
|
4174
|
+
}
|
|
4175
|
+
else {
|
|
4176
|
+
modelOrderBy = `${modelName}OrderByWithRelationInput`;
|
|
4177
|
+
}
|
|
4178
|
+
const orderByImport = this.generateInputImport(modelOrderBy);
|
|
4179
|
+
const orderByZodSchemaLine = `orderBy: z.union([${Transformer.getObjectSchemaName(modelOrderBy)}, ${Transformer.getObjectSchemaName(modelOrderBy)}.array()]).optional(),`;
|
|
4180
|
+
return { orderByImport, orderByZodSchemaLine };
|
|
4181
|
+
}
|
|
4182
|
+
/**
|
|
4183
|
+
* Determines if a select schema should be inlined to avoid circular dependencies.
|
|
4184
|
+
* Following community generator approach: ALWAYS inline select schemas.
|
|
4185
|
+
* Use lazy loading only for specific relation fields within the inlined schema.
|
|
4186
|
+
*/
|
|
4187
|
+
shouldInlineSelectSchema(_model) {
|
|
4188
|
+
// Community generator approach: Always inline select schemas
|
|
4189
|
+
// This prevents circular imports by keeping select definitions local
|
|
4190
|
+
// Use z.lazy() only for relation fields within the inlined schema
|
|
4191
|
+
return true; // Always inline - aggressive inlining like community generator
|
|
4192
|
+
}
|
|
4193
|
+
/**
|
|
4194
|
+
* Resolves the nested-args schema a relation field should union with inside an
|
|
4195
|
+
* inline select schema, mirroring the gating used for objects/<Model>Select.schema.ts
|
|
4196
|
+
* (see select-helpers/include-helpers). Returns null when only booleans are allowed
|
|
4197
|
+
* (minimal mode, select+include both disabled, or the related model disabled).
|
|
4198
|
+
*/
|
|
4199
|
+
resolveInlineSelectRelationTarget(field) {
|
|
4200
|
+
if (!field.relationName)
|
|
4201
|
+
return null;
|
|
4202
|
+
const config = Transformer.getGeneratorConfig();
|
|
4203
|
+
if ((config === null || config === void 0 ? void 0 : config.mode) === 'minimal')
|
|
4204
|
+
return null;
|
|
4205
|
+
if (!Transformer.isGenerateSelect && !Transformer.isGenerateInclude)
|
|
4206
|
+
return null;
|
|
4207
|
+
if (!Transformer.isModelEnabled(field.type))
|
|
4208
|
+
return null;
|
|
4209
|
+
if (field.isList && (0, model_helpers_1.isOperationEnabledForModel)(field.type, 'findMany')) {
|
|
4210
|
+
return { kind: 'query', modelName: field.type };
|
|
4211
|
+
}
|
|
4212
|
+
return { kind: 'args', typeName: `${field.type}Args` };
|
|
4213
|
+
}
|
|
4214
|
+
/**
|
|
4215
|
+
* Resolves the <Model>CountOutputTypeArgs reference for the `_count` field of an
|
|
4216
|
+
* inline select schema, or null when `_count` must remain boolean-only.
|
|
4217
|
+
*/
|
|
4218
|
+
resolveInlineSelectCountArgsReference(model) {
|
|
4219
|
+
const config = Transformer.getGeneratorConfig();
|
|
4220
|
+
if ((config === null || config === void 0 ? void 0 : config.mode) === 'minimal')
|
|
4221
|
+
return null;
|
|
4222
|
+
if (!Transformer.isGenerateSelect)
|
|
4223
|
+
return null;
|
|
4224
|
+
return Transformer.getObjectSchemaName(`${model.name}CountOutputTypeArgs`);
|
|
4225
|
+
}
|
|
4226
|
+
/**
|
|
4227
|
+
* Resolve the actual exported identifier of a model query schema file, matching the
|
|
4228
|
+
* naming used by generateDualSchemaExports (typed export when enabled, Zod export
|
|
4229
|
+
* otherwise, honoring naming.schema.exportNamePattern).
|
|
4230
|
+
*/
|
|
4231
|
+
resolveModelQueryExportName(modelName, operationType) {
|
|
4232
|
+
var _a, _b;
|
|
4233
|
+
let baseExportName = `${modelName}${operationType}`;
|
|
4234
|
+
try {
|
|
4235
|
+
const schemaNamingConfig = (_b = (_a = Transformer.getGeneratorConfig()) === null || _a === void 0 ? void 0 : _a.naming) === null || _b === void 0 ? void 0 : _b.schema;
|
|
4236
|
+
if (schemaNamingConfig === null || schemaNamingConfig === void 0 ? void 0 : schemaNamingConfig.exportNamePattern) {
|
|
4237
|
+
const customExportName = (0, naming_resolver_1.generateExportName)(schemaNamingConfig.exportNamePattern, modelName, operationType);
|
|
4238
|
+
if (customExportName) {
|
|
4239
|
+
baseExportName = customExportName;
|
|
4240
|
+
}
|
|
4241
|
+
}
|
|
4242
|
+
}
|
|
4243
|
+
catch {
|
|
4244
|
+
// Fallback to default naming
|
|
4245
|
+
}
|
|
4246
|
+
if (Transformer.exportTypedSchemas) {
|
|
4247
|
+
return baseExportName.endsWith('Schema')
|
|
4248
|
+
? baseExportName
|
|
4249
|
+
: `${baseExportName}${Transformer.typedSchemaSuffix}`;
|
|
4250
|
+
}
|
|
4251
|
+
return `${baseExportName}${Transformer.zodSchemaSuffix}`;
|
|
4252
|
+
}
|
|
4253
|
+
/**
|
|
4254
|
+
* Generate an import statement for a root-level model query schema file
|
|
4255
|
+
* (e.g. findManyPost.schema.ts), honoring naming.schema patterns. `from`
|
|
4256
|
+
* selects the relative prefix: './' for root-level CRUD files, '../' for
|
|
4257
|
+
* files inside objects/.
|
|
4258
|
+
*/
|
|
4259
|
+
generateModelQueryImport(modelName, queryName, from = 'objects') {
|
|
4260
|
+
const importExtension = this.getImportFileExtension();
|
|
4261
|
+
const prefix = from === 'objects' ? '..' : '.';
|
|
4262
|
+
const operation = queryName.charAt(0).toUpperCase() + queryName.slice(1);
|
|
4263
|
+
const aliasName = this.resolveModelQuerySchemaName(modelName, queryName);
|
|
4264
|
+
try {
|
|
4265
|
+
const schemaCfg = (0, naming_resolver_1.resolveSchemaNaming)(Transformer.getGeneratorConfig());
|
|
4266
|
+
const fileName = (0, naming_resolver_1.generateFileName)(schemaCfg.filePattern, modelName, operation);
|
|
4267
|
+
const baseName = fileName.replace(/\.ts$/, '');
|
|
4268
|
+
const exportName = this.resolveModelQueryExportName(modelName, operation);
|
|
4269
|
+
if (exportName === aliasName) {
|
|
4270
|
+
return `import { ${exportName} } from '${prefix}/${baseName}${importExtension}'`;
|
|
4271
|
+
}
|
|
4272
|
+
return `import { ${exportName} as ${aliasName} } from '${prefix}/${baseName}${importExtension}'`;
|
|
4273
|
+
}
|
|
4274
|
+
catch {
|
|
4275
|
+
// Fallback to legacy hardcoded naming if naming resolver fails
|
|
4276
|
+
return `import { ${aliasName} } from '${prefix}/${operation}${modelName}.schema${importExtension}'`;
|
|
4277
|
+
}
|
|
4278
|
+
}
|
|
4279
|
+
/**
|
|
4280
|
+
* Generates the additional imports needed for inlined select schemas.
|
|
4281
|
+
* Returns import statements for the model query / Args schemas referenced by
|
|
4282
|
+
* relation-field unions (mirroring objects/<Model>Select.schema.ts imports).
|
|
4283
|
+
*/
|
|
4284
|
+
generateInlineSelectImports(model, operation) {
|
|
4285
|
+
const imports = [];
|
|
4286
|
+
for (const field of model.fields) {
|
|
4287
|
+
const relationTarget = this.resolveInlineSelectRelationTarget(field);
|
|
4288
|
+
if (!relationTarget)
|
|
4289
|
+
continue;
|
|
4290
|
+
if (relationTarget.kind === 'query') {
|
|
4291
|
+
// A self list relation inside the findMany file references an export declared
|
|
4292
|
+
// later in the same file; z.lazy defers the dereference, so no import is needed.
|
|
4293
|
+
if (operation === 'FindMany' && relationTarget.modelName === model.name)
|
|
4294
|
+
continue;
|
|
4295
|
+
imports.push(this.generateModelQueryImport(relationTarget.modelName, 'findMany', 'root'));
|
|
4296
|
+
}
|
|
4297
|
+
else {
|
|
4298
|
+
imports.push(this.generateObjectInputImport(relationTarget.typeName, 'root'));
|
|
4299
|
+
}
|
|
4300
|
+
}
|
|
4301
|
+
const hasArrayRelations = model.fields.some((field) => field.relationName && field.isList);
|
|
4302
|
+
if (hasArrayRelations && this.resolveInlineSelectCountArgsReference(model)) {
|
|
4303
|
+
imports.push(this.generateObjectInputImport(`${model.name}CountOutputTypeArgs`, 'root'));
|
|
4304
|
+
}
|
|
4305
|
+
// Remove duplicates
|
|
4306
|
+
return [...new Set(imports)];
|
|
4307
|
+
}
|
|
4308
|
+
/**
|
|
4309
|
+
* Generates dual schema exports: typed version and Zod-method-friendly version
|
|
4310
|
+
*/
|
|
4311
|
+
generateDualSchemaExports(modelName, operationType, schemaDefinition, prismaType) {
|
|
4312
|
+
var _a;
|
|
4313
|
+
const exports = [];
|
|
4314
|
+
// Use schema naming configuration if available
|
|
4315
|
+
let baseExportName = `${modelName}${operationType}`;
|
|
4316
|
+
try {
|
|
4317
|
+
const config = Transformer.getGeneratorConfig();
|
|
4318
|
+
const schemaNamingConfig = (_a = config === null || config === void 0 ? void 0 : config.naming) === null || _a === void 0 ? void 0 : _a.schema;
|
|
4319
|
+
if (schemaNamingConfig === null || schemaNamingConfig === void 0 ? void 0 : schemaNamingConfig.exportNamePattern) {
|
|
4320
|
+
const customExportName = (0, naming_resolver_1.generateExportName)(schemaNamingConfig.exportNamePattern, modelName, operationType);
|
|
4321
|
+
if (customExportName) {
|
|
4322
|
+
baseExportName = customExportName;
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
catch {
|
|
4327
|
+
// Fallback to default naming if there's an error
|
|
4328
|
+
}
|
|
4329
|
+
// Generate typed schema (perfect inference, no methods) - KEEP PRISMA TYPING
|
|
4330
|
+
if (Transformer.exportTypedSchemas) {
|
|
4331
|
+
const typedName = baseExportName.endsWith('Schema')
|
|
4332
|
+
? baseExportName
|
|
4333
|
+
: `${baseExportName}${Transformer.typedSchemaSuffix}`;
|
|
4334
|
+
exports.push(`export const ${typedName}: z.ZodType<${prismaType}> = ${schemaDefinition} as unknown as z.ZodType<${prismaType}>;`);
|
|
4335
|
+
}
|
|
4336
|
+
// Generate Zod schema (methods available, loose inference)
|
|
4337
|
+
if (Transformer.exportZodSchemas) {
|
|
4338
|
+
const zodName = `${baseExportName}${Transformer.zodSchemaSuffix}`;
|
|
4339
|
+
exports.push(`export const ${zodName} = ${schemaDefinition};`);
|
|
4340
|
+
}
|
|
4341
|
+
return exports.join('\n\n');
|
|
4342
|
+
}
|
|
4343
|
+
/**
|
|
4344
|
+
* Generates dual select schema exports for inlined schemas
|
|
4345
|
+
*/
|
|
4346
|
+
generateDualSelectSchemaExports(model, operation) {
|
|
4347
|
+
const modelName = model.name;
|
|
4348
|
+
const schemaDefinition = this.generateInlineSelectSchemaDefinition(model);
|
|
4349
|
+
const exports = [];
|
|
4350
|
+
// Generate typed select schema - KEEP PRISMA TYPING
|
|
4351
|
+
if (Transformer.exportTypedSchemas) {
|
|
4352
|
+
const typedName = `${modelName}${operation ? operation : ''}Select${Transformer.typedSchemaSuffix}`;
|
|
4353
|
+
exports.push(`export const ${typedName}: z.ZodType<Prisma.${this.getPrismaTypeName(modelName)}Select> = ${schemaDefinition} as unknown as z.ZodType<Prisma.${this.getPrismaTypeName(modelName)}Select>;`);
|
|
4354
|
+
}
|
|
4355
|
+
// Generate Zod select schema
|
|
4356
|
+
if (Transformer.exportZodSchemas) {
|
|
4357
|
+
const zodName = `${modelName}${operation ? operation : ''}Select${Transformer.zodSchemaSuffix}`;
|
|
4358
|
+
exports.push(`export const ${zodName} = ${schemaDefinition};`);
|
|
4359
|
+
}
|
|
4360
|
+
return exports.join('\n\n');
|
|
4361
|
+
}
|
|
4362
|
+
/**
|
|
4363
|
+
* Generates just the schema definition without export statement
|
|
4364
|
+
*/
|
|
4365
|
+
generateInlineSelectSchemaDefinition(model) {
|
|
4366
|
+
var _a;
|
|
4367
|
+
const { fields } = model;
|
|
4368
|
+
// Generate field definitions for the select schema
|
|
4369
|
+
const selectFields = [];
|
|
4370
|
+
for (const field of fields) {
|
|
4371
|
+
const { name: fieldName } = field;
|
|
4372
|
+
const relationTarget = this.resolveInlineSelectRelationTarget(field);
|
|
4373
|
+
if (relationTarget) {
|
|
4374
|
+
// Relation selection mirrors objects/<Model>Select.schema.ts: Prisma's
|
|
4375
|
+
// <Model>Select accepts boolean OR nested args (select/include/where/...).
|
|
4376
|
+
const reference = relationTarget.kind === 'query'
|
|
4377
|
+
? this.resolveModelQuerySchemaName(relationTarget.modelName, 'findMany')
|
|
4378
|
+
: Transformer.getObjectSchemaName(relationTarget.typeName);
|
|
4379
|
+
selectFields.push(` ${fieldName}: z.union([z.boolean(), z.lazy(() => ${reference})]).optional()`);
|
|
4380
|
+
}
|
|
4381
|
+
else {
|
|
4382
|
+
// Scalar field (or relation without a generated nested-args schema): boolean only
|
|
4383
|
+
selectFields.push(` ${fieldName}: z.boolean().optional()`);
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
// Add _count field if model has array relations (for aggregation support)
|
|
4387
|
+
const hasArrayRelations = fields.some((field) => field.relationName && field.isList);
|
|
4388
|
+
if (hasArrayRelations) {
|
|
4389
|
+
const countArgsReference = this.resolveInlineSelectCountArgsReference(model);
|
|
4390
|
+
selectFields.push(countArgsReference
|
|
4391
|
+
? ` _count: z.union([z.boolean(), z.lazy(() => ${countArgsReference})]).optional()`
|
|
4392
|
+
: ` _count: z.boolean().optional()`);
|
|
4393
|
+
}
|
|
4394
|
+
// Apply strict mode based on configuration for object schemas
|
|
4395
|
+
const strictModeSuffix = ((_a = Transformer.getStrictModeResolver()) === null || _a === void 0 ? void 0 : _a.getObjectStrictModeSuffix(model.name)) || '';
|
|
4396
|
+
return `z.object({
|
|
4397
|
+
${selectFields.join(',\n')}
|
|
4398
|
+
})${strictModeSuffix}`;
|
|
4399
|
+
}
|
|
4400
|
+
}
|
|
4401
|
+
Transformer.enumNames = [];
|
|
4402
|
+
Transformer.rawOpsMap = {};
|
|
4403
|
+
Transformer.outputPath = './generated';
|
|
4404
|
+
Transformer.prismaClientOutputPath = '@prisma/client';
|
|
4405
|
+
Transformer.isCustomPrismaClientOutputPath = false;
|
|
4406
|
+
Transformer.prismaClientProvider = 'prisma-client-js';
|
|
4407
|
+
Transformer.prismaClientEntryBasenameCache = new Map();
|
|
4408
|
+
Transformer.prismaClientConfig = {};
|
|
4409
|
+
Transformer.isGenerateSelect = false;
|
|
4410
|
+
Transformer.isGenerateInclude = false;
|
|
4411
|
+
Transformer.generatorConfig = null;
|
|
4412
|
+
Transformer.strictModeResolver = null;
|
|
4413
|
+
Transformer.usedSchemaFilePaths = new Map();
|
|
4414
|
+
// Dual schema export configuration
|
|
4415
|
+
Transformer.exportTypedSchemas = true; // Export z.ZodType<Prisma.Type> versions (type-safe)
|
|
4416
|
+
Transformer.exportZodSchemas = true; // Export pure Zod versions (method-friendly)
|
|
4417
|
+
Transformer.typedSchemaSuffix = 'Schema'; // Suffix for typed schemas (PostFindManySchema)
|
|
4418
|
+
Transformer.zodSchemaSuffix = 'ZodSchema'; // Suffix for Zod schemas (PostFindManyZodSchema)
|
|
4419
|
+
Transformer.jsonHelpersWritten = false;
|
|
4420
|
+
Transformer.decimalHelpersWritten = false;
|
|
4421
|
+
// Track generated files for safe cleanup
|
|
4422
|
+
Transformer.currentManifest = null;
|
|
4423
|
+
/**
|
|
4424
|
+
* The per-field copies of Prisma's shared update-operations inputs, planned once per
|
|
4425
|
+
* generate. Empty unless `typedJson` is configured and some column is annotated.
|
|
4426
|
+
*/
|
|
4427
|
+
Transformer.typedFieldUpdateOperationsPlan = typed_field_update_operations_1.EMPTY_TYPED_FIELD_UPDATE_OPERATIONS_PLAN;
|
|
4428
|
+
/**
|
|
4429
|
+
* Shared regex patterns for model-specific enum detection
|
|
4430
|
+
*/
|
|
4431
|
+
Transformer.modelEnumPatterns = [
|
|
4432
|
+
/^(\w+)ScalarFieldEnum$/,
|
|
4433
|
+
/^(\w+)OrderByRelevanceFieldEnum$/,
|
|
4434
|
+
];
|
|
4435
|
+
exports.default = Transformer;
|
|
4436
|
+
//# sourceMappingURL=transformer.js.map
|