@venizia/ignis 0.4.8-0 → 0.4.8-1
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.
- package/dist/esm/base/applications/base.d.ts +19 -0
- package/dist/esm/base/applications/base.js +19 -0
- package/dist/esm/base/applications/base.js.map +1 -1
- package/dist/esm/base/applications/boot-steps.d.ts +1 -0
- package/dist/esm/base/applications/boot-steps.js.map +1 -1
- package/dist/esm/base/applications/common/types.d.ts +21 -4
- package/dist/esm/base/applications/common/types.js.map +1 -1
- package/dist/esm/base/metadata/request-context.d.ts +1 -0
- package/dist/esm/base/metadata/request-context.js +1 -0
- package/dist/esm/base/metadata/request-context.js.map +1 -1
- package/dist/esm/components/api-reference/common/constants.d.ts +1 -0
- package/dist/esm/components/api-reference/common/constants.js +1 -0
- package/dist/esm/components/api-reference/common/constants.js.map +1 -1
- package/dist/esm/components/api-reference/common/keys.d.ts +1 -0
- package/dist/esm/components/api-reference/common/keys.js +1 -0
- package/dist/esm/components/api-reference/common/keys.js.map +1 -1
- package/dist/esm/components/api-reference/common/types.d.ts +18 -1
- package/dist/esm/components/api-reference/common/types.js.map +1 -1
- package/dist/esm/components/api-reference/component.d.ts +14 -0
- package/dist/esm/components/api-reference/component.js +14 -0
- package/dist/esm/components/api-reference/component.js.map +1 -1
- package/dist/esm/components/api-reference/ui/factory.d.ts +1 -0
- package/dist/esm/components/api-reference/ui/factory.js +1 -0
- package/dist/esm/components/api-reference/ui/factory.js.map +1 -1
- package/dist/esm/components/api-reference/ui/scalar.d.ts +1 -0
- package/dist/esm/components/api-reference/ui/scalar.js +1 -0
- package/dist/esm/components/api-reference/ui/scalar.js.map +1 -1
- package/dist/esm/components/api-reference/ui/swagger.d.ts +1 -0
- package/dist/esm/components/api-reference/ui/swagger.js +1 -0
- package/dist/esm/components/api-reference/ui/swagger.js.map +1 -1
- package/dist/esm/components/auth/authenticate/component.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/component.js +1 -0
- package/dist/esm/components/auth/authenticate/component.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -0
- package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/jwks/controller.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js +1 -0
- package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js +1 -0
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js +1 -0
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js +1 -0
- package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js +1 -0
- package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jws.strategy.d.ts +1 -0
- package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js +1 -0
- package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js.map +1 -1
- package/dist/esm/components/auth/authorize/adapters/scoped-casbin/common/types.d.ts +2 -0
- package/dist/esm/components/auth/authorize/adapters/scoped-casbin/common/types.js.map +1 -1
- package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.d.ts +1 -0
- package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.js +1 -0
- package/dist/esm/components/auth/authorize/adapters/scoped-casbin/policy-edges.js.map +1 -1
- package/dist/esm/components/auth/authorize/component.d.ts +1 -0
- package/dist/esm/components/auth/authorize/component.js +1 -0
- package/dist/esm/components/auth/authorize/component.js.map +1 -1
- package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.d.ts +1 -0
- package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.js +1 -0
- package/dist/esm/components/auth/authorize/enforcers/casbin.enforcer.js.map +1 -1
- package/dist/esm/components/auth/models/entities/columns.d.ts +1 -0
- package/dist/esm/components/auth/models/entities/columns.js.map +1 -1
- package/dist/esm/components/auth/models/entities/permission.model.d.ts +2 -0
- package/dist/esm/components/auth/models/entities/permission.model.js.map +1 -1
- package/dist/esm/components/auth/models/entities/policy-definition.model.d.ts +1 -0
- package/dist/esm/components/auth/models/entities/policy-definition.model.js.map +1 -1
- package/dist/esm/components/controller/grpc/common/types.d.ts +2 -0
- package/dist/esm/components/controller/grpc/common/types.js +1 -0
- package/dist/esm/components/controller/grpc/common/types.js.map +1 -1
- package/dist/esm/components/controller/grpc/grpc.component.d.ts +1 -0
- package/dist/esm/components/controller/grpc/grpc.component.js +1 -0
- package/dist/esm/components/controller/grpc/grpc.component.js.map +1 -1
- package/dist/esm/components/health-check/common/constants.d.ts +1 -0
- package/dist/esm/components/health-check/common/constants.js +1 -0
- package/dist/esm/components/health-check/common/constants.js.map +1 -1
- package/dist/esm/components/health-check/common/keys.d.ts +1 -0
- package/dist/esm/components/health-check/common/keys.js +1 -0
- package/dist/esm/components/health-check/common/keys.js.map +1 -1
- package/dist/esm/components/health-check/common/rest-paths.d.ts +1 -0
- package/dist/esm/components/health-check/common/rest-paths.js +1 -0
- package/dist/esm/components/health-check/common/rest-paths.js.map +1 -1
- package/dist/esm/components/health-check/common/types.d.ts +24 -3
- package/dist/esm/components/health-check/common/types.js.map +1 -1
- package/dist/esm/components/health-check/component.d.ts +15 -0
- package/dist/esm/components/health-check/component.js +15 -0
- package/dist/esm/components/health-check/component.js.map +1 -1
- package/dist/esm/components/health-check/controller.d.ts +1 -0
- package/dist/esm/components/health-check/controller.js +1 -0
- package/dist/esm/components/health-check/controller.js.map +1 -1
- package/dist/esm/components/mail/common/constants.d.ts +6 -0
- package/dist/esm/components/mail/common/constants.js +5 -0
- package/dist/esm/components/mail/common/constants.js.map +1 -1
- package/dist/esm/components/mail/common/keys.d.ts +1 -0
- package/dist/esm/components/mail/common/keys.js +1 -0
- package/dist/esm/components/mail/common/keys.js.map +1 -1
- package/dist/esm/components/mail/common/types/message.d.ts +10 -0
- package/dist/esm/components/mail/common/types/message.js.map +1 -1
- package/dist/esm/components/mail/common/types/options.d.ts +22 -1
- package/dist/esm/components/mail/common/types/options.js.map +1 -1
- package/dist/esm/components/mail/common/types/queue.d.ts +7 -0
- package/dist/esm/components/mail/common/types/queue.js.map +1 -1
- package/dist/esm/components/mail/common/types/template.d.ts +2 -0
- package/dist/esm/components/mail/common/types/template.js.map +1 -1
- package/dist/esm/components/mail/common/types/verification.d.ts +5 -0
- package/dist/esm/components/mail/common/types/verification.js.map +1 -1
- package/dist/esm/components/mail/component.d.ts +1 -0
- package/dist/esm/components/mail/component.js +1 -0
- package/dist/esm/components/mail/component.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +1 -0
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +1 -0
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/direct-executor.helper.d.ts +1 -0
- package/dist/esm/components/mail/helpers/executors/direct-executor.helper.js +1 -0
- package/dist/esm/components/mail/helpers/executors/direct-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +1 -0
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +1 -0
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.d.ts +1 -0
- package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js +1 -0
- package/dist/esm/components/mail/helpers/transporters/amazon-ses-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.d.ts +1 -0
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +1 -0
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.d.ts +1 -0
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +1 -0
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js.map +1 -1
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.d.ts +2 -0
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +1 -0
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
- package/dist/esm/components/mail/providers/mail-transporter.provider.d.ts +2 -0
- package/dist/esm/components/mail/providers/mail-transporter.provider.js +1 -0
- package/dist/esm/components/mail/providers/mail-transporter.provider.js.map +1 -1
- package/dist/esm/components/mail/services/generators/numeric-code.d.ts +1 -0
- package/dist/esm/components/mail/services/generators/numeric-code.js +1 -0
- package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
- package/dist/esm/components/mail/services/generators/random-token.d.ts +1 -0
- package/dist/esm/components/mail/services/generators/random-token.js +1 -0
- package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
- package/dist/esm/components/mail/services/generators/verification-data.d.ts +1 -0
- package/dist/esm/components/mail/services/generators/verification-data.js +1 -0
- package/dist/esm/components/mail/services/generators/verification-data.js.map +1 -1
- package/dist/esm/components/mail/services/mail.service.d.ts +1 -0
- package/dist/esm/components/mail/services/mail.service.js +1 -0
- package/dist/esm/components/mail/services/mail.service.js.map +1 -1
- package/dist/esm/components/mail/services/template.service.d.ts +1 -0
- package/dist/esm/components/mail/services/template.service.js +1 -0
- package/dist/esm/components/mail/services/template.service.js.map +1 -1
- package/dist/esm/components/mail/utilities/address.utility.d.ts +1 -0
- package/dist/esm/components/mail/utilities/address.utility.js +1 -0
- package/dist/esm/components/mail/utilities/address.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/mime.utility.d.ts +1 -0
- package/dist/esm/components/mail/utilities/mime.utility.js +1 -0
- package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/verification.utility.d.ts +1 -0
- package/dist/esm/components/mail/utilities/verification.utility.js +1 -0
- package/dist/esm/components/mail/utilities/verification.utility.js.map +1 -1
- package/dist/esm/components/request-tracker/component.d.ts +1 -0
- package/dist/esm/components/request-tracker/component.js +1 -0
- package/dist/esm/components/request-tracker/component.js.map +1 -1
- package/dist/esm/components/socket-io/common/keys.d.ts +1 -0
- package/dist/esm/components/socket-io/common/keys.js +1 -0
- package/dist/esm/components/socket-io/common/keys.js.map +1 -1
- package/dist/esm/components/socket-io/component.d.ts +1 -0
- package/dist/esm/components/socket-io/component.js +1 -0
- package/dist/esm/components/socket-io/component.js.map +1 -1
- package/dist/esm/components/static-asset/common/constants.d.ts +3 -0
- package/dist/esm/components/static-asset/common/constants.js +1 -0
- package/dist/esm/components/static-asset/common/constants.js.map +1 -1
- package/dist/esm/components/static-asset/common/keys.d.ts +1 -0
- package/dist/esm/components/static-asset/common/keys.js +1 -0
- package/dist/esm/components/static-asset/common/keys.js.map +1 -1
- package/dist/esm/components/static-asset/common/types.d.ts +42 -6
- package/dist/esm/components/static-asset/common/types.js.map +1 -1
- package/dist/esm/components/static-asset/controller/factory.d.ts +2 -0
- package/dist/esm/components/static-asset/controller/factory.js +1 -0
- package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
- package/dist/esm/components/static-asset/ingest.d.ts +5 -1
- package/dist/esm/components/static-asset/ingest.js.map +1 -1
- package/dist/esm/components/static-asset/models/base.model.d.ts +2 -0
- package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
- package/dist/esm/components/websocket/common/keys.d.ts +1 -0
- package/dist/esm/components/websocket/common/keys.js +1 -0
- package/dist/esm/components/websocket/common/keys.js.map +1 -1
- package/dist/esm/components/websocket/component.d.ts +1 -0
- package/dist/esm/components/websocket/component.js +1 -0
- package/dist/esm/components/websocket/component.js.map +1 -1
- package/dist/esm/testing/assert-application-boots.d.ts +39 -8
- package/dist/esm/testing/assert-application-boots.js +14 -0
- package/dist/esm/testing/assert-application-boots.js.map +1 -1
- package/dist/esm/utilities/drizzle-result.utility.d.ts +1 -0
- package/dist/esm/utilities/drizzle-result.utility.js +1 -0
- package/dist/esm/utilities/drizzle-result.utility.js.map +1 -1
- package/dist/presets/app/preset.json +4 -4
- package/dist/presets/lib/preset.json +3 -3
- package/dist/presets/shared/preset.json +1 -1
- package/package.json +8 -8
|
@@ -92,6 +92,7 @@ const RouteConfigs = {
|
|
|
92
92
|
}),
|
|
93
93
|
},
|
|
94
94
|
};
|
|
95
|
+
/** Serves the health routes: the root summary and `/ping` always, `/stats` only when `IHealthCheckOptions.stats` allows it and the request is authorized. */
|
|
95
96
|
let HealthCheckController = HealthCheckController_1 = class HealthCheckController extends BaseRestController {
|
|
96
97
|
/**
|
|
97
98
|
* Both dependencies arrive through the container, so two applications in one process each get
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../src/components/health-check/controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAsB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAuB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,sBA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,CAAC;CACF,CAAA;AATC;IADC,GAAG,CAAC,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC;;;;qDASnC;AAjEU,qBAAqB;IAM7B,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,sBAAsB,CAAC,oBAAoB,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAE9E,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,sBAAsB,CAAC,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;;GARlE,qBAAqB,CAkEjC","sourcesContent":["import { BaseRestController, type TRouteContext } from '@/base/controllers';\nimport { api, inject } from '@/base/metadata';\nimport { OpenApiResponses } from '@venizia/ignis-kernel';\nimport type { IApplicationInfo } from '@venizia/ignis-kernel';\nimport { z } from '@hono/zod-openapi';\nimport { HTTP, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n HealthCheckBindingKeys,\n HealthCheckHeaders,\n HealthCheckRestPaths,\n type IHealthCheckOptions,\n} from './common';\nimport { HealthCheckReporter } from './reporter';\n\nconst RouteConfigs = {\n ROOT: {\n method: HTTP.Methods.GET,\n path: HealthCheckRestPaths.ROOT,\n responses: OpenApiResponses.jsonResponse({\n schema: z.object({ status: z.string(), timestamp: z.iso.datetime() }).openapi({\n description: 'HealthCheck Schema',\n examples: [{ status: 'ok', timestamp: new Date().toISOString() }],\n }),\n description: 'Health check status',\n }),\n },\n STATS: {\n method: HTTP.Methods.GET,\n path: HealthCheckRestPaths.STATS,\n request: {\n headers: z.object({\n [HealthCheckHeaders.SECRET_KEY]: z.string().optional().openapi({\n description: 'The stats key',\n }),\n }),\n },\n responses: OpenApiResponses.jsonResponse({\n schema: z\n .object({\n status: z.string(),\n timestamp: z.iso.datetime(),\n build: z.object({\n service: z.string(),\n version: z.string(),\n commit: z.string(),\n branch: z.string(),\n builtAt: z.string(),\n }),\n process: z.object({\n pid: z.number(),\n uptime: z.number(),\n uptimeHuman: z.string(),\n runtime: z.string(),\n environment: z.string(),\n }),\n memory: z.object({ rss: z.string(), heapUsed: z.string(), heapTotal: z.string() }),\n })\n .openapi({ description: 'HealthCheck Stats Schema' }),\n description:\n 'Build stamp, process and memory - closed outside the development environments unless enabled',\n }),\n },\n PING: {\n method: HTTP.Methods.POST,\n path: HealthCheckRestPaths.PING,\n request: {\n body: OpenApiResponses.jsonContent({\n description: 'PING | Request body',\n schema: z.object({\n type: z.string().optional().default('PING'),\n message: z.string().min(1).max(255),\n }),\n }),\n },\n responses: OpenApiResponses.jsonResponse({\n schema: z\n .object({\n type: z.string().optional().default('PONG'),\n date: z.iso.datetime(),\n message: z.string(),\n })\n .openapi({\n description: 'HealthCheck PingPong Schema',\n examples: [{ date: new Date().toISOString(), message: 'ok' }],\n }),\n description: 'HealthCheck PingPong Message',\n }),\n },\n} as const;\n\nexport class HealthCheckController extends BaseRestController {\n /**\n * Both dependencies arrive through the container, so two applications in one process each get\n * their own gate - a static field would let the last one to boot decide for every other.\n */\n constructor(\n @inject({ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS, isOptional: true })\n private readonly healthOptions: IHealthCheckOptions = {},\n @inject({ key: HealthCheckBindingKeys.APPLICATION_INFO, isOptional: true })\n private readonly appInfo?: IApplicationInfo,\n ) {\n super({ scope: HealthCheckController.name });\n\n // Note: This is optional declare internal controller route definitions\n this.definitions = RouteConfigs;\n }\n\n override binding(): ValueOrPromise<void> {\n // Public liveness probe: status and clock only. Nothing here names a runtime or a version.\n this.bindRoute({ configs: RouteConfigs.ROOT }).to({\n handler: (context) => {\n return context.json(HealthCheckReporter.buildSummary(), HTTP.ResultCodes.RS_2.Ok);\n },\n });\n\n if (!HealthCheckReporter.isStatsEnabled({ options: this.healthOptions })) {\n this.logger\n .for(this.binding.name)\n .debug('Stats route disabled | path: %s', HealthCheckRestPaths.STATS);\n\n return;\n }\n\n this.bindRoute({ configs: RouteConfigs.STATS }).to({\n handler: (context) => {\n // `context.notFound()`, not a thrown 404: it runs the application's own notFound handler,\n // so the refusal is byte-identical to the answer for a route that was never mounted. A\n // thrown `ApplicationError` serializes a different body and would confirm the route exists.\n if (\n !HealthCheckReporter.isStatsAuthorized({\n options: this.healthOptions,\n header: context.req.header(HealthCheckHeaders.SECRET_KEY),\n })\n ) {\n return context.notFound();\n }\n\n return context.json(\n HealthCheckReporter.buildStats({ options: this.healthOptions, appInfo: this.appInfo }),\n HTTP.ResultCodes.RS_2.Ok,\n );\n },\n });\n }\n\n // Method 3: Using 'decorators' to create a controller route, with an explicit type assertion for the validated request data\n @api({ configs: RouteConfigs.PING })\n pingPong(context: TRouteContext) {\n const { message } = context.req.valid<{ type?: string; message: string }>('json');\n\n // Return type is automatically validated against the response schema\n return context.json(\n { type: 'PONG', date: new Date().toISOString(), message },\n HTTP.ResultCodes.RS_2.Ok,\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../src/components/health-check/controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAsB,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,IAAI,EAAuB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,GAErB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,YAAY,GAAG;IACnB,IAAI,EAAE;QACJ,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG;QACxB,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,SAAS,EAAE,gBAAgB,CAAC,YAAY,CAAC;YACvC,MAAM,EAAE,CAAC,CAAC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AAU,EAAE,IAAI,EAAE,CAAC,CAAA;;GARlE,qBAAqB,CAkEjC","sourcesContent":["import { BaseRestController, type TRouteContext } from '@/base/controllers';\nimport { api, inject } from '@/base/metadata';\nimport { OpenApiResponses } from '@venizia/ignis-kernel';\nimport type { IApplicationInfo } from '@venizia/ignis-kernel';\nimport { z } from '@hono/zod-openapi';\nimport { HTTP, type ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport {\n HealthCheckBindingKeys,\n HealthCheckHeaders,\n HealthCheckRestPaths,\n type IHealthCheckOptions,\n} from './common';\nimport { HealthCheckReporter } from './reporter';\n\nconst RouteConfigs = {\n ROOT: {\n method: HTTP.Methods.GET,\n path: HealthCheckRestPaths.ROOT,\n responses: OpenApiResponses.jsonResponse({\n schema: z.object({ status: z.string(), timestamp: z.iso.datetime() }).openapi({\n description: 'HealthCheck Schema',\n examples: [{ status: 'ok', timestamp: new Date().toISOString() }],\n }),\n description: 'Health check status',\n }),\n },\n STATS: {\n method: HTTP.Methods.GET,\n path: HealthCheckRestPaths.STATS,\n request: {\n headers: z.object({\n [HealthCheckHeaders.SECRET_KEY]: z.string().optional().openapi({\n description: 'The stats key',\n }),\n }),\n },\n responses: OpenApiResponses.jsonResponse({\n schema: z\n .object({\n status: z.string(),\n timestamp: z.iso.datetime(),\n build: z.object({\n service: z.string(),\n version: z.string(),\n commit: z.string(),\n branch: z.string(),\n builtAt: z.string(),\n }),\n process: z.object({\n pid: z.number(),\n uptime: z.number(),\n uptimeHuman: z.string(),\n runtime: z.string(),\n environment: z.string(),\n }),\n memory: z.object({ rss: z.string(), heapUsed: z.string(), heapTotal: z.string() }),\n })\n .openapi({ description: 'HealthCheck Stats Schema' }),\n description:\n 'Build stamp, process and memory - closed outside the development environments unless enabled',\n }),\n },\n PING: {\n method: HTTP.Methods.POST,\n path: HealthCheckRestPaths.PING,\n request: {\n body: OpenApiResponses.jsonContent({\n description: 'PING | Request body',\n schema: z.object({\n type: z.string().optional().default('PING'),\n message: z.string().min(1).max(255),\n }),\n }),\n },\n responses: OpenApiResponses.jsonResponse({\n schema: z\n .object({\n type: z.string().optional().default('PONG'),\n date: z.iso.datetime(),\n message: z.string(),\n })\n .openapi({\n description: 'HealthCheck PingPong Schema',\n examples: [{ date: new Date().toISOString(), message: 'ok' }],\n }),\n description: 'HealthCheck PingPong Message',\n }),\n },\n} as const;\n\n/** Serves the health routes: the root summary and `/ping` always, `/stats` only when `IHealthCheckOptions.stats` allows it and the request is authorized. */\nexport class HealthCheckController extends BaseRestController {\n /**\n * Both dependencies arrive through the container, so two applications in one process each get\n * their own gate - a static field would let the last one to boot decide for every other.\n */\n constructor(\n @inject({ key: HealthCheckBindingKeys.HEALTH_CHECK_OPTIONS, isOptional: true })\n private readonly healthOptions: IHealthCheckOptions = {},\n @inject({ key: HealthCheckBindingKeys.APPLICATION_INFO, isOptional: true })\n private readonly appInfo?: IApplicationInfo,\n ) {\n super({ scope: HealthCheckController.name });\n\n // Note: This is optional declare internal controller route definitions\n this.definitions = RouteConfigs;\n }\n\n override binding(): ValueOrPromise<void> {\n // Public liveness probe: status and clock only. Nothing here names a runtime or a version.\n this.bindRoute({ configs: RouteConfigs.ROOT }).to({\n handler: (context) => {\n return context.json(HealthCheckReporter.buildSummary(), HTTP.ResultCodes.RS_2.Ok);\n },\n });\n\n if (!HealthCheckReporter.isStatsEnabled({ options: this.healthOptions })) {\n this.logger\n .for(this.binding.name)\n .debug('Stats route disabled | path: %s', HealthCheckRestPaths.STATS);\n\n return;\n }\n\n this.bindRoute({ configs: RouteConfigs.STATS }).to({\n handler: (context) => {\n // `context.notFound()`, not a thrown 404: it runs the application's own notFound handler,\n // so the refusal is byte-identical to the answer for a route that was never mounted. A\n // thrown `ApplicationError` serializes a different body and would confirm the route exists.\n if (\n !HealthCheckReporter.isStatsAuthorized({\n options: this.healthOptions,\n header: context.req.header(HealthCheckHeaders.SECRET_KEY),\n })\n ) {\n return context.notFound();\n }\n\n return context.json(\n HealthCheckReporter.buildStats({ options: this.healthOptions, appInfo: this.appInfo }),\n HTTP.ResultCodes.RS_2.Ok,\n );\n },\n });\n }\n\n // Method 3: Using 'decorators' to create a controller route, with an explicit type assertion for the validated request data\n @api({ configs: RouteConfigs.PING })\n pingPong(context: TRouteContext) {\n const { message } = context.req.valid<{ type?: string; message: string }>('json');\n\n // Return type is automatically validated against the response schema\n return context.json(\n { type: 'PONG', date: new Date().toISOString(), message },\n HTTP.ResultCodes.RS_2.Ok,\n );\n }\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TConstValue } from '@venizia/ignis-helpers/common';
|
|
2
|
+
/** Fallbacks for mail sending: the batch concurrency, the `from` address used when neither the message nor the options set one, and the attachment size cap. */
|
|
2
3
|
export declare class MailDefaults {
|
|
3
4
|
static readonly BATCH_CONCURRENCY = 5;
|
|
4
5
|
static readonly FALLBACK_FROM = "noreply@example.com";
|
|
@@ -17,9 +18,11 @@ export declare class MailErrorCodes {
|
|
|
17
18
|
static readonly ATTACHMENT_TOO_LARGE: string;
|
|
18
19
|
static readonly BODY_SOURCE_REFUSED: string;
|
|
19
20
|
}
|
|
21
|
+
/** Messages thrown by the mail queue executors. */
|
|
20
22
|
export declare class MailExecutorErrors {
|
|
21
23
|
static readonly PROCESSOR_NOT_SET = "Processor not set. Call setProcessor() first.";
|
|
22
24
|
}
|
|
25
|
+
/** Values of `IMailQueueExecutorConfig.type`, selecting how verification mails are queued: sent inline, held in process, or handed to BullMQ. */
|
|
23
26
|
export declare class MailQueueExecutorTypes {
|
|
24
27
|
static readonly DIRECT = "direct";
|
|
25
28
|
static readonly INTERNAL_QUEUE = "internal-queue";
|
|
@@ -27,6 +30,7 @@ export declare class MailQueueExecutorTypes {
|
|
|
27
30
|
static readonly SCHEME_SET: Set<string>;
|
|
28
31
|
static isValid(value: string): boolean;
|
|
29
32
|
}
|
|
33
|
+
/** Values of `IBullMQMailExecutorOpts.mode`: `queue-only` enqueues jobs without starting workers, `worker-only` starts workers without a queue, `both` does each. */
|
|
30
34
|
export declare class BullMQExecutorModes {
|
|
31
35
|
static readonly QUEUE_ONLY = "queue-only";
|
|
32
36
|
static readonly WORKER_ONLY = "worker-only";
|
|
@@ -34,12 +38,14 @@ export declare class BullMQExecutorModes {
|
|
|
34
38
|
static readonly MODE_SET: Set<string>;
|
|
35
39
|
static isValid(value: string): boolean;
|
|
36
40
|
}
|
|
41
|
+
/** Values of `TMailOptions.provider`, naming the transport the mail component builds. */
|
|
37
42
|
export declare class MailProviders {
|
|
38
43
|
static readonly NODEMAILER = "nodemailer";
|
|
39
44
|
static readonly MAILGUN = "mailgun";
|
|
40
45
|
static readonly CUSTOM = "custom";
|
|
41
46
|
static readonly AMAZON_SES = "amazon-ses";
|
|
42
47
|
}
|
|
48
|
+
/** Union of the `MailProviders` values. */
|
|
43
49
|
export type TMailProvider = TConstValue<typeof MailProviders>;
|
|
44
50
|
/** How the delay between two attempts to send a queued mail grows: FIXED stays the same, EXPONENTIAL doubles. */
|
|
45
51
|
export declare class MailBackoffTypes {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MessageCode } from '@venizia/ignis-helpers/core';
|
|
2
|
+
/** Fallbacks for mail sending: the batch concurrency, the `from` address used when neither the message nor the options set one, and the attachment size cap. */
|
|
2
3
|
export class MailDefaults {
|
|
3
4
|
static { this.BATCH_CONCURRENCY = 5; }
|
|
4
5
|
static { this.FALLBACK_FROM = 'noreply@example.com'; }
|
|
@@ -33,9 +34,11 @@ export class MailErrorCodes {
|
|
|
33
34
|
parts: ['core', 'mail', 'body_source_refused'],
|
|
34
35
|
}); }
|
|
35
36
|
}
|
|
37
|
+
/** Messages thrown by the mail queue executors. */
|
|
36
38
|
export class MailExecutorErrors {
|
|
37
39
|
static { this.PROCESSOR_NOT_SET = 'Processor not set. Call setProcessor() first.'; }
|
|
38
40
|
}
|
|
41
|
+
/** Values of `IMailQueueExecutorConfig.type`, selecting how verification mails are queued: sent inline, held in process, or handed to BullMQ. */
|
|
39
42
|
export class MailQueueExecutorTypes {
|
|
40
43
|
static { this.DIRECT = 'direct'; }
|
|
41
44
|
static { this.INTERNAL_QUEUE = 'internal-queue'; }
|
|
@@ -45,6 +48,7 @@ export class MailQueueExecutorTypes {
|
|
|
45
48
|
return this.SCHEME_SET.has(value);
|
|
46
49
|
}
|
|
47
50
|
}
|
|
51
|
+
/** Values of `IBullMQMailExecutorOpts.mode`: `queue-only` enqueues jobs without starting workers, `worker-only` starts workers without a queue, `both` does each. */
|
|
48
52
|
export class BullMQExecutorModes {
|
|
49
53
|
static { this.QUEUE_ONLY = 'queue-only'; }
|
|
50
54
|
static { this.WORKER_ONLY = 'worker-only'; }
|
|
@@ -54,6 +58,7 @@ export class BullMQExecutorModes {
|
|
|
54
58
|
return this.MODE_SET.has(value);
|
|
55
59
|
}
|
|
56
60
|
}
|
|
61
|
+
/** Values of `TMailOptions.provider`, naming the transport the mail component builds. */
|
|
57
62
|
export class MailProviders {
|
|
58
63
|
static { this.NODEMAILER = 'nodemailer'; }
|
|
59
64
|
static { this.MAILGUN = 'mailgun'; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../src/components/mail/common/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,OAAO,YAAY;aACP,sBAAiB,GAAG,CAAC,CAAC;aACtB,kBAAa,GAAG,qBAAqB,CAAC;IACtD,mFAAmF;aACnE,yBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;;AAG1D,yKAAyK;AACzK,MAAM,OAAO,cAAc;aACT,0BAAqB,GAAG,WAAW,CAAC,KAAK,CAAC;QACxD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,uBAAuB,CAAC;KACjD,CAAC,CAAC;aAEa,gBAAW,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa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9F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;;AAGH,qKAAqK;AACrK,MAAM,OAAO,mBAAmB;aACd,eAAU,GAAG,YAAY,CAAC;aAC1B,gBAAW,GAAG,aAAa,CAAC;aAC5B,SAAI,GAAG,MAAM,CAAC;aAEd,aAAQ,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3F,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;;AAGH,yFAAyF;AACzF,MAAM,OAAO,aAAa;aACR,eAAU,GAAG,YAAY,CAAC;aAC1B,YAAO,GAAG,SAAS,CAAC;aACpB,WAAM,GAAG,QAAQ,CAAC;IAClC,uHAAuH;aACvG,eAAU,GAAG,YAAY,CAAC;;AAM5C,iHAAiH;AACjH,MAAM,OAAO,gBAAgB;aACX,UAAK,GAAG,OAAO,CAAC;aAChB,gBAAW,GAAG,aAAa,CAAC;aAE5B,eAAU,GAAG,IAAI,GAAG,CAAS,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAE7E,MAAM,CAAC,OAAO,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC","sourcesContent":["import type { TConstValue } from '@venizia/ignis-helpers/common';\nimport { MessageCode } from '@venizia/ignis-helpers/core';\n\n/** Fallbacks for mail sending: the batch concurrency, the `from` address used when neither the message nor the options set one, and the attachment size cap. */\nexport class MailDefaults {\n static readonly BATCH_CONCURRENCY = 5;\n static readonly FALLBACK_FROM = 'noreply@example.com';\n /** Bytes of attachment content one message may carry, all attachments together. */\n static readonly MAX_ATTACHMENT_BYTES = 25 * 1024 * 1024;\n}\n\n/** Built via {@link MessageCode.build}: `ApplicationError` lower-cases codes, so a SCREAMING_CASE literal would reach the client in a spelling no const here matches. */\nexport class MailErrorCodes {\n static readonly INVALID_CONFIGURATION = MessageCode.build({\n parts: ['core', 'mail', 'invalid_configuration'],\n });\n\n static readonly SEND_FAILED = MessageCode.build({ parts: ['core', 'mail', 'send_failed'] });\n static readonly VERIFICATION_FAILED = MessageCode.build({\n parts: ['core', 'mail', 'verification_failed'],\n });\n\n static readonly INVALID_RECIPIENT = MessageCode.build({\n parts: ['core', 'mail', 'invalid_recipient'],\n });\n\n static readonly BATCH_SEND_FAILED = MessageCode.build({\n parts: ['core', 'mail', 'batch_send_failed'],\n });\n\n static readonly TEMPLATE_NOT_FOUND = MessageCode.build({\n parts: ['core', 'mail', 'template_not_found'],\n });\n\n static readonly ATTACHMENT_PATH_REFUSED = MessageCode.build({\n parts: ['core', 'mail', 'attachment_path_refused'],\n });\n\n static readonly ATTACHMENT_TOO_LARGE = MessageCode.build({\n parts: ['core', 'mail', 'attachment_too_large'],\n });\n\n static readonly BODY_SOURCE_REFUSED = MessageCode.build({\n parts: ['core', 'mail', 'body_source_refused'],\n });\n}\n\n/** Messages thrown by the mail queue executors. */\nexport class MailExecutorErrors {\n static readonly PROCESSOR_NOT_SET = 'Processor not set. Call setProcessor() first.';\n}\n\n/** Values of `IMailQueueExecutorConfig.type`, selecting how verification mails are queued: sent inline, held in process, or handed to BullMQ. */\nexport class MailQueueExecutorTypes {\n static readonly DIRECT = 'direct';\n static readonly INTERNAL_QUEUE = 'internal-queue';\n static readonly BULLMQ = 'bullmq';\n\n static readonly SCHEME_SET = new Set<string>([this.DIRECT, this.INTERNAL_QUEUE, this.BULLMQ]);\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Values of `IBullMQMailExecutorOpts.mode`: `queue-only` enqueues jobs without starting workers, `worker-only` starts workers without a queue, `both` does each. */\nexport class BullMQExecutorModes {\n static readonly QUEUE_ONLY = 'queue-only';\n static readonly WORKER_ONLY = 'worker-only';\n static readonly BOTH = 'both';\n\n static readonly MODE_SET = new Set<string>([this.QUEUE_ONLY, this.WORKER_ONLY, this.BOTH]);\n static isValid(value: string): boolean {\n return this.MODE_SET.has(value);\n }\n}\n\n/** Values of `TMailOptions.provider`, naming the transport the mail component builds. */\nexport class MailProviders {\n static readonly NODEMAILER = 'nodemailer';\n static readonly MAILGUN = 'mailgun';\n static readonly CUSTOM = 'custom';\n // Amazon SES supports both SMTP and HTTPS - this provider is the HTTPS API path; SMTP goes through NODEMAILER instead.\n static readonly AMAZON_SES = 'amazon-ses';\n}\n\n/** Union of the `MailProviders` values. */\nexport type TMailProvider = TConstValue<typeof MailProviders>;\n\n/** How the delay between two attempts to send a queued mail grows: FIXED stays the same, EXPONENTIAL doubles. */\nexport class MailBackoffTypes {\n static readonly FIXED = 'fixed';\n static readonly EXPONENTIAL = 'exponential';\n\n static readonly SCHEME_SET = new Set<string>([this.FIXED, this.EXPONENTIAL]);\n\n static isValid(value: string): boolean {\n return this.SCHEME_SET.has(value);\n }\n}\n\n/** Valid mail backoff type values. */\nexport type TMailBackoffType = TConstValue<typeof MailBackoffTypes>;\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** DI binding keys the mail component registers and reads: options, queue executor config, transport and queue provider/instance, services and verification generators. */
|
|
1
2
|
export declare class MailKeys {
|
|
2
3
|
static readonly MAIL_OPTIONS = "@app/components/mail/options";
|
|
3
4
|
static readonly MAIL_QUEUE_EXECUTOR_CONFIG = "@app/components/mail/queue/executor-config";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/** DI binding keys the mail component registers and reads: options, queue executor config, transport and queue provider/instance, services and verification generators. */
|
|
1
2
|
export class MailKeys {
|
|
2
3
|
// Options & Configs
|
|
3
4
|
static { this.MAIL_OPTIONS = '@app/components/mail/options'; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/mail/common/keys.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,QAAQ;IACnB,oBAAoB;aACJ,iBAAY,GAAG,8BAA8B,CAAC;aAC9C,+BAA0B,GAAG,4CAA4C,CAAC;IAE1F,cAAc;aACE,4BAAuB,GAAG,yCAAyC,CAAC;aACpE,4BAAuB,GAAG,yCAAyC,CAAC;IAEpF,WAAW;aACK,yBAAoB,GAAG,+CAA+C,CAAC;aACvE,iBAAY,GAAG,8BAA8B,CAAC;IAE9D,aAAa;aACG,qCAAgC,GAC9C,kDAAkD,CAAC;aAErC,sCAAiC,GAC/C,mDAAmD,CAAC;aAEtC,qCAAgC,GAC9C,kDAAkD,CAAC;IAErD,QAAQ;aACQ,iCAA4B,GAAG,8CAA8C,CAAC;aAC9E,iCAA4B,GAAG,8CAA8C,CAAC","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/mail/common/keys.ts"],"names":[],"mappings":"AAAA,2KAA2K;AAC3K,MAAM,OAAO,QAAQ;IACnB,oBAAoB;aACJ,iBAAY,GAAG,8BAA8B,CAAC;aAC9C,+BAA0B,GAAG,4CAA4C,CAAC;IAE1F,cAAc;aACE,4BAAuB,GAAG,yCAAyC,CAAC;aACpE,4BAAuB,GAAG,yCAAyC,CAAC;IAEpF,WAAW;aACK,yBAAoB,GAAG,+CAA+C,CAAC;aACvE,iBAAY,GAAG,8BAA8B,CAAC;IAE9D,aAAa;aACG,qCAAgC,GAC9C,kDAAkD,CAAC;aAErC,sCAAiC,GAC/C,mDAAmD,CAAC;aAEtC,qCAAgC,GAC9C,kDAAkD,CAAC;IAErD,QAAQ;aACQ,iCAA4B,GAAG,8CAA8C,CAAC;aAC9E,iCAA4B,GAAG,8CAA8C,CAAC","sourcesContent":["/** DI binding keys the mail component registers and reads: options, queue executor config, transport and queue provider/instance, services and verification generators. */\nexport class MailKeys {\n // Options & Configs\n static readonly MAIL_OPTIONS = '@app/components/mail/options';\n static readonly MAIL_QUEUE_EXECUTOR_CONFIG = '@app/components/mail/queue/executor-config';\n\n // Transporter\n static readonly MAIL_TRANSPORT_PROVIDER = '@app/components/mail/transport-provider';\n static readonly MAIL_TRANSPORT_INSTANCE = '@app/components/mail/transport-instance';\n\n // Services\n static readonly MAIL_TEMPLATE_ENGINE = '@app/components/mail/services/template-engine';\n static readonly MAIL_SERVICE = '@app/components/mail/service';\n\n // Generators\n static readonly MAIL_VERIFICATION_CODE_GENERATOR =\n '@app/components/mail/verification/code-generator';\n\n static readonly MAIL_VERIFICATION_TOKEN_GENERATOR =\n '@app/components/mail/verification/token-generator';\n\n static readonly MAIL_VERIFICATION_DATA_GENERATOR =\n '@app/components/mail/verification/data-generator';\n\n // Queue\n static readonly MAIL_QUEUE_EXECUTOR_PROVIDER = '@app/components/mail/queue-executor-provider';\n static readonly MAIL_QUEUE_EXECUTOR_INSTANCE = '@app/components/mail/queue-executor-instance';\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Readable } from 'node:stream';
|
|
2
|
+
/** One attachment on an `IMailMessage`. Give `content` or `path`; `cid` makes the part inline, referenced as `cid:<value>` from the HTML body. */
|
|
2
3
|
export interface IMailAttachment {
|
|
3
4
|
filename?: string;
|
|
4
5
|
contentType?: string;
|
|
@@ -9,7 +10,13 @@ export interface IMailAttachment {
|
|
|
9
10
|
cid?: string;
|
|
10
11
|
[key: string]: any;
|
|
11
12
|
}
|
|
13
|
+
/** A mail to send. `to` needs at least one recipient, `subject` is required, and at least one of `text` or `html` must be set; `from` falls back to the options' `from` (with `fromName`). */
|
|
12
14
|
export interface IMailMessage {
|
|
15
|
+
/**
|
|
16
|
+
* Sender of this message.
|
|
17
|
+
*
|
|
18
|
+
* @default the mail options' `from` with `fromName`, else `MailDefaults.FALLBACK_FROM`
|
|
19
|
+
*/
|
|
13
20
|
from?: string;
|
|
14
21
|
to: string | string[];
|
|
15
22
|
cc?: string | string[];
|
|
@@ -23,17 +30,20 @@ export interface IMailMessage {
|
|
|
23
30
|
requireValidate?: boolean;
|
|
24
31
|
[key: string]: any;
|
|
25
32
|
}
|
|
33
|
+
/** Outcome of one send: `success` plus the provider `messageId`, or an `error` string when the send failed. */
|
|
26
34
|
export interface IMailSendResult {
|
|
27
35
|
success: boolean;
|
|
28
36
|
messageId?: string;
|
|
29
37
|
response?: any;
|
|
30
38
|
error?: string;
|
|
31
39
|
}
|
|
40
|
+
/** A mail provider backend. `verify` checks the connection or credentials; `close`, when present, releases the client. */
|
|
32
41
|
export interface IMailTransport {
|
|
33
42
|
send(message: IMailMessage): Promise<IMailSendResult>;
|
|
34
43
|
verify(): Promise<boolean>;
|
|
35
44
|
close?(): Promise<void>;
|
|
36
45
|
}
|
|
46
|
+
/** The service callers use to send mail; wraps the configured `IMailTransport`. */
|
|
37
47
|
export interface IMailService {
|
|
38
48
|
send(message: IMailMessage): Promise<IMailSendResult>;
|
|
39
49
|
sendBatch(messages: IMailMessage[], options?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/message.ts"],"names":[],"mappings":"","sourcesContent":["import type { Readable } from 'node:stream';\n\nexport interface IMailAttachment {\n filename?: string;\n contentType?: string;\n /** A file under the mail options' `attachmentRoot`; refused when no root is set. */\n path?: string;\n content?: string | Buffer | Uint8Array | Readable | ReadableStream<Uint8Array>;\n encoding?: BufferEncoding;\n cid?: string;\n [key: string]: any;\n}\n\nexport interface IMailMessage {\n from?: string;\n to: string | string[];\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string;\n subject: string;\n text?: string;\n html?: string;\n attachments?: IMailAttachment[];\n headers?: Record<string, string>;\n requireValidate?: boolean;\n [key: string]: any;\n}\n\nexport interface IMailSendResult {\n success: boolean;\n messageId?: string;\n response?: any;\n error?: string;\n}\n\nexport interface IMailTransport {\n send(message: IMailMessage): Promise<IMailSendResult>;\n verify(): Promise<boolean>;\n close?(): Promise<void>;\n}\n\nexport interface IMailService {\n send(message: IMailMessage): Promise<IMailSendResult>;\n sendBatch(\n messages: IMailMessage[],\n options?: {\n concurrency?: number;\n },\n ): Promise<IMailSendResult[]>;\n sendTemplate(opts: {\n templateName: string;\n data: Record<string, any>;\n recipients: string | string[];\n options?: Partial<IMailMessage>;\n }): Promise<IMailSendResult>;\n verify(): Promise<boolean>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/message.ts"],"names":[],"mappings":"","sourcesContent":["import type { Readable } from 'node:stream';\n\n/** One attachment on an `IMailMessage`. Give `content` or `path`; `cid` makes the part inline, referenced as `cid:<value>` from the HTML body. */\nexport interface IMailAttachment {\n filename?: string;\n contentType?: string;\n /** A file under the mail options' `attachmentRoot`; refused when no root is set. */\n path?: string;\n content?: string | Buffer | Uint8Array | Readable | ReadableStream<Uint8Array>;\n encoding?: BufferEncoding;\n cid?: string;\n [key: string]: any;\n}\n\n/** A mail to send. `to` needs at least one recipient, `subject` is required, and at least one of `text` or `html` must be set; `from` falls back to the options' `from` (with `fromName`). */\nexport interface IMailMessage {\n /**\n * Sender of this message.\n *\n * @default the mail options' `from` with `fromName`, else `MailDefaults.FALLBACK_FROM`\n */\n from?: string;\n to: string | string[];\n cc?: string | string[];\n bcc?: string | string[];\n replyTo?: string;\n subject: string;\n text?: string;\n html?: string;\n attachments?: IMailAttachment[];\n headers?: Record<string, string>;\n requireValidate?: boolean;\n [key: string]: any;\n}\n\n/** Outcome of one send: `success` plus the provider `messageId`, or an `error` string when the send failed. */\nexport interface IMailSendResult {\n success: boolean;\n messageId?: string;\n response?: any;\n error?: string;\n}\n\n/** A mail provider backend. `verify` checks the connection or credentials; `close`, when present, releases the client. */\nexport interface IMailTransport {\n send(message: IMailMessage): Promise<IMailSendResult>;\n verify(): Promise<boolean>;\n close?(): Promise<void>;\n}\n\n/** The service callers use to send mail; wraps the configured `IMailTransport`. */\nexport interface IMailService {\n send(message: IMailMessage): Promise<IMailSendResult>;\n sendBatch(\n messages: IMailMessage[],\n options?: {\n concurrency?: number;\n },\n ): Promise<IMailSendResult[]>;\n sendTemplate(opts: {\n templateName: string;\n data: Record<string, any>;\n recipients: string | string[];\n options?: Partial<IMailMessage>;\n }): Promise<IMailSendResult>;\n verify(): Promise<boolean>;\n}\n"]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { AnyType } from '@venizia/ignis-helpers/common';
|
|
2
2
|
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
|
|
3
3
|
import type { IMailTransport } from './message.js';
|
|
4
|
+
/** Options shared by every mail provider. */
|
|
4
5
|
export interface IBaseMailOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Sender used when a message sets none.
|
|
8
|
+
*
|
|
9
|
+
* @default MailDefaults.FALLBACK_FROM
|
|
10
|
+
*/
|
|
5
11
|
from?: string;
|
|
6
12
|
fromName?: string;
|
|
7
13
|
/**
|
|
@@ -9,34 +15,46 @@ export interface IBaseMailOptions {
|
|
|
9
15
|
* refused if it lands outside, symlinks included. Unset, every `path` is refused.
|
|
10
16
|
*/
|
|
11
17
|
attachmentRoot?: string;
|
|
12
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Bytes of attachment content one message may carry, all attachments together.
|
|
20
|
+
*
|
|
21
|
+
* @default MailDefaults.MAX_ATTACHMENT_BYTES
|
|
22
|
+
*/
|
|
13
23
|
maxAttachmentBytes?: number;
|
|
14
24
|
}
|
|
25
|
+
/** Mail options for the `nodemailer` provider; `module` hands over the `nodemailer` module instead of loading it by name. */
|
|
15
26
|
export interface INodemailerMailOptions extends IBaseMailOptions {
|
|
16
27
|
provider: 'nodemailer';
|
|
17
28
|
config: TNodemailerConfig;
|
|
18
29
|
module?: TNodemailerModule;
|
|
19
30
|
}
|
|
31
|
+
/** Mail options for the `mailgun` provider; `config` needs `username`, `key` and `domain`, and `module` hands over the `mailgun.js` module. */
|
|
20
32
|
export interface IMailgunMailOptions extends IBaseMailOptions {
|
|
21
33
|
provider: 'mailgun';
|
|
22
34
|
config: TMailgunConfig;
|
|
23
35
|
module?: TMailgunModule;
|
|
24
36
|
}
|
|
37
|
+
/** Mail options for the `amazon-ses` provider (SES HTTPS API); use `nodemailer` for SES over SMTP. */
|
|
25
38
|
export interface IAmazonSesMailOptions extends IBaseMailOptions {
|
|
26
39
|
provider: 'amazon-ses';
|
|
27
40
|
config: TAmazonSesConfig;
|
|
28
41
|
module?: TAmazonSesModule;
|
|
29
42
|
}
|
|
43
|
+
/** Mail options for the `custom` provider; `config` is the transport to use as is. */
|
|
30
44
|
export interface ICustomMailOptions extends IBaseMailOptions {
|
|
31
45
|
provider: 'custom';
|
|
32
46
|
config: IMailTransport;
|
|
33
47
|
}
|
|
48
|
+
/** Mail options with an arbitrary provider name and config; accepted by the type, but the transport provider throws on a name it does not support. */
|
|
34
49
|
export interface IGenericMailOptions extends IBaseMailOptions {
|
|
35
50
|
provider: string;
|
|
36
51
|
config: Record<string, AnyType>;
|
|
37
52
|
}
|
|
53
|
+
/** Options passed to the mail component, discriminated by `provider`. */
|
|
38
54
|
export type TMailOptions = INodemailerMailOptions | IAmazonSesMailOptions | IMailgunMailOptions | ICustomMailOptions | IGenericMailOptions;
|
|
55
|
+
/** Nodemailer `createTransport` argument: a transport instance, SMTP options or a connection URL. */
|
|
39
56
|
export type TNodemailerConfig = SMTPTransport | SMTPTransport.Options | string;
|
|
57
|
+
/** Mailgun client options (`mailgun.js`) plus the sending `domain`. */
|
|
40
58
|
export type TMailgunConfig = AnyType & {
|
|
41
59
|
domain: string;
|
|
42
60
|
};
|
|
@@ -50,7 +68,9 @@ export type TMailgunConfig = AnyType & {
|
|
|
50
68
|
export type TNodemailerModule = {
|
|
51
69
|
createTransport: (config: AnyType, defaults?: AnyType) => AnyType;
|
|
52
70
|
};
|
|
71
|
+
/** The `mailgun.js` class, as a constructor taking the form-data implementation. */
|
|
53
72
|
export type TMailgunModule = new (formData: AnyType) => AnyType;
|
|
73
|
+
/** Amazon SES client configuration: `region` is required; `credentials` and `endpoint` are optional. */
|
|
54
74
|
export type TAmazonSesConfig = {
|
|
55
75
|
region: string;
|
|
56
76
|
credentials?: {
|
|
@@ -66,6 +86,7 @@ export type TAmazonSesModule<TConfig extends AnyType = AnyType, TClient extends
|
|
|
66
86
|
SendEmailCommand: new (input: AnyType) => AnyType;
|
|
67
87
|
GetAccountCommand: new (input?: AnyType) => AnyType;
|
|
68
88
|
};
|
|
89
|
+
/** An Amazon SES client with the command classes the transport sends and verifies with. */
|
|
69
90
|
export type TAmazonSesClient = Pick<TAmazonSesModule, 'SendEmailCommand' | 'GetAccountCommand'> & {
|
|
70
91
|
client: AnyType;
|
|
71
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/options.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnyType } from '@venizia/ignis-helpers/common';\nimport type SMTPTransport from 'nodemailer/lib/smtp-transport';\nimport type { IMailTransport } from './message';\n\nexport interface IBaseMailOptions {\n from?: string;\n fromName?: string;\n /**\n * The only directory an `attachment.path` may be read from; `path` is resolved against it and\n * refused if it lands outside, symlinks included. Unset, every `path` is refused.\n */\n attachmentRoot?: string;\n
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/options.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnyType } from '@venizia/ignis-helpers/common';\nimport type SMTPTransport from 'nodemailer/lib/smtp-transport';\nimport type { IMailTransport } from './message';\n\n/** Options shared by every mail provider. */\nexport interface IBaseMailOptions {\n /**\n * Sender used when a message sets none.\n *\n * @default MailDefaults.FALLBACK_FROM\n */\n from?: string;\n fromName?: string;\n /**\n * The only directory an `attachment.path` may be read from; `path` is resolved against it and\n * refused if it lands outside, symlinks included. Unset, every `path` is refused.\n */\n attachmentRoot?: string;\n /**\n * Bytes of attachment content one message may carry, all attachments together.\n *\n * @default MailDefaults.MAX_ATTACHMENT_BYTES\n */\n maxAttachmentBytes?: number;\n}\n\n/** Mail options for the `nodemailer` provider; `module` hands over the `nodemailer` module instead of loading it by name. */\nexport interface INodemailerMailOptions extends IBaseMailOptions {\n provider: 'nodemailer';\n config: TNodemailerConfig;\n module?: TNodemailerModule;\n}\n\n/** Mail options for the `mailgun` provider; `config` needs `username`, `key` and `domain`, and `module` hands over the `mailgun.js` module. */\nexport interface IMailgunMailOptions extends IBaseMailOptions {\n provider: 'mailgun';\n config: TMailgunConfig;\n module?: TMailgunModule;\n}\n\n/** Mail options for the `amazon-ses` provider (SES HTTPS API); use `nodemailer` for SES over SMTP. */\nexport interface IAmazonSesMailOptions extends IBaseMailOptions {\n provider: 'amazon-ses';\n config: TAmazonSesConfig;\n module?: TAmazonSesModule;\n}\n\n/** Mail options for the `custom` provider; `config` is the transport to use as is. */\nexport interface ICustomMailOptions extends IBaseMailOptions {\n provider: 'custom';\n config: IMailTransport;\n}\n\n/** Mail options with an arbitrary provider name and config; accepted by the type, but the transport provider throws on a name it does not support. */\nexport interface IGenericMailOptions extends IBaseMailOptions {\n provider: string;\n config: Record<string, AnyType>;\n}\n\n/** Options passed to the mail component, discriminated by `provider`. */\nexport type TMailOptions =\n | INodemailerMailOptions\n | IAmazonSesMailOptions\n | IMailgunMailOptions\n | ICustomMailOptions\n | IGenericMailOptions;\n\n/** Nodemailer `createTransport` argument: a transport instance, SMTP options or a connection URL. */\nexport type TNodemailerConfig = SMTPTransport | SMTPTransport.Options | string;\n\n// MailgunClientOptions & {domain: string}\n/** Mailgun client options (`mailgun.js`) plus the sending `domain`. */\nexport type TMailgunConfig = AnyType & { domain: string };\n\n/**\n * The peer module itself, handed over by an application that already holds it. A `bun build\n * --compile` binary carries no `node_modules`, so the runtime lookup these transports fall back to\n * has nothing to resolve against - passing the module through the options is what a compiled\n * application does instead. Typed as the shape each transport actually uses, so a wrong module is\n * a compile error rather than a boot crash.\n */\nexport type TNodemailerModule = {\n createTransport: (config: AnyType, defaults?: AnyType) => AnyType;\n};\n\n/** The `mailgun.js` class, as a constructor taking the form-data implementation. */\nexport type TMailgunModule = new (formData: AnyType) => AnyType;\n\n/** Amazon SES client configuration: `region` is required; `credentials` and `endpoint` are optional. */\nexport type TAmazonSesConfig = {\n region: string;\n credentials?: { accessKeyId: string; secretAccessKey: string; sessionToken?: string };\n endpoint?: string;\n};\n\n/** Same story as {@link TNodemailerModule} - a compiled binary hands this over explicitly since there is no `node_modules` to resolve `@aws-sdk/client-sesv2` against. */\nexport type TAmazonSesModule<\n TConfig extends AnyType = AnyType,\n TClient extends AnyType = AnyType,\n> = {\n SESv2Client: new (config: TConfig) => TClient;\n SendEmailCommand: new (input: AnyType) => AnyType;\n GetAccountCommand: new (input?: AnyType) => AnyType;\n};\n\n/** An Amazon SES client with the command classes the transport sends and verifies with. */\nexport type TAmazonSesClient = Pick<TAmazonSesModule, 'SendEmailCommand' | 'GetAccountCommand'> & {\n client: AnyType;\n};\n"]}
|
|
@@ -2,6 +2,7 @@ import type { TMailBackoffType } from '../constants.js';
|
|
|
2
2
|
import type { TConstValue } from '@venizia/ignis-helpers/common';
|
|
3
3
|
import type { IRedisSingleHelperOptions } from '@venizia/ignis-helpers';
|
|
4
4
|
import type { BullMQExecutorModes, MailQueueExecutorTypes } from '../constants.js';
|
|
5
|
+
/** Per-job options for a queued verification mail. `delay` and `backoff.delay` are milliseconds; `attempts` is the total number of tries, first included. */
|
|
5
6
|
export interface IMailQueueOptions {
|
|
6
7
|
priority?: number;
|
|
7
8
|
delay?: number;
|
|
@@ -11,18 +12,21 @@ export interface IMailQueueOptions {
|
|
|
11
12
|
delay: number;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
15
|
+
/** Result a queue processor returns for one verification mail; returning `success: false` marks the job failed so it is retried. */
|
|
14
16
|
export interface IMailProcessorResult {
|
|
15
17
|
success: boolean;
|
|
16
18
|
message: string;
|
|
17
19
|
expiresInMinutes: number;
|
|
18
20
|
nextResendAt?: string;
|
|
19
21
|
}
|
|
22
|
+
/** Result of enqueueing a verification mail; `queued` is `false` and `result` is set when the executor ran the mail inline. */
|
|
20
23
|
export interface IMailQueueResult {
|
|
21
24
|
jobId?: string;
|
|
22
25
|
queued: boolean;
|
|
23
26
|
message: string;
|
|
24
27
|
result?: IMailProcessorResult;
|
|
25
28
|
}
|
|
29
|
+
/** Queues verification mails and runs them through the processor registered with `setProcessor`. */
|
|
26
30
|
export interface IMailQueueExecutor {
|
|
27
31
|
enqueueVerificationEmail(email: string, options?: IMailQueueOptions): Promise<IMailQueueResult>;
|
|
28
32
|
setProcessor(processor: (email: string) => Promise<IMailProcessorResult>): void;
|
|
@@ -35,9 +39,11 @@ export interface IQueueJobPayload {
|
|
|
35
39
|
attempts: number;
|
|
36
40
|
scheduledAt: number;
|
|
37
41
|
}
|
|
42
|
+
/** Options of the in-process queue executor; `identifier` names its queue. */
|
|
38
43
|
export interface IInternalQueueMailExecutorOpts {
|
|
39
44
|
identifier: string;
|
|
40
45
|
}
|
|
46
|
+
/** Options of the BullMQ mail executor: the Redis connection, the queue `identifier` and BullMQ `name`, and which of queue and workers this process runs. */
|
|
41
47
|
export interface IBullMQMailExecutorOpts {
|
|
42
48
|
/** `redis.module` passes `ioredis` itself - see `module` below for why. */
|
|
43
49
|
redis: IRedisSingleHelperOptions;
|
|
@@ -49,6 +55,7 @@ export interface IBullMQMailExecutorOpts {
|
|
|
49
55
|
/** `bullmq` itself, for a `bun build --compile` binary that has no `node_modules` to load it from. */
|
|
50
56
|
module?: typeof import('bullmq');
|
|
51
57
|
}
|
|
58
|
+
/** Selects and configures the mail queue executor; the field matching `type` (`internalQueue` or `bullmq`) is required for that type. */
|
|
52
59
|
export interface IMailQueueExecutorConfig {
|
|
53
60
|
type: TConstValue<typeof MailQueueExecutorTypes>;
|
|
54
61
|
internalQueue?: IInternalQueueMailExecutorOpts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/queue.ts"],"names":[],"mappings":"","sourcesContent":["import type { TMailBackoffType } from '../constants';\nimport type { TConstValue } from '@venizia/ignis-helpers/common';\nimport type { IRedisSingleHelperOptions } from '@venizia/ignis-helpers';\nimport type { BullMQExecutorModes, MailQueueExecutorTypes } from '../constants';\n\nexport interface IMailQueueOptions {\n priority?: number;\n delay?: number;\n attempts?: number;\n backoff?: {\n type: TMailBackoffType;\n delay: number;\n };\n}\n\nexport interface IMailProcessorResult {\n success: boolean;\n message: string;\n expiresInMinutes: number;\n nextResendAt?: string;\n}\n\nexport interface IMailQueueResult {\n jobId?: string;\n queued: boolean;\n message: string;\n result?: IMailProcessorResult;\n}\n\nexport interface IMailQueueExecutor {\n enqueueVerificationEmail(email: string, options?: IMailQueueOptions): Promise<IMailQueueResult>;\n setProcessor(processor: (email: string) => Promise<IMailProcessorResult>): void;\n}\n\n/** Envelope every queue-backed executor stores for one pending verification email. */\nexport interface IQueueJobPayload {\n id: string;\n email: string;\n options?: IMailQueueOptions;\n attempts: number;\n scheduledAt: number;\n}\n\nexport interface IInternalQueueMailExecutorOpts {\n identifier: string;\n}\n\nexport interface IBullMQMailExecutorOpts {\n /** `redis.module` passes `ioredis` itself - see `module` below for why. */\n redis: IRedisSingleHelperOptions;\n queue: { identifier: string; name: string };\n mode: TConstValue<typeof BullMQExecutorModes>;\n /** `bullmq` itself, for a `bun build --compile` binary that has no `node_modules` to load it from. */\n module?: typeof import('bullmq');\n}\n\nexport interface IMailQueueExecutorConfig {\n type: TConstValue<typeof MailQueueExecutorTypes>;\n internalQueue?: IInternalQueueMailExecutorOpts;\n bullmq?: IBullMQMailExecutorOpts;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/queue.ts"],"names":[],"mappings":"","sourcesContent":["import type { TMailBackoffType } from '../constants';\nimport type { TConstValue } from '@venizia/ignis-helpers/common';\nimport type { IRedisSingleHelperOptions } from '@venizia/ignis-helpers';\nimport type { BullMQExecutorModes, MailQueueExecutorTypes } from '../constants';\n\n/** Per-job options for a queued verification mail. `delay` and `backoff.delay` are milliseconds; `attempts` is the total number of tries, first included. */\nexport interface IMailQueueOptions {\n priority?: number;\n delay?: number;\n attempts?: number;\n backoff?: {\n type: TMailBackoffType;\n delay: number;\n };\n}\n\n/** Result a queue processor returns for one verification mail; returning `success: false` marks the job failed so it is retried. */\nexport interface IMailProcessorResult {\n success: boolean;\n message: string;\n expiresInMinutes: number;\n nextResendAt?: string;\n}\n\n/** Result of enqueueing a verification mail; `queued` is `false` and `result` is set when the executor ran the mail inline. */\nexport interface IMailQueueResult {\n jobId?: string;\n queued: boolean;\n message: string;\n result?: IMailProcessorResult;\n}\n\n/** Queues verification mails and runs them through the processor registered with `setProcessor`. */\nexport interface IMailQueueExecutor {\n enqueueVerificationEmail(email: string, options?: IMailQueueOptions): Promise<IMailQueueResult>;\n setProcessor(processor: (email: string) => Promise<IMailProcessorResult>): void;\n}\n\n/** Envelope every queue-backed executor stores for one pending verification email. */\nexport interface IQueueJobPayload {\n id: string;\n email: string;\n options?: IMailQueueOptions;\n attempts: number;\n scheduledAt: number;\n}\n\n/** Options of the in-process queue executor; `identifier` names its queue. */\nexport interface IInternalQueueMailExecutorOpts {\n identifier: string;\n}\n\n/** Options of the BullMQ mail executor: the Redis connection, the queue `identifier` and BullMQ `name`, and which of queue and workers this process runs. */\nexport interface IBullMQMailExecutorOpts {\n /** `redis.module` passes `ioredis` itself - see `module` below for why. */\n redis: IRedisSingleHelperOptions;\n queue: { identifier: string; name: string };\n mode: TConstValue<typeof BullMQExecutorModes>;\n /** `bullmq` itself, for a `bun build --compile` binary that has no `node_modules` to load it from. */\n module?: typeof import('bullmq');\n}\n\n/** Selects and configures the mail queue executor; the field matching `type` (`internalQueue` or `bullmq`) is required for that type. */\nexport interface IMailQueueExecutorConfig {\n type: TConstValue<typeof MailQueueExecutorTypes>;\n internalQueue?: IInternalQueueMailExecutorOpts;\n bullmq?: IBullMQMailExecutorOpts;\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AnyType } from '@venizia/ignis-helpers/common';
|
|
2
|
+
/** A registered mail template: `content` is the body, `subject` and `description` are optional. */
|
|
2
3
|
export interface ITemplate {
|
|
3
4
|
name: string;
|
|
4
5
|
content?: string;
|
|
@@ -6,6 +7,7 @@ export interface ITemplate {
|
|
|
6
7
|
subject?: string;
|
|
7
8
|
description?: string;
|
|
8
9
|
}
|
|
10
|
+
/** Stores and renders mail templates. Render with a registered `templateName` or inline `templateData`. */
|
|
9
11
|
export interface IMailTemplateEngine {
|
|
10
12
|
render(opts: {
|
|
11
13
|
templateData?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/template.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnyType } from '@venizia/ignis-helpers/common';\n\nexport interface ITemplate {\n name: string;\n content?: string;\n render?: (data: Record<string, AnyType>) => string;\n subject?: string;\n description?: string;\n}\n\nexport interface IMailTemplateEngine {\n render(opts: {\n templateData?: string;\n templateName?: string;\n data: Record<string, any>;\n requireValidate?: boolean;\n }): string;\n registerTemplate(opts: { name: string; content: string }): void;\n validateTemplateData(opts: { template: string; data: Record<string, any> }): {\n isValid: boolean;\n missingKeys: string[];\n allKeys: string[];\n };\n getTemplate(name: string): ITemplate | undefined;\n listTemplates(): ITemplate[];\n hasTemplate(name: string): boolean;\n removeTemplate(name: string): boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/template.ts"],"names":[],"mappings":"","sourcesContent":["import type { AnyType } from '@venizia/ignis-helpers/common';\n\n/** A registered mail template: `content` is the body, `subject` and `description` are optional. */\nexport interface ITemplate {\n name: string;\n content?: string;\n render?: (data: Record<string, AnyType>) => string;\n subject?: string;\n description?: string;\n}\n\n/** Stores and renders mail templates. Render with a registered `templateName` or inline `templateData`. */\nexport interface IMailTemplateEngine {\n render(opts: {\n templateData?: string;\n templateName?: string;\n data: Record<string, any>;\n requireValidate?: boolean;\n }): string;\n registerTemplate(opts: { name: string; content: string }): void;\n validateTemplateData(opts: { template: string; data: Record<string, any> }): {\n isValid: boolean;\n missingKeys: string[];\n allKeys: string[];\n };\n getTemplate(name: string): ITemplate | undefined;\n listTemplates(): ITemplate[];\n hasTemplate(name: string): boolean;\n removeTemplate(name: string): boolean;\n}\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/** Sizes and lifetimes for generated verification data: code digits, token bytes, code lifetime in minutes, token lifetime in hours. */
|
|
1
2
|
export interface IVerificationGenerationOptions {
|
|
2
3
|
codeLength: number;
|
|
3
4
|
tokenBytes: number;
|
|
4
5
|
codeExpiryMinutes: number;
|
|
5
6
|
tokenExpiryHours: number;
|
|
6
7
|
}
|
|
8
|
+
/** A verification code and token with their generation and expiry times (ISO 8601 strings) and the failed-attempt count. */
|
|
7
9
|
export interface IVerificationData {
|
|
8
10
|
verificationCode: string;
|
|
9
11
|
codeGeneratedAt: string;
|
|
@@ -14,12 +16,15 @@ export interface IVerificationData {
|
|
|
14
16
|
tokenExpiresAt: string;
|
|
15
17
|
lastCodeSentAt: string;
|
|
16
18
|
}
|
|
19
|
+
/** Generates a numeric verification code. */
|
|
17
20
|
export interface IVerificationCodeGenerator {
|
|
18
21
|
generateCode(length: number): string;
|
|
19
22
|
}
|
|
23
|
+
/** Generates a random verification token. */
|
|
20
24
|
export interface IVerificationTokenGenerator {
|
|
21
25
|
generateToken(bytes: number): string;
|
|
22
26
|
}
|
|
27
|
+
/** Generates a full `IVerificationData` (code, token, timestamps) from the given sizes and lifetimes. */
|
|
23
28
|
export interface IVerificationDataGenerator {
|
|
24
29
|
generateVerificationData(options: IVerificationGenerationOptions): IVerificationData;
|
|
25
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verification.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/verification.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"verification.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/verification.ts"],"names":[],"mappings":"","sourcesContent":["/** Sizes and lifetimes for generated verification data: code digits, token bytes, code lifetime in minutes, token lifetime in hours. */\nexport interface IVerificationGenerationOptions {\n codeLength: number;\n tokenBytes: number;\n codeExpiryMinutes: number;\n tokenExpiryHours: number;\n}\n\n/** A verification code and token with their generation and expiry times (ISO 8601 strings) and the failed-attempt count. */\nexport interface IVerificationData {\n verificationCode: string;\n codeGeneratedAt: string;\n codeExpiresAt: string;\n codeAttempts: number;\n\n verificationToken: string;\n tokenGeneratedAt: string;\n tokenExpiresAt: string;\n\n lastCodeSentAt: string;\n}\n\n/** Generates a numeric verification code. */\nexport interface IVerificationCodeGenerator {\n generateCode(length: number): string;\n}\n\n/** Generates a random verification token. */\nexport interface IVerificationTokenGenerator {\n generateToken(bytes: number): string;\n}\n\n/** Generates a full `IVerificationData` (code, token, timestamps) from the given sizes and lifetimes. */\nexport interface IVerificationDataGenerator {\n generateVerificationData(options: IVerificationGenerationOptions): IVerificationData;\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type BaseApplication } from '../../base/applications/index.js';
|
|
2
2
|
import { BaseComponent } from '@venizia/ignis-kernel';
|
|
3
3
|
import type { TMailOptions } from './common/index.js';
|
|
4
|
+
/** Registers the mail transport, queue executor, template engine, `MailService` and verification generators under `MailKeys`. Options come from `MailKeys.MAIL_OPTIONS` or from the options passed to `application.component`; boot throws when they are missing or when `attachmentRoot` or `maxAttachmentBytes` is invalid. */
|
|
4
5
|
export declare class MailComponent extends BaseComponent<TMailOptions> {
|
|
5
6
|
private application;
|
|
6
7
|
constructor(application: BaseApplication);
|
|
@@ -21,6 +21,7 @@ import { isAbsolute } from 'node:path';
|
|
|
21
21
|
import { MailErrorCodes, MailKeys, MailQueueExecutorTypes } from './common/index.js';
|
|
22
22
|
import { MailQueueExecutorProvider, MailTransportProvider } from './providers/index.js';
|
|
23
23
|
import { DefaultVerificationDataGenerator, MailService, NumericCodeGenerator, RandomTokenGenerator, TemplateEngineService, } from './services/index.js';
|
|
24
|
+
/** Registers the mail transport, queue executor, template engine, `MailService` and verification generators under `MailKeys`. Options come from `MailKeys.MAIL_OPTIONS` or from the options passed to `application.component`; boot throws when they are missing or when `attachmentRoot` or `maxAttachmentBytes` is invalid. */
|
|
24
25
|
let MailComponent = MailComponent_1 = class MailComponent extends BaseComponent {
|
|
25
26
|
constructor(application) {
|
|
26
27
|
super({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/mail/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAE5E,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,gCAAgC,EAChC,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAEpB,IAAa,aAAa,qBAA1B,MAAa,aAAc,SAAQ,aAA2B;IAC5D,YAC8D,WAA4B;QAExF,KAAK,CAAC;YACJ,KAAK,EAAE,eAAa,CAA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qBAAqB,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AApKY,aAAa;IAErB,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAF1C,aAAa,CAoKzB","sourcesContent":["import { type BaseApplication } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { inject } from '@/base/metadata';\nimport { CoreBindings } from '@/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { statSync } from 'node:fs';\nimport { isAbsolute } from 'node:path';\nimport type { IMailQueueExecutorConfig, TMailOptions } from './common';\nimport { MailErrorCodes, MailKeys, MailQueueExecutorTypes } from './common';\nimport type { TGetMailQueueExecutorFn, TGetMailTransportFn } from './providers';\nimport { MailQueueExecutorProvider, MailTransportProvider } from './providers';\nimport {\n DefaultVerificationDataGenerator,\n MailService,\n NumericCodeGenerator,\n RandomTokenGenerator,\n TemplateEngineService,\n} from './services';\n\nexport class MailComponent extends BaseComponent<TMailOptions> {\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: MailComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {},\n });\n }\n\n /** `application.component(MailComponent, { options })` lands here; the call site outranks a key bound earlier. */\n override async configure(opts?: TMailOptions): Promise<void> {\n // The base short-circuits a second call; binding before that check would swap the options\n // under a transport that was already built from the first ones.\n if (this.isConfigured) {\n return;\n }\n\n if (opts !== undefined) {\n this.application.bind<TMailOptions>({ key: MailKeys.MAIL_OPTIONS }).toValue(opts);\n }\n\n await super.configure(opts);\n }\n\n override binding(): void | Promise<void> {\n if (!this.application.isBound({ key: MailKeys.MAIL_OPTIONS })) {\n this.logger\n .for(this.binding.name)\n .error(\n 'Mail options not configured. Please bind MailKeys.MAIL_OPTIONS before adding MailComponent.',\n );\n\n throw getError({\n message: 'Mail options not configured',\n });\n }\n\n this.initGenerators();\n this.initProviders();\n this.initServices();\n\n this.createAndBindInstances();\n\n this.logger.for(this.binding.name).info('Mail component initialized successfully');\n }\n\n initGenerators() {\n this.application\n .bind({ key: MailKeys.MAIL_VERIFICATION_CODE_GENERATOR })\n .toClass(NumericCodeGenerator);\n this.application\n .bind({ key: MailKeys.MAIL_VERIFICATION_TOKEN_GENERATOR })\n .toClass(RandomTokenGenerator);\n this.application\n .bind({ key: MailKeys.MAIL_VERIFICATION_DATA_GENERATOR })\n .toClass(DefaultVerificationDataGenerator);\n }\n\n initProviders() {\n this.application\n .bind({ key: MailKeys.MAIL_TRANSPORT_PROVIDER })\n .toProvider(MailTransportProvider)\n .setScope('singleton');\n this.application\n .bind({ key: MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER })\n .toProvider(MailQueueExecutorProvider)\n .setScope('singleton');\n }\n\n initServices() {\n this.application\n .bind({ key: MailKeys.MAIL_SERVICE })\n .toClass(MailService)\n .setScope('singleton');\n this.application\n .bind({ key: MailKeys.MAIL_TEMPLATE_ENGINE })\n .toClass(TemplateEngineService)\n .setScope('singleton');\n }\n\n /** A bad limit or root would otherwise surface on every send, as a 400 that blames the caller. */\n private validateAttachmentOptions(opts: { options: TMailOptions }): void {\n const { attachmentRoot, maxAttachmentBytes } = opts.options;\n\n const buildOptionError = (details: { message: string; cause?: unknown }) => {\n return getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n messageCode: MailErrorCodes.INVALID_CONFIGURATION,\n message: `Invalid mail options | ${details.message}`,\n cause: details.cause,\n });\n };\n\n const isValidLimit =\n maxAttachmentBytes === undefined ||\n (Number.isSafeInteger(maxAttachmentBytes) && maxAttachmentBytes > 0);\n\n if (!isValidLimit) {\n throw buildOptionError({ message: 'maxAttachmentBytes must be a positive integer' });\n }\n\n if (attachmentRoot === undefined) {\n return;\n }\n\n if (typeof attachmentRoot !== 'string' || !isAbsolute(attachmentRoot)) {\n throw buildOptionError({ message: 'attachmentRoot must be an absolute path' });\n }\n\n let isDirectory: boolean;\n\n try {\n isDirectory = statSync(attachmentRoot).isDirectory();\n } catch (error) {\n throw buildOptionError({\n message: 'attachmentRoot must be an existing directory',\n cause: error,\n });\n }\n\n if (!isDirectory) {\n throw buildOptionError({ message: 'attachmentRoot must be an existing directory' });\n }\n }\n\n createAndBindInstances(): void {\n // Transport\n const transportGetter = this.application.get<TGetMailTransportFn>({\n key: MailKeys.MAIL_TRANSPORT_PROVIDER,\n });\n const mailOptions = this.application.get<TMailOptions>({ key: MailKeys.MAIL_OPTIONS });\n this.validateAttachmentOptions({ options: mailOptions });\n\n // Only the provider is logged: the options carry SMTP / API credentials, which must never reach a log sink.\n this.logger\n .for(this.createAndBindInstances.name)\n .info('Mail provider: %s', mailOptions.provider);\n\n const mailTransportInstance = transportGetter(mailOptions);\n this.application.bind({ key: MailKeys.MAIL_TRANSPORT_INSTANCE }).toValue(mailTransportInstance);\n\n // Queue\n const queueGetter = this.application.get<TGetMailQueueExecutorFn>({\n key: MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER,\n });\n\n // Queueing is opt-in: with no executor config bound, fall back to the direct (inline) executor instead of a \"binding is not bounded\" crash at boot.\n const queueConfig = this.application.get<IMailQueueExecutorConfig>({\n key: MailKeys.MAIL_QUEUE_EXECUTOR_CONFIG,\n isOptional: true,\n }) ?? { type: MailQueueExecutorTypes.DIRECT };\n\n // Same reason as above: a bullmq config carries the Redis password.\n this.logger\n .for(this.createAndBindInstances.name)\n .info('Mail queue executor type: %s', queueConfig.type);\n\n const queueExecutorInstance = queueGetter(queueConfig);\n this.application\n .bind({ key: MailKeys.MAIL_QUEUE_EXECUTOR_INSTANCE })\n .toValue(queueExecutorInstance);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/components/mail/component.ts"],"names":[],"mappings":";;;;;;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,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AAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAA0B;YAChE,GAAG,EAAE,QAAQ,CAAC,4BAA4B;SAC3C,CAAC,CAAC;QAEH,oJAAoJ;QACpJ,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAA2B;YACjE,GAAG,EAAE,QAAQ,CAAC,0BAA0B;YACxC,UAAU,EAAE,IAAI;SACjB,CAAC,IAAI,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,EAAE,CAAC;QAE9C,oEAAoE;QACpE,IAAI,CAAC,MAAM;aACR,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC;aACrC,IAAI,CAAC,8BAA8B,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAE1D,MAAM,qBAAqB,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,CAAC,WAAW;aACb,IAAI,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,4BAA4B,EAAE,CAAC;aACpD,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACpC,CAAC;CACF,CAAA;AApKY,aAAa;IAErB,WAAA,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,CAAC,oBAAoB,EAAE,CAAC,CAAA;;GAF1C,aAAa,CAoKzB","sourcesContent":["import { type BaseApplication } from '@/base/applications';\nimport { BaseComponent } from '@venizia/ignis-kernel';\nimport { inject } from '@/base/metadata';\nimport { CoreBindings } from '@/common';\nimport { getError } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\nimport { statSync } from 'node:fs';\nimport { isAbsolute } from 'node:path';\nimport type { IMailQueueExecutorConfig, TMailOptions } from './common';\nimport { MailErrorCodes, MailKeys, MailQueueExecutorTypes } from './common';\nimport type { TGetMailQueueExecutorFn, TGetMailTransportFn } from './providers';\nimport { MailQueueExecutorProvider, MailTransportProvider } from './providers';\nimport {\n DefaultVerificationDataGenerator,\n MailService,\n NumericCodeGenerator,\n RandomTokenGenerator,\n TemplateEngineService,\n} from './services';\n\n/** Registers the mail transport, queue executor, template engine, `MailService` and verification generators under `MailKeys`. Options come from `MailKeys.MAIL_OPTIONS` or from the options passed to `application.component`; boot throws when they are missing or when `attachmentRoot` or `maxAttachmentBytes` is invalid. */\nexport class MailComponent extends BaseComponent<TMailOptions> {\n constructor(\n @inject({ key: CoreBindings.APPLICATION_INSTANCE }) private application: BaseApplication,\n ) {\n super({\n scope: MailComponent.name,\n initDefault: { enable: true, container: application },\n bindings: {},\n });\n }\n\n /** `application.component(MailComponent, { options })` lands here; the call site outranks a key bound earlier. */\n override async configure(opts?: TMailOptions): Promise<void> {\n // The base short-circuits a second call; binding before that check would swap the options\n // under a transport that was already built from the first ones.\n if (this.isConfigured) {\n return;\n }\n\n if (opts !== undefined) {\n this.application.bind<TMailOptions>({ key: MailKeys.MAIL_OPTIONS }).toValue(opts);\n }\n\n await super.configure(opts);\n }\n\n override binding(): void | Promise<void> {\n if (!this.application.isBound({ key: MailKeys.MAIL_OPTIONS })) {\n this.logger\n .for(this.binding.name)\n .error(\n 'Mail options not configured. Please bind MailKeys.MAIL_OPTIONS before adding MailComponent.',\n );\n\n throw getError({\n message: 'Mail options not configured',\n });\n }\n\n this.initGenerators();\n this.initProviders();\n this.initServices();\n\n this.createAndBindInstances();\n\n this.logger.for(this.binding.name).info('Mail component initialized successfully');\n }\n\n initGenerators() {\n this.application\n .bind({ key: MailKeys.MAIL_VERIFICATION_CODE_GENERATOR })\n .toClass(NumericCodeGenerator);\n this.application\n .bind({ key: MailKeys.MAIL_VERIFICATION_TOKEN_GENERATOR })\n .toClass(RandomTokenGenerator);\n this.application\n .bind({ key: MailKeys.MAIL_VERIFICATION_DATA_GENERATOR })\n .toClass(DefaultVerificationDataGenerator);\n }\n\n initProviders() {\n this.application\n .bind({ key: MailKeys.MAIL_TRANSPORT_PROVIDER })\n .toProvider(MailTransportProvider)\n .setScope('singleton');\n this.application\n .bind({ key: MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER })\n .toProvider(MailQueueExecutorProvider)\n .setScope('singleton');\n }\n\n initServices() {\n this.application\n .bind({ key: MailKeys.MAIL_SERVICE })\n .toClass(MailService)\n .setScope('singleton');\n this.application\n .bind({ key: MailKeys.MAIL_TEMPLATE_ENGINE })\n .toClass(TemplateEngineService)\n .setScope('singleton');\n }\n\n /** A bad limit or root would otherwise surface on every send, as a 400 that blames the caller. */\n private validateAttachmentOptions(opts: { options: TMailOptions }): void {\n const { attachmentRoot, maxAttachmentBytes } = opts.options;\n\n const buildOptionError = (details: { message: string; cause?: unknown }) => {\n return getError({\n statusCode: HTTP.ResultCodes.RS_5.InternalServerError,\n messageCode: MailErrorCodes.INVALID_CONFIGURATION,\n message: `Invalid mail options | ${details.message}`,\n cause: details.cause,\n });\n };\n\n const isValidLimit =\n maxAttachmentBytes === undefined ||\n (Number.isSafeInteger(maxAttachmentBytes) && maxAttachmentBytes > 0);\n\n if (!isValidLimit) {\n throw buildOptionError({ message: 'maxAttachmentBytes must be a positive integer' });\n }\n\n if (attachmentRoot === undefined) {\n return;\n }\n\n if (typeof attachmentRoot !== 'string' || !isAbsolute(attachmentRoot)) {\n throw buildOptionError({ message: 'attachmentRoot must be an absolute path' });\n }\n\n let isDirectory: boolean;\n\n try {\n isDirectory = statSync(attachmentRoot).isDirectory();\n } catch (error) {\n throw buildOptionError({\n message: 'attachmentRoot must be an existing directory',\n cause: error,\n });\n }\n\n if (!isDirectory) {\n throw buildOptionError({ message: 'attachmentRoot must be an existing directory' });\n }\n }\n\n createAndBindInstances(): void {\n // Transport\n const transportGetter = this.application.get<TGetMailTransportFn>({\n key: MailKeys.MAIL_TRANSPORT_PROVIDER,\n });\n const mailOptions = this.application.get<TMailOptions>({ key: MailKeys.MAIL_OPTIONS });\n this.validateAttachmentOptions({ options: mailOptions });\n\n // Only the provider is logged: the options carry SMTP / API credentials, which must never reach a log sink.\n this.logger\n .for(this.createAndBindInstances.name)\n .info('Mail provider: %s', mailOptions.provider);\n\n const mailTransportInstance = transportGetter(mailOptions);\n this.application.bind({ key: MailKeys.MAIL_TRANSPORT_INSTANCE }).toValue(mailTransportInstance);\n\n // Queue\n const queueGetter = this.application.get<TGetMailQueueExecutorFn>({\n key: MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER,\n });\n\n // Queueing is opt-in: with no executor config bound, fall back to the direct (inline) executor instead of a \"binding is not bounded\" crash at boot.\n const queueConfig = this.application.get<IMailQueueExecutorConfig>({\n key: MailKeys.MAIL_QUEUE_EXECUTOR_CONFIG,\n isOptional: true,\n }) ?? { type: MailQueueExecutorTypes.DIRECT };\n\n // Same reason as above: a bullmq config carries the Redis password.\n this.logger\n .for(this.createAndBindInstances.name)\n .info('Mail queue executor type: %s', queueConfig.type);\n\n const queueExecutorInstance = queueGetter(queueConfig);\n this.application\n .bind({ key: MailKeys.MAIL_QUEUE_EXECUTOR_INSTANCE })\n .toValue(queueExecutorInstance);\n }\n}\n"]}
|
|
@@ -2,6 +2,7 @@ import { BaseHelper } from '@venizia/ignis-helpers/core';
|
|
|
2
2
|
import type { TConstValue } from '../../../../helpers/index.js';
|
|
3
3
|
import type { IBullMQMailExecutorOpts, IMailProcessorResult, IMailQueueExecutor, IMailQueueOptions, IMailQueueResult } from '../../common/index.js';
|
|
4
4
|
import { BullMQExecutorModes } from '../../common/index.js';
|
|
5
|
+
/** Mail queue executor backed by BullMQ. The `mode` option decides whether this process holds the queue, the workers, or both; a processor returning `success: false` fails the job so BullMQ retries it. */
|
|
5
6
|
export declare class BullMQMailExecutorHelper extends BaseHelper implements IMailQueueExecutor {
|
|
6
7
|
private queueIdentifier;
|
|
7
8
|
private queueName;
|
|
@@ -2,6 +2,7 @@ import { BaseHelper, getError } from '@venizia/ignis-helpers/core';
|
|
|
2
2
|
import { RedisSingleHelper } from '@venizia/ignis-helpers';
|
|
3
3
|
import { BullMQHelper } from '@venizia/ignis-helpers/bullmq';
|
|
4
4
|
import { BullMQExecutorModes, MailBackoffTypes, MailErrorCodes, MailExecutorErrors, } from '../../common/index.js';
|
|
5
|
+
/** Mail queue executor backed by BullMQ. The `mode` option decides whether this process holds the queue, the workers, or both; a processor returning `success: false` fails the job so BullMQ retries it. */
|
|
5
6
|
export class BullMQMailExecutorHelper extends BaseHelper {
|
|
6
7
|
constructor(opts) {
|
|
7
8
|
super({ scope: BullMQMailExecutorHelper.name });
|