arkos 1.1.67-beta → 1.1.69-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 (111) hide show
  1. package/dist/cjs/app.js +1 -1
  2. package/dist/cjs/app.js.map +1 -1
  3. package/dist/cjs/exports/controllers/index.js +11 -0
  4. package/dist/cjs/exports/controllers/index.js.map +1 -0
  5. package/dist/cjs/exports/services/index.js +4 -4
  6. package/dist/cjs/exports/services/index.js.map +1 -1
  7. package/dist/cjs/modules/auth/auth.controller.js +6 -6
  8. package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
  9. package/dist/cjs/modules/auth/auth.service.js +11 -1
  10. package/dist/cjs/modules/auth/auth.service.js.map +1 -1
  11. package/dist/cjs/modules/base/base.controller.js +3 -3
  12. package/dist/cjs/modules/base/base.controller.js.map +1 -1
  13. package/dist/cjs/modules/base/base.service.js +19 -10
  14. package/dist/cjs/modules/base/base.service.js.map +1 -1
  15. package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js.map +1 -1
  16. package/dist/cjs/modules/file-upload/file-upload.controller.js +254 -0
  17. package/dist/cjs/modules/file-upload/file-upload.controller.js.map +1 -0
  18. package/dist/cjs/modules/{file-uploader/file-uploader.router.js → file-upload/file-upload.router.js} +7 -6
  19. package/dist/cjs/modules/file-upload/file-upload.router.js.map +1 -0
  20. package/dist/cjs/modules/{file-uploader/file-uploader.service.js → file-upload/file-upload.service.js} +74 -39
  21. package/dist/cjs/modules/file-upload/file-upload.service.js.map +1 -0
  22. package/dist/cjs/modules/{file-uploader/utils/helpers/file-uploader.helpers.js → file-upload/utils/helpers/file-upload.helpers.js} +1 -1
  23. package/dist/cjs/modules/file-upload/utils/helpers/file-upload.helpers.js.map +1 -0
  24. package/dist/cjs/types/arkos-config.js.map +1 -1
  25. package/dist/cjs/types/index.js.map +1 -1
  26. package/dist/cjs/utils/cli/build.js +8 -5
  27. package/dist/cjs/utils/cli/build.js.map +1 -1
  28. package/dist/cjs/utils/cli/generate.js +170 -0
  29. package/dist/cjs/utils/cli/generate.js.map +1 -0
  30. package/dist/cjs/utils/cli/index.js +39 -1
  31. package/dist/cjs/utils/cli/index.js.map +1 -1
  32. package/dist/cjs/utils/cli/start.js +4 -2
  33. package/dist/cjs/utils/cli/start.js.map +1 -1
  34. package/dist/cjs/utils/cli/utils/generators.js +200 -0
  35. package/dist/cjs/utils/cli/utils/generators.js.map +1 -0
  36. package/dist/cjs/utils/cli/utils/helpers.js +17 -0
  37. package/dist/cjs/utils/cli/utils/helpers.js.map +1 -0
  38. package/dist/cjs/utils/helpers/global.helpers.js +2 -0
  39. package/dist/cjs/utils/helpers/global.helpers.js.map +1 -1
  40. package/dist/cjs/utils/helpers/models.helpers.js +44 -6
  41. package/dist/cjs/utils/helpers/models.helpers.js.map +1 -1
  42. package/dist/es2020/app.js +1 -1
  43. package/dist/es2020/app.js.map +1 -1
  44. package/dist/es2020/exports/controllers/index.js +4 -0
  45. package/dist/es2020/exports/controllers/index.js.map +1 -0
  46. package/dist/es2020/exports/services/index.js +2 -2
  47. package/dist/es2020/exports/services/index.js.map +1 -1
  48. package/dist/es2020/modules/auth/auth.controller.js +6 -6
  49. package/dist/es2020/modules/auth/auth.controller.js.map +1 -1
  50. package/dist/es2020/modules/auth/auth.service.js +11 -1
  51. package/dist/es2020/modules/auth/auth.service.js.map +1 -1
  52. package/dist/es2020/modules/base/base.controller.js +3 -3
  53. package/dist/es2020/modules/base/base.controller.js.map +1 -1
  54. package/dist/es2020/modules/base/base.service.js +19 -10
  55. package/dist/es2020/modules/base/base.service.js.map +1 -1
  56. package/dist/es2020/modules/base/utils/helpers/base.service.helpers.js.map +1 -1
  57. package/dist/es2020/modules/file-upload/file-upload.controller.js +249 -0
  58. package/dist/es2020/modules/file-upload/file-upload.controller.js.map +1 -0
  59. package/dist/es2020/modules/{file-uploader/file-uploader.router.js → file-upload/file-upload.router.js} +6 -5
  60. package/dist/es2020/modules/file-upload/file-upload.router.js.map +1 -0
  61. package/dist/es2020/modules/{file-uploader/file-uploader.service.js → file-upload/file-upload.service.js} +67 -32
  62. package/dist/es2020/modules/file-upload/file-upload.service.js.map +1 -0
  63. package/dist/es2020/modules/{file-uploader/utils/helpers/file-uploader.helpers.js → file-upload/utils/helpers/file-upload.helpers.js} +1 -1
  64. package/dist/es2020/modules/file-upload/utils/helpers/file-upload.helpers.js.map +1 -0
  65. package/dist/es2020/types/arkos-config.js.map +1 -1
  66. package/dist/es2020/types/index.js.map +1 -1
  67. package/dist/es2020/utils/cli/build.js +8 -5
  68. package/dist/es2020/utils/cli/build.js.map +1 -1
  69. package/dist/es2020/utils/cli/generate.js +164 -0
  70. package/dist/es2020/utils/cli/generate.js.map +1 -0
  71. package/dist/es2020/utils/cli/index.js +38 -1
  72. package/dist/es2020/utils/cli/index.js.map +1 -1
  73. package/dist/es2020/utils/cli/start.js +4 -2
  74. package/dist/es2020/utils/cli/start.js.map +1 -1
  75. package/dist/es2020/utils/cli/utils/generators.js +197 -0
  76. package/dist/es2020/utils/cli/utils/generators.js.map +1 -0
  77. package/dist/es2020/utils/cli/utils/helpers.js +10 -0
  78. package/dist/es2020/utils/cli/utils/helpers.js.map +1 -0
  79. package/dist/es2020/utils/helpers/global.helpers.js +1 -0
  80. package/dist/es2020/utils/helpers/global.helpers.js.map +1 -1
  81. package/dist/es2020/utils/helpers/models.helpers.js +42 -6
  82. package/dist/es2020/utils/helpers/models.helpers.js.map +1 -1
  83. package/dist/types/exports/controllers/index.d.ts +3 -0
  84. package/dist/types/exports/services/index.d.ts +2 -2
  85. package/dist/types/modules/auth/auth.service.d.ts +1 -0
  86. package/dist/types/modules/base/base.service.d.ts +31 -12
  87. package/dist/types/modules/file-upload/file-upload.controller.d.ts +9 -0
  88. package/dist/types/modules/file-upload/file-upload.router.d.ts +3 -0
  89. package/dist/types/modules/{file-uploader/file-uploader.service.d.ts → file-upload/file-upload.service.d.ts} +8 -7
  90. package/dist/types/types/arkos-config.d.ts +2 -2
  91. package/dist/types/types/index.d.ts +1 -3
  92. package/dist/types/utils/cli/generate.d.ts +12 -0
  93. package/dist/types/utils/cli/index.d.ts +2 -1
  94. package/dist/types/utils/cli/utils/generators.d.ts +17 -0
  95. package/dist/types/utils/cli/utils/helpers.d.ts +2 -0
  96. package/dist/types/utils/helpers/global.helpers.d.ts +1 -0
  97. package/dist/types/utils/helpers/models.helpers.d.ts +6 -0
  98. package/package.json +6 -1
  99. package/dist/cjs/modules/file-uploader/file-uploader.controller.js +0 -149
  100. package/dist/cjs/modules/file-uploader/file-uploader.controller.js.map +0 -1
  101. package/dist/cjs/modules/file-uploader/file-uploader.router.js.map +0 -1
  102. package/dist/cjs/modules/file-uploader/file-uploader.service.js.map +0 -1
  103. package/dist/cjs/modules/file-uploader/utils/helpers/file-uploader.helpers.js.map +0 -1
  104. package/dist/es2020/modules/file-uploader/file-uploader.controller.js +0 -143
  105. package/dist/es2020/modules/file-uploader/file-uploader.controller.js.map +0 -1
  106. package/dist/es2020/modules/file-uploader/file-uploader.router.js.map +0 -1
  107. package/dist/es2020/modules/file-uploader/file-uploader.service.js.map +0 -1
  108. package/dist/es2020/modules/file-uploader/utils/helpers/file-uploader.helpers.js.map +0 -1
  109. package/dist/types/modules/file-uploader/file-uploader.controller.d.ts +0 -3
  110. package/dist/types/modules/file-uploader/file-uploader.router.d.ts +0 -3
  111. /package/dist/types/modules/{file-uploader/utils/helpers/file-uploader.helpers.d.ts → file-upload/utils/helpers/file-upload.helpers.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../../src/utils/cli/utils/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,IAAI,CAAC;AA2BpB,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACnD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC5B,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// src/utils/cli/utils.ts\nimport fs from \"fs\";\nimport path from \"path\";\n\n// export function toPascalCase(str: string): string {\n// return str\n// .replace(/[\\W_]/g, \" \")\n// .replace(/\\s+/g, \" \")\n// .trim()\n// .split(\" \")\n// .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n// .join(\"\");\n// }\n\n// export function toCamelCase(str: string): string {\n// const pascal = toPascalCase(str);\n// return pascal.charAt(0).toLowerCase() + pascal.slice(1);\n// }\n\n// export function toKebabCase(str: string): string {\n// return str\n// .replace(/([a-z])([A-Z])/g, \"$1-$2\")\n// .replace(/[\\W_]/g, \"-\")\n// .replace(/-+/g, \"-\")\n// .replace(/^-|-$/g, \"\")\n// .toLowerCase();\n// }\n\nexport function ensureDirectoryExists(dirPath: string): void {\n if (!fs.existsSync(dirPath)) {\n fs.mkdirSync(dirPath, { recursive: true });\n }\n}\n\nexport function fileExists(filePath: string): boolean {\n return fs.existsSync(filePath);\n}\n\n// export function getProjectType(): \"typescript\" | \"javascript\" {\n// const tsConfigExists = fileExists(path.join(process.cwd(), \"tsconfig.json\"));\n// const packageJson = path.join(process.cwd(), \"package.json\");\n\n// if (tsConfigExists) return \"typescript\";\n\n// if (fileExists(packageJson)) {\n// try {\n// const pkg = JSON.parse(fs.readFileSync(packageJson, \"utf8\"));\n// if (pkg.devDependencies?.typescript || pkg.dependencies?.typescript) {\n// return \"typescript\";\n// }\n// } catch {\n// // ignore\n// }\n// }\n\n// return \"javascript\";\n// }\n"]}
@@ -1,4 +1,5 @@
1
1
  export async function importModule(path) {
2
2
  return await import(path);
3
3
  }
4
+ export function cleanProcessCwd() { }
4
5
  //# 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,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
+ {"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;AAED,MAAM,UAAU,eAAe,KAAI,CAAC","sourcesContent":["export async function importModule(path: string) {\n return await import(path);\n}\n\nexport function cleanProcessCwd() {}\n"]}
@@ -17,7 +17,9 @@ export function getFileModelModulesFileStructure(modelName) {
17
17
  controller: `${kebabModelName}.controller.${ext}`,
18
18
  middlewares: `${kebabModelName}.middlewares.${ext}`,
19
19
  authConfigs: `${kebabModelName}.auth-configs.${ext}`,
20
+ authConfigsNew: `${kebabModelName}.auth.${ext}`,
20
21
  prismaQueryOptions: `${kebabModelName}.prisma-query-options.${ext}`,
22
+ prismaQueryOptionsNew: `${kebabModelName}.query.${ext}`,
21
23
  router: `${kebabModelName}.router.${ext}`,
22
24
  },
23
25
  dtos: isAuthModule
@@ -89,6 +91,42 @@ export async function processSubdir(modelName, type, result) {
89
91
  console.error(error);
90
92
  }
91
93
  }
94
+ export function validateNamingConventions(key, fileName, result) {
95
+ if (key === "prismaQueryOptions") {
96
+ if (result.prismaQueryOptions) {
97
+ throw new Error(`\n Cannot use both ${fileName} and ${fileName.replace("prisma-query-options", "query")} at once, please choose only one name convention. \n`);
98
+ }
99
+ }
100
+ else if (key === "prismaQueryOptionsNew") {
101
+ if (result.prismaQueryOptions) {
102
+ throw new Error(`\n Cannot use both ${fileName} and ${fileName.replace("query", "prisma-query-options")} at once, please choose only one name convention. \n`);
103
+ }
104
+ }
105
+ else if (key === "authConfigs") {
106
+ if (result.authConfigs) {
107
+ throw new Error(`\n Cannot use both ${fileName} and ${fileName.replace("auth-configs", "auth")} at once, please choose only one name convention. \n`);
108
+ }
109
+ }
110
+ else if (key === "authConfigsNew") {
111
+ if (result.authConfigs) {
112
+ throw new Error(`\n Cannot use both ${fileName} and ${fileName.replace("auth", "auth-configs")} at once, please choose only one name convention. \n`);
113
+ }
114
+ }
115
+ }
116
+ export function assignModuleToResult(key, module, result) {
117
+ if (key === "prismaQueryOptions" || key === "prismaQueryOptionsNew") {
118
+ result.prismaQueryOptions = module.default || module;
119
+ }
120
+ else if (key === "authConfigs" || key === "authConfigsNew") {
121
+ result.authConfigs = module.default || module;
122
+ }
123
+ else if (key === "middlewares" || key === "router") {
124
+ result[key] = module;
125
+ }
126
+ else {
127
+ result[key] = module.default || module;
128
+ }
129
+ }
92
130
  export async function importPrismaModelModules(modelName) {
93
131
  const moduleDir = path.resolve(crd(), "src", "modules", kebabCase(modelName));
94
132
  const result = {
@@ -101,15 +139,13 @@ export async function importPrismaModelModules(modelName) {
101
139
  try {
102
140
  const module = await importModule(filePath).catch(() => null);
103
141
  if (module) {
104
- if (key === "middlewares")
105
- result[key] = module;
106
- else if (key === "router")
107
- result[key] = module;
108
- else
109
- result[key] = module.default || module;
142
+ validateNamingConventions(key, fileName, result);
143
+ assignModuleToResult(key, module, result);
110
144
  }
111
145
  }
112
146
  catch (err) {
147
+ if (err.message.includes("Cannot use both"))
148
+ throw err;
113
149
  console.error(err);
114
150
  }
115
151
  }));
@@ -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,EACT,UAAU,GACX,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,GAAG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C,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 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: `${kebabModelName}.dto.${ext}`,\n create: `create-${kebabModelName}.dto.${ext}`,\n createMany: `create-many-${kebabModelName}.dto.${ext}`,\n update: `update-${kebabModelName}.dto.${ext}`,\n updateMany: `update-many-${kebabModelName}.dto.${ext}`,\n query: `query-${kebabModelName}.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: `${kebabModelName}.schema.${ext}`,\n create: `create-${kebabModelName}.schema.${ext}`,\n createMany: `create-many-${kebabModelName}.schema.${ext}`,\n update: `update-${kebabModelName}.schema.${ext}`,\n updateMany: `update-many-${kebabModelName}.schema.${ext}`,\n query: `query-${kebabModelName}.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(crd(), \"src\", \"modules\", kebabCase(modelName));\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 console.error(error);\n }\n })\n );\n } catch (error) {\n // Directory doesn't exist, continue silently\n console.error(error);\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\", kebabCase(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\n if (module) {\n if (key === \"middlewares\") result[key] = module;\n else if (key === \"router\") result[key] = module;\n else result[key as keyof typeof result] = module.default || module;\n }\n } catch (err) {\n console.error(err);\n }\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() {\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 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,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EACL,SAAS,EACT,S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AS;wBACf,IAAI,EAAE,SAAS;qBAChB,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;wBAClB,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,SAAS;qBAChB,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YAED,yBAAyB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;QACnD,CAAC;IACH,CAAC;AACH,CAAC;AAED,sBAAsB,EAAE,CAAC;AAQzB,MAAM,UAAU,uBAAuB,CAAC,SAAiB;IACvD,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IAElC,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 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 authConfigsNew: `${kebabModelName}.auth.${ext}`,\n prismaQueryOptions: `${kebabModelName}.prisma-query-options.${ext}`,\n prismaQueryOptionsNew: `${kebabModelName}.query.${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: `${kebabModelName}.dto.${ext}`,\n create: `create-${kebabModelName}.dto.${ext}`,\n createMany: `create-many-${kebabModelName}.dto.${ext}`,\n update: `update-${kebabModelName}.dto.${ext}`,\n updateMany: `update-many-${kebabModelName}.dto.${ext}`,\n query: `query-${kebabModelName}.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: `${kebabModelName}.schema.${ext}`,\n create: `create-${kebabModelName}.schema.${ext}`,\n createMany: `create-many-${kebabModelName}.schema.${ext}`,\n update: `update-${kebabModelName}.schema.${ext}`,\n updateMany: `update-many-${kebabModelName}.schema.${ext}`,\n query: `query-${kebabModelName}.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(crd(), \"src\", \"modules\", kebabCase(modelName));\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 console.error(error);\n }\n })\n );\n } catch (error) {\n // Directory doesn't exist, continue silently\n console.error(error);\n }\n}\n\ntype importPrismaModelModulesReturnType = {\n service?: any;\n controller?: any;\n middlewares?: any;\n authConfigs?: AuthConfigs;\n authConfigsNew?: AuthConfigs;\n prismaQueryOptions?: any;\n prismaQueryOptionsNew?: any;\n router?: any;\n dtos: Record<string, any>;\n schemas: Record<string, any>;\n};\n\n/**\n * Validates naming convention conflicts for prismaQueryOptions and authConfigs\n * @param {string} key - The current file key being processed\n * @param {string} fileName - The filename being imported\n * @param {importPrismaModelModulesReturnType} result - The current result object\n * @throws {Error} When conflicting naming conventions are detected\n */\nexport function validateNamingConventions(\n key: string,\n fileName: string,\n result: importPrismaModelModulesReturnType\n): void {\n if (key === \"prismaQueryOptions\") {\n if (result.prismaQueryOptions) {\n throw new Error(\n `\\n Cannot use both ${fileName} and ${fileName.replace(\n \"prisma-query-options\",\n \"query\"\n )} at once, please choose only one name convention. \\n`\n );\n }\n } else if (key === \"prismaQueryOptionsNew\") {\n if (result.prismaQueryOptions) {\n throw new Error(\n `\\n Cannot use both ${fileName} and ${fileName.replace(\n \"query\",\n \"prisma-query-options\"\n )} at once, please choose only one name convention. \\n`\n );\n }\n } else if (key === \"authConfigs\") {\n if (result.authConfigs) {\n throw new Error(\n `\\n Cannot use both ${fileName} and ${fileName.replace(\n \"auth-configs\",\n \"auth\"\n )} at once, please choose only one name convention. \\n`\n );\n }\n } else if (key === \"authConfigsNew\") {\n if (result.authConfigs) {\n throw new Error(\n `\\n Cannot use both ${fileName} and ${fileName.replace(\n \"auth\",\n \"auth-configs\"\n )} at once, please choose only one name convention. \\n`\n );\n }\n }\n}\n\n/**\n * Processes and assigns module to the result object based on the key\n * @param {string} key - The file key being processed\n * @param {any} module - The imported module\n * @param {importPrismaModelModulesReturnType} result - The result object to modify\n */\nexport function assignModuleToResult(\n key: string,\n module: any,\n result: importPrismaModelModulesReturnType\n): void {\n if (key === \"prismaQueryOptions\" || key === \"prismaQueryOptionsNew\") {\n result.prismaQueryOptions = module.default || module;\n } else if (key === \"authConfigs\" || key === \"authConfigsNew\") {\n result.authConfigs = module.default || module;\n } else if (key === \"middlewares\" || key === \"router\") {\n result[key] = module;\n } else {\n result[key as keyof typeof result] = module.default || module;\n }\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\", kebabCase(modelName));\n\n const result: importPrismaModelModulesReturnType = {\n dtos: {},\n schemas: {},\n };\n\n const fileStructure = getFileModelModulesFileStructure(modelName);\n\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\n if (module) {\n // Validate naming conventions before assignment\n validateNamingConventions(key, fileName, result);\n\n // Assign module to result\n assignModuleToResult(key, module, result);\n }\n } catch (err: any) {\n if (err.message.includes(\"Cannot use both\")) throw err;\n console.error(err);\n }\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\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// */\n// export async function importPrismaModelModules(\n// modelName: string\n// ): Promise<importPrismaModelModulesReturnType> {\n// const moduleDir = path.resolve(crd(), \"src\", \"modules\", kebabCase(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\n// if (module) {\n// // Handle prismaQueryOptions (old vs new naming)\n// if (key === \"prismaQueryOptions\") {\n// if (result.prismaQueryOptions) {\n// throw Error(\n// `\\n Cannot use both ${fileName} and ${fileName.replace(\n// \"prisma-query-options\",\n// \"query\"\n// )} at once, please choose only one name convention. \\n`\n// );\n// }\n// result.prismaQueryOptions = module.default || module;\n// } else if (key === \"prismaQueryOptionsNew\") {\n// if (result.prismaQueryOptions) {\n// throw Error(\n// `\\n Cannot use both ${fileName} and ${fileName.replace(\n// \"query\",\n// \"prisma-query-options\"\n// )} at once, please choose only one name convention. \\n`\n// );\n// }\n// // Store new naming convention under old key\n// result.prismaQueryOptions = module.default || module;\n// }\n// // Handle authConfigs (old vs new naming)\n// else if (key === \"authConfigs\") {\n// if (result.authConfigs) {\n// throw Error(\n// `\\n Cannot use both ${fileName} and ${fileName.replace(\n// \"auth-configs\",\n// \"auth\"\n// )} at once, please choose only one name convention. \\n`\n// );\n// }\n// result.authConfigs = module.default || module;\n// } else if (key === \"authConfigsNew\") {\n// if (result.authConfigs) {\n// throw Error(\n// `\\n Cannot use both ${fileName} and ${fileName.replace(\n// \"auth\",\n// \"auth-configs\"\n// )} at once, please choose only one name convention. \\n`\n// );\n// }\n// // Store new naming convention under old key\n// result.authConfigs = module.default || module;\n// }\n// // Handle other modules\n// else if (key === \"middlewares\" || key === \"router\") {\n// result[key] = module;\n// } else {\n// result[key as keyof typeof result] = module.default || module;\n// }\n// }\n// } catch (err: any) {\n// if (err.message.includes(\"Cannot use both\")) throw err;\n// console.error(err);\n// }\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() {\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 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"]}
@@ -0,0 +1,3 @@
1
+ import { BaseController } from "./../../modules/base/base.controller";
2
+ import fileUploadController from "../../modules/file-upload/file-upload.controller";
3
+ export { fileUploadController, BaseController };
@@ -1,4 +1,4 @@
1
- import { getFileUploaderServices, FileUploaderService } from "../../modules/file-uploader/file-uploader.service";
1
+ import { getFileUploadServices, FileUploadService } from "../../modules/file-upload/file-upload.service";
2
2
  import { EmailOptions } from "../../modules/email/email.service";
3
3
  import authService, { AuthService } from "../../modules/auth/auth.service";
4
4
  import emailService, { EmailService } from "../../modules/email/email.service";
@@ -6,4 +6,4 @@ import { BaseService, getBaseServices } from "../../modules/base/base.service";
6
6
  export { authService, AuthService };
7
7
  export { BaseService, getBaseServices };
8
8
  export { emailService, EmailService, EmailOptions };
9
- export { getFileUploaderServices, FileUploaderService };
9
+ export { getFileUploadServices, FileUploadService };
@@ -4,6 +4,7 @@ import { AuthJwtPayload, AccessAction, AccessControlConfig, AuthenticationContro
4
4
  import { MsDuration } from "./utils/helpers/auth.controller.helpers";
5
5
  export declare class AuthService {
6
6
  signJwtToken(id: number | string, expiresIn?: MsDuration | number, secret?: string): string;
7
+ isPasswordHashed(password: string): boolean;
7
8
  isCorrectPassword(candidatePassword: string, userPassword: string): Promise<boolean>;
8
9
  hashPassword(password: string): Promise<string>;
9
10
  isPasswordStrong(password: string): boolean;
@@ -4,43 +4,62 @@ export declare class BaseService<TModel extends Record<string, any> = any> {
4
4
  relationFields: RelationFields;
5
5
  prisma: any;
6
6
  constructor(modelName: string);
7
- createOne(data: Parameters<TModel["create"]>[0] extends {
7
+ createOne<TOptions extends Omit<Parameters<TModel["create"]>[0], "data">>(data: Parameters<TModel["create"]>[0] extends {
8
8
  data: infer D;
9
9
  [x: string]: any;
10
- } ? D : any, queryOptions?: Omit<Parameters<TModel["create"]>[0], "data">): Promise<ReturnType<TModel["create"]>>;
11
- createMany(data: Parameters<TModel["createMany"]>[0] extends {
10
+ } ? D : any, queryOptions?: TOptions): Promise<TModel["create"] extends (args: {
11
+ data: any;
12
+ } & TOptions) => infer R ? R : never>;
13
+ createMany<TOptions extends Omit<Parameters<TModel["createMany"]>[0], "data">>(data: Parameters<TModel["createMany"]>[0] extends {
12
14
  data: infer D;
13
15
  [x: string]: any;
14
- } ? D : any, queryOptions?: Omit<Parameters<TModel["createMany"]>[0], "data">): Promise<ReturnType<TModel["createMany"]>>;
16
+ } ? D : any, queryOptions?: TOptions): Promise<TModel["createMany"] extends (args: {
17
+ data: any;
18
+ } & TOptions) => infer R ? R : never>;
15
19
  count(filters: Parameters<TModel["count"]>[0] extends {
16
20
  where: infer W;
17
21
  [x: string]: any;
18
22
  } ? W : any): Promise<number>;
19
- findMany(filters: Parameters<TModel["findMany"]>[0] extends {
23
+ findMany<TOptions extends Omit<Parameters<TModel["findMany"]>[0], "where">>(filters: Parameters<TModel["findMany"]>[0] extends {
20
24
  where: infer W;
21
25
  [x: string]: any;
22
- } ? W : any, queryOptions?: Omit<Parameters<TModel["findMany"]>[0], "where">): Promise<ReturnType<TModel["findMany"]>>;
23
- findOne(filters: Parameters<TModel["findFirst"]>[0] extends {
26
+ } ? W : any, queryOptions?: TOptions): Promise<TModel["findMany"] extends (args: {
27
+ where: any;
28
+ } & TOptions) => infer R ? R : never>;
29
+ findById<TOptions extends Omit<Parameters<TModel["findUnique"]>[0], "where">>(id: string | number, queryOptions?: TOptions): Promise<TModel["findUnique"] extends (args: {
30
+ where: any;
31
+ } & TOptions) => infer R ? R : never>;
32
+ findOne<TOptions extends Omit<Parameters<TModel["findFirst"]>[0], "where"> | Omit<Parameters<TModel["findUnique"]>[0], "where">>(filters: Parameters<TModel["findFirst"]>[0] extends {
24
33
  where: infer W;
25
34
  [x: string]: any;
26
35
  } ? W : any | Parameters<TModel["findUnique"]>[0] extends {
27
36
  where: infer W;
28
37
  [x: string]: any;
29
- } ? W : any, queryOptions?: Omit<Parameters<TModel["findFirst"]>[0], "where"> | Omit<Parameters<TModel["findUnique"]>[0], "where">): Promise<ReturnType<TModel["findFirst"]> | ReturnType<TModel["findUnique"]>>;
30
- updateOne(filters: Parameters<TModel["update"]>[0] extends {
38
+ } ? W : any, queryOptions?: TOptions): Promise<TModel["findFirst"] extends (args: {
39
+ where: any;
40
+ } & TOptions) => infer R ? R : TModel["findUnique"] extends (args: {
41
+ where: any;
42
+ } & TOptions) => infer R2 ? R2 : never>;
43
+ updateOne<TOptions extends Omit<Parameters<TModel["update"]>[0], "where" | "data">>(filters: Parameters<TModel["update"]>[0] extends {
31
44
  where: infer W;
32
45
  [x: string]: any;
33
46
  } ? W : any, data: Parameters<TModel["update"]>[0] extends {
34
47
  data: infer D;
35
48
  [x: string]: any;
36
- } ? D : any, queryOptions?: Omit<Parameters<TModel["update"]>[0], "where" | "data">): Promise<ReturnType<TModel["update"]>>;
37
- updateMany(filters: Parameters<TModel["updateMany"]>[0] extends {
49
+ } ? D : any, queryOptions?: TOptions): Promise<TModel["update"] extends (args: {
50
+ where: any;
51
+ data: any;
52
+ } & TOptions) => infer R ? R : never>;
53
+ updateMany<TOptions extends Omit<Parameters<TModel["updateMany"]>[0], "where" | "data">>(filters: Parameters<TModel["updateMany"]>[0] extends {
38
54
  where: infer W;
39
55
  [x: string]: any;
40
56
  } ? W : any, data: Parameters<TModel["updateMany"]>[0] extends {
41
57
  data: infer D;
42
58
  [x: string]: any;
43
- } ? D : any, queryOptions?: Omit<Parameters<TModel["updateMany"]>[0], "where" | "data">): Promise<ReturnType<TModel["updateMany"]>>;
59
+ } ? D : any, queryOptions?: TOptions): Promise<TModel["updateMany"] extends (args: {
60
+ where: any;
61
+ data: any;
62
+ } & TOptions) => infer R ? R : never>;
44
63
  deleteOne(filters: Parameters<TModel["delete"]>[0] extends {
45
64
  where: infer W;
46
65
  [x: string]: any;
@@ -0,0 +1,9 @@
1
+ import { ArkosNextFunction, ArkosRequest, ArkosResponse } from "../../types";
2
+ declare class FileUploadController {
3
+ uploadFile: (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => Promise<void>;
4
+ deleteFile: (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => Promise<void>;
5
+ updateFile: (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => Promise<void>;
6
+ streamFile: (req: ArkosRequest, res: ArkosResponse, next: ArkosNextFunction) => Promise<void>;
7
+ }
8
+ declare const fileUploadController: FileUploadController;
9
+ export default fileUploadController;
@@ -0,0 +1,3 @@
1
+ import { Router } from "express";
2
+ import { ArkosConfig } from "../../types/arkos-config";
3
+ export declare function getFileUploadRouter({ fileUpload }: ArkosConfig): Promise<Router>;
@@ -1,7 +1,7 @@
1
1
  import multer from "multer";
2
2
  import { NextFunction } from "express";
3
3
  import { ArkosRequest, ArkosResponse } from "../../types";
4
- export declare class FileUploaderService {
4
+ export declare class FileUploadService {
5
5
  readonly uploadDir: string;
6
6
  private fileSizeLimit;
7
7
  private allowedFileTypes;
@@ -9,7 +9,7 @@ export declare class FileUploaderService {
9
9
  private maxCount;
10
10
  constructor(uploadDir: string, fileSizeLimit?: number, allowedFileTypes?: RegExp, maxCount?: number);
11
11
  private fileFilter;
12
- getUploader(): multer.Multer;
12
+ getUpload(): multer.Multer;
13
13
  handleSingleUpload(oldFilePath?: string): (req: ArkosRequest, res: ArkosResponse, next: NextFunction) => void;
14
14
  handleMultipleUpload(): (req: ArkosRequest, res: ArkosResponse, next: NextFunction) => void;
15
15
  handleDeleteSingleFile(oldFilePath: string): (req: ArkosRequest, res: ArkosResponse, next: NextFunction) => Promise<void>;
@@ -21,10 +21,11 @@ export declare class FileUploaderService {
21
21
  height?: number;
22
22
  resizeTo?: number;
23
23
  }): Promise<string | string[] | null>;
24
+ deleteFileByName(fileName: string, fileType: "images" | "videos" | "documents" | "files"): Promise<boolean>;
24
25
  }
25
- export declare const getFileUploaderServices: () => {
26
- imageUploaderService: FileUploaderService;
27
- videoUploaderService: FileUploaderService;
28
- documentUploaderService: FileUploaderService;
29
- fileUploaderService: FileUploaderService;
26
+ export declare const getFileUploadServices: () => {
27
+ imageUploadService: FileUploadService;
28
+ videoUploadService: FileUploadService;
29
+ documentUploadService: FileUploadService;
30
+ fileUploadService: FileUploadService;
30
31
  };
@@ -99,11 +99,11 @@ export type ArkosConfig = {
99
99
  };
100
100
  routers?: {
101
101
  additional?: express.Router[];
102
- disable?: ("auth-router" | "prisma-models-router" | "file-uploader" | "welcome-endpoint")[];
102
+ disable?: ("auth-router" | "prisma-models-router" | "file-upload" | "welcome-endpoint")[];
103
103
  replace?: {
104
104
  authRouter?: (config: ArkosConfig) => express.Router | Promise<express.Router>;
105
105
  prismaModelsRouter?: (config: ArkosConfig) => express.Router | Promise<express.Router>;
106
- fileUploader?: (config: ArkosConfig) => express.Router | Promise<express.Router>;
106
+ fileUpload?: (config: ArkosConfig) => express.Router | Promise<express.Router>;
107
107
  welcomeEndpoint?: express.RequestHandler;
108
108
  };
109
109
  };
@@ -19,8 +19,7 @@ export type AuthPrismaQueryOptions<T extends Record<string, any>> = {
19
19
  signup?: Partial<Parameters<T["create"]>[0]>;
20
20
  updatePassword?: Partial<Parameters<T["update"]>[0]>;
21
21
  };
22
- export type PrismaModelDelegate = a;
23
- type a = {
22
+ export type PrismaModelDelegate = {
24
23
  create: (args: {
25
24
  data: never;
26
25
  [key: string]: never;
@@ -122,4 +121,3 @@ export interface ArkosNextFunction extends NextFunction {
122
121
  }
123
122
  export interface ArkosRequestHandler extends RequestHandler {
124
123
  }
125
- export {};
@@ -0,0 +1,12 @@
1
+ interface GenerateOptions {
2
+ path?: string;
3
+ }
4
+ export declare const generateCommand: {
5
+ controller: (modelName: string, options: GenerateOptions) => Promise<void>;
6
+ service: (modelName: string, options: GenerateOptions) => Promise<void>;
7
+ router: (modelName: string, options: GenerateOptions) => Promise<void>;
8
+ middleware: (middlewareName: string, options: GenerateOptions) => Promise<void>;
9
+ authConfig: (modelName: string, options: GenerateOptions) => Promise<void>;
10
+ queryOptions: (modelName: string, options: GenerateOptions) => Promise<void>;
11
+ };
12
+ export {};
@@ -2,6 +2,7 @@ import { Command } from "commander";
2
2
  import { buildCommand } from "./build";
3
3
  import { devCommand } from "./dev";
4
4
  import { startCommand } from "./start";
5
+ import { generateCommand } from "./generate";
5
6
  export declare function getVersion(): any;
6
7
  declare const program: Command;
7
- export { program, buildCommand, devCommand, startCommand };
8
+ export { program, buildCommand, devCommand, startCommand, generateCommand };
@@ -0,0 +1,17 @@
1
+ interface ModelName {
2
+ pascal: string;
3
+ camel: string;
4
+ kebab: string;
5
+ }
6
+ interface MiddlewareName {
7
+ pascal: string;
8
+ camel: string;
9
+ kebab: string;
10
+ }
11
+ interface TemplateOptions {
12
+ modelName?: ModelName;
13
+ middlewareName?: MiddlewareName;
14
+ imports?: Record<string, string>;
15
+ }
16
+ export declare function generateTemplate(type: string, options?: TemplateOptions): string;
17
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function ensureDirectoryExists(dirPath: string): void;
2
+ export declare function fileExists(filePath: string): boolean;
@@ -1 +1,2 @@
1
1
  export declare function importModule(path: string): Promise<any>;
2
+ export declare function cleanProcessCwd(): void;
@@ -7,7 +7,9 @@ export declare function getFileModelModulesFileStructure(modelName: string): {
7
7
  controller: string;
8
8
  middlewares: string;
9
9
  authConfigs: string;
10
+ authConfigsNew: string;
10
11
  prismaQueryOptions: string;
12
+ prismaQueryOptionsNew: string;
11
13
  router: string;
12
14
  };
13
15
  dtos: {
@@ -63,11 +65,15 @@ type importPrismaModelModulesReturnType = {
63
65
  controller?: any;
64
66
  middlewares?: any;
65
67
  authConfigs?: AuthConfigs;
68
+ authConfigsNew?: AuthConfigs;
66
69
  prismaQueryOptions?: any;
70
+ prismaQueryOptionsNew?: any;
67
71
  router?: any;
68
72
  dtos: Record<string, any>;
69
73
  schemas: Record<string, any>;
70
74
  };
75
+ export declare function validateNamingConventions(key: string, fileName: string, result: importPrismaModelModulesReturnType): void;
76
+ export declare function assignModuleToResult(key: string, module: any, result: importPrismaModelModulesReturnType): void;
71
77
  export declare function importPrismaModelModules(modelName: string): Promise<importPrismaModelModulesReturnType>;
72
78
  export type ModelFieldDefition = {
73
79
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkos",
3
- "version": "1.1.67-beta",
3
+ "version": "1.1.69-test",
4
4
  "description": "The Express & Prisma Framework For RESTful API",
5
5
  "main": "dist/cjs/exports/index.js",
6
6
  "module": "dist/es2020/exports/index.js",
@@ -26,6 +26,11 @@
26
26
  "import": "./dist/es2020/exports/services/index.js",
27
27
  "require": "./dist/cjs/exports/services/index.js"
28
28
  },
29
+ "./controllers": {
30
+ "types": "./dist/types/exports/controllers/index.d.ts",
31
+ "import": "./dist/es2020/exports/controllers/index.js",
32
+ "require": "./dist/cjs/exports/controllers/index.js"
33
+ },
29
34
  "./middlewares": {
30
35
  "types": "./dist/types/exports/middlewares/index.d.ts",
31
36
  "import": "./dist/es2020/exports/middlewares/index.js",