diff --git a/.github/renovate.json b/.github/renovate.json index 37fec8af5a..96740c8237 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -6,13 +6,7 @@ "packageRules": [ { "groupName": "patched packages", - "matchPackageNames": [ - "@crowdin/ota-client", - "eslint-plugin-node", - "iso-google-locales", - "trpc-panel", - "next-auth" - ], + "matchPackageNames": ["@crowdin/ota-client", "eslint-plugin-node", "iso-google-locales", "trpc-panel"], "matchUpdateTypes": ["major", "minor", "patch"] } ], diff --git a/apps/app/package.json b/apps/app/package.json index 69248d3e18..992a50827e 100644 --- a/apps/app/package.json +++ b/apps/app/package.json @@ -97,7 +97,7 @@ "just-compare": "2.3.0", "luxon": "3.4.0", "next": "13.4.16", - "next-auth": "4.23.0", + "next-auth": "4.23.1", "next-i18next": "14.0.0", "next-seo": "6.1.0", "nextjs-routes": "2.0.1", diff --git a/package.json b/package.json index eedf6d5505..69a8d3eb1c 100644 --- a/package.json +++ b/package.json @@ -93,8 +93,7 @@ "@crowdin/ota-client@1.0.0": "patches/@crowdin__ota-client@1.0.0.patch", "eslint-plugin-node@11.1.0": "patches/eslint-plugin-node@11.1.0.patch", "iso-google-locales@3.0.4": "patches/iso-google-locales@3.0.4.patch", - "trpc-panel@1.3.4": "patches/trpc-panel@1.3.4.patch", - "next-auth@4.23.0": "patches/next-auth@4.23.0.patch" + "trpc-panel@1.3.4": "patches/trpc-panel@1.3.4.patch" }, "peerDependencyRules": { "allowedVersions": { diff --git a/packages/auth/package.json b/packages/auth/package.json index db02e004b5..2d9f190700 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -33,7 +33,7 @@ "@weareinreach/eslint-config": "0.100.0", "eslint": "8.47.0", "next": "13.4.16", - "next-auth": "4.23.0", + "next-auth": "4.23.1", "react": "18.2.0", "react-dom": "18.2.0", "typescript": "5.1.6" diff --git a/packages/ui/package.json b/packages/ui/package.json index 1ba3fecd99..8c76f458e4 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -140,7 +140,7 @@ "msw": "1.2.3", "msw-storybook-addon": "1.8.0", "next": "13.4.16", - "next-auth": "4.23.0", + "next-auth": "4.23.1", "next-i18next": "14.0.0", "next-router-mock": "0.9.9", "postcss-loader": "7.3.3", diff --git a/patches/next-auth@4.23.0.patch b/patches/next-auth@4.23.0.patch deleted file mode 100644 index 05abb6fd57..0000000000 --- a/patches/next-auth@4.23.0.patch +++ /dev/null @@ -1,278 +0,0 @@ -diff --git a/package.json b/package.json -index 896c4c4182d67b5bb60b698b3404800be2bd8a82..5e733541d866f864a5bccb91c4e994e4d2e53e3e 100644 ---- a/package.json -+++ b/package.json -@@ -1,148 +1,127 @@ - { -- "name": "next-auth", -- "version": "4.23.0", -- "description": "Authentication for Next.js", -- "homepage": "https://next-auth.js.org", -- "repository": "https://github.com/nextauthjs/next-auth.git", -- "author": "Iain Collins ", -- "contributors": [ -- "Balázs Orbán ", -- "Nico Domino ", -- "Lluis Agusti ", -- "Thang Huu Vu " -- ], -- "main": "index.js", -- "module": "index.js", -- "types": "index.d.ts", -- "keywords": [ -- "react", -- "nodejs", -- "oauth", -- "jwt", -- "oauth2", -- "authentication", -- "nextjs", -- "csrf", -- "oidc", -- "nextauth" -- ], -- "exports": { -- ".": { -- "types": "./index.d.ts", -- "import": "./index.js" -- }, -- "./jwt": { -- "types": "./jwt/index.d.ts", -- "import": "./jwt/index.js" -- }, -- "./react": { -- "types": "./react/index.d.ts", -- "import": "./react/index.js" -- }, -- "./next": { -- "types": "./next/index.d.ts", -- "import": "./next/index.js" -- }, -- "./middleware": { -- "types": "./middleware.d.ts", -- "import": "./middleware.js" -- }, -- "./client/_utils": { -- "types": "./client/_utils.d.ts", -- "import": "./client/_utils.js" -- }, -- "./providers/*": { -- "types": "./providers/*.d.ts", -- "import": "./providers/*.js" -- } -- }, -- "files": [ -- "client", -- "core", -- "css", -- "jwt", -- "lib", -- "next", -- "providers", -- "react", -- "src", -- "utils", -- "*.d.ts*", -- "*.js" -- ], -- "license": "ISC", -- "dependencies": { -- "@babel/runtime": "^7.20.13", -- "@panva/hkdf": "^1.0.2", -- "cookie": "^0.5.0", -- "jose": "^4.11.4", -- "oauth": "^0.9.15", -- "openid-client": "^5.4.0", -- "preact": "^10.6.3", -- "preact-render-to-string": "^5.1.19", -- "uuid": "^8.3.2" -- }, -- "peerDependencies": { -- "next": "^12.2.5 || ^13", -- "nodemailer": "^6.6.5", -- "react": "^17.0.2 || ^18", -- "react-dom": "^17.0.2 || ^18" -- }, -- "peerDependenciesMeta": { -- "nodemailer": { -- "optional": true -- } -- }, -- "devDependencies": { -- "@babel/cli": "^7.17.10", -- "@babel/core": "^7.18.2", -- "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", -- "@babel/plugin-transform-runtime": "^7.18.2", -- "@babel/preset-env": "^7.18.2", -- "@babel/preset-react": "^7.17.12", -- "@babel/preset-typescript": "^7.17.12", -- "@edge-runtime/jest-environment": "1.1.0-beta.35", -- "@next-auth/tsconfig": "0.0.0", -- "@swc/core": "^1.2.198", -- "@swc/jest": "^0.2.21", -- "@testing-library/dom": "^8.13.0", -- "@testing-library/jest-dom": "^5.16.4", -- "@testing-library/react": "^13.3.0", -- "@testing-library/react-hooks": "^8.0.0", -- "@testing-library/user-event": "^14.2.0", -- "@types/jest": "^28.1.3", -- "@types/node": "^17.0.42", -- "@types/nodemailer": "^6.4.4", -- "@types/oauth": "^0.9.1", -- "@types/react": "18.0.37", -- "@types/react-dom": "^18.0.6", -- "autoprefixer": "^10.4.7", -- "babel-plugin-jsx-pragmatic": "^1.0.2", -- "babel-preset-preact": "^2.0.0", -- "concurrently": "^7", -- "cssnano": "^5.1.11", -- "jest": "^28.1.1", -- "jest-environment-jsdom": "^28.1.1", -- "jest-watch-typeahead": "^1.1.0", -- "msw": "^0.42.3", -- "next": "13.3.0", -- "postcss": "^8.4.14", -- "postcss-cli": "^9.1.0", -- "postcss-nested": "^5.0.6", -- "react": "^18", -- "react-dom": "^18", -- "whatwg-fetch": "^3.6.2" -- }, -- "scripts": { -- "build": "pnpm clean && pnpm build:js && pnpm build:css", -- "build:js": "pnpm clean && pnpm generate-providers && pnpm tsc --project tsconfig.json && babel --config-file ./config/babel.config.js src --out-dir . --extensions \".tsx,.ts,.js,.jsx\"", -- "clean": "rm -rf coverage client css utils providers core jwt react next lib ./*.js ./*.ts*", -- "build:css": "postcss --config config/postcss.config.js src/**/*.css --base src --dir . && node config/wrap-css.js", -- "dev": "pnpm clean && pnpm generate-providers && concurrently \"pnpm watch:css\" \"pnpm watch:ts\"", -- "watch:ts": "pnpm tsc --project tsconfig.dev.json", -- "watch:css": "postcss --config config/postcss.config.js --watch src/**/*.css --base src --dir .", -- "test": "jest --config ./config/jest.config.js", -- "generate-providers": "node ./config/generate-providers.js", -- "lint": "eslint src config tests" -- } -+ "name": "next-auth", -+ "version": "4.23.0", -+ "description": "Authentication for Next.js", -+ "homepage": "https://next-auth.js.org", -+ "repository": "https://github.com/nextauthjs/next-auth.git", -+ "author": "Iain Collins ", -+ "contributors": [ -+ "Balázs Orbán ", -+ "Nico Domino ", -+ "Lluis Agusti ", -+ "Thang Huu Vu " -+ ], -+ "main": "index.js", -+ "module": "index.js", -+ "types": "index.d.ts", -+ "keywords": [ -+ "react", -+ "nodejs", -+ "oauth", -+ "jwt", -+ "oauth2", -+ "authentication", -+ "nextjs", -+ "csrf", -+ "oidc", -+ "nextauth" -+ ], -+ "exports": { -+ ".": "./index.js", -+ "./jwt": "./jwt/index.js", -+ "./react": "./react/index.js", -+ "./next": "./next/index.js", -+ "./middleware": "./middleware.js", -+ "./client/_utils": "./client/_utils.js", -+ "./providers/*": "./providers/*.js" -+ }, -+ "files": [ -+ "client", -+ "core", -+ "css", -+ "jwt", -+ "lib", -+ "next", -+ "providers", -+ "react", -+ "src", -+ "utils", -+ "*.d.ts*", -+ "*.js" -+ ], -+ "license": "ISC", -+ "dependencies": { -+ "@babel/runtime": "^7.20.13", -+ "@panva/hkdf": "^1.0.2", -+ "cookie": "^0.5.0", -+ "jose": "^4.11.4", -+ "oauth": "^0.9.15", -+ "openid-client": "^5.4.0", -+ "preact": "^10.6.3", -+ "preact-render-to-string": "^5.1.19", -+ "uuid": "^8.3.2" -+ }, -+ "peerDependencies": { -+ "next": "^12.2.5 || ^13", -+ "nodemailer": "^6.6.5", -+ "react": "^17.0.2 || ^18", -+ "react-dom": "^17.0.2 || ^18" -+ }, -+ "peerDependenciesMeta": { -+ "nodemailer": { -+ "optional": true -+ } -+ }, -+ "devDependencies": { -+ "@babel/cli": "^7.17.10", -+ "@babel/core": "^7.18.2", -+ "@babel/plugin-proposal-optional-catch-binding": "^7.16.7", -+ "@babel/plugin-transform-runtime": "^7.18.2", -+ "@babel/preset-env": "^7.18.2", -+ "@babel/preset-react": "^7.17.12", -+ "@babel/preset-typescript": "^7.17.12", -+ "@edge-runtime/jest-environment": "1.1.0-beta.35", -+ "@next-auth/tsconfig": "0.0.0", -+ "@swc/core": "^1.2.198", -+ "@swc/jest": "^0.2.21", -+ "@testing-library/dom": "^8.13.0", -+ "@testing-library/jest-dom": "^5.16.4", -+ "@testing-library/react": "^13.3.0", -+ "@testing-library/react-hooks": "^8.0.0", -+ "@testing-library/user-event": "^14.2.0", -+ "@types/jest": "^28.1.3", -+ "@types/node": "^17.0.42", -+ "@types/nodemailer": "^6.4.4", -+ "@types/oauth": "^0.9.1", -+ "@types/react": "18.0.37", -+ "@types/react-dom": "^18.0.6", -+ "autoprefixer": "^10.4.7", -+ "babel-plugin-jsx-pragmatic": "^1.0.2", -+ "babel-preset-preact": "^2.0.0", -+ "concurrently": "^7", -+ "cssnano": "^5.1.11", -+ "jest": "^28.1.1", -+ "jest-environment-jsdom": "^28.1.1", -+ "jest-watch-typeahead": "^1.1.0", -+ "msw": "^0.42.3", -+ "next": "13.3.0", -+ "postcss": "^8.4.14", -+ "postcss-cli": "^9.1.0", -+ "postcss-nested": "^5.0.6", -+ "react": "^18", -+ "react-dom": "^18", -+ "whatwg-fetch": "^3.6.2" -+ }, -+ "scripts": { -+ "build": "pnpm clean && pnpm build:js && pnpm build:css", -+ "build:js": "pnpm clean && pnpm generate-providers && pnpm tsc --project tsconfig.json && babel --config-file ./config/babel.config.js src --out-dir . --extensions \".tsx,.ts,.js,.jsx\"", -+ "clean": "rm -rf coverage client css utils providers core jwt react next lib ./*.js ./*.ts*", -+ "build:css": "postcss --config config/postcss.config.js src/**/*.css --base src --dir . && node config/wrap-css.js", -+ "dev": "pnpm clean && pnpm generate-providers && concurrently \"pnpm watch:css\" \"pnpm watch:ts\"", -+ "watch:ts": "pnpm tsc --project tsconfig.dev.json", -+ "watch:css": "postcss --config config/postcss.config.js --watch src/**/*.css --base src --dir .", -+ "test": "jest --config ./config/jest.config.js", -+ "generate-providers": "node ./config/generate-providers.js", -+ "lint": "eslint src config tests" -+ } - } \ No newline at end of file diff --git a/patches/zod-prisma@0.5.4.patch b/patches/zod-prisma@0.5.4.patch deleted file mode 100644 index 8c962cfe1e..0000000000 --- a/patches/zod-prisma@0.5.4.patch +++ /dev/null @@ -1,274 +0,0 @@ -diff --git a/dist/zod-prisma.cjs.development.js b/dist/zod-prisma.cjs.development.js -index fb04fd45d6e6d9407ed9ab0b13533b05f3ae4d08..b75f4aa8ea9602757f3b1707a06905286dc73217 100644 ---- a/dist/zod-prisma.cjs.development.js -+++ b/dist/zod-prisma.cjs.development.js -@@ -33,10 +33,8 @@ const useModelNames = ({ - if (modelCase === 'camelCase') { - name = name.slice(0, 1).toLowerCase() + name.slice(1); - } -- - return `${prefix}${name}${modelSuffix}`; - }; -- - return { - modelName: name => formatModelName(name, relationModel === 'default' ? '_' : ''), - relatedModelName: name => formatModelName(relationModel === 'default' ? name.toString() : `Related${name.toString()}`) -@@ -57,24 +55,21 @@ const dotSlash = input => { - - const getJSDocs = docString => { - const lines = []; -- - if (docString) { - const docLines = docString.split('\n').filter(dL => !dL.trimStart().startsWith('@zod')); -- - if (docLines.length) { - lines.push('/**'); - docLines.forEach(dL => lines.push(` * ${dL}`)); - lines.push(' */'); - } - } -- - return lines; - }; --const getZodDocElements = docString => docString.split('\n').filter(line => line.trimStart().startsWith('@zod')).map(line => line.trimStart().slice(4)).flatMap(line => // Array.from(line.matchAll(/\.([^().]+\(.*?\))/g), (m) => m.slice(1)).flat() -+const getZodDocElements = docString => docString.split('\n').filter(line => line.trimStart().startsWith('@zod')).map(line => line.trimStart().slice(4)).flatMap(line => -+// Array.from(line.matchAll(/\.([^().]+\(.*?\))/g), (m) => m.slice(1)).flat() - chunk(parenthesis.parse(line), 2).slice(0, -1).map(([each, contents]) => each.replace(/\)?\./, '') + `${parenthesis.stringify(contents)})`)); - const computeCustomSchema = docString => { - var _getZodDocElements$fi; -- - return (_getZodDocElements$fi = getZodDocElements(docString).find(modifier => modifier.startsWith('custom('))) == null ? void 0 : _getZodDocElements$fi.slice(7).slice(0, -1); - }; - const computeModifiers = docString => { -@@ -84,43 +79,34 @@ const computeModifiers = docString => { - const getZodConstructor = (field, getRelatedModelName = name => name.toString()) => { - let zodType = 'z.unknown()'; - let extraModifiers = ['']; -- - if (field.kind === 'scalar') { - switch (field.type) { - case 'String': - zodType = 'z.string()'; - break; -- - case 'Int': - zodType = 'z.number()'; - extraModifiers.push('int()'); - break; -- - case 'BigInt': - zodType = 'z.bigint()'; - break; -- - case 'DateTime': - zodType = 'z.date()'; - break; -- - case 'Float': - zodType = 'z.number()'; - break; -- - case 'Decimal': - zodType = 'z.number()'; - break; -- - case 'Json': - zodType = 'jsonSchema'; - break; -- - case 'Boolean': - zodType = 'z.boolean()'; - break; - // TODO: Proper type for bytes fields -- - case 'Bytes': - zodType = 'z.unknown()'; - break; -@@ -130,18 +116,14 @@ const getZodConstructor = (field, getRelatedModelName = name => name.toString()) - } else if (field.kind === 'object') { - zodType = getRelatedModelName(field.type); - } -- - if (field.isList) extraModifiers.push('array()'); -- - if (field.documentation) { - var _computeCustomSchema; -- - zodType = (_computeCustomSchema = computeCustomSchema(field.documentation)) != null ? _computeCustomSchema : zodType; - extraModifiers.push(...computeModifiers(field.documentation)); - } -- -- if (!field.isRequired && field.type !== 'Json') extraModifiers.push('nullish()'); // if (field.hasDefaultValue) extraModifiers.push('optional()') -- -+ if (!field.isRequired && field.type !== 'Json') extraModifiers.push('nullish()'); -+ // if (field.hasDefaultValue) extraModifiers.push('optional()') - return `${zodType}${extraModifiers.join('.')}`; - }; - -@@ -158,7 +140,6 @@ const writeImportsForModel = (model, sourceFile, config, { - namespaceImport: 'z', - moduleSpecifier: 'zod' - }]; -- - if (config.imports) { - importList.push({ - kind: tsMorph.StructureKind.ImportDeclaration, -@@ -166,7 +147,6 @@ const writeImportsForModel = (model, sourceFile, config, { - moduleSpecifier: dotSlash(path__default["default"].relative(outputPath, path__default["default"].resolve(path__default["default"].dirname(schemaPath), config.imports))) - }); - } -- - if (config.useDecimalJs && model.fields.some(f => f.type === 'Decimal')) { - importList.push({ - kind: tsMorph.StructureKind.ImportDeclaration, -@@ -174,23 +154,19 @@ const writeImportsForModel = (model, sourceFile, config, { - moduleSpecifier: 'decimal.js' - }); - } -- - const enumFields = model.fields.filter(f => f.kind === 'enum'); - const relationFields = model.fields.filter(f => f.kind === 'object'); - const relativePath = path__default["default"].relative(outputPath, clientPath); -- - if (enumFields.length > 0) { - importList.push({ - kind: tsMorph.StructureKind.ImportDeclaration, - isTypeOnly: enumFields.length === 0, - moduleSpecifier: dotSlash(relativePath), -- namedImports: enumFields.map(f => f.type) -+ namedImports: Array.from(new Set(enumFields.map(f => f.type))) - }); - } -- - if (config.relationModel !== false && relationFields.length > 0) { - const filteredFields = relationFields.filter(f => f.type !== model.name); -- - if (filteredFields.length > 0) { - importList.push({ - kind: tsMorph.StructureKind.ImportDeclaration, -@@ -199,7 +175,6 @@ const writeImportsForModel = (model, sourceFile, config, { - }); - } - } -- - sourceFile.addImportDeclarations(importList); - }; - const writeTypeSpecificSchemas = (model, sourceFile, config, _prismaOptions) => { -@@ -209,7 +184,6 @@ const writeTypeSpecificSchemas = (model, sourceFile, config, _prismaOptions) => - writeArray(writer, ['// Helper schema for JSON fields', `type Literal = boolean | number | string${config.prismaJsonNullability ? '' : '| null'}`, 'type Json = Literal | { [key: string]: Json } | Json[]', `const literalSchema = z.union([z.string(), z.number(), z.boolean()${config.prismaJsonNullability ? '' : ', z.null()'}])`, 'const jsonSchema: z.ZodSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))']); - }); - } -- - if (config.useDecimalJs && model.fields.some(f => f.type === 'Decimal')) { - sourceFile.addStatements(writer => { - writer.newLine(); -@@ -227,7 +201,6 @@ const generateSchemaForModel = (model, sourceFile, config, _prismaOptions) => { - leadingTrivia: writer => writer.blankLineIfLastNot(), - declarations: [{ - name: modelName(model.name), -- - initializer(writer) { - writer.write('z.object(').inlineBlock(() => { - model.fields.filter(f => f.kind !== 'object').forEach(field => { -@@ -236,7 +209,6 @@ const generateSchemaForModel = (model, sourceFile, config, _prismaOptions) => { - }); - }).write(')'); - } -- - }] - }); - }; -@@ -263,7 +235,6 @@ const generateRelatedSchemaForModel = (model, sourceFile, config, _prismaOptions - declarations: [{ - name: relatedModelName(model.name), - type: `z.ZodSchema`, -- - initializer(writer) { - writer.write(`z.lazy(() => ${modelName(model.name)}.extend(`).inlineBlock(() => { - relationFields.forEach(field => { -@@ -272,7 +243,6 @@ const generateRelatedSchemaForModel = (model, sourceFile, config, _prismaOptions - }); - }).write('))'); - } -- - }] - }); - }; -@@ -297,7 +267,6 @@ generatorHelper.generatorHandler({ - defaultOutput: 'zod' - }; - }, -- - onGenerate(options) { - const project = new tsMorph.Project(); - const models = options.dmmf.datamodel.models; -@@ -336,6 +305,5 @@ generatorHelper.generatorHandler({ - }); - return project.save(); - } -- - }); - //# sourceMappingURL=zod-prisma.cjs.development.js.map -diff --git a/dist/zod-prisma.cjs.development.js.map b/dist/zod-prisma.cjs.development.js.map -index c2ac3f57954c438381edb0eaaa01b3e171fcedea..4b58c7dd4a82d85c10b861e2211696bfeeb8667f 100644 ---- a/dist/zod-prisma.cjs.development.js.map -+++ b/dist/zod-prisma.cjs.development.js.map -@@ -1 +1 @@ --{"version":3,"file":"zod-prisma.cjs.development.js","sources":["../src/config.ts","../src/util.ts","../src/docs.ts","../src/types.ts","../src/generator.ts","../src/index.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst configBoolean = z.enum(['true', 'false']).transform((arg) => JSON.parse(arg))\n\nexport const configSchema = z.object({\n\trelationModel: configBoolean.default('true').or(z.literal('default')),\n\tmodelSuffix: z.string().default('Model'),\n\tmodelCase: z.enum(['PascalCase', 'camelCase']).default('PascalCase'),\n\tuseDecimalJs: configBoolean.default('false'),\n\timports: z.string().optional(),\n\tprismaJsonNullability: configBoolean.default('true'),\n})\n\nexport type Config = z.infer\n\nexport type PrismaOptions = {\n\tschemaPath: string\n\toutputPath: string\n\tclientPath: string\n}\n\nexport type Names = {\n\tmodel: string\n\trelated: string\n}\n","import { DMMF } from '@prisma/generator-helper'\nimport type { CodeBlockWriter } from 'ts-morph'\nimport { Config } from './config'\n\nexport const writeArray = (writer: CodeBlockWriter, array: string[], newLine = true) =>\n\tarray.forEach((line) => writer.write(line).conditionalNewLine(newLine))\n\nexport const useModelNames = ({ modelCase, modelSuffix, relationModel }: Config) => {\n\tconst formatModelName = (name: string, prefix = '') => {\n\t\tif (modelCase === 'camelCase') {\n\t\t\tname = name.slice(0, 1).toLowerCase() + name.slice(1)\n\t\t}\n\t\treturn `${prefix}${name}${modelSuffix}`\n\t}\n\n\treturn {\n\t\tmodelName: (name: string) => formatModelName(name, relationModel === 'default' ? '_' : ''),\n\t\trelatedModelName: (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\t\tformatModelName(\n\t\t\t\trelationModel === 'default' ? name.toString() : `Related${name.toString()}`\n\t\t\t),\n\t}\n}\n\nexport const needsRelatedModel = (model: DMMF.Model, config: Config) =>\n\tmodel.fields.some((field) => field.kind === 'object') && config.relationModel !== false\n\nexport const chunk = (input: T, size: number): T[] => {\n\treturn input.reduce((arr, item, idx) => {\n\t\treturn idx % size === 0\n\t\t\t? [...arr, [item]]\n\t\t\t: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]]\n\t}, [])\n}\n\nexport const dotSlash = (input: string) => {\n\tconst converted = input\n\t\t.replace(/^\\\\\\\\\\?\\\\/, '')\n\t\t.replace(/\\\\/g, '/')\n\t\t.replace(/\\/\\/+/g, '/')\n\n\tif (converted.includes(`/node_modules/`)) return converted.split(`/node_modules/`).slice(-1)[0]\n\n\tif (converted.startsWith(`../`)) return converted\n\n\treturn './' + converted\n}\n","import { ArrayTree, parse, stringify } from 'parenthesis'\nimport { chunk } from './util'\n\nexport const getJSDocs = (docString?: string) => {\n\tconst lines: string[] = []\n\n\tif (docString) {\n\t\tconst docLines = docString.split('\\n').filter((dL) => !dL.trimStart().startsWith('@zod'))\n\n\t\tif (docLines.length) {\n\t\t\tlines.push('/**')\n\t\t\tdocLines.forEach((dL) => lines.push(` * ${dL}`))\n\t\t\tlines.push(' */')\n\t\t}\n\t}\n\n\treturn lines\n}\n\nexport const getZodDocElements = (docString: string) =>\n\tdocString\n\t\t.split('\\n')\n\t\t.filter((line) => line.trimStart().startsWith('@zod'))\n\t\t.map((line) => line.trimStart().slice(4))\n\t\t.flatMap((line) =>\n\t\t\t// Array.from(line.matchAll(/\\.([^().]+\\(.*?\\))/g), (m) => m.slice(1)).flat()\n\t\t\tchunk(parse(line), 2)\n\t\t\t\t.slice(0, -1)\n\t\t\t\t.map(\n\t\t\t\t\t([each, contents]) =>\n\t\t\t\t\t\t(each as string).replace(/\\)?\\./, '') +\n\t\t\t\t\t\t`${stringify(contents as ArrayTree)})`\n\t\t\t\t)\n\t\t)\n\nexport const computeCustomSchema = (docString: string) => {\n\treturn getZodDocElements(docString)\n\t\t.find((modifier) => modifier.startsWith('custom('))\n\t\t?.slice(7)\n\t\t.slice(0, -1)\n}\n\nexport const computeModifiers = (docString: string) => {\n\treturn getZodDocElements(docString).filter((each) => !each.startsWith('custom('))\n}\n","import type { DMMF } from '@prisma/generator-helper'\nimport { computeCustomSchema, computeModifiers } from './docs'\n\nexport const getZodConstructor = (\n\tfield: DMMF.Field,\n\tgetRelatedModelName = (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\tname.toString()\n) => {\n\tlet zodType = 'z.unknown()'\n\tlet extraModifiers: string[] = ['']\n\tif (field.kind === 'scalar') {\n\t\tswitch (field.type) {\n\t\t\tcase 'String':\n\t\t\t\tzodType = 'z.string()'\n\t\t\t\tbreak\n\t\t\tcase 'Int':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\textraModifiers.push('int()')\n\t\t\t\tbreak\n\t\t\tcase 'BigInt':\n\t\t\t\tzodType = 'z.bigint()'\n\t\t\t\tbreak\n\t\t\tcase 'DateTime':\n\t\t\t\tzodType = 'z.date()'\n\t\t\t\tbreak\n\t\t\tcase 'Float':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Decimal':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Json':\n\t\t\t\tzodType = 'jsonSchema'\n\t\t\t\tbreak\n\t\t\tcase 'Boolean':\n\t\t\t\tzodType = 'z.boolean()'\n\t\t\t\tbreak\n\t\t\t// TODO: Proper type for bytes fields\n\t\t\tcase 'Bytes':\n\t\t\t\tzodType = 'z.unknown()'\n\t\t\t\tbreak\n\t\t}\n\t} else if (field.kind === 'enum') {\n\t\tzodType = `z.nativeEnum(${field.type})`\n\t} else if (field.kind === 'object') {\n\t\tzodType = getRelatedModelName(field.type)\n\t}\n\n\tif (field.isList) extraModifiers.push('array()')\n\tif (field.documentation) {\n\t\tzodType = computeCustomSchema(field.documentation) ?? zodType\n\t\textraModifiers.push(...computeModifiers(field.documentation))\n\t}\n\tif (!field.isRequired && field.type !== 'Json') extraModifiers.push('nullish()')\n\t// if (field.hasDefaultValue) extraModifiers.push('optional()')\n\n\treturn `${zodType}${extraModifiers.join('.')}`\n}\n","import path from 'path'\nimport { DMMF } from '@prisma/generator-helper'\nimport {\n\tImportDeclarationStructure,\n\tSourceFile,\n\tStructureKind,\n\tVariableDeclarationKind,\n} from 'ts-morph'\nimport { Config, PrismaOptions } from './config'\nimport { dotSlash, needsRelatedModel, useModelNames, writeArray } from './util'\nimport { getJSDocs } from './docs'\nimport { getZodConstructor } from './types'\n\nexport const writeImportsForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t{ schemaPath, outputPath, clientPath }: PrismaOptions\n) => {\n\tconst { relatedModelName } = useModelNames(config)\n\tconst importList: ImportDeclarationStructure[] = [\n\t\t{\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'z',\n\t\t\tmoduleSpecifier: 'zod',\n\t\t},\n\t]\n\n\tif (config.imports) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'imports',\n\t\t\tmoduleSpecifier: dotSlash(\n\t\t\t\tpath.relative(outputPath, path.resolve(path.dirname(schemaPath), config.imports))\n\t\t\t),\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamedImports: ['Decimal'],\n\t\t\tmoduleSpecifier: 'decimal.js',\n\t\t})\n\t}\n\n\tconst enumFields = model.fields.filter((f) => f.kind === 'enum')\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\tconst relativePath = path.relative(outputPath, clientPath)\n\n\tif (enumFields.length > 0) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tisTypeOnly: enumFields.length === 0,\n\t\t\tmoduleSpecifier: dotSlash(relativePath),\n\t\t\tnamedImports: enumFields.map((f) => f.type),\n\t\t})\n\t}\n\n\tif (config.relationModel !== false && relationFields.length > 0) {\n\t\tconst filteredFields = relationFields.filter((f) => f.type !== model.name)\n\n\t\tif (filteredFields.length > 0) {\n\t\t\timportList.push({\n\t\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\t\tmoduleSpecifier: './index',\n\t\t\t\tnamedImports: Array.from(\n\t\t\t\t\tnew Set(\n\t\t\t\t\t\tfilteredFields.flatMap((f) => [\n\t\t\t\t\t\t\t`Complete${f.type}`,\n\t\t\t\t\t\t\trelatedModelName(f.type),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\t}\n\n\tsourceFile.addImportDeclarations(importList)\n}\n\nexport const writeTypeSpecificSchemas = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tif (model.fields.some((f) => f.type === 'Json')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for JSON fields',\n\t\t\t\t`type Literal = boolean | number | string${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : '| null'\n\t\t\t\t}`,\n\t\t\t\t'type Json = Literal | { [key: string]: Json } | Json[]',\n\t\t\t\t`const literalSchema = z.union([z.string(), z.number(), z.boolean()${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : ', z.null()'\n\t\t\t\t}])`,\n\t\t\t\t'const jsonSchema: z.ZodSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))',\n\t\t\t])\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for Decimal fields',\n\t\t\t\t'z',\n\t\t\t\t'.instanceof(Decimal)',\n\t\t\t\t'.or(z.string())',\n\t\t\t\t'.or(z.number())',\n\t\t\t\t'.refine((value) => {',\n\t\t\t\t' try {',\n\t\t\t\t' return new Decimal(value);',\n\t\t\t\t' } catch (error) {',\n\t\t\t\t' return false;',\n\t\t\t\t' }',\n\t\t\t\t'})',\n\t\t\t\t'.transform((value) => new Decimal(value));',\n\t\t\t])\n\t\t})\n\t}\n}\n\nexport const generateSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName } = useModelNames(config)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tleadingTrivia: (writer) => writer.blankLineIfLastNot(),\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: modelName(model.name),\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write('z.object(')\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\tmodel.fields\n\t\t\t\t\t\t\t\t.filter((f) => f.kind !== 'object')\n\t\t\t\t\t\t\t\t.forEach((field) => {\n\t\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\t\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t\t.write(`${field.name}: ${getZodConstructor(field)}`)\n\t\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write(')')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const generateRelatedSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName, relatedModelName } = useModelNames(config)\n\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\n\tsourceFile.addInterface({\n\t\tname: `Complete${model.name}`,\n\t\tisExported: true,\n\t\textends: [`z.infer`],\n\t\tproperties: relationFields.map((f) => ({\n\t\t\thasQuestionToken: !f.isRequired,\n\t\t\tname: f.name,\n\t\t\ttype: `Complete${f.type}${f.isList ? '[]' : ''}${!f.isRequired ? ' | null' : ''}`,\n\t\t})),\n\t})\n\n\tsourceFile.addStatements((writer) =>\n\t\twriteArray(writer, [\n\t\t\t'',\n\t\t\t'/**',\n\t\t\t` * ${relatedModelName(\n\t\t\t\tmodel.name\n\t\t\t)} contains all relations on your model in addition to the scalars`,\n\t\t\t' *',\n\t\t\t' * NOTE: Lazy required in case of potential circular dependencies within schema',\n\t\t\t' */',\n\t\t])\n\t)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: relatedModelName(model.name),\n\t\t\t\ttype: `z.ZodSchema`,\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write(`z.lazy(() => ${modelName(model.name)}.extend(`)\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\trelationFields.forEach((field) => {\n\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\n\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t.write(\n\t\t\t\t\t\t\t\t\t\t`${field.name}: ${getZodConstructor(\n\t\t\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\t\t\trelatedModelName\n\t\t\t\t\t\t\t\t\t\t)}`\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write('))')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const populateModelFile = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\tprismaOptions: PrismaOptions\n) => {\n\twriteImportsForModel(model, sourceFile, config, prismaOptions)\n\twriteTypeSpecificSchemas(model, sourceFile, config, prismaOptions)\n\tgenerateSchemaForModel(model, sourceFile, config, prismaOptions)\n\tif (needsRelatedModel(model, config))\n\t\tgenerateRelatedSchemaForModel(model, sourceFile, config, prismaOptions)\n}\n\nexport const generateBarrelFile = (models: DMMF.Model[], indexFile: SourceFile) => {\n\tmodels.forEach((model) =>\n\t\tindexFile.addExportDeclaration({\n\t\t\tmoduleSpecifier: `./${model.name.toLowerCase()}`,\n\t\t})\n\t)\n}\n","// @ts-ignore Importing package.json for automated synchronization of version numbers\nimport { version } from '../package.json'\n\nimport { generatorHandler } from '@prisma/generator-helper'\nimport { SemicolonPreference } from 'typescript'\nimport { configSchema, PrismaOptions } from './config'\nimport { populateModelFile, generateBarrelFile } from './generator'\nimport { Project } from 'ts-morph'\n\ngeneratorHandler({\n\tonManifest() {\n\t\treturn {\n\t\t\tversion,\n\t\t\tprettyName: 'Zod Schemas',\n\t\t\tdefaultOutput: 'zod',\n\t\t}\n\t},\n\tonGenerate(options) {\n\t\tconst project = new Project()\n\n\t\tconst models = options.dmmf.datamodel.models\n\n\t\tconst { schemaPath } = options\n\t\tconst outputPath = options.generator.output!.value\n\t\tconst clientPath = options.otherGenerators.find(\n\t\t\t(each) => each.provider.value === 'prisma-client-js'\n\t\t)!.output!.value!\n\n\t\tconst results = configSchema.safeParse(options.generator.config)\n\t\tif (!results.success)\n\t\t\tthrow new Error(\n\t\t\t\t'Incorrect config provided. Please check the values you provided and try again.'\n\t\t\t)\n\n\t\tconst config = results.data\n\t\tconst prismaOptions: PrismaOptions = {\n\t\t\tclientPath,\n\t\t\toutputPath,\n\t\t\tschemaPath,\n\t\t}\n\n\t\tconst indexFile = project.createSourceFile(\n\t\t\t`${outputPath}/index.ts`,\n\t\t\t{},\n\t\t\t{ overwrite: true }\n\t\t)\n\n\t\tgenerateBarrelFile(models, indexFile)\n\n\t\tindexFile.formatText({\n\t\t\tindentSize: 2,\n\t\t\tconvertTabsToSpaces: true,\n\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t})\n\n\t\tmodels.forEach((model) => {\n\t\t\tconst sourceFile = project.createSourceFile(\n\t\t\t\t`${outputPath}/${model.name.toLowerCase()}.ts`,\n\t\t\t\t{},\n\t\t\t\t{ overwrite: true }\n\t\t\t)\n\n\t\t\tpopulateModelFile(model, sourceFile, config, prismaOptions)\n\n\t\t\tsourceFile.formatText({\n\t\t\t\tindentSize: 2,\n\t\t\t\tconvertTabsToSpaces: true,\n\t\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t\t})\n\t\t})\n\n\t\treturn project.save()\n\t},\n})\n"],"names":["configBoolean","z","enum","transform","arg","JSON","parse","configSchema","object","relationModel","default","or","literal","modelSuffix","string","modelCase","useDecimalJs","imports","optional","prismaJsonNullability","writeArray","writer","array","newLine","forEach","line","write","conditionalNewLine","useModelNames","formatModelName","name","prefix","slice","toLowerCase","modelName","relatedModelName","toString","needsRelatedModel","model","config","fields","some","field","kind","chunk","input","size","reduce","arr","item","idx","dotSlash","converted","replace","includes","split","startsWith","getJSDocs","docString","lines","docLines","filter","dL","trimStart","length","push","getZodDocElements","map","flatMap","each","contents","stringify","computeCustomSchema","find","modifier","computeModifiers","getZodConstructor","getRelatedModelName","zodType","extraModifiers","type","isList","documentation","isRequired","join","writeImportsForModel","sourceFile","schemaPath","outputPath","clientPath","importList","StructureKind","ImportDeclaration","namespaceImport","moduleSpecifier","path","relative","resolve","dirname","f","namedImports","enumFields","relationFields","relativePath","isTypeOnly","filteredFields","Array","from","Set","addImportDeclarations","writeTypeSpecificSchemas","_prismaOptions","addStatements","generateSchemaForModel","addVariableStatement","declarationKind","VariableDeclarationKind","Const","isExported","leadingTrivia","blankLineIfLastNot","declarations","initializer","inlineBlock","generateRelatedSchemaForModel","addInterface","extends","properties","hasQuestionToken","populateModelFile","prismaOptions","generateBarrelFile","models","indexFile","addExportDeclaration","generatorHandler","onManifest","version","prettyName","defaultOutput","onGenerate","options","project","Project","dmmf","datamodel","generator","output","value","otherGenerators","provider","results","safeParse","success","Error","data","createSourceFile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CAAhB;;"} -\ No newline at end of file -+{"version":3,"file":"zod-prisma.cjs.development.js","sources":["../src/config.ts","../src/util.ts","../src/docs.ts","../src/types.ts","../src/generator.ts","../src/index.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst configBoolean = z.enum(['true', 'false']).transform((arg) => JSON.parse(arg))\n\nexport const configSchema = z.object({\n\trelationModel: configBoolean.default('true').or(z.literal('default')),\n\tmodelSuffix: z.string().default('Model'),\n\tmodelCase: z.enum(['PascalCase', 'camelCase']).default('PascalCase'),\n\tuseDecimalJs: configBoolean.default('false'),\n\timports: z.string().optional(),\n\tprismaJsonNullability: configBoolean.default('true'),\n})\n\nexport type Config = z.infer\n\nexport type PrismaOptions = {\n\tschemaPath: string\n\toutputPath: string\n\tclientPath: string\n}\n\nexport type Names = {\n\tmodel: string\n\trelated: string\n}\n","import { DMMF } from '@prisma/generator-helper'\nimport type { CodeBlockWriter } from 'ts-morph'\nimport { Config } from './config'\n\nexport const writeArray = (writer: CodeBlockWriter, array: string[], newLine = true) =>\n\tarray.forEach((line) => writer.write(line).conditionalNewLine(newLine))\n\nexport const useModelNames = ({ modelCase, modelSuffix, relationModel }: Config) => {\n\tconst formatModelName = (name: string, prefix = '') => {\n\t\tif (modelCase === 'camelCase') {\n\t\t\tname = name.slice(0, 1).toLowerCase() + name.slice(1)\n\t\t}\n\t\treturn `${prefix}${name}${modelSuffix}`\n\t}\n\n\treturn {\n\t\tmodelName: (name: string) => formatModelName(name, relationModel === 'default' ? '_' : ''),\n\t\trelatedModelName: (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\t\tformatModelName(\n\t\t\t\trelationModel === 'default' ? name.toString() : `Related${name.toString()}`\n\t\t\t),\n\t}\n}\n\nexport const needsRelatedModel = (model: DMMF.Model, config: Config) =>\n\tmodel.fields.some((field) => field.kind === 'object') && config.relationModel !== false\n\nexport const chunk = (input: T, size: number): T[] => {\n\treturn input.reduce((arr, item, idx) => {\n\t\treturn idx % size === 0\n\t\t\t? [...arr, [item]]\n\t\t\t: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]]\n\t}, [])\n}\n\nexport const dotSlash = (input: string) => {\n\tconst converted = input\n\t\t.replace(/^\\\\\\\\\\?\\\\/, '')\n\t\t.replace(/\\\\/g, '/')\n\t\t.replace(/\\/\\/+/g, '/')\n\n\tif (converted.includes(`/node_modules/`)) return converted.split(`/node_modules/`).slice(-1)[0]\n\n\tif (converted.startsWith(`../`)) return converted\n\n\treturn './' + converted\n}\n","import { ArrayTree, parse, stringify } from 'parenthesis'\nimport { chunk } from './util'\n\nexport const getJSDocs = (docString?: string) => {\n\tconst lines: string[] = []\n\n\tif (docString) {\n\t\tconst docLines = docString.split('\\n').filter((dL) => !dL.trimStart().startsWith('@zod'))\n\n\t\tif (docLines.length) {\n\t\t\tlines.push('/**')\n\t\t\tdocLines.forEach((dL) => lines.push(` * ${dL}`))\n\t\t\tlines.push(' */')\n\t\t}\n\t}\n\n\treturn lines\n}\n\nexport const getZodDocElements = (docString: string) =>\n\tdocString\n\t\t.split('\\n')\n\t\t.filter((line) => line.trimStart().startsWith('@zod'))\n\t\t.map((line) => line.trimStart().slice(4))\n\t\t.flatMap((line) =>\n\t\t\t// Array.from(line.matchAll(/\\.([^().]+\\(.*?\\))/g), (m) => m.slice(1)).flat()\n\t\t\tchunk(parse(line), 2)\n\t\t\t\t.slice(0, -1)\n\t\t\t\t.map(\n\t\t\t\t\t([each, contents]) =>\n\t\t\t\t\t\t(each as string).replace(/\\)?\\./, '') +\n\t\t\t\t\t\t`${stringify(contents as ArrayTree)})`\n\t\t\t\t)\n\t\t)\n\nexport const computeCustomSchema = (docString: string) => {\n\treturn getZodDocElements(docString)\n\t\t.find((modifier) => modifier.startsWith('custom('))\n\t\t?.slice(7)\n\t\t.slice(0, -1)\n}\n\nexport const computeModifiers = (docString: string) => {\n\treturn getZodDocElements(docString).filter((each) => !each.startsWith('custom('))\n}\n","import type { DMMF } from '@prisma/generator-helper'\nimport { computeCustomSchema, computeModifiers } from './docs'\n\nexport const getZodConstructor = (\n\tfield: DMMF.Field,\n\tgetRelatedModelName = (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\tname.toString()\n) => {\n\tlet zodType = 'z.unknown()'\n\tlet extraModifiers: string[] = ['']\n\tif (field.kind === 'scalar') {\n\t\tswitch (field.type) {\n\t\t\tcase 'String':\n\t\t\t\tzodType = 'z.string()'\n\t\t\t\tbreak\n\t\t\tcase 'Int':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\textraModifiers.push('int()')\n\t\t\t\tbreak\n\t\t\tcase 'BigInt':\n\t\t\t\tzodType = 'z.bigint()'\n\t\t\t\tbreak\n\t\t\tcase 'DateTime':\n\t\t\t\tzodType = 'z.date()'\n\t\t\t\tbreak\n\t\t\tcase 'Float':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Decimal':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Json':\n\t\t\t\tzodType = 'jsonSchema'\n\t\t\t\tbreak\n\t\t\tcase 'Boolean':\n\t\t\t\tzodType = 'z.boolean()'\n\t\t\t\tbreak\n\t\t\t// TODO: Proper type for bytes fields\n\t\t\tcase 'Bytes':\n\t\t\t\tzodType = 'z.unknown()'\n\t\t\t\tbreak\n\t\t}\n\t} else if (field.kind === 'enum') {\n\t\tzodType = `z.nativeEnum(${field.type})`\n\t} else if (field.kind === 'object') {\n\t\tzodType = getRelatedModelName(field.type)\n\t}\n\n\tif (field.isList) extraModifiers.push('array()')\n\tif (field.documentation) {\n\t\tzodType = computeCustomSchema(field.documentation) ?? zodType\n\t\textraModifiers.push(...computeModifiers(field.documentation))\n\t}\n\tif (!field.isRequired && field.type !== 'Json') extraModifiers.push('nullish()')\n\t// if (field.hasDefaultValue) extraModifiers.push('optional()')\n\n\treturn `${zodType}${extraModifiers.join('.')}`\n}\n","import path from 'path'\nimport { DMMF } from '@prisma/generator-helper'\nimport {\n\tImportDeclarationStructure,\n\tSourceFile,\n\tStructureKind,\n\tVariableDeclarationKind,\n} from 'ts-morph'\nimport { Config, PrismaOptions } from './config'\nimport { dotSlash, needsRelatedModel, useModelNames, writeArray } from './util'\nimport { getJSDocs } from './docs'\nimport { getZodConstructor } from './types'\n\nexport const writeImportsForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t{ schemaPath, outputPath, clientPath }: PrismaOptions\n) => {\n\tconst { relatedModelName } = useModelNames(config)\n\tconst importList: ImportDeclarationStructure[] = [\n\t\t{\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'z',\n\t\t\tmoduleSpecifier: 'zod',\n\t\t},\n\t]\n\n\tif (config.imports) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'imports',\n\t\t\tmoduleSpecifier: dotSlash(\n\t\t\t\tpath.relative(outputPath, path.resolve(path.dirname(schemaPath), config.imports))\n\t\t\t),\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamedImports: ['Decimal'],\n\t\t\tmoduleSpecifier: 'decimal.js',\n\t\t})\n\t}\n\n\tconst enumFields = model.fields.filter((f) => f.kind === 'enum')\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\tconst relativePath = path.relative(outputPath, clientPath)\n\n\tif (enumFields.length > 0) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tisTypeOnly: enumFields.length === 0,\n\t\t\tmoduleSpecifier: dotSlash(relativePath),\n\t\t\tnamedImports: Array.from(new Set(enumFields.map((f) => f.type))),\n\t\t})\n\t}\n\n\tif (config.relationModel !== false && relationFields.length > 0) {\n\t\tconst filteredFields = relationFields.filter((f) => f.type !== model.name)\n\n\t\tif (filteredFields.length > 0) {\n\t\t\timportList.push({\n\t\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\t\tmoduleSpecifier: './index',\n\t\t\t\tnamedImports: Array.from(\n\t\t\t\t\tnew Set(\n\t\t\t\t\t\tfilteredFields.flatMap((f) => [\n\t\t\t\t\t\t\t`Complete${f.type}`,\n\t\t\t\t\t\t\trelatedModelName(f.type),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\t}\n\n\tsourceFile.addImportDeclarations(importList)\n}\n\nexport const writeTypeSpecificSchemas = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tif (model.fields.some((f) => f.type === 'Json')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for JSON fields',\n\t\t\t\t`type Literal = boolean | number | string${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : '| null'\n\t\t\t\t}`,\n\t\t\t\t'type Json = Literal | { [key: string]: Json } | Json[]',\n\t\t\t\t`const literalSchema = z.union([z.string(), z.number(), z.boolean()${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : ', z.null()'\n\t\t\t\t}])`,\n\t\t\t\t'const jsonSchema: z.ZodSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))',\n\t\t\t])\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for Decimal fields',\n\t\t\t\t'z',\n\t\t\t\t'.instanceof(Decimal)',\n\t\t\t\t'.or(z.string())',\n\t\t\t\t'.or(z.number())',\n\t\t\t\t'.refine((value) => {',\n\t\t\t\t' try {',\n\t\t\t\t' return new Decimal(value);',\n\t\t\t\t' } catch (error) {',\n\t\t\t\t' return false;',\n\t\t\t\t' }',\n\t\t\t\t'})',\n\t\t\t\t'.transform((value) => new Decimal(value));',\n\t\t\t])\n\t\t})\n\t}\n}\n\nexport const generateSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName } = useModelNames(config)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tleadingTrivia: (writer) => writer.blankLineIfLastNot(),\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: modelName(model.name),\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write('z.object(')\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\tmodel.fields\n\t\t\t\t\t\t\t\t.filter((f) => f.kind !== 'object')\n\t\t\t\t\t\t\t\t.forEach((field) => {\n\t\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\t\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t\t.write(`${field.name}: ${getZodConstructor(field)}`)\n\t\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write(')')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const generateRelatedSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName, relatedModelName } = useModelNames(config)\n\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\n\tsourceFile.addInterface({\n\t\tname: `Complete${model.name}`,\n\t\tisExported: true,\n\t\textends: [`z.infer`],\n\t\tproperties: relationFields.map((f) => ({\n\t\t\thasQuestionToken: !f.isRequired,\n\t\t\tname: f.name,\n\t\t\ttype: `Complete${f.type}${f.isList ? '[]' : ''}${!f.isRequired ? ' | null' : ''}`,\n\t\t})),\n\t})\n\n\tsourceFile.addStatements((writer) =>\n\t\twriteArray(writer, [\n\t\t\t'',\n\t\t\t'/**',\n\t\t\t` * ${relatedModelName(\n\t\t\t\tmodel.name\n\t\t\t)} contains all relations on your model in addition to the scalars`,\n\t\t\t' *',\n\t\t\t' * NOTE: Lazy required in case of potential circular dependencies within schema',\n\t\t\t' */',\n\t\t])\n\t)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: relatedModelName(model.name),\n\t\t\t\ttype: `z.ZodSchema`,\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write(`z.lazy(() => ${modelName(model.name)}.extend(`)\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\trelationFields.forEach((field) => {\n\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\n\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t.write(\n\t\t\t\t\t\t\t\t\t\t`${field.name}: ${getZodConstructor(\n\t\t\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\t\t\trelatedModelName\n\t\t\t\t\t\t\t\t\t\t)}`\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write('))')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const populateModelFile = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\tprismaOptions: PrismaOptions\n) => {\n\twriteImportsForModel(model, sourceFile, config, prismaOptions)\n\twriteTypeSpecificSchemas(model, sourceFile, config, prismaOptions)\n\tgenerateSchemaForModel(model, sourceFile, config, prismaOptions)\n\tif (needsRelatedModel(model, config))\n\t\tgenerateRelatedSchemaForModel(model, sourceFile, config, prismaOptions)\n}\n\nexport const generateBarrelFile = (models: DMMF.Model[], indexFile: SourceFile) => {\n\tmodels.forEach((model) =>\n\t\tindexFile.addExportDeclaration({\n\t\t\tmoduleSpecifier: `./${model.name.toLowerCase()}`,\n\t\t})\n\t)\n}\n","// @ts-ignore Importing package.json for automated synchronization of version numbers\nimport { version } from '../package.json'\n\nimport { generatorHandler } from '@prisma/generator-helper'\nimport { SemicolonPreference } from 'typescript'\nimport { configSchema, PrismaOptions } from './config'\nimport { populateModelFile, generateBarrelFile } from './generator'\nimport { Project } from 'ts-morph'\n\ngeneratorHandler({\n\tonManifest() {\n\t\treturn {\n\t\t\tversion,\n\t\t\tprettyName: 'Zod Schemas',\n\t\t\tdefaultOutput: 'zod',\n\t\t}\n\t},\n\tonGenerate(options) {\n\t\tconst project = new Project()\n\n\t\tconst models = options.dmmf.datamodel.models\n\n\t\tconst { schemaPath } = options\n\t\tconst outputPath = options.generator.output!.value\n\t\tconst clientPath = options.otherGenerators.find(\n\t\t\t(each) => each.provider.value === 'prisma-client-js'\n\t\t)!.output!.value!\n\n\t\tconst results = configSchema.safeParse(options.generator.config)\n\t\tif (!results.success)\n\t\t\tthrow new Error(\n\t\t\t\t'Incorrect config provided. Please check the values you provided and try again.'\n\t\t\t)\n\n\t\tconst config = results.data\n\t\tconst prismaOptions: PrismaOptions = {\n\t\t\tclientPath,\n\t\t\toutputPath,\n\t\t\tschemaPath,\n\t\t}\n\n\t\tconst indexFile = project.createSourceFile(\n\t\t\t`${outputPath}/index.ts`,\n\t\t\t{},\n\t\t\t{ overwrite: true }\n\t\t)\n\n\t\tgenerateBarrelFile(models, indexFile)\n\n\t\tindexFile.formatText({\n\t\t\tindentSize: 2,\n\t\t\tconvertTabsToSpaces: true,\n\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t})\n\n\t\tmodels.forEach((model) => {\n\t\t\tconst sourceFile = project.createSourceFile(\n\t\t\t\t`${outputPath}/${model.name.toLowerCase()}.ts`,\n\t\t\t\t{},\n\t\t\t\t{ overwrite: true }\n\t\t\t)\n\n\t\t\tpopulateModelFile(model, sourceFile, config, prismaOptions)\n\n\t\t\tsourceFile.formatText({\n\t\t\t\tindentSize: 2,\n\t\t\t\tconvertTabsToSpaces: true,\n\t\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t\t})\n\t\t})\n\n\t\treturn project.save()\n\t},\n})\n"],"names":["configBoolean","z","enum","transform","arg","JSON","parse","configSchema","object","relationModel","default","or","literal","modelSuffix","string","modelCase","useDecimalJs","imports","optional","prismaJsonNullability","writeArray","writer","array","newLine","forEach","line","write","conditionalNewLine","useModelNames","formatModelName","name","prefix","slice","toLowerCase","modelName","relatedModelName","toString","needsRelatedModel","model","config","fields","some","field","kind","chunk","input","size","reduce","arr","item","idx","dotSlash","converted","replace","includes","split","startsWith","getJSDocs","docString","lines","docLines","filter","dL","trimStart","length","push","getZodDocElements","map","flatMap","each","contents","stringify","computeCustomSchema","find","modifier","computeModifiers","getZodConstructor","getRelatedModelName","zodType","extraModifiers","type","isList","documentation","isRequired","join","writeImportsForModel","sourceFile","schemaPath","outputPath","clientPath","importList","StructureKind","ImportDeclaration","namespaceImport","moduleSpecifier","path","relative","resolve","dirname","f","namedImports","enumFields","relationFields","relativePath","isTypeOnly","Array","from","Set","filteredFields","addImportDeclarations","writeTypeSpecificSchemas","_prismaOptions","addStatements","generateSchemaForModel","addVariableStatement","declarationKind","VariableDeclarationKind","Const","isExported","leadingTrivia","blankLineIfLastNot","declarations","initializer","inlineBlock","generateRelatedSchemaForModel","addInterface","extends","properties","hasQuestionToken","populateModelFile","prismaOptions","generateBarrelFile","models","indexFile","addExportDeclaration","generatorHandler","onManifest","version","prettyName","defaultOutput","onGenerate","options","project","Project","dmmf","datamodel","generator","output","value","otherGenerators","provider","results","safeParse","success","Error","data","createSource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IAAI;AACxB,MAAA,MAAMgD,UAAU,GAAGwD,OAAO,CAACc,gBAAgB,CACvC,GAAApE,UAAc,CAAA,CAAA,EAAAlD,KAAK,CAACR,IAAI,CAACG,WAAW,EAAO,KAAA,EAC9C,EAAE,EACF;AAAE4H,QAAAA,SAAS,EAAE,IAAA;AAAM,OAAA,CACnB,CAAA;MAED5B,iBAAiB,CAAC3F,KAAK,EAAEgD,UAAU,EAAE/C,MAAM,EAAE2F,aAAa,CAAC,CAAA;MAE3D5C,UAAU,CAACwE,UAAU,CAAC;AACrBC,QAAAA,UAAU,EAAE,CAAC;AACbC,QAAAA,mBAAmB,EAAE,IAAI;QACzBC,UAAU,EAAEC,8BAAmB,CAACC,MAAAA;AAChC,OAAA,CAAC,CAAA;AACH,KAAC,CAAC,CAAA;IAEF,OAAOrB,OAAO,CAACsB,IAAI,EAAE,CAAA;AACtB,GAAA;AACA,CAAA,CAAC;;"} -\ No newline at end of file -diff --git a/dist/zod-prisma.cjs.production.min.js b/dist/zod-prisma.cjs.production.min.js -index 9720e85802156e5765b0cc277a5c3dbed9b5a2e8..3d1fd4af5c3edd1dbf88cb9b8b70f78b999cb414 100644 ---- a/dist/zod-prisma.cjs.production.min.js -+++ b/dist/zod-prisma.cjs.production.min.js -@@ -1,2 +1,2 @@ --"use strict";var e=require("@prisma/generator-helper"),t=require("typescript"),a=require("zod"),r=require("path"),i=require("ts-morph"),n=require("parenthesis");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(r);const s=a.z.enum(["true","false"]).transform((e=>JSON.parse(e))),c=a.z.object({relationModel:s.default("true").or(a.z.literal("default")),modelSuffix:a.z.string().default("Model"),modelCase:a.z.enum(["PascalCase","camelCase"]).default("PascalCase"),useDecimalJs:s.default("false"),imports:a.z.string().optional(),prismaJsonNullability:s.default("true")}),d=(e,t,a=!0)=>t.forEach((t=>e.write(t).conditionalNewLine(a))),m=({modelCase:e,modelSuffix:t,relationModel:a})=>{const r=(a,r="")=>("camelCase"===e&&(a=a.slice(0,1).toLowerCase()+a.slice(1)),`${r}${a}${t}`);return{modelName:e=>r(e,"default"===a?"_":""),relatedModelName:e=>r("default"===a?e.toString():`Related${e.toString()}`)}},u=e=>{const t=e.replace(/^\\\\\?\\/,"").replace(/\\/g,"/").replace(/\/\/+/g,"/");return t.includes("/node_modules/")?t.split("/node_modules/").slice(-1)[0]:t.startsWith("../")?t:"./"+t},p=e=>{const t=[];if(e){const a=e.split("\n").filter((e=>!e.trimStart().startsWith("@zod")));a.length&&(t.push("/**"),a.forEach((e=>t.push(` * ${e}`))),t.push(" */"))}return t},f=e=>e.split("\n").filter((e=>e.trimStart().startsWith("@zod"))).map((e=>e.trimStart().slice(4))).flatMap((e=>{return(t=n.parse(e),t.reduce(((e,t,a)=>a%2==0?[...e,[t]]:[...e.slice(0,-1),[...e.slice(-1)[0],t]]),[])).slice(0,-1).map((([e,t])=>e.replace(/\)?\./,"")+`${n.stringify(t)})`));var t})),h=(e,t=(e=>e.toString()))=>{let a="z.unknown()",r=[""];if("scalar"===e.kind)switch(e.type){case"String":a="z.string()";break;case"Int":a="z.number()",r.push("int()");break;case"BigInt":a="z.bigint()";break;case"DateTime":a="z.date()";break;case"Float":case"Decimal":a="z.number()";break;case"Json":a="jsonSchema";break;case"Boolean":a="z.boolean()";break;case"Bytes":a="z.unknown()"}else"enum"===e.kind?a=`z.nativeEnum(${e.type})`:"object"===e.kind&&(a=t(e.type));var i,n,o;return e.isList&&r.push("array()"),e.documentation&&(a=null!=(i=null==(n=f(e.documentation).find((e=>e.startsWith("custom("))))?void 0:n.slice(7).slice(0,-1))?i:a,r.push(...(o=e.documentation,f(o).filter((e=>!e.startsWith("custom(")))))),e.isRequired||"Json"===e.type||r.push("nullish()"),`${a}${r.join(".")}`};e.generatorHandler({onManifest:()=>({version:"0.5.4",prettyName:"Zod Schemas",defaultOutput:"zod"}),onGenerate(e){const a=new i.Project,r=e.dmmf.datamodel.models,{schemaPath:n}=e,o=e.generator.output.value,s=e.otherGenerators.find((e=>"prisma-client-js"===e.provider.value)).output.value,f=c.safeParse(e.generator.config);if(!f.success)throw new Error("Incorrect config provided. Please check the values you provided and try again.");const z=f.data,S={clientPath:s,outputPath:o,schemaPath:n},y=a.createSourceFile(`${o}/index.ts`,{},{overwrite:!0});return((e,t)=>{e.forEach((e=>t.addExportDeclaration({moduleSpecifier:`./${e.name.toLowerCase()}`})))})(r,y),y.formatText({indentSize:2,convertTabsToSpaces:!0,semicolons:t.SemicolonPreference.Remove}),r.forEach((e=>{const r=a.createSourceFile(`${o}/${e.name.toLowerCase()}.ts`,{},{overwrite:!0});((e,t,a,r)=>{((e,t,a,{schemaPath:r,outputPath:n,clientPath:o})=>{const{relatedModelName:s}=m(a),c=[{kind:i.StructureKind.ImportDeclaration,namespaceImport:"z",moduleSpecifier:"zod"}];a.imports&&c.push({kind:i.StructureKind.ImportDeclaration,namespaceImport:"imports",moduleSpecifier:u(l.default.relative(n,l.default.resolve(l.default.dirname(r),a.imports)))}),a.useDecimalJs&&e.fields.some((e=>"Decimal"===e.type))&&c.push({kind:i.StructureKind.ImportDeclaration,namedImports:["Decimal"],moduleSpecifier:"decimal.js"});const d=e.fields.filter((e=>"enum"===e.kind)),p=e.fields.filter((e=>"object"===e.kind)),f=l.default.relative(n,o);if(d.length>0&&c.push({kind:i.StructureKind.ImportDeclaration,isTypeOnly:0===d.length,moduleSpecifier:u(f),namedImports:d.map((e=>e.type))}),!1!==a.relationModel&&p.length>0){const t=p.filter((t=>t.type!==e.name));t.length>0&&c.push({kind:i.StructureKind.ImportDeclaration,moduleSpecifier:"./index",namedImports:Array.from(new Set(t.flatMap((e=>[`Complete${e.type}`,s(e.type)]))))})}t.addImportDeclarations(c)})(e,t,a,r),((e,t,a,r)=>{e.fields.some((e=>"Json"===e.type))&&t.addStatements((e=>{e.newLine(),d(e,["// Helper schema for JSON fields","type Literal = boolean | number | string"+(a.prismaJsonNullability?"":"| null"),"type Json = Literal | { [key: string]: Json } | Json[]",`const literalSchema = z.union([z.string(), z.number(), z.boolean()${a.prismaJsonNullability?"":", z.null()"}])`,"const jsonSchema: z.ZodSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))"])})),a.useDecimalJs&&e.fields.some((e=>"Decimal"===e.type))&&t.addStatements((e=>{e.newLine(),d(e,["// Helper schema for Decimal fields","z",".instanceof(Decimal)",".or(z.string())",".or(z.number())",".refine((value) => {"," try {"," return new Decimal(value);"," } catch (error) {"," return false;"," }","})",".transform((value) => new Decimal(value));"])}))})(e,t,a),((e,t,a,r)=>{const{modelName:n}=m(a);t.addVariableStatement({declarationKind:i.VariableDeclarationKind.Const,isExported:!0,leadingTrivia:e=>e.blankLineIfLastNot(),declarations:[{name:n(e.name),initializer(t){t.write("z.object(").inlineBlock((()=>{e.fields.filter((e=>"object"!==e.kind)).forEach((e=>{d(t,p(e.documentation)),t.write(`${e.name}: ${h(e)}`).write(",").newLine()}))})).write(")")}}]})})(e,t,a),((e,t)=>e.fields.some((e=>"object"===e.kind))&&!1!==t.relationModel)(e,a)&&((e,t,a,r)=>{const{modelName:n,relatedModelName:o}=m(a),l=e.fields.filter((e=>"object"===e.kind));t.addInterface({name:`Complete${e.name}`,isExported:!0,extends:[`z.infer`],properties:l.map((e=>({hasQuestionToken:!e.isRequired,name:e.name,type:`Complete${e.type}${e.isList?"[]":""}${e.isRequired?"":" | null"}`})))}),t.addStatements((t=>d(t,["","/**",` * ${o(e.name)} contains all relations on your model in addition to the scalars`," *"," * NOTE: Lazy required in case of potential circular dependencies within schema"," */"]))),t.addVariableStatement({declarationKind:i.VariableDeclarationKind.Const,isExported:!0,declarations:[{name:o(e.name),type:`z.ZodSchema`,initializer(t){t.write(`z.lazy(() => ${n(e.name)}.extend(`).inlineBlock((()=>{l.forEach((e=>{d(t,p(e.documentation)),t.write(`${e.name}: ${h(e,o)}`).write(",").newLine()}))})).write("))")}}]})})(e,t,a)})(e,r,z,S),r.formatText({indentSize:2,convertTabsToSpaces:!0,semicolons:t.SemicolonPreference.Remove})})),a.save()}}); -+"use strict";var e=require("@prisma/generator-helper"),t=require("typescript"),a=require("zod"),r=require("path"),i=require("ts-morph"),n=require("parenthesis");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=o(r);const s=a.z.enum(["true","false"]).transform((e=>JSON.parse(e))),c=a.z.object({relationModel:s.default("true").or(a.z.literal("default")),modelSuffix:a.z.string().default("Model"),modelCase:a.z.enum(["PascalCase","camelCase"]).default("PascalCase"),useDecimalJs:s.default("false"),imports:a.z.string().optional(),prismaJsonNullability:s.default("true")}),d=(e,t,a=!0)=>t.forEach((t=>e.write(t).conditionalNewLine(a))),m=({modelCase:e,modelSuffix:t,relationModel:a})=>{const r=(a,r="")=>("camelCase"===e&&(a=a.slice(0,1).toLowerCase()+a.slice(1)),`${r}${a}${t}`);return{modelName:e=>r(e,"default"===a?"_":""),relatedModelName:e=>r("default"===a?e.toString():`Related${e.toString()}`)}},u=e=>{const t=e.replace(/^\\\\\?\\/,"").replace(/\\/g,"/").replace(/\/\/+/g,"/");return t.includes("/node_modules/")?t.split("/node_modules/").slice(-1)[0]:t.startsWith("../")?t:"./"+t},p=e=>{const t=[];if(e){const a=e.split("\n").filter((e=>!e.trimStart().startsWith("@zod")));a.length&&(t.push("/**"),a.forEach((e=>t.push(` * ${e}`))),t.push(" */"))}return t},f=e=>e.split("\n").filter((e=>e.trimStart().startsWith("@zod"))).map((e=>e.trimStart().slice(4))).flatMap((e=>{return(t=n.parse(e),t.reduce(((e,t,a)=>a%2==0?[...e,[t]]:[...e.slice(0,-1),[...e.slice(-1)[0],t]]),[])).slice(0,-1).map((([e,t])=>e.replace(/\)?\./,"")+`${n.stringify(t)})`));var t})),h=(e,t=(e=>e.toString()))=>{let a="z.unknown()",r=[""];if("scalar"===e.kind)switch(e.type){case"String":a="z.string()";break;case"Int":a="z.number()",r.push("int()");break;case"BigInt":a="z.bigint()";break;case"DateTime":a="z.date()";break;case"Float":case"Decimal":a="z.number()";break;case"Json":a="jsonSchema";break;case"Boolean":a="z.boolean()";break;case"Bytes":a="z.unknown()"}else"enum"===e.kind?a=`z.nativeEnum(${e.type})`:"object"===e.kind&&(a=t(e.type));var i,n,o;return e.isList&&r.push("array()"),e.documentation&&(a=null!=(i=null==(n=f(e.documentation).find((e=>e.startsWith("custom("))))?void 0:n.slice(7).slice(0,-1))?i:a,r.push(...(o=e.documentation,f(o).filter((e=>!e.startsWith("custom(")))))),e.isRequired||"Json"===e.type||r.push("nullish()"),`${a}${r.join(".")}`};e.generatorHandler({onManifest:()=>({version:"0.5.4",prettyName:"Zod Schemas",defaultOutput:"zod"}),onGenerate(e){const a=new i.Project,r=e.dmmf.datamodel.models,{schemaPath:n}=e,o=e.generator.output.value,s=e.otherGenerators.find((e=>"prisma-client-js"===e.provider.value)).output.value,f=c.safeParse(e.generator.config);if(!f.success)throw new Error("Incorrect config provided. Please check the values you provided and try again.");const S=f.data,z={clientPath:s,outputPath:o,schemaPath:n},y=a.createSourceFile(`${o}/index.ts`,{},{overwrite:!0});return((e,t)=>{e.forEach((e=>t.addExportDeclaration({moduleSpecifier:`./${e.name.toLowerCase()}`})))})(r,y),y.formatText({indentSize:2,convertTabsToSpaces:!0,semicolons:t.SemicolonPreference.Remove}),r.forEach((e=>{const r=a.createSourceFile(`${o}/${e.name.toLowerCase()}.ts`,{},{overwrite:!0});((e,t,a,r)=>{((e,t,a,{schemaPath:r,outputPath:n,clientPath:o})=>{const{relatedModelName:s}=m(a),c=[{kind:i.StructureKind.ImportDeclaration,namespaceImport:"z",moduleSpecifier:"zod"}];a.imports&&c.push({kind:i.StructureKind.ImportDeclaration,namespaceImport:"imports",moduleSpecifier:u(l.default.relative(n,l.default.resolve(l.default.dirname(r),a.imports)))}),a.useDecimalJs&&e.fields.some((e=>"Decimal"===e.type))&&c.push({kind:i.StructureKind.ImportDeclaration,namedImports:["Decimal"],moduleSpecifier:"decimal.js"});const d=e.fields.filter((e=>"enum"===e.kind)),p=e.fields.filter((e=>"object"===e.kind)),f=l.default.relative(n,o);if(d.length>0&&c.push({kind:i.StructureKind.ImportDeclaration,isTypeOnly:0===d.length,moduleSpecifier:u(f),namedImports:Array.from(new Set(d.map((e=>e.type))))}),!1!==a.relationModel&&p.length>0){const t=p.filter((t=>t.type!==e.name));t.length>0&&c.push({kind:i.StructureKind.ImportDeclaration,moduleSpecifier:"./index",namedImports:Array.from(new Set(t.flatMap((e=>[`Complete${e.type}`,s(e.type)]))))})}t.addImportDeclarations(c)})(e,t,a,r),((e,t,a,r)=>{e.fields.some((e=>"Json"===e.type))&&t.addStatements((e=>{e.newLine(),d(e,["// Helper schema for JSON fields","type Literal = boolean | number | string"+(a.prismaJsonNullability?"":"| null"),"type Json = Literal | { [key: string]: Json } | Json[]",`const literalSchema = z.union([z.string(), z.number(), z.boolean()${a.prismaJsonNullability?"":", z.null()"}])`,"const jsonSchema: z.ZodSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))"])})),a.useDecimalJs&&e.fields.some((e=>"Decimal"===e.type))&&t.addStatements((e=>{e.newLine(),d(e,["// Helper schema for Decimal fields","z",".instanceof(Decimal)",".or(z.string())",".or(z.number())",".refine((value) => {"," try {"," return new Decimal(value);"," } catch (error) {"," return false;"," }","})",".transform((value) => new Decimal(value));"])}))})(e,t,a),((e,t,a,r)=>{const{modelName:n}=m(a);t.addVariableStatement({declarationKind:i.VariableDeclarationKind.Const,isExported:!0,leadingTrivia:e=>e.blankLineIfLastNot(),declarations:[{name:n(e.name),initializer(t){t.write("z.object(").inlineBlock((()=>{e.fields.filter((e=>"object"!==e.kind)).forEach((e=>{d(t,p(e.documentation)),t.write(`${e.name}: ${h(e)}`).write(",").newLine()}))})).write(")")}}]})})(e,t,a),((e,t)=>e.fields.some((e=>"object"===e.kind))&&!1!==t.relationModel)(e,a)&&((e,t,a,r)=>{const{modelName:n,relatedModelName:o}=m(a),l=e.fields.filter((e=>"object"===e.kind));t.addInterface({name:`Complete${e.name}`,isExported:!0,extends:[`z.infer`],properties:l.map((e=>({hasQuestionToken:!e.isRequired,name:e.name,type:`Complete${e.type}${e.isList?"[]":""}${e.isRequired?"":" | null"}`})))}),t.addStatements((t=>d(t,["","/**",` * ${o(e.name)} contains all relations on your model in addition to the scalars`," *"," * NOTE: Lazy required in case of potential circular dependencies within schema"," */"]))),t.addVariableStatement({declarationKind:i.VariableDeclarationKind.Const,isExported:!0,declarations:[{name:o(e.name),type:`z.ZodSchema`,initializer(t){t.write(`z.lazy(() => ${n(e.name)}.extend(`).inlineBlock((()=>{l.forEach((e=>{d(t,p(e.documentation)),t.write(`${e.name}: ${h(e,o)}`).write(",").newLine()}))})).write("))")}}]})})(e,t,a)})(e,r,S,z),r.formatText({indentSize:2,convertTabsToSpaces:!0,semicolons:t.SemicolonPreference.Remove})})),a.save()}}); - //# sourceMappingURL=zod-prisma.cjs.production.min.js.map -diff --git a/dist/zod-prisma.cjs.production.min.js.map b/dist/zod-prisma.cjs.production.min.js.map -index 10501876bc9965c211638dcf21e3fdecad472a49..3b17a8e1377da1df5fbe6d9d7207e549b3593f99 100644 ---- a/dist/zod-prisma.cjs.production.min.js.map -+++ b/dist/zod-prisma.cjs.production.min.js.map -@@ -1 +1 @@ --{"version":3,"file":"zod-prisma.cjs.production.min.js","sources":["../src/config.ts","../src/util.ts","../src/docs.ts","../src/types.ts","../src/index.ts","../src/generator.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst configBoolean = z.enum(['true', 'false']).transform((arg) => JSON.parse(arg))\n\nexport const configSchema = z.object({\n\trelationModel: configBoolean.default('true').or(z.literal('default')),\n\tmodelSuffix: z.string().default('Model'),\n\tmodelCase: z.enum(['PascalCase', 'camelCase']).default('PascalCase'),\n\tuseDecimalJs: configBoolean.default('false'),\n\timports: z.string().optional(),\n\tprismaJsonNullability: configBoolean.default('true'),\n})\n\nexport type Config = z.infer\n\nexport type PrismaOptions = {\n\tschemaPath: string\n\toutputPath: string\n\tclientPath: string\n}\n\nexport type Names = {\n\tmodel: string\n\trelated: string\n}\n","import { DMMF } from '@prisma/generator-helper'\nimport type { CodeBlockWriter } from 'ts-morph'\nimport { Config } from './config'\n\nexport const writeArray = (writer: CodeBlockWriter, array: string[], newLine = true) =>\n\tarray.forEach((line) => writer.write(line).conditionalNewLine(newLine))\n\nexport const useModelNames = ({ modelCase, modelSuffix, relationModel }: Config) => {\n\tconst formatModelName = (name: string, prefix = '') => {\n\t\tif (modelCase === 'camelCase') {\n\t\t\tname = name.slice(0, 1).toLowerCase() + name.slice(1)\n\t\t}\n\t\treturn `${prefix}${name}${modelSuffix}`\n\t}\n\n\treturn {\n\t\tmodelName: (name: string) => formatModelName(name, relationModel === 'default' ? '_' : ''),\n\t\trelatedModelName: (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\t\tformatModelName(\n\t\t\t\trelationModel === 'default' ? name.toString() : `Related${name.toString()}`\n\t\t\t),\n\t}\n}\n\nexport const needsRelatedModel = (model: DMMF.Model, config: Config) =>\n\tmodel.fields.some((field) => field.kind === 'object') && config.relationModel !== false\n\nexport const chunk = (input: T, size: number): T[] => {\n\treturn input.reduce((arr, item, idx) => {\n\t\treturn idx % size === 0\n\t\t\t? [...arr, [item]]\n\t\t\t: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]]\n\t}, [])\n}\n\nexport const dotSlash = (input: string) => {\n\tconst converted = input\n\t\t.replace(/^\\\\\\\\\\?\\\\/, '')\n\t\t.replace(/\\\\/g, '/')\n\t\t.replace(/\\/\\/+/g, '/')\n\n\tif (converted.includes(`/node_modules/`)) return converted.split(`/node_modules/`).slice(-1)[0]\n\n\tif (converted.startsWith(`../`)) return converted\n\n\treturn './' + converted\n}\n","import { ArrayTree, parse, stringify } from 'parenthesis'\nimport { chunk } from './util'\n\nexport const getJSDocs = (docString?: string) => {\n\tconst lines: string[] = []\n\n\tif (docString) {\n\t\tconst docLines = docString.split('\\n').filter((dL) => !dL.trimStart().startsWith('@zod'))\n\n\t\tif (docLines.length) {\n\t\t\tlines.push('/**')\n\t\t\tdocLines.forEach((dL) => lines.push(` * ${dL}`))\n\t\t\tlines.push(' */')\n\t\t}\n\t}\n\n\treturn lines\n}\n\nexport const getZodDocElements = (docString: string) =>\n\tdocString\n\t\t.split('\\n')\n\t\t.filter((line) => line.trimStart().startsWith('@zod'))\n\t\t.map((line) => line.trimStart().slice(4))\n\t\t.flatMap((line) =>\n\t\t\t// Array.from(line.matchAll(/\\.([^().]+\\(.*?\\))/g), (m) => m.slice(1)).flat()\n\t\t\tchunk(parse(line), 2)\n\t\t\t\t.slice(0, -1)\n\t\t\t\t.map(\n\t\t\t\t\t([each, contents]) =>\n\t\t\t\t\t\t(each as string).replace(/\\)?\\./, '') +\n\t\t\t\t\t\t`${stringify(contents as ArrayTree)})`\n\t\t\t\t)\n\t\t)\n\nexport const computeCustomSchema = (docString: string) => {\n\treturn getZodDocElements(docString)\n\t\t.find((modifier) => modifier.startsWith('custom('))\n\t\t?.slice(7)\n\t\t.slice(0, -1)\n}\n\nexport const computeModifiers = (docString: string) => {\n\treturn getZodDocElements(docString).filter((each) => !each.startsWith('custom('))\n}\n","import type { DMMF } from '@prisma/generator-helper'\nimport { computeCustomSchema, computeModifiers } from './docs'\n\nexport const getZodConstructor = (\n\tfield: DMMF.Field,\n\tgetRelatedModelName = (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\tname.toString()\n) => {\n\tlet zodType = 'z.unknown()'\n\tlet extraModifiers: string[] = ['']\n\tif (field.kind === 'scalar') {\n\t\tswitch (field.type) {\n\t\t\tcase 'String':\n\t\t\t\tzodType = 'z.string()'\n\t\t\t\tbreak\n\t\t\tcase 'Int':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\textraModifiers.push('int()')\n\t\t\t\tbreak\n\t\t\tcase 'BigInt':\n\t\t\t\tzodType = 'z.bigint()'\n\t\t\t\tbreak\n\t\t\tcase 'DateTime':\n\t\t\t\tzodType = 'z.date()'\n\t\t\t\tbreak\n\t\t\tcase 'Float':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Decimal':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Json':\n\t\t\t\tzodType = 'jsonSchema'\n\t\t\t\tbreak\n\t\t\tcase 'Boolean':\n\t\t\t\tzodType = 'z.boolean()'\n\t\t\t\tbreak\n\t\t\t// TODO: Proper type for bytes fields\n\t\t\tcase 'Bytes':\n\t\t\t\tzodType = 'z.unknown()'\n\t\t\t\tbreak\n\t\t}\n\t} else if (field.kind === 'enum') {\n\t\tzodType = `z.nativeEnum(${field.type})`\n\t} else if (field.kind === 'object') {\n\t\tzodType = getRelatedModelName(field.type)\n\t}\n\n\tif (field.isList) extraModifiers.push('array()')\n\tif (field.documentation) {\n\t\tzodType = computeCustomSchema(field.documentation) ?? zodType\n\t\textraModifiers.push(...computeModifiers(field.documentation))\n\t}\n\tif (!field.isRequired && field.type !== 'Json') extraModifiers.push('nullish()')\n\t// if (field.hasDefaultValue) extraModifiers.push('optional()')\n\n\treturn `${zodType}${extraModifiers.join('.')}`\n}\n","// @ts-ignore Importing package.json for automated synchronization of version numbers\nimport { version } from '../package.json'\n\nimport { generatorHandler } from '@prisma/generator-helper'\nimport { SemicolonPreference } from 'typescript'\nimport { configSchema, PrismaOptions } from './config'\nimport { populateModelFile, generateBarrelFile } from './generator'\nimport { Project } from 'ts-morph'\n\ngeneratorHandler({\n\tonManifest() {\n\t\treturn {\n\t\t\tversion,\n\t\t\tprettyName: 'Zod Schemas',\n\t\t\tdefaultOutput: 'zod',\n\t\t}\n\t},\n\tonGenerate(options) {\n\t\tconst project = new Project()\n\n\t\tconst models = options.dmmf.datamodel.models\n\n\t\tconst { schemaPath } = options\n\t\tconst outputPath = options.generator.output!.value\n\t\tconst clientPath = options.otherGenerators.find(\n\t\t\t(each) => each.provider.value === 'prisma-client-js'\n\t\t)!.output!.value!\n\n\t\tconst results = configSchema.safeParse(options.generator.config)\n\t\tif (!results.success)\n\t\t\tthrow new Error(\n\t\t\t\t'Incorrect config provided. Please check the values you provided and try again.'\n\t\t\t)\n\n\t\tconst config = results.data\n\t\tconst prismaOptions: PrismaOptions = {\n\t\t\tclientPath,\n\t\t\toutputPath,\n\t\t\tschemaPath,\n\t\t}\n\n\t\tconst indexFile = project.createSourceFile(\n\t\t\t`${outputPath}/index.ts`,\n\t\t\t{},\n\t\t\t{ overwrite: true }\n\t\t)\n\n\t\tgenerateBarrelFile(models, indexFile)\n\n\t\tindexFile.formatText({\n\t\t\tindentSize: 2,\n\t\t\tconvertTabsToSpaces: true,\n\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t})\n\n\t\tmodels.forEach((model) => {\n\t\t\tconst sourceFile = project.createSourceFile(\n\t\t\t\t`${outputPath}/${model.name.toLowerCase()}.ts`,\n\t\t\t\t{},\n\t\t\t\t{ overwrite: true }\n\t\t\t)\n\n\t\t\tpopulateModelFile(model, sourceFile, config, prismaOptions)\n\n\t\t\tsourceFile.formatText({\n\t\t\t\tindentSize: 2,\n\t\t\t\tconvertTabsToSpaces: true,\n\t\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t\t})\n\t\t})\n\n\t\treturn project.save()\n\t},\n})\n","import path from 'path'\nimport { DMMF } from '@prisma/generator-helper'\nimport {\n\tImportDeclarationStructure,\n\tSourceFile,\n\tStructureKind,\n\tVariableDeclarationKind,\n} from 'ts-morph'\nimport { Config, PrismaOptions } from './config'\nimport { dotSlash, needsRelatedModel, useModelNames, writeArray } from './util'\nimport { getJSDocs } from './docs'\nimport { getZodConstructor } from './types'\n\nexport const writeImportsForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t{ schemaPath, outputPath, clientPath }: PrismaOptions\n) => {\n\tconst { relatedModelName } = useModelNames(config)\n\tconst importList: ImportDeclarationStructure[] = [\n\t\t{\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'z',\n\t\t\tmoduleSpecifier: 'zod',\n\t\t},\n\t]\n\n\tif (config.imports) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'imports',\n\t\t\tmoduleSpecifier: dotSlash(\n\t\t\t\tpath.relative(outputPath, path.resolve(path.dirname(schemaPath), config.imports))\n\t\t\t),\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamedImports: ['Decimal'],\n\t\t\tmoduleSpecifier: 'decimal.js',\n\t\t})\n\t}\n\n\tconst enumFields = model.fields.filter((f) => f.kind === 'enum')\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\tconst relativePath = path.relative(outputPath, clientPath)\n\n\tif (enumFields.length > 0) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tisTypeOnly: enumFields.length === 0,\n\t\t\tmoduleSpecifier: dotSlash(relativePath),\n\t\t\tnamedImports: enumFields.map((f) => f.type),\n\t\t})\n\t}\n\n\tif (config.relationModel !== false && relationFields.length > 0) {\n\t\tconst filteredFields = relationFields.filter((f) => f.type !== model.name)\n\n\t\tif (filteredFields.length > 0) {\n\t\t\timportList.push({\n\t\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\t\tmoduleSpecifier: './index',\n\t\t\t\tnamedImports: Array.from(\n\t\t\t\t\tnew Set(\n\t\t\t\t\t\tfilteredFields.flatMap((f) => [\n\t\t\t\t\t\t\t`Complete${f.type}`,\n\t\t\t\t\t\t\trelatedModelName(f.type),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\t}\n\n\tsourceFile.addImportDeclarations(importList)\n}\n\nexport const writeTypeSpecificSchemas = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tif (model.fields.some((f) => f.type === 'Json')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for JSON fields',\n\t\t\t\t`type Literal = boolean | number | string${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : '| null'\n\t\t\t\t}`,\n\t\t\t\t'type Json = Literal | { [key: string]: Json } | Json[]',\n\t\t\t\t`const literalSchema = z.union([z.string(), z.number(), z.boolean()${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : ', z.null()'\n\t\t\t\t}])`,\n\t\t\t\t'const jsonSchema: z.ZodSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))',\n\t\t\t])\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for Decimal fields',\n\t\t\t\t'z',\n\t\t\t\t'.instanceof(Decimal)',\n\t\t\t\t'.or(z.string())',\n\t\t\t\t'.or(z.number())',\n\t\t\t\t'.refine((value) => {',\n\t\t\t\t' try {',\n\t\t\t\t' return new Decimal(value);',\n\t\t\t\t' } catch (error) {',\n\t\t\t\t' return false;',\n\t\t\t\t' }',\n\t\t\t\t'})',\n\t\t\t\t'.transform((value) => new Decimal(value));',\n\t\t\t])\n\t\t})\n\t}\n}\n\nexport const generateSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName } = useModelNames(config)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tleadingTrivia: (writer) => writer.blankLineIfLastNot(),\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: modelName(model.name),\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write('z.object(')\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\tmodel.fields\n\t\t\t\t\t\t\t\t.filter((f) => f.kind !== 'object')\n\t\t\t\t\t\t\t\t.forEach((field) => {\n\t\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\t\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t\t.write(`${field.name}: ${getZodConstructor(field)}`)\n\t\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write(')')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const generateRelatedSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName, relatedModelName } = useModelNames(config)\n\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\n\tsourceFile.addInterface({\n\t\tname: `Complete${model.name}`,\n\t\tisExported: true,\n\t\textends: [`z.infer`],\n\t\tproperties: relationFields.map((f) => ({\n\t\t\thasQuestionToken: !f.isRequired,\n\t\t\tname: f.name,\n\t\t\ttype: `Complete${f.type}${f.isList ? '[]' : ''}${!f.isRequired ? ' | null' : ''}`,\n\t\t})),\n\t})\n\n\tsourceFile.addStatements((writer) =>\n\t\twriteArray(writer, [\n\t\t\t'',\n\t\t\t'/**',\n\t\t\t` * ${relatedModelName(\n\t\t\t\tmodel.name\n\t\t\t)} contains all relations on your model in addition to the scalars`,\n\t\t\t' *',\n\t\t\t' * NOTE: Lazy required in case of potential circular dependencies within schema',\n\t\t\t' */',\n\t\t])\n\t)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: relatedModelName(model.name),\n\t\t\t\ttype: `z.ZodSchema`,\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write(`z.lazy(() => ${modelName(model.name)}.extend(`)\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\trelationFields.forEach((field) => {\n\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\n\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t.write(\n\t\t\t\t\t\t\t\t\t\t`${field.name}: ${getZodConstructor(\n\t\t\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\t\t\trelatedModelName\n\t\t\t\t\t\t\t\t\t\t)}`\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write('))')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const populateModelFile = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\tprismaOptions: PrismaOptions\n) => {\n\twriteImportsForModel(model, sourceFile, config, prismaOptions)\n\twriteTypeSpecificSchemas(model, sourceFile, config, prismaOptions)\n\tgenerateSchemaForModel(model, sourceFile, config, prismaOptions)\n\tif (needsRelatedModel(model, config))\n\t\tgenerateRelatedSchemaForModel(model, sourceFile, config, prismaOptions)\n}\n\nexport const generateBarrelFile = (models: DMMF.Model[], indexFile: SourceFile) => {\n\tmodels.forEach((model) =>\n\t\tindexFile.addExportDeclaration({\n\t\t\tmoduleSpecifier: `./${model.name.toLowerCase()}`,\n\t\t})\n\t)\n}\n"],"names":["configBoolean","z","enum","transform","arg","JSON","parse","configSchema","object","relationModel","default","or","literal","modelSuffix","string","modelCase","useDecimalJs","imports","optional","prismaJsonNullability","writeArray","writer","array","newLine","forEach","line","write","conditionalNewLine","useModelNames","formatModelName","name","prefix","slice","toLowerCase","modelName","relatedModelName","toString","dotSlash","input","converted","replace","includes","split","startsWith","getJSDocs","docString","lines","docLines","filter","dL","trimStart","length","push","getZodDocElements","map","flatMap","chunk","reduce","arr","item","idx","each","contents","stringify","getZodConstructor","field","getRelatedModelName","zodType","extraModifiers","kind","type","isList","documentation","find","modifier","_getZodDocElements$fi","isRequired","join","generatorHandler","onManifest","version","prettyName","defaultOutput","onGenerate","options","project","Project","models","dmmf","datamodel","schemaPath","outputPath","generator","output","value","clientPath","otherGenerators","provider","results","safeParse","config","success","Error","data","prismaOptions","indexFile","createSourceFile","overwrite","model","addExportDeclaration","moduleSpecifier","generateBarrelFile","formatText","indentSize","convertTabsToSpaces","semicolons","SemicolonPreference","Remove","sourceFile","importList","StructureKind","ImportDeclaration","namespaceImport","path","relative","resolve","dirname","fields","some","f","namedImports","enumFields","relationFields","relativePath","isTypeOnly","filteredFields","Array","from","Set","addImportDeclarations","writeImportsForModel","_prismaOptions","addStatements","writeTypeSpecificSchemas","addVariableStatement","declarationKind","VariableDeclarationKind","Const","isExported","leadingTrivia","blankLineIfLastNot","declarations","initializer","inlineBlock","generateSchemaForModel","needsRelatedModel","addInterface","extends","properties","hasQuestionToken","generateRelatedSchemaForModel","populateModelFile","save"],"mappings":"oPAEA,MAAMA,EAAgBC,IAAEC,KAAK,CAAC,OAAQ,UAAUC,WAAWC,GAAQC,KAAKC,MAAMF,KAEjEG,EAAeN,IAAEO,OAAO,CACpCC,cAAeT,EAAcU,QAAQ,QAAQC,GAAGV,IAAEW,QAAQ,YAC1DC,YAAaZ,IAAEa,SAASJ,QAAQ,SAChCK,UAAWd,IAAEC,KAAK,CAAC,aAAc,cAAcQ,QAAQ,cACvDM,aAAchB,EAAcU,QAAQ,SACpCO,QAAShB,IAAEa,SAASI,WACpBC,sBAAuBnB,EAAcU,QAAQ,UCNjCU,EAAa,CAACC,EAAyBC,EAAiBC,GAAU,IAC9ED,EAAME,SAASC,GAASJ,EAAOK,MAAMD,GAAME,m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AW,CACrBC,WAAY,EACZC,qBAAqB,EACrBC,WAAYC,sBAAoBC,YAI3BhC,EAAQ6E"} -\ No newline at end of file -+{"version":3,"file":"zod-prisma.cjs.production.min.js","sources":["../src/config.ts","../src/util.ts","../src/docs.ts","../src/types.ts","../src/index.ts","../src/generator.ts"],"sourcesContent":["import { z } from 'zod'\n\nconst configBoolean = z.enum(['true', 'false']).transform((arg) => JSON.parse(arg))\n\nexport const configSchema = z.object({\n\trelationModel: configBoolean.default('true').or(z.literal('default')),\n\tmodelSuffix: z.string().default('Model'),\n\tmodelCase: z.enum(['PascalCase', 'camelCase']).default('PascalCase'),\n\tuseDecimalJs: configBoolean.default('false'),\n\timports: z.string().optional(),\n\tprismaJsonNullability: configBoolean.default('true'),\n})\n\nexport type Config = z.infer\n\nexport type PrismaOptions = {\n\tschemaPath: string\n\toutputPath: string\n\tclientPath: string\n}\n\nexport type Names = {\n\tmodel: string\n\trelated: string\n}\n","import { DMMF } from '@prisma/generator-helper'\nimport type { CodeBlockWriter } from 'ts-morph'\nimport { Config } from './config'\n\nexport const writeArray = (writer: CodeBlockWriter, array: string[], newLine = true) =>\n\tarray.forEach((line) => writer.write(line).conditionalNewLine(newLine))\n\nexport const useModelNames = ({ modelCase, modelSuffix, relationModel }: Config) => {\n\tconst formatModelName = (name: string, prefix = '') => {\n\t\tif (modelCase === 'camelCase') {\n\t\t\tname = name.slice(0, 1).toLowerCase() + name.slice(1)\n\t\t}\n\t\treturn `${prefix}${name}${modelSuffix}`\n\t}\n\n\treturn {\n\t\tmodelName: (name: string) => formatModelName(name, relationModel === 'default' ? '_' : ''),\n\t\trelatedModelName: (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\t\tformatModelName(\n\t\t\t\trelationModel === 'default' ? name.toString() : `Related${name.toString()}`\n\t\t\t),\n\t}\n}\n\nexport const needsRelatedModel = (model: DMMF.Model, config: Config) =>\n\tmodel.fields.some((field) => field.kind === 'object') && config.relationModel !== false\n\nexport const chunk = (input: T, size: number): T[] => {\n\treturn input.reduce((arr, item, idx) => {\n\t\treturn idx % size === 0\n\t\t\t? [...arr, [item]]\n\t\t\t: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]]\n\t}, [])\n}\n\nexport const dotSlash = (input: string) => {\n\tconst converted = input\n\t\t.replace(/^\\\\\\\\\\?\\\\/, '')\n\t\t.replace(/\\\\/g, '/')\n\t\t.replace(/\\/\\/+/g, '/')\n\n\tif (converted.includes(`/node_modules/`)) return converted.split(`/node_modules/`).slice(-1)[0]\n\n\tif (converted.startsWith(`../`)) return converted\n\n\treturn './' + converted\n}\n","import { ArrayTree, parse, stringify } from 'parenthesis'\nimport { chunk } from './util'\n\nexport const getJSDocs = (docString?: string) => {\n\tconst lines: string[] = []\n\n\tif (docString) {\n\t\tconst docLines = docString.split('\\n').filter((dL) => !dL.trimStart().startsWith('@zod'))\n\n\t\tif (docLines.length) {\n\t\t\tlines.push('/**')\n\t\t\tdocLines.forEach((dL) => lines.push(` * ${dL}`))\n\t\t\tlines.push(' */')\n\t\t}\n\t}\n\n\treturn lines\n}\n\nexport const getZodDocElements = (docString: string) =>\n\tdocString\n\t\t.split('\\n')\n\t\t.filter((line) => line.trimStart().startsWith('@zod'))\n\t\t.map((line) => line.trimStart().slice(4))\n\t\t.flatMap((line) =>\n\t\t\t// Array.from(line.matchAll(/\\.([^().]+\\(.*?\\))/g), (m) => m.slice(1)).flat()\n\t\t\tchunk(parse(line), 2)\n\t\t\t\t.slice(0, -1)\n\t\t\t\t.map(\n\t\t\t\t\t([each, contents]) =>\n\t\t\t\t\t\t(each as string).replace(/\\)?\\./, '') +\n\t\t\t\t\t\t`${stringify(contents as ArrayTree)})`\n\t\t\t\t)\n\t\t)\n\nexport const computeCustomSchema = (docString: string) => {\n\treturn getZodDocElements(docString)\n\t\t.find((modifier) => modifier.startsWith('custom('))\n\t\t?.slice(7)\n\t\t.slice(0, -1)\n}\n\nexport const computeModifiers = (docString: string) => {\n\treturn getZodDocElements(docString).filter((each) => !each.startsWith('custom('))\n}\n","import type { DMMF } from '@prisma/generator-helper'\nimport { computeCustomSchema, computeModifiers } from './docs'\n\nexport const getZodConstructor = (\n\tfield: DMMF.Field,\n\tgetRelatedModelName = (name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg) =>\n\t\tname.toString()\n) => {\n\tlet zodType = 'z.unknown()'\n\tlet extraModifiers: string[] = ['']\n\tif (field.kind === 'scalar') {\n\t\tswitch (field.type) {\n\t\t\tcase 'String':\n\t\t\t\tzodType = 'z.string()'\n\t\t\t\tbreak\n\t\t\tcase 'Int':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\textraModifiers.push('int()')\n\t\t\t\tbreak\n\t\t\tcase 'BigInt':\n\t\t\t\tzodType = 'z.bigint()'\n\t\t\t\tbreak\n\t\t\tcase 'DateTime':\n\t\t\t\tzodType = 'z.date()'\n\t\t\t\tbreak\n\t\t\tcase 'Float':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Decimal':\n\t\t\t\tzodType = 'z.number()'\n\t\t\t\tbreak\n\t\t\tcase 'Json':\n\t\t\t\tzodType = 'jsonSchema'\n\t\t\t\tbreak\n\t\t\tcase 'Boolean':\n\t\t\t\tzodType = 'z.boolean()'\n\t\t\t\tbreak\n\t\t\t// TODO: Proper type for bytes fields\n\t\t\tcase 'Bytes':\n\t\t\t\tzodType = 'z.unknown()'\n\t\t\t\tbreak\n\t\t}\n\t} else if (field.kind === 'enum') {\n\t\tzodType = `z.nativeEnum(${field.type})`\n\t} else if (field.kind === 'object') {\n\t\tzodType = getRelatedModelName(field.type)\n\t}\n\n\tif (field.isList) extraModifiers.push('array()')\n\tif (field.documentation) {\n\t\tzodType = computeCustomSchema(field.documentation) ?? zodType\n\t\textraModifiers.push(...computeModifiers(field.documentation))\n\t}\n\tif (!field.isRequired && field.type !== 'Json') extraModifiers.push('nullish()')\n\t// if (field.hasDefaultValue) extraModifiers.push('optional()')\n\n\treturn `${zodType}${extraModifiers.join('.')}`\n}\n","// @ts-ignore Importing package.json for automated synchronization of version numbers\nimport { version } from '../package.json'\n\nimport { generatorHandler } from '@prisma/generator-helper'\nimport { SemicolonPreference } from 'typescript'\nimport { configSchema, PrismaOptions } from './config'\nimport { populateModelFile, generateBarrelFile } from './generator'\nimport { Project } from 'ts-morph'\n\ngeneratorHandler({\n\tonManifest() {\n\t\treturn {\n\t\t\tversion,\n\t\t\tprettyName: 'Zod Schemas',\n\t\t\tdefaultOutput: 'zod',\n\t\t}\n\t},\n\tonGenerate(options) {\n\t\tconst project = new Project()\n\n\t\tconst models = options.dmmf.datamodel.models\n\n\t\tconst { schemaPath } = options\n\t\tconst outputPath = options.generator.output!.value\n\t\tconst clientPath = options.otherGenerators.find(\n\t\t\t(each) => each.provider.value === 'prisma-client-js'\n\t\t)!.output!.value!\n\n\t\tconst results = configSchema.safeParse(options.generator.config)\n\t\tif (!results.success)\n\t\t\tthrow new Error(\n\t\t\t\t'Incorrect config provided. Please check the values you provided and try again.'\n\t\t\t)\n\n\t\tconst config = results.data\n\t\tconst prismaOptions: PrismaOptions = {\n\t\t\tclientPath,\n\t\t\toutputPath,\n\t\t\tschemaPath,\n\t\t}\n\n\t\tconst indexFile = project.createSourceFile(\n\t\t\t`${outputPath}/index.ts`,\n\t\t\t{},\n\t\t\t{ overwrite: true }\n\t\t)\n\n\t\tgenerateBarrelFile(models, indexFile)\n\n\t\tindexFile.formatText({\n\t\t\tindentSize: 2,\n\t\t\tconvertTabsToSpaces: true,\n\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t})\n\n\t\tmodels.forEach((model) => {\n\t\t\tconst sourceFile = project.createSourceFile(\n\t\t\t\t`${outputPath}/${model.name.toLowerCase()}.ts`,\n\t\t\t\t{},\n\t\t\t\t{ overwrite: true }\n\t\t\t)\n\n\t\t\tpopulateModelFile(model, sourceFile, config, prismaOptions)\n\n\t\t\tsourceFile.formatText({\n\t\t\t\tindentSize: 2,\n\t\t\t\tconvertTabsToSpaces: true,\n\t\t\t\tsemicolons: SemicolonPreference.Remove,\n\t\t\t})\n\t\t})\n\n\t\treturn project.save()\n\t},\n})\n","import path from 'path'\nimport { DMMF } from '@prisma/generator-helper'\nimport {\n\tImportDeclarationStructure,\n\tSourceFile,\n\tStructureKind,\n\tVariableDeclarationKind,\n} from 'ts-morph'\nimport { Config, PrismaOptions } from './config'\nimport { dotSlash, needsRelatedModel, useModelNames, writeArray } from './util'\nimport { getJSDocs } from './docs'\nimport { getZodConstructor } from './types'\n\nexport const writeImportsForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t{ schemaPath, outputPath, clientPath }: PrismaOptions\n) => {\n\tconst { relatedModelName } = useModelNames(config)\n\tconst importList: ImportDeclarationStructure[] = [\n\t\t{\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'z',\n\t\t\tmoduleSpecifier: 'zod',\n\t\t},\n\t]\n\n\tif (config.imports) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamespaceImport: 'imports',\n\t\t\tmoduleSpecifier: dotSlash(\n\t\t\t\tpath.relative(outputPath, path.resolve(path.dirname(schemaPath), config.imports))\n\t\t\t),\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tnamedImports: ['Decimal'],\n\t\t\tmoduleSpecifier: 'decimal.js',\n\t\t})\n\t}\n\n\tconst enumFields = model.fields.filter((f) => f.kind === 'enum')\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\tconst relativePath = path.relative(outputPath, clientPath)\n\n\tif (enumFields.length > 0) {\n\t\timportList.push({\n\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\tisTypeOnly: enumFields.length === 0,\n\t\t\tmoduleSpecifier: dotSlash(relativePath),\n\t\t\tnamedImports: Array.from(new Set(enumFields.map((f) => f.type))),\n\t\t})\n\t}\n\n\tif (config.relationModel !== false && relationFields.length > 0) {\n\t\tconst filteredFields = relationFields.filter((f) => f.type !== model.name)\n\n\t\tif (filteredFields.length > 0) {\n\t\t\timportList.push({\n\t\t\t\tkind: StructureKind.ImportDeclaration,\n\t\t\t\tmoduleSpecifier: './index',\n\t\t\t\tnamedImports: Array.from(\n\t\t\t\t\tnew Set(\n\t\t\t\t\t\tfilteredFields.flatMap((f) => [\n\t\t\t\t\t\t\t`Complete${f.type}`,\n\t\t\t\t\t\t\trelatedModelName(f.type),\n\t\t\t\t\t\t])\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\t}\n\n\tsourceFile.addImportDeclarations(importList)\n}\n\nexport const writeTypeSpecificSchemas = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tif (model.fields.some((f) => f.type === 'Json')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for JSON fields',\n\t\t\t\t`type Literal = boolean | number | string${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : '| null'\n\t\t\t\t}`,\n\t\t\t\t'type Json = Literal | { [key: string]: Json } | Json[]',\n\t\t\t\t`const literalSchema = z.union([z.string(), z.number(), z.boolean()${\n\t\t\t\t\tconfig.prismaJsonNullability ? '' : ', z.null()'\n\t\t\t\t}])`,\n\t\t\t\t'const jsonSchema: z.ZodSchema = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))',\n\t\t\t])\n\t\t})\n\t}\n\n\tif (config.useDecimalJs && model.fields.some((f) => f.type === 'Decimal')) {\n\t\tsourceFile.addStatements((writer) => {\n\t\t\twriter.newLine()\n\t\t\twriteArray(writer, [\n\t\t\t\t'// Helper schema for Decimal fields',\n\t\t\t\t'z',\n\t\t\t\t'.instanceof(Decimal)',\n\t\t\t\t'.or(z.string())',\n\t\t\t\t'.or(z.number())',\n\t\t\t\t'.refine((value) => {',\n\t\t\t\t' try {',\n\t\t\t\t' return new Decimal(value);',\n\t\t\t\t' } catch (error) {',\n\t\t\t\t' return false;',\n\t\t\t\t' }',\n\t\t\t\t'})',\n\t\t\t\t'.transform((value) => new Decimal(value));',\n\t\t\t])\n\t\t})\n\t}\n}\n\nexport const generateSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName } = useModelNames(config)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tleadingTrivia: (writer) => writer.blankLineIfLastNot(),\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: modelName(model.name),\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write('z.object(')\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\tmodel.fields\n\t\t\t\t\t\t\t\t.filter((f) => f.kind !== 'object')\n\t\t\t\t\t\t\t\t.forEach((field) => {\n\t\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\t\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t\t.write(`${field.name}: ${getZodConstructor(field)}`)\n\t\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write(')')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const generateRelatedSchemaForModel = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\t_prismaOptions: PrismaOptions\n) => {\n\tconst { modelName, relatedModelName } = useModelNames(config)\n\n\tconst relationFields = model.fields.filter((f) => f.kind === 'object')\n\n\tsourceFile.addInterface({\n\t\tname: `Complete${model.name}`,\n\t\tisExported: true,\n\t\textends: [`z.infer`],\n\t\tproperties: relationFields.map((f) => ({\n\t\t\thasQuestionToken: !f.isRequired,\n\t\t\tname: f.name,\n\t\t\ttype: `Complete${f.type}${f.isList ? '[]' : ''}${!f.isRequired ? ' | null' : ''}`,\n\t\t})),\n\t})\n\n\tsourceFile.addStatements((writer) =>\n\t\twriteArray(writer, [\n\t\t\t'',\n\t\t\t'/**',\n\t\t\t` * ${relatedModelName(\n\t\t\t\tmodel.name\n\t\t\t)} contains all relations on your model in addition to the scalars`,\n\t\t\t' *',\n\t\t\t' * NOTE: Lazy required in case of potential circular dependencies within schema',\n\t\t\t' */',\n\t\t])\n\t)\n\n\tsourceFile.addVariableStatement({\n\t\tdeclarationKind: VariableDeclarationKind.Const,\n\t\tisExported: true,\n\t\tdeclarations: [\n\t\t\t{\n\t\t\t\tname: relatedModelName(model.name),\n\t\t\t\ttype: `z.ZodSchema`,\n\t\t\t\tinitializer(writer) {\n\t\t\t\t\twriter\n\t\t\t\t\t\t.write(`z.lazy(() => ${modelName(model.name)}.extend(`)\n\t\t\t\t\t\t.inlineBlock(() => {\n\t\t\t\t\t\t\trelationFields.forEach((field) => {\n\t\t\t\t\t\t\t\twriteArray(writer, getJSDocs(field.documentation))\n\n\t\t\t\t\t\t\t\twriter\n\t\t\t\t\t\t\t\t\t.write(\n\t\t\t\t\t\t\t\t\t\t`${field.name}: ${getZodConstructor(\n\t\t\t\t\t\t\t\t\t\t\tfield,\n\t\t\t\t\t\t\t\t\t\t\trelatedModelName\n\t\t\t\t\t\t\t\t\t\t)}`\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t.write(',')\n\t\t\t\t\t\t\t\t\t.newLine()\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.write('))')\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t})\n}\n\nexport const populateModelFile = (\n\tmodel: DMMF.Model,\n\tsourceFile: SourceFile,\n\tconfig: Config,\n\tprismaOptions: PrismaOptions\n) => {\n\twriteImportsForModel(model, sourceFile, config, prismaOptions)\n\twriteTypeSpecificSchemas(model, sourceFile, config, prismaOptions)\n\tgenerateSchemaForModel(model, sourceFile, config, prismaOptions)\n\tif (needsRelatedModel(model, config))\n\t\tgenerateRelatedSchemaForModel(model, sourceFile, config, prismaOptions)\n}\n\nexport const generateBarrelFile = (models: DMMF.Model[], indexFile: SourceFile) => {\n\tmodels.forEach((model) =>\n\t\tindexFile.addExportDeclaration({\n\t\t\tmoduleSpecifier: `./${model.name.toLowerCase()}`,\n\t\t})\n\t)\n}\n"],"names":["configBoolean","z","enum","transform","arg","JSON","parse","configSchema","object","relationModel","default","or","literal","modelSuffix","string","modelCase","useDecimalJs","imports","optional","prismaJsonNullability","writeArray","writer","array","newLine","forEach","line","write","conditionalNewLine","useModelNames","formatModelName","name","prefix","slice","toLowerCase","modelName","relatedModelName","toString","dotSlash","input","converted","replace","includes","split","startsWith","getJSDocs","docString","lines","docLines","filter","dL","trimStart","length","push","getZodDocElements","map","flatMap","chunk","reduce","arr","item","idx","each","contents","stringify","getZodConstructor","field","getRelatedModelName","zodType","extraModifiers","kind","type","_computeCustomSchema","_getZodDocElements$fi","isList","documentation","find","modifier","isRequired","join","generatorHandler","onManifest","version","prettyName","defaultOutput","onGenerate","options","project","Project","models","dmmf","datamodel","schemaPath","outputPath","generator","output","value","clientPath","otherGenerators","provider","results","safeParse","config","success","Error","data","prismaOptions","indexFile","createSourceFile","overwrite","model","addExportDeclaration","moduleSpecifier","generateBarrelFile","formatText","indentSize","convertTabsToSpaces","semicolons","SemicolonPreference","Remove","sourceFile","importList","StructureKind","ImportDeclaration","namespaceImport","path","relative","resolve","dirname","fields","some","f","namedImports","enumFields","relationFields","relativePath","isTypeOnly","Array","from","Set","filteredFields","addImportDeclarations","writeImportsForModel","_prismaOptions","addStatements","writeTypeSpecificSchemas","addVariableStatement","declarationKind","VariableDeclarationKind","Const","isExported","leadingTrivia","blankLineIfLastNot","declarations","initializer","inlineBlock","generateSchemaForModel","needsRelatedModel","addInterface","extends","properties","hasQuestionToken","generateRelatedSchemaForModel","populateModelFile","save"],"mappings":"oPAEA,MAAMA,EAAgBC,EAAAA,EAAEC,KAAK,CAAC,OAAQ,UAAUC,WAAWC,GAAQC,KAAKC,MAAMF,KAEjEG,EAAeN,EAACA,EAACO,OAAO,CACpCC,cAAeT,EAAcU,QAAQ,QAAQC,GAAGV,EAACA,EAACW,QAAQ,YAC1DC,YAAaZ,EAAAA,EAAEa,SAASJ,QAAQ,SAChCK,UAAWd,EAAAA,EAAEC,KAAK,CAAC,aAAc,cAAcQ,QAAQ,cACvDM,aAAchB,EAAcU,QAAQ,SACpCO,QAAShB,EAACA,EAACa,SAASI,WACpBC,sBAAuBnB,EAAcU,QAAQ,UCNjCU,EAAa,CAACC,EAAyBC,EAAiBC,GAAU,IAC9ED,EAAME,SAASC,GAASJ,EAAOK,MAAMD,GAAME,mBAAmBJ,KAElDK,EAAgB,EAAGb,YAAWF,cAAaJ,oBACvD,MAAMoB,EAAkB,CAACC,EAAcC,EAAS,MAC7B,cAAdhB,IACHe,EAAOA,EAAKE,MAAM,EAAG,GAAGC,cAAgBH,EAAKE,MAAM,OAE1CD,IAASD,IAAOjB,KAG3B,MAAO,CACNqB,UAAYJ,GAAiBD,EAAgBC,EAAwB,YAAlBrB,EAA8B,IAAM,IACvF0B,iBAAmBL,GAClBD,EACmB,YAAlBpB,EAA8BqB,EAAKM,WAAuB,UAAAN,EAAKM,cAEjE,EAcWC,EAAYC,IACxB,MAAMC,EAAYD,EAChBE,QAAQ,YAAa,IACrBA,QAAQ,MAAO,KACfA,QAAQ,SAAU,KAEpB,OAAID,EAAUE,2BAAmCF,EAAUG,wBAAwBV,OAAO,GAAG,GAEzFO,EAAUI,kBAA0BJ,EAEjC,KAAOA,CAAS,EC1CXK,EAAaC,IACzB,MAAMC,EAAkB,GAExB,GAAID,EAAW,CACd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AChB"} -\ No newline at end of file -diff --git a/package.json b/package.json -index 198b8999bc167af4858d97c8ec182c0d5d7d78e6..25b6772aac8720d7e3a12f5b4c7c2eecbcc597ea 100644 ---- a/package.json -+++ b/package.json -@@ -52,23 +52,23 @@ - "testEnvironment": "node" - }, - "dependencies": { -- "@prisma/generator-helper": "~3.8.1", -+ "@prisma/generator-helper": "~4.6.0", - "parenthesis": "^3.1.8", -- "ts-morph": "^13.0.2" -+ "ts-morph": "^16.0.0" - }, - "devDependencies": { -- "@prisma/client": "~3.8.1", -- "@prisma/sdk": "~3.7.0", -+ "@prisma/client": "~4.6.0", -+ "@prisma/sdk": "~4.0.0", - "@tsconfig/recommended": "^1.0.1", - "@types/fs-extra": "^9.0.13", - "dts-cli": "^1.1.5", -- "execa": "^5.1.0", -+ "execa": "^6.1.0", - "fast-glob": "^3.2.5", - "fs-extra": "^10.0.0", -- "husky": "^7.0.4", -- "jest-mock-extended": "^2.0.4", -- "prisma": "^3.4.2", -- "tslib": "^2.3.1", -+ "husky": "^8.0.2", -+ "jest-mock-extended": "^3.0.1", -+ "prisma": "^4.6.0", -+ "tslib": "^2.4.1", - "typescript": "^4.5.4", - "zod": "^3.11.6" - }, \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d9245eafd9..d41018f81c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,9 +38,6 @@ patchedDependencies: iso-google-locales@3.0.4: hash: ltnamflm7ayajalculwqyezjya path: patches/iso-google-locales@3.0.4.patch - next-auth@4.23.0: - hash: 5rcmqpbec3t4wwdelpjvypkzei - path: patches/next-auth@4.23.0.patch trpc-panel@1.3.4: hash: 3z2tx2cn67fyw5s2xdx73dxaji path: patches/trpc-panel@1.3.4.patch @@ -335,8 +332,8 @@ importers: specifier: 13.4.16 version: 13.4.16(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0) next-auth: - specifier: 4.23.0 - version: 4.23.0(patch_hash=5rcmqpbec3t4wwdelpjvypkzei)(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) + specifier: 4.23.1 + version: 4.23.1(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) next-i18next: specifier: 14.0.0 version: 14.0.0(i18next@23.4.4)(next@13.4.16)(react-i18next@13.1.2)(react@18.2.0) @@ -759,7 +756,7 @@ importers: version: 3.391.0 '@next-auth/prisma-adapter': specifier: 1.0.7 - version: 1.0.7(@prisma/client@5.1.1)(next-auth@4.23.0) + version: 1.0.7(@prisma/client@5.1.1)(next-auth@4.23.1) '@weareinreach/db': specifier: workspace:* version: link:../db @@ -807,8 +804,8 @@ importers: specifier: 13.4.16 version: 13.4.16(@opentelemetry/api@1.4.1)(react-dom@18.2.0)(react@18.2.0) next-auth: - specifier: 4.23.0 - version: 4.23.0(patch_hash=5rcmqpbec3t4wwdelpjvypkzei)(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) + specifier: 4.23.1 + version: 4.23.1(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) react: specifier: 18.2.0 version: 18.2.0 @@ -1612,7 +1609,7 @@ importers: version: 2.0.4(@tiptap/pm@2.0.4) '@tomfreudenberg/next-auth-mock': specifier: 0.5.6 - version: 0.5.6(next-auth@4.23.0)(react@18.2.0) + version: 0.5.6(next-auth@4.23.1)(react@18.2.0) '@trpc/client': specifier: 10.37.1 version: 10.37.1(@trpc/server@10.37.1) @@ -1722,8 +1719,8 @@ importers: specifier: 13.4.16 version: 13.4.16(@babel/core@7.22.10)(react-dom@18.2.0)(react@18.2.0) next-auth: - specifier: 4.23.0 - version: 4.23.0(patch_hash=5rcmqpbec3t4wwdelpjvypkzei)(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) + specifier: 4.23.1 + version: 4.23.1(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) next-i18next: specifier: 14.0.0 version: 14.0.0(i18next@23.4.4)(next@13.4.16)(react-i18next@13.1.2)(react@18.2.0) @@ -6127,14 +6124,14 @@ packages: '@types/pg': 8.6.6 dev: false - /@next-auth/prisma-adapter@1.0.7(@prisma/client@5.1.1)(next-auth@4.23.0): + /@next-auth/prisma-adapter@1.0.7(@prisma/client@5.1.1)(next-auth@4.23.1): resolution: {integrity: sha512-Cdko4KfcmKjsyHFrWwZ//lfLUbcLqlyFqjd/nYE2m3aZ7tjMNUjpks47iw7NTCnXf+5UWz5Ypyt1dSs1EP5QJw==} peerDependencies: '@prisma/client': '>=2.26.0 || >=3' next-auth: ^4 dependencies: '@prisma/client': 5.1.1(prisma@5.1.1) - next-auth: 4.23.0(patch_hash=5rcmqpbec3t4wwdelpjvypkzei)(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) + next-auth: 4.23.1(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) dev: false /@next/bundle-analyzer@13.4.16: @@ -10356,13 +10353,13 @@ packages: transitivePeerDependencies: - '@tiptap/pm' - /@tomfreudenberg/next-auth-mock@0.5.6(next-auth@4.23.0)(react@18.2.0): + /@tomfreudenberg/next-auth-mock@0.5.6(next-auth@4.23.1)(react@18.2.0): resolution: {integrity: sha512-fSZJY5rUyj8GIcJI450ZV7FV/CMzpjUUGhPiaRyQo9l7l5mLvrnNe1MymzOnLpgXIkFja+CF/UHFGW807QcwmA==} peerDependencies: next-auth: ^4.12.3 react: ^18 || 18 dependencies: - next-auth: 4.23.0(patch_hash=5rcmqpbec3t4wwdelpjvypkzei)(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) + next-auth: 4.23.1(next@13.4.16)(react-dom@18.2.0)(react@18.2.0) react: 18.2.0 dev: true @@ -19551,8 +19548,8 @@ packages: resolution: {integrity: sha512-md4cGoxuT4T4d/HDOXbrUHkTKrp/vp+m3aOA7XXVYwNsUNMK49g3SQicTSeV5GIz/5QVGAeYRAOlyp9OvlgsYA==} engines: {node: '>=10'} - /next-auth@4.23.0(patch_hash=5rcmqpbec3t4wwdelpjvypkzei)(next@13.4.16)(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-RgukcJkBdvsJwEfA+B80Wcowvtgy6tk8KKWffb7CMCdzcLO4fCCA6aB6sp/DZ2I0ISvWGnbVcO5KXmlan71igw==} + /next-auth@4.23.1(next@13.4.16)(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-mL083z8KgRtlrIV6CDca2H1kduWJuK/3pTS0Fe2og15KOm4v2kkLGdSDfc2g+019aEBrJUT0pPW2Xx42ImN1WA==} peerDependencies: next: ^12.2.5 || ^13 || 13 nodemailer: ^6.6.5 @@ -19574,7 +19571,6 @@ packages: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) uuid: 9.0.0 - patched: true /next-i18next@14.0.0(i18next@23.4.4)(next@13.4.16)(react-i18next@13.1.2)(react@18.2.0): resolution: {integrity: sha512-umv8hOZoSoAA+td3ErfemyO/5Ib2pnYCdQ8/Oy+fncS2skFIL3hHKRer3Oa3Nfm4Xbv5p6DHWzm3NhT1j4tWwg==}