@stryke/prisma-trpc-generator 0.13.37 → 0.13.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.cjs +1 -0
- package/dist/_virtual/rolldown_runtime.mjs +1 -0
- package/dist/config.cjs +1 -0
- package/dist/config.mjs +2 -0
- package/dist/config.mjs.map +1 -0
- package/dist/generator.d.cts +1 -2
- package/dist/generator.d.mts +1 -2
- package/dist/helpers.cjs +85 -0
- package/dist/helpers.mjs +86 -0
- package/dist/helpers.mjs.map +1 -0
- package/dist/index.cjs +1 -116
- package/dist/index.mjs +1 -116
- package/dist/index.mjs.map +1 -1
- package/dist/packages/env/src/get-env-paths.cjs +1 -0
- package/dist/packages/env/src/get-env-paths.mjs +2 -0
- package/dist/packages/env/src/get-env-paths.mjs.map +1 -0
- package/dist/packages/string-format/src/acronyms.cjs +1 -0
- package/dist/packages/string-format/src/acronyms.mjs +2 -0
- package/dist/packages/string-format/src/acronyms.mjs.map +1 -0
- package/dist/packages/string-format/src/articles.cjs +1 -0
- package/dist/packages/string-format/src/articles.mjs +2 -0
- package/dist/packages/string-format/src/articles.mjs.map +1 -0
- package/dist/packages/string-format/src/combine.cjs +1 -0
- package/dist/packages/string-format/src/combine.mjs +2 -0
- package/dist/packages/string-format/src/combine.mjs.map +1 -0
- package/dist/packages/string-format/src/conjunctions.cjs +1 -0
- package/dist/packages/string-format/src/conjunctions.mjs +2 -0
- package/dist/packages/string-format/src/conjunctions.mjs.map +1 -0
- package/dist/packages/string-format/src/decamelize.cjs +1 -0
- package/dist/packages/string-format/src/decamelize.mjs +2 -0
- package/dist/packages/string-format/src/decamelize.mjs.map +1 -0
- package/dist/packages/string-format/src/format-special-cases.cjs +1 -0
- package/dist/packages/string-format/src/format-special-cases.mjs +2 -0
- package/dist/packages/string-format/src/format-special-cases.mjs.map +1 -0
- package/dist/packages/string-format/src/lower-case-first.cjs +1 -0
- package/dist/packages/string-format/src/lower-case-first.mjs +2 -0
- package/dist/packages/string-format/src/lower-case-first.mjs.map +1 -0
- package/dist/packages/string-format/src/prepositions.cjs +1 -0
- package/dist/packages/string-format/src/prepositions.mjs +2 -0
- package/dist/packages/string-format/src/prepositions.mjs.map +1 -0
- package/dist/packages/string-format/src/special-cases.cjs +1 -0
- package/dist/packages/string-format/src/special-cases.mjs +2 -0
- package/dist/packages/string-format/src/special-cases.mjs.map +1 -0
- package/dist/packages/string-format/src/title-case.cjs +1 -0
- package/dist/packages/string-format/src/title-case.mjs +2 -0
- package/dist/packages/string-format/src/title-case.mjs.map +1 -0
- package/dist/packages/string-format/src/upper-case-first.cjs +1 -0
- package/dist/packages/string-format/src/upper-case-first.mjs +2 -0
- package/dist/packages/string-format/src/upper-case-first.mjs.map +1 -0
- package/dist/prisma-generator.cjs +9 -0
- package/dist/prisma-generator.mjs +10 -0
- package/dist/prisma-generator.mjs.map +1 -0
- package/dist/project.cjs +1 -0
- package/dist/project.mjs +2 -0
- package/dist/project.mjs.map +1 -0
- package/dist/utils/format-file.cjs +1 -0
- package/dist/utils/format-file.mjs +2 -0
- package/dist/utils/format-file.mjs.map +1 -0
- package/dist/utils/get-jiti.cjs +1 -0
- package/dist/utils/get-jiti.mjs +2 -0
- package/dist/utils/get-jiti.mjs.map +1 -0
- package/dist/utils/get-prisma-internals.cjs +1 -0
- package/dist/utils/get-prisma-internals.mjs +2 -0
- package/dist/utils/get-prisma-internals.mjs.map +1 -0
- package/dist/utils/write-file-safely.cjs +2 -0
- package/dist/utils/write-file-safely.mjs +3 -0
- package/dist/utils/write-file-safely.mjs.map +1 -0
- package/dist/zod/aggregate-helpers.cjs +1 -0
- package/dist/zod/aggregate-helpers.mjs +2 -0
- package/dist/zod/aggregate-helpers.mjs.map +1 -0
- package/dist/zod/comments-helpers.cjs +1 -0
- package/dist/zod/comments-helpers.mjs +2 -0
- package/dist/zod/comments-helpers.mjs.map +1 -0
- package/dist/zod/docs-helpers.cjs +3 -0
- package/dist/zod/docs-helpers.mjs +4 -0
- package/dist/zod/docs-helpers.mjs.map +1 -0
- package/dist/zod/generator-helpers.cjs +1 -0
- package/dist/zod/generator-helpers.mjs +2 -0
- package/dist/zod/generator-helpers.mjs.map +1 -0
- package/dist/zod/helpers.cjs +1 -0
- package/dist/zod/helpers.mjs +2 -0
- package/dist/zod/helpers.mjs.map +1 -0
- package/dist/zod/include-helpers.cjs +1 -0
- package/dist/zod/include-helpers.mjs +2 -0
- package/dist/zod/include-helpers.mjs.map +1 -0
- package/dist/zod/model-helpers.cjs +1 -0
- package/dist/zod/model-helpers.mjs +2 -0
- package/dist/zod/model-helpers.mjs.map +1 -0
- package/dist/zod/modelArgs-helpers.cjs +1 -0
- package/dist/zod/modelArgs-helpers.mjs +2 -0
- package/dist/zod/modelArgs-helpers.mjs.map +1 -0
- package/dist/zod/mongodb-helpers.cjs +1 -0
- package/dist/zod/mongodb-helpers.mjs +2 -0
- package/dist/zod/mongodb-helpers.mjs.map +1 -0
- package/dist/zod/select-helpers.cjs +1 -0
- package/dist/zod/select-helpers.mjs +2 -0
- package/dist/zod/select-helpers.mjs.map +1 -0
- package/dist/zod/transformer.cjs +21 -0
- package/dist/zod/transformer.mjs +22 -0
- package/dist/zod/transformer.mjs.map +1 -0
- package/dist/zod/whereUniqueInput-helpers.cjs +1 -0
- package/dist/zod/whereUniqueInput-helpers.mjs +2 -0
- package/dist/zod/whereUniqueInput-helpers.mjs.map +1 -0
- package/package.json +8 -8
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["pluralize","compilerOptions: CompilerOptions","ACRONYMS: Record<\n string,\n { description: string; display?: string }\n>","ACRONYM_DISPLAY: Record<string, string>","ACRONYM_DESCRIPTION: Record<string, string>","ACRONYM_LIST: string[]","jiti!: Jiti","lines: string[]","importList: ImportDeclarationStructure[]","relativePath","extraModifiers: string[]","modelAttributeRegex","attributeNameRegex","attributeArgsRegex","parsedAttributeArgs: Record<string, unknown>","relativePath","aggregateOperationSupport: AggregateOperationSupport","parsedAttributeArgs: Record<string, unknown>","rawOpsMap: { [name: string]: string }","line: string","prismaClientImportPath: string","modelQueryTypeSuffixToQueryName: Record<string, string>","modelIncludeInputObjectTypes: DMMF.InputType[]","fields: DMMF.SchemaArg[]","field: DMMF.SchemaArg","inputTypes: SchemaArgInputTypes","_countField: DMMF.SchemaArg","modelIncludeInputObjectType: DMMF.InputType","modelArgsInputObjectTypes: DMMF.InputType[]","fields: DMMF.SchemaArg[]","selectField: DMMF.SchemaArg","includeField: DMMF.SchemaArg","modelArgsInputObjectType: DMMF.InputType","modelCountOutputTypeSelectInputObjectTypes: DMMF.InputType[]","modelCountOutputTypeSelectInputObjectType: DMMF.InputType","modelCountOutputTypeArgsInputObjectTypes: DMMF.InputType[]","modelCountOutputTypeArgsInputObjectType: DMMF.InputType","modelSelectInputObjectTypes: DMMF.InputType[]","fields: DMMF.SchemaArg[]","field: Writeable<DMMF.SchemaArg>","schemaArgInputType: ArrayValues<SchemaArgInputTypes>","_countField: DMMF.SchemaArg","modelSelectInputObjectType: DMMF.InputType","hiddenModels: string[]","hiddenFields: string[]","queries: RootType","mutations: RootType","subscriptions: RootType"],"sources":["../../string-format/src/lower-case-first.ts","../../../node_modules/.pnpm/pluralize@8.0.0/node_modules/pluralize/pluralize.js","../src/config.ts","../src/project.ts","../../string-format/src/combine.ts","../../string-format/src/decamelize.ts","../../string-format/src/acronyms.ts","../../string-format/src/articles.ts","../../string-format/src/conjunctions.ts","../../string-format/src/prepositions.ts","../../string-format/src/special-cases.ts","../../string-format/src/format-special-cases.ts","../../string-format/src/upper-case-first.ts","../../string-format/src/title-case.ts","../../env/src/get-env-paths.ts","../src/utils/get-jiti.ts","../src/utils/get-prisma-internals.ts","../src/zod/docs-helpers.ts","../src/zod/model-helpers.ts","../src/helpers.ts","../src/utils/format-file.ts","../src/utils/write-file-safely.ts","../src/zod/aggregate-helpers.ts","../src/zod/comments-helpers.ts","../src/zod/mongodb-helpers.ts","../src/zod/transformer.ts","../src/zod/generator-helpers.ts","../src/zod/include-helpers.ts","../src/zod/modelArgs-helpers.ts","../src/zod/select-helpers.ts","../src/zod/whereUniqueInput-helpers.ts","../src/zod/helpers.ts","../src/prisma-generator.ts","../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Lower case the first character of an input string.\n *\n * @remarks\n * \"tHISISANEXAMPLE\"\n *\n * @param input - The input string.\n * @returns The lower-cased string.\n */\nexport function lowerCaseFirst<T extends string | undefined>(input?: T): T {\n return (input ? input.charAt(0).toLowerCase() + input.slice(1) : input) as T;\n}\n","/* global define */\n\n(function (root, pluralize) {\n /* istanbul ignore else */\n if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {\n // Node.\n module.exports = pluralize();\n } else if (typeof define === 'function' && define.amd) {\n // AMD, registers as an anonymous module.\n define(function () {\n return pluralize();\n });\n } else {\n // Browser global.\n root.pluralize = pluralize();\n }\n})(this, function () {\n // Rule storage - pluralize and singularize need to be run sequentially,\n // while other rules can be optimized using an object for instant lookups.\n var pluralRules = [];\n var singularRules = [];\n var uncountables = {};\n var irregularPlurals = {};\n var irregularSingles = {};\n\n /**\n * Sanitize a pluralization rule to a usable regular expression.\n *\n * @param {(RegExp|string)} rule\n * @return {RegExp}\n */\n function sanitizeRule (rule) {\n if (typeof rule === 'string') {\n return new RegExp('^' + rule + '$', 'i');\n }\n\n return rule;\n }\n\n /**\n * Pass in a word token to produce a function that can replicate the case on\n * another word.\n *\n * @param {string} word\n * @param {string} token\n * @return {Function}\n */\n function restoreCase (word, token) {\n // Tokens are an exact match.\n if (word === token) return token;\n\n // Lower cased words. E.g. \"hello\".\n if (word === word.toLowerCase()) return token.toLowerCase();\n\n // Upper cased words. E.g. \"WHISKY\".\n if (word === word.toUpperCase()) return token.toUpperCase();\n\n // Title cased words. E.g. \"Title\".\n if (word[0] === word[0].toUpperCase()) {\n return token.charAt(0).toUpperCase() + token.substr(1).toLowerCase();\n }\n\n // Lower cased words. E.g. \"test\".\n return token.toLowerCase();\n }\n\n /**\n * Interpolate a regexp string.\n *\n * @param {string} str\n * @param {Array} args\n * @return {string}\n */\n function interpolate (str, args) {\n return str.replace(/\\$(\\d{1,2})/g, function (match, index) {\n return args[index] || '';\n });\n }\n\n /**\n * Replace a word using a rule.\n *\n * @param {string} word\n * @param {Array} rule\n * @return {string}\n */\n function replace (word, rule) {\n return word.replace(rule[0], function (match, index) {\n var result = interpolate(rule[1], arguments);\n\n if (match === '') {\n return restoreCase(word[index - 1], result);\n }\n\n return restoreCase(match, result);\n });\n }\n\n /**\n * Sanitize a word by passing in the word and sanitization rules.\n *\n * @param {string} token\n * @param {string} word\n * @param {Array} rules\n * @return {string}\n */\n function sanitizeWord (token, word, rules) {\n // Empty string or doesn't need fixing.\n if (!token.length || uncountables.hasOwnProperty(token)) {\n return word;\n }\n\n var len = rules.length;\n\n // Iterate over the sanitization rules and use the first one to match.\n while (len--) {\n var rule = rules[len];\n\n if (rule[0].test(word)) return replace(word, rule);\n }\n\n return word;\n }\n\n /**\n * Replace a word with the updated word.\n *\n * @param {Object} replaceMap\n * @param {Object} keepMap\n * @param {Array} rules\n * @return {Function}\n */\n function replaceWord (replaceMap, keepMap, rules) {\n return function (word) {\n // Get the correct token and case restoration functions.\n var token = word.toLowerCase();\n\n // Check against the keep object map.\n if (keepMap.hasOwnProperty(token)) {\n return restoreCase(word, token);\n }\n\n // Check against the replacement map for a direct word replacement.\n if (replaceMap.hasOwnProperty(token)) {\n return restoreCase(word, replaceMap[token]);\n }\n\n // Run all the rules against the word.\n return sanitizeWord(token, word, rules);\n };\n }\n\n /**\n * Check if a word is part of the map.\n */\n function checkWord (replaceMap, keepMap, rules, bool) {\n return function (word) {\n var token = word.toLowerCase();\n\n if (keepMap.hasOwnProperty(token)) return true;\n if (replaceMap.hasOwnProperty(token)) return false;\n\n return sanitizeWord(token, token, rules) === token;\n };\n }\n\n /**\n * Pluralize or singularize a word based on the passed in count.\n *\n * @param {string} word The word to pluralize\n * @param {number} count How many of the word exist\n * @param {boolean} inclusive Whether to prefix with the number (e.g. 3 ducks)\n * @return {string}\n */\n function pluralize (word, count, inclusive) {\n var pluralized = count === 1\n ? pluralize.singular(word) : pluralize.plural(word);\n\n return (inclusive ? count + ' ' : '') + pluralized;\n }\n\n /**\n * Pluralize a word.\n *\n * @type {Function}\n */\n pluralize.plural = replaceWord(\n irregularSingles, irregularPlurals, pluralRules\n );\n\n /**\n * Check if a word is plural.\n *\n * @type {Function}\n */\n pluralize.isPlural = checkWord(\n irregularSingles, irregularPlurals, pluralRules\n );\n\n /**\n * Singularize a word.\n *\n * @type {Function}\n */\n pluralize.singular = replaceWord(\n irregularPlurals, irregularSingles, singularRules\n );\n\n /**\n * Check if a word is singular.\n *\n * @type {Function}\n */\n pluralize.isSingular = checkWord(\n irregularPlurals, irregularSingles, singularRules\n );\n\n /**\n * Add a pluralization rule to the collection.\n *\n * @param {(string|RegExp)} rule\n * @param {string} replacement\n */\n pluralize.addPluralRule = function (rule, replacement) {\n pluralRules.push([sanitizeRule(rule), replacement]);\n };\n\n /**\n * Add a singularization rule to the collection.\n *\n * @param {(string|RegExp)} rule\n * @param {string} replacement\n */\n pluralize.addSingularRule = function (rule, replacement) {\n singularRules.push([sanitizeRule(rule), replacement]);\n };\n\n /**\n * Add an uncountable word rule.\n *\n * @param {(string|RegExp)} word\n */\n pluralize.addUncountableRule = function (word) {\n if (typeof word === 'string') {\n uncountables[word.toLowerCase()] = true;\n return;\n }\n\n // Set singular and plural references for the word.\n pluralize.addPluralRule(word, '$0');\n pluralize.addSingularRule(word, '$0');\n };\n\n /**\n * Add an irregular word definition.\n *\n * @param {string} single\n * @param {string} plural\n */\n pluralize.addIrregularRule = function (single, plural) {\n plural = plural.toLowerCase();\n single = single.toLowerCase();\n\n irregularSingles[single] = plural;\n irregularPlurals[plural] = single;\n };\n\n /**\n * Irregular rules.\n */\n [\n // Pronouns.\n ['I', 'we'],\n ['me', 'us'],\n ['he', 'they'],\n ['she', 'they'],\n ['them', 'them'],\n ['myself', 'ourselves'],\n ['yourself', 'yourselves'],\n ['itself', 'themselves'],\n ['herself', 'themselves'],\n ['himself', 'themselves'],\n ['themself', 'themselves'],\n ['is', 'are'],\n ['was', 'were'],\n ['has', 'have'],\n ['this', 'these'],\n ['that', 'those'],\n // Words ending in with a consonant and `o`.\n ['echo', 'echoes'],\n ['dingo', 'dingoes'],\n ['volcano', 'volcanoes'],\n ['tornado', 'tornadoes'],\n ['torpedo', 'torpedoes'],\n // Ends with `us`.\n ['genus', 'genera'],\n ['viscus', 'viscera'],\n // Ends with `ma`.\n ['stigma', 'stigmata'],\n ['stoma', 'stomata'],\n ['dogma', 'dogmata'],\n ['lemma', 'lemmata'],\n ['schema', 'schemata'],\n ['anathema', 'anathemata'],\n // Other irregular rules.\n ['ox', 'oxen'],\n ['axe', 'axes'],\n ['die', 'dice'],\n ['yes', 'yeses'],\n ['foot', 'feet'],\n ['eave', 'eaves'],\n ['goose', 'geese'],\n ['tooth', 'teeth'],\n ['quiz', 'quizzes'],\n ['human', 'humans'],\n ['proof', 'proofs'],\n ['carve', 'carves'],\n ['valve', 'valves'],\n ['looey', 'looies'],\n ['thief', 'thieves'],\n ['groove', 'grooves'],\n ['pickaxe', 'pickaxes'],\n ['passerby', 'passersby']\n ].forEach(function (rule) {\n return pluralize.addIrregularRule(rule[0], rule[1]);\n });\n\n /**\n * Pluralization rules.\n */\n [\n [/s?$/i, 's'],\n [/[^\\u0000-\\u007F]$/i, '$0'],\n [/([^aeiou]ese)$/i, '$1'],\n [/(ax|test)is$/i, '$1es'],\n [/(alias|[^aou]us|t[lm]as|gas|ris)$/i, '$1es'],\n [/(e[mn]u)s?$/i, '$1s'],\n [/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i, '$1'],\n [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1i'],\n [/(alumn|alg|vertebr)(?:a|ae)$/i, '$1ae'],\n [/(seraph|cherub)(?:im)?$/i, '$1im'],\n [/(her|at|gr)o$/i, '$1oes'],\n [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i, '$1a'],\n [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i, '$1a'],\n [/sis$/i, 'ses'],\n [/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i, '$1$2ves'],\n [/([^aeiouy]|qu)y$/i, '$1ies'],\n [/([^ch][ieo][ln])ey$/i, '$1ies'],\n [/(x|ch|ss|sh|zz)$/i, '$1es'],\n [/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i, '$1ices'],\n [/\\b((?:tit)?m|l)(?:ice|ouse)$/i, '$1ice'],\n [/(pe)(?:rson|ople)$/i, '$1ople'],\n [/(child)(?:ren)?$/i, '$1ren'],\n [/eaux$/i, '$0'],\n [/m[ae]n$/i, 'men'],\n ['thou', 'you']\n ].forEach(function (rule) {\n return pluralize.addPluralRule(rule[0], rule[1]);\n });\n\n /**\n * Singularization rules.\n */\n [\n [/s$/i, ''],\n [/(ss)$/i, '$1'],\n [/(wi|kni|(?:after|half|high|low|mid|non|night|[^\\w]|^)li)ves$/i, '$1fe'],\n [/(ar|(?:wo|[ae])l|[eo][ao])ves$/i, '$1f'],\n [/ies$/i, 'y'],\n [/\\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i, '$1ie'],\n [/\\b(mon|smil)ies$/i, '$1ey'],\n [/\\b((?:tit)?m|l)ice$/i, '$1ouse'],\n [/(seraph|cherub)im$/i, '$1'],\n [/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i, '$1'],\n [/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i, '$1sis'],\n [/(movie|twelve|abuse|e[mn]u)s$/i, '$1'],\n [/(test)(?:is|es)$/i, '$1is'],\n [/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i, '$1us'],\n [/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i, '$1um'],\n [/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i, '$1on'],\n [/(alumn|alg|vertebr)ae$/i, '$1a'],\n [/(cod|mur|sil|vert|ind)ices$/i, '$1ex'],\n [/(matr|append)ices$/i, '$1ix'],\n [/(pe)(rson|ople)$/i, '$1rson'],\n [/(child)ren$/i, '$1'],\n [/(eau)x?$/i, '$1'],\n [/men$/i, 'man']\n ].forEach(function (rule) {\n return pluralize.addSingularRule(rule[0], rule[1]);\n });\n\n /**\n * Uncountable rules.\n */\n [\n // Singular words with no plurals.\n 'adulthood',\n 'advice',\n 'agenda',\n 'aid',\n 'aircraft',\n 'alcohol',\n 'ammo',\n 'analytics',\n 'anime',\n 'athletics',\n 'audio',\n 'bison',\n 'blood',\n 'bream',\n 'buffalo',\n 'butter',\n 'carp',\n 'cash',\n 'chassis',\n 'chess',\n 'clothing',\n 'cod',\n 'commerce',\n 'cooperation',\n 'corps',\n 'debris',\n 'diabetes',\n 'digestion',\n 'elk',\n 'energy',\n 'equipment',\n 'excretion',\n 'expertise',\n 'firmware',\n 'flounder',\n 'fun',\n 'gallows',\n 'garbage',\n 'graffiti',\n 'hardware',\n 'headquarters',\n 'health',\n 'herpes',\n 'highjinks',\n 'homework',\n 'housework',\n 'information',\n 'jeans',\n 'justice',\n 'kudos',\n 'labour',\n 'literature',\n 'machinery',\n 'mackerel',\n 'mail',\n 'media',\n 'mews',\n 'moose',\n 'music',\n 'mud',\n 'manga',\n 'news',\n 'only',\n 'personnel',\n 'pike',\n 'plankton',\n 'pliers',\n 'police',\n 'pollution',\n 'premises',\n 'rain',\n 'research',\n 'rice',\n 'salmon',\n 'scissors',\n 'series',\n 'sewage',\n 'shambles',\n 'shrimp',\n 'software',\n 'species',\n 'staff',\n 'swine',\n 'tennis',\n 'traffic',\n 'transportation',\n 'trout',\n 'tuna',\n 'wealth',\n 'welfare',\n 'whiting',\n 'wildebeest',\n 'wildlife',\n 'you',\n /pok[eé]mon$/i,\n // Regexes.\n /[^aeiou]ese$/i, // \"chinese\", \"japanese\"\n /deer$/i, // \"deer\", \"reindeer\"\n /fish$/i, // \"fish\", \"blowfish\", \"angelfish\"\n /measles$/i,\n /o[iu]s$/i, // \"carnivorous\"\n /pox$/i, // \"chickpox\", \"smallpox\"\n /sheep$/i\n ].forEach(pluralize.addUncountableRule);\n\n return pluralize;\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { z } from \"zod\";\n\nexport enum ModelAction {\n findUnique = \"findUnique\",\n findUniqueOrThrow = \"findUniqueOrThrow\",\n findFirst = \"findFirst\",\n findFirstOrThrow = \"findFirstOrThrow\",\n findMany = \"findMany\",\n create = \"create\",\n createMany = \"createMany\",\n createManyAndReturn = \"createManyAndReturn\",\n update = \"update\",\n updateMany = \"updateMany\",\n updateManyAndReturn = \"updateManyAndReturn\",\n upsert = \"upsert\",\n delete = \"delete\",\n deleteMany = \"deleteMany\",\n groupBy = \"groupBy\",\n count = \"count\", // TODO: count does not actually exist, why?\n aggregate = \"aggregate\",\n findRaw = \"findRaw\",\n aggregateRaw = \"aggregateRaw\"\n}\n\nconst modelActionEnum = z.nativeEnum(ModelAction);\n\nconst configBoolean = z\n .string()\n .trim()\n .transform(value =>\n !value ||\n value.toLowerCase() === \"false\" ||\n value.toLowerCase() === \"n\" ||\n value.toLowerCase() === \"no\" ||\n value === \"0\"\n ? false\n : value.toLowerCase() === \"true\" ||\n value.toLowerCase() === \"y\" ||\n value.toLowerCase() === \"yes\" ||\n value === \"1\"\n ? true\n : value\n );\n\nexport const configSchema = z.object({\n debug: configBoolean.default(\"false\"),\n withNext: configBoolean.default(\"true\"),\n withMiddleware: configBoolean.default(\"false\"),\n withShield: configBoolean.default(\"false\"),\n contextPath: z.string().trim().default(\"../context\"),\n trpcOptions: configBoolean.default(\"true\"),\n showModelNameInProcedure: configBoolean.default(\"false\"),\n generateModelActions: z\n .string()\n .default(Object.values(ModelAction).join(\",\"))\n .transform(arg => {\n return arg.split(\",\").map(action => modelActionEnum.parse(action.trim()));\n }),\n\n // Zod configuration\n withZod: configBoolean.default(\"true\"),\n relationModel: configBoolean.default(\"true\").or(z.literal(\"default\")),\n modelSuffix: z.string().default(\"Schema\"),\n modelCase: z.enum([\"PascalCase\", \"camelCase\"]).default(\"camelCase\"),\n useDecimalJs: configBoolean.default(\"true\"),\n imports: z.string().optional(),\n prismaJsonNullability: configBoolean.default(\"true\")\n});\n\nexport type Config = z.infer<typeof configSchema>;\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { CompilerOptions } from \"ts-morph\";\nimport { ModuleKind, Project, ScriptTarget } from \"ts-morph\";\n\nconst compilerOptions: CompilerOptions = {\n target: ScriptTarget.ESNext,\n module: ModuleKind.ESNext,\n emitDecoratorMetadata: true,\n experimentalDecorators: true,\n esModuleInterop: true\n};\n\nexport const project = new Project({\n compilerOptions: {\n ...compilerOptions\n }\n});\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Combine two strings with a space in between.\n *\n * @param acc - The accumulated string.\n * @param str - The string to add.\n * @returns The combined string.\n */\nexport function combine(acc: string, str: string): string {\n return `${acc} ${str}`;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Convert a camelCase or PascalCase string to a snake_case string.\n *\n * @param value - The camelCase or PascalCase string to convert.\n * @returns The converted snake_case string.\n */\nexport function decamelize(value: string): string {\n return value\n .replace(/([a-z\\d])([A-Z])/g, \"$1_$2\")\n .replace(/([A-Z]+)([A-Z][a-z\\d]+)/g, \"$1_$2\")\n .toLowerCase();\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * A running list of common acronyms and their meanings.\n *\n * @remarks\n * This list is not exhaustive and may be updated over time.\n */\nexport const ACRONYMS: Record<\n string,\n { description: string; display?: string }\n> = {\n \"2D\": { description: \"Two-Dimensional\", display: \"2d\" },\n \"3D\": { description: \"Three-Dimensional\", display: \"3d\" },\n \"4D\": { description: \"Four-Dimensional\", display: \"4d\" },\n \"5G\": { description: \"Fifth Generation (mobile networks)\" },\n \"6G\": { description: \"Sixth Generation (mobile networks)\" },\n \"7G\": { description: \"Seventh Generation (mobile networks)\" },\n \"8G\": { description: \"Eighth Generation (mobile networks)\" },\n \"ACID\": { description: \"Atomicity, Consistency, Isolation, Durability\" },\n \"AITA\": { description: \"Am I The Asshole\" },\n \"AES\": { description: \"Advanced Encryption Standard\" },\n \"AI\": { description: \"Artificial Intelligence\" },\n \"AJAX\": { description: \"Asynchronous JavaScript and XML\" },\n \"API\": { description: \"Application Programming Interface\" },\n \"AR\": { description: \"Augmented Reality\" },\n \"ASCII\": {\n description: \"American Standard Code for Information Interchange\"\n },\n \"ATF\": { description: \"Bureau of Alcohol, Tobacco, Firearms and Explosives\" },\n \"ATM\": { description: \"Automated Teller Machine\" },\n \"B2B\": { description: \"Business to Business\" },\n \"B2C\": { description: \"Business to Consumer\" },\n \"BATFE\": {\n description: \"Bureau of Alcohol, Tobacco, Firearms and Explosives\"\n },\n \"BFF\": { description: \"Best Friends Forever\" },\n \"BFFS\": { description: \"Best Friends Forever (plural)\" },\n \"BI\": { description: \"Business Intelligence\" },\n \"BIOS\": { description: \"Basic Input/Output System\" },\n \"BGP\": { description: \"Border Gateway Protocol\" },\n \"BOM\": { description: \"Bill of Materials / Byte Order Mark\" },\n \"BSON\": { description: \"Binary JSON\" },\n \"BYOD\": { description: \"Bring Your Own Device\" },\n \"C2C\": { description: \"Consumer to Consumer\" },\n \"CAGR\": { description: \"Compound Annual Growth Rate\" },\n \"CAPTCHA\": {\n description:\n \"Completely Automated Public Turing test to tell Computers and Humans Apart\"\n },\n \"CCTV\": { description: \"Closed-Circuit Television\" },\n \"CD\": { description: \"Continuous Delivery / Compact Disc\" },\n \"CDN\": { description: \"Content Delivery Network\" },\n \"CDP\": { description: \"Customer Data Platform\" },\n \"CDT\": { description: \"Central Daylight Time\" },\n \"CIA\": { description: \"Central Intelligence Agency\" },\n \"CI\": { description: \"Continuous Integration\" },\n \"CI/CD\": { description: \"Continuous Integration/Continuous Delivery\" },\n \"CIAM\": { description: \"Customer Identity and Access Management\" },\n \"CICD\": {\n description: \"Continuous Integration Continuous Delivery\",\n display: \"CI/CD\"\n },\n \"CLI\": { description: \"Command Line Interface\" },\n \"CMDB\": { description: \"Configuration Management Database\" },\n \"CORS\": { description: \"Cross-Origin Resource Sharing\" },\n \"CPA\": { description: \"Certified Public Accountant\" },\n \"CPU\": { description: \"Central Processing Unit\" },\n \"CRUD\": { description: \"Create, Read, Update, Delete\" },\n \"CSR\": {\n description: \"Certificate Signing Request / Corporate Social Responsibility\"\n },\n \"CSS\": { description: \"Cascading Style Sheets\" },\n \"CST\": { description: \"Central Standard Time\" },\n \"CTA\": { description: \"Call To Action\" },\n \"CWD\": { description: \"Current Working Directory\" },\n \"CX\": { description: \"Customer Experience\" },\n \"DAG\": { description: \"Directed Acyclic Graph\" },\n \"DBMS\": { description: \"Database Management System\" },\n \"DDOS\": { description: \"Distributed Denial of Service\", display: \"DDoS\" },\n \"DEA\": { description: \"Drug Enforcement Administration\" },\n \"DEVENV\": { description: \"Devenv\", display: \"Devenv\" },\n \"DEVOPS\": { description: \"Development Operations\", display: \"DevOps\" },\n \"DHS\": { description: \"Department of Homeland Security\" },\n \"DIRENV\": { description: \"DirEnv\", display: \"DirEnv\" },\n \"DNC\": { description: \"Democratic National Committee / Do Not Call\" },\n \"DNS\": { description: \"Domain Name System\" },\n \"DNSSEC\": { description: \"Domain Name System Security Extensions\" },\n \"DOD\": { description: \"Department of Defense\", display: \"DoD\" },\n \"DOJ\": { description: \"Department of Justice\", display: \"DoJ\" },\n \"DOM\": { description: \"Document Object Model\" },\n \"DOT\": { description: \"Department of Transportation\", display: \"DoT\" },\n \"DOTENV\": { description: \"Dotenv (.env)\", display: \"Dotenv\" },\n \"DR\": { description: \"Disaster Recovery\" },\n \"DRM\": { description: \"Digital Rights Management\" },\n \"DSN\": { description: \"Data Source Name\" },\n \"DWH\": { description: \"Data Warehouse\" },\n \"E2E\": { description: \"End to End\" },\n \"EAI\": { description: \"Enterprise Application Integration\" },\n \"EDT\": { description: \"Eastern Daylight Time\" },\n \"EEA\": { description: \"European Economic Area\" },\n \"EKS\": { description: \"Elastic Kubernetes Service\" },\n \"EOF\": { description: \"End Of File\" },\n \"EOD\": { description: \"End Of Day / Explosive Ordnance Disposal\" },\n \"EPA\": { description: \"Environmental Protection Agency\" },\n \"ER\": { description: \"Emergency Room / Entity Relationship\" },\n \"EST\": { description: \"Eastern Standard Time\" },\n \"ETC\": { description: \"Et Cetera\" },\n \"ETL\": { description: \"Extract, Transform, Load\" },\n \"EULA\": { description: \"End User License Agreement\" },\n \"FAAS\": { description: \"Function as a Service\", display: \"FaaS\" },\n \"FAQ\": { description: \"Frequently Asked Questions\", display: \"FAQs\" },\n \"FAQS\": { description: \"Frequently Asked Questions\" },\n \"FBI\": { description: \"Federal Bureau of Investigation\" },\n \"FCC\": { description: \"Federal Communications Commission\" },\n \"FDA\": { description: \"Food and Drug Administration\" },\n \"FIDO\": { description: \"Fast IDentity Online\" },\n \"FLOTUS\": { description: \"First Lady of the United States\" },\n \"FQDN\": { description: \"Fully Qualified Domain Name\" },\n \"FTC\": { description: \"Federal Trade Commission\" },\n \"FTP\": { description: \"File Transfer Protocol\" },\n \"GC\": { description: \"Garbage Collection\" },\n \"GCP\": { description: \"Google Cloud Platform\" },\n \"GDPR\": { description: \"General Data Protection Regulation\" },\n \"GMT\": { description: \"Greenwich Mean Time\" },\n \"GOP\": { description: \"Grand Old Party\" },\n \"GPU\": { description: \"Graphics Processing Unit\" },\n \"GUID\": { description: \"Globally Unique Identifier\" },\n \"GUI\": { description: \"Graphical User Interface\" },\n \"GZIP\": { description: \"GNU Zip\" },\n \"HCI\": {\n description: \"Human Computer Interaction / Hyper-Converged Infrastructure\"\n },\n \"HDD\": { description: \"Hard Disk Drive\" },\n \"HDFS\": { description: \"Hadoop Distributed File System\" },\n \"HHS\": { description: \"Health and Human Services\" },\n \"HIPAA\": {\n description: \"Health Insurance Portability and Accountability Act\"\n },\n \"HMAC\": { description: \"Hash-based Message Authentication Code\" },\n \"HOTP\": { description: \"HMAC-based One-Time Password\" },\n \"HSM\": { description: \"Hardware Security Module\" },\n \"HTML\": { description: \"HyperText Markup Language\" },\n \"HTTP\": { description: \"HyperText Transfer Protocol (HTTP)\" },\n \"HTTP/2\": { description: \"HyperText Transfer Protocol Version 2 (HTTP/2)\" },\n \"HTTP/2.0\": {\n description: \"HyperText Transfer Protocol Version 2 (HTTP/2)\",\n display: \"HTTP2\"\n },\n \"HTTP/3\": { description: \"HyperText Transfer Protocol Version 3 (HTTP/3)\" },\n \"HTTP/3.0\": {\n description: \"HyperText Transfer Protocol Version 3 (HTTP/3)\",\n display: \"HTTP3\"\n },\n \"HTTP2\": {\n description: \"HyperText Transfer Protocol Version 2 (HTTP/2)\",\n display: \"HTTP2\"\n },\n \"HTTP2.0\": {\n description: \"HyperText Transfer Protocol Version 2 (HTTP/2)\",\n display: \"HTTP2\"\n },\n \"HTTP3\": {\n description: \"HyperText Transfer Protocol Version 3 (HTTP/3)\",\n display: \"HTTP3\"\n },\n \"HTTP3.0\": {\n description: \"HyperText Transfer Protocol Version 3 (HTTP/3)\",\n display: \"HTTP3\"\n },\n \"HTTPS\": { description: \"HyperText Transfer Protocol Secure (HTTPS)\" },\n \"HTTPS/2\": {\n description: \"HyperText Transfer Protocol Secure Version 2 (HTTPS/2)\"\n },\n \"HTTPS/2.0\": {\n description: \"HyperText Transfer Protocol Secure Version 2 (HTTPS/2)\",\n display: \"HTTPS2\"\n },\n \"HTTPS/3\": {\n description: \"HyperText Transfer Protocol Secure Version 3 (HTTPS/3)\"\n },\n \"HTTPS/3.0\": {\n description: \"HyperText Transfer Protocol Secure Version 3 (HTTPS/3)\",\n display: \"HTTPS3\"\n },\n \"HTTPS2\": {\n description: \"HyperText Transfer Protocol Secure Version 2 (HTTPS/2)\",\n display: \"HTTPS2\"\n },\n \"HTTPS2.0\": {\n description: \"HyperText Transfer Protocol Secure Version 2 (HTTPS/2)\",\n display: \"HTTPS2\"\n },\n \"HTTPS3\": {\n description: \"HyperText Transfer Protocol Secure Version 3 (HTTPS/3)\",\n display: \"HTTPS3\"\n },\n \"HTTPS3.0\": {\n description: \"HyperText Transfer Protocol Secure Version 3 (HTTPS/3)\",\n display: \"HTTPS3\"\n },\n \"IAAS\": { description: \"Infrastructure as a Service\", display: \"IaaS\" },\n \"IAM\": { description: \"Identity and Access Management\" },\n \"IAMM\": { description: \"Identity and Access Management and Monitoring\" },\n \"IAMT\": { description: \"Identity and Access Management Tool\" },\n \"ID\": { description: \"Identifier\", display: \"Id\" },\n \"IFTTT\": { description: \"If This Then That\" },\n \"IMAP\": { description: \"Internet Message Access Protocol\" },\n \"IO\": { description: \"Input/Output\" },\n \"IP\": { description: \"Internet Protocol\" },\n \"IPFS\": { description: \"InterPlanetary File System\" },\n \"IPS\": { description: \"Intrusion Prevention System\" },\n \"ISO\": { description: \"International Organization for Standardization\" },\n \"IQ\": { description: \"Intelligence Quotient\", display: \"IQ\" },\n \"IOT\": { description: \"Internet of Things\", display: \"IoT\" },\n \"JSON\": { description: \"JavaScript Object Notation\" },\n \"JSONP\": { description: \"JSON with Padding\" },\n \"JWT\": { description: \"JSON Web Token\" },\n \"K8S\": { description: \"Kubernetes\", display: \"K8s\" },\n \"KMS\": { description: \"Key Management Service\" },\n \"KPI\": { description: \"Key Performance Indicator\" },\n \"KV\": { description: \"Key Value\" },\n \"LAN\": { description: \"Local Area Network\" },\n \"LHS\": { description: \"Left Hand Side\" },\n \"LPGA\": { description: \"Ladies Professional Golf Association\" },\n \"LXC\": { description: \"Linux Containers\" },\n \"MDT\": { description: \"Mountain Daylight Time\" },\n \"MFA\": { description: \"Multi-Factor Authentication\" },\n \"ML\": { description: \"Machine Learning\" },\n \"MLB\": { description: \"Major League Baseball\" },\n \"MLOps\": { description: \"Machine Learning Operations\" },\n \"MPA\": { description: \"Multi-Page Application\" },\n \"MST\": { description: \"Mountain Standard Time\" },\n \"MVC\": { description: \"Model View Controller\" },\n \"MVP\": { description: \"Minimum Viable Product / Most Valuable Player\" },\n \"NAIA\": { description: \"National Association of Intercollegiate Athletics\" },\n \"NAS\": { description: \"Network Attached Storage\" },\n \"NASA\": { description: \"National Aeronautics and Space Administration\" },\n \"NASCAR\": { description: \"National Association for Stock Car Auto Racing\" },\n \"NAT\": { description: \"Network Address Translation\" },\n \"NBA\": { description: \"National Basketball Association\" },\n \"NCAA\": { description: \"National Collegiate Athletic Association\" },\n \"NDA\": { description: \"Non-Disclosure Agreement\" },\n \"NFS\": { description: \"Network File System\" },\n \"NHL\": { description: \"National Hockey League\" },\n \"NIST\": { description: \"National Institute of Standards and Technology\" },\n \"NLP\": { description: \"Natural Language Processing\" },\n \"NPS\": { description: \"Net Promoter Score\" },\n \"NRA\": { description: \"National Rifle Association\" },\n \"NSFW\": { description: \"Not Safe For Work\" },\n \"NX\": { description: \"Nx\", display: \"Nx\" },\n \"OCR\": { description: \"Optical Character Recognition\" },\n \"OEM\": { description: \"Original Equipment Manufacturer\" },\n \"OKR\": { description: \"Objectives and Key Results\" },\n \"OLAP\": { description: \"Online Analytical Processing\" },\n \"OLTP\": { description: \"Online Transaction Processing\" },\n \"OOP\": { description: \"Object Oriented Programming\" },\n \"ORM\": { description: \"Object Relational Mapping\" },\n \"OS\": { description: \"Operating System\" },\n \"OSINT\": { description: \"Open Source Intelligence\" },\n \"OSS\": { description: \"Open Source Software\" },\n \"OTP\": { description: \"One-Time Password\" },\n \"P2P\": { description: \"Peer to Peer\" },\n \"PAAS\": { description: \"Platform as a Service\", display: \"PaaS\" },\n \"PCI\": { description: \"Payment Card Industry\" },\n \"PDP\": { description: \"Policy Decision Point / Product Detail Page\" },\n \"PDT\": { description: \"Pacific Daylight Time\" },\n \"PGA\": { description: \"Professional Golfers' Association\" },\n \"POTUS\": { description: \"President of the United States\" },\n \"PP\": { description: \"Pages / PayPal / Percentage Points\" },\n \"PST\": { description: \"Pacific Standard Time\" },\n \"PTO\": { description: \"Paid Time Off / Power Take-Off\" },\n \"PKI\": { description: \"Public Key Infrastructure\" },\n \"PWA\": { description: \"Progressive Web App\" },\n \"PX\": { description: \"Pixel\" },\n \"QA\": { description: \"Quality Assurance\" },\n \"R2\": { description: \"R2\" },\n \"RAID\": { description: \"Redundant Array of Independent Disks\" },\n \"RAM\": { description: \"Random Access Memory\" },\n \"RDS\": { description: \"Relational Database Service\" },\n \"REST\": { description: \"Representational State Transfer\" },\n \"RHS\": { description: \"Right Hand Side\" },\n \"ROI\": { description: \"Return on Investment\" },\n \"RPC\": { description: \"Remote Procedure Call\" },\n \"RPA\": { description: \"Robotic Process Automation\" },\n \"RSC\": { description: \"React Server Components\" },\n \"RSS\": { description: \"Really Simple Syndication\" },\n \"RUM\": { description: \"Real User Monitoring\" },\n \"S3\": { description: \"Simple Storage Service (S3)\" },\n \"SAN\": { description: \"Storage Area Network\" },\n \"SASE\": { description: \"Secure Access Service Edge\" },\n \"SCOTUS\": { description: \"Supreme Court of the United States\" },\n \"SDLC\": { description: \"Software Development Life Cycle\" },\n \"SDK\": { description: \"Software Development Kit\" },\n \"SEC\": { description: \"Securities and Exchange Commission\" },\n \"SEO\": { description: \"Search Engine Optimization\" },\n \"SFTP\": {\n description: \"SSH File Transfer Protocol / Secure File Transfer Protocol\"\n },\n \"SIEM\": { description: \"Security Information and Event Management\" },\n \"SLA\": { description: \"Service Level Agreement\" },\n \"SMB\": { description: \"Server Message Block / Small and Medium Business\" },\n \"SMTP\": { description: \"Simple Mail Transfer Protocol\" },\n \"SOAP\": { description: \"Simple Object Access Protocol\" },\n \"SOA\": { description: \"Service Oriented Architecture\" },\n \"SOC\": { description: \"Security Operations Center / System on Chip\" },\n \"SPA\": { description: \"Single Page Application\" },\n \"SPDY\": { description: 'Speedy (pronounced \"SPeeDY\")' },\n \"SPF\": { description: \"Sender Policy Framework\" },\n \"SQL\": { description: \"Structured Query Language\" },\n \"SRV\": { description: \"Service\" },\n \"SRE\": { description: \"Site Reliability Engineering\" },\n \"SSH\": { description: \"Secure Shell\" },\n \"SSDL\": { description: \"Secure Software Development Lifecycle\" },\n \"SSG\": { description: \"Static Site Generation\" },\n \"SSR\": { description: \"Server Side Rendering\" },\n \"SSO\": { description: \"Single Sign-On\" },\n \"SSL\": { description: \"Secure Sockets Layer\" },\n \"TDD\": { description: \"Test Driven Development\" },\n \"TLD\": { description: \"Top Level Domain\" },\n \"TLS\": { description: \"Transport Layer Security\" },\n \"TLS1.3\": { description: \"Transport Layer Security 1.3\" },\n \"TOR\": { description: \"The Onion Router\" },\n \"TOTP\": { description: \"Time-based One-Time Password\" },\n \"TRPC\": { description: \"TypeScript Remote Procedure Call\" },\n \"TSA\": { description: \"Transportation Security Administration\" },\n \"TTL\": { description: \"Time To Live\" },\n \"UDP\": { description: \"User Datagram Protocol\" },\n \"UI\": { description: \"User Interface\" },\n \"UID\": { description: \"Unique Identifier\" },\n \"URI\": { description: \"Uniform Resource Identifier\" },\n \"URL\": { description: \"Uniform Resource Locator\" },\n \"USOPC\": { description: \"United States Olympic & Paralympic Committee\" },\n \"USPS\": { description: \"United States Postal Service\" },\n \"USTA\": { description: \"United States Tennis Association\" },\n \"UTF\": { description: \"Unicode Transformation Format\" },\n \"UTC\": { description: \"Coordinated Universal Time\" },\n \"UUID\": { description: \"Universally Unique Identifier\" },\n \"UX\": { description: \"User Experience\" },\n \"VM\": { description: \"Virtual Machine\" },\n \"VLAN\": { description: \"Virtual Local Area Network\" },\n \"VPN\": { description: \"Virtual Private Network\" },\n \"VPPA\": { description: \"Video Privacy Protection Act\" },\n \"VR\": { description: \"Virtual Reality\" },\n \"WAF\": { description: \"Web Application Firewall\" },\n \"WAN\": { description: \"Wide Area Network\" },\n \"WNBA\": { description: \"Women's National Basketball Association\" },\n \"WLAN\": { description: \"Wireless Local Area Network\" },\n \"WPA\": { description: \"Wi-Fi Protected Access\" },\n \"WPA2\": { description: \"Wi-Fi Protected Access II\" },\n \"WPA3\": { description: \"Wi-Fi Protected Access III\" },\n \"WWW\": { description: \"World Wide Web\" },\n \"WYSIWYG\": { description: \"What You See Is What You Get\" },\n \"XACML\": { description: \"eXtensible Access Control Markup Language\" },\n \"XDG\": { description: \"Cross-Desktop Group\" },\n \"XML\": { description: \"eXtensible Markup Language\" },\n \"XSRF\": { description: \"Cross-Site Request Forgery\" },\n \"XSS\": { description: \"Cross-Site Scripting\" },\n \"XR\": { description: \"Extended Reality\" },\n \"YAML\": { description: \"YAML Ain't Markup Language\" },\n \"YMCA\": { description: \"Young Men's Christian Association\" },\n \"YWCA\": { description: \"Young Women's Christian Association\" },\n \"ZTA\": { description: \"Zero Trust Architecture\" }\n} as const;\n\nexport const ACRONYM_DISPLAY: Record<string, string> = Object.fromEntries(\n Object.entries(ACRONYMS).map(([key, value]) => [key, value.display ?? key])\n);\n\nexport const ACRONYM_DESCRIPTION: Record<string, string> = Object.fromEntries(\n Object.entries(ACRONYMS).map(([key, value]) => [key, value.description])\n);\n\nexport const ACRONYM_LIST: string[] = Object.keys(ACRONYMS);\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const ARTICLES = [\"a\", \"an\", \"the\"];\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const CONJUNCTIONS = [\n \"and\",\n \"that\",\n \"but\",\n \"or\",\n \"as\",\n \"if\",\n \"when\",\n \"than\",\n \"because\",\n \"while\",\n \"where\",\n \"after\",\n \"so\",\n \"though\",\n \"since\",\n \"until\",\n \"whether\",\n \"before\",\n \"although\",\n \"nor\",\n \"like\",\n \"once\",\n \"unless\",\n \"now\",\n \"except\"\n];\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const PREPOSITIONS = [\n \"about\",\n \"above\",\n \"across\",\n \"after\",\n \"against\",\n \"along\",\n \"among\",\n \"around\",\n \"at\",\n \"because of\",\n \"before\",\n \"behind\",\n \"below\",\n \"beneath\",\n \"beside\",\n \"besides\",\n \"between\",\n \"beyond\",\n \"but\",\n \"by\",\n \"concerning\",\n \"despite\",\n \"down\",\n \"during\",\n \"except\",\n \"excepting\",\n \"for\",\n \"from\",\n \"in\",\n \"in front of\",\n \"inside\",\n \"in spite of\",\n \"instead of\",\n \"into\",\n \"like\",\n \"near\",\n \"of\",\n \"off\",\n \"on\",\n \"onto\",\n \"out\",\n \"outside\",\n \"over\",\n \"past\",\n \"regarding\",\n \"since\",\n \"through\",\n \"throughout\",\n \"to\",\n \"toward\",\n \"under\",\n \"underneath\",\n \"until\",\n \"up\",\n \"upon\",\n \"up to\",\n \"with\",\n \"within\",\n \"without\",\n \"with regard to\",\n \"with respect to\"\n];\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const SPECIAL_CASES = [\n \"2FA\",\n \"4K\",\n \"5K\",\n \"8K\",\n \"AGI\",\n \"BI\",\n \"ChatGPT\",\n \"CTA\",\n \"DateTime\",\n \"FMS\",\n \"GitHub\",\n \"GPT\",\n \"HD\",\n \"IBMid\",\n \"IDs\",\n \"iMac\",\n \"IMAX\",\n \"iOS\",\n \"iPad\",\n \"iPhone\",\n \"iPod\",\n \"LDAP\",\n \"LinkedIn\",\n \"LLM\",\n \"macOS\",\n \"McDonalds\",\n \"MCP\",\n \"ML\",\n \"MySQL\",\n \"NLG\",\n \"NLP\",\n \"NLU\",\n \"OpenAI\",\n \"PDFs\",\n \"PIM\",\n \"PEFT\",\n \"pH\",\n \"PostgreSQL\",\n \"SEO\",\n \"TTS\",\n \"UHD\",\n \"UUID\",\n \"XSS\",\n \"YouTube\",\n \"CSpell\",\n \"ESLint\"\n];\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { ACRONYMS } from \"./acronyms\";\nimport { ARTICLES } from \"./articles\";\nimport { CONJUNCTIONS } from \"./conjunctions\";\nimport { PREPOSITIONS } from \"./prepositions\";\nimport { SPECIAL_CASES } from \"./special-cases\";\n\nexport interface FormatSpecialCasesOptions {\n /**\n * If true, use the descriptions from the acronym list instead of the display names.\n *\n * @defaultValue true\n */\n useDescriptions?: boolean;\n}\n\n/**\n * Handle special words in a title.\n *\n * @see https://apastyle.apa.org/style-grammar-guidelines/capitalization/title-case\n *\n * @param value - The word to handle\n * @param index - The index of the word in the title\n * @param words - The full title as an array of words\n * @returns The formatted word\n */\nexport function formatSpecialCases(\n value: string,\n index: number,\n words: string[],\n options?: FormatSpecialCasesOptions\n): string {\n const lowercaseStr = value.toLowerCase();\n const uppercaseStr = value.toUpperCase();\n\n for (const special of SPECIAL_CASES) {\n if (special.toLowerCase() === lowercaseStr) {\n return special;\n }\n }\n\n if (ACRONYMS[uppercaseStr]) {\n return options?.useDescriptions !== false\n ? ACRONYMS[uppercaseStr].description\n : ACRONYMS[uppercaseStr].display || uppercaseStr;\n }\n\n // If the word is the first word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === 0) {\n return value;\n }\n\n // If the word is the last word in the sentence, but it's not a specially\n // cased word or an acronym, return the capitalized string\n if (index === words.length - 1) {\n return value;\n }\n\n // Return the word capitalized if it's 4 characters or more\n if (value.length >= 4) {\n return value;\n }\n\n if (PREPOSITIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (CONJUNCTIONS.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n if (ARTICLES.includes(lowercaseStr)) {\n return lowercaseStr;\n }\n\n return value;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\n/**\n * Upper case the first character of an input string.\n *\n * @remarks\n * \"Thisisanexample\"\n *\n * @param input - The input string.\n * @returns The capitalized string.\n */\nexport function upperCaseFirst<T extends string | undefined>(input?: T): T {\n return (input ? input.charAt(0).toUpperCase() + input.slice(1) : input) as T;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { combine } from \"./combine\";\nimport { decamelize } from \"./decamelize\";\nimport type { FormatSpecialCasesOptions } from \"./format-special-cases\";\nimport { formatSpecialCases } from \"./format-special-cases\";\nimport { upperCaseFirst } from \"./upper-case-first\";\n\n/**\n * Convert a string to title case.\n *\n * @param input - The input string to convert.\n * @param options - Options for formatting special cases.\n * @returns The title cased string.\n */\nexport function titleCase<T extends string | undefined>(\n input: T,\n options?: FormatSpecialCasesOptions\n): T {\n return input\n ?.split(/\\s+-\\s+/)\n .map(segment =>\n decamelize(segment)\n .split(/[\\s\\-_]/)\n .map(upperCaseFirst)\n .map((value: string, index: number, array: string[]) =>\n formatSpecialCases(value, index, array, options)\n )\n .reduce(combine)\n )\n .join(\" - \") as T;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n// Forked from https://www.npmjs.com/package/env-paths\n\nconst homedir = os.homedir();\nconst tmpdir = os.tmpdir();\n\n/**\n * Options for the `getEnvPaths` function.\n */\nexport interface GetEnvPathsOptions {\n /**\n * The name of the organization\n *\n * @defaultValue \"storm-software\"\n */\n orgId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * For example: `~/ ... /storm-software/Log/<appId>`\n */\n appId?: string;\n\n /**\n * The name of the specific application to use as a nested folder inside the organization's folder\n *\n * When a value is provided, it will use `~/ ... /storm-software/Log/<appId>/<nestedDir>`\n *\n * @remarks\n * If no child is provided, it will use `~/ ... /storm-software/Log/<appId>`\n */\n nestedDir?: string;\n\n /**\n * The suffix to append to the project name.\n *\n * @remarks\n * If `suffix` is `true`, the project name will be suffixed with `\"nodejs\"`.\n *\n * @defaultValue false\n */\n suffix?: string | boolean | null;\n\n /**\n * The root directory of the workspace that is used for determining the `cache` and `tmp` paths if they were not already set by other means.\n */\n workspaceRoot?: string;\n}\n\nexport interface EnvPaths {\n data: string;\n config: string;\n cache: string;\n log: string;\n temp: string;\n}\n\nconst macos = (orgId: string): EnvPaths => {\n const library = joinPaths(homedir, \"Library\");\n\n return {\n data: joinPaths(library, \"Application Support\", orgId),\n config: joinPaths(library, \"Preferences\", orgId),\n cache: joinPaths(library, \"Caches\", orgId),\n log: joinPaths(library, \"Logs\", orgId),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\nconst windows = (orgId: string): EnvPaths => {\n const appData =\n process.env.APPDATA || joinPaths(homedir, \"AppData\", \"Roaming\");\n const localAppData =\n process.env.LOCALAPPDATA || joinPaths(homedir, \"AppData\", \"Local\");\n\n const windowsFormattedOrgId = titleCase(orgId).trim().replace(/\\s+/g, \"\");\n\n return {\n // Data/config/cache/log are invented by me as Windows isn't opinionated about this\n data: joinPaths(localAppData, windowsFormattedOrgId, \"Data\"),\n config: joinPaths(appData, windowsFormattedOrgId, \"Config\"),\n cache: joinPaths(localAppData, \"Cache\", orgId),\n log: joinPaths(localAppData, windowsFormattedOrgId, \"Log\"),\n temp: joinPaths(tmpdir, orgId)\n };\n};\n\n// https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html\nconst linux = (orgId: string): EnvPaths => {\n const username = path.basename(homedir);\n\n return {\n data: joinPaths(\n process.env.XDG_DATA_HOME || joinPaths(homedir, \".local\", \"share\"),\n orgId\n ),\n config: joinPaths(\n process.env.XDG_CONFIG_HOME || joinPaths(homedir, \".config\"),\n orgId\n ),\n cache: joinPaths(\n process.env.XDG_CACHE_HOME || joinPaths(homedir, \".cache\"),\n orgId\n ),\n // https://wiki.debian.org/XDGBaseDirectorySpecification#state\n log: joinPaths(\n process.env.XDG_STATE_HOME || joinPaths(homedir, \".local\", \"state\"),\n orgId\n ),\n // https://devenv.sh/files-and-variables/#devenv_root\n temp:\n process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR\n ? joinPaths(\n (process.env.DEVENV_RUNTIME || process.env.XDG_RUNTIME_DIR)!,\n orgId\n )\n : joinPaths(tmpdir, username, orgId)\n };\n};\n\n/**\n * Get paths for storing things like data, config, logs, and cache in the current runtime environment.\n *\n * @remarks\n * On macOS, directories are generally created in `~/Library/Application Support/<name>`.\n * On Windows, directories are generally created in `%AppData%/<name>`.\n * On Linux, directories are generally created in `~/.config/<name>` - this is determined via the [XDG Base Directory spec](https://specifications.freedesktop.org/basedir-spec/latest/).\n *\n * If the `STORM_DATA_DIR`, `STORM_CONFIG_DIR`, `STORM_CACHE_DIR`, `STORM_LOG_DIR`, or `STORM_TEMP_DIR` environment variables are set, they will be used instead of the default paths.\n *\n * @param options - Parameters used to determine the specific paths for the current project/runtime environment\n * @returns An object containing the various paths for the runtime environment\n */\nexport function getEnvPaths(options: GetEnvPathsOptions = {}): EnvPaths {\n let orgId = options.orgId || \"storm-software\";\n if (!orgId) {\n throw new Error(\n \"You need to provide an orgId to the `getEnvPaths` function\"\n );\n }\n\n if (options.suffix) {\n // Add suffix to prevent possible conflict with native apps\n orgId += `-${typeof options.suffix === \"string\" ? options.suffix : \"nodejs\"}`;\n }\n\n let result = {} as EnvPaths;\n\n if (process.platform === \"darwin\") {\n result = macos(orgId);\n } else if (process.platform === \"win32\") {\n result = windows(orgId);\n } else {\n result = linux(orgId);\n }\n\n if (process.env.STORM_DATA_DIR) {\n result.data = process.env.STORM_DATA_DIR;\n } else if (process.env.STORM_CONFIG_DIR) {\n result.config = process.env.STORM_CONFIG_DIR;\n } else if (process.env.STORM_CACHE_DIR) {\n result.cache = process.env.STORM_CACHE_DIR;\n } else if (process.env.STORM_LOG_DIR) {\n result.log = process.env.STORM_LOG_DIR;\n } else if (process.env.STORM_TEMP_DIR) {\n result.temp = process.env.STORM_TEMP_DIR;\n }\n\n if (options.workspaceRoot) {\n result.cache ??= joinPaths(\n options.workspaceRoot,\n \"node_modules\",\n \".cache\",\n orgId\n );\n result.temp ??= joinPaths(options.workspaceRoot, \"tmp\", orgId);\n result.log ??= joinPaths(result.temp, \"logs\");\n result.config ??= joinPaths(options.workspaceRoot, \".config\", orgId);\n }\n\n return Object.keys(result).reduce((ret, key) => {\n if (result[key as keyof EnvPaths]) {\n const filePath = result[key as keyof EnvPaths];\n\n ret[key as keyof EnvPaths] =\n options.appId &&\n options.appId !== options.orgId &&\n options.appId !== options.nestedDir\n ? joinPaths(filePath, options.appId)\n : filePath;\n\n if (\n options.nestedDir &&\n options.nestedDir !== options.orgId &&\n options.nestedDir !== options.appId\n ) {\n ret[key as keyof EnvPaths] = joinPaths(\n ret[key as keyof EnvPaths],\n options.nestedDir\n );\n }\n }\n\n return ret;\n }, {} as EnvPaths);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { getWorkspaceRoot } from \"@stryke/fs/get-workspace-root\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport type { Jiti } from \"jiti\";\nimport { createJiti } from \"jiti\";\n\nlet jiti!: Jiti;\n\nexport function getJiti() {\n if (!jiti) {\n const envPaths = getEnvPaths();\n\n jiti = createJiti(getWorkspaceRoot(), {\n fsCache: joinPaths(envPaths.cache, \"jiti\"),\n interopDefault: true\n });\n }\n\n return jiti;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF, EnvValue } from \"@prisma/generator-helper\";\nimport type { Handler } from \"@prisma/generator-helper/dist/generatorHandler\";\nimport type { GetDMMFOptions } from \"@prisma/internals\";\nimport { getJiti } from \"./get-jiti\";\n\nexport async function getPrismaInternals() {\n return getJiti().import<{\n parseEnvValue: (p: EnvValue) => string;\n getDMMF: (options: GetDMMFOptions) => Promise<DMMF.Document>;\n }>(getJiti().esmResolve(\"@prisma/internals\"));\n}\n\nexport async function getPrismaGeneratorHelper() {\n return getJiti().import<{\n generatorHandler: (handler: Handler) => void;\n }>(getJiti().esmResolve(\"@prisma/generator-helper\"));\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { ArrayTree } from \"parenthesis\";\nimport parenthesis from \"parenthesis\";\nimport { chunk } from \"./model-helpers\";\n\nexport const getJSDocs = (docString?: string) => {\n const lines: string[] = [];\n\n if (docString) {\n const docLines = docString\n .split(\"\\n\")\n .filter(dL => !dL.trimStart().startsWith(\"@zod\"));\n\n if (docLines.length) {\n lines.push(\"/**\");\n docLines.forEach(dL => lines.push(` * ${dL}`));\n lines.push(\" */\");\n }\n }\n\n return lines;\n};\n\nexport const getZodDocElements = (docString: string) =>\n docString\n .split(\"\\n\")\n .filter(line => line.trimStart().startsWith(\"@zod\"))\n .map(line => line.trimStart().slice(4))\n .flatMap(line =>\n // Array.from(line.matchAll(/\\.([^().]+\\(.*?\\))/g), (m) => m.slice(1)).flat()\n chunk(parenthesis.parse(line), 2)\n .slice(0, -1)\n .map(\n ([each, contents]) =>\n `${(each as string).replace(\n /\\)?\\./,\n \"\"\n )}${parenthesis.stringify(contents as ArrayTree)})`\n )\n );\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type {\n DMMF,\n EnvValue,\n GeneratorOptions\n} from \"@prisma/generator-helper\";\nimport { lowerCaseFirst } from \"@stryke/string-format/lower-case-first\";\nimport path from \"node:path\";\nimport type {\n CodeBlockWriter,\n ImportDeclarationStructure,\n SourceFile\n} from \"ts-morph\";\nimport { StructureKind, VariableDeclarationKind } from \"ts-morph\";\nimport type { Config } from \"../config\";\nimport { getPrismaInternals } from \"../utils/get-prisma-internals\";\nimport { getJSDocs, getZodDocElements } from \"./docs-helpers\";\n\nexport function checkModelHasModelRelation(model: DMMF.Model) {\n const { fields: modelFields } = model;\n for (const modelField of modelFields) {\n const isRelationField = checkIsModelRelationField(modelField);\n if (isRelationField) {\n return true;\n }\n }\n return false;\n}\n\nexport function checkModelHasManyModelRelation(model: DMMF.Model) {\n const { fields: modelFields } = model;\n for (const modelField of modelFields) {\n const isManyRelationField = checkIsManyModelRelationField(modelField);\n if (isManyRelationField) {\n return true;\n }\n }\n return false;\n}\n\nexport function checkIsModelRelationField(modelField: DMMF.Field) {\n const { kind, relationName } = modelField;\n\n return kind === \"object\" && !!relationName;\n}\n\nexport function checkIsManyModelRelationField(modelField: DMMF.Field) {\n return checkIsModelRelationField(modelField) && modelField.isList;\n}\n\nexport function findModelByName(models: DMMF.Model[], modelName: string) {\n return models.find(({ name }) => name === modelName);\n}\n\nexport const writeArray = (\n writer: CodeBlockWriter,\n array: string[],\n newLine = true\n) => array.forEach(line => writer.write(line).conditionalNewLine(newLine));\n\nexport const useModelNames = ({\n modelCase,\n modelSuffix,\n relationModel\n}: Config) => {\n const formatModelName = (name: string, prefix = \"\") => {\n if (modelCase === \"camelCase\") {\n name = name.slice(0, 1).toLowerCase() + name.slice(1);\n }\n return `${prefix}${name}${modelSuffix}`;\n };\n\n return {\n modelName: (name: string) =>\n formatModelName(name, relationModel === \"default\" ? \"_\" : \"\"),\n relatedModelName: (\n name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg\n ) =>\n formatModelName(\n relationModel === \"default\"\n ? name.toString()\n : `Related${name.toString()}`\n )\n };\n};\n\nexport const dotSlash = (input: string) => {\n const converted = input\n .replace(/^\\\\\\\\\\?\\\\/, \"\")\n .replace(/\\\\/g, \"/\")\n .replace(/\\/{2,}/g, \"/\");\n\n if (converted.includes(`/node_modules/`))\n return converted.split(`/node_modules/`).slice(-1)[0];\n\n if (converted.startsWith(`../`)) return converted;\n\n return `./${converted}`;\n};\n\nexport const chunk = <T extends any[]>(input: T, size: number): T[] => {\n return input.reduce((arr, item, idx) => {\n return idx % size === 0\n ? [...arr, [item]]\n : [...(arr as T).slice(0, -1), [...(arr as T).slice(-1)[0], item]];\n }, []);\n};\n\nexport const needsRelatedModel = (model: DMMF.Model, config: Config) =>\n model.fields.some(field => field.kind === \"object\") &&\n config.relationModel !== false;\n\nexport const writeImportsForModel = async (\n model: DMMF.Model,\n sourceFile: SourceFile,\n config: Config,\n options: GeneratorOptions\n) => {\n const internals = await getPrismaInternals();\n\n const outputPath = internals.parseEnvValue(\n options.generator.output as EnvValue\n );\n\n const { relatedModelName } = useModelNames(config);\n const importList: ImportDeclarationStructure[] = [\n {\n kind: StructureKind.ImportDeclaration,\n namespaceImport: \"z\",\n moduleSpecifier: \"zod\"\n }\n ];\n\n if (config.imports) {\n importList.push({\n kind: StructureKind.ImportDeclaration,\n namespaceImport: \"imports\",\n moduleSpecifier: dotSlash(\n path.relative(\n outputPath,\n path.resolve(path.dirname(options.schemaPath), config.imports)\n )\n )!\n });\n }\n\n if (config.useDecimalJs && model.fields.some(f => f.type === \"Decimal\")) {\n importList.push({\n kind: StructureKind.ImportDeclaration,\n namedImports: [\"Decimal\"],\n moduleSpecifier: \"decimal.js\"\n });\n }\n\n const enumFields = model.fields.filter(f => f.kind === \"enum\");\n const relationFields = model.fields.filter(f => f.kind === \"object\");\n\n const clientPath = options.otherGenerators.find(\n each => each.provider.value === \"prisma-client-js\"\n )!.output!.value!;\n\n const relativePath = path.relative(outputPath, clientPath);\n\n if (enumFields.length > 0) {\n importList.push({\n kind: StructureKind.ImportDeclaration,\n isTypeOnly: enumFields.length === 0,\n moduleSpecifier: dotSlash(relativePath)!,\n namedImports: enumFields.map(f => f.type)\n });\n }\n\n if (config.relationModel !== false && relationFields.length > 0) {\n const filteredFields = relationFields.filter(f => f.type !== model.name);\n\n if (filteredFields.length > 0) {\n importList.push({\n kind: StructureKind.ImportDeclaration,\n moduleSpecifier: \"./index\",\n namedImports: Array.from(\n new Set(\n filteredFields.flatMap(f => [`${f.type}`, relatedModelName(f.type)])\n )\n )\n });\n }\n }\n\n sourceFile.addImportDeclarations(importList);\n};\n\nexport const computeCustomSchema = (docString: string) => {\n return getZodDocElements(docString)\n .find(modifier => modifier.startsWith(\"custom(\"))\n ?.slice(7)\n .slice(0, -1);\n};\n\nexport const computeModifiers = (docString: string) => {\n return getZodDocElements(docString).filter(\n each => !each.startsWith(\"custom(\")\n );\n};\n\nexport const getZodConstructor = (\n field: DMMF.Field,\n getRelatedModelName = (\n name: string | DMMF.SchemaEnum | DMMF.OutputType | DMMF.SchemaArg\n ) => name.toString()\n) => {\n let zodType = \"z.unknown()\";\n const extraModifiers: string[] = [\"\"];\n if (field.kind === \"scalar\") {\n switch (field.type) {\n case \"String\":\n zodType = \"z.string()\";\n break;\n case \"Int\":\n zodType = \"z.number()\";\n extraModifiers.push(\"int()\");\n break;\n case \"BigInt\":\n zodType = \"z.bigint()\";\n break;\n case \"DateTime\":\n zodType = \"z.date()\";\n break;\n case \"Float\":\n zodType = \"z.number()\";\n break;\n case \"Decimal\":\n zodType = \"z.number()\";\n break;\n case \"Json\":\n zodType = \"jsonSchema\";\n break;\n case \"Boolean\":\n zodType = \"z.boolean()\";\n break;\n // TODO: Proper type for bytes fields\n case \"Bytes\":\n zodType = \"z.unknown()\";\n break;\n }\n } else if (field.kind === \"enum\") {\n zodType = `z.nativeEnum(${field.type})`;\n } else if (field.kind === \"object\") {\n zodType = getRelatedModelName(field.type);\n }\n\n if (field.isList) extraModifiers.push(\"array()\");\n if (field.documentation) {\n zodType = computeCustomSchema(field.documentation) ?? zodType;\n extraModifiers.push(...computeModifiers(field.documentation));\n }\n if (!field.isRequired && field.type !== \"Json\")\n extraModifiers.push(\"nullish()\");\n // if (field.hasDefaultValue) extraModifiers.push('optional()')\n\n return `${zodType}${extraModifiers.join(\".\")}`;\n};\n\nexport const writeTypeSpecificSchemas = (\n model: DMMF.Model,\n sourceFile: SourceFile,\n config: Config\n) => {\n if (model.fields.some(f => f.type === \"Json\")) {\n sourceFile.addStatements(writer => {\n writer.newLine();\n writeArray(writer, [\n \"// Helper schema for JSON fields\",\n `type Literal = boolean | number | string${\n config.prismaJsonNullability ? \"\" : \"| null\"\n }`,\n \"type Json = Literal | { [key: string]: Json } | Json[]\",\n `const literalSchema = z.union([z.string(), z.number(), z.boolean()${\n config.prismaJsonNullability ? \"\" : \", z.null()\"\n }])`,\n \"const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.array(jsonSchema), z.record(jsonSchema)]))\"\n ]);\n });\n }\n\n if (config.useDecimalJs && model.fields.some(f => f.type === \"Decimal\")) {\n sourceFile.addStatements(writer => {\n writer.newLine();\n writeArray(writer, [\n \"// Helper schema for Decimal fields\",\n \"z\",\n \".instanceof(Decimal)\",\n \".or(z.string())\",\n \".or(z.number())\",\n \".refine((value) => {\",\n \" try {\",\n \" return new Decimal(value);\",\n \" } catch (error) {\",\n \" return false;\",\n \" }\",\n \"})\",\n \".transform((value) => new Decimal(value));\"\n ]);\n });\n }\n};\n\nexport const generateSchemaForModel = (\n model: DMMF.Model,\n sourceFile: SourceFile,\n config: Config\n) => {\n const { modelName } = useModelNames(config);\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n leadingTrivia: writer => writer.blankLineIfLastNot(),\n declarations: [\n {\n name: modelName(model.name),\n initializer(writer) {\n writer\n .write(\"z.object(\")\n .inlineBlock(() => {\n model.fields\n .filter(f => f.kind !== \"object\")\n .forEach(field => {\n writeArray(writer, getJSDocs(field.documentation));\n writer\n .write(`${field.name}: ${getZodConstructor(field)}`)\n .write(\",\")\n .newLine();\n });\n })\n .write(\")\");\n }\n }\n ]\n });\n};\n\nexport const generateRelatedSchemaForModel = (\n model: DMMF.Model,\n sourceFile: SourceFile,\n config: Config\n) => {\n const { modelName, relatedModelName } = useModelNames(config);\n\n const relationFields = model.fields.filter(f => f.kind === \"object\");\n\n sourceFile.addInterface({\n name: `${model.name}`,\n isExported: true,\n extends: [`z.infer<typeof ${modelName(model.name)}>`],\n properties: relationFields.map(f => ({\n hasQuestionToken: !f.isRequired,\n name: f.name,\n type: `${f.type}${f.isList ? \"[]\" : \"\"}${!f.isRequired ? \" | null\" : \"\"}`\n }))\n });\n\n sourceFile.addStatements(writer =>\n writeArray(writer, [\n \"\",\n \"/**\",\n ` * ${relatedModelName(\n model.name\n )} contains all relations on your model in addition to the scalars`,\n \" *\",\n \" * NOTE: Lazy required in case of potential circular dependencies within schema\",\n \" */\"\n ])\n );\n\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: relatedModelName(model.name),\n type: `z.ZodSchema<${model.name}>`,\n initializer(writer) {\n writer\n .write(`z.lazy(() => ${modelName(model.name)}.extend(`)\n .inlineBlock(() => {\n relationFields.forEach(field => {\n writeArray(writer, getJSDocs(field.documentation));\n\n writer\n .write(\n `${field.name}: ${getZodConstructor(\n field,\n relatedModelName\n )}`\n )\n .write(\",\")\n .newLine();\n });\n })\n .write(\"))\");\n }\n }\n ]\n });\n};\n\nexport const populateModelFile = async (\n model: DMMF.Model,\n sourceFile: SourceFile,\n config: Config,\n options: GeneratorOptions\n) => {\n await writeImportsForModel(model, sourceFile, config, options);\n writeTypeSpecificSchemas(model, sourceFile, config);\n generateSchemaForModel(model, sourceFile, config);\n if (needsRelatedModel(model, config))\n generateRelatedSchemaForModel(model, sourceFile, config);\n};\n\nexport const generateBarrelFile = (\n models: DMMF.Model[],\n indexFile: SourceFile\n) => {\n models.forEach(model =>\n indexFile.addExportDeclaration({\n moduleSpecifier: `./${lowerCaseFirst(model.name)}.schema`\n })\n );\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\n/* eslint-disable ts/no-use-before-define */\n\nimport type {\n DMMF,\n EnvValue,\n GeneratorOptions\n} from \"@prisma/generator-helper\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { lowerCaseFirst } from \"@stryke/string-format/lower-case-first\";\nimport type { SourceFile } from \"ts-morph\";\nimport type { Config } from \"./config\";\nimport { project } from \"./project\";\nimport type { Writeable } from \"./types\";\nimport { getPrismaInternals } from \"./utils/get-prisma-internals\";\nimport { generateBarrelFile, populateModelFile } from \"./zod/model-helpers\";\n\nconst getProcedureName = (config: Config) => {\n return config.withShield\n ? \"shieldedProcedure\"\n : config.withMiddleware\n ? \"protectedProcedure\"\n : \"publicProcedure\";\n};\n\nexport const generateCreateRouterImport = ({\n sourceFile,\n config\n}: {\n sourceFile: SourceFile;\n config?: Config;\n}) => {\n const imports = [\"t\"];\n\n if (config) {\n imports.push(getProcedureName(config));\n }\n\n sourceFile.addImportDeclaration({\n moduleSpecifier: \"../trpc\",\n namedImports: imports\n });\n};\n\nexport const generateRPCImport = (sourceFile: SourceFile) => {\n sourceFile.addImportDeclaration({\n moduleSpecifier: \"@trpc/server\",\n namespaceImport: \"trpc\"\n });\n};\n\nexport const generateMiddlewareImport = async (\n sourceFile: SourceFile,\n options: GeneratorOptions\n) => {\n const internals = await getPrismaInternals();\n\n const outputDir = internals.parseEnvValue(\n options.generator.output as EnvValue\n );\n sourceFile.addImportDeclaration({\n moduleSpecifier: relativePath(\n outputDir,\n joinPaths(outputDir, \"middleware\")\n ),\n namedImports: [\"permissions\"]\n });\n};\n\nexport const generateRouterImport = (\n sourceFile: SourceFile,\n modelNamePlural: string,\n modelNameCamelCase: string\n) => {\n sourceFile.addImportDeclaration({\n moduleSpecifier: `./${lowerCaseFirst(modelNameCamelCase)}.router`,\n namedImports: [`${modelNamePlural}Router`]\n });\n};\n\nexport async function generateTRPCExports(\n sourceFile: SourceFile,\n config: Config,\n options: GeneratorOptions,\n outputDir: string\n) {\n if (config.withShield) {\n sourceFile.addImportDeclaration({\n moduleSpecifier: relativePath(\n outputDir,\n joinPaths(\n outputDir,\n typeof config.withShield === \"string\" ? config.withShield : \"shield\"\n )\n ),\n namedImports: [\"permissions\"]\n });\n }\n\n sourceFile.addStatements(\n /* ts */ `import type { Context } from '${relativePath(\n outputDir,\n joinPaths(outputDir, config.contextPath)\n )}';`\n );\n\n if (config.trpcOptions) {\n sourceFile.addStatements(\n /* ts */ `import trpcOptions from '${\n typeof config.trpcOptions === \"string\"\n ? relativePath(outputDir, joinPaths(outputDir, config.trpcOptions))\n : \"./options\"\n }';`\n );\n }\n\n if (config.withNext) {\n sourceFile.addStatements(/* ts */ `import { createContext } from '${relativePath(\n outputDir,\n joinPaths(outputDir, config.contextPath)\n )}';\nimport { initTRPC } from '@trpc/server';\nimport { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';\nimport { cookies } from \"next/headers\";`);\n }\n\n sourceFile.addStatements(/* ts */ `\nexport const t = initTRPC.context<Context>().create(${\n config.trpcOptions ? \"trpcOptions\" : \"\"\n });`);\n\n const middlewares = [];\n\n if (config.withMiddleware && typeof config.withMiddleware === \"boolean\") {\n sourceFile.addStatements(/* ts */ `\nexport const globalMiddleware = t.middleware(async ({ ctx, next }) => {\n console.log('inside middleware!')\n return next()\n});`);\n middlewares.push({\n type: \"global\",\n value: /* ts */ `.use(globalMiddleware)`\n });\n }\n\n if (config.withMiddleware && typeof config.withMiddleware === \"string\") {\n sourceFile.addStatements(/* ts */ `\nimport middleware from '${relativePath(\n outputDir,\n joinPaths(\n outputDir,\n typeof config.withMiddleware === \"string\"\n ? config.withMiddleware\n : \"middleware\"\n )\n )}';\n `);\n sourceFile.addStatements(/* ts */ `\nexport const globalMiddleware = t.middleware(middleware);`);\n middlewares.push({\n type: \"global\",\n value: /* ts */ `.use(globalMiddleware)`\n });\n }\n\n if (config.withShield) {\n sourceFile.addStatements(/* ts */ `\nexport const permissionsMiddleware = t.middleware(permissions);\n `);\n\n middlewares.push({\n type: \"shield\",\n value: /* ts */ `\n .use(permissions)`\n });\n }\n\n sourceFile.addStatements(/* ts */ `\n/**\n * Create a server-side caller\n * @see https://trpc.io/docs/server/server-side-calls\n */\nexport const createCallerFactory = t.createCallerFactory;`);\n\n sourceFile.addStatements(/* ts */ `\nexport const publicProcedure = t.procedure; `);\n\n if (middlewares.length > 0) {\n const procName = getProcedureName(config);\n\n middlewares.forEach((middleware, i) => {\n if (i === 0) {\n sourceFile.addStatements(/* ts */ `\nexport const ${procName} = t.procedure`);\n }\n\n sourceFile.addStatements(\n /* ts */ `.use(${\n middleware.type === \"shield\"\n ? \"permissionsMiddleware\"\n : \"globalMiddleware\"\n })`\n );\n });\n }\n\n if (config.withNext) {\n sourceFile.addStatements(/* ts */ `\nexport const createAction: ReturnType<typeof createTRPCServerActionHandler> =\n createTRPCServerActionHandler(cookies, t, createContext);\n`);\n }\n\n sourceFile.formatText({\n indentSize: 2\n });\n}\n\nexport function generateProcedure(\n sourceFile: SourceFile,\n name: string,\n typeName: string,\n modelName: string,\n opType: string,\n baseOpType: string,\n config: Config\n) {\n let input = `input${!config.withZod ? \" as any\" : \"\"}`;\n const nameWithoutModel = name.replace(modelName, \"\");\n if (nameWithoutModel === \"groupBy\" && config.withZod) {\n input =\n \"{ where: input.where, orderBy: input.orderBy, by: input.by, having: input.having, take: input.take, skip: input.skip }\";\n }\n sourceFile.addStatements(/* ts */ `${\n config.showModelNameInProcedure ? name : nameWithoutModel\n }: ${getProcedureName(config)}\n ${config.withZod ? `.input(${lowerCaseFirst(typeName)})` : \"\"}.${getProcedureTypeByOpName(\n baseOpType\n )}(async ({ ctx, input }) => {\n const ${name} = await ctx.prisma.${lowerCaseFirst(\n modelName\n )}.${opType.replace(\"One\", \"\")}(${input});\n return ${name};\n }),`);\n}\n\nexport function generateRouterSchemaImports(\n sourceFile: SourceFile,\n modelName: string,\n modelActions: string[]\n) {\n sourceFile.addStatements(\n /* ts */\n [\n // remove any duplicate import statements\n ...new Set(\n modelActions.map(opName =>\n getRouterSchemaImportByOpName(opName, modelName)\n )\n )\n ].join(\"\\n\")\n );\n}\n\nexport const getRouterSchemaImportByOpName = (\n opName: string,\n modelName: string\n) => {\n const opType = opName.replace(\"OrThrow\", \"\").replace(\"ManyAndReturn\", \"\");\n const inputType = getInputTypeByOpName(opType, modelName);\n\n return inputType\n ? `import { ${lowerCaseFirst(inputType)} } from \"../schemas/${lowerCaseFirst(opType)}${modelName}.schema\"; `\n : \"\";\n};\n\nexport const getInputTypeByOpName = (opName: string, modelName: string) => {\n let inputType;\n switch (opName) {\n case \"findUnique\":\n inputType = `${modelName}FindUniqueSchema`;\n break;\n case \"findFirst\":\n inputType = `${modelName}FindFirstSchema`;\n break;\n case \"findMany\":\n inputType = `${modelName}FindManySchema`;\n break;\n case \"findRaw\":\n inputType = `${modelName}FindRawObjectSchema`;\n break;\n case \"createOne\":\n inputType = `${modelName}CreateOneSchema`;\n break;\n case \"createMany\":\n inputType = `${modelName}CreateManySchema`;\n break;\n case \"createManyAndReturn\":\n inputType = `${modelName}CreateManySchema`;\n break;\n case \"deleteOne\":\n inputType = `${modelName}DeleteOneSchema`;\n break;\n case \"deleteMany\":\n inputType = `${modelName}DeleteManySchema`;\n break;\n case \"updateOne\":\n inputType = `${modelName}UpdateOneSchema`;\n break;\n case \"updateMany\":\n inputType = `${modelName}UpdateManySchema`;\n break;\n case \"updateManyAndReturn\":\n inputType = `${modelName}UpdateManySchema`;\n break;\n case \"upsertOne\":\n inputType = `${modelName}UpsertSchema`;\n break;\n case \"aggregate\":\n inputType = `${modelName}AggregateSchema`;\n break;\n case \"aggregateRaw\":\n inputType = `${modelName}AggregateRawObjectSchema`;\n break;\n case \"groupBy\":\n inputType = `${modelName}GroupBySchema`;\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(\"getInputTypeByOpName: \", { opName, modelName });\n }\n return inputType;\n};\n\nexport const getProcedureTypeByOpName = (opName: string) => {\n let procType;\n switch (opName) {\n case \"findUnique\":\n case \"findFirst\":\n case \"findMany\":\n case \"findRaw\":\n case \"aggregate\":\n case \"aggregateRaw\":\n case \"groupBy\":\n procType = \"query\";\n break;\n case \"createOne\":\n case \"createMany\":\n case \"createManyAndReturn\":\n case \"deleteOne\":\n case \"updateOne\":\n case \"deleteMany\":\n case \"updateMany\":\n case \"updateManyAndReturn\":\n case \"upsertOne\":\n procType = \"mutation\";\n break;\n default:\n // eslint-disable-next-line no-console\n console.log(\"getProcedureTypeByOpName: \", { opName });\n }\n return procType;\n};\n\nexport function resolveModelsComments(\n models: DMMF.Model[],\n hiddenModels: string[]\n) {\n // eslint-disable-next-line regexp/no-obscure-range\n const modelAttributeRegex = /(?:@@Gen\\.)+[A-z]+\\(.+\\)/;\n const attributeNameRegex = /\\.+[A-Z]+\\(+/i;\n const attributeArgsRegex = /\\(+[A-Z]+:.+\\)/i;\n\n for (const model of models) {\n if (model.documentation) {\n const attribute = model.documentation?.match(modelAttributeRegex)?.[0];\n const attributeName = attribute\n ?.match(attributeNameRegex)?.[0]\n ?.slice(1, -1);\n if (attributeName !== \"model\") continue;\n const rawAttributeArgs = attribute\n ?.match(attributeArgsRegex)?.[0]\n ?.slice(1, -1);\n\n const parsedAttributeArgs: Record<string, unknown> = {};\n if (rawAttributeArgs) {\n const rawAttributeArgsParts = rawAttributeArgs\n .split(\":\")\n .map(it => it.trim())\n .map(part => (part.startsWith(\"[\") ? part : part.split(\",\")))\n .flat()\n .map(it => it.trim());\n\n for (let i = 0; i < rawAttributeArgsParts.length; i += 2) {\n const key = rawAttributeArgsParts[i];\n const value = rawAttributeArgsParts[i + 1];\n parsedAttributeArgs[key!] = JSON.parse(value!);\n }\n }\n\n if (parsedAttributeArgs.hide) {\n hiddenModels.push(model.name);\n }\n }\n }\n}\n\nexport const getImports = (\n type: \"trpc\" | \"trpc-shield\" | \"context\",\n newPath?: string\n) => {\n let statement = \"\";\n if (type === \"trpc\") {\n statement = \"import * as trpc from '@trpc/server';\\n\";\n } else if (type === \"trpc-shield\") {\n statement = \"import { shield, allow } from '@stryke/trpc-next/shield';\\n\";\n } else if (type === \"context\") {\n statement = `import type { Context } from '${newPath}';\\n`;\n }\n\n return statement;\n};\n\nexport const wrapWithObject = ({\n shieldItemLines\n}: {\n shieldItemLines: Array<string> | string;\n}) => {\n let wrapped = \"{\";\n wrapped += \"\\n\";\n wrapped += Array.isArray(shieldItemLines)\n ? ` ${shieldItemLines.join(\",\\r\\n\")}`\n : ` ${shieldItemLines}`;\n wrapped += \"\\n\";\n wrapped += \"}\";\n return wrapped;\n};\n\nexport const wrapWithTrpcShieldCall = ({\n shieldObjectTextWrapped\n}: {\n shieldObjectTextWrapped: string;\n}) => {\n let wrapped = \"shield<Context>(\";\n wrapped += \"\\n\";\n wrapped += ` ${shieldObjectTextWrapped}`;\n wrapped += \"\\n\";\n wrapped += \")\";\n return wrapped;\n};\n\nexport const wrapWithExport = ({\n shieldObjectText\n}: {\n shieldObjectText: string;\n}) => {\n return `export const permissions: ReturnType<typeof shield<Context>> = ${shieldObjectText};`;\n};\n\nexport const constructShield = async (\n {\n queries,\n mutations,\n subscriptions\n }: {\n queries: Array<string>;\n mutations: Array<string>;\n subscriptions: Array<string>;\n },\n config: Config,\n options: GeneratorOptions,\n outputDir: string\n) => {\n if (\n queries.length === 0 &&\n mutations.length === 0 &&\n subscriptions.length === 0\n ) {\n return \"\";\n }\n\n let rootItems = \"\";\n if (queries.length > 0) {\n const queryLinesWrapped = `query: ${wrapWithObject({\n shieldItemLines: queries.map(query => `${query}: allow`)\n })},`;\n rootItems += queryLinesWrapped;\n }\n if (mutations.length > 0) {\n const mutationLinesWrapped = `mutation: ${wrapWithObject({\n shieldItemLines: mutations.map(mutation => `${mutation}: allow`)\n })},`;\n rootItems += mutationLinesWrapped;\n }\n\n if (subscriptions.length > 0) {\n const subscriptionLinesWrapped = `subscription: ${wrapWithObject({\n shieldItemLines: subscriptions.map(\n subscription => `${subscription}: allow`\n )\n })},`;\n rootItems += subscriptionLinesWrapped;\n }\n\n if (rootItems.length === 0) {\n return \"\";\n }\n\n let shieldText = getImports(\"trpc-shield\");\n shieldText += getImports(\n \"context\",\n relativePath(outputDir, joinPaths(outputDir, config.contextPath))\n );\n shieldText += \"\\n\\n\";\n shieldText += wrapWithExport({\n shieldObjectText: wrapWithTrpcShieldCall({\n shieldObjectTextWrapped: wrapWithObject({ shieldItemLines: rootItems })\n })\n });\n\n return shieldText;\n};\n\nexport const constructDefaultOptions = (\n config: Config,\n options: GeneratorOptions,\n outputDir: string\n) => {\n return `import { ZodError } from 'zod';${config.withNext ? '\\nimport { transformer } from \"@stryke/trpc-next/shared\";' : \"\"}\nimport type {\n DataTransformerOptions,\n RootConfig\n} from \"@trpc/server/unstable-core-do-not-import\";\nimport type { Context } from \"${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}\";\n\ninterface RuntimeConfigOptions<\n TContext extends object,\n TMeta extends object = object\n> extends Partial<\n Omit<\n RootConfig<{\n ctx: TContext;\n meta: TMeta;\n errorShape: any;\n transformer: any;\n }>,\n \"$types\" | \"transformer\"\n >\n > {\n /**\n * Use a data transformer\n * @see https://trpc.io/docs/v11/data-transformers\n */\n transformer?: DataTransformerOptions;\n}\n\nconst options: RuntimeConfigOptions<Context> = {${config.withNext ? \"\\n transformer,\" : \"\"}\n errorFormatter({ shape, error }) {\n return {\n ...shape,\n data: {\n ...shape.data,\n zodError:\n error.code === \"BAD_REQUEST\" && error.cause instanceof ZodError\n ? error.cause.flatten()\n : null\n }\n };\n }\n};\n\nexport default options;\n`;\n};\n\nexport const constructZodModels = async (\n models: Writeable<DMMF.Model[]>,\n outputPath: string,\n config: Config,\n options: GeneratorOptions\n) => {\n const indexFile = project.createSourceFile(\n `${outputPath}/index.ts`,\n {},\n { overwrite: true }\n );\n\n generateBarrelFile(models, indexFile);\n\n indexFile.formatText({\n indentSize: 2\n });\n\n await Promise.all(\n models.map(async model => {\n const sourceFile = project.createSourceFile(\n `${outputPath}/${lowerCaseFirst(model.name)}.schema.ts`,\n {},\n { overwrite: true }\n );\n\n await populateModelFile(model, sourceFile, config, options);\n\n sourceFile.formatText({\n indentSize: 2\n });\n })\n );\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport prettier from \"prettier\";\n\nexport async function formatFile(content: string): Promise<string> {\n const options = await prettier.resolveConfig(process.cwd());\n\n let formatOptions = options;\n if (!options) {\n formatOptions = {\n trailingComma: \"all\",\n tabWidth: 2,\n printWidth: 80,\n bracketSpacing: true,\n semi: true,\n singleQuote: true,\n useTabs: false\n };\n }\n\n const formatted = await prettier.format(content, {\n ...formatOptions,\n parser: \"typescript\"\n });\n\n return formatted;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport { createDirectory } from \"@stryke/fs/helpers\";\nimport { writeFile } from \"@stryke/fs/write-file\";\nimport { correctPath } from \"@stryke/path/correct-path\";\nimport { findFilePath } from \"@stryke/path/file-path-fns\";\nimport path from \"node:path\";\nimport { formatFile } from \"./format-file\";\n\nconst indexExports = new Set<string>();\n\nexport const addIndexExport = (filePath: string) => {\n indexExports.add(filePath);\n};\n\nexport const writeFileSafely = async (\n writeLocation: string,\n content: any,\n addToIndex = true\n) => {\n const [fileContent] = await Promise.all([\n formatFile(content),\n createDirectory(findFilePath(writeLocation))\n ]);\n\n await writeFile(writeLocation, fileContent);\n if (addToIndex) {\n addIndexExport(writeLocation);\n }\n};\n\nexport const writeIndexFile = async (indexPath: string) => {\n const rows = Array.from(indexExports).map(filePath => {\n let relativePath = path.relative(path.dirname(indexPath), filePath);\n if (relativePath.endsWith(\".ts\")) {\n relativePath = relativePath.slice(0, relativePath.lastIndexOf(\".ts\"));\n }\n const normalized = correctPath(relativePath);\n\n return `export * from './${normalized}';`;\n });\n\n rows.push(\"export * from './models';\");\n\n await writeFileSafely(indexPath, rows.join(\"\\n\"), false);\n};\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\nimport type { AggregateOperationSupport } from \"../types\";\n\nconst isAggregateOutputType = (name: string) =>\n /(?:Count|Avg|Sum|Min|Max)AggregateOutputType$/.test(name);\n\nexport const isAggregateInputType = (name: string) =>\n name.endsWith(\"CountAggregateInput\") ||\n name.endsWith(\"SumAggregateInput\") ||\n name.endsWith(\"AvgAggregateInput\") ||\n name.endsWith(\"MinAggregateInput\") ||\n name.endsWith(\"MaxAggregateInput\");\n\nexport function addMissingInputObjectTypesForAggregate(\n inputObjectTypes: DMMF.InputType[],\n outputObjectTypes: DMMF.OutputType[]\n) {\n const aggregateOutputTypes = outputObjectTypes.filter(({ name }) =>\n isAggregateOutputType(name)\n );\n for (const aggregateOutputType of aggregateOutputTypes) {\n const name = aggregateOutputType.name.replace(/(?:OutputType|Output)$/, \"\");\n inputObjectTypes.push({\n constraints: { maxNumFields: null, minNumFields: null },\n name: `${name}Input`,\n fields: aggregateOutputType.fields.map(field => ({\n name: field.name,\n isNullable: false,\n isRequired: false,\n inputTypes: [\n {\n isList: false,\n type: \"True\",\n location: \"scalar\"\n }\n ]\n }))\n });\n }\n}\n\nexport function resolveZodAggregateOperationSupport(\n inputObjectTypes: DMMF.InputType[]\n) {\n const aggregateOperationSupport: AggregateOperationSupport = {};\n for (const inputType of inputObjectTypes) {\n if (isAggregateInputType(inputType.name)) {\n const name = inputType.name.replace(\"AggregateInput\", \"\");\n if (name.endsWith(\"Count\")) {\n const model = name.replace(\"Count\", \"\");\n aggregateOperationSupport[model] = {\n ...aggregateOperationSupport[model],\n count: true\n };\n } else if (name.endsWith(\"Min\")) {\n const model = name.replace(\"Min\", \"\");\n aggregateOperationSupport[model] = {\n ...aggregateOperationSupport[model],\n min: true\n };\n } else if (name.endsWith(\"Max\")) {\n const model = name.replace(\"Max\", \"\");\n aggregateOperationSupport[model] = {\n ...aggregateOperationSupport[model],\n max: true\n };\n } else if (name.endsWith(\"Sum\")) {\n const model = name.replace(\"Sum\", \"\");\n aggregateOperationSupport[model] = {\n ...aggregateOperationSupport[model],\n sum: true\n };\n } else if (name.endsWith(\"Avg\")) {\n const model = name.replace(\"Avg\", \"\");\n aggregateOperationSupport[model] = {\n ...aggregateOperationSupport[model],\n avg: true\n };\n }\n }\n }\n return aggregateOperationSupport;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\n\n// eslint-disable-next-line regexp/no-obscure-range\nconst modelAttributeRegex = /(?:@@Gen\\.)+[A-z]+\\(.+\\)/;\nconst attributeNameRegex = /\\.+[A-Z]+\\(+/i;\nconst attributeArgsRegex = /\\(+[A-Z]+:.+\\)/i;\n\nexport function resolveZodModelsComments(\n models: DMMF.Model[],\n modelOperations: DMMF.ModelMapping[],\n enumTypes: { model?: DMMF.SchemaEnum[]; prisma: DMMF.SchemaEnum[] },\n hiddenModels: string[],\n hiddenFields: string[]\n) {\n models = collectHiddenModels(models, hiddenModels);\n collectHiddenFields(models, hiddenModels, hiddenFields);\n hideModelOperations(models, modelOperations);\n hideEnums(enumTypes, hiddenModels);\n}\n\nfunction collectHiddenModels(models: DMMF.Model[], hiddenModels: string[]) {\n return models\n .map(model => {\n if (model.documentation) {\n const attribute = model.documentation?.match(modelAttributeRegex)?.[0];\n const attributeName = attribute\n ?.match(attributeNameRegex)?.[0]\n ?.slice(1, -1);\n if (attributeName !== \"model\") {\n return model;\n }\n\n const rawAttributeArgs = attribute\n ?.match(attributeArgsRegex)?.[0]\n ?.slice(1, -1);\n\n const parsedAttributeArgs: Record<string, unknown> = {};\n if (rawAttributeArgs) {\n const rawAttributeArgsParts = rawAttributeArgs\n .split(\":\")\n .map(it => it.trim())\n .map(part => (part.startsWith(\"[\") ? part : part.split(\",\")))\n .flat()\n .map(it => it.trim());\n\n for (let i = 0; i < rawAttributeArgsParts.length; i += 2) {\n const key = rawAttributeArgsParts[i];\n const value = rawAttributeArgsParts[i + 1];\n parsedAttributeArgs[key!] = JSON.parse(value!);\n }\n }\n if (parsedAttributeArgs.hide) {\n hiddenModels.push(model.name);\n return null as unknown as DMMF.Model;\n }\n }\n\n return model;\n })\n .filter(Boolean);\n}\n\nfunction collectHiddenFields(\n models: DMMF.Model[],\n hiddenModels: string[],\n hiddenFields: string[]\n) {\n models.forEach(model => {\n model.fields.forEach(field => {\n if (hiddenModels.includes(field.type)) {\n hiddenFields.push(field.name);\n if (field.relationFromFields) {\n field.relationFromFields.forEach(item => hiddenFields.push(item));\n }\n }\n });\n });\n}\nfunction hideEnums(\n enumTypes: { model?: DMMF.SchemaEnum[]; prisma: DMMF.SchemaEnum[] },\n hiddenModels: string[]\n) {\n enumTypes.prisma = enumTypes.prisma.filter(\n item => !hiddenModels.find(model => item.name.startsWith(model))\n );\n}\n\nfunction hideModelOperations(\n models: DMMF.Model[],\n modelOperations: DMMF.ModelMapping[]\n) {\n let i = modelOperations.length;\n while (i >= 0) {\n --i;\n const modelOperation = modelOperations[i];\n if (\n modelOperation &&\n !models.find(model => {\n return model.name === modelOperation.model;\n })\n ) {\n modelOperations.splice(i, 1);\n }\n }\n}\n\nexport function hideZodInputObjectTypesAndRelatedFields(\n inputObjectTypes: DMMF.InputType[],\n hiddenModels: string[],\n hiddenFields: string[]\n) {\n let j = inputObjectTypes.length;\n while (j >= 0) {\n --j;\n const inputType = inputObjectTypes[j];\n if (\n inputType &&\n (hiddenModels.includes(inputType?.meta?.source as string) ||\n hiddenModels.find(model => inputType.name.startsWith(model)))\n ) {\n inputObjectTypes.splice(j, 1);\n } else {\n let k = inputType?.fields?.length ?? 0;\n while (k >= 0) {\n --k;\n const field = inputType?.fields?.[k];\n if (field && hiddenFields.includes(field.name)) {\n inputObjectTypes[j]!.fields.slice(k, 1);\n }\n }\n }\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\nimport Transformer from \"./transformer\";\n\nexport function addMissingInputObjectTypesForMongoDbRawOpsAndQueries(\n modelOperations: DMMF.ModelMapping[],\n outputObjectTypes: DMMF.OutputType[],\n inputObjectTypes: DMMF.InputType[]\n) {\n const rawOpsMap = resolveMongoDbRawOperations(modelOperations);\n Transformer.rawOpsMap = rawOpsMap ?? {};\n\n const mongoDbRawQueryInputObjectTypes =\n resolveMongoDbRawQueryInputObjectTypes(outputObjectTypes);\n for (const mongoDbRawQueryInputType of mongoDbRawQueryInputObjectTypes) {\n inputObjectTypes.push(mongoDbRawQueryInputType);\n }\n}\n\nfunction resolveMongoDbRawOperations(modelOperations: DMMF.ModelMapping[]) {\n const rawOpsMap: { [name: string]: string } = {};\n const rawOpsNames = [\n ...new Set(\n modelOperations.reduce<string[]>((result, current) => {\n const keys = Object.keys(current);\n keys?.forEach(key => {\n if (key.includes(\"Raw\")) {\n result.push(key);\n }\n });\n return result;\n }, [])\n )\n ];\n\n const modelNames = modelOperations.map(item => item.model);\n\n rawOpsNames.forEach(opName => {\n modelNames.forEach(modelName => {\n const isFind = opName === \"findRaw\";\n const opWithModel = `${opName.replace(\"Raw\", \"\")}${modelName}Raw`;\n rawOpsMap[opWithModel] = isFind\n ? `${modelName}FindRawArgs`\n : `${modelName}AggregateRawArgs`;\n });\n });\n\n return rawOpsMap;\n}\n\nfunction resolveMongoDbRawQueryInputObjectTypes(\n outputObjectTypes: DMMF.OutputType[]\n) {\n const mongoDbRawQueries = getMongoDbRawQueries(outputObjectTypes);\n const mongoDbRawQueryInputObjectTypes = mongoDbRawQueries.map(item => ({\n name: item.name,\n constraints: {\n maxNumFields: null,\n minNumFields: null\n },\n fields: item.args.map(arg => ({\n name: arg.name,\n isRequired: arg.isRequired,\n isNullable: arg.isNullable,\n inputTypes: arg.inputTypes\n }))\n }));\n\n return mongoDbRawQueryInputObjectTypes;\n}\n\nfunction getMongoDbRawQueries(outputObjectTypes: DMMF.OutputType[]) {\n const queryOutputTypes = outputObjectTypes.filter(\n item => item.name === \"Query\"\n );\n\n const mongodbRawQueries =\n queryOutputTypes?.[0]!.fields.filter(field => field.name.includes(\"Raw\")) ??\n [];\n\n return mongodbRawQueries;\n}\n\nexport const isMongodbRawOp = (name: string) =>\n /find[\\s\\S]*?Raw/.test(name) || /aggregate[\\s\\S]*?Raw/.test(name);\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type {\n ConnectorType,\n DMMF as PrismaDMMF\n} from \"@prisma/generator-helper\";\nimport { lowerCaseFirst } from \"@stryke/string-format/lower-case-first\";\nimport { upperCaseFirst } from \"@stryke/string-format/upper-case-first\";\nimport path from \"node:path\";\nimport type {\n AggregateOperationSupport,\n TransformerParams,\n Writeable\n} from \"../types\";\nimport { writeFileSafely, writeIndexFile } from \"../utils/write-file-safely\";\nimport { isAggregateInputType } from \"./aggregate-helpers\";\nimport { checkModelHasModelRelation, findModelByName } from \"./model-helpers\";\nimport { isMongodbRawOp } from \"./mongodb-helpers\";\n\nexport default class Transformer {\n name: string;\n\n fields: Writeable<PrismaDMMF.SchemaArg[]>;\n\n schemaImports = new Set<string>();\n\n models: Writeable<PrismaDMMF.Model[]>;\n\n modelOperations: Writeable<PrismaDMMF.ModelMapping[]>;\n\n aggregateOperationSupport: AggregateOperationSupport;\n\n enumTypes: Writeable<PrismaDMMF.SchemaEnum[]>;\n\n static enumNames: string[] = [];\n\n static rawOpsMap: { [name: string]: string } = {};\n\n static provider: ConnectorType;\n\n static previewFeatures: string[] | undefined;\n\n private static outputPath: string = \"./generated\";\n\n private hasJson = false;\n\n private static prismaClientOutputPath: string = \"@prisma/client\";\n\n private static isCustomPrismaClientOutputPath: boolean = false;\n\n private static isGenerateSelect: boolean = true;\n\n private static isGenerateInclude: boolean = true;\n\n constructor(params: Writeable<TransformerParams>) {\n this.name = params.name ?? \"\";\n this.fields = params.fields ?? [];\n this.models = params.models ?? [];\n this.modelOperations = params.modelOperations ?? [];\n this.aggregateOperationSupport = params.aggregateOperationSupport ?? {};\n this.enumTypes = params.enumTypes ?? [];\n }\n\n static setOutputPath(outPath: string) {\n this.outputPath = outPath;\n }\n\n static setIsGenerateSelect(isGenerateSelect: boolean) {\n this.isGenerateSelect = isGenerateSelect;\n }\n\n static setIsGenerateInclude(isGenerateInclude: boolean) {\n this.isGenerateInclude = isGenerateInclude;\n }\n\n static getOutputPath() {\n return this.outputPath;\n }\n\n static setPrismaClientOutputPath(prismaClientCustomPath: string) {\n this.prismaClientOutputPath = prismaClientCustomPath;\n this.isCustomPrismaClientOutputPath =\n prismaClientCustomPath !== \"@prisma/client\";\n }\n\n static async generateIndex() {\n const indexPath = path.join(Transformer.outputPath, \"schemas/index.ts\");\n await writeIndexFile(indexPath);\n }\n\n async generateEnumSchemas() {\n for (const enumType of this.enumTypes) {\n const { name, values } = enumType;\n\n await writeFileSafely(\n path.join(\n Transformer.outputPath,\n `schemas/enums/${lowerCaseFirst(name)}.schema.ts`\n ),\n `${this.generateImportZodStatement()}\\n${this.generateExportSchemaStatement(\n `${lowerCaseFirst(name)}`,\n `z.enum(${JSON.stringify(values)})`\n )}`\n );\n }\n }\n\n generateImportZodStatement() {\n return \"import { z } from 'zod';\\n\";\n }\n\n generateExportSchemaStatement(name: string, schema: string) {\n return `export const ${lowerCaseFirst(name)}Schema = ${schema}`;\n }\n\n async generateObjectSchema() {\n const zodObjectSchemaFields = this.generateObjectSchemaFields();\n const objectSchema = this.prepareObjectSchema(zodObjectSchemaFields);\n const objectSchemaName = this.resolveObjectSchemaName();\n\n await writeFileSafely(\n path.join(\n Transformer.outputPath,\n `schemas/objects/${lowerCaseFirst(objectSchemaName)}.schema.ts`\n ),\n objectSchema\n );\n }\n\n generateObjectSchemaFields() {\n const zodObjectSchemaFields = this.fields\n .map(field => this.generateObjectSchemaField(field))\n .flatMap(item => item)\n .map(item => {\n const [zodStringWithMainType, field, skipValidators] = item;\n\n const value = skipValidators\n ? zodStringWithMainType\n : this.generateFieldValidators(zodStringWithMainType, field);\n\n return value.trim();\n });\n\n return zodObjectSchemaFields;\n }\n\n generateObjectSchemaField(\n field: PrismaDMMF.SchemaArg\n ): [string, PrismaDMMF.SchemaArg, boolean][] {\n const lines = field.inputTypes;\n\n if (lines.length === 0) {\n return [];\n }\n\n let alternatives = lines.reduce<string[]>((result, inputType) => {\n if (inputType.type === \"String\") {\n result.push(this.wrapWithZodValidators(\"z.string()\", field));\n } else if (\n inputType.type === \"Int\" ||\n inputType.type === \"Float\" ||\n inputType.type === \"Decimal\"\n ) {\n result.push(this.wrapWithZodValidators(\"z.number()\", field));\n } else if (inputType.type === \"BigInt\") {\n result.push(this.wrapWithZodValidators(\"z.bigint()\", field));\n } else if (inputType.type === \"Boolean\") {\n result.push(this.wrapWithZodValidators(\"z.boolean()\", field));\n } else if (inputType.type === \"DateTime\") {\n result.push(this.wrapWithZodValidators(\"z.coerce.date()\", field));\n } else if (inputType.type === \"Json\") {\n this.hasJson = true;\n\n result.push(this.wrapWithZodValidators(\"jsonSchema\", field));\n } else if (inputType.type === \"True\") {\n result.push(this.wrapWithZodValidators(\"z.literal(true)\", field));\n } else if (inputType.type === \"Bytes\") {\n result.push(this.wrapWithZodValidators(\"z.instanceof(Buffer)\", field));\n } else if (!inputType.type.endsWith(\"FieldRefInput\")) {\n const isEnum = inputType.location === \"enumTypes\";\n\n if (inputType.namespace === \"prisma\" || isEnum) {\n if (\n inputType.type !== this.name &&\n typeof inputType.type === \"string\"\n ) {\n this.addSchemaImport(inputType.type);\n }\n\n result.push(\n this.generatePrismaStringLine(field, inputType, lines.length)\n );\n }\n }\n\n return result;\n }, []);\n\n if (alternatives.length === 0) {\n return [];\n }\n\n if (alternatives.length > 1) {\n alternatives = alternatives.map(alter =>\n alter.replace(\".optional()\", \"\")\n );\n }\n\n const fieldName = alternatives.some(alt => alt.includes(\":\"))\n ? \"\"\n : ` ${field.name}:`;\n\n const opt = !field.isRequired ? \".optional()\" : \"\";\n\n let resString =\n alternatives.length === 1\n ? alternatives.join(\",\\r\\n\")\n : `z.union([${alternatives.join(\",\\r\\n\")}])${opt}`;\n\n if (field.isNullable) {\n resString += \".nullable()\";\n }\n\n return [[` ${fieldName} ${resString} `, field, true]];\n }\n\n wrapWithZodValidators(mainValidator: string, field: PrismaDMMF.SchemaArg) {\n let line: string = \"\";\n line = mainValidator;\n\n if (field.inputTypes.some(inputType => inputType.isList)) {\n line += \".array()\";\n }\n\n if (!field.isRequired) {\n line += \".optional()\";\n }\n\n return line;\n }\n\n addSchemaImport(name: string) {\n this.schemaImports.add(name);\n }\n\n generatePrismaStringLine(\n field: PrismaDMMF.SchemaArg,\n inputType: PrismaDMMF.InputTypeRef,\n inputsLength: number\n ) {\n // if (field.inputTypes.length === 0 || !field.inputTypes[0]) {\n // return \"\";\n // }\n\n // const inputType = field.inputTypes[0];\n\n const isEnum = inputType.location === \"enumTypes\";\n\n const inputTypeString = inputType.type;\n const { isModelQueryType, modelName, queryName } =\n this.checkIsModelQueryType(inputTypeString);\n\n const objectSchemaLine = isModelQueryType\n ? this.resolveModelQuerySchemaName(modelName!, queryName!)\n : `${inputTypeString}ObjectSchema`;\n const enumSchemaLine = `${inputTypeString}Schema`;\n\n const schema =\n inputType.type === this.name\n ? objectSchemaLine\n : isEnum\n ? enumSchemaLine\n : objectSchemaLine;\n const arr = inputType.isList ? \".array()\" : \"\";\n const opt = !field.isRequired ? \".optional()\" : \"\";\n\n return inputsLength === 1\n ? ` ${field.name}: z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}`\n : `z.lazy(() => ${lowerCaseFirst(schema)})${arr}${opt}`;\n }\n\n generateFieldValidators(\n zodStringWithMainType: string,\n field: PrismaDMMF.SchemaArg\n ) {\n const { isRequired, isNullable } = field;\n\n if (!isRequired) {\n zodStringWithMainType += \".optional()\";\n }\n\n if (isNullable) {\n zodStringWithMainType += \".nullable()\";\n }\n\n return zodStringWithMainType;\n }\n\n prepareObjectSchema(zodObjectSchemaFields: string[]) {\n const objectSchema = `${this.generateExportObjectSchemaStatement(\n this.addFinalWrappers({ zodStringFields: zodObjectSchemaFields })\n )}\\n`;\n\n const prismaImportStatement = this.generateImportPrismaStatement();\n\n const json = this.generateJsonSchemaImplementation();\n\n return `${this.generateObjectSchemaImportStatements()}${prismaImportStatement}${json}${objectSchema}`;\n }\n\n generateExportObjectSchemaStatement(schema: string) {\n let name = this.name;\n let exportName = this.name;\n if (Transformer.provider === \"mongodb\") {\n if (isMongodbRawOp(name)) {\n name = Transformer.rawOpsMap[name]!;\n exportName = name.replace(\"Args\", \"\");\n }\n }\n\n if (isAggregateInputType(name)) {\n name = `${name}Type`;\n }\n const end = `export const ${lowerCaseFirst(exportName)}ObjectSchema = schema`;\n\n return `const schema: z.ZodType<Prisma.${name}> = ${schema};\\n\\n ${end}`;\n }\n\n addFinalWrappers({ zodStringFields }: { zodStringFields: string[] }) {\n const fields = [...zodStringFields];\n\n return `${this.wrapWithZodObject(fields)}.strict()`;\n }\n\n generateImportPrismaStatement() {\n let prismaClientImportPath: string;\n if (Transformer.isCustomPrismaClientOutputPath) {\n /**\n * If a custom location was designated for the prisma client, we need to figure out the\n * relative path from \\{outputPath\\}/schemas/objects to \\{prismaClientCustomPath\\}\n */\n const fromPath = path.join(Transformer.outputPath, \"schemas\", \"objects\");\n const toPath = Transformer.prismaClientOutputPath;\n const relativePathFromOutputToPrismaClient = path\n .relative(fromPath, toPath)\n .split(path.sep)\n .join(path.posix.sep);\n prismaClientImportPath = relativePathFromOutputToPrismaClient;\n } else {\n /**\n * If the default output path for prisma client (\\@prisma/client) is being used, we can import from it directly\n * without having to resolve a relative path\n */\n prismaClientImportPath = Transformer.prismaClientOutputPath;\n }\n return `import type { Prisma } from '${prismaClientImportPath}';\\n\\n`;\n }\n\n generateJsonSchemaImplementation() {\n let jsonSchemaImplementation = \"\";\n\n if (this.hasJson) {\n jsonSchemaImplementation += `\\n`;\n jsonSchemaImplementation += `const literalSchema = z.union([z.string(), z.number(), z.boolean()]);\\n`;\n jsonSchemaImplementation += `const jsonSchema: z.ZodType<Prisma.InputJsonValue> = z.lazy(() =>\\n`;\n jsonSchemaImplementation += ` z.union([literalSchema, z.array(jsonSchema.nullable()), z.record(jsonSchema.nullable())])\\n`;\n jsonSchemaImplementation += `);\\n\\n`;\n }\n\n return jsonSchemaImplementation;\n }\n\n generateObjectSchemaImportStatements() {\n let generatedImports = this.generateImportZodStatement();\n generatedImports += this.generateSchemaImports();\n generatedImports += \"\\n\\n\";\n return generatedImports;\n }\n\n generateSchemaImports() {\n return [...this.schemaImports]\n .map(name => {\n const { isModelQueryType, modelName, queryName } =\n this.checkIsModelQueryType(name);\n if (isModelQueryType) {\n return `import { ${this.resolveModelQuerySchemaName(\n modelName!,\n queryName!\n )} } from '../${queryName}${modelName}.schema'`;\n } else if (Transformer.enumNames.includes(name)) {\n return `import { ${lowerCaseFirst(name)}Schema } from '../enums/${lowerCaseFirst(name)}.schema'`;\n } else {\n return `import { ${lowerCaseFirst(name)}ObjectSchema } from './${lowerCaseFirst(name)}.schema'`;\n }\n })\n .join(\";\\r\\n\");\n }\n\n checkIsModelQueryType(type: string) {\n const modelQueryTypeSuffixToQueryName: Record<string, string> = {\n FindManyArgs: \"findMany\"\n };\n for (const modelQueryType of [\"FindManyArgs\"]) {\n if (type.includes(modelQueryType)) {\n const modelQueryTypeSuffixIndex = type.indexOf(modelQueryType);\n\n return {\n isModelQueryType: true,\n modelName: type.substring(0, modelQueryTypeSuffixIndex),\n queryName: modelQueryTypeSuffixToQueryName[modelQueryType]\n };\n }\n }\n return { isModelQueryType: false };\n }\n\n resolveModelQuerySchemaName(modelName: string, queryName: string) {\n const modelNameUncapitalized = lowerCaseFirst(modelName);\n const queryNameCapitalized = upperCaseFirst(queryName);\n\n return `${modelNameUncapitalized}${queryNameCapitalized}Schema`;\n }\n\n wrapWithZodUnion(zodStringFields: string[]) {\n let wrapped = \"\";\n\n wrapped += \"z.union([\";\n wrapped += \"\\n\";\n wrapped += ` ${zodStringFields.join(\",\")}`;\n wrapped += \"\\n\";\n wrapped += \"])\";\n return wrapped;\n }\n\n wrapWithZodObject(zodStringFields: string | string[]) {\n let wrapped = \"\";\n\n wrapped += \"z.object({\";\n wrapped += \"\\n\";\n wrapped += ` ${typeof zodStringFields === \"string\" ? zodStringFields : zodStringFields.join(\",\\n \")}`;\n wrapped += \"\\n\";\n wrapped += \"})\";\n return wrapped;\n }\n\n resolveObjectSchemaName() {\n let name = this.name;\n let exportName = this.name;\n if (isMongodbRawOp(name)) {\n name = Transformer.rawOpsMap[name]!;\n exportName = name.replace(\"Args\", \"\");\n }\n\n return lowerCaseFirst(exportName);\n }\n\n async generateModelSchemas() {\n for (const modelOperation of this.modelOperations) {\n const {\n findUnique,\n findFirst,\n findMany,\n // @ts-ignore\n createOne,\n createMany,\n createManyAndReturn,\n // @ts-ignore\n deleteOne,\n // @ts-ignore\n updateOne,\n deleteMany,\n updateMany,\n updateManyAndReturn,\n // @ts-ignore\n upsertOne,\n aggregate,\n groupBy\n } = modelOperation;\n\n const model = findModelByName(this.models, modelOperation.model)!;\n const modelName = lowerCaseFirst(modelOperation.model)!;\n\n const {\n selectImport,\n includeImport,\n selectZodSchemaLine,\n includeZodSchemaLine,\n selectZodSchemaLineLazy,\n includeZodSchemaLineLazy\n } = this.resolveSelectIncludeImportAndZodSchemaLine(model);\n\n const { orderByImport, orderByZodSchemaLine } =\n this.resolveOrderByWithRelationImportAndZodSchemaLine(model);\n\n if (findUnique) {\n const imports = [\n selectImport,\n includeImport,\n `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${findUnique}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}FindUnique`,\n `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`\n )}`\n );\n }\n\n if (findFirst) {\n const imports = [\n selectImport,\n includeImport,\n orderByImport,\n `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,\n `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,\n `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${findFirst}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}FindFirst`,\n `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`\n )}`\n );\n }\n\n if (findMany) {\n const imports = [\n selectImport,\n includeImport,\n orderByImport,\n `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,\n `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,\n `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${findMany}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}FindMany`,\n `z.object({ ${selectZodSchemaLineLazy} ${includeZodSchemaLineLazy} ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), distinct: z.array(${modelName}ScalarFieldEnumSchema).optional() })`\n )}`\n );\n }\n\n if (createOne) {\n const imports = [\n selectImport,\n includeImport,\n `import { ${modelName}CreateInputObjectSchema } from './objects/${modelName}CreateInput.schema'`,\n `import { ${modelName}UncheckedCreateInputObjectSchema } from './objects/${modelName}UncheckedCreateInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${createOne}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}CreateOne`,\n `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema]) })`\n )}`\n );\n }\n\n if (createMany) {\n const imports = [\n `import { ${modelName}CreateManyInputObjectSchema } from './objects/${modelName}CreateManyInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${createMany}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}CreateMany`,\n `z.object({ data: z.union([ ${modelName}CreateManyInputObjectSchema, z.array(${modelName}CreateManyInputObjectSchema) ]), ${\n Transformer.provider === \"mongodb\" ||\n Transformer.provider === \"sqlserver\"\n ? \"\"\n : \"skipDuplicates: z.boolean().optional()\"\n } })`\n )}`\n );\n }\n\n if (createManyAndReturn) {\n const imports = [\n `import { ${modelName}CreateManyAndReturnInputObjectSchema } from './objects/${modelName}CreateManyAndReturnInput.schema'`\n ];\n await writeFileSafely(\n path.join(\n Transformer.outputPath,\n `schemas/${createManyAndReturn}.schema.ts`\n ),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}CreateManyAndReturn`,\n `z.object({ data: z.union([ ${modelName}CreateManyAndReturnInputObjectSchema, z.array(${modelName}CreateManyAndReturnInputObjectSchema) ]), ${\n Transformer.provider === \"mongodb\" ||\n Transformer.provider === \"sqlserver\"\n ? \"\"\n : \"skipDuplicates: z.boolean().optional()\"\n } })`\n )}`\n );\n }\n\n if (deleteOne) {\n const imports = [\n selectImport,\n includeImport,\n `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${deleteOne}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}DeleteOne`,\n `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema })`\n )}`\n );\n }\n\n if (deleteMany) {\n const imports = [\n `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${deleteMany}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}DeleteMany`,\n `z.object({ where: ${modelName}WhereInputObjectSchema.optional() })`\n )}`\n );\n }\n\n if (updateOne) {\n const imports = [\n selectImport,\n includeImport,\n `import { ${modelName}UpdateInputObjectSchema } from './objects/${modelName}UpdateInput.schema'`,\n `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`,\n `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${updateOne}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}UpdateOne`,\n `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} data: z.union([${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema]), where: ${modelName}WhereUniqueInputObjectSchema })`\n )}`\n );\n }\n\n if (updateMany) {\n const imports = [\n `import { ${modelName}UpdateManyMutationInputObjectSchema } from './objects/${modelName}UpdateManyMutationInput.schema'`,\n `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${updateMany}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}UpdateMany`,\n `z.object({ data: ${modelName}UpdateManyMutationInputObjectSchema, where: ${modelName}WhereInputObjectSchema.optional() })`\n )}`\n );\n }\n\n if (updateManyAndReturn) {\n const imports = [\n `import { ${modelName}UpdateManyAndReturnInputObjectSchema } from './objects/${modelName}UpdateManyAndReturnInput.schema'`\n ];\n await writeFileSafely(\n path.join(\n Transformer.outputPath,\n `schemas/${updateManyAndReturn}.schema.ts`\n ),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}UpdateManyAndReturn`,\n `z.object({ data: z.union([ ${modelName}UpdateManyAndReturnInputObjectSchema, z.array(${modelName}UpdateManyAndReturnInputObjectSchema) ]), ${\n Transformer.provider === \"mongodb\" ||\n Transformer.provider === \"sqlserver\"\n ? \"\"\n : \"skipDuplicates: z.boolean().optional()\"\n } })`\n )}`\n );\n }\n\n if (upsertOne) {\n const imports = [\n selectImport,\n includeImport,\n `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`,\n `import { ${modelName}CreateInputObjectSchema } from './objects/${modelName}CreateInput.schema'`,\n `import { ${modelName}UncheckedCreateInputObjectSchema } from './objects/${modelName}UncheckedCreateInput.schema'`,\n `import { ${modelName}UpdateInputObjectSchema } from './objects/${modelName}UpdateInput.schema'`,\n `import { ${modelName}UncheckedUpdateInputObjectSchema } from './objects/${modelName}UncheckedUpdateInput.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${upsertOne}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}Upsert`,\n `z.object({ ${selectZodSchemaLine} ${includeZodSchemaLine} where: ${modelName}WhereUniqueInputObjectSchema, create: z.union([ ${modelName}CreateInputObjectSchema, ${modelName}UncheckedCreateInputObjectSchema ]), update: z.union([ ${modelName}UpdateInputObjectSchema, ${modelName}UncheckedUpdateInputObjectSchema ]) })`\n )}`\n );\n }\n\n if (aggregate) {\n const imports = [\n orderByImport,\n `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,\n `import { ${modelName}WhereUniqueInputObjectSchema } from './objects/${modelName}WhereUniqueInput.schema'`\n ];\n const aggregateOperations = [];\n if (this.aggregateOperationSupport[modelName]) {\n if (this.aggregateOperationSupport[modelName].count) {\n imports.push(\n `import { ${modelName}CountAggregateInputObjectSchema } from './objects/${modelName}CountAggregateInput.schema'`\n );\n aggregateOperations.push(\n `_count: z.union([ z.literal(true), ${modelName}CountAggregateInputObjectSchema ]).optional()`\n );\n }\n if (this.aggregateOperationSupport[modelName].min) {\n imports.push(\n `import { ${modelName}MinAggregateInputObjectSchema } from './objects/${modelName}MinAggregateInput.schema'`\n );\n aggregateOperations.push(\n `_min: ${modelName}MinAggregateInputObjectSchema.optional()`\n );\n }\n if (this.aggregateOperationSupport[modelName].max) {\n imports.push(\n `import { ${modelName}MaxAggregateInputObjectSchema } from './objects/${modelName}MaxAggregateInput.schema'`\n );\n aggregateOperations.push(\n `_max: ${modelName}MaxAggregateInputObjectSchema.optional()`\n );\n }\n if (this.aggregateOperationSupport[modelName].avg) {\n imports.push(\n `import { ${modelName}AvgAggregateInputObjectSchema } from './objects/${modelName}AvgAggregateInput.schema'`\n );\n aggregateOperations.push(\n `_avg: ${modelName}AvgAggregateInputObjectSchema.optional()`\n );\n }\n if (this.aggregateOperationSupport[modelName].sum) {\n imports.push(\n `import { ${modelName}SumAggregateInputObjectSchema } from './objects/${modelName}SumAggregateInput.schema'`\n );\n aggregateOperations.push(\n `_sum: ${modelName}SumAggregateInputObjectSchema.optional()`\n );\n }\n }\n\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${aggregate}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}Aggregate`,\n `z.object({ ${orderByZodSchemaLine} where: ${modelName}WhereInputObjectSchema.optional(), cursor: ${modelName}WhereUniqueInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), ${aggregateOperations.join(\n \", \"\n )} })`\n )}`\n );\n }\n\n if (groupBy) {\n const imports = [\n `import { ${modelName}WhereInputObjectSchema } from './objects/${modelName}WhereInput.schema'`,\n `import { ${modelName}OrderByWithAggregationInputObjectSchema } from './objects/${modelName}OrderByWithAggregationInput.schema'`,\n `import { ${modelName}ScalarWhereWithAggregatesInputObjectSchema } from './objects/${modelName}ScalarWhereWithAggregatesInput.schema'`,\n `import { ${modelName}ScalarFieldEnumSchema } from './enums/${modelName}ScalarFieldEnum.schema'`\n ];\n await writeFileSafely(\n path.join(Transformer.outputPath, `schemas/${groupBy}.schema.ts`),\n `${this.generateImportStatements(\n imports\n )}${this.generateExportSchemaStatement(\n `${modelName}GroupBy`,\n `z.object({ where: ${modelName}WhereInputObjectSchema.optional(), orderBy: z.union([${modelName}OrderByWithAggregationInputObjectSchema, ${modelName}OrderByWithAggregationInputObjectSchema.array()]).optional(), having: ${modelName}ScalarWhereWithAggregatesInputObjectSchema.optional(), take: z.number().optional(), skip: z.number().optional(), by: z.array(${modelName}ScalarFieldEnumSchema) })`\n )}`\n );\n }\n }\n }\n\n generateImportStatements(imports: (string | undefined)[]) {\n let generatedImports = this.generateImportZodStatement();\n generatedImports +=\n imports?.filter(importItem => !!importItem).join(\";\\r\\n\") ?? \"\";\n generatedImports += \"\\n\\n\";\n return generatedImports;\n }\n\n resolveSelectIncludeImportAndZodSchemaLine(model: PrismaDMMF.Model) {\n const { name: modelName } = model;\n\n const hasRelationToAnotherModel = checkModelHasModelRelation(model);\n\n const selectImport = Transformer.isGenerateSelect\n ? `import { ${lowerCaseFirst(modelName)}SelectObjectSchema } from './objects/${lowerCaseFirst(modelName)}Select.schema'`\n : \"\";\n\n const includeImport =\n Transformer.isGenerateInclude && hasRelationToAnotherModel\n ? `import { ${lowerCaseFirst(modelName)}IncludeObjectSchema } from './objects/${lowerCaseFirst(modelName)}Include.schema'`\n : \"\";\n\n let selectZodSchemaLine = \"\";\n let includeZodSchemaLine = \"\";\n let selectZodSchemaLineLazy = \"\";\n let includeZodSchemaLineLazy = \"\";\n\n if (Transformer.isGenerateSelect) {\n const zodSelectObjectSchema = `${lowerCaseFirst(modelName)}SelectObjectSchema.optional()`;\n selectZodSchemaLine = `select: ${zodSelectObjectSchema},`;\n selectZodSchemaLineLazy = `select: z.lazy(() => ${zodSelectObjectSchema}),`;\n }\n\n if (Transformer.isGenerateInclude && hasRelationToAnotherModel) {\n const zodIncludeObjectSchema = `${lowerCaseFirst(modelName)}IncludeObjectSchema.optional()`;\n includeZodSchemaLine = `include: ${zodIncludeObjectSchema},`;\n includeZodSchemaLineLazy = `include: z.lazy(() => ${zodIncludeObjectSchema}),`;\n }\n\n return {\n selectImport,\n includeImport,\n selectZodSchemaLine,\n includeZodSchemaLine,\n selectZodSchemaLineLazy,\n includeZodSchemaLineLazy\n };\n }\n\n resolveOrderByWithRelationImportAndZodSchemaLine(model: PrismaDMMF.Model) {\n const { name: modelName } = model;\n let modelOrderBy = \"\";\n\n if (\n [\"postgresql\", \"mysql\"].includes(Transformer.provider) &&\n Transformer.previewFeatures?.includes(\"fullTextSearch\")\n ) {\n modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationAndSearchRelevanceInput`;\n } else {\n modelOrderBy = `${lowerCaseFirst(modelName)}OrderByWithRelationInput`;\n }\n\n const orderByImport = `import { ${modelOrderBy}ObjectSchema } from './objects/${modelOrderBy}.schema'`;\n const orderByZodSchemaLine = `orderBy: z.union([${modelOrderBy}ObjectSchema, ${modelOrderBy}ObjectSchema.array()]).optional(),`;\n\n return { orderByImport, orderByZodSchemaLine };\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\nimport type { AggregateOperationSupport, Writeable } from \"../types\";\nimport Transformer from \"./transformer\";\n\nexport async function generateZodEnumSchemas(\n prismaSchemaEnum: Writeable<DMMF.SchemaEnum[]>,\n modelSchemaEnum: Writeable<DMMF.SchemaEnum[]>\n) {\n const enumTypes = [...prismaSchemaEnum, ...modelSchemaEnum];\n const enumNames = enumTypes.map(enumItem => enumItem.name);\n Transformer.enumNames = enumNames ?? [];\n const transformer = new Transformer({\n enumTypes\n });\n await transformer.generateEnumSchemas();\n}\n\nexport async function generateZodObjectSchemas(\n inputObjectTypes: Writeable<DMMF.InputType[]>\n) {\n for (let i = 0; i < inputObjectTypes.length; i += 1) {\n const fields = inputObjectTypes[i]?.fields;\n const name = inputObjectTypes[i]?.name;\n const transformer = new Transformer({ name, fields });\n await transformer.generateObjectSchema();\n }\n}\n\nexport async function generateZodModelSchemas(\n models: Writeable<DMMF.Model[]>,\n modelOperations: Writeable<DMMF.ModelMapping[]>,\n aggregateOperationSupport: AggregateOperationSupport\n) {\n const transformer = new Transformer({\n models,\n modelOperations,\n aggregateOperationSupport\n });\n await transformer.generateModelSchemas();\n}\n\nexport async function generateZodIndex() {\n await Transformer.generateIndex();\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\nimport type { SchemaArgInputTypes } from \"../types\";\nimport {\n checkIsModelRelationField,\n checkModelHasManyModelRelation,\n checkModelHasModelRelation\n} from \"./model-helpers\";\n\nexport function addMissingInputObjectTypesForInclude(\n inputObjectTypes: DMMF.InputType[],\n models: DMMF.Model[],\n isGenerateSelect: boolean\n) {\n // generate input object types necessary to support ModelInclude with relation support\n const generatedIncludeInputObjectTypes = generateModelIncludeInputObjectTypes(\n models,\n isGenerateSelect\n );\n\n for (const includeInputObjectType of generatedIncludeInputObjectTypes) {\n inputObjectTypes.push(includeInputObjectType);\n }\n}\n\nfunction generateModelIncludeInputObjectTypes(\n models: DMMF.Model[],\n isGenerateSelect: boolean\n) {\n const modelIncludeInputObjectTypes: DMMF.InputType[] = [];\n for (const model of models) {\n const { name: modelName, fields: modelFields } = model;\n const fields: DMMF.SchemaArg[] = [];\n\n for (const modelField of modelFields) {\n const { name: modelFieldName, isList, type } = modelField;\n\n const isRelationField = checkIsModelRelationField(modelField);\n\n if (isRelationField) {\n const field: DMMF.SchemaArg = {\n name: modelFieldName,\n isRequired: false,\n isNullable: false,\n inputTypes: [\n { isList: false, type: \"Boolean\", location: \"scalar\" },\n {\n isList: false,\n type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,\n location: \"inputObjectTypes\",\n namespace: \"prisma\"\n }\n ]\n };\n fields.push(field);\n }\n }\n\n /**\n * include is not generated for models that do not have a relation with any other models continue onto the next model\n */\n const hasRelationToAnotherModel = checkModelHasModelRelation(model);\n if (!hasRelationToAnotherModel) {\n continue;\n }\n\n const hasManyRelationToAnotherModel = checkModelHasManyModelRelation(model);\n\n const shouldAddCountField = hasManyRelationToAnotherModel;\n if (shouldAddCountField) {\n const inputTypes: SchemaArgInputTypes = [\n { isList: false, type: \"Boolean\", location: \"scalar\" }\n ];\n if (isGenerateSelect) {\n inputTypes.push({\n isList: false,\n type: `${modelName}CountOutputTypeDefaultArgs`,\n location: \"inputObjectTypes\",\n namespace: \"prisma\"\n });\n }\n const _countField: DMMF.SchemaArg = {\n name: \"_count\",\n isRequired: false,\n isNullable: false,\n inputTypes\n };\n fields.push(_countField);\n }\n\n const modelIncludeInputObjectType: DMMF.InputType = {\n name: `${modelName}Include`,\n constraints: {\n maxNumFields: null,\n minNumFields: null\n },\n fields\n };\n modelIncludeInputObjectTypes.push(modelIncludeInputObjectType);\n }\n return modelIncludeInputObjectTypes;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\nimport { checkModelHasModelRelation } from \"./model-helpers\";\n\nexport function addMissingInputObjectTypesForModelArgs(\n inputObjectTypes: DMMF.InputType[],\n models: DMMF.Model[],\n isGenerateSelect: boolean,\n isGenerateInclude: boolean\n) {\n const modelArgsInputObjectTypes = generateModelArgsInputObjectTypes(\n models,\n isGenerateSelect,\n isGenerateInclude\n );\n\n for (const modelArgsInputObjectType of modelArgsInputObjectTypes) {\n inputObjectTypes.push(modelArgsInputObjectType);\n }\n}\nfunction generateModelArgsInputObjectTypes(\n models: DMMF.Model[],\n isGenerateSelect: boolean,\n isGenerateInclude: boolean\n) {\n const modelArgsInputObjectTypes: DMMF.InputType[] = [];\n for (const model of models) {\n const { name: modelName } = model;\n const fields: DMMF.SchemaArg[] = [];\n\n if (isGenerateSelect) {\n const selectField: DMMF.SchemaArg = {\n name: \"select\",\n isRequired: false,\n isNullable: false,\n inputTypes: [\n {\n isList: false,\n type: `${modelName}Select`,\n location: \"inputObjectTypes\",\n namespace: \"prisma\"\n }\n ]\n };\n fields.push(selectField);\n }\n\n const hasRelationToAnotherModel = checkModelHasModelRelation(model);\n\n if (isGenerateInclude && hasRelationToAnotherModel) {\n const includeField: DMMF.SchemaArg = {\n name: \"include\",\n isRequired: false,\n isNullable: false,\n inputTypes: [\n {\n isList: false,\n type: `${modelName}Include`,\n location: \"inputObjectTypes\",\n namespace: \"prisma\"\n }\n ]\n };\n fields.push(includeField);\n }\n\n const modelArgsInputObjectType: DMMF.InputType = {\n name: `${modelName}DefaultArgs`,\n constraints: {\n maxNumFields: null,\n minNumFields: null\n },\n fields\n };\n modelArgsInputObjectTypes.push(modelArgsInputObjectType);\n }\n\n return modelArgsInputObjectTypes;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { SchemaArgInputTypes, Writeable } from \"../types\";\nimport {\n checkIsModelRelationField,\n checkModelHasManyModelRelation\n} from \"./model-helpers\";\n\nexport function addMissingInputObjectTypesForSelect(\n inputObjectTypes: DMMF.InputType[],\n outputObjectTypes: DMMF.OutputType[],\n models: DMMF.Model[]\n) {\n // generate input object types necessary to support ModelSelect._count\n const modelCountOutputTypes = getModelCountOutputTypes(outputObjectTypes);\n const modelCountOutputTypeSelectInputObjectTypes =\n generateModelCountOutputTypeSelectInputObjectTypes(modelCountOutputTypes);\n const modelCountOutputTypeArgsInputObjectTypes =\n generateModelCountOutputTypeArgsInputObjectTypes(modelCountOutputTypes);\n\n const modelSelectInputObjectTypes =\n generateModelSelectInputObjectTypes(models);\n\n const generatedInputObjectTypes = [\n modelCountOutputTypeSelectInputObjectTypes,\n modelCountOutputTypeArgsInputObjectTypes,\n modelSelectInputObjectTypes\n ].flat();\n\n for (const inputObjectType of generatedInputObjectTypes) {\n inputObjectTypes.push(inputObjectType);\n }\n}\n\nfunction getModelCountOutputTypes(outputObjectTypes: DMMF.OutputType[]) {\n return outputObjectTypes.filter(({ name }) =>\n name.includes(\"CountOutputType\")\n );\n}\n\nfunction generateModelCountOutputTypeSelectInputObjectTypes(\n modelCountOutputTypes: DMMF.OutputType[]\n) {\n const modelCountOutputTypeSelectInputObjectTypes: DMMF.InputType[] = [];\n for (const modelCountOutputType of modelCountOutputTypes) {\n const {\n name: modelCountOutputTypeName,\n fields: modelCountOutputTypeFields\n } = modelCountOutputType;\n const modelCountOutputTypeSelectInputObjectType: DMMF.InputType = {\n name: `${modelCountOutputTypeName}Select`,\n constraints: {\n maxNumFields: null,\n minNumFields: null\n },\n fields: modelCountOutputTypeFields.map(({ name }) => ({\n name,\n isRequired: false,\n isNullable: false,\n inputTypes: [\n {\n isList: false,\n type: `Boolean`,\n location: \"scalar\"\n }\n ]\n }))\n };\n modelCountOutputTypeSelectInputObjectTypes.push(\n modelCountOutputTypeSelectInputObjectType\n );\n }\n\n return modelCountOutputTypeSelectInputObjectTypes;\n}\n\nfunction generateModelCountOutputTypeArgsInputObjectTypes(\n modelCountOutputTypes: DMMF.OutputType[]\n) {\n const modelCountOutputTypeArgsInputObjectTypes: DMMF.InputType[] = [];\n for (const modelCountOutputType of modelCountOutputTypes) {\n const { name: modelCountOutputTypeName } = modelCountOutputType;\n const modelCountOutputTypeArgsInputObjectType: DMMF.InputType = {\n name: `${modelCountOutputTypeName}DefaultArgs`,\n constraints: {\n maxNumFields: null,\n minNumFields: null\n },\n fields: [\n {\n name: \"select\",\n isRequired: false,\n isNullable: false,\n inputTypes: [\n {\n isList: false,\n type: `${modelCountOutputTypeName}Select`,\n location: \"inputObjectTypes\",\n namespace: \"prisma\"\n }\n ]\n }\n ]\n };\n modelCountOutputTypeArgsInputObjectTypes.push(\n modelCountOutputTypeArgsInputObjectType\n );\n }\n\n return modelCountOutputTypeArgsInputObjectTypes;\n}\n\nfunction generateModelSelectInputObjectTypes(models: DMMF.Model[]) {\n const modelSelectInputObjectTypes: DMMF.InputType[] = [];\n for (const model of models) {\n const { name: modelName, fields: modelFields } = model;\n const fields: DMMF.SchemaArg[] = [];\n\n for (const modelField of modelFields) {\n const { name: modelFieldName, isList, type } = modelField;\n\n const isRelationField = checkIsModelRelationField(modelField);\n\n const field: Writeable<DMMF.SchemaArg> = {\n name: modelFieldName,\n isRequired: false,\n isNullable: false,\n inputTypes: [\n { isList: false, type: \"Boolean\", location: \"scalar\" }\n ] as Writeable<DMMF.SchemaArg[\"inputTypes\"]>\n };\n\n if (isRelationField) {\n const schemaArgInputType: ArrayValues<SchemaArgInputTypes> = {\n isList: false,\n type: isList ? `${type}FindManyArgs` : `${type}DefaultArgs`,\n location: \"inputObjectTypes\",\n namespace: \"prisma\"\n };\n field.inputTypes.push(schemaArgInputType);\n }\n\n fields.push(field);\n }\n\n const hasManyRelationToAnotherModel = checkModelHasManyModelRelation(model);\n\n const shouldAddCountField = hasManyRelationToAnotherModel;\n if (shouldAddCountField) {\n const _countField: DMMF.SchemaArg = {\n name: \"_count\",\n isRequired: false,\n isNullable: false,\n inputTypes: [\n { isList: false, type: \"Boolean\", location: \"scalar\" },\n {\n isList: false,\n type: `${modelName}CountOutputTypeDefaultArgs`,\n location: \"inputObjectTypes\",\n namespace: \"prisma\"\n }\n ]\n };\n fields.push(_countField);\n }\n\n const modelSelectInputObjectType: DMMF.InputType = {\n name: `${modelName}Select`,\n constraints: {\n maxNumFields: null,\n minNumFields: null\n },\n fields\n };\n modelSelectInputObjectTypes.push(modelSelectInputObjectType);\n }\n\n return modelSelectInputObjectTypes;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { DMMF } from \"@prisma/generator-helper\";\nimport type { ArrayValues } from \"@stryke/types/array\";\nimport type { Writeable } from \"../types\";\n\nexport function changeOptionalToRequiredFields(\n inputObjectTypes: Writeable<DMMF.InputType[]>\n) {\n inputObjectTypes.map((item: Writeable<DMMF.InputType>) => {\n if (\n item.name.includes(\"WhereUniqueInput\") &&\n // eslint-disable-next-line ts/no-non-null-asserted-optional-chain\n item.constraints.fields?.length! > 0\n ) {\n item.fields = item.fields.map(\n (subItem: Writeable<ArrayValues<DMMF.InputType[\"fields\"]>>) => {\n if (item.constraints.fields?.includes(subItem.name)) {\n subItem.isRequired = true;\n return subItem;\n }\n return subItem;\n }\n );\n }\n return item;\n });\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\nimport type { ConnectorType, DMMF } from \"@prisma/generator-helper\";\nimport type { Writeable } from \"../types\";\nimport { addMissingInputObjectTypesForAggregate } from \"./aggregate-helpers\";\nimport { addMissingInputObjectTypesForInclude } from \"./include-helpers\";\nimport { addMissingInputObjectTypesForModelArgs } from \"./modelArgs-helpers\";\nimport { addMissingInputObjectTypesForMongoDbRawOpsAndQueries } from \"./mongodb-helpers\";\nimport { addMissingInputObjectTypesForSelect } from \"./select-helpers\";\nimport Transformer from \"./transformer\";\nimport { changeOptionalToRequiredFields } from \"./whereUniqueInput-helpers\";\n\ninterface AddMissingInputObjectTypeOptions {\n isGenerateSelect: boolean;\n isGenerateInclude: boolean;\n}\n\nexport function addMissingZodInputObjectTypes(\n inputObjectTypes: DMMF.InputType[],\n outputObjectTypes: DMMF.OutputType[],\n models: DMMF.Model[],\n modelOperations: DMMF.ModelMapping[],\n dataSourceProvider: ConnectorType,\n options: AddMissingInputObjectTypeOptions\n) {\n // TODO: remove once Prisma fix this issue: https://github.com/prisma/prisma/issues/14900\n if (dataSourceProvider === \"mongodb\") {\n addMissingInputObjectTypesForMongoDbRawOpsAndQueries(\n modelOperations,\n outputObjectTypes,\n inputObjectTypes\n );\n }\n addMissingInputObjectTypesForAggregate(inputObjectTypes, outputObjectTypes);\n if (options.isGenerateSelect) {\n addMissingInputObjectTypesForSelect(\n inputObjectTypes,\n outputObjectTypes,\n models\n );\n Transformer.setIsGenerateSelect(true);\n }\n if (options.isGenerateSelect || options.isGenerateInclude) {\n addMissingInputObjectTypesForModelArgs(\n inputObjectTypes,\n models,\n options.isGenerateSelect,\n options.isGenerateInclude\n );\n }\n if (options.isGenerateInclude) {\n addMissingInputObjectTypesForInclude(\n inputObjectTypes,\n models,\n options.isGenerateSelect\n );\n Transformer.setIsGenerateInclude(true);\n }\n\n changeOptionalToRequiredFields(\n inputObjectTypes as Writeable<DMMF.InputType[]>\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n DMMF,\n EnvValue,\n GeneratorOptions\n} from \"@prisma/generator-helper\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, removeDirectory } from \"@stryke/fs/helpers\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { lowerCaseFirst } from \"@stryke/string-format/lower-case-first\";\nimport path from \"node:path\";\nimport pluralize from \"pluralize\";\nimport { configSchema } from \"./config\";\nimport {\n constructDefaultOptions,\n constructShield,\n constructZodModels,\n generateCreateRouterImport,\n generateProcedure,\n generateRouterImport,\n generateRouterSchemaImports,\n generateTRPCExports,\n getInputTypeByOpName,\n resolveModelsComments\n} from \"./helpers\";\nimport { project } from \"./project\";\nimport type { RootType, Writeable } from \"./types\";\nimport { getPrismaInternals } from \"./utils/get-prisma-internals\";\nimport { writeFileSafely } from \"./utils/write-file-safely\";\nimport { resolveZodAggregateOperationSupport } from \"./zod/aggregate-helpers\";\nimport {\n hideZodInputObjectTypesAndRelatedFields,\n resolveZodModelsComments\n} from \"./zod/comments-helpers\";\nimport {\n generateZodEnumSchemas,\n generateZodIndex,\n generateZodModelSchemas,\n generateZodObjectSchemas\n} from \"./zod/generator-helpers\";\nimport { addMissingZodInputObjectTypes } from \"./zod/helpers\";\nimport Transformer from \"./zod/transformer\";\n\nexport async function generate(options: GeneratorOptions) {\n // eslint-disable-next-line no-console\n console.log(\"[STORM]: Running the Storm Software - Prisma tRPC generator \\n\");\n\n const internals = await getPrismaInternals();\n\n // eslint-disable-next-line no-console\n console.log(`[STORM]: Validating configuration options \\n`);\n\n const outputDir = internals.parseEnvValue(\n options.generator.output as EnvValue\n );\n const results = await configSchema.safeParseAsync(options.generator.config);\n if (!results.success) {\n throw new Error(\"Invalid options passed\");\n }\n\n const config = results.data;\n const consoleLog = (message: string) => {\n if (config.debug) {\n // eslint-disable-next-line no-console\n console.log(`[STORM]: ${message} \\n`);\n }\n };\n\n consoleLog(`Using configuration parameters: \\n${JSON.stringify(config)}`);\n\n consoleLog(`Preparing output directory: ${outputDir}`);\n\n await removeDirectory(outputDir);\n await createDirectory(outputDir);\n\n consoleLog(\"Finding Prisma Client generator\");\n\n const prismaClientProvider = options.otherGenerators.find(\n it => internals.parseEnvValue(it.provider) === \"prisma-client-js\"\n );\n if (!prismaClientProvider) {\n throw new Error(\n \"No Prisma Client generator found. Please add `prisma-client-js` to your generator list.\"\n );\n }\n\n consoleLog(\"Generating Prisma Client DMMF\");\n\n const prismaClientDmmf = (await internals.getDMMF({\n datamodel: options.datamodel,\n previewFeatures: prismaClientProvider?.previewFeatures\n })) as Writeable<DMMF.Document>;\n\n const modelOperations = prismaClientDmmf.mappings\n .modelOperations as DMMF.ModelMapping[];\n const inputObjectTypes = prismaClientDmmf.schema.inputObjectTypes\n .prisma as DMMF.InputType[];\n const outputObjectTypes = prismaClientDmmf.schema.outputObjectTypes\n .prisma as DMMF.OutputType[];\n const enumTypes = prismaClientDmmf.schema.enumTypes;\n const models = prismaClientDmmf.datamodel.models as Writeable<DMMF.Model[]>;\n const hiddenModels: string[] = [];\n const hiddenFields: string[] = [];\n\n if (config.withZod !== false) {\n consoleLog(\"Generating Zod schemas\");\n\n const zodOutputPath = internals.parseEnvValue(options.generator.output!);\n\n await createDirectory(zodOutputPath);\n Transformer.setOutputPath(zodOutputPath);\n\n if (prismaClientProvider?.isCustomOutput) {\n Transformer.setPrismaClientOutputPath(\n prismaClientProvider.output?.value as string\n );\n }\n\n await constructZodModels(\n models,\n joinPaths(zodOutputPath, \"schemas\", \"models\"),\n config,\n options\n );\n\n resolveZodModelsComments(\n models,\n modelOperations,\n enumTypes,\n hiddenModels,\n hiddenFields\n );\n\n await generateZodEnumSchemas(enumTypes.prisma, enumTypes.model!);\n\n const dataSource = options.datasources?.[0];\n if (!dataSource) {\n throw new Error(\"No datasource found\");\n }\n\n const previewFeatures = prismaClientProvider?.previewFeatures;\n Transformer.provider = dataSource.provider;\n Transformer.previewFeatures = previewFeatures;\n\n addMissingZodInputObjectTypes(\n inputObjectTypes,\n outputObjectTypes,\n models,\n modelOperations,\n dataSource.provider,\n {\n isGenerateSelect: true,\n isGenerateInclude: true\n }\n );\n\n const aggregateOperationSupport =\n resolveZodAggregateOperationSupport(inputObjectTypes);\n\n hideZodInputObjectTypesAndRelatedFields(\n inputObjectTypes,\n hiddenModels,\n hiddenFields\n );\n\n await generateZodObjectSchemas(\n inputObjectTypes as Writeable<DMMF.InputType[]>\n );\n\n await generateZodModelSchemas(\n models,\n modelOperations,\n aggregateOperationSupport\n );\n await generateZodIndex();\n } else {\n consoleLog(\"Skipping Zod schemas generation\");\n }\n\n const queries: RootType = [];\n const mutations: RootType = [];\n const subscriptions: RootType = [];\n\n prismaClientDmmf.mappings.modelOperations.forEach(modelOperation => {\n const { model: _model, plural: _plural, ...operations } = modelOperation;\n for (const [opType, opNameWithModel] of Object.entries(operations)) {\n if (\n [\n \"findUnique\",\n \"findUniqueOrThrow\",\n \"findFirst\",\n \"findFirstOrThrow\",\n \"findRaw\",\n \"findMany\",\n \"aggregateRaw\",\n \"count\",\n \"aggregate\",\n \"groupBy\"\n ].includes(opType)\n ) {\n queries.push(opNameWithModel as string);\n }\n\n if (\n [\n \"createOne\",\n \"createMany\",\n \"createManyAndReturn\",\n \"deleteOne\",\n \"deleteMany\",\n \"updateOne\",\n \"updateMany\",\n \"updateManyAndReturn\",\n \"upsertOne\"\n ].includes(opType)\n ) {\n mutations.push(opNameWithModel as string);\n }\n }\n });\n\n queries.sort();\n mutations.sort();\n subscriptions.sort();\n\n if (\n config.withShield &&\n !(\n typeof config.withShield === \"string\" &&\n (existsSync(joinPaths(outputDir, config.withShield)) ||\n existsSync(joinPaths(outputDir, `./${config.withShield}.ts`)) ||\n existsSync(joinPaths(outputDir, config.withShield, \"./shield.ts\")))\n )\n ) {\n consoleLog(`Generating tRPC Shield source file to ${outputDir}`);\n await writeFileSafely(\n joinPaths(outputDir, \"./shield.ts\"),\n await constructShield(\n { queries, mutations, subscriptions },\n config,\n options,\n outputDir\n )\n );\n } else {\n consoleLog(\"Skipping tRPC Shield generation\");\n }\n\n consoleLog(`Generating tRPC source code for ${models.length} models`);\n\n if (config.trpcOptions && typeof config.trpcOptions === \"boolean\") {\n consoleLog(`Generating tRPC options source file to ${outputDir}`);\n\n await writeFileSafely(\n joinPaths(outputDir, \"./options.ts\"),\n constructDefaultOptions(config, options, outputDir)\n );\n }\n\n resolveModelsComments(models, hiddenModels);\n\n consoleLog(\"Generating tRPC export file\");\n const trpcExports = project.createSourceFile(\n path.resolve(outputDir, \"trpc.ts\"),\n undefined,\n { overwrite: true }\n );\n\n await generateTRPCExports(trpcExports, config, options, outputDir);\n\n consoleLog(\"Generating tRPC app router\");\n const appRouter = project.createSourceFile(\n path.resolve(outputDir, \"routers\", `index.ts`),\n undefined,\n { overwrite: true }\n );\n\n consoleLog(\"Generating tRPC router imports\");\n\n generateCreateRouterImport({\n sourceFile: appRouter\n });\n\n const routerStatements = [];\n\n for (const modelOperation of modelOperations) {\n const { model, ...operations } = modelOperation;\n if (hiddenModels.includes(model)) {\n consoleLog(`Skipping model ${model} as it is hidden`);\n continue;\n }\n if (!model) {\n consoleLog(`Skipping model ${model} as it is not defined`);\n continue;\n }\n\n const modelActions = Object.keys(operations).filter<DMMF.ModelAction>(\n (opType): opType is DMMF.ModelAction =>\n // eslint-disable-next-line unicorn/prefer-includes\n config.generateModelActions.some(\n generateModelAction =>\n generateModelAction === opType.replace(\"One\", \"\")\n )\n );\n if (!modelActions.length) {\n consoleLog(`Skipping model ${model} as it has no actions to generate`);\n continue;\n }\n\n const plural = pluralize(lowerCaseFirst(model));\n\n consoleLog(`Generating tRPC router for model ${model}`);\n\n generateRouterImport(appRouter, plural, model);\n const modelRouter = project.createSourceFile(\n path.resolve(outputDir, \"routers\", `${lowerCaseFirst(model)}.router.ts`),\n undefined,\n { overwrite: true }\n );\n\n generateCreateRouterImport({\n sourceFile: modelRouter,\n config\n });\n\n if (config.withZod) {\n consoleLog(\"Generating Zod schemas imports\");\n generateRouterSchemaImports(modelRouter, model, modelActions);\n }\n\n modelRouter.addStatements(/* ts */ `\n export const ${plural}Router = t.router({`);\n\n for (const opType of modelActions) {\n const opNameWithModel = operations[opType];\n if (opNameWithModel) {\n const baseOpType = opType.replace(\"OrThrow\", \"\");\n\n generateProcedure(\n modelRouter,\n opNameWithModel,\n getInputTypeByOpName(baseOpType, model)!,\n model,\n opType,\n baseOpType,\n config\n );\n }\n }\n\n modelRouter.addStatements(/* ts */ `\n })`);\n\n modelRouter.formatText({ indentSize: 2 });\n routerStatements.push(/* ts */ `\n ${lowerCaseFirst(model)}: ${plural}Router`);\n\n consoleLog(\n `Generated tRPC router for model ${model} with ${modelActions.length} actions`\n );\n }\n\n consoleLog(\"Generating tRPC app router\");\n\n appRouter.addStatements(/* ts */ `\nexport const appRouter = t.router({${routerStatements.join()}});\n\nexport type AppRouter = typeof appRouter;`);\n\n appRouter.formatText({ indentSize: 2 });\n\n consoleLog(\"Saving tRPC router source files to disk\");\n\n await project.save();\n\n consoleLog(\"Storm Software - Prisma tRPC generator completed successfully\");\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\n/**\n * The prisma-trpc-generator library used by Storm Software for building NodeJS applications.\n *\n * @remarks\n * A fork of the prisma-trpc-generator code to work in ESM\n *\n * @packageDocumentation\n */\n\nimport { generate } from \"./prisma-generator\";\nimport { getPrismaGeneratorHelper } from \"./utils/get-prisma-internals\";\n\ngetPrismaGeneratorHelper()\n .then(helpers => {\n helpers.generatorHandler({\n onManifest: () => ({\n defaultOutput: \"./generated\",\n prettyName: \"Storm Software - Prisma tRPC Generator\",\n requiresGenerators: [\"prisma-client-js\"]\n }),\n onGenerate: generate\n });\n })\n .catch(reason => {\n // eslint-disable-next-line no-console\n console.error(\n `An error occured while generating prisma tRPC source code: ${reason}`\n );\n });\n"],"x_google_ignoreList":[1],"mappings":"oxCA2BA,SAAgB,EAA6C,EAAc,CACzE,OAAQ,GAAQ,EAAM,OAAO,EAAE,CAAC,aAAa,CAAG,EAAM,MAAM,EAAE,wBC1B/D,SAAU,EAAM,EAAW,CAEtB,OAAA,IAAmB,YAAc,OAAO,GAAY,UAAY,OAAO,GAAW,SAEpF,EAAO,QAAUA,GAAW,CACnB,OAAO,QAAW,YAAc,OAAO,IAEhD,OAAO,UAAY,CACjB,OAAOA,GAAW,EAClB,CAGF,EAAK,UAAYA,GAAW,KAEvB,UAAY,CAGnB,IAAI,EAAc,EAAE,CAChB,EAAgB,EAAE,CAClB,EAAe,EAAE,C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,SACA,SACA,MACA,WACA,UACA,OACA,YACA,QACA,YACA,QACA,QACA,QACA,QACA,UACA,SACA,OACA,OACA,UACA,QACA,WACA,MACA,WACA,cACA,QACA,SACA,WACA,YACA,MACA,SACA,YACA,YACA,YACA,WACA,WACA,MACA,UACA,UACA,WACA,WACA,eACA,SACA,SACA,YACA,WACA,YACA,cACA,QACA,UACA,QACA,SACA,aACA,YACA,WACA,OACA,QACA,OACA,QACA,QACA,MACA,QACA,OACA,OACA,YACA,OACA,WACA,SACA,SACA,YACA,WACA,OACA,WACA,OACA,SACA,WACA,SACA,SACA,WACA,SACA,WACA,UACA,QACA,QACA,SACA,UACA,iBACA,QACA,OACA,SACA,UACA,UACA,aACA,WACA,MACA,eAEA,gBACA,SACA,SACA,YACA,WACA,QACA,UACD,CAAC,QAAQA,EAAU,mBAAmB,CAEhCA,GACP,SCleF,IAAA,EAAA,SAAA,EAAA,OACE,GAAA,WAAA,aACA,EAAA,kBAAA,oBACA,EAAA,UAAA,YACA,EAAA,iBAAA,mBACA,EAAA,SAAA,WACA,EAAA,OAAA,SACA,EAAA,WAAA,aACA,EAAA,oBAAA,sBACA,EAAA,OAAA,SACA,EAAA,WAAA,aACA,EAAA,oBAAA,sBACA,EAAA,OAAA,SACA,EAAA,OAAA,SACA,EAAA,WAAA,aACA,EAAA,QAAA,UACA,EAAA,MAAA,QACA,EAAA,UAAA,YACA,EAAA,QAAA,UACA,EAAA,aAAA,sBAGF,MAAA,GAAA,EAAA,WAAA,EAAA,CAEA,EAAA,EAAA,QAAA,CAAA,MAAA,CAAA,UAAA,GAAA,CAAA,GAAA,EAAA,aAAA,GAAA,SAAA,EAAA,aAAA,GAAA,KAAA,EAAA,aAAA,GAAA,MAAA,IAAA,IAAA,GAAA,EAAA,aAAA,GAAA,QAAA,EAAA,aAAA,GAAA,KAAA,EAAA,aAAA,GAAA,OAAA,IAAA,IAAA,GAAA,EAAA,CAkBA,GAAA,EAAA,OAAA,oUAYM,EAAA,MAAA,IAAA,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AM,EAAc,EAAQ,iBAC1B,EAAK,QAAQ,EAAW,UAAW,GAAG,EAAe,EAAM,CAAC,YAAY,CACxE,IAAA,GACA,CAAE,UAAW,GAAM,CACpB,CAED,EAA2B,CACzB,WAAY,EACZ,SACD,CAAC,CAEE,EAAO,UACT,EAAW,iCAAiC,CAC5C,GAA4B,EAAa,EAAO,EAAa,EAG/D,EAAY,cAAuB;qBAClB,EAAO,qBAAqB,CAE7C,IAAK,IAAM,KAAU,EAAc,CACjC,IAAM,EAAkB,EAAW,GACnC,GAAI,EAAiB,CACnB,IAAM,EAAa,EAAO,QAAQ,UAAW,GAAG,CAEhD,GACE,EACA,EACA,EAAqB,EAAY,EAAM,CACvC,EACA,EACA,EACA,EACD,EAIL,EAAY,cAAuB;QAC/B,CAEJ,EAAY,WAAW,CAAE,WAAY,EAAG,CAAC,CACzC,EAAiB,KAAc;QAC3B,EAAe,EAAM,CAAC,IAAI,EAAO,QAAQ,CAE7C,EACE,mCAAmC,EAAM,QAAQ,EAAa,OAAO,UACtE,CAGH,EAAW,6BAA6B,CAExC,EAAU,cAAuB;qCACE,EAAiB,MAAM,CAAC;;2CAElB,CAEzC,EAAU,WAAW,CAAE,WAAY,EAAG,CAAC,CAEvC,EAAW,0CAA0C,CAErD,MAAM,EAAQ,MAAM,CAEpB,EAAW,gEAAgE,CC3W7E,IAA0B,CACvB,KAAK,GAAW,CACf,EAAQ,iBAAiB,CACvB,gBAAmB,CACjB,cAAe,cACf,WAAY,yCACZ,mBAAoB,CAAC,mBAAmB,CACzC,EACD,WAAY,GACb,CAAC,EACF,CACD,MAAM,GAAU,CAEf,QAAQ,MACN,8DAA8D,IAC/D,EACD"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 License, and is\n free for commercial and private use. For more information, please visit\n our licensing page.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://stormsoftware.com/projects/stryke/docs\n Contact: https://stormsoftware.com/contact\n License: https://stormsoftware.com/projects/stryke/license\n\n ------------------------------------------------------------------- */\n\n/**\n * The prisma-trpc-generator library used by Storm Software for building NodeJS applications.\n *\n * @remarks\n * A fork of the prisma-trpc-generator code to work in ESM\n *\n * @packageDocumentation\n */\n\nimport { generate } from \"./prisma-generator\";\nimport { getPrismaGeneratorHelper } from \"./utils/get-prisma-internals\";\n\ngetPrismaGeneratorHelper()\n .then(helpers => {\n helpers.generatorHandler({\n onManifest: () => ({\n defaultOutput: \"./generated\",\n prettyName: \"Storm Software - Prisma tRPC Generator\",\n requiresGenerators: [\"prisma-client-js\"]\n }),\n onGenerate: generate\n });\n })\n .catch(reason => {\n // eslint-disable-next-line no-console\n console.error(\n `An error occured while generating prisma tRPC source code: ${reason}`\n );\n });\n"],"mappings":"8HA6BA,GAA0B,CACvB,KAAK,GAAW,CACf,EAAQ,iBAAiB,CACvB,gBAAmB,CACjB,cAAe,cACf,WAAY,yCACZ,mBAAoB,CAAC,mBAAmB,CACzC,EACD,WAAY,EACb,CAAC,EACF,CACD,MAAM,GAAU,CAEf,QAAQ,MACN,8DAA8D,IAC/D,EACD"}
|