arkos 1.4.1-canary.8 → 1.5.0-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 (126) hide show
  1. package/dist/cjs/modules/auth/auth.controller.js +13 -0
  2. package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
  3. package/dist/cjs/modules/auth/auth.service.js +40 -14
  4. package/dist/cjs/modules/auth/auth.service.js.map +1 -1
  5. package/dist/cjs/modules/auth/utils/services/auth-action.service.js +1 -1
  6. package/dist/cjs/modules/auth/utils/services/auth-action.service.js.map +1 -1
  7. package/dist/cjs/modules/base/base.middlewares.js +6 -4
  8. package/dist/cjs/modules/base/base.middlewares.js.map +1 -1
  9. package/dist/cjs/modules/base/utils/error-prettifier.js +185 -0
  10. package/dist/cjs/modules/base/utils/error-prettifier.js.map +1 -0
  11. package/dist/cjs/modules/email/email.service.js +4 -1
  12. package/dist/cjs/modules/email/email.service.js.map +1 -1
  13. package/dist/cjs/modules/error-handler/error-handler.controller.js.map +1 -1
  14. package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js +9 -3
  15. package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
  16. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +27 -9
  17. package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
  18. package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +28 -11
  19. package/dist/cjs/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
  20. package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js +3 -0
  21. package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -1
  22. package/dist/cjs/types/auth.js.map +1 -1
  23. package/dist/cjs/utils/arkos-router/index.js +7 -1
  24. package/dist/cjs/utils/arkos-router/index.js.map +1 -1
  25. package/dist/cjs/utils/arkos-router/types/index.js.map +1 -1
  26. package/dist/cjs/utils/arkos-router/utils/helpers/index.js +51 -0
  27. package/dist/cjs/utils/arkos-router/utils/helpers/index.js.map +1 -1
  28. package/dist/cjs/utils/cli/generate.js +38 -0
  29. package/dist/cjs/utils/cli/generate.js.map +1 -1
  30. package/dist/cjs/utils/cli/index.js +37 -4
  31. package/dist/cjs/utils/cli/index.js.map +1 -1
  32. package/dist/cjs/utils/cli/utils/cli.helpers.js +1 -1
  33. package/dist/cjs/utils/cli/utils/template-generator/templates/auth-configs-template.js +70 -37
  34. package/dist/cjs/utils/cli/utils/template-generator/templates/auth-configs-template.js.map +1 -1
  35. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js +556 -0
  36. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js.map +1 -0
  37. package/dist/cjs/utils/cli/utils/template-generator/templates/zod-schema-generator.js +327 -0
  38. package/dist/cjs/utils/cli/utils/template-generator/templates/zod-schema-generator.js.map +1 -0
  39. package/dist/cjs/utils/cli/utils/template-generators.js +14 -8
  40. package/dist/cjs/utils/cli/utils/template-generators.js.map +1 -1
  41. package/dist/cjs/utils/dynamic-loader.js +2 -2
  42. package/dist/cjs/utils/dynamic-loader.js.map +1 -1
  43. package/dist/cjs/utils/helpers/routers.helpers.js +2 -3
  44. package/dist/cjs/utils/helpers/routers.helpers.js.map +1 -1
  45. package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +5 -5
  46. package/dist/cjs/utils/prisma/prisma-json-schema-generator.js.map +1 -1
  47. package/dist/esm/modules/auth/auth.controller.js +13 -0
  48. package/dist/esm/modules/auth/auth.controller.js.map +1 -1
  49. package/dist/esm/modules/auth/auth.service.js +40 -14
  50. package/dist/esm/modules/auth/auth.service.js.map +1 -1
  51. package/dist/esm/modules/auth/utils/services/auth-action.service.js +1 -1
  52. package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
  53. package/dist/esm/modules/base/base.middlewares.js +6 -4
  54. package/dist/esm/modules/base/base.middlewares.js.map +1 -1
  55. package/dist/esm/modules/base/utils/error-prettifier.js +181 -0
  56. package/dist/esm/modules/base/utils/error-prettifier.js.map +1 -0
  57. package/dist/esm/modules/email/email.service.js +4 -1
  58. package/dist/esm/modules/email/email.service.js.map +1 -1
  59. package/dist/esm/modules/error-handler/error-handler.controller.js.map +1 -1
  60. package/dist/esm/modules/error-handler/utils/error-handler.helpers.js +9 -3
  61. package/dist/esm/modules/error-handler/utils/error-handler.helpers.js.map +1 -1
  62. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +27 -9
  63. package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js.map +1 -1
  64. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js +28 -11
  65. package/dist/esm/modules/swagger/utils/helpers/get-file-upload-json-schema-paths.js.map +1 -1
  66. package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js +3 -0
  67. package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js.map +1 -1
  68. package/dist/esm/types/auth.js.map +1 -1
  69. package/dist/esm/utils/arkos-router/index.js +8 -2
  70. package/dist/esm/utils/arkos-router/index.js.map +1 -1
  71. package/dist/esm/utils/arkos-router/types/index.js.map +1 -1
  72. package/dist/esm/utils/arkos-router/utils/helpers/index.js +50 -0
  73. package/dist/esm/utils/arkos-router/utils/helpers/index.js.map +1 -1
  74. package/dist/esm/utils/cli/generate.js +38 -0
  75. package/dist/esm/utils/cli/generate.js.map +1 -1
  76. package/dist/esm/utils/cli/index.js +37 -4
  77. package/dist/esm/utils/cli/index.js.map +1 -1
  78. package/dist/esm/utils/cli/utils/cli.helpers.js +1 -1
  79. package/dist/esm/utils/cli/utils/template-generator/templates/auth-configs-template.js +70 -37
  80. package/dist/esm/utils/cli/utils/template-generator/templates/auth-configs-template.js.map +1 -1
  81. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js +549 -0
  82. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator-dto-generator.js.map +1 -0
  83. package/dist/esm/utils/cli/utils/template-generator/templates/zod-schema-generator.js +320 -0
  84. package/dist/esm/utils/cli/utils/template-generator/templates/zod-schema-generator.js.map +1 -0
  85. package/dist/esm/utils/cli/utils/template-generators.js +14 -8
  86. package/dist/esm/utils/cli/utils/template-generators.js.map +1 -1
  87. package/dist/esm/utils/dynamic-loader.js +2 -2
  88. package/dist/esm/utils/dynamic-loader.js.map +1 -1
  89. package/dist/esm/utils/helpers/routers.helpers.js +2 -3
  90. package/dist/esm/utils/helpers/routers.helpers.js.map +1 -1
  91. package/dist/esm/utils/prisma/prisma-json-schema-generator.js +5 -5
  92. package/dist/esm/utils/prisma/prisma-json-schema-generator.js.map +1 -1
  93. package/dist/types/modules/auth/auth.service.d.ts +5 -0
  94. package/dist/types/modules/auth/utils/services/auth-action.service.d.ts +1 -1
  95. package/dist/types/modules/base/utils/error-prettifier.d.ts +19 -0
  96. package/dist/types/modules/email/email.service.d.ts +4 -8
  97. package/dist/types/types/auth.d.ts +3 -3
  98. package/dist/types/utils/arkos-router/index.d.ts +3 -1
  99. package/dist/types/utils/arkos-router/types/index.d.ts +2 -2
  100. package/dist/types/utils/arkos-router/utils/helpers/index.d.ts +4 -0
  101. package/dist/types/utils/cli/generate.d.ts +4 -0
  102. package/dist/types/utils/cli/utils/template-generator/templates/auth-configs-template.d.ts +3 -1
  103. package/dist/types/utils/cli/utils/template-generator/templates/class-validator-dto-generator.d.ts +18 -0
  104. package/dist/types/utils/cli/utils/template-generator/templates/zod-schema-generator.d.ts +14 -0
  105. package/dist/types/utils/helpers/routers.helpers.d.ts +1 -1
  106. package/package.json +1 -1
  107. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +0 -187
  108. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +0 -1
  109. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +0 -181
  110. package/dist/cjs/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +0 -1
  111. package/dist/cjs/utils/cli/utils/template-generator/templates/zod/create-schema-template.js +0 -106
  112. package/dist/cjs/utils/cli/utils/template-generator/templates/zod/create-schema-template.js.map +0 -1
  113. package/dist/cjs/utils/cli/utils/template-generator/templates/zod/update-schema-template.js +0 -104
  114. package/dist/cjs/utils/cli/utils/template-generator/templates/zod/update-schema-template.js.map +0 -1
  115. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js +0 -181
  116. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.js.map +0 -1
  117. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js +0 -175
  118. package/dist/esm/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.js.map +0 -1
  119. package/dist/esm/utils/cli/utils/template-generator/templates/zod/create-schema-template.js +0 -100
  120. package/dist/esm/utils/cli/utils/template-generator/templates/zod/create-schema-template.js.map +0 -1
  121. package/dist/esm/utils/cli/utils/template-generator/templates/zod/update-schema-template.js +0 -98
  122. package/dist/esm/utils/cli/utils/template-generator/templates/zod/update-schema-template.js.map +0 -1
  123. package/dist/types/utils/cli/utils/template-generator/templates/class-validator/create-dto-template.d.ts +0 -2
  124. package/dist/types/utils/cli/utils/template-generator/templates/class-validator/update-dto-template.d.ts +0 -2
  125. package/dist/types/utils/cli/utils/template-generator/templates/zod/create-schema-template.d.ts +0 -2
  126. package/dist/types/utils/cli/utils/template-generator/templates/zod/update-schema-template.d.ts +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"email.service.js","sourceRoot":"","sources":["../../../../src/modules/email/email.service.ts"],"names":[],"mappings":"AAAA,OAAO,UAA2B,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AAqCxD,MAAM,OAA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CAAC;YAC3C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YAC7D,IAAI,CAAC,WAAW;gBAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC;YACtC,GAAG,OAAO;YACV,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC;SAC7C,CAAC,CAAC;QAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;IACpC,CAAC;IAOM,KAAK,CAAC,gBAAgB,CAC3B,mBAAiC;QAEjC,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,mBAAmB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACjE,MAAM,WAAW,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAMM,YAAY,CAAC,MAA6B;QAC/C,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAOM,MAAM,CAAC,MAAM,CAAC,MAA6B;QAChD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;AAED,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAExC,eAAe,YAAY,CAAC","sourcesContent":["import nodemailer, { Transporter } from \"nodemailer\";\nimport { convert } from \"html-to-text\";\nimport { getArkosConfig } from \"../../server\";\nimport AppError from \"../error-handler/utils/app-error\";\n\n/**\n * Defines the options for sending an email.\n */\nexport type EmailOptions = {\n from?: string;\n to: string | string[];\n subject: string;\n text?: string;\n html: string;\n};\n\n/**\n * Defines the authentication options for SMTP.\n */\nexport type SMTPAuthOptions = {\n user: string;\n pass: string;\n};\n\n/**\n * Defines the connection options for SMTP server.\n */\nexport type SMTPConnectionOptions = {\n host?: string;\n port?: number;\n secure?: boolean;\n auth?: SMTPAuthOptions;\n name?: string;\n};\n\n/**\n * A service class to handle email-related tasks, including sending emails.\n *\n * See the api reference [www.arkosjs.com/docs/api-reference/the-email-service-class](https://www.arkosjs.com/docs/api-reference/the-email-service-class)\n */\nexport class EmailService {\n private transporter: Transporter | null = null;\n private customConfig: SMTPConnectionOptions | null = null;\n\n /**\n * Creates an instance of the EmailService class.\n *\n * @param {SMTPConnectionOptions} [config] - Optional custom SMTP configuration.\n * If provided, these settings will be used instead of the Arkos config.\n */\n constructor(config?: SMTPConnectionOptions) {\n if (config) {\n this.customConfig = config;\n }\n }\n\n /**\n * Gets the email configuration from multiple sources with priority:\n * 1. Constructor customConfig\n * 2. ArkosConfig\n * 3. Environment variables\n * @returns Configuration object with host, port, and auth details\n * @throws AppError if required email configuration is not set\n */\n private getEmailConfig(): SMTPConnectionOptions {\n if (this.customConfig) {\n return this.customConfig;\n }\n\n const { email: emailConfigs } = getArkosConfig();\n const host = emailConfigs?.host || process.env.EMAIL_HOST;\n const port =\n emailConfigs?.port ||\n (process.env.EMAIL_PORT ? parseInt(process.env.EMAIL_PORT) : undefined);\n const secure =\n emailConfigs?.secure !== undefined\n ? emailConfigs.secure\n : process.env.EMAIL_SECURE\n ? process.env.EMAIL_SECURE === \"true\"\n : undefined;\n const user = emailConfigs?.auth?.user || process.env.EMAIL_USER;\n const pass = emailConfigs?.auth?.pass || process.env.EMAIL_PASSWORD;\n const name = emailConfigs?.name || process.env.EMAIL_NAME;\n\n if (!host || !user || !pass) {\n throw new AppError(\n \"You are trying to use emailService without setting email configurations. \" +\n \"Please configure either arkosConfig.email or environment variables (EMAIL_HOST, EMAIL_USER, EMAIL_PASSWORD)\",\n 500,\n {\n docs: \"Read more about emailService at https://www.arkosjs.com/docs/core-concepts/sending-emails\",\n }\n );\n }\n\n return {\n host,\n port: port || 465,\n secure: secure !== undefined ? secure : true,\n auth: {\n user,\n pass,\n },\n name,\n };\n }\n\n /**\n * Gets or creates a transporter using the email configuration\n * @param customConfig Optional override connection settings (takes full priority if provided)\n * @returns A configured nodemailer transporter\n */\n private getTransporter(customConfig?: SMTPConnectionOptions): Transporter {\n if (customConfig) {\n const { name, ...config } = customConfig;\n return nodemailer.createTransport(config);\n }\n\n if (!this.transporter) {\n const { name, ...config } = this.getEmailConfig() || {};\n this.transporter = nodemailer.createTransport(config);\n }\n return this.transporter;\n }\n\n /**\n * Sends an email with the provided options.\n * Can use either the default configuration or custom connection options.\n *\n * @param {EmailOptions} options - The options for the email to be sent.\n * @param {SMTPConnectionOptions} [connectionOptions] - Optional custom connection settings.\n * @param {boolean} [skipVerification=false] - Whether to skip connection verification.\n * @returns {Promise<{ success: boolean; messageId?: string } & Record<string, any>>} Result with message ID on success.\n */\n public async send(\n options: EmailOptions,\n connectionOptions?: SMTPConnectionOptions,\n skipVerification: boolean = true\n ): Promise<{ success: boolean; messageId?: string } & Record<string, any>> {\n const config = this.getEmailConfig();\n const transporter = connectionOptions\n ? this.getTransporter(connectionOptions)\n : this.getTransporter();\n\n const fromAddress =\n options.from || connectionOptions?.auth?.user || config.auth?.user;\n\n if (connectionOptions || !skipVerification) {\n const isConnected = await this.verifyConnection(transporter);\n if (!isConnected) throw new Error(\"Failed to connect to email server\");\n }\n\n const info = await transporter.sendMail({\n ...options,\n from: fromAddress,\n text: options?.text || convert(options.html),\n });\n\n return { success: true, ...info };\n }\n\n /**\n * Verifies the connection to the email server.\n * @param {Transporter} [transporterToVerify] - Optional transporter to verify.\n * @returns {Promise<boolean>} A promise that resolves to true if connection is valid.\n */\n public async verifyConnection(\n transporterToVerify?: Transporter\n ): Promise<boolean> {\n try {\n const transporter = transporterToVerify || this.getTransporter();\n await transporter.verify();\n return true;\n } catch (error) {\n console.error(\"Email Server Connection Failed\", error);\n return false;\n }\n }\n\n /**\n * Updates the custom configuration for this email service instance.\n * @param {SMTPConnectionOptions} config - The new connection options.\n */\n public updateConfig(config: SMTPConnectionOptions): void {\n this.customConfig = config;\n this.transporter = null; // Reset transporter so it will be recreated with new config\n }\n\n /**\n * Creates a new instance of EmailService with custom configuration.\n * @param {SMTPConnectionOptions} config - The connection options for the new instance.\n * @returns {EmailService} A new EmailService instance.\n */\n public static create(config: SMTPConnectionOptions): EmailService {\n return new EmailService(config);\n }\n}\n\nconst emailService = new EmailService();\n\nexport default emailService;\n"]}
1
+ {"version":3,"file":"email.service.js","sourceRoot":"","sources":["../../../../src/modules/email/email.service.ts"],"names":[],"mappings":"AAAA,OAAO,UAA4C,MAAM,YAAY,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,QAAQ,MAAM,kCAAkC,CAAC;AAiCxD,MAAM,OAAO,YAAY;IAUvB,YAAY,MAA8B;QAT1C,gBAAW,GAAuB,IAAI,CAAC;QAC/B,iBAAY,GAAiC,IAAI,CAAC;QASxD,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC7B,CAAC;IACH,CAAC;IAUO,cAAc;QACpB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,YAAY,CAAC;QAC3B,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,cAAc,EAAE,CAAC;QACjD,MAAM,IAAI,GAAG,YAAY,EAAE,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;QAC1D,MAAM,IAAI,GACR,YAAY,EAAE,IAAI;YAClB,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,O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IAOM,KAAK,CAAC,gBAAgB,CAC3B,mBAAiC;QAEjC,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,mBAAmB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACjE,MAAM,WAAW,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAMM,YAAY,CAAC,MAA6B;QAC/C,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAOM,MAAM,CAAC,MAAM,CAAC,MAA6B;QAChD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;CACF;AAED,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAExC,eAAe,YAAY,CAAC","sourcesContent":["import nodemailer, { SendMailOptions, Transporter } from \"nodemailer\";\nimport { convert } from \"html-to-text\";\nimport { getArkosConfig } from \"../../server\";\nimport AppError from \"../error-handler/utils/app-error\";\n\n/**\n * Defines the options for sending an email.\n */\nexport type EmailOptions = {\n subject: string;\n} & SendMailOptions;\n\n/**\n * Defines the authentication options for SMTP.\n */\nexport type SMTPAuthOptions = {\n user: string;\n pass: string;\n};\n\n/**\n * Defines the connection options for SMTP server.\n */\nexport type SMTPConnectionOptions = {\n host?: string;\n port?: number;\n secure?: boolean;\n auth?: SMTPAuthOptions;\n name?: string;\n};\n\n/**\n * A service class to handle email-related tasks, including sending emails.\n *\n * See the api reference [www.arkosjs.com/docs/api-reference/the-email-service-class](https://www.arkosjs.com/docs/api-reference/the-email-service-class)\n */\nexport class EmailService {\n transporter: Transporter | null = null;\n private customConfig: SMTPConnectionOptions | null = null;\n\n /**\n * Creates an instance of the EmailService class.\n *\n * @param {SMTPConnectionOptions} [config] - Optional custom SMTP configuration.\n * If provided, these settings will be used instead of the Arkos config.\n */\n constructor(config?: SMTPConnectionOptions) {\n if (config) {\n this.customConfig = config;\n }\n }\n\n /**\n * Gets the email configuration from multiple sources with priority:\n * 1. Constructor customConfig\n * 2. ArkosConfig\n * 3. Environment variables\n * @returns Configuration object with host, port, and auth details\n * @throws AppError if required email configuration is not set\n */\n private getEmailConfig(): SMTPConnectionOptions {\n if (this.customConfig) {\n return this.customConfig;\n }\n\n const { email: emailConfigs } = getArkosConfig();\n const host = emailConfigs?.host || process.env.EMAIL_HOST;\n const port =\n emailConfigs?.port ||\n (process.env.EMAIL_PORT ? parseInt(process.env.EMAIL_PORT) : undefined);\n const secure =\n emailConfigs?.secure !== undefined\n ? emailConfigs.secure\n : process.env.EMAIL_SECURE\n ? process.env.EMAIL_SECURE === \"true\"\n : undefined;\n const user = emailConfigs?.auth?.user || process.env.EMAIL_USER;\n const pass = emailConfigs?.auth?.pass || process.env.EMAIL_PASSWORD;\n const name = emailConfigs?.name || process.env.EMAIL_NAME;\n\n if (!host || !user || !pass) {\n throw new AppError(\n \"You are trying to use emailService without setting email configurations. \" +\n \"Please configure either arkosConfig.email or environment variables (EMAIL_HOST, EMAIL_USER, EMAIL_PASSWORD)\",\n 500,\n {\n docs: \"Read more about emailService at https://www.arkosjs.com/docs/core-concepts/sending-emails\",\n }\n );\n }\n\n return {\n host,\n port: port || 465,\n secure: secure !== undefined ? secure : true,\n auth: {\n user,\n pass,\n },\n name,\n };\n }\n\n /**\n * Gets or creates a transporter using the email configuration\n * @param customConfig Optional override connection settings (takes full priority if provided)\n * @returns A configured nodemailer transporter\n */\n private getTransporter(customConfig?: SMTPConnectionOptions): Transporter {\n if (customConfig) {\n const { name, ...config } = customConfig;\n return nodemailer.createTransport(config);\n }\n\n if (!this.transporter) {\n const { name, ...config } = this.getEmailConfig() || {};\n this.transporter = nodemailer.createTransport(config);\n }\n return this.transporter;\n }\n\n /**\n * Sends an email with the provided options.\n * Can use either the default configuration or custom connection options.\n *\n * @param {EmailOptions} options - The options for the email to be sent.\n * @param {SMTPConnectionOptions} [connectionOptions] - Optional custom connection settings.\n * @param {boolean} [skipVerification=false] - Whether to skip connection verification.\n * @returns {Promise<{ success: boolean; messageId?: string } & Record<string, any>>} Result with message ID on success.\n */\n public async send(\n options: EmailOptions & SendMailOptions,\n connectionOptions?: SMTPConnectionOptions,\n skipVerification: boolean = true\n ): Promise<{ success: boolean; messageId?: string } & Record<string, any>> {\n const config = this.getEmailConfig();\n const transporter = connectionOptions\n ? this.getTransporter(connectionOptions)\n : this.getTransporter();\n\n const fromAddress =\n options.from || connectionOptions?.auth?.user || config.auth?.user;\n\n if (connectionOptions || !skipVerification) {\n const isConnected = await this.verifyConnection(transporter);\n if (!isConnected) throw new Error(\"Failed to connect to email server\");\n }\n\n const info = await transporter.sendMail({\n ...options,\n from: fromAddress,\n text:\n options?.text ||\n (typeof options.html === \"string\" && options.html\n ? convert(options.html as string)\n : undefined),\n });\n\n return { success: true, ...info };\n }\n\n /**\n * Verifies the connection to the email server.\n * @param {Transporter} [transporterToVerify] - Optional transporter to verify.\n * @returns {Promise<boolean>} A promise that resolves to true if connection is valid.\n */\n public async verifyConnection(\n transporterToVerify?: Transporter\n ): Promise<boolean> {\n try {\n const transporter = transporterToVerify || this.getTransporter();\n await transporter.verify();\n return true;\n } catch (error) {\n console.error(\"Email Server Connection Failed\", error);\n return false;\n }\n }\n\n /**\n * Updates the custom configuration for this email service instance.\n * @param {SMTPConnectionOptions} config - The new connection options.\n */\n public updateConfig(config: SMTPConnectionOptions): void {\n this.customConfig = config;\n this.transporter = null; // Reset transporter so it will be recreated with new config\n }\n\n /**\n * Creates a new instance of EmailService with custom configuration.\n * @param {SMTPConnectionOptions} config - The connection options for the new instance.\n * @returns {EmailService} A new EmailService instance.\n */\n public static create(config: SMTPConnectionOptions): EmailService {\n return new EmailService(config);\n }\n}\n\nconst emailService = new EmailService();\n\nexport default emailService;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"error-handler.controller.js","sourceRoot":"","sources":["../../../../src/modules/error-handler/error-handler.controller.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAiBtC,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,GAAa,EACb,GAAY,EACZ,GAAa,EACb,CAAe;IAEf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAE9C,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC;IACvC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC;IAEnC,IAAI,KAAK,GAAQ;QACf,GAAG,GAAG;QACN,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,SAAS;KAC/B,CAAC;IAEF,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM;QAAE,OAAO,KAAK,EAAE,KAAK,CAAC;IAE5D,IAAI,GAAG,CAAC,IAAI,KAAK,mBAAmB;QAClC,KAAK,GAAG,qBAAqB,CAAC,cAAc,EAAE,CAAC;IACjD,IAAI,GAAG,CAAC,IAAI,KAAK,mBAAmB;QAClC,KAAK,GAAG,qBAAqB,CAAC,gBAAgB,EAAE,CAAC;IAEnD,IAAI,GAAG,CAAC,IAAI,KAAK,6BAA6B;QAC5C,KAAK,GAAG,qBAAqB,CAAC,iCAAiC,CAAC,GAAG,CAAC,CAAC;IACvE,IAAI,GAAG,CAAC,IAAI,KAAK,iCAAiC;QAChD,KAAK,GAAG,qBAAqB,CAAC,qCAAqC,CAAC,GAAG,CAAC,CAAC;IAC3E,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;QACtB,KAAK,GAAG,qBAAqB,CAAC,yBAAyB,CAAC,GAAG,CAAC,CAAC;IAC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,CAAC;QAE3E,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { NextFunction, Request, Response } from \"express\";\nimport AppError from \"./utils/app-error\";\nimport * as errorControllerHelper from \"./utils/error-handler.helpers\";\nimport { server } from \"../../server\";\n\n/**\n * Error handling middleware for Express.\n *\n * This middleware function handles all errors in the Express application.\n * It checks for the environment (development or production) and sends appropriate error responses\n * based on whether the environment is production or not. It also maps specific errors such as\n * JWT errors, Prisma client errors, and database-related errors to specific helper functions for handling.\n *\n * @param {AppError} err - The error object thrown by the application.\n * @param {Request} req - The Express request object.\n * @param {Response} res - The Express response object.\n * @param {NextFunction} _ - The next middleware function in the chain.\n *\n * @returns {void} - Sends the response with the error details to the client.\n */\nexport default function errorHandler(\n err: AppError,\n req: Request,\n res: Response,\n _: NextFunction\n): void {\n console.error(\"[\\x1b[31mError\\x1b[0m]:\", err);\n\n err.statusCode = err.statusCode || 500;\n err.status = err.status || \"error\";\n\n let error: any = {\n ...err,\n message: err.message,\n stack: err?.stack || undefined,\n };\n\n if (process.env.ARKOS_BUILD === \"true\") delete error?.stack;\n\n if (err.name === \"JsonWebTokenError\")\n error = errorControllerHelper.handleJWTError();\n if (err.name === \"TokenExpiredError\")\n error = errorControllerHelper.handleJWTExpired();\n\n if (err.name === \"PrismaClientValidationError\")\n error = errorControllerHelper.handlePrismaClientValidationError(err);\n if (err.name === \"PrismaClientInitializationError\")\n error = errorControllerHelper.handlePrismaClientInitializationError(err);\n if (err.code === \"P1000\")\n error = errorControllerHelper.handleAuthenticationError(err);\n if (err.code === \"P1001\")\n error = errorControllerHelper.handleServerNotReachableError(err);\n if (err.code === \"P1002\")\n error = errorControllerHelper.handleConnectionTimeoutError(err);\n if (err.code === \"P1003\")\n error = errorControllerHelper.handleDatabaseNotFoundError(err);\n if (err.code === \"P2000\")\n error = errorControllerHelper.handleFieldValueTooLargeError(err);\n if (err.code === \"P2001\")\n error = errorControllerHelper.handleRecordNotFoundError(err);\n if (err.code === \"P2002\")\n error = errorControllerHelper.handleUniqueConstraintError(err);\n if (err.code === \"P2003\")\n error = errorControllerHelper.handleForeignKeyConstraintError(err);\n if (err.code === \"P2004\")\n error = errorControllerHelper.handleConstraintFailedError(err);\n if (err.code === \"P2025\")\n error = errorControllerHelper.handleNonExistingRecord(err);\n if (err.code === \"P3000\")\n error = errorControllerHelper.handleSchemaCreationFailedError(err);\n if (err.code === \"P3001\")\n error = errorControllerHelper.handleMigrationAlreadyAppliedError(err);\n if (err.code === \"P3002\")\n error = errorControllerHelper.handleMigrationScriptFailedError(err);\n if (err.code === \"P3003\")\n error = errorControllerHelper.handleVersionMismatchError(err);\n\n if (err.name === \"NetworkError\")\n error = errorControllerHelper.handleNetworkError(err);\n\n if (process.env.ARKOS_BUILD !== \"true\")\n return sendDevelopmentError(\n {\n ...error,\n message: error.message,\n stack: err.stack,\n originalError: err,\n },\n req,\n res\n );\n\n sendProductionError(error, req, res);\n}\n\n/**\n * Sends a detailed error response in development mode.\n *\n * In development, the error response includes full error details, including\n * the stack trace and the complete error message.\n *\n * @param {AppError} err - The error object.\n * @param {Request} req - The Express request object.\n * @param {Response} res - The Express response object.\n *\n * @returns {void} - Sends the response with the error details to the client.\n */\nfunction sendDevelopmentError(err: any, req: Request, res: Response): void {\n if (req.originalUrl.startsWith(\"/api\"))\n res.status(err.statusCode).json({\n ...err,\n message:\n err.message?.split?.(\"\\n\")[err.message?.split?.(\"\\n\").length - 1],\n stack: err?.originalError?.stack?.split?.(\"\\n\"),\n });\n else\n res.status(err.statusCode).json({\n title: \"Internal server error\",\n message: err.message,\n });\n}\n\n/**\n * Sends a generic error response in production mode.\n *\n * In production, sensitive error details (such as stack traces) are not exposed\n * to the client. Only operational errors are shown with a generic message.\n *\n * @param {AppError} err - The error object.\n * @param {Request} req - The Express request object.\n * @param {Response} res - The Express response object.\n *\n * @returns {void} - Sends the response with the error details to the client.\n */\nfunction sendProductionError(err: AppError, req: Request, res: Response): void {\n if (req.originalUrl.startsWith(\"/api\")) {\n if (err.isOperational)\n res.status(err.statusCode).json({\n status: err.status,\n message: err.message,\n meta: err.meta || {},\n code: err.code || \"Unknown\",\n });\n else\n res.status(500).json({\n status: \"error\",\n message: \"Internal server error, please try again later.\",\n code: \"Unknown\",\n meta: {},\n });\n\n return;\n }\n\n if (err.isOperational) {\n res.status(err.statusCode).json({\n title: \"Internal server error\",\n message: err.message,\n code: \"Unknown\",\n });\n return;\n }\n\n res.status(err.statusCode).json({\n title: \"Internal server error\",\n message: \"Internal server error, please try again later.\",\n });\n}\n\n/**\n * Gracefully handles process termination by listening for SIGTERM signal.\n *\n * - In production and staging environments, it will log a shutdown message\n * and attempt to close the server gracefully.\n * - In development or non-production environments, it will immediately exit the process.\n *\n * @returns {void}\n */\nprocess.on(\"SIGTERM\", () => {\n if (process.env.ARKOS_BUILD !== \"true\") {\n process.exit();\n } else {\n console.error(\"SIGTERM RECEIVED in Production. Shutting down gracefully!\");\n\n server.close(() => {\n console.error(\"Process terminated!!!\");\n process.exit();\n });\n }\n});\n"]}
1
+ {"version":3,"file":"error-handler.controller.js","sourceRoot":"","sources":["../../../../src/modules/error-handler/error-handler.controller.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAiBtC,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,GAAa,EACb,GAAY,EACZ,GAAa,EACb,CAAe;IAEf,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;IAE9C,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC;IACvC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI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,CAAC;gBACnB,MAAM,EAAE,OAAO;gBACf,OAAO,EAAE,gDAAgD;gBACzD,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,EAAE;aACT,CAAC,CAAC;QAEL,OAAO;IACT,CAAC;IAED,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC;QACtB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;YAC9B,KAAK,EAAE,uBAAuB;YAC9B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,SAAS;SAChB,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC;QAC9B,KAAK,EAAE,uBAAuB;QAC9B,OAAO,EAAE,gDAAgD;KAC1D,CAAC,CAAC;AACL,CAAC;AAWD,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM,EAAE,CAAC;QACvC,OAAO,CAAC,IAAI,EAAE,CAAC;IACjB,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAE3E,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;YAChB,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["import { NextFunction, Request, Response } from \"express\";\nimport AppError from \"./utils/app-error\";\nimport * as errorControllerHelper from \"./utils/error-handler.helpers\";\nimport { server } from \"../../server\";\n\n/**\n * Error handling middleware for Express.\n *\n * This middleware function handles all errors in the Express application.\n * It checks for the environment (development or production) and sends appropriate error responses\n * based on whether the environment is production or not. It also maps specific errors such as\n * JWT errors, Prisma client errors, and database-related errors to specific helper functions for handling.\n *\n * @param {AppError} err - The error object thrown by the application.\n * @param {Request} req - The Express request object.\n * @param {Response} res - The Express response object.\n * @param {NextFunction} _ - The next middleware function in the chain.\n *\n * @returns {void} - Sends the response with the error details to the client.\n */\nexport default function errorHandler(\n err: AppError,\n req: Request,\n res: Response,\n _: NextFunction\n): void {\n console.error(\"[\\x1b[31mError\\x1b[0m]:\", err);\n\n err.statusCode = err.statusCode || 500;\n err.status = err.status || \"error\";\n\n let error: any = {\n ...err,\n message: err.message,\n stack: err?.stack || undefined,\n };\n\n if (process.env.ARKOS_BUILD === \"true\") delete error?.stack;\n\n if (err.name === \"JsonWebTokenError\")\n error = errorControllerHelper.handleJWTError();\n if (err.name === \"TokenExpiredError\")\n error = errorControllerHelper.handleJWTExpired();\n if (err.name === \"PrismaClientValidationError\")\n error = errorControllerHelper.handlePrismaClientValidationError(err);\n if (err.name === \"PrismaClientInitializationError\")\n error = errorControllerHelper.handlePrismaClientInitializationError(err);\n if (err.code === \"P1000\")\n error = errorControllerHelper.handleAuthenticationError(err);\n if (err.code === \"P1001\")\n error = errorControllerHelper.handleServerNotReachableError(err);\n if (err.code === \"P1002\")\n error = errorControllerHelper.handleConnectionTimeoutError(err);\n if (err.code === \"P1003\")\n error = errorControllerHelper.handleDatabaseNotFoundError(err);\n if (err.code === \"P2000\")\n error = errorControllerHelper.handleFieldValueTooLargeError(err);\n if (err.code === \"P2001\")\n error = errorControllerHelper.handleRecordNotFoundError(err);\n if (err.code === \"P2002\")\n error = errorControllerHelper.handleUniqueConstraintError(err);\n if (err.code === \"P2003\")\n error = errorControllerHelper.handleForeignKeyConstraintError(err);\n if (err.code === \"P2004\")\n error = errorControllerHelper.handleConstraintFailedError(err);\n if (err.code === \"P2025\")\n error = errorControllerHelper.handleNonExistingRecord(err);\n if (err.code === \"P3000\")\n error = errorControllerHelper.handleSchemaCreationFailedError(err);\n if (err.code === \"P3001\")\n error = errorControllerHelper.handleMigrationAlreadyAppliedError(err);\n if (err.code === \"P3002\")\n error = errorControllerHelper.handleMigrationScriptFailedError(err);\n if (err.code === \"P3003\")\n error = errorControllerHelper.handleVersionMismatchError(err);\n\n if (err.name === \"NetworkError\")\n error = errorControllerHelper.handleNetworkError(err);\n\n if (process.env.ARKOS_BUILD !== \"true\")\n return sendDevelopmentError(\n {\n ...error,\n message: error.message,\n stack: err.stack,\n originalError: err,\n },\n req,\n res\n );\n\n sendProductionError(error, req, res);\n}\n\n/**\n * Sends a detailed error response in development mode.\n *\n * In development, the error response includes full error details, including\n * the stack trace and the complete error message.\n *\n * @param {AppError} err - The error object.\n * @param {Request} req - The Express request object.\n * @param {Response} res - The Express response object.\n *\n * @returns {void} - Sends the response with the error details to the client.\n */\nfunction sendDevelopmentError(err: any, req: Request, res: Response): void {\n if (req.originalUrl.startsWith(\"/api\"))\n res.status(err.statusCode).json({\n ...err,\n message:\n err.message?.split?.(\"\\n\")[err.message?.split?.(\"\\n\").length - 1],\n stack: err?.originalError?.stack?.split?.(\"\\n\"),\n });\n else\n res.status(err.statusCode).json({\n title: \"Internal server error\",\n message: err.message,\n });\n}\n\n/**\n * Sends a generic error response in production mode.\n *\n * In production, sensitive error details (such as stack traces) are not exposed\n * to the client. Only operational errors are shown with a generic message.\n *\n * @param {AppError} err - The error object.\n * @param {Request} req - The Express request object.\n * @param {Response} res - The Express response object.\n *\n * @returns {void} - Sends the response with the error details to the client.\n */\nfunction sendProductionError(err: AppError, req: Request, res: Response): void {\n if (req.originalUrl.startsWith(\"/api\")) {\n if (err.isOperational)\n res.status(err.statusCode).json({\n status: err.status,\n message: err.message,\n meta: err.meta || {},\n code: err.code || \"Unknown\",\n });\n else\n res.status(500).json({\n status: \"error\",\n message: \"Internal server error, please try again later.\",\n code: \"Unknown\",\n meta: {},\n });\n\n return;\n }\n\n if (err.isOperational) {\n res.status(err.statusCode).json({\n title: \"Internal server error\",\n message: err.message,\n code: \"Unknown\",\n });\n return;\n }\n\n res.status(err.statusCode).json({\n title: \"Internal server error\",\n message: \"Internal server error, please try again later.\",\n });\n}\n\n/**\n * Gracefully handles process termination by listening for SIGTERM signal.\n *\n * - In production and staging environments, it will log a shutdown message\n * and attempt to close the server gracefully.\n * - In development or non-production environments, it will immediately exit the process.\n *\n * @returns {void}\n */\nprocess.on(\"SIGTERM\", () => {\n if (process.env.ARKOS_BUILD !== \"true\") {\n process.exit();\n } else {\n console.error(\"SIGTERM RECEIVED in Production. Shutting down gracefully!\");\n\n server.close(() => {\n console.error(\"Process terminated!!!\");\n process.exit();\n });\n }\n});\n"]}
@@ -1,3 +1,4 @@
1
+ import { pascalCase } from "../../../utils/features/change-case.features.js";
1
2
  import AppError from "./app-error.js";
2
3
  export function handleJWTError() {
3
4
  return new AppError("Invalid token. Please log in again!", 401);
@@ -41,7 +42,9 @@ export function handleRecordNotFoundError(_) {
41
42
  export function handleUniqueConstraintError(err) {
42
43
  const field = err?.meta?.target || "unknown field";
43
44
  const message = `Duplicate value detected for the unique field(s): ${field}. Please use a different value.`;
44
- return new AppError(message, 409);
45
+ return new AppError(message, 409, (err.meta?.modelName &&
46
+ `${pascalCase(err.meta?.modelName)}${pascalCase(err.meta?.target?.[0])}UniqueConstraint`) ||
47
+ "Unknown");
45
48
  }
46
49
  export function handleForeignKeyConstraintError(_) {
47
50
  const message = "Foreign key constraint violation. Ensure that the referenced record exists.";
@@ -155,9 +158,12 @@ export function handleEmptyResultError(_) {
155
158
  export function handleNonExistingRecord(err) {
156
159
  const message = err?.meta?.cause ||
157
160
  `Operation could not be completed as the required record was not found`;
158
- return new AppError(message, 404, err.meta || {}, "RecordNotFound");
161
+ const model = err?.meta?.cause
162
+ ? err?.meta?.cause?.split("No '")?.[1]?.split?.("'")?.[0]
163
+ : "";
164
+ return new AppError(message, 404, `Inline${pascalCase(model || "")}RecordNotFound`);
159
165
  }
160
166
  export function handlePrismaClientInitializationError(_) {
161
- return new AppError("Service temporarily unavailable", 503, {}, "DatabaseNotAvailable");
167
+ return new AppError("Service temporarily unavailable", 503, "DatabaseNotAvailable");
162
168
  }
163
169
  //# sourceMappingURL=error-handler.helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error-handler.helpers.js","sourceRoot":"","sources":["../../../../../src/modules/error-handler/utils/error-handler.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,aAAa,CAAC;AASnC,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,QAAQ,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,QAAQ,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,GAAa;IAC7D,MAAM,OAAO,GACX,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClE,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,CAAW;IACnD,MAAM,OAAO,GACX,mFAAmF,CAAC;IACtF,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,CAAW;IACvD,MAAM,OAAO,GACX,qGAAqG,CAAC;IACxG,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,CAAW;IACtD,MAAM,OAAO,GACX,gGAAgG,CAAC;IACnG,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,CAAW;IACrD,MAAM,OAAO,GAAG,sDAAsD,CAAC;IACvE,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC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AAC;AAED,MAAM,UAAU,2BAA2B,CAAC,CAAW;IACrD,MAAM,OAAO,GAAG,iGAAiG,CAAC;IAClH,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAa;IAC/C,MAAM,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,KAAK,IAAI,eAAe,CAAC;IAClD,MAAM,YAAY,GAAG,GAAG,EAAE,IAAI,EAAE,aAAa,IAAI,cAAc,CAAC;IAChE,MAAM,OAAO,GAAG,gCAAgC,KAAK,qBAAqB,YAAY,GAAG,CAAC;IAC1F,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,CAAW;IAChD,MAAM,OAAO,GAAG,6FAA6F,CAAC;IAC9G,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,GAGvC;IACC,MAAM,OAAO,GACX,GAAG,EAAE,IAAI,EAAE,KAAK;QAChB,uEAAuE,CAAC;IAC1E,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,gBAAgB,CAAC,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,qCAAqC,CAAC,CAAM;IAC1D,OAAO,IAAI,QAAQ,CACjB,iCAAiC,EACjC,GAAG,EACH,EAAE,EACF,sBAAsB,CACvB,CAAC;AACJ,CAAC","sourcesContent":["import AppError from \"./app-error\";\n\nexport interface PrismaError {\n code?: string;\n message: string;\n meta?: Record<string, any>;\n name?: string;\n}\n\nexport function handleJWTError() {\n return new AppError(\"Invalid token. Please log in again!\", 401);\n}\n\nexport function handleJWTExpired() {\n return new AppError(\"Your token has expired, Please log again!\", 401);\n}\n\nexport function handlePrismaClientValidationError(err: AppError) {\n const message =\n err?.message?.split(\"\\n\")[err?.message?.split(\"\\n\").length - 1];\n return new AppError(message, 400);\n}\n\nexport function handleAuthenticationError(_: AppError) {\n const message =\n \"Authentication failed against the database server. Please check your credentials.\";\n return new AppError(message, 401);\n}\n\nexport function handleServerNotReachableError(_: AppError) {\n const message =\n \"The database server is not reachable. Verify your connection string or ensure the server is online.\";\n return new AppError(message, 503);\n}\n\nexport function handleConnectionTimeoutError(_: AppError) {\n const message =\n \"Connection to the database timed out. Please check server performance or network connectivity.\";\n return new AppError(message, 504);\n}\n\nexport function handleDatabaseNotFoundError(_: AppError) {\n const message = \"The specified database does not exist on the server.\";\n return new AppError(message, 404);\n}\n\nexport function handleEnvironmentVariableError(err: AppError) {\n const missingVars = err?.missing || \"unknown environment variables\";\n const message = `Missing or invalid environment variables: ${missingVars}. Please check your configuration.`;\n return new AppError(message, 500);\n}\n\nexport function handleFieldValueTooLargeError(err: AppError) {\n const message = `The value for the field \"${err?.meta?.field_name}\" is too large. Please provide a smaller value.`;\n return new AppError(message, 400);\n}\n\nexport function handleRecordNotFoundError(_: AppError) {\n const message =\n \"No record found for the given query. Ensure the query parameters are correct.\";\n return new AppError(message, 404);\n}\n\nexport function handleUniqueConstraintError(err: AppError) {\n const field = err?.meta?.target || \"unknown field\";\n const message = `Duplicate value detected for the unique field(s): ${field}. Please use a different value.`;\n return new AppError(message, 409);\n}\n\nexport function handleForeignKeyConstraintError(_: AppError) {\n const message =\n \"Foreign key constraint violation. Ensure that the referenced record exists.\";\n return new AppError(message, 400);\n}\n\nexport function handleConstraintFailedError(err: AppError) {\n const constraint = err?.meta?.constraint || \"unknown constraint\";\n const message = `A database constraint \"${constraint}\" failed. Please review your input data.`;\n return new AppError(message, 400);\n}\n\nexport function handleInvalidFieldValueError(err: AppError) {\n const fieldName = err?.meta?.field_name || \"unknown field\";\n const message = `Invalid value provided for the field \"${fieldName}\". Please provide a valid value.`;\n return new AppError(message, 400);\n}\n\nexport function handleInvalidFieldProvidedError(err: AppError) {\n const fieldName = err?.meta?.field_name || \"unknown field\";\n const message = `The field \"${fieldName}\" has been provided with an invalid value. Check the data and try again.`;\n return new AppError(message, 400);\n}\n\nexport function handleDataValidationError(_: AppError) {\n const message =\n \"Data validation error occurred. Please ensure all fields meet the required criteria.\";\n return new AppError(message, 400);\n}\n\nexport function handleQueryParsingError(err: AppError) {\n const query = err?.meta?.query || \"unknown query\";\n const message = `Failed to parse the query: \"${query}\". Check the syntax and structure.`;\n return new AppError(message, 400);\n}\n\nexport function handleInvalidQueryFormatError(err: AppError) {\n const query = err?.meta?.query || \"unknown query\";\n const message = `The query format is invalid: \"${query}\". Ensure the query adheres to the expected format.`;\n return new AppError(message, 400);\n}\n\nexport function handleRawQueryExecutionError(_: AppError) {\n const message =\n \"An error occurred during the execution of a raw query. Verify the query and try again.\";\n return new AppError(message, 500);\n}\n\nexport function handleNullConstraintViolationError(err: AppError) {\n const fieldName = err?.meta?.field_name || \"unknown field\";\n const message = `The field \"${fieldName}\" cannot be null. Please provide a value.`;\n return new AppError(message, 400);\n}\n\nexport function handleSchemaCreationFailedError(_: AppError) {\n const message =\n \"Failed to create the database schema. Verify the schema definition and try again.\";\n return new AppError(message, 500);\n}\n\nexport function handleMigrationAlreadyAppliedError(err: AppError) {\n const migrationName = err?.meta?.migration || \"unknown migration\";\n const message = `The migration \"${migrationName}\" has already been applied to the database.`;\n return new AppError(message, 409);\n}\n\nexport function handleMigrationScriptFailedError(err: AppError) {\n const migrationName = err?.meta?.migration || \"unknown migration\";\n const message = `The migration script \"${migrationName}\" failed. Review the script and resolve any issues.`;\n return new AppError(message, 500);\n}\n\nexport function handleVersionMismatchError(_: AppError) {\n const message = `Version mismatch: The database schema and migration versions are inconsistent. Please check and resolve this issue.`;\n return new AppError(message, 400);\n}\n\nexport function handleMigrationFileReadError(err: AppError) {\n const migrationFile = err?.meta?.migration_file || \"unknown file\";\n const message = `Failed to read the migration file \"${migrationFile}\". Ensure the file exists and is accessible.`;\n return new AppError(message, 500);\n}\n\nexport function handleSchemaDriftError(_: AppError) {\n const message = `Schema drift detected: The database schema differs from the expected state. Run migrations or sync schema to resolve.`;\n return new AppError(message, 400);\n}\n\nexport function handleSchemaSyntaxError(_: AppError) {\n const message = `Syntax error in the schema file. Please check for typos or invalid syntax in your schema definition.`;\n return new AppError(message, 500);\n}\n\nexport function handleClientTypeError(_: AppError) {\n const message = `Type error, Ensure proper usage of methods and correct data types.`;\n return new AppError(message, 400);\n}\n\nexport function handleDynamicQueryError(_: AppError) {\n const message = `Error constructing or executing a dynamic query. Verify query structure and parameters.`;\n return new AppError(message, 400);\n}\n\nexport function handleRelationLoadingError(err: AppError) {\n const relation = err?.meta?.relation || \"unknown relation\";\n const message = `Error loading relation \"${relation}\". Ensure it is correctly defined and included in the query.`;\n return new AppError(message, 400);\n}\n\nexport function handleBinaryError(err: AppError) {\n const binaryName = err?.meta?.binary || \"unknown binary\";\n const message = `Error with Prisma binary \"${binaryName}\". Ensure the binary is properly installed and compatible.`;\n return new AppError(message, 500);\n}\n\nexport function handleNetworkError(_: AppError) {\n const message = `Network error: Unable to connect to the database or internet. Please check your network connection.`;\n return new AppError(message, 500);\n}\n\nexport function handleUnhandledPromiseError(_: AppError) {\n const message = `Unhandled promise rejection detected. Please check asynchronous code for proper error handling.`;\n return new AppError(message, 500);\n}\n\nexport function handleDataTypeError(err: AppError) {\n const field = err?.meta?.field || \"unknown field\";\n const expectedType = err?.meta?.expected_type || \"unknown type\";\n const message = `Invalid data type for field \"${field}\". Expected type: ${expectedType}.`;\n return new AppError(message, 400);\n}\n\nexport function handleEmptyResultError(_: AppError) {\n const message = `Empty result: No data was found for the given query. Ensure the query criteria are correct.`;\n return new AppError(message, 404);\n}\n\nexport function handleNonExistingRecord(err: {\n meta?: Record<string, any>;\n [x: string]: any;\n}) {\n const message =\n err?.meta?.cause ||\n `Operation could not be completed as the required record was not found`;\n return new AppError(message, 404, err.meta || {}, \"RecordNotFound\");\n}\n\nexport function handlePrismaClientInitializationError(_: any) {\n return new AppError(\n \"Service temporarily unavailable\",\n 503,\n {},\n \"DatabaseNotAvailable\"\n );\n}\n"]}
1
+ {"version":3,"file":"error-handler.helpers.js","sourceRoot":"","sources":["../../../../../src/modules/error-handler/utils/error-handler.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,8CAA8C,CAAC;AAC1E,OAAO,QAAQ,MAAM,aAAa,CAAC;AASnC,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,QAAQ,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,IAAI,QAAQ,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,iCAAiC,CAAC,GAAa;IAC7D,MAAM,OAAO,GACX,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAClE,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,CAAW;IACnD,MAAM,OAAO,GACX,mFAAmF,CAAC;IACtF,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,CAAW;IACvD,MAAM,OAAO,GACX,qGAAqG,CAAC;IACxG,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,CAAW;IACtD,MAAM,OAAO,GACX,gGAAgG,CAAC;IACnG,OAAO,IAAI,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,CAAW;IACrD,MAAM,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AC,CAAC;QACzD,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,IAAI,QAAQ,CACjB,OAAO,EACP,GAAG,EACH,SAAS,UAAU,CAAC,KAAK,IAAI,EAAE,CAAC,gBAAgB,CACjD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qCAAqC,CAAC,CAAM;IAC1D,OAAO,IAAI,QAAQ,CACjB,iCAAiC,EACjC,GAAG,EACH,sBAAsB,CACvB,CAAC;AACJ,CAAC","sourcesContent":["import { pascalCase } from \"../../../utils/features/change-case.features\";\nimport AppError from \"./app-error\";\n\nexport interface PrismaError {\n code?: string;\n message: string;\n meta?: Record<string, any>;\n name?: string;\n}\n\nexport function handleJWTError() {\n return new AppError(\"Invalid token. Please log in again!\", 401);\n}\n\nexport function handleJWTExpired() {\n return new AppError(\"Your token has expired, Please log again!\", 401);\n}\n\nexport function handlePrismaClientValidationError(err: AppError) {\n const message =\n err?.message?.split(\"\\n\")[err?.message?.split(\"\\n\").length - 1];\n return new AppError(message, 400);\n}\n\nexport function handleAuthenticationError(_: AppError) {\n const message =\n \"Authentication failed against the database server. Please check your credentials.\";\n return new AppError(message, 401);\n}\n\nexport function handleServerNotReachableError(_: AppError) {\n const message =\n \"The database server is not reachable. Verify your connection string or ensure the server is online.\";\n return new AppError(message, 503);\n}\n\nexport function handleConnectionTimeoutError(_: AppError) {\n const message =\n \"Connection to the database timed out. Please check server performance or network connectivity.\";\n return new AppError(message, 504);\n}\n\nexport function handleDatabaseNotFoundError(_: AppError) {\n const message = \"The specified database does not exist on the server.\";\n return new AppError(message, 404);\n}\n\nexport function handleEnvironmentVariableError(err: AppError) {\n const missingVars = err?.missing || \"unknown environment variables\";\n const message = `Missing or invalid environment variables: ${missingVars}. Please check your configuration.`;\n return new AppError(message, 500);\n}\n\nexport function handleFieldValueTooLargeError(err: AppError) {\n const message = `The value for the field \"${err?.meta?.field_name}\" is too large. Please provide a smaller value.`;\n return new AppError(message, 400);\n}\n\nexport function handleRecordNotFoundError(_: AppError) {\n const message =\n \"No record found for the given query. Ensure the query parameters are correct.\";\n return new AppError(message, 404);\n}\n\nexport function handleUniqueConstraintError(err: AppError) {\n const field = err?.meta?.target || \"unknown field\";\n const message = `Duplicate value detected for the unique field(s): ${field}. Please use a different value.`;\n return new AppError(\n message,\n 409,\n (err.meta?.modelName &&\n `${pascalCase(err.meta?.modelName)}${pascalCase(err.meta?.target?.[0])}UniqueConstraint`) ||\n \"Unknown\"\n );\n}\n\nexport function handleForeignKeyConstraintError(_: AppError) {\n const message =\n \"Foreign key constraint violation. Ensure that the referenced record exists.\";\n return new AppError(message, 400);\n}\n\nexport function handleConstraintFailedError(err: AppError) {\n const constraint = err?.meta?.constraint || \"unknown constraint\";\n const message = `A database constraint \"${constraint}\" failed. Please review your input data.`;\n return new AppError(message, 400);\n}\n\nexport function handleInvalidFieldValueError(err: AppError) {\n const fieldName = err?.meta?.field_name || \"unknown field\";\n const message = `Invalid value provided for the field \"${fieldName}\". Please provide a valid value.`;\n return new AppError(message, 400);\n}\n\nexport function handleInvalidFieldProvidedError(err: AppError) {\n const fieldName = err?.meta?.field_name || \"unknown field\";\n const message = `The field \"${fieldName}\" has been provided with an invalid value. Check the data and try again.`;\n return new AppError(message, 400);\n}\n\nexport function handleDataValidationError(_: AppError) {\n const message =\n \"Data validation error occurred. Please ensure all fields meet the required criteria.\";\n return new AppError(message, 400);\n}\n\nexport function handleQueryParsingError(err: AppError) {\n const query = err?.meta?.query || \"unknown query\";\n const message = `Failed to parse the query: \"${query}\". Check the syntax and structure.`;\n return new AppError(message, 400);\n}\n\nexport function handleInvalidQueryFormatError(err: AppError) {\n const query = err?.meta?.query || \"unknown query\";\n const message = `The query format is invalid: \"${query}\". Ensure the query adheres to the expected format.`;\n return new AppError(message, 400);\n}\n\nexport function handleRawQueryExecutionError(_: AppError) {\n const message =\n \"An error occurred during the execution of a raw query. Verify the query and try again.\";\n return new AppError(message, 500);\n}\n\nexport function handleNullConstraintViolationError(err: AppError) {\n const fieldName = err?.meta?.field_name || \"unknown field\";\n const message = `The field \"${fieldName}\" cannot be null. Please provide a value.`;\n return new AppError(message, 400);\n}\n\nexport function handleSchemaCreationFailedError(_: AppError) {\n const message =\n \"Failed to create the database schema. Verify the schema definition and try again.\";\n return new AppError(message, 500);\n}\n\nexport function handleMigrationAlreadyAppliedError(err: AppError) {\n const migrationName = err?.meta?.migration || \"unknown migration\";\n const message = `The migration \"${migrationName}\" has already been applied to the database.`;\n return new AppError(message, 409);\n}\n\nexport function handleMigrationScriptFailedError(err: AppError) {\n const migrationName = err?.meta?.migration || \"unknown migration\";\n const message = `The migration script \"${migrationName}\" failed. Review the script and resolve any issues.`;\n return new AppError(message, 500);\n}\n\nexport function handleVersionMismatchError(_: AppError) {\n const message = `Version mismatch: The database schema and migration versions are inconsistent. Please check and resolve this issue.`;\n return new AppError(message, 400);\n}\n\nexport function handleMigrationFileReadError(err: AppError) {\n const migrationFile = err?.meta?.migration_file || \"unknown file\";\n const message = `Failed to read the migration file \"${migrationFile}\". Ensure the file exists and is accessible.`;\n return new AppError(message, 500);\n}\n\nexport function handleSchemaDriftError(_: AppError) {\n const message = `Schema drift detected: The database schema differs from the expected state. Run migrations or sync schema to resolve.`;\n return new AppError(message, 400);\n}\n\nexport function handleSchemaSyntaxError(_: AppError) {\n const message = `Syntax error in the schema file. Please check for typos or invalid syntax in your schema definition.`;\n return new AppError(message, 500);\n}\n\nexport function handleClientTypeError(_: AppError) {\n const message = `Type error, Ensure proper usage of methods and correct data types.`;\n return new AppError(message, 400);\n}\n\nexport function handleDynamicQueryError(_: AppError) {\n const message = `Error constructing or executing a dynamic query. Verify query structure and parameters.`;\n return new AppError(message, 400);\n}\n\nexport function handleRelationLoadingError(err: AppError) {\n const relation = err?.meta?.relation || \"unknown relation\";\n const message = `Error loading relation \"${relation}\". Ensure it is correctly defined and included in the query.`;\n return new AppError(message, 400);\n}\n\nexport function handleBinaryError(err: AppError) {\n const binaryName = err?.meta?.binary || \"unknown binary\";\n const message = `Error with Prisma binary \"${binaryName}\". Ensure the binary is properly installed and compatible.`;\n return new AppError(message, 500);\n}\n\nexport function handleNetworkError(_: AppError) {\n const message = `Network error: Unable to connect to the database or internet. Please check your network connection.`;\n return new AppError(message, 500);\n}\n\nexport function handleUnhandledPromiseError(_: AppError) {\n const message = `Unhandled promise rejection detected. Please check asynchronous code for proper error handling.`;\n return new AppError(message, 500);\n}\n\nexport function handleDataTypeError(err: AppError) {\n const field = err?.meta?.field || \"unknown field\";\n const expectedType = err?.meta?.expected_type || \"unknown type\";\n const message = `Invalid data type for field \"${field}\". Expected type: ${expectedType}.`;\n return new AppError(message, 400);\n}\n\nexport function handleEmptyResultError(_: AppError) {\n const message = `Empty result: No data was found for the given query. Ensure the query criteria are correct.`;\n return new AppError(message, 404);\n}\n\nexport function handleNonExistingRecord(err: {\n meta?: Record<string, any>;\n [x: string]: any;\n}) {\n const message =\n err?.meta?.cause ||\n `Operation could not be completed as the required record was not found`;\n\n const model = err?.meta?.cause\n ? err?.meta?.cause?.split(\"No '\")?.[1]?.split?.(\"'\")?.[0]\n : \"\";\n\n return new AppError(\n message,\n 404,\n `Inline${pascalCase(model || \"\")}RecordNotFound`\n );\n}\n\nexport function handlePrismaClientInitializationError(_: any) {\n return new AppError(\n \"Service temporarily unavailable\",\n 503,\n \"DatabaseNotAvailable\"\n );\n}\n"]}
@@ -39,7 +39,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
39
39
  : currentPath?.summary,
40
40
  description: currentPath?.description ||
41
41
  "Authenticates a user and returns an access token",
42
- operationId: currentPath?.operationId || "login",
42
+ operationId: currentPath?.operationId?.includes(pathname)
43
+ ? "login"
44
+ : currentPath?.operationId,
43
45
  requestBody: currentPath?.requestBody || {
44
46
  description: "User credentials",
45
47
  required: true,
@@ -90,7 +92,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
90
92
  ? "Logout from the system"
91
93
  : currentPath?.summary,
92
94
  description: currentPath?.description || "Invalidates the current user's JWT token",
93
- operationId: currentPath?.operationId || "logout",
95
+ operationId: currentPath?.operationId?.includes(pathname)
96
+ ? "logout"
97
+ : currentPath?.operationId,
94
98
  security: [{ BearerAuth: [] }],
95
99
  responses: {
96
100
  ...(currentPath?.responses || {}),
@@ -117,7 +121,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
117
121
  ? "Register a new user"
118
122
  : currentPath?.summary,
119
123
  description: currentPath?.description || "Creates a new user account",
120
- operationId: currentPath?.operationId || "signup",
124
+ operationId: currentPath?.operationId?.includes(pathname)
125
+ ? "signup"
126
+ : currentPath?.operationId,
121
127
  requestBody: currentPath?.requestBody || {
122
128
  description: "User registration data",
123
129
  required: true,
@@ -164,7 +170,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
164
170
  : currentPath?.summary,
165
171
  description: currentPath?.description ||
166
172
  "Changes the password for the authenticated user",
167
- operationId: currentPath?.operationId || "updatePassword",
173
+ operationId: currentPath?.operationId?.includes(pathname)
174
+ ? "updatePassword"
175
+ : currentPath?.operationId,
168
176
  security: [{ BearerAuth: [] }],
169
177
  requestBody: currentPath?.requestBody || {
170
178
  description: "Current and new password",
@@ -222,7 +230,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
222
230
  : currentPath?.summary,
223
231
  description: currentPath?.description ||
224
232
  "Retrieves information about the currently authenticated user",
225
- operationId: currentPath?.operationId || "getMe",
233
+ operationId: currentPath?.operationId?.includes(pathname)
234
+ ? "getMe"
235
+ : currentPath?.operationId,
226
236
  security: [{ BearerAuth: [] }],
227
237
  responses: {
228
238
  ...(currentPath?.responses || {}),
@@ -257,7 +267,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
257
267
  : currentPath?.summary,
258
268
  description: currentPath?.description ||
259
269
  "Updates information for the currently authenticated user",
260
- operationId: currentPath?.operationId || "updateMe",
270
+ operationId: currentPath?.operationId?.includes(pathname)
271
+ ? "updateMe"
272
+ : currentPath?.operationId,
261
273
  security: [{ BearerAuth: [] }],
262
274
  requestBody: currentPath?.requestBody || {
263
275
  description: "User data to update",
@@ -304,7 +316,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
304
316
  : currentPath?.summary,
305
317
  description: currentPath?.description ||
306
318
  "Marks the current user's account as deleted",
307
- operationId: currentPath?.operationId || "deleteMe",
319
+ operationId: currentPath?.operationId?.includes(pathname)
320
+ ? "deleteMe"
321
+ : currentPath?.operationId,
308
322
  security: [{ BearerAuth: [] }],
309
323
  responses: {
310
324
  ...(currentPath?.responses || {}),
@@ -343,7 +357,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
343
357
  : currentPath?.summary,
344
358
  description: currentPath?.description ||
345
359
  "Retrieves a list of all available authentication actions and permissions",
346
- operationId: currentPath?.operationId || "findManyAuthAction",
360
+ operationId: currentPath?.operationId?.includes(pathname)
361
+ ? "findManyAuthAction"
362
+ : currentPath?.operationId,
347
363
  security: [{ BearerAuth: [] }],
348
364
  responses: {
349
365
  ...(currentPath?.responses || {}),
@@ -410,7 +426,9 @@ export default function getAuthenticationJsonSchemaPaths(arkosConfig, existingPa
410
426
  : currentPath?.summary,
411
427
  description: currentPath?.description ||
412
428
  "Retrieves all authentication actions for a specific resource",
413
- operationId: currentPath?.operationId || "findOneAuthAction",
429
+ operationId: currentPath?.operationId?.includes(pathname)
430
+ ? "findOneAuthAction"
431
+ : currentPath?.operationId,
414
432
  security: [{ BearerAuth: [] }],
415
433
  parameters: mergedParameters,
416
434
  responses: {
@@ -1 +1 @@
1
- {"version":3,"file":"get-authentication-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-authentication-json-schema-paths.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAA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,WAAW,EAAE,oBAAoB;iBAClC;aACF;SACF,CAAC;QAEF,KAAK,CAAC,QAAQ,CAAE,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;IACpE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport {\n getSchemaRef,\n localValidatorFileExists,\n} from \"./swagger.router.helpers\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\n\nexport const getSchemaMode = (\n action: string,\n arkosConfig: ArkosConfig\n): \"prisma\" | \"zod\" | \"class-validator\" => {\n const swaggerMode = arkosConfig.swagger?.mode;\n const isStrict = arkosConfig.swagger?.strict;\n\n if (!swaggerMode) return \"prisma\";\n if (isStrict) return swaggerMode;\n\n const actionKey = action as any;\n const localFileExists = localValidatorFileExists(\n actionKey,\n \"auth\",\n arkosConfig\n );\n\n if (!localFileExists) return \"prisma\";\n return swaggerMode;\n};\n\nexport default function getAuthenticationJsonSchemaPaths(\n arkosConfig: ArkosConfig,\n existingPaths: OpenAPIV3.PathsObject\n) {\n const paths: OpenAPIV3.PathsObject = { ...existingPaths };\n\n if (!arkosConfig.swagger?.mode) return paths;\n\n const AuthModuleComponents = getModuleComponents(\"auth\");\n const routerConfig = AuthModuleComponents?.router\n ?.config as RouterConfig<\"auth\">;\n\n if (routerConfig?.disable === true) return paths;\n\n const isAuthEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n // Login\n if (!isAuthEndpointDisabled(\"login\")) {\n const pathname = \"/api/auth/login\";\n if (!paths[pathname]) paths[pathname] = {};\n const loginMode = getSchemaMode(\"login\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Login to the system\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Authenticates a user and returns an access token\",\n operationId: currentPath?.operationId || \"login\",\n requestBody: currentPath?.requestBody || {\n description: \"User credentials\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Login\", loginMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Login successful\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n accessToken: {\n type: \"string\",\n description: \"JWT access token\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Invalid credentials\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Logout\n if (!isAuthEndpointDisabled(\"logout\")) {\n const pathname = \"/api/auth/logout\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Logout from the system\"\n : currentPath?.summary,\n description:\n currentPath?.description || \"Invalidates the current user's JWT token\",\n operationId: currentPath?.operationId || \"logout\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"204\": currentPath?.responses?.[\"204\"] || {\n description: \"Logout successful\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Signup\n if (!isAuthEndpointDisabled(\"signup\")) {\n const pathname = \"/api/auth/signup\";\n if (!paths[pathname]) paths[pathname] = {};\n const signupMode = getSchemaMode(\"signup\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Register a new user\"\n : currentPath?.summary,\n description: currentPath?.description || \"Creates a new user account\",\n operationId: currentPath?.operationId || \"signup\",\n requestBody: currentPath?.requestBody || {\n description: \"User registration data\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Signup\", signupMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"201\": currentPath?.responses?.[\"201\"] || {\n description: \"User created successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"409\": currentPath?.responses?.[\"409\"] || {\n description: \"User already exists\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Password\n if (!isAuthEndpointDisabled(\"updatePassword\")) {\n const pathname = \"/api/auth/update-password\";\n if (!paths[pathname]) paths[pathname] = {};\n const updatePasswordMode = getSchemaMode(\"updatePassword\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update user password\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Changes the password for the authenticated user\",\n operationId: currentPath?.operationId || \"updatePassword\",\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"Current and new password\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdatePassword\", updatePasswordMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Password updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n status: {\n type: \"string\",\n example: \"success\",\n },\n message: {\n type: \"string\",\n example: \"Password updated successfully!\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data or current password incorrect\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Get Me\n if (!isAuthEndpointDisabled(\"getMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const findMeMode = getSchemaMode(\"getMe\", arkosConfig);\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves information about the currently authenticated user\",\n operationId: currentPath?.operationId || \"getMe\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User information retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"GetMe\", findMeMode),\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Me\n if (!isAuthEndpointDisabled(\"updateMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const updateMeMode = getSchemaMode(\"updateMe\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.patch;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Updates information for the currently authenticated user\",\n operationId: currentPath?.operationId || \"updateMe\",\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"User data to update\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdateMe\", updateMeMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.patch = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Delete Me\n if (!isAuthEndpointDisabled(\"deleteMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Delete current user account\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Marks the current user's account as deleted\",\n operationId: currentPath?.operationId || \"deleteMe\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Account deleted successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n message: {\n type: \"string\",\n example: \"Account deleted successfully\",\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Find Many Auth Action\n if (!isAuthEndpointDisabled(\"findManyAuthAction\")) {\n const pathname = \"/api/auth-actions\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get all authentication actions\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves a list of all available authentication actions and permissions\",\n operationId: currentPath?.operationId || \"findManyAuthAction\",\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description: \"Total number of auth actions\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n if (!isAuthEndpointDisabled(\"findOneAuthAction\")) {\n const pathname = \"/api/auth-actions/{resourceName}\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"resourceName\",\n in: \"path\",\n description: \"Name of the resource to retrieve auth actions for\",\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: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get authentication actions by resource\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves all authentication actions for a specific resource\",\n operationId: currentPath?.operationId || \"findOneAuthAction\",\n security: [{ BearerAuth: [] }],\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions for resource retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description:\n \"Total number of auth actions for this resource\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: \"Resource not found\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n return paths;\n}\n"]}
1
+ {"version":3,"file":"get-authentication-json-schema-paths.js","sourceRoot":"","sources":["../../../../../../src/modules/swagger/utils/helpers/get-authentication-json-schema-paths.ts"],"names":[],"mappings":"AACA,OAAO,EACL,YAAY,EACZ,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,MAAM,CAAC,MAAM,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KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,kDAAkD;oBAC/D,OAAO,EAAE;wBACP,kBAAkB,EAAE;4BAClB,MAAM,EAAE;gCACN,IAAI,EAAE,QAAQ;gCACd,UAAU,EAAE;oCACV,KAAK,EAAE;wCACL,IAAI,EAAE,QAAQ;wCACd,WAAW,EACT,gDAAgD;qCACnD;oCACD,OAAO,EAAE;wCACP,IAAI,EAAE,QAAQ;wCACd,WAAW,EAAE,iCAAiC;qCAC/C;oCACD,IAAI,EAAE;wCACJ,IAAI,EAAE,OAAO;wCACb,KAAK,EAAE;4CACL,IAAI,EAAE,qDAAqD;yCAC5D;qCACF;iCACF;6BACF;yBACF;qBACF;iBACF;gBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,yBAAyB;iBACvC;gBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,0BAA0B;iBACxC;gBACD,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,IAAI;oBACxC,WAAW,EAAE,oBAAoB;iBAClC;aACF;SACF,CAAC;QAEF,KAAK,CAAC,QAAQ,CAAE,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,EAAE,GAAG,WAAW,EAAE,CAAC;IACpE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { OpenAPIV3 } from \"openapi-types\";\nimport {\n getSchemaRef,\n localValidatorFileExists,\n} from \"./swagger.router.helpers\";\nimport { ArkosConfig, RouterConfig } from \"../../../../exports\";\nimport { getModuleComponents } from \"../../../../utils/dynamic-loader\";\nimport { isEndpointDisabled } from \"../../../base/utils/helpers/base.router.helpers\";\n\nexport const getSchemaMode = (\n action: string,\n arkosConfig: ArkosConfig\n): \"prisma\" | \"zod\" | \"class-validator\" => {\n const swaggerMode = arkosConfig.swagger?.mode;\n const isStrict = arkosConfig.swagger?.strict;\n\n if (!swaggerMode) return \"prisma\";\n if (isStrict) return swaggerMode;\n\n const actionKey = action as any;\n const localFileExists = localValidatorFileExists(\n actionKey,\n \"auth\",\n arkosConfig\n );\n\n if (!localFileExists) return \"prisma\";\n return swaggerMode;\n};\n\nexport default function getAuthenticationJsonSchemaPaths(\n arkosConfig: ArkosConfig,\n existingPaths: OpenAPIV3.PathsObject\n) {\n const paths: OpenAPIV3.PathsObject = { ...existingPaths };\n\n if (!arkosConfig.swagger?.mode) return paths;\n\n const AuthModuleComponents = getModuleComponents(\"auth\");\n const routerConfig = AuthModuleComponents?.router\n ?.config as RouterConfig<\"auth\">;\n\n if (routerConfig?.disable === true) return paths;\n\n const isAuthEndpointDisabled = (endpoint: string): boolean => {\n return isEndpointDisabled(routerConfig, endpoint as any);\n };\n\n // Login\n if (!isAuthEndpointDisabled(\"login\")) {\n const pathname = \"/api/auth/login\";\n if (!paths[pathname]) paths[pathname] = {};\n const loginMode = getSchemaMode(\"login\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Login to the system\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Authenticates a user and returns an access token\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"login\"\n : currentPath?.operationId,\n requestBody: currentPath?.requestBody || {\n description: \"User credentials\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Login\", loginMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Login successful\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n accessToken: {\n type: \"string\",\n description: \"JWT access token\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Invalid credentials\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Logout\n if (!isAuthEndpointDisabled(\"logout\")) {\n const pathname = \"/api/auth/logout\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Logout from the system\"\n : currentPath?.summary,\n description:\n currentPath?.description || \"Invalidates the current user's JWT token\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"logout\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"204\": currentPath?.responses?.[\"204\"] || {\n description: \"Logout successful\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Signup\n if (!isAuthEndpointDisabled(\"signup\")) {\n const pathname = \"/api/auth/signup\";\n if (!paths[pathname]) paths[pathname] = {};\n const signupMode = getSchemaMode(\"signup\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Register a new user\"\n : currentPath?.summary,\n description: currentPath?.description || \"Creates a new user account\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"signup\"\n : currentPath?.operationId,\n requestBody: currentPath?.requestBody || {\n description: \"User registration data\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"Signup\", signupMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"201\": currentPath?.responses?.[\"201\"] || {\n description: \"User created successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"409\": currentPath?.responses?.[\"409\"] || {\n description: \"User already exists\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Password\n if (!isAuthEndpointDisabled(\"updatePassword\")) {\n const pathname = \"/api/auth/update-password\";\n if (!paths[pathname]) paths[pathname] = {};\n const updatePasswordMode = getSchemaMode(\"updatePassword\", arkosConfig);\n const currentPath = paths[pathname]!.post;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update user password\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Changes the password for the authenticated user\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"updatePassword\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"Current and new password\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdatePassword\", updatePasswordMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Password updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n status: {\n type: \"string\",\n example: \"success\",\n },\n message: {\n type: \"string\",\n example: \"Password updated successfully!\",\n },\n },\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data or current password incorrect\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.post = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Get Me\n if (!isAuthEndpointDisabled(\"getMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const findMeMode = getSchemaMode(\"getMe\", arkosConfig);\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves information about the currently authenticated user\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"getMe\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User information retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"GetMe\", findMeMode),\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Update Me\n if (!isAuthEndpointDisabled(\"updateMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const updateMeMode = getSchemaMode(\"updateMe\", arkosConfig);\n const userMode = getSchemaMode(\"user\", arkosConfig);\n const currentPath = paths[pathname]!.patch;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Update current user information\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Updates information for the currently authenticated user\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"updateMe\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n requestBody: currentPath?.requestBody || {\n description: \"User data to update\",\n required: true,\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"UpdateMe\", updateMeMode),\n },\n },\n },\n },\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"User updated successfully\",\n content: {\n \"application/json\": {\n schema: {\n $ref: getSchemaRef(\"User\", userMode),\n },\n },\n },\n },\n \"400\": currentPath?.responses?.[\"400\"] || {\n description: \"Invalid input data\",\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.patch = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Delete Me\n if (!isAuthEndpointDisabled(\"deleteMe\")) {\n const pathname = \"/api/users/me\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.delete;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Delete current user account\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Marks the current user's account as deleted\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"deleteMe\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Account deleted successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n message: {\n type: \"string\",\n example: \"Account deleted successfully\",\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n },\n };\n\n paths[pathname]!.delete = { ...(currentPath || {}), ...defaultSpec };\n }\n\n // Find Many Auth Action\n if (!isAuthEndpointDisabled(\"findManyAuthAction\")) {\n const pathname = \"/api/auth-actions\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultSpec = {\n tags: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get all authentication actions\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves a list of all available authentication actions and permissions\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"findManyAuthAction\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description: \"Total number of auth actions\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n if (!isAuthEndpointDisabled(\"findOneAuthAction\")) {\n const pathname = \"/api/auth-actions/{resourceName}\";\n if (!paths[pathname]) paths[pathname] = {};\n const currentPath = paths[pathname]!.get;\n\n const defaultParameters: OpenAPIV3.ParameterObject[] = [\n {\n name: \"resourceName\",\n in: \"path\",\n description: \"Name of the resource to retrieve auth actions for\",\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: [\"Authentication\", ...(currentPath?.tags || [])].filter(\n (tag) => tag !== \"Defaults\"\n ),\n summary:\n currentPath?.summary === pathname || !currentPath?.summary\n ? \"Get authentication actions by resource\"\n : currentPath?.summary,\n description:\n currentPath?.description ||\n \"Retrieves all authentication actions for a specific resource\",\n operationId: currentPath?.operationId?.includes(pathname)\n ? \"findOneAuthAction\"\n : currentPath?.operationId,\n security: [{ BearerAuth: [] }],\n parameters: mergedParameters,\n responses: {\n ...(currentPath?.responses || {}),\n \"200\": currentPath?.responses?.[\"200\"] || {\n description: \"Auth actions for resource retrieved successfully\",\n content: {\n \"application/json\": {\n schema: {\n type: \"object\",\n properties: {\n total: {\n type: \"number\",\n description:\n \"Total number of auth actions for this resource\",\n },\n results: {\n type: \"number\",\n description: \"Number of auth actions returned\",\n },\n data: {\n type: \"array\",\n items: {\n $ref: \"#/components/schemas/FindManyAuthActionSystemSchema\",\n },\n },\n },\n },\n },\n },\n },\n \"401\": currentPath?.responses?.[\"401\"] || {\n description: \"Authentication required\",\n },\n \"403\": currentPath?.responses?.[\"403\"] || {\n description: \"Insufficient permissions\",\n },\n \"404\": currentPath?.responses?.[\"404\"] || {\n description: \"Resource not found\",\n },\n },\n };\n\n paths[pathname]!.get = { ...(currentPath || {}), ...defaultSpec };\n }\n\n return paths;\n}\n"]}
@@ -78,9 +78,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
78
78
  summary: currentPath?.summary === pathname || !currentPath?.summary
79
79
  ? "Retrieve uploaded file"
80
80
  : currentPath?.summary,
81
- description: currentPath?.description ||
82
- `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`,
83
- operationId: currentPath?.operationId || "findFile",
81
+ description: currentPath?.description === pathname || !currentPath?.description
82
+ ? `Serves static files from the upload directory (${baseUploadDir}). This endpoint uses wildcard path matching to serve files from any subdirectory.`
83
+ : currentPath?.description,
84
+ operationId: currentPath?.operationId?.includes(pathname) ||
85
+ !currentPath?.operationId
86
+ ? "findFile"
87
+ : currentPath?.operationId,
84
88
  ...(shouldIncludeSecurity("View") && {
85
89
  security: [{ BearerAuth: [] }],
86
90
  }),
@@ -178,9 +182,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
178
182
  summary: currentPath?.summary === pathname || !currentPath?.summary
179
183
  ? "Upload file(s)"
180
184
  : currentPath?.summary,
181
- description: currentPath?.description ||
182
- "Upload one or multiple files. Supports image processing options for image uploads.",
183
- operationId: currentPath?.operationId || "uploadFile",
185
+ description: currentPath?.description === pathname || !currentPath?.description
186
+ ? "Upload one or multiple files. Supports image processing options for image uploads."
187
+ : currentPath?.description,
188
+ operationId: currentPath?.operationId?.includes(pathname) ||
189
+ !currentPath?.operationId
190
+ ? "uploadFile"
191
+ : currentPath?.operationId,
184
192
  ...(shouldIncludeSecurity("Create") && {
185
193
  security: [{ BearerAuth: [] }],
186
194
  }),
@@ -330,9 +338,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
330
338
  summary: currentPath?.summary === pathname || !currentPath?.summary
331
339
  ? "Update existing file"
332
340
  : currentPath?.summary,
333
- description: currentPath?.description ||
334
- "Replace an existing file with a new one. Deletes the old file and uploads the new one.",
335
- operationId: currentPath?.operationId || "updateFile",
341
+ description: currentPath?.description === pathname || !currentPath?.description
342
+ ? "Replace an existing file with a new one. Deletes the old file and uploads the new one."
343
+ : currentPath?.description,
344
+ operationId: currentPath?.operationId?.includes(pathname) ||
345
+ !currentPath?.operationId
346
+ ? "updateFile"
347
+ : currentPath?.operationId,
336
348
  ...(shouldIncludeSecurity("Update") && {
337
349
  security: [{ BearerAuth: [] }],
338
350
  }),
@@ -451,8 +463,13 @@ export default function getFileUploadJsonSchemaPaths(arkosConfig, existingPaths)
451
463
  summary: currentPath?.summary === pathname || !currentPath?.summary
452
464
  ? "Delete file"
453
465
  : currentPath?.summary,
454
- description: currentPath?.description || "Delete an uploaded file from the server",
455
- operationId: currentPath?.operationId || "deleteFile",
466
+ description: currentPath?.description === pathname || !currentPath?.description
467
+ ? "Delete an uploaded file from the server"
468
+ : currentPath?.description,
469
+ operationId: currentPath?.operationId?.includes(pathname) ||
470
+ !currentPath?.operationId
471
+ ? "deleteFile"
472
+ : currentPath?.operationId,
456
473
  ...(shouldIncludeSecurity("Delete") && {
457
474
  security: [{ BearerAuth: [] }],
458
475
  }),