@venizia/ignis 0.4.8-9 → 0.5.0-0
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.js +5 -2
- package/dist/esm/base/applications/base.js.map +1 -1
- package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js +1 -1
- package/dist/esm/base/middlewares/request-spy/request-spy.middleware.js.map +1 -1
- package/dist/esm/components/api-reference/common/keys.d.ts +2 -1
- package/dist/esm/components/api-reference/common/keys.js +4 -1
- package/dist/esm/components/api-reference/common/keys.js.map +1 -1
- package/dist/esm/components/api-reference/common/types.d.ts +7 -4
- package/dist/esm/components/api-reference/common/types.js.map +1 -1
- package/dist/esm/components/api-reference/component.js +8 -3
- package/dist/esm/components/api-reference/component.js.map +1 -1
- package/dist/esm/components/auth/authenticate/component.js +13 -18
- package/dist/esm/components/auth/authenticate/component.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/factory.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/controllers/factory.js +1 -1
- package/dist/esm/components/auth/authenticate/controllers/factory.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/jwks/controller.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/jwks/definitions.d.ts +2 -2
- package/dist/esm/components/auth/authenticate/controllers/service-certs/controller.js.map +1 -1
- package/dist/esm/components/auth/authenticate/controllers/service-certs/definitions.d.ts +2 -2
- package/dist/esm/components/auth/authenticate/services/basic/service.js +1 -1
- package/dist/esm/components/auth/authenticate/services/basic/service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.d.ts +5 -3
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js +19 -2
- package/dist/esm/components/auth/authenticate/services/bearer/abstract.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/issuer.service.js +1 -1
- 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 +3 -3
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js +2 -2
- package/dist/esm/components/auth/authenticate/services/bearer/jwks/verifier.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jws.service.d.ts +3 -3
- package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js +1 -1
- package/dist/esm/components/auth/authenticate/services/bearer/jws.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/jwks-url-policy.d.ts +10 -22
- package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js +16 -112
- package/dist/esm/components/auth/authenticate/services/jwks-url-policy.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/service/signer.service.d.ts +11 -0
- package/dist/esm/components/auth/authenticate/services/service/signer.service.js +18 -0
- package/dist/esm/components/auth/authenticate/services/service/signer.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/services/service/verifier.service.js +1 -1
- package/dist/esm/components/auth/authenticate/services/service/verifier.service.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/basic.strategy.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jwks/issuer.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jwks/verifier.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/jws.strategy.js.map +1 -1
- package/dist/esm/components/auth/authenticate/strategies/service.strategy.js.map +1 -1
- package/dist/esm/components/auth/authorize/adapters/common/types.d.ts +1 -2
- package/dist/esm/components/auth/authorize/adapters/common/types.js.map +1 -1
- package/dist/esm/components/auth/authorize/component.js.map +1 -1
- package/dist/esm/components/controller/grpc/common/types.d.ts +1 -1
- package/dist/esm/components/controller/grpc/common/types.js +4 -1
- package/dist/esm/components/controller/grpc/common/types.js.map +1 -1
- package/dist/esm/components/controller/grpc/grpc.component.js.map +1 -1
- package/dist/esm/components/health-check/common/keys.d.ts +4 -2
- package/dist/esm/components/health-check/common/keys.js +7 -2
- package/dist/esm/components/health-check/common/keys.js.map +1 -1
- package/dist/esm/components/health-check/common/types.d.ts +1 -1
- package/dist/esm/components/health-check/common/types.js.map +1 -1
- package/dist/esm/components/health-check/component.js +1 -3
- package/dist/esm/components/health-check/component.js.map +1 -1
- package/dist/esm/components/mail/common/constants.d.ts +32 -14
- package/dist/esm/components/mail/common/constants.js +25 -32
- package/dist/esm/components/mail/common/constants.js.map +1 -1
- package/dist/esm/components/mail/common/errors.d.ts +19 -1
- package/dist/esm/components/mail/common/errors.js +13 -1
- package/dist/esm/components/mail/common/errors.js.map +1 -1
- package/dist/esm/components/mail/common/keys.d.ts +14 -11
- package/dist/esm/components/mail/common/keys.js +34 -11
- package/dist/esm/components/mail/common/keys.js.map +1 -1
- package/dist/esm/components/mail/common/types/message.d.ts +7 -4
- package/dist/esm/components/mail/common/types/message.js.map +1 -1
- package/dist/esm/components/mail/common/types/options.d.ts +54 -10
- package/dist/esm/components/mail/common/types/options.js.map +1 -1
- package/dist/esm/components/mail/common/types/queue.d.ts +25 -12
- package/dist/esm/components/mail/common/types/queue.js.map +1 -1
- package/dist/esm/components/mail/common/types/template.d.ts +8 -4
- package/dist/esm/components/mail/common/types/template.js.map +1 -1
- package/dist/esm/components/mail/common/types/verification.d.ts +1 -0
- package/dist/esm/components/mail/common/types/verification.js.map +1 -1
- package/dist/esm/components/mail/component.js +11 -2
- package/dist/esm/components/mail/component.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.d.ts +3 -1
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js +27 -33
- package/dist/esm/components/mail/helpers/executors/bull-mq-executor.helper.js.map +1 -1
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.d.ts +2 -0
- package/dist/esm/components/mail/helpers/executors/internal-queue-executor.helper.js +17 -10
- 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.js +11 -6
- 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 +2 -3
- package/dist/esm/components/mail/helpers/transporters/mailgun-transporter.helper.js +15 -6
- 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 +2 -3
- package/dist/esm/components/mail/helpers/transporters/nodemail-transporter.helper.js +2 -2
- 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 -2
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js +7 -9
- package/dist/esm/components/mail/providers/mail-queue-executor.provider.js.map +1 -1
- package/dist/esm/components/mail/providers/mail-transporter.provider.js +7 -7
- 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 -6
- package/dist/esm/components/mail/services/generators/numeric-code.js +3 -31
- package/dist/esm/components/mail/services/generators/numeric-code.js.map +1 -1
- package/dist/esm/components/mail/services/generators/random-token.d.ts +4 -1
- package/dist/esm/components/mail/services/generators/random-token.js +9 -6
- package/dist/esm/components/mail/services/generators/random-token.js.map +1 -1
- package/dist/esm/components/mail/services/mail.service.d.ts +1 -2
- package/dist/esm/components/mail/services/mail.service.js +22 -19
- package/dist/esm/components/mail/services/mail.service.js.map +1 -1
- package/dist/esm/components/mail/services/template.service.d.ts +8 -6
- package/dist/esm/components/mail/services/template.service.js +34 -33
- package/dist/esm/components/mail/services/template.service.js.map +1 -1
- package/dist/esm/components/mail/utilities/attachment.utility.js +8 -6
- package/dist/esm/components/mail/utilities/attachment.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/header.utility.d.ts +14 -0
- package/dist/esm/components/mail/utilities/header.utility.js +44 -0
- package/dist/esm/components/mail/utilities/header.utility.js.map +1 -0
- package/dist/esm/components/mail/utilities/index.d.ts +2 -0
- package/dist/esm/components/mail/utilities/index.js +2 -0
- package/dist/esm/components/mail/utilities/index.js.map +1 -1
- package/dist/esm/components/mail/utilities/mime.utility.d.ts +5 -1
- package/dist/esm/components/mail/utilities/mime.utility.js +12 -58
- package/dist/esm/components/mail/utilities/mime.utility.js.map +1 -1
- package/dist/esm/components/mail/utilities/template-renderer.utility.d.ts +31 -0
- package/dist/esm/components/mail/utilities/template-renderer.utility.js +184 -0
- package/dist/esm/components/mail/utilities/template-renderer.utility.js.map +1 -0
- package/dist/esm/components/mail/utilities/type.utility.d.ts +2 -3
- package/dist/esm/components/mail/utilities/type.utility.js +6 -7
- package/dist/esm/components/mail/utilities/type.utility.js.map +1 -1
- package/dist/esm/components/request-tracker/component.d.ts +2 -1
- package/dist/esm/components/request-tracker/component.js +5 -5
- package/dist/esm/components/request-tracker/component.js.map +1 -1
- package/dist/esm/components/server-info/common/keys.d.ts +2 -1
- package/dist/esm/components/server-info/common/keys.js +4 -1
- package/dist/esm/components/server-info/common/keys.js.map +1 -1
- package/dist/esm/components/server-info/common/types.d.ts +1 -1
- package/dist/esm/components/server-info/common/types.js.map +1 -1
- package/dist/esm/components/server-info/component.js +1 -3
- package/dist/esm/components/server-info/component.js.map +1 -1
- package/dist/esm/components/socket-io/common/keys.d.ts +9 -6
- package/dist/esm/components/socket-io/common/keys.js +19 -6
- package/dist/esm/components/socket-io/common/keys.js.map +1 -1
- package/dist/esm/components/socket-io/component.js +1 -1
- package/dist/esm/components/socket-io/component.js.map +1 -1
- package/dist/esm/components/socket-io/handlers/bun.handler.d.ts +13 -3
- package/dist/esm/components/socket-io/handlers/bun.handler.js.map +1 -1
- package/dist/esm/components/static-asset/common/constants.d.ts +51 -24
- package/dist/esm/components/static-asset/common/constants.js +75 -47
- package/dist/esm/components/static-asset/common/constants.js.map +1 -1
- package/dist/esm/components/static-asset/common/errors.d.ts +30 -35
- package/dist/esm/components/static-asset/common/errors.js +31 -33
- package/dist/esm/components/static-asset/common/errors.js.map +1 -1
- package/dist/esm/components/static-asset/common/index.d.ts +1 -1
- package/dist/esm/components/static-asset/common/index.js +1 -1
- package/dist/esm/components/static-asset/common/index.js.map +1 -1
- package/dist/esm/components/static-asset/common/keys.d.ts +14 -2
- package/dist/esm/components/static-asset/common/keys.js +17 -2
- package/dist/esm/components/static-asset/common/keys.js.map +1 -1
- package/dist/esm/components/static-asset/common/types.d.ts +267 -147
- package/dist/esm/components/static-asset/common/types.js.map +1 -1
- package/dist/esm/components/static-asset/common/validation.d.ts +10 -0
- package/dist/esm/components/static-asset/common/validation.js +8 -0
- package/dist/esm/components/static-asset/common/validation.js.map +1 -0
- package/dist/esm/components/static-asset/component.d.ts +4 -2
- package/dist/esm/components/static-asset/component.js +27 -31
- package/dist/esm/components/static-asset/component.js.map +1 -1
- package/dist/esm/components/static-asset/controller/factory.d.ts +37 -79
- package/dist/esm/components/static-asset/controller/factory.js +26 -917
- package/dist/esm/components/static-asset/controller/factory.js.map +1 -1
- package/dist/esm/components/static-asset/controller/index.d.ts +1 -0
- package/dist/esm/components/static-asset/controller/index.js +1 -0
- package/dist/esm/components/static-asset/controller/index.js.map +1 -1
- package/dist/esm/components/static-asset/controller/routes/context.d.ts +62 -0
- package/dist/esm/components/static-asset/controller/routes/context.js +45 -0
- package/dist/esm/components/static-asset/controller/routes/context.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/definition.d.ts +40 -0
- package/dist/esm/components/static-asset/controller/routes/definition.js +83 -0
- package/dist/esm/components/static-asset/controller/routes/definition.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.d.ts +3 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.js +153 -0
- package/dist/esm/components/static-asset/controller/routes/direct-upload.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/labels.d.ts +16 -0
- package/dist/esm/components/static-asset/controller/routes/labels.js +19 -0
- package/dist/esm/components/static-asset/controller/routes/labels.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/objects.d.ts +7 -0
- package/dist/esm/components/static-asset/controller/routes/objects.js +193 -0
- package/dist/esm/components/static-asset/controller/routes/objects.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/serve.d.ts +29 -0
- package/dist/esm/components/static-asset/controller/routes/serve.js +152 -0
- package/dist/esm/components/static-asset/controller/routes/serve.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/table.d.ts +12 -0
- package/dist/esm/components/static-asset/controller/routes/table.js +52 -0
- package/dist/esm/components/static-asset/controller/routes/table.js.map +1 -0
- package/dist/esm/components/static-asset/controller/routes/upload.d.ts +10 -0
- package/dist/esm/components/static-asset/controller/routes/upload.js +175 -0
- package/dist/esm/components/static-asset/controller/routes/upload.js.map +1 -0
- package/dist/esm/components/static-asset/index.d.ts +2 -1
- package/dist/esm/components/static-asset/index.js +2 -1
- package/dist/esm/components/static-asset/index.js.map +1 -1
- package/dist/esm/components/static-asset/models/base.model.d.ts +4 -4
- package/dist/esm/components/static-asset/models/base.model.js.map +1 -1
- package/dist/esm/components/static-asset/services/commitment.service.d.ts +103 -0
- package/dist/esm/components/static-asset/services/commitment.service.js +252 -0
- package/dist/esm/components/static-asset/services/commitment.service.js.map +1 -0
- package/dist/esm/components/static-asset/services/index.d.ts +3 -0
- package/dist/esm/components/static-asset/services/index.js +3 -0
- package/dist/esm/components/static-asset/services/index.js.map +1 -0
- package/dist/esm/components/static-asset/services/policy.service.d.ts +45 -0
- package/dist/esm/components/static-asset/services/policy.service.js +104 -0
- package/dist/esm/components/static-asset/services/policy.service.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.d.ts +28 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.js +112 -0
- package/dist/esm/components/static-asset/utilities/commit-token.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.d.ts +69 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.js +160 -0
- package/dist/esm/components/static-asset/utilities/entry.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/index.d.ts +6 -0
- package/dist/esm/components/static-asset/utilities/index.js +6 -0
- package/dist/esm/components/static-asset/utilities/index.js.map +1 -0
- package/dist/esm/components/static-asset/{ingest.d.ts → utilities/ingest.utility.d.ts} +8 -8
- package/dist/esm/components/static-asset/{ingest.js → utilities/ingest.utility.js} +21 -23
- package/dist/esm/components/static-asset/utilities/ingest.utility.js.map +1 -0
- package/dist/esm/components/static-asset/{controller/key-scope.d.ts → utilities/key-scope.utility.d.ts} +21 -2
- package/dist/esm/components/static-asset/utilities/key-scope.utility.js +74 -0
- package/dist/esm/components/static-asset/utilities/key-scope.utility.js.map +1 -0
- package/dist/esm/components/static-asset/{controller/meta-link.d.ts → utilities/meta-link.utility.d.ts} +9 -9
- package/dist/esm/components/static-asset/{controller/meta-link.js → utilities/meta-link.utility.js} +10 -10
- package/dist/esm/components/static-asset/utilities/meta-link.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.d.ts +16 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.js +20 -0
- package/dist/esm/components/static-asset/utilities/object-link.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.d.ts +39 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.js +53 -0
- package/dist/esm/components/static-asset/utilities/pinned-file.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.d.ts +43 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.js +71 -0
- package/dist/esm/components/static-asset/utilities/route-options.utility.js.map +1 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.d.ts +5 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.js +5 -0
- package/dist/esm/components/static-asset/utilities/toggle.utility.js.map +1 -0
- package/dist/esm/components/websocket/common/keys.d.ts +12 -10
- package/dist/esm/components/websocket/common/keys.js +31 -10
- package/dist/esm/components/websocket/common/keys.js.map +1 -1
- package/dist/esm/components/websocket/component.js.map +1 -1
- package/dist/esm/testing/assert-application-boots.d.ts +2 -2
- package/dist/esm/testing/assert-application-boots.js +6 -2
- package/dist/esm/testing/assert-application-boots.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
- package/dist/esm/components/static-asset/common/commit-token.d.ts +0 -28
- package/dist/esm/components/static-asset/common/commit-token.js +0 -48
- package/dist/esm/components/static-asset/common/commit-token.js.map +0 -1
- package/dist/esm/components/static-asset/controller/base.definition.d.ts +0 -30
- package/dist/esm/components/static-asset/controller/base.definition.js +0 -307
- package/dist/esm/components/static-asset/controller/base.definition.js.map +0 -1
- package/dist/esm/components/static-asset/controller/key-scope.js +0 -41
- package/dist/esm/components/static-asset/controller/key-scope.js.map +0 -1
- package/dist/esm/components/static-asset/controller/meta-link.js.map +0 -1
- package/dist/esm/components/static-asset/controller/route-options.d.ts +0 -29
- package/dist/esm/components/static-asset/controller/route-options.js +0 -47
- package/dist/esm/components/static-asset/controller/route-options.js.map +0 -1
- package/dist/esm/components/static-asset/ingest.js.map +0 -1
|
@@ -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,gKAAgK;AAChK,MAAM,OAAO,YAAY;aACP,sBAAiB,GAAG,CAAC,CAAC;aACtB,kBAAa,GAAG,qBAAqB,CAAC;IACtD,mFAAmF;aACnE,yBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC
|
|
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,gKAAgK;AAChK,MAAM,OAAO,YAAY;aACP,sBAAiB,GAAG,CAAC,CAAC;aACtB,kBAAa,GAAG,qBAAqB,CAAC;IACtD,mFAAmF;aACnE,yBAAoB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;IACxD,+DAA+D;aAC/C,YAAO,GAAG,YAAY,CAAC;IACvC,uFAAuF;aACvE,aAAQ,GAAG,CAAC,CAAC;aACb,qBAAgB,GAAG,IAAI,CAAC;IACxC,+GAA+G;aAC/F,yBAAoB,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;AAGhF,+LAA+L;AAC/L,MAAM,OAAO,mBAAmB;aACd,SAAI,GAAG,MAAM,CAAC;aACd,SAAI,GAAG,MAAM,CAAC;;AAMhC,6JAA6J;AAC7J,MAAM,OAAO,wBAAwB;aACnB,UAAK,GAAG,OAAO,CAAC;aAChB,SAAI,GAAG,MAAM,CAAC;aACd,UAAK,GAAG,OAAO,CAAC;;AAMlC,uDAAuD;AACvD,MAAM,OAAO,iBAAiB;aACZ,4BAAuB,GAAG,yBAAyB,CAAC;;AAGtE,+PAA+P;AAC/P,MAAM,OAAO,cAAc;aACT,gBAAW,GAAG,WAAW,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC;aAC5E,wBAAmB,GAAG,WAAW,CAAC,KAAK,CAAC;QACtD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,qBAAqB,CAAC;KAC/C,CAAC,CAAC;aAEa,sBAAiB,GAAG,WAAW,CAAC,KAAK,CAAC;QACpD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,mBAAmB,CAAC;KAC7C,CAAC,CAAC;;AAGL,mDAAmD;AACnD,MAAM,OAAO,kBAAkB;aACb,sBAAiB,GAAG,+CAA+C,CAAC;aACpE,WAAM,GAAG,gDAAgD,CAAC;;AAG5E,iJAAiJ;AACjJ,MAAM,OAAO,sBAAsB;aACjB,WAAM,GAAG,QAAQ,CAAC;aAClB,mBAAc,GAAG,gBAAgB,CAAC;aAClC,WAAM,GAAG,QAAQ,CAAC;;AAGpC,qKAAqK;AACrK,MAAM,OAAO,mBAAmB;aACd,eAAU,GAAG,YAAY,CAAC;aAC1B,gBAAW,GAAG,aAAa,CAAC;aAC5B,SAAI,GAAG,MAAM,CAAC;;AAGhC,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","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 /** The subject of a template mail that has none of its own. */\n static readonly SUBJECT = 'No Subject';\n /** Tries per queued mail, the first included, unless the job options say otherwise. */\n static readonly ATTEMPTS = 3;\n static readonly BACKOFF_DELAY_MS = 1000;\n /** How long a failed BullMQ mail job stays in Redis (it holds a recipient address), and the most that stay. */\n static readonly FAILED_JOB_RETENTION = { age: 7 * 24 * 60 * 60, count: 1000 };\n}\n\n/** Where a rendered template is going: `HTML` escapes every double-brace placeholder, `TEXT` (a subject, a plain-text part) inserts it as it is. A triple-brace placeholder is raw in both. */\nexport class MailTemplateFormats {\n static readonly HTML = 'html';\n static readonly TEXT = 'text';\n}\n\n/** Union of the `MailTemplateFormats` values. */\nexport type TMailTemplateFormat = TConstValue<typeof MailTemplateFormats>;\n\n/** What a template does with a placeholder the data does not have: `EMPTY` renders nothing, `KEEP` leaves the tag as written, `THROW` refuses the render. */\nexport class MailTemplateMissingModes {\n static readonly EMPTY = 'empty';\n static readonly KEEP = 'keep';\n static readonly THROW = 'throw';\n}\n\n/** Union of the `MailTemplateMissingModes` values. */\nexport type TMailTemplateMissing = TConstValue<typeof MailTemplateMissingModes>;\n\n/** Names of the jobs the BullMQ mail executor adds. */\nexport class MailQueueJobNames {\n static readonly SEND_VERIFICATION_EMAIL = 'send-verification-email';\n}\n\n/** The codes of the server-side failures, which are not in the 4xx `MailErrors` catalog. 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 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 BATCH_SEND_FAILED = MessageCode.build({\n parts: ['core', 'mail', 'batch_send_failed'],\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 static readonly CLOSED = 'The executor is closed and takes no more jobs.';\n}\n\n/** Values of `TMailQueueExecutorConfig.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\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\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\n/** Valid mail backoff type values. */\nexport type TMailBackoffType = TConstValue<typeof MailBackoffTypes>;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TRegisterErrors } from '@venizia/ignis-helpers/core';
|
|
2
2
|
/** Codes a client branches on for a mail request it can fix - a missing template, a message that is not sendable. Delivery failures are NOT here: they are 5xx and stay codeless, because a client cannot act on the remote provider being down. */
|
|
3
|
-
/** Codes are LITERAL strings, deliberately not `MailErrorCodes.*`: `MessageCode.build()` returns `string`, which erases the literal type `TRegisterErrors` is built on and silently kills autocomplete.
|
|
3
|
+
/** Codes are LITERAL strings, deliberately not `MailErrorCodes.*`: `MessageCode.build()` returns `string`, which erases the literal type `TRegisterErrors` is built on and silently kills autocomplete. `MailErrorCodes` holds only the codes of the server-side failures, which are not in this 4xx catalog: every code string has one home. They are a public contract and must not shift. */
|
|
4
4
|
export declare const MailErrors: {
|
|
5
5
|
readonly TEMPLATE_NOT_FOUND: {
|
|
6
6
|
readonly message: {
|
|
@@ -43,6 +43,24 @@ export declare const MailErrors: {
|
|
|
43
43
|
readonly statusCode: 413;
|
|
44
44
|
readonly category: "validation";
|
|
45
45
|
};
|
|
46
|
+
/** An address, the subject or a header holds a line break or another control character, or a header name is not printable ASCII: it would break out of its header line. */
|
|
47
|
+
readonly INVALID_HEADER: {
|
|
48
|
+
readonly message: {
|
|
49
|
+
readonly text: "Invalid mail header";
|
|
50
|
+
readonly code: "core.mail.invalid_header";
|
|
51
|
+
};
|
|
52
|
+
readonly statusCode: 400;
|
|
53
|
+
readonly category: "validation";
|
|
54
|
+
};
|
|
55
|
+
/** A template that is malformed (a section left open, a closing tag that does not match), uses a tag this renderer does not have (a partial, a delimiter change), or reads a function or an object where text goes. */
|
|
56
|
+
readonly TEMPLATE_INVALID: {
|
|
57
|
+
readonly message: {
|
|
58
|
+
readonly text: "Invalid mail template";
|
|
59
|
+
readonly code: "core.mail.template_invalid";
|
|
60
|
+
};
|
|
61
|
+
readonly statusCode: 400;
|
|
62
|
+
readonly category: "validation";
|
|
63
|
+
};
|
|
46
64
|
readonly BODY_SOURCE_REFUSED: {
|
|
47
65
|
readonly message: {
|
|
48
66
|
readonly text: "Mail body must be text";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ErrorScopes } from '@venizia/ignis-helpers/core';
|
|
2
2
|
import { HTTP } from '@venizia/ignis-helpers/common';
|
|
3
3
|
/** Codes a client branches on for a mail request it can fix - a missing template, a message that is not sendable. Delivery failures are NOT here: they are 5xx and stay codeless, because a client cannot act on the remote provider being down. */
|
|
4
|
-
/** Codes are LITERAL strings, deliberately not `MailErrorCodes.*`: `MessageCode.build()` returns `string`, which erases the literal type `TRegisterErrors` is built on and silently kills autocomplete.
|
|
4
|
+
/** Codes are LITERAL strings, deliberately not `MailErrorCodes.*`: `MessageCode.build()` returns `string`, which erases the literal type `TRegisterErrors` is built on and silently kills autocomplete. `MailErrorCodes` holds only the codes of the server-side failures, which are not in this 4xx catalog: every code string has one home. They are a public contract and must not shift. */
|
|
5
5
|
export const MailErrors = {
|
|
6
6
|
TEMPLATE_NOT_FOUND: {
|
|
7
7
|
message: { text: 'Mail template not found', code: 'core.mail.template_not_found' },
|
|
@@ -35,6 +35,18 @@ export const MailErrors = {
|
|
|
35
35
|
statusCode: HTTP.ResultCodes.RS_4.ContentTooLarge,
|
|
36
36
|
category: ErrorScopes.VALIDATION,
|
|
37
37
|
},
|
|
38
|
+
/** An address, the subject or a header holds a line break or another control character, or a header name is not printable ASCII: it would break out of its header line. */
|
|
39
|
+
INVALID_HEADER: {
|
|
40
|
+
message: { text: 'Invalid mail header', code: 'core.mail.invalid_header' },
|
|
41
|
+
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
42
|
+
category: ErrorScopes.VALIDATION,
|
|
43
|
+
},
|
|
44
|
+
/** A template that is malformed (a section left open, a closing tag that does not match), uses a tag this renderer does not have (a partial, a delimiter change), or reads a function or an object where text goes. */
|
|
45
|
+
TEMPLATE_INVALID: {
|
|
46
|
+
message: { text: 'Invalid mail template', code: 'core.mail.template_invalid' },
|
|
47
|
+
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
48
|
+
category: ErrorScopes.VALIDATION,
|
|
49
|
+
},
|
|
38
50
|
BODY_SOURCE_REFUSED: {
|
|
39
51
|
message: { text: 'Mail body must be text', code: 'core.mail.body_source_refused' },
|
|
40
52
|
statusCode: HTTP.ResultCodes.RS_4.BadRequest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/components/mail/common/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,oPAAoP;AACpP,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../../src/components/mail/common/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAErD,oPAAoP;AACpP,gYAAgY;AAChY,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,kBAAkB,EAAE;QAClB,OAAO,EAAE,EAAE,IAAI,EAAE,yBAAyB,EAAE,IAAI,EAAE,8BAA8B,EAAE;QAClF,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ;QAC1C,QAAQ,EAAE,WAAW,CAAC,QAAQ;KAC/B;IACD,qBAAqB,EAAE;QACrB,OAAO,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,IAAI,EAAE,iCAAiC,EAAE;QACxF,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,WAAW,CAAC,UAAU;KACjC;IACD,iBAAiB,EAAE;QACjB,OAAO,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,6BAA6B,EAAE;QAChF,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,WAAW,CAAC,UAAU;KACjC;IACD,gIAAgI;IAChI,uBAAuB,EAAE;QACvB,OAAO,EAAE;YACP,IAAI,EAAE,8BAA8B;YACpC,IAAI,EAAE,mCAAmC;SAC1C;QACD,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,WAAW,CAAC,UAAU;KACjC;IACD,oBAAoB,EAAE;QACpB,OAAO,EAAE;YACP,IAAI,EAAE,sDAAsD;YAC5D,IAAI,EAAE,gCAAgC;SACvC;QACD,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,eAAe;QACjD,QAAQ,EAAE,WAAW,CAAC,UAAU;KACjC;IACD,2KAA2K;IAC3K,cAAc,EAAE;QACd,OAAO,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,0BAA0B,EAAE;QAC1E,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,WAAW,CAAC,UAAU;KACjC;IACD,uNAAuN;IACvN,gBAAgB,EAAE;QAChB,OAAO,EAAE,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,4BAA4B,EAAE;QAC9E,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,WAAW,CAAC,UAAU;KACjC;IACD,mBAAmB,EAAE;QACnB,OAAO,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,IAAI,EAAE,+BAA+B,EAAE;QAClF,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU;QAC5C,QAAQ,EAAE,WAAW,CAAC,UAAU;KACjC;CACkD,CAAC","sourcesContent":["import type { TErrorDefinition, TRegisterErrors } from '@venizia/ignis-helpers/core';\nimport { ErrorScopes } from '@venizia/ignis-helpers/core';\nimport { HTTP } from '@venizia/ignis-helpers/common';\n\n/** Codes a client branches on for a mail request it can fix - a missing template, a message that is not sendable. Delivery failures are NOT here: they are 5xx and stay codeless, because a client cannot act on the remote provider being down. */\n/** Codes are LITERAL strings, deliberately not `MailErrorCodes.*`: `MessageCode.build()` returns `string`, which erases the literal type `TRegisterErrors` is built on and silently kills autocomplete. `MailErrorCodes` holds only the codes of the server-side failures, which are not in this 4xx catalog: every code string has one home. They are a public contract and must not shift. */\nexport const MailErrors = {\n TEMPLATE_NOT_FOUND: {\n message: { text: 'Mail template not found', code: 'core.mail.template_not_found' },\n statusCode: HTTP.ResultCodes.RS_4.NotFound,\n category: ErrorScopes.BUSINESS,\n },\n INVALID_CONFIGURATION: {\n message: { text: 'Invalid mail configuration', code: 'core.mail.invalid_configuration' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n INVALID_RECIPIENT: {\n message: { text: 'Invalid mail recipient', code: 'core.mail.invalid_recipient' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** One answer for every refused source - outside the root, missing, not a file - so a caller cannot probe which files exist. */\n ATTACHMENT_PATH_REFUSED: {\n message: {\n text: 'Mail attachment path refused',\n code: 'core.mail.attachment_path_refused',\n },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n ATTACHMENT_TOO_LARGE: {\n message: {\n text: 'Mail attachments are larger than the maximum allowed',\n code: 'core.mail.attachment_too_large',\n },\n statusCode: HTTP.ResultCodes.RS_4.ContentTooLarge,\n category: ErrorScopes.VALIDATION,\n },\n /** An address, the subject or a header holds a line break or another control character, or a header name is not printable ASCII: it would break out of its header line. */\n INVALID_HEADER: {\n message: { text: 'Invalid mail header', code: 'core.mail.invalid_header' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n /** A template that is malformed (a section left open, a closing tag that does not match), uses a tag this renderer does not have (a partial, a delimiter change), or reads a function or an object where text goes. */\n TEMPLATE_INVALID: {\n message: { text: 'Invalid mail template', code: 'core.mail.template_invalid' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n BODY_SOURCE_REFUSED: {\n message: { text: 'Mail body must be text', code: 'core.mail.body_source_refused' },\n statusCode: HTTP.ResultCodes.RS_4.BadRequest,\n category: ErrorScopes.VALIDATION,\n },\n} as const satisfies Record<string, TErrorDefinition>;\n\n/** Registers these codes with the shared key registry so a consumer gets autocomplete on `messageCode`. */\ndeclare module '@venizia/ignis-helpers' {\n interface IErrorKeyRegistry extends TRegisterErrors<typeof MailErrors> {}\n}\n"]}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import type { TGetMailQueueExecutorFn, TGetMailTransportFn } from '../providers/index.js';
|
|
2
|
+
import type { MailService, TemplateEngineService } from '../services/index.js';
|
|
3
|
+
import type { IMailQueueExecutor, IMailTransport, IVerificationCodeGenerator, IVerificationDataGenerator, IVerificationTokenGenerator, TMailOptions, TMailQueueExecutorConfig } from './types/index.js';
|
|
1
4
|
/** DI binding keys the mail component registers and reads: options, queue executor config, transport and queue provider/instance, services and verification generators. */
|
|
2
5
|
export declare class MailKeys {
|
|
3
|
-
static readonly MAIL_OPTIONS
|
|
4
|
-
static readonly MAIL_QUEUE_EXECUTOR_CONFIG
|
|
5
|
-
static readonly MAIL_TRANSPORT_PROVIDER
|
|
6
|
-
static readonly MAIL_TRANSPORT_INSTANCE
|
|
7
|
-
static readonly MAIL_TEMPLATE_ENGINE
|
|
8
|
-
static readonly MAIL_SERVICE
|
|
9
|
-
static readonly MAIL_VERIFICATION_CODE_GENERATOR
|
|
10
|
-
static readonly MAIL_VERIFICATION_TOKEN_GENERATOR
|
|
11
|
-
static readonly MAIL_VERIFICATION_DATA_GENERATOR
|
|
12
|
-
static readonly MAIL_QUEUE_EXECUTOR_PROVIDER
|
|
13
|
-
static readonly MAIL_QUEUE_EXECUTOR_INSTANCE
|
|
6
|
+
static readonly MAIL_OPTIONS: import("@venizia/ignis-inversion").TBindingKey<TMailOptions>;
|
|
7
|
+
static readonly MAIL_QUEUE_EXECUTOR_CONFIG: import("@venizia/ignis-inversion").TBindingKey<TMailQueueExecutorConfig>;
|
|
8
|
+
static readonly MAIL_TRANSPORT_PROVIDER: import("@venizia/ignis-inversion").TBindingKey<TGetMailTransportFn>;
|
|
9
|
+
static readonly MAIL_TRANSPORT_INSTANCE: import("@venizia/ignis-inversion").TBindingKey<IMailTransport>;
|
|
10
|
+
static readonly MAIL_TEMPLATE_ENGINE: import("@venizia/ignis-inversion").TBindingKey<TemplateEngineService>;
|
|
11
|
+
static readonly MAIL_SERVICE: import("@venizia/ignis-inversion").TBindingKey<MailService>;
|
|
12
|
+
static readonly MAIL_VERIFICATION_CODE_GENERATOR: import("@venizia/ignis-inversion").TBindingKey<IVerificationCodeGenerator>;
|
|
13
|
+
static readonly MAIL_VERIFICATION_TOKEN_GENERATOR: import("@venizia/ignis-inversion").TBindingKey<IVerificationTokenGenerator>;
|
|
14
|
+
static readonly MAIL_VERIFICATION_DATA_GENERATOR: import("@venizia/ignis-inversion").TBindingKey<IVerificationDataGenerator>;
|
|
15
|
+
static readonly MAIL_QUEUE_EXECUTOR_PROVIDER: import("@venizia/ignis-inversion").TBindingKey<TGetMailQueueExecutorFn>;
|
|
16
|
+
static readonly MAIL_QUEUE_EXECUTOR_INSTANCE: import("@venizia/ignis-inversion").TBindingKey<IMailQueueExecutor>;
|
|
14
17
|
}
|
|
15
18
|
//# sourceMappingURL=keys.d.ts.map
|
|
@@ -1,20 +1,43 @@
|
|
|
1
|
+
import { BindingKeys } from '@venizia/ignis-inversion';
|
|
1
2
|
/** DI binding keys the mail component registers and reads: options, queue executor config, transport and queue provider/instance, services and verification generators. */
|
|
2
3
|
export class MailKeys {
|
|
3
4
|
// Options & Configs
|
|
4
|
-
static { this.MAIL_OPTIONS =
|
|
5
|
-
|
|
5
|
+
static { this.MAIL_OPTIONS = BindingKeys.build({
|
|
6
|
+
key: '@app/components/mail/options',
|
|
7
|
+
}); }
|
|
8
|
+
static { this.MAIL_QUEUE_EXECUTOR_CONFIG = BindingKeys.build({
|
|
9
|
+
key: '@app/components/mail/queue/executor-config',
|
|
10
|
+
}); }
|
|
6
11
|
// Transporter
|
|
7
|
-
static { this.MAIL_TRANSPORT_PROVIDER =
|
|
8
|
-
|
|
12
|
+
static { this.MAIL_TRANSPORT_PROVIDER = BindingKeys.build({
|
|
13
|
+
key: '@app/components/mail/transport-provider',
|
|
14
|
+
}); }
|
|
15
|
+
static { this.MAIL_TRANSPORT_INSTANCE = BindingKeys.build({
|
|
16
|
+
key: '@app/components/mail/transport-instance',
|
|
17
|
+
}); }
|
|
9
18
|
// Services
|
|
10
|
-
static { this.MAIL_TEMPLATE_ENGINE =
|
|
11
|
-
|
|
19
|
+
static { this.MAIL_TEMPLATE_ENGINE = BindingKeys.build({
|
|
20
|
+
key: '@app/components/mail/services/template-engine',
|
|
21
|
+
}); }
|
|
22
|
+
static { this.MAIL_SERVICE = BindingKeys.build({
|
|
23
|
+
key: '@app/components/mail/service',
|
|
24
|
+
}); }
|
|
12
25
|
// Generators
|
|
13
|
-
static { this.MAIL_VERIFICATION_CODE_GENERATOR =
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
static { this.MAIL_VERIFICATION_CODE_GENERATOR = BindingKeys.build({
|
|
27
|
+
key: '@app/components/mail/verification/code-generator',
|
|
28
|
+
}); }
|
|
29
|
+
static { this.MAIL_VERIFICATION_TOKEN_GENERATOR = BindingKeys.build({
|
|
30
|
+
key: '@app/components/mail/verification/token-generator',
|
|
31
|
+
}); }
|
|
32
|
+
static { this.MAIL_VERIFICATION_DATA_GENERATOR = BindingKeys.build({
|
|
33
|
+
key: '@app/components/mail/verification/data-generator',
|
|
34
|
+
}); }
|
|
16
35
|
// Queue
|
|
17
|
-
static { this.MAIL_QUEUE_EXECUTOR_PROVIDER =
|
|
18
|
-
|
|
36
|
+
static { this.MAIL_QUEUE_EXECUTOR_PROVIDER = BindingKeys.build({
|
|
37
|
+
key: '@app/components/mail/queue-executor-provider',
|
|
38
|
+
}); }
|
|
39
|
+
static { this.MAIL_QUEUE_EXECUTOR_INSTANCE = BindingKeys.build({
|
|
40
|
+
key: '@app/components/mail/queue-executor-instance',
|
|
41
|
+
}); }
|
|
19
42
|
}
|
|
20
43
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../../src/components/mail/common/keys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAavD,2KAA2K;AAC3K,MAAM,OAAO,QAAQ;IACnB,oBAAoB;aACJ,iBAAY,GAAG,WAAW,CAAC,KAAK,CAAe;QAC7D,GAAG,EAAE,8BAA8B;KACpC,CAAC,CAAC;aAEa,+BAA0B,GAAG,WAAW,CAAC,KAAK,CAA2B;QACvF,GAAG,EAAE,4CAA4C;KAClD,CAAC,CAAC;IAEH,cAAc;aACE,4BAAuB,GAAG,WAAW,CAAC,KAAK,CAAsB;QAC/E,GAAG,EAAE,yCAAyC;KAC/C,CAAC,CAAC;aAEa,4BAAuB,GAAG,WAAW,CAAC,KAAK,CAAiB;QAC1E,GAAG,EAAE,yCAAyC;KAC/C,CAAC,CAAC;IAEH,WAAW;aACK,yBAAoB,GAAG,WAAW,CAAC,KAAK,CAAwB;QAC9E,GAAG,EAAE,+CAA+C;KACrD,CAAC,CAAC;aAEa,iBAAY,GAAG,WAAW,CAAC,KAAK,CAAc;QAC5D,GAAG,EAAE,8BAA8B;KACpC,CAAC,CAAC;IAEH,aAAa;aACG,qCAAgC,GAAG,WAAW,CAAC,KAAK,CAA6B;QAC/F,GAAG,EAAE,kDAAkD;KACxD,CAAC,CAAC;aAEa,sCAAiC,GAC/C,WAAW,CAAC,KAAK,CAA8B;QAC7C,GAAG,EAAE,mDAAmD;KACzD,CAAC,CAAC;aAEW,qCAAgC,GAAG,WAAW,CAAC,KAAK,CAA6B;QAC/F,GAAG,EAAE,kDAAkD;KACxD,CAAC,CAAC;IAEH,QAAQ;aACQ,iCAA4B,GAAG,WAAW,CAAC,KAAK,CAA0B;QACxF,GAAG,EAAE,8CAA8C;KACpD,CAAC,CAAC;aAEa,iCAA4B,GAAG,WAAW,CAAC,KAAK,CAAqB;QACnF,GAAG,EAAE,8CAA8C;KACpD,CAAC,CAAC","sourcesContent":["import { BindingKeys } from '@venizia/ignis-inversion';\nimport type { TGetMailQueueExecutorFn, TGetMailTransportFn } from '../providers';\nimport type { MailService, TemplateEngineService } from '../services';\nimport type {\n IMailQueueExecutor,\n IMailTransport,\n IVerificationCodeGenerator,\n IVerificationDataGenerator,\n IVerificationTokenGenerator,\n TMailOptions,\n TMailQueueExecutorConfig,\n} from './types';\n\n/** 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 = BindingKeys.build<TMailOptions>({\n key: '@app/components/mail/options',\n });\n\n static readonly MAIL_QUEUE_EXECUTOR_CONFIG = BindingKeys.build<TMailQueueExecutorConfig>({\n key: '@app/components/mail/queue/executor-config',\n });\n\n // Transporter\n static readonly MAIL_TRANSPORT_PROVIDER = BindingKeys.build<TGetMailTransportFn>({\n key: '@app/components/mail/transport-provider',\n });\n\n static readonly MAIL_TRANSPORT_INSTANCE = BindingKeys.build<IMailTransport>({\n key: '@app/components/mail/transport-instance',\n });\n\n // Services\n static readonly MAIL_TEMPLATE_ENGINE = BindingKeys.build<TemplateEngineService>({\n key: '@app/components/mail/services/template-engine',\n });\n\n static readonly MAIL_SERVICE = BindingKeys.build<MailService>({\n key: '@app/components/mail/service',\n });\n\n // Generators\n static readonly MAIL_VERIFICATION_CODE_GENERATOR = BindingKeys.build<IVerificationCodeGenerator>({\n key: '@app/components/mail/verification/code-generator',\n });\n\n static readonly MAIL_VERIFICATION_TOKEN_GENERATOR =\n BindingKeys.build<IVerificationTokenGenerator>({\n key: '@app/components/mail/verification/token-generator',\n });\n\n static readonly MAIL_VERIFICATION_DATA_GENERATOR = BindingKeys.build<IVerificationDataGenerator>({\n key: '@app/components/mail/verification/data-generator',\n });\n\n // Queue\n static readonly MAIL_QUEUE_EXECUTOR_PROVIDER = BindingKeys.build<TGetMailQueueExecutorFn>({\n key: '@app/components/mail/queue-executor-provider',\n });\n\n static readonly MAIL_QUEUE_EXECUTOR_INSTANCE = BindingKeys.build<IMailQueueExecutor>({\n key: '@app/components/mail/queue-executor-instance',\n });\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Readable } from 'node:stream';
|
|
2
|
+
import type { TMailTemplateMissing } from '../constants.js';
|
|
2
3
|
/** One attachment on an `IMailMessage`. Give `content` or `path`; `cid` makes the part inline, referenced as `cid:<value>` from the HTML body. */
|
|
3
4
|
export interface IMailAttachment {
|
|
4
5
|
filename?: string;
|
|
@@ -8,7 +9,7 @@ export interface IMailAttachment {
|
|
|
8
9
|
content?: string | Buffer | Uint8Array | Readable | ReadableStream<Uint8Array>;
|
|
9
10
|
encoding?: BufferEncoding;
|
|
10
11
|
cid?: string;
|
|
11
|
-
[key: string]:
|
|
12
|
+
[key: string]: unknown;
|
|
12
13
|
}
|
|
13
14
|
/** 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`). */
|
|
14
15
|
export interface IMailMessage {
|
|
@@ -28,13 +29,15 @@ export interface IMailMessage {
|
|
|
28
29
|
attachments?: IMailAttachment[];
|
|
29
30
|
headers?: Record<string, string>;
|
|
30
31
|
requireValidate?: boolean;
|
|
31
|
-
|
|
32
|
+
/** What a template does with a placeholder the data does not have. @default MailTemplateMissingModes.EMPTY */
|
|
33
|
+
missing?: TMailTemplateMissing;
|
|
34
|
+
[key: string]: unknown;
|
|
32
35
|
}
|
|
33
36
|
/** Outcome of one send: `success` plus the provider `messageId`, or an `error` string when the send failed. */
|
|
34
37
|
export interface IMailSendResult {
|
|
35
38
|
success: boolean;
|
|
36
39
|
messageId?: string;
|
|
37
|
-
response?:
|
|
40
|
+
response?: unknown;
|
|
38
41
|
error?: string;
|
|
39
42
|
}
|
|
40
43
|
/** A mail provider backend. `verify` checks the connection or credentials; `close`, when present, releases the client. */
|
|
@@ -51,7 +54,7 @@ export interface IMailService {
|
|
|
51
54
|
}): Promise<IMailSendResult[]>;
|
|
52
55
|
sendTemplate(opts: {
|
|
53
56
|
templateName: string;
|
|
54
|
-
data: Record<string,
|
|
57
|
+
data: Record<string, unknown>;
|
|
55
58
|
recipients: string | string[];
|
|
56
59
|
options?: Partial<IMailMessage>;
|
|
57
60
|
}): Promise<IMailSendResult>;
|
|
@@ -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\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]:
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/message.ts"],"names":[],"mappings":"","sourcesContent":["import type { Readable } from 'node:stream';\nimport type { TMailTemplateMissing } from '../constants';\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]: unknown;\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 /** What a template does with a placeholder the data does not have. @default MailTemplateMissingModes.EMPTY */\n missing?: TMailTemplateMissing;\n [key: string]: unknown;\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?: unknown;\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, unknown>;\n recipients: string | string[];\n options?: Partial<IMailMessage>;\n }): Promise<IMailSendResult>;\n verify(): Promise<boolean>;\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { AnyType } from '@venizia/ignis-helpers/common';
|
|
2
1
|
import type SMTPTransport from 'nodemailer/lib/smtp-transport';
|
|
3
2
|
import type { IMailTransport } from './message.js';
|
|
4
3
|
/** Options shared by every mail provider. */
|
|
@@ -48,15 +47,19 @@ export interface ICustomMailOptions extends IBaseMailOptions {
|
|
|
48
47
|
/** 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. */
|
|
49
48
|
export interface IGenericMailOptions extends IBaseMailOptions {
|
|
50
49
|
provider: string;
|
|
51
|
-
config: Record<string,
|
|
50
|
+
config: Record<string, unknown>;
|
|
52
51
|
}
|
|
53
52
|
/** Options passed to the mail component, discriminated by `provider`. */
|
|
54
53
|
export type TMailOptions = INodemailerMailOptions | IAmazonSesMailOptions | IMailgunMailOptions | ICustomMailOptions | IGenericMailOptions;
|
|
55
54
|
/** Nodemailer `createTransport` argument: a transport instance, SMTP options or a connection URL. */
|
|
56
55
|
export type TNodemailerConfig = SMTPTransport | SMTPTransport.Options | string;
|
|
57
|
-
/** Mailgun client options (`mailgun.js`) plus the sending `domain`. */
|
|
58
|
-
export type TMailgunConfig =
|
|
56
|
+
/** Mailgun client options (`mailgun.js`) plus the sending `domain`; the transport throws on a missing `username`, `key` or `domain`. */
|
|
57
|
+
export type TMailgunConfig = {
|
|
58
|
+
username: string;
|
|
59
|
+
key: string;
|
|
59
60
|
domain: string;
|
|
61
|
+
url?: string;
|
|
62
|
+
[option: string]: unknown;
|
|
60
63
|
};
|
|
61
64
|
/**
|
|
62
65
|
* The peer module itself, handed over by an application that already holds it. A `bun build
|
|
@@ -66,10 +69,31 @@ export type TMailgunConfig = AnyType & {
|
|
|
66
69
|
* a compile error rather than a boot crash.
|
|
67
70
|
*/
|
|
68
71
|
export type TNodemailerModule = {
|
|
69
|
-
createTransport
|
|
72
|
+
createTransport(config: TNodemailerConfig): INodemailerTransporter;
|
|
70
73
|
};
|
|
74
|
+
/** The part of a `nodemailer` transporter the transport calls. */
|
|
75
|
+
export interface INodemailerTransporter {
|
|
76
|
+
sendMail(mailOptions: object): Promise<{
|
|
77
|
+
messageId?: string;
|
|
78
|
+
response?: unknown;
|
|
79
|
+
}>;
|
|
80
|
+
verify(): Promise<unknown>;
|
|
81
|
+
close(): void;
|
|
82
|
+
}
|
|
83
|
+
/** The result of one `mailgun.js` send; `id` is the message id. */
|
|
84
|
+
export interface IMailgunSendResult {
|
|
85
|
+
id?: string;
|
|
86
|
+
}
|
|
87
|
+
/** The part of the `mailgun.js` messages client the transport calls. */
|
|
88
|
+
export interface IMailgunMessagesClient {
|
|
89
|
+
create(domain: string, message: object): Promise<IMailgunSendResult>;
|
|
90
|
+
}
|
|
71
91
|
/** The `mailgun.js` class, as a constructor taking the form-data implementation. */
|
|
72
|
-
export type TMailgunModule = new (formData:
|
|
92
|
+
export type TMailgunModule = new (formData: typeof FormData) => {
|
|
93
|
+
client(config: object): {
|
|
94
|
+
messages: IMailgunMessagesClient;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
73
97
|
/** Amazon SES client configuration: `region` is required; `credentials` and `endpoint` are optional. */
|
|
74
98
|
export type TAmazonSesConfig = {
|
|
75
99
|
region: string;
|
|
@@ -80,14 +104,34 @@ export type TAmazonSesConfig = {
|
|
|
80
104
|
};
|
|
81
105
|
endpoint?: string;
|
|
82
106
|
};
|
|
107
|
+
/** The part of an `@aws-sdk/client-sesv2` client the transport calls; `send` resolves with the command's output. */
|
|
108
|
+
export interface IAmazonSesClient {
|
|
109
|
+
send(command: object): Promise<unknown>;
|
|
110
|
+
destroy?(): void;
|
|
111
|
+
}
|
|
112
|
+
/** The input of a `SendEmailCommand`: the sender, the recipients and the raw MIME body. */
|
|
113
|
+
export interface IAmazonSesSendEmailInput {
|
|
114
|
+
FromEmailAddress?: string;
|
|
115
|
+
Destination: {
|
|
116
|
+
ToAddresses: string[];
|
|
117
|
+
CcAddresses?: string[];
|
|
118
|
+
BccAddresses?: string[];
|
|
119
|
+
};
|
|
120
|
+
ReplyToAddresses?: string[];
|
|
121
|
+
Content: {
|
|
122
|
+
Raw: {
|
|
123
|
+
Data: Uint8Array;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
}
|
|
83
127
|
/** 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. */
|
|
84
|
-
export type TAmazonSesModule<TConfig
|
|
128
|
+
export type TAmazonSesModule<TConfig = TAmazonSesConfig, TClient extends IAmazonSesClient = IAmazonSesClient> = {
|
|
85
129
|
SESv2Client: new (config: TConfig) => TClient;
|
|
86
|
-
SendEmailCommand: new (input:
|
|
87
|
-
GetAccountCommand: new (input
|
|
130
|
+
SendEmailCommand: new (input: IAmazonSesSendEmailInput) => object;
|
|
131
|
+
GetAccountCommand: new (input: object) => object;
|
|
88
132
|
};
|
|
89
133
|
/** An Amazon SES client with the command classes the transport sends and verifies with. */
|
|
90
134
|
export type TAmazonSesClient = Pick<TAmazonSesModule, 'SendEmailCommand' | 'GetAccountCommand'> & {
|
|
91
|
-
client:
|
|
135
|
+
client: IAmazonSesClient;
|
|
92
136
|
};
|
|
93
137
|
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/options.ts"],"names":[],"mappings":"","sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/options.ts"],"names":[],"mappings":"","sourcesContent":["import 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, unknown>;\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/** Mailgun client options (`mailgun.js`) plus the sending `domain`; the transport throws on a missing `username`, `key` or `domain`. */\nexport type TMailgunConfig = {\n username: string;\n key: string;\n domain: string;\n url?: string;\n [option: string]: unknown;\n};\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: TNodemailerConfig): INodemailerTransporter;\n};\n\n/** The part of a `nodemailer` transporter the transport calls. */\nexport interface INodemailerTransporter {\n sendMail(mailOptions: object): Promise<{ messageId?: string; response?: unknown }>;\n verify(): Promise<unknown>;\n close(): void;\n}\n\n/** The result of one `mailgun.js` send; `id` is the message id. */\nexport interface IMailgunSendResult {\n id?: string;\n}\n\n/** The part of the `mailgun.js` messages client the transport calls. */\nexport interface IMailgunMessagesClient {\n create(domain: string, message: object): Promise<IMailgunSendResult>;\n}\n\n/** The `mailgun.js` class, as a constructor taking the form-data implementation. */\nexport type TMailgunModule = new (formData: typeof FormData) => {\n client(config: object): { messages: IMailgunMessagesClient };\n};\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/** The part of an `@aws-sdk/client-sesv2` client the transport calls; `send` resolves with the command's output. */\nexport interface IAmazonSesClient {\n send(command: object): Promise<unknown>;\n destroy?(): void;\n}\n\n/** The input of a `SendEmailCommand`: the sender, the recipients and the raw MIME body. */\nexport interface IAmazonSesSendEmailInput {\n FromEmailAddress?: string;\n Destination: { ToAddresses: string[]; CcAddresses?: string[]; BccAddresses?: string[] };\n ReplyToAddresses?: string[];\n Content: { Raw: { Data: Uint8Array } };\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 = TAmazonSesConfig,\n TClient extends IAmazonSesClient = IAmazonSesClient,\n> = {\n SESv2Client: new (config: TConfig) => TClient;\n SendEmailCommand: new (input: IAmazonSesSendEmailInput) => object;\n GetAccountCommand: new (input: object) => object;\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: IAmazonSesClient;\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TMailBackoffType } from '../constants.js';
|
|
2
|
-
import type { TConstValue } from '@venizia/ignis-helpers/common';
|
|
3
|
-
import type {
|
|
2
|
+
import type { TConstValue, ValueOrPromise } from '@venizia/ignis-helpers/common';
|
|
3
|
+
import type { IRedisHelper } from '@venizia/ignis-helpers';
|
|
4
4
|
import type { BullMQExecutorModes, MailQueueExecutorTypes } from '../constants.js';
|
|
5
5
|
/** Per-job options for a queued verification mail. `delay` and `backoff.delay` are milliseconds; `attempts` is the total number of tries, first included. */
|
|
6
6
|
export interface IMailQueueOptions {
|
|
@@ -29,7 +29,9 @@ export interface IMailQueueResult {
|
|
|
29
29
|
/** Queues verification mails and runs them through the processor registered with `setProcessor`. */
|
|
30
30
|
export interface IMailQueueExecutor {
|
|
31
31
|
enqueueVerificationEmail(email: string, options?: IMailQueueOptions): Promise<IMailQueueResult>;
|
|
32
|
-
setProcessor(processor: (email: string) => Promise<IMailProcessorResult>): void
|
|
32
|
+
setProcessor(processor: (email: string) => Promise<IMailProcessorResult>): ValueOrPromise<void>;
|
|
33
|
+
/** Releases what the executor holds: timers, workers, the queue. The application stop hook calls it. */
|
|
34
|
+
close?(): Promise<void>;
|
|
33
35
|
}
|
|
34
36
|
/** Envelope every queue-backed executor stores for one pending verification email. */
|
|
35
37
|
export interface IQueueJobPayload {
|
|
@@ -43,22 +45,33 @@ export interface IQueueJobPayload {
|
|
|
43
45
|
export interface IInternalQueueMailExecutorOpts {
|
|
44
46
|
identifier: string;
|
|
45
47
|
}
|
|
46
|
-
/** Options of the BullMQ mail executor: the Redis
|
|
48
|
+
/** Options of the BullMQ mail executor: the Redis helper, the queue `identifier` and BullMQ `name`, and which of queue and workers this process runs. */
|
|
47
49
|
export interface IBullMQMailExecutorOpts {
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
+
/**
|
|
51
|
+
* A ready single, cluster or sentinel helper. The queue and each worker duplicate its client, and the
|
|
52
|
+
* application closes it: the executor never disconnects a connection it did not create. On a cluster
|
|
53
|
+
* the queue name is wrapped in a `{hash tag}` so its keys share one slot.
|
|
54
|
+
*/
|
|
55
|
+
redis: IRedisHelper;
|
|
56
|
+
/** `prefix` is the Redis key prefix of the queue and of every worker the executor builds; unset is BullMQ's own `bull`. Switching it strands the jobs under the old one: see the queue helper's migration notes. */
|
|
50
57
|
queue: {
|
|
51
58
|
identifier: string;
|
|
52
59
|
name: string;
|
|
60
|
+
prefix?: string;
|
|
53
61
|
};
|
|
54
62
|
mode: TConstValue<typeof BullMQExecutorModes>;
|
|
55
63
|
/** `bullmq` itself, for a `bun build --compile` binary that has no `node_modules` to load it from. */
|
|
56
64
|
module?: typeof import('bullmq');
|
|
57
65
|
}
|
|
58
|
-
/** Selects and configures the mail queue executor
|
|
59
|
-
export
|
|
60
|
-
type:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
/** Selects and configures the mail queue executor: `type` picks one of three, and the options its executor needs are required by the types. */
|
|
67
|
+
export type TMailQueueExecutorConfig = {
|
|
68
|
+
type: typeof MailQueueExecutorTypes.DIRECT;
|
|
69
|
+
options?: never;
|
|
70
|
+
} | {
|
|
71
|
+
type: typeof MailQueueExecutorTypes.INTERNAL_QUEUE;
|
|
72
|
+
options: IInternalQueueMailExecutorOpts;
|
|
73
|
+
} | {
|
|
74
|
+
type: typeof MailQueueExecutorTypes.BULLMQ;
|
|
75
|
+
options: IBullMQMailExecutorOpts;
|
|
76
|
+
};
|
|
64
77
|
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -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 {
|
|
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, ValueOrPromise } from '@venizia/ignis-helpers/common';\nimport type { IRedisHelper } 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>): ValueOrPromise<void>;\n /** Releases what the executor holds: timers, workers, the queue. The application stop hook calls it. */\n close?(): Promise<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 helper, the queue `identifier` and BullMQ `name`, and which of queue and workers this process runs. */\nexport interface IBullMQMailExecutorOpts {\n /**\n * A ready single, cluster or sentinel helper. The queue and each worker duplicate its client, and the\n * application closes it: the executor never disconnects a connection it did not create. On a cluster\n * the queue name is wrapped in a `{hash tag}` so its keys share one slot.\n */\n redis: IRedisHelper;\n /** `prefix` is the Redis key prefix of the queue and of every worker the executor builds; unset is BullMQ's own `bull`. Switching it strands the jobs under the old one: see the queue helper's migration notes. */\n queue: { identifier: string; name: string; prefix?: 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: `type` picks one of three, and the options its executor needs are required by the types. */\nexport type TMailQueueExecutorConfig =\n | { type: typeof MailQueueExecutorTypes.DIRECT; options?: never }\n | {\n type: typeof MailQueueExecutorTypes.INTERNAL_QUEUE;\n options: IInternalQueueMailExecutorOpts;\n }\n | { type: typeof MailQueueExecutorTypes.BULLMQ; options: IBullMQMailExecutorOpts };\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TMailTemplateFormat, TMailTemplateMissing } from '../constants.js';
|
|
2
2
|
/** A registered mail template: `content` is the body, `subject` and `description` are optional. */
|
|
3
3
|
export interface ITemplate {
|
|
4
4
|
name: string;
|
|
5
5
|
content?: string;
|
|
6
|
-
render?: (data: Record<string, AnyType>) => string;
|
|
7
6
|
subject?: string;
|
|
8
7
|
description?: string;
|
|
9
8
|
}
|
|
@@ -12,8 +11,13 @@ export interface IMailTemplateEngine {
|
|
|
12
11
|
render(opts: {
|
|
13
12
|
templateData?: string;
|
|
14
13
|
templateName?: string;
|
|
15
|
-
data: Record<string,
|
|
14
|
+
data: Record<string, unknown>;
|
|
15
|
+
/** Every key of the template is checked first and the render refuses when any is missing, naming them all; sections are not checked (an absent one is an optional block). */
|
|
16
16
|
requireValidate?: boolean;
|
|
17
|
+
/** What a missing placeholder renders; `THROW` refuses at the first one. @default MailTemplateMissingModes.EMPTY */
|
|
18
|
+
missing?: TMailTemplateMissing;
|
|
19
|
+
/** @default MailTemplateFormats.HTML */
|
|
20
|
+
format?: TMailTemplateFormat;
|
|
17
21
|
}): string;
|
|
18
22
|
registerTemplate(opts: {
|
|
19
23
|
name: string;
|
|
@@ -21,7 +25,7 @@ export interface IMailTemplateEngine {
|
|
|
21
25
|
}): void;
|
|
22
26
|
validateTemplateData(opts: {
|
|
23
27
|
template: string;
|
|
24
|
-
data: Record<string,
|
|
28
|
+
data: Record<string, unknown>;
|
|
25
29
|
}): {
|
|
26
30
|
isValid: boolean;
|
|
27
31
|
missingKeys: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/template.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../../src/components/mail/common/types/template.ts"],"names":[],"mappings":"","sourcesContent":["import type { TMailTemplateFormat, TMailTemplateMissing } from '../constants';\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 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, unknown>;\n /** Every key of the template is checked first and the render refuses when any is missing, naming them all; sections are not checked (an absent one is an optional block). */\n requireValidate?: boolean;\n /** What a missing placeholder renders; `THROW` refuses at the first one. @default MailTemplateMissingModes.EMPTY */\n missing?: TMailTemplateMissing;\n /** @default MailTemplateFormats.HTML */\n format?: TMailTemplateFormat;\n }): string;\n registerTemplate(opts: { name: string; content: string }): void;\n validateTemplateData(opts: { template: string; data: Record<string, unknown> }): {\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,6 +1,7 @@
|
|
|
1
1
|
/** Sizes and lifetimes for generated verification data: code digits, token bytes, code lifetime in minutes, token lifetime in hours. */
|
|
2
2
|
export interface IVerificationGenerationOptions {
|
|
3
3
|
codeLength: number;
|
|
4
|
+
/** Random bytes of the verification token; an integer of at least 16 (128 bits), or generation throws. */
|
|
4
5
|
tokenBytes: number;
|
|
5
6
|
codeExpiryMinutes: number;
|
|
6
7
|
tokenExpiryHours: number;
|
|
@@ -1 +1 @@
|
|
|
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
|
+
{"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 /** Random bytes of the verification token; an integer of at least 16 (128 bits), or generation throws. */\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"]}
|