@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,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MikroORM global-filter definitions for the tenant guard (feature 050).
|
|
3
|
+
*
|
|
4
|
+
* The `cond` functions read the ambient `TenantContext` DIRECTLY from
|
|
5
|
+
* AsyncLocalStorage at query time (not from `setFilterParams`). This makes the
|
|
6
|
+
* filter fork-independent: it applies correctly on the request-scoped EM, on
|
|
7
|
+
* `em.transactional` sub-forks, and on any other fork — because the store is
|
|
8
|
+
* read when the query runs, inside the caller's async context. A query executed
|
|
9
|
+
* with no ambient context throws `MissingTenantContextError` (fail-closed).
|
|
10
|
+
*
|
|
11
|
+
* The filters are attached (default-on, `args: false`) by the classification
|
|
12
|
+
* decorators in `org-scoped.decorator.ts`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ORG_FILTER = "org";
|
|
15
|
+
export declare const CUSTOMER_FILTER = "customerAccount";
|
|
16
|
+
/** The tenant key every `@CustomerScoped` entity carries, by definition. */
|
|
17
|
+
export declare const CUSTOMER_TENANT_KEY = "customerAccountId";
|
|
18
|
+
/**
|
|
19
|
+
* The organization column a `@CustomerScoped` entity carries **when it has
|
|
20
|
+
* one**. `Cart` does; the other fifteen do not yet (feature 087, FR-003).
|
|
21
|
+
*/
|
|
22
|
+
export declare const CUSTOMER_ORGANIZATION_KEY = "organizationId";
|
|
23
|
+
/**
|
|
24
|
+
* Whether the filtered entity carries {@link CUSTOMER_ORGANIZATION_KEY}.
|
|
25
|
+
*
|
|
26
|
+
* Derived per entity by the decorator from the ORM's own discovered metadata —
|
|
27
|
+
* never written down — so an entity that gains the column starts being filtered
|
|
28
|
+
* on it in the same run, and one that loses it stops. See
|
|
29
|
+
* `org-scoped.decorator.ts`.
|
|
30
|
+
*/
|
|
31
|
+
export type CustomerOrganizationColumn = 'present' | 'absent';
|
|
32
|
+
/** `where` fragment applied to `@OrgScoped` entities on their `organizationId`. */
|
|
33
|
+
export declare function orgFilterCond(): Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* `where` fragment applied to `@CustomerScoped` entities on their
|
|
36
|
+
* `customerAccountId` — and, for the `allowed-set` mode, on their own
|
|
37
|
+
* organization column when they carry one (feature 087, FR-001/FR-002).
|
|
38
|
+
*
|
|
39
|
+
* ## The `allowed-set` arm, and why it used to be empty
|
|
40
|
+
*
|
|
41
|
+
* It returned `{}`. An `allowed-set` context is what a `sales_representative`
|
|
42
|
+
* resolves to, so for that actor every one of the sixteen `@CustomerScoped`
|
|
43
|
+
* classes behaved exactly as if it were `@GlobalEntity`, and the tenant
|
|
44
|
+
* boundary on any admin surface over one was whatever that surface remembered
|
|
45
|
+
* to do for itself. That is a guard whose green means *not looking*: the code
|
|
46
|
+
* runs, returns successfully, and enforces nothing. Two surfaces did the work
|
|
47
|
+
* by hand (`carts`, `customers`); every other one disclosed another
|
|
48
|
+
* organization's rows, reads and writes alike.
|
|
49
|
+
*
|
|
50
|
+
* The arm now answers in one of two ways and never in a third:
|
|
51
|
+
*
|
|
52
|
+
* - **the entity carries `organizationId`** — the column compare the owner
|
|
53
|
+
* ruled for (exit (a′), 2026-08-24): `{ organizationId: { $in: allowed } }`,
|
|
54
|
+
* on a column of the filtered row's own table, no join and no subquery
|
|
55
|
+
* (FR-002). `Cart` is the one class in this state today.
|
|
56
|
+
* - **it does not** — the predicate matches **nothing**. That is not a
|
|
57
|
+
* placeholder, it is FR-011 applied to the state those tables are in: they
|
|
58
|
+
* carry no organization at all, so no row in them is inside a scoped
|
|
59
|
+
* actor's authority, and a row is never visible because a predicate was
|
|
60
|
+
* absent. When feature 087's Group A and Group B land the column, the same
|
|
61
|
+
* arm starts matching without another edit here.
|
|
62
|
+
*
|
|
63
|
+
* `{ customerAccountId: { $in: [] } }` is the match-nothing spelling because
|
|
64
|
+
* `customerAccountId` is the one column every `@CustomerScoped` entity carries
|
|
65
|
+
* by classification, so FR-002 holds for the refusal exactly as it does for the
|
|
66
|
+
* grant. An empty `allowed-set` therefore matches nothing on `@OrgScoped` and
|
|
67
|
+
* on `@CustomerScoped` alike (FR-007) — the two used to give the same actor
|
|
68
|
+
* opposite answers, and the `@CustomerScoped` one was "everything".
|
|
69
|
+
*
|
|
70
|
+
* **The refusal says so** (feature 087, owner decision of 2026-08-29). An empty
|
|
71
|
+
* list and "nothing exists" are the same three bytes to every layer above this
|
|
72
|
+
* one, so the refusing arm records itself on the ambient context's observation
|
|
73
|
+
* sink (`TenantScopeNotices`) and the host puts a code on the response
|
|
74
|
+
* envelope. That is derived rather than declared: no route sets a flag, no
|
|
75
|
+
* screen is remembered, and the day a table gains its column the same arm
|
|
76
|
+
* starts granting and the notice stops being emitted, in one edit that is this
|
|
77
|
+
* file's `organizationColumn` answer changing.
|
|
78
|
+
*
|
|
79
|
+
* **A surface that has already established the caller's authority may still
|
|
80
|
+
* read across this**, through the one sanctioned crossing (`withSystemScope`,
|
|
81
|
+
* feature 050 FR-005) and never through a bare `catch`. `customers`'
|
|
82
|
+
* `CustomerAddressService` is the worked example: it proves the caller may
|
|
83
|
+
* reach the account through `customer_accounts`' `@OrgScoped` read model first,
|
|
84
|
+
* and the widening covers only the rows of the account it just authorised.
|
|
85
|
+
*/
|
|
86
|
+
export declare function customerFilterCond(organizationColumn: CustomerOrganizationColumn): Record<string, unknown>;
|
|
87
|
+
//# sourceMappingURL=filters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.d.ts","sourceRoot":"","sources":["../../src/tenancy/filters.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,UAAU,QAAQ,CAAC;AAChC,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE9D,mFAAmF;AACnF,wBAAgB,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,wBAAgB,kBAAkB,CAChC,kBAAkB,EAAE,0BAA0B,GAC7C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBzB"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { getTenantContext, MissingTenantContextError, noteOrganizationAttributionRefusal, } from './tenant-context.js';
|
|
2
|
+
/**
|
|
3
|
+
* MikroORM global-filter definitions for the tenant guard (feature 050).
|
|
4
|
+
*
|
|
5
|
+
* The `cond` functions read the ambient `TenantContext` DIRECTLY from
|
|
6
|
+
* AsyncLocalStorage at query time (not from `setFilterParams`). This makes the
|
|
7
|
+
* filter fork-independent: it applies correctly on the request-scoped EM, on
|
|
8
|
+
* `em.transactional` sub-forks, and on any other fork — because the store is
|
|
9
|
+
* read when the query runs, inside the caller's async context. A query executed
|
|
10
|
+
* with no ambient context throws `MissingTenantContextError` (fail-closed).
|
|
11
|
+
*
|
|
12
|
+
* The filters are attached (default-on, `args: false`) by the classification
|
|
13
|
+
* decorators in `org-scoped.decorator.ts`.
|
|
14
|
+
*/
|
|
15
|
+
export const ORG_FILTER = 'org';
|
|
16
|
+
export const CUSTOMER_FILTER = 'customerAccount';
|
|
17
|
+
/** The tenant key every `@CustomerScoped` entity carries, by definition. */
|
|
18
|
+
export const CUSTOMER_TENANT_KEY = 'customerAccountId';
|
|
19
|
+
/**
|
|
20
|
+
* The organization column a `@CustomerScoped` entity carries **when it has
|
|
21
|
+
* one**. `Cart` does; the other fifteen do not yet (feature 087, FR-003).
|
|
22
|
+
*/
|
|
23
|
+
export const CUSTOMER_ORGANIZATION_KEY = 'organizationId';
|
|
24
|
+
/** `where` fragment applied to `@OrgScoped` entities on their `organizationId`. */
|
|
25
|
+
export function orgFilterCond() {
|
|
26
|
+
const ctx = getTenantContext();
|
|
27
|
+
if (!ctx)
|
|
28
|
+
throw new MissingTenantContextError(`filter '${ORG_FILTER}'`);
|
|
29
|
+
switch (ctx.mode) {
|
|
30
|
+
case 'all':
|
|
31
|
+
case 'system':
|
|
32
|
+
return {};
|
|
33
|
+
case 'single-org':
|
|
34
|
+
// The `?? null` is belt-and-braces and **matches nothing** since D-178.
|
|
35
|
+
// A `single-org` context with a null organisation was producible by
|
|
36
|
+
// exactly one thing — a signed-in customer whose `customer_accounts` row
|
|
37
|
+
// had `organization_id IS NULL` — and that column is `NOT NULL` now.
|
|
38
|
+
// Until it was, this line put every such customer into one shared tenant
|
|
39
|
+
// bucket: two of them resolved the same predicate and saw each other's
|
|
40
|
+
// `@OrgScoped` rows. The type keeps the coalesce (`TenantContext`'s field
|
|
41
|
+
// is optional); the platform no longer has a caller for it.
|
|
42
|
+
return { organizationId: ctx.organizationId ?? null };
|
|
43
|
+
case 'allowed-set':
|
|
44
|
+
return { organizationId: { $in: [...(ctx.allowedOrganizationIds ?? [])] } };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* `where` fragment applied to `@CustomerScoped` entities on their
|
|
49
|
+
* `customerAccountId` — and, for the `allowed-set` mode, on their own
|
|
50
|
+
* organization column when they carry one (feature 087, FR-001/FR-002).
|
|
51
|
+
*
|
|
52
|
+
* ## The `allowed-set` arm, and why it used to be empty
|
|
53
|
+
*
|
|
54
|
+
* It returned `{}`. An `allowed-set` context is what a `sales_representative`
|
|
55
|
+
* resolves to, so for that actor every one of the sixteen `@CustomerScoped`
|
|
56
|
+
* classes behaved exactly as if it were `@GlobalEntity`, and the tenant
|
|
57
|
+
* boundary on any admin surface over one was whatever that surface remembered
|
|
58
|
+
* to do for itself. That is a guard whose green means *not looking*: the code
|
|
59
|
+
* runs, returns successfully, and enforces nothing. Two surfaces did the work
|
|
60
|
+
* by hand (`carts`, `customers`); every other one disclosed another
|
|
61
|
+
* organization's rows, reads and writes alike.
|
|
62
|
+
*
|
|
63
|
+
* The arm now answers in one of two ways and never in a third:
|
|
64
|
+
*
|
|
65
|
+
* - **the entity carries `organizationId`** — the column compare the owner
|
|
66
|
+
* ruled for (exit (a′), 2026-08-24): `{ organizationId: { $in: allowed } }`,
|
|
67
|
+
* on a column of the filtered row's own table, no join and no subquery
|
|
68
|
+
* (FR-002). `Cart` is the one class in this state today.
|
|
69
|
+
* - **it does not** — the predicate matches **nothing**. That is not a
|
|
70
|
+
* placeholder, it is FR-011 applied to the state those tables are in: they
|
|
71
|
+
* carry no organization at all, so no row in them is inside a scoped
|
|
72
|
+
* actor's authority, and a row is never visible because a predicate was
|
|
73
|
+
* absent. When feature 087's Group A and Group B land the column, the same
|
|
74
|
+
* arm starts matching without another edit here.
|
|
75
|
+
*
|
|
76
|
+
* `{ customerAccountId: { $in: [] } }` is the match-nothing spelling because
|
|
77
|
+
* `customerAccountId` is the one column every `@CustomerScoped` entity carries
|
|
78
|
+
* by classification, so FR-002 holds for the refusal exactly as it does for the
|
|
79
|
+
* grant. An empty `allowed-set` therefore matches nothing on `@OrgScoped` and
|
|
80
|
+
* on `@CustomerScoped` alike (FR-007) — the two used to give the same actor
|
|
81
|
+
* opposite answers, and the `@CustomerScoped` one was "everything".
|
|
82
|
+
*
|
|
83
|
+
* **The refusal says so** (feature 087, owner decision of 2026-08-29). An empty
|
|
84
|
+
* list and "nothing exists" are the same three bytes to every layer above this
|
|
85
|
+
* one, so the refusing arm records itself on the ambient context's observation
|
|
86
|
+
* sink (`TenantScopeNotices`) and the host puts a code on the response
|
|
87
|
+
* envelope. That is derived rather than declared: no route sets a flag, no
|
|
88
|
+
* screen is remembered, and the day a table gains its column the same arm
|
|
89
|
+
* starts granting and the notice stops being emitted, in one edit that is this
|
|
90
|
+
* file's `organizationColumn` answer changing.
|
|
91
|
+
*
|
|
92
|
+
* **A surface that has already established the caller's authority may still
|
|
93
|
+
* read across this**, through the one sanctioned crossing (`withSystemScope`,
|
|
94
|
+
* feature 050 FR-005) and never through a bare `catch`. `customers`'
|
|
95
|
+
* `CustomerAddressService` is the worked example: it proves the caller may
|
|
96
|
+
* reach the account through `customer_accounts`' `@OrgScoped` read model first,
|
|
97
|
+
* and the widening covers only the rows of the account it just authorised.
|
|
98
|
+
*/
|
|
99
|
+
export function customerFilterCond(organizationColumn) {
|
|
100
|
+
const ctx = getTenantContext();
|
|
101
|
+
if (!ctx)
|
|
102
|
+
throw new MissingTenantContextError(`filter '${CUSTOMER_FILTER}'`);
|
|
103
|
+
switch (ctx.mode) {
|
|
104
|
+
case 'all':
|
|
105
|
+
case 'system':
|
|
106
|
+
return {};
|
|
107
|
+
case 'single-org':
|
|
108
|
+
return { [CUSTOMER_TENANT_KEY]: ctx.customerAccountId ?? null };
|
|
109
|
+
case 'allowed-set': {
|
|
110
|
+
const allowed = [...(ctx.allowedOrganizationIds ?? [])];
|
|
111
|
+
if (organizationColumn === 'present') {
|
|
112
|
+
return { [CUSTOMER_ORGANIZATION_KEY]: { $in: allowed } };
|
|
113
|
+
}
|
|
114
|
+
// The predicate is unchanged; the line above it is a *record* that this
|
|
115
|
+
// execution was refused a whole table, which the host discloses on the
|
|
116
|
+
// response envelope (feature 087, owner decision of 2026-08-29). It is
|
|
117
|
+
// written here because this is the only place that knows the difference
|
|
118
|
+
// between "your reach excludes all of these" and "there are none", and
|
|
119
|
+
// both answers look like `[]` from every layer above. Nothing in the
|
|
120
|
+
// guard reads it back: it is an observation, not an input.
|
|
121
|
+
noteOrganizationAttributionRefusal(ctx);
|
|
122
|
+
return { [CUSTOMER_TENANT_KEY]: { $in: [] } };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/tenancy/filters.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC;AAChC,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEjD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAEvD;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAY1D,mFAAmF;AACnF,MAAM,UAAU,aAAa;IAC3B,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,yBAAyB,CAAC,WAAW,UAAU,GAAG,CAAC,CAAC;IACxE,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,QAAQ;YACX,OAAO,EAAE,CAAC;QACZ,KAAK,YAAY;YACf,wEAAwE;YACxE,oEAAoE;YACpE,yEAAyE;YACzE,qEAAqE;YACrE,yEAAyE;YACzE,uEAAuE;YACvE,0EAA0E;YAC1E,4DAA4D;YAC5D,OAAO,EAAE,cAAc,EAAE,GAAG,CAAC,cAAc,IAAI,IAAI,EAAE,CAAC;QACxD,KAAK,aAAa;YAChB,OAAO,EAAE,cAAc,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;IAChF,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,MAAM,UAAU,kBAAkB,CAChC,kBAA8C;IAE9C,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,yBAAyB,CAAC,WAAW,eAAe,GAAG,CAAC,CAAC;IAC7E,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,KAAK,CAAC;QACX,KAAK,QAAQ;YACX,OAAO,EAAE,CAAC;QACZ,KAAK,YAAY;YACf,OAAO,EAAE,CAAC,mBAAmB,CAAC,EAAE,GAAG,CAAC,iBAAiB,IAAI,IAAI,EAAE,CAAC;QAClE,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC,CAAC,CAAC;YACxD,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;gBACrC,OAAO,EAAE,CAAC,yBAAyB,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC;YAC3D,CAAC;YACD,wEAAwE;YACxE,uEAAuE;YACvE,uEAAuE;YACvE,wEAAwE;YACxE,uEAAuE;YACvE,qEAAqE;YACrE,2DAA2D;YAC3D,kCAAkC,CAAC,GAAG,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC,mBAAmB,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tenant guard core layer (feature 050 — Systemic Organization Tenant Scoping).
|
|
3
|
+
* Peer of `events/`, `http/`, `kernel/`, `commands/`; becomes the `./tenancy`
|
|
4
|
+
* subpath of `@endora-commerce/platform` (feature 080, D-160.1/D-160.7), and
|
|
5
|
+
* that subpath is the boundary a future `@endora-commerce/tenancy` would take
|
|
6
|
+
* (D-160.6). See specs/050-org-tenant-scoping/.
|
|
7
|
+
*
|
|
8
|
+
* **This barrel is a package boundary in waiting, so it carries this
|
|
9
|
+
* directory's symbols and nothing else.** Re-exporting a kernel or commands
|
|
10
|
+
* symbol here to save a consumer one import line spends the split option for a
|
|
11
|
+
* convenience.
|
|
12
|
+
*
|
|
13
|
+
* **What is on it is decided by `contracts/host-package.md` §1.3, not by what
|
|
14
|
+
* happens to be here** (T042f, applying T042c's rule to this directory for the
|
|
15
|
+
* first time). Until T042f the barrel was an accumulation of 38 names over
|
|
16
|
+
* seven files, of which modules took **two** through the barrel itself —
|
|
17
|
+
* `getTenantContext` and `withSystemScope`, in four files — while the same
|
|
18
|
+
* directory was reached 237 times by relative path, for ten distinct names.
|
|
19
|
+
* Every one of those relative reaches becomes a bare specifier when its module
|
|
20
|
+
* moves, so the surface is decided by §1.3's symbol column and not by what
|
|
21
|
+
* happened to be re-exported here.
|
|
22
|
+
*
|
|
23
|
+
* So the rule is the kernel barrel's: a symbol is here when §1.3 records a
|
|
24
|
+
* module taking it from a file it marks **P** (rows 2, 21, 28, 30 and 45 — every
|
|
25
|
+
* file of this directory a module reaches is **P**), or when it is the argument,
|
|
26
|
+
* return or thrown shape of one of those. Everything else is reachable by
|
|
27
|
+
* relative path, which the composition roots and the tests have and a packaged
|
|
28
|
+
* module does not. `test/unit/kernel/published-surface.test.ts` is the two-way
|
|
29
|
+
* ratchet and carries the reason each removed name is not published.
|
|
30
|
+
*
|
|
31
|
+
* Two groups deserve naming here because a future author will look for them:
|
|
32
|
+
*
|
|
33
|
+
* - **the request pipeline** — `resolveTenantContext`, `systemTenantContext`,
|
|
34
|
+
* `orgPinnedTenantContext` and the four actor-input shapes, plus
|
|
35
|
+
* `runWithTenantContext` / `runInTenantContext` / `enterTenantContext` /
|
|
36
|
+
* `runWithoutTenantContext` and `forkScopedEm`. A context is derived
|
|
37
|
+
* server-side from the authenticated actor and established by the host; a
|
|
38
|
+
* module *reads* it (`getTenantContext`) or widens it explicitly
|
|
39
|
+
* (`withSystemScope`), and §1.3 gives none of those files a row because no
|
|
40
|
+
* module reaches one. `enterSystemScope` (kernel, row 13) is the
|
|
41
|
+
* module-facing entry for an execution that starts outside a request.
|
|
42
|
+
* - **the runtime classification registry** — `tenantClassifications`,
|
|
43
|
+
* `ClassificationMeta`, `ScopeClass` and the two filter names. The
|
|
44
|
+
* decorators write into the registry and attach the MikroORM filters; the
|
|
45
|
+
* host and `check-entity-tenant-classification` read them. A module applies
|
|
46
|
+
* a decorator and never names what it wrote.
|
|
47
|
+
*/
|
|
48
|
+
export {
|
|
49
|
+
/** Row 45 — `getTenantContext`'s return shape, and the parameter of every derived-scope helper. */
|
|
50
|
+
type TenantContext,
|
|
51
|
+
/**
|
|
52
|
+
* The fail-closed guarantee: a tenant-scoped query with no ambient context
|
|
53
|
+
* raises it, as does every derived-scope helper. A caller that cannot name it
|
|
54
|
+
* cannot handle the refusal.
|
|
55
|
+
*/
|
|
56
|
+
MissingTenantContextError, getTenantContext, } from './tenant-context.js';
|
|
57
|
+
/** Row 2 — 219 reaches from 59 modules, the largest single reach in the contract. */
|
|
58
|
+
export { OrgScoped, CustomerScoped, GlobalEntity, TransitivelyScoped, RuleScoped, } from './org-scoped.decorator.js';
|
|
59
|
+
/** Row 21 — the sanctioned cross-organization widening (FR-005/FR-013). */
|
|
60
|
+
export { withSystemScope } from './escape-hatch.js';
|
|
61
|
+
/** Row 28, plus `orgConstraintFor`'s return shape. */
|
|
62
|
+
export { orgConstraintFor, isOrgInScope, ruleVisibleForScope, type OrgConstraint, } from './derived-scope.js';
|
|
63
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tenancy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO;AACL,mGAAmG;AACnG,KAAK,aAAa;AAClB;;;;GAIG;AACH,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,qFAAqF;AACrF,OAAO,EACL,SAAS,EACT,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,UAAU,GACX,MAAM,2BAA2B,CAAC;AACnC,2EAA2E;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,sDAAsD;AACtD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tenant guard core layer (feature 050 — Systemic Organization Tenant Scoping).
|
|
3
|
+
* Peer of `events/`, `http/`, `kernel/`, `commands/`; becomes the `./tenancy`
|
|
4
|
+
* subpath of `@endora-commerce/platform` (feature 080, D-160.1/D-160.7), and
|
|
5
|
+
* that subpath is the boundary a future `@endora-commerce/tenancy` would take
|
|
6
|
+
* (D-160.6). See specs/050-org-tenant-scoping/.
|
|
7
|
+
*
|
|
8
|
+
* **This barrel is a package boundary in waiting, so it carries this
|
|
9
|
+
* directory's symbols and nothing else.** Re-exporting a kernel or commands
|
|
10
|
+
* symbol here to save a consumer one import line spends the split option for a
|
|
11
|
+
* convenience.
|
|
12
|
+
*
|
|
13
|
+
* **What is on it is decided by `contracts/host-package.md` §1.3, not by what
|
|
14
|
+
* happens to be here** (T042f, applying T042c's rule to this directory for the
|
|
15
|
+
* first time). Until T042f the barrel was an accumulation of 38 names over
|
|
16
|
+
* seven files, of which modules took **two** through the barrel itself —
|
|
17
|
+
* `getTenantContext` and `withSystemScope`, in four files — while the same
|
|
18
|
+
* directory was reached 237 times by relative path, for ten distinct names.
|
|
19
|
+
* Every one of those relative reaches becomes a bare specifier when its module
|
|
20
|
+
* moves, so the surface is decided by §1.3's symbol column and not by what
|
|
21
|
+
* happened to be re-exported here.
|
|
22
|
+
*
|
|
23
|
+
* So the rule is the kernel barrel's: a symbol is here when §1.3 records a
|
|
24
|
+
* module taking it from a file it marks **P** (rows 2, 21, 28, 30 and 45 — every
|
|
25
|
+
* file of this directory a module reaches is **P**), or when it is the argument,
|
|
26
|
+
* return or thrown shape of one of those. Everything else is reachable by
|
|
27
|
+
* relative path, which the composition roots and the tests have and a packaged
|
|
28
|
+
* module does not. `test/unit/kernel/published-surface.test.ts` is the two-way
|
|
29
|
+
* ratchet and carries the reason each removed name is not published.
|
|
30
|
+
*
|
|
31
|
+
* Two groups deserve naming here because a future author will look for them:
|
|
32
|
+
*
|
|
33
|
+
* - **the request pipeline** — `resolveTenantContext`, `systemTenantContext`,
|
|
34
|
+
* `orgPinnedTenantContext` and the four actor-input shapes, plus
|
|
35
|
+
* `runWithTenantContext` / `runInTenantContext` / `enterTenantContext` /
|
|
36
|
+
* `runWithoutTenantContext` and `forkScopedEm`. A context is derived
|
|
37
|
+
* server-side from the authenticated actor and established by the host; a
|
|
38
|
+
* module *reads* it (`getTenantContext`) or widens it explicitly
|
|
39
|
+
* (`withSystemScope`), and §1.3 gives none of those files a row because no
|
|
40
|
+
* module reaches one. `enterSystemScope` (kernel, row 13) is the
|
|
41
|
+
* module-facing entry for an execution that starts outside a request.
|
|
42
|
+
* - **the runtime classification registry** — `tenantClassifications`,
|
|
43
|
+
* `ClassificationMeta`, `ScopeClass` and the two filter names. The
|
|
44
|
+
* decorators write into the registry and attach the MikroORM filters; the
|
|
45
|
+
* host and `check-entity-tenant-classification` read them. A module applies
|
|
46
|
+
* a decorator and never names what it wrote.
|
|
47
|
+
*/
|
|
48
|
+
export {
|
|
49
|
+
/**
|
|
50
|
+
* The fail-closed guarantee: a tenant-scoped query with no ambient context
|
|
51
|
+
* raises it, as does every derived-scope helper. A caller that cannot name it
|
|
52
|
+
* cannot handle the refusal.
|
|
53
|
+
*/
|
|
54
|
+
MissingTenantContextError, getTenantContext, } from './tenant-context.js';
|
|
55
|
+
/** Row 2 — 219 reaches from 59 modules, the largest single reach in the contract. */
|
|
56
|
+
export { OrgScoped, CustomerScoped, GlobalEntity, TransitivelyScoped, RuleScoped, } from './org-scoped.decorator.js';
|
|
57
|
+
/** Row 21 — the sanctioned cross-organization widening (FR-005/FR-013). */
|
|
58
|
+
export { withSystemScope } from './escape-hatch.js';
|
|
59
|
+
/** Row 28, plus `orgConstraintFor`'s return shape. */
|
|
60
|
+
export { orgConstraintFor, isOrgInScope, ruleVisibleForScope, } from './derived-scope.js';
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tenancy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,OAAO;AAGL;;;;GAIG;AACH,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,qFAAqF;AACrF,OAAO,EACL,SAAS,EACT,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,UAAU,GACX,MAAM,2BAA2B,CAAC;AACnC,2EAA2E;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,sDAAsD;AACtD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-entity tenant-scope classification (feature 050, FR-006).
|
|
3
|
+
*
|
|
4
|
+
* Exactly one decorator MUST be applied to every persisted entity. `@OrgScoped`
|
|
5
|
+
* and `@CustomerScoped` also attach a default-on MikroORM global filter, so the
|
|
6
|
+
* data-layer guard applies automatically. The other three record classification
|
|
7
|
+
* only (enforcement is via `derived-scope.ts` or, for globals, none).
|
|
8
|
+
*
|
|
9
|
+
* The `check-entity-tenant-classification.ts` CI check reads the source to prove
|
|
10
|
+
* the classification is total; the runtime registry here supports introspection
|
|
11
|
+
* and tests.
|
|
12
|
+
*/
|
|
13
|
+
export type ScopeClass = 'org' | 'customer' | 'global' | 'transitive' | 'rule';
|
|
14
|
+
type EntityClass = new (...args: never[]) => object;
|
|
15
|
+
export interface ClassificationMeta {
|
|
16
|
+
readonly target: EntityClass;
|
|
17
|
+
readonly className: string;
|
|
18
|
+
readonly scope: ScopeClass;
|
|
19
|
+
/** Tenant-key column for `org` / `customer`. */
|
|
20
|
+
readonly key?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Parent-aggregate class name + FK for `transitive` — see
|
|
23
|
+
* {@link TransitivelyScoped} for why the parent is a name and not a class.
|
|
24
|
+
*/
|
|
25
|
+
readonly parentClassName?: string;
|
|
26
|
+
readonly fk?: string;
|
|
27
|
+
}
|
|
28
|
+
/** All classified entities registered at import time. */
|
|
29
|
+
export declare function tenantClassifications(): readonly ClassificationMeta[];
|
|
30
|
+
/** Direct `organizationId` column. Filtered by the `org` global filter. */
|
|
31
|
+
export declare function OrgScoped(): (target: EntityClass) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Direct `customerAccountId` column. Filtered by the `customerAccount` filter.
|
|
34
|
+
*
|
|
35
|
+
* The filter's `allowed-set` arm also needs to know whether *this* entity
|
|
36
|
+
* carries an organization column of its own, so the `cond` forwards the ORM's
|
|
37
|
+
* `em` and `entityName` to {@link customerOrganizationColumn}. See
|
|
38
|
+
* `customerFilterCond` for what each answer means.
|
|
39
|
+
*/
|
|
40
|
+
export declare function CustomerScoped(): (target: EntityClass) => void;
|
|
41
|
+
/** Platform-global, exempt from all tenant filters. */
|
|
42
|
+
export declare function GlobalEntity(): (target: EntityClass) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Scoped through a parent aggregate's org (e.g. Invoice → Order). No own column.
|
|
45
|
+
*
|
|
46
|
+
* **The parent is named by its class name, not by the class** (feature 080,
|
|
47
|
+
* T049; ruling D-169). Both of this platform's transitive chains cross a module
|
|
48
|
+
* boundary — `Invoice` → `Order` and `KsefSubmission` → `Invoice` — and D-168
|
|
49
|
+
* says a module that has become a package publishes an `entities` array and no
|
|
50
|
+
* named entity class, so the symbol the old `() => Order` thunk closed over is
|
|
51
|
+
* one the child cannot import. Those two lines were the whole reason `invoices`
|
|
52
|
+
* and `ksef` could not be packaged. Nothing else in the tree took the thunk
|
|
53
|
+
* form, so there is one form and not two (Constitution IV).
|
|
54
|
+
*
|
|
55
|
+
* **Why the class name and not the table name.** {@link ClassificationMeta}
|
|
56
|
+
* already keys every row by `className`, so the lookup needs no second index
|
|
57
|
+
* and no per-module token registry; MikroORM refuses two entities sharing a
|
|
58
|
+
* class name at discovery (`MetadataValidator`), so the name is a
|
|
59
|
+
* platform-wide unique key the ORM already enforces rather than an assumption
|
|
60
|
+
* written down here; and no reader of this registry — `filters.ts`,
|
|
61
|
+
* `derived-scope.ts`, `kernel/scope.ts`, `check-entity-tenant-classification`
|
|
62
|
+
* — asks for a table. Resolving a table name would mean re-deriving it through
|
|
63
|
+
* the naming strategy or reading `MetadataStorage`, which is only populated
|
|
64
|
+
* after ORM discovery, i.e. later than the moment this has to answer.
|
|
65
|
+
*
|
|
66
|
+
* The name is resolved lazily by {@link resolveTransitiveParent}: entity
|
|
67
|
+
* classes register in import order and a child is routinely imported before its
|
|
68
|
+
* parent, so resolving here would refuse a chain that is perfectly good.
|
|
69
|
+
*/
|
|
70
|
+
export declare function TransitivelyScoped(parentClassName: string, fk: string): (target: EntityClass) => void;
|
|
71
|
+
/**
|
|
72
|
+
* A `@TransitivelyScoped` chain from which no tenant can be read.
|
|
73
|
+
*
|
|
74
|
+
* It is an error and never a fallback. A transitively scoped entity carries no
|
|
75
|
+
* tenant column of its own, so an unresolved parent leaves it reachable with no
|
|
76
|
+
* tenant predicate at all — Principle XI (non-negotiable) defeated by a silence,
|
|
77
|
+
* which is exactly the failure mode a name-addressed parent would otherwise
|
|
78
|
+
* introduce. Resolution therefore has two outcomes and no third: the one
|
|
79
|
+
* classified entity carrying that name, or this.
|
|
80
|
+
*
|
|
81
|
+
* **It is also the error for a chain that resolves at every step and grounds
|
|
82
|
+
* nowhere** (D-170): a `global` or `rule` terminus, a cycle, and a run of
|
|
83
|
+
* transitives reaching no keyed classification. **One error class, deliberately.**
|
|
84
|
+
* A caller can do nothing different about "your parent does not exist" and "your
|
|
85
|
+
* parent has no tenant to give you" — both are boot failures with the same
|
|
86
|
+
* remedy, a decorator to open — and a second class would invite a `catch` that
|
|
87
|
+
* distinguishes them, which is the beginning of a degraded mode. The degraded
|
|
88
|
+
* mode is an untenanted read.
|
|
89
|
+
*/
|
|
90
|
+
export declare class UnresolvableTenantParentError extends Error {
|
|
91
|
+
constructor(detail: string);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The classification of `child`'s parent aggregate, resolved by class name.
|
|
95
|
+
*
|
|
96
|
+
* Lazy and order-independent by construction: it reads the registry when it is
|
|
97
|
+
* called, never when the decorator ran. Throws {@link UnresolvableTenantParentError}
|
|
98
|
+
* — see that class for why there is no other outcome.
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveTransitiveParent(child: ClassificationMeta): ClassificationMeta;
|
|
101
|
+
/** Where the reconciliation's `info` lines go; a `PlatformLogger` satisfies it. */
|
|
102
|
+
export interface TenancyChainReporter {
|
|
103
|
+
info(obj: object, msg: string): void;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Reconcile every transitive chain in the registry, and refuse if any is broken.
|
|
107
|
+
*
|
|
108
|
+
* **This is where the refusal lives, and the placement is the decision.** The
|
|
109
|
+
* decorator cannot refuse — a child is routinely decorated before its parent is
|
|
110
|
+
* imported, so an eager check would reject working chains. The *first
|
|
111
|
+
* resolution* cannot be the only refusal either: nothing in this repository
|
|
112
|
+
* resolves a parent on a request path today, so a chain that stopped resolving
|
|
113
|
+
* would sit there unmeasured, which is the silence this exists to remove. So
|
|
114
|
+
* the host reconciles the whole registry once, at the moment it enumerates the
|
|
115
|
+
* entity classes it is about to configure the ORM with
|
|
116
|
+
* (`backend/src/db/configured-entities.ts`) — the first instant at which every
|
|
117
|
+
* classification decorator has run, core and installed package alike, and still
|
|
118
|
+
* before a single query can be issued.
|
|
119
|
+
*
|
|
120
|
+
* It reports **every** broken chain, not the first: an author who renamed an
|
|
121
|
+
* entity wants the whole list in one boot, not one per restart.
|
|
122
|
+
*
|
|
123
|
+
* ## Three outcomes (D-170)
|
|
124
|
+
*
|
|
125
|
+
* Silent for an `org` terminus. **Refused** for `global`, `rule`, a cycle or a
|
|
126
|
+
* run of transitives that grounds nowhere — see {@link walkTenancyChain}.
|
|
127
|
+
* **Accepted with one `info` line** for a `customer` terminus, which is legal
|
|
128
|
+
* because it grounds (a real column, a default-on filter, and `CustomerAccount`
|
|
129
|
+
* is itself `@OrgScoped`, so the customer axis narrows the org axis rather than
|
|
130
|
+
* competing with it) and reported because of a measured circularity:
|
|
131
|
+
* `customerFilterCond()` returns `{ customerAccountId: … }` in `single-org`
|
|
132
|
+
* mode and **`{}` — no predicate at all — in `allowed-set`**, where that file's
|
|
133
|
+
* own comment says an org-scoped admin "cannot be expressed as a
|
|
134
|
+
* customer-account predicate… such rows are reached **via transitive scoping**
|
|
135
|
+
* where needed". A chain terminating there is therefore unfiltered for an
|
|
136
|
+
* org-scoped admin, and the recorded remedy for that is the very mechanism doing
|
|
137
|
+
* the terminating. Worth a line; not worth a throw, since refusing would police
|
|
138
|
+
* a defect the terminus did not cause — the `{}` applies to all customer-scoped
|
|
139
|
+
* entities either way — and would forbid a shape with nowhere else to go, a
|
|
140
|
+
* customer-scoped parent having no `organizationId` column to continue through.
|
|
141
|
+
*
|
|
142
|
+
* The notices are emitted before the refusal rather than instead of it: each
|
|
143
|
+
* chain is judged on its own, and suppressing a true report about one because
|
|
144
|
+
* another is broken would make the line come and go for unrelated reasons.
|
|
145
|
+
*/
|
|
146
|
+
export declare function assertTransitiveParentsResolve(report?: TenancyChainReporter): void;
|
|
147
|
+
/** Org targeting lives in a rule (e.g. price_lists `applicationRule`), not a column. */
|
|
148
|
+
export declare function RuleScoped(): (target: EntityClass) => void;
|
|
149
|
+
export {};
|
|
150
|
+
//# sourceMappingURL=org-scoped.decorator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"org-scoped.decorator.d.ts","sourceRoot":"","sources":["../../src/tenancy/org-scoped.decorator.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;AAG/E,KAAK,WAAW,GAAG,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,MAAM,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,gDAAgD;IAChD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,yDAAyD;AACzD,wBAAgB,qBAAqB,IAAI,SAAS,kBAAkB,EAAE,CAErE;AAsDD,2EAA2E;AAC3E,wBAAgB,SAAS,IAAI,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAKzD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAO9D;AAED,uDAAuD;AACvD,wBAAgB,YAAY,IAAI,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAI5D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,MAAM,EACvB,EAAE,EAAE,MAAM,GACT,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAI/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;gBAC1C,MAAM,EAAE,MAAM;CAI3B;AAmCD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,kBAAkB,GAAG,kBAAkB,CAIrF;AAmGD,mFAAmF;AACnF,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAqBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,8BAA8B,CAC5C,MAAM,GAAE,oBAAsC,GAC7C,IAAI,CAwBN;AAED,wFAAwF;AACxF,wBAAgB,UAAU,IAAI,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAI1D"}
|