arkos 1.1.12-test → 1.1.13-test

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 (133) hide show
  1. package/dist/cjs/app.js +1 -1
  2. package/dist/cjs/app.js.map +1 -1
  3. package/dist/cjs/modules/auth/auth.controller.js +53 -64
  4. package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
  5. package/dist/cjs/modules/auth/auth.router.js +46 -58
  6. package/dist/cjs/modules/auth/auth.router.js.map +1 -1
  7. package/dist/cjs/modules/auth/auth.service.js +75 -97
  8. package/dist/cjs/modules/auth/auth.service.js.map +1 -1
  9. package/dist/cjs/modules/auth/utils/helpers/auth.controller.helpers.js +6 -7
  10. package/dist/cjs/modules/auth/utils/helpers/auth.controller.helpers.js.map +1 -1
  11. package/dist/cjs/modules/base/base.controller.js +30 -46
  12. package/dist/cjs/modules/base/base.controller.js.map +1 -1
  13. package/dist/cjs/modules/base/base.middlewares.js +17 -21
  14. package/dist/cjs/modules/base/base.middlewares.js.map +1 -1
  15. package/dist/cjs/modules/base/base.router.js +6 -17
  16. package/dist/cjs/modules/base/base.router.js.map +1 -1
  17. package/dist/cjs/modules/base/base.service.js +128 -116
  18. package/dist/cjs/modules/base/base.service.js.map +1 -1
  19. package/dist/cjs/modules/base/utils/helpers/base.controller.helpers.js +3 -5
  20. package/dist/cjs/modules/base/utils/helpers/base.controller.helpers.js.map +1 -1
  21. package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js +36 -47
  22. package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js.map +1 -1
  23. package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js +30 -40
  24. package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js.map +1 -1
  25. package/dist/cjs/modules/email/email.service.js +28 -39
  26. package/dist/cjs/modules/email/email.service.js.map +1 -1
  27. package/dist/cjs/modules/error-handler/error-handler.controller.js +6 -3
  28. package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
  29. package/dist/cjs/modules/error-handler/utils/catch-async.js +3 -12
  30. package/dist/cjs/modules/error-handler/utils/catch-async.js.map +1 -1
  31. package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js +17 -31
  32. package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
  33. package/dist/cjs/modules/file-uploader/file-uploader.controller.js +18 -27
  34. package/dist/cjs/modules/file-uploader/file-uploader.controller.js.map +1 -1
  35. package/dist/cjs/modules/file-uploader/file-uploader.router.js +23 -34
  36. package/dist/cjs/modules/file-uploader/file-uploader.router.js.map +1 -1
  37. package/dist/cjs/modules/file-uploader/file-uploader.service.js +117 -131
  38. package/dist/cjs/modules/file-uploader/file-uploader.service.js.map +1 -1
  39. package/dist/cjs/modules/file-uploader/utils/helpers/file-uploader.helpers.js +15 -26
  40. package/dist/cjs/modules/file-uploader/utils/helpers/file-uploader.helpers.js.map +1 -1
  41. package/dist/cjs/server.js +1 -1
  42. package/dist/cjs/server.js.map +1 -1
  43. package/dist/cjs/utils/cli/build.js +9 -2
  44. package/dist/cjs/utils/cli/build.js.map +1 -1
  45. package/dist/cjs/utils/cli/dev.js +43 -48
  46. package/dist/cjs/utils/cli/dev.js.map +1 -1
  47. package/dist/cjs/utils/cli/start.js +35 -38
  48. package/dist/cjs/utils/cli/start.js.map +1 -1
  49. package/dist/cjs/utils/features/api.features.js +26 -33
  50. package/dist/cjs/utils/features/api.features.js.map +1 -1
  51. package/dist/cjs/utils/helpers/api.features.helpers.js +4 -6
  52. package/dist/cjs/utils/helpers/api.features.helpers.js.map +1 -1
  53. package/dist/cjs/utils/helpers/change-case.helpers.js +28 -36
  54. package/dist/cjs/utils/helpers/change-case.helpers.js.map +1 -1
  55. package/dist/cjs/utils/helpers/deepmerge.helper.js +4 -8
  56. package/dist/cjs/utils/helpers/deepmerge.helper.js.map +1 -1
  57. package/dist/cjs/utils/helpers/global.helpers.js +2 -13
  58. package/dist/cjs/utils/helpers/global.helpers.js.map +1 -1
  59. package/dist/cjs/utils/helpers/models.helpers.js +65 -80
  60. package/dist/cjs/utils/helpers/models.helpers.js.map +1 -1
  61. package/dist/cjs/utils/helpers/prisma.helpers.js +23 -34
  62. package/dist/cjs/utils/helpers/prisma.helpers.js.map +1 -1
  63. package/dist/cjs/utils/validate-dto.js +6 -17
  64. package/dist/cjs/utils/validate-dto.js.map +1 -1
  65. package/dist/cjs/utils/validate-schema.js +6 -17
  66. package/dist/cjs/utils/validate-schema.js.map +1 -1
  67. package/dist/es2020/app.js +1 -1
  68. package/dist/es2020/app.js.map +1 -1
  69. package/dist/es2020/modules/auth/auth.controller.js +53 -64
  70. package/dist/es2020/modules/auth/auth.controller.js.map +1 -1
  71. package/dist/es2020/modules/auth/auth.router.js +46 -58
  72. package/dist/es2020/modules/auth/auth.router.js.map +1 -1
  73. package/dist/es2020/modules/auth/auth.service.js +75 -97
  74. package/dist/es2020/modules/auth/auth.service.js.map +1 -1
  75. package/dist/es2020/modules/auth/utils/helpers/auth.controller.helpers.js +6 -7
  76. package/dist/es2020/modules/auth/utils/helpers/auth.controller.helpers.js.map +1 -1
  77. package/dist/es2020/modules/base/base.controller.js +30 -46
  78. package/dist/es2020/modules/base/base.controller.js.map +1 -1
  79. package/dist/es2020/modules/base/base.middlewares.js +17 -21
  80. package/dist/es2020/modules/base/base.middlewares.js.map +1 -1
  81. package/dist/es2020/modules/base/base.router.js +6 -17
  82. package/dist/es2020/modules/base/base.router.js.map +1 -1
  83. package/dist/es2020/modules/base/base.service.js +128 -116
  84. package/dist/es2020/modules/base/base.service.js.map +1 -1
  85. package/dist/es2020/modules/base/utils/helpers/base.controller.helpers.js +3 -5
  86. package/dist/es2020/modules/base/utils/helpers/base.controller.helpers.js.map +1 -1
  87. package/dist/es2020/modules/base/utils/helpers/base.router.helpers.js +36 -47
  88. package/dist/es2020/modules/base/utils/helpers/base.router.helpers.js.map +1 -1
  89. package/dist/es2020/modules/base/utils/helpers/base.service.helpers.js +30 -40
  90. package/dist/es2020/modules/base/utils/helpers/base.service.helpers.js.map +1 -1
  91. package/dist/es2020/modules/email/email.service.js +28 -39
  92. package/dist/es2020/modules/email/email.service.js.map +1 -1
  93. package/dist/es2020/modules/error-handler/error-handler.controller.js +6 -3
  94. package/dist/es2020/modules/error-handler/error-handler.controller.js.map +1 -1
  95. package/dist/es2020/modules/error-handler/utils/catch-async.js +3 -12
  96. package/dist/es2020/modules/error-handler/utils/catch-async.js.map +1 -1
  97. package/dist/es2020/modules/error-handler/utils/error-handler.helpers.js +17 -31
  98. package/dist/es2020/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
  99. package/dist/es2020/modules/file-uploader/file-uploader.controller.js +18 -27
  100. package/dist/es2020/modules/file-uploader/file-uploader.controller.js.map +1 -1
  101. package/dist/es2020/modules/file-uploader/file-uploader.router.js +23 -34
  102. package/dist/es2020/modules/file-uploader/file-uploader.router.js.map +1 -1
  103. package/dist/es2020/modules/file-uploader/file-uploader.service.js +117 -131
  104. package/dist/es2020/modules/file-uploader/file-uploader.service.js.map +1 -1
  105. package/dist/es2020/modules/file-uploader/utils/helpers/file-uploader.helpers.js +15 -26
  106. package/dist/es2020/modules/file-uploader/utils/helpers/file-uploader.helpers.js.map +1 -1
  107. package/dist/es2020/server.js +1 -1
  108. package/dist/es2020/server.js.map +1 -1
  109. package/dist/es2020/utils/cli/build.js +9 -2
  110. package/dist/es2020/utils/cli/build.js.map +1 -1
  111. package/dist/es2020/utils/cli/dev.js +43 -48
  112. package/dist/es2020/utils/cli/dev.js.map +1 -1
  113. package/dist/es2020/utils/cli/start.js +35 -38
  114. package/dist/es2020/utils/cli/start.js.map +1 -1
  115. package/dist/es2020/utils/features/api.features.js +26 -33
  116. package/dist/es2020/utils/features/api.features.js.map +1 -1
  117. package/dist/es2020/utils/helpers/api.features.helpers.js +4 -6
  118. package/dist/es2020/utils/helpers/api.features.helpers.js.map +1 -1
  119. package/dist/es2020/utils/helpers/change-case.helpers.js +28 -36
  120. package/dist/es2020/utils/helpers/change-case.helpers.js.map +1 -1
  121. package/dist/es2020/utils/helpers/deepmerge.helper.js +4 -8
  122. package/dist/es2020/utils/helpers/deepmerge.helper.js.map +1 -1
  123. package/dist/es2020/utils/helpers/global.helpers.js +2 -13
  124. package/dist/es2020/utils/helpers/global.helpers.js.map +1 -1
  125. package/dist/es2020/utils/helpers/models.helpers.js +65 -80
  126. package/dist/es2020/utils/helpers/models.helpers.js.map +1 -1
  127. package/dist/es2020/utils/helpers/prisma.helpers.js +23 -34
  128. package/dist/es2020/utils/helpers/prisma.helpers.js.map +1 -1
  129. package/dist/es2020/utils/validate-dto.js +6 -17
  130. package/dist/es2020/utils/validate-dto.js.map +1 -1
  131. package/dist/es2020/utils/validate-schema.js +6 -17
  132. package/dist/es2020/utils/validate-schema.js.map +1 -1
  133. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"change-case.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/change-case.helpers.ts"],"names":[],"mappings":"AACA,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AACtD,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAG5D,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAGzD,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAG9C,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAGrC,MAAM,gCAAgC,GAAG,EAAE,CAAC;AA+B5C,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,IAAI,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE1B,MAAM,GAAG,MAAM;SACZ,OAAO,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;SAClD,OAAO,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC;IAEtD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;IAEpD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;IAG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AAA;YAAE,MAAM;QAC/C,WAAW,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,WAAW,GAAG,WAAW,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,WAAW,GAAG,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,CAAA,MAAA,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,QAAQ,iEAAG,IAAI,CAAC,CAAA;YAAE,MAAM;QAC/C,WAAW,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAC9C,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC;KACzB,CAAC;AACJ,CAAC","sourcesContent":["// Regexps involved with splitting words in various case formats.\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\n\n// Used to iterate over the initial split result and separate numbers.\nconst SPLIT_SEPARATE_NUMBER_RE = /(\\d)\\p{Ll}|(\\p{L})\\d/u;\n\n// Regexp involved with stripping non-word characters from the result.\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\n\n// The replacement value for splits.\nconst SPLIT_REPLACE_VALUE = \"$1\\0$2\";\n\n// The default characters to keep after transforming case.\nconst DEFAULT_PREFIX_SUFFIX_CHARACTERS = \"\";\n\n/**\n * Supported locale values. Use `false` to ignore locale.\n * Defaults to `undefined`, which uses the host environment.\n */\nexport type Locale = string[] | string | false | undefined;\n\n/**\n * Options used for converting strings to pascal/camel case.\n */\nexport interface PascalCaseOptions extends Options {\n mergeAmbiguousCharacters?: boolean;\n}\n\n/**\n * Options used for converting strings to any case.\n */\nexport interface Options {\n locale?: Locale;\n split?: (value: string) => string[];\n /** @deprecated Pass `split: splitSeparateNumbers` instead. */\n separateNumbers?: boolean;\n delimiter?: string;\n prefixCharacters?: string;\n suffixCharacters?: string;\n}\n\n/**\n * Split any cased input strings into an array of words.\n */\nexport function split(value: string) {\n let result = value.trim();\n\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n\n result = result.replace(DEFAULT_STRIP_REGEXP, \"\\0\");\n\n let start = 0;\n let end = result.length;\n\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\") start++;\n if (start === end) return [];\n while (result.charAt(end - 1) === \"\\0\") end--;\n\n return result.slice(start, end).split(/\\0/g);\n}\n\n/**\n * Split the input string into an array of words, separating numbers.\n */\nexport function splitSeparateNumbers(value: string) {\n const words = split(value);\n for (let i = 0; i < words.length; i++) {\n const word = words[i];\n const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);\n if (match) {\n const offset = match.index + (match[1] ?? match[2]).length;\n words.splice(i, 1, word.slice(0, offset), word.slice(offset));\n }\n }\n return words;\n}\n\n/**\n * Convert a string to space separated lower case (`foo bar`).\n */\nexport function noCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to camel case (`fooBar`).\n */\nexport function camelCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return lower(word);\n return transform(word, index);\n })\n .join(options?.delimiter ?? \"\") +\n suffix\n );\n}\n\n/**\n * Convert a string to pascal case (`FooBar`).\n */\nexport function pascalCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return prefix + words.map(transform).join(options?.delimiter ?? \"\") + suffix;\n}\n\n/**\n * Convert a string to pascal snake case (`Foo_Bar`).\n */\nexport function pascalSnakeCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to capital case (`Foo Bar`).\n */\nexport function capitalCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n return (\n prefix +\n words\n .map(capitalCaseTransformFactory(lower, upper))\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to constant case (`FOO_BAR`).\n */\nexport function constantCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(upperFactory(options?.locale)).join(options?.delimiter ?? \"_\") +\n suffix\n );\n}\n\n/**\n * Convert a string to dot case (`foo.bar`).\n */\nexport function dotCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \".\", ...options });\n}\n\n/**\n * Convert a string to kebab case (`foo-bar`).\n */\nexport function kebabCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"-\", ...options });\n}\n\n/**\n * Convert a string to path case (`foo/bar`).\n */\nexport function pathCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"/\", ...options });\n}\n\n/**\n * Convert a string to path case (`Foo bar`).\n */\nexport function sentenceCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = capitalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return transform(word);\n return lower(word);\n })\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to snake case (`foo_bar`).\n */\nexport function snakeCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to header case (`Foo-Bar`).\n */\nexport function trainCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"-\", ...options });\n}\n\nfunction lowerFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toLowerCase()\n : (input: string) => input.toLocaleLowerCase(locale);\n}\n\nfunction upperFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toUpperCase()\n : (input: string) => input.toLocaleUpperCase(locale);\n}\n\nfunction capitalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string\n) {\n return (word: string) => `${upper(word[0])}${lower(word.slice(1))}`;\n}\n\nfunction pascalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string\n) {\n return (word: string, index: number) => {\n const char0 = word[0];\n const initial =\n index > 0 && char0 >= \"0\" && char0 <= \"9\" ? \"_\" + char0 : upper(char0);\n return initial + lower(word.slice(1));\n };\n}\n\nfunction splitPrefixSuffix(\n input: string,\n options: Options = {}\n): [string, string[], string] {\n const splitFn =\n options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);\n const prefixCharacters =\n options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n const suffixCharacters =\n options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n let prefixIndex = 0;\n let suffixIndex = input.length;\n\n while (prefixIndex < input.length) {\n const char = input.charAt(prefixIndex);\n if (!prefixCharacters?.includes?.(char)) break;\n prefixIndex++;\n }\n\n while (suffixIndex > prefixIndex) {\n const index = suffixIndex - 1;\n const char = input.charAt(index);\n if (!suffixCharacters?.includes?.(char)) break;\n suffixIndex = index;\n }\n\n return [\n input.slice(0, prefixIndex),\n splitFn(input.slice(prefixIndex, suffixIndex)),\n input.slice(suffixIndex),\n ];\n}\n"]}
1
+ {"version":3,"file":"change-case.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/change-case.helpers.ts"],"names":[],"mappings":"AACA,MAAM,oBAAoB,GAAG,wBAAwB,CAAC;AACtD,MAAM,oBAAoB,GAAG,8BAA8B,CAAC;AAG5D,MAAM,wBAAwB,GAAG,uBAAuB,CAAC;AAGzD,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAG9C,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAGrC,MAAM,gCAAgC,GAAG,EAAE,CAAC;AA+B5C,MAAM,UAAU,KAAK,CAAC,KAAa;IACjC,IAAI,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAE1B,MAAM,GAAG,MAAM;SACZ,OAAO,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;SAClD,OAAO,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC;IAEtD,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;IAEpD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC;IAGxB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI;QAAE,KAAK,EAAE,CAAC;IAC9C,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,EAAE,CAAC;IAC7B,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,IAAI;QAAE,GAAG,EAAE,CAAC;IAE9C,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC/C,CAAC;AAKD,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,KAA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B,GACpB,OAAO,CAAC,gBAAgB,IAAI,gCAAgC,CAAC;IAC/D,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,IAAI,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC;IAE/B,OAAO,WAAW,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACvC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC;YAAE,MAAM;QAC/C,WAAW,EAAE,CAAC;IAChB,CAAC;IAED,OAAO,WAAW,GAAG,WAAW,EAAE,CAAC;QACjC,MAAM,KAAK,GAAG,WAAW,GAAG,CAAC,CAAC;QAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,CAAC,gBAAgB,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC;YAAE,MAAM;QAC/C,WAAW,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,OAAO;QACL,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAC9C,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC;KACzB,CAAC;AACJ,CAAC","sourcesContent":["// Regexps involved with splitting words in various case formats.\nconst SPLIT_LOWER_UPPER_RE = /([\\p{Ll}\\d])(\\p{Lu})/gu;\nconst SPLIT_UPPER_UPPER_RE = /(\\p{Lu})([\\p{Lu}][\\p{Ll}])/gu;\n\n// Used to iterate over the initial split result and separate numbers.\nconst SPLIT_SEPARATE_NUMBER_RE = /(\\d)\\p{Ll}|(\\p{L})\\d/u;\n\n// Regexp involved with stripping non-word characters from the result.\nconst DEFAULT_STRIP_REGEXP = /[^\\p{L}\\d]+/giu;\n\n// The replacement value for splits.\nconst SPLIT_REPLACE_VALUE = \"$1\\0$2\";\n\n// The default characters to keep after transforming case.\nconst DEFAULT_PREFIX_SUFFIX_CHARACTERS = \"\";\n\n/**\n * Supported locale values. Use `false` to ignore locale.\n * Defaults to `undefined`, which uses the host environment.\n */\nexport type Locale = string[] | string | false | undefined;\n\n/**\n * Options used for converting strings to pascal/camel case.\n */\nexport interface PascalCaseOptions extends Options {\n mergeAmbiguousCharacters?: boolean;\n}\n\n/**\n * Options used for converting strings to any case.\n */\nexport interface Options {\n locale?: Locale;\n split?: (value: string) => string[];\n /** @deprecated Pass `split: splitSeparateNumbers` instead. */\n separateNumbers?: boolean;\n delimiter?: string;\n prefixCharacters?: string;\n suffixCharacters?: string;\n}\n\n/**\n * Split any cased input strings into an array of words.\n */\nexport function split(value: string) {\n let result = value.trim();\n\n result = result\n .replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE)\n .replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);\n\n result = result.replace(DEFAULT_STRIP_REGEXP, \"\\0\");\n\n let start = 0;\n let end = result.length;\n\n // Trim the delimiter from around the output string.\n while (result.charAt(start) === \"\\0\") start++;\n if (start === end) return [];\n while (result.charAt(end - 1) === \"\\0\") end--;\n\n return result.slice(start, end).split(/\\0/g);\n}\n\n/**\n * Split the input string into an array of words, separating numbers.\n */\nexport function splitSeparateNumbers(value: string) {\n const words = split(value);\n for (let i = 0; i < words.length; i++) {\n const word = words[i];\n const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);\n if (match) {\n const offset = match.index + (match[1] ?? match[2]).length;\n words.splice(i, 1, word.slice(0, offset), word.slice(offset));\n }\n }\n return words;\n}\n\n/**\n * Convert a string to space separated lower case (`foo bar`).\n */\nexport function noCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to camel case (`fooBar`).\n */\nexport function camelCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return lower(word);\n return transform(word, index);\n })\n .join(options?.delimiter ?? \"\") +\n suffix\n );\n}\n\n/**\n * Convert a string to pascal case (`FooBar`).\n */\nexport function pascalCase(input: string, options?: PascalCaseOptions) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = options?.mergeAmbiguousCharacters\n ? capitalCaseTransformFactory(lower, upper)\n : pascalCaseTransformFactory(lower, upper);\n return prefix + words.map(transform).join(options?.delimiter ?? \"\") + suffix;\n}\n\n/**\n * Convert a string to pascal snake case (`Foo_Bar`).\n */\nexport function pascalSnakeCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to capital case (`Foo Bar`).\n */\nexport function capitalCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n return (\n prefix +\n words\n .map(capitalCaseTransformFactory(lower, upper))\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to constant case (`FOO_BAR`).\n */\nexport function constantCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n return (\n prefix +\n words.map(upperFactory(options?.locale)).join(options?.delimiter ?? \"_\") +\n suffix\n );\n}\n\n/**\n * Convert a string to dot case (`foo.bar`).\n */\nexport function dotCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \".\", ...options });\n}\n\n/**\n * Convert a string to kebab case (`foo-bar`).\n */\nexport function kebabCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"-\", ...options });\n}\n\n/**\n * Convert a string to path case (`foo/bar`).\n */\nexport function pathCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"/\", ...options });\n}\n\n/**\n * Convert a string to path case (`Foo bar`).\n */\nexport function sentenceCase(input: string, options?: Options) {\n const [prefix, words, suffix] = splitPrefixSuffix(input, options);\n const lower = lowerFactory(options?.locale);\n const upper = upperFactory(options?.locale);\n const transform = capitalCaseTransformFactory(lower, upper);\n return (\n prefix +\n words\n .map((word, index) => {\n if (index === 0) return transform(word);\n return lower(word);\n })\n .join(options?.delimiter ?? \" \") +\n suffix\n );\n}\n\n/**\n * Convert a string to snake case (`foo_bar`).\n */\nexport function snakeCase(input: string, options?: Options) {\n return noCase(input, { delimiter: \"_\", ...options });\n}\n\n/**\n * Convert a string to header case (`Foo-Bar`).\n */\nexport function trainCase(input: string, options?: Options) {\n return capitalCase(input, { delimiter: \"-\", ...options });\n}\n\nfunction lowerFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toLowerCase()\n : (input: string) => input.toLocaleLowerCase(locale);\n}\n\nfunction upperFactory(locale: Locale): (input: string) => string {\n return locale === false\n ? (input: string) => input.toUpperCase()\n : (input: string) => input.toLocaleUpperCase(locale);\n}\n\nfunction capitalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string\n) {\n return (word: string) => `${upper(word[0])}${lower(word.slice(1))}`;\n}\n\nfunction pascalCaseTransformFactory(\n lower: (input: string) => string,\n upper: (input: string) => string\n) {\n return (word: string, index: number) => {\n const char0 = word[0];\n const initial =\n index > 0 && char0 >= \"0\" && char0 <= \"9\" ? \"_\" + char0 : upper(char0);\n return initial + lower(word.slice(1));\n };\n}\n\nfunction splitPrefixSuffix(\n input: string,\n options: Options = {}\n): [string, string[], string] {\n const splitFn =\n options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);\n const prefixCharacters =\n options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n const suffixCharacters =\n options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;\n let prefixIndex = 0;\n let suffixIndex = input.length;\n\n while (prefixIndex < input.length) {\n const char = input.charAt(prefixIndex);\n if (!prefixCharacters?.includes?.(char)) break;\n prefixIndex++;\n }\n\n while (suffixIndex > prefixIndex) {\n const index = suffixIndex - 1;\n const char = input.charAt(index);\n if (!suffixCharacters?.includes?.(char)) break;\n suffixIndex = index;\n }\n\n return [\n input.slice(0, prefixIndex),\n splitFn(input.slice(prefixIndex, suffixIndex)),\n input.slice(suffixIndex),\n ];\n}\n"]}
@@ -24,8 +24,7 @@ function getEnumerableOwnPropertySymbols(target) {
24
24
  : [];
25
25
  }
26
26
  function cloneUnlessOtherwiseSpecified(value, options) {
27
- var _a;
28
- return options.clone !== false && ((_a = options.isMergeableObject) === null || _a === void 0 ? void 0 : _a.call(options, value))
27
+ return options.clone !== false && options.isMergeableObject?.(value)
29
28
  ? deepmerge(emptyTarget(value), value, options)
30
29
  : value;
31
30
  }
@@ -55,9 +54,8 @@ function propertyIsUnsafe(target, key) {
55
54
  Object.propertyIsEnumerable.call(target, key)));
56
55
  }
57
56
  function mergeObject(target, source, options) {
58
- var _a;
59
57
  const destination = {};
60
- if ((_a = options.isMergeableObject) === null || _a === void 0 ? void 0 : _a.call(options, target)) {
58
+ if (options.isMergeableObject?.(target)) {
61
59
  getKeys(target).forEach(function (key) {
62
60
  destination[key] = options.cloneUnlessOtherwiseSpecified
63
61
  ? options.cloneUnlessOtherwiseSpecified(target[key], options)
@@ -65,12 +63,11 @@ function mergeObject(target, source, options) {
65
63
  });
66
64
  }
67
65
  getKeys(source).forEach(function (key) {
68
- var _a;
69
66
  if (propertyIsUnsafe(target, key)) {
70
67
  return;
71
68
  }
72
69
  if (propertyIsOnObject(target, key) &&
73
- ((_a = options.isMergeableObject) === null || _a === void 0 ? void 0 : _a.call(options, source[key]))) {
70
+ options.isMergeableObject?.(source[key])) {
74
71
  destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
75
72
  }
76
73
  else {
@@ -82,7 +79,6 @@ function mergeObject(target, source, options) {
82
79
  return destination;
83
80
  }
84
81
  function deepmerge(target, source, options) {
85
- var _a;
86
82
  options = options || {};
87
83
  const mergeOptions = {
88
84
  arrayMerge: options.arrayMerge || defaultArrayMerge,
@@ -98,7 +94,7 @@ function deepmerge(target, source, options) {
98
94
  return mergeOptions.cloneUnlessOtherwiseSpecified(source, mergeOptions);
99
95
  }
100
96
  else if (sourceIsArray) {
101
- return (_a = mergeOptions.arrayMerge) === null || _a === void 0 ? void 0 : _a.call(mergeOptions, target, source, mergeOptions);
97
+ return mergeOptions.arrayMerge?.(target, source, mergeOptions);
102
98
  }
103
99
  else {
104
100
  return mergeObject(target, source, mergeOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"deepmerge.helper.js","sourceRoot":"","sources":["../../../../src/utils/helpers/deepmerge.helper.ts"],"names":[],"mappings":"AAqBA,SAAS,iBAAiB,CAAC,KAAU;IACnC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,eAAe,CAAC,KAAU;IACjC,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AAC9C,CAAC;AAED,SAAS,SAAS,CAAC,KAAU;IAC3B,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE1D,OAAO,WAAW,KAAK,iBAAiB,IAAI,WAAW,KAAK,eAAe,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,GAAQ;IAC3B,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACtC,CAAC;AAED,SAAS,OAAO,CAAC,MAAW;IAC1B,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAA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CAAC;QACN,OAAO,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CACnB,KAAuB,EACvB,OAA2B;IAE3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACjC,OAAO,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,EAAE,EAAO,CAAC,CAAC;AACd,CAAC;AAED,SAAS,CAAC,GAAG,GAAG,YAAY,CAAC;AAE7B,eAAe,SAAS,CAAC","sourcesContent":["declare namespace deepmerge {\n export interface Options {\n arrayMerge?(\n target: any[],\n source: any[],\n options?: ArrayMergeOptions\n ): any[];\n clone?: boolean;\n customMerge?: (\n key: string,\n options?: Options\n ) => ((x: any, y: any) => any) | undefined;\n isMergeableObject?(value: object): boolean;\n cloneUnlessOtherwiseSpecified?(value: any, options?: Options): any;\n }\n\n export interface ArrayMergeOptions extends Options {\n cloneUnlessOtherwiseSpecified(value: any, options?: Options): any;\n }\n}\n\nfunction isMergeableObject(value: any): boolean {\n return isNonNullObject(value) && !isSpecial(value);\n}\n\nfunction isNonNullObject(value: any): boolean {\n return !!value && typeof value === \"object\";\n}\n\nfunction isSpecial(value: any): boolean {\n const stringValue = Object.prototype.toString.call(value);\n\n return stringValue === \"[object RegExp]\" || stringValue === \"[object Date]\";\n}\n\nfunction emptyTarget(val: any): any {\n return Array.isArray(val) ? [] : {};\n}\n\nfunction getKeys(target: any): (string | symbol)[] {\n const objectKeys = Object.keys(target);\n const symbolKeys = getEnumerableOwnPropertySymbols(target);\n return [...objectKeys, ...symbolKeys];\n}\n\nfunction getEnumerableOwnPropertySymbols(target: any): symbol[] {\n return Object.getOwnPropertySymbols\n ? Object.getOwnPropertySymbols(target).filter(function (symbol) {\n return Object.propertyIsEnumerable.call(target, symbol);\n })\n : [];\n}\n\nfunction cloneUnlessOtherwiseSpecified(\n value: any,\n options: deepmerge.Options\n): any {\n return options.clone !== false && options.isMergeableObject?.(value)\n ? deepmerge(emptyTarget(value), value, options)\n : value;\n}\n\nfunction defaultArrayMerge(\n target: any[],\n source: any[],\n options: deepmerge.ArrayMergeOptions\n): any[] {\n return target.concat(source).map(function (element) {\n return options.cloneUnlessOtherwiseSpecified(element, options);\n });\n}\n\nfunction getMergeFunction(\n key: string,\n options: deepmerge.Options\n): (x: any, y: any, options?: deepmerge.Options) => any {\n if (!options.customMerge) {\n return deepmerge;\n }\n const customMerge = options.customMerge(key);\n return typeof customMerge === \"function\" ? customMerge : deepmerge;\n}\n\nfunction propertyIsOnObject(object: any, property: string | symbol): boolean {\n try {\n return property in object;\n } catch (_) {\n return false;\n }\n}\n\nfunction propertyIsUnsafe(target: any, key: string | symbol): boolean {\n return (\n propertyIsOnObject(target, key) &&\n !(\n Object.hasOwnProperty.call(target, key) &&\n Object.propertyIsEnumerable.call(target, key)\n )\n );\n}\n\nfunction mergeObject(\n target: any,\n source: any,\n options: deepmerge.Options\n): any {\n const destination: any = {};\n if (options.isMergeableObject?.(target)) {\n getKeys(target).forEach(function (key) {\n destination[key] = options.cloneUnlessOtherwiseSpecified\n ? options.cloneUnlessOtherwiseSpecified(target[key], options)\n : target[key];\n });\n }\n getKeys(source).forEach(function (key) {\n if (propertyIsUnsafe(target, key)) {\n return;\n }\n\n if (\n propertyIsOnObject(target, key) &&\n options.isMergeableObject?.(source[key])\n ) {\n destination[key] = getMergeFunction(key as string, options)(\n target[key],\n source[key],\n options\n );\n } else {\n destination[key] = options.cloneUnlessOtherwiseSpecified\n ? options.cloneUnlessOtherwiseSpecified(source[key], options)\n : source[key];\n }\n });\n return destination;\n}\n\nfunction deepmerge<T>(\n target: Partial<T>,\n source: Partial<T>,\n options?: deepmerge.Options\n): T;\nfunction deepmerge<T1, T2>(\n target: Partial<T1>,\n source: Partial<T2>,\n options?: deepmerge.Options\n): T1 & T2;\nfunction deepmerge(target: any, source: any, options?: deepmerge.Options): any {\n options = options || {};\n\n // Ensure default implementations\n const mergeOptions: deepmerge.ArrayMergeOptions = {\n arrayMerge: options.arrayMerge || defaultArrayMerge,\n isMergeableObject: options.isMergeableObject || isMergeableObject,\n cloneUnlessOtherwiseSpecified:\n options.cloneUnlessOtherwiseSpecified || cloneUnlessOtherwiseSpecified,\n clone: options.clone,\n customMerge: options.customMerge,\n };\n\n const sourceIsArray = Array.isArray(source);\n const targetIsArray = Array.isArray(target);\n const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n if (!sourceAndTargetTypesMatch) {\n return mergeOptions.cloneUnlessOtherwiseSpecified(source, mergeOptions);\n } else if (sourceIsArray) {\n return mergeOptions.arrayMerge?.(target, source, mergeOptions);\n } else {\n return mergeObject(target, source, mergeOptions);\n }\n}\n\nfunction deepmergeAll<T extends Record<string, any> = Record<string, any>>(\n array: ReadonlyArray<T>,\n options?: deepmerge.Options\n): T {\n if (!Array.isArray(array)) {\n throw new Error(\"first argument should be an array\");\n }\n\n return array.reduce((prev, next) => {\n return deepmerge(prev, next, options);\n }, {} as T);\n}\n\ndeepmerge.all = deepmergeAll;\n\nexport default deepmerge;\n"]}
1
+ {"version":3,"file":"deepmerge.helper.js","sourceRoot":"","sources":["../../../../src/utils/helpers/deepmerge.helper.ts"],"names":[],"mappings":"AAqBA,SAAS,iBAAiB,CAAC,KAAU;IACnC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,eAAe,CAAC,KAAU;IACjC,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AAC9C,CAAC;AAED,SAAS,SAAS,CAAC,KAAU;IAC3B,MAAM,WAAW,GAAG,MAAM,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K,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,yBAAyB,GAAG,aAAa,KAAK,aAAa,CAAC;IAElE,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC/B,OAAO,YAAY,CAAC,6BAA6B,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAC1E,CAAC;SAAM,IAAI,aAAa,EAAE,CAAC;QACzB,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACjE,CAAC;SAAM,CAAC;QACN,OAAO,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IACnD,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CACnB,KAAuB,EACvB,OAA2B;IAE3B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IAED,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACjC,OAAO,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC,EAAE,EAAO,CAAC,CAAC;AACd,CAAC;AAED,SAAS,CAAC,GAAG,GAAG,YAAY,CAAC;AAE7B,eAAe,SAAS,CAAC","sourcesContent":["declare namespace deepmerge {\n export interface Options {\n arrayMerge?(\n target: any[],\n source: any[],\n options?: ArrayMergeOptions\n ): any[];\n clone?: boolean;\n customMerge?: (\n key: string,\n options?: Options\n ) => ((x: any, y: any) => any) | undefined;\n isMergeableObject?(value: object): boolean;\n cloneUnlessOtherwiseSpecified?(value: any, options?: Options): any;\n }\n\n export interface ArrayMergeOptions extends Options {\n cloneUnlessOtherwiseSpecified(value: any, options?: Options): any;\n }\n}\n\nfunction isMergeableObject(value: any): boolean {\n return isNonNullObject(value) && !isSpecial(value);\n}\n\nfunction isNonNullObject(value: any): boolean {\n return !!value && typeof value === \"object\";\n}\n\nfunction isSpecial(value: any): boolean {\n const stringValue = Object.prototype.toString.call(value);\n\n return stringValue === \"[object RegExp]\" || stringValue === \"[object Date]\";\n}\n\nfunction emptyTarget(val: any): any {\n return Array.isArray(val) ? [] : {};\n}\n\nfunction getKeys(target: any): (string | symbol)[] {\n const objectKeys = Object.keys(target);\n const symbolKeys = getEnumerableOwnPropertySymbols(target);\n return [...objectKeys, ...symbolKeys];\n}\n\nfunction getEnumerableOwnPropertySymbols(target: any): symbol[] {\n return Object.getOwnPropertySymbols\n ? Object.getOwnPropertySymbols(target).filter(function (symbol) {\n return Object.propertyIsEnumerable.call(target, symbol);\n })\n : [];\n}\n\nfunction cloneUnlessOtherwiseSpecified(\n value: any,\n options: deepmerge.Options\n): any {\n return options.clone !== false && options.isMergeableObject?.(value)\n ? deepmerge(emptyTarget(value), value, options)\n : value;\n}\n\nfunction defaultArrayMerge(\n target: any[],\n source: any[],\n options: deepmerge.ArrayMergeOptions\n): any[] {\n return target.concat(source).map(function (element) {\n return options.cloneUnlessOtherwiseSpecified(element, options);\n });\n}\n\nfunction getMergeFunction(\n key: string,\n options: deepmerge.Options\n): (x: any, y: any, options?: deepmerge.Options) => any {\n if (!options.customMerge) {\n return deepmerge;\n }\n const customMerge = options.customMerge(key);\n return typeof customMerge === \"function\" ? customMerge : deepmerge;\n}\n\nfunction propertyIsOnObject(object: any, property: string | symbol): boolean {\n try {\n return property in object;\n } catch (_) {\n return false;\n }\n}\n\nfunction propertyIsUnsafe(target: any, key: string | symbol): boolean {\n return (\n propertyIsOnObject(target, key) &&\n !(\n Object.hasOwnProperty.call(target, key) &&\n Object.propertyIsEnumerable.call(target, key)\n )\n );\n}\n\nfunction mergeObject(\n target: any,\n source: any,\n options: deepmerge.Options\n): any {\n const destination: any = {};\n if (options.isMergeableObject?.(target)) {\n getKeys(target).forEach(function (key) {\n destination[key] = options.cloneUnlessOtherwiseSpecified\n ? options.cloneUnlessOtherwiseSpecified(target[key], options)\n : target[key];\n });\n }\n getKeys(source).forEach(function (key) {\n if (propertyIsUnsafe(target, key)) {\n return;\n }\n\n if (\n propertyIsOnObject(target, key) &&\n options.isMergeableObject?.(source[key])\n ) {\n destination[key] = getMergeFunction(key as string, options)(\n target[key],\n source[key],\n options\n );\n } else {\n destination[key] = options.cloneUnlessOtherwiseSpecified\n ? options.cloneUnlessOtherwiseSpecified(source[key], options)\n : source[key];\n }\n });\n return destination;\n}\n\nfunction deepmerge<T>(\n target: Partial<T>,\n source: Partial<T>,\n options?: deepmerge.Options\n): T;\nfunction deepmerge<T1, T2>(\n target: Partial<T1>,\n source: Partial<T2>,\n options?: deepmerge.Options\n): T1 & T2;\nfunction deepmerge(target: any, source: any, options?: deepmerge.Options): any {\n options = options || {};\n\n // Ensure default implementations\n const mergeOptions: deepmerge.ArrayMergeOptions = {\n arrayMerge: options.arrayMerge || defaultArrayMerge,\n isMergeableObject: options.isMergeableObject || isMergeableObject,\n cloneUnlessOtherwiseSpecified:\n options.cloneUnlessOtherwiseSpecified || cloneUnlessOtherwiseSpecified,\n clone: options.clone,\n customMerge: options.customMerge,\n };\n\n const sourceIsArray = Array.isArray(source);\n const targetIsArray = Array.isArray(target);\n const sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;\n\n if (!sourceAndTargetTypesMatch) {\n return mergeOptions.cloneUnlessOtherwiseSpecified(source, mergeOptions);\n } else if (sourceIsArray) {\n return mergeOptions.arrayMerge?.(target, source, mergeOptions);\n } else {\n return mergeObject(target, source, mergeOptions);\n }\n}\n\nfunction deepmergeAll<T extends Record<string, any> = Record<string, any>>(\n array: ReadonlyArray<T>,\n options?: deepmerge.Options\n): T {\n if (!Array.isArray(array)) {\n throw new Error(\"first argument should be an array\");\n }\n\n return array.reduce((prev, next) => {\n return deepmerge(prev, next, options);\n }, {} as T);\n}\n\ndeepmerge.all = deepmergeAll;\n\nexport default deepmerge;\n"]}
@@ -1,15 +1,4 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- export function importModule(path) {
11
- return __awaiter(this, void 0, void 0, function* () {
12
- return yield import(path);
13
- });
1
+ export async function importModule(path) {
2
+ return await import(path);
14
3
  }
15
4
  //# sourceMappingURL=global.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/global.helpers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,MAAM,UAAgB,YAAY,CAAC,IAAY;;QAC7C,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CAAA","sourcesContent":["export async function importModule(path: string) {\n return await import(path);\n}\n"]}
1
+ {"version":3,"file":"global.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/global.helpers.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAY;IAC7C,OAAO,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["export async function importModule(path: string) {\n return await import(path);\n}\n"]}
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import path from "path";
11
2
  import fs from "fs";
12
3
  import { camelCase, kebabCase, pascalCase, } from "../../utils/helpers/change-case.helpers";
@@ -62,76 +53,72 @@ export function getFileModelModulesFileStructure(modelName) {
62
53
  },
63
54
  };
64
55
  }
65
- export function processSubdir(modelName, type, result) {
66
- return __awaiter(this, void 0, void 0, function* () {
67
- const moduleDir = path.resolve(process.cwd(), "src", "modules", kebabCase(modelName));
68
- const subdir = path.join(moduleDir, type);
69
- const pascalModelName = pascalCase(modelName);
70
- const fileStructure = getFileModelModulesFileStructure(modelName);
71
- const isAuthModule = modelName.toLowerCase() === "auth";
72
- try {
73
- yield fs.promises.access(subdir).catch(() => {
74
- return;
75
- });
76
- yield Promise.all(Object.entries(fileStructure[type]).map((_a) => __awaiter(this, [_a], void 0, function* ([key, fileName]) {
77
- const filePath = path.join(subdir, fileName);
78
- try {
79
- const module = yield import(filePath).catch(() => null);
80
- if (module) {
81
- if (isAuthModule) {
82
- const pascalKey = key.charAt(0).toUpperCase() + key.slice(1);
83
- const expectedName = `${pascalKey}${type === "dtos" ? "Dto" : "Schema"}`;
84
- result[type][key] = module.default;
85
- }
86
- else {
87
- const expectedName = key === "model"
88
- ? `${pascalModelName}${type === "dtos" ? "Dto" : "Schema"}`
89
- : `${key.charAt(0).toUpperCase() + key.slice(1)}${pascalModelName}${type === "dtos" ? "Dto" : "Schema"}`;
90
- result[type][key] = module.default;
91
- }
92
- }
93
- }
94
- catch (error) {
95
- }
96
- })));
97
- }
98
- catch (error) {
99
- }
100
- });
101
- }
102
- export function importPrismaModelModules(modelName) {
103
- return __awaiter(this, void 0, void 0, function* () {
104
- const moduleDir = path.resolve(crd(), "src", "modules", modelName);
105
- const result = {
106
- dtos: {},
107
- schemas: {},
108
- };
109
- const fileStructure = getFileModelModulesFileStructure(modelName);
110
- yield Promise.all(Object.entries(fileStructure.core).map((_a) => __awaiter(this, [_a], void 0, function* ([key, fileName]) {
111
- const filePath = path.join(moduleDir, fileName);
56
+ export async function processSubdir(modelName, type, result) {
57
+ const moduleDir = path.resolve(process.cwd(), "src", "modules", kebabCase(modelName));
58
+ const subdir = path.join(moduleDir, type);
59
+ const pascalModelName = pascalCase(modelName);
60
+ const fileStructure = getFileModelModulesFileStructure(modelName);
61
+ const isAuthModule = modelName.toLowerCase() === "auth";
62
+ try {
63
+ await fs.promises.access(subdir).catch(() => {
64
+ return;
65
+ });
66
+ await Promise.all(Object.entries(fileStructure[type]).map(async ([key, fileName]) => {
67
+ const filePath = path.join(subdir, fileName);
112
68
  try {
113
- const module = yield importModule(filePath).catch(() => null);
69
+ const module = await import(filePath).catch(() => null);
114
70
  if (module) {
115
- if (key === "middlewares")
116
- result[key] = module;
117
- else
118
- result[key] = module.default || module;
71
+ if (isAuthModule) {
72
+ const pascalKey = key.charAt(0).toUpperCase() + key.slice(1);
73
+ const expectedName = `${pascalKey}${type === "dtos" ? "Dto" : "Schema"}`;
74
+ result[type][key] = module.default;
75
+ }
76
+ else {
77
+ const expectedName = key === "model"
78
+ ? `${pascalModelName}${type === "dtos" ? "Dto" : "Schema"}`
79
+ : `${key.charAt(0).toUpperCase() + key.slice(1)}${pascalModelName}${type === "dtos" ? "Dto" : "Schema"}`;
80
+ result[type][key] = module.default;
81
+ }
119
82
  }
120
83
  }
121
- catch (_b) { }
122
- })));
123
- yield Promise.all([
124
- processSubdir(modelName, "dtos", result),
125
- processSubdir(modelName, "schemas", result),
126
- ]);
127
- prismaModelsModules[modelName] = result;
128
- return result;
129
- });
84
+ catch (error) {
85
+ }
86
+ }));
87
+ }
88
+ catch (error) {
89
+ }
90
+ }
91
+ export async function importPrismaModelModules(modelName) {
92
+ const moduleDir = path.resolve(crd(), "src", "modules", modelName);
93
+ const result = {
94
+ dtos: {},
95
+ schemas: {},
96
+ };
97
+ const fileStructure = getFileModelModulesFileStructure(modelName);
98
+ await Promise.all(Object.entries(fileStructure.core).map(async ([key, fileName]) => {
99
+ const filePath = path.join(moduleDir, fileName);
100
+ try {
101
+ const module = await importModule(filePath).catch(() => null);
102
+ if (module) {
103
+ if (key === "middlewares")
104
+ result[key] = module;
105
+ else
106
+ result[key] = module.default || module;
107
+ }
108
+ }
109
+ catch { }
110
+ }));
111
+ await Promise.all([
112
+ processSubdir(modelName, "dtos", result),
113
+ processSubdir(modelName, "schemas", result),
114
+ ]);
115
+ prismaModelsModules[modelName] = result;
116
+ return result;
130
117
  }
131
118
  export const prismaModelRelationFields = {};
132
119
  export function getAllPrismaFiles(dirPath, fileList = []) {
133
120
  const files = fs.readdirSync(dirPath);
134
- files === null || files === void 0 ? void 0 : files.forEach((file) => {
121
+ files?.forEach((file) => {
135
122
  const filePath = path.join(dirPath, file);
136
123
  const stat = fs.statSync(filePath);
137
124
  if (stat.isDirectory() && file !== "migrations") {
@@ -147,19 +134,17 @@ const modelRegex = /model\s+(\w+)\s*{/g;
147
134
  export const models = [];
148
135
  export const prismaModelsUniqueFields = [];
149
136
  export function initializePrismaModels(testName) {
150
- var _a, _b, _c, _d, _e;
151
137
  const prismaContent = [];
152
138
  const files = getAllPrismaFiles("./prisma");
153
139
  for (const file of files) {
154
140
  const content = fs.readFileSync(file, "utf-8");
155
- if (!((_a = prismaContent === null || prismaContent === void 0 ? void 0 : prismaContent.includes) === null || _a === void 0 ? void 0 : _a.call(prismaContent, content)))
141
+ if (!prismaContent?.includes?.(content))
156
142
  prismaContent.push(content);
157
143
  }
158
144
  const content = prismaContent
159
145
  .join("\n")
160
146
  .replace(modelRegex, (_, modelName) => {
161
- var _a;
162
- if (!((_a = models === null || models === void 0 ? void 0 : models.includes) === null || _a === void 0 ? void 0 : _a.call(models, modelName)))
147
+ if (!models?.includes?.(modelName))
163
148
  models.push(camelCase(modelName.trim()));
164
149
  return `model ${modelName} {`;
165
150
  });
@@ -180,7 +165,7 @@ export function initializePrismaModels(testName) {
180
165
  trimmedLine.startsWith("//"))
181
166
  continue;
182
167
  const [fieldName, type] = trimmedLine.split(/\s+/);
183
- const isUnique = (_b = trimmedLine === null || trimmedLine === void 0 ? void 0 : trimmedLine.includes) === null || _b === void 0 ? void 0 : _b.call(trimmedLine, "@unique");
168
+ const isUnique = trimmedLine?.includes?.("@unique");
184
169
  if (isUnique) {
185
170
  const existingFields = prismaModelsUniqueFields[model] || [];
186
171
  const alreadyExists = existingFields.some((field) => field.name === fieldName &&
@@ -193,10 +178,10 @@ export function initializePrismaModels(testName) {
193
178
  ];
194
179
  }
195
180
  }
196
- const cleanType = type === null || type === void 0 ? void 0 : type.replace("[]", "").replace("?", "");
197
- if (((_c = trimmedLine === null || trimmedLine === void 0 ? void 0 : trimmedLine.includes) === null || _c === void 0 ? void 0 : _c.call(trimmedLine, "@relation")) ||
181
+ const cleanType = type?.replace("[]", "").replace("?", "");
182
+ if (trimmedLine?.includes?.("@relation") ||
198
183
  trimmedLine.match(/\s+\w+(\[\])?(\s+@|$)/) ||
199
- ((_d = models === null || models === void 0 ? void 0 : models.includes) === null || _d === void 0 ? void 0 : _d.call(models, camelCase(cleanType || "")))) {
184
+ models?.includes?.(camelCase(cleanType || ""))) {
200
185
  const enumStart = content.indexOf(`enum ${cleanType} {`);
201
186
  const typeStart = content.indexOf(`type ${cleanType} {`);
202
187
  if (!cleanType ||
@@ -213,7 +198,7 @@ export function initializePrismaModels(testName) {
213
198
  cleanType === "Json") {
214
199
  continue;
215
200
  }
216
- if (!((_e = type === null || type === void 0 ? void 0 : type.includes) === null || _e === void 0 ? void 0 : _e.call(type, "[]"))) {
201
+ if (!type?.includes?.("[]")) {
217
202
  relations.singular.push({
218
203
  name: fieldName,
219
204
  type: cleanType,
@@ -1 +1 @@
1
- {"version":3,"file":"models.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/models.helpers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EACL,SAAS,EACT,SAAS,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ElC,IAAI,CAAC,CAAC,SAAS,IAAI,yBAAyB,CAAC;QAAE,OAAO;IACtD,OAAO,yBAAyB,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC;AAOD,SAAS,SAAS;IAChB,OAAO,MAAM,CAAC;AAChB,CAAC;AAMD,SAAS,oBAAoB,CAAC,SAAiB;IAC7C,OAAO,wBAAwB,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport {\n camelCase,\n kebabCase,\n pascalCase,\n} from \"../../utils/helpers/change-case.helpers\";\nimport { crd, getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\nimport { AuthConfigs } from \"../../types/auth\";\n\nexport let prismaModelsModules: Record<\n string,\n Awaited<ReturnType<typeof importPrismaModelModules>>\n> = {};\n\nexport function getModelModules(modelName: string) {\n return prismaModelsModules[kebabCase(modelName)];\n}\n\nexport function getFileModelModulesFileStructure(modelName: string) {\n const kebabModelName = kebabCase(modelName).toLowerCase();\n const lowerModelName = kebabModelName.toLowerCase();\n const isAuthModule = modelName.toLowerCase() === \"auth\";\n const ext = getUserFileExtension();\n\n return {\n core: {\n service: `${kebabModelName}.service.${ext}`,\n controller: `${kebabModelName}.controller.${ext}`,\n middlewares: `${kebabModelName}.middlewares.${ext}`,\n authConfigs: `${kebabModelName}.auth-configs.${ext}`,\n prismaQueryOptions: `${kebabModelName}.prisma-query-options.${ext}`,\n router: `${kebabModelName}.router.${ext}`,\n },\n dtos: isAuthModule\n ? {\n login: `login.dto.${ext}`,\n signup: `signup.dto.${ext}`,\n updateMe: `update-me.dto.${ext}`,\n updatePassword: `update-password.dto.${ext}`,\n }\n : {\n model: `${lowerModelName}.dto.${ext}`,\n create: `create-${lowerModelName}.dto.${ext}`,\n createMany: `create-many-${lowerModelName}.dto.${ext}`,\n update: `update-${lowerModelName}.dto.${ext}`,\n updateMy: `update-many-${lowerModelName}.dto.${ext}`,\n query: `query-${lowerModelName}.dto.${ext}`,\n },\n schemas: isAuthModule\n ? {\n login: `login.schema.${ext}`,\n signup: `signup.schema.${ext}`,\n updateMe: `update-me.schema.${ext}`,\n updatePassword: `update-password.schema.${ext}`,\n }\n : {\n model: `${lowerModelName}.schema.${ext}`,\n create: `create-${lowerModelName}.schema.${ext}`,\n createMany: `create-many-${lowerModelName}.schema.${ext}`,\n update: `update-${lowerModelName}.schema.${ext}`,\n updateMy: `update-many-${lowerModelName}.schema.${ext}`,\n query: `query-${lowerModelName}.schema.${ext}`,\n },\n };\n}\n\nexport async function processSubdir(\n modelName: string,\n type: \"dtos\" | \"schemas\",\n result: Record<string, any>\n) {\n const moduleDir = path.resolve(\n process.cwd(),\n \"src\",\n \"modules\",\n kebabCase(modelName)\n );\n\n const subdir = path.join(moduleDir, type);\n const pascalModelName = pascalCase(modelName);\n const fileStructure = getFileModelModulesFileStructure(modelName);\n const isAuthModule = modelName.toLowerCase() === \"auth\";\n\n // Skip if directory doesn't exist\n try {\n await fs.promises.access(subdir).catch(() => {\n return; // Directory doesn't exist\n });\n\n await Promise.all(\n Object.entries(fileStructure[type]).map(async ([key, fileName]) => {\n const filePath = path.join(subdir, fileName);\n try {\n const module = await import(filePath).catch(() => null);\n if (module) {\n if (isAuthModule) {\n // Auth module uses different naming conventions\n const pascalKey = key.charAt(0).toUpperCase() + key.slice(1);\n const expectedName = `${pascalKey}${\n type === \"dtos\" ? \"Dto\" : \"Schema\"\n }`;\n result[type][key] = module.default;\n } else {\n // Standard modules\n const expectedName =\n key === \"model\"\n ? `${pascalModelName}${type === \"dtos\" ? \"Dto\" : \"Schema\"}`\n : `${\n key.charAt(0).toUpperCase() + key.slice(1)\n }${pascalModelName}${type === \"dtos\" ? \"Dto\" : \"Schema\"}`;\n\n result[type][key] = module.default;\n }\n }\n } catch (error) {\n // Silent fail - file might not exist\n }\n })\n );\n } catch (error) {\n // Directory doesn't exist, continue silently\n }\n}\n\ntype importPrismaModelModulesReturnType = {\n service?: any;\n controller?: any;\n middlewares?: any;\n authConfigs?: AuthConfigs;\n prismaQueryOptions?: any;\n router?: any;\n dtos: Record<string, any>;\n schemas: Record<string, any>;\n};\n\n/**\n * Dynamically imports model-specific modules for a given model with optimized file handling.\n * Includes special handling for the Auth module.\n *\n * @param {string} modelName - The name of the model (e.g., \"User\", \"Post\", \"Auth\").\n * @returns {Promise<Object>} An object containing the imported modules\n */\nexport async function importPrismaModelModules(\n modelName: string\n): Promise<importPrismaModelModulesReturnType> {\n const moduleDir = path.resolve(crd(), \"src\", \"modules\", modelName);\n\n const result: importPrismaModelModulesReturnType = {\n dtos: {},\n schemas: {},\n };\n\n const fileStructure = getFileModelModulesFileStructure(modelName);\n // Batch process core files\n await Promise.all(\n Object.entries(fileStructure.core).map(async ([key, fileName]) => {\n const filePath = path.join(moduleDir, fileName);\n try {\n const module = await importModule(filePath).catch(() => null);\n if (module) {\n if (key === \"middlewares\") result[key] = module;\n else result[key as keyof typeof result] = module.default || module;\n }\n } catch {}\n })\n );\n\n await Promise.all([\n processSubdir(modelName, \"dtos\", result),\n processSubdir(modelName, \"schemas\", result),\n ]);\n\n // Cache the result\n prismaModelsModules[modelName] = result;\n\n return result;\n}\n\nexport type ModelFieldDefition = {\n name: string;\n type: string;\n isUnique: boolean;\n};\n\n/**\n * Represents the structure of relation fields for Prisma models.\n * It includes both singular (one-to-one) and list (one-to-many) relationships.\n *\n * @typedef {Object} RelationFields\n * @property {Array<{name: string, type: string}>} singular - List of singular relationships.\n * @property {Array<{name: string, type: string}>} list - List of list relationships.\n */\nexport type RelationFields = {\n singular: Omit<ModelFieldDefition, \"isUnique\">[];\n list: Omit<ModelFieldDefition, \"isUnique\">[];\n};\n\n/**\n * Reads the Prisma schema files and extracts all model definitions,\n * identifying their relations (one-to-one and one-to-many).\n */\nexport const prismaModelRelationFields: Record<string, RelationFields> = {};\n\nexport function getAllPrismaFiles(dirPath: string, fileList: string[] = []) {\n const files = fs.readdirSync(dirPath);\n\n files?.forEach((file) => {\n const filePath = path.join(dirPath, file);\n const stat = fs.statSync(filePath);\n\n // Skip migrations folder\n if (stat.isDirectory() && file !== \"migrations\") {\n fileList = getAllPrismaFiles(filePath, fileList);\n } else if (stat.isFile() && file.endsWith(\".prisma\")) {\n fileList.push(filePath);\n }\n });\n\n return fileList;\n}\n\nconst modelRegex = /model\\s+(\\w+)\\s*{/g;\nexport const models: string[] = [];\nexport const prismaModelsUniqueFields: Record<string, ModelFieldDefition[]> =\n [] as any;\n\nexport function initializePrismaModels(testName?: string) {\n const prismaContent: string[] = [];\n\n const files = getAllPrismaFiles(\"./prisma\");\n\n for (const file of files) {\n const content = fs.readFileSync(file, \"utf-8\");\n\n if (!prismaContent?.includes?.(content)) prismaContent.push(content);\n }\n\n const content = prismaContent\n .join(\"\\n\")\n .replace(modelRegex, (_, modelName) => {\n if (!models?.includes?.(modelName))\n models.push(camelCase(modelName.trim()));\n return `model ${modelName} {`;\n });\n\n for (const model of models) {\n const modelName = pascalCase(model);\n\n const modelStart = content.indexOf(`model ${modelName} {`);\n const modelEnd = content.indexOf(\"}\", modelStart);\n const modelDefinition = content.slice(modelStart, modelEnd);\n\n const relations: RelationFields = {\n singular: [],\n list: [],\n };\n const lines = modelDefinition.split(\"\\n\");\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n\n if (\n !trimmedLine ||\n trimmedLine.startsWith(\"model\") ||\n trimmedLine.startsWith(\"//\")\n )\n continue;\n\n const [fieldName, type] = trimmedLine.split(/\\s+/);\n const isUnique = trimmedLine?.includes?.(\"@unique\");\n\n if (isUnique) {\n const existingFields = prismaModelsUniqueFields[model] || [];\n\n const alreadyExists = existingFields.some(\n (field) =>\n field.name === fieldName &&\n field.type === type &&\n field.isUnique === isUnique\n );\n\n if (!alreadyExists) {\n prismaModelsUniqueFields[model] = [\n ...existingFields,\n { name: fieldName, type, isUnique },\n ];\n }\n }\n\n const cleanType = type?.replace(\"[]\", \"\").replace(\"?\", \"\");\n\n if (\n trimmedLine?.includes?.(\"@relation\") ||\n trimmedLine.match(/\\s+\\w+(\\[\\])?(\\s+@|$)/) ||\n models?.includes?.(camelCase(cleanType || \"\"))\n ) {\n const enumStart = content.indexOf(`enum ${cleanType} {`);\n const typeStart = content.indexOf(`type ${cleanType} {`);\n\n if (\n !cleanType ||\n enumStart >= 0 ||\n typeStart >= 0 ||\n cleanType === \"String\" ||\n cleanType === \"Int\" ||\n cleanType === \"Float\" ||\n cleanType === \"Boolean\" ||\n cleanType === \"DateTime\" ||\n cleanType === \"Bytes\" ||\n cleanType === \"Decimal\" ||\n cleanType === \"BigInt\" ||\n cleanType === \"Json\"\n\n // && !content.includes?.(`model ${cleanType} {`)\n ) {\n continue;\n }\n\n if (!type?.includes?.(\"[]\")) {\n relations.singular.push({\n name: fieldName,\n type: cleanType,\n });\n } else {\n relations.list.push({\n name: fieldName,\n type: cleanType,\n });\n }\n }\n\n prismaModelRelationFields[modelName] = relations;\n }\n }\n}\n\ninitializePrismaModels();\n\n/**\n * Retrieves the relations for a given Prisma model.\n *\n * @param {string} modelName - The name of the model (e.g., \"User\").\n * @returns {RelationFields|undefined} The relation fields for the model, or `undefined` if no relations are found.\n */\nexport function getPrismaModelRelations(modelName: string) {\n modelName = pascalCase(modelName);\n\n if (!(modelName in prismaModelRelationFields)) return;\n return prismaModelRelationFields[modelName];\n}\n\n/**\n * Retrieves all the model names from the Prisma schema.\n *\n * @returns {string[]} An array of model names (e.g., [\"User\", \"Post\"]).\n */\nfunction getModels() {\n return models;\n}\n\n/** Retuns a given model unique fields\n * @param {string} modelName - The name of model in PascalCase\n * @returns {string[]} An array of all unique fields,\n */\nfunction getModelUniqueFields(modelName: string) {\n return prismaModelsUniqueFields[modelName];\n}\n\nexport { getModels, getModelUniqueFields };\n"]}
1
+ {"version":3,"file":"models.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/models.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CA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,SAAiB;IAC7C,OAAO,wBAAwB,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC","sourcesContent":["import path from \"path\";\nimport fs from \"fs\";\nimport {\n camelCase,\n kebabCase,\n pascalCase,\n} from \"../../utils/helpers/change-case.helpers\";\nimport { crd, getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\nimport { AuthConfigs } from \"../../types/auth\";\n\nexport let prismaModelsModules: Record<\n string,\n Awaited<ReturnType<typeof importPrismaModelModules>>\n> = {};\n\nexport function getModelModules(modelName: string) {\n return prismaModelsModules[kebabCase(modelName)];\n}\n\nexport function getFileModelModulesFileStructure(modelName: string) {\n const kebabModelName = kebabCase(modelName).toLowerCase();\n const lowerModelName = kebabModelName.toLowerCase();\n const isAuthModule = modelName.toLowerCase() === \"auth\";\n const ext = getUserFileExtension();\n\n return {\n core: {\n service: `${kebabModelName}.service.${ext}`,\n controller: `${kebabModelName}.controller.${ext}`,\n middlewares: `${kebabModelName}.middlewares.${ext}`,\n authConfigs: `${kebabModelName}.auth-configs.${ext}`,\n prismaQueryOptions: `${kebabModelName}.prisma-query-options.${ext}`,\n router: `${kebabModelName}.router.${ext}`,\n },\n dtos: isAuthModule\n ? {\n login: `login.dto.${ext}`,\n signup: `signup.dto.${ext}`,\n updateMe: `update-me.dto.${ext}`,\n updatePassword: `update-password.dto.${ext}`,\n }\n : {\n model: `${lowerModelName}.dto.${ext}`,\n create: `create-${lowerModelName}.dto.${ext}`,\n createMany: `create-many-${lowerModelName}.dto.${ext}`,\n update: `update-${lowerModelName}.dto.${ext}`,\n updateMy: `update-many-${lowerModelName}.dto.${ext}`,\n query: `query-${lowerModelName}.dto.${ext}`,\n },\n schemas: isAuthModule\n ? {\n login: `login.schema.${ext}`,\n signup: `signup.schema.${ext}`,\n updateMe: `update-me.schema.${ext}`,\n updatePassword: `update-password.schema.${ext}`,\n }\n : {\n model: `${lowerModelName}.schema.${ext}`,\n create: `create-${lowerModelName}.schema.${ext}`,\n createMany: `create-many-${lowerModelName}.schema.${ext}`,\n update: `update-${lowerModelName}.schema.${ext}`,\n updateMy: `update-many-${lowerModelName}.schema.${ext}`,\n query: `query-${lowerModelName}.schema.${ext}`,\n },\n };\n}\n\nexport async function processSubdir(\n modelName: string,\n type: \"dtos\" | \"schemas\",\n result: Record<string, any>\n) {\n const moduleDir = path.resolve(\n process.cwd(),\n \"src\",\n \"modules\",\n kebabCase(modelName)\n );\n\n const subdir = path.join(moduleDir, type);\n const pascalModelName = pascalCase(modelName);\n const fileStructure = getFileModelModulesFileStructure(modelName);\n const isAuthModule = modelName.toLowerCase() === \"auth\";\n\n // Skip if directory doesn't exist\n try {\n await fs.promises.access(subdir).catch(() => {\n return; // Directory doesn't exist\n });\n\n await Promise.all(\n Object.entries(fileStructure[type]).map(async ([key, fileName]) => {\n const filePath = path.join(subdir, fileName);\n try {\n const module = await import(filePath).catch(() => null);\n if (module) {\n if (isAuthModule) {\n // Auth module uses different naming conventions\n const pascalKey = key.charAt(0).toUpperCase() + key.slice(1);\n const expectedName = `${pascalKey}${\n type === \"dtos\" ? \"Dto\" : \"Schema\"\n }`;\n result[type][key] = module.default;\n } else {\n // Standard modules\n const expectedName =\n key === \"model\"\n ? `${pascalModelName}${type === \"dtos\" ? \"Dto\" : \"Schema\"}`\n : `${\n key.charAt(0).toUpperCase() + key.slice(1)\n }${pascalModelName}${type === \"dtos\" ? \"Dto\" : \"Schema\"}`;\n\n result[type][key] = module.default;\n }\n }\n } catch (error) {\n // Silent fail - file might not exist\n }\n })\n );\n } catch (error) {\n // Directory doesn't exist, continue silently\n }\n}\n\ntype importPrismaModelModulesReturnType = {\n service?: any;\n controller?: any;\n middlewares?: any;\n authConfigs?: AuthConfigs;\n prismaQueryOptions?: any;\n router?: any;\n dtos: Record<string, any>;\n schemas: Record<string, any>;\n};\n\n/**\n * Dynamically imports model-specific modules for a given model with optimized file handling.\n * Includes special handling for the Auth module.\n *\n * @param {string} modelName - The name of the model (e.g., \"User\", \"Post\", \"Auth\").\n * @returns {Promise<Object>} An object containing the imported modules\n */\nexport async function importPrismaModelModules(\n modelName: string\n): Promise<importPrismaModelModulesReturnType> {\n const moduleDir = path.resolve(crd(), \"src\", \"modules\", modelName);\n\n const result: importPrismaModelModulesReturnType = {\n dtos: {},\n schemas: {},\n };\n\n const fileStructure = getFileModelModulesFileStructure(modelName);\n // Batch process core files\n await Promise.all(\n Object.entries(fileStructure.core).map(async ([key, fileName]) => {\n const filePath = path.join(moduleDir, fileName);\n try {\n const module = await importModule(filePath).catch(() => null);\n if (module) {\n if (key === \"middlewares\") result[key] = module;\n else result[key as keyof typeof result] = module.default || module;\n }\n } catch {}\n })\n );\n\n await Promise.all([\n processSubdir(modelName, \"dtos\", result),\n processSubdir(modelName, \"schemas\", result),\n ]);\n\n // Cache the result\n prismaModelsModules[modelName] = result;\n\n return result;\n}\n\nexport type ModelFieldDefition = {\n name: string;\n type: string;\n isUnique: boolean;\n};\n\n/**\n * Represents the structure of relation fields for Prisma models.\n * It includes both singular (one-to-one) and list (one-to-many) relationships.\n *\n * @typedef {Object} RelationFields\n * @property {Array<{name: string, type: string}>} singular - List of singular relationships.\n * @property {Array<{name: string, type: string}>} list - List of list relationships.\n */\nexport type RelationFields = {\n singular: Omit<ModelFieldDefition, \"isUnique\">[];\n list: Omit<ModelFieldDefition, \"isUnique\">[];\n};\n\n/**\n * Reads the Prisma schema files and extracts all model definitions,\n * identifying their relations (one-to-one and one-to-many).\n */\nexport const prismaModelRelationFields: Record<string, RelationFields> = {};\n\nexport function getAllPrismaFiles(dirPath: string, fileList: string[] = []) {\n const files = fs.readdirSync(dirPath);\n\n files?.forEach((file) => {\n const filePath = path.join(dirPath, file);\n const stat = fs.statSync(filePath);\n\n // Skip migrations folder\n if (stat.isDirectory() && file !== \"migrations\") {\n fileList = getAllPrismaFiles(filePath, fileList);\n } else if (stat.isFile() && file.endsWith(\".prisma\")) {\n fileList.push(filePath);\n }\n });\n\n return fileList;\n}\n\nconst modelRegex = /model\\s+(\\w+)\\s*{/g;\nexport const models: string[] = [];\nexport const prismaModelsUniqueFields: Record<string, ModelFieldDefition[]> =\n [] as any;\n\nexport function initializePrismaModels(testName?: string) {\n const prismaContent: string[] = [];\n\n const files = getAllPrismaFiles(\"./prisma\");\n\n for (const file of files) {\n const content = fs.readFileSync(file, \"utf-8\");\n\n if (!prismaContent?.includes?.(content)) prismaContent.push(content);\n }\n\n const content = prismaContent\n .join(\"\\n\")\n .replace(modelRegex, (_, modelName) => {\n if (!models?.includes?.(modelName))\n models.push(camelCase(modelName.trim()));\n return `model ${modelName} {`;\n });\n\n for (const model of models) {\n const modelName = pascalCase(model);\n\n const modelStart = content.indexOf(`model ${modelName} {`);\n const modelEnd = content.indexOf(\"}\", modelStart);\n const modelDefinition = content.slice(modelStart, modelEnd);\n\n const relations: RelationFields = {\n singular: [],\n list: [],\n };\n const lines = modelDefinition.split(\"\\n\");\n\n for (const line of lines) {\n const trimmedLine = line.trim();\n\n if (\n !trimmedLine ||\n trimmedLine.startsWith(\"model\") ||\n trimmedLine.startsWith(\"//\")\n )\n continue;\n\n const [fieldName, type] = trimmedLine.split(/\\s+/);\n const isUnique = trimmedLine?.includes?.(\"@unique\");\n\n if (isUnique) {\n const existingFields = prismaModelsUniqueFields[model] || [];\n\n const alreadyExists = existingFields.some(\n (field) =>\n field.name === fieldName &&\n field.type === type &&\n field.isUnique === isUnique\n );\n\n if (!alreadyExists) {\n prismaModelsUniqueFields[model] = [\n ...existingFields,\n { name: fieldName, type, isUnique },\n ];\n }\n }\n\n const cleanType = type?.replace(\"[]\", \"\").replace(\"?\", \"\");\n\n if (\n trimmedLine?.includes?.(\"@relation\") ||\n trimmedLine.match(/\\s+\\w+(\\[\\])?(\\s+@|$)/) ||\n models?.includes?.(camelCase(cleanType || \"\"))\n ) {\n const enumStart = content.indexOf(`enum ${cleanType} {`);\n const typeStart = content.indexOf(`type ${cleanType} {`);\n\n if (\n !cleanType ||\n enumStart >= 0 ||\n typeStart >= 0 ||\n cleanType === \"String\" ||\n cleanType === \"Int\" ||\n cleanType === \"Float\" ||\n cleanType === \"Boolean\" ||\n cleanType === \"DateTime\" ||\n cleanType === \"Bytes\" ||\n cleanType === \"Decimal\" ||\n cleanType === \"BigInt\" ||\n cleanType === \"Json\"\n\n // && !content.includes?.(`model ${cleanType} {`)\n ) {\n continue;\n }\n\n if (!type?.includes?.(\"[]\")) {\n relations.singular.push({\n name: fieldName,\n type: cleanType,\n });\n } else {\n relations.list.push({\n name: fieldName,\n type: cleanType,\n });\n }\n }\n\n prismaModelRelationFields[modelName] = relations;\n }\n }\n}\n\ninitializePrismaModels();\n\n/**\n * Retrieves the relations for a given Prisma model.\n *\n * @param {string} modelName - The name of the model (e.g., \"User\").\n * @returns {RelationFields|undefined} The relation fields for the model, or `undefined` if no relations are found.\n */\nexport function getPrismaModelRelations(modelName: string) {\n modelName = pascalCase(modelName);\n\n if (!(modelName in prismaModelRelationFields)) return;\n return prismaModelRelationFields[modelName];\n}\n\n/**\n * Retrieves all the model names from the Prisma schema.\n *\n * @returns {string[]} An array of model names (e.g., [\"User\", \"Post\"]).\n */\nfunction getModels() {\n return models;\n}\n\n/** Retuns a given model unique fields\n * @param {string} modelName - The name of model in PascalCase\n * @returns {string[]} An array of all unique fields,\n */\nfunction getModelUniqueFields(modelName: string) {\n return prismaModelsUniqueFields[modelName];\n}\n\nexport { getModels, getModelUniqueFields };\n"]}
@@ -1,54 +1,43 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import fs from "fs";
11
2
  import catchAsync from "../../modules/error-handler/utils/catch-async";
12
3
  import AppError from "../../modules/error-handler/utils/app-error";
13
4
  import { crd, getUserFileExtension } from "./fs.helpers";
14
5
  import { importModule } from "./global.helpers";
15
6
  export let prismaInstance = null;
16
- export function loadPrismaModule() {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- if (!prismaInstance) {
19
- try {
20
- let prismaPath = `${crd()}/src/utils/prisma.${getUserFileExtension()}`;
21
- if (!fs.existsSync(prismaPath)) {
22
- prismaPath = `${crd()}/src/utils/prisma/index.${getUserFileExtension()}`;
23
- }
24
- const prismaModule = yield importModule(prismaPath);
25
- prismaInstance = prismaModule.default || prismaModule.prisma;
26
- if (!prismaInstance)
27
- throw new Error("Prisma not found");
28
- }
29
- catch (error) {
30
- if (error.message === "Prisma not found")
31
- throw new AppError("Could not initialize Prisma module.", 500, {
32
- tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()} or src/utils/prisma/index.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,
33
- });
34
- throw error;
7
+ export async function loadPrismaModule() {
8
+ if (!prismaInstance) {
9
+ try {
10
+ let prismaPath = `${crd()}/src/utils/prisma.${getUserFileExtension()}`;
11
+ if (!fs.existsSync(prismaPath)) {
12
+ prismaPath = `${crd()}/src/utils/prisma/index.${getUserFileExtension()}`;
35
13
  }
14
+ const prismaModule = await importModule(prismaPath);
15
+ prismaInstance = prismaModule.default || prismaModule.prisma;
16
+ if (!prismaInstance)
17
+ throw new Error("Prisma not found");
18
+ }
19
+ catch (error) {
20
+ if (error.message === "Prisma not found")
21
+ throw new AppError("Could not initialize Prisma module.", 500, {
22
+ tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()} or src/utils/prisma/index.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,
23
+ });
24
+ throw error;
36
25
  }
37
- return prismaInstance;
38
- });
26
+ }
27
+ return prismaInstance;
39
28
  }
40
29
  export function getPrismaInstance() {
41
30
  return prismaInstance;
42
31
  }
43
- export const checkDatabaseConnection = catchAsync((req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
44
- const prisma = yield loadPrismaModule();
32
+ export const checkDatabaseConnection = catchAsync(async (req, res, next) => {
33
+ const prisma = await loadPrismaModule();
45
34
  try {
46
- yield prisma.$connect();
35
+ await prisma.$connect();
47
36
  next();
48
37
  }
49
38
  catch (error) {
50
39
  console.error("Database connection error", error.message);
51
40
  next(new AppError(error.message, 503));
52
41
  }
53
- }));
42
+ });
54
43
  //# sourceMappingURL=prisma.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prisma.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/prisma.helpers.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,UAAU,MAAM,+CAA+C,CAAC;AACvE,OAAO,QAAQ,MAAM,6CAA6C,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,IAAI,cAAc,GAAQ,IAAI,CAAC;AAEtC,MAAM,UAAgB,gBAAgB;;QACpC,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,IAAI,CAAC;gBACH,IAAI,UAAU,GAAG,GAAG,GAAG,EAAE,qBAAqB,oBAAoB,EAAE,EAAE,CAAC;gBAEvE,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;oBAC/B,UAAU,GAAG,GAAG,GAAG,EAAE,2BAA2B,oBAAoB,EAAE,EAAE,CAAC;gBAC3E,CAAC;gBAED,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,UAAU,CAAC,CAAC;gBACpD,cAAc,GAAG,YAAY,CAAC,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC;gBAE7D,IAAI,CAAC,cAAc;oBAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;YAC3D,CAAC;YAAC,OAAO,KAAU,EAAE,CAAC;gBACpB,IAAI,KAAK,CAAC,OAAO,KAAK,kBAAkB;oBACtC,MAAM,IAAI,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;wBAC7D,GAAG,EAAE,qEAAqE,oBAAoB,EAAE,8BAA8B,oBAAoB,EAAE,gHAAgH;qBACrQ,CAAC,CAAC;gBACL,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;CAAA;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAC/C,CAAO,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;IACxD,MAAM,MAAM,GAAG,MAAM,gBAAgB,EAAE,CAAC;IACxC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,QAAQ,EAAE,CAAC;QACxB,IAAI,EAAE,CAAC;IACT,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC;AACH,CAAC,CAAA,CACF,CAAC","sourcesContent":["import fs from \"fs\";\nimport { Request, Response, NextFunction } from \"express\";\nimport catchAsync from \"../../modules/error-handler/utils/catch-async\";\nimport AppError from \"../../modules/error-handler/utils/app-error\";\nimport { crd, getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\n\nexport let prismaInstance: any = null;\n\nexport async function loadPrismaModule() {\n if (!prismaInstance) {\n try {\n let prismaPath = `${crd()}/src/utils/prisma.${getUserFileExtension()}`;\n\n if (!fs.existsSync(prismaPath)) {\n prismaPath = `${crd()}/src/utils/prisma/index.${getUserFileExtension()}`;\n }\n\n const prismaModule = await importModule(prismaPath);\n prismaInstance = prismaModule.default || prismaModule.prisma;\n\n if (!prismaInstance) throw new Error(\"Prisma not found\");\n } catch (error: any) {\n if (error.message === \"Prisma not found\")\n throw new AppError(\"Could not initialize Prisma module.\", 500, {\n tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()} or src/utils/prisma/index.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,\n });\n throw error;\n }\n }\n return prismaInstance;\n}\n\nexport function getPrismaInstance() {\n return prismaInstance;\n}\n\nexport const checkDatabaseConnection = catchAsync(\n async (req: Request, res: Response, next: NextFunction) => {\n const prisma = await loadPrismaModule();\n try {\n await prisma.$connect();\n next();\n } catch (error: any) {\n console.error(\"Database connection error\", error.message);\n next(new AppError(error.message, 503));\n }\n }\n);\n"]}
1
+ {"version":3,"file":"prisma.helpers.js","sourceRoot":"","sources":["../../../../src/utils/helpers/prisma.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,UAAU,MAAM,+CAA+C,CAAC;AACvE,OAAO,QAAQ,MAAM,6CAA6C,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,IAAI,cAAc,GAAQ,IAAI,CAAC;AAEtC,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,IAAI,CAAC;YACH,IAAI,UAAU,GAAG,GAAG,GAAG,EAAE,qBAAqB,oBAAoB,EAAE,EAAE,CAAC;YAEvE,IAAI,CAAC,EAA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unction } from \"express\";\nimport catchAsync from \"../../modules/error-handler/utils/catch-async\";\nimport AppError from \"../../modules/error-handler/utils/app-error\";\nimport { crd, getUserFileExtension } from \"./fs.helpers\";\nimport { importModule } from \"./global.helpers\";\n\nexport let prismaInstance: any = null;\n\nexport async function loadPrismaModule() {\n if (!prismaInstance) {\n try {\n let prismaPath = `${crd()}/src/utils/prisma.${getUserFileExtension()}`;\n\n if (!fs.existsSync(prismaPath)) {\n prismaPath = `${crd()}/src/utils/prisma/index.${getUserFileExtension()}`;\n }\n\n const prismaModule = await importModule(prismaPath);\n prismaInstance = prismaModule.default || prismaModule.prisma;\n\n if (!prismaInstance) throw new Error(\"Prisma not found\");\n } catch (error: any) {\n if (error.message === \"Prisma not found\")\n throw new AppError(\"Could not initialize Prisma module.\", 500, {\n tip: `Make sure your prisma instance is exported under src/utils/prisma.${getUserFileExtension()} or src/utils/prisma/index.${getUserFileExtension()}, read more about Arkos' Project Structure under https://www.arkosjs.com/docs/project-structure#root-structure`,\n });\n throw error;\n }\n }\n return prismaInstance;\n}\n\nexport function getPrismaInstance() {\n return prismaInstance;\n}\n\nexport const checkDatabaseConnection = catchAsync(\n async (req: Request, res: Response, next: NextFunction) => {\n const prisma = await loadPrismaModule();\n try {\n await prisma.$connect();\n next();\n } catch (error: any) {\n console.error(\"Database connection error\", error.message);\n next(new AppError(error.message, 503));\n }\n }\n);\n"]}