@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,234 @@
|
|
|
1
|
+
import type { EventBus } from '../events/bus.js';
|
|
2
|
+
import type { ApiInterceptorRegistry } from '../http/interceptors/index.js';
|
|
3
|
+
import { type KernelContainer } from './container.js';
|
|
4
|
+
import { type RequiredModule } from './lifecycle/required-modules.js';
|
|
5
|
+
import { type DecorationLedger, type DecorationRecord, type ModuleContext, type ModuleRegistrationSink, type RegistrationOwnership } from './module-context.js';
|
|
6
|
+
import type { PlatformLogger } from './logging.js';
|
|
7
|
+
export { AmbiguousDecorationError, ForeignDecorationError, PackageDecorationNotOfferedError, type DecorationLedger, type DecorationRecord, } from './module-context.js';
|
|
8
|
+
/**
|
|
9
|
+
* The composition seam (feature 072, T042/T043).
|
|
10
|
+
*
|
|
11
|
+
* `registerModule` is what a module writes; this is what runs it. Everything a
|
|
12
|
+
* composition root needs to know about a module is the three fields of
|
|
13
|
+
* {@link ModuleEntry} — which is what makes the list generatable in Phase 5,
|
|
14
|
+
* and what makes removing a module a deletion rather than an archaeology
|
|
15
|
+
* exercise.
|
|
16
|
+
*
|
|
17
|
+
* Two invariants are enforced here rather than left to review, because both
|
|
18
|
+
* fail silently otherwise:
|
|
19
|
+
*
|
|
20
|
+
* 1. **One owner per registration name.** Otherwise which implementation the
|
|
21
|
+
* platform runs depends on the order the composer happens to emit.
|
|
22
|
+
* 2. **Registration resolves nothing.** At the moment a module registers, the
|
|
23
|
+
* modules after it have not registered yet, so an eager resolution either
|
|
24
|
+
* throws or — worse — succeeds today and breaks when the topological order
|
|
25
|
+
* changes for an unrelated reason.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* A module failed while the composer was running it (T053).
|
|
29
|
+
*
|
|
30
|
+
* The composer is the only place that knows *which* module is executing, so it
|
|
31
|
+
* is the only place that can say so. Without this, a boot failure reads
|
|
32
|
+
* `AwilixResolutionError: Could not resolve 'assetReferenceRegistry'` — a name,
|
|
33
|
+
* with no indication of which of the modules wanted it — and the operator's
|
|
34
|
+
* first move is to grep for a string that appears in six files.
|
|
35
|
+
*
|
|
36
|
+
* The kernel's own composition errors ({@link DuplicateRegistrationError},
|
|
37
|
+
* {@link EagerResolutionError}) already name the module (and, for a collision,
|
|
38
|
+
* both of them), so they propagate untouched rather than being wrapped twice.
|
|
39
|
+
*/
|
|
40
|
+
export declare class ModuleCompositionError extends Error {
|
|
41
|
+
readonly moduleId: string;
|
|
42
|
+
readonly phase: 'register' | 'decorate' | 'boot';
|
|
43
|
+
readonly cause: unknown;
|
|
44
|
+
constructor(moduleId: string, phase: 'register' | 'decorate' | 'boot', cause: unknown);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* A root contributed outside the contribution window (issue #52).
|
|
48
|
+
*
|
|
49
|
+
* The window is the single slot between `composeModules(MODULES, …)` and
|
|
50
|
+
* `runBootHooks()` (D-45), and both of its edges used to be a convention two
|
|
51
|
+
* composition roots had to remember identically. {@link ComposedModules.contribute}
|
|
52
|
+
* makes the early edge structural — there is nothing to call the method on until
|
|
53
|
+
* the registration pass is over — and this makes the late edge loud.
|
|
54
|
+
*/
|
|
55
|
+
export declare class ContributionWindowClosedError extends Error {
|
|
56
|
+
readonly names: readonly string[];
|
|
57
|
+
constructor(names: readonly string[]);
|
|
58
|
+
}
|
|
59
|
+
/** What the composer knows about one module. Nothing else about it is reachable. */
|
|
60
|
+
export interface ModuleEntry {
|
|
61
|
+
/** The manifest id. Injected here, never hard-coded inside the module (FR-031). */
|
|
62
|
+
readonly id: string;
|
|
63
|
+
/** The manifest version. */
|
|
64
|
+
readonly version: string;
|
|
65
|
+
readonly registerModule: (ctx: ModuleContext) => void;
|
|
66
|
+
/**
|
|
67
|
+
* This entry is one of the active **deployment's** overlay modules, found
|
|
68
|
+
* under `backend/src/apps/<deployment>/modules/` (issue #203).
|
|
69
|
+
*
|
|
70
|
+
* Absent for every core module, and the generated composer is what sets it —
|
|
71
|
+
* from the root the module was discovered under, never from anything the
|
|
72
|
+
* module says about itself. It exempts the module from the ownership rule on
|
|
73
|
+
* `ctx.di.decorate`, which is why it is a location and not a declaration.
|
|
74
|
+
*/
|
|
75
|
+
readonly overlay?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* This entry came from an **installed extension package**, not from this
|
|
78
|
+
* repository's tree (D-176 Q3).
|
|
79
|
+
*
|
|
80
|
+
* Set by the host's package loader from where it found the package, never by
|
|
81
|
+
* the package — the same rule `overlay` follows, and for the mirror-image
|
|
82
|
+
* purpose: `overlay` grants the decoration exemption, this **withholds** one.
|
|
83
|
+
* A deployment's overlay may wrap anything core registers and not a
|
|
84
|
+
* registration a package owns, because nothing in a package's `exports` map
|
|
85
|
+
* publishes the container names it registers internally. See
|
|
86
|
+
* {@link PackageDecorationNotOfferedError}.
|
|
87
|
+
*
|
|
88
|
+
* It is a separate field rather than `overlay` widened to an origin enum
|
|
89
|
+
* (D-156.4): one flag that both grants and refuses is one flag away from
|
|
90
|
+
* granting a stranger the audit path.
|
|
91
|
+
*/
|
|
92
|
+
readonly installedPackage?: boolean;
|
|
93
|
+
}
|
|
94
|
+
export interface ComposeModulesOptions {
|
|
95
|
+
readonly container: KernelContainer;
|
|
96
|
+
readonly eventBus: EventBus;
|
|
97
|
+
readonly log: PlatformLogger;
|
|
98
|
+
/** Absent in composition roots that mount no interceptor surface. */
|
|
99
|
+
readonly interceptorRegistry?: ApiInterceptorRegistry | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Share one ledger across several `composeModules` calls — which is what a
|
|
102
|
+
* root does while modules are converted one batch at a time, so a converted
|
|
103
|
+
* module still collides with a converted module composed in another call.
|
|
104
|
+
*/
|
|
105
|
+
readonly ownership?: RegistrationOwnership | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Share one decoration ledger across several `composeModules` calls, for the
|
|
108
|
+
* same reason `ownership` is shared: a client module composed in a later call
|
|
109
|
+
* still wraps a registration an earlier call decorated.
|
|
110
|
+
*/
|
|
111
|
+
readonly decorations?: DecorationLedger | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Declared wrapping order per registration name, reaching the composer as
|
|
114
|
+
* data.
|
|
115
|
+
*
|
|
116
|
+
* Only needed where **two different modules** decorate one name; below that
|
|
117
|
+
* there is nothing to decide. It is checked rather than applied: the composer
|
|
118
|
+
* emits modules in topological order, so the declaration's job is to say that
|
|
119
|
+
* this order is the intended one, and composition fails when the two
|
|
120
|
+
* disagree.
|
|
121
|
+
*
|
|
122
|
+
* **Both composition roots pass it**, from the deployment's own
|
|
123
|
+
* `backend/src/apps/<deployment>/divergence.ts` (feature 107, FR-040/FR-041).
|
|
124
|
+
* The declaration is a hand-written, reviewed file in the deployment's tree;
|
|
125
|
+
* `loadDivergenceDeclaration` reads it and each root hands the field over as
|
|
126
|
+
* data, in the shape `requiredModules` and `activationDeclarations` already
|
|
127
|
+
* have — the composer is given the answer and never reads a file.
|
|
128
|
+
*
|
|
129
|
+
* It was a seam with **no** supply until then (D-156.7): the field was written
|
|
130
|
+
* against `endora.config.ts`'s `overrides.order` (D-28), an instance-repository
|
|
131
|
+
* artefact scheduled for F11 that the owner has since ruled will not be built,
|
|
132
|
+
* so a deployment shipping two overlay modules that decorate one name got
|
|
133
|
+
* `AmbiguousDecorationError` and could not declare its way out. That failed
|
|
134
|
+
* closed, so nothing was unsafe; it was a dead end wearing an instruction, and
|
|
135
|
+
* this paragraph carried the coupling — *"the day a root starts passing this,
|
|
136
|
+
* that message is what has to change with it"*. It changed with it:
|
|
137
|
+
* `AmbiguousDecorationError` now names this field and that file.
|
|
138
|
+
*
|
|
139
|
+
* Three shapes the *report's* check refuses, because they describe nothing and
|
|
140
|
+
* will describe the wrong thing later: an entry for a name no two overlay
|
|
141
|
+
* modules decorate, an entry naming a module that is not one of this
|
|
142
|
+
* deployment's, and an entry naming fewer modules than decorate that name.
|
|
143
|
+
* They are `check:divergence`'s and not this composer's, because a stale
|
|
144
|
+
* ordering is a merge-request question while an ambiguity is a correctness one.
|
|
145
|
+
*/
|
|
146
|
+
readonly decorationOrder?: Readonly<Record<string, readonly string[]>> | undefined;
|
|
147
|
+
/**
|
|
148
|
+
* The modules this composition is required to have — issue #258, and see
|
|
149
|
+
* `lifecycle/required-modules.ts` for the whole reasoning.
|
|
150
|
+
*
|
|
151
|
+
* A root derives it with `requiredModulesFrom(manifests)` and hands it over as
|
|
152
|
+
* data, for the same reason `activationDeclarationsFrom` exists: the composer
|
|
153
|
+
* is given three fields per module and may not read a manifest. Deriving it is
|
|
154
|
+
* the root's job; there is no list anywhere, so withdrawing a lock changes
|
|
155
|
+
* this refusal in the same run (D-100).
|
|
156
|
+
*
|
|
157
|
+
* Omitting it means *this composition requires nothing*, which is the honest
|
|
158
|
+
* answer for a fixture composing two modules that do not exist. Every root
|
|
159
|
+
* that composes the platform passes it, and `harness-parity.test.ts` is what
|
|
160
|
+
* keeps the two from drifting apart on it.
|
|
161
|
+
*/
|
|
162
|
+
readonly requiredModules?: readonly RequiredModule[] | undefined;
|
|
163
|
+
}
|
|
164
|
+
export interface ComposedModules {
|
|
165
|
+
/** Everything the modules contributed, in registration order. */
|
|
166
|
+
readonly sink: ModuleRegistrationSink;
|
|
167
|
+
/** Which module registered `name`, for diagnostics and for the duplicate report. */
|
|
168
|
+
ownerOf(name: string): string | undefined;
|
|
169
|
+
/**
|
|
170
|
+
* The override report (T065): every decoration this composition applied, in
|
|
171
|
+
* application order, innermost first.
|
|
172
|
+
*
|
|
173
|
+
* A build's customisations should be readable from the build, not inferred
|
|
174
|
+
* from which files happen to exist on disk. Empty means a bare-core build,
|
|
175
|
+
* and it means it explicitly.
|
|
176
|
+
*/
|
|
177
|
+
readonly decorations: readonly DecorationRecord[];
|
|
178
|
+
/**
|
|
179
|
+
* The **contribution window** (D-45, issue #52): the one slot where a root
|
|
180
|
+
* may write a name a module has defaulted.
|
|
181
|
+
*
|
|
182
|
+
* Register it earlier and the module's own registration overwrites it;
|
|
183
|
+
* register it later and a boot hook has already read the default. Both edges
|
|
184
|
+
* are enforced by the shape rather than remembered: the early one because
|
|
185
|
+
* this object does not exist until every module has registered, the late one
|
|
186
|
+
* because the method refuses once {@link runBootHooks} has started
|
|
187
|
+
* ({@link ContributionWindowClosedError}).
|
|
188
|
+
*
|
|
189
|
+
* Host values **no module defaults** — the Redis client, the EventBus, a
|
|
190
|
+
* deployment flag — have no window at all and are registered with
|
|
191
|
+
* `registerValues` where they come into existence. The window is about
|
|
192
|
+
* overwriting, and there is nothing to overwrite.
|
|
193
|
+
*/
|
|
194
|
+
contribute(values: Readonly<Record<string, unknown>>): void;
|
|
195
|
+
/**
|
|
196
|
+
* A **post-registration** `ModuleContext` for one composed module — D-157.7,
|
|
197
|
+
* beside `ownerOf` and `contribute`, which are the two accessors this object
|
|
198
|
+
* already exists to provide.
|
|
199
|
+
*
|
|
200
|
+
* It exists for the host's CLI runner (D-160.9): a module-declared command
|
|
201
|
+
* receives a `ModuleContext`, not a cradle, so its body resolves with
|
|
202
|
+
* `lazyPort<T>(ctx, 'literalName')` — character-for-character what
|
|
203
|
+
* `backend.ts` writes, which is what keeps `check:port-dependencies` able to
|
|
204
|
+
* see the edge. A `scope.cradle.someForeignPort` read would be an undeclared
|
|
205
|
+
* port edge that reports clean.
|
|
206
|
+
*
|
|
207
|
+
* Two properties of the context it returns, both deliberate:
|
|
208
|
+
*
|
|
209
|
+
* - `isRegistering` is **false**, so the phase guard permits resolution.
|
|
210
|
+
* That is the whole difference from the context `registerModule` was
|
|
211
|
+
* given, and it is correct here: every module has registered.
|
|
212
|
+
* - its registration **sink is a throwaway**. A command is invoked after the
|
|
213
|
+
* composition is built, so a route or a worker pushed into it is read by
|
|
214
|
+
* nobody. The sink is not shared with the composition's, so a command
|
|
215
|
+
* cannot half-register a surface into a running platform either.
|
|
216
|
+
*
|
|
217
|
+
* @throws {Error} when `moduleId` is not one of the composed entries — a
|
|
218
|
+
* caller asking for a context by id has to be told the id is wrong, rather
|
|
219
|
+
* than handed a context for a module that is not there.
|
|
220
|
+
*/
|
|
221
|
+
contextFor(moduleId: string): ModuleContext;
|
|
222
|
+
/**
|
|
223
|
+
* Run the explicit boot phase (FR-021): every module's `onBoot` hook, in
|
|
224
|
+
* registration order, each inside its own `enterSystemScope`.
|
|
225
|
+
*
|
|
226
|
+
* A boot hook is the one place a module may do composition-time work that
|
|
227
|
+
* resolves — so it runs after **every** module has registered, and never as a
|
|
228
|
+
* side effect of route attachment, which a `BACKEND_ROLE=worker` process
|
|
229
|
+
* would never reach.
|
|
230
|
+
*/
|
|
231
|
+
runBootHooks(): Promise<void>;
|
|
232
|
+
}
|
|
233
|
+
export declare function composeModules(entries: readonly ModuleEntry[], options: ComposeModulesOptions): ComposedModules;
|
|
234
|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B,EAAE,CAAC;IAClD;;;;;;;;;;;;;;;OAeG;IACH,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;IAC5C;;;;;;;;OAQG;IACH,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,OAAO,EAAE,qBAAqB,GAC7B,eAAe,CA2MjB"}
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { registerValues } from './container.js';
|
|
2
|
+
import { effectiveState } from './lifecycle/effective-state.js';
|
|
3
|
+
import { assertRequiredModulesPresent, } from './lifecycle/required-modules.js';
|
|
4
|
+
import { assertUniqueModuleIds } from './lifecycle/unique-module-ids.js';
|
|
5
|
+
import { enterSystemScope } from './scope.js';
|
|
6
|
+
import { AmbiguousDecorationError, DuplicateRegistrationError, EagerResolutionError, ForeignDecorationError, PackageDecorationNotOfferedError, createDecorationLedger, createDecorationQueue, createModuleContext, createModuleRegistrationSink, createRegistrationOwnership, } from './module-context.js';
|
|
7
|
+
export { AmbiguousDecorationError, ForeignDecorationError, PackageDecorationNotOfferedError, } from './module-context.js';
|
|
8
|
+
/**
|
|
9
|
+
* The composition seam (feature 072, T042/T043).
|
|
10
|
+
*
|
|
11
|
+
* `registerModule` is what a module writes; this is what runs it. Everything a
|
|
12
|
+
* composition root needs to know about a module is the three fields of
|
|
13
|
+
* {@link ModuleEntry} — which is what makes the list generatable in Phase 5,
|
|
14
|
+
* and what makes removing a module a deletion rather than an archaeology
|
|
15
|
+
* exercise.
|
|
16
|
+
*
|
|
17
|
+
* Two invariants are enforced here rather than left to review, because both
|
|
18
|
+
* fail silently otherwise:
|
|
19
|
+
*
|
|
20
|
+
* 1. **One owner per registration name.** Otherwise which implementation the
|
|
21
|
+
* platform runs depends on the order the composer happens to emit.
|
|
22
|
+
* 2. **Registration resolves nothing.** At the moment a module registers, the
|
|
23
|
+
* modules after it have not registered yet, so an eager resolution either
|
|
24
|
+
* throws or — worse — succeeds today and breaks when the topological order
|
|
25
|
+
* changes for an unrelated reason.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* A module failed while the composer was running it (T053).
|
|
29
|
+
*
|
|
30
|
+
* The composer is the only place that knows *which* module is executing, so it
|
|
31
|
+
* is the only place that can say so. Without this, a boot failure reads
|
|
32
|
+
* `AwilixResolutionError: Could not resolve 'assetReferenceRegistry'` — a name,
|
|
33
|
+
* with no indication of which of the modules wanted it — and the operator's
|
|
34
|
+
* first move is to grep for a string that appears in six files.
|
|
35
|
+
*
|
|
36
|
+
* The kernel's own composition errors ({@link DuplicateRegistrationError},
|
|
37
|
+
* {@link EagerResolutionError}) already name the module (and, for a collision,
|
|
38
|
+
* both of them), so they propagate untouched rather than being wrapped twice.
|
|
39
|
+
*/
|
|
40
|
+
export class ModuleCompositionError extends Error {
|
|
41
|
+
moduleId;
|
|
42
|
+
phase;
|
|
43
|
+
cause;
|
|
44
|
+
constructor(moduleId, phase, cause) {
|
|
45
|
+
const detail = cause instanceof Error ? cause.message : String(cause);
|
|
46
|
+
super(phase === 'register'
|
|
47
|
+
? `[kernel] module '${moduleId}' failed while registering: ${detail}`
|
|
48
|
+
: phase === 'decorate'
|
|
49
|
+
? // D-176 — a decoration is applied at the drain, after the last
|
|
50
|
+
// module has registered, so a failure in one is no longer inside
|
|
51
|
+
// the decorating module's `registerModule`. The phase says so
|
|
52
|
+
// rather than borrowing 'register', which would attribute the
|
|
53
|
+
// failure to a call that had already returned.
|
|
54
|
+
`[kernel] module '${moduleId}' failed while its decoration was applied: ${detail}`
|
|
55
|
+
: `[kernel] module '${moduleId}' failed in its boot hook: ${detail}`);
|
|
56
|
+
this.moduleId = moduleId;
|
|
57
|
+
this.phase = phase;
|
|
58
|
+
this.cause = cause;
|
|
59
|
+
this.name = 'ModuleCompositionError';
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A root contributed outside the contribution window (issue #52).
|
|
64
|
+
*
|
|
65
|
+
* The window is the single slot between `composeModules(MODULES, …)` and
|
|
66
|
+
* `runBootHooks()` (D-45), and both of its edges used to be a convention two
|
|
67
|
+
* composition roots had to remember identically. {@link ComposedModules.contribute}
|
|
68
|
+
* makes the early edge structural — there is nothing to call the method on until
|
|
69
|
+
* the registration pass is over — and this makes the late edge loud.
|
|
70
|
+
*/
|
|
71
|
+
export class ContributionWindowClosedError extends Error {
|
|
72
|
+
names;
|
|
73
|
+
constructor(names) {
|
|
74
|
+
super(`[kernel] contribution outside the window: ${names.join(', ')}. ` +
|
|
75
|
+
'A root contribution over a name a module defaults goes between ' +
|
|
76
|
+
'`composeModules(MODULES, …)` and `runBootHooks()` (D-45). The boot phase has ' +
|
|
77
|
+
'already started, so a hook may have read the default this was meant to replace ' +
|
|
78
|
+
'— move the `contribute(…)` call above `runBootHooks()`.');
|
|
79
|
+
this.names = names;
|
|
80
|
+
this.name = 'ContributionWindowClosedError';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/** Both already carry the module id; wrapping them would only bury it. */
|
|
84
|
+
function alreadyNamesTheModule(error) {
|
|
85
|
+
return (error instanceof DuplicateRegistrationError ||
|
|
86
|
+
error instanceof EagerResolutionError ||
|
|
87
|
+
error instanceof AmbiguousDecorationError ||
|
|
88
|
+
error instanceof ForeignDecorationError ||
|
|
89
|
+
error instanceof PackageDecorationNotOfferedError);
|
|
90
|
+
}
|
|
91
|
+
export function composeModules(entries, options) {
|
|
92
|
+
// T030c / D-155.7 — module id uniqueness, in the same slot and for the same
|
|
93
|
+
// reason as the refusal below: both answers exist already, and a composition
|
|
94
|
+
// that is going to be refused must not half-run first. Unconditional, because
|
|
95
|
+
// there is no composition in which two entries claiming one id is a coherent
|
|
96
|
+
// request — see `lifecycle/unique-module-ids.ts` for what used to happen
|
|
97
|
+
// instead.
|
|
98
|
+
assertUniqueModuleIds(entries.map((entry) => entry.id));
|
|
99
|
+
// Issue #258 — before the first module registers, because both answers this
|
|
100
|
+
// needs exist already and nothing it could refuse is worth half-doing. It has
|
|
101
|
+
// to land ahead of the boot phase, which is where the failure it prevents
|
|
102
|
+
// surfaces (as `invoices` failing in a hook, naming the wrong module and no
|
|
103
|
+
// remedy); ahead of the *registration* phase is simply the earliest point
|
|
104
|
+
// that is still ahead of it.
|
|
105
|
+
//
|
|
106
|
+
// A composition passing no `requiredModules` requires nothing and is left
|
|
107
|
+
// alone: the presence singleton is process-wide and has nothing to do with a
|
|
108
|
+
// fixture composing two modules that do not exist.
|
|
109
|
+
if (options.requiredModules && options.requiredModules.length > 0) {
|
|
110
|
+
assertRequiredModulesPresent(options.requiredModules, new Set(entries.map((entry) => entry.id)), effectiveState);
|
|
111
|
+
}
|
|
112
|
+
const combined = createModuleRegistrationSink();
|
|
113
|
+
const ownership = options.ownership ?? createRegistrationOwnership();
|
|
114
|
+
const decorations = options.decorations ?? createDecorationLedger(options.decorationOrder ?? {});
|
|
115
|
+
const bootHooks = [];
|
|
116
|
+
// D-176 — every `ctx.di.decorate` of this pass lands here and is applied
|
|
117
|
+
// below, once the last module has registered.
|
|
118
|
+
const decorationQueue = createDecorationQueue();
|
|
119
|
+
// D-176 Q3 — which of these entries a stranger shipped. Derived from the
|
|
120
|
+
// entries the root handed over, so a package cannot answer for itself, and
|
|
121
|
+
// read only by the decoration guard.
|
|
122
|
+
const installedPackageModuleIds = new Set(entries.filter((entry) => entry.installedPackage === true).map((entry) => entry.id));
|
|
123
|
+
// Read by every context this call creates, so the phase guard covers the
|
|
124
|
+
// whole pass rather than one module at a time: module A resolving something
|
|
125
|
+
// module B registers is exactly the order-dependence being forbidden.
|
|
126
|
+
let registering = true;
|
|
127
|
+
try {
|
|
128
|
+
for (const entry of entries) {
|
|
129
|
+
const sink = createModuleRegistrationSink();
|
|
130
|
+
const ctx = createModuleContext({
|
|
131
|
+
module: { id: entry.id, version: entry.version },
|
|
132
|
+
container: options.container,
|
|
133
|
+
eventBus: options.eventBus,
|
|
134
|
+
sink,
|
|
135
|
+
log: options.log,
|
|
136
|
+
ownership,
|
|
137
|
+
decorations,
|
|
138
|
+
decorationQueue,
|
|
139
|
+
installedPackageModuleIds,
|
|
140
|
+
isRegistering: () => registering,
|
|
141
|
+
...(entry.overlay === undefined ? {} : { overlay: entry.overlay }),
|
|
142
|
+
...(options.interceptorRegistry
|
|
143
|
+
? { interceptorRegistry: options.interceptorRegistry }
|
|
144
|
+
: {}),
|
|
145
|
+
});
|
|
146
|
+
try {
|
|
147
|
+
entry.registerModule(ctx);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
if (alreadyNamesTheModule(err))
|
|
151
|
+
throw err;
|
|
152
|
+
throw new ModuleCompositionError(entry.id, 'register', err);
|
|
153
|
+
}
|
|
154
|
+
combined.plugins.push(...sink.plugins);
|
|
155
|
+
combined.rootPlugins.push(...sink.rootPlugins);
|
|
156
|
+
combined.workers.push(...sink.workers);
|
|
157
|
+
combined.unsubscribes.push(...sink.unsubscribes);
|
|
158
|
+
for (const hook of sink.bootHooks)
|
|
159
|
+
bootHooks.push({ moduleId: entry.id, hook });
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
finally {
|
|
163
|
+
registering = false;
|
|
164
|
+
}
|
|
165
|
+
// ---- The decoration drain (D-176) ---------------------------------------
|
|
166
|
+
//
|
|
167
|
+
// One registration pass, then one drain. Every `ctx.di.decorate` of the pass
|
|
168
|
+
// above was queued rather than applied, so what a decoration can reach no
|
|
169
|
+
// longer depends on where its module sat in the array — which is what makes
|
|
170
|
+
// D-45's sentence true of this seam as well: registration order is
|
|
171
|
+
// meaningless, and `decorate` was the one operation that read and rewrote the
|
|
172
|
+
// container without resolving anything, so the `registering` guard never saw
|
|
173
|
+
// the dependency it created.
|
|
174
|
+
//
|
|
175
|
+
// In the queue's own order, deliberately. `AmbiguousDecorationError` exempts
|
|
176
|
+
// a module that decorates one name twice because it wrote both wraps in the
|
|
177
|
+
// order it wrote them, and a queue keeps that for free.
|
|
178
|
+
//
|
|
179
|
+
// Nothing is sorted and nothing is grouped: the drain removes the
|
|
180
|
+
// *dependency* on order, not the order. Two different modules decorating one
|
|
181
|
+
// name is still refused unless the composition declares which wraps which.
|
|
182
|
+
for (const pending of decorationQueue.pending) {
|
|
183
|
+
try {
|
|
184
|
+
pending.apply();
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
// The kernel's own decoration refusals name the module already; anything
|
|
188
|
+
// else — a wrap that threw while building — is attributed to the module
|
|
189
|
+
// that wrote it, which is the fact the queued entry carries for exactly
|
|
190
|
+
// this reason.
|
|
191
|
+
if (alreadyNamesTheModule(err))
|
|
192
|
+
throw err;
|
|
193
|
+
throw new ModuleCompositionError(pending.moduleId, 'decorate', err);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
// The report is emitted, not merely available: a deployment running a client
|
|
197
|
+
// override should say so once at boot, in the same place the operator already
|
|
198
|
+
// reads what the platform composed.
|
|
199
|
+
if (decorations.entries.length > 0) {
|
|
200
|
+
options.log.info({
|
|
201
|
+
overrides: decorations.entries.map((entry) => ({
|
|
202
|
+
registration: entry.name,
|
|
203
|
+
decoratedBy: entry.moduleId,
|
|
204
|
+
owner: entry.owner ?? null,
|
|
205
|
+
depth: entry.depth,
|
|
206
|
+
})),
|
|
207
|
+
}, 'kernel.decorations');
|
|
208
|
+
}
|
|
209
|
+
// Closed by the boot phase rather than by the end of it: hooks run in
|
|
210
|
+
// registration order, so a contribution made from inside one is already
|
|
211
|
+
// invisible to every hook that ran before it.
|
|
212
|
+
let contributionWindowOpen = true;
|
|
213
|
+
return {
|
|
214
|
+
sink: combined,
|
|
215
|
+
ownerOf: (name) => ownership.ownerOf(name),
|
|
216
|
+
decorations: decorations.entries,
|
|
217
|
+
contextFor(moduleId) {
|
|
218
|
+
const entry = entries.find((candidate) => candidate.id === moduleId);
|
|
219
|
+
if (entry === undefined) {
|
|
220
|
+
throw new Error(`[kernel] no module '${moduleId}' in this composition, so there is no context to ` +
|
|
221
|
+
`build for it. Composed: ${entries.map((e) => e.id).join(', ')}.`);
|
|
222
|
+
}
|
|
223
|
+
return createModuleContext({
|
|
224
|
+
module: { id: entry.id, version: entry.version },
|
|
225
|
+
container: options.container,
|
|
226
|
+
eventBus: options.eventBus,
|
|
227
|
+
// Throwaway — see the interface comment. Nothing reads it, and that is
|
|
228
|
+
// better than handing over the composition's, which a command could
|
|
229
|
+
// push a route into after the server was built.
|
|
230
|
+
sink: createModuleRegistrationSink(),
|
|
231
|
+
log: options.log,
|
|
232
|
+
ownership,
|
|
233
|
+
decorations,
|
|
234
|
+
// No queue, and that is the honest shape: the drain has already run, so
|
|
235
|
+
// a decoration written from a command's context applies at the call —
|
|
236
|
+
// which is what it did before D-176 and what it must keep doing, since
|
|
237
|
+
// queueing it would be a wrap nobody ever applies. The guards are
|
|
238
|
+
// unchanged either way, `installedPackageModuleIds` included.
|
|
239
|
+
installedPackageModuleIds,
|
|
240
|
+
// The one difference from the registration pass: every module has
|
|
241
|
+
// registered, so resolving is exactly what this context is for.
|
|
242
|
+
isRegistering: () => false,
|
|
243
|
+
...(entry.overlay === undefined ? {} : { overlay: entry.overlay }),
|
|
244
|
+
...(options.interceptorRegistry
|
|
245
|
+
? { interceptorRegistry: options.interceptorRegistry }
|
|
246
|
+
: {}),
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
contribute(values) {
|
|
250
|
+
if (!contributionWindowOpen) {
|
|
251
|
+
throw new ContributionWindowClosedError(Object.keys(values));
|
|
252
|
+
}
|
|
253
|
+
registerValues(options.container, values);
|
|
254
|
+
},
|
|
255
|
+
async runBootHooks() {
|
|
256
|
+
contributionWindowOpen = false;
|
|
257
|
+
for (const { moduleId, hook } of bootHooks) {
|
|
258
|
+
await enterSystemScope(`boot: ${moduleId}`, async () => {
|
|
259
|
+
try {
|
|
260
|
+
await hook();
|
|
261
|
+
}
|
|
262
|
+
catch (err) {
|
|
263
|
+
if (alreadyNamesTheModule(err))
|
|
264
|
+
throw err;
|
|
265
|
+
throw new ModuleCompositionError(moduleId, 'boot', err);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
// Branch the scope off the container these modules registered into,
|
|
269
|
+
// not off the process-wide default. `ctx.cradle()` resolves through
|
|
270
|
+
// the ambient scope when there is one, so a boot hook opened against
|
|
271
|
+
// the wrong root would fail to resolve the module's own services —
|
|
272
|
+
// in a composition root that never called `setRootContainer`, which
|
|
273
|
+
// is every unit test that composes its own container.
|
|
274
|
+
{ entryPoint: 'boot', container: options.container });
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=compose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../../src/kernel/compose.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAwB,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EACL,4BAA4B,GAE7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,EACtB,gCAAgC,EAChC,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,4BAA4B,EAC5B,2BAA2B,GAO5B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,gCAAgC,GAGjC,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;GAkBG;AAE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,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;oBAC1D,CAAC;gBACH,CAAC;gBACD,oEAAoE;gBACpE,oEAAoE;gBACpE,qEAAqE;gBACrE,mEAAmE;gBACnE,oEAAoE;gBACpE,sDAAsD;gBACtD,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CACrD,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type AwilixContainer } from 'awilix';
|
|
2
|
+
import type { EntityManager, MikroORM } from '@mikro-orm/postgresql';
|
|
3
|
+
/**
|
|
4
|
+
* The kernel's root container (feature 072).
|
|
5
|
+
*
|
|
6
|
+
* `composition.ts` hand-wires 3144 lines and therefore imports every module by
|
|
7
|
+
* name. The container replaces that with registrations, so a module set becomes
|
|
8
|
+
* a build-time variable. Modules never see this file — they see `ModuleContext`,
|
|
9
|
+
* so the container stays swappable behind that seam.
|
|
10
|
+
*
|
|
11
|
+
* Two construction options are load-bearing:
|
|
12
|
+
*
|
|
13
|
+
* - **`InjectionMode.PROXY`** — a registration receives one `cradle` argument
|
|
14
|
+
* and destructures the names it needs, so adding a dependency is not a
|
|
15
|
+
* positional-argument change at every call site.
|
|
16
|
+
* - **`strict: true`** — awilix refuses a lifetime mismatch (a singleton
|
|
17
|
+
* capturing a scoped registration) at resolution rather than silently
|
|
18
|
+
* pinning the first request's value for the life of the process. Given that
|
|
19
|
+
* the one scoped value is the resolved sales channel, a silent capture would
|
|
20
|
+
* be a Constitution XII violation with no test to catch it.
|
|
21
|
+
*
|
|
22
|
+
* In both modes an unknown name **throws** `AwilixResolutionError`; it never
|
|
23
|
+
* resolves `undefined`. That is the property `composition.ts` could not offer —
|
|
24
|
+
* a missing option object key there is `undefined` reaching business logic.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* The resolution surface. Module registrations are added at composition time,
|
|
28
|
+
* so the index signature is the honest static type: the container is the
|
|
29
|
+
* runtime authority, and a miss throws.
|
|
30
|
+
*/
|
|
31
|
+
export interface KernelCradle {
|
|
32
|
+
/**
|
|
33
|
+
* The closure ~59 module factories take today as `emFactory`. Calling it
|
|
34
|
+
* always forks; see the note on `em` below.
|
|
35
|
+
*/
|
|
36
|
+
readonly emFactory: () => EntityManager;
|
|
37
|
+
/**
|
|
38
|
+
* A fresh `EntityManager` fork per resolution — **transient**, matching
|
|
39
|
+
* `composition.ts:282`'s `em = () => forkScopedEm(orm)` called once per
|
|
40
|
+
* service method (research R-1b). There is deliberately no request-scoped
|
|
41
|
+
* EntityManager: introducing one would change identity-map sharing, flush
|
|
42
|
+
* ordering and transaction nesting for every service in the codebase.
|
|
43
|
+
*/
|
|
44
|
+
readonly em: EntityManager;
|
|
45
|
+
readonly [name: string]: unknown;
|
|
46
|
+
}
|
|
47
|
+
export type KernelContainer = AwilixContainer<KernelCradle>;
|
|
48
|
+
/** Build a root container. One per process; scopes are children of it. */
|
|
49
|
+
export declare function createRootContainer(): KernelContainer;
|
|
50
|
+
/**
|
|
51
|
+
* Register the ORM-derived names.
|
|
52
|
+
*
|
|
53
|
+
* `emFactory` keeps today's exact semantics — it is the closure, and every call
|
|
54
|
+
* forks. `em` is the container-native spelling of the same thing: **transient**,
|
|
55
|
+
* so each resolution yields its own fork with its own identity map. Neither is
|
|
56
|
+
* scoped, and that is the invariant the whole request seam rests on: the tenant
|
|
57
|
+
* filter reads `AsyncLocalStorage` at query-build time (`tenancy/filters.ts`),
|
|
58
|
+
* which is what makes a bare fork correct.
|
|
59
|
+
*/
|
|
60
|
+
export declare function registerOrm(container: KernelContainer, orm: MikroORM): void;
|
|
61
|
+
/**
|
|
62
|
+
* Register plain values a composition root already owns — the Redis client, the
|
|
63
|
+
* `requireAdmin` factory, a port implementation a not-yet-converted module
|
|
64
|
+
* exposes through its handle.
|
|
65
|
+
*
|
|
66
|
+
* It exists so a composition root spells the container's vocabulary without
|
|
67
|
+
* importing `awilix` either. Modules are *forbidden* to import it
|
|
68
|
+
* (`scripts/check-container-imports.ts`); a root importing it would still be
|
|
69
|
+
* one more file to touch the day the container is swapped.
|
|
70
|
+
*/
|
|
71
|
+
export declare function registerValues(container: KernelContainer, values: Readonly<Record<string, unknown>>): void;
|
|
72
|
+
/**
|
|
73
|
+
* The process-wide root container, created on first use. `enterPlatformScope`
|
|
74
|
+
* falls back to it so a CLI script or an interval sweep needs no wiring to open
|
|
75
|
+
* a scope.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getRootContainer(): KernelContainer;
|
|
78
|
+
/** Install a composed root. Used by the composer, and by tests that build their own. */
|
|
79
|
+
export declare function setRootContainer(container: KernelContainer): void;
|
|
80
|
+
/**
|
|
81
|
+
* Dispose the root container and forget it. Runs every registration's
|
|
82
|
+
* `.disposer(...)` — Redis clients, queue connections, the ORM — so a composed
|
|
83
|
+
* process tears down through one call instead of a hand-maintained list.
|
|
84
|
+
*/
|
|
85
|
+
export declare function disposeRootContainer(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Dispose `container` when the process is asked to stop. Returns a detach
|
|
88
|
+
* function so a test (or a second composition in the same process) does not
|
|
89
|
+
* leak signal handlers.
|
|
90
|
+
*
|
|
91
|
+
* Not installed automatically: importing the kernel must not attach global
|
|
92
|
+
* signal handlers, or 900 test files would each add a set.
|
|
93
|
+
*/
|
|
94
|
+
export declare function installShutdownDisposal(container: KernelContainer, signals?: readonly NodeJS.Signals[]): () => void;
|
|
95
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/kernel/container.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGrE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH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