@stryke/prisma-trpc-generator 0.13.49 → 0.13.51

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.
Files changed (104) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +31 -1
  2. package/dist/_virtual/rolldown_runtime.mjs +32 -1
  3. package/dist/config.cjs +50 -1
  4. package/dist/config.mjs +49 -1
  5. package/dist/config.mjs.map +1 -1
  6. package/dist/generator.cjs +1 -1
  7. package/dist/generator.mjs +3 -1
  8. package/dist/helpers.cjs +281 -32
  9. package/dist/helpers.mjs +271 -32
  10. package/dist/helpers.mjs.map +1 -1
  11. package/dist/index.cjs +26 -1
  12. package/dist/index.mjs +27 -1
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/packages/env/src/get-env-paths.cjs +87 -1
  15. package/dist/packages/env/src/get-env-paths.mjs +84 -1
  16. package/dist/packages/env/src/get-env-paths.mjs.map +1 -1
  17. package/dist/packages/string-format/src/acronyms.cjs +408 -1
  18. package/dist/packages/string-format/src/acronyms.mjs +407 -1
  19. package/dist/packages/string-format/src/acronyms.mjs.map +1 -1
  20. package/dist/packages/string-format/src/articles.cjs +10 -1
  21. package/dist/packages/string-format/src/articles.mjs +9 -1
  22. package/dist/packages/string-format/src/articles.mjs.map +1 -1
  23. package/dist/packages/string-format/src/combine.cjs +15 -1
  24. package/dist/packages/string-format/src/combine.mjs +14 -1
  25. package/dist/packages/string-format/src/combine.mjs.map +1 -1
  26. package/dist/packages/string-format/src/conjunctions.cjs +32 -1
  27. package/dist/packages/string-format/src/conjunctions.mjs +31 -1
  28. package/dist/packages/string-format/src/conjunctions.mjs.map +1 -1
  29. package/dist/packages/string-format/src/decamelize.cjs +14 -1
  30. package/dist/packages/string-format/src/decamelize.mjs +13 -1
  31. package/dist/packages/string-format/src/decamelize.mjs.map +1 -1
  32. package/dist/packages/string-format/src/format-special-cases.cjs +33 -1
  33. package/dist/packages/string-format/src/format-special-cases.mjs +33 -1
  34. package/dist/packages/string-format/src/format-special-cases.mjs.map +1 -1
  35. package/dist/packages/string-format/src/lower-case-first.cjs +17 -1
  36. package/dist/packages/string-format/src/lower-case-first.mjs +16 -1
  37. package/dist/packages/string-format/src/lower-case-first.mjs.map +1 -1
  38. package/dist/packages/string-format/src/prepositions.cjs +68 -1
  39. package/dist/packages/string-format/src/prepositions.mjs +67 -1
  40. package/dist/packages/string-format/src/prepositions.mjs.map +1 -1
  41. package/dist/packages/string-format/src/special-cases.cjs +53 -1
  42. package/dist/packages/string-format/src/special-cases.mjs +52 -1
  43. package/dist/packages/string-format/src/special-cases.mjs.map +1 -1
  44. package/dist/packages/string-format/src/title-case.cjs +19 -1
  45. package/dist/packages/string-format/src/title-case.mjs +19 -1
  46. package/dist/packages/string-format/src/title-case.mjs.map +1 -1
  47. package/dist/packages/string-format/src/upper-case-first.cjs +17 -1
  48. package/dist/packages/string-format/src/upper-case-first.mjs +16 -1
  49. package/dist/packages/string-format/src/upper-case-first.mjs.map +1 -1
  50. package/dist/prisma-generator.cjs +185 -8
  51. package/dist/prisma-generator.mjs +184 -8
  52. package/dist/prisma-generator.mjs.map +1 -1
  53. package/dist/project.cjs +15 -1
  54. package/dist/project.mjs +14 -1
  55. package/dist/project.mjs.map +1 -1
  56. package/dist/utils/format-file.cjs +25 -1
  57. package/dist/utils/format-file.mjs +23 -1
  58. package/dist/utils/format-file.mjs.map +1 -1
  59. package/dist/utils/get-jiti.cjs +21 -1
  60. package/dist/utils/get-jiti.mjs +20 -1
  61. package/dist/utils/get-jiti.mjs.map +1 -1
  62. package/dist/utils/get-prisma-internals.cjs +13 -1
  63. package/dist/utils/get-prisma-internals.mjs +12 -1
  64. package/dist/utils/get-prisma-internals.mjs.map +1 -1
  65. package/dist/utils/write-file-safely.cjs +32 -2
  66. package/dist/utils/write-file-safely.mjs +29 -2
  67. package/dist/utils/write-file-safely.mjs.map +1 -1
  68. package/dist/zod/aggregate-helpers.cjs +70 -1
  69. package/dist/zod/aggregate-helpers.mjs +67 -1
  70. package/dist/zod/aggregate-helpers.mjs.map +1 -1
  71. package/dist/zod/comments-helpers.cjs +77 -1
  72. package/dist/zod/comments-helpers.mjs +75 -1
  73. package/dist/zod/comments-helpers.mjs.map +1 -1
  74. package/dist/zod/docs-helpers.cjs +23 -3
  75. package/dist/zod/docs-helpers.mjs +20 -3
  76. package/dist/zod/docs-helpers.mjs.map +1 -1
  77. package/dist/zod/generator-helpers.cjs +34 -1
  78. package/dist/zod/generator-helpers.mjs +31 -1
  79. package/dist/zod/generator-helpers.mjs.map +1 -1
  80. package/dist/zod/helpers.cjs +26 -1
  81. package/dist/zod/helpers.mjs +26 -1
  82. package/dist/zod/helpers.mjs.map +1 -1
  83. package/dist/zod/include-helpers.cjs +69 -1
  84. package/dist/zod/include-helpers.mjs +69 -1
  85. package/dist/zod/include-helpers.mjs.map +1 -1
  86. package/dist/zod/model-helpers.cjs +244 -1
  87. package/dist/zod/model-helpers.mjs +236 -1
  88. package/dist/zod/model-helpers.mjs.map +1 -1
  89. package/dist/zod/modelArgs-helpers.cjs +56 -1
  90. package/dist/zod/modelArgs-helpers.mjs +56 -1
  91. package/dist/zod/modelArgs-helpers.mjs.map +1 -1
  92. package/dist/zod/mongodb-helpers.cjs +49 -1
  93. package/dist/zod/mongodb-helpers.mjs +48 -1
  94. package/dist/zod/mongodb-helpers.mjs.map +1 -1
  95. package/dist/zod/select-helpers.cjs +128 -1
  96. package/dist/zod/select-helpers.mjs +128 -1
  97. package/dist/zod/select-helpers.mjs.map +1 -1
  98. package/dist/zod/transformer.cjs +434 -19
  99. package/dist/zod/transformer.mjs +432 -19
  100. package/dist/zod/transformer.mjs.map +1 -1
  101. package/dist/zod/whereUniqueInput-helpers.cjs +17 -1
  102. package/dist/zod/whereUniqueInput-helpers.mjs +16 -1
  103. package/dist/zod/whereUniqueInput-helpers.mjs.map +1 -1
  104. package/package.json +4 -4
@@ -1,2 +1,24 @@
1
- import e from"prettier";async function t(t){let n=await e.resolveConfig(process.cwd()),r=n;return n||(r={trailingComma:`all`,tabWidth:2,printWidth:80,bracketSpacing:!0,semi:!0,singleQuote:!0,useTabs:!1}),await e.format(t,{...r,parser:`typescript`})}export{t as formatFile};
1
+ import prettier from "prettier";
2
+
3
+ //#region src/utils/format-file.ts
4
+ async function formatFile(content) {
5
+ const options = await prettier.resolveConfig(process.cwd());
6
+ let formatOptions = options;
7
+ if (!options) formatOptions = {
8
+ trailingComma: "all",
9
+ tabWidth: 2,
10
+ printWidth: 80,
11
+ bracketSpacing: true,
12
+ semi: true,
13
+ singleQuote: true,
14
+ useTabs: false
15
+ };
16
+ return await prettier.format(content, {
17
+ ...formatOptions,
18
+ parser: "typescript"
19
+ });
20
+ }
21
+
22
+ //#endregion
23
+ export { formatFile };
2
24
  //# sourceMappingURL=format-file.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"format-file.mjs","names":[],"sources":["../../src/utils/format-file.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\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"],"mappings":"wBAmBA,eAAsB,EAAW,EAAkC,CACjE,IAAM,EAAU,MAAM,EAAS,cAAc,QAAQ,KAAK,CAAC,CAEvD,EAAgB,EAkBpB,OAjBK,IACH,EAAgB,CACd,cAAe,MACf,SAAU,EACV,WAAY,GACZ,eAAgB,GAChB,KAAM,GACN,YAAa,GACb,QAAS,GACV,EAGe,MAAM,EAAS,OAAO,EAAS,CAC/C,GAAG,EACH,OAAQ,aACT,CAAC"}
1
+ {"version":3,"file":"format-file.mjs","names":[],"sources":["../../src/utils/format-file.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\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"],"mappings":";;;AAmBA,eAAsB,WAAW,SAAkC;CACjE,MAAM,UAAU,MAAM,SAAS,cAAc,QAAQ,KAAK,CAAC;CAE3D,IAAI,gBAAgB;AACpB,KAAI,CAAC,QACH,iBAAgB;EACd,eAAe;EACf,UAAU;EACV,YAAY;EACZ,gBAAgB;EAChB,MAAM;EACN,aAAa;EACb,SAAS;EACV;AAQH,QALkB,MAAM,SAAS,OAAO,SAAS;EAC/C,GAAG;EACH,QAAQ;EACT,CAAC"}
@@ -1 +1,21 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`../packages/env/src/get-env-paths.cjs`);let n=require(`@stryke/path/join-paths`),r=require(`@stryke/fs/get-workspace-root`),i=require(`jiti`),a;function o(){if(!a){let e=t.getEnvPaths();a=(0,i.createJiti)((0,r.getWorkspaceRoot)(),{fsCache:(0,n.joinPaths)(e.cache,`jiti`),interopDefault:!0})}return a}exports.getJiti=o;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_get_env_paths = require('../packages/env/src/get-env-paths.cjs');
3
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
4
+ let __stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
5
+ let jiti = require("jiti");
6
+
7
+ //#region src/utils/get-jiti.ts
8
+ let jiti$1;
9
+ function getJiti() {
10
+ if (!jiti$1) {
11
+ const envPaths = require_get_env_paths.getEnvPaths();
12
+ jiti$1 = (0, jiti.createJiti)((0, __stryke_fs_get_workspace_root.getWorkspaceRoot)(), {
13
+ fsCache: (0, __stryke_path_join_paths.joinPaths)(envPaths.cache, "jiti"),
14
+ interopDefault: true
15
+ });
16
+ }
17
+ return jiti$1;
18
+ }
19
+
20
+ //#endregion
21
+ exports.getJiti = getJiti;
@@ -1,2 +1,21 @@
1
- import{getEnvPaths as e}from"../packages/env/src/get-env-paths.mjs";import{joinPaths as t}from"@stryke/path/join-paths";import{getWorkspaceRoot as n}from"@stryke/fs/get-workspace-root";import{createJiti as r}from"jiti";let i;function a(){if(!i){let a=e();i=r(n(),{fsCache:t(a.cache,`jiti`),interopDefault:!0})}return i}export{a as getJiti};
1
+ import { getEnvPaths } from "../packages/env/src/get-env-paths.mjs";
2
+ import { joinPaths } from "@stryke/path/join-paths";
3
+ import { getWorkspaceRoot } from "@stryke/fs/get-workspace-root";
4
+ import { createJiti } from "jiti";
5
+
6
+ //#region src/utils/get-jiti.ts
7
+ let jiti;
8
+ function getJiti() {
9
+ if (!jiti) {
10
+ const envPaths = getEnvPaths();
11
+ jiti = createJiti(getWorkspaceRoot(), {
12
+ fsCache: joinPaths(envPaths.cache, "jiti"),
13
+ interopDefault: true
14
+ });
15
+ }
16
+ return jiti;
17
+ }
18
+
19
+ //#endregion
20
+ export { getJiti };
2
21
  //# sourceMappingURL=get-jiti.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-jiti.mjs","names":["jiti!: Jiti"],"sources":["../../src/utils/get-jiti.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\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"],"mappings":"2NAwBA,IAAIA,EAEJ,SAAgB,GAAU,CACxB,GAAI,CAAC,EAAM,CACT,IAAM,EAAW,GAAa,CAE9B,EAAO,EAAW,GAAkB,CAAE,CACpC,QAAS,EAAU,EAAS,MAAO,OAAO,CAC1C,eAAgB,GACjB,CAAC,CAGJ,OAAO"}
1
+ {"version":3,"file":"get-jiti.mjs","names":["jiti!: Jiti"],"sources":["../../src/utils/get-jiti.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\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"],"mappings":";;;;;;AAwBA,IAAIA;AAEJ,SAAgB,UAAU;AACxB,KAAI,CAAC,MAAM;EACT,MAAM,WAAW,aAAa;AAE9B,SAAO,WAAW,kBAAkB,EAAE;GACpC,SAAS,UAAU,SAAS,OAAO,OAAO;GAC1C,gBAAgB;GACjB,CAAC;;AAGJ,QAAO"}
@@ -1 +1,13 @@
1
- const e=require(`./get-jiti.cjs`);async function t(){return e.getJiti().import(e.getJiti().esmResolve(`@prisma/internals`))}async function n(){return e.getJiti().import(e.getJiti().esmResolve(`@prisma/generator-helper`))}exports.getPrismaGeneratorHelper=n,exports.getPrismaInternals=t;
1
+ const require_get_jiti = require('./get-jiti.cjs');
2
+
3
+ //#region src/utils/get-prisma-internals.ts
4
+ async function getPrismaInternals() {
5
+ return require_get_jiti.getJiti().import(require_get_jiti.getJiti().esmResolve("@prisma/internals"));
6
+ }
7
+ async function getPrismaGeneratorHelper() {
8
+ return require_get_jiti.getJiti().import(require_get_jiti.getJiti().esmResolve("@prisma/generator-helper"));
9
+ }
10
+
11
+ //#endregion
12
+ exports.getPrismaGeneratorHelper = getPrismaGeneratorHelper;
13
+ exports.getPrismaInternals = getPrismaInternals;
@@ -1,2 +1,13 @@
1
- import{getJiti as e}from"./get-jiti.mjs";async function t(){return e().import(e().esmResolve(`@prisma/internals`))}async function n(){return e().import(e().esmResolve(`@prisma/generator-helper`))}export{n as getPrismaGeneratorHelper,t as getPrismaInternals};
1
+ import { getJiti } from "./get-jiti.mjs";
2
+
3
+ //#region src/utils/get-prisma-internals.ts
4
+ async function getPrismaInternals() {
5
+ return getJiti().import(getJiti().esmResolve("@prisma/internals"));
6
+ }
7
+ async function getPrismaGeneratorHelper() {
8
+ return getJiti().import(getJiti().esmResolve("@prisma/generator-helper"));
9
+ }
10
+
11
+ //#endregion
12
+ export { getPrismaGeneratorHelper, getPrismaInternals };
2
13
  //# sourceMappingURL=get-prisma-internals.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-prisma-internals.mjs","names":[],"sources":["../../src/utils/get-prisma-internals.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\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"],"mappings":"yCAsBA,eAAsB,GAAqB,CACzC,OAAO,GAAS,CAAC,OAGd,GAAS,CAAC,WAAW,oBAAoB,CAAC,CAG/C,eAAsB,GAA2B,CAC/C,OAAO,GAAS,CAAC,OAEd,GAAS,CAAC,WAAW,2BAA2B,CAAC"}
1
+ {"version":3,"file":"get-prisma-internals.mjs","names":[],"sources":["../../src/utils/get-prisma-internals.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\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"],"mappings":";;;AAsBA,eAAsB,qBAAqB;AACzC,QAAO,SAAS,CAAC,OAGd,SAAS,CAAC,WAAW,oBAAoB,CAAC;;AAG/C,eAAsB,2BAA2B;AAC/C,QAAO,SAAS,CAAC,OAEd,SAAS,CAAC,WAAW,2BAA2B,CAAC"}
@@ -1,2 +1,32 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`),t=require(`./format-file.cjs`);let n=require(`@stryke/fs/helpers`),r=require(`node:path`);r=e.__toESM(r);let i=require(`@stryke/path/file-path-fns`),a=require(`@stryke/fs/write-file`),o=require(`@stryke/path/correct-path`);const s=new Set,c=e=>{s.add(e)},l=async(e,r,o=!0)=>{let[s]=await Promise.all([t.formatFile(r),(0,n.createDirectory)((0,i.findFilePath)(e))]);await(0,a.writeFile)(e,s),o&&c(e)},u=async e=>{let t=Array.from(s).map(t=>{let n=r.default.relative(r.default.dirname(e),t);return n.endsWith(`.ts`)&&(n=n.slice(0,n.lastIndexOf(`.ts`))),`export * from './${(0,o.correctPath)(n)}';`});t.push(`export * from './models';`),await l(e,t.join(`
2
- `),!1)};exports.writeFileSafely=l,exports.writeIndexFile=u;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_format_file = require('./format-file.cjs');
3
+ let __stryke_fs_helpers = require("@stryke/fs/helpers");
4
+ let node_path = require("node:path");
5
+ node_path = require_rolldown_runtime.__toESM(node_path);
6
+ let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
+ let __stryke_fs_write_file = require("@stryke/fs/write-file");
8
+ let __stryke_path_correct_path = require("@stryke/path/correct-path");
9
+
10
+ //#region src/utils/write-file-safely.ts
11
+ const indexExports = /* @__PURE__ */ new Set();
12
+ const addIndexExport = (filePath) => {
13
+ indexExports.add(filePath);
14
+ };
15
+ const writeFileSafely = async (writeLocation, content, addToIndex = true) => {
16
+ const [fileContent] = await Promise.all([require_format_file.formatFile(content), (0, __stryke_fs_helpers.createDirectory)((0, __stryke_path_file_path_fns.findFilePath)(writeLocation))]);
17
+ await (0, __stryke_fs_write_file.writeFile)(writeLocation, fileContent);
18
+ if (addToIndex) addIndexExport(writeLocation);
19
+ };
20
+ const writeIndexFile = async (indexPath) => {
21
+ const rows = Array.from(indexExports).map((filePath) => {
22
+ let relativePath = node_path.default.relative(node_path.default.dirname(indexPath), filePath);
23
+ if (relativePath.endsWith(".ts")) relativePath = relativePath.slice(0, relativePath.lastIndexOf(".ts"));
24
+ return `export * from './${(0, __stryke_path_correct_path.correctPath)(relativePath)}';`;
25
+ });
26
+ rows.push("export * from './models';");
27
+ await writeFileSafely(indexPath, rows.join("\n"), false);
28
+ };
29
+
30
+ //#endregion
31
+ exports.writeFileSafely = writeFileSafely;
32
+ exports.writeIndexFile = writeIndexFile;
@@ -1,3 +1,30 @@
1
- import{formatFile as e}from"./format-file.mjs";import{createDirectory as t}from"@stryke/fs/helpers";import n from"node:path";import{findFilePath as r}from"@stryke/path/file-path-fns";import{writeFile as i}from"@stryke/fs/write-file";import{correctPath as a}from"@stryke/path/correct-path";const o=new Set,s=e=>{o.add(e)},c=async(n,a,o=!0)=>{let[c]=await Promise.all([e(a),t(r(n))]);await i(n,c),o&&s(n)},l=async e=>{let t=Array.from(o).map(t=>{let r=n.relative(n.dirname(e),t);return r.endsWith(`.ts`)&&(r=r.slice(0,r.lastIndexOf(`.ts`))),`export * from './${a(r)}';`});t.push(`export * from './models';`),await c(e,t.join(`
2
- `),!1)};export{c as writeFileSafely,l as writeIndexFile};
1
+ import { formatFile } from "./format-file.mjs";
2
+ import { createDirectory } from "@stryke/fs/helpers";
3
+ import path from "node:path";
4
+ import { findFilePath } from "@stryke/path/file-path-fns";
5
+ import { writeFile } from "@stryke/fs/write-file";
6
+ import { correctPath } from "@stryke/path/correct-path";
7
+
8
+ //#region src/utils/write-file-safely.ts
9
+ const indexExports = /* @__PURE__ */ new Set();
10
+ const addIndexExport = (filePath) => {
11
+ indexExports.add(filePath);
12
+ };
13
+ const writeFileSafely = async (writeLocation, content, addToIndex = true) => {
14
+ const [fileContent] = await Promise.all([formatFile(content), createDirectory(findFilePath(writeLocation))]);
15
+ await writeFile(writeLocation, fileContent);
16
+ if (addToIndex) addIndexExport(writeLocation);
17
+ };
18
+ const writeIndexFile = async (indexPath) => {
19
+ const rows = Array.from(indexExports).map((filePath) => {
20
+ let relativePath$1 = path.relative(path.dirname(indexPath), filePath);
21
+ if (relativePath$1.endsWith(".ts")) relativePath$1 = relativePath$1.slice(0, relativePath$1.lastIndexOf(".ts"));
22
+ return `export * from './${correctPath(relativePath$1)}';`;
23
+ });
24
+ rows.push("export * from './models';");
25
+ await writeFileSafely(indexPath, rows.join("\n"), false);
26
+ };
27
+
28
+ //#endregion
29
+ export { writeFileSafely, writeIndexFile };
3
30
  //# sourceMappingURL=write-file-safely.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-file-safely.mjs","names":["relativePath"],"sources":["../../src/utils/write-file-safely.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\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"],"mappings":"iSAwBA,MAAM,EAAe,IAAI,IAEZ,EAAkB,GAAqB,CAClD,EAAa,IAAI,EAAS,EAGf,EAAkB,MAC7B,EACA,EACA,EAAa,KACV,CACH,GAAM,CAAC,GAAe,MAAM,QAAQ,IAAI,CACtC,EAAW,EAAQ,CACnB,EAAgB,EAAa,EAAc,CAAC,CAC7C,CAAC,CAEF,MAAM,EAAU,EAAe,EAAY,CACvC,GACF,EAAe,EAAc,EAIpB,EAAiB,KAAO,IAAsB,CACzD,IAAM,EAAO,MAAM,KAAK,EAAa,CAAC,IAAI,GAAY,CACpD,IAAIA,EAAe,EAAK,SAAS,EAAK,QAAQ,EAAU,CAAE,EAAS,CAMnE,OALIA,EAAa,SAAS,MAAM,GAC9B,EAAeA,EAAa,MAAM,EAAGA,EAAa,YAAY,MAAM,CAAC,EAIhE,oBAFY,EAAYA,EAAa,CAEN,KACtC,CAEF,EAAK,KAAK,4BAA4B,CAEtC,MAAM,EAAgB,EAAW,EAAK,KAAK;EAAK,CAAE,GAAM"}
1
+ {"version":3,"file":"write-file-safely.mjs","names":["relativePath"],"sources":["../../src/utils/write-file-safely.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\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"],"mappings":";;;;;;;;AAwBA,MAAM,+BAAe,IAAI,KAAa;AAEtC,MAAa,kBAAkB,aAAqB;AAClD,cAAa,IAAI,SAAS;;AAG5B,MAAa,kBAAkB,OAC7B,eACA,SACA,aAAa,SACV;CACH,MAAM,CAAC,eAAe,MAAM,QAAQ,IAAI,CACtC,WAAW,QAAQ,EACnB,gBAAgB,aAAa,cAAc,CAAC,CAC7C,CAAC;AAEF,OAAM,UAAU,eAAe,YAAY;AAC3C,KAAI,WACF,gBAAe,cAAc;;AAIjC,MAAa,iBAAiB,OAAO,cAAsB;CACzD,MAAM,OAAO,MAAM,KAAK,aAAa,CAAC,KAAI,aAAY;EACpD,IAAIA,iBAAe,KAAK,SAAS,KAAK,QAAQ,UAAU,EAAE,SAAS;AACnE,MAAIA,eAAa,SAAS,MAAM,CAC9B,kBAAeA,eAAa,MAAM,GAAGA,eAAa,YAAY,MAAM,CAAC;AAIvE,SAAO,oBAFY,YAAYA,eAAa,CAEN;GACtC;AAEF,MAAK,KAAK,4BAA4B;AAEtC,OAAM,gBAAgB,WAAW,KAAK,KAAK,KAAK,EAAE,MAAM"}
@@ -1 +1,70 @@
1
- const e=e=>/(?:Count|Avg|Sum|Min|Max)AggregateOutputType$/.test(e),t=e=>e.endsWith(`CountAggregateInput`)||e.endsWith(`SumAggregateInput`)||e.endsWith(`AvgAggregateInput`)||e.endsWith(`MinAggregateInput`)||e.endsWith(`MaxAggregateInput`);function n(t,n){let r=n.filter(({name:t})=>e(t));for(let e of r){let n=e.name.replace(/(?:OutputType|Output)$/,``);t.push({constraints:{maxNumFields:null,minNumFields:null},name:`${n}Input`,fields:e.fields.map(e=>({name:e.name,isNullable:!1,isRequired:!1,inputTypes:[{isList:!1,type:`True`,location:`scalar`}]}))})}}function r(e){let n={};for(let r of e)if(t(r.name)){let e=r.name.replace(`AggregateInput`,``);if(e.endsWith(`Count`)){let t=e.replace(`Count`,``);n[t]={...n[t],count:!0}}else if(e.endsWith(`Min`)){let t=e.replace(`Min`,``);n[t]={...n[t],min:!0}}else if(e.endsWith(`Max`)){let t=e.replace(`Max`,``);n[t]={...n[t],max:!0}}else if(e.endsWith(`Sum`)){let t=e.replace(`Sum`,``);n[t]={...n[t],sum:!0}}else if(e.endsWith(`Avg`)){let t=e.replace(`Avg`,``);n[t]={...n[t],avg:!0}}}return n}exports.addMissingInputObjectTypesForAggregate=n,exports.isAggregateInputType=t,exports.resolveZodAggregateOperationSupport=r;
1
+
2
+ //#region src/zod/aggregate-helpers.ts
3
+ const isAggregateOutputType = (name) => /(?:Count|Avg|Sum|Min|Max)AggregateOutputType$/.test(name);
4
+ const isAggregateInputType = (name) => name.endsWith("CountAggregateInput") || name.endsWith("SumAggregateInput") || name.endsWith("AvgAggregateInput") || name.endsWith("MinAggregateInput") || name.endsWith("MaxAggregateInput");
5
+ function addMissingInputObjectTypesForAggregate(inputObjectTypes, outputObjectTypes) {
6
+ const aggregateOutputTypes = outputObjectTypes.filter(({ name }) => isAggregateOutputType(name));
7
+ for (const aggregateOutputType of aggregateOutputTypes) {
8
+ const name = aggregateOutputType.name.replace(/(?:OutputType|Output)$/, "");
9
+ inputObjectTypes.push({
10
+ constraints: {
11
+ maxNumFields: null,
12
+ minNumFields: null
13
+ },
14
+ name: `${name}Input`,
15
+ fields: aggregateOutputType.fields.map((field) => ({
16
+ name: field.name,
17
+ isNullable: false,
18
+ isRequired: false,
19
+ inputTypes: [{
20
+ isList: false,
21
+ type: "True",
22
+ location: "scalar"
23
+ }]
24
+ }))
25
+ });
26
+ }
27
+ }
28
+ function resolveZodAggregateOperationSupport(inputObjectTypes) {
29
+ const aggregateOperationSupport = {};
30
+ for (const inputType of inputObjectTypes) if (isAggregateInputType(inputType.name)) {
31
+ const name = inputType.name.replace("AggregateInput", "");
32
+ if (name.endsWith("Count")) {
33
+ const model = name.replace("Count", "");
34
+ aggregateOperationSupport[model] = {
35
+ ...aggregateOperationSupport[model],
36
+ count: true
37
+ };
38
+ } else if (name.endsWith("Min")) {
39
+ const model = name.replace("Min", "");
40
+ aggregateOperationSupport[model] = {
41
+ ...aggregateOperationSupport[model],
42
+ min: true
43
+ };
44
+ } else if (name.endsWith("Max")) {
45
+ const model = name.replace("Max", "");
46
+ aggregateOperationSupport[model] = {
47
+ ...aggregateOperationSupport[model],
48
+ max: true
49
+ };
50
+ } else if (name.endsWith("Sum")) {
51
+ const model = name.replace("Sum", "");
52
+ aggregateOperationSupport[model] = {
53
+ ...aggregateOperationSupport[model],
54
+ sum: true
55
+ };
56
+ } else if (name.endsWith("Avg")) {
57
+ const model = name.replace("Avg", "");
58
+ aggregateOperationSupport[model] = {
59
+ ...aggregateOperationSupport[model],
60
+ avg: true
61
+ };
62
+ }
63
+ }
64
+ return aggregateOperationSupport;
65
+ }
66
+
67
+ //#endregion
68
+ exports.addMissingInputObjectTypesForAggregate = addMissingInputObjectTypesForAggregate;
69
+ exports.isAggregateInputType = isAggregateInputType;
70
+ exports.resolveZodAggregateOperationSupport = resolveZodAggregateOperationSupport;
@@ -1,2 +1,68 @@
1
- const e=e=>/(?:Count|Avg|Sum|Min|Max)AggregateOutputType$/.test(e),t=e=>e.endsWith(`CountAggregateInput`)||e.endsWith(`SumAggregateInput`)||e.endsWith(`AvgAggregateInput`)||e.endsWith(`MinAggregateInput`)||e.endsWith(`MaxAggregateInput`);function n(t,n){let r=n.filter(({name:t})=>e(t));for(let e of r){let n=e.name.replace(/(?:OutputType|Output)$/,``);t.push({constraints:{maxNumFields:null,minNumFields:null},name:`${n}Input`,fields:e.fields.map(e=>({name:e.name,isNullable:!1,isRequired:!1,inputTypes:[{isList:!1,type:`True`,location:`scalar`}]}))})}}function r(e){let n={};for(let r of e)if(t(r.name)){let e=r.name.replace(`AggregateInput`,``);if(e.endsWith(`Count`)){let t=e.replace(`Count`,``);n[t]={...n[t],count:!0}}else if(e.endsWith(`Min`)){let t=e.replace(`Min`,``);n[t]={...n[t],min:!0}}else if(e.endsWith(`Max`)){let t=e.replace(`Max`,``);n[t]={...n[t],max:!0}}else if(e.endsWith(`Sum`)){let t=e.replace(`Sum`,``);n[t]={...n[t],sum:!0}}else if(e.endsWith(`Avg`)){let t=e.replace(`Avg`,``);n[t]={...n[t],avg:!0}}}return n}export{n as addMissingInputObjectTypesForAggregate,t as isAggregateInputType,r as resolveZodAggregateOperationSupport};
1
+ //#region src/zod/aggregate-helpers.ts
2
+ const isAggregateOutputType = (name) => /(?:Count|Avg|Sum|Min|Max)AggregateOutputType$/.test(name);
3
+ const isAggregateInputType = (name) => name.endsWith("CountAggregateInput") || name.endsWith("SumAggregateInput") || name.endsWith("AvgAggregateInput") || name.endsWith("MinAggregateInput") || name.endsWith("MaxAggregateInput");
4
+ function addMissingInputObjectTypesForAggregate(inputObjectTypes, outputObjectTypes) {
5
+ const aggregateOutputTypes = outputObjectTypes.filter(({ name }) => isAggregateOutputType(name));
6
+ for (const aggregateOutputType of aggregateOutputTypes) {
7
+ const name = aggregateOutputType.name.replace(/(?:OutputType|Output)$/, "");
8
+ inputObjectTypes.push({
9
+ constraints: {
10
+ maxNumFields: null,
11
+ minNumFields: null
12
+ },
13
+ name: `${name}Input`,
14
+ fields: aggregateOutputType.fields.map((field) => ({
15
+ name: field.name,
16
+ isNullable: false,
17
+ isRequired: false,
18
+ inputTypes: [{
19
+ isList: false,
20
+ type: "True",
21
+ location: "scalar"
22
+ }]
23
+ }))
24
+ });
25
+ }
26
+ }
27
+ function resolveZodAggregateOperationSupport(inputObjectTypes) {
28
+ const aggregateOperationSupport = {};
29
+ for (const inputType of inputObjectTypes) if (isAggregateInputType(inputType.name)) {
30
+ const name = inputType.name.replace("AggregateInput", "");
31
+ if (name.endsWith("Count")) {
32
+ const model = name.replace("Count", "");
33
+ aggregateOperationSupport[model] = {
34
+ ...aggregateOperationSupport[model],
35
+ count: true
36
+ };
37
+ } else if (name.endsWith("Min")) {
38
+ const model = name.replace("Min", "");
39
+ aggregateOperationSupport[model] = {
40
+ ...aggregateOperationSupport[model],
41
+ min: true
42
+ };
43
+ } else if (name.endsWith("Max")) {
44
+ const model = name.replace("Max", "");
45
+ aggregateOperationSupport[model] = {
46
+ ...aggregateOperationSupport[model],
47
+ max: true
48
+ };
49
+ } else if (name.endsWith("Sum")) {
50
+ const model = name.replace("Sum", "");
51
+ aggregateOperationSupport[model] = {
52
+ ...aggregateOperationSupport[model],
53
+ sum: true
54
+ };
55
+ } else if (name.endsWith("Avg")) {
56
+ const model = name.replace("Avg", "");
57
+ aggregateOperationSupport[model] = {
58
+ ...aggregateOperationSupport[model],
59
+ avg: true
60
+ };
61
+ }
62
+ }
63
+ return aggregateOperationSupport;
64
+ }
65
+
66
+ //#endregion
67
+ export { addMissingInputObjectTypesForAggregate, isAggregateInputType, resolveZodAggregateOperationSupport };
2
68
  //# sourceMappingURL=aggregate-helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate-helpers.mjs","names":["aggregateOperationSupport: AggregateOperationSupport"],"sources":["../../src/zod/aggregate-helpers.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\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"],"mappings":"AAoBA,MAAM,EAAyB,GAC7B,gDAAgD,KAAK,EAAK,CAE/C,EAAwB,GACnC,EAAK,SAAS,sBAAsB,EACpC,EAAK,SAAS,oBAAoB,EAClC,EAAK,SAAS,oBAAoB,EAClC,EAAK,SAAS,oBAAoB,EAClC,EAAK,SAAS,oBAAoB,CAEpC,SAAgB,EACd,EACA,EACA,CACA,IAAM,EAAuB,EAAkB,QAAQ,CAAE,UACvD,EAAsB,EAAK,CAC5B,CACD,IAAK,IAAM,KAAuB,EAAsB,CACtD,IAAM,EAAO,EAAoB,KAAK,QAAQ,yBAA0B,GAAG,CAC3E,EAAiB,KAAK,CACpB,YAAa,CAAE,aAAc,KAAM,aAAc,KAAM,CACvD,KAAM,GAAG,EAAK,OACd,OAAQ,EAAoB,OAAO,IAAI,IAAU,CAC/C,KAAM,EAAM,KACZ,WAAY,GACZ,WAAY,GACZ,WAAY,CACV,CACE,OAAQ,GACR,KAAM,OACN,SAAU,SACX,CACF,CACF,EAAE,CACJ,CAAC,EAIN,SAAgB,EACd,EACA,CACA,IAAMA,EAAuD,EAAE,CAC/D,IAAK,IAAM,KAAa,EACtB,GAAI,EAAqB,EAAU,KAAK,CAAE,CACxC,IAAM,EAAO,EAAU,KAAK,QAAQ,iBAAkB,GAAG,CACzD,GAAI,EAAK,SAAS,QAAQ,CAAE,CAC1B,IAAM,EAAQ,EAAK,QAAQ,QAAS,GAAG,CACvC,EAA0B,GAAS,CACjC,GAAG,EAA0B,GAC7B,MAAO,GACR,SACQ,EAAK,SAAS,MAAM,CAAE,CAC/B,IAAM,EAAQ,EAAK,QAAQ,MAAO,GAAG,CACrC,EAA0B,GAAS,CACjC,GAAG,EAA0B,GAC7B,IAAK,GACN,SACQ,EAAK,SAAS,MAAM,CAAE,CAC/B,IAAM,EAAQ,EAAK,QAAQ,MAAO,GAAG,CACrC,EAA0B,GAAS,CACjC,GAAG,EAA0B,GAC7B,IAAK,GACN,SACQ,EAAK,SAAS,MAAM,CAAE,CAC/B,IAAM,EAAQ,EAAK,QAAQ,MAAO,GAAG,CACrC,EAA0B,GAAS,CACjC,GAAG,EAA0B,GAC7B,IAAK,GACN,SACQ,EAAK,SAAS,MAAM,CAAE,CAC/B,IAAM,EAAQ,EAAK,QAAQ,MAAO,GAAG,CACrC,EAA0B,GAAS,CACjC,GAAG,EAA0B,GAC7B,IAAK,GACN,EAIP,OAAO"}
1
+ {"version":3,"file":"aggregate-helpers.mjs","names":["aggregateOperationSupport: AggregateOperationSupport"],"sources":["../../src/zod/aggregate-helpers.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\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"],"mappings":";AAoBA,MAAM,yBAAyB,SAC7B,gDAAgD,KAAK,KAAK;AAE5D,MAAa,wBAAwB,SACnC,KAAK,SAAS,sBAAsB,IACpC,KAAK,SAAS,oBAAoB,IAClC,KAAK,SAAS,oBAAoB,IAClC,KAAK,SAAS,oBAAoB,IAClC,KAAK,SAAS,oBAAoB;AAEpC,SAAgB,uCACd,kBACA,mBACA;CACA,MAAM,uBAAuB,kBAAkB,QAAQ,EAAE,WACvD,sBAAsB,KAAK,CAC5B;AACD,MAAK,MAAM,uBAAuB,sBAAsB;EACtD,MAAM,OAAO,oBAAoB,KAAK,QAAQ,0BAA0B,GAAG;AAC3E,mBAAiB,KAAK;GACpB,aAAa;IAAE,cAAc;IAAM,cAAc;IAAM;GACvD,MAAM,GAAG,KAAK;GACd,QAAQ,oBAAoB,OAAO,KAAI,WAAU;IAC/C,MAAM,MAAM;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY,CACV;KACE,QAAQ;KACR,MAAM;KACN,UAAU;KACX,CACF;IACF,EAAE;GACJ,CAAC;;;AAIN,SAAgB,oCACd,kBACA;CACA,MAAMA,4BAAuD,EAAE;AAC/D,MAAK,MAAM,aAAa,iBACtB,KAAI,qBAAqB,UAAU,KAAK,EAAE;EACxC,MAAM,OAAO,UAAU,KAAK,QAAQ,kBAAkB,GAAG;AACzD,MAAI,KAAK,SAAS,QAAQ,EAAE;GAC1B,MAAM,QAAQ,KAAK,QAAQ,SAAS,GAAG;AACvC,6BAA0B,SAAS;IACjC,GAAG,0BAA0B;IAC7B,OAAO;IACR;aACQ,KAAK,SAAS,MAAM,EAAE;GAC/B,MAAM,QAAQ,KAAK,QAAQ,OAAO,GAAG;AACrC,6BAA0B,SAAS;IACjC,GAAG,0BAA0B;IAC7B,KAAK;IACN;aACQ,KAAK,SAAS,MAAM,EAAE;GAC/B,MAAM,QAAQ,KAAK,QAAQ,OAAO,GAAG;AACrC,6BAA0B,SAAS;IACjC,GAAG,0BAA0B;IAC7B,KAAK;IACN;aACQ,KAAK,SAAS,MAAM,EAAE;GAC/B,MAAM,QAAQ,KAAK,QAAQ,OAAO,GAAG;AACrC,6BAA0B,SAAS;IACjC,GAAG,0BAA0B;IAC7B,KAAK;IACN;aACQ,KAAK,SAAS,MAAM,EAAE;GAC/B,MAAM,QAAQ,KAAK,QAAQ,OAAO,GAAG;AACrC,6BAA0B,SAAS;IACjC,GAAG,0BAA0B;IAC7B,KAAK;IACN;;;AAIP,QAAO"}
@@ -1 +1,77 @@
1
- const e=/(?:@@Gen\.)+[A-z]+\(.+\)/,t=/\.+[A-Z]+\(+/i,n=/\(+[A-Z]+:.+\)/i;function r(e,t,n,r,c){e=i(e,r),a(e,r,c),s(e,t),o(n,r)}function i(r,i){return r.map(r=>{if(r.documentation){let a=r.documentation?.match(e)?.[0];if(a?.match(t)?.[0]?.slice(1,-1)!==`model`)return r;let o=a?.match(n)?.[0]?.slice(1,-1),s={};if(o){let e=o.split(`:`).map(e=>e.trim()).map(e=>e.startsWith(`[`)?e:e.split(`,`)).flat().map(e=>e.trim());for(let t=0;t<e.length;t+=2){let n=e[t],r=e[t+1];s[n]=JSON.parse(r)}}if(s.hide)return i.push(r.name),null}return r}).filter(Boolean)}function a(e,t,n){e.forEach(e=>{e.fields.forEach(e=>{t.includes(e.type)&&(n.push(e.name),e.relationFromFields&&e.relationFromFields.forEach(e=>n.push(e)))})})}function o(e,t){e.prisma=e.prisma.filter(e=>!t.find(t=>e.name.startsWith(t)))}function s(e,t){let n=t.length;for(;n>=0;){--n;let r=t[n];r&&!e.find(e=>e.name===r.model)&&t.splice(n,1)}}function c(e,t,n){let r=e.length;for(;r>=0;){--r;let i=e[r];if(i&&(t.includes(i?.meta?.source)||t.find(e=>i.name.startsWith(e))))e.splice(r,1);else{let t=i?.fields?.length??0;for(;t>=0;){--t;let a=i?.fields?.[t];a&&n.includes(a.name)&&e[r].fields.slice(t,1)}}}}exports.hideZodInputObjectTypesAndRelatedFields=c,exports.resolveZodModelsComments=r;
1
+
2
+ //#region src/zod/comments-helpers.ts
3
+ const modelAttributeRegex = /(?:@@Gen\.)+[A-z]+\(.+\)/;
4
+ const attributeNameRegex = /\.+[A-Z]+\(+/i;
5
+ const attributeArgsRegex = /\(+[A-Z]+:.+\)/i;
6
+ function resolveZodModelsComments(models, modelOperations, enumTypes, hiddenModels, hiddenFields) {
7
+ models = collectHiddenModels(models, hiddenModels);
8
+ collectHiddenFields(models, hiddenModels, hiddenFields);
9
+ hideModelOperations(models, modelOperations);
10
+ hideEnums(enumTypes, hiddenModels);
11
+ }
12
+ function collectHiddenModels(models, hiddenModels) {
13
+ return models.map((model) => {
14
+ if (model.documentation) {
15
+ const attribute = model.documentation?.match(modelAttributeRegex)?.[0];
16
+ if (attribute?.match(attributeNameRegex)?.[0]?.slice(1, -1) !== "model") return model;
17
+ const rawAttributeArgs = attribute?.match(attributeArgsRegex)?.[0]?.slice(1, -1);
18
+ const parsedAttributeArgs = {};
19
+ if (rawAttributeArgs) {
20
+ const rawAttributeArgsParts = rawAttributeArgs.split(":").map((it) => it.trim()).map((part) => part.startsWith("[") ? part : part.split(",")).flat().map((it) => it.trim());
21
+ for (let i = 0; i < rawAttributeArgsParts.length; i += 2) {
22
+ const key = rawAttributeArgsParts[i];
23
+ const value = rawAttributeArgsParts[i + 1];
24
+ parsedAttributeArgs[key] = JSON.parse(value);
25
+ }
26
+ }
27
+ if (parsedAttributeArgs.hide) {
28
+ hiddenModels.push(model.name);
29
+ return null;
30
+ }
31
+ }
32
+ return model;
33
+ }).filter(Boolean);
34
+ }
35
+ function collectHiddenFields(models, hiddenModels, hiddenFields) {
36
+ models.forEach((model) => {
37
+ model.fields.forEach((field) => {
38
+ if (hiddenModels.includes(field.type)) {
39
+ hiddenFields.push(field.name);
40
+ if (field.relationFromFields) field.relationFromFields.forEach((item) => hiddenFields.push(item));
41
+ }
42
+ });
43
+ });
44
+ }
45
+ function hideEnums(enumTypes, hiddenModels) {
46
+ enumTypes.prisma = enumTypes.prisma.filter((item) => !hiddenModels.find((model) => item.name.startsWith(model)));
47
+ }
48
+ function hideModelOperations(models, modelOperations) {
49
+ let i = modelOperations.length;
50
+ while (i >= 0) {
51
+ --i;
52
+ const modelOperation = modelOperations[i];
53
+ if (modelOperation && !models.find((model) => {
54
+ return model.name === modelOperation.model;
55
+ })) modelOperations.splice(i, 1);
56
+ }
57
+ }
58
+ function hideZodInputObjectTypesAndRelatedFields(inputObjectTypes, hiddenModels, hiddenFields) {
59
+ let j = inputObjectTypes.length;
60
+ while (j >= 0) {
61
+ --j;
62
+ const inputType = inputObjectTypes[j];
63
+ if (inputType && (hiddenModels.includes(inputType?.meta?.source) || hiddenModels.find((model) => inputType.name.startsWith(model)))) inputObjectTypes.splice(j, 1);
64
+ else {
65
+ let k = inputType?.fields?.length ?? 0;
66
+ while (k >= 0) {
67
+ --k;
68
+ const field = inputType?.fields?.[k];
69
+ if (field && hiddenFields.includes(field.name)) inputObjectTypes[j].fields.slice(k, 1);
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ //#endregion
76
+ exports.hideZodInputObjectTypesAndRelatedFields = hideZodInputObjectTypesAndRelatedFields;
77
+ exports.resolveZodModelsComments = resolveZodModelsComments;
@@ -1,2 +1,76 @@
1
- const e=/(?:@@Gen\.)+[A-z]+\(.+\)/,t=/\.+[A-Z]+\(+/i,n=/\(+[A-Z]+:.+\)/i;function r(e,t,n,r,c){e=i(e,r),a(e,r,c),s(e,t),o(n,r)}function i(r,i){return r.map(r=>{if(r.documentation){let a=r.documentation?.match(e)?.[0];if(a?.match(t)?.[0]?.slice(1,-1)!==`model`)return r;let o=a?.match(n)?.[0]?.slice(1,-1),s={};if(o){let e=o.split(`:`).map(e=>e.trim()).map(e=>e.startsWith(`[`)?e:e.split(`,`)).flat().map(e=>e.trim());for(let t=0;t<e.length;t+=2){let n=e[t],r=e[t+1];s[n]=JSON.parse(r)}}if(s.hide)return i.push(r.name),null}return r}).filter(Boolean)}function a(e,t,n){e.forEach(e=>{e.fields.forEach(e=>{t.includes(e.type)&&(n.push(e.name),e.relationFromFields&&e.relationFromFields.forEach(e=>n.push(e)))})})}function o(e,t){e.prisma=e.prisma.filter(e=>!t.find(t=>e.name.startsWith(t)))}function s(e,t){let n=t.length;for(;n>=0;){--n;let r=t[n];r&&!e.find(e=>e.name===r.model)&&t.splice(n,1)}}function c(e,t,n){let r=e.length;for(;r>=0;){--r;let i=e[r];if(i&&(t.includes(i?.meta?.source)||t.find(e=>i.name.startsWith(e))))e.splice(r,1);else{let t=i?.fields?.length??0;for(;t>=0;){--t;let a=i?.fields?.[t];a&&n.includes(a.name)&&e[r].fields.slice(t,1)}}}}export{c as hideZodInputObjectTypesAndRelatedFields,r as resolveZodModelsComments};
1
+ //#region src/zod/comments-helpers.ts
2
+ const modelAttributeRegex = /(?:@@Gen\.)+[A-z]+\(.+\)/;
3
+ const attributeNameRegex = /\.+[A-Z]+\(+/i;
4
+ const attributeArgsRegex = /\(+[A-Z]+:.+\)/i;
5
+ function resolveZodModelsComments(models, modelOperations, enumTypes, hiddenModels, hiddenFields) {
6
+ models = collectHiddenModels(models, hiddenModels);
7
+ collectHiddenFields(models, hiddenModels, hiddenFields);
8
+ hideModelOperations(models, modelOperations);
9
+ hideEnums(enumTypes, hiddenModels);
10
+ }
11
+ function collectHiddenModels(models, hiddenModels) {
12
+ return models.map((model) => {
13
+ if (model.documentation) {
14
+ const attribute = model.documentation?.match(modelAttributeRegex)?.[0];
15
+ if (attribute?.match(attributeNameRegex)?.[0]?.slice(1, -1) !== "model") return model;
16
+ const rawAttributeArgs = attribute?.match(attributeArgsRegex)?.[0]?.slice(1, -1);
17
+ const parsedAttributeArgs = {};
18
+ if (rawAttributeArgs) {
19
+ const rawAttributeArgsParts = rawAttributeArgs.split(":").map((it) => it.trim()).map((part) => part.startsWith("[") ? part : part.split(",")).flat().map((it) => it.trim());
20
+ for (let i = 0; i < rawAttributeArgsParts.length; i += 2) {
21
+ const key = rawAttributeArgsParts[i];
22
+ const value = rawAttributeArgsParts[i + 1];
23
+ parsedAttributeArgs[key] = JSON.parse(value);
24
+ }
25
+ }
26
+ if (parsedAttributeArgs.hide) {
27
+ hiddenModels.push(model.name);
28
+ return null;
29
+ }
30
+ }
31
+ return model;
32
+ }).filter(Boolean);
33
+ }
34
+ function collectHiddenFields(models, hiddenModels, hiddenFields) {
35
+ models.forEach((model) => {
36
+ model.fields.forEach((field) => {
37
+ if (hiddenModels.includes(field.type)) {
38
+ hiddenFields.push(field.name);
39
+ if (field.relationFromFields) field.relationFromFields.forEach((item) => hiddenFields.push(item));
40
+ }
41
+ });
42
+ });
43
+ }
44
+ function hideEnums(enumTypes, hiddenModels) {
45
+ enumTypes.prisma = enumTypes.prisma.filter((item) => !hiddenModels.find((model) => item.name.startsWith(model)));
46
+ }
47
+ function hideModelOperations(models, modelOperations) {
48
+ let i = modelOperations.length;
49
+ while (i >= 0) {
50
+ --i;
51
+ const modelOperation = modelOperations[i];
52
+ if (modelOperation && !models.find((model) => {
53
+ return model.name === modelOperation.model;
54
+ })) modelOperations.splice(i, 1);
55
+ }
56
+ }
57
+ function hideZodInputObjectTypesAndRelatedFields(inputObjectTypes, hiddenModels, hiddenFields) {
58
+ let j = inputObjectTypes.length;
59
+ while (j >= 0) {
60
+ --j;
61
+ const inputType = inputObjectTypes[j];
62
+ if (inputType && (hiddenModels.includes(inputType?.meta?.source) || hiddenModels.find((model) => inputType.name.startsWith(model)))) inputObjectTypes.splice(j, 1);
63
+ else {
64
+ let k = inputType?.fields?.length ?? 0;
65
+ while (k >= 0) {
66
+ --k;
67
+ const field = inputType?.fields?.[k];
68
+ if (field && hiddenFields.includes(field.name)) inputObjectTypes[j].fields.slice(k, 1);
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+ //#endregion
75
+ export { hideZodInputObjectTypesAndRelatedFields, resolveZodModelsComments };
2
76
  //# sourceMappingURL=comments-helpers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"comments-helpers.mjs","names":["parsedAttributeArgs: Record<string, unknown>"],"sources":["../../src/zod/comments-helpers.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\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"],"mappings":"AAoBA,MAAM,EAAsB,2BACtB,EAAqB,gBACrB,EAAqB,kBAE3B,SAAgB,EACd,EACA,EACA,EACA,EACA,EACA,CACA,EAAS,EAAoB,EAAQ,EAAa,CAClD,EAAoB,EAAQ,EAAc,EAAa,CACvD,EAAoB,EAAQ,EAAgB,CAC5C,EAAU,EAAW,EAAa,CAGpC,SAAS,EAAoB,EAAsB,EAAwB,CACzE,OAAO,EACJ,IAAI,GAAS,CACZ,GAAI,EAAM,cAAe,CACvB,IAAM,EAAY,EAAM,eAAe,MAAM,EAAoB,GAAG,GAIpE,GAHsB,GAClB,MAAM,EAAmB,GAAG,IAC5B,MAAM,EAAG,GAAG,GACM,QACpB,OAAO,EAGT,IAAM,EAAmB,GACrB,MAAM,EAAmB,GAAG,IAC5B,MAAM,EAAG,GAAG,CAEVA,EAA+C,EAAE,CACvD,GAAI,EAAkB,CACpB,IAAM,EAAwB,EAC3B,MAAM,IAAI,CACV,IAAI,GAAM,EAAG,MAAM,CAAC,CACpB,IAAI,GAAS,EAAK,WAAW,IAAI,CAAG,EAAO,EAAK,MAAM,IAAI,CAAE,CAC5D,MAAM,CACN,IAAI,GAAM,EAAG,MAAM,CAAC,CAEvB,IAAK,IAAI,EAAI,EAAG,EAAI,EAAsB,OAAQ,GAAK,EAAG,CACxD,IAAM,EAAM,EAAsB,GAC5B,EAAQ,EAAsB,EAAI,GACxC,EAAoB,GAAQ,KAAK,MAAM,EAAO,EAGlD,GAAI,EAAoB,KAEtB,OADA,EAAa,KAAK,EAAM,KAAK,CACtB,KAIX,OAAO,GACP,CACD,OAAO,QAAQ,CAGpB,SAAS,EACP,EACA,EACA,EACA,CACA,EAAO,QAAQ,GAAS,CACtB,EAAM,OAAO,QAAQ,GAAS,CACxB,EAAa,SAAS,EAAM,KAAK,GACnC,EAAa,KAAK,EAAM,KAAK,CACzB,EAAM,oBACR,EAAM,mBAAmB,QAAQ,GAAQ,EAAa,KAAK,EAAK,CAAC,GAGrE,EACF,CAEJ,SAAS,EACP,EACA,EACA,CACA,EAAU,OAAS,EAAU,OAAO,OAClC,GAAQ,CAAC,EAAa,KAAK,GAAS,EAAK,KAAK,WAAW,EAAM,CAAC,CACjE,CAGH,SAAS,EACP,EACA,EACA,CACA,IAAI,EAAI,EAAgB,OACxB,KAAO,GAAK,GAAG,CACb,EAAE,EACF,IAAM,EAAiB,EAAgB,GAErC,GACA,CAAC,EAAO,KAAK,GACJ,EAAM,OAAS,EAAe,MACrC,EAEF,EAAgB,OAAO,EAAG,EAAE,EAKlC,SAAgB,EACd,EACA,EACA,EACA,CACA,IAAI,EAAI,EAAiB,OACzB,KAAO,GAAK,GAAG,CACb,EAAE,EACF,IAAM,EAAY,EAAiB,GACnC,GACE,IACC,EAAa,SAAS,GAAW,MAAM,OAAiB,EACvD,EAAa,KAAK,GAAS,EAAU,KAAK,WAAW,EAAM,CAAC,EAE9D,EAAiB,OAAO,EAAG,EAAE,KACxB,CACL,IAAI,EAAI,GAAW,QAAQ,QAAU,EACrC,KAAO,GAAK,GAAG,CACb,EAAE,EACF,IAAM,EAAQ,GAAW,SAAS,GAC9B,GAAS,EAAa,SAAS,EAAM,KAAK,EAC5C,EAAiB,GAAI,OAAO,MAAM,EAAG,EAAE"}
1
+ {"version":3,"file":"comments-helpers.mjs","names":["parsedAttributeArgs: Record<string, unknown>"],"sources":["../../src/zod/comments-helpers.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\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"],"mappings":";AAoBA,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAC3B,MAAM,qBAAqB;AAE3B,SAAgB,yBACd,QACA,iBACA,WACA,cACA,cACA;AACA,UAAS,oBAAoB,QAAQ,aAAa;AAClD,qBAAoB,QAAQ,cAAc,aAAa;AACvD,qBAAoB,QAAQ,gBAAgB;AAC5C,WAAU,WAAW,aAAa;;AAGpC,SAAS,oBAAoB,QAAsB,cAAwB;AACzE,QAAO,OACJ,KAAI,UAAS;AACZ,MAAI,MAAM,eAAe;GACvB,MAAM,YAAY,MAAM,eAAe,MAAM,oBAAoB,GAAG;AAIpE,OAHsB,WAClB,MAAM,mBAAmB,GAAG,IAC5B,MAAM,GAAG,GAAG,KACM,QACpB,QAAO;GAGT,MAAM,mBAAmB,WACrB,MAAM,mBAAmB,GAAG,IAC5B,MAAM,GAAG,GAAG;GAEhB,MAAMA,sBAA+C,EAAE;AACvD,OAAI,kBAAkB;IACpB,MAAM,wBAAwB,iBAC3B,MAAM,IAAI,CACV,KAAI,OAAM,GAAG,MAAM,CAAC,CACpB,KAAI,SAAS,KAAK,WAAW,IAAI,GAAG,OAAO,KAAK,MAAM,IAAI,CAAE,CAC5D,MAAM,CACN,KAAI,OAAM,GAAG,MAAM,CAAC;AAEvB,SAAK,IAAI,IAAI,GAAG,IAAI,sBAAsB,QAAQ,KAAK,GAAG;KACxD,MAAM,MAAM,sBAAsB;KAClC,MAAM,QAAQ,sBAAsB,IAAI;AACxC,yBAAoB,OAAQ,KAAK,MAAM,MAAO;;;AAGlD,OAAI,oBAAoB,MAAM;AAC5B,iBAAa,KAAK,MAAM,KAAK;AAC7B,WAAO;;;AAIX,SAAO;GACP,CACD,OAAO,QAAQ;;AAGpB,SAAS,oBACP,QACA,cACA,cACA;AACA,QAAO,SAAQ,UAAS;AACtB,QAAM,OAAO,SAAQ,UAAS;AAC5B,OAAI,aAAa,SAAS,MAAM,KAAK,EAAE;AACrC,iBAAa,KAAK,MAAM,KAAK;AAC7B,QAAI,MAAM,mBACR,OAAM,mBAAmB,SAAQ,SAAQ,aAAa,KAAK,KAAK,CAAC;;IAGrE;GACF;;AAEJ,SAAS,UACP,WACA,cACA;AACA,WAAU,SAAS,UAAU,OAAO,QAClC,SAAQ,CAAC,aAAa,MAAK,UAAS,KAAK,KAAK,WAAW,MAAM,CAAC,CACjE;;AAGH,SAAS,oBACP,QACA,iBACA;CACA,IAAI,IAAI,gBAAgB;AACxB,QAAO,KAAK,GAAG;AACb,IAAE;EACF,MAAM,iBAAiB,gBAAgB;AACvC,MACE,kBACA,CAAC,OAAO,MAAK,UAAS;AACpB,UAAO,MAAM,SAAS,eAAe;IACrC,CAEF,iBAAgB,OAAO,GAAG,EAAE;;;AAKlC,SAAgB,wCACd,kBACA,cACA,cACA;CACA,IAAI,IAAI,iBAAiB;AACzB,QAAO,KAAK,GAAG;AACb,IAAE;EACF,MAAM,YAAY,iBAAiB;AACnC,MACE,cACC,aAAa,SAAS,WAAW,MAAM,OAAiB,IACvD,aAAa,MAAK,UAAS,UAAU,KAAK,WAAW,MAAM,CAAC,EAE9D,kBAAiB,OAAO,GAAG,EAAE;OACxB;GACL,IAAI,IAAI,WAAW,QAAQ,UAAU;AACrC,UAAO,KAAK,GAAG;AACb,MAAE;IACF,MAAM,QAAQ,WAAW,SAAS;AAClC,QAAI,SAAS,aAAa,SAAS,MAAM,KAAK,CAC5C,kBAAiB,GAAI,OAAO,MAAM,GAAG,EAAE"}