@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,48 @@
|
|
|
1
|
+
export async function runMigrationCommand(orm, command, io) {
|
|
2
|
+
const migrator = orm.getMigrator();
|
|
3
|
+
switch (command) {
|
|
4
|
+
case 'up': {
|
|
5
|
+
const applied = await migrator.up();
|
|
6
|
+
io.out(`applied ${applied.length} migration(s)\n`);
|
|
7
|
+
for (const m of applied)
|
|
8
|
+
io.out(` + ${m.name}\n`);
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
case 'down': {
|
|
12
|
+
const reverted = await migrator.down();
|
|
13
|
+
io.out(`reverted ${reverted.length} migration(s)\n`);
|
|
14
|
+
for (const m of reverted)
|
|
15
|
+
io.out(` - ${m.name}\n`);
|
|
16
|
+
return 0;
|
|
17
|
+
}
|
|
18
|
+
case 'pending': {
|
|
19
|
+
const pending = await migrator.getPendingMigrations();
|
|
20
|
+
if (pending.length === 0) {
|
|
21
|
+
io.out('no pending migrations\n');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
for (const m of pending)
|
|
25
|
+
io.out(` ~ ${m.name}\n`);
|
|
26
|
+
}
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
case 'fresh': {
|
|
30
|
+
// Drop the entire schema by name rather than relying on
|
|
31
|
+
// `dropSchema()`, which only removes tables present in the current
|
|
32
|
+
// entity metadata. Tables that exist in the DB but are no longer (or
|
|
33
|
+
// not yet) reflected in metadata — e.g. pivot tables — would survive
|
|
34
|
+
// that path and make Migration001 fail with "relation already exists".
|
|
35
|
+
// A raw `DROP SCHEMA ... CASCADE` guarantees a clean slate.
|
|
36
|
+
const conn = orm.em.getConnection();
|
|
37
|
+
await conn.execute('drop schema public cascade; create schema public;');
|
|
38
|
+
const applied = await migrator.up();
|
|
39
|
+
io.out(`dropped and re-applied ${applied.length} migration(s)\n`);
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
default: {
|
|
43
|
+
io.err(`unknown command: ${command}\n`);
|
|
44
|
+
return 1;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/db/migrate.ts"],"names":[],"mappings":"AAqBA,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAa,EACb,OAAe,EACf,EAAsB;IAEtB,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;IAEnC,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,IAAI,CAAC,CAAC,CAAC;YACV,M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OAAO,GAAG,MAAM,QAAQ,CAAC,EAAE,EAAE,CAAC;YACpC,EAAE,CAAC,GAAG,CAAC,0BAA0B,OAAO,CAAC,MAAM,iBAAiB,CAAC,CAAC;YAClE,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACR,EAAE,CAAC,GAAG,CAAC,oBAAoB,OAAO,IAAI,CAAC,CAAC;YACxC,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { MigrationObject } from '@mikro-orm/core';
|
|
2
|
+
/**
|
|
3
|
+
* Computes the order in which migrations are handed to the migrator.
|
|
4
|
+
*
|
|
5
|
+
* Pure by design: no I/O, no clock read, no environment read, and no import
|
|
6
|
+
* from `src/modules/`. It is importable and testable without booting the ORM.
|
|
7
|
+
*
|
|
8
|
+
* The rule is two blocks. A **baseline block** — the migrations named by the
|
|
9
|
+
* platform's published baseline list — is emitted first, in the order that list
|
|
10
|
+
* holds them, exactly as history applied them. Everything else is the
|
|
11
|
+
* **open block**, emitted module by module in a topological order of the
|
|
12
|
+
* module dependency graph, each module's migrations contiguous and ascending
|
|
13
|
+
* by timestamp. So a timestamp orders migrations only **within** their own
|
|
14
|
+
* module, and a manifest's `dependencies` array is the only thing ordering one
|
|
15
|
+
* module's schema against another's — which is what lets a migration arrive
|
|
16
|
+
* from an installed package whose author knows nothing of the host's history.
|
|
17
|
+
*
|
|
18
|
+
* Specified by specs/081-per-module-migration-order/contracts/ — the ordering
|
|
19
|
+
* in `ordering-algorithm.md` (which supersedes the feature-065 contract in
|
|
20
|
+
* whole), the class-name rule it enforces in `migration-identity.md`. The
|
|
21
|
+
* baseline block's membership rule is amended by
|
|
22
|
+
* `specs/110-instance-repository/contracts/instance-migration-order.md`: it is
|
|
23
|
+
* an **identity**, not a stamp and not an origin, so that the same corpus
|
|
24
|
+
* installed from packages orders identically. That contract's §1 is where every
|
|
25
|
+
* obvious alternative — squash, re-stamp, declare a dependency, drop the
|
|
26
|
+
* boundary — is refused with the reason.
|
|
27
|
+
*/
|
|
28
|
+
/** A migration class as MikroORM instantiates it. */
|
|
29
|
+
export type MigrationClass = MigrationObject['class'];
|
|
30
|
+
/** Where a registry entry came from. Absent means `'core'`. */
|
|
31
|
+
export type MigrationOrigin = 'core' | 'external';
|
|
32
|
+
export interface MigrationRegistryEntry {
|
|
33
|
+
/**
|
|
34
|
+
* Owning module id — a `manifest.id` from the resolved manifest index, or
|
|
35
|
+
* the literal 'core' for the cross-cutting migrations in src/db/migrations/.
|
|
36
|
+
*/
|
|
37
|
+
moduleId: string;
|
|
38
|
+
/** The migration class. `cls.name` IS the migration name persisted in the DB. */
|
|
39
|
+
cls: MigrationClass;
|
|
40
|
+
/**
|
|
41
|
+
* Absent means `'core'`, so the committed generated registry is untouched. A
|
|
42
|
+
* producer outside it must set `'external'`.
|
|
43
|
+
*
|
|
44
|
+
* **No ordering decision is taken on it** (R1.6). It survives because the
|
|
45
|
+
* acceptance criterion's per-origin template digest reads it and
|
|
46
|
+
* `configured-migrations.ts` reports it — but it once decided membership of
|
|
47
|
+
* the frozen prefix, and that is exactly what made the prefix empty when the
|
|
48
|
+
* modules became packages: `origin` answers *"did this come out of our
|
|
49
|
+
* build"*, which is not the question *"is this one of the migrations whose
|
|
50
|
+
* order is history"*. The second question is answered by
|
|
51
|
+
* {@link OrderMigrationsInput.baseline}, which names them.
|
|
52
|
+
*/
|
|
53
|
+
origin?: MigrationOrigin;
|
|
54
|
+
}
|
|
55
|
+
export type MigrationOrderErrorCode = 'unparsable-name' | 'duplicate-name' | 'duplicate-timestamp' | 'unknown-module' | 'unscoped-name';
|
|
56
|
+
export declare class MigrationOrderError extends Error {
|
|
57
|
+
readonly code: MigrationOrderErrorCode;
|
|
58
|
+
constructor(code: MigrationOrderErrorCode, message: string);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The frozen historical prefix boundary. **Closed. Never drained.**
|
|
62
|
+
*
|
|
63
|
+
* Every migration the committed core registry contributed at or before this
|
|
64
|
+
* UTC stamp predates feature 065: it was written, and applied, in the
|
|
65
|
+
* hand-maintained array order of the pre-065 `migrationsList`, and those
|
|
66
|
+
* modules' `dependencies` arrays do not describe the order they actually need
|
|
67
|
+
* — they contradict it in 37 places. Emitting that block in any other order
|
|
68
|
+
* produces one a fresh database cannot apply: measured, not assumed — with the
|
|
69
|
+
* boundary removed, `db:fresh` fails at
|
|
70
|
+
* `Migration20260505T102206AssetsLibraryInit` with `relation "cms_pages" does
|
|
71
|
+
* not exist`, because the graph pulls `assets_library` ahead of `cms`.
|
|
72
|
+
*
|
|
73
|
+
* So it is not "the block we have not corrected yet"; it is "the block whose
|
|
74
|
+
* order is history", and nothing should try to drain it. It cannot grow
|
|
75
|
+
* either: `scripts/new-migration.ts` clamps every scaffolded core stamp past
|
|
76
|
+
* the boundary.
|
|
77
|
+
*
|
|
78
|
+
* **It is a generation-time rule, and no longer a runtime membership test**
|
|
79
|
+
* (`specs/110-instance-repository/contracts/instance-migration-order.md` R1.2).
|
|
80
|
+
* `scripts/new-migration.ts` clamps a scaffolded stamp past it, and
|
|
81
|
+
* `composer:generate` renders the published baseline list out of what the
|
|
82
|
+
* committed core registry contributes at or below it. Nothing asks it at run
|
|
83
|
+
* time, because a stamp is a claim an arriving package can make and a name is
|
|
84
|
+
* not: an entry stamped `20250101T000000` reaches this platform from a registry
|
|
85
|
+
* with the same authority as one of ours, and history is a list of names.
|
|
86
|
+
*/
|
|
87
|
+
export declare const BASELINE_THROUGH = "20260801T000000";
|
|
88
|
+
export interface OrderMigrationsInput {
|
|
89
|
+
/** Registry entries. Order is irrelevant. */
|
|
90
|
+
entries: readonly MigrationRegistryEntry[];
|
|
91
|
+
/**
|
|
92
|
+
* moduleId → directly declared `dependencies`. Must contain every entry's
|
|
93
|
+
* moduleId. This is the primary ordering input, and no other manifest array
|
|
94
|
+
* is read: nothing else orders one module's migrations against another's.
|
|
95
|
+
*/
|
|
96
|
+
moduleDependencies: ReadonlyMap<string, readonly string[]>;
|
|
97
|
+
/**
|
|
98
|
+
* The frozen historical prefix, **by identity**: the migration class names
|
|
99
|
+
* whose order is history, in the order history applied them.
|
|
100
|
+
*
|
|
101
|
+
* Normally `BASELINE_MIGRATIONS`, the list `@endora-commerce/platform`
|
|
102
|
+
* publishes — data about this platform's history, carried to a client by the
|
|
103
|
+
* package that carries the history (R1.5), and generated rather than
|
|
104
|
+
* hand-written (R1.3). A name here that this composition does not supply is
|
|
105
|
+
* simply not emitted, which is what an instance installing a subset of the
|
|
106
|
+
* modules is; the two-way reconciliation that would catch a *wrong* list is a
|
|
107
|
+
* guard over this repository's committed artefacts
|
|
108
|
+
* (`test/unit/db/instance-migration-order.test.ts`), never a throw here.
|
|
109
|
+
*/
|
|
110
|
+
baseline: readonly string[];
|
|
111
|
+
}
|
|
112
|
+
/** What the computation observed and did not refuse. */
|
|
113
|
+
export interface MigrationOrderDiagnostic {
|
|
114
|
+
kind: 'module-cycle';
|
|
115
|
+
/** Every member of the strongly connected component, sorted. At least two. */
|
|
116
|
+
modules: readonly string[];
|
|
117
|
+
/** Operator-readable: names the members and says what the order did instead. */
|
|
118
|
+
message: string;
|
|
119
|
+
}
|
|
120
|
+
export interface MigrationOrderResult {
|
|
121
|
+
/** Assigned verbatim to `migrations.migrationsList`. */
|
|
122
|
+
migrations: MigrationObject[];
|
|
123
|
+
diagnostics: readonly MigrationOrderDiagnostic[];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The frozen prefix as history recorded it, over migration **names**.
|
|
127
|
+
*
|
|
128
|
+
* This is the one derivation of that order in the repository: `composer:generate`
|
|
129
|
+
* renders the published baseline list with it, and the fixtures that drive
|
|
130
|
+
* `orderMigrations` build their own frozen block with it. A second
|
|
131
|
+
* implementation would be free to disagree with the first, and nothing compares
|
|
132
|
+
* two orders that are never computed together.
|
|
133
|
+
*
|
|
134
|
+
* It is a **generation-time** answer and takes the watermark for that reason
|
|
135
|
+
* (R1.2). The result is what {@link orderMigrations} then emits verbatim: the
|
|
136
|
+
* ordering itself asks no question about a stamp.
|
|
137
|
+
*/
|
|
138
|
+
export declare function historicalBaselineOrder(names: readonly string[], baselineThrough?: string): string[];
|
|
139
|
+
/**
|
|
140
|
+
* Every dependency cycle in a module graph, in the same shape and wording
|
|
141
|
+
* `orderMigrations` reports — one strongly connected component of more than
|
|
142
|
+
* one module per diagnostic, members sorted.
|
|
143
|
+
*
|
|
144
|
+
* Two of the diagnostic's three readers are here: `test/unit/db/module-graph.test.ts`,
|
|
145
|
+
* which fails the build on a cycle in the committed manifests, and the ORM
|
|
146
|
+
* configuration, which warns at boot and keeps serving. The third is the
|
|
147
|
+
* `_lifecycle` orchestrator, which refuses an install whose arrival closes a
|
|
148
|
+
* cycle — the one moment where refusing costs nothing (081 FR-012).
|
|
149
|
+
*
|
|
150
|
+
* **The walk itself is the platform's** (D-160.11): the orchestrator reads
|
|
151
|
+
* `moduleDependencyCycles` directly rather than this wrapper, because it lives
|
|
152
|
+
* in `@endora-commerce/platform` and this file is the host application's. Three
|
|
153
|
+
* reactions, one graph walk — the split is the point, and what keeps a second
|
|
154
|
+
* walk from being free to disagree with this one is that there is only one.
|
|
155
|
+
* What is added here is the *wording*, which is the migration order's own.
|
|
156
|
+
*/
|
|
157
|
+
export declare function findModuleCycles(moduleDependencies: ReadonlyMap<string, readonly string[]>): readonly MigrationOrderDiagnostic[];
|
|
158
|
+
export declare function orderMigrations(input: OrderMigrationsInput): MigrationOrderResult;
|
|
159
|
+
//# sourceMappingURL=migration-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration-order.d.ts","sourceRoot":"","sources":["../../src/db/migration-order.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAUvD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,qDAAqD;AACrD,MAAM,MAAM,cAAc,GA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K,EAAE,SAAS,MAAM,EAAE,EACxB,eAAe,GAAE,MAAyB,GACzC,MAAM,EAAE,CAkBV;AAmDD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC9B,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,GACzD,SAAS,wBAAwB,EAAE,CAErC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,oBAAoB,CAmDjF"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
// The graph walk is the platform's (D-160.11): the lifecycle orchestrator refuses an
|
|
2
|
+
// install whose arrival closes a cycle, and the member list it names an operator has to
|
|
3
|
+
// be the member list reported here. One implementation is what makes that true.
|
|
4
|
+
import { moduleDependencyCycles, sortComponentsTopologically, stronglyConnectedComponents, } from '../lifecycle/services/dep-graph.js';
|
|
5
|
+
export class MigrationOrderError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
constructor(code, message) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'MigrationOrderError';
|
|
10
|
+
this.code = code;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The frozen historical prefix boundary. **Closed. Never drained.**
|
|
15
|
+
*
|
|
16
|
+
* Every migration the committed core registry contributed at or before this
|
|
17
|
+
* UTC stamp predates feature 065: it was written, and applied, in the
|
|
18
|
+
* hand-maintained array order of the pre-065 `migrationsList`, and those
|
|
19
|
+
* modules' `dependencies` arrays do not describe the order they actually need
|
|
20
|
+
* — they contradict it in 37 places. Emitting that block in any other order
|
|
21
|
+
* produces one a fresh database cannot apply: measured, not assumed — with the
|
|
22
|
+
* boundary removed, `db:fresh` fails at
|
|
23
|
+
* `Migration20260505T102206AssetsLibraryInit` with `relation "cms_pages" does
|
|
24
|
+
* not exist`, because the graph pulls `assets_library` ahead of `cms`.
|
|
25
|
+
*
|
|
26
|
+
* So it is not "the block we have not corrected yet"; it is "the block whose
|
|
27
|
+
* order is history", and nothing should try to drain it. It cannot grow
|
|
28
|
+
* either: `scripts/new-migration.ts` clamps every scaffolded core stamp past
|
|
29
|
+
* the boundary.
|
|
30
|
+
*
|
|
31
|
+
* **It is a generation-time rule, and no longer a runtime membership test**
|
|
32
|
+
* (`specs/110-instance-repository/contracts/instance-migration-order.md` R1.2).
|
|
33
|
+
* `scripts/new-migration.ts` clamps a scaffolded stamp past it, and
|
|
34
|
+
* `composer:generate` renders the published baseline list out of what the
|
|
35
|
+
* committed core registry contributes at or below it. Nothing asks it at run
|
|
36
|
+
* time, because a stamp is a claim an arriving package can make and a name is
|
|
37
|
+
* not: an entry stamped `20250101T000000` reaches this platform from a registry
|
|
38
|
+
* with the same authority as one of ours, and history is a list of names.
|
|
39
|
+
*/
|
|
40
|
+
export const BASELINE_THROUGH = '20260801T000000';
|
|
41
|
+
/** The cross-cutting pseudo-module owning src/db/migrations/. */
|
|
42
|
+
const CORE_MODULE_ID = 'core';
|
|
43
|
+
/** Class-name recognizer — see contracts/migration-identity.md §2. */
|
|
44
|
+
const MIGRATION_CLASS_RE = /^Migration(\d{8}T\d{6})[A-Z0-9]/;
|
|
45
|
+
/** `orders` → `Orders`, `customer_accounts` → `CustomerAccounts`, `_i18n` → `I18n`. */
|
|
46
|
+
function expectedNamePrefix(moduleId) {
|
|
47
|
+
return (moduleId.startsWith('_') ? moduleId.slice(1) : moduleId)
|
|
48
|
+
.split('_')
|
|
49
|
+
.filter((part) => part.length > 0)
|
|
50
|
+
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
51
|
+
.join('');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Rejects a well-formed stamp that names no real instant — month 13, hour 25,
|
|
55
|
+
* 30 February. The round trip is what catches the last one: `Date.UTC` rolls it
|
|
56
|
+
* forward to 2 March rather than refusing it.
|
|
57
|
+
*/
|
|
58
|
+
function assertRealInstant(name, timestamp) {
|
|
59
|
+
const at = (from, width) => Number(timestamp.slice(from, from + width));
|
|
60
|
+
const utc = new Date(Date.UTC(at(0, 4), at(4, 2) - 1, at(6, 2), at(9, 2), at(11, 2), at(13, 2)));
|
|
61
|
+
// '2026-08-19T07:48:16.000Z' → '20260819T074816'. The regex bounds the year
|
|
62
|
+
// to four digits, so `toISOString` never takes its extended ±YYYYYY form.
|
|
63
|
+
if (utc.toISOString().replace(/[-:]/g, '').slice(0, 15) !== timestamp) {
|
|
64
|
+
throw new MigrationOrderError('unparsable-name', `[migration-order] migration "${name}" carries the timestamp ${timestamp}, ` +
|
|
65
|
+
`which is not a real UTC instant. Fix the class name and the filename.`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/** Step 1 — parse & validate entries. */
|
|
69
|
+
function parseEntries(entries, moduleDependencies) {
|
|
70
|
+
const byName = new Map();
|
|
71
|
+
// Keyed by module, not globally: two authors who cannot talk to each other
|
|
72
|
+
// must not have to coordinate stamps, and after Step 5 a stamp orders
|
|
73
|
+
// nothing outside its own module anyway.
|
|
74
|
+
const byModuleStamp = new Map();
|
|
75
|
+
const parsed = [];
|
|
76
|
+
for (const entry of entries) {
|
|
77
|
+
const name = entry.cls.name;
|
|
78
|
+
const match = MIGRATION_CLASS_RE.exec(name);
|
|
79
|
+
if (!match) {
|
|
80
|
+
throw new MigrationOrderError('unparsable-name', `[migration-order] migration class "${name}" does not match the naming ` +
|
|
81
|
+
`convention Migration<YYYYMMDDTHHmmss><PascalCaseTail>. See ` +
|
|
82
|
+
`specs/081-per-module-migration-order/contracts/migration-identity.md.`);
|
|
83
|
+
}
|
|
84
|
+
const timestamp = match[1];
|
|
85
|
+
assertRealInstant(name, timestamp);
|
|
86
|
+
const duplicateName = byName.get(name);
|
|
87
|
+
if (duplicateName) {
|
|
88
|
+
throw new MigrationOrderError('duplicate-name', `[migration-order] migration "${name}" is registered more than once ` +
|
|
89
|
+
`(modules "${duplicateName.moduleId}" and "${entry.moduleId}"). The class ` +
|
|
90
|
+
`name is what \`mikro_orm_migrations\` stores, so it must be globally ` +
|
|
91
|
+
`unique; rename one and regenerate with \`composer:generate\`.`);
|
|
92
|
+
}
|
|
93
|
+
const prefix = expectedNamePrefix(entry.moduleId);
|
|
94
|
+
if (!name.slice(match[0].length - 1).startsWith(prefix)) {
|
|
95
|
+
throw new MigrationOrderError('unscoped-name', `[migration-order] migration "${name}" is owned by module "${entry.moduleId}", ` +
|
|
96
|
+
`so it must be named Migration${timestamp}${prefix}…. A class name is ` +
|
|
97
|
+
`scoped by its module, which is what makes it unique across every module ` +
|
|
98
|
+
`the platform can compose — contracts/migration-identity.md §2.`);
|
|
99
|
+
}
|
|
100
|
+
const stampKey = `${entry.moduleId} ${timestamp}`;
|
|
101
|
+
const duplicateStamp = byModuleStamp.get(stampKey);
|
|
102
|
+
if (duplicateStamp) {
|
|
103
|
+
throw new MigrationOrderError('duplicate-timestamp', `[migration-order] module "${entry.moduleId}" has two migrations stamped ` +
|
|
104
|
+
`${timestamp}: "${duplicateStamp.name}" and "${name}". Inside one module the ` +
|
|
105
|
+
`timestamp is the whole order; advance one by a whole second (file and class).`);
|
|
106
|
+
}
|
|
107
|
+
if (entry.moduleId !== CORE_MODULE_ID && !moduleDependencies.has(entry.moduleId)) {
|
|
108
|
+
throw new MigrationOrderError('unknown-module', `[migration-order] migration "${name}" declares the unknown owning ` +
|
|
109
|
+
`module "${entry.moduleId}". Add the module's manifest and run ` +
|
|
110
|
+
`\`pnpm --filter backend run manifest-index:generate\`.`);
|
|
111
|
+
}
|
|
112
|
+
const migration = {
|
|
113
|
+
name,
|
|
114
|
+
timestamp,
|
|
115
|
+
moduleId: entry.moduleId,
|
|
116
|
+
origin: entry.origin ?? CORE_MODULE_ID,
|
|
117
|
+
cls: entry.cls,
|
|
118
|
+
};
|
|
119
|
+
byName.set(name, migration);
|
|
120
|
+
byModuleStamp.set(stampKey, migration);
|
|
121
|
+
parsed.push(migration);
|
|
122
|
+
}
|
|
123
|
+
return parsed;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Ascending by timestamp, ties broken by class name — the tiebreak is what
|
|
127
|
+
* keeps the output a pure function of its inputs now that two modules may
|
|
128
|
+
* legally share a stamp.
|
|
129
|
+
*/
|
|
130
|
+
function chronologically(left, right) {
|
|
131
|
+
if (left.timestamp !== right.timestamp)
|
|
132
|
+
return left.timestamp < right.timestamp ? -1 : 1;
|
|
133
|
+
return left.name < right.name ? -1 : 1;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The frozen prefix as history recorded it, over migration **names**.
|
|
137
|
+
*
|
|
138
|
+
* This is the one derivation of that order in the repository: `composer:generate`
|
|
139
|
+
* renders the published baseline list with it, and the fixtures that drive
|
|
140
|
+
* `orderMigrations` build their own frozen block with it. A second
|
|
141
|
+
* implementation would be free to disagree with the first, and nothing compares
|
|
142
|
+
* two orders that are never computed together.
|
|
143
|
+
*
|
|
144
|
+
* It is a **generation-time** answer and takes the watermark for that reason
|
|
145
|
+
* (R1.2). The result is what {@link orderMigrations} then emits verbatim: the
|
|
146
|
+
* ordering itself asks no question about a stamp.
|
|
147
|
+
*/
|
|
148
|
+
export function historicalBaselineOrder(names, baselineThrough = BASELINE_THROUGH) {
|
|
149
|
+
return names
|
|
150
|
+
.map((name) => {
|
|
151
|
+
const match = MIGRATION_CLASS_RE.exec(name);
|
|
152
|
+
if (!match) {
|
|
153
|
+
throw new MigrationOrderError('unparsable-name', `[migration-order] migration class "${name}" does not match the naming ` +
|
|
154
|
+
`convention Migration<YYYYMMDDTHHmmss><PascalCaseTail>, so the frozen ` +
|
|
155
|
+
`historical prefix cannot be derived from it. See ` +
|
|
156
|
+
`specs/081-per-module-migration-order/contracts/migration-identity.md.`);
|
|
157
|
+
}
|
|
158
|
+
return { name, timestamp: match[1] };
|
|
159
|
+
})
|
|
160
|
+
.filter((migration) => migration.timestamp <= baselineThrough)
|
|
161
|
+
.sort(chronologically)
|
|
162
|
+
.map((migration) => migration.name);
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Step 4 — a stable topological sort of the condensation.
|
|
166
|
+
*
|
|
167
|
+
* **The walk is the platform's** (`sortComponentsTopologically`), for the reason
|
|
168
|
+
* `stronglyConnectedComponents` is: feature 113's demo runner orders modules by
|
|
169
|
+
* the same manifest graph, and its contract says it *"MUST NOT maintain an order
|
|
170
|
+
* of its own"* (§4.1). Two implementations of one order would disagree silently,
|
|
171
|
+
* because nothing compares a demo run's order to a migration run's.
|
|
172
|
+
*
|
|
173
|
+
* What stays here is the `'core'` argument, which is this file's alone: `'core'`
|
|
174
|
+
* declares nothing and nothing declares it, so it is always ready at the start,
|
|
175
|
+
* every module's tables sit downstream of the bootstrap tables, and saying so
|
|
176
|
+
* beats relying on an accident of alphabetical ordering.
|
|
177
|
+
*/
|
|
178
|
+
function sortComponents(components, neighboursOf) {
|
|
179
|
+
return sortComponentsTopologically(components, neighboursOf, CORE_MODULE_ID);
|
|
180
|
+
}
|
|
181
|
+
/** Step 3 — the ordering graph of a module dependency map, and its components. */
|
|
182
|
+
function orderingGraph(moduleDependencies) {
|
|
183
|
+
const nodes = [...moduleDependencies.keys()];
|
|
184
|
+
if (!moduleDependencies.has(CORE_MODULE_ID))
|
|
185
|
+
nodes.push(CORE_MODULE_ID);
|
|
186
|
+
// Edges to ids absent from the map are skipped; a *migration* claiming such
|
|
187
|
+
// a module is rejected by Step 1 instead.
|
|
188
|
+
const neighboursOf = (id) => (moduleDependencies.get(id) ?? []).filter((dependency) => moduleDependencies.has(dependency));
|
|
189
|
+
return { components: stronglyConnectedComponents(nodes, neighboursOf), neighboursOf };
|
|
190
|
+
}
|
|
191
|
+
/** A component of more than one module is a cycle, and is reported, never thrown. */
|
|
192
|
+
function cycleDiagnostics(components) {
|
|
193
|
+
return components
|
|
194
|
+
.filter((members) => members.length > 1)
|
|
195
|
+
.map((members) => ({
|
|
196
|
+
kind: 'module-cycle',
|
|
197
|
+
modules: members,
|
|
198
|
+
message: `[migration-order] modules [${members.join(', ')}] declare a dependency cycle. ` +
|
|
199
|
+
`Their migrations are emitted as one block in timestamp order, because the ` +
|
|
200
|
+
`declarations contain no order. Fix the \`dependencies\` array in one of them.`,
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Every dependency cycle in a module graph, in the same shape and wording
|
|
205
|
+
* `orderMigrations` reports — one strongly connected component of more than
|
|
206
|
+
* one module per diagnostic, members sorted.
|
|
207
|
+
*
|
|
208
|
+
* Two of the diagnostic's three readers are here: `test/unit/db/module-graph.test.ts`,
|
|
209
|
+
* which fails the build on a cycle in the committed manifests, and the ORM
|
|
210
|
+
* configuration, which warns at boot and keeps serving. The third is the
|
|
211
|
+
* `_lifecycle` orchestrator, which refuses an install whose arrival closes a
|
|
212
|
+
* cycle — the one moment where refusing costs nothing (081 FR-012).
|
|
213
|
+
*
|
|
214
|
+
* **The walk itself is the platform's** (D-160.11): the orchestrator reads
|
|
215
|
+
* `moduleDependencyCycles` directly rather than this wrapper, because it lives
|
|
216
|
+
* in `@endora-commerce/platform` and this file is the host application's. Three
|
|
217
|
+
* reactions, one graph walk — the split is the point, and what keeps a second
|
|
218
|
+
* walk from being free to disagree with this one is that there is only one.
|
|
219
|
+
* What is added here is the *wording*, which is the migration order's own.
|
|
220
|
+
*/
|
|
221
|
+
export function findModuleCycles(moduleDependencies) {
|
|
222
|
+
return cycleDiagnostics(moduleDependencyCycles(moduleDependencies));
|
|
223
|
+
}
|
|
224
|
+
export function orderMigrations(input) {
|
|
225
|
+
const { entries, moduleDependencies, baseline: baselineNames } = input;
|
|
226
|
+
const parsed = parseEntries(entries, moduleDependencies);
|
|
227
|
+
const { components, neighboursOf } = orderingGraph(moduleDependencies);
|
|
228
|
+
// Reported, never thrown: the graph is the primary ordering now, so a throw
|
|
229
|
+
// would mean a stranger's manifest can stop a shop's own schema from
|
|
230
|
+
// migrating. The readers want different reactions — a red unit test
|
|
231
|
+
// (`test/unit/db/module-graph.test.ts`), a `warn` at boot, and the lifecycle
|
|
232
|
+
// refusing an install that closes a loop (FR-012) — and none of them belongs
|
|
233
|
+
// in a pure function.
|
|
234
|
+
const diagnostics = cycleDiagnostics(components);
|
|
235
|
+
// Step 2 — baseline membership, by **identity**. The published list is
|
|
236
|
+
// ordered and that order is history's, so the block is emitted as the list
|
|
237
|
+
// holds it rather than as a comparator recomputes it: a comparator that ever
|
|
238
|
+
// disagreed with the list would make the artefact a lie, and this way there
|
|
239
|
+
// is nothing for it to disagree with. A listed name this composition does not
|
|
240
|
+
// supply is simply absent — that is an instance installing a subset.
|
|
241
|
+
const baselinePosition = new Map(baselineNames.map((name, index) => [name, index]));
|
|
242
|
+
const baseline = [];
|
|
243
|
+
const openByModule = new Map();
|
|
244
|
+
for (const migration of parsed) {
|
|
245
|
+
if (baselinePosition.has(migration.name)) {
|
|
246
|
+
baseline.push(migration);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
const bucket = openByModule.get(migration.moduleId);
|
|
250
|
+
if (bucket)
|
|
251
|
+
bucket.push(migration);
|
|
252
|
+
else
|
|
253
|
+
openByModule.set(migration.moduleId, [migration]);
|
|
254
|
+
}
|
|
255
|
+
baseline.sort((left, right) => baselinePosition.get(left.name) - baselinePosition.get(right.name));
|
|
256
|
+
// Step 5 — the open block, component by component, contiguous. A
|
|
257
|
+
// multi-module component has no internal order to respect, so its members'
|
|
258
|
+
// migrations are merged and emitted chronologically across the whole block:
|
|
259
|
+
// the baseline block's rule, applied locally.
|
|
260
|
+
const open = [];
|
|
261
|
+
for (const members of sortComponents(components, neighboursOf)) {
|
|
262
|
+
const owned = members.flatMap((member) => openByModule.get(member) ?? []);
|
|
263
|
+
open.push(...owned.sort(chronologically));
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
migrations: [...baseline, ...open].map((migration) => ({
|
|
267
|
+
name: migration.name,
|
|
268
|
+
class: migration.cls,
|
|
269
|
+
})),
|
|
270
|
+
diagnostics,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=migration-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,EAAE,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YACrD,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,KAAK,EAAE,SAAS,CAAC,GAAG;SACrB,CAAC,CAAC;QACH,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type Options } from '@mikro-orm/postgresql';
|
|
2
|
+
import type { ConfiguredEntity } from './configured-entities.js';
|
|
3
|
+
import type { ConfiguredMigrations } from './configured-migrations.js';
|
|
4
|
+
/**
|
|
5
|
+
* MikroORM configuration for an Endora platform.
|
|
6
|
+
*
|
|
7
|
+
* - PostgreSQL driver (constitutional stack).
|
|
8
|
+
* - Plural snake_case table names + snake_case columns (Principle VI) via the
|
|
9
|
+
* custom naming strategy in ./pluralizing-naming-strategy.ts (R-04).
|
|
10
|
+
* - Migration ownership is module-local: each module keeps its migration files
|
|
11
|
+
* under its own `migrations/` directory. The few genuinely cross-cutting
|
|
12
|
+
* bootstrap migrations (foundation/commerce init, module-lifecycle, tenant
|
|
13
|
+
* indexes) are the platform's own and live in `../migrations/`. Adding a
|
|
14
|
+
* migration means dropping a file in the owning module's migrations/ dir and
|
|
15
|
+
* regenerating — never here.
|
|
16
|
+
* - Both registries stay explicit static-import lists rather than a filesystem
|
|
17
|
+
* glob: glob discovery needs runtime dynamic `import()` of .ts files, which
|
|
18
|
+
* Node's ESM loader cannot transform and which breaks under Vitest. Since
|
|
19
|
+
* feature 071's F2 the lists are *emitted* from a filesystem walk by
|
|
20
|
+
* scripts/generate-composer.ts and committed, so they are static imports
|
|
21
|
+
* nobody maintains by hand. The "registered ⇔ on-disk" round-trip is enforced
|
|
22
|
+
* by test/unit/db/migrations-registry.test.ts, and `overlay:check` fails on a
|
|
23
|
+
* committed artefact that drifted from the tree.
|
|
24
|
+
* - Execution order is computed by ./migration-order.ts: a frozen historical
|
|
25
|
+
* prefix, then module by module in a topological order of the manifest
|
|
26
|
+
* dependency graph, each module's migrations contiguous and ascending by
|
|
27
|
+
* timestamp. See docs/docs/architecture/migrations.md.
|
|
28
|
+
*
|
|
29
|
+
* ## It takes its inputs and reads no artefact (`specs/110-instance-repository/` R7.4)
|
|
30
|
+
*
|
|
31
|
+
* Both committed registries are **bare core**, and stay that way: an installed
|
|
32
|
+
* extension package may ship entities and migrations (D-106.2), but which
|
|
33
|
+
* packages an instance installed is a fact about the process rather than about
|
|
34
|
+
* the tree, so the committed artefacts must not claim to know (D-119, confirmed
|
|
35
|
+
* as D-155). The package half is therefore discovered at runtime by
|
|
36
|
+
* `configured-entities.ts` and `configured-migrations.ts`, and the host hands
|
|
37
|
+
* the merged result in here. `backend/src/db/mikro-orm.config.ts` is the
|
|
38
|
+
* binding: it holds the async factory, the memoisation and the fourteen callers
|
|
39
|
+
* — all three facts about one process — and this file is the configuration
|
|
40
|
+
* itself, which is the platform's. `DATABASE_URL`, `NODE_ENV` and `DB_DEBUG`
|
|
41
|
+
* are the exception and stay a `process.env` read here; see {@link databaseUrl}.
|
|
42
|
+
*/
|
|
43
|
+
/** What {@link mikroOrmConfigFrom} needs from the host. */
|
|
44
|
+
export interface OrmConfigurationInputs {
|
|
45
|
+
/** The merged entity set — `configuredEntitiesFrom`'s answer. */
|
|
46
|
+
readonly entities: readonly ConfiguredEntity[];
|
|
47
|
+
/** The merged execution order — `configuredMigrations`' answer. */
|
|
48
|
+
readonly migrations: ConfiguredMigrations;
|
|
49
|
+
}
|
|
50
|
+
export declare function mikroOrmConfigFrom(inputs: OrmConfigurationInputs): Options;
|
|
51
|
+
//# sourceMappingURL=mikro-orm.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mikro-orm.config.d.ts","sourceRoot":"","sources":["../../src/db/mikro-orm.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,2DAA2D;AAC3D,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,SAAS,gBAAgB,EAAE,CAAC;IAC/C,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,oBAAoB,CAAC;CAC3C;AAiBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CA8C1E"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { defineConfig } from '@mikro-orm/postgresql';
|
|
2
|
+
import { Migrator } from '@mikro-orm/migrations';
|
|
3
|
+
import { PluralizingNamingStrategy } from './pluralizing-naming-strategy.js';
|
|
4
|
+
import { OrgWriteGuardSubscriber } from '../tenancy/org-write-guard.js';
|
|
5
|
+
/**
|
|
6
|
+
* Read off `process.env` directly, and deliberately not through an injected
|
|
7
|
+
* environment.
|
|
8
|
+
*
|
|
9
|
+
* `check:env-inputs` reconciles the platform's declared inputs against the
|
|
10
|
+
* `process.env` and `import.meta.env` reads its walk can see, so a value
|
|
11
|
+
* reached through a parameter is a declared input nothing reads — measured on
|
|
12
|
+
* this file when T116 moved it: `DATABASE_URL` and `DB_DEBUG` both reported
|
|
13
|
+
* `unread-input`, which is an operator being asked for a value that changes
|
|
14
|
+
* nothing. Which database a process talks to is a fact about that process, so
|
|
15
|
+
* reading it here is also the honest shape.
|
|
16
|
+
*/
|
|
17
|
+
const databaseUrl = () => process.env['DATABASE_URL'] ?? 'postgresql://b2b:b2b@localhost:5432/b2b';
|
|
18
|
+
export function mikroOrmConfigFrom(inputs) {
|
|
19
|
+
// A dependency cycle is a diagnostic, not a throw: the graph is the primary
|
|
20
|
+
// ordering now, so refusing here would let one mis-declared manifest stop
|
|
21
|
+
// the whole platform's schema from migrating — and since a manifest can
|
|
22
|
+
// arrive from an installed package, that manifest may be a stranger's.
|
|
23
|
+
// Nothing in this file branches on it — warning is the whole reaction, and
|
|
24
|
+
// the platform boots and serves. The other two readers refuse instead, each
|
|
25
|
+
// where refusing costs nothing: test/unit/db/module-graph.test.ts fails the
|
|
26
|
+
// build on a cycle in the committed manifests, and the _lifecycle
|
|
27
|
+
// orchestrator refuses an install whose arrival closes one (FR-012).
|
|
28
|
+
// test/unit/db/migration-order-boot-warning.test.ts is the proof that this
|
|
29
|
+
// warning fires on a cycle and is silent without one.
|
|
30
|
+
for (const diagnostic of inputs.migrations.diagnostics) {
|
|
31
|
+
console.warn(diagnostic.message);
|
|
32
|
+
}
|
|
33
|
+
return defineConfig({
|
|
34
|
+
clientUrl: databaseUrl(),
|
|
35
|
+
namingStrategy: PluralizingNamingStrategy,
|
|
36
|
+
// Explicit class list, not a glob — glob discovery requires runtime
|
|
37
|
+
// dynamic `import()` of .ts files, which Node's ESM loader cannot
|
|
38
|
+
// transform and which breaks under Vitest. See
|
|
39
|
+
// backend/src/db/entities-registry.generated.ts for the rationale and for
|
|
40
|
+
// what emits it, and ./configured-entities.ts for the package half.
|
|
41
|
+
entities: [...inputs.entities],
|
|
42
|
+
// The tenant guard on the write side (D-260/A). One subscriber, over the
|
|
43
|
+
// classification registry the `@OrgScoped()` decorators already write, so
|
|
44
|
+
// there is nothing per entity and nothing per module to declare here as
|
|
45
|
+
// classes arrive. It is constructed rather than passed in because it takes
|
|
46
|
+
// no input: its subscribed set and its predicate are both `tenancy/`'s, and
|
|
47
|
+
// a host that could substitute it could switch the guard off.
|
|
48
|
+
// See ../tenancy/org-write-guard.ts for what it does and does not catch.
|
|
49
|
+
subscribers: [new OrgWriteGuardSubscriber()],
|
|
50
|
+
debug: process.env['NODE_ENV'] === 'development' && process.env['DB_DEBUG'] === 'true',
|
|
51
|
+
allowGlobalContext: false,
|
|
52
|
+
forceUndefined: true,
|
|
53
|
+
extensions: [Migrator],
|
|
54
|
+
migrations: {
|
|
55
|
+
migrationsList: inputs.migrations.migrations,
|
|
56
|
+
transactional: true,
|
|
57
|
+
disableForeignKeys: false,
|
|
58
|
+
allOrNothing: true,
|
|
59
|
+
emit: 'ts',
|
|
60
|
+
snapshot: false,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=mikro-orm.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mikro-orm.config.js","sourceRoot":"","sources":["../../src/db/mikro-orm.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAoDxE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,GAAG,GAAW,EAAE,CAC/B,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,yCAAyC,CAAC;AAE3E,MAAM,UAAU,kBAAkB,CAAC,MAA8B;IAC/D,4EAA4E;IAC5E,0EAA0E;IAC1E,wEAAwE;IACxE,uEAAuE;IACvE,2EAA2E;IAC3E,4EAA4E;IAC5E,4EAA4E;IAC5E,kEAAkE;IAClE,qEAAqE;IACrE,2EAA2E;IAC3E,sDAAsD;IACtD,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED,OAAO,YAAY,CAAC;QAClB,SAAS,EAAE,WAAW,EAAE;QACxB,cAAc,EAAE,yBAAyB;QACzC,oEAAoE;QACpE,kEAAkE;QAClE,+CAA+C;QAC/C,0EAA0E;QAC1E,oEAAoE;QACpE,QAAQ,EAAE,CAAC,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