@wildo-ai/saas-backend-lib 1.1.1 → 1.1.3
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/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
- package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
- package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts +14 -3
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +138 -24
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts +3 -1
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js +8 -3
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts +11 -0
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js +11 -2
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +48 -4
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +102 -30
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js +16 -0
- package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts +20 -6
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +96 -32
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts +3 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js +32 -7
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts +8 -5
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +80 -0
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +298 -23
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts +71 -1
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +85 -5
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +21 -0
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +146 -4
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts +3 -26
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js +3 -68
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +533 -43
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
- package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
- package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
- package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +54 -13
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
- package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
- package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
- package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
- package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
- package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
- package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +263 -13
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +376 -58
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +264 -7
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +414 -5
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +16 -0
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +140 -0
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +65 -6
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +45 -0
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
- package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/config/custom/application-config-controller.backend.service.js +7 -1
- package/dist/esm/config/custom/application-config-controller.backend.service.js.map +1 -1
- package/dist/esm/config/models/app-config.backend.schemas.d.ts +146 -46
- package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
- package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
- package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
- package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
- package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts +43 -1
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.js +52 -3
- package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
- package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
- package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts +2 -2
- package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js +2 -2
- package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js.map +1 -1
- package/dist/esm/databases/models/filter.backend.schemas.js +2 -2
- package/dist/esm/databases/models/filter.backend.schemas.js.map +1 -1
- package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
- package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js +20 -1
- package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js.map +1 -1
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
- package/dist/esm/databases/services/redis.service.d.ts +27 -0
- package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
- package/dist/esm/databases/services/redis.service.js +29 -0
- package/dist/esm/databases/services/redis.service.js.map +1 -1
- package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
- package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
- package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
- package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.js +134 -8
- package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
- package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
- package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
- package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts +41 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js +40 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js.map +1 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts +64 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js +193 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js.map +1 -0
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +72 -4
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +60 -19
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
- package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-transform.backend.js +7 -1
- package/dist/esm/external-data/external-data-transform.backend.js.map +1 -1
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts +2 -0
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js +13 -0
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js.map +1 -1
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
- package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
- package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +306 -7
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +539 -45
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
- package/dist/esm/files/controllers/file.controller.d.ts +24 -1
- package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
- package/dist/esm/files/controllers/file.controller.js +83 -11
- package/dist/esm/files/controllers/file.controller.js.map +1 -1
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts +17 -0
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -0
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js +1 -0
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -0
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +5 -1
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +76 -13
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-operation-handler.backend.service.d.ts +18 -0
- package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-operation-handler.backend.service.js +36 -28
- package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
- package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
- package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
- package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +214 -0
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -0
- package/dist/esm/files/services/file-upload-grant.backend.service.js +566 -0
- package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -0
- package/dist/esm/files/services/files.backend.service.d.ts +87 -0
- package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/files.backend.service.js +252 -19
- package/dist/esm/files/services/files.backend.service.js.map +1 -1
- package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
- package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
- package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
- package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
- package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
- package/dist/esm/files/utils/file-uploader.utils.js +12 -0
- package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +200 -44
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
- package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
- package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts +107 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.js +519 -56
- package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
- package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
- package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +151 -41
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +308 -143
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
- package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
- package/dist/esm/index.d.ts +15 -5
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +45 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/inject/models/container.d.ts.map +1 -1
- package/dist/esm/inject/models/container.js +82 -10
- package/dist/esm/inject/models/container.js.map +1 -1
- package/dist/esm/inject/models/service-types.d.ts +20 -3
- package/dist/esm/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/inject/models/service-types.js +21 -3
- package/dist/esm/inject/models/service-types.js.map +1 -1
- package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
- package/dist/esm/mcp/controllers/mcp.controller.js +32 -4
- package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts +34 -0
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.js +42 -0
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +84 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.js +235 -11
- package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts +64 -2
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +152 -6
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
- package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
- package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
- package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
- package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
- package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
- package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
- package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
- package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
- package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
- package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
- package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
- package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
- package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
- package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +108 -13
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +432 -101
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
- package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
- package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
- package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +54 -7
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts +5 -5
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js +14 -13
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts +2 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +18 -8
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +20 -18
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js +4 -1
- package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
- package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
- package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
- package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
- package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.js +1 -4
- package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
- package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-executor.backend.service.js +1 -4
- package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
- package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
- package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
- package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
- package/dist/esm/queue/queue.backend.service.d.ts +3 -3
- package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue.backend.service.js +26 -4
- package/dist/esm/queue/queue.backend.service.js.map +1 -1
- package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
- package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
- package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
- package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
- package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
- package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
- package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
- package/dist/esm/requests/service/websocket.service.d.ts +9 -0
- package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
- package/dist/esm/requests/service/websocket.service.js +88 -15
- package/dist/esm/requests/service/websocket.service.js.map +1 -1
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +16 -2
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
- package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
- package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
- package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
- package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
- package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
- package/dist/esm/resources/services/resource-id.backend.service.js +3 -3
- package/dist/esm/resources/services/resource-id.backend.service.js.map +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
- package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.js +91 -7
- package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
- package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
- package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
- package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
- package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
- package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
- package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
- package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
- package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/execution-context-creator.backend.service.js +13 -7
- package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
- package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
- package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts +47 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.js +343 -77
- package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
- package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
- package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts +3 -23
- package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/jwt.backend.schemas.js +20 -45
- package/dist/esm/security/authentications/models/jwt.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts +9 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +77 -2
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js +5 -3
- package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +41 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +87 -4
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
- package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
- package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js +24 -1
- package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js.map +1 -1
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts +117 -0
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js +104 -0
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js.map +1 -0
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +175 -14
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js +385 -49
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts +18 -1
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js +110 -74
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js.map +1 -1
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts +22 -0
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -0
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js +22 -0
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js.map +1 -0
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts +17 -3
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js +12 -0
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +41 -3
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +83 -20
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
- package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
- package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
- package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
- package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
- package/dist/esm/security/jwt/services/jwt.backend.service.js +1 -18
- package/dist/esm/security/jwt/services/jwt.backend.service.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
- package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
- package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +17 -9
- package/dist/esm/.builder.pid +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization-unit-custom-implementation.backend.service.js","sourceRoot":"","sources":["../../../../../src/organizations/services/organization-unit-custom-implementation.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,4BAA4B,EAC5B,kCAAkC,EAClC,8BAA8B,EAC9B,2BAA2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K,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,gBAAgB,EAAE;4BAC1E,OAAO,EAAE;gCACP,OAAO,EAAE,gFAAgF;gCACzF,YAAY,EAAE,gBAAgB,CAAC,kBAAkB;gCACjD,kBAAkB,EAAE,0BAA0B,CAAC,GAAG,CAAC;6BACpD;yBACF,CAAC,CAAC;oBACL,CAAC;oBAED,MAAM,kCAAkC,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;oBAEtF,kEAAkE;oBAClE,OAAO,KAAK,CAAC;gBACf,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CAAC,OAAgE,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/**\n * Organization Unit Custom Implementations\n *\n * DELETE dependents guard: refuses to delete an interior node of the organization tree while\n * child units still hang off it.\n */\n\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ErrorType,\n ErrorCustomMessageReference,\n OrganizationUnitStatus,\n OrganizationUnit_Operations,\n ResourceOperationVariantType,\n coreResourceShared_FieldIdentifier,\n buildOrganizationUnitChildPath,\n isOrganizationUnitInSubtree,\n organizationUnitAncestorIds,\n organizationUnitSubtreePrefix,\n rebaseOrganizationUnitPath,\n type OrganizationUnit,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ResourceOperation_CustomImplementation_Utils } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation-base.backend.service';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport {\n describeUnaddressableShape,\n resolveSingleSubjectId,\n} from '~wildo-backend-lib/base-classes/utils/single-subject-addressing.backend.utils';\n\n/**\n * The FK that materializes the organization-unit tree: a unit's parent node.\n *\n * Typed against {@link OrganizationUnit} so a rename of the field breaks the build here rather\n * than silently degrading the guard into a filter that matches nothing.\n */\nconst PARENT_UNIT_FK_FIELD: Extract<keyof OrganizationUnit, 'parentUnitId'> = 'parentUnitId';\n\n/**\n * Refuse removal of an organization unit while child units still hang off it.\n *\n * ## Why this guard exists\n *\n * `ORGANIZATION_UNITS -> ORGANIZATION_UNITS` (the tree self-edge on `parentUnitId`) is the ONE\n * `ORGANIZATIONS`-family relationship that declares no `onParentDelete` cascade. Deleting an\n * interior node therefore strands its entire subtree: every descendant keeps a `parentUnitId`\n * pointing at a row that no longer exists, and the materialized `path` of the whole branch — a\n * server-computed field (`.excludeFromCreate().excludeFromUpdate()`) that nothing recomputes —\n * silently describes a hierarchy that is no longer real. Neither is recoverable from the\n * remaining data, because the deleted node held the only link between the branch and its\n * grandparent.\n *\n * Enabling a cascade instead was rejected: the spec's stated policy is that the operator decides\n * where an orphaned branch belongs, and silently hard-deleting an arbitrarily deep subtree behind\n * a single-node DELETE is a far worse default for a `HIGH` risk-level operation than refusing it.\n *\n * The remedy is MOVE: re-parent each child onto another node, then delete the emptied leaf. MOVE\n * rewrites the materialized `path` of the whole subtree in one transaction, which a raw\n * `parentUnitId` edit never did — which is why `parentUnitId` became `.excludeFromUpdate()` in the\n * same pass that implemented MOVE (plan decision D-B2). Until then the guard's only escape hatch was\n * that raw edit, and it silently left every descendant's path describing a tree that no longer\n * existed.\n *\n * ## Scope: direct per-unit DELETE only\n *\n * Deleting the whole ORGANIZATION is a different path and is deliberately NOT affected. That\n * cascade IS enabled (`ORGANIZATIONS -> ORGANIZATION_UNITS`) and removes every unit of the\n * tenant in one pass — depth is irrelevant there because every unit, root or nested, carries the\n * tenant's `organizationId`. It also runs at the REPOSITORY level, which does not execute service\n * custom implementations, so this guard is structurally never consulted on that path. Tearing a\n * tenant down does not require dismantling its org chart leaf-by-leaf first.\n *\n * ## Why it fails closed\n *\n * DELETE is `riskLevel: HIGH`, so \"cannot verify\" must never read as \"nothing found\". An\n * unregistered `ORGANIZATION_UNITS` repository raises `CONFIGURATION` rather than being skipped,\n * and any scope-filter failure inside the read propagates instead of being swallowed.\n *\n * Detection uses `read()` rather than `count()` deliberately: `ORGANIZATION_UNITS` declares no\n * `COUNT` core operation, so `repository.count()` would throw INTERNAL. It does declare `READ`.\n * The read is a single indexed hit on `parentUnitId` (`.isDBIndexed()`), and the guard only needs\n * existence, not a tally.\n *\n * ## Also covered: unit assignments (since D-B5)\n *\n * Assigned members block the delete too. This dependent used to be EXCLUDED: unit assignment lived\n * in an embedded `OrganizationMember.organizationUnitsMembership` array, which is not a registered\n * relationship and has no adapter-neutral query — a dot-path filter into a JSONB array resolves to\n * NULL on PostgreSQL (matching nothing) and the LIST summary projection strips the field entirely,\n * so BOTH available scans would have failed OPEN on a guard whose whole purpose is to fail closed.\n * Promoting the assignment to the `ORGANIZATION_UNIT_MEMBERS` junction is exactly what made it\n * checkable, and it is now checked here on the same fail-closed terms as child units.\n *\n * @param unitId - The unit row about to be deleted.\n * @throws `CONFLICT` (409, `ORGANIZATION_UNIT_HAS_DEPENDENTS`) carrying whichever dependent blocked:\n * `blockingChildUnitId` for a child unit, `blockingUnitMemberId` for a member assignment.\n * @throws `CONFIGURATION` when the organization-units repository is not registered (unverifiable).\n */\nexport async function assertNoOrganizationUnitDependents(\n unitId: string,\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n): Promise<void> {\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n\n // Fail closed: an unregistered repository means we cannot prove the node is a leaf. Skipping\n // would silently downgrade the guard to \"nothing found\".\n if (!unitRepository) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'Cannot verify organization-unit dependents: the organization-units repository is not registered',\n organizationUnitId: unitId,\n childResourceType: CoreResourceType.ORGANIZATION_UNITS,\n },\n });\n }\n\n const blockingChildUnit = await unitRepository.read<OrganizationUnit>(executionContext, {\n [PARENT_UNIT_FK_FIELD]: unitId,\n });\n\n if (blockingChildUnit) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_HAS_DEPENDENTS,\n context: {\n organizationUnitId: unitId,\n blockingChildUnitId: blockingChildUnit._id,\n blockingChildUnitName: blockingChildUnit.name,\n },\n });\n }\n\n // Assigned members — checkable since D-B5 promoted unit assignment to a real junction resource.\n // Same fail-closed terms as the child-unit scan above: an unregistered repository means we cannot\n // prove the unit is unassigned, which must never read as \"nothing found\" on a HIGH-risk delete.\n const unitMemberRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNIT_MEMBERS);\n if (!unitMemberRepository) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'Cannot verify organization-unit assignments: the organization-unit-members repository is not registered',\n organizationUnitId: unitId,\n childResourceType: CoreResourceType.ORGANIZATION_UNIT_MEMBERS,\n },\n });\n }\n\n const blockingAssignment = await unitMemberRepository.read<{ _id: string; organizationMemberId: string }>(\n executionContext,\n { organizationUnitId: unitId },\n );\n\n if (blockingAssignment) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_HAS_DEPENDENTS,\n context: {\n organizationUnitId: unitId,\n blockingUnitMemberId: blockingAssignment._id,\n blockingOrganizationMemberId: blockingAssignment.organizationMemberId,\n },\n });\n }\n}\n\n/** The unit fields these implementations read; kept narrow so a schema rename breaks the build here. */\ntype OrganizationUnitTreeNodeRow = Pick<OrganizationUnit, '_id' | 'organizationId' | 'parentUnitId' | 'path' | 'status' | 'code' | 'name'>;\n\n/**\n * Load a unit that MUST exist inside the caller's scope, or fail with 404.\n *\n * Cross-tenant lookups resolve to \"not found\" rather than a conflict on purpose: the contextual\n * filter scopes the read to the caller's organization, so a unit belonging to another tenant is\n * simply absent. Reporting 409 there would confirm the existence of a row the caller may not see.\n */\nasync function loadScopedOrganizationUnit(\n unitId: string,\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n notFoundContext: Record<string, unknown>,\n): Promise<OrganizationUnitTreeNodeRow> {\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n if (!unitRepository) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: { message: 'The organization-units repository is not registered', ...notFoundContext },\n });\n }\n\n const unit = await unitRepository.read<OrganizationUnitTreeNodeRow>(executionContext, { _id: unitId });\n if (!unit) {\n throw utils.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: notFoundContext,\n });\n }\n return unit;\n}\n\n/**\n * Every unit strictly below `unit`, found by the materialized-path prefix.\n *\n * Uses `listForInternalScan` rather than `list`: this is an internal integrity sweep, and the LIST\n * summary projection would strip `path` — the one field the rewrite depends on.\n */\nasync function listOrganizationUnitDescendants(\n unit: OrganizationUnitTreeNodeRow,\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n): Promise<OrganizationUnitTreeNodeRow[]> {\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n const subtreePrefix = organizationUnitSubtreePrefix(unit);\n\n // Filter on the organization, then narrow by prefix in memory. An adapter-neutral \"starts with\"\n // filter does not exist across Mongo and SQL, and inventing one per adapter here would put a\n // query dialect inside a domain rule. Org trees are small (hundreds of nodes), and the scan is\n // already scoped to a single tenant.\n const scoped = await unitRepository.listForInternalScan<OrganizationUnitTreeNodeRow>(\n executionContext,\n { organizationId: unit.organizationId },\n utils.serviceOptions,\n );\n const rows: OrganizationUnitTreeNodeRow[] = Array.isArray(scoped) ? scoped : (scoped as { data: OrganizationUnitTreeNodeRow[] }).data;\n return rows.filter((row) => row._id !== unit._id && isOrganizationUnitInSubtree(row, unit));\n}\n\n/**\n * Refuse a `code` that is already taken by a sibling under `parentUnitId`.\n *\n * Sibling-scoped rather than org-wide: two teams called `sales` under different divisions are a\n * legitimate org chart, and `code` is optional so many rows carry none at all. That exact identity\n * — (`organizationId`, `parentUnitId`, `code`), scoped to rows that HAVE a code — is now also the\n * schema's business key, so MongoDB enforces it with a partial compound unique index.\n *\n * **This guard is deliberately KEPT rather than deleted as redundant.** Schema-declared uniqueness\n * is emitted for MongoDB only; the SQL planner records it as intent and leaves enforcement\n * migration-owned, so on a SQL adapter this function is the ONLY thing standing between two\n * same-coded siblings. It is a read-then-write and therefore still racy — under concurrency the\n * index is what actually closes the window on Mongo — but a racy check that usually wins is\n * strictly better than no check at all on an adapter that has no index to fall back to.\n *\n * Both layers raise the SAME reference. The index cannot know which operation was running, so an\n * operation-specific code would make one condition report differently depending on which write won\n * the race — an API client would have to handle both to recognise one situation.\n */\nasync function assertSiblingCodeAvailable(\n candidate: { unitId: string; organizationId: string; parentUnitId: string | undefined; code: string | undefined },\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n): Promise<void> {\n if (!candidate.code) return;\n\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n const sibling = await unitRepository.read<OrganizationUnitTreeNodeRow>(executionContext, {\n organizationId: candidate.organizationId,\n parentUnitId: candidate.parentUnitId ?? null,\n code: candidate.code,\n });\n\n if (sibling && sibling._id !== candidate.unitId) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_CODE_EXISTS,\n context: {\n reason: 'organization_unit_sibling_code_taken',\n organizationUnitId: candidate.unitId,\n conflictingUnitId: sibling._id,\n parentUnitId: candidate.parentUnitId ?? null,\n code: candidate.code,\n },\n });\n }\n}\n\n/**\n * CREATE prefix — materialize `path` on the SAME write that inserts the row.\n *\n * `path` is `.excludeFromCreate()` and was previously never written by anything, so every unit\n * persisted with an empty hierarchy path (the defect this closes). The prefix's return value is\n * merged into the create payload and passed through the loose repository write, which is how a\n * server-owned field reaches persistence without being client-settable.\n *\n * The path is derived from the PARENT alone — see the format contract in\n * `organization-units.shared.path.ts` for why it cannot include the new row's own id.\n */\nexport function createOrganizationUnitCreatePathFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: CoreResourceOperation.CREATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'organization-units.create.path-materialization',\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const authored = input as { parentUnitId?: string; organizationId?: string; code?: string };\n\n const organizationId = authored.organizationId\n ?? executionContext.getContextResourceId?.(coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS])\n ?? executionContext.initiatorIds?.organizationId;\n\n if (!organizationId) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: { message: 'An organization scope is required to place a unit in the tree', reason: 'organization_unit_create_unscoped' },\n });\n }\n\n // A parent that was NAMED but cannot be resolved must fail, never silently fall back to\n // root: the scoped read returns nothing for a unit in another tenant, and treating that as\n // \"no parent\" would quietly promote a cross-tenant child to a root of the caller's tree.\n const parentUnit = authored.parentUnitId\n ? await loadScopedOrganizationUnit(authored.parentUnitId, executionContext, utils, {\n reason: 'organization_unit_parent_not_found',\n parentUnitId: authored.parentUnitId,\n })\n : null;\n\n await assertSiblingCodeAvailable(\n { unitId: '', organizationId, parentUnitId: authored.parentUnitId, code: authored.code },\n executionContext,\n utils,\n );\n\n return { ...input, organizationId, path: buildOrganizationUnitChildPath(parentUnit) };\n },\n },\n });\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n\n/**\n * UPDATE prefix — keep sibling `code` unambiguous on a rename.\n *\n * Re-parenting is no longer reachable here (`parentUnitId` is `.excludeFromUpdate()` since MOVE\n * shipped — D-B2), so the only structural collision generic UPDATE can still cause is two same-coded\n * siblings under one parent. That is the surviving half of the spec's `ORGANIZATION_UNIT_CONFLICT`\n * scenario; the cycle half now lives entirely under MOVE.\n */\nexport function createOrganizationUnitUpdateFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: CoreResourceOperation.UPDATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'organization-units.update.sibling-code-guard',\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const patch = input as { code?: unknown };\n // Only a rename can collide. An update that leaves `code` alone cannot introduce a\n // duplicate, and re-checking it would 409 every unrelated edit of an already-valid row.\n if (typeof patch.code !== 'string' || patch.code.length === 0) return input;\n\n // Resolve rather than cast. The former `_id as string` asserted a shape the addressing\n // contract does not guarantee: a filter-addressed rename would have handed an OBJECT to a\n // by-id read, which builds `{ _id: <object> }` and matches nothing — surfacing as a spurious\n // NOT_FOUND while the sibling-code collision it was meant to catch went unchecked.\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: 'Organization unit UPDATE renaming `code` requires a single addressed unit',\n reason: 'organization_unit_rename_unaddressed',\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n const unit = await loadScopedOrganizationUnit(organizationUnitId, executionContext, utils, {\n reason: 'organization_unit_not_found',\n organizationUnitId,\n });\n\n await assertSiblingCodeAvailable(\n { unitId: unit._id, organizationId: unit.organizationId, parentUnitId: unit.parentUnitId ?? undefined, code: patch.code },\n executionContext,\n utils,\n );\n\n return input;\n },\n },\n });\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n\n/**\n * MOVE — re-parent a unit and re-home its entire subtree.\n *\n * The descendant rewrite is the part that must never be skipped: leaving it out is exactly the\n * \"materialized field nothing recomputes\" bug that `path` was already an instance of. Because the\n * rewrite spans many rows, the whole operation runs in one transaction — a partial rewrite would\n * leave the tree describing a shape that never existed.\n *\n * An absent `newParentUnitId` means \"promote to root\", which the request DTO models as optional. A\n * present-but-blank value is malformed and is refused rather than silently read as a promotion.\n *\n * ⚠️ Cost: the subtree rewrite is a scan plus one `update()` per descendant. `repository.updateMany`\n * is unavailable here — it requires an `UPDATE_MANY` core operation, which this resource does not\n * declare. Acceptable while org charts are small; revisit if deep trees appear.\n */\nexport function createOrganizationUnitMoveFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: OrganizationUnit_Operations.MOVE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'organization-units.move',\n // The subtree rewrite spans many ORGANIZATION_UNITS rows plus the moved node itself. A partial\n // rewrite would leave the tree describing a shape that never existed, so they share one unit\n // of work. No OTHER resource participates — the move is entirely within the unit tree.\n transactionalCore: true,\n transactionParticipants: {},\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n // A conditional `{ _id, … }` filter names one unit and is admitted; only a genuinely\n // population-addressed move is refused, since the subtree rewrite below is computed from\n // ONE node's path.\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: 'Organization unit MOVE requires a single addressed unit',\n reason: 'organization_unit_move_unaddressed',\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n const requested = input as { newParentUnitId?: unknown };\n const hasDestination = requested.newParentUnitId !== undefined && requested.newParentUnitId !== null;\n if (hasDestination && (typeof requested.newParentUnitId !== 'string' || requested.newParentUnitId.length === 0)) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: { message: 'newParentUnitId must be a non-empty unit id, or be omitted to promote the unit to a root', reason: 'organization_unit_move_malformed_destination' },\n });\n }\n const newParentUnitId = hasDestination ? (requested.newParentUnitId as string) : undefined;\n\n const unit = await loadScopedOrganizationUnit(organizationUnitId, executionContext, utils, {\n reason: 'organization_unit_not_found',\n organizationUnitId,\n });\n\n if (newParentUnitId === unit._id) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_MOVE_CONFLICT,\n context: { reason: 'organization_unit_move_onto_self', organizationUnitId: unit._id },\n });\n }\n\n const newParentUnit = newParentUnitId\n ? await loadScopedOrganizationUnit(newParentUnitId, executionContext, utils, {\n reason: 'organization_unit_destination_not_found',\n newParentUnitId,\n })\n : null;\n\n // O(1) cycle test — the payoff of the materialized path. Moving a node beneath one of its\n // own descendants would detach the branch: it would have no route back to the root.\n if (newParentUnit && isOrganizationUnitInSubtree(newParentUnit, unit)) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_MOVE_CONFLICT,\n context: {\n reason: 'organization_unit_move_would_create_cycle',\n organizationUnitId: unit._id,\n newParentUnitId,\n },\n });\n }\n\n // Raises ORGANIZATION_UNIT_CODE_EXISTS, not MOVE_CONFLICT: the destination itself is legal\n // here — it is the unit's own `code` that collides — so renaming the unit is a remedy that\n // choosing another destination is not. The two conditions want different client handling.\n await assertSiblingCodeAvailable(\n { unitId: unit._id, organizationId: unit.organizationId, parentUnitId: newParentUnitId, code: unit.code },\n executionContext,\n utils,\n );\n\n // Re-home the branch. Descendants are rewritten BEFORE the node's own update lands, so a\n // failure anywhere rolls the whole move back rather than leaving a half-moved tree.\n const oldSubtreePrefix = organizationUnitSubtreePrefix(unit);\n const newUnitPath = buildOrganizationUnitChildPath(newParentUnit);\n const newSubtreePrefix = `${newUnitPath}${unit._id}/`;\n\n const descendants = await listOrganizationUnitDescendants(unit, executionContext, utils);\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n for (const descendant of descendants) {\n await unitRepository.update(\n executionContext,\n descendant._id,\n { path: rebaseOrganizationUnitPath(descendant.path, oldSubtreePrefix, newSubtreePrefix) } as any,\n utils.serviceOptions,\n );\n }\n\n // The MOVE request DTO names no schema field, so the core UPDATE must be handed the real\n // mutation. `parentUnitId: null` (not `undefined`) is what clears the FK on a promotion.\n return { parentUnitId: newParentUnitId ?? null, path: newUnitPath };\n },\n },\n });\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n\n/**\n * ARCHIVE / RESTORE — node-only status transitions (plan decision Q-B1).\n *\n * Archiving a branch marks ONLY the node: descendants keep their own status, which makes ARCHIVE\n * O(1) and keeps restore order explicit. RESTORE pays for that by validating the ancestor chain —\n * restoring a node under a still-archived parent would leave an active unit reachable only through\n * an inactive one, which is the inconsistency the spec's 409 describes.\n */\nfunction createOrganizationUnitStatusTransitionFactory(\n operationIdentifier: OrganizationUnit_Operations.ARCHIVE | OrganizationUnit_Operations.RESTORE,\n): ResourceCustomServiceImplementationFactory {\n const isArchive = operationIdentifier === OrganizationUnit_Operations.ARCHIVE;\n\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: `organization-units.${isArchive ? 'archive' : 'restore'}`,\n handlers: {\n prefixCoreOperations: async (_id, _input, executionContext, _operationPath, utils) => {\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: `Organization unit ${operationIdentifier.toUpperCase()} requires a single addressed unit`,\n reason: 'organization_unit_status_transition_unaddressed',\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n const unit = await loadScopedOrganizationUnit(organizationUnitId, executionContext, utils, {\n reason: 'organization_unit_not_found',\n organizationUnitId,\n });\n\n const alreadyArchived = unit.status === OrganizationUnitStatus.ARCHIVED;\n if (isArchive === alreadyArchived) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_CONFLICT,\n context: {\n reason: isArchive ? 'organization_unit_already_archived' : 'organization_unit_not_archived',\n organizationUnitId: unit._id,\n currentStatus: unit.status,\n },\n });\n }\n\n if (!isArchive) {\n // Restore order is explicit: every ancestor must already be out of ARCHIVED.\n for (const ancestorId of organizationUnitAncestorIds(unit)) {\n const ancestor = await loadScopedOrganizationUnit(ancestorId, executionContext, utils, {\n reason: 'organization_unit_ancestor_not_found',\n organizationUnitId: unit._id,\n ancestorUnitId: ancestorId,\n });\n if (ancestor.status === OrganizationUnitStatus.ARCHIVED) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_CONFLICT,\n context: {\n reason: 'organization_unit_ancestor_still_archived',\n organizationUnitId: unit._id,\n blockingAncestorUnitId: ancestor._id,\n },\n });\n }\n }\n }\n\n // As with MOVE, the request DTO carries only `reason`, so the real mutation is supplied here.\n return { status: isArchive ? OrganizationUnitStatus.ARCHIVED : OrganizationUnitStatus.ACTIVE };\n },\n },\n });\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n/** ARCHIVE + RESTORE implementations. */\nexport function createOrganizationUnitStatusTransitionFactories(): ResourceCustomServiceImplementationFactory[] {\n return [\n createOrganizationUnitStatusTransitionFactory(OrganizationUnit_Operations.ARCHIVE),\n createOrganizationUnitStatusTransitionFactory(OrganizationUnit_Operations.RESTORE),\n ];\n}\n\n/**\n * Register {@link assertNoOrganizationUnitDependents} as the `ORGANIZATION_UNITS` DELETE prefix.\n *\n * PREFIX: refuses the delete with 409 `ORGANIZATION_UNIT_HAS_DEPENDENTS` while any child unit\n * still names this node as its parent. There is no CORE replacement — when the guard passes, the\n * standard DELETE proceeds untouched.\n *\n * Registered on `API_CALL` — the variant the resource configuration actually declares for DELETE.\n * Custom implementations are resolved by an exact operation-path key that embeds `variantType`,\n * so a guard registered under any other variant would never run.\n */\nexport function createOrganizationUnitDeleteDependentsGuardFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: CoreResourceOperation.DELETE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n // Fail closed: the dependent scan filters on a single unit id, so a POPULATION-addressed\n // delete (an ids array or an unpinned filter reaching this path via `doByOperationPath`)\n // must be refused rather than silently producing a filter that matches nothing and waving\n // the delete through. A conditional `{ _id, … }` filter resolves to the one unit the delete\n // can destroy and is admitted.\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: 'Organization unit DELETE requires a single addressed unit to verify dependents',\n resourceType: CoreResourceType.ORGANIZATION_UNITS,\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n await assertNoOrganizationUnitDependents(organizationUnitId, executionContext, utils);\n\n // Guard only — the core DELETE input is passed through unchanged.\n return input;\n },\n },\n });\n };\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"organization-unit-custom-implementation.backend.service.js","sourceRoot":"","sources":["../../../../../src/organizations/services/organization-unit-custom-implementation.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,4BAA4B,EAC5B,kCAAkC,EAClC,8BAA8B,EAC9B,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,EAC7B,0BAA0B,GAE3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yCAAyC,GAE1C,MAAM,4GAA4G,CAAC;AAIpH,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,+EAA+E,CAAC;AAEvF;;;;;GAKG;AACH,MAAM,oBAAoB,GAAoD,cAAc,CAAC;AAE7F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,MAAc,EACd,gBAAuC,EACvC,KAAmD;IAEnD,MAAM,cAAc,GAAG,KAAK,CAAC,oBAAoB,CAAC,aAAa,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IAErG,6FAA6F;IAC7F,yDAAyD;IACzD,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,MAAM,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,EAAE,gBAAgB,EAAE;YAC7E,sBAAsB,EAAE,2BAA2B,CAAC,aAAa;YACjE,OAAO,EAAE;gBACP,OAAO,EAAE,iGAAiG;gBAC1G,kBAAkB,EAAE,MAAM;gBAC1B,iBAAiB,EAAE,gBAAgB,CAAC,kBAAkB;aACvD;SACF,CAAC,CAAC;IACL,CAAC;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E,qBAAqB,CAAC,MAAM;gBACjD,WAAW,EAAE,4BAA4B,CAAC,QAAQ;gBAClD,kBAAkB,EAAE,IAAI;aACzB;YACD,QAAQ,EAAE;gBACR,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE;oBAClF,yFAAyF;oBACzF,yFAAyF;oBACzF,0FAA0F;oBAC1F,4FAA4F;oBAC5F,+BAA+B;oBAC/B,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;oBACvD,IAAI,kBAAkB,KAAK,SAAS,EAAE,CAAC;wBACrC,MAAM,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,gBAAgB,EAAE;4BAC1E,OAAO,EAAE;gCACP,OAAO,EAAE,gFAAgF;gCACzF,YAAY,EAAE,gBAAgB,CAAC,kBAAkB;gCACjD,kBAAkB,EAAE,0BAA0B,CAAC,GAAG,CAAC;6BACpD;yBACF,CAAC,CAAC;oBACL,CAAC;oBAED,MAAM,kCAAkC,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;oBAEtF,kEAAkE;oBAClE,OAAO,KAAK,CAAC;gBACf,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CAAC,OAAgE,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["/**\n * Organization Unit Custom Implementations\n *\n * DELETE dependents guard: refuses to delete an interior node of the organization tree while\n * child units still hang off it.\n */\n\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ErrorType,\n ErrorCustomMessageReference,\n OrganizationUnitStatus,\n OrganizationUnit_Operations,\n ResourceOperationVariantType,\n coreResourceShared_FieldIdentifier,\n buildOrganizationUnitChildPath,\n isOrganizationUnitInSubtree,\n organizationUnitAncestorIds,\n organizationUnitSubtreePrefix,\n rebaseOrganizationUnitPath,\n type OrganizationUnit,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ResourceOperation_CustomImplementation_Utils } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation-base.backend.service';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport {\n describeUnaddressableShape,\n resolveSingleSubjectId,\n} from '~wildo-backend-lib/base-classes/utils/single-subject-addressing.backend.utils';\n\n/**\n * The FK that materializes the organization-unit tree: a unit's parent node.\n *\n * Typed against {@link OrganizationUnit} so a rename of the field breaks the build here rather\n * than silently degrading the guard into a filter that matches nothing.\n */\nconst PARENT_UNIT_FK_FIELD: Extract<keyof OrganizationUnit, 'parentUnitId'> = 'parentUnitId';\n\n/**\n * Refuse removal of an organization unit while child units still hang off it.\n *\n * ## Why this guard exists\n *\n * `ORGANIZATION_UNITS -> ORGANIZATION_UNITS` (the tree self-edge on `parentUnitId`) is the ONE\n * `ORGANIZATIONS`-family relationship that declares no `onParentDelete` cascade. Deleting an\n * interior node therefore strands its entire subtree: every descendant keeps a `parentUnitId`\n * pointing at a row that no longer exists, and the materialized `path` of the whole branch — a\n * server-computed field (`.excludeFromCreate().excludeFromUpdate()`) that nothing recomputes —\n * silently describes a hierarchy that is no longer real. Neither is recoverable from the\n * remaining data, because the deleted node held the only link between the branch and its\n * grandparent.\n *\n * Enabling a cascade instead was rejected: the spec's stated policy is that the operator decides\n * where an orphaned branch belongs, and silently hard-deleting an arbitrarily deep subtree behind\n * a single-node DELETE is a far worse default for a `HIGH` risk-level operation than refusing it.\n *\n * The remedy is MOVE: re-parent each child onto another node, then delete the emptied leaf. MOVE\n * rewrites the materialized `path` of the whole subtree in one transaction, which a raw\n * `parentUnitId` edit never did — which is why `parentUnitId` became `.excludeFromUpdate()` in the\n * same pass that implemented MOVE (plan decision D-B2). Until then the guard's only escape hatch was\n * that raw edit, and it silently left every descendant's path describing a tree that no longer\n * existed.\n *\n * ## Scope: direct per-unit DELETE only\n *\n * Deleting the whole ORGANIZATION is a different path and is deliberately NOT affected. That\n * cascade IS enabled (`ORGANIZATIONS -> ORGANIZATION_UNITS`) and removes every unit of the\n * tenant in one pass — depth is irrelevant there because every unit, root or nested, carries the\n * tenant's `organizationId`. It also runs at the REPOSITORY level, which does not execute service\n * custom implementations, so this guard is structurally never consulted on that path. Tearing a\n * tenant down does not require dismantling its org chart leaf-by-leaf first.\n *\n * ## Why it fails closed\n *\n * DELETE is `riskLevel: HIGH`, so \"cannot verify\" must never read as \"nothing found\". An\n * unregistered `ORGANIZATION_UNITS` repository raises `CONFIGURATION` rather than being skipped,\n * and any scope-filter failure inside the read propagates instead of being swallowed.\n *\n * Detection uses `read()` rather than `count()` deliberately: `ORGANIZATION_UNITS` declares no\n * `COUNT` core operation, so `repository.count()` would throw INTERNAL. It does declare `READ`.\n * The read is a single indexed hit on `parentUnitId` (`.isDBIndexed()`), and the guard only needs\n * existence, not a tally.\n *\n * ## Also covered: unit assignments (since D-B5)\n *\n * Assigned members block the delete too. This dependent used to be EXCLUDED: unit assignment lived\n * in an embedded `OrganizationMember.organizationUnitsMembership` array, which is not a registered\n * relationship and has no adapter-neutral query — a dot-path filter into a JSONB array resolves to\n * NULL on PostgreSQL (matching nothing) and the LIST summary projection strips the field entirely,\n * so BOTH available scans would have failed OPEN on a guard whose whole purpose is to fail closed.\n * Promoting the assignment to the `ORGANIZATION_UNIT_MEMBERS` junction is exactly what made it\n * checkable, and it is now checked here on the same fail-closed terms as child units.\n *\n * @param unitId - The unit row about to be deleted.\n * @throws `CONFLICT` (409, `ORGANIZATION_UNIT_HAS_DEPENDENTS`) carrying whichever dependent blocked:\n * `blockingChildUnitId` for a child unit, `blockingUnitMemberId` for a member assignment.\n * @throws `CONFIGURATION` when the organization-units repository is not registered (unverifiable).\n */\nexport async function assertNoOrganizationUnitDependents(\n unitId: string,\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n): Promise<void> {\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n\n // Fail closed: an unregistered repository means we cannot prove the node is a leaf. Skipping\n // would silently downgrade the guard to \"nothing found\".\n if (!unitRepository) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'Cannot verify organization-unit dependents: the organization-units repository is not registered',\n organizationUnitId: unitId,\n childResourceType: CoreResourceType.ORGANIZATION_UNITS,\n },\n });\n }\n\n const blockingChildUnit = await unitRepository.read<OrganizationUnit>(executionContext, {\n [PARENT_UNIT_FK_FIELD]: unitId,\n });\n\n if (blockingChildUnit) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_HAS_DEPENDENTS,\n context: {\n organizationUnitId: unitId,\n blockingChildUnitId: blockingChildUnit._id,\n blockingChildUnitName: blockingChildUnit.name,\n },\n });\n }\n\n // Assigned members — checkable since D-B5 promoted unit assignment to a real junction resource.\n // Same fail-closed terms as the child-unit scan above: an unregistered repository means we cannot\n // prove the unit is unassigned, which must never read as \"nothing found\" on a HIGH-risk delete.\n const unitMemberRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNIT_MEMBERS);\n if (!unitMemberRepository) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'Cannot verify organization-unit assignments: the organization-unit-members repository is not registered',\n organizationUnitId: unitId,\n childResourceType: CoreResourceType.ORGANIZATION_UNIT_MEMBERS,\n },\n });\n }\n\n const blockingAssignment = await unitMemberRepository.read<{ _id: string; organizationMemberId: string }>(\n executionContext,\n { organizationUnitId: unitId },\n );\n\n if (blockingAssignment) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_HAS_DEPENDENTS,\n context: {\n organizationUnitId: unitId,\n blockingUnitMemberId: blockingAssignment._id,\n blockingOrganizationMemberId: blockingAssignment.organizationMemberId,\n },\n });\n }\n}\n\n/** The unit fields these implementations read; kept narrow so a schema rename breaks the build here. */\ntype OrganizationUnitTreeNodeRow = Pick<OrganizationUnit, '_id' | 'organizationId' | 'parentUnitId' | 'path' | 'status' | 'code' | 'name'>;\n\n/**\n * Load a unit that MUST exist inside the caller's scope, or fail with 404.\n *\n * Cross-tenant lookups resolve to \"not found\" rather than a conflict on purpose: the contextual\n * filter scopes the read to the caller's organization, so a unit belonging to another tenant is\n * simply absent. Reporting 409 there would confirm the existence of a row the caller may not see.\n */\nasync function loadScopedOrganizationUnit(\n unitId: string,\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n notFoundContext: Record<string, unknown>,\n): Promise<OrganizationUnitTreeNodeRow> {\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n if (!unitRepository) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: { message: 'The organization-units repository is not registered', ...notFoundContext },\n });\n }\n\n const unit = await unitRepository.read<OrganizationUnitTreeNodeRow>(executionContext, { _id: unitId });\n if (!unit) {\n throw utils.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: notFoundContext,\n });\n }\n return unit;\n}\n\n/**\n * Every unit strictly below `unit`, found by the materialized-path prefix.\n *\n * Uses `listForInternalScan` rather than `list`: this is an internal integrity sweep, and the LIST\n * summary projection would strip `path` — the one field the rewrite depends on.\n */\nasync function listOrganizationUnitDescendants(\n unit: OrganizationUnitTreeNodeRow,\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n): Promise<OrganizationUnitTreeNodeRow[]> {\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n const subtreePrefix = organizationUnitSubtreePrefix(unit);\n\n // Filter on the organization, then narrow by prefix in memory. An adapter-neutral \"starts with\"\n // filter does not exist across Mongo and SQL, and inventing one per adapter here would put a\n // query dialect inside a domain rule. Org trees are small (hundreds of nodes), and the scan is\n // already scoped to a single tenant.\n const scoped = await unitRepository.listForInternalScan<OrganizationUnitTreeNodeRow>(\n executionContext,\n { organizationId: unit.organizationId },\n utils.serviceOptions,\n );\n const rows: OrganizationUnitTreeNodeRow[] = Array.isArray(scoped) ? scoped : (scoped as { data: OrganizationUnitTreeNodeRow[] }).data;\n return rows.filter((row) => row._id !== unit._id && isOrganizationUnitInSubtree(row, unit));\n}\n\n/**\n * Refuse a `code` that is already taken by a sibling under `parentUnitId`.\n *\n * Sibling-scoped rather than org-wide: two teams called `sales` under different divisions are a\n * legitimate org chart, and `code` is optional so many rows carry none at all. That exact identity\n * — (`organizationId`, `parentUnitId`, `code`), scoped to rows that HAVE a code — is now also the\n * schema's business key, so MongoDB enforces it with a partial compound unique index.\n *\n * **This guard is deliberately KEPT rather than deleted as redundant.** Schema-declared uniqueness\n * is emitted for MongoDB only; the SQL planner records it as intent and leaves enforcement\n * migration-owned, so on a SQL adapter this function is the ONLY thing standing between two\n * same-coded siblings. It is a read-then-write and therefore still racy — under concurrency the\n * index is what actually closes the window on Mongo — but a racy check that usually wins is\n * strictly better than no check at all on an adapter that has no index to fall back to.\n *\n * Both layers raise the SAME reference. The index cannot know which operation was running, so an\n * operation-specific code would make one condition report differently depending on which write won\n * the race — an API client would have to handle both to recognise one situation.\n */\nasync function assertSiblingCodeAvailable(\n candidate: { unitId: string; organizationId: string; parentUnitId: string | undefined; code: string | undefined },\n executionContext: ExecutionContext<any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n): Promise<void> {\n if (!candidate.code) return;\n\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n const sibling = await unitRepository.read<OrganizationUnitTreeNodeRow>(executionContext, {\n organizationId: candidate.organizationId,\n parentUnitId: candidate.parentUnitId ?? null,\n code: candidate.code,\n });\n\n if (sibling && sibling._id !== candidate.unitId) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_CODE_EXISTS,\n context: {\n reason: 'organization_unit_sibling_code_taken',\n organizationUnitId: candidate.unitId,\n conflictingUnitId: sibling._id,\n parentUnitId: candidate.parentUnitId ?? null,\n // NOT `code`: that key is the client-facing refusal-code contract (allow-listed, hoisted to\n // `error.code`) and must only ever carry a declared enum value. The user-typed unit code is\n // diagnostic context and stays server-side; `customMessageReference` already names the refusal.\n conflictingUnitCode: candidate.code,\n },\n });\n }\n}\n\n/**\n * CREATE prefix — materialize `path` on the SAME write that inserts the row.\n *\n * `path` is `.excludeFromCreate()` and was previously never written by anything, so every unit\n * persisted with an empty hierarchy path (the defect this closes). The prefix's return value is\n * merged into the create payload and passed through the loose repository write, which is how a\n * server-owned field reaches persistence without being client-settable.\n *\n * The path is derived from the PARENT alone — see the format contract in\n * `organization-units.shared.path.ts` for why it cannot include the new row's own id.\n */\nexport function createOrganizationUnitCreatePathFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: CoreResourceOperation.CREATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'organization-units.create.path-materialization',\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const authored = input as { parentUnitId?: string; organizationId?: string; code?: string };\n\n const organizationId = authored.organizationId\n ?? executionContext.getContextResourceId?.(coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS])\n ?? executionContext.initiatorIds?.organizationId;\n\n if (!organizationId) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: { message: 'An organization scope is required to place a unit in the tree', reason: 'organization_unit_create_unscoped' },\n });\n }\n\n // A parent that was NAMED but cannot be resolved must fail, never silently fall back to\n // root: the scoped read returns nothing for a unit in another tenant, and treating that as\n // \"no parent\" would quietly promote a cross-tenant child to a root of the caller's tree.\n const parentUnit = authored.parentUnitId\n ? await loadScopedOrganizationUnit(authored.parentUnitId, executionContext, utils, {\n reason: 'organization_unit_parent_not_found',\n parentUnitId: authored.parentUnitId,\n })\n : null;\n\n await assertSiblingCodeAvailable(\n { unitId: '', organizationId, parentUnitId: authored.parentUnitId, code: authored.code },\n executionContext,\n utils,\n );\n\n return { ...input, organizationId, path: buildOrganizationUnitChildPath(parentUnit) };\n },\n },\n });\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n\n/**\n * UPDATE prefix — keep sibling `code` unambiguous on a rename.\n *\n * Re-parenting is no longer reachable here (`parentUnitId` is `.excludeFromUpdate()` since MOVE\n * shipped — D-B2), so the only structural collision generic UPDATE can still cause is two same-coded\n * siblings under one parent. That is the surviving half of the spec's `ORGANIZATION_UNIT_CONFLICT`\n * scenario; the cycle half now lives entirely under MOVE.\n */\nexport function createOrganizationUnitUpdateFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: CoreResourceOperation.UPDATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'organization-units.update.sibling-code-guard',\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const patch = input as { code?: unknown };\n // Only a rename can collide. An update that leaves `code` alone cannot introduce a\n // duplicate, and re-checking it would 409 every unrelated edit of an already-valid row.\n if (typeof patch.code !== 'string' || patch.code.length === 0) return input;\n\n // Resolve rather than cast. The former `_id as string` asserted a shape the addressing\n // contract does not guarantee: a filter-addressed rename would have handed an OBJECT to a\n // by-id read, which builds `{ _id: <object> }` and matches nothing — surfacing as a spurious\n // NOT_FOUND while the sibling-code collision it was meant to catch went unchecked.\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: 'Organization unit UPDATE renaming `code` requires a single addressed unit',\n reason: 'organization_unit_rename_unaddressed',\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n const unit = await loadScopedOrganizationUnit(organizationUnitId, executionContext, utils, {\n reason: 'organization_unit_not_found',\n organizationUnitId,\n });\n\n await assertSiblingCodeAvailable(\n { unitId: unit._id, organizationId: unit.organizationId, parentUnitId: unit.parentUnitId ?? undefined, code: patch.code },\n executionContext,\n utils,\n );\n\n return input;\n },\n },\n });\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n\n/**\n * MOVE — re-parent a unit and re-home its entire subtree.\n *\n * The descendant rewrite is the part that must never be skipped: leaving it out is exactly the\n * \"materialized field nothing recomputes\" bug that `path` was already an instance of. Because the\n * rewrite spans many rows, the whole operation runs in one transaction — a partial rewrite would\n * leave the tree describing a shape that never existed.\n *\n * An absent `newParentUnitId` means \"promote to root\", which the request DTO models as optional. A\n * present-but-blank value is malformed and is refused rather than silently read as a promotion.\n *\n * ⚠️ Cost: the subtree rewrite is a scan plus one `update()` per descendant. `repository.updateMany`\n * is unavailable here — it requires an `UPDATE_MANY` core operation, which this resource does not\n * declare. Acceptable while org charts are small; revisit if deep trees appear.\n */\nexport function createOrganizationUnitMoveFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: OrganizationUnit_Operations.MOVE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'organization-units.move',\n // The subtree rewrite spans many ORGANIZATION_UNITS rows plus the moved node itself. A partial\n // rewrite would leave the tree describing a shape that never existed, so they share one unit\n // of work. No OTHER resource participates — the move is entirely within the unit tree.\n transactionalCore: true,\n transactionParticipants: {},\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n // A conditional `{ _id, … }` filter names one unit and is admitted; only a genuinely\n // population-addressed move is refused, since the subtree rewrite below is computed from\n // ONE node's path.\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: 'Organization unit MOVE requires a single addressed unit',\n reason: 'organization_unit_move_unaddressed',\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n const requested = input as { newParentUnitId?: unknown };\n const hasDestination = requested.newParentUnitId !== undefined && requested.newParentUnitId !== null;\n if (hasDestination && (typeof requested.newParentUnitId !== 'string' || requested.newParentUnitId.length === 0)) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: { message: 'newParentUnitId must be a non-empty unit id, or be omitted to promote the unit to a root', reason: 'organization_unit_move_malformed_destination' },\n });\n }\n const newParentUnitId = hasDestination ? (requested.newParentUnitId as string) : undefined;\n\n const unit = await loadScopedOrganizationUnit(organizationUnitId, executionContext, utils, {\n reason: 'organization_unit_not_found',\n organizationUnitId,\n });\n\n if (newParentUnitId === unit._id) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_MOVE_CONFLICT,\n context: { reason: 'organization_unit_move_onto_self', organizationUnitId: unit._id },\n });\n }\n\n const newParentUnit = newParentUnitId\n ? await loadScopedOrganizationUnit(newParentUnitId, executionContext, utils, {\n reason: 'organization_unit_destination_not_found',\n newParentUnitId,\n })\n : null;\n\n // O(1) cycle test — the payoff of the materialized path. Moving a node beneath one of its\n // own descendants would detach the branch: it would have no route back to the root.\n if (newParentUnit && isOrganizationUnitInSubtree(newParentUnit, unit)) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_MOVE_CONFLICT,\n context: {\n reason: 'organization_unit_move_would_create_cycle',\n organizationUnitId: unit._id,\n newParentUnitId,\n },\n });\n }\n\n // Raises ORGANIZATION_UNIT_CODE_EXISTS, not MOVE_CONFLICT: the destination itself is legal\n // here — it is the unit's own `code` that collides — so renaming the unit is a remedy that\n // choosing another destination is not. The two conditions want different client handling.\n await assertSiblingCodeAvailable(\n { unitId: unit._id, organizationId: unit.organizationId, parentUnitId: newParentUnitId, code: unit.code },\n executionContext,\n utils,\n );\n\n // Re-home the branch. Descendants are rewritten BEFORE the node's own update lands, so a\n // failure anywhere rolls the whole move back rather than leaving a half-moved tree.\n const oldSubtreePrefix = organizationUnitSubtreePrefix(unit);\n const newUnitPath = buildOrganizationUnitChildPath(newParentUnit);\n const newSubtreePrefix = `${newUnitPath}${unit._id}/`;\n\n const descendants = await listOrganizationUnitDescendants(unit, executionContext, utils);\n const unitRepository = utils.repositoriesRegistry.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n for (const descendant of descendants) {\n await unitRepository.update(\n executionContext,\n descendant._id,\n { path: rebaseOrganizationUnitPath(descendant.path, oldSubtreePrefix, newSubtreePrefix) } as any,\n utils.serviceOptions,\n );\n }\n\n // The MOVE request DTO names no schema field, so the core UPDATE must be handed the real\n // mutation. `parentUnitId: null` (not `undefined`) is what clears the FK on a promotion.\n return { parentUnitId: newParentUnitId ?? null, path: newUnitPath };\n },\n },\n });\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n\n/**\n * ARCHIVE / RESTORE — node-only status transitions (plan decision Q-B1).\n *\n * Archiving a branch marks ONLY the node: descendants keep their own status, which makes ARCHIVE\n * O(1) and keeps restore order explicit. RESTORE pays for that by validating the ancestor chain —\n * restoring a node under a still-archived parent would leave an active unit reachable only through\n * an inactive one, which is the inconsistency the spec's 409 describes.\n */\nfunction createOrganizationUnitStatusTransitionFactory(\n operationIdentifier: OrganizationUnit_Operations.ARCHIVE | OrganizationUnit_Operations.RESTORE,\n): ResourceCustomServiceImplementationFactory {\n const isArchive = operationIdentifier === OrganizationUnit_Operations.ARCHIVE;\n\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: `organization-units.${isArchive ? 'archive' : 'restore'}`,\n handlers: {\n prefixCoreOperations: async (_id, _input, executionContext, _operationPath, utils) => {\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: `Organization unit ${operationIdentifier.toUpperCase()} requires a single addressed unit`,\n reason: 'organization_unit_status_transition_unaddressed',\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n const unit = await loadScopedOrganizationUnit(organizationUnitId, executionContext, utils, {\n reason: 'organization_unit_not_found',\n organizationUnitId,\n });\n\n const alreadyArchived = unit.status === OrganizationUnitStatus.ARCHIVED;\n if (isArchive === alreadyArchived) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_CONFLICT,\n context: {\n reason: isArchive ? 'organization_unit_already_archived' : 'organization_unit_not_archived',\n organizationUnitId: unit._id,\n currentStatus: unit.status,\n },\n });\n }\n\n if (!isArchive) {\n // Restore order is explicit: every ancestor must already be out of ARCHIVED.\n for (const ancestorId of organizationUnitAncestorIds(unit)) {\n const ancestor = await loadScopedOrganizationUnit(ancestorId, executionContext, utils, {\n reason: 'organization_unit_ancestor_not_found',\n organizationUnitId: unit._id,\n ancestorUnitId: ancestorId,\n });\n if (ancestor.status === OrganizationUnitStatus.ARCHIVED) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.ORGANIZATION_UNIT_CONFLICT,\n context: {\n reason: 'organization_unit_ancestor_still_archived',\n organizationUnitId: unit._id,\n blockingAncestorUnitId: ancestor._id,\n },\n });\n }\n }\n }\n\n // As with MOVE, the request DTO carries only `reason`, so the real mutation is supplied here.\n return { status: isArchive ? OrganizationUnitStatus.ARCHIVED : OrganizationUnitStatus.ACTIVE };\n },\n },\n });\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n/** ARCHIVE + RESTORE implementations. */\nexport function createOrganizationUnitStatusTransitionFactories(): ResourceCustomServiceImplementationFactory[] {\n return [\n createOrganizationUnitStatusTransitionFactory(OrganizationUnit_Operations.ARCHIVE),\n createOrganizationUnitStatusTransitionFactory(OrganizationUnit_Operations.RESTORE),\n ];\n}\n\n/**\n * Register {@link assertNoOrganizationUnitDependents} as the `ORGANIZATION_UNITS` DELETE prefix.\n *\n * PREFIX: refuses the delete with 409 `ORGANIZATION_UNIT_HAS_DEPENDENTS` while any child unit\n * still names this node as its parent. There is no CORE replacement — when the guard passes, the\n * standard DELETE proceeds untouched.\n *\n * Registered on `API_CALL` — the variant the resource configuration actually declares for DELETE.\n * Custom implementations are resolved by an exact operation-path key that embeds `variantType`,\n * so a guard registered under any other variant would never run.\n */\nexport function createOrganizationUnitDeleteDependentsGuardFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_UNITS,\n operationIdentifier: CoreResourceOperation.DELETE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n // Fail closed: the dependent scan filters on a single unit id, so a POPULATION-addressed\n // delete (an ids array or an unpinned filter reaching this path via `doByOperationPath`)\n // must be refused rather than silently producing a filter that matches nothing and waving\n // the delete through. A conditional `{ _id, … }` filter resolves to the one unit the delete\n // can destroy and is admitted.\n const organizationUnitId = resolveSingleSubjectId(_id);\n if (organizationUnitId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n context: {\n message: 'Organization unit DELETE requires a single addressed unit to verify dependents',\n resourceType: CoreResourceType.ORGANIZATION_UNITS,\n receivedAddressing: describeUnaddressableShape(_id),\n },\n });\n }\n\n await assertNoOrganizationUnitDependents(organizationUnitId, executionContext, utils);\n\n // Guard only — the core DELETE input is passed through unchanged.\n return input;\n },\n },\n });\n };\n\n return [factory as unknown as ResourceCustomServiceImplementationFactory];\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { JobPayload, JobResult } from '@wildo-ai/saas-models';
|
|
2
|
+
import { LoggerService } from '../../monitoring/logger/services/logger.service';
|
|
3
|
+
import type { MessageHandler, QueueAdapter } from '../../queue/adapters/queue-adapter.backend.interface';
|
|
4
|
+
import type { PublishOptions, QueueAssertOptions } from '../../queue/adapters/queue-adapter.backend.options';
|
|
5
|
+
export declare class InMemoryQueueAdapterBackendService implements QueueAdapter {
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private readonly queues;
|
|
8
|
+
private readonly pendingDelays;
|
|
9
|
+
private readonly podId;
|
|
10
|
+
private replyQueueName;
|
|
11
|
+
private connected;
|
|
12
|
+
constructor(logger: LoggerService);
|
|
13
|
+
connect(): Promise<void>;
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
isConnected(): boolean;
|
|
16
|
+
assertQueue(queueName: string, options?: QueueAssertOptions): Promise<void>;
|
|
17
|
+
publish(queueName: string, payload: JobPayload, options?: PublishOptions): Promise<void>;
|
|
18
|
+
scheduleDelayedRetry(sourceQueueName: string, job: JobPayload, delayMs: number, options?: PublishOptions): Promise<void>;
|
|
19
|
+
consume(queueName: string, handler: MessageHandler): Promise<string>;
|
|
20
|
+
cancelConsumer(queueName: string): Promise<void>;
|
|
21
|
+
setupReplyQueue(appId: string, onReply: (correlationId: string, result: JobResult) => void): Promise<string>;
|
|
22
|
+
publishResult(replyTo: string, correlationId: string, result: JobResult): Promise<void>;
|
|
23
|
+
getReplyQueueName(): string | null;
|
|
24
|
+
getQueueDepth(queueName: string): Promise<number | null>;
|
|
25
|
+
getPodId(): string;
|
|
26
|
+
/** In-flight count for a queue — delivered, not yet settled. Test-facing, and the reason it exists. */
|
|
27
|
+
getUnsettledCount(queueName: string): number;
|
|
28
|
+
/**
|
|
29
|
+
* Every queue this adapter currently knows about.
|
|
30
|
+
*
|
|
31
|
+
* Test-facing, and it exists because of a mutation that survived without it: a version that
|
|
32
|
+
* INVENTED a dead-letter destination when a queue declared none passed a suite asserting only that
|
|
33
|
+
* the source queue was empty. "The message went nowhere" is a claim about every queue, and it
|
|
34
|
+
* cannot be checked one queue at a time.
|
|
35
|
+
*/
|
|
36
|
+
getQueueNames(): readonly string[];
|
|
37
|
+
/**
|
|
38
|
+
* Delayed retries still waiting to fire.
|
|
39
|
+
*
|
|
40
|
+
* Also mutation-driven: `close()` clearing the queue map makes a late timer harmless by accident,
|
|
41
|
+
* so a test asserting depth after close passed with the timer cleanup deleted. This exposes the
|
|
42
|
+
* mechanism itself, which is the thing the cleanup is actually for.
|
|
43
|
+
*/
|
|
44
|
+
getPendingDelayCount(): number;
|
|
45
|
+
private buildMessage;
|
|
46
|
+
private enqueue;
|
|
47
|
+
/**
|
|
48
|
+
* Deliver on a microtask, one message at a time, never re-entrantly.
|
|
49
|
+
*
|
|
50
|
+
* `draining` is what makes a handler that publishes to its OWN queue terminate: without it the
|
|
51
|
+
* enqueue inside the handler re-enters the drain and the stack grows until it overflows — a failure
|
|
52
|
+
* that would appear only under the in-memory adapter and would read as a defect in the consumer.
|
|
53
|
+
*/
|
|
54
|
+
private scheduleDrain;
|
|
55
|
+
private drain;
|
|
56
|
+
private acknowledgerFor;
|
|
57
|
+
/**
|
|
58
|
+
* Route a rejected message to the dead-letter destination the source queue DECLARED.
|
|
59
|
+
*
|
|
60
|
+
* Only when one was declared. Inventing a destination would make a test pass that proves nothing
|
|
61
|
+
* about a deployment whose queue was asserted without dead-lettering — the message is dropped there,
|
|
62
|
+
* and dropping it here is the truthful simulation.
|
|
63
|
+
*/
|
|
64
|
+
private deadLetter;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=in-memory-queue-adapter.backend.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory-queue-adapter.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/queue/adapters/in-memory-queue-adapter.backend.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAInE,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAE7F,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EAGb,MAAM,mEAAmE,CAAC;AAC3E,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EACnB,MAAM,iEAAiE,CAAC;AAsDzE,qBACa,kCAAmC,YAAW,YAAY;IAQhC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAP5D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;IAC3D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,SAAS,CAAS;gBAG4B,MAAM,EAAE,aAAa;IAG9D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,KAAK,IAAI,OAAO,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6BnB,OAAO,CAAC,eAAe;IAoBvB;;;;;;OAMG;IACH,OAAO,CAAC,UAAU;CAQnB"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { inject, injectable } from 'inversify';
|
|
15
|
+
import { SAAS_SERVICE_TYPES } from '../../inject/models/service-types.js';
|
|
16
|
+
import { LoggerService } from '../../monitoring/logger/services/logger.service.js';
|
|
17
|
+
import { describeCaughtError } from '../../errors/utils/error-log-level-classification.backend.utils.js';
|
|
18
|
+
let InMemoryQueueAdapterBackendService = class InMemoryQueueAdapterBackendService {
|
|
19
|
+
logger;
|
|
20
|
+
queues = new Map();
|
|
21
|
+
pendingDelays = new Set();
|
|
22
|
+
podId = `in-memory-${randomUUID()}`;
|
|
23
|
+
replyQueueName = null;
|
|
24
|
+
connected = false;
|
|
25
|
+
constructor(logger) {
|
|
26
|
+
this.logger = logger;
|
|
27
|
+
}
|
|
28
|
+
async connect() {
|
|
29
|
+
this.connected = true;
|
|
30
|
+
}
|
|
31
|
+
async close() {
|
|
32
|
+
// Timers first: a delayed retry firing after close would republish onto a queue nobody is
|
|
33
|
+
// consuming, and in a test run that surfaces as an unhandled rejection in the NEXT test.
|
|
34
|
+
for (const timer of this.pendingDelays)
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
this.pendingDelays.clear();
|
|
37
|
+
this.queues.clear();
|
|
38
|
+
this.replyQueueName = null;
|
|
39
|
+
this.connected = false;
|
|
40
|
+
}
|
|
41
|
+
isConnected() {
|
|
42
|
+
return this.connected;
|
|
43
|
+
}
|
|
44
|
+
async assertQueue(queueName, options = {}) {
|
|
45
|
+
const existing = this.queues.get(queueName);
|
|
46
|
+
if (existing) {
|
|
47
|
+
// Idempotent, like the broker's own `assertQueue`. The options of the FIRST assertion win, so a
|
|
48
|
+
// later assertion cannot silently retune a live queue's dead-lettering.
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.queues.set(queueName, { messages: [], options, unsettled: new Set(), draining: false });
|
|
52
|
+
}
|
|
53
|
+
async publish(queueName, payload, options = {}) {
|
|
54
|
+
await this.assertQueue(queueName);
|
|
55
|
+
this.enqueue(queueName, this.buildMessage(payload, options), 'back');
|
|
56
|
+
}
|
|
57
|
+
async scheduleDelayedRetry(sourceQueueName, job, delayMs, options = {}) {
|
|
58
|
+
await this.assertQueue(sourceQueueName);
|
|
59
|
+
/*
|
|
60
|
+
* A timer, where RabbitMQ uses a per-delay queue whose TTL dead-letters back to the source. The
|
|
61
|
+
* MECHANISM differs and the observable contract does not: the job reappears on its source queue
|
|
62
|
+
* after `delayMs`. A consumer that depended on the intermediate delay queue existing would be
|
|
63
|
+
* depending on a RabbitMQ implementation detail, which is exactly what the port exists to stop.
|
|
64
|
+
*/
|
|
65
|
+
const timer = setTimeout(() => {
|
|
66
|
+
this.pendingDelays.delete(timer);
|
|
67
|
+
this.enqueue(sourceQueueName, this.buildMessage(job, options), 'back');
|
|
68
|
+
}, delayMs);
|
|
69
|
+
// Never hold the event loop open: a pending retry must not keep a test process (or a shutting-down
|
|
70
|
+
// runtime) alive past its work.
|
|
71
|
+
timer.unref?.();
|
|
72
|
+
this.pendingDelays.add(timer);
|
|
73
|
+
}
|
|
74
|
+
async consume(queueName, handler) {
|
|
75
|
+
await this.assertQueue(queueName);
|
|
76
|
+
const queue = this.queues.get(queueName);
|
|
77
|
+
const tag = `in-memory-consumer-${randomUUID()}`;
|
|
78
|
+
queue.consumer = { tag, handler };
|
|
79
|
+
this.scheduleDrain(queueName);
|
|
80
|
+
return tag;
|
|
81
|
+
}
|
|
82
|
+
async cancelConsumer(queueName) {
|
|
83
|
+
const queue = this.queues.get(queueName);
|
|
84
|
+
if (queue)
|
|
85
|
+
queue.consumer = undefined;
|
|
86
|
+
}
|
|
87
|
+
async setupReplyQueue(appId, onReply) {
|
|
88
|
+
const queueName = `${appId}.replies.${this.podId}`;
|
|
89
|
+
await this.assertQueue(queueName, { exclusive: true, autoDelete: true });
|
|
90
|
+
await this.consume(queueName, async (message, acknowledger) => {
|
|
91
|
+
const correlationId = message.properties.correlationId;
|
|
92
|
+
if (typeof correlationId === 'string') {
|
|
93
|
+
onReply(correlationId, JSON.parse(message.content.toString()));
|
|
94
|
+
}
|
|
95
|
+
acknowledger.ack(message);
|
|
96
|
+
});
|
|
97
|
+
this.replyQueueName = queueName;
|
|
98
|
+
return queueName;
|
|
99
|
+
}
|
|
100
|
+
async publishResult(replyTo, correlationId, result) {
|
|
101
|
+
await this.assertQueue(replyTo);
|
|
102
|
+
this.enqueue(replyTo, {
|
|
103
|
+
content: Buffer.from(JSON.stringify(result)),
|
|
104
|
+
fields: { redelivered: false },
|
|
105
|
+
properties: { correlationId },
|
|
106
|
+
}, 'back');
|
|
107
|
+
}
|
|
108
|
+
getReplyQueueName() {
|
|
109
|
+
return this.replyQueueName;
|
|
110
|
+
}
|
|
111
|
+
async getQueueDepth(queueName) {
|
|
112
|
+
// A real number, not `null`: this adapter genuinely knows, and monitoring is one of the things a
|
|
113
|
+
// broker-free lane exists to exercise. `null` is reserved for "cannot say", which would be a lie
|
|
114
|
+
// here.
|
|
115
|
+
return this.queues.get(queueName)?.messages.length ?? 0;
|
|
116
|
+
}
|
|
117
|
+
getPodId() {
|
|
118
|
+
return this.podId;
|
|
119
|
+
}
|
|
120
|
+
/** In-flight count for a queue — delivered, not yet settled. Test-facing, and the reason it exists. */
|
|
121
|
+
getUnsettledCount(queueName) {
|
|
122
|
+
return this.queues.get(queueName)?.unsettled.size ?? 0;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Every queue this adapter currently knows about.
|
|
126
|
+
*
|
|
127
|
+
* Test-facing, and it exists because of a mutation that survived without it: a version that
|
|
128
|
+
* INVENTED a dead-letter destination when a queue declared none passed a suite asserting only that
|
|
129
|
+
* the source queue was empty. "The message went nowhere" is a claim about every queue, and it
|
|
130
|
+
* cannot be checked one queue at a time.
|
|
131
|
+
*/
|
|
132
|
+
getQueueNames() {
|
|
133
|
+
return [...this.queues.keys()];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Delayed retries still waiting to fire.
|
|
137
|
+
*
|
|
138
|
+
* Also mutation-driven: `close()` clearing the queue map makes a late timer harmless by accident,
|
|
139
|
+
* so a test asserting depth after close passed with the timer cleanup deleted. This exposes the
|
|
140
|
+
* mechanism itself, which is the thing the cleanup is actually for.
|
|
141
|
+
*/
|
|
142
|
+
getPendingDelayCount() {
|
|
143
|
+
return this.pendingDelays.size;
|
|
144
|
+
}
|
|
145
|
+
buildMessage(payload, options) {
|
|
146
|
+
return {
|
|
147
|
+
content: Buffer.from(JSON.stringify(payload)),
|
|
148
|
+
fields: { redelivered: false },
|
|
149
|
+
// Only what the port declares. `priority` and `expiration` are accepted by `PublishOptions`
|
|
150
|
+
// and are BROKER scheduling hints — this queue has no priority ordering and says so by not
|
|
151
|
+
// pretending to carry them, rather than storing a value nothing reads.
|
|
152
|
+
properties: {
|
|
153
|
+
correlationId: options.correlationId ?? null,
|
|
154
|
+
replyTo: options.replyTo,
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
enqueue(queueName, message, end) {
|
|
159
|
+
const queue = this.queues.get(queueName);
|
|
160
|
+
if (!queue)
|
|
161
|
+
return;
|
|
162
|
+
if (end === 'front')
|
|
163
|
+
queue.messages.unshift(message);
|
|
164
|
+
else
|
|
165
|
+
queue.messages.push(message);
|
|
166
|
+
this.scheduleDrain(queueName);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Deliver on a microtask, one message at a time, never re-entrantly.
|
|
170
|
+
*
|
|
171
|
+
* `draining` is what makes a handler that publishes to its OWN queue terminate: without it the
|
|
172
|
+
* enqueue inside the handler re-enters the drain and the stack grows until it overflows — a failure
|
|
173
|
+
* that would appear only under the in-memory adapter and would read as a defect in the consumer.
|
|
174
|
+
*/
|
|
175
|
+
scheduleDrain(queueName) {
|
|
176
|
+
const queue = this.queues.get(queueName);
|
|
177
|
+
if (!queue || queue.draining || !queue.consumer)
|
|
178
|
+
return;
|
|
179
|
+
queue.draining = true;
|
|
180
|
+
queueMicrotask(() => void this.drain(queueName));
|
|
181
|
+
}
|
|
182
|
+
async drain(queueName) {
|
|
183
|
+
const queue = this.queues.get(queueName);
|
|
184
|
+
if (!queue)
|
|
185
|
+
return;
|
|
186
|
+
try {
|
|
187
|
+
while (queue.consumer && queue.messages.length > 0) {
|
|
188
|
+
const message = queue.messages.shift();
|
|
189
|
+
queue.unsettled.add(message);
|
|
190
|
+
try {
|
|
191
|
+
await queue.consumer.handler(message, this.acknowledgerFor(queueName));
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
/*
|
|
195
|
+
* A handler that THROWS has not settled the message, and the broker would hold it in
|
|
196
|
+
* flight until the channel closed. Mirrored rather than silently requeued: auto-requeueing
|
|
197
|
+
* here would turn a crashing handler into an infinite hot loop that no real deployment
|
|
198
|
+
* would produce.
|
|
199
|
+
*/
|
|
200
|
+
this.logger.warn('In-memory queue handler threw; message left unsettled', {
|
|
201
|
+
queueName,
|
|
202
|
+
error: describeCaughtError(error),
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
queue.draining = false;
|
|
209
|
+
// A message that arrived while we were awaiting a handler needs its own drain.
|
|
210
|
+
if (queue.consumer && queue.messages.length > 0)
|
|
211
|
+
this.scheduleDrain(queueName);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
acknowledgerFor(queueName) {
|
|
215
|
+
return {
|
|
216
|
+
ack: (message) => {
|
|
217
|
+
this.queues.get(queueName)?.unsettled.delete(message);
|
|
218
|
+
},
|
|
219
|
+
nack: (message, _allUpTo = false, requeue = false) => {
|
|
220
|
+
const queue = this.queues.get(queueName);
|
|
221
|
+
if (!queue)
|
|
222
|
+
return;
|
|
223
|
+
queue.unsettled.delete(message);
|
|
224
|
+
if (requeue) {
|
|
225
|
+
// FRONT, and redelivered — the broker's own semantics for a requeue, and the difference a
|
|
226
|
+
// retry test can actually observe.
|
|
227
|
+
this.enqueue(queueName, { ...message, fields: { ...message.fields, redelivered: true } }, 'front');
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.deadLetter(queue, message);
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Route a rejected message to the dead-letter destination the source queue DECLARED.
|
|
236
|
+
*
|
|
237
|
+
* Only when one was declared. Inventing a destination would make a test pass that proves nothing
|
|
238
|
+
* about a deployment whose queue was asserted without dead-lettering — the message is dropped there,
|
|
239
|
+
* and dropping it here is the truthful simulation.
|
|
240
|
+
*/
|
|
241
|
+
deadLetter(queue, message) {
|
|
242
|
+
const destination = queue.options.deadLetterRoutingKey ?? queue.options.deadLetterExchange;
|
|
243
|
+
if (!destination)
|
|
244
|
+
return;
|
|
245
|
+
if (!this.queues.has(destination)) {
|
|
246
|
+
this.queues.set(destination, { messages: [], options: {}, unsettled: new Set(), draining: false });
|
|
247
|
+
}
|
|
248
|
+
this.enqueue(destination, message, 'back');
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
InMemoryQueueAdapterBackendService = __decorate([
|
|
252
|
+
injectable(),
|
|
253
|
+
__param(0, inject(SAAS_SERVICE_TYPES.Logger)),
|
|
254
|
+
__metadata("design:paramtypes", [LoggerService])
|
|
255
|
+
], InMemoryQueueAdapterBackendService);
|
|
256
|
+
export { InMemoryQueueAdapterBackendService };
|
|
257
|
+
//# sourceMappingURL=in-memory-queue-adapter.backend.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"in-memory-queue-adapter.backend.service.js","sourceRoot":"","sources":["../../../../../src/queue/adapters/in-memory-queue-adapter.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,8EAA8E,CAAC;AAiE5G,IAAM,kCAAkC,GAAxC,MAAM,kCAAkC;IAQS;IAPrC,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;IAC1C,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,GAAG,aAAa,UAAU,EAAE,EAAE,CAAC;IAC7C,cAAc,GAAkB,IAAI,CAAC;IACrC,SAAS,GAAG,KAAK,CAAC;IAE1B,YACsD,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IACxE,CAAC;IAEG,KAAK,CAAC,OAAO;QAClB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,0FAA0F;QAC1F,yFAAyF;QACz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M,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;qCAA0B,aAAa;GARhE,kCAAkC,CA8P9C","sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type { JobPayload, JobResult } from '@wildo-ai/saas-models';\nimport { inject, injectable } from 'inversify';\n\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { describeCaughtError } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport type {\n MessageHandler,\n QueueAdapter,\n QueueConsumeMessage,\n QueueMessageAcknowledger,\n} from '~wildo-backend-lib/queue/adapters/queue-adapter.backend.interface';\nimport type {\n PublishOptions,\n QueueAssertOptions,\n} from '~wildo-backend-lib/queue/adapters/queue-adapter.backend.options';\n\n/**\n * An in-process {@link QueueAdapter}, so background-work BEHAVIOUR can be tested without a broker (#502).\n *\n * ## What this is for, and the bar it had to clear\n *\n * `QueueAdapterType` declared three adapters and one existed. The decision was to build this one and\n * collapse the other two, on a stated justification: *\"a queue that needs no RabbitMQ makes\n * background-work behaviour testable in-process\"*. That justification also sets the bar — an adapter\n * nothing runs against would have been a fourth unreachable thing built to fix three — so this ships\n * with a lane that drives real consumer behaviour through it, and that lane, not this file, is what\n * makes the decision honest.\n *\n * ## It is a QUEUE, not a stub\n *\n * The distinction matters, because a stub proves the caller compiles and a queue proves the caller is\n * right. So this really does what the port promises:\n *\n * - **`nack(requeue: true)` puts the message back**, at the FRONT, and the consumer sees it again.\n * That is the retry loop every job consumer depends on, and a stub that swallowed it would let a\n * broken retry pass.\n * - **`nack(requeue: false)` dead-letters** to the queue named by the source queue's\n * `deadLetterExchange`/`deadLetterRoutingKey` assertion when one was declared, so a test can assert\n * a poison message ARRIVED somewhere rather than merely that it left.\n * - **`scheduleDelayedRetry` really waits**, on a timer, and the delay is observable. RabbitMQ does\n * this with a per-delay TTL queue dead-lettering back to the source; the observable contract — the\n * job reappears on its source queue after `delayMs` — is identical, which is the only part a\n * consumer may depend on.\n * - **An unacknowledged message stays unacknowledged.** Nothing auto-acks. A handler that forgets to\n * settle leaves the message in flight here exactly as it would on a broker, and the count is\n * readable through {@link getQueueDepth}.\n *\n * ## What it deliberately does NOT do\n *\n * No durability, no cross-process visibility, no broker permissions, no exchange topology. Those are\n * the properties a real deployment buys a broker FOR, and simulating them here would produce a second\n * queue implementation whose divergences from RabbitMQ nobody could enumerate. This is for tests and\n * for a single-process runtime that has declared it wants no broker — it is not a smaller RabbitMQ.\n *\n * Delivery is asynchronous (`queueMicrotask`), never synchronous inside `publish`. A synchronous\n * hand-off would let a test pass that deadlocks against a real broker, because the publisher would be\n * holding whatever the handler then waits on.\n */\n\ninterface InMemoryQueue {\n readonly messages: QueueConsumeMessage[];\n readonly options: QueueAssertOptions;\n /** In-flight: delivered and not yet settled. Keyed by the identity handed to the handler. */\n readonly unsettled: Set<QueueConsumeMessage>;\n consumer?: { tag: string; handler: MessageHandler };\n draining: boolean;\n}\n\n@injectable()\nexport class InMemoryQueueAdapterBackendService implements QueueAdapter {\n private readonly queues = new Map<string, InMemoryQueue>();\n private readonly pendingDelays = new Set<NodeJS.Timeout>();\n private readonly podId = `in-memory-${randomUUID()}`;\n private replyQueueName: string | null = null;\n private connected = false;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n ) {}\n\n public async connect(): Promise<void> {\n this.connected = true;\n }\n\n public async close(): Promise<void> {\n // Timers first: a delayed retry firing after close would republish onto a queue nobody is\n // consuming, and in a test run that surfaces as an unhandled rejection in the NEXT test.\n for (const timer of this.pendingDelays) clearTimeout(timer);\n this.pendingDelays.clear();\n this.queues.clear();\n this.replyQueueName = null;\n this.connected = false;\n }\n\n public isConnected(): boolean {\n return this.connected;\n }\n\n public async assertQueue(queueName: string, options: QueueAssertOptions = {}): Promise<void> {\n const existing = this.queues.get(queueName);\n if (existing) {\n // Idempotent, like the broker's own `assertQueue`. The options of the FIRST assertion win, so a\n // later assertion cannot silently retune a live queue's dead-lettering.\n return;\n }\n this.queues.set(queueName, { messages: [], options, unsettled: new Set(), draining: false });\n }\n\n public async publish(queueName: string, payload: JobPayload, options: PublishOptions = {}): Promise<void> {\n await this.assertQueue(queueName);\n this.enqueue(queueName, this.buildMessage(payload, options), 'back');\n }\n\n public async scheduleDelayedRetry(\n sourceQueueName: string,\n job: JobPayload,\n delayMs: number,\n options: PublishOptions = {},\n ): Promise<void> {\n await this.assertQueue(sourceQueueName);\n /*\n * A timer, where RabbitMQ uses a per-delay queue whose TTL dead-letters back to the source. The\n * MECHANISM differs and the observable contract does not: the job reappears on its source queue\n * after `delayMs`. A consumer that depended on the intermediate delay queue existing would be\n * depending on a RabbitMQ implementation detail, which is exactly what the port exists to stop.\n */\n const timer = setTimeout(() => {\n this.pendingDelays.delete(timer);\n this.enqueue(sourceQueueName, this.buildMessage(job, options), 'back');\n }, delayMs);\n // Never hold the event loop open: a pending retry must not keep a test process (or a shutting-down\n // runtime) alive past its work.\n timer.unref?.();\n this.pendingDelays.add(timer);\n }\n\n public async consume(queueName: string, handler: MessageHandler): Promise<string> {\n await this.assertQueue(queueName);\n const queue = this.queues.get(queueName) as InMemoryQueue;\n const tag = `in-memory-consumer-${randomUUID()}`;\n queue.consumer = { tag, handler };\n this.scheduleDrain(queueName);\n return tag;\n }\n\n public async cancelConsumer(queueName: string): Promise<void> {\n const queue = this.queues.get(queueName);\n if (queue) queue.consumer = undefined;\n }\n\n public async setupReplyQueue(\n appId: string,\n onReply: (correlationId: string, result: JobResult) => void,\n ): Promise<string> {\n const queueName = `${appId}.replies.${this.podId}`;\n await this.assertQueue(queueName, { exclusive: true, autoDelete: true });\n await this.consume(queueName, async (message, acknowledger) => {\n const correlationId = message.properties.correlationId;\n if (typeof correlationId === 'string') {\n onReply(correlationId, JSON.parse(message.content.toString()) as JobResult);\n }\n acknowledger.ack(message);\n });\n this.replyQueueName = queueName;\n return queueName;\n }\n\n public async publishResult(replyTo: string, correlationId: string, result: JobResult): Promise<void> {\n await this.assertQueue(replyTo);\n this.enqueue(\n replyTo,\n {\n content: Buffer.from(JSON.stringify(result)),\n fields: { redelivered: false },\n properties: { correlationId },\n },\n 'back',\n );\n }\n\n public getReplyQueueName(): string | null {\n return this.replyQueueName;\n }\n\n public async getQueueDepth(queueName: string): Promise<number | null> {\n // A real number, not `null`: this adapter genuinely knows, and monitoring is one of the things a\n // broker-free lane exists to exercise. `null` is reserved for \"cannot say\", which would be a lie\n // here.\n return this.queues.get(queueName)?.messages.length ?? 0;\n }\n\n public getPodId(): string {\n return this.podId;\n }\n\n /** In-flight count for a queue — delivered, not yet settled. Test-facing, and the reason it exists. */\n public getUnsettledCount(queueName: string): number {\n return this.queues.get(queueName)?.unsettled.size ?? 0;\n }\n\n /**\n * Every queue this adapter currently knows about.\n *\n * Test-facing, and it exists because of a mutation that survived without it: a version that\n * INVENTED a dead-letter destination when a queue declared none passed a suite asserting only that\n * the source queue was empty. \"The message went nowhere\" is a claim about every queue, and it\n * cannot be checked one queue at a time.\n */\n public getQueueNames(): readonly string[] {\n return [...this.queues.keys()];\n }\n\n /**\n * Delayed retries still waiting to fire.\n *\n * Also mutation-driven: `close()` clearing the queue map makes a late timer harmless by accident,\n * so a test asserting depth after close passed with the timer cleanup deleted. This exposes the\n * mechanism itself, which is the thing the cleanup is actually for.\n */\n public getPendingDelayCount(): number {\n return this.pendingDelays.size;\n }\n\n private buildMessage(payload: JobPayload | JobResult, options: PublishOptions): QueueConsumeMessage {\n return {\n content: Buffer.from(JSON.stringify(payload)),\n fields: { redelivered: false },\n // Only what the port declares. `priority` and `expiration` are accepted by `PublishOptions`\n // and are BROKER scheduling hints — this queue has no priority ordering and says so by not\n // pretending to carry them, rather than storing a value nothing reads.\n properties: {\n correlationId: options.correlationId ?? null,\n replyTo: options.replyTo,\n },\n };\n }\n\n private enqueue(queueName: string, message: QueueConsumeMessage, end: 'front' | 'back'): void {\n const queue = this.queues.get(queueName);\n if (!queue) return;\n if (end === 'front') queue.messages.unshift(message);\n else queue.messages.push(message);\n this.scheduleDrain(queueName);\n }\n\n /**\n * Deliver on a microtask, one message at a time, never re-entrantly.\n *\n * `draining` is what makes a handler that publishes to its OWN queue terminate: without it the\n * enqueue inside the handler re-enters the drain and the stack grows until it overflows — a failure\n * that would appear only under the in-memory adapter and would read as a defect in the consumer.\n */\n private scheduleDrain(queueName: string): void {\n const queue = this.queues.get(queueName);\n if (!queue || queue.draining || !queue.consumer) return;\n queue.draining = true;\n queueMicrotask(() => void this.drain(queueName));\n }\n\n private async drain(queueName: string): Promise<void> {\n const queue = this.queues.get(queueName);\n if (!queue) return;\n try {\n while (queue.consumer && queue.messages.length > 0) {\n const message = queue.messages.shift() as QueueConsumeMessage;\n queue.unsettled.add(message);\n try {\n await queue.consumer.handler(message, this.acknowledgerFor(queueName));\n } catch (error) {\n /*\n * A handler that THROWS has not settled the message, and the broker would hold it in\n * flight until the channel closed. Mirrored rather than silently requeued: auto-requeueing\n * here would turn a crashing handler into an infinite hot loop that no real deployment\n * would produce.\n */\n this.logger.warn('In-memory queue handler threw; message left unsettled', {\n queueName,\n error: describeCaughtError(error),\n });\n }\n }\n } finally {\n queue.draining = false;\n // A message that arrived while we were awaiting a handler needs its own drain.\n if (queue.consumer && queue.messages.length > 0) this.scheduleDrain(queueName);\n }\n }\n\n private acknowledgerFor(queueName: string): QueueMessageAcknowledger {\n return {\n ack: (message) => {\n this.queues.get(queueName)?.unsettled.delete(message);\n },\n nack: (message, _allUpTo = false, requeue = false) => {\n const queue = this.queues.get(queueName);\n if (!queue) return;\n queue.unsettled.delete(message);\n if (requeue) {\n // FRONT, and redelivered — the broker's own semantics for a requeue, and the difference a\n // retry test can actually observe.\n this.enqueue(queueName, { ...message, fields: { ...message.fields, redelivered: true } }, 'front');\n return;\n }\n this.deadLetter(queue, message);\n },\n };\n }\n\n /**\n * Route a rejected message to the dead-letter destination the source queue DECLARED.\n *\n * Only when one was declared. Inventing a destination would make a test pass that proves nothing\n * about a deployment whose queue was asserted without dead-lettering — the message is dropped there,\n * and dropping it here is the truthful simulation.\n */\n private deadLetter(queue: InMemoryQueue, message: QueueConsumeMessage): void {\n const destination = queue.options.deadLetterRoutingKey ?? queue.options.deadLetterExchange;\n if (!destination) return;\n if (!this.queues.has(destination)) {\n this.queues.set(destination, { messages: [], options: {}, unsettled: new Set(), draining: false });\n }\n this.enqueue(destination, message, 'back');\n }\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Container } from 'inversify';
|
|
2
|
+
import { QueueAdapterType } from '@wildo-ai/saas-models';
|
|
3
|
+
/**
|
|
4
|
+
* Bind the queue adapter a runtime will use.
|
|
5
|
+
*
|
|
6
|
+
* Rebinds when the token is already bound, so a test lane can select the in-memory adapter against a
|
|
7
|
+
* container the framework has already configured — which is the shape every consumer of this
|
|
8
|
+
* actually needs, and a bind-only version would have forced each of them to build a container from
|
|
9
|
+
* scratch.
|
|
10
|
+
*/
|
|
11
|
+
export declare function bindQueueAdapter(container: Container, adapterType: QueueAdapterType): void;
|
|
12
|
+
//# sourceMappingURL=queue-adapter.backend.binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-adapter.backend.binding.d.ts","sourceRoot":"","sources":["../../../../../src/queue/adapters/queue-adapter.backend.binding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAkCzD;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI,CAM1F"}
|