@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,101 @@
|
|
|
1
|
+
import type { FastifyBaseLogger, FastifyRequest } from 'fastify';
|
|
2
|
+
/**
|
|
3
|
+
* API Interceptor mechanism (feature 060).
|
|
4
|
+
*
|
|
5
|
+
* Modules register pre/post interceptors against HTTP endpoints owned by
|
|
6
|
+
* other modules, identified by the stable `"<METHOD> <route pattern>"`
|
|
7
|
+
* endpoint identity (the same key the OpenAPI auto-registration dedupes on).
|
|
8
|
+
*
|
|
9
|
+
* Contract: specs/060-api-interceptor/contracts/interceptor-registry.md
|
|
10
|
+
* Docs: docs/docs/architecture/api-interceptor.md
|
|
11
|
+
*/
|
|
12
|
+
export type InterceptorPhase = 'pre' | 'post';
|
|
13
|
+
/** Read-only view of the intercepted request, shared by both phases. */
|
|
14
|
+
export interface InterceptorRequestInfo {
|
|
15
|
+
/** Concrete HTTP method of this request (uppercase). */
|
|
16
|
+
readonly method: string;
|
|
17
|
+
/** Concrete request URL (with real params, query string included). */
|
|
18
|
+
readonly url: string;
|
|
19
|
+
/** The endpoint identity that matched, e.g. `POST /api/v1/orders`. */
|
|
20
|
+
readonly identity: string;
|
|
21
|
+
readonly headers: FastifyRequest['headers'];
|
|
22
|
+
/** Child logger pre-bound with `{interceptorModule, interceptorId, phase}` attribution. */
|
|
23
|
+
readonly log: FastifyBaseLogger;
|
|
24
|
+
/**
|
|
25
|
+
* The underlying Fastify request — exposes `request.actor` and whatever else
|
|
26
|
+
* the composition decorates it with. The resolved sales channel is NOT among
|
|
27
|
+
* them since feature 072: it lives on the request scope, read through
|
|
28
|
+
* `getResolvedChannel()`.
|
|
29
|
+
* Treat as read-only: interceptors adjust request data ONLY through the
|
|
30
|
+
* pre-phase `body` mechanism, never by mutating the raw request.
|
|
31
|
+
*/
|
|
32
|
+
readonly raw: FastifyRequest;
|
|
33
|
+
}
|
|
34
|
+
export interface PreInterceptorContext {
|
|
35
|
+
readonly request: InterceptorRequestInfo;
|
|
36
|
+
/** The VALIDATED request body (post-Zod). Mutate it or return a replacement. */
|
|
37
|
+
body: unknown;
|
|
38
|
+
readonly query: unknown;
|
|
39
|
+
readonly params: unknown;
|
|
40
|
+
}
|
|
41
|
+
export interface PostInterceptorContext {
|
|
42
|
+
readonly request: InterceptorRequestInfo;
|
|
43
|
+
/** Always < 400 — post interceptors never run on error responses. */
|
|
44
|
+
readonly statusCode: number;
|
|
45
|
+
/** The un-serialized response payload produced by the endpoint (or a previous interceptor). */
|
|
46
|
+
readonly payload: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Pre-phase handler. Runs after the route's own preHandler guards
|
|
50
|
+
* (auth/authz) and after schema validation, immediately before the handler.
|
|
51
|
+
* Veto by throwing `HttpError` with a registered `ErrorCode`; any other
|
|
52
|
+
* throw is a failure and yields 500 INTERNAL (fail-closed).
|
|
53
|
+
*/
|
|
54
|
+
export type PreInterceptorHandler = (ctx: PreInterceptorContext) => void | {
|
|
55
|
+
body?: unknown;
|
|
56
|
+
} | Promise<void | {
|
|
57
|
+
body?: unknown;
|
|
58
|
+
}>;
|
|
59
|
+
/**
|
|
60
|
+
* Post-phase handler. Runs at preSerialization for successful responses.
|
|
61
|
+
* Return the replacement payload, or `undefined` to leave it unchanged.
|
|
62
|
+
* MUST be side-effect-free with respect to persistence — the endpoint's
|
|
63
|
+
* own write may already be committed when a post interceptor runs.
|
|
64
|
+
*/
|
|
65
|
+
export type PostInterceptorHandler = (ctx: PostInterceptorContext) => unknown | Promise<unknown>;
|
|
66
|
+
interface InterceptorRegistrationBase {
|
|
67
|
+
/** Owning module id — execution is lifecycle-gated on this module's enabled state. */
|
|
68
|
+
module: string;
|
|
69
|
+
/** Unique within the module (kebab-case by convention). */
|
|
70
|
+
id: string;
|
|
71
|
+
/** One or more endpoint identities, `"<METHOD> <route pattern>"`. */
|
|
72
|
+
target: string | string[];
|
|
73
|
+
/** Ascending execution order; default 0. Ties break on (module, id) lexicographic. */
|
|
74
|
+
order?: number;
|
|
75
|
+
}
|
|
76
|
+
export type InterceptorRegistration = (InterceptorRegistrationBase & {
|
|
77
|
+
phase: 'pre';
|
|
78
|
+
handler: PreInterceptorHandler;
|
|
79
|
+
}) | (InterceptorRegistrationBase & {
|
|
80
|
+
phase: 'post';
|
|
81
|
+
handler: PostInterceptorHandler;
|
|
82
|
+
});
|
|
83
|
+
/** A registration normalized by the registry (targets resolved, order defaulted). */
|
|
84
|
+
export interface ResolvedRegistration {
|
|
85
|
+
readonly module: string;
|
|
86
|
+
readonly id: string;
|
|
87
|
+
readonly phase: InterceptorPhase;
|
|
88
|
+
readonly order: number;
|
|
89
|
+
readonly targets: readonly string[];
|
|
90
|
+
readonly handler: PreInterceptorHandler | PostInterceptorHandler;
|
|
91
|
+
}
|
|
92
|
+
/** One row of the execution plan exposed by `ApiInterceptorRegistry.list()`. */
|
|
93
|
+
export interface InterceptorListItem {
|
|
94
|
+
readonly target: string;
|
|
95
|
+
readonly phase: InterceptorPhase;
|
|
96
|
+
readonly order: number;
|
|
97
|
+
readonly module: string;
|
|
98
|
+
readonly id: string;
|
|
99
|
+
}
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/http/interceptors/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEjE;;;;;;;;;GASG;AAEH,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9C,wEAAwE;AACxE,MAAM,WAAW,sBAAsB;IACrC,wDAAwD;IACxD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IAC5C,2FAA2F;IAC3F,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,GAAG,EAAE,cAAc,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,gFAAgF;IAChF,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,sBAAsB,CAAC;IACzC,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,+FAA+F;IAC/F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAClC,GAAG,EAAE,qBAAqB,KACvB,IAAI,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,GAAG;IAAE,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE,sBAAsB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAEjG,UAAU,2BAA2B;IACnC,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,EAAE,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,uBAAuB,GAC/B,CAAC,2BAA2B,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAA;CAAE,CAAC,GAChF,CAAC,2BAA2B,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,sBAAsB,CAAA;CAAE,CAAC,CAAC;AAEvF,qFAAqF;AACrF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,qBAAqB,GAAG,sBAAsB,CAAC;CAClE;AAED,gFAAgF;AAChF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/http/interceptors/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ApiInterceptorRegistry } from './registry.js';
|
|
2
|
+
import type { RouteTable } from './route-table.js';
|
|
3
|
+
/**
|
|
4
|
+
* Boot-time validation of interceptor targets (feature 060, FR-010/SC-007).
|
|
5
|
+
* Runs in `buildServer`'s onReady hook, after every module has registered its
|
|
6
|
+
* routes and before any traffic is served. Fail-closed: a typo'd target
|
|
7
|
+
* refuses startup instead of silently never firing (Constitution XV).
|
|
8
|
+
*
|
|
9
|
+
* This used to cite the overlay pattern's `UnknownOverrideTargetError` as the
|
|
10
|
+
* precedent. That refusal is retired with the file-shadowing mechanism it
|
|
11
|
+
* guarded (D-201, feature 103) — and it was the wrong precedent by then
|
|
12
|
+
* anyway: it had been unreachable since the core module index emptied, so what
|
|
13
|
+
* it cited was a promise nothing kept. The stance is right on its own terms; a
|
|
14
|
+
* mechanism that cannot fire is not a mechanism a second one should model
|
|
15
|
+
* itself on.
|
|
16
|
+
*
|
|
17
|
+
* A target owned by a currently-disabled module is NOT an error: the route is
|
|
18
|
+
* still mounted (it 503s via defineModuleRoutes gating) and the interceptor
|
|
19
|
+
* is simply inert until the module is enabled.
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateRegistrations(registry: ApiInterceptorRegistry, routeTable: RouteTable): void;
|
|
22
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/http/interceptors/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,sBAAsB,EAChC,UAAU,EAAE,UAAU,GACrB,IAAI,CAyBN"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boot-time validation of interceptor targets (feature 060, FR-010/SC-007).
|
|
3
|
+
* Runs in `buildServer`'s onReady hook, after every module has registered its
|
|
4
|
+
* routes and before any traffic is served. Fail-closed: a typo'd target
|
|
5
|
+
* refuses startup instead of silently never firing (Constitution XV).
|
|
6
|
+
*
|
|
7
|
+
* This used to cite the overlay pattern's `UnknownOverrideTargetError` as the
|
|
8
|
+
* precedent. That refusal is retired with the file-shadowing mechanism it
|
|
9
|
+
* guarded (D-201, feature 103) — and it was the wrong precedent by then
|
|
10
|
+
* anyway: it had been unreachable since the core module index emptied, so what
|
|
11
|
+
* it cited was a promise nothing kept. The stance is right on its own terms; a
|
|
12
|
+
* mechanism that cannot fire is not a mechanism a second one should model
|
|
13
|
+
* itself on.
|
|
14
|
+
*
|
|
15
|
+
* A target owned by a currently-disabled module is NOT an error: the route is
|
|
16
|
+
* still mounted (it 503s via defineModuleRoutes gating) and the interceptor
|
|
17
|
+
* is simply inert until the module is enabled.
|
|
18
|
+
*/
|
|
19
|
+
export function validateRegistrations(registry, routeTable) {
|
|
20
|
+
const problems = [];
|
|
21
|
+
for (const reg of registry.registrations()) {
|
|
22
|
+
for (const target of reg.targets) {
|
|
23
|
+
const route = routeTable.get(target);
|
|
24
|
+
if (!route) {
|
|
25
|
+
problems.push(`module '${reg.module}' interceptor '${reg.id}' targets unknown endpoint '${target}' — ` +
|
|
26
|
+
`no such route is mounted in this deployment.`);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (reg.phase === 'post' && route.streamingResponse) {
|
|
30
|
+
problems.push(`module '${reg.module}' interceptor '${reg.id}' declares phase 'post' on streaming endpoint ` +
|
|
31
|
+
`'${target}' — streaming/binary payloads bypass serialization and cannot be reshaped.`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (problems.length > 0) {
|
|
36
|
+
throw new Error(`[api-interceptor] boot validation failed:\n - ${problems.join('\n - ')}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/http/interceptors/validation.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAgC,EAChC,UAAsB;IAEtB,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,GAAG,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC;QAC3C,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACrC,IAAI,CAAC,KAAK,EAAE,CAAC;gBACX,QAAQ,CAAC,IAAI,CACX,WAAW,GAAG,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,+BAA+B,MAAM,MAAM;oBACtF,8CAA8C,CACjD,CAAC;gBACF,SAAS;YACX,CAAC;YACD,IAAI,GAAG,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;gBACpD,QAAQ,CAAC,IAAI,CACX,WAAW,GAAG,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAE,gDAAgD;oBAC3F,IAAI,MAAM,4EAA4E,CACzF,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACb,kDAAkD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAC5E,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Logger as PinoLogger } from 'pino';
|
|
2
|
+
export type Logger = PinoLogger;
|
|
3
|
+
export interface CreateLoggerOptions {
|
|
4
|
+
level?: string;
|
|
5
|
+
/** When true (development), pretty-prints the output. */
|
|
6
|
+
pretty?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function createLogger(options?: CreateLoggerOptions): Logger;
|
|
9
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/http/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,IAAI,UAAU,EAAsB,MAAM,MAAM,CAAC;AAE3E,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAEhC,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAwBtE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { pino } from 'pino';
|
|
2
|
+
export function createLogger(options = {}) {
|
|
3
|
+
const level = options.level ?? process.env['LOG_LEVEL'] ?? 'info';
|
|
4
|
+
const pretty = options.pretty ?? process.env['NODE_ENV'] !== 'production';
|
|
5
|
+
const loggerOptions = {
|
|
6
|
+
level,
|
|
7
|
+
base: { pid: process.pid },
|
|
8
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
9
|
+
redact: {
|
|
10
|
+
paths: ['req.headers.authorization', 'req.headers.cookie', '*.password', '*.passwordHash', '*.secret'],
|
|
11
|
+
censor: '[REDACTED]',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
if (pretty) {
|
|
15
|
+
return pino({
|
|
16
|
+
...loggerOptions,
|
|
17
|
+
transport: {
|
|
18
|
+
target: 'pino-pretty',
|
|
19
|
+
options: { colorize: true, translateTime: 'SYS:HH:MM:ss.l', ignore: 'pid,hostname' },
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return pino(loggerOptions);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/http/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAiD,MAAM,MAAM,CAAC;AAU3E,MAAM,UAAU,YAAY,CAAC,UAA+B,EAAE;IAC5D,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,YAAY,CAAC;IAE1E,MAAM,aAAa,GAAkB;QACnC,KAAK;QACL,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAC1B,SAAS,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO;QACxC,MAAM,EAAE;YACN,KAAK,EAAE,CAAC,2BAA2B,EAAE,oBAAoB,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,CAAC;YACtG,MAAM,EAAE,YAAY;SACrB;KACF,CAAC;IAEF,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;YACV,GAAG,aAAa;YAChB,SAAS,EAAE;gBACT,MAAM,EAAE,aAAa;gBACrB,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,cAAc,EAAE;aACrF;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
import { OpenAPIRegistry } from '@asteasolutions/zod-to-openapi';
|
|
3
|
+
/**
|
|
4
|
+
* Shared OpenAPI registry. Modules call `openApiRegistry.register(...)` during bootstrap
|
|
5
|
+
* so the live OpenAPI document served at /api/v1/_openapi.json is always generated from
|
|
6
|
+
* the same Zod schemas the Fastify routes validate against (R-05, Principle V).
|
|
7
|
+
*/
|
|
8
|
+
export declare const openApiRegistry: OpenAPIRegistry;
|
|
9
|
+
/**
|
|
10
|
+
* Registers an `onRoute` hook so every Fastify route auto-publishes into the OpenAPI
|
|
11
|
+
* registry. Avoids per-module registerPath boilerplate while still letting a module opt
|
|
12
|
+
* into a richer schema by calling `openApiRegistry.registerPath` directly.
|
|
13
|
+
*/
|
|
14
|
+
export declare function attachOpenApiAutoRegistration(app: FastifyInstance): void;
|
|
15
|
+
export interface OpenApiMetadata {
|
|
16
|
+
title: string;
|
|
17
|
+
version: string;
|
|
18
|
+
serverUrl: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function registerOpenApiRoutes(app: FastifyInstance, meta: OpenApiMetadata): void;
|
|
21
|
+
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/http/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAuB,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtF;;;;GAIG;AACH,eAAO,MAAM,eAAe,iBAAwB,CAAC;AAiBrD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAgCxE;AAMD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAkBD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,eAAe,GAAG,IAAI,CA0CvF"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { OpenApiGeneratorV31, OpenAPIRegistry } from '@asteasolutions/zod-to-openapi';
|
|
2
|
+
/**
|
|
3
|
+
* Shared OpenAPI registry. Modules call `openApiRegistry.register(...)` during bootstrap
|
|
4
|
+
* so the live OpenAPI document served at /api/v1/_openapi.json is always generated from
|
|
5
|
+
* the same Zod schemas the Fastify routes validate against (R-05, Principle V).
|
|
6
|
+
*/
|
|
7
|
+
export const openApiRegistry = new OpenAPIRegistry();
|
|
8
|
+
const HTTP_METHODS = new Set([
|
|
9
|
+
'get',
|
|
10
|
+
'post',
|
|
11
|
+
'put',
|
|
12
|
+
'delete',
|
|
13
|
+
'patch',
|
|
14
|
+
'head',
|
|
15
|
+
'options',
|
|
16
|
+
'trace',
|
|
17
|
+
]);
|
|
18
|
+
const seenRoutes = new Set();
|
|
19
|
+
/**
|
|
20
|
+
* Registers an `onRoute` hook so every Fastify route auto-publishes into the OpenAPI
|
|
21
|
+
* registry. Avoids per-module registerPath boilerplate while still letting a module opt
|
|
22
|
+
* into a richer schema by calling `openApiRegistry.registerPath` directly.
|
|
23
|
+
*/
|
|
24
|
+
export function attachOpenApiAutoRegistration(app) {
|
|
25
|
+
app.addHook('onRoute', (route) => {
|
|
26
|
+
const rawMethod = route.method;
|
|
27
|
+
const methods = Array.isArray(rawMethod) ? rawMethod : [rawMethod];
|
|
28
|
+
const path = toOpenApiPath(route.url);
|
|
29
|
+
if (path === '/api/v1/_openapi.json' || path === '/api/v1/_docs')
|
|
30
|
+
return;
|
|
31
|
+
for (const m of methods) {
|
|
32
|
+
const method = m.toLowerCase();
|
|
33
|
+
if (!HTTP_METHODS.has(method))
|
|
34
|
+
continue;
|
|
35
|
+
// Fastify auto-registers HEAD for every GET; skip the duplicate.
|
|
36
|
+
if (method === 'head')
|
|
37
|
+
continue;
|
|
38
|
+
const key = `${method} ${path}`;
|
|
39
|
+
if (seenRoutes.has(key))
|
|
40
|
+
continue;
|
|
41
|
+
seenRoutes.add(key);
|
|
42
|
+
try {
|
|
43
|
+
openApiRegistry.registerPath({
|
|
44
|
+
method: method,
|
|
45
|
+
path,
|
|
46
|
+
responses: {
|
|
47
|
+
'200': { description: 'OK' },
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Swallow — auto-registration is best-effort; a route that can't be expressed
|
|
53
|
+
// here should opt into manual registration via openApiRegistry.registerPath.
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function toOpenApiPath(url) {
|
|
59
|
+
return url.replace(/:([A-Za-z0-9_]+)/g, '{$1}');
|
|
60
|
+
}
|
|
61
|
+
function buildDocument(meta) {
|
|
62
|
+
const generator = new OpenApiGeneratorV31(openApiRegistry.definitions);
|
|
63
|
+
const doc = generator.generateDocument({
|
|
64
|
+
openapi: '3.1.0',
|
|
65
|
+
info: {
|
|
66
|
+
title: meta.title,
|
|
67
|
+
version: meta.version,
|
|
68
|
+
description: 'B2B Platform API. Generated at runtime from the Zod schemas in @endora-commerce/contracts. ' +
|
|
69
|
+
'Source of truth: specs/001-b2b-platform-foundation/contracts/.',
|
|
70
|
+
},
|
|
71
|
+
servers: [{ url: meta.serverUrl }],
|
|
72
|
+
});
|
|
73
|
+
return doc;
|
|
74
|
+
}
|
|
75
|
+
export function registerOpenApiRoutes(app, meta) {
|
|
76
|
+
// Build the document lazily on first request — by then every module has registered
|
|
77
|
+
// its routes via the onRoute hook installed in attachOpenApiAutoRegistration().
|
|
78
|
+
let cached;
|
|
79
|
+
const getDoc = () => {
|
|
80
|
+
if (!cached) {
|
|
81
|
+
cached = buildDocument(meta);
|
|
82
|
+
}
|
|
83
|
+
return cached;
|
|
84
|
+
};
|
|
85
|
+
app.get('/api/v1/_openapi.json', async (_req, reply) => {
|
|
86
|
+
// Return the payload rather than calling `reply.send()` and then resolving
|
|
87
|
+
// the async handler with `undefined` — Fastify 5 treats the latter as a
|
|
88
|
+
// second send and raises ERR_HTTP_HEADERS_SENT.
|
|
89
|
+
reply.header('Content-Type', 'application/json');
|
|
90
|
+
return getDoc();
|
|
91
|
+
});
|
|
92
|
+
app.get('/api/v1/_docs', async (_req, reply) => {
|
|
93
|
+
// Minimal HTML shell rendering the spec via Swagger UI hosted on a CDN.
|
|
94
|
+
// Intentionally not adding a swagger-ui dependency (Principle IV) since this is dev-only.
|
|
95
|
+
reply
|
|
96
|
+
.header('Content-Type', 'text/html; charset=utf-8')
|
|
97
|
+
.send(`<!doctype html>
|
|
98
|
+
<html lang="en">
|
|
99
|
+
<head>
|
|
100
|
+
<meta charset="utf-8"/>
|
|
101
|
+
<title>B2B Platform API</title>
|
|
102
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swagger-ui-dist/swagger-ui.css"/>
|
|
103
|
+
</head>
|
|
104
|
+
<body>
|
|
105
|
+
<div id="swagger-ui"></div>
|
|
106
|
+
<script src="https://cdn.jsdelivr.net/npm/swagger-ui-dist/swagger-ui-bundle.js"></script>
|
|
107
|
+
<script>
|
|
108
|
+
window.onload = () => SwaggerUIBundle({ url: '/api/v1/_openapi.json', dom_id: '#swagger-ui' });
|
|
109
|
+
</script>
|
|
110
|
+
</body>
|
|
111
|
+
</html>`);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=openapi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.js","sourceRoot":"","sources":["../../src/http/openapi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGtF;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;AAErD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,KAAK;IACL,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,MAAM;IACN,SAAS;IACT,OAAO;CACC,CAAC,CAAC;AAIZ,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;AAErC;;;;GAIG;AACH,MAAM,UAAU,6BAA6B,CAAC,GAAoB;IAChE,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAC/B,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC;QAC/B,MAAM,OAAO,GAAa,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC7E,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEtC,IAAI,IAAI,KAAK,uBAAuB,IAAI,IAAI,KAAK,eAAe;YAAE,OAAO;QAEzE,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;YACxB,MAAM,MAAM,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;YAC/B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAoB,CAAC;gBAAE,SAAS;YACtD,iEAAiE;YACjE,IAAI,MAAM,KAAK,MAAM;gBAAE,SAAS;YAEhC,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;YAChC,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAS;YAClC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAEpB,IAAI,CAAC;gBACH,eAAe,CAAC,YAAY,CAAC;oBAC3B,MAAM,EAAE,MAAoB;oBAC5B,IAAI;oBACJ,SAAS,EAAE;wBACT,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;qBAC7B;iBACF,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,8EAA8E;gBAC9E,6EAA6E;YAC/E,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAQD,SAAS,aAAa,CAAC,IAAqB;IAC1C,MAAM,SAAS,GAAG,IAAI,mBAAmB,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;IACvE,MAAM,GAAG,GAAG,SAAS,CAAC,gBAAgB,CAAC;QACrC,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EACT,6FAA6F;gBAC7F,gEAAgE;SACnE;QACD,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;KACnC,CAAC,CAAC;IACH,OAAO,GAAsC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,GAAoB,EAAE,IAAqB;IAC/E,mFAAmF;IACnF,gFAAgF;IAChF,IAAI,MAAwC,CAAC;IAC7C,MAAM,MAAM,GAAG,GAAyB,EAAE;QACxC,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,GAAG,CAAC,GAAG,CAAC,uBAAuB,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QACrD,2EAA2E;QAC3E,wEAAwE;QACxE,gDAAgD;QAChD,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QACjD,OAAO,MAAM,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;QAC7C,wEAAwE;QACxE,0FAA0F;QAC1F,KAAK;aACF,MAAM,CAAC,cAAc,EAAE,0BAA0B,CAAC;aAClD,IAAI,CACH;;;;;;;;;;;;;;QAcA,CACD,CAAC;IACN,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { FastifyReply, FastifyRequest } from 'fastify';
|
|
2
|
+
import { type ProductAudience } from '@endora-commerce/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* The {@link ProductAudience} of a request, off the actor the auth plugin
|
|
5
|
+
* resolved (issue #227).
|
|
6
|
+
*
|
|
7
|
+
* It lives beside {@link testAdminUserId} rather than in `catalog`, for the
|
|
8
|
+
* reason that helper does: it reads a `FastifyRequest` decoration and nothing
|
|
9
|
+
* else, and six modules serve a product to a buyer. A copy per module is six
|
|
10
|
+
* chances to answer "is an unbound API key authenticated?" differently, and the
|
|
11
|
+
* answer is not obvious enough to be re-derived six times.
|
|
12
|
+
*
|
|
13
|
+
* Three actor kinds can reach a catalogue read, and each answers differently:
|
|
14
|
+
*
|
|
15
|
+
* - **`customer`** — a signed-in buyer. `organizationId` is stamped on the
|
|
16
|
+
* actor by the auth plugin and is `null` for the guest-style accounts
|
|
17
|
+
* feature 026 allows, which is exactly the caller `logged_in_only` exists
|
|
18
|
+
* to distinguish from the public.
|
|
19
|
+
* - **`api_key`** — an integration. A *bound* distributor key carries the
|
|
20
|
+
* organisation it acts for and gets that organisation's answer; an unbound
|
|
21
|
+
* key carries none. Both are authenticated: an unbound key is a caller the
|
|
22
|
+
* platform has identified, so it sees `logged_in_only` rows and no
|
|
23
|
+
* allow-listed ones. That is the same answer the buyer whose session has no
|
|
24
|
+
* Organization gets, and it is deliberate — a key that should see a
|
|
25
|
+
* distributor's restricted assortment is a key that should be bound to that
|
|
26
|
+
* distributor.
|
|
27
|
+
* - **`admin`** and **`anonymous`** — the public answer. An admin reading the
|
|
28
|
+
* *storefront* API is shopping, not administering; the surfaces whose job is
|
|
29
|
+
* to show every product are the `/api/v1/admin/*` ones, and they are gated
|
|
30
|
+
* by `requireAdmin` rather than by this.
|
|
31
|
+
*
|
|
32
|
+
* A request with no actor at all — a composition that mounted these routes
|
|
33
|
+
* without the auth plugin — reads as anonymous, which is the fail-closed end.
|
|
34
|
+
*
|
|
35
|
+
* The actor used to be read through a **local** inline shape rather than off the
|
|
36
|
+
* `fastify` module augmentation, because that augmentation was declared in
|
|
37
|
+
* `modules/auth/plugin.ts` — so a platform file depending on it depended on a
|
|
38
|
+
* module (D-52/D-53), and it did not compile at all once these directories were
|
|
39
|
+
* compiled as `@endora-commerce/platform`, where no module is in the program.
|
|
40
|
+
* T118b moved the declaration here (`./request-actor.js`) and the shape to
|
|
41
|
+
* `@endora-commerce/contracts`, so the restatement is gone and this reads the
|
|
42
|
+
* type every other consumer reads.
|
|
43
|
+
*
|
|
44
|
+
* The **widening** stays and is this site's own: `request.actor` is decorated
|
|
45
|
+
* by `auth`'s `onRequest` hook, and these routes can be mounted by a
|
|
46
|
+
* composition that never mounted the plugin. `undefined` was already the
|
|
47
|
+
* answer for such a request and is still the fail-closed one.
|
|
48
|
+
*/
|
|
49
|
+
export declare function productAudienceOf(request: FastifyRequest): ProductAudience;
|
|
50
|
+
/**
|
|
51
|
+
* Marks a response whose prices were resolved for a specific buying
|
|
52
|
+
* organisation as private and unstorable.
|
|
53
|
+
*
|
|
54
|
+
* The catalogue's public reads are the platform's most cacheable responses:
|
|
55
|
+
* before this existed, `GET /api/v1/catalog/products` and the product detail
|
|
56
|
+
* carried **no** `Cache-Control` at all, and their representation was a pure
|
|
57
|
+
* function of `(channel, currency, locale)`. Making the price depend on the
|
|
58
|
+
* caller makes the priced part of that response *private*, and a shared cache
|
|
59
|
+
* holding one would hand one buyer's negotiated figure to the next caller of
|
|
60
|
+
* the same URL — a worse defect than quoting everybody the channel price.
|
|
61
|
+
*
|
|
62
|
+
* So the header is set on **exactly** the responses that changed, and the
|
|
63
|
+
* anonymous one is left byte-for-byte and header-for-header as it was: it is
|
|
64
|
+
* still the canonical answer a crawler indexes and the one the storefront's ISR
|
|
65
|
+
* window caches (Principle VII). `no-store` rather than `private, max-age=0`
|
|
66
|
+
* because there is no revalidation story here worth the ambiguity — a
|
|
67
|
+
* personalised price is re-resolved per request, and `price_lists`' own
|
|
68
|
+
* in-process LRU is what keeps that cheap.
|
|
69
|
+
*
|
|
70
|
+
* `Vary` is deliberately not set. The credential here is a cookie, and `Vary:
|
|
71
|
+
* Cookie` is not a usable cache key (every unrelated cookie changes it); the
|
|
72
|
+
* leak direction — a personalised representation entering a shared cache — is
|
|
73
|
+
* closed by `no-store` alone, and the remaining direction, a shared cache
|
|
74
|
+
* answering a signed-in buyer with the stored *public* price, discloses nothing
|
|
75
|
+
* and is exactly the behaviour that shipped before this change.
|
|
76
|
+
*/
|
|
77
|
+
export declare function markPersonalisedPricing(reply: FastifyReply, audience: ProductAudience): void;
|
|
78
|
+
//# sourceMappingURL=product-audience.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-audience.d.ts","sourceRoot":"","sources":["../../src/http/product-audience.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,eAAe,CAU1E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,eAAe,GACxB,IAAI,CAGN"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { ANONYMOUS_PRODUCT_AUDIENCE, } from '@endora-commerce/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link ProductAudience} of a request, off the actor the auth plugin
|
|
4
|
+
* resolved (issue #227).
|
|
5
|
+
*
|
|
6
|
+
* It lives beside {@link testAdminUserId} rather than in `catalog`, for the
|
|
7
|
+
* reason that helper does: it reads a `FastifyRequest` decoration and nothing
|
|
8
|
+
* else, and six modules serve a product to a buyer. A copy per module is six
|
|
9
|
+
* chances to answer "is an unbound API key authenticated?" differently, and the
|
|
10
|
+
* answer is not obvious enough to be re-derived six times.
|
|
11
|
+
*
|
|
12
|
+
* Three actor kinds can reach a catalogue read, and each answers differently:
|
|
13
|
+
*
|
|
14
|
+
* - **`customer`** — a signed-in buyer. `organizationId` is stamped on the
|
|
15
|
+
* actor by the auth plugin and is `null` for the guest-style accounts
|
|
16
|
+
* feature 026 allows, which is exactly the caller `logged_in_only` exists
|
|
17
|
+
* to distinguish from the public.
|
|
18
|
+
* - **`api_key`** — an integration. A *bound* distributor key carries the
|
|
19
|
+
* organisation it acts for and gets that organisation's answer; an unbound
|
|
20
|
+
* key carries none. Both are authenticated: an unbound key is a caller the
|
|
21
|
+
* platform has identified, so it sees `logged_in_only` rows and no
|
|
22
|
+
* allow-listed ones. That is the same answer the buyer whose session has no
|
|
23
|
+
* Organization gets, and it is deliberate — a key that should see a
|
|
24
|
+
* distributor's restricted assortment is a key that should be bound to that
|
|
25
|
+
* distributor.
|
|
26
|
+
* - **`admin`** and **`anonymous`** — the public answer. An admin reading the
|
|
27
|
+
* *storefront* API is shopping, not administering; the surfaces whose job is
|
|
28
|
+
* to show every product are the `/api/v1/admin/*` ones, and they are gated
|
|
29
|
+
* by `requireAdmin` rather than by this.
|
|
30
|
+
*
|
|
31
|
+
* A request with no actor at all — a composition that mounted these routes
|
|
32
|
+
* without the auth plugin — reads as anonymous, which is the fail-closed end.
|
|
33
|
+
*
|
|
34
|
+
* The actor used to be read through a **local** inline shape rather than off the
|
|
35
|
+
* `fastify` module augmentation, because that augmentation was declared in
|
|
36
|
+
* `modules/auth/plugin.ts` — so a platform file depending on it depended on a
|
|
37
|
+
* module (D-52/D-53), and it did not compile at all once these directories were
|
|
38
|
+
* compiled as `@endora-commerce/platform`, where no module is in the program.
|
|
39
|
+
* T118b moved the declaration here (`./request-actor.js`) and the shape to
|
|
40
|
+
* `@endora-commerce/contracts`, so the restatement is gone and this reads the
|
|
41
|
+
* type every other consumer reads.
|
|
42
|
+
*
|
|
43
|
+
* The **widening** stays and is this site's own: `request.actor` is decorated
|
|
44
|
+
* by `auth`'s `onRequest` hook, and these routes can be mounted by a
|
|
45
|
+
* composition that never mounted the plugin. `undefined` was already the
|
|
46
|
+
* answer for such a request and is still the fail-closed one.
|
|
47
|
+
*/
|
|
48
|
+
export function productAudienceOf(request) {
|
|
49
|
+
const actor = request.actor;
|
|
50
|
+
if (!actor)
|
|
51
|
+
return ANONYMOUS_PRODUCT_AUDIENCE;
|
|
52
|
+
if (actor.kind === 'customer') {
|
|
53
|
+
return { organizationId: actor.organizationId ?? null, authenticated: true };
|
|
54
|
+
}
|
|
55
|
+
if (actor.kind === 'api_key') {
|
|
56
|
+
return { organizationId: actor.organizationId ?? null, authenticated: true };
|
|
57
|
+
}
|
|
58
|
+
return ANONYMOUS_PRODUCT_AUDIENCE;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Marks a response whose prices were resolved for a specific buying
|
|
62
|
+
* organisation as private and unstorable.
|
|
63
|
+
*
|
|
64
|
+
* The catalogue's public reads are the platform's most cacheable responses:
|
|
65
|
+
* before this existed, `GET /api/v1/catalog/products` and the product detail
|
|
66
|
+
* carried **no** `Cache-Control` at all, and their representation was a pure
|
|
67
|
+
* function of `(channel, currency, locale)`. Making the price depend on the
|
|
68
|
+
* caller makes the priced part of that response *private*, and a shared cache
|
|
69
|
+
* holding one would hand one buyer's negotiated figure to the next caller of
|
|
70
|
+
* the same URL — a worse defect than quoting everybody the channel price.
|
|
71
|
+
*
|
|
72
|
+
* So the header is set on **exactly** the responses that changed, and the
|
|
73
|
+
* anonymous one is left byte-for-byte and header-for-header as it was: it is
|
|
74
|
+
* still the canonical answer a crawler indexes and the one the storefront's ISR
|
|
75
|
+
* window caches (Principle VII). `no-store` rather than `private, max-age=0`
|
|
76
|
+
* because there is no revalidation story here worth the ambiguity — a
|
|
77
|
+
* personalised price is re-resolved per request, and `price_lists`' own
|
|
78
|
+
* in-process LRU is what keeps that cheap.
|
|
79
|
+
*
|
|
80
|
+
* `Vary` is deliberately not set. The credential here is a cookie, and `Vary:
|
|
81
|
+
* Cookie` is not a usable cache key (every unrelated cookie changes it); the
|
|
82
|
+
* leak direction — a personalised representation entering a shared cache — is
|
|
83
|
+
* closed by `no-store` alone, and the remaining direction, a shared cache
|
|
84
|
+
* answering a signed-in buyer with the stored *public* price, discloses nothing
|
|
85
|
+
* and is exactly the behaviour that shipped before this change.
|
|
86
|
+
*/
|
|
87
|
+
export function markPersonalisedPricing(reply, audience) {
|
|
88
|
+
if (audience.organizationId === null)
|
|
89
|
+
return;
|
|
90
|
+
reply.header('cache-control', 'private, no-store');
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=product-audience.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-audience.js","sourceRoot":"","sources":["../../src/http/product-audience.ts"],"names":[],"mappings":"AACA,OAAO,EACL,0BAA0B,GAG3B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAuB;IACvD,MAAM,KAAK,GAAG,OAAO,CAAC,KAA0B,CAAC;IACjD,IAAI,CAAC,KAAK;QAAE,OAAO,0BAA0B,CAAC;IAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IAC/E,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,IAAI,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC;IAC/E,CAAC;IACD,OAAO,0BAA0B,CAAC;AACpC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAmB,EACnB,QAAyB;IAEzB,IAAI,QAAQ,CAAC,cAAc,KAAK,IAAI;QAAE,OAAO;IAC7C,KAAK,CAAC,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Actor, ActorAdmin } from '@endora-commerce/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* `request.actor` and `request.adminActor`, declared once
|
|
4
|
+
* (`specs/110-instance-repository/` T118b).
|
|
5
|
+
*
|
|
6
|
+
* ## What this file is, and why it is the platform's
|
|
7
|
+
*
|
|
8
|
+
* An ambient augmentation reaches a consumer's program only if the file
|
|
9
|
+
* declaring it is *in* that program. This block used to live in
|
|
10
|
+
* `packages/modules/auth/src/backend/plugin.ts`, which made "may I read
|
|
11
|
+
* `request.actor`?" a question about whether the reader could name a **module**
|
|
12
|
+
* — and the four answers the tree gave were all bad ones:
|
|
13
|
+
*
|
|
14
|
+
* - `backend/src/composition.ts` kept a type-only import of
|
|
15
|
+
* `@endora-commerce/mod-auth/backend` whose only job was to drag the
|
|
16
|
+
* augmentation into its program. It had been arriving incidentally through a
|
|
17
|
+
* *value* import until feature 117 retired that, at which point thirty reads
|
|
18
|
+
* of `request.actor` stopped compiling at once.
|
|
19
|
+
* - Three platform files restated the shape structurally, because D-52/D-53
|
|
20
|
+
* refuses the kernel an import of a module — `request-language.ts`'
|
|
21
|
+
* `ActorSlice`, `product-audience.ts`' inline cast and
|
|
22
|
+
* `sales-channel-resolver.middleware.ts`' `ApiKeyActorSlice`. Each carried a
|
|
23
|
+
* comment naming the prohibition as the reason. They are the same shape
|
|
24
|
+
* written three times and checked against nothing.
|
|
25
|
+
* - A packaged module wrote a cast of its own, one per module, because `auth`
|
|
26
|
+
* publishes nothing a package's own program can name.
|
|
27
|
+
*
|
|
28
|
+
* The vocabulary itself is `@endora-commerce/contracts`' {@link Actor}; what is
|
|
29
|
+
* here is the Fastify half, because that package declares no dependency on
|
|
30
|
+
* Fastify. It is the same split, and the same reason, as
|
|
31
|
+
* `RequireCustomerGuard` and `AdminActorPromotion` in the platform's
|
|
32
|
+
* `kernel/ports/require-admin.ts`.
|
|
33
|
+
*
|
|
34
|
+
* ## `auth` still resolves it
|
|
35
|
+
*
|
|
36
|
+
* Only the *declaration* moved. `auth` owns the session table, the cookies, the
|
|
37
|
+
* `onRequest` hook that decides which of the four kinds a request carries, and
|
|
38
|
+
* the two `decorateRequest` slots these names read from. A composition that
|
|
39
|
+
* mounts no auth plugin leaves both undecorated — see the note on
|
|
40
|
+
* {@link FastifyRequest.actor} below, which is the one thing a platform-side
|
|
41
|
+
* reader has to know that a module-side one did not.
|
|
42
|
+
*
|
|
43
|
+
* ## It is carried by the `./http` barrel and exports nothing
|
|
44
|
+
*
|
|
45
|
+
* `http/index.ts` imports this file for its side effect. That is what puts the
|
|
46
|
+
* augmentation in the program of every consumer of `@endora-commerce/platform/http`
|
|
47
|
+
* without any of them naming it — a module writing
|
|
48
|
+
* `import '@endora-commerce/platform/http/request-actor.js'` would be a
|
|
49
|
+
* `whole-file-reach` under `check:platform-surface`, and there is no subpath to
|
|
50
|
+
* write it with anyway.
|
|
51
|
+
*/
|
|
52
|
+
declare module 'fastify' {
|
|
53
|
+
interface FastifyRequest {
|
|
54
|
+
/**
|
|
55
|
+
* Who is asking, resolved by `auth`'s `onRequest` hook.
|
|
56
|
+
*
|
|
57
|
+
* **Typed non-optional and decorated only where `auth` is composed.** The
|
|
58
|
+
* hook seeds `{ kind: 'anonymous' }` before any branch runs, so within a
|
|
59
|
+
* composition that mounts the auth plugin this is total and every consumer
|
|
60
|
+
* may read it as written. Outside one — a composition that mounts a
|
|
61
|
+
* module's routes without the plugin, or a reply Fastify is serialising
|
|
62
|
+
* before the hook has run — the decoration is simply absent, and a platform
|
|
63
|
+
* file that runs in that window says so at its own site rather than by
|
|
64
|
+
* widening this declaration. `request-language.ts` and
|
|
65
|
+
* `product-audience.ts` are the two that do; both answer the anonymous
|
|
66
|
+
* result, which is the fail-closed end.
|
|
67
|
+
*/
|
|
68
|
+
actor: Actor;
|
|
69
|
+
/**
|
|
70
|
+
* The admin session resolved from the dedicated admin cookie, independently
|
|
71
|
+
* of {@link actor}, so an admin signed in to the Admin UI and a customer
|
|
72
|
+
* signed in to the storefront can coexist in one browser. `null` when the
|
|
73
|
+
* request carries no admin cookie.
|
|
74
|
+
*
|
|
75
|
+
* `promoteAdminActor` — `auth`'s implementation of the platform's
|
|
76
|
+
* `AdminActorPromotion` port — is what moves this into {@link actor} for an
|
|
77
|
+
* admin route whose ambient actor is a customer.
|
|
78
|
+
*/
|
|
79
|
+
adminActor: ActorAdmin | null;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=request-actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-actor.d.ts","sourceRoot":"","sources":["../../src/http/request-actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,cAAc;QACtB;;;;;;;;;;;;;WAaG;QACH,KAAK,EAAE,KAAK,CAAC;QACb;;;;;;;;;WASG;QACH,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;KAC/B;CACF"}
|