@endora-commerce/platform 0.100.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/cli/dispatch.d.ts +146 -0
- package/dist/cli/dispatch.d.ts.map +1 -0
- package/dist/cli/dispatch.js +259 -0
- package/dist/cli/dispatch.js.map +1 -0
- package/dist/cli/index.d.ts +58 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +58 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/module-commands.d.ts +118 -0
- package/dist/cli/module-commands.d.ts.map +1 -0
- package/dist/cli/module-commands.js +120 -0
- package/dist/cli/module-commands.js.map +1 -0
- package/dist/commands/actor.d.ts +19 -0
- package/dist/commands/actor.d.ts.map +1 -0
- package/dist/commands/actor.js +45 -0
- package/dist/commands/actor.js.map +1 -0
- package/dist/commands/audit-from-context.d.ts +24 -0
- package/dist/commands/audit-from-context.d.ts.map +1 -0
- package/dist/commands/audit-from-context.js +28 -0
- package/dist/commands/audit-from-context.js.map +1 -0
- package/dist/commands/command-bus.d.ts +40 -0
- package/dist/commands/command-bus.d.ts.map +1 -0
- package/dist/commands/command-bus.js +46 -0
- package/dist/commands/command-bus.js.map +1 -0
- package/dist/commands/command.d.ts +76 -0
- package/dist/commands/command.d.ts.map +1 -0
- package/dist/commands/command.js +2 -0
- package/dist/commands/command.js.map +1 -0
- package/dist/commands/index.d.ts +65 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +57 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/reversible.d.ts +66 -0
- package/dist/commands/reversible.d.ts.map +1 -0
- package/dist/commands/reversible.js +41 -0
- package/dist/commands/reversible.js.map +1 -0
- package/dist/composition/compose-app.d.ts +305 -0
- package/dist/composition/compose-app.d.ts.map +1 -0
- package/dist/composition/compose-app.js +939 -0
- package/dist/composition/compose-app.js.map +1 -0
- package/dist/composition/index.d.ts +92 -0
- package/dist/composition/index.d.ts.map +1 -0
- package/dist/composition/index.js +175 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/composition/newsletter-token-secret.d.ts +19 -0
- package/dist/composition/newsletter-token-secret.d.ts.map +1 -0
- package/dist/composition/newsletter-token-secret.js +24 -0
- package/dist/composition/newsletter-token-secret.js.map +1 -0
- package/dist/composition/process-runs-workers.d.ts +17 -0
- package/dist/composition/process-runs-workers.d.ts.map +1 -0
- package/dist/composition/process-runs-workers.js +19 -0
- package/dist/composition/process-runs-workers.js.map +1 -0
- package/dist/db/baseline-migration-inventory.d.ts +15 -0
- package/dist/db/baseline-migration-inventory.d.ts.map +1 -0
- package/dist/db/baseline-migration-inventory.js +115 -0
- package/dist/db/baseline-migration-inventory.js.map +1 -0
- package/dist/db/configured-entities.d.ts +74 -0
- package/dist/db/configured-entities.d.ts.map +1 -0
- package/dist/db/configured-entities.js +20 -0
- package/dist/db/configured-entities.js.map +1 -0
- package/dist/db/configured-migrations.d.ts +199 -0
- package/dist/db/configured-migrations.d.ts.map +1 -0
- package/dist/db/configured-migrations.js +181 -0
- package/dist/db/configured-migrations.js.map +1 -0
- package/dist/db/index.d.ts +54 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +54 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrate.d.ts +21 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +48 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/migration-order.d.ts +159 -0
- package/dist/db/migration-order.d.ts.map +1 -0
- package/dist/db/migration-order.js +273 -0
- package/dist/db/migration-order.js.map +1 -0
- package/dist/db/mikro-orm.config.d.ts +51 -0
- package/dist/db/mikro-orm.config.d.ts.map +1 -0
- package/dist/db/mikro-orm.config.js +64 -0
- package/dist/db/mikro-orm.config.js.map +1 -0
- package/dist/db/orm.d.ts +40 -0
- package/dist/db/orm.d.ts.map +1 -0
- package/dist/db/orm.js +25 -0
- package/dist/db/orm.js.map +1 -0
- package/dist/db/platform-schema.d.ts +102 -0
- package/dist/db/platform-schema.d.ts.map +1 -0
- package/dist/db/platform-schema.js +79 -0
- package/dist/db/platform-schema.js.map +1 -0
- package/dist/db/pluralizing-naming-strategy.d.ts +16 -0
- package/dist/db/pluralizing-naming-strategy.d.ts.map +1 -0
- package/dist/db/pluralizing-naming-strategy.js +66 -0
- package/dist/db/pluralizing-naming-strategy.js.map +1 -0
- package/dist/demo/guard.d.ts +101 -0
- package/dist/demo/guard.d.ts.map +1 -0
- package/dist/demo/guard.js +168 -0
- package/dist/demo/guard.js.map +1 -0
- package/dist/demo/host-command.d.ts +133 -0
- package/dist/demo/host-command.d.ts.map +1 -0
- package/dist/demo/host-command.js +113 -0
- package/dist/demo/host-command.js.map +1 -0
- package/dist/demo/index.d.ts +82 -0
- package/dist/demo/index.d.ts.map +1 -0
- package/dist/demo/index.js +82 -0
- package/dist/demo/index.js.map +1 -0
- package/dist/demo/packages.d.ts +67 -0
- package/dist/demo/packages.d.ts.map +1 -0
- package/dist/demo/packages.js +132 -0
- package/dist/demo/packages.js.map +1 -0
- package/dist/demo/plan.d.ts +111 -0
- package/dist/demo/plan.d.ts.map +1 -0
- package/dist/demo/plan.js +74 -0
- package/dist/demo/plan.js.map +1 -0
- package/dist/demo/report.d.ts +17 -0
- package/dist/demo/report.d.ts.map +1 -0
- package/dist/demo/report.js +85 -0
- package/dist/demo/report.js.map +1 -0
- package/dist/demo/runner.d.ts +207 -0
- package/dist/demo/runner.d.ts.map +1 -0
- package/dist/demo/runner.js +169 -0
- package/dist/demo/runner.js.map +1 -0
- package/dist/demo/scope.d.ts +44 -0
- package/dist/demo/scope.d.ts.map +1 -0
- package/dist/demo/scope.js +44 -0
- package/dist/demo/scope.js.map +1 -0
- package/dist/env/index.d.ts +68 -0
- package/dist/env/index.d.ts.map +1 -0
- package/dist/env/index.js +427 -0
- package/dist/env/index.js.map +1 -0
- package/dist/events/bus.d.ts +29 -0
- package/dist/events/bus.d.ts.map +1 -0
- package/dist/events/bus.js +67 -0
- package/dist/events/bus.js.map +1 -0
- package/dist/events/index.d.ts +19 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +19 -0
- package/dist/events/index.js.map +1 -0
- package/dist/http/cursor.d.ts +10 -0
- package/dist/http/cursor.d.ts.map +1 -0
- package/dist/http/cursor.js +20 -0
- package/dist/http/cursor.js.map +1 -0
- package/dist/http/error-envelope.d.ts +127 -0
- package/dist/http/error-envelope.d.ts.map +1 -0
- package/dist/http/error-envelope.js +402 -0
- package/dist/http/error-envelope.js.map +1 -0
- package/dist/http/health.d.ts +88 -0
- package/dist/http/health.d.ts.map +1 -0
- package/dist/http/health.js +77 -0
- package/dist/http/health.js.map +1 -0
- package/dist/http/index.d.ts +50 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +50 -0
- package/dist/http/index.js.map +1 -0
- package/dist/http/interceptors/dispatch.d.ts +14 -0
- package/dist/http/interceptors/dispatch.d.ts.map +1 -0
- package/dist/http/interceptors/dispatch.js +113 -0
- package/dist/http/interceptors/dispatch.js.map +1 -0
- package/dist/http/interceptors/index.d.ts +6 -0
- package/dist/http/interceptors/index.d.ts.map +1 -0
- package/dist/http/interceptors/index.js +5 -0
- package/dist/http/interceptors/index.js.map +1 -0
- package/dist/http/interceptors/registry.d.ts +44 -0
- package/dist/http/interceptors/registry.d.ts.map +1 -0
- package/dist/http/interceptors/registry.js +123 -0
- package/dist/http/interceptors/registry.js.map +1 -0
- package/dist/http/interceptors/route-table.d.ts +33 -0
- package/dist/http/interceptors/route-table.d.ts.map +1 -0
- package/dist/http/interceptors/route-table.js +39 -0
- package/dist/http/interceptors/route-table.js.map +1 -0
- package/dist/http/interceptors/types.d.ts +101 -0
- package/dist/http/interceptors/types.d.ts.map +1 -0
- package/dist/http/interceptors/types.js +2 -0
- package/dist/http/interceptors/types.js.map +1 -0
- package/dist/http/interceptors/validation.d.ts +22 -0
- package/dist/http/interceptors/validation.d.ts.map +1 -0
- package/dist/http/interceptors/validation.js +39 -0
- package/dist/http/interceptors/validation.js.map +1 -0
- package/dist/http/logger.d.ts +9 -0
- package/dist/http/logger.d.ts.map +1 -0
- package/dist/http/logger.js +25 -0
- package/dist/http/logger.js.map +1 -0
- package/dist/http/openapi.d.ts +21 -0
- package/dist/http/openapi.d.ts.map +1 -0
- package/dist/http/openapi.js +114 -0
- package/dist/http/openapi.js.map +1 -0
- package/dist/http/product-audience.d.ts +78 -0
- package/dist/http/product-audience.d.ts.map +1 -0
- package/dist/http/product-audience.js +92 -0
- package/dist/http/product-audience.js.map +1 -0
- package/dist/http/request-actor.d.ts +82 -0
- package/dist/http/request-actor.d.ts.map +1 -0
- package/dist/http/request-actor.js +2 -0
- package/dist/http/request-actor.js.map +1 -0
- package/dist/http/server.d.ts +60 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +117 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/storefront-revalidator.d.ts +29 -0
- package/dist/http/storefront-revalidator.d.ts.map +1 -0
- package/dist/http/storefront-revalidator.js +34 -0
- package/dist/http/storefront-revalidator.js.map +1 -0
- package/dist/http/test-actor-carrier.d.ts +28 -0
- package/dist/http/test-actor-carrier.d.ts.map +1 -0
- package/dist/http/test-actor-carrier.js +10 -0
- package/dist/http/test-actor-carrier.js.map +1 -0
- package/dist/http/trusted-proxy.d.ts +48 -0
- package/dist/http/trusted-proxy.d.ts.map +1 -0
- package/dist/http/trusted-proxy.js +136 -0
- package/dist/http/trusted-proxy.js.map +1 -0
- package/dist/kernel/audit/audit-log-entry.entity.d.ts +33 -0
- package/dist/kernel/audit/audit-log-entry.entity.d.ts.map +1 -0
- package/dist/kernel/audit/audit-log-entry.entity.js +102 -0
- package/dist/kernel/audit/audit-log-entry.entity.js.map +1 -0
- package/dist/kernel/audit/audit-log-service.d.ts +63 -0
- package/dist/kernel/audit/audit-log-service.d.ts.map +1 -0
- package/dist/kernel/audit/audit-log-service.js +107 -0
- package/dist/kernel/audit/audit-log-service.js.map +1 -0
- package/dist/kernel/cache/in-process-cache-registry.d.ts +93 -0
- package/dist/kernel/cache/in-process-cache-registry.d.ts.map +1 -0
- package/dist/kernel/cache/in-process-cache-registry.js +78 -0
- package/dist/kernel/cache/in-process-cache-registry.js.map +1 -0
- package/dist/kernel/cache/shared-drop-marks.d.ts +39 -0
- package/dist/kernel/cache/shared-drop-marks.d.ts.map +1 -0
- package/dist/kernel/cache/shared-drop-marks.js +68 -0
- package/dist/kernel/cache/shared-drop-marks.js.map +1 -0
- package/dist/kernel/compose.d.ts +234 -0
- package/dist/kernel/compose.d.ts.map +1 -0
- package/dist/kernel/compose.js +279 -0
- package/dist/kernel/compose.js.map +1 -0
- package/dist/kernel/container.d.ts +95 -0
- package/dist/kernel/container.d.ts.map +1 -0
- package/dist/kernel/container.js +90 -0
- package/dist/kernel/container.js.map +1 -0
- package/dist/kernel/contribution-sinks.d.ts +106 -0
- package/dist/kernel/contribution-sinks.d.ts.map +1 -0
- package/dist/kernel/contribution-sinks.js +153 -0
- package/dist/kernel/contribution-sinks.js.map +1 -0
- package/dist/kernel/crypto/password-hasher.d.ts +3 -0
- package/dist/kernel/crypto/password-hasher.d.ts.map +1 -0
- package/dist/kernel/crypto/password-hasher.js +44 -0
- package/dist/kernel/crypto/password-hasher.js.map +1 -0
- package/dist/kernel/i18n/error-envelope-options.d.ts +56 -0
- package/dist/kernel/i18n/error-envelope-options.d.ts.map +1 -0
- package/dist/kernel/i18n/error-envelope-options.js +46 -0
- package/dist/kernel/i18n/error-envelope-options.js.map +1 -0
- package/dist/kernel/i18n/error-translation.d.ts +144 -0
- package/dist/kernel/i18n/error-translation.d.ts.map +1 -0
- package/dist/kernel/i18n/error-translation.js +84 -0
- package/dist/kernel/i18n/error-translation.js.map +1 -0
- package/dist/kernel/i18n/request-language.d.ts +80 -0
- package/dist/kernel/i18n/request-language.d.ts.map +1 -0
- package/dist/kernel/i18n/request-language.js +168 -0
- package/dist/kernel/i18n/request-language.js.map +1 -0
- package/dist/kernel/index.d.ts +142 -0
- package/dist/kernel/index.d.ts.map +1 -0
- package/dist/kernel/index.js +160 -0
- package/dist/kernel/index.js.map +1 -0
- package/dist/kernel/lazy-port.d.ts +59 -0
- package/dist/kernel/lazy-port.d.ts.map +1 -0
- package/dist/kernel/lazy-port.js +78 -0
- package/dist/kernel/lazy-port.js.map +1 -0
- package/dist/kernel/lifecycle/activation-resolver.d.ts +63 -0
- package/dist/kernel/lifecycle/activation-resolver.d.ts.map +1 -0
- package/dist/kernel/lifecycle/activation-resolver.js +70 -0
- package/dist/kernel/lifecycle/activation-resolver.js.map +1 -0
- package/dist/kernel/lifecycle/capability-registry.d.ts +145 -0
- package/dist/kernel/lifecycle/capability-registry.d.ts.map +1 -0
- package/dist/kernel/lifecycle/capability-registry.js +170 -0
- package/dist/kernel/lifecycle/capability-registry.js.map +1 -0
- package/dist/kernel/lifecycle/effective-state.d.ts +126 -0
- package/dist/kernel/lifecycle/effective-state.d.ts.map +1 -0
- package/dist/kernel/lifecycle/effective-state.js +111 -0
- package/dist/kernel/lifecycle/effective-state.js.map +1 -0
- package/dist/kernel/lifecycle/module-registration.entity.d.ts +57 -0
- package/dist/kernel/lifecycle/module-registration.entity.d.ts.map +1 -0
- package/dist/kernel/lifecycle/module-registration.entity.js +111 -0
- package/dist/kernel/lifecycle/module-registration.entity.js.map +1 -0
- package/dist/kernel/lifecycle/plugin-helpers.d.ts +165 -0
- package/dist/kernel/lifecycle/plugin-helpers.d.ts.map +1 -0
- package/dist/kernel/lifecycle/plugin-helpers.js +395 -0
- package/dist/kernel/lifecycle/plugin-helpers.js.map +1 -0
- package/dist/kernel/lifecycle/registry-cache.d.ts +318 -0
- package/dist/kernel/lifecycle/registry-cache.d.ts.map +1 -0
- package/dist/kernel/lifecycle/registry-cache.js +509 -0
- package/dist/kernel/lifecycle/registry-cache.js.map +1 -0
- package/dist/kernel/lifecycle/required-modules.d.ts +137 -0
- package/dist/kernel/lifecycle/required-modules.d.ts.map +1 -0
- package/dist/kernel/lifecycle/required-modules.js +80 -0
- package/dist/kernel/lifecycle/required-modules.js.map +1 -0
- package/dist/kernel/lifecycle/unique-module-ids.d.ts +58 -0
- package/dist/kernel/lifecycle/unique-module-ids.d.ts.map +1 -0
- package/dist/kernel/lifecycle/unique-module-ids.js +82 -0
- package/dist/kernel/lifecycle/unique-module-ids.js.map +1 -0
- package/dist/kernel/logging.d.ts +116 -0
- package/dist/kernel/logging.d.ts.map +1 -0
- package/dist/kernel/logging.js +71 -0
- package/dist/kernel/logging.js.map +1 -0
- package/dist/kernel/module-context.d.ts +563 -0
- package/dist/kernel/module-context.d.ts.map +1 -0
- package/dist/kernel/module-context.js +670 -0
- package/dist/kernel/module-context.js.map +1 -0
- package/dist/kernel/ports/audit.d.ts +115 -0
- package/dist/kernel/ports/audit.d.ts.map +1 -0
- package/dist/kernel/ports/audit.js +2 -0
- package/dist/kernel/ports/audit.js.map +1 -0
- package/dist/kernel/ports/organizations.d.ts +56 -0
- package/dist/kernel/ports/organizations.d.ts.map +1 -0
- package/dist/kernel/ports/organizations.js +2 -0
- package/dist/kernel/ports/organizations.js.map +1 -0
- package/dist/kernel/ports/provide.d.ts +14 -0
- package/dist/kernel/ports/provide.d.ts.map +1 -0
- package/dist/kernel/ports/provide.js +50 -0
- package/dist/kernel/ports/provide.js.map +1 -0
- package/dist/kernel/ports/require-admin.d.ts +61 -0
- package/dist/kernel/ports/require-admin.d.ts.map +1 -0
- package/dist/kernel/ports/require-admin.js +2 -0
- package/dist/kernel/ports/require-admin.js.map +1 -0
- package/dist/kernel/ports/require-customer.d.ts +17 -0
- package/dist/kernel/ports/require-customer.d.ts.map +1 -0
- package/dist/kernel/ports/require-customer.js +2 -0
- package/dist/kernel/ports/require-customer.js.map +1 -0
- package/dist/kernel/ports/sales-channel.d.ts +84 -0
- package/dist/kernel/ports/sales-channel.d.ts.map +1 -0
- package/dist/kernel/ports/sales-channel.js +2 -0
- package/dist/kernel/ports/sales-channel.js.map +1 -0
- package/dist/kernel/ports/settings.d.ts +59 -0
- package/dist/kernel/ports/settings.d.ts.map +1 -0
- package/dist/kernel/ports/settings.js +2 -0
- package/dist/kernel/ports/settings.js.map +1 -0
- package/dist/kernel/public-api-base-url.d.ts +98 -0
- package/dist/kernel/public-api-base-url.d.ts.map +1 -0
- package/dist/kernel/public-api-base-url.js +144 -0
- package/dist/kernel/public-api-base-url.js.map +1 -0
- package/dist/kernel/request-scope-hook.d.ts +63 -0
- package/dist/kernel/request-scope-hook.d.ts.map +1 -0
- package/dist/kernel/request-scope-hook.js +67 -0
- package/dist/kernel/request-scope-hook.js.map +1 -0
- package/dist/kernel/sales-channels/channel-bridge-registry.d.ts +109 -0
- package/dist/kernel/sales-channels/channel-bridge-registry.d.ts.map +1 -0
- package/dist/kernel/sales-channels/channel-bridge-registry.js +75 -0
- package/dist/kernel/sales-channels/channel-bridge-registry.js.map +1 -0
- package/dist/kernel/sales-channels/compose.d.ts +69 -0
- package/dist/kernel/sales-channels/compose.d.ts.map +1 -0
- package/dist/kernel/sales-channels/compose.js +43 -0
- package/dist/kernel/sales-channels/compose.js.map +1 -0
- package/dist/kernel/sales-channels/default-channel-reconciler.d.ts +66 -0
- package/dist/kernel/sales-channels/default-channel-reconciler.d.ts.map +1 -0
- package/dist/kernel/sales-channels/default-channel-reconciler.js +91 -0
- package/dist/kernel/sales-channels/default-channel-reconciler.js.map +1 -0
- package/dist/kernel/sales-channels/no-system-default-channel.error.d.ts +28 -0
- package/dist/kernel/sales-channels/no-system-default-channel.error.d.ts.map +1 -0
- package/dist/kernel/sales-channels/no-system-default-channel.error.js +33 -0
- package/dist/kernel/sales-channels/no-system-default-channel.error.js.map +1 -0
- package/dist/kernel/sales-channels/request-channel-assortment.d.ts +72 -0
- package/dist/kernel/sales-channels/request-channel-assortment.d.ts.map +1 -0
- package/dist/kernel/sales-channels/request-channel-assortment.js +83 -0
- package/dist/kernel/sales-channels/request-channel-assortment.js.map +1 -0
- package/dist/kernel/sales-channels/sales-channel-membership.service.d.ts +157 -0
- package/dist/kernel/sales-channels/sales-channel-membership.service.d.ts.map +1 -0
- package/dist/kernel/sales-channels/sales-channel-membership.service.js +302 -0
- package/dist/kernel/sales-channels/sales-channel-membership.service.js.map +1 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.middleware.d.ts +76 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.middleware.d.ts.map +1 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.middleware.js +184 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.middleware.js.map +1 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.service.d.ts +82 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.service.d.ts.map +1 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.service.js +126 -0
- package/dist/kernel/sales-channels/sales-channel-resolver.service.js.map +1 -0
- package/dist/kernel/sales-channels/sales-channel.entity.d.ts +50 -0
- package/dist/kernel/sales-channels/sales-channel.entity.d.ts.map +1 -0
- package/dist/kernel/sales-channels/sales-channel.entity.js +132 -0
- package/dist/kernel/sales-channels/sales-channel.entity.js.map +1 -0
- package/dist/kernel/sales-channels/sales-channels-cache.d.ts +170 -0
- package/dist/kernel/sales-channels/sales-channels-cache.d.ts.map +1 -0
- package/dist/kernel/sales-channels/sales-channels-cache.js +243 -0
- package/dist/kernel/sales-channels/sales-channels-cache.js.map +1 -0
- package/dist/kernel/scope.d.ts +153 -0
- package/dist/kernel/scope.d.ts.map +1 -0
- package/dist/kernel/scope.js +172 -0
- package/dist/kernel/scope.js.map +1 -0
- package/dist/kernel/settings/compose.d.ts +49 -0
- package/dist/kernel/settings/compose.d.ts.map +1 -0
- package/dist/kernel/settings/compose.js +21 -0
- package/dist/kernel/settings/compose.js.map +1 -0
- package/dist/kernel/settings/manifest-reconciler.d.ts +78 -0
- package/dist/kernel/settings/manifest-reconciler.d.ts.map +1 -0
- package/dist/kernel/settings/manifest-reconciler.js +343 -0
- package/dist/kernel/settings/manifest-reconciler.js.map +1 -0
- package/dist/kernel/settings/secret-value-codec.d.ts +52 -0
- package/dist/kernel/settings/secret-value-codec.d.ts.map +1 -0
- package/dist/kernel/settings/secret-value-codec.js +102 -0
- package/dist/kernel/settings/secret-value-codec.js.map +1 -0
- package/dist/kernel/settings/setting-group.entity.d.ts +25 -0
- package/dist/kernel/settings/setting-group.entity.d.ts.map +1 -0
- package/dist/kernel/settings/setting-group.entity.js +79 -0
- package/dist/kernel/settings/setting-group.entity.js.map +1 -0
- package/dist/kernel/settings/setting-value.entity.d.ts +23 -0
- package/dist/kernel/settings/setting-value.entity.d.ts.map +1 -0
- package/dist/kernel/settings/setting-value.entity.js +66 -0
- package/dist/kernel/settings/setting-value.entity.js.map +1 -0
- package/dist/kernel/settings/setting.entity.d.ts +56 -0
- package/dist/kernel/settings/setting.entity.d.ts.map +1 -0
- package/dist/kernel/settings/setting.entity.js +147 -0
- package/dist/kernel/settings/setting.entity.js.map +1 -0
- package/dist/kernel/settings/settings-cache.d.ts +158 -0
- package/dist/kernel/settings/settings-cache.d.ts.map +1 -0
- package/dist/kernel/settings/settings-cache.js +253 -0
- package/dist/kernel/settings/settings-cache.js.map +1 -0
- package/dist/kernel/settings/settings.service.d.ts +142 -0
- package/dist/kernel/settings/settings.service.d.ts.map +1 -0
- package/dist/kernel/settings/settings.service.js +294 -0
- package/dist/kernel/settings/settings.service.js.map +1 -0
- package/dist/lifecycle/backend.d.ts +51 -0
- package/dist/lifecycle/backend.d.ts.map +1 -0
- package/dist/lifecycle/backend.js +40 -0
- package/dist/lifecycle/backend.js.map +1 -0
- package/dist/lifecycle/commands/activation.commands.d.ts +97 -0
- package/dist/lifecycle/commands/activation.commands.d.ts.map +1 -0
- package/dist/lifecycle/commands/activation.commands.js +142 -0
- package/dist/lifecycle/commands/activation.commands.js.map +1 -0
- package/dist/lifecycle/commands/disable.d.ts +3 -0
- package/dist/lifecycle/commands/disable.d.ts.map +1 -0
- package/dist/lifecycle/commands/disable.js +126 -0
- package/dist/lifecycle/commands/disable.js.map +1 -0
- package/dist/lifecycle/commands/enable.d.ts +3 -0
- package/dist/lifecycle/commands/enable.d.ts.map +1 -0
- package/dist/lifecycle/commands/enable.js +102 -0
- package/dist/lifecycle/commands/enable.js.map +1 -0
- package/dist/lifecycle/commands/install.d.ts +3 -0
- package/dist/lifecycle/commands/install.d.ts.map +1 -0
- package/dist/lifecycle/commands/install.js +263 -0
- package/dist/lifecycle/commands/install.js.map +1 -0
- package/dist/lifecycle/commands/operator-entry.d.ts +104 -0
- package/dist/lifecycle/commands/operator-entry.d.ts.map +1 -0
- package/dist/lifecycle/commands/operator-entry.js +127 -0
- package/dist/lifecycle/commands/operator-entry.js.map +1 -0
- package/dist/lifecycle/commands/operator-runtime.d.ts +147 -0
- package/dist/lifecycle/commands/operator-runtime.d.ts.map +1 -0
- package/dist/lifecycle/commands/operator-runtime.js +40 -0
- package/dist/lifecycle/commands/operator-runtime.js.map +1 -0
- package/dist/lifecycle/commands/status.d.ts +3 -0
- package/dist/lifecycle/commands/status.d.ts.map +1 -0
- package/dist/lifecycle/commands/status.js +108 -0
- package/dist/lifecycle/commands/status.js.map +1 -0
- package/dist/lifecycle/commands/uninstall.d.ts +3 -0
- package/dist/lifecycle/commands/uninstall.d.ts.map +1 -0
- package/dist/lifecycle/commands/uninstall.js +223 -0
- package/dist/lifecycle/commands/uninstall.js.map +1 -0
- package/dist/lifecycle/divergence-declaration.d.ts +74 -0
- package/dist/lifecycle/divergence-declaration.d.ts.map +1 -0
- package/dist/lifecycle/divergence-declaration.js +92 -0
- package/dist/lifecycle/divergence-declaration.js.map +1 -0
- package/dist/lifecycle/i18n/en.json +4 -0
- package/dist/lifecycle/i18n/pl.json +4 -0
- package/dist/lifecycle/index.d.ts +110 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/lifecycle/index.js +189 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/lifecycle/manifest-registry.d.ts +244 -0
- package/dist/lifecycle/manifest-registry.d.ts.map +1 -0
- package/dist/lifecycle/manifest-registry.js +223 -0
- package/dist/lifecycle/manifest-registry.js.map +1 -0
- package/dist/lifecycle/manifest.d.ts +166 -0
- package/dist/lifecycle/manifest.d.ts.map +1 -0
- package/dist/lifecycle/manifest.js +121 -0
- package/dist/lifecycle/manifest.js.map +1 -0
- package/dist/lifecycle/plugin.d.ts +56 -0
- package/dist/lifecycle/plugin.d.ts.map +1 -0
- package/dist/lifecycle/plugin.js +59 -0
- package/dist/lifecycle/plugin.js.map +1 -0
- package/dist/lifecycle/resident.d.ts +16 -0
- package/dist/lifecycle/resident.d.ts.map +1 -0
- package/dist/lifecycle/resident.js +59 -0
- package/dist/lifecycle/resident.js.map +1 -0
- package/dist/lifecycle/routes.admin.d.ts +57 -0
- package/dist/lifecycle/routes.admin.d.ts.map +1 -0
- package/dist/lifecycle/routes.admin.js +162 -0
- package/dist/lifecycle/routes.admin.js.map +1 -0
- package/dist/lifecycle/routes.storefront.d.ts +26 -0
- package/dist/lifecycle/routes.storefront.d.ts.map +1 -0
- package/dist/lifecycle/routes.storefront.js +36 -0
- package/dist/lifecycle/routes.storefront.js.map +1 -0
- package/dist/lifecycle/services/deactivation-ledger.d.ts +216 -0
- package/dist/lifecycle/services/deactivation-ledger.d.ts.map +1 -0
- package/dist/lifecycle/services/deactivation-ledger.js +171 -0
- package/dist/lifecycle/services/deactivation-ledger.js.map +1 -0
- package/dist/lifecycle/services/dep-graph.d.ts +119 -0
- package/dist/lifecycle/services/dep-graph.d.ts.map +1 -0
- package/dist/lifecycle/services/dep-graph.js +334 -0
- package/dist/lifecycle/services/dep-graph.js.map +1 -0
- package/dist/lifecycle/services/gating-graph.d.ts +164 -0
- package/dist/lifecycle/services/gating-graph.d.ts.map +1 -0
- package/dist/lifecycle/services/gating-graph.js +203 -0
- package/dist/lifecycle/services/gating-graph.js.map +1 -0
- package/dist/lifecycle/services/lock.d.ts +27 -0
- package/dist/lifecycle/services/lock.d.ts.map +1 -0
- package/dist/lifecycle/services/lock.js +82 -0
- package/dist/lifecycle/services/lock.js.map +1 -0
- package/dist/lifecycle/services/manifest-loader.d.ts +125 -0
- package/dist/lifecycle/services/manifest-loader.d.ts.map +1 -0
- package/dist/lifecycle/services/manifest-loader.js +210 -0
- package/dist/lifecycle/services/manifest-loader.js.map +1 -0
- package/dist/lifecycle/services/migration-ownership.d.ts +36 -0
- package/dist/lifecycle/services/migration-ownership.d.ts.map +1 -0
- package/dist/lifecycle/services/migration-ownership.js +15 -0
- package/dist/lifecycle/services/migration-ownership.js.map +1 -0
- package/dist/lifecycle/services/module-id-claims.d.ts +38 -0
- package/dist/lifecycle/services/module-id-claims.d.ts.map +1 -0
- package/dist/lifecycle/services/module-id-claims.js +123 -0
- package/dist/lifecycle/services/module-id-claims.js.map +1 -0
- package/dist/lifecycle/services/module-origin.d.ts +55 -0
- package/dist/lifecycle/services/module-origin.d.ts.map +1 -0
- package/dist/lifecycle/services/module-origin.js +47 -0
- package/dist/lifecycle/services/module-origin.js.map +1 -0
- package/dist/lifecycle/services/orchestrator.d.ts +235 -0
- package/dist/lifecycle/services/orchestrator.d.ts.map +1 -0
- package/dist/lifecycle/services/orchestrator.js +954 -0
- package/dist/lifecycle/services/orchestrator.js.map +1 -0
- package/dist/lifecycle/services/presence-load.d.ts +281 -0
- package/dist/lifecycle/services/presence-load.d.ts.map +1 -0
- package/dist/lifecycle/services/presence-load.js +437 -0
- package/dist/lifecycle/services/presence-load.js.map +1 -0
- package/dist/lifecycle/services/static-registry.d.ts +47 -0
- package/dist/lifecycle/services/static-registry.d.ts.map +1 -0
- package/dist/lifecycle/services/static-registry.js +41 -0
- package/dist/lifecycle/services/static-registry.js.map +1 -0
- package/dist/migrations/20260424T165847_core_foundation_init.d.ts +25 -0
- package/dist/migrations/20260424T165847_core_foundation_init.d.ts.map +1 -0
- package/dist/migrations/20260424T165847_core_foundation_init.js +238 -0
- package/dist/migrations/20260424T165847_core_foundation_init.js.map +1 -0
- package/dist/migrations/20260425T050720_core_commerce_init.d.ts +19 -0
- package/dist/migrations/20260425T050720_core_commerce_init.d.ts.map +1 -0
- package/dist/migrations/20260425T050720_core_commerce_init.js +200 -0
- package/dist/migrations/20260425T050720_core_commerce_init.js.map +1 -0
- package/dist/migrations/20260430T101450_core_settings_init.d.ts +25 -0
- package/dist/migrations/20260430T101450_core_settings_init.d.ts.map +1 -0
- package/dist/migrations/20260430T101450_core_settings_init.js +113 -0
- package/dist/migrations/20260430T101450_core_settings_init.js.map +1 -0
- package/dist/migrations/20260430T170044_core_sales_channels_promote.d.ts +67 -0
- package/dist/migrations/20260430T170044_core_sales_channels_promote.d.ts.map +1 -0
- package/dist/migrations/20260430T170044_core_sales_channels_promote.js +101 -0
- package/dist/migrations/20260430T170044_core_sales_channels_promote.js.map +1 -0
- package/dist/migrations/20260506T200657_core_module_lifecycle_init.d.ts +21 -0
- package/dist/migrations/20260506T200657_core_module_lifecycle_init.d.ts.map +1 -0
- package/dist/migrations/20260506T200657_core_module_lifecycle_init.js +41 -0
- package/dist/migrations/20260506T200657_core_module_lifecycle_init.js.map +1 -0
- package/dist/migrations/20260514T111329_core_settings_global_value.d.ts +30 -0
- package/dist/migrations/20260514T111329_core_settings_global_value.d.ts.map +1 -0
- package/dist/migrations/20260514T111329_core_settings_global_value.js +34 -0
- package/dist/migrations/20260514T111329_core_settings_global_value.js.map +1 -0
- package/dist/migrations/20260611T140411_core_settings_secret_value_type.d.ts +26 -0
- package/dist/migrations/20260611T140411_core_settings_secret_value_type.d.ts.map +1 -0
- package/dist/migrations/20260611T140411_core_settings_secret_value_type.js +63 -0
- package/dist/migrations/20260611T140411_core_settings_secret_value_type.js.map +1 -0
- package/dist/migrations/20260611T140419_core_settings_enum_options.d.ts +19 -0
- package/dist/migrations/20260611T140419_core_settings_enum_options.d.ts.map +1 -0
- package/dist/migrations/20260611T140419_core_settings_enum_options.js +23 -0
- package/dist/migrations/20260611T140419_core_settings_enum_options.js.map +1 -0
- package/dist/migrations/20260629T090100_core_settings_hidden_flag.d.ts +20 -0
- package/dist/migrations/20260629T090100_core_settings_hidden_flag.d.ts.map +1 -0
- package/dist/migrations/20260629T090100_core_settings_hidden_flag.js +24 -0
- package/dist/migrations/20260629T090100_core_settings_hidden_flag.js.map +1 -0
- package/dist/migrations/20260717T134752_core_tenant_scope_indexes.d.ts +27 -0
- package/dist/migrations/20260717T134752_core_tenant_scope_indexes.d.ts.map +1 -0
- package/dist/migrations/20260717T134752_core_tenant_scope_indexes.js +32 -0
- package/dist/migrations/20260717T134752_core_tenant_scope_indexes.js.map +1 -0
- package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.d.ts +24 -0
- package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.d.ts.map +1 -0
- package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.js +57 -0
- package/dist/migrations/20260721T011510_core_settings_credential_ref_value_type.js.map +1 -0
- package/dist/migrations/20260816T203339_core_retire_core_activation_settings.d.ts +39 -0
- package/dist/migrations/20260816T203339_core_retire_core_activation_settings.d.ts.map +1 -0
- package/dist/migrations/20260816T203339_core_retire_core_activation_settings.js +59 -0
- package/dist/migrations/20260816T203339_core_retire_core_activation_settings.js.map +1 -0
- package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.d.ts +34 -0
- package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.d.ts.map +1 -0
- package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.js +38 -0
- package/dist/migrations/20260919T101500_core_module_registrations_boot_converged.js.map +1 -0
- package/dist/migrations/baseline-migrations.generated.d.ts +2 -0
- package/dist/migrations/baseline-migrations.generated.d.ts.map +1 -0
- package/dist/migrations/baseline-migrations.generated.js +136 -0
- package/dist/migrations/baseline-migrations.generated.js.map +1 -0
- package/dist/migrations/index.d.ts +62 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +75 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/overlay/deployment-roots.d.ts +37 -0
- package/dist/overlay/deployment-roots.d.ts.map +1 -0
- package/dist/overlay/deployment-roots.js +90 -0
- package/dist/overlay/deployment-roots.js.map +1 -0
- package/dist/overlay/index.d.ts +62 -0
- package/dist/overlay/index.d.ts.map +1 -0
- package/dist/overlay/index.js +62 -0
- package/dist/overlay/index.js.map +1 -0
- package/dist/overlay/overlay-runtime.d.ts +173 -0
- package/dist/overlay/overlay-runtime.d.ts.map +1 -0
- package/dist/overlay/overlay-runtime.js +281 -0
- package/dist/overlay/overlay-runtime.js.map +1 -0
- package/dist/overlay/resolve-overlay.d.ts +41 -0
- package/dist/overlay/resolve-overlay.d.ts.map +1 -0
- package/dist/overlay/resolve-overlay.js +72 -0
- package/dist/overlay/resolve-overlay.js.map +1 -0
- package/dist/packages/index.d.ts +57 -0
- package/dist/packages/index.d.ts.map +1 -0
- package/dist/packages/index.js +57 -0
- package/dist/packages/index.js.map +1 -0
- package/dist/packages/installed-packages.d.ts +79 -0
- package/dist/packages/installed-packages.d.ts.map +1 -0
- package/dist/packages/installed-packages.js +312 -0
- package/dist/packages/installed-packages.js.map +1 -0
- package/dist/packages/package-entity-lookup.d.ts +120 -0
- package/dist/packages/package-entity-lookup.d.ts.map +1 -0
- package/dist/packages/package-entity-lookup.js +17 -0
- package/dist/packages/package-entity-lookup.js.map +1 -0
- package/dist/packages/package-runtime.d.ts +177 -0
- package/dist/packages/package-runtime.d.ts.map +1 -0
- package/dist/packages/package-runtime.js +386 -0
- package/dist/packages/package-runtime.js.map +1 -0
- package/dist/tenancy/derived-scope.d.ts +43 -0
- package/dist/tenancy/derived-scope.d.ts.map +1 -0
- package/dist/tenancy/derived-scope.js +76 -0
- package/dist/tenancy/derived-scope.js.map +1 -0
- package/dist/tenancy/escape-hatch.d.ts +30 -0
- package/dist/tenancy/escape-hatch.d.ts.map +1 -0
- package/dist/tenancy/escape-hatch.js +50 -0
- package/dist/tenancy/escape-hatch.js.map +1 -0
- package/dist/tenancy/filters.d.ts +87 -0
- package/dist/tenancy/filters.d.ts.map +1 -0
- package/dist/tenancy/filters.js +126 -0
- package/dist/tenancy/filters.js.map +1 -0
- package/dist/tenancy/index.d.ts +63 -0
- package/dist/tenancy/index.d.ts.map +1 -0
- package/dist/tenancy/index.js +61 -0
- package/dist/tenancy/index.js.map +1 -0
- package/dist/tenancy/org-scoped.decorator.d.ts +150 -0
- package/dist/tenancy/org-scoped.decorator.d.ts.map +1 -0
- package/dist/tenancy/org-scoped.decorator.js +339 -0
- package/dist/tenancy/org-scoped.decorator.js.map +1 -0
- package/dist/tenancy/org-write-guard.d.ts +106 -0
- package/dist/tenancy/org-write-guard.d.ts.map +1 -0
- package/dist/tenancy/org-write-guard.js +141 -0
- package/dist/tenancy/org-write-guard.js.map +1 -0
- package/dist/tenancy/resolve-tenant-context.d.ts +91 -0
- package/dist/tenancy/resolve-tenant-context.d.ts.map +1 -0
- package/dist/tenancy/resolve-tenant-context.js +85 -0
- package/dist/tenancy/resolve-tenant-context.js.map +1 -0
- package/dist/tenancy/scoped-em.d.ts +10 -0
- package/dist/tenancy/scoped-em.d.ts.map +1 -0
- package/dist/tenancy/scoped-em.js +11 -0
- package/dist/tenancy/scoped-em.js.map +1 -0
- package/dist/tenancy/tenant-context.d.ts +154 -0
- package/dist/tenancy/tenant-context.d.ts.map +1 -0
- package/dist/tenancy/tenant-context.js +109 -0
- package/dist/tenancy/tenant-context.js.map +1 -0
- package/package.json +123 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { asClass, asFunction, asValue, Lifetime, } from 'awilix';
|
|
2
|
+
import { defineModuleRoutes, defineModuleWorker, subscribeForModule, } from './lifecycle/plugin-helpers.js';
|
|
3
|
+
import { moduleLogger } from './logging.js';
|
|
4
|
+
import { registerPort } from './ports/provide.js';
|
|
5
|
+
import { DROPPED_CONTRIBUTION_SINK, isDeclaredContribution, } from './contribution-sinks.js';
|
|
6
|
+
/**
|
|
7
|
+
* Is this resolver a **root-resolved constant** — awilix's `asValue`?
|
|
8
|
+
*
|
|
9
|
+
* The signature is the pair `{ resolve, isLeakSafe: true }` with no `lifetime`,
|
|
10
|
+
* and both halves are asked for, deliberately. `lifetime === undefined` alone
|
|
11
|
+
* would also match a hand-built resolver object that is *not* leak-safe, whose
|
|
12
|
+
* author meant something by leaving the field off that this function has no way
|
|
13
|
+
* to read; `isLeakSafe` alone would match a future builder that opts out of the
|
|
14
|
+
* leak check while still declaring a lifetime. Only the pair means the thing
|
|
15
|
+
* this predicate is used for in `decorate`: a constant the root registered,
|
|
16
|
+
* whose contract is one object for every resolution.
|
|
17
|
+
*/
|
|
18
|
+
function isRootResolvedConstant(resolver) {
|
|
19
|
+
return resolver.lifetime === undefined && resolver.isLeakSafe === true;
|
|
20
|
+
}
|
|
21
|
+
/** Two modules registered the same name. Names both, never just the loser. */
|
|
22
|
+
export class DuplicateRegistrationError extends Error {
|
|
23
|
+
registrationName;
|
|
24
|
+
owner;
|
|
25
|
+
claimant;
|
|
26
|
+
constructor(registrationName, owner, claimant) {
|
|
27
|
+
super(`[kernel] modules '${owner}' and '${claimant}' both register '${registrationName}'. ` +
|
|
28
|
+
`A registration name is owned by exactly one module — otherwise which ` +
|
|
29
|
+
`implementation the platform runs depends on registration order. One of them ` +
|
|
30
|
+
`owns it and the other resolves it. If '${claimant}' meant to supply an ` +
|
|
31
|
+
`implementation behind a name '${owner}' published, note that rung 3 is the ` +
|
|
32
|
+
`**owner's to publish, not the claimant's to take**: ctx.di.providePort claims the ` +
|
|
33
|
+
`name, and there is no overlay exemption on the claim. A deployment that needs to ` +
|
|
34
|
+
`change what '${owner}' registers has rung 4a instead — wrap it from its own overlay ` +
|
|
35
|
+
`module with ctx.di.decorate('${registrationName}', …), which keeps '${owner}' ` +
|
|
36
|
+
`delegating through it. See docs/docs/architecture/customisation-ladder.md.`);
|
|
37
|
+
this.registrationName = registrationName;
|
|
38
|
+
this.owner = owner;
|
|
39
|
+
this.claimant = claimant;
|
|
40
|
+
this.name = 'DuplicateRegistrationError';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A module registered over a name a composition root supplies (D-156.6).
|
|
45
|
+
*
|
|
46
|
+
* This is the door beside the one {@link ForeignDecorationError} guards, and it
|
|
47
|
+
* stood open while that one was locked. `registerValues` claims no ownership,
|
|
48
|
+
* and `claim` threw only when a *different module* already owned the name — so for a
|
|
49
|
+
* root-registered name there was no prior owner, the claim succeeded, and
|
|
50
|
+
* awilix's `register` overwrote the entry. Any module could take `commandBus`,
|
|
51
|
+
* become its owner, and thereafter decorate it legally, because
|
|
52
|
+
* `ForeignDecorationError` fires only for a name someone else owns.
|
|
53
|
+
*
|
|
54
|
+
* Refusing the **wrap** while permitting the **replacement** is not a boundary:
|
|
55
|
+
* it reads as one and is not, and D-28 is explicit that replacement must be *a
|
|
56
|
+
* distinct, more explicit act* than decoration. Today it is the less explicit
|
|
57
|
+
* one, which is what this closes.
|
|
58
|
+
*
|
|
59
|
+
* The refused set is derived, never listed (D-100, D-156.5): a name the
|
|
60
|
+
* container already holds that no module claimed is exactly a name a
|
|
61
|
+
* composition root supplied — `registerValues` above the compose call, or
|
|
62
|
+
* `contribute()` in D-45's window. A root that starts or stops supplying a name
|
|
63
|
+
* changes the answer in the same run, and nothing has to be kept true by hand.
|
|
64
|
+
*
|
|
65
|
+
* There is no overlay exemption here, and that is not an oversight. A
|
|
66
|
+
* deployment's way to change what a root-supplied name resolves to is
|
|
67
|
+
* `ctx.di.decorate`, which it may do and which keeps core delegating; taking
|
|
68
|
+
* the name outright severs that, for every consumer at once, with nothing
|
|
69
|
+
* declared and nothing reported.
|
|
70
|
+
*/
|
|
71
|
+
export class ForeignRegistrationError extends Error {
|
|
72
|
+
registrationName;
|
|
73
|
+
moduleId;
|
|
74
|
+
constructor(registrationName, moduleId) {
|
|
75
|
+
super(`[kernel] module '${moduleId}' cannot register '${registrationName}': a composition ` +
|
|
76
|
+
`root supplies it, so no module owns it. Registering over it replaces what every ` +
|
|
77
|
+
`consumer of that name resolves — for the platform's own names that is the audit ` +
|
|
78
|
+
`path, the transaction boundary, the event bus and the tenant-scoped EntityManager ` +
|
|
79
|
+
`factory — and it does so with nothing declared in any manifest and nothing in the ` +
|
|
80
|
+
`override report. Reach for a seam that exists instead: subscribe to the events the ` +
|
|
81
|
+
`owner emits (ctx.subscribe), run before or after another module's endpoint ` +
|
|
82
|
+
`(ctx.interceptors), or ask the owner to publish a strategy port with a default and ` +
|
|
83
|
+
`register your implementation behind it (ctx.di.providePort, resolved through ` +
|
|
84
|
+
`lazyPort). If this is a per-deployment customisation, write it as an overlay module ` +
|
|
85
|
+
`under backend/src/apps/<deployment>/modules/ and wrap the registration with ` +
|
|
86
|
+
`ctx.di.decorate('${registrationName}', …), which keeps core delegating through it.`);
|
|
87
|
+
this.registrationName = registrationName;
|
|
88
|
+
this.moduleId = moduleId;
|
|
89
|
+
this.name = 'ForeignRegistrationError';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** A module resolved something while it was still registering (T043). */
|
|
93
|
+
export class EagerResolutionError extends Error {
|
|
94
|
+
moduleId;
|
|
95
|
+
registrationName;
|
|
96
|
+
constructor(moduleId, registrationName) {
|
|
97
|
+
super(`[kernel] module '${moduleId}' resolved '${registrationName}' while registering. ` +
|
|
98
|
+
`Registration declares; it never resolves — at registration time the modules ` +
|
|
99
|
+
`after this one have not registered yet, so an eager resolution silently depends ` +
|
|
100
|
+
`on registration order. Move the resolution into the closure that uses it: a ` +
|
|
101
|
+
`route registrar, a worker processor, a subscriber, or ctx.onBoot().`);
|
|
102
|
+
this.moduleId = moduleId;
|
|
103
|
+
this.registrationName = registrationName;
|
|
104
|
+
this.name = 'EagerResolutionError';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Two modules decorate one name and nothing says which wraps which (T064).
|
|
109
|
+
*
|
|
110
|
+
* Decoration order is not a formatting question: `beta(acme(core))` and
|
|
111
|
+
* `acme(beta(core))` are different implementations, and a platform that picks
|
|
112
|
+
* between them by package load order picks by accident. The failure is loud at
|
|
113
|
+
* composition rather than deferred to whichever behaviour shows up in
|
|
114
|
+
* production.
|
|
115
|
+
*
|
|
116
|
+
* A module decorating the same name twice is *not* ambiguous — it wrote both
|
|
117
|
+
* wraps, in the order it wrote them — so this fires only across modules.
|
|
118
|
+
*
|
|
119
|
+
* **The remedy is the one that exists today** (D-156.7, D-156.11 item 2;
|
|
120
|
+
* feature 107 FR-042), and as of feature 107's P3 that is the field. This
|
|
121
|
+
* message sent its reader to `decorationOrder` once before and was corrected,
|
|
122
|
+
* because the field was passed by no composition root and its declared source
|
|
123
|
+
* — `endora.config.ts` — was an F11 artefact that never existed: an author
|
|
124
|
+
* could satisfy the instruction only by editing core's own `composition.ts`,
|
|
125
|
+
* which is the one thing an overlay is built to avoid.
|
|
126
|
+
*
|
|
127
|
+
* Both roots now read it from the deployment's own
|
|
128
|
+
* `backend/src/apps/<deployment>/divergence.ts`, which is a file in the
|
|
129
|
+
* deployment's own tree. That is the coupling `compose.ts`'
|
|
130
|
+
* `decorationOrder` doc block recorded — *"the day a root starts passing this,
|
|
131
|
+
* that message is what has to change with it"* — and this is that change. The
|
|
132
|
+
* old workaround (merge the two wraps into one overlay module) is withdrawn
|
|
133
|
+
* rather than kept beside it: two remedies for one refusal is an author
|
|
134
|
+
* choosing, and the declaration is the one that keeps the two modules apart.
|
|
135
|
+
*/
|
|
136
|
+
export class AmbiguousDecorationError extends Error {
|
|
137
|
+
registrationName;
|
|
138
|
+
modules;
|
|
139
|
+
constructor(registrationName, modules, detail) {
|
|
140
|
+
super(`[kernel] modules ${modules.map((m) => `'${m}'`).join(' and ')} both decorate ` +
|
|
141
|
+
`'${registrationName}', and ${detail} Which override wraps which decides what the ` +
|
|
142
|
+
`platform runs, so it cannot be left to the order the modules happen to compose in. ` +
|
|
143
|
+
`Declare it in this deployment's own file — backend/src/apps/<deployment>/` +
|
|
144
|
+
`divergence.ts, the \`decorationOrder\` field, innermost first:\n` +
|
|
145
|
+
` decorationOrder: { '${registrationName}': [` +
|
|
146
|
+
`${modules.map((m) => `'${m}'`).join(', ')}] }\n` +
|
|
147
|
+
`It is checked, never applied: the composer keeps emitting in its own order and this ` +
|
|
148
|
+
`asserts that order was the intended one, so a declaration that stops matching ` +
|
|
149
|
+
`refuses here rather than silently reordering anything. ` +
|
|
150
|
+
`This is rung 4a — decoration — and it is the most invasive seam short of a fork. ` +
|
|
151
|
+
`If the two wraps genuinely belong to different owners, one of them is asking for a ` +
|
|
152
|
+
`seam rather than a wrap: rung 3, ask that owner to publish a strategy port ` +
|
|
153
|
+
`(ctx.di.providePort) you resolve with lazyPort. See ` +
|
|
154
|
+
`docs/docs/architecture/customisation-ladder.md.`);
|
|
155
|
+
this.registrationName = registrationName;
|
|
156
|
+
this.modules = modules;
|
|
157
|
+
this.name = 'AmbiguousDecorationError';
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A module decorated a registration it does not own (issue #203).
|
|
162
|
+
*
|
|
163
|
+
* `decorate` used to check only that *something* was registered under the name.
|
|
164
|
+
* Both halves of the answer were already in hand at the call site — the
|
|
165
|
+
* decorating module's id, and the owner from the ownership ledger — and the
|
|
166
|
+
* record kept both while comparing neither, so any module could wrap any entry
|
|
167
|
+
* in the container: `commandBus` to observe every audited write,
|
|
168
|
+
* `auditLogService` to change what the audit records, another module's read
|
|
169
|
+
* port to sit between a consumer and its owner with nothing declared anywhere.
|
|
170
|
+
*
|
|
171
|
+
* Refused rather than ledgered. A ledger makes the platform's answer "we will
|
|
172
|
+
* notice", and what is at stake here is not a coupling to drain but the
|
|
173
|
+
* integrity of the audit path.
|
|
174
|
+
*
|
|
175
|
+
* The exemption is the **deployment's own** overlay module, which is a
|
|
176
|
+
* different act: core wrapping core is a coupling nothing declares, while a
|
|
177
|
+
* deployment wrapping core is the sanctioned per-deployment customisation seam
|
|
178
|
+
* (feature 072 replaced file shadowing with it). It is not a claim a module can
|
|
179
|
+
* make about itself — the generated composer sets it from the root the module
|
|
180
|
+
* was discovered under, `backend/src/apps/<deployment>/modules/`.
|
|
181
|
+
*
|
|
182
|
+
* **The exemption is total, and this paragraph is here because the one above it
|
|
183
|
+
* reads as though it were not** (D-156.4, D-156.11 item 3). `overlay` is a
|
|
184
|
+
* per-module boolean and the check below is name-unscoped, so an overlay module
|
|
185
|
+
* may wrap *anything the container holds* — not merely "core", but the
|
|
186
|
+
* root-registered set no module owns: `commandBus`, `auditLogService`,
|
|
187
|
+
* `eventBus`, `emFactory`. Those are precisely the names this error was
|
|
188
|
+
* introduced to defend — `commandBus` to observe every audited write,
|
|
189
|
+
* `auditLogService` to change what the audit records — so the rule as stated
|
|
190
|
+
* and the code as written disagree, and the code is the one that runs.
|
|
191
|
+
*
|
|
192
|
+
* **That is deliberate and it stays.** A deployment owns its instance outright:
|
|
193
|
+
* it edits its own `apps/<deployment>/` tree, it builds the image, and it
|
|
194
|
+
* answers to nobody but itself — so refusing it `commandBus` would defend the
|
|
195
|
+
* audit path against the one party entitled to change it, while a deployment
|
|
196
|
+
* that wanted to could simply do it another way. The defended set is a boundary
|
|
197
|
+
* against *strangers*, and a deployment is not one.
|
|
198
|
+
*
|
|
199
|
+
* This paragraph used to rest part of that argument on a second mechanism — a
|
|
200
|
+
* file under `backend/src/apps/<deployment>/decorations/` that could wrap any
|
|
201
|
+
* registration. That seam is retired: it was wired for one hard-coded name, and
|
|
202
|
+
* D-103 had already made an overlay module's `ctx.di.decorate` do the same job
|
|
203
|
+
* with none of its costs. The argument stands on the sentence above it, which
|
|
204
|
+
* never needed the second mechanism.
|
|
205
|
+
*
|
|
206
|
+
* **An installed extension package is** (D-156.1–D-156.9). `loadPackageModuleEntries`
|
|
207
|
+
* therefore sets no `overlay` flag, and that is the ruled behaviour rather than
|
|
208
|
+
* a placeholder: if a grant is ever built it is keyed per
|
|
209
|
+
* `(package, registration name)`, read from an artefact the instance owns and
|
|
210
|
+
* the package cannot write, and refused outright for any name whose owner is
|
|
211
|
+
* `undefined`. This flag is not the mechanism — widening it, re-typing it to an
|
|
212
|
+
* origin enum or setting it from a declaration hands a stranger the audit path
|
|
213
|
+
* along with whatever it asked for. Do not narrow the check below to match the
|
|
214
|
+
* older prose; the prose was what was wrong.
|
|
215
|
+
*/
|
|
216
|
+
export class ForeignDecorationError extends Error {
|
|
217
|
+
registrationName;
|
|
218
|
+
moduleId;
|
|
219
|
+
owner;
|
|
220
|
+
constructor(registrationName, moduleId,
|
|
221
|
+
/** The registering module, or `undefined` when a composition root registered it. */
|
|
222
|
+
owner) {
|
|
223
|
+
const owned = owner === undefined
|
|
224
|
+
? `a composition root registers it, so no module owns it`
|
|
225
|
+
: `'${owner}' registers it`;
|
|
226
|
+
super(`[kernel] module '${moduleId}' cannot decorate '${registrationName}': ${owned}. ` +
|
|
227
|
+
`That is rung 4a — decoration — and it is not offered to a core module: it ` +
|
|
228
|
+
`rewrites what every consumer of that name resolves, so it is the owner's to do, ` +
|
|
229
|
+
`and reaching into another module's registration is a coupling nothing declares ` +
|
|
230
|
+
`and nothing reports. Drop to the highest rung that works for you, in order:\n` +
|
|
231
|
+
` rung 3 — ask ${owner === undefined ? 'the composition root' : `'${owner}'`} to ` +
|
|
232
|
+
`publish a strategy port (ctx.di.providePort) and resolve it with ` +
|
|
233
|
+
`lazyPort<T>(ctx, '<name>'), declaring the edge in your manifest;\n` +
|
|
234
|
+
` rung 2 — if what you need is around an endpoint that module already serves, ` +
|
|
235
|
+
`ctx.interceptors([{ target: '<METHOD> <route>', phase, handler }]);\n` +
|
|
236
|
+
` rung 1 — if the work is additive and something already happened, ` +
|
|
237
|
+
`ctx.subscribe('<event>', handler).\n` +
|
|
238
|
+
`If this is a per-deployment customisation, rung 4a is yours: write it as an ` +
|
|
239
|
+
`overlay module under backend/src/apps/<deployment>/modules/ — that is the one ` +
|
|
240
|
+
`decoration across owners the platform sanctions. See ` +
|
|
241
|
+
`docs/docs/architecture/customisation-ladder.md.`);
|
|
242
|
+
this.registrationName = registrationName;
|
|
243
|
+
this.moduleId = moduleId;
|
|
244
|
+
this.owner = owner;
|
|
245
|
+
this.name = 'ForeignDecorationError';
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The registration being wrapped belongs to an **installed extension package**
|
|
250
|
+
* (D-176 Q3, ruled by the owner on 2026-08-25).
|
|
251
|
+
*
|
|
252
|
+
* A per-deployment overlay may decorate anything core or another of the
|
|
253
|
+
* deployment's own modules registers — that seam is unchanged and is the whole
|
|
254
|
+
* of feature 072's answer to file shadowing. It may **not** decorate a
|
|
255
|
+
* registration an installed package owns, and until the drain landed it could
|
|
256
|
+
* not: `composition.ts` composes overlays before packages, so the name was not
|
|
257
|
+
* in the container yet and `hasRegistration` refused for a reason that had
|
|
258
|
+
* nothing to do with the wrap. The drain removes that accident, so the refusal
|
|
259
|
+
* has to be stated here or the same change would silently grant the capability
|
|
260
|
+
* the owner declined.
|
|
261
|
+
*
|
|
262
|
+
* **Why it is refused today.** The mechanism that would make it safe does not
|
|
263
|
+
* exist. A package's `exports` map publishes `registerModule`, its entities, its
|
|
264
|
+
* migrations and `./ports`; a container name it registers internally is
|
|
265
|
+
* published by none of them, so a deployment wrapping one is writing against a
|
|
266
|
+
* name the package never offered and can rename in a patch release.
|
|
267
|
+
* `check:port-shape` signal 3 already refuses a *module* resolving an
|
|
268
|
+
* unpublished container name — this is the same violation one level out. And
|
|
269
|
+
* feature 057's `tsc` contract gate does not transfer: there is no
|
|
270
|
+
* `*.interface.ts` here, so the compiler would hold the wrap to a `dist/*.d.ts`
|
|
271
|
+
* that moves under `pnpm update`, authored by someone the deployment does not
|
|
272
|
+
* employ.
|
|
273
|
+
*
|
|
274
|
+
* **Why it does not say "never".** D-106.2 has already committed the platform to
|
|
275
|
+
* third-party modules being first-class in schema; refusing decoration outright
|
|
276
|
+
* would make them second-class in behaviour with forking as the only recourse.
|
|
277
|
+
* The exit the owner named is a package **declaring** which of its registrations
|
|
278
|
+
* are decoratable — `./ports` is the natural home for it, where changing the
|
|
279
|
+
* shape costs a major bump — so the message says *not offered yet* rather than
|
|
280
|
+
* *forbidden*, and names it.
|
|
281
|
+
*
|
|
282
|
+
* **It also answers for a decorator that is not an overlay**, and that rules
|
|
283
|
+
* nothing D-176 left open. A core module or a second package wrapping a
|
|
284
|
+
* package's registration was refused before this error existed
|
|
285
|
+
* ({@link ForeignDecorationError}) and is refused after it; what moves is the
|
|
286
|
+
* reason the author is given, because `ForeignDecorationError`'s remedy is
|
|
287
|
+
* *"write it as an overlay module"* — advice that, for a package owner, leads
|
|
288
|
+
* straight back to this refusal.
|
|
289
|
+
*/
|
|
290
|
+
export class PackageDecorationNotOfferedError extends Error {
|
|
291
|
+
registrationName;
|
|
292
|
+
moduleId;
|
|
293
|
+
owner;
|
|
294
|
+
constructor(registrationName, moduleId,
|
|
295
|
+
/** The installed package's module id. */
|
|
296
|
+
owner) {
|
|
297
|
+
super(`[kernel] module '${moduleId}' cannot decorate '${registrationName}': '${owner}' is an ` +
|
|
298
|
+
`installed extension package, and wrapping a registration a package owns is not ` +
|
|
299
|
+
`offered yet. A deployment's overlay module may still wrap anything core or its own ` +
|
|
300
|
+
`overlay modules register — that seam is unchanged. What is missing for a package is ` +
|
|
301
|
+
`the declaration: its exports map publishes registerModule, its entities, its ` +
|
|
302
|
+
`migrations and './ports', and a container name it registers internally is published ` +
|
|
303
|
+
`by none of them — so this wrap would be written against a name '${owner}' never ` +
|
|
304
|
+
`offered and may rename in a patch release. The way this opens is for the package to ` +
|
|
305
|
+
`declare which of its registrations are decoratable, './ports' being the natural home ` +
|
|
306
|
+
`for it, where changing the shape costs a major version bump: ask its author for that ` +
|
|
307
|
+
`declaration. Until then, drop to the highest rung that works, in order: ` +
|
|
308
|
+
`rung 3, a strategy port '${owner}' publishes and you resolve with ` +
|
|
309
|
+
`lazyPort<T>(ctx, '<name>'); rung 2, ctx.interceptors around an endpoint it already ` +
|
|
310
|
+
`serves; rung 1, ctx.subscribe on an event it already emits. See ` +
|
|
311
|
+
`docs/docs/architecture/customisation-ladder.md.`);
|
|
312
|
+
this.registrationName = registrationName;
|
|
313
|
+
this.moduleId = moduleId;
|
|
314
|
+
this.owner = owner;
|
|
315
|
+
this.name = 'PackageDecorationNotOfferedError';
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
export function createDecorationQueue() {
|
|
319
|
+
const pending = [];
|
|
320
|
+
return {
|
|
321
|
+
pending,
|
|
322
|
+
enqueue(entry) {
|
|
323
|
+
pending.push(entry);
|
|
324
|
+
},
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
export function createDecorationLedger(decorationOrder = {}) {
|
|
328
|
+
const entries = [];
|
|
329
|
+
let counter = 0;
|
|
330
|
+
return {
|
|
331
|
+
entries,
|
|
332
|
+
innerNameFor(name) {
|
|
333
|
+
counter += 1;
|
|
334
|
+
return `${name}$undecorated$${counter}`;
|
|
335
|
+
},
|
|
336
|
+
record(name, moduleId, owner) {
|
|
337
|
+
const prior = entries.filter((entry) => entry.name === name);
|
|
338
|
+
const priorModules = [...new Set(prior.map((entry) => entry.moduleId))];
|
|
339
|
+
if (priorModules.some((id) => id !== moduleId)) {
|
|
340
|
+
const applied = [...new Set([...priorModules, moduleId])];
|
|
341
|
+
const declared = decorationOrder[name];
|
|
342
|
+
if (declared === undefined) {
|
|
343
|
+
throw new AmbiguousDecorationError(name, applied, 'no order is declared for it.');
|
|
344
|
+
}
|
|
345
|
+
const missing = applied.filter((id) => !declared.includes(id));
|
|
346
|
+
if (missing.length > 0) {
|
|
347
|
+
throw new AmbiguousDecorationError(name, applied, `the declared order omits ${missing.map((id) => `'${id}'`).join(', ')}.`);
|
|
348
|
+
}
|
|
349
|
+
// A declaration that does not bind is worse than none: it reads as a
|
|
350
|
+
// decision and behaves as a comment.
|
|
351
|
+
for (let i = 1; i < applied.length; i += 1) {
|
|
352
|
+
if (declared.indexOf(applied[i]) < declared.indexOf(applied[i - 1])) {
|
|
353
|
+
throw new AmbiguousDecorationError(name, applied, `they compose in the order ${applied.map((id) => `'${id}'`).join(' → ')}, which ` +
|
|
354
|
+
`contradicts the declared ${declared.map((id) => `'${id}'`).join(' → ')}.`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const entry = { name, moduleId, owner, depth: prior.length + 1 };
|
|
359
|
+
entries.push(entry);
|
|
360
|
+
return entry;
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
export function createRegistrationOwnership() {
|
|
365
|
+
const owners = new Map();
|
|
366
|
+
return {
|
|
367
|
+
claim(name, moduleId) {
|
|
368
|
+
const owner = owners.get(name);
|
|
369
|
+
if (owner !== undefined && owner !== moduleId) {
|
|
370
|
+
throw new DuplicateRegistrationError(name, owner, moduleId);
|
|
371
|
+
}
|
|
372
|
+
owners.set(name, moduleId);
|
|
373
|
+
},
|
|
374
|
+
ownerOf: (name) => owners.get(name),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
export function createModuleRegistrationSink() {
|
|
378
|
+
return {
|
|
379
|
+
plugins: [],
|
|
380
|
+
rootPlugins: [],
|
|
381
|
+
workers: [],
|
|
382
|
+
unsubscribes: [],
|
|
383
|
+
bootHooks: [],
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
export function createModuleContext(options) {
|
|
387
|
+
const { module, container, eventBus, sink, log, interceptorRegistry, ownership } = options;
|
|
388
|
+
const isRegistering = options.isRegistering ?? (() => false);
|
|
389
|
+
const isDeploymentOverlay = options.overlay === true;
|
|
390
|
+
const decorationQueue = options.decorationQueue;
|
|
391
|
+
const installedPackageModuleIds = options.installedPackageModuleIds ?? new Set();
|
|
392
|
+
/**
|
|
393
|
+
* Every name **this context** registered (issue #203).
|
|
394
|
+
*
|
|
395
|
+
* The ownership ledger is the composition's record and the authority
|
|
396
|
+
* wherever there is one, but a context built by hand carries none — and
|
|
397
|
+
* "no ledger" must not read as "no owner to compare", which would make the
|
|
398
|
+
* decoration rule off by construction for exactly the contexts a test
|
|
399
|
+
* builds. This answers the same question locally, and it cannot drift from
|
|
400
|
+
* the ledger: with a ledger present, every name in here is already claimed
|
|
401
|
+
* in it, so the fallback is unreachable.
|
|
402
|
+
*/
|
|
403
|
+
const ownRegistrations = new Set();
|
|
404
|
+
const decorations = options.decorations ?? createDecorationLedger();
|
|
405
|
+
/**
|
|
406
|
+
* Who owns `name` right now, as `decorate` has always asked it.
|
|
407
|
+
*
|
|
408
|
+
* `undefined` has two readings and only one of them is a hole: the name is
|
|
409
|
+
* not in the container at all (nobody owns it, and registering it is the
|
|
410
|
+
* ordinary case), or the container holds it and no module claimed it — which
|
|
411
|
+
* happens exactly when a composition root registered it. The callers below
|
|
412
|
+
* discriminate; this function does not, because the two questions share this
|
|
413
|
+
* one answer and duplicating it is how they would drift.
|
|
414
|
+
*/
|
|
415
|
+
const ownerOf = (name) => ownership?.ownerOf(name) ?? (ownRegistrations.has(name) ? module.id : undefined);
|
|
416
|
+
/**
|
|
417
|
+
* The registration half of the ownership rule (D-156.6).
|
|
418
|
+
*
|
|
419
|
+
* Three outcomes, and the order is the point:
|
|
420
|
+
*
|
|
421
|
+
* - another **module** owns the name — untouched, `claim` still throws
|
|
422
|
+
* `DuplicateRegistrationError`, which names both modules and tells the
|
|
423
|
+
* loser to decorate. That error can say things this one cannot;
|
|
424
|
+
* - a composition **root** supplies it — refused here, because there is no
|
|
425
|
+
* owner to ask for a seam and the names in that set are the platform's own;
|
|
426
|
+
* - nobody holds it — the ordinary case, and the one every registration in a
|
|
427
|
+
* bare-core composition takes: all 291 of them, against 17 root-supplied
|
|
428
|
+
* names, with an empty intersection measured in both roots.
|
|
429
|
+
*
|
|
430
|
+
* Asked before anything is claimed or written, so a refused batch leaves the
|
|
431
|
+
* container and the ownership ledger exactly as they were.
|
|
432
|
+
*/
|
|
433
|
+
const assertRegistrable = (name) => {
|
|
434
|
+
if (ownerOf(name) === undefined && container.hasRegistration(name)) {
|
|
435
|
+
throw new ForeignRegistrationError(name, module.id);
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* One proxy per context, over this module's own container. It is stable
|
|
440
|
+
* across calls so a module that captures `ctx.cradle()` during registration
|
|
441
|
+
* still hits the phase guard when it later reads a name off the captured
|
|
442
|
+
* object.
|
|
443
|
+
*/
|
|
444
|
+
const cradleProxy = new Proxy(Object.create(null), {
|
|
445
|
+
get(_target, property) {
|
|
446
|
+
// A symbol here is the runtime probing the object (`Symbol.toPrimitive`,
|
|
447
|
+
// `then` on an accidental await); no registration can carry that name.
|
|
448
|
+
if (typeof property === 'symbol')
|
|
449
|
+
return undefined;
|
|
450
|
+
if (isRegistering())
|
|
451
|
+
throw new EagerResolutionError(module.id, property);
|
|
452
|
+
// **A contribution to a registry that was never registered is dropped**
|
|
453
|
+
// (owner ruling, 2026-09-12; feature 117, A4). Asked here, at the
|
|
454
|
+
// container resolution, because this is where the throw comes from and
|
|
455
|
+
// because it is the only layer that needs no cooperation from the module:
|
|
456
|
+
// a contributor pushes without knowing whether the registry exists in
|
|
457
|
+
// this composition, which is the whole of the ruling.
|
|
458
|
+
//
|
|
459
|
+
// The conjunction is what keeps it from being "an unregistered name
|
|
460
|
+
// resolves to something": this module's **own** manifest must declare
|
|
461
|
+
// this exact name as `contributes-to`, and nothing in this composition
|
|
462
|
+
// may register it. A name nobody registers anywhere is still
|
|
463
|
+
// `check:port-dependencies`' `unowned-name` and still fails the build.
|
|
464
|
+
// See `contribution-sinks.ts` for the full reasoning and its bound.
|
|
465
|
+
if (isDeclaredContribution(module.id, property) &&
|
|
466
|
+
!container.hasRegistration(property)) {
|
|
467
|
+
return DROPPED_CONTRIBUTION_SINK;
|
|
468
|
+
}
|
|
469
|
+
return container.cradle[property];
|
|
470
|
+
},
|
|
471
|
+
has(_target, property) {
|
|
472
|
+
return typeof property === 'string' && container.hasRegistration(property);
|
|
473
|
+
},
|
|
474
|
+
});
|
|
475
|
+
return {
|
|
476
|
+
module,
|
|
477
|
+
di: {
|
|
478
|
+
register(registrations) {
|
|
479
|
+
// Two passes: every name is checked before any is claimed, so a batch
|
|
480
|
+
// holding one refused name registers none of the others.
|
|
481
|
+
for (const name of Object.keys(registrations))
|
|
482
|
+
assertRegistrable(name);
|
|
483
|
+
for (const name of Object.keys(registrations)) {
|
|
484
|
+
ownership?.claim(name, module.id);
|
|
485
|
+
ownRegistrations.add(name);
|
|
486
|
+
}
|
|
487
|
+
container.register(registrations);
|
|
488
|
+
},
|
|
489
|
+
providePort(name, registration) {
|
|
490
|
+
// The same claim, so the same guard: a port registration that skipped
|
|
491
|
+
// it would be the side door beside the side door.
|
|
492
|
+
assertRegistrable(name);
|
|
493
|
+
ownership?.claim(name, module.id);
|
|
494
|
+
ownRegistrations.add(name);
|
|
495
|
+
registerPort(container, module.id, name, registration);
|
|
496
|
+
},
|
|
497
|
+
/**
|
|
498
|
+
* **Enqueued here, applied at the drain** (D-176).
|
|
499
|
+
*
|
|
500
|
+
* This used to write the container while the registration pass was still
|
|
501
|
+
* running, and that made array order decide whether a decoration was
|
|
502
|
+
* possible at all: `composition.ts` passes overlays before packages, so a
|
|
503
|
+
* deployment's overlay wrapping an installed package's registration was
|
|
504
|
+
* refused because the name was not there *yet* — measured as T053(c)
|
|
505
|
+
* (!967). D-45 says registration order is meaningless because registration
|
|
506
|
+
* resolves nothing, which is true of every other seam and was not true of
|
|
507
|
+
* this one: `decorate` read and rewrote the container **without**
|
|
508
|
+
* resolving, so the `registering` guard never saw it.
|
|
509
|
+
*
|
|
510
|
+
* `AmbiguousDecorationError` in this same file already states the
|
|
511
|
+
* principle — *"it cannot be left to the order the modules happen to
|
|
512
|
+
* compose in"* — and the drain applies it here. One registration pass,
|
|
513
|
+
* then one drain: no sort, no dependency graph, and `hasRegistration`
|
|
514
|
+
* keeps its real job, which after the drain is the only thing it can
|
|
515
|
+
* mean — a decoration of a name nothing in the composition ever
|
|
516
|
+
* registers.
|
|
517
|
+
*
|
|
518
|
+
* A context with no queue (hand-built, or the post-registration one
|
|
519
|
+
* `contextFor` returns) applies at the call, exactly as before: there is
|
|
520
|
+
* no drain behind either, so queueing would be a wrap nobody applies.
|
|
521
|
+
*/
|
|
522
|
+
decorate(name, wrap) {
|
|
523
|
+
const apply = () => {
|
|
524
|
+
if (!container.hasRegistration(name)) {
|
|
525
|
+
throw new Error(`[kernel] module '${module.id}' cannot decorate '${name}': nothing is registered ` +
|
|
526
|
+
`under that name, by any module in this composition. Decoration wraps an ` +
|
|
527
|
+
`existing registration and is applied after every module has registered, so ` +
|
|
528
|
+
`this is not a question of order — check the spelling of the name, and that ` +
|
|
529
|
+
`the module that owns it is composed at all.`);
|
|
530
|
+
}
|
|
531
|
+
// Whose registration is this? Asked before anything is written, for
|
|
532
|
+
// the same reason the ambiguity check is: a refused decoration must
|
|
533
|
+
// leave the container as it was rather than half-wrapped.
|
|
534
|
+
//
|
|
535
|
+
// An owner of `undefined` means nobody claimed the name — a
|
|
536
|
+
// composition root registered it (`commandBus`, `auditLogService`,
|
|
537
|
+
// `redis`) — and for a module that is refused like any other foreign
|
|
538
|
+
// registration. Reading "unowned" as "fair game" would leave the
|
|
539
|
+
// highest-value targets in the platform the only undefended ones.
|
|
540
|
+
//
|
|
541
|
+
// `isDeploymentOverlay` is exempt from **both** halves, not just the
|
|
542
|
+
// core-owned one, and the condition says so by being name-unscoped: a
|
|
543
|
+
// deployment's overlay module may wrap `commandBus` too. That is the
|
|
544
|
+
// ruled behaviour (D-156.4) — a deployment owns its instance and is
|
|
545
|
+
// not the stranger this guard defends against — and it is why the flag
|
|
546
|
+
// is never the mechanism by which an installed *package* would be
|
|
547
|
+
// granted decoration. See `ForeignDecorationError`'s doc block; it is
|
|
548
|
+
// written out there rather than here because the older prose said
|
|
549
|
+
// otherwise and the next reader's instinct is to "fix" this line.
|
|
550
|
+
const owner = ownerOf(name);
|
|
551
|
+
if (owner !== module.id) {
|
|
552
|
+
// D-176 Q3, and it is asked **before** the overlay exemption
|
|
553
|
+
// because that exemption is exactly what it narrows: an installed
|
|
554
|
+
// package's registration is the one thing a deployment may not
|
|
555
|
+
// wrap. For every other decorator the answer was already "no" and
|
|
556
|
+
// stays "no" — only the reason improves, since
|
|
557
|
+
// `ForeignDecorationError` would send its reader to write an
|
|
558
|
+
// overlay module, which lands back here.
|
|
559
|
+
if (owner !== undefined && installedPackageModuleIds.has(owner)) {
|
|
560
|
+
throw new PackageDecorationNotOfferedError(name, module.id, owner);
|
|
561
|
+
}
|
|
562
|
+
if (!isDeploymentOverlay) {
|
|
563
|
+
throw new ForeignDecorationError(name, module.id, owner);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
decorations.record(name, module.id, owner);
|
|
567
|
+
const inner = container.getRegistration(name);
|
|
568
|
+
// Re-registering the previous resolver under a private name keeps the
|
|
569
|
+
// inner instance resolving through the SAME container or scope, so its
|
|
570
|
+
// lifetime is preserved and a chain of decorations composes cleanly.
|
|
571
|
+
// The name comes from the composition-wide ledger: a per-context
|
|
572
|
+
// counter would hand two modules' first decorations the same private
|
|
573
|
+
// name, and the second would overwrite the first's inner registration
|
|
574
|
+
// with the first's own wrapper — a chain that resolves into itself.
|
|
575
|
+
const innerName = decorations.innerNameFor(name);
|
|
576
|
+
container.register({ [innerName]: inner });
|
|
577
|
+
container.register({
|
|
578
|
+
// Preserve the inner registration's lifetime, so decorating does
|
|
579
|
+
// not silently turn a singleton into a per-resolution instance.
|
|
580
|
+
//
|
|
581
|
+
// An `asValue` resolver carries no `lifetime`, and reading that
|
|
582
|
+
// field alone is what used to kill the boot: `asValue` is the
|
|
583
|
+
// **pair** `{ resolve, isLeakSafe: true }`, and `isLeakSafe` is
|
|
584
|
+
// what `throwIfLifetimeLeakage` short-circuits on. A wrapper
|
|
585
|
+
// registered TRANSIENT drops the partner and asserts the one
|
|
586
|
+
// lifetime the pair never meant, so the first SINGLETON ancestor to
|
|
587
|
+
// resolve the name raised `AwilixResolutionError: … has a shorter
|
|
588
|
+
// lifetime than its ancestor` — measured on `commandBus` behind
|
|
589
|
+
// `catalog`, which is a name D-156.4 sanctions a deployment overlay
|
|
590
|
+
// wrapping by name (`specs/124-instance-customisation-gap/` FR-003).
|
|
591
|
+
//
|
|
592
|
+
// The pair means "root-resolved constant", which is SINGLETON: two
|
|
593
|
+
// resolutions give the same object, which is the whole contract of
|
|
594
|
+
// the name being wrapped, and a singleton is never a lifetime leak,
|
|
595
|
+
// so the strict check passes by construction rather than by being
|
|
596
|
+
// switched off. Every other inner keeps exactly what it had, and a
|
|
597
|
+
// wrap reaching for a genuinely scoped registration still throws.
|
|
598
|
+
[name]: isRootResolvedConstant(inner)
|
|
599
|
+
? asFunction((cradle) => wrap(cradle[innerName], cradle)).singleton()
|
|
600
|
+
: asFunction((cradle) => wrap(cradle[innerName], cradle)).setLifetime(inner.lifetime ?? Lifetime.TRANSIENT),
|
|
601
|
+
});
|
|
602
|
+
};
|
|
603
|
+
if (decorationQueue === undefined) {
|
|
604
|
+
apply();
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
decorationQueue.enqueue({ moduleId: module.id, name, apply });
|
|
608
|
+
},
|
|
609
|
+
},
|
|
610
|
+
asClass: (ctor) => asClass(ctor),
|
|
611
|
+
asFunction: (fn) => asFunction(fn),
|
|
612
|
+
asValue: (value) => asValue(value),
|
|
613
|
+
cradle: () => cradleProxy,
|
|
614
|
+
routes(register) {
|
|
615
|
+
sink.plugins.push(defineModuleRoutes(module.id, register));
|
|
616
|
+
},
|
|
617
|
+
ungatedRoutes(reason, register) {
|
|
618
|
+
if (reason.trim().length === 0) {
|
|
619
|
+
throw new Error(`[kernel] module '${module.id}' registered ungated routes without a reason. ` +
|
|
620
|
+
`Gating is the default; the exemption exists for surfaces that report on the ` +
|
|
621
|
+
`platform itself (liveness and readiness probes, module presence), which cannot ` +
|
|
622
|
+
`be gated on a part of the platform without becoming circular. State which one ` +
|
|
623
|
+
`this is, or use ctx.routes().`);
|
|
624
|
+
}
|
|
625
|
+
// The same encapsulated child context `defineModuleRoutes` uses, minus
|
|
626
|
+
// the `onRequest` gate — so the only difference between the two seams is
|
|
627
|
+
// the one this exemption is about.
|
|
628
|
+
sink.plugins.push(async (app) => {
|
|
629
|
+
await app.register(async (scoped) => {
|
|
630
|
+
await register(scoped);
|
|
631
|
+
});
|
|
632
|
+
});
|
|
633
|
+
},
|
|
634
|
+
rootPlugin(reason, plugin) {
|
|
635
|
+
if (reason.trim().length === 0) {
|
|
636
|
+
throw new Error(`[kernel] module '${module.id}' registered a root plugin without a reason. ` +
|
|
637
|
+
`This is the one seam that reaches every other module, so it states what it ` +
|
|
638
|
+
`decorates and why that cannot live inside the module's own context.`);
|
|
639
|
+
}
|
|
640
|
+
sink.rootPlugins.push(plugin);
|
|
641
|
+
},
|
|
642
|
+
worker(worker, workerOptions) {
|
|
643
|
+
const registered = defineModuleWorker(module.id, worker, workerOptions);
|
|
644
|
+
sink.workers.push(registered);
|
|
645
|
+
return registered;
|
|
646
|
+
},
|
|
647
|
+
subscribe(event, handler) {
|
|
648
|
+
sink.unsubscribes.push(subscribeForModule(module.id, eventBus, event, handler));
|
|
649
|
+
},
|
|
650
|
+
interceptors(entries) {
|
|
651
|
+
if (!interceptorRegistry) {
|
|
652
|
+
throw new Error(`[kernel] module '${module.id}' registered an API interceptor, but this composition ` +
|
|
653
|
+
`root mounts no interceptor registry.`);
|
|
654
|
+
}
|
|
655
|
+
for (const entry of entries) {
|
|
656
|
+
interceptorRegistry.register({ ...entry, module: module.id });
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
onBoot(hook) {
|
|
660
|
+
sink.bootHooks.push(hook);
|
|
661
|
+
},
|
|
662
|
+
// Issue #269 — attribution and request correlation are applied here, over
|
|
663
|
+
// whatever destination the root passed, so they hold for every root and for
|
|
664
|
+
// a context built by hand in a test. The composer's own lines (the
|
|
665
|
+
// decoration report) are the composition's, not a module's, and go to the
|
|
666
|
+
// unwrapped `log`.
|
|
667
|
+
log: moduleLogger(module.id, log),
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
//# sourceMappingURL=module-context.js.map
|