@venizia/ignis-atlas 0.1.0-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/LICENSE.md +104 -0
- package/README.md +144 -0
- package/dist/cjs/cli/modes.d.ts +29 -0
- package/dist/cjs/cli/modes.d.ts.map +1 -0
- package/dist/cjs/cli/modes.js +70 -0
- package/dist/cjs/cli/modes.js.map +1 -0
- package/dist/cjs/cli.d.ts +3 -0
- package/dist/cjs/cli.d.ts.map +1 -0
- package/dist/cjs/cli.js +60 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/common/constants.d.ts +22 -0
- package/dist/cjs/common/constants.d.ts.map +1 -0
- package/dist/cjs/common/constants.js +32 -0
- package/dist/cjs/common/constants.js.map +1 -0
- package/dist/cjs/common/index.d.ts +3 -0
- package/dist/cjs/common/index.d.ts.map +1 -0
- package/dist/cjs/common/index.js +19 -0
- package/dist/cjs/common/index.js.map +1 -0
- package/dist/cjs/common/logger.d.ts +21 -0
- package/dist/cjs/common/logger.d.ts.map +1 -0
- package/dist/cjs/common/logger.js +50 -0
- package/dist/cjs/common/logger.js.map +1 -0
- package/dist/cjs/common/types.d.ts +5 -0
- package/dist/cjs/common/types.d.ts.map +1 -0
- package/dist/cjs/common/types.js +3 -0
- package/dist/cjs/common/types.js.map +1 -0
- package/dist/cjs/corpus/chunker.d.ts +12 -0
- package/dist/cjs/corpus/chunker.d.ts.map +1 -0
- package/dist/cjs/corpus/chunker.js +298 -0
- package/dist/cjs/corpus/chunker.js.map +1 -0
- package/dist/cjs/corpus/common/index.d.ts +2 -0
- package/dist/cjs/corpus/common/index.d.ts.map +1 -0
- package/dist/cjs/corpus/common/index.js +18 -0
- package/dist/cjs/corpus/common/index.js.map +1 -0
- package/dist/cjs/corpus/common/types.d.ts +37 -0
- package/dist/cjs/corpus/common/types.d.ts.map +1 -0
- package/dist/cjs/corpus/common/types.js +3 -0
- package/dist/cjs/corpus/common/types.js.map +1 -0
- package/dist/cjs/corpus/frontmatter.d.ts +13 -0
- package/dist/cjs/corpus/frontmatter.d.ts.map +1 -0
- package/dist/cjs/corpus/frontmatter.js +31 -0
- package/dist/cjs/corpus/frontmatter.js.map +1 -0
- package/dist/cjs/corpus/index.d.ts +6 -0
- package/dist/cjs/corpus/index.d.ts.map +1 -0
- package/dist/cjs/corpus/index.js +22 -0
- package/dist/cjs/corpus/index.js.map +1 -0
- package/dist/cjs/corpus/loader.d.ts +16 -0
- package/dist/cjs/corpus/loader.d.ts.map +1 -0
- package/dist/cjs/corpus/loader.js +72 -0
- package/dist/cjs/corpus/loader.js.map +1 -0
- package/dist/cjs/corpus/roots.d.ts +9 -0
- package/dist/cjs/corpus/roots.d.ts.map +1 -0
- package/dist/cjs/corpus/roots.js +30 -0
- package/dist/cjs/corpus/roots.js.map +1 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/protocol/common/constants.d.ts +9 -0
- package/dist/cjs/protocol/common/constants.d.ts.map +1 -0
- package/dist/cjs/protocol/common/constants.js +13 -0
- package/dist/cjs/protocol/common/constants.js.map +1 -0
- package/dist/cjs/protocol/common/index.d.ts +4 -0
- package/dist/cjs/protocol/common/index.d.ts.map +1 -0
- package/dist/cjs/protocol/common/index.js +20 -0
- package/dist/cjs/protocol/common/index.js.map +1 -0
- package/dist/cjs/protocol/common/rpc-error.d.ts +9 -0
- package/dist/cjs/protocol/common/rpc-error.d.ts.map +1 -0
- package/dist/cjs/protocol/common/rpc-error.js +12 -0
- package/dist/cjs/protocol/common/rpc-error.js.map +1 -0
- package/dist/cjs/protocol/common/types.d.ts +32 -0
- package/dist/cjs/protocol/common/types.d.ts.map +1 -0
- package/dist/cjs/protocol/common/types.js +3 -0
- package/dist/cjs/protocol/common/types.js.map +1 -0
- package/dist/cjs/protocol/index.d.ts +3 -0
- package/dist/cjs/protocol/index.d.ts.map +1 -0
- package/dist/cjs/protocol/index.js +19 -0
- package/dist/cjs/protocol/index.js.map +1 -0
- package/dist/cjs/protocol/transport.d.ts +28 -0
- package/dist/cjs/protocol/transport.d.ts.map +1 -0
- package/dist/cjs/protocol/transport.js +155 -0
- package/dist/cjs/protocol/transport.js.map +1 -0
- package/dist/cjs/search/common/constants.d.ts +23 -0
- package/dist/cjs/search/common/constants.d.ts.map +1 -0
- package/dist/cjs/search/common/constants.js +56 -0
- package/dist/cjs/search/common/constants.js.map +1 -0
- package/dist/cjs/search/common/index.d.ts +3 -0
- package/dist/cjs/search/common/index.d.ts.map +1 -0
- package/dist/cjs/search/common/index.js +19 -0
- package/dist/cjs/search/common/index.js.map +1 -0
- package/dist/cjs/search/common/types.d.ts +18 -0
- package/dist/cjs/search/common/types.d.ts.map +1 -0
- package/dist/cjs/search/common/types.js +3 -0
- package/dist/cjs/search/common/types.js.map +1 -0
- package/dist/cjs/search/index.d.ts +4 -0
- package/dist/cjs/search/index.d.ts.map +1 -0
- package/dist/cjs/search/index.js +20 -0
- package/dist/cjs/search/index.js.map +1 -0
- package/dist/cjs/search/planner.d.ts +13 -0
- package/dist/cjs/search/planner.d.ts.map +1 -0
- package/dist/cjs/search/planner.js +58 -0
- package/dist/cjs/search/planner.js.map +1 -0
- package/dist/cjs/search/store.d.ts +37 -0
- package/dist/cjs/search/store.d.ts.map +1 -0
- package/dist/cjs/search/store.js +141 -0
- package/dist/cjs/search/store.js.map +1 -0
- package/dist/cjs/server/freshness.d.ts +40 -0
- package/dist/cjs/server/freshness.d.ts.map +1 -0
- package/dist/cjs/server/freshness.js +85 -0
- package/dist/cjs/server/freshness.js.map +1 -0
- package/dist/cjs/server.d.ts +12 -0
- package/dist/cjs/server.d.ts.map +1 -0
- package/dist/cjs/server.js +65 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/tools/common/index.d.ts +2 -0
- package/dist/cjs/tools/common/index.d.ts.map +1 -0
- package/dist/cjs/tools/common/index.js +18 -0
- package/dist/cjs/tools/common/index.js.map +1 -0
- package/dist/cjs/tools/common/schemas.d.ts +23 -0
- package/dist/cjs/tools/common/schemas.d.ts.map +1 -0
- package/dist/cjs/tools/common/schemas.js +37 -0
- package/dist/cjs/tools/common/schemas.js.map +1 -0
- package/dist/cjs/tools/get.tool.d.ts +6 -0
- package/dist/cjs/tools/get.tool.d.ts.map +1 -0
- package/dist/cjs/tools/get.tool.js +115 -0
- package/dist/cjs/tools/get.tool.js.map +1 -0
- package/dist/cjs/tools/index.d.ts +4 -0
- package/dist/cjs/tools/index.d.ts.map +1 -0
- package/dist/cjs/tools/index.js +20 -0
- package/dist/cjs/tools/index.js.map +1 -0
- package/dist/cjs/tools/search.tool.d.ts +6 -0
- package/dist/cjs/tools/search.tool.d.ts.map +1 -0
- package/dist/cjs/tools/search.tool.js +58 -0
- package/dist/cjs/tools/search.tool.js.map +1 -0
- package/dist/corpus/changelogs/2025-12-16-initial-architecture.md +145 -0
- package/dist/corpus/changelogs/2025-12-16-model-repo-datasource-refactor.md +300 -0
- package/dist/corpus/changelogs/2025-12-17-refactor.md +90 -0
- package/dist/corpus/changelogs/2025-12-18-performance-optimizations.md +130 -0
- package/dist/corpus/changelogs/2025-12-18-repository-validation-security.md +255 -0
- package/dist/corpus/changelogs/2025-12-26-nested-relations-and-generics.md +86 -0
- package/dist/corpus/changelogs/2025-12-26-transaction-support.md +57 -0
- package/dist/corpus/changelogs/2025-12-29-dynamic-binding-registration.md +104 -0
- package/dist/corpus/changelogs/2025-12-29-snowflake-uid-helper.md +100 -0
- package/dist/corpus/changelogs/2025-12-30-repository-enhancements.md +214 -0
- package/dist/corpus/changelogs/2025-12-31-json-path-filtering-array-operators.md +214 -0
- package/dist/corpus/changelogs/2025-12-31-string-id-custom-generator.md +137 -0
- package/dist/corpus/changelogs/2026-01-02-default-filter-and-repository-mixins.md +421 -0
- package/dist/corpus/changelogs/2026-01-05-range-queries-content-range.md +184 -0
- package/dist/corpus/changelogs/2026-01-06-basic-authentication.md +103 -0
- package/dist/corpus/changelogs/2026-01-07-controller-route-customization.md +190 -0
- package/dist/corpus/changelogs/2026-01-11-logger-optimization-hf-logger.md +254 -0
- package/dist/corpus/changelogs/2026-02-06-socket-io-integration-fix.md +541 -0
- package/dist/corpus/changelogs/2026-02-10-websocket-heartbeat-payload.md +173 -0
- package/dist/corpus/changelogs/2026-02-11-crypto-refactor-ecdh.md +217 -0
- package/dist/corpus/changelogs/2026-02-11-websocket-encrypted-delivery.md +209 -0
- package/dist/corpus/changelogs/2026-02-11-websocket-generic-types.md +134 -0
- package/dist/corpus/changelogs/2026-02-16-authorization-system.md +378 -0
- package/dist/corpus/changelogs/2026-02-26-core-helpers-decoupling.md +145 -0
- package/dist/corpus/changelogs/2026-02-27-jwks-authentication.md +391 -0
- package/dist/corpus/changelogs/2026-03-02-model-authorize-settings.md +155 -0
- package/dist/corpus/changelogs/2026-03-04-jwt-payload-field-codecs.md +219 -0
- package/dist/corpus/changelogs/2026-03-06-filter-offset-skip-fix.md +88 -0
- package/dist/corpus/changelogs/2026-03-10-kafka-helpers-refactor.md +225 -0
- package/dist/corpus/changelogs/2026-03-12-kafka-helpers-enhancement.md +169 -0
- package/dist/corpus/changelogs/2026-03-15-grpc-controller-system.md +281 -0
- package/dist/corpus/changelogs/2026-03-30-row-level-locking.md +134 -0
- package/dist/corpus/changelogs/2026-03-31-typescript-6-and-toolchain.md +100 -0
- package/dist/corpus/changelogs/2026-04-23-error-response-extra-fields.md +131 -0
- package/dist/corpus/changelogs/2026-05-05-refresh-token-endpoint.md +116 -0
- package/dist/corpus/changelogs/2026-05-08-crud-route-toggles-and-typed-responses.md +136 -0
- package/dist/corpus/changelogs/2026-05-20-relation-scope-default-limit.md +133 -0
- package/dist/corpus/changelogs/2026-05-21-mass-mutation-guards.md +102 -0
- package/dist/corpus/changelogs/2026-05-22-casbin-adapter-schema-qualification.md +72 -0
- package/dist/corpus/changelogs/2026-05-25-per-model-default-limit.md +68 -0
- package/dist/corpus/changelogs/2026-05-27-casbin-domain-matching-function.md +90 -0
- package/dist/corpus/changelogs/2026-06-02-authorize-scoped-rbac.md +105 -0
- package/dist/corpus/changelogs/2026-06-14-validation-codes-and-error-hardening.md +124 -0
- package/dist/corpus/changelogs/2026-06-18-auth-user-information-endpoint.md +69 -0
- package/dist/corpus/changelogs/2026-06-25-redis-helpers-refactor.md +199 -0
- package/dist/corpus/changelogs/2026-07-05-unified-repository-connectors.md +206 -0
- package/dist/corpus/changelogs/2026-07-08-typesense-advanced-search.md +72 -0
- package/dist/corpus/changelogs/2026-07-11-connectors-consistency-hardening.md +192 -0
- package/dist/corpus/changelogs/2026-07-11-postgres-driver-seam-supabase.md +146 -0
- package/dist/corpus/changelogs/2026-07-12-core-consolidation-dedup.md +127 -0
- package/dist/corpus/changelogs/2026-07-13-hardening-round.md +99 -0
- package/dist/corpus/changelogs/2026-07-14-driver-class-bundling.md +100 -0
- package/dist/corpus/changelogs/2026-07-16-error-catalog-and-structured-message.md +64 -0
- package/dist/corpus/changelogs/2026-07-16-secrets-vault-integration.md +72 -0
- package/dist/corpus/changelogs/2026-07-17-error-module-redesign.md +202 -0
- package/dist/corpus/changelogs/2026-07-17-logger-correctness-pass.md +46 -0
- package/dist/corpus/changelogs/2026-07-17-secrets-bundler-invisible-peers.md +30 -0
- package/dist/corpus/changelogs/2026-07-18-dependency-refresh.md +55 -0
- package/dist/corpus/changelogs/2026-07-18-logger-overhaul.md +104 -0
- package/dist/corpus/changelogs/2026-07-18-repository-read-retry.md +74 -0
- package/dist/corpus/changelogs/2026-07-20-casbin-custom-grants.md +72 -0
- package/dist/corpus/changelogs/2026-07-20-casbin-single-wave-extraction.md +58 -0
- package/dist/corpus/changelogs/2026-07-20-error-from-error-client.md +66 -0
- package/dist/corpus/changelogs/2026-07-21-casbin-connector-resolution-fix.md +36 -0
- package/dist/corpus/changelogs/2026-07-25-error-logging.md +129 -0
- package/dist/corpus/changelogs/2026-07-25-ignis-filter-package.md +75 -0
- package/dist/corpus/changelogs/2026-07-26-search-and-mail-error-codes.md +58 -0
- package/dist/corpus/changelogs/2026-08-01-relational-connector-lift.md +403 -0
- package/dist/corpus/changelogs/2026-08-02-sqlite-and-pglite-connectors.md +177 -0
- package/dist/corpus/changelogs/2026-08-05-search-dialect-relational-parity.md +90 -0
- package/dist/corpus/changelogs/2026-08-06-aes-pbkdf2-and-key-rotation.md +131 -0
- package/dist/corpus/changelogs/2026-08-07-default-query-by.md +62 -0
- package/dist/corpus/changelogs/2026-08-07-nested-fields-and-order-validation.md +75 -0
- package/dist/corpus/changelogs/2026-08-07-typesense-multi-search-transport.md +97 -0
- package/dist/corpus/changelogs/2026-08-12-json-log-arguments.md +69 -0
- package/dist/corpus/changelogs/2026-08-13-browser-pure-kernel.md +130 -0
- package/dist/corpus/changelogs/2026-08-18-esm-builds-and-one-default-stack.md +104 -0
- package/dist/corpus/changelogs/2026-08-18-opaque-uid-helper.md +43 -0
- package/dist/corpus/changelogs/2026-08-19-browser-bff-multi-tab.md +88 -0
- package/dist/corpus/changelogs/2026-08-19-service-authentication-phase-1.md +157 -0
- package/dist/corpus/changelogs/2026-08-21-service-authentication-strategy.md +127 -0
- package/dist/corpus/changelogs/2026-08-22-logger-color-off-outside-development.md +48 -0
- package/dist/corpus/changelogs/2026-08-24-query-wrapper-schemas.md +77 -0
- package/dist/corpus/changelogs/2026-08-29-casbin-domain-hierarchy.md +66 -0
- package/dist/corpus/changelogs/2026-08-30-authorize-no-enforcer-fails-closed.md +60 -0
- package/dist/corpus/changelogs/2026-08-30-crypto-hashing.md +158 -0
- package/dist/corpus/changelogs/2026-08-30-policy-definition-extra-variants.md +62 -0
- package/dist/corpus/changelogs/2026-08-30-row-scope-filter.md +221 -0
- package/dist/corpus/changelogs/2026-08-30-search-connector-health-and-import-contract.md +46 -0
- package/dist/corpus/changelogs/2026-08-30-tree-and-recursive-sql.md +188 -0
- package/dist/corpus/changelogs/2026-08-30-typed-where-clauses.md +114 -0
- package/dist/corpus/changelogs/2026-08-31-entity-id-brand.md +70 -0
- package/dist/corpus/changelogs/2026-08-31-event-bus-retry.md +143 -0
- package/dist/corpus/changelogs/2026-08-31-policy-domain-split-release-b.md +54 -0
- package/dist/corpus/changelogs/2026-08-31-policy-domain-split.md +175 -0
- package/dist/corpus/changelogs/2026-08-31-scope-filter-boot-checks.md +77 -0
- package/dist/corpus/changelogs/2026-09-02-bundle-safe-helpers.md +71 -0
- package/dist/corpus/changelogs/2026-09-02-decorator-artifact-registration.md +119 -0
- package/dist/corpus/changelogs/2026-09-03-deprecated-boot-api-removed.md +133 -0
- package/dist/corpus/changelogs/2026-09-04-dependency-floors-raised.md +61 -0
- package/dist/corpus/changelogs/2026-09-05-boot-checks.md +57 -0
- package/dist/corpus/changelogs/2026-09-05-core-drops-boot-dependency.md +44 -0
- package/dist/corpus/changelogs/2026-09-05-list-response-contract.md +74 -0
- package/dist/corpus/changelogs/2026-09-06-bun-serve-options.md +51 -0
- package/dist/corpus/changelogs/2026-09-06-ignis-atlas.md +54 -0
- package/dist/corpus/changelogs/2026-09-06-repository-inheritance-and-quiet-cli.md +46 -0
- package/dist/corpus/changelogs/2026-09-06-shared-singletons-across-module-copies.md +43 -0
- package/dist/corpus/changelogs/index.md +135 -0
- package/dist/corpus/changelogs/planned-schema-migrator.md +553 -0
- package/dist/corpus/changelogs/template.md +64 -0
- package/dist/corpus/wiki/best-practices/api-usage-examples.md +617 -0
- package/dist/corpus/wiki/best-practices/architectural-patterns.md +437 -0
- package/dist/corpus/wiki/best-practices/architecture-decisions.md +524 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/advanced-patterns.md +283 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/constants-configuration.md +240 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/control-flow.md +280 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/documentation.md +241 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/function-patterns.md +178 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/index.md +114 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/naming-conventions.md +200 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/route-definitions.md +205 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/tooling.md +168 -0
- package/dist/corpus/wiki/best-practices/code-style-standards/type-safety.md +199 -0
- package/dist/corpus/wiki/best-practices/common-pitfalls.md +447 -0
- package/dist/corpus/wiki/best-practices/contribution-workflow.md +211 -0
- package/dist/corpus/wiki/best-practices/data-modeling.md +548 -0
- package/dist/corpus/wiki/best-practices/deployment-strategies.md +736 -0
- package/dist/corpus/wiki/best-practices/error-handling.md +604 -0
- package/dist/corpus/wiki/best-practices/index.md +206 -0
- package/dist/corpus/wiki/best-practices/performance-optimization.md +437 -0
- package/dist/corpus/wiki/best-practices/security-guidelines.md +523 -0
- package/dist/corpus/wiki/best-practices/testing-strategies.md +639 -0
- package/dist/corpus/wiki/best-practices/troubleshooting-tips.md +227 -0
- package/dist/corpus/wiki/extensions/atlas/index.md +65 -0
- package/dist/corpus/wiki/extensions/components/api-reference.md +268 -0
- package/dist/corpus/wiki/extensions/components/authentication/api.md +643 -0
- package/dist/corpus/wiki/extensions/components/authentication/errors.md +211 -0
- package/dist/corpus/wiki/extensions/components/authentication/index.md +171 -0
- package/dist/corpus/wiki/extensions/components/authentication/usage.md +464 -0
- package/dist/corpus/wiki/extensions/components/authorization/api.md +1509 -0
- package/dist/corpus/wiki/extensions/components/authorization/errors.md +397 -0
- package/dist/corpus/wiki/extensions/components/authorization/getting-started.md +227 -0
- package/dist/corpus/wiki/extensions/components/authorization/index.md +155 -0
- package/dist/corpus/wiki/extensions/components/authorization/usage.md +587 -0
- package/dist/corpus/wiki/extensions/components/health-check.md +227 -0
- package/dist/corpus/wiki/extensions/components/index.md +26 -0
- package/dist/corpus/wiki/extensions/components/mail/api.md +773 -0
- package/dist/corpus/wiki/extensions/components/mail/errors.md +190 -0
- package/dist/corpus/wiki/extensions/components/mail/index.md +182 -0
- package/dist/corpus/wiki/extensions/components/mail/usage.md +370 -0
- package/dist/corpus/wiki/extensions/components/request-tracker.md +152 -0
- package/dist/corpus/wiki/extensions/components/socket-io/api.md +728 -0
- package/dist/corpus/wiki/extensions/components/socket-io/errors.md +119 -0
- package/dist/corpus/wiki/extensions/components/socket-io/index.md +116 -0
- package/dist/corpus/wiki/extensions/components/socket-io/usage.md +429 -0
- package/dist/corpus/wiki/extensions/components/static-asset/api.md +593 -0
- package/dist/corpus/wiki/extensions/components/static-asset/errors.md +159 -0
- package/dist/corpus/wiki/extensions/components/static-asset/index.md +160 -0
- package/dist/corpus/wiki/extensions/components/static-asset/usage.md +253 -0
- package/dist/corpus/wiki/extensions/components/template/api-page.md +125 -0
- package/dist/corpus/wiki/extensions/components/template/errors-page.md +100 -0
- package/dist/corpus/wiki/extensions/components/template/index.md +104 -0
- package/dist/corpus/wiki/extensions/components/template/setup-page.md +134 -0
- package/dist/corpus/wiki/extensions/components/template/single-page.md +132 -0
- package/dist/corpus/wiki/extensions/components/template/usage-page.md +127 -0
- package/dist/corpus/wiki/extensions/components/websocket/api.md +416 -0
- package/dist/corpus/wiki/extensions/components/websocket/errors.md +128 -0
- package/dist/corpus/wiki/extensions/components/websocket/index.md +127 -0
- package/dist/corpus/wiki/extensions/components/websocket/usage.md +257 -0
- package/dist/corpus/wiki/extensions/helpers/cron/index.md +116 -0
- package/dist/corpus/wiki/extensions/helpers/crypto/index.md +136 -0
- package/dist/corpus/wiki/extensions/helpers/crypto/reference.md +544 -0
- package/dist/corpus/wiki/extensions/helpers/env/index.md +119 -0
- package/dist/corpus/wiki/extensions/helpers/error/index.md +373 -0
- package/dist/corpus/wiki/extensions/helpers/index.md +63 -0
- package/dist/corpus/wiki/extensions/helpers/inversion/index.md +142 -0
- package/dist/corpus/wiki/extensions/helpers/inversion/reference.md +531 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/admin.md +210 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/compile-binary.md +125 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/consumer.md +422 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/examples.md +154 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/index.md +84 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/producer.md +408 -0
- package/dist/corpus/wiki/extensions/helpers/kafka/schema-registry.md +194 -0
- package/dist/corpus/wiki/extensions/helpers/logger/hf-logger.md +220 -0
- package/dist/corpus/wiki/extensions/helpers/logger/index.md +156 -0
- package/dist/corpus/wiki/extensions/helpers/logger/pino.md +107 -0
- package/dist/corpus/wiki/extensions/helpers/logger/reference.md +938 -0
- package/dist/corpus/wiki/extensions/helpers/network/api.md +1067 -0
- package/dist/corpus/wiki/extensions/helpers/network/index.md +189 -0
- package/dist/corpus/wiki/extensions/helpers/queue/index.md +165 -0
- package/dist/corpus/wiki/extensions/helpers/queue/reference.md +490 -0
- package/dist/corpus/wiki/extensions/helpers/redis/index.md +159 -0
- package/dist/corpus/wiki/extensions/helpers/redis/reference.md +784 -0
- package/dist/corpus/wiki/extensions/helpers/secrets/index.md +136 -0
- package/dist/corpus/wiki/extensions/helpers/socket-io/api.md +618 -0
- package/dist/corpus/wiki/extensions/helpers/socket-io/index.md +167 -0
- package/dist/corpus/wiki/extensions/helpers/storage/api.md +1021 -0
- package/dist/corpus/wiki/extensions/helpers/storage/index.md +162 -0
- package/dist/corpus/wiki/extensions/helpers/template/index.md +69 -0
- package/dist/corpus/wiki/extensions/helpers/template/single-page.md +126 -0
- package/dist/corpus/wiki/extensions/helpers/types/index.md +143 -0
- package/dist/corpus/wiki/extensions/helpers/types/reference.md +708 -0
- package/dist/corpus/wiki/extensions/helpers/uid/index.md +259 -0
- package/dist/corpus/wiki/extensions/helpers/websocket/api.md +888 -0
- package/dist/corpus/wiki/extensions/helpers/websocket/index.md +139 -0
- package/dist/corpus/wiki/extensions/helpers/worker-thread/index.md +142 -0
- package/dist/corpus/wiki/extensions/helpers/worker-thread/reference.md +434 -0
- package/dist/corpus/wiki/extensions/index.md +46 -0
- package/dist/corpus/wiki/guides/core-concepts/application/bootstrapping.md +274 -0
- package/dist/corpus/wiki/guides/core-concepts/application/index.md +239 -0
- package/dist/corpus/wiki/guides/core-concepts/components-guide.md +513 -0
- package/dist/corpus/wiki/guides/core-concepts/components.md +155 -0
- package/dist/corpus/wiki/guides/core-concepts/dependency-injection.md +336 -0
- package/dist/corpus/wiki/guides/core-concepts/grpc-controllers.md +296 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/datasources.md +195 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/index.md +132 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/models.md +331 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/pglite.md +218 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/postgres-drivers.md +207 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/repositories.md +311 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/search-meilisearch.md +195 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/search-typesense.md +443 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/sqlite.md +296 -0
- package/dist/corpus/wiki/guides/core-concepts/persistent/transactions.md +238 -0
- package/dist/corpus/wiki/guides/core-concepts/rest-controllers.md +465 -0
- package/dist/corpus/wiki/guides/core-concepts/secrets-vault.md +177 -0
- package/dist/corpus/wiki/guides/core-concepts/services.md +389 -0
- package/dist/corpus/wiki/guides/get-started/5-minute-quickstart.md +163 -0
- package/dist/corpus/wiki/guides/get-started/philosophy.md +135 -0
- package/dist/corpus/wiki/guides/get-started/setup.md +136 -0
- package/dist/corpus/wiki/guides/index.md +82 -0
- package/dist/corpus/wiki/guides/migrations/boot-api-removal-migration.md +79 -0
- package/dist/corpus/wiki/guides/migrations/redis-helpers-migration.md +178 -0
- package/dist/corpus/wiki/guides/migrations/scoped-rbac-migration.md +300 -0
- package/dist/corpus/wiki/guides/migrations/unified-connectors-migration.md +114 -0
- package/dist/corpus/wiki/guides/reference/glossary.md +250 -0
- package/dist/corpus/wiki/guides/tutorials/building-a-crud-api.md +704 -0
- package/dist/corpus/wiki/guides/tutorials/complete-installation.md +440 -0
- package/dist/corpus/wiki/guides/tutorials/ecommerce-api.md +1442 -0
- package/dist/corpus/wiki/guides/tutorials/realtime-chat.md +1571 -0
- package/dist/corpus/wiki/guides/tutorials/testing.md +264 -0
- package/dist/corpus/wiki/index.md +5 -0
- package/dist/corpus/wiki/public/apple-touch-icon.png +0 -0
- package/dist/corpus/wiki/public/logo.svg +1 -0
- package/dist/corpus/wiki/public/og-image.png +0 -0
- package/dist/corpus/wiki/public/site.webmanifest +11 -0
- package/dist/corpus/wiki/references/base/application.md +482 -0
- package/dist/corpus/wiki/references/base/bootstrapping.md +351 -0
- package/dist/corpus/wiki/references/base/components.md +883 -0
- package/dist/corpus/wiki/references/base/connectors.md +121 -0
- package/dist/corpus/wiki/references/base/controllers.md +1022 -0
- package/dist/corpus/wiki/references/base/datasources-reference.md +598 -0
- package/dist/corpus/wiki/references/base/datasources.md +165 -0
- package/dist/corpus/wiki/references/base/dependency-injection.md +423 -0
- package/dist/corpus/wiki/references/base/filter-system/application-usage.md +215 -0
- package/dist/corpus/wiki/references/base/filter-system/array-operators.md +135 -0
- package/dist/corpus/wiki/references/base/filter-system/comparison-operators.md +110 -0
- package/dist/corpus/wiki/references/base/filter-system/default-filter.md +267 -0
- package/dist/corpus/wiki/references/base/filter-system/fields-order-pagination.md +244 -0
- package/dist/corpus/wiki/references/base/filter-system/index.md +149 -0
- package/dist/corpus/wiki/references/base/filter-system/json-filtering.md +122 -0
- package/dist/corpus/wiki/references/base/filter-system/list-operators.md +56 -0
- package/dist/corpus/wiki/references/base/filter-system/logical-operators.md +148 -0
- package/dist/corpus/wiki/references/base/filter-system/null-operators.md +80 -0
- package/dist/corpus/wiki/references/base/filter-system/pattern-matching.md +105 -0
- package/dist/corpus/wiki/references/base/filter-system/quick-reference.md +172 -0
- package/dist/corpus/wiki/references/base/filter-system/range-operators.md +53 -0
- package/dist/corpus/wiki/references/base/filter-system/tips.md +154 -0
- package/dist/corpus/wiki/references/base/filter-system/use-cases.md +394 -0
- package/dist/corpus/wiki/references/base/grpc-controllers.md +1020 -0
- package/dist/corpus/wiki/references/base/index.md +112 -0
- package/dist/corpus/wiki/references/base/middlewares.md +543 -0
- package/dist/corpus/wiki/references/base/models-reference.md +886 -0
- package/dist/corpus/wiki/references/base/models.md +154 -0
- package/dist/corpus/wiki/references/base/providers.md +728 -0
- package/dist/corpus/wiki/references/base/repositories/advanced.md +627 -0
- package/dist/corpus/wiki/references/base/repositories/index.md +152 -0
- package/dist/corpus/wiki/references/base/repositories/mixins.md +103 -0
- package/dist/corpus/wiki/references/base/repositories/relations.md +379 -0
- package/dist/corpus/wiki/references/base/repositories/soft-deletable.md +307 -0
- package/dist/corpus/wiki/references/base/secrets.md +267 -0
- package/dist/corpus/wiki/references/base/services.md +417 -0
- package/dist/corpus/wiki/references/configuration/environment-variables.md +498 -0
- package/dist/corpus/wiki/references/configuration/index.md +132 -0
- package/dist/corpus/wiki/references/index.md +172 -0
- package/dist/corpus/wiki/references/quick-reference.md +594 -0
- package/dist/corpus/wiki/references/utilities/date.md +50 -0
- package/dist/corpus/wiki/references/utilities/duration.md +85 -0
- package/dist/corpus/wiki/references/utilities/index.md +81 -0
- package/dist/corpus/wiki/references/utilities/jsx-reference.md +298 -0
- package/dist/corpus/wiki/references/utilities/jsx.md +131 -0
- package/dist/corpus/wiki/references/utilities/module.md +110 -0
- package/dist/corpus/wiki/references/utilities/parse.md +55 -0
- package/dist/corpus/wiki/references/utilities/performance.md +54 -0
- package/dist/corpus/wiki/references/utilities/promise.md +54 -0
- package/dist/corpus/wiki/references/utilities/request.md +85 -0
- package/dist/corpus/wiki/references/utilities/retry.md +148 -0
- package/dist/corpus/wiki/references/utilities/schema.md +69 -0
- package/dist/corpus/wiki/references/utilities/statuses-reference.md +360 -0
- package/dist/corpus/wiki/references/utilities/statuses.md +122 -0
- package/package.json +74 -0
|
@@ -0,0 +1,773 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Mail Component - Full Reference
|
|
3
|
+
description: Binding keys, configuration options, interfaces, and internal implementation of the Mail component
|
|
4
|
+
difficulty: intermediate
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Mail Component Reference
|
|
8
|
+
|
|
9
|
+
Every binding key, configuration variant, interface, and internal mechanism of `MailComponent`. For the task-oriented walkthrough, see [Usage & Examples](./usage).
|
|
10
|
+
|
|
11
|
+
**Files:**
|
|
12
|
+
|
|
13
|
+
- [`packages/core-server/src/components/mail/component.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/component.ts)
|
|
14
|
+
- [`packages/core-server/src/components/mail/common/types/`](https://github.com/VENIZIA-AI/ignis/tree/main/packages/core-server/src/components/mail/common/types)
|
|
15
|
+
- [`packages/core-server/src/components/mail/common/constants.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/common/constants.ts)
|
|
16
|
+
- [`packages/core-server/src/components/mail/common/keys.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/common/keys.ts)
|
|
17
|
+
- [`packages/core-server/src/components/mail/services/mail.service.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/services/mail.service.ts)
|
|
18
|
+
- [`packages/core-server/src/components/mail/services/template.service.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/services/template.service.ts)
|
|
19
|
+
- [`packages/core-server/src/components/mail/services/generators/`](https://github.com/VENIZIA-AI/ignis/tree/main/packages/core-server/src/components/mail/services/generators)
|
|
20
|
+
- [`packages/core-server/src/components/mail/providers/mail-transporter.provider.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/providers/mail-transporter.provider.ts)
|
|
21
|
+
- [`packages/core-server/src/components/mail/providers/mail-queue-executor.provider.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/providers/mail-queue-executor.provider.ts)
|
|
22
|
+
- [`packages/core-server/src/components/mail/helpers/transporters/nodemail-transporter.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/helpers/transporters/nodemail-transporter.helper.ts)
|
|
23
|
+
- [`packages/core-server/src/components/mail/helpers/transporters/mailgun-transporter.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/helpers/transporters/mailgun-transporter.helper.ts)
|
|
24
|
+
- [`packages/core-server/src/components/mail/helpers/executors/direct-executor.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/helpers/executors/direct-executor.helper.ts)
|
|
25
|
+
- [`packages/core-server/src/components/mail/helpers/executors/internal-queue-executor.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/helpers/executors/internal-queue-executor.helper.ts)
|
|
26
|
+
- [`packages/core-server/src/components/mail/helpers/executors/bull-mq-executor.helper.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/helpers/executors/bull-mq-executor.helper.ts)
|
|
27
|
+
- [`packages/core-server/src/components/mail/utilities/type.utility.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/utilities/type.utility.ts)
|
|
28
|
+
- [`packages/core-server/src/components/mail/utilities/verification.utility.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/utilities/verification.utility.ts)
|
|
29
|
+
|
|
30
|
+
## Quick reference
|
|
31
|
+
|
|
32
|
+
| Item | Value |
|
|
33
|
+
|------|-------|
|
|
34
|
+
| Package | `@venizia/ignis` |
|
|
35
|
+
| Subpath | `@venizia/ignis/mail` |
|
|
36
|
+
| Component class | `MailComponent` |
|
|
37
|
+
| Runtimes | Both (Bun, Node.js) |
|
|
38
|
+
|
|
39
|
+
| Component | Purpose |
|
|
40
|
+
|-----------|---------|
|
|
41
|
+
| `MailComponent` | Registers mail services, transporters, generators, and the queue executor |
|
|
42
|
+
| `MailService` | `send()`, `sendBatch()`, `sendTemplate()`, `verify()` |
|
|
43
|
+
| `TemplateEngineService` | <code v-pre>{{variable}}</code> substitution engine, in-memory template registry |
|
|
44
|
+
| `NodemailerTransportHelper` | SMTP transport via `nodemailer` |
|
|
45
|
+
| `MailgunTransportHelper` | Mailgun HTTP API transport via `mailgun.js` |
|
|
46
|
+
| `DirectMailExecutorHelper` | Runs the processor immediately, no queue |
|
|
47
|
+
| `InternalQueueMailExecutorHelper` | In-memory queue (`SequentialQueueHelper`) |
|
|
48
|
+
| `BullMQMailExecutorHelper` | Redis-backed queue, distributed workers |
|
|
49
|
+
| `MailTransportProvider` | Factory: `TMailOptions` -> `IMailTransport` |
|
|
50
|
+
| `MailQueueExecutorProvider` | Factory: `IMailQueueExecutorConfig` -> `IMailQueueExecutor` |
|
|
51
|
+
| `NumericCodeGenerator` | Cryptographically random numeric codes |
|
|
52
|
+
| `RandomTokenGenerator` | Cryptographically random base64url tokens |
|
|
53
|
+
| `DefaultVerificationDataGenerator` | Composes both generators into an `IVerificationData` |
|
|
54
|
+
|
|
55
|
+
## Import paths
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
import {
|
|
59
|
+
MailComponent,
|
|
60
|
+
MailKeys,
|
|
61
|
+
MailProviders,
|
|
62
|
+
MailErrorCodes,
|
|
63
|
+
MailDefaults,
|
|
64
|
+
MailExecutorErrors,
|
|
65
|
+
MailQueueExecutorTypes,
|
|
66
|
+
BullMQExecutorModes,
|
|
67
|
+
MailService,
|
|
68
|
+
TemplateEngineService,
|
|
69
|
+
NumericCodeGenerator,
|
|
70
|
+
RandomTokenGenerator,
|
|
71
|
+
DefaultVerificationDataGenerator,
|
|
72
|
+
MailTransportProvider,
|
|
73
|
+
MailQueueExecutorProvider,
|
|
74
|
+
} from '@venizia/ignis/mail';
|
|
75
|
+
|
|
76
|
+
import type {
|
|
77
|
+
TMailOptions,
|
|
78
|
+
IBaseMailOptions,
|
|
79
|
+
INodemailerMailOptions,
|
|
80
|
+
IMailgunMailOptions,
|
|
81
|
+
ICustomMailOptions,
|
|
82
|
+
IGenericMailOptions,
|
|
83
|
+
IMailService,
|
|
84
|
+
IMailTemplateEngine,
|
|
85
|
+
IMailMessage,
|
|
86
|
+
IMailSendResult,
|
|
87
|
+
IMailTransport,
|
|
88
|
+
IMailAttachment,
|
|
89
|
+
IMailQueueExecutor,
|
|
90
|
+
IMailQueueExecutorConfig,
|
|
91
|
+
IMailQueueOptions,
|
|
92
|
+
IMailQueueResult,
|
|
93
|
+
IMailProcessorResult,
|
|
94
|
+
ITemplate,
|
|
95
|
+
IVerificationCodeGenerator,
|
|
96
|
+
IVerificationTokenGenerator,
|
|
97
|
+
IVerificationDataGenerator,
|
|
98
|
+
IVerificationData,
|
|
99
|
+
IVerificationGenerationOptions,
|
|
100
|
+
TMailProvider,
|
|
101
|
+
TNodemailerConfig,
|
|
102
|
+
TMailgunConfig,
|
|
103
|
+
} from '@venizia/ignis/mail';
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Architecture
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
┌─────────────────────────────────────────────────┐
|
|
110
|
+
│ Your Application │
|
|
111
|
+
│ │
|
|
112
|
+
│ preConfigure() │
|
|
113
|
+
│ ├── binds MailKeys.MAIL_OPTIONS (required) │
|
|
114
|
+
│ ├── binds MailKeys.MAIL_QUEUE_EXECUTOR_CONFIG │
|
|
115
|
+
│ │ (optional -- defaults to `direct`) │
|
|
116
|
+
│ └── registers MailComponent │
|
|
117
|
+
└───────────────────────┬─────────────────────────┘
|
|
118
|
+
│
|
|
119
|
+
▼
|
|
120
|
+
┌─────────────────────────────────────────────────┐
|
|
121
|
+
│ MailComponent.binding() │
|
|
122
|
+
│ │
|
|
123
|
+
│ ├── initGenerators() (transient bindings) │
|
|
124
|
+
│ │ ├── NumericCodeGenerator │
|
|
125
|
+
│ │ ├── RandomTokenGenerator │
|
|
126
|
+
│ │ └── DefaultVerificationDataGenerator │
|
|
127
|
+
│ │ │
|
|
128
|
+
│ ├── initProviders() (singleton bindings) │
|
|
129
|
+
│ │ ├── MailTransportProvider │
|
|
130
|
+
│ │ └── MailQueueExecutorProvider │
|
|
131
|
+
│ │ │
|
|
132
|
+
│ ├── initServices() (singleton bindings) │
|
|
133
|
+
│ │ ├── MailService │
|
|
134
|
+
│ │ └── TemplateEngineService │
|
|
135
|
+
│ │ │
|
|
136
|
+
│ └── createAndBindInstances() │
|
|
137
|
+
│ ├── Transport Instance ◄── MAIL_OPTIONS │
|
|
138
|
+
│ └── Queue Executor ◄── QUEUE_CONFIG │
|
|
139
|
+
│ (or the direct │
|
|
140
|
+
│ default) │
|
|
141
|
+
└─────────────────────────────────────────────────┘
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`MailService` and the queue executor are **independent** consumers of the transport/config. `IMailQueueExecutor` never calls `MailService`. See [How it works](./#how-it-works) on the Overview for that distinction.
|
|
145
|
+
|
|
146
|
+
**Source:** [`component.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/component.ts)
|
|
147
|
+
|
|
148
|
+
## Binding keys
|
|
149
|
+
|
|
150
|
+
| Key | Constant | Type | Required | Default |
|
|
151
|
+
|-----|----------|------|----------|---------|
|
|
152
|
+
| `@app/components/mail/options` | `MailKeys.MAIL_OPTIONS` | `TMailOptions` | **Yes** | -- |
|
|
153
|
+
| `@app/components/mail/queue/executor-config` | `MailKeys.MAIL_QUEUE_EXECUTOR_CONFIG` | `IMailQueueExecutorConfig` | No | `{ type: MailQueueExecutorTypes.DIRECT }` |
|
|
154
|
+
| `@app/components/mail/service` | `MailKeys.MAIL_SERVICE` | `IMailService` | No | `MailService` (singleton) |
|
|
155
|
+
| `@app/components/mail/services/template-engine` | `MailKeys.MAIL_TEMPLATE_ENGINE` | `IMailTemplateEngine` | No | `TemplateEngineService` (singleton) |
|
|
156
|
+
| `@app/components/mail/transport-provider` | `MailKeys.MAIL_TRANSPORT_PROVIDER` | `TGetMailTransportFn` | No | `MailTransportProvider` (singleton) |
|
|
157
|
+
| `@app/components/mail/transport-instance` | `MailKeys.MAIL_TRANSPORT_INSTANCE` | `IMailTransport` | No | Created by the component |
|
|
158
|
+
| `@app/components/mail/queue-executor-provider` | `MailKeys.MAIL_QUEUE_EXECUTOR_PROVIDER` | `TGetMailQueueExecutorFn` | No | `MailQueueExecutorProvider` (singleton) |
|
|
159
|
+
| `@app/components/mail/queue-executor-instance` | `MailKeys.MAIL_QUEUE_EXECUTOR_INSTANCE` | `IMailQueueExecutor` | No | Created by the component |
|
|
160
|
+
| `@app/components/mail/verification/code-generator` | `MailKeys.MAIL_VERIFICATION_CODE_GENERATOR` | `IVerificationCodeGenerator` | No | `NumericCodeGenerator` (transient) |
|
|
161
|
+
| `@app/components/mail/verification/token-generator` | `MailKeys.MAIL_VERIFICATION_TOKEN_GENERATOR` | `IVerificationTokenGenerator` | No | `RandomTokenGenerator` (transient) |
|
|
162
|
+
| `@app/components/mail/verification/data-generator` | `MailKeys.MAIL_VERIFICATION_DATA_GENERATOR` | `IVerificationDataGenerator` | No | `DefaultVerificationDataGenerator` (transient) |
|
|
163
|
+
|
|
164
|
+
> [!IMPORTANT]
|
|
165
|
+
> `MailKeys.MAIL_OPTIONS` is the only binding `MailComponent` requires. It throws `Mail options not configured` in `binding()` if the key is not bound. `MailKeys.MAIL_QUEUE_EXECUTOR_CONFIG` is read with `isOptional: true` -- when it is not bound, `createAndBindInstances()` falls back to `{ type: MailQueueExecutorTypes.DIRECT }` rather than failing startup.
|
|
166
|
+
|
|
167
|
+
**Source:** [`common/keys.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/common/keys.ts)
|
|
168
|
+
|
|
169
|
+
## Configuration
|
|
170
|
+
|
|
171
|
+
### Transport options (`TMailOptions`)
|
|
172
|
+
|
|
173
|
+
A discriminated union on `provider`, extending `IBaseMailOptions`:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
interface IBaseMailOptions {
|
|
177
|
+
from?: string;
|
|
178
|
+
fromName?: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface INodemailerMailOptions extends IBaseMailOptions {
|
|
182
|
+
provider: 'nodemailer';
|
|
183
|
+
config: TNodemailerConfig; // SMTPTransport | SMTPTransport.Options | string
|
|
184
|
+
module?: TNodemailerModule; // the peer itself; see "Peer dependency loading"
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
interface IMailgunMailOptions extends IBaseMailOptions {
|
|
188
|
+
provider: 'mailgun';
|
|
189
|
+
config: TMailgunConfig; // AnyType & { domain: string } -- also requires username, key at runtime
|
|
190
|
+
module?: TMailgunModule; // the peer itself; see "Peer dependency loading"
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
interface ICustomMailOptions extends IBaseMailOptions {
|
|
194
|
+
provider: 'custom';
|
|
195
|
+
config: IMailTransport; // Must implement send() and verify()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface IGenericMailOptions extends IBaseMailOptions {
|
|
199
|
+
provider: string;
|
|
200
|
+
config: Record<string, AnyType>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
type TMailOptions =
|
|
204
|
+
| INodemailerMailOptions
|
|
205
|
+
| IMailgunMailOptions
|
|
206
|
+
| ICustomMailOptions
|
|
207
|
+
| IGenericMailOptions;
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Nodemailer (SMTP with basic auth):**
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
{
|
|
214
|
+
provider: MailProviders.NODEMAILER,
|
|
215
|
+
from: 'noreply@example.com',
|
|
216
|
+
fromName: 'Example App',
|
|
217
|
+
config: {
|
|
218
|
+
host: 'smtp.gmail.com',
|
|
219
|
+
port: 465,
|
|
220
|
+
secure: true,
|
|
221
|
+
auth: { user: 'your-email@gmail.com', pass: 'your-app-password' },
|
|
222
|
+
},
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Nodemailer (OAuth2):**
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
{
|
|
230
|
+
provider: MailProviders.NODEMAILER,
|
|
231
|
+
from: applicationEnvironment.get<string>('APP_ENV_MAIL_FROM') ?? 'noreply@example.com',
|
|
232
|
+
fromName: applicationEnvironment.get<string>('APP_ENV_MAIL_FROM_NAME') ?? 'Example App',
|
|
233
|
+
config: {
|
|
234
|
+
host: applicationEnvironment.get<string>('APP_ENV_MAIL_HOST') ?? 'smtp.gmail.com',
|
|
235
|
+
port: +(applicationEnvironment.get<number>('APP_ENV_MAIL_PORT') ?? 465),
|
|
236
|
+
secure: toBoolean(applicationEnvironment.get<boolean>('APP_ENV_MAIL_SECURE') ?? true),
|
|
237
|
+
auth: {
|
|
238
|
+
type: 'oauth2',
|
|
239
|
+
user: applicationEnvironment.get<string>('APP_ENV_MAIL_USER'),
|
|
240
|
+
clientId: applicationEnvironment.get<string>('APP_ENV_MAIL_CLIENT_ID'),
|
|
241
|
+
clientSecret: applicationEnvironment.get<string>('APP_ENV_MAIL_CLIENT_SECRET'),
|
|
242
|
+
refreshToken: applicationEnvironment.get<string>('APP_ENV_MAIL_REFRESH_TOKEN'),
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
`APP_ENV_MAIL_*` is an app-level convention, not a framework-defined env var. `applicationEnvironment.get()` reads whatever variables your wrapper component chooses to look up. A matching `.env`:
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
APP_ENV_MAIL_HOST=smtp.gmail.com
|
|
252
|
+
APP_ENV_MAIL_PORT=465
|
|
253
|
+
APP_ENV_MAIL_SECURE=true
|
|
254
|
+
APP_ENV_MAIL_USER=your-email@gmail.com
|
|
255
|
+
APP_ENV_MAIL_CLIENT_ID=your-oauth2-client-id
|
|
256
|
+
APP_ENV_MAIL_CLIENT_SECRET=your-oauth2-client-secret
|
|
257
|
+
APP_ENV_MAIL_REFRESH_TOKEN=your-oauth2-refresh-token
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
> [!TIP]
|
|
261
|
+
> For Gmail OAuth2, follow [Google's OAuth2 setup guide](https://developers.google.com/gmail/api/auth/web-server) to obtain the client ID, secret, and refresh token.
|
|
262
|
+
|
|
263
|
+
**Mailgun:**
|
|
264
|
+
|
|
265
|
+
```typescript
|
|
266
|
+
{
|
|
267
|
+
provider: MailProviders.MAILGUN,
|
|
268
|
+
from: 'noreply@example.com',
|
|
269
|
+
fromName: 'Example App',
|
|
270
|
+
config: {
|
|
271
|
+
username: 'api', // required -- mailgun.js client username
|
|
272
|
+
key: process.env.MAILGUN_API_KEY, // required -- Mailgun API key
|
|
273
|
+
domain: 'mg.example.com', // required
|
|
274
|
+
host: 'api.eu.mailgun.net', // optional -- EU region
|
|
275
|
+
},
|
|
276
|
+
}
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
> [!IMPORTANT]
|
|
280
|
+
> `MailgunTransportHelper` validates `username`, `key`, and `domain` on construction. It throws `Invalid Mailgun configuration | Missing required keys: <keys>` if any is missing. This check runs even though `TMailgunConfig`'s only *typed* requirement is `domain` - `username` and `key` are checked at runtime, not by the type.
|
|
281
|
+
|
|
282
|
+
**Custom transport:**
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
{
|
|
286
|
+
provider: MailProviders.CUSTOM,
|
|
287
|
+
from: 'noreply@example.com',
|
|
288
|
+
config: myTransportImplementingIMailTransport, // must have send() and verify()
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Generic provider (extensibility escape hatch):**
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
{
|
|
296
|
+
provider: 'sendgrid',
|
|
297
|
+
from: 'noreply@example.com',
|
|
298
|
+
config: { apiKey: process.env.SENDGRID_API_KEY },
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
> [!WARNING]
|
|
303
|
+
> `IGenericMailOptions` falls through to the `default` case in `MailTransportProvider` and throws `Unsupported mail provider: <provider>`. The framework's built-in provider does not handle it. `IGenericMailOptions` exists only so you can bind a **custom** `MailTransportProvider` that recognizes the provider string.
|
|
304
|
+
|
|
305
|
+
### Queue executor options (`IMailQueueExecutorConfig`)
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
interface IMailQueueExecutorConfig {
|
|
309
|
+
type: TConstValue<typeof MailQueueExecutorTypes>; // 'direct' | 'internal-queue' | 'bullmq'
|
|
310
|
+
internalQueue?: {
|
|
311
|
+
identifier: string;
|
|
312
|
+
};
|
|
313
|
+
bullmq?: {
|
|
314
|
+
redis: IRedisSingleHelperOptions;
|
|
315
|
+
queue: { identifier: string; name: string };
|
|
316
|
+
mode: TConstValue<typeof BullMQExecutorModes>; // REQUIRED -- no default
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
// Direct (also the implicit default when MAIL_QUEUE_EXECUTOR_CONFIG is unbound)
|
|
323
|
+
{ type: 'direct' }
|
|
324
|
+
|
|
325
|
+
// Internal queue (in-memory)
|
|
326
|
+
{ type: 'internal-queue', internalQueue: { identifier: 'mail-internal-queue' } }
|
|
327
|
+
|
|
328
|
+
// BullMQ (Redis-backed)
|
|
329
|
+
{
|
|
330
|
+
type: 'bullmq',
|
|
331
|
+
bullmq: {
|
|
332
|
+
redis: { host: 'localhost', port: 6379, password: 'your-redis-password' },
|
|
333
|
+
queue: { identifier: 'mail-queue', name: 'mail-queue' },
|
|
334
|
+
mode: 'both', // 'queue-only' | 'worker-only' | 'both' -- required, no default
|
|
335
|
+
},
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Choosing an executor:**
|
|
340
|
+
|
|
341
|
+
| Executor | Use when | Why |
|
|
342
|
+
|---|---|---|
|
|
343
|
+
| `direct` | Development or low-volume apps | No queueing overhead |
|
|
344
|
+
| `internal-queue` | Single-instance apps, moderate volume | In-memory, with retry |
|
|
345
|
+
| `bullmq` | Distributed or high-volume systems | Redis-backed, configurable concurrency/priority/backoff |
|
|
346
|
+
|
|
347
|
+
**Source:** [`common/types/`](https://github.com/VENIZIA-AI/ignis/tree/main/packages/core-server/src/components/mail/common/types)
|
|
348
|
+
|
|
349
|
+
### Constants
|
|
350
|
+
|
|
351
|
+
| Constant | Value | Description |
|
|
352
|
+
|----------|-------|-------------|
|
|
353
|
+
| `MailDefaults.BATCH_CONCURRENCY` | `5` | Default concurrent sends in `sendBatch()` |
|
|
354
|
+
| `MailDefaults.FALLBACK_FROM` | `'noreply@example.com'` | Used by `getDefaultFrom()` when `options.from` is unset |
|
|
355
|
+
| `MailExecutorErrors.PROCESSOR_NOT_SET` | `'Processor not set. Call setProcessor() first.'` | Thrown by all three queue executors |
|
|
356
|
+
| `MailQueueExecutorTypes.DIRECT` | `'direct'` | Immediate execution |
|
|
357
|
+
| `MailQueueExecutorTypes.INTERNAL_QUEUE` | `'internal-queue'` | In-memory queue |
|
|
358
|
+
| `MailQueueExecutorTypes.BULLMQ` | `'bullmq'` | Redis-backed queue |
|
|
359
|
+
| `BullMQExecutorModes.QUEUE_ONLY` | `'queue-only'` | Producer only (enqueue) |
|
|
360
|
+
| `BullMQExecutorModes.WORKER_ONLY` | `'worker-only'` | Consumer only (process) |
|
|
361
|
+
| `BullMQExecutorModes.BOTH` | `'both'` | Full duplex (produce + consume) |
|
|
362
|
+
|
|
363
|
+
`MailQueueExecutorTypes` and `BullMQExecutorModes` both carry a `SCHEME_SET`/`MODE_SET` and a static `isValid()`:
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
MailQueueExecutorTypes.isValid('bullmq'); // true
|
|
367
|
+
MailQueueExecutorTypes.isValid('unknown'); // false
|
|
368
|
+
BullMQExecutorModes.isValid('both'); // true
|
|
369
|
+
BullMQExecutorModes.isValid('invalid'); // false
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
#### `MailErrorCodes`
|
|
373
|
+
|
|
374
|
+
Built through `MessageCode.build()`, so every value is lower-case (`ApplicationError` lower-cases whatever it is handed):
|
|
375
|
+
|
|
376
|
+
| Constant | Value | Description |
|
|
377
|
+
|----------|-------|-------------|
|
|
378
|
+
| `MailErrorCodes.INVALID_CONFIGURATION` | `'core.mail.invalid_configuration'` | Invalid or missing configuration (transport, template engine, subject, body) |
|
|
379
|
+
| `MailErrorCodes.SEND_FAILED` | `'core.mail.send_failed'` | Single email send failed |
|
|
380
|
+
| `MailErrorCodes.VERIFICATION_FAILED` | `'core.mail.verification_failed'` | Transport connection verification failed |
|
|
381
|
+
| `MailErrorCodes.INVALID_RECIPIENT` | `'core.mail.invalid_recipient'` | Missing or empty recipient address |
|
|
382
|
+
| `MailErrorCodes.BATCH_SEND_FAILED` | `'core.mail.batch_send_failed'` | Batch email operation failed |
|
|
383
|
+
| `MailErrorCodes.TEMPLATE_NOT_FOUND` | `'core.mail.template_not_found'` | Template name not found in registry |
|
|
384
|
+
|
|
385
|
+
**Source:** [`common/constants.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/common/constants.ts)
|
|
386
|
+
|
|
387
|
+
## `IMailService` interface
|
|
388
|
+
|
|
389
|
+
```typescript
|
|
390
|
+
interface IMailService {
|
|
391
|
+
send(message: IMailMessage): Promise<IMailSendResult>;
|
|
392
|
+
|
|
393
|
+
sendBatch(
|
|
394
|
+
messages: IMailMessage[],
|
|
395
|
+
options?: { concurrency?: number },
|
|
396
|
+
): Promise<IMailSendResult[]>;
|
|
397
|
+
|
|
398
|
+
sendTemplate(opts: {
|
|
399
|
+
templateName: string;
|
|
400
|
+
data: Record<string, any>;
|
|
401
|
+
recipients: string | string[];
|
|
402
|
+
options?: Partial<IMailMessage>;
|
|
403
|
+
}): Promise<IMailSendResult>;
|
|
404
|
+
|
|
405
|
+
verify(): Promise<boolean>;
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
**`send(message)`**
|
|
410
|
+
|
|
411
|
+
1. `validateMessage()` throws for missing `to`, missing `subject`, or missing both `text`/`html` (400, see below).
|
|
412
|
+
2. Merges `message.from` with `getDefaultFrom()` if unset.
|
|
413
|
+
3. Delegates to `transport.send()`.
|
|
414
|
+
4. Returns `{ success, messageId, error? }`.
|
|
415
|
+
5. If the transport throws, and the error is **not** already an `ApplicationError`, it is caught and re-thrown as `MailErrorCodes.SEND_FAILED` (500).
|
|
416
|
+
6. An `ApplicationError` thrown earlier in the same `try` block - for example, from `validateMessage()` - is re-thrown as-is, unchanged.
|
|
417
|
+
|
|
418
|
+
**`sendBatch(messages, options?)`**
|
|
419
|
+
|
|
420
|
+
Sends every message via `send()` with concurrency bounded by `executePromiseWithLimit()`, default `MailDefaults.BATCH_CONCURRENCY` (`5`). A `send()` that throws is caught per-message and downgraded to `{ success: false, error }`; a failure in the batch operation itself throws `MailErrorCodes.BATCH_SEND_FAILED`.
|
|
421
|
+
|
|
422
|
+
**`sendTemplate(opts)`**
|
|
423
|
+
|
|
424
|
+
Renders a registered template and sends it. Subject resolution order: `options.subject` -> the template's own `subject` (rendered through the same engine) -> `'No Subject'`. Throws `MailErrorCodes.INVALID_CONFIGURATION` ("Template engine not configured") if `templateEngine` was not injected. Re-throws any other error unchanged, including `TEMPLATE_NOT_FOUND` from the template engine.
|
|
425
|
+
|
|
426
|
+
**`verify()`**
|
|
427
|
+
|
|
428
|
+
Delegates to `transport.verify()`. If the transport throws, wraps it as `MailErrorCodes.VERIFICATION_FAILED` (500).
|
|
429
|
+
|
|
430
|
+
### Protected methods (`MailService`)
|
|
431
|
+
|
|
432
|
+
**`validateMessage(message)`**
|
|
433
|
+
|
|
434
|
+
| Check | Error code | Status | Message |
|
|
435
|
+
|-------|-----------|--------|---------|
|
|
436
|
+
| `to` is falsy or an empty array | `INVALID_RECIPIENT` | 400 | `Recipient email address is required` |
|
|
437
|
+
| `subject` is falsy | `INVALID_CONFIGURATION` | 400 | `Email subject is required` |
|
|
438
|
+
| Both `text` and `html` are falsy | `INVALID_CONFIGURATION` | 400 | `Email must have either text or html content` |
|
|
439
|
+
|
|
440
|
+
**`getDefaultFrom()`**
|
|
441
|
+
|
|
442
|
+
- If `options.from` is unset, returns `MailDefaults.FALLBACK_FROM` (`'noreply@example.com'`).
|
|
443
|
+
- Else if `options.fromName` is unset, returns `options.from` as-is.
|
|
444
|
+
- Else returns `"${fromName}" <${from}>`.
|
|
445
|
+
|
|
446
|
+
**Source:** [`services/mail.service.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/services/mail.service.ts)
|
|
447
|
+
|
|
448
|
+
## `IMailMessage` interface
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
interface IMailMessage {
|
|
452
|
+
from?: string; // Uses getDefaultFrom() if not provided
|
|
453
|
+
to: string | string[];
|
|
454
|
+
cc?: string | string[];
|
|
455
|
+
bcc?: string | string[];
|
|
456
|
+
replyTo?: string;
|
|
457
|
+
subject: string;
|
|
458
|
+
text?: string;
|
|
459
|
+
html?: string;
|
|
460
|
+
attachments?: IMailAttachment[];
|
|
461
|
+
headers?: Record<string, string>;
|
|
462
|
+
requireValidate?: boolean; // Passed through to sendTemplate()'s render() call
|
|
463
|
+
[key: string]: any; // Open-ended -- provider-specific fields pass through
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
| Field | Notes |
|
|
468
|
+
|-------|-------|
|
|
469
|
+
| `from` | Falls back to `getDefaultFrom()`. Can be overridden per message (multi-tenant scenarios). |
|
|
470
|
+
| `to`, `cc`, `bcc` | Single string or array. Nodemailer joins arrays with `', '`; Mailgun passes `to` as-is (always coerced to an array), `cc`/`bcc` pass through unmodified. |
|
|
471
|
+
| `replyTo` | Nodemailer passes it directly; Mailgun maps it to `h:Reply-To`. |
|
|
472
|
+
| `subject` | Rendered through the template engine when set via `sendTemplate()`. |
|
|
473
|
+
| `text`, `html` | At least one is required (`validateMessage()`). |
|
|
474
|
+
| `attachments` | See `IMailAttachment` below. |
|
|
475
|
+
| `headers` | Nodemailer passes them directly; Mailgun prefixes every key with `h:`. |
|
|
476
|
+
| `requireValidate` | `true` makes template rendering throw on missing placeholders instead of preserving them as literal text. Defaults to `false`. |
|
|
477
|
+
|
|
478
|
+
```typescript
|
|
479
|
+
interface IMailAttachment {
|
|
480
|
+
filename?: string;
|
|
481
|
+
contentType?: string;
|
|
482
|
+
path?: string;
|
|
483
|
+
content?: string | Buffer | Readable;
|
|
484
|
+
cid?: string;
|
|
485
|
+
[key: string]: any;
|
|
486
|
+
}
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
- File path: `{ filename: 'doc.pdf', path: '/path/to/doc.pdf' }`
|
|
490
|
+
- Buffer: `{ filename: 'data.txt', content: Buffer.from('...') }`
|
|
491
|
+
- Inline image: `{ filename: 'logo.png', path: '...', cid: 'logo' }`
|
|
492
|
+
- Mailgun maps each attachment to `{ filename, data: att.path ?? att.content ?? Buffer.from('') }`.
|
|
493
|
+
|
|
494
|
+
**Source:** [`common/types/`](https://github.com/VENIZIA-AI/ignis/tree/main/packages/core-server/src/components/mail/common/types)
|
|
495
|
+
|
|
496
|
+
## `IMailTemplateEngine` interface
|
|
497
|
+
|
|
498
|
+
```typescript
|
|
499
|
+
interface IMailTemplateEngine {
|
|
500
|
+
render(opts: {
|
|
501
|
+
templateData?: string;
|
|
502
|
+
templateName?: string;
|
|
503
|
+
data: Record<string, any>;
|
|
504
|
+
requireValidate?: boolean;
|
|
505
|
+
}): string;
|
|
506
|
+
|
|
507
|
+
registerTemplate(opts: { name: string; content: string }): void;
|
|
508
|
+
|
|
509
|
+
validateTemplateData(opts: { template: string; data: Record<string, any> }): {
|
|
510
|
+
isValid: boolean;
|
|
511
|
+
missingKeys: string[];
|
|
512
|
+
allKeys: string[];
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
getTemplate(name: string): ITemplate | undefined;
|
|
516
|
+
listTemplates(): ITemplate[];
|
|
517
|
+
hasTemplate(name: string): boolean;
|
|
518
|
+
removeTemplate(name: string): boolean;
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
`TemplateEngineService` also exposes `clearTemplates(): void`. It resets the registry, but it is **not** part of the `IMailTemplateEngine` interface - you can only reach it when you hold the concrete class, not the interface type.
|
|
523
|
+
|
|
524
|
+
| Method | Behavior |
|
|
525
|
+
|--------|----------|
|
|
526
|
+
| `render(opts)` | Renders by `templateName` (registry lookup) or raw `templateData`. Throws if neither is given. Throws `TEMPLATE_NOT_FOUND` (404) if `templateName` is not registered. Delegates to `renderSimpleTemplate()`. |
|
|
527
|
+
| `registerTemplate(opts)` | `options` (on the class) accepts `subject`/`description` (`Partial<ITemplate>`). Overwrites an existing template with the same name. |
|
|
528
|
+
| `validateTemplateData(opts)` | Extracts every unique <code v-pre>{{key}}</code> via `/\{\{(\s*[\w.]+\s*)\}\}/g`, deduplicates, resolves nested dot-notation values. Returns `isValid`, `missingKeys`, `allKeys`. |
|
|
529
|
+
| `getTemplate(name)` | Returns `undefined` if not registered. |
|
|
530
|
+
| `listTemplates()` | All templates, as an array of `ITemplate`. |
|
|
531
|
+
| `hasTemplate(name)` | Registry membership check. |
|
|
532
|
+
| `removeTemplate(name)` | Logs the removal, returns `true`/`false`. |
|
|
533
|
+
|
|
534
|
+
```typescript
|
|
535
|
+
interface ITemplate {
|
|
536
|
+
name: string;
|
|
537
|
+
content?: string;
|
|
538
|
+
render?: (data: Record<string, AnyType>) => string;
|
|
539
|
+
subject?: string;
|
|
540
|
+
description?: string;
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
The `render` field supports a custom per-template render function, though the built-in `TemplateEngineService` always uses `content` + `renderSimpleTemplate()` instead.
|
|
545
|
+
|
|
546
|
+
**Source:** [`services/template.service.ts`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/services/template.service.ts)
|
|
547
|
+
|
|
548
|
+
## Transport layer
|
|
549
|
+
|
|
550
|
+
`MailTransportProvider.value()` returns a factory function that switches on `TMailOptions.provider`:
|
|
551
|
+
|
|
552
|
+
| Provider | Result |
|
|
553
|
+
|----------|--------|
|
|
554
|
+
| `'nodemailer'` | `NodemailerTransportHelper`, backed by `nodemailer` |
|
|
555
|
+
| `'mailgun'` | `MailgunTransportHelper`, backed by the Mailgun HTTP API (`mailgun.js`) |
|
|
556
|
+
| `'custom'` | The `config` value itself, validated to implement `IMailTransport` |
|
|
557
|
+
| Any other string | Throws `Unsupported mail provider: <provider>` (`INVALID_CONFIGURATION`, 500) |
|
|
558
|
+
|
|
559
|
+
Type narrowing uses three private guards, each checking `provider === X && 'config' in options`:
|
|
560
|
+
|
|
561
|
+
```typescript
|
|
562
|
+
private isNodemailerOptions(options: TMailOptions): options is INodemailerMailOptions
|
|
563
|
+
private isMailgunOptions(options: TMailOptions): options is IMailgunMailOptions
|
|
564
|
+
private isCustomOptions(options: TMailOptions): options is ICustomMailOptions
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
For `custom`, an additional `isMailTransport()` utility check reports specifically which of `send`/`verify` is missing.
|
|
568
|
+
|
|
569
|
+
```typescript
|
|
570
|
+
interface IMailTransport {
|
|
571
|
+
send(message: IMailMessage): Promise<IMailSendResult>;
|
|
572
|
+
verify(): Promise<boolean>;
|
|
573
|
+
close?(): Promise<void>;
|
|
574
|
+
}
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Peer dependency loading
|
|
578
|
+
|
|
579
|
+
Pass the peer yourself through `module`, or let the transport find it. With `module` set, the transport uses it as-is; without it, the transport falls back to `ModuleUtility.loadSync({ module })` from the client-factory seam `configure()` calls. A missing package then throws the framework's install hint - `[ModuleUtility.loadSync] nodemailer is required. Please install 'nodemailer'` - not Node's raw `Cannot find module`.
|
|
580
|
+
|
|
581
|
+
That fallback keeps the specifier invisible to `Bun.build`. Importing `@venizia/ignis/mail` for the Nodemailer transport no longer drags `mailgun.js` into your bundle, and the reverse holds too.
|
|
582
|
+
|
|
583
|
+
**A compiled application must pass `module`.** A `bun build --compile` binary ships without `node_modules`, so the runtime lookup has nothing to resolve against and the component throws that install hint at boot - with the peer sitting in `package.json`, which is no help because nothing put it inside the binary. The static import is what embeds it:
|
|
584
|
+
|
|
585
|
+
```typescript
|
|
586
|
+
import * as nodemailer from 'nodemailer';
|
|
587
|
+
|
|
588
|
+
this.bind({ key: MailKeys.MAIL_OPTIONS }).toValue({
|
|
589
|
+
provider: MailProviders.NODEMAILER,
|
|
590
|
+
config: { host, port, secure, auth },
|
|
591
|
+
module: nodemailer,
|
|
592
|
+
});
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
`module` is typed as the shape the transport calls (`createTransport` for Nodemailer, a constructor for Mailgun), so handing over the wrong thing is a compile error rather than a boot crash. Prefer it over [`ModuleUtility.register`](/references/utilities/module#compiled-binaries): the dependency arrives where it is used and cannot be defeated by binding order. Every IGNIS component that reaches an optional peer now takes one of these options - the [table in the module reference](/references/utilities/module#compiled-binaries) lists them.
|
|
596
|
+
|
|
597
|
+
**Nodemailer (`NodemailerTransportHelper`, extends `BaseHelper`):**
|
|
598
|
+
|
|
599
|
+
- `configure()` builds the transporter via `nodemailer.createTransport(config)`.
|
|
600
|
+
- `send()` maps `IMailMessage` fields to Nodemailer's mail options, joining array recipients with `', '`. It catches transport errors and returns `{ success: false, error }` - it never throws.
|
|
601
|
+
- `verify()` delegates to `transporter.verify()` (SMTP handshake). It catches errors and returns `false` - it never throws.
|
|
602
|
+
- `close()` calls `transporter.close()`.
|
|
603
|
+
|
|
604
|
+
**Mailgun (`MailgunTransportHelper`, extends `BaseHelper`):**
|
|
605
|
+
|
|
606
|
+
- `configure()` calls `validateConfig()` **before** building the client. `username`, `key`, and `domain` must all be present in `config`, or it throws `Invalid Mailgun configuration | Missing required keys: <keys>` (`INVALID_CONFIGURATION`, 500). This check runs even though `TMailgunConfig`'s type only requires `domain`.
|
|
607
|
+
- `send()` converts `IMailMessage` to Mailgun's format: `to` is coerced to an array, `replyTo` becomes `h:Reply-To`, and every custom header is prefixed `h:`. Attachments map to `{ filename, data: path ?? content ?? Buffer.from('') }`.
|
|
608
|
+
- It catches send errors and returns `{ success: false, error }` - it never throws.
|
|
609
|
+
- `verify()` sends a test message to `verify@<domain>` with `o:testmode: 'yes'`, since Mailgun has no dedicated verify endpoint. It catches errors and returns `false` - it never throws.
|
|
610
|
+
- No `close()` - the HTTP API is stateless.
|
|
611
|
+
|
|
612
|
+
**Custom transport:** set `provider: MailProviders.CUSTOM` and pass an object implementing `IMailTransport` as `config`. Useful for SendGrid, AWS SES, or a custom SMTP relay that the framework does not ship a helper for.
|
|
613
|
+
|
|
614
|
+
**Source:** [`helpers/transporters/`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/helpers/transporters)
|
|
615
|
+
|
|
616
|
+
## Queue executor implementations
|
|
617
|
+
|
|
618
|
+
All three implement:
|
|
619
|
+
|
|
620
|
+
```typescript
|
|
621
|
+
interface IMailQueueExecutor {
|
|
622
|
+
enqueueVerificationEmail(email: string, options?: IMailQueueOptions): Promise<IMailQueueResult>;
|
|
623
|
+
setProcessor(processor: (email: string) => Promise<IMailProcessorResult>): void;
|
|
624
|
+
}
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
**`DirectMailExecutorHelper`** extends `BaseHelper`. It calls the processor immediately, with no queue, and returns `{ queued: false, message: 'Email sent immediately (no queue)', result }`. If `enqueueVerificationEmail()` runs before `setProcessor()`, it throws `MailExecutorErrors.PROCESSOR_NOT_SET`.
|
|
628
|
+
|
|
629
|
+
**`InternalQueueMailExecutorHelper`** extends `BaseHelper` (constructor takes `IInternalQueueMailExecutorOpts`). It wraps `SequentialQueueHelper<IQueueJobPayload>` from `@venizia/ignis-helpers`, with `autoDispatch: true`.
|
|
630
|
+
|
|
631
|
+
- Job IDs: `job_<counter>_<timestamp>`.
|
|
632
|
+
- `options.delay > 0` schedules the enqueue itself via `setTimeout`, tracked in an internal `delayedJobs: Map<string, NodeJS.Timeout>`.
|
|
633
|
+
- Retry: on a thrown error, or `{ success: false }` from the processor, it retries up to `options.attempts ?? 3` times using `calculateBackoff()`:
|
|
634
|
+
|
|
635
|
+
| `backoff` config | Delay |
|
|
636
|
+
|---|---|
|
|
637
|
+
| Not set | `1000ms` fixed |
|
|
638
|
+
| `type: 'fixed'` | the raw `delay` |
|
|
639
|
+
| `type: 'exponential'` | `delay * 2 ** (attempt - 1)` |
|
|
640
|
+
|
|
641
|
+
- `close()` clears every pending delayed/retry `setTimeout`. Without that cleanup, a live timer keeps the event loop open past shutdown.
|
|
642
|
+
- No persistence across restarts.
|
|
643
|
+
|
|
644
|
+
**`BullMQMailExecutorHelper`** extends `BaseHelper` (constructor takes `IBullMQMailExecutorOpts`). It wraps `BullMQHelper` (`@venizia/ignis-helpers/bullmq`) and a `RedisSingleHelper` connection.
|
|
645
|
+
|
|
646
|
+
| Mode | Queue created | Workers created | Can enqueue | Can process |
|
|
647
|
+
|------|----------------|------------------|-------------|-------------|
|
|
648
|
+
| `'queue-only'` | Yes | No (`setProcessor()` skips worker creation, logs a warning) | Yes - processor not required | No |
|
|
649
|
+
| `'worker-only'` | No | Yes | No (throws) | Yes |
|
|
650
|
+
| `'both'` | Yes | Yes | Yes - processor required | Yes |
|
|
651
|
+
|
|
652
|
+
`setProcessor(processor, opts?)` is `async`. It clears all existing workers, then creates `opts?.numberOfWorkers ?? 1` workers, each with `concurrencyPerWorker ?? 5` and `lockDuration ?? 30000`ms. In `queue-only` mode it stores the processor and returns without creating any worker.
|
|
653
|
+
|
|
654
|
+
`enqueueVerificationEmail()` throws in three cases:
|
|
655
|
+
|
|
656
|
+
| Condition | Throws |
|
|
657
|
+
|---|---|
|
|
658
|
+
| Mode is `worker-only` | `Cannot enqueue jobs in worker-only mode...` |
|
|
659
|
+
| Queue was never created (should not happen in a queue-enabled mode) | `Queue helper not initialized...` |
|
|
660
|
+
| No processor set, and `mode !== 'queue-only'` | `PROCESSOR_NOT_SET` |
|
|
661
|
+
|
|
662
|
+
Its enqueue options: `attempts: options?.attempts ?? 3`, `backoff: { type: options?.backoff?.type ?? 'exponential', delay: options?.backoff?.delay ?? 1000 }`, `removeOnComplete: true`, `removeOnFail: false`.
|
|
663
|
+
|
|
664
|
+
**Dynamic workers** - manage the worker pool without a restart:
|
|
665
|
+
|
|
666
|
+
| Method | Behavior |
|
|
667
|
+
|---|---|
|
|
668
|
+
| `addWorker(opts)` | Requires a processor set first. Takes a unique identifier, default concurrency `5`, default lock duration `30000`ms |
|
|
669
|
+
| `removeWorker(index)` | Closes the worker, then splices it out. Returns `false` if `index` is out of range |
|
|
670
|
+
| `clearWorkers()` | Closes and empties every worker. Called internally by `setProcessor()` |
|
|
671
|
+
| `getWorkerCount()` | Returns the current worker count |
|
|
672
|
+
| `getMode()` | Returns the executor's `BullMQExecutorModes` value |
|
|
673
|
+
|
|
674
|
+
`close()` tears down workers, then the queue, then the Redis connection. Every step runs even if an earlier one failed, and every failure is collected into one thrown error at the end.
|
|
675
|
+
|
|
676
|
+
```typescript
|
|
677
|
+
interface IBullMQMailExecutorOpts {
|
|
678
|
+
redis: IRedisSingleHelperOptions; // from @venizia/ignis-helpers
|
|
679
|
+
queue: { identifier: string; name: string };
|
|
680
|
+
mode: TConstValue<typeof BullMQExecutorModes>; // REQUIRED, no default
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
**Source:** [`helpers/executors/`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/helpers/executors)
|
|
685
|
+
|
|
686
|
+
## Additional interfaces
|
|
687
|
+
|
|
688
|
+
```typescript
|
|
689
|
+
interface IMailSendResult {
|
|
690
|
+
success: boolean;
|
|
691
|
+
messageId?: string;
|
|
692
|
+
response?: any;
|
|
693
|
+
error?: string;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
interface IMailQueueOptions {
|
|
697
|
+
priority?: number;
|
|
698
|
+
delay?: number;
|
|
699
|
+
attempts?: number;
|
|
700
|
+
backoff?: { type: 'fixed' | 'exponential'; delay: number };
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
interface IMailQueueResult {
|
|
704
|
+
jobId?: string;
|
|
705
|
+
queued: boolean; // false for direct execution, true for internal-queue and bullmq
|
|
706
|
+
message: string;
|
|
707
|
+
result?: IMailProcessorResult; // populated only for direct execution (synchronous processor)
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
interface IMailProcessorResult {
|
|
711
|
+
success: boolean;
|
|
712
|
+
message: string;
|
|
713
|
+
expiresInMinutes: number;
|
|
714
|
+
nextResendAt?: string;
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
interface IVerificationData {
|
|
718
|
+
verificationCode: string;
|
|
719
|
+
codeGeneratedAt: string;
|
|
720
|
+
codeExpiresAt: string;
|
|
721
|
+
codeAttempts: number;
|
|
722
|
+
verificationToken: string;
|
|
723
|
+
tokenGeneratedAt: string;
|
|
724
|
+
tokenExpiresAt: string;
|
|
725
|
+
lastCodeSentAt: string;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
interface IVerificationGenerationOptions {
|
|
729
|
+
codeLength: number; // all four fields required, no defaults
|
|
730
|
+
tokenBytes: number;
|
|
731
|
+
codeExpiryMinutes: number;
|
|
732
|
+
tokenExpiryHours: number;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
interface IQueueJobPayload {
|
|
736
|
+
id: string;
|
|
737
|
+
email: string;
|
|
738
|
+
options?: IMailQueueOptions;
|
|
739
|
+
attempts: number;
|
|
740
|
+
scheduledAt: number;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
interface IInternalQueueMailExecutorOpts {
|
|
744
|
+
identifier: string;
|
|
745
|
+
}
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
**Source:** [`common/types/`](https://github.com/VENIZIA-AI/ignis/tree/main/packages/core-server/src/components/mail/common/types)
|
|
749
|
+
|
|
750
|
+
## Utility functions
|
|
751
|
+
|
|
752
|
+
```typescript
|
|
753
|
+
// type.utility.ts
|
|
754
|
+
function isMailTransport(value: AnyType): value is IMailTransport;
|
|
755
|
+
function isValidMailOptions(options: AnyType): options is TMailOptions;
|
|
756
|
+
|
|
757
|
+
// verification.utility.ts
|
|
758
|
+
function getExpiryTime(minutes: number): Date; // Date `minutes` minutes from now
|
|
759
|
+
function getExpiryTimeInHours(hours: number): Date; // Date `hours` hours from now
|
|
760
|
+
```
|
|
761
|
+
|
|
762
|
+
- `isMailTransport()` checks that `send` and `verify` are functions, and that `close` is either a function or `undefined`.
|
|
763
|
+
- `isValidMailOptions()` checks that `provider` is a string and `config` is truthy. It does not validate the shape of `config` against the specific provider.
|
|
764
|
+
|
|
765
|
+
**Source:** [`utilities/`](https://github.com/VENIZIA-AI/ignis/blob/main/packages/core-server/src/components/mail/utilities)
|
|
766
|
+
|
|
767
|
+
## See also
|
|
768
|
+
|
|
769
|
+
- [Overview](./) -- quick start, imports, common configuration tasks
|
|
770
|
+
- [Usage & Examples](./usage) -- sending emails, templates, queue executors, verification generators
|
|
771
|
+
- [Error Reference](./errors) -- error codes and troubleshooting
|
|
772
|
+
- [Queue Helper](/extensions/helpers/queue/) -- `SequentialQueueHelper` and `BullMQHelper`
|
|
773
|
+
- [Redis Helper](/extensions/helpers/redis/) -- `RedisSingleHelper`, `IRedisSingleHelperOptions`
|