arkos 1.4.0-canary.92 → 1.4.1-canary.2

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 (151) hide show
  1. package/dist/cjs/app.js +1 -1
  2. package/dist/cjs/app.js.map +1 -1
  3. package/dist/cjs/exports/index.js.map +1 -1
  4. package/dist/cjs/modules/auth/auth.controller.js +1 -1
  5. package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
  6. package/dist/cjs/modules/auth/auth.service.js +2 -3
  7. package/dist/cjs/modules/auth/auth.service.js.map +1 -1
  8. package/dist/cjs/modules/auth/utils/services/auth-action.service.js +50 -8
  9. package/dist/cjs/modules/auth/utils/services/auth-action.service.js.map +1 -1
  10. package/dist/cjs/modules/base/base.controller.js +6 -3
  11. package/dist/cjs/modules/base/base.controller.js.map +1 -1
  12. package/dist/cjs/modules/base/base.middlewares.js +8 -4
  13. package/dist/cjs/modules/base/base.middlewares.js.map +1 -1
  14. package/dist/cjs/modules/error-handler/error-handler.controller.js +2 -2
  15. package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
  16. package/dist/cjs/modules/error-handler/utils/catch-async.js.map +1 -1
  17. package/dist/cjs/modules/swagger/swagger.router.js +6 -4
  18. package/dist/cjs/modules/swagger/swagger.router.js.map +1 -1
  19. package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js +7 -0
  20. package/dist/cjs/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
  21. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +308 -183
  22. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
  23. package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +357 -288
  24. package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
  25. package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -5
  26. package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
  27. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
  28. package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
  29. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
  30. package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
  31. package/dist/cjs/server.js +17 -15
  32. package/dist/cjs/server.js.map +1 -1
  33. package/dist/cjs/types/index.js.map +1 -1
  34. package/dist/cjs/types/new-arkos-config.js.map +1 -1
  35. package/dist/cjs/utils/arkos-router/index.js +32 -5
  36. package/dist/cjs/utils/arkos-router/index.js.map +1 -1
  37. package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
  38. package/dist/cjs/utils/arkos-router/utils/helpers/index.js +11 -0
  39. package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
  40. package/dist/cjs/utils/cli/dev.js +12 -53
  41. package/dist/cjs/utils/cli/dev.js.map +1 -1
  42. package/dist/cjs/utils/cli/export-auth-action.js +1 -1
  43. package/dist/cjs/utils/cli/export-auth-action.js.map +1 -1
  44. package/dist/cjs/utils/cli/generate.js +3 -3
  45. package/dist/cjs/utils/cli/generate.js.map +1 -1
  46. package/dist/cjs/utils/cli/index.js +1 -1
  47. package/dist/cjs/utils/cli/index.js.map +1 -1
  48. package/dist/cjs/utils/cli/start.js +14 -10
  49. package/dist/cjs/utils/cli/start.js.map +1 -1
  50. package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
  51. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js +51 -6
  52. package/dist/cjs/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  53. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
  54. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
  55. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
  56. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
  57. package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
  58. package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
  59. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +3 -1
  60. package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  61. package/dist/cjs/utils/dotenv.helpers.js +10 -6
  62. package/dist/cjs/utils/dotenv.helpers.js.map +1 -1
  63. package/dist/cjs/utils/helpers/api.features.helpers.js +174 -81
  64. package/dist/cjs/utils/helpers/api.features.helpers.js.map +1 -1
  65. package/dist/cjs/utils/helpers/prisma.helpers.js +40 -1
  66. package/dist/cjs/utils/helpers/prisma.helpers.js.map +1 -1
  67. package/dist/cjs/utils/helpers/routers.helpers.js +0 -1
  68. package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
  69. package/dist/esm/app.js +1 -1
  70. package/dist/esm/app.js.map +1 -1
  71. package/dist/esm/exports/index.js.map +1 -1
  72. package/dist/esm/modules/auth/auth.controller.js +1 -1
  73. package/dist/esm/modules/auth/auth.controller.js.map +1 -1
  74. package/dist/esm/modules/auth/auth.service.js +3 -4
  75. package/dist/esm/modules/auth/auth.service.js.map +1 -1
  76. package/dist/esm/modules/auth/utils/services/auth-action.service.js +50 -5
  77. package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
  78. package/dist/esm/modules/base/base.controller.js +6 -3
  79. package/dist/esm/modules/base/base.controller.js.map +1 -1
  80. package/dist/esm/modules/base/base.middlewares.js +8 -4
  81. package/dist/esm/modules/base/base.middlewares.js.map +1 -1
  82. package/dist/esm/modules/error-handler/error-handler.controller.js +2 -2
  83. package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
  84. package/dist/esm/modules/error-handler/utils/catch-async.js.map +1 -1
  85. package/dist/esm/modules/swagger/swagger.router.js +6 -4
  86. package/dist/esm/modules/swagger/swagger.router.js.map +1 -1
  87. package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js +5 -0
  88. package/dist/esm/modules/swagger/utils/built-in-route-path-object-manager.js.map +1 -0
  89. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +308 -183
  90. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
  91. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +357 -288
  92. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
  93. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +1 -2
  94. package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js.map +1 -1
  95. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +280 -243
  96. package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js.map +1 -1
  97. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +8 -6
  98. package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js.map +1 -1
  99. package/dist/esm/server.js +17 -15
  100. package/dist/esm/server.js.map +1 -1
  101. package/dist/esm/types/index.js.map +1 -1
  102. package/dist/esm/types/new-arkos-config.js.map +1 -1
  103. package/dist/esm/utils/arkos-router/index.js +33 -6
  104. package/dist/esm/utils/arkos-router/index.js.map +1 -1
  105. package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
  106. package/dist/esm/utils/arkos-router/utils/helpers/index.js +10 -0
  107. package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
  108. package/dist/esm/utils/cli/dev.js +13 -54
  109. package/dist/esm/utils/cli/dev.js.map +1 -1
  110. package/dist/esm/utils/cli/export-auth-action.js +1 -1
  111. package/dist/esm/utils/cli/export-auth-action.js.map +1 -1
  112. package/dist/esm/utils/cli/generate.js +3 -3
  113. package/dist/esm/utils/cli/generate.js.map +1 -1
  114. package/dist/esm/utils/cli/index.js +1 -1
  115. package/dist/esm/utils/cli/index.js.map +1 -1
  116. package/dist/esm/utils/cli/start.js +14 -10
  117. package/dist/esm/utils/cli/start.js.map +1 -1
  118. package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
  119. package/dist/esm/utils/cli/utils/runtime-cli-commander.js +52 -7
  120. package/dist/esm/utils/cli/utils/runtime-cli-commander.js.map +1 -1
  121. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +3 -3
  122. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +1 -1
  123. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +3 -3
  124. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +1 -1
  125. package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js +6 -3
  126. package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js.map +1 -1
  127. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js +3 -1
  128. package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js.map +1 -1
  129. package/dist/esm/utils/dotenv.helpers.js +10 -6
  130. package/dist/esm/utils/dotenv.helpers.js.map +1 -1
  131. package/dist/esm/utils/helpers/api.features.helpers.js +174 -81
  132. package/dist/esm/utils/helpers/api.features.helpers.js.map +1 -1
  133. package/dist/esm/utils/helpers/prisma.helpers.js +39 -1
  134. package/dist/esm/utils/helpers/prisma.helpers.js.map +1 -1
  135. package/dist/esm/utils/helpers/routers.helpers.js +0 -1
  136. package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
  137. package/dist/types/exports/index.d.ts +2 -1
  138. package/dist/types/modules/auth/auth.router.d.ts +1 -1
  139. package/dist/types/modules/auth/auth.service.d.ts +2 -2
  140. package/dist/types/modules/base/base.router.d.ts +1 -1
  141. package/dist/types/modules/swagger/utils/built-in-route-path-object-manager.d.ts +4 -0
  142. package/dist/types/modules/swagger/utils/helpers/get-authentication-json-schema-paths.d.ts +1 -1
  143. package/dist/types/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.d.ts +1 -1
  144. package/dist/types/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.d.ts +1 -1
  145. package/dist/types/modules/swagger/utils/helpers/swagger.router.helpers.d.ts +1 -1
  146. package/dist/types/types/index.d.ts +5 -5
  147. package/dist/types/types/new-arkos-config.d.ts +1 -1
  148. package/dist/types/utils/arkos-router/types/index.d.ts +15 -14
  149. package/dist/types/utils/arkos-router/utils/helpers/index.d.ts +1 -0
  150. package/dist/types/utils/helpers/prisma.helpers.d.ts +1 -0
  151. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"generate-prisma-model-main-routes-paths.js","sourceRoot":"","sources":["../../../../../../../../src/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,MAAM,UAAU,kCAAkC,CAChD,KAAa,EACb,QAA+B,EAAE,EACjC,WAAwB;IAExB,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,iBAAiB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;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,\n kebabToHuman,\n localValidatorFileExists,\n} from \"../../swagger.router.helpers\";\nimport pluralize from \"pluralize\";\nimport { isEndpointDisabled } from \"../../../../../base/utils/helpers/base.router.helpers\";\nimport { ArkosConfig, RouterConfig } from \"../../../../../../exports\";\nimport { kebabCase, pascalCase } from \"../../../../../../exports/utils\";\nimport { getModuleComponents } from \"../../../../../../utils/dynamic-loader\";\n\nexport function generatePrismaModelMainRoutesPaths(\n model: string,\n paths: OpenAPIV3.PathsObject = {},\n arkosConfig: ArkosConfig\n) {\n const modelName = kebabCase(model);\n const routeName = pluralize.plural(modelName);\n const pascalModelName = pascalCase(model);\n const humanReadableName = kebabToHuman(modelName);\n const humanReadableNamePlural = pluralize.plural(humanReadableName);\n\n const moduleComponents = getModuleComponents(model);\n const routerConfig = moduleComponents?.router\n ?.config as RouterConfig<\"prisma\">;\n\n if (routerConfig?.disable === true) return paths;\n\n const getSchemaMode = (\n action: string\n ): \"prisma\" | \"zod\" | \"class-validator\" => {\n const swaggerMode = arkosConfig.swagger?.mode;\n const isStrict = arkosConfig.swagger?.strict;\n\n if (isStrict) return swaggerMode || \"prisma\";\n\n const actionKey = action as any;\n\n const localFileExists = localValidatorFileExists(\n actionKey,\n model,\n arkosConfig\n );\n\n if (!localFileExists) return \"prisma\";\n\n return swaggerMode || \"prisma\";\n };\n\n // Create One\n if (!isEndpointDisabled(routerConfig, \"createOne\")) {\n if (!paths[`/api/${routeName}`]) paths[`/api/${routeName}`] = {};\n const createMode = getSchemaMode(\"create\");\n paths[`/api/${routeName}`]!.post = {\n tags: [humanReadableNamePlural],\n summary: `Create a new ${humanReadableName}`,\n description: `Creates a new ${humanReadableName} record in the system`,\n operationId: `create${pascalModelName}`,\n requestBody: {\n description: `${humanReadableName} data to create`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Create${pascalModelName}`, createMode),\n },\n },\n },\n },\n responses: {\n \"201\": {\n description: `${humanReadableName} created successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`${pascalModelName}`, createMode),\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data provided\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Find Many\n if (!isEndpointDisabled(routerConfig, \"findMany\")) {\n if (!paths[`/api/${routeName}`]) paths[`/api/${routeName}`] = {};\n const findManyMode = getSchemaMode(\"findMany\");\n paths[`/api/${routeName}`]!.get = {\n tags: [humanReadableNamePlural],\n summary: `Get ${humanReadableNamePlural}`,\n description: `Retrieves a paginated list of ${humanReadableNamePlural} with optional filtering and sorting`,\n operationId: `find${pluralize.plural(pascalModelName)}`,\n parameters: [\n {\n name: \"filters\",\n in: \"query\",\n description: \"Filter criteria in JSON format\",\n schema: {\n type: \"string\",\n },\n },\n {\n name: \"sort\",\n in: \"query\",\n description: \"Sort field (prefix with '-' for descending order)\",\n schema: {\n type: \"string\",\n },\n },\n {\n name: \"page\",\n in: \"query\",\n description: \"Page number (starts from 1)\",\n schema: {\n type: \"integer\",\n minimum: 1,\n },\n },\n {\n name: \"limit\",\n in: \"query\",\n description: \"Number of items per page\",\n schema: {\n type: \"integer\",\n minimum: 1,\n maximum: 100,\n },\n },\n {\n name: \"fields\",\n in: \"query\",\n description: \"Comma-separated list of fields to include in response\",\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"200\": {\n description: `List of ${humanReadableNamePlural} retrieved successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"integer\",\n description:\n \"Total number of records matching the criteria\",\n },\n results: {\n type: \"integer\",\n description: \"Number of records returned in current page\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: getSchemaRef(\n `FindMany${pascalModelName}`,\n findManyMode\n ),\n },\n },\n },\n },\n },\n },\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Create Many\n if (!isEndpointDisabled(routerConfig, \"createMany\")) {\n const createManyMode = getSchemaMode(\"createMany\");\n paths[`/api/${routeName}/many`] = {\n post: {\n tags: [humanReadableNamePlural],\n summary: `Create multiple ${humanReadableNamePlural}`,\n description: `Creates multiple ${humanReadableNamePlural} records in a single batch operation`,\n operationId: `createMany${pascalModelName}`,\n requestBody: {\n description: `Array of ${humanReadableName} data to create`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n type: \"array\",\n items: {\n $ref: getSchemaRef(\n `CreateMany${pascalModelName}`,\n createManyMode\n ),\n },\n },\n },\n },\n },\n responses: {\n \"201\": {\n description: `${humanReadableNamePlural} created successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records created\",\n },\n },\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data provided\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n },\n };\n }\n\n // Update Many\n if (!isEndpointDisabled(routerConfig, \"updateMany\")) {\n if (!paths[`/api/${routeName}/many`]) paths[`/api/${routeName}/many`] = {};\n const updateManyMode = getSchemaMode(\"updateMany\");\n paths[`/api/${routeName}/many`]!.patch = {\n tags: [humanReadableNamePlural],\n summary: `Update multiple ${humanReadableNamePlural}`,\n description: `Updates multiple ${humanReadableNamePlural} records that match the specified filter criteria`,\n operationId: `updateMany${pascalModelName}`,\n parameters: [\n {\n name: \"filters\",\n in: \"query\",\n description: \"Filter criteria in JSON format (required)\",\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n requestBody: {\n description: `Partial ${humanReadableName} data to update`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\n `UpdateMany${pascalModelName}`,\n updateManyMode\n ),\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: `${humanReadableNamePlural} updated successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records updated\",\n },\n },\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data or missing filter criteria\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Delete Many\n if (!isEndpointDisabled(routerConfig, \"deleteMany\")) {\n if (!paths[`/api/${routeName}/many`]) paths[`/api/${routeName}/many`] = {};\n paths[`/api/${routeName}/many`]!.delete = {\n tags: [humanReadableNamePlural],\n summary: `Delete multiple ${humanReadableNamePlural}`,\n description: `Deletes multiple ${humanReadableNamePlural} records that match the specified filter criteria`,\n operationId: `deleteMany${pascalModelName}`,\n parameters: [\n {\n name: \"filters\",\n in: \"query\",\n description: \"Filter criteria in JSON format (required)\",\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"200\": {\n description: `${humanReadableNamePlural} deleted successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records deleted\",\n },\n },\n },\n },\n },\n },\n \"400\": {\n description: \"Missing filter criteria\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Find One\n if (!isEndpointDisabled(routerConfig, \"findOne\")) {\n const findOneMode = getSchemaMode(\"findOne\");\n paths[`/api/${routeName}/{id}`] = {\n get: {\n tags: [humanReadableNamePlural],\n summary: `Get ${humanReadableName} by ID`,\n description: `Retrieves a single ${humanReadableName} record by its unique identifier`,\n operationId: `find${pascalModelName}ById`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"200\": {\n description: `${humanReadableName} retrieved successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`FindOne${pascalModelName}`, findOneMode),\n },\n },\n },\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n },\n };\n }\n\n // Update One\n if (!isEndpointDisabled(routerConfig, \"updateOne\")) {\n if (!paths[`/api/${routeName}/{id}`]) paths[`/api/${routeName}/{id}`] = {};\n const updateMode = getSchemaMode(\"update\");\n paths[`/api/${routeName}/{id}`]!.patch = {\n tags: [humanReadableNamePlural],\n summary: `Update ${humanReadableName} by ID`,\n description: `Updates a single ${humanReadableName} record by its unique identifier`,\n operationId: `update${pascalModelName}`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n requestBody: {\n description: `Partial ${humanReadableName} data to update`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Update${pascalModelName}`, updateMode),\n },\n },\n },\n },\n responses: {\n \"200\": {\n description: `${humanReadableName} updated successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`${pascalModelName}`, updateMode),\n },\n },\n },\n },\n \"400\": {\n description: \"Invalid input data provided\",\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n\n // Delete One\n if (!isEndpointDisabled(routerConfig, \"deleteOne\")) {\n if (!paths[`/api/${routeName}/{id}`]) paths[`/api/${routeName}/{id}`] = {};\n paths[`/api/${routeName}/{id}`]!.delete = {\n tags: [humanReadableNamePlural],\n summary: `Delete ${humanReadableName} by ID`,\n description: `Permanently deletes a single ${humanReadableName} record by its unique identifier`,\n operationId: `delete${pascalModelName}`,\n parameters: [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: {\n type: \"string\",\n },\n },\n ],\n responses: {\n \"204\": {\n description: `${humanReadableName} deleted successfully`,\n },\n \"401\": {\n description: \"Authentication required\",\n },\n \"403\": {\n description: \"Insufficient permissions\",\n },\n \"404\": {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n }\n}\n"]}
1
+ {"version":3,"file":"generate-prisma-model-main-routes-paths.js","sourceRoot":"","sources":["../../../../../../../../src/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,wBAAwB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAE3F,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAsD,CAAC;AAE/F,SAAS,qBAAqB;IAC5B,IAAI,CAAC,uBAAuB,EAAE;QAAE,OAAO,EAAE,CAAC;IAE1C,OAAO;QACL,KAAK,EAAE,EAAE,WAAW,EAAE,yBAAyB,EAAE;QACjD,KAAK,EAAE,EAAE,WAAW,EAAE,0BAA0B,EAAE;KACnD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kCAAkC,CAChD,KAAa,EACb,QAA+B,EAAE,EACjC,WAAwB;IAExB,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,eAAe,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,iBAAiB,GAAG,YAAY,CA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n localValidatorFileExists,\n} from \"../../swagger.router.helpers\";\nimport pluralize from \"pluralize\";\nimport { isEndpointDisabled } from \"../../../../../base/utils/helpers/base.router.helpers\";\nimport { ArkosConfig, RouterConfig } from \"../../../../../../exports\";\nimport { kebabCase, pascalCase } from \"../../../../../../exports/utils\";\nimport { getModuleComponents } from \"../../../../../../utils/dynamic-loader\";\nimport { isAuthenticationEnabled } from \"../../../../../../utils/helpers/arkos-config.helpers\";\n\nfunction getAuthErrorResponses(): Record<string, any> {\n if (!isAuthenticationEnabled()) return {};\n\n return {\n \"401\": { description: \"Authentication required\" },\n \"403\": { description: \"Insufficient permissions\" },\n };\n}\n\nexport function generatePrismaModelMainRoutesPaths(\n model: string,\n paths: OpenAPIV3.PathsObject = {},\n arkosConfig: ArkosConfig\n) {\n const modelName = kebabCase(model);\n const routeName = pluralize.plural(modelName);\n const pascalModelName = pascalCase(model);\n const humanReadableName = kebabToHuman(modelName);\n const humanReadableNamePlural = pluralize.plural(humanReadableName);\n\n const moduleComponents = getModuleComponents(model);\n const routerConfig = moduleComponents?.router\n ?.config as RouterConfig<\"prisma\">;\n\n if (routerConfig?.disable === true) return paths;\n\n const getSchemaMode = (\n action: string\n ): \"prisma\" | \"zod\" | \"class-validator\" => {\n const swaggerMode = arkosConfig.swagger?.mode;\n const isStrict = arkosConfig.swagger?.strict;\n\n if (isStrict) return swaggerMode || \"prisma\";\n\n const actionKey = action as any;\n\n const localFileExists = localValidatorFileExists(\n actionKey,\n model,\n arkosConfig\n );\n\n if (!localFileExists) return \"prisma\";\n\n return swaggerMode || \"prisma\";\n };\n\n // Create One\n if (!isEndpointDisabled(routerConfig, \"createOne\")) {\n const pathname = `/api/${routeName}`;\n if (!paths[pathname]) paths[pathname] = {};\n const createMode = getSchemaMode(\"create\");\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Create a new ${humanReadableName}`\n : currentPath?.summary,\n description: `Creates a new ${humanReadableName} record in the system`,\n operationId: `create${pascalModelName}`,\n requestBody: currentPath?.requestBody || {\n description: `${humanReadableName} data to create`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Create${pascalModelName}`, createMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"201\": currentPath?.responses?.[\"201\"] || {\n description: `${humanReadableName} created successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`${pascalModelName}`, createMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data provided\",\n },\n ...getAuthErrorResponses(),\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Find Many\n if (!isEndpointDisabled(routerConfig, \"findMany\")) {\n const pathname = `/api/${routeName}`;\n if (!paths[pathname]) paths[pathname] = {};\n const findManyMode = getSchemaMode(\"findMany\");\n const currentPath = paths[pathname]!.get;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"filters\",\n in: \"query\",\n description: \"Filter criteria in JSON format\",\n schema: { type: \"string\" },\n },\n {\n name: \"sort\",\n in: \"query\",\n description: \"Sort field (prefix with '-' for descending order)\",\n schema: { type: \"string\" },\n },\n {\n name: \"page\",\n in: \"query\",\n description: \"Page number (starts from 1)\",\n schema: { type: \"integer\", minimum: 1 },\n },\n {\n name: \"limit\",\n in: \"query\",\n description: \"Number of items per page\",\n schema: { type: \"integer\", minimum: 1, maximum: 100 },\n },\n {\n name: \"fields\",\n in: \"query\",\n description: \"Comma-separated list of fields to include in response\",\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Get ${humanReadableNamePlural}`\n : currentPath?.summary,\n description: `Retrieves a paginated list of ${humanReadableNamePlural} with optional filtering and sorting`,\n operationId: `find${pluralize.plural(pascalModelName)}`,\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: `List of ${humanReadableNamePlural} retrieved successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"integer\",\n description:\n \"Total number of records matching the criteria\",\n },\n results: {\n type: \"integer\",\n description: \"Number of records returned in current page\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: getSchemaRef(\n `FindMany${pascalModelName}`,\n findManyMode\n ),\n },\n },\n },\n },\n },\n },\n },\n ...getAuthErrorResponses(),\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Create Many\n if (!isEndpointDisabled(routerConfig, \"createMany\")) {\n const pathname = `/api/${routeName}/many`;\n if (!paths[pathname]) paths[pathname] = {};\n const createManyMode = getSchemaMode(\"createMany\");\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Create multiple ${humanReadableNamePlural}`\n : currentPath?.summary,\n description: `Creates multiple ${humanReadableNamePlural} records in a single batch operation`,\n operationId: `createMany${pascalModelName}`,\n requestBody: currentPath?.requestBody || {\n description: `Array of ${humanReadableName} data to create`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n type: \"array\",\n items: {\n $ref: getSchemaRef(\n `CreateMany${pascalModelName}`,\n createManyMode\n ),\n },\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"201\": currentPath?.responses?.[\"201\"] || {\n description: `${humanReadableNamePlural} created successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records created\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data provided\",\n },\n ...getAuthErrorResponses(),\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Many\n if (!isEndpointDisabled(routerConfig, \"updateMany\")) {\n const pathname = `/api/${routeName}/many`;\n if (!paths[pathname]) paths[pathname] = {};\n const updateManyMode = getSchemaMode(\"updateMany\");\n const currentPath = paths[pathname]!.patch;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"filters\",\n in: \"query\",\n description: \"Filter criteria in JSON format (required)\",\n required: true,\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Update multiple ${humanReadableNamePlural}`\n : currentPath?.summary,\n description: `Updates multiple ${humanReadableNamePlural} records that match the specified filter criteria`,\n operationId: `updateMany${pascalModelName}`,\n parameters: mergedParameters,\n requestBody: currentPath?.requestBody || {\n description: `Partial ${humanReadableName} data to update`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\n `UpdateMany${pascalModelName}`,\n updateManyMode\n ),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: `${humanReadableNamePlural} updated successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records updated\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data or missing filter criteria\",\n },\n ...getAuthErrorResponses(),\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.patch = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Delete Many\n if (!isEndpointDisabled(routerConfig, \"deleteMany\")) {\n const pathname = `/api/${routeName}/many`;\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"filters\",\n in: \"query\",\n description: \"Filter criteria in JSON format (required)\",\n required: true,\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Delete multiple ${humanReadableNamePlural}`\n : currentPath?.summary,\n description: `Deletes multiple ${humanReadableNamePlural} records that match the specified filter criteria`,\n operationId: `deleteMany${pascalModelName}`,\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: `${humanReadableNamePlural} deleted successfully`,\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n count: {\n type: \"integer\",\n description: \"Number of records deleted\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Missing filter criteria\",\n },\n ...getAuthErrorResponses(),\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Find One\n if (!isEndpointDisabled(routerConfig, \"findOne\")) {\n const pathname = `/api/${routeName}/{id}`;\n if (!paths[pathname]) paths[pathname] = {};\n const findOneMode = getSchemaMode(\"findOne\");\n const currentPath = paths[pathname]!.get;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Get ${humanReadableName} by ID`\n : currentPath?.summary,\n description: `Retrieves a single ${humanReadableName} record by its unique identifier`,\n operationId: `find${pascalModelName}ById`,\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: `${humanReadableName} retrieved successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`FindOne${pascalModelName}`, findOneMode),\n },\n },\n },\n },\n ...getAuthErrorResponses(),\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update One\n if (!isEndpointDisabled(routerConfig, \"updateOne\")) {\n const pathname = `/api/${routeName}/{id}`;\n if (!paths[pathname]) paths[pathname] = {};\n const updateMode = getSchemaMode(\"update\");\n const currentPath = paths[pathname]!.patch;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Update ${humanReadableName} by ID`\n : currentPath?.summary,\n description: `Updates a single ${humanReadableName} record by its unique identifier`,\n operationId: `update${pascalModelName}`,\n parameters: mergedParameters,\n requestBody: currentPath?.requestBody || {\n description: `Partial ${humanReadableName} data to update`,\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`Update${pascalModelName}`, updateMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: `${humanReadableName} updated successfully`,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(`${pascalModelName}`, updateMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data provided\",\n },\n ...getAuthErrorResponses(),\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.patch = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Delete One\n if (!isEndpointDisabled(routerConfig, \"deleteOne\")) {\n const pathname = `/api/${routeName}/{id}`;\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"id\",\n in: \"path\",\n description: `Unique identifier of the ${humanReadableName}`,\n required: true,\n schema: { type: \"string\" },\n },\n ];\n\n const existingParams =\n (currentPath?.parameters as OpenAPIV3.ParameterObject[]) || [];\n const existingParamKeys = new Set(\n existingParams.map((p) => `${p.in}-${p.name}`)\n );\n\n const mergedParameters = [\n ...existingParams,\n ...defaultParameters.filter(\n (p) => !existingParamKeys.has(`${p.in}-${p.name}`)\n ),\n ];\n\n const defaultSpec = {\n tags: [humanReadableNamePlural, ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? `Delete ${humanReadableName} by ID`\n : currentPath?.summary,\n description: `Permanently deletes a single ${humanReadableName} record by its unique identifier`,\n operationId: `delete${pascalModelName}`,\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"204\": currentPath?.responses?.[\"204\"] || {\n description: `${humanReadableName} deleted successfully`,\n },\n ...getAuthErrorResponses(),\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: `${humanReadableName} not found`,\n },\n },\n security: [{ BearerAuth: [] }],\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n return paths;\n}\n"]}
@@ -9,6 +9,7 @@ import generatePrismaModelParentRoutePaths from "./json-schema-generators/prisma
9
9
  import sheu from "../../../../utils/sheu.js";
10
10
  import prismaSchemaParser from "../../../../utils/prisma/prisma-schema-parser.js";
11
11
  import { getModuleComponents, } from "../../../../utils/dynamic-loader.js";
12
+ import { isAuthenticationEnabled } from "../../../../utils/helpers/arkos-config.helpers.js";
12
13
  export function getOpenAPIJsonSchemasByConfigMode(arkosConfig) {
13
14
  switch (arkosConfig?.swagger.mode) {
14
15
  case "prisma":
@@ -72,11 +73,11 @@ export function getSchemaRef(schemaName, mode) {
72
73
  return "";
73
74
  }
74
75
  }
75
- export function generatePathsForModels(arkosConfig) {
76
+ export function generatePathsForModels(arkosConfig, existingPaths = {}) {
76
77
  const swaggerConfig = arkosConfig?.swagger;
77
78
  if (!swaggerConfig)
78
79
  return {};
79
- let paths = {};
80
+ let paths = { ...existingPaths };
80
81
  const models = prismaSchemaParser.getModelsAsArrayOfStrings();
81
82
  for (const model of models) {
82
83
  generatePrismaModelMainRoutesPaths(model, paths, arkosConfig);
@@ -86,10 +87,11 @@ export function generatePathsForModels(arkosConfig) {
86
87
  ...paths,
87
88
  ...getSystemJsonSchemaPaths(),
88
89
  };
89
- paths = {
90
- ...paths,
91
- ...(getAuthenticationJsonSchemaPaths(arkosConfig) || {}),
92
- };
90
+ if (isAuthenticationEnabled())
91
+ paths = {
92
+ ...paths,
93
+ ...(getAuthenticationJsonSchemaPaths(arkosConfig, existingPaths) || {}),
94
+ };
93
95
  return paths;
94
96
  }
95
97
  export function localValidatorFileExists(action, modelName, arkosConfig) {
@@ -1 +1 @@
1
- {"version":3,"file":"swagger.router.helpers.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/swagger.router.helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,gCAAgC,MAAM,wCAAwC,CAAC;AACtF,OAAO,sBAAsB,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,iCAAiC,EAAE,MAAM,gEAAgE,CAAC;AACnH,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,kCAAkC,EAAE,MAAM,gFAAgF,CAAC;AACpI,OAAO,mCAAmC,MAAM,kFAAkF,CAAC;AACnI,OAAO,IAAI,MAAM,wBAAwB,CAAC;AAC1C,OAAO,kBAAkB,MAAM,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,mCAAmC,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,GAAG;QACN,GAAG,KAAK;QACR,GAAG,wBAAwB,EAAE;KAC9B,CAAC;IAEF,KAAK,GAAG;QACN,GAAG,KAAK;QACR,GAAG,CAAC,gCAAgC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;KACzD,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC;AAUD,MAAM,UAAU,wBAAwB,CACtC,MAAgC,EAChC,SAAiB,EACjB,WAAwB;IAExB,IAAI,WAAW,EAAE,OAAO,EAAE,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC1D,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,CAAQ,CAAC;IAE/D,OAAO,CAAC,CAAC,gBAAgB,EAAE,CACzB,WAAW,CAAC,UAAU,EAAE,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAChE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import { ArkosConfig } from \"../../../../exports\";\nimport { camelCase, pascalCase } from \"../../../../exports/utils\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { getSystemJsonSchemaPaths } from \"./get-system-json-schema-paths\";\nimport getAuthenticationJsonSchemaPaths from \"./get-authentication-json-schema-paths\";\nimport generateZodJsonSchemas from \"./json-schema-generators/generate-zod-json-schemas\";\nimport { generateClassValidatorJsonSchemas } from \"./json-schema-generators/generate-class-validator-json-schemas\";\nimport { generatePrismaJsonSchemas } from \"./json-schema-generators/generate-prisma-json-schemas\";\nimport { generatePrismaModelMainRoutesPaths } from \"./json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths\";\nimport generatePrismaModelParentRoutePaths from \"./json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths\";\nimport sheu from \"../../../../utils/sheu\";\nimport prismaSchemaParser from \"../../../../utils/prisma/prisma-schema-parser\";\nimport {\n getModuleComponents,\n ValidationFileMappingKey,\n} from \"../../../../utils/dynamic-loader\";\n\n/**\n * Helps choosing the right json schemas according to swagger configurations\n */\nexport function getOpenAPIJsonSchemasByConfigMode(arkosConfig: ArkosConfig) {\n switch (arkosConfig?.swagger!.mode) {\n case \"prisma\":\n return generatePrismaJsonSchemas(arkosConfig);\n case \"class-validator\":\n return generateClassValidatorJsonSchemas();\n case \"zod\":\n return generateZodJsonSchemas();\n default:\n throw Error(\n \"Unknown mode for auto documentation, supported values are prisma, class-validator, zod or json-schemas\"\n );\n }\n}\n\nexport function getCorrectJsonSchemaName(\n type: string,\n modelName: string,\n suffix: \"Dto\" | \"Schema\"\n): string {\n const pascalModelName = pascalCase(modelName);\n\n const map: Record<string, string> = {\n model: pascalModelName,\n create: `Create${pascalModelName}`,\n createMany: `CreateMany${pascalModelName}`,\n findOne: `FindOne${pascalModelName}`,\n findMany: `FindMany${pascalModelName}`,\n update: `Update${pascalModelName}`,\n updateMany: `UpdateMany${pascalModelName}`,\n query: `Query${pascalModelName}`,\n login: \"Login\",\n signup: \"Signup\",\n updateMe: \"UpdateMe\",\n updatePassword: \"UpdatePassword\",\n };\n\n const baseName = map[type] ?? pascalCase(type);\n return `${baseName}${suffix}`;\n}\n\nexport function kebabToHuman(kebabStr: string): string {\n return kebabStr\n .split(\"-\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\nexport function getSchemaRef(\n schemaName: string,\n mode: \"prisma\" | \"zod\" | \"class-validator\"\n): string {\n schemaName = pascalCase(schemaName);\n const specialCases = [\n \"getme\",\n \"updateme\",\n \"login\",\n \"signup\",\n \"updatepassword\",\n \"password\",\n \"me\",\n ];\n const isSpecialCase = specialCases.some(\n (keyword) => keyword === schemaName.toLowerCase()\n );\n\n if (isSpecialCase && mode === \"prisma\")\n return `#/components/schemas/${schemaName}Schema`;\n\n switch (mode) {\n case \"prisma\":\n return `#/components/schemas/${schemaName}ModelSchema`;\n case \"zod\":\n return `#/components/schemas/${schemaName}Schema`;\n case \"class-validator\":\n return `#/components/schemas/${schemaName}Dto`;\n default:\n sheu.error(\n `Unknown Arkos.js swagger documentation provided, available options are prisma, zod or class-validator but received ${mode}`\n );\n return \"\";\n }\n}\n\nexport function generatePathsForModels(\n arkosConfig: ArkosConfig\n): OpenAPIV3.PathsObject {\n const swaggerConfig = arkosConfig?.swagger;\n\n if (!swaggerConfig) return {};\n\n let paths: OpenAPIV3.PathsObject = {};\n const models = prismaSchemaParser.getModelsAsArrayOfStrings();\n\n for (const model of models) {\n generatePrismaModelMainRoutesPaths(model, paths, arkosConfig);\n generatePrismaModelParentRoutePaths(model, paths, arkosConfig);\n }\n\n paths = {\n ...paths,\n ...getSystemJsonSchemaPaths(),\n };\n\n paths = {\n ...paths,\n ...(getAuthenticationJsonSchemaPaths(arkosConfig) || {}),\n };\n\n return paths;\n}\n\n/**\n * Helps in finding out whether a given dto/schema file exits under the user project according to the validation arkos configuration.\n *\n * @param action {ValidationFileMappingKey} - the action of the dto, e.g: create, findMany.\n * @param modelName {string} - the model to be checked\n * @param arkosConfig {ArkosConfig} - the arkos.js configuration\n * @returns boolean\n */\nexport function localValidatorFileExists(\n action: ValidationFileMappingKey,\n modelName: string,\n arkosConfig: ArkosConfig\n) {\n if (arkosConfig?.swagger?.mode === \"prisma\") return false;\n const moduleComponents = getModuleComponents(modelName) as any;\n\n return !!moduleComponents?.[\n arkosConfig.validation?.resolver === \"zod\" ? \"schemas\" : \"dtos\"\n ]?.[camelCase(action)];\n}\n"]}
1
+ {"version":3,"file":"swagger.router.helpers.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/swagger.router.helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,gCAAgC,MAAM,wCA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d,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,WAAwB,EACxB,gBAAuC,EAAE;IAEzC,MAAM,aAAa,GAAG,WAAW,EAAE,OAAO,CAAC;IAE3C,IAAI,CAAC,aAAa;QAAE,OAAO,EAAE,CAAC;IAE9B,IAAI,KAAK,GAA0B,EAAE,GAAG,aAAa,EAAE,CAAC;IACxD,MAAM,MAAM,GAAG,kBAAkB,CAAC,yBAAyB,EAAE,CAAC;IAE9D,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,kCAAkC,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;QAC9D,mCAAmC,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,GAAG;QACN,GAAG,KAAK;QACR,GAAG,wBAAwB,EAAE;KAC9B,CAAC;IAEF,IAAI,uBAAuB,EAAE;QAC3B,KAAK,GAAG;YACN,GAAG,KAAK;YACR,GAAG,CAAC,gCAAgC,CAAC,WAAW,EAAE,aAAa,CAAC,IAAI,EAAE,CAAC;SACxE,CAAC;IAEJ,OAAO,KAAK,CAAC;AACf,CAAC;AAUD,MAAM,UAAU,wBAAwB,CACtC,MAAgC,EAChC,SAAiB,EACjB,WAAwB;IAExB,IAAI,WAAW,EAAE,OAAO,EAAE,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC1D,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,SAAS,CAAQ,CAAC;IAE/D,OAAO,CAAC,CAAC,gBAAgB,EAAE,CACzB,WAAW,CAAC,UAAU,EAAE,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAChE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACzB,CAAC","sourcesContent":["import { ArkosConfig } from \"../../../../exports\";\nimport { camelCase, pascalCase } from \"../../../../exports/utils\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport { getSystemJsonSchemaPaths } from \"./get-system-json-schema-paths\";\nimport getAuthenticationJsonSchemaPaths from \"./get-authentication-json-schema-paths\";\nimport generateZodJsonSchemas from \"./json-schema-generators/generate-zod-json-schemas\";\nimport { generateClassValidatorJsonSchemas } from \"./json-schema-generators/generate-class-validator-json-schemas\";\nimport { generatePrismaJsonSchemas } from \"./json-schema-generators/generate-prisma-json-schemas\";\nimport { generatePrismaModelMainRoutesPaths } from \"./json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths\";\nimport generatePrismaModelParentRoutePaths from \"./json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths\";\nimport sheu from \"../../../../utils/sheu\";\nimport prismaSchemaParser from \"../../../../utils/prisma/prisma-schema-parser\";\nimport {\n getModuleComponents,\n ValidationFileMappingKey,\n} from \"../../../../utils/dynamic-loader\";\nimport { isAuthenticationEnabled } from \"../../../../utils/helpers/arkos-config.helpers\";\n\n/**\n * Helps choosing the right json schemas according to swagger configurations\n */\nexport function getOpenAPIJsonSchemasByConfigMode(arkosConfig: ArkosConfig) {\n switch (arkosConfig?.swagger!.mode) {\n case \"prisma\":\n return generatePrismaJsonSchemas(arkosConfig);\n case \"class-validator\":\n return generateClassValidatorJsonSchemas();\n case \"zod\":\n return generateZodJsonSchemas();\n default:\n throw Error(\n \"Unknown mode for auto documentation, supported values are prisma, class-validator, zod or json-schemas\"\n );\n }\n}\n\nexport function getCorrectJsonSchemaName(\n type: string,\n modelName: string,\n suffix: \"Dto\" | \"Schema\"\n): string {\n const pascalModelName = pascalCase(modelName);\n\n const map: Record<string, string> = {\n model: pascalModelName,\n create: `Create${pascalModelName}`,\n createMany: `CreateMany${pascalModelName}`,\n findOne: `FindOne${pascalModelName}`,\n findMany: `FindMany${pascalModelName}`,\n update: `Update${pascalModelName}`,\n updateMany: `UpdateMany${pascalModelName}`,\n query: `Query${pascalModelName}`,\n login: \"Login\",\n signup: \"Signup\",\n updateMe: \"UpdateMe\",\n updatePassword: \"UpdatePassword\",\n };\n\n const baseName = map[type] ?? pascalCase(type);\n return `${baseName}${suffix}`;\n}\n\nexport function kebabToHuman(kebabStr: string): string {\n return kebabStr\n .split(\"-\")\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n .join(\" \");\n}\n\nexport function getSchemaRef(\n schemaName: string,\n mode: \"prisma\" | \"zod\" | \"class-validator\"\n): string {\n schemaName = pascalCase(schemaName);\n const specialCases = [\n \"getme\",\n \"updateme\",\n \"login\",\n \"signup\",\n \"updatepassword\",\n \"password\",\n \"me\",\n ];\n const isSpecialCase = specialCases.some(\n (keyword) => keyword === schemaName.toLowerCase()\n );\n\n if (isSpecialCase && mode === \"prisma\")\n return `#/components/schemas/${schemaName}Schema`;\n\n switch (mode) {\n case \"prisma\":\n return `#/components/schemas/${schemaName}ModelSchema`;\n case \"zod\":\n return `#/components/schemas/${schemaName}Schema`;\n case \"class-validator\":\n return `#/components/schemas/${schemaName}Dto`;\n default:\n sheu.error(\n `Unknown Arkos.js swagger documentation provided, available options are prisma, zod or class-validator but received ${mode}`\n );\n return \"\";\n }\n}\n\nexport function generatePathsForModels(\n arkosConfig: ArkosConfig,\n existingPaths: OpenAPIV3.PathsObject = {}\n): OpenAPIV3.PathsObject {\n const swaggerConfig = arkosConfig?.swagger;\n\n if (!swaggerConfig) return {};\n\n let paths: OpenAPIV3.PathsObject = { ...existingPaths };\n const models = prismaSchemaParser.getModelsAsArrayOfStrings();\n\n for (const model of models) {\n generatePrismaModelMainRoutesPaths(model, paths, arkosConfig);\n generatePrismaModelParentRoutePaths(model, paths, arkosConfig);\n }\n\n paths = {\n ...paths,\n ...getSystemJsonSchemaPaths(),\n };\n\n if (isAuthenticationEnabled())\n paths = {\n ...paths,\n ...(getAuthenticationJsonSchemaPaths(arkosConfig, existingPaths) || {}),\n };\n\n return paths;\n}\n\n/**\n * Helps in finding out whether a given dto/schema file exits under the user project according to the validation arkos configuration.\n *\n * @param action {ValidationFileMappingKey} - the action of the dto, e.g: create, findMany.\n * @param modelName {string} - the model to be checked\n * @param arkosConfig {ArkosConfig} - the arkos.js configuration\n * @returns boolean\n */\nexport function localValidatorFileExists(\n action: ValidationFileMappingKey,\n modelName: string,\n arkosConfig: ArkosConfig\n) {\n if (arkosConfig?.swagger?.mode === \"prisma\") return false;\n const moduleComponents = getModuleComponents(modelName) as any;\n\n return !!moduleComponents?.[\n arkosConfig.validation?.resolver === \"zod\" ? \"schemas\" : \"dtos\"\n ]?.[camelCase(action)];\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import { bootstrap } from "./app.js";
2
2
  import http from "http";
3
3
  import sheu from "./utils/sheu.js";
4
- import { capitalize } from "./utils/helpers/text.helpers.js";
5
4
  import portAndHostAllocator from "./utils/features/port-and-host-allocator.js";
6
5
  import { killDevelopmentServerChildProcess } from "./utils/cli/dev.js";
7
6
  import { killServerChildProcess } from "./utils/cli/utils/cli.helpers.js";
@@ -14,11 +13,11 @@ export function getArkosConfig() {
14
13
  process.on("uncaughtException", (err) => {
15
14
  if (err.message.includes("EPIPE"))
16
15
  return;
17
- sheu.error("\nUNCAUGHT EXCEPTION! SHUTTING DOWN...\n", {
18
- timestamp: true,
19
- bold: true,
20
- });
21
- console.error(err.name, err.message);
16
+ if (process.env.CLI !== "true")
17
+ sheu.error("UNCAUGHT EXCEPTION! SHUTTING DOWN...\n", {
18
+ timestamp: true,
19
+ bold: true,
20
+ });
22
21
  console.error(err);
23
22
  process.exit(1);
24
23
  });
@@ -27,7 +26,7 @@ let _app;
27
26
  async function initApp(initConfig = {}) {
28
27
  try {
29
28
  const arkosConfig = getArkosConfig();
30
- const portAndHost = await portAndHostAllocator.getHostAndAvailablePort(process.env, arkosConfig);
29
+ const portAndHost = { port: process.env.__PORT, host: process.env.__HOST };
31
30
  let networkHost = portAndHostAllocator.getFirstNonLocalIp();
32
31
  _app = await bootstrap(initConfig);
33
32
  const time = new Date().toTimeString().split(" ")[0];
@@ -43,7 +42,7 @@ async function initApp(initConfig = {}) {
43
42
  ? "localhost"
44
43
  : portAndHost?.host;
45
44
  const message = `${sheu.gray(time)} {{server}} waiting on http://${host}:${portAndHost?.port}`;
46
- sheu.ready(message.replace("{{server}}", `${capitalize(process.env.NODE_ENV || "development")} server`));
45
+ sheu.ready(message.replace("{{server}}", `${process.env.ARKOS_BUILD === "true" ? "Production" : "Development"} server`));
47
46
  if (networkHost && portAndHost.host === "0.0.0.0")
48
47
  sheu.ready(message
49
48
  .replace(host, networkHost)
@@ -71,15 +70,18 @@ async function initApp(initConfig = {}) {
71
70
  }
72
71
  }
73
72
  process.on("unhandledRejection", (err) => {
74
- sheu.error("\nUNHANDLED REJECTION! SHUTTING DOWN...\n", {
75
- timestamp: true,
76
- bold: true,
77
- });
78
- console.error(err.name, err.message);
73
+ if (process.env.CLI !== "true")
74
+ sheu.error("UNHANDLED REJECTION! SHUTTING DOWN...\n", {
75
+ timestamp: true,
76
+ bold: true,
77
+ });
79
78
  console.error(err);
80
- server?.close(() => {
79
+ if (server?.close)
80
+ server?.close(() => {
81
+ process.exit(1);
82
+ });
83
+ else
81
84
  process.exit(1);
82
- });
83
85
  });
84
86
  export function terminateApplicationRunningProcessAndServer() {
85
87
  server?.close(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,cAAc,IAAI,oB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IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport http from \"http\";\nimport sheu from \"./utils/sheu\";\nimport { capitalize } from \"./utils/helpers/text.helpers\";\nimport portAndHostAllocator from \"./utils/features/port-and-host-allocator\";\nimport { killDevelopmentServerChildProcess } from \"./utils/cli/dev\";\nimport { killServerChildProcess } from \"./utils/cli/utils/cli.helpers\";\nimport { killProductionServerChildProcess } from \"./utils/cli/start\";\nimport { ArkosConfig } from \"./types/new-arkos-config\";\nimport { ArkosInitConfig } from \"./exports\";\nimport { getArkosConfig as getArkosConfigHelper } from \"./utils/helpers/arkos-config.helpers\";\nimport runtimeCliCommander from \"./utils/cli/utils/runtime-cli-commander\";\n\n/**\n * Gives access to the underlying current configurations being used by **Arkos** by default and also loaded through `arkos.config.{ts|js}`\n *\n * @returns {ArkosConfig}\n */\nexport function getArkosConfig(): ArkosConfig {\n // This was kept only not to require many changes on the given time\n return getArkosConfigHelper();\n}\n\nprocess.on(\"uncaughtException\", (err) => {\n if (err.message.includes(\"EPIPE\")) return;\n\n sheu.error(\"\\nUNCAUGHT EXCEPTION! SHUTTING DOWN...\\n\", {\n timestamp: true,\n bold: true,\n });\n\n console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosInitConfig} initConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(\n initConfig: ArkosInitConfig = {}\n): Promise<Express | undefined> {\n try {\n const arkosConfig = getArkosConfig();\n\n const portAndHost = await portAndHostAllocator.getHostAndAvailablePort(\n process.env,\n arkosConfig\n );\n\n let networkHost = portAndHostAllocator.getFirstNonLocalIp();\n\n _app = await bootstrap(initConfig);\n const time = new Date().toTimeString().split(\" \")[0];\n const cliCommand = process.env.CLI_COMMAND;\n\n if (\n !cliCommand &&\n ((\"port\" in arkosConfig && arkosConfig?.port !== undefined) ||\n !(\"port\" in arkosConfig))\n ) {\n server = http.createServer(_app);\n\n if (initConfig?.configureServer) await initConfig.configureServer(server);\n\n server.listen(\n Number(portAndHost?.port),\n portAndHost.host! === \"localhost\" ? \"127.0.0.1\" : portAndHost.host!,\n () => {\n const host = [\"0.0.0.0\", \"127.0.0.1\"].includes(portAndHost?.host)\n ? \"localhost\"\n : portAndHost?.host;\n\n const message = `${sheu.gray(time)} {{server}} waiting on http://${host}:${portAndHost?.port}`;\n\n sheu.ready(\n message.replace(\n \"{{server}}\",\n `${capitalize(process.env.NODE_ENV || \"development\")} server`\n )\n );\n if (networkHost && portAndHost.host === \"0.0.0.0\")\n sheu.ready(\n message\n .replace(host, networkHost)\n .replace(\"{{server}}\", `Network server`)\n );\n if (\n arkosConfig?.swagger?.mode &&\n ((arkosConfig?.swagger?.enableAfterBuild &&\n process.env.ARKOS_BUILD === \"true\") ||\n process.env.ARKOS_BUILD !== \"true\")\n )\n sheu.ready(\n `${message.replace(\"{{server}}\", \"Documentation\")}${arkosConfig?.swagger?.endpoint || \"/api/docs\"}`\n );\n }\n );\n } else if (!cliCommand) {\n sheu.warn(\n `${sheu.gray(time)} Port set to undefined, hence no internal http server was setup.`\n );\n } else if (cliCommand) runtimeCliCommander.handle();\n\n return _app;\n } catch (err: any) {\n sheu.error(\n err?.message || \"Something went wrong while starting your application!\"\n );\n console.error(err);\n killDevelopmentServerChildProcess?.();\n killServerChildProcess?.();\n killProductionServerChildProcess?.();\n }\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n sheu.error(\"\\nUNHANDLED REJECTION! SHUTTING DOWN...\\n\", {\n timestamp: true,\n bold: true,\n });\n console.error(err.name, err.message);\n console.error(err);\n server?.close(() => {\n process.exit(1);\n });\n});\n\n/**\n * Terminates the current running express application, server and process.\n *\n * @returns {void}\n */\nexport function terminateApplicationRunningProcessAndServer(): void {\n server?.close(() => {\n process.exit(1);\n });\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAGrE,OAAO,EAAE,cAAc,IAAI,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,mBAAmB,MAAM,yCAAyC,CAAC;AAO1E,MAAM,UAAU,cAAc;IAE5B,OAAO,oBAAoB,EAAE,CAAC;AAChC,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,GAAG,EAAE,EAAE;IACtC,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO;IAE1C,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM;QAC5B,IAAI,CAAC,KAAK,CAAC,wCAAwC,EAAE;YACnD,SAAS,EAAE,IAAI;YACf,IAAI,EA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;QAEpD,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAI,CAAC,KAAK,CACR,GAAG,EAAE,OAAO,IAAI,uDAAuD,CACxE,CAAC;QACF,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,iCAAiC,EAAE,EAAE,CAAC;QACtC,sBAAsB,EAAE,EAAE,CAAC;QAC3B,gCAAgC,EAAE,EAAE,CAAC;IACvC,CAAC;AACH,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,GAAa,EAAE,EAAE;IACjD,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM;QAC5B,IAAI,CAAC,KAAK,CAAC,yCAAyC,EAAE;YACpD,SAAS,EAAE,IAAI;YACf,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IAEL,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,IAAI,MAAM,EAAE,KAAK;QACf,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;YACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;;QACA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC;AAOH,MAAM,UAAU,2CAA2C;IACzD,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import { IncomingMessage, Server, ServerResponse } from \"http\";\nimport AppError from \"./modules/error-handler/utils/app-error\";\nimport { Express } from \"express\";\nimport { bootstrap } from \"./app\";\nimport http from \"http\";\nimport sheu from \"./utils/sheu\";\nimport portAndHostAllocator from \"./utils/features/port-and-host-allocator\";\nimport { killDevelopmentServerChildProcess } from \"./utils/cli/dev\";\nimport { killServerChildProcess } from \"./utils/cli/utils/cli.helpers\";\nimport { killProductionServerChildProcess } from \"./utils/cli/start\";\nimport { ArkosConfig } from \"./types/new-arkos-config\";\nimport { ArkosInitConfig } from \"./exports\";\nimport { getArkosConfig as getArkosConfigHelper } from \"./utils/helpers/arkos-config.helpers\";\nimport runtimeCliCommander from \"./utils/cli/utils/runtime-cli-commander\";\n\n/**\n * Gives access to the underlying current configurations being used by **Arkos** by default and also loaded through `arkos.config.{ts|js}`\n *\n * @returns {ArkosConfig}\n */\nexport function getArkosConfig(): ArkosConfig {\n // This was kept only not to require many changes on the given time\n return getArkosConfigHelper();\n}\n\nprocess.on(\"uncaughtException\", (err) => {\n if (err.message.includes(\"EPIPE\")) return;\n\n if (process.env.CLI !== \"true\")\n sheu.error(\"UNCAUGHT EXCEPTION! SHUTTING DOWN...\\n\", {\n timestamp: true,\n bold: true,\n });\n\n // console.error(err.name, err.message);\n console.error(err);\n process.exit(1);\n});\n\nlet server: Server<typeof IncomingMessage, typeof ServerResponse>;\nlet _app: Express;\n\n/**\n * Initializes the application server.\n *\n * This function starts the server by listening on a specified port.\n * The port is determined by the following order of precedence:\n * 1. The `port` argument passed to the function.\n * 2. Defaults to `8000` if neither is provided.\n *\n * @param {ArkosInitConfig} initConfig - initial configs for the api ( authentication, port).\n * @returns {Promise<Express>} This function returns the Express App after all middlewares configurations.\n * You can prevent it from listen py passing port as undefined\n *\n */\nasync function initApp(\n initConfig: ArkosInitConfig = {}\n): Promise<Express | undefined> {\n try {\n const arkosConfig = getArkosConfig();\n\n const portAndHost = { port: process.env.__PORT, host: process.env.__HOST! };\n\n let networkHost = portAndHostAllocator.getFirstNonLocalIp();\n\n _app = await bootstrap(initConfig);\n const time = new Date().toTimeString().split(\" \")[0];\n const cliCommand = process.env.CLI_COMMAND;\n\n if (\n !cliCommand &&\n ((\"port\" in arkosConfig && arkosConfig?.port !== undefined) ||\n !(\"port\" in arkosConfig))\n ) {\n server = http.createServer(_app);\n\n if (initConfig?.configureServer) await initConfig.configureServer(server);\n\n server.listen(\n Number(portAndHost?.port),\n portAndHost.host! === \"localhost\" ? \"127.0.0.1\" : portAndHost.host!,\n () => {\n const host = [\"0.0.0.0\", \"127.0.0.1\"].includes(portAndHost?.host)\n ? \"localhost\"\n : portAndHost?.host;\n\n const message = `${sheu.gray(time)} {{server}} waiting on http://${host}:${portAndHost?.port}`;\n\n sheu.ready(\n message.replace(\n \"{{server}}\",\n `${process.env.ARKOS_BUILD === \"true\" ? \"Production\" : \"Development\"} server`\n )\n );\n if (networkHost && portAndHost.host === \"0.0.0.0\")\n sheu.ready(\n message\n .replace(host, networkHost)\n .replace(\"{{server}}\", `Network server`)\n );\n if (\n arkosConfig?.swagger?.mode &&\n ((arkosConfig?.swagger?.enableAfterBuild &&\n process.env.ARKOS_BUILD === \"true\") ||\n process.env.ARKOS_BUILD !== \"true\")\n )\n sheu.ready(\n `${message.replace(\"{{server}}\", \"Documentation\")}${arkosConfig?.swagger?.endpoint || \"/api/docs\"}`\n );\n }\n );\n } else if (!cliCommand) {\n sheu.warn(\n `${sheu.gray(time)} Port set to undefined, hence no internal http server was setup.`\n );\n } else if (cliCommand) runtimeCliCommander.handle();\n\n return _app;\n } catch (err: any) {\n sheu.error(\n err?.message || \"Something went wrong while starting your application!\"\n );\n console.error(err);\n killDevelopmentServerChildProcess?.();\n killServerChildProcess?.();\n killProductionServerChildProcess?.();\n }\n}\n\nprocess.on(\"unhandledRejection\", (err: AppError) => {\n if (process.env.CLI !== \"true\")\n sheu.error(\"UNHANDLED REJECTION! SHUTTING DOWN...\\n\", {\n timestamp: true,\n bold: true,\n });\n // console.error(err.name, err.message);\n console.error(err);\n if (server?.close)\n server?.close(() => {\n process.exit(1);\n });\n else process.exit(1);\n});\n\n/**\n * Terminates the current running express application, server and process.\n *\n * @returns {void}\n */\nexport function terminateApplicationRunningProcessAndServer(): void {\n server?.close(() => {\n process.exit(1);\n });\n}\n\nexport function getExpressApp() {\n return _app;\n}\n\nexport { server, initApp };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AA6LA,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,yCAAiB,CAAA;IACjB,yCAAiB,CAAA;AACnB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B","sourcesContent":["import {\n ErrorRequestHandler,\n NextFunction,\n Request,\n RequestHandler,\n Response,\n} from \"express\";\n\nexport type PrismaOperations = \"findMany\";\n\n/**\n * Type definition for authentication-related Prisma query operations\n * @template T - The Prisma model delegate type\n */\nexport type AuthPrismaQueryOptions<T extends Record<string, any>> = {\n // User profile endpoints\n /**\n * Options for retrieving the current authenticated user's profile\n */\n getMe?: Partial<Parameters<T[\"findUnique\"]>[0]>;\n /**\n * Options for updating the current authenticated user's profile\n */\n updateMe?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Options for soft deleting or deactivating the current authenticated user's account\n */\n deleteMe?: Partial<Parameters<T[\"update\"]>[0]>;\n // Authentication endpoints\n /**\n * Options for user login authentication queries\n */\n login?: Partial<Parameters<T[\"findFirst\"]>[0]>;\n /**\n * Options for user registration and account creation\n */\n signup?: Partial<Parameters<T[\"create\"]>[0]>;\n /**\n * Options for updating the current authenticated user's password\n */\n updatePassword?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Options for finding multiple auth actions\n */\n findManyAuthAction?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * Options for finding a single auth action\n */\n findOneAuthAction?: Partial<Parameters<T[\"findFirst\"]>[0]>;\n};\n\n/**\n * Base Prisma query options for standard CRUD operations\n * @template T - The Prisma model delegate type\n */\ntype BasePrismaQueryOptions<T extends Record<string, any>> = {\n /**\n * @deprecated Use `global` instead for general query options\n */\n queryOptions?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * Global query options that can be used for all operations\n * Replaces the deprecated queryOptions\n */\n global?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * General find options for findMany and findOne operations\n */\n find?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * General create options for createOne and createMany operations\n */\n create?: Partial<Parameters<T[\"create\"]>[0]>;\n /**\n * General update options for updateOne and updateMany operations\n */\n update?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * General delete options for deleteOne and deleteMany operations\n */\n delete?: Partial<Parameters<T[\"delete\"]>[0]>;\n /**\n * General save options for createOne, createMany, updateOne, updateMany operations\n */\n save?:\n | Partial<Parameters<T[\"create\"]>[0]>\n | Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Save options for single record operations (createOne, updateOne)\n */\n saveOne?:\n | Partial<Parameters<T[\"create\"]>[0]>\n | Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Save options for multiple record operations (createMany, updateMany)\n */\n saveMany?:\n | Partial<Parameters<T[\"createMany\"]>[0]>\n | Partial<Parameters<T[\"updateMany\"]>[0]>;\n /**\n * Options for finding a single record (first match)\n */\n findOne?: Partial<Parameters<T[\"findFirst\"]>[0]>;\n /**\n * Options for finding multiple records\n */\n findMany?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * Options for creating a single record\n */\n createOne?: Partial<Parameters<T[\"create\"]>[0]>;\n /**\n * Options for creating multiple records\n */\n createMany?: Partial<Parameters<T[\"createMany\"]>[0]>;\n /**\n * Options for updating a single record\n */\n updateOne?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Options for updating multiple records\n */\n updateMany?: Partial<Parameters<T[\"updateMany\"]>[0]>;\n /**\n * Options for deleting a single record\n */\n deleteOne?: Partial<Parameters<T[\"delete\"]>[0]>;\n /**\n * Options for deleting multiple records\n */\n deleteMany?: Partial<Parameters<T[\"deleteMany\"]>[0]>;\n};\n\n/**\n * Type definition for Prisma query operations with flexible options\n * Conditionally provides auth-specific options when ModelName is \"auth\"\n * @template T - The Prisma model delegate type\n * @template ModelName - The model name (defaults to string for standard models)\n */\nexport type PrismaQueryOptions<\n T extends Record<string, any>,\n ModelName extends string = string,\n> = ModelName extends \"auth\"\n ? AuthPrismaQueryOptions<T>\n : BasePrismaQueryOptions<T>;\n/**\n * Interface defining the minimum structure required for Prisma model delegates\n * This allows us to constraint TModel without requiring Prisma imports\n */\nexport type PrismaModelDelegate = {\n create: (args: { data: never; [key: string]: never }) => Promise<any>;\n createMany: (args: { data: never; [key: string]: never }) => Promise<any>;\n findMany: (args: { [key: string]: never }) => Promise<any[]>;\n findFirst: (args: { where: never; [key: string]: never }) => Promise<any>;\n findUnique: (args: { where: never; [key: string]: never }) => Promise<any>;\n update: (args: {\n where: never;\n data: never;\n [key: string]: never;\n }) => Promise<any>;\n updateMany: (args: {\n where: never;\n data: never;\n [key: string]: never;\n }) => Promise<any>;\n delete: (args: { where: never; [key: string]: never }) => Promise<any>;\n deleteMany: (args: { where: never; [key: string]: never }) => Promise<any>;\n count: (args: { where: never; [key: string]: never }) => Promise<number>;\n};\n\nexport interface UserRole {\n id: string;\n createdAt: Date;\n deletedAt?: Date;\n roleId: string;\n role: AuthRole;\n user: User;\n userId: string;\n}\n\nexport interface AuthRole {\n id: string;\n createdAt: Date;\n deletedAt?: Date;\n name: string;\n permissions: AuthPermission[];\n userRoles: UserRole[];\n}\n\nexport enum AuthPermissionAction {\n Create = \"Create\",\n View = \"View\",\n Update = \"Update\",\n Delete = \"Delete\",\n}\n\nexport interface AuthPermission {\n id: string;\n createdAt: Date;\n deletedAt?: Date;\n resource: string;\n action: AuthPermissionAction;\n roleId: string;\n role: AuthRole;\n}\n\nexport interface User {\n id: string;\n isStaff: boolean;\n isSuperUser: boolean;\n password: string;\n passwordChangedAt?: Date;\n deletedSelfAccountAt: Date;\n isActive: boolean;\n roles?: UserRole[] | any[];\n role?: UserRole | any;\n}\n\nexport interface ArkosRequest<\n Params extends Record<string, any> = any,\n Body = any,\n Query extends Record<string, any> = any,\n> extends Request<Params, any, Body, Query> {\n /**\n * Authenticated user with additional fields\n */\n user?: User & Record<string, any>;\n\n /**\n * Fields to include in relational queries\n */\n relationFields?: Record<string, boolean>;\n\n /**\n * Prisma include options for related data\n */\n include?: Record<string, any>;\n\n /**\n * Data to be sent in the response\n */\n responseData?: Record<string, any> | null;\n\n /**\n * Additional context data\n */\n additionalData?: Record<string, any> | null;\n\n /**\n * HTTP status code for the response\n */\n responseStatus?: number;\n\n /**\n * Typed request body\n */\n body: Body;\n\n /**\n * Prisma query options (where, orderBy, select, etc.)\n */\n prismaQueryOptions?: Record<string, any>;\n\n /**\n * Typed query parameters\n */\n query: Query;\n\n /**\n * JWT token used in authentication process\n */\n accessToken?: string;\n\n /**\n * Query parameters after being handled and transformed by middleware\n */\n transformedQuery?: Record<string, any>;\n\n /**\n * Processed filters from APIFeatures.filters\n */\n filters?: Record<string, any>;\n\n /**\n * Name of the Prisma model being queried\n */\n modelName?: string;\n}\n\nexport interface ArkosResponse extends Response {}\nexport interface ArkosNextFunction extends NextFunction {}\nexport interface ArkosRequestHandler extends RequestHandler {}\nexport interface ArkosErrorRequestHandler extends ErrorRequestHandler {}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AA6LA,MAAM,CAAN,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,qCAAa,CAAA;IACb,yCAAiB,CAAA;IACjB,yCAAiB,CAAA;AACnB,CAAC,EALW,oBAAoB,KAApB,oBAAoB,QAK/B","sourcesContent":["import {\n ErrorRequestHandler,\n NextFunction,\n Request,\n RequestHandler,\n Response,\n} from \"express\";\n\nexport type PrismaOperations = \"findMany\";\n\n/**\n * Type definition for authentication-related Prisma query operations\n * @template T - The Prisma model delegate type\n */\nexport type AuthPrismaQueryOptions<T extends Record<string, any>> = {\n // User profile endpoints\n /**\n * Options for retrieving the current authenticated user's profile\n */\n getMe?: Partial<Parameters<T[\"findUnique\"]>[0]>;\n /**\n * Options for updating the current authenticated user's profile\n */\n updateMe?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Options for soft deleting or deactivating the current authenticated user's account\n */\n deleteMe?: Partial<Parameters<T[\"update\"]>[0]>;\n // Authentication endpoints\n /**\n * Options for user login authentication queries\n */\n login?: Partial<Parameters<T[\"findFirst\"]>[0]>;\n /**\n * Options for user registration and account creation\n */\n signup?: Partial<Parameters<T[\"create\"]>[0]>;\n /**\n * Options for updating the current authenticated user's password\n */\n updatePassword?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Options for finding multiple auth actions\n */\n findManyAuthAction?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * Options for finding a single auth action\n */\n findOneAuthAction?: Partial<Parameters<T[\"findFirst\"]>[0]>;\n};\n\n/**\n * Base Prisma query options for standard CRUD operations\n * @template T - The Prisma model delegate type\n */\ntype BasePrismaQueryOptions<T extends Record<string, any>> = {\n /**\n * @deprecated Use `global` instead for general query options\n */\n queryOptions?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * Global query options that can be used for all operations\n * Replaces the deprecated queryOptions\n */\n global?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * General find options for findMany and findOne operations\n */\n find?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * General create options for createOne and createMany operations\n */\n create?: Partial<Parameters<T[\"create\"]>[0]>;\n /**\n * General update options for updateOne and updateMany operations\n */\n update?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * General delete options for deleteOne and deleteMany operations\n */\n delete?: Partial<Parameters<T[\"delete\"]>[0]>;\n /**\n * General save options for createOne, createMany, updateOne, updateMany operations\n */\n save?:\n | Partial<Parameters<T[\"create\"]>[0]>\n | Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Save options for single record operations (createOne, updateOne)\n */\n saveOne?:\n | Partial<Parameters<T[\"create\"]>[0]>\n | Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Save options for multiple record operations (createMany, updateMany)\n */\n saveMany?:\n | Partial<Parameters<T[\"createMany\"]>[0]>\n | Partial<Parameters<T[\"updateMany\"]>[0]>;\n /**\n * Options for finding a single record (first match)\n */\n findOne?: Partial<Parameters<T[\"findFirst\"]>[0]>;\n /**\n * Options for finding multiple records\n */\n findMany?: Partial<Parameters<T[\"findMany\"]>[0]>;\n /**\n * Options for creating a single record\n */\n createOne?: Partial<Parameters<T[\"create\"]>[0]>;\n /**\n * Options for creating multiple records\n */\n createMany?: Partial<Parameters<T[\"createMany\"]>[0]>;\n /**\n * Options for updating a single record\n */\n updateOne?: Partial<Parameters<T[\"update\"]>[0]>;\n /**\n * Options for updating multiple records\n */\n updateMany?: Partial<Parameters<T[\"updateMany\"]>[0]>;\n /**\n * Options for deleting a single record\n */\n deleteOne?: Partial<Parameters<T[\"delete\"]>[0]>;\n /**\n * Options for deleting multiple records\n */\n deleteMany?: Partial<Parameters<T[\"deleteMany\"]>[0]>;\n};\n\n/**\n * Type definition for Prisma query operations with flexible options\n * Conditionally provides auth-specific options when ModelName is \"auth\"\n * @template T - The Prisma model delegate type\n * @template ModelName - The model name (defaults to string for standard models)\n */\nexport type PrismaQueryOptions<\n T extends Record<string, any>,\n ModelName extends string = string,\n> = ModelName extends \"auth\"\n ? AuthPrismaQueryOptions<T>\n : BasePrismaQueryOptions<T>;\n/**\n * Interface defining the minimum structure required for Prisma model delegates\n * This allows us to constraint TModel without requiring Prisma imports\n */\nexport type PrismaModelDelegate = {\n create: (args: { data: never; [key: string]: never }) => Promise<any>;\n createMany: (args: { data: never; [key: string]: never }) => Promise<any>;\n findMany: (args: { [key: string]: never }) => Promise<any[]>;\n findFirst: (args: { where: never; [key: string]: never }) => Promise<any>;\n findUnique: (args: { where: never; [key: string]: never }) => Promise<any>;\n update: (args: {\n where: never;\n data: never;\n [key: string]: never;\n }) => Promise<any>;\n updateMany: (args: {\n where: never;\n data: never;\n [key: string]: never;\n }) => Promise<any>;\n delete: (args: { where: never; [key: string]: never }) => Promise<any>;\n deleteMany: (args: { where: never; [key: string]: never }) => Promise<any>;\n count: (args: { where: never; [key: string]: never }) => Promise<number>;\n};\n\nexport interface UserRole {\n id: string;\n createdAt: Date;\n deletedAt?: Date;\n roleId: string;\n role: AuthRole;\n user: User;\n userId: string;\n}\n\nexport interface AuthRole {\n id: string;\n createdAt: Date;\n deletedAt?: Date;\n name: string;\n permissions: AuthPermission[];\n userRoles: UserRole[];\n}\n\nexport enum AuthPermissionAction {\n Create = \"Create\",\n View = \"View\",\n Update = \"Update\",\n Delete = \"Delete\",\n}\n\nexport interface AuthPermission {\n id: string;\n createdAt: Date;\n deletedAt?: Date;\n resource: string;\n action: AuthPermissionAction;\n roleId: string;\n role: AuthRole;\n}\n\nexport interface User {\n id: string;\n isStaff: boolean;\n isSuperUser: boolean;\n password: string;\n passwordChangedAt?: Date;\n deletedSelfAccountAt: Date;\n isActive: boolean;\n roles?: UserRole[] | any[];\n role?: UserRole | any;\n}\n\nexport interface ArkosRequest<\n P extends Record<string, any> = any,\n ResBody = any,\n ReqBody = any,\n Query extends Record<string, any> = any,\n> extends Request<P, ResBody, ReqBody, Query> {\n /**\n * Authenticated user with additional fields\n */\n user?: User & Record<string, any>;\n\n /**\n * Fields to include in relational queries\n */\n relationFields?: Record<string, boolean>;\n\n /**\n * Prisma include options for related data\n */\n include?: Record<string, any>;\n\n /**\n * Data to be sent in the response\n */\n responseData?: Record<string, any> | null;\n\n /**\n * Additional context data\n */\n additionalData?: Record<string, any> | null;\n\n /**\n * HTTP status code for the response\n */\n responseStatus?: number;\n\n /**\n * Typed request body\n */\n body: ReqBody;\n\n /**\n * Prisma query options (where, orderBy, select, etc.)\n */\n prismaQueryOptions?: Record<string, any>;\n\n /**\n * Typed query parameters\n */\n query: Query;\n\n /**\n * JWT token used in authentication process\n */\n accessToken?: string;\n\n /**\n * Query parameters after being handled and transformed by middleware\n */\n transformedQuery?: Record<string, any>;\n\n /**\n * Processed filters from APIFeatures.filters\n */\n filters?: Record<string, any>;\n\n /**\n * Name of the Prisma model being queried\n */\n modelName?: string;\n}\n\nexport interface ArkosResponse<\n ResBody = any,\n Locals extends Record<string, any> = Record<string, any>,\n> extends Response<ResBody, Locals> {}\n\nexport interface ArkosNextFunction extends NextFunction {}\n\nexport interface ArkosRequestHandler<\n P extends Record<string, any> = any,\n ResBody = any,\n ReqBody = any,\n ReqQuery = qs.ParsedQs,\n Locals extends Record<string, any> = Record<string, any>,\n> extends RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals> {}\n\nexport interface ArkosErrorRequestHandler<\n P extends Record<string, any> = any,\n ResBody = any,\n ReqBody = any,\n ReqQuery = qs.ParsedQs,\n Locals extends Record<string, any> = Record<string, any>,\n> extends ErrorRequestHandler<P, ResBody, ReqBody, ReqQuery, Locals> {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"new-arkos-config.js","sourceRoot":"","sources":["../../../src/types/new-arkos-config.ts"],"names":[],"mappings":"","sourcesContent":["import cors from \"cors\";\nimport express from \"express\";\nimport { Options as RateLimitOptions } from \"express-rate-limit\";\nimport cookieParser from \"cookie-parser\";\nimport compression from \"compression\";\nimport { Options as QueryParserOptions } from \"../utils/helpers/query-parser.helpers\";\nimport { ValidatorOptions } from \"class-validator\";\nimport { MsDuration } from \"../modules/auth/utils/helpers/auth.controller.helpers\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport type { ApiReferenceConfiguration } from \"@scalar/express-api-reference\" with { \"resolution-mode\": \"import\" };\nimport nodemailer from \"nodemailer\";\nimport { ModuleComponents } from \"../utils/dynamic-loader\";\nimport { ArkosRequestHandler } from \".\";\n\n/**\n * Defines the initial configs of the api to be loaded at startup when arkos.init() is called.\n */\nexport type ArkosConfig = {\n /**\n * Allows to configure request configs\n */\n request?: {\n /**\n * Allows to configure request parameters\n */\n parameters?: {\n /**\n * Toggles allowing `VERY DANGEROUS` request paramateres under `req.query` for passing prisma query options.\n *\n * See more\n */\n allowDangerousPrismaQueryOptions?: boolean;\n };\n };\n /** Message you would like to send, as Json and 200 response when\n * ```curl\n * GET /api\n * ```\n *\n * ```json\n * { \"message\": \"Welcome to YourAppName\" }\n * ```\n *\n * default message is: Welcome to our Rest API generated by Arkos, find more about Arkos at www.arkosjs.com.\n *\n *\n * */\n welcomeMessage?: string;\n /**\n * Port where the application will run, can be set in 3 ways:\n *\n * 1. default is 8000\n * 2. PORT under environment variables (Lower precedence)\n * 3. this config option (Higher precedence)\n */\n port?: number | undefined;\n /**\n * Allows to listen on a different host than localhost only\n */\n host?: string;\n /**\n * Defines authentication related configurations, by default is undefined.\n *\n * See [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for details.\n */\n authentication?: {\n enabled?: boolean;\n /**\n * Defines whether to use Static or Dynamic Role-Based Acess Control\n *\n * Visit [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for more details.\n */\n mode: \"static\" | \"dynamic\";\n /**\n * Defines auth login related configurations to customize the api.\n */\n login?: {\n /**\n * Defines the field that will be used as username by the built-in auth system, by default arkos will look for the field \"username\" in your model User, hence when making login for example you must send:\n *\n * ```json\n * {\n * \"username\": \"johndoe\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n *\n * **Note:** You can also modify the usernameField on the fly by passing it to the request query parameters. example:\n *\n * ```curl\n * POST /api/auth/login?usernameField=email\n * ```\n *\n * See more at [www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds](https://www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds)\n *\n * By specifing here another field for username, for example passing \"email\", \"companyCode\" or something else your json will be like:\n *\n * **Example with email**\n *\n * ```json\n * {\n * \"email\": \"john.doe@example.com\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n */\n allowedUsernames?: string[];\n /** Defines wether to send the access token in response after login or only send as cookie, defeault is both.*/\n sendAccessTokenThrough?: \"cookie-only\" | \"response-only\" | \"both\";\n };\n /**\n * Specifies the regex pattern used by the authentication system to enforce password strength requirements.\n *\n * **Important**: If using validation libraries like Zod or class-validator, this will be completely overwritten.\n *\n * **Default**: ```/^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).+$/``` - Ensures the password contains at least one uppercase letter, one lowercase letter, and one numeric digit.\n *\n * **message**: (Optional) A custom error message to display when the password does not meet the required strength criteria.\n */\n passwordValidation?: { regex: RegExp; message?: string };\n /**\n * Allows to specify the request rate limit for all authentication endpoints but `/api/users/me`.\n * \n * #### Default\n *{\n windowMs: 5000,\n limit: 10,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n *@see This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n rateLimit?: Partial<RateLimitOptions>;\n /**\n * JWT (JSON Web Token) authentication configuration.\n *\n * You can override these values directly in code, or use environment variables:\n *\n * - `JWT_SECRET`: Secret used to sign and verify JWT tokens.\n * - `JWT_EXPIRES_IN`: Duration string or number indicating when the token should expire (e.g. \"30d\", 3600).\n * - `JWT_COOKIE_SECURE`: Whether the cookie is sent only over HTTPS. Default: `true` in production.\n * - `JWT_COOKIE_HTTP_ONLY`: Whether the cookie is HTTP-only. Default: `true`.\n * - `JWT_COOKIE_SAME_SITE`: Can be \"lax\", \"strict\", or \"none\". Defaults to \"lax\" in dev, \"none\" in prod.\n *\n * ⚠️ Values passed here take precedence over environment variables.\n */\n jwt?: {\n /** Secret key used for signing and verifying JWT tokens */\n secret?: string;\n /**\n * Duration after which the JWT token expires.\n * Accepts either a duration string (e.g. \"30d\", \"1h\") or a number in milliseconds.\n * Defaults to \"30d\" if not provided.\n */\n expiresIn?: MsDuration | number;\n\n /**\n * Configuration for the JWT cookie sent to the client\n */\n cookie?: {\n /**\n * Whether the cookie should be marked as secure (sent only over HTTPS).\n * Defaults to `true` in production and `false` in development.\n */\n secure?: boolean;\n\n /**\n * Whether the cookie should be marked as HTTP-only.\n * Default is `true` to prevent access via JavaScript.\n */\n httpOnly?: boolean;\n\n /**\n * Controls the SameSite attribute of the cookie.\n * Defaults to \"none\" in production and \"lax\" in development.\n * Options: \"lax\" | \"strict\" | \"none\"\n */\n sameSite?: \"lax\" | \"strict\" | \"none\";\n };\n };\n };\n /** Allows to customize and toggle the built-in validation, by default it is set to `false`. If true is passed it will use validation with the default resolver set to `class-validator` if you intend to change the resolver to `zod` do the following:\n *\n *```ts\n * // src/app.ts\n * import arkos from 'arkos'\n *\n * arkos.init({\n * validation: {\n * resolver: \"zod\"\n * }\n * })\n * ```\n *\n * @See [www.arkosjs.com/docs/core-concepts/request-data-validation](https://www.arkosjs.com/docs/core-concepts/request-data-validation) for more details.\n */\n validation?: {\n /**\n * Defines whether to use strict request validation, it means in every request using `ArkosRouter()` you must pass the validation options with all options (e.g: query, params, body, etc.).\n *\n * **How It Works:**\n * - If it is true, Arkos will require all the options a stated above on the routes and if you don't pass it will throw an error.\n * **What if you don't want to pass a validator to some options?**\n * - You will need to pass `undefined` to the validator option (see example below), this way Arkos will throw an error if something is passed to `req.query` if you passed undefined as validator into `validation.query`\n *\n * ```ts\n * import { ArkosRouter } from \"arkos\"\n *\n * const router = ArkosRouter()\n *\n * router.get({\n * route: \"/api/posts\",\n * validation: {\n * query: undefined\n * }\n * })\n *\n * ```\n */\n strict?: boolean;\n } & (\n | {\n resolver: \"class-validator\";\n /**\n * ValidatorOptions to used while validating request data.\n *\n * **Default**:\n * ```ts\n * {\n * whitelist: true\n * }\n * ```\n */\n validationOptions?: ValidatorOptions;\n }\n | {\n resolver: \"zod\";\n validationOptions?: Record<string, any>;\n }\n );\n /**\n * Defines file upload configurations\n *\n * See [www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations](https://www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations)\n */\n fileUpload?: {\n /**\n * Defiens the base file upload directory, default is set to /uploads (on root directory)\n *\n * When setting up a path dir always now that root directory will be the starting reference.\n *\n * #### Example\n * passing `../my-arkos-uploaded-files`\n *\n * Will save uploaded files one level outside the root dir inside `my-arkos-uploaded-files`\n *\n * NB: You must be aware of permissions on your server to acess files outside your project directory.\n *\n */\n baseUploadDir?: string;\n /**\n * Changes the default `/api/uploads` base route for accessing file upload route.\n *\n * #### IMPORTANT\n * Changing this will not affect the `baseUploadDir` folder. You can\n * pass here `/api/files/my-user-files` and `baseUploadDir` be `/uploaded-files`.\n *\n */\n baseRoute?: string;\n /**\n * Defines options for `express.static(somePath, someOptions)`\n *\n * #### Default:\n *\n * ```ts\n *{\n maxAge: \"1y\",\n etag: true,\n lastModified: true,\n dotfiles: \"ignore\",\n fallthrough: true,\n index: false,\n cacheControl: true,\n }\n * ```\n * \n * By passing your custom options have in mind that it\n * will be deepmerged with the default.\n * \n * Visit [https://expressjs.com/en/4x/api.html#express.static](https://expressjs.com/en/4x/api.html#express.static) for more understanding.\n * \n */\n expressStatic?: Parameters<typeof express.static>[1];\n /**\n * Defines upload restrictions for each file type: image, video, document or other.\n *\n * #### Important:\n * Passing an object without overriding everything will only cause it\n * to be deepmerged with the default options.\n *\n * See [www.arkosjs.com/docs/api-reference/default-supported-upload-files](https://www.arkosjs.com/docs/api-reference/default-supported-upload-files) for detailed explanation about default values.\n * ```\n */\n restrictions?: {\n images?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n videos?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n documents?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n files?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n };\n };\n /**\n * Defines express middlewares configurations\n */\n middlewares?: {\n /**\n * Allows to define options for npm package compression\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/compression](https://www.npmjs.com/package/compression) for further details.\n */\n compression?: false | compression.CompressionOptions | ArkosRequestHandler;\n /**\n * Allows to specify the request rate limit for all endpoints.\n * \n * #### Default\n *```ts\n *{\n windowMs: 60 * 1000,\n limit: 1000,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n ```\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n * This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n rateLimit?: false | Partial<RateLimitOptions> | ArkosRequestHandler;\n /**\n * Configuration for CORS (Cross-Origin Resource Sharing).\n *\n * @property {string | string[] | \"all\"} [allowedOrigins] - List of allowed origins. If set to `\"all\"`, all origins are accepted.\n * @property {import('cors').CorsOptions} [options] - Additional CORS options passed directly to the `cors` middleware.\n * @property {import('cors').CorsOptionsDelegate} [customHandler] - A custom middleware function that overrides the default behavior.\n *\n * @remarks\n * If `customHandler` is provided, both `allowedOrigins` and `options` will be ignored in favor of the custom logic.\n *\n * See https://www.npmjs.com/package/cors\n */\n cors?:\n | false\n | {\n /**\n * Defines allowed origins to acess the API.\n */\n allowedOrigins?: string | string[] | \"*\";\n options?: cors.CorsOptions;\n /**\n * If you would like to override the entire middleware\n *\n * see\n */\n customHandler?: cors.CorsOptionsDelegate;\n }\n | ArkosRequestHandler;\n /**\n * Defines options for the built-in express.json() middleware\n * Nothing is passed by default.\n */\n expressJson?:\n | false\n | Parameters<typeof express.json>[0]\n | ArkosRequestHandler;\n /**\n * Allows to pass paremeters to cookieParser from npm package cookie-parser\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/cookie-parser](https://www.npmjs.com/package/cookie-parser) for further details.\n */\n cookieParser?:\n | false\n | Parameters<typeof cookieParser>\n | ArkosRequestHandler;\n /**\n * Options to define how query must be parsed.\n *\n * #### for example:\n * ```\n * GET /api/product?saleId=null\n * ```\n *\n * Normally would parsed to { saleId: \"null\" } so query parser\n * trough setting option `parseNull` will transform { saleId: null }\n * \n * #### Default:\n * \n * {\n parseNull: true,\n parseUndefined: true,\n parseBoolean: true,\n parseNumber: true,\n }\n * \n * parseNumber may convert fields that are string but you only passed\n * numbers to query pay attention to this.\n * \n * Soon a feature to converted the query to the end prisma type will be added.\n */\n queryParser?: false | QueryParserOptions | ArkosRequestHandler;\n /**\n * Configuration for request logger middleware.\n *\n * Logs incoming HTTP requests with details such as method, URL, status code, and response time.\n * Useful for debugging and monitoring API traffic.\n */\n requestLogger?: false | ArkosRequestHandler;\n /**\n * Configuration for global error handler middleware.\n *\n * Catches and processes errors thrown in route handlers and other middlewares.\n * Provides a centralized way to format error responses and log errors.\n */\n errorHandler?: false | express.ErrorRequestHandler;\n };\n /**\n * Defines express/arkos routers configurations\n */\n routers?: {\n /**\n * Strict mode configuration for routing security\n *\n * @default false\n * - all CRUD + Auth (if using auth) endpoits are enabled and avialable by default.\n *\n * When enabled:\n * - If `true`: All CRUD endpoints start disabled and must be explicitly enabled\n * in each model's router configuration\n * - If `'no-bulk'`: Bulk operations (createMany, updateMany, deleteMany) are disabled\n * by default, while individual operations can be enabled per model\n *\n * This provides enhanced security by ensuring no routes are accidentally exposed.\n * Use this in production environments to follow the principle of least privilege.\n *\n * See documentation: https://www.arkosjs.com/docs/guide/security#strict-mode\n */\n strict?: boolean | \"no-bulk\";\n /**\n * Replace the default welcome endpoint handler\n * @param req Express request object\n * @param res Express response object\n * @param next Express next function\n */\n welcomeRoute?: false | ArkosRequestHandler;\n };\n /**\n * Allows to configure email configurations for sending emails through `emailService`\n *\n * See [www.arkosjs.com/docs/core-concepts/sending-emails](https://www.arkosjs.com/docs/core-concepts/sending-emails)\n */\n email?: {\n /**\n * Email name to used like:\n *\n * John Doe\\<john.doe@gmail.com>\n */\n name?: string;\n /**\n * Your email provider url\n */\n host: string;\n /**\n * Email provider SMTP port, Default is `465`\n */\n port?: number;\n /**\n * If smtp connection must be secure, Default is `true`\n */\n secure?: boolean;\n /**\n * Used to authenticate in your smtp server\n */\n auth: {\n /**\n * Email used for auth as well as sending emails\n */\n user: string;\n /**\n * Your SMTP password\n */\n pass: string;\n };\n } & Parameters<typeof nodemailer.createTransport>[0];\n /**\n * Defines Swagger and OpenApi specifications for auto generating swagger documentation UI using whether it is Prisma Schemas, Class-validator DTOs, Zod Schemas or JSON-Schemas.\n *\n * **Important**: Is worth mentioning that this works alongside `@scalar/express-api-reference` npm package, you define it's ApiReferenceConfiguration under ``. also consider checking the package documentation at []\n *\n * **Usage**\n *\n * ```ts\n * // src/app.ts\n *\n * import arkos from \"arkos\"\n *\n * arkos.init({\n * // other configs\n * swagger: {\n * mode: \"zod\",\n * options: {\n * defintion: {\n * info: {\n * openapi: \"3.0.0\",\n * title: \"API Generated By Arkos.js\",\n * description: \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n * }\n * }\n * }\n * }\n * })\n * ```\n * @see {@link https://www.arkosjs.com/docs/core-concepts/swagger-api-documentation}\n */\n swagger?: {\n /**\n * By default Arkos will disable API Documentation when the project is built `npm run build`, it does not matter what node environment is set. If you want to use it even after the `arkos build` command just set this to `true`.\n * */\n enableAfterBuild?: boolean;\n /**\n * Endpoint where the Swagger UI will be available.\n *\n * @default \"/api/api-docs\"\n */\n endpoint?: string;\n /**\n * Determines how your API schemas should be generated.\n *\n * - \"prisma\": Generates schemas based on Prisma models\n * - \"class-validator\": Uses class-validator and class-transformer DTO classes\n * - \"zod\": Uses OpenAPI-compliant schemas directly\n */\n mode: \"prisma\" | \"class-validator\" | \"zod\";\n /**\n * Allows `Arkos.js` to fallback to prisma schema and use them as json schema for defining request body and response data\n * when a given zod Schema or class-validator Class is not found to be transformed to json schema.\n *\n * @default false\n */\n strict?: boolean;\n /**\n * Defines your swagger configurations\n */\n options?: {\n /**\n * Swagger definition according to OpenAPI Specification.\n */\n definition?: {\n /**\n * OpenAPI version.\n *\n * @default \"3.0.0\"\n */\n openapi?: string;\n\n /**\n * Information about your API.\n */\n info?: {\n /**\n * Title of the API documentation.\n *\n *\n * @example \"My API\"\n *\n * @default \"API Generated By Arkos.js\"\n */\n title?: string;\n\n /**\n * Version of the API.\n *\n * @example \"1.0.0\"\n */\n version?: string;\n\n /**\n * Description of the API.\n *\n * @default \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n */\n description?: string;\n };\n\n /**\n * Server configurations for the API.\n *\n * @default [{ url: \"http://localhost:8000\", description: \"Development server\" }]\n *\n * This can be overridden automatically by Arkos based on CLI, .env, or `arkos.init()`.\n */\n servers?: {\n /**\n * Base URL of the server.\n *\n * @example \"http://localhost:8000\"\n */\n url: string;\n\n /**\n * Human-readable description of the server.\n *\n * @example \"Development Server\"\n */\n description?: string;\n }[];\n /**\n * Allows adding more paths for your OpenAPI documentation\n *\n * */\n paths?: OpenAPIV3.PathsObject;\n /**\n * (Optional) Additional metadata such as terms of service, contact, or license.\n *\n * See: https://swagger.io/specification/#infoObject\n */\n termsOfService?: string;\n contact?: {\n name?: string;\n url?: string;\n email?: string;\n };\n license?: {\n name: string;\n url?: string;\n };\n\n /**\n * Tags to group and describe endpoints.\n */\n tags?: {\n name: string;\n description?: string;\n }[];\n\n /**\n * Security definitions (e.g., Bearer Auth).\n */\n components?: {\n securitySchemes?: Record<string, any>;\n schemas?: Record<string, any>;\n };\n\n /**\n * Global security requirements.\n */\n security?: Array<Record<string, string[]>>;\n };\n\n /**\n * Glob patterns defining where Swagger should look for API route definitions and comments.\n *\n * @default \n * ```ts\n * [\"./src/routers/*.router.{ts,js}\", \"./src/modules/**\\/*.router.{ts,js}\"]\n ```\n *\n * Adjust depending on TypeScript or JavaScript usage.\n */\n apis?: string[];\n\n /**\n * Enables deep linking in the Swagger UI.\n *\n * @default true\n */\n deepLinking?: boolean;\n\n /**\n * Enable/disable the \"Try it out\" button globally.\n *\n * @default true\n */\n tryItOutEnabled?: boolean;\n\n /**\n * Whether to persist authorization data across page reloads.\n *\n * @default false\n */\n persistAuthorization?: boolean;\n };\n /**\n * Custom `@scalar/express-api-reference` package options.\n *\n * @see {@link https://guides.scalar.com/scalar/scalar-api-references/integrations/express}\n */\n scalarApiReferenceConfiguration?: Partial<ApiReferenceConfiguration>;\n };\n /**\n * Helps in debugging some of the variables values that are used inside arkos from dynamic loaded components towhat is used into the generated api.\n *\n */\n debugging?: {\n /**\n * Controls debugging over HTTP request level\n */\n requests?: {\n level?: 0 | 1 | 2 | 3;\n filter?: (\n | \"Query\"\n | \"Body\"\n | \"Params\"\n | \"TransformedQuery\"\n | \"ServiceArgs\"\n | \"FinalPrismaQueryArgs\"\n )[];\n };\n /**\n * Controls debugging over the dynamic loaded modules and it's components on app starting\n */\n dynamicLoader?: {\n /**\n * Adjusts logging details\n *\n * 1 - Loaded modules and list of it's components files\n * 2 - All from 1 and detailed inspection per module component\n * 3 - All from 1 and 2, plus the final router component after merged with autho generated router.\n */\n level?: 0 | 1 | 2 | 3;\n filters?: {\n /**\n * Allows filtering by specific modules.\n *\n * Supports only searching for the starting parts of the module name, e.g: If there is`user-profile`, `user`, `posts`, passing `[\"user\"]` will match both `user-profile` and `user`.\n */\n modules?: string[];\n /**\n * Allows filtering by component's names\n */\n components?: keyof ModuleComponents[];\n };\n };\n };\n};\n"]}
1
+ {"version":3,"file":"new-arkos-config.js","sourceRoot":"","sources":["../../../src/types/new-arkos-config.ts"],"names":[],"mappings":"","sourcesContent":["import cors from \"cors\";\nimport express from \"express\";\nimport { Options as RateLimitOptions } from \"express-rate-limit\";\nimport cookieParser from \"cookie-parser\";\nimport compression from \"compression\";\nimport { Options as QueryParserOptions } from \"../utils/helpers/query-parser.helpers\";\nimport { ValidatorOptions } from \"class-validator\";\nimport { MsDuration } from \"../modules/auth/utils/helpers/auth.controller.helpers\";\nimport { OpenAPIV3 } from \"openapi-types\";\nimport type { ApiReferenceConfiguration } from \"@scalar/express-api-reference\" with { \"resolution-mode\": \"import\" };\nimport nodemailer from \"nodemailer\";\nimport { ModuleComponents } from \"../utils/dynamic-loader\";\nimport { ArkosRequestHandler } from \".\";\n\n/**\n * Defines the initial configs of the api to be loaded at startup when arkos.init() is called.\n */\nexport type ArkosConfig = {\n /**\n * Allows to configure request configs\n */\n request?: {\n /**\n * Allows to configure request parameters\n */\n parameters?: {\n /**\n * Toggles allowing `VERY DANGEROUS` request paramateres under `req.query` for passing prisma query options.\n *\n * See more\n */\n allowDangerousPrismaQueryOptions?: boolean;\n };\n };\n /** Message you would like to send, as Json and 200 response when\n * ```curl\n * GET /api\n * ```\n *\n * ```json\n * { \"message\": \"Welcome to YourAppName\" }\n * ```\n *\n * default message is: Welcome to our Rest API generated by Arkos, find more about Arkos at www.arkosjs.com.\n *\n *\n * */\n welcomeMessage?: string;\n /**\n * Port where the application will run, can be set in 3 ways:\n *\n * 1. default is 8000\n * 2. PORT under environment variables (Lower precedence)\n * 3. this config option (Higher precedence)\n */\n port?: number | undefined;\n /**\n * Allows to listen on a different host than localhost only\n */\n host?: string;\n /**\n * Defines authentication related configurations, by default is undefined.\n *\n * See [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for details.\n */\n authentication?: {\n enabled?: boolean;\n /**\n * Defines whether to use Static or Dynamic Role-Based Acess Control\n *\n * Visit [www.arkosjs.com/docs/core-concepts/authentication-system](https://www.arkosjs.com/docs/core-concepts/authentication-system) for more details.\n */\n mode: \"static\" | \"dynamic\";\n /**\n * Defines auth login related configurations to customize the api.\n */\n login?: {\n /**\n * Defines the field that will be used as username by the built-in auth system, by default arkos will look for the field \"username\" in your model User, hence when making login for example you must send:\n *\n * ```json\n * {\n * \"username\": \"johndoe\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n *\n * **Note:** You can also modify the usernameField on the fly by passing it to the request query parameters. example:\n *\n * ```curl\n * POST /api/auth/login?usernameField=email\n * ```\n *\n * See more at [www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds](https://www.arkosjs.com/docs/core-concepts/authentication-system#login-with-different-fileds)\n *\n * By specifing here another field for username, for example passing \"email\", \"companyCode\" or something else your json will be like:\n *\n * **Example with email**\n *\n * ```json\n * {\n * \"email\": \"john.doe@example.com\",\n * \"password\": \"somePassword123\"\n * }\n * ```\n */\n allowedUsernames?: string[];\n /** Defines wether to send the access token in response after login or only send as cookie, defeault is both.*/\n sendAccessTokenThrough?: \"cookie-only\" | \"response-only\" | \"both\";\n };\n /**\n * Specifies the regex pattern used by the authentication system to enforce password strength requirements.\n *\n * **Important**: If using validation libraries like Zod or class-validator, this will be completely overwritten.\n *\n * **Default**: ```/^(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).+$/``` - Ensures the password contains at least one uppercase letter, one lowercase letter, and one numeric digit.\n *\n * **message**: (Optional) A custom error message to display when the password does not meet the required strength criteria.\n */\n passwordValidation?: { regex: RegExp; message?: string };\n /**\n * Allows to specify the request rate limit for all authentication endpoints but `/api/users/me`.\n * \n * #### Default\n *{\n windowMs: 5000,\n limit: 10,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n *@see This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n rateLimit?: Partial<RateLimitOptions>;\n /**\n * JWT (JSON Web Token) authentication configuration.\n *\n * You can override these values directly in code, or use environment variables:\n *\n * - `JWT_SECRET`: Secret used to sign and verify JWT tokens.\n * - `JWT_EXPIRES_IN`: Duration string or number indicating when the token should expire (e.g. \"30d\", 3600).\n * - `JWT_COOKIE_SECURE`: Whether the cookie is sent only over HTTPS. Default: `true` in production.\n * - `JWT_COOKIE_HTTP_ONLY`: Whether the cookie is HTTP-only. Default: `true`.\n * - `JWT_COOKIE_SAME_SITE`: Can be \"lax\", \"strict\", or \"none\". Defaults to \"lax\" in dev, \"none\" in prod.\n *\n * ⚠️ Values passed here take precedence over environment variables.\n */\n jwt?: {\n /** Secret key used for signing and verifying JWT tokens */\n secret?: string;\n /**\n * Duration after which the JWT token expires.\n * Accepts either a duration string (e.g. \"30d\", \"1h\") or a number in milliseconds.\n * Defaults to \"30d\" if not provided.\n */\n expiresIn?: MsDuration | number;\n\n /**\n * Configuration for the JWT cookie sent to the client\n */\n cookie?: {\n /**\n * Whether the cookie should be marked as secure (sent only over HTTPS).\n * Defaults to `true` in production and `false` in development.\n */\n secure?: boolean;\n\n /**\n * Whether the cookie should be marked as HTTP-only.\n * Default is `true` to prevent access via JavaScript.\n */\n httpOnly?: boolean;\n\n /**\n * Controls the SameSite attribute of the cookie.\n * Defaults to \"none\" in production and \"lax\" in development.\n * Options: \"lax\" | \"strict\" | \"none\"\n */\n sameSite?: \"lax\" | \"strict\" | \"none\";\n };\n };\n };\n /** Allows to customize and toggle the built-in validation, by default it is set to `false`. If true is passed it will use validation with the default resolver set to `class-validator` if you intend to change the resolver to `zod` do the following:\n *\n *```ts\n * // src/app.ts\n * import arkos from 'arkos'\n *\n * arkos.init({\n * validation: {\n * resolver: \"zod\"\n * }\n * })\n * ```\n *\n * @See [www.arkosjs.com/docs/core-concepts/request-data-validation](https://www.arkosjs.com/docs/core-concepts/request-data-validation) for more details.\n */\n validation?: {\n /**\n * Defines whether to use strict request validation, it means in every request using `ArkosRouter()` you must pass the validation options with all options (e.g: query, params, body, etc.).\n *\n * **How It Works:**\n * - If it is true, Arkos will require all the options a stated above on the routes and if you don't pass it will throw an error.\n * **What if you don't want to pass a validator to some options?**\n * - You will need to pass `undefined` to the validator option (see example below), this way Arkos will throw an error if something is passed to `req.query` if you passed undefined as validator into `validation.query`\n *\n * ```ts\n * import { ArkosRouter } from \"arkos\"\n *\n * const router = ArkosRouter()\n *\n * router.get({\n * route: \"/api/posts\",\n * validation: {\n * query: undefined\n * }\n * })\n *\n * ```\n */\n strict?: boolean;\n } & (\n | {\n resolver: \"class-validator\";\n /**\n * ValidatorOptions to used while validating request data.\n *\n * **Default**:\n * ```ts\n * {\n * whitelist: true\n * }\n * ```\n */\n validationOptions?: ValidatorOptions;\n }\n | {\n resolver: \"zod\";\n validationOptions?: Record<string, any>;\n }\n );\n /**\n * Defines file upload configurations\n *\n * See [www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations](https://www.arkosjs.com/docs/core-concepts/file-upload#costum-configurations)\n */\n fileUpload?: {\n /**\n * Defiens the base file upload directory, default is set to /uploads (on root directory)\n *\n * When setting up a path dir always now that root directory will be the starting reference.\n *\n * #### Example\n * passing `../my-arkos-uploaded-files`\n *\n * Will save uploaded files one level outside the root dir inside `my-arkos-uploaded-files`\n *\n * NB: You must be aware of permissions on your server to acess files outside your project directory.\n *\n */\n baseUploadDir?: string;\n /**\n * Changes the default `/api/uploads` base route for accessing file upload route.\n *\n * #### IMPORTANT\n * Changing this will not affect the `baseUploadDir` folder. You can\n * pass here `/api/files/my-user-files` and `baseUploadDir` be `/uploaded-files`.\n *\n */\n baseRoute?: string;\n /**\n * Defines options for `express.static(somePath, someOptions)`\n *\n * #### Default:\n *\n * ```ts\n *{\n maxAge: \"1y\",\n etag: true,\n lastModified: true,\n dotfiles: \"ignore\",\n fallthrough: true,\n index: false,\n cacheControl: true,\n }\n * ```\n * \n * By passing your custom options have in mind that it\n * will be deepmerged with the default.\n * \n * Visit [https://expressjs.com/en/4x/api.html#express.static](https://expressjs.com/en/4x/api.html#express.static) for more understanding.\n * \n */\n expressStatic?: Parameters<typeof express.static>[1];\n /**\n * Defines upload restrictions for each file type: image, video, document or other.\n *\n * #### Important:\n * Passing an object without overriding everything will only cause it\n * to be deepmerged with the default options.\n *\n * See [www.arkosjs.com/docs/api-reference/default-supported-upload-files](https://www.arkosjs.com/docs/api-reference/default-supported-upload-files) for detailed explanation about default values.\n * ```\n */\n restrictions?: {\n images?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n videos?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n documents?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n files?: {\n maxCount?: number;\n maxSize?: number;\n supportedFilesRegex?: RegExp;\n };\n };\n };\n /**\n * Defines express middlewares configurations\n */\n middlewares?: {\n /**\n * Allows to define options for npm package compression\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/compression](https://www.npmjs.com/package/compression) for further details.\n */\n compression?: false | compression.CompressionOptions | ArkosRequestHandler;\n /**\n * Allows to specify the request rate limit for all endpoints.\n * \n * #### Default\n *```ts\n *{\n windowMs: 60 * 1000,\n limit: 1000,\n standardHeaders: \"draft-7\",\n legacyHeaders: false,\n }\n ```\n * \n * Passing an object not overriding all the default options will only\n * cause it to be deepmerged and not actually replace with empty fields\n * \n * This is are the options used on the `express-rate-limit` npm package used on epxress. read more about [https://www.npmjs.com/package/express-rate-limit](https://www.npmjs.com/package/express-rate-limit)\n */\n rateLimit?: false | Partial<RateLimitOptions> | ArkosRequestHandler;\n /**\n * Configuration for CORS (Cross-Origin Resource Sharing).\n *\n * @property {string | string[] | \"all\"} [allowedOrigins] - List of allowed origins. If set to `\"all\"`, all origins are accepted.\n * @property {import('cors').CorsOptions} [options] - Additional CORS options passed directly to the `cors` middleware.\n * @property {import('cors').CorsOptionsDelegate} [customHandler] - A custom middleware function that overrides the default behavior.\n *\n * @remarks\n * If `customHandler` is provided, both `allowedOrigins` and `options` will be ignored in favor of the custom logic.\n *\n * See https://www.npmjs.com/package/cors\n */\n cors?:\n | false\n | {\n /**\n * Defines allowed origins to acess the API.\n */\n allowedOrigins?: string | string[] | \"*\";\n options?: cors.CorsOptions;\n /**\n * If you would like to override the entire middleware\n *\n * see\n */\n customHandler?: cors.CorsOptionsDelegate;\n }\n | ArkosRequestHandler;\n /**\n * Defines options for the built-in express.json() middleware\n * Nothing is passed by default.\n */\n expressJson?:\n | false\n | Parameters<typeof express.json>[0]\n | ArkosRequestHandler;\n /**\n * Allows to pass paremeters to cookieParser from npm package cookie-parser\n * Nothing is passed by default.\n *\n * See [www.npmjs.com/package/cookie-parser](https://www.npmjs.com/package/cookie-parser) for further details.\n */\n cookieParser?:\n | false\n | Parameters<typeof cookieParser>\n | ArkosRequestHandler;\n /**\n * Options to define how query must be parsed.\n *\n * #### for example:\n * ```\n * GET /api/product?saleId=null\n * ```\n *\n * Normally would parsed to { saleId: \"null\" } so query parser\n * trough setting option `parseNull` will transform { saleId: null }\n * \n * #### Default:\n * \n * {\n parseNull: true,\n parseUndefined: true,\n parseBoolean: true,\n parseNumber: true,\n }\n * \n * parseNumber may convert fields that are string but you only passed\n * numbers to query pay attention to this.\n * \n * Soon a feature to converted the query to the end prisma type will be added.\n */\n queryParser?: false | QueryParserOptions | ArkosRequestHandler;\n /**\n * Configuration for request logger middleware.\n *\n * Logs incoming HTTP requests with details such as method, URL, status code, and response time.\n * Useful for debugging and monitoring API traffic.\n */\n requestLogger?: false | ArkosRequestHandler;\n /**\n * Configuration for global error handler middleware.\n *\n * Catches and processes errors thrown in route handlers and other middlewares.\n * Provides a centralized way to format error responses and log errors.\n */\n errorHandler?: false | express.ErrorRequestHandler;\n };\n /**\n * Defines express/arkos routers configurations\n */\n routers?: {\n /**\n * Strict mode configuration for routing security\n *\n * @default false\n * - all CRUD + Auth (if using auth) endpoits are enabled and avialable by default.\n *\n * When enabled:\n * - If `true`: All CRUD endpoints start disabled and must be explicitly enabled\n * in each model's router configuration\n * - If `'no-bulk'`: Bulk operations (createMany, updateMany, deleteMany) are disabled\n * by default, while individual operations can be enabled per model\n *\n * This provides enhanced security by ensuring no routes are accidentally exposed.\n * Use this in production environments to follow the principle of least privilege.\n *\n * See documentation: https://www.arkosjs.com/docs/guide/security#strict-mode\n */\n strict?: boolean | \"no-bulk\";\n /**\n * Replace the default welcome endpoint handler\n * @param req Express request object\n * @param res Express response object\n * @param next Express next function\n */\n welcomeRoute?: false | ArkosRequestHandler;\n };\n /**\n * Allows to configure email configurations for sending emails through `emailService`\n *\n * See [www.arkosjs.com/docs/core-concepts/sending-emails](https://www.arkosjs.com/docs/core-concepts/sending-emails)\n */\n email?: {\n /**\n * Email name to used like:\n *\n * John Doe\\<john.doe@gmail.com>\n */\n name?: string;\n /**\n * Your email provider url\n */\n host: string;\n /**\n * Email provider SMTP port, Default is `465`\n */\n port?: number;\n /**\n * If smtp connection must be secure, Default is `true`\n */\n secure?: boolean;\n /**\n * Used to authenticate in your smtp server\n */\n auth: {\n /**\n * Email used for auth as well as sending emails\n */\n user: string;\n /**\n * Your SMTP password\n */\n pass: string;\n };\n } & Parameters<typeof nodemailer.createTransport>[0];\n /**\n * Defines Swagger and OpenApi specifications for auto generating swagger documentation UI using whether it is Prisma Schemas, Class-validator DTOs, Zod Schemas or JSON-Schemas.\n *\n * **Important**: Is worth mentioning that this works alongside `@scalar/express-api-reference` npm package, you define it's ApiReferenceConfiguration under ``. also consider checking the package documentation at []\n *\n * **Usage**\n *\n * ```ts\n * // src/app.ts\n *\n * import arkos from \"arkos\"\n *\n * arkos.init({\n * // other configs\n * swagger: {\n * mode: \"zod\",\n * options: {\n * defintion: {\n * info: {\n * openapi: \"3.0.0\",\n * title: \"API Generated By Arkos.js\",\n * description: \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n * }\n * }\n * }\n * }\n * })\n * ```\n * @see {@link https://www.arkosjs.com/docs/core-concepts/swagger-api-documentation}\n */\n swagger?: {\n /**\n * By default Arkos will disable API Documentation when the project is built `npm run build`, it does not matter what node environment is set. If you want to use it even after the `arkos build` command just set this to `true`.\n * */\n enableAfterBuild?: boolean;\n /**\n * Endpoint where the Swagger UI will be available.\n *\n * @default \"/api/api-docs\"\n */\n endpoint?: string;\n /**\n * Determines how your API schemas should be generated.\n *\n * - \"prisma\": Generates schemas based on Prisma models\n * - \"class-validator\": Uses class-validator and class-transformer DTO classes\n * - \"zod\": Uses OpenAPI-compliant schemas directly\n */\n mode: \"prisma\" | \"class-validator\" | \"zod\";\n /**\n * Allows `Arkos.js` to fallback to prisma schema and use them as json schema for defining request body and response data\n * when a given zod Schema or class-validator Class is not found to be transformed to json schema.\n *\n * @default false\n */\n strict?: boolean;\n /**\n * Defines your swagger configurations\n */\n options?: {\n /**\n * Swagger definition according to OpenAPI Specification.\n */\n definition?: {\n /**\n * OpenAPI version.\n *\n * @default \"3.0.0\"\n */\n openapi?: string;\n\n /**\n * Information about your API.\n */\n info?: {\n /**\n * Title of the API documentation.\n *\n *\n * @example \"My API\"\n *\n * @default \"API Generated By Arkos.js\"\n */\n title?: string;\n\n /**\n * Version of the API.\n *\n * @example \"1.0.0\"\n */\n version?: string;\n\n /**\n * Description of the API.\n *\n * @default \"This API was automatically generated by Arkos.js read more about at www.arkosjs.com\"\n */\n description?: string;\n };\n\n /**\n * Server configurations for the API.\n *\n * @default [{ url: \"http://localhost:8000\", description: \"Development server\" }]\n *\n * This can be overridden automatically by Arkos based on CLI, .env, or `arkos.init()`.\n */\n servers?: {\n /**\n * Base URL of the server.\n *\n * @example \"http://localhost:8000\"\n */\n url: string;\n\n /**\n * Human-readable description of the server.\n *\n * @example \"Development Server\"\n */\n description?: string;\n }[];\n /**\n * Allows adding more paths for your OpenAPI documentation\n *\n * */\n paths?: OpenAPIV3.PathsObject;\n /**\n * (Optional) Additional metadata such as terms of service, contact, or license.\n *\n * See: https://swagger.io/specification/#infoObject\n */\n termsOfService?: string;\n contact?: {\n name?: string;\n url?: string;\n email?: string;\n };\n license?: {\n name: string;\n url?: string;\n };\n\n /**\n * Tags to group and describe endpoints.\n */\n tags?: {\n name: string;\n description?: string;\n }[];\n\n /**\n * Security definitions (e.g., Bearer Auth).\n */\n components?: {\n securitySchemes?: Record<string, any>;\n schemas?: Record<string, any>;\n };\n\n /**\n * Global security requirements.\n */\n security?: Array<Record<string, string[]>>;\n };\n\n /**\n * Glob patterns defining where Swagger should look for API route definitions and comments.\n *\n * @default \n * ```ts\n * [\"./src/routers/*.router.{ts,js}\", \"./src/modules/**\\/*.router.{ts,js}\"]\n ```\n *\n * Adjust depending on TypeScript or JavaScript usage.\n */\n apis?: string[];\n\n /**\n * Enables deep linking in the Swagger UI.\n *\n * @default true\n */\n deepLinking?: boolean;\n\n /**\n * Enable/disable the \"Try it out\" button globally.\n *\n * @default true\n */\n tryItOutEnabled?: boolean;\n\n /**\n * Whether to persist authorization data across page reloads.\n *\n * @default false\n */\n persistAuthorization?: boolean;\n };\n /**\n * Custom `@scalar/express-api-reference` package options.\n *\n * @see {@link https://guides.scalar.com/scalar/scalar-api-references/integrations/express}\n */\n scalarApiReferenceConfiguration?: Partial<ApiReferenceConfiguration>;\n };\n /**\n * Helps in debugging some of the variables values that are used inside arkos from dynamic loaded components towhat is used into the generated api.\n *\n */\n debugging?: {\n /**\n * Controls debugging over HTTP request level\n */\n requests?: {\n level?: 0 | 1 | 2 | 3;\n filter?: (\n | \"Query\"\n | \"Body\"\n | \"Params\"\n | \"TransformedQuery\"\n | \"ServiceArgs\"\n | \"PrismaFinalQueryArgs\"\n )[];\n };\n /**\n * Controls debugging over the dynamic loaded modules and it's components on app starting\n */\n dynamicLoader?: {\n /**\n * Adjusts logging details\n *\n * 1 - Loaded modules and list of it's components files\n * 2 - All from 1 and detailed inspection per module component\n * 3 - All from 1 and 2, plus the final router component after merged with autho generated router.\n */\n level?: 0 | 1 | 2 | 3;\n filters?: {\n /**\n * Allows filtering by specific modules.\n *\n * Supports only searching for the starting parts of the module name, e.g: If there is`user-profile`, `user`, `posts`, passing `[\"user\"]` will match both `user-profile` and `user`.\n */\n modules?: string[];\n /**\n * Allows filtering by component's names\n */\n components?: keyof ModuleComponents[];\n };\n };\n };\n};\n"]}