@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
|
@@ -36,6 +36,8 @@ import { FileStorageRouterBackendService } from '../../files/storage/file-storag
|
|
|
36
36
|
import { FileFieldDetectionBackendService } from '../../files/services/file-field-detection.backend.service';
|
|
37
37
|
import { FileStoragePathResolverBackendService } from '../../files/storage/file-storage-path-resolver.backend.service';
|
|
38
38
|
import { FileScanningBackendService } from '../../files/services/file-scanning.backend.service';
|
|
39
|
+
import { ConsumableTokenBackendService } from '../../security/consumable-tokens/services/consumable-token.backend.service';
|
|
40
|
+
import { FileUploadGrantBackendService } from '../../files/services/file-upload-grant.backend.service';
|
|
39
41
|
export declare class ResourceFileUploadHandlerBackendService {
|
|
40
42
|
private readonly logger;
|
|
41
43
|
private readonly errorBuilder;
|
|
@@ -49,8 +51,10 @@ export declare class ResourceFileUploadHandlerBackendService {
|
|
|
49
51
|
private readonly appConfigService;
|
|
50
52
|
private readonly pathResolver;
|
|
51
53
|
private readonly fileScanningService;
|
|
54
|
+
private readonly consumableTokenService;
|
|
55
|
+
private readonly fileUploadGrantService;
|
|
52
56
|
protected logDebug: (message: string, context?: Record<string, unknown>) => void;
|
|
53
|
-
constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, resourcesRegistry: ResourcesRegistryBackendService, constraintResolver: FileConstraintResolverChain, fileValidator: FileValidationService, filesService: FilesBackendService, fileStorageRouter: FileStorageRouterBackendService, fileFieldDetection: FileFieldDetectionBackendService, resourceOperationHelper: ResourceOperationHelperBackendService, appConfigService: AppConfigurationService, pathResolver: FileStoragePathResolverBackendService, fileScanningService: FileScanningBackendService);
|
|
57
|
+
constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, resourcesRegistry: ResourcesRegistryBackendService, constraintResolver: FileConstraintResolverChain, fileValidator: FileValidationService, filesService: FilesBackendService, fileStorageRouter: FileStorageRouterBackendService, fileFieldDetection: FileFieldDetectionBackendService, resourceOperationHelper: ResourceOperationHelperBackendService, appConfigService: AppConfigurationService, pathResolver: FileStoragePathResolverBackendService, fileScanningService: FileScanningBackendService, consumableTokenService: ConsumableTokenBackendService, fileUploadGrantService: FileUploadGrantBackendService);
|
|
54
58
|
/**
|
|
55
59
|
* Extract the resource instance from the request body (if available).
|
|
56
60
|
* In multipart uploads, the resource data may be present in `req.body`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-file-upload-handler.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/files/handlers/resource-file-upload-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAiN,MAAM,uBAAuB,CAAC;AAG3R,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAC3H,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AACvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,qFAAqF,CAAC;AAClI,OAAO,EAAE,qBAAqB,EAAE,MAAM,sEAAsE,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE,qCAAqC,EAAE,MAAM,qFAAqF,CAAC;AAG5I,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,+BAA+B,EAAE,MAAM,sEAAsE,CAAC;AACvH,OAAO,EAAE,gCAAgC,EAAE,MAAM,wEAAwE,CAAC;AAC1H,OAAO,EAAE,qCAAqC,EAAE,MAAM,6EAA6E,CAAC;AAEpI,OAAO,EAAE,0BAA0B,EAAE,MAAM,iEAAiE,CAAC;
|
|
1
|
+
{"version":3,"file":"resource-file-upload-handler.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/files/handlers/resource-file-upload-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG/D,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAiN,MAAM,uBAAuB,CAAC;AAG3R,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG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B,EAAE,gBAAgB,CAAC,GAAG,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC;IA0FhB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,6BAA6B;CAyHtC"}
|
|
@@ -53,6 +53,8 @@ import { FileStoragePathResolverBackendService } from '../../files/storage/file-
|
|
|
53
53
|
import { FileScanningBackendService } from '../../files/services/file-scanning.backend.service.js';
|
|
54
54
|
import { describeCaughtError, projectCaughtErrorLogFields } from '../../errors/utils/error-log-level-classification.backend.utils.js';
|
|
55
55
|
import { resolveStorageApplicationIdentity } from '../../files/utils/storage-application-identity.backend.utils.js';
|
|
56
|
+
import { ConsumableTokenBackendService } from '../../security/consumable-tokens/services/consumable-token.backend.service.js';
|
|
57
|
+
import { FileUploadGrantBackendService } from '../../files/services/file-upload-grant.backend.service.js';
|
|
56
58
|
let ResourceFileUploadHandlerBackendService = class ResourceFileUploadHandlerBackendService {
|
|
57
59
|
logger;
|
|
58
60
|
errorBuilder;
|
|
@@ -66,8 +68,10 @@ let ResourceFileUploadHandlerBackendService = class ResourceFileUploadHandlerBac
|
|
|
66
68
|
appConfigService;
|
|
67
69
|
pathResolver;
|
|
68
70
|
fileScanningService;
|
|
71
|
+
consumableTokenService;
|
|
72
|
+
fileUploadGrantService;
|
|
69
73
|
logDebug;
|
|
70
|
-
constructor(logger, errorBuilder, resourcesRegistry, constraintResolver, fileValidator, filesService, fileStorageRouter, fileFieldDetection, resourceOperationHelper, appConfigService, pathResolver, fileScanningService) {
|
|
74
|
+
constructor(logger, errorBuilder, resourcesRegistry, constraintResolver, fileValidator, filesService, fileStorageRouter, fileFieldDetection, resourceOperationHelper, appConfigService, pathResolver, fileScanningService, consumableTokenService, fileUploadGrantService) {
|
|
71
75
|
this.logger = logger;
|
|
72
76
|
this.errorBuilder = errorBuilder;
|
|
73
77
|
this.resourcesRegistry = resourcesRegistry;
|
|
@@ -80,6 +84,8 @@ let ResourceFileUploadHandlerBackendService = class ResourceFileUploadHandlerBac
|
|
|
80
84
|
this.appConfigService = appConfigService;
|
|
81
85
|
this.pathResolver = pathResolver;
|
|
82
86
|
this.fileScanningService = fileScanningService;
|
|
87
|
+
this.consumableTokenService = consumableTokenService;
|
|
88
|
+
this.fileUploadGrantService = fileUploadGrantService;
|
|
83
89
|
this.logDebug = this.logger.debugByType('ResourceFileUploadHandlerBackendService');
|
|
84
90
|
this.logger.setDebugTypeLogging('ResourceFileUploadHandlerBackendService', false);
|
|
85
91
|
}
|
|
@@ -179,8 +185,24 @@ let ResourceFileUploadHandlerBackendService = class ResourceFileUploadHandlerBac
|
|
|
179
185
|
// Step 4c: Resolve storage provider from z_file() metadata.
|
|
180
186
|
const storageAccepted = fieldMeta?.fileMetadata.storageAccepted;
|
|
181
187
|
const storageProvider = this.fileStorageRouter.resolveProvider(storageAccepted);
|
|
188
|
+
// Step 4d: a file upload GRANT (issue #312) is claimed HERE — the point of no return. Every check a
|
|
189
|
+
// caller can act on (no file, wrong type, too large, generated field) has run; nothing has been
|
|
190
|
+
// written. A refusal above leaves the grant usable for a retry; a race loser is refused by the
|
|
191
|
+
// atomic consume and writes nothing. This handler is NOT on the services-registry pipeline, so its
|
|
192
|
+
// post-operation consumption never sees this request — this is the one consumption site.
|
|
193
|
+
const grant = response.locals?.fileUploadGrant;
|
|
194
|
+
if (grant) {
|
|
195
|
+
await this.consumableTokenService.consumeToken(executionContext.consumableTokenValue);
|
|
196
|
+
executionContext.markConsumableTokenConsumed();
|
|
197
|
+
}
|
|
182
198
|
// Step 5: Create file record (status: PENDING) with scope
|
|
183
|
-
|
|
199
|
+
// Under a grant the file is attributed to the MINTER — the person or machine that delegated the
|
|
200
|
+
// upload — never to the grant. A user-minted grant already yields that through the token context
|
|
201
|
+
// (`resolveFileUploaderPrincipal`, CONSUMABLE_TOKEN case); a machine-minted one yields nothing
|
|
202
|
+
// there, so the grant's own `minter` record is used. Both agree with createFile's mismatch guard.
|
|
203
|
+
const uploaderPrincipal = grant
|
|
204
|
+
? this.fileUploadGrantService.resolveUploaderFromGrant(grant.metadata)
|
|
205
|
+
: resolveFileUploaderPrincipal(executionContext);
|
|
184
206
|
if (uploaderPrincipal) {
|
|
185
207
|
validateUploadedBy(uploaderPrincipal.uploadedBy, this.errorBuilder, executionContext, 'uploadedBy');
|
|
186
208
|
validateUploadedByEntityType(uploaderPrincipal.uploadedByEntityType, this.errorBuilder, executionContext, 'uploadedByEntityType');
|
|
@@ -370,9 +392,44 @@ let ResourceFileUploadHandlerBackendService = class ResourceFileUploadHandlerBac
|
|
|
370
392
|
},
|
|
371
393
|
});
|
|
372
394
|
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
395
|
+
/*
|
|
396
|
+
* Step 9: hold a scanned file NON-DOWNLOADABLE before anyone is told the upload succeeded.
|
|
397
|
+
*
|
|
398
|
+
* `initiateScan` awaits the UPLOADED -> SCANNING transition and only then fires the scan
|
|
399
|
+
* pipeline asynchronously, so awaiting it here costs ONE status write, not the scan. Until
|
|
400
|
+
* 2026-09-08 this ran AFTER the response, fire-and-forget (#433): the file sat at UPLOADED —
|
|
401
|
+
* a downloadable status — for the whole gap between the upload committing and the transition
|
|
402
|
+
* landing, so a field declaring `scanPolicy: 'required'` had a window in which its bytes were
|
|
403
|
+
* servable unscanned. The control advertised more than it held.
|
|
404
|
+
*
|
|
405
|
+
* FAIL-CLOSED, deliberately: this is NOT wrapped in a catch. A scan that cannot be initiated
|
|
406
|
+
* fails the upload, and because `uploadReachedSuccessState` is still false the catch below
|
|
407
|
+
* marks the file FAILED. A caught-and-logged failure would leave the row at UPLOADED, which is
|
|
408
|
+
* exactly the servable state this closes — a scanner outage would silently reopen the window
|
|
409
|
+
* on every upload. An operator gets a failed upload instead, which is the behaviour a control
|
|
410
|
+
* named `required` has to have.
|
|
411
|
+
*/
|
|
412
|
+
const scanIsRequired = this.fileScanningService.shouldScan(fieldMeta?.fileMetadata);
|
|
413
|
+
let uploadedFileForResponse = uploadedFile;
|
|
414
|
+
if (scanIsRequired) {
|
|
415
|
+
await this.fileScanningService.initiateScan(uploadedFile.fileId, executionContext);
|
|
416
|
+
// Re-read so the response reports SCANNING rather than the UPLOADED this row no longer has.
|
|
417
|
+
// A client polling `GET /files/:fileId/metadata` sees SCANNING either way; reporting
|
|
418
|
+
// UPLOADED here would make the upload response the one place the two disagree. A null read
|
|
419
|
+
// keeps the pre-transition row rather than failing an upload that already succeeded.
|
|
420
|
+
const afterScanInitiation = await this.filesService.getFile(uploadedFile.fileId, executionContext);
|
|
421
|
+
if (afterScanInitiation) {
|
|
422
|
+
uploadedFileForResponse = afterScanInitiation;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
// Step 9b: Return success response with file metadata
|
|
426
|
+
const fileMetadata = this.filesService.toMetadataResponse(uploadedFileForResponse);
|
|
427
|
+
/*
|
|
428
|
+
* SCANNING counts as reached-success alongside UPLOADED: the upload itself committed, and the
|
|
429
|
+
* catch below must not roll a scanned file back to FAILED for a later response-layer failure.
|
|
430
|
+
*/
|
|
431
|
+
uploadReachedSuccessState = uploadedFileForResponse.status === FileStatus.UPLOADED
|
|
432
|
+
|| uploadedFileForResponse.status === FileStatus.SCANNING;
|
|
376
433
|
response.status(200).json({
|
|
377
434
|
success: true,
|
|
378
435
|
file: fileMetadata,
|
|
@@ -382,14 +439,16 @@ let ResourceFileUploadHandlerBackendService = class ResourceFileUploadHandlerBac
|
|
|
382
439
|
resourceType,
|
|
383
440
|
fieldName,
|
|
384
441
|
});
|
|
385
|
-
// Step 10:
|
|
386
|
-
|
|
387
|
-
if (
|
|
388
|
-
this.
|
|
389
|
-
.
|
|
390
|
-
|
|
442
|
+
// Step 10: a redeemed grant records what it produced and is audited. Best-effort by contract —
|
|
443
|
+
// the upload has succeeded and the response is sent; a failure here is logged, never thrown.
|
|
444
|
+
if (grant) {
|
|
445
|
+
this.fileUploadGrantService
|
|
446
|
+
.recordRedemption(grant, { fileId: uploadedFile.fileId, mimeType: uploadedFile.mimeType, size: uploadedFile.size }, executionContext)
|
|
447
|
+
.catch((redemptionError) => {
|
|
448
|
+
this.logger.error('File upload grant: redemption record failed', {
|
|
449
|
+
grantId: grant.token._id,
|
|
391
450
|
fileId: uploadedFile.fileId,
|
|
392
|
-
...projectCaughtErrorLogFields(
|
|
451
|
+
...projectCaughtErrorLogFields(redemptionError),
|
|
393
452
|
});
|
|
394
453
|
});
|
|
395
454
|
}
|
|
@@ -633,6 +692,8 @@ ResourceFileUploadHandlerBackendService = __decorate([
|
|
|
633
692
|
__param(9, inject(SAAS_SERVICE_TYPES.AppConfigService)),
|
|
634
693
|
__param(10, inject(SAAS_SERVICE_TYPES.FileStoragePathResolver)),
|
|
635
694
|
__param(11, inject(SAAS_SERVICE_TYPES.FileScanningService)),
|
|
695
|
+
__param(12, inject(SAAS_SERVICE_TYPES.ConsumableTokenService)),
|
|
696
|
+
__param(13, inject(SAAS_SERVICE_TYPES.FileUploadGrantService)),
|
|
636
697
|
__metadata("design:paramtypes", [Function, ErrorBuilderBackendService,
|
|
637
698
|
ResourcesRegistryBackendService,
|
|
638
699
|
FileConstraintResolverChain,
|
|
@@ -643,7 +704,9 @@ ResourceFileUploadHandlerBackendService = __decorate([
|
|
|
643
704
|
ResourceOperationHelperBackendService,
|
|
644
705
|
AppConfigurationService,
|
|
645
706
|
FileStoragePathResolverBackendService,
|
|
646
|
-
FileScanningBackendService
|
|
707
|
+
FileScanningBackendService,
|
|
708
|
+
ConsumableTokenBackendService,
|
|
709
|
+
FileUploadGrantBackendService])
|
|
647
710
|
], ResourceFileUploadHandlerBackendService);
|
|
648
711
|
export { ResourceFileUploadHandlerBackendService };
|
|
649
712
|
//# sourceMappingURL=resource-file-upload-handler.backend.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-file-upload-handler.backend.service.js","sourceRoot":"","sources":["../../../../../src/files/handlers/resource-file-upload-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;AAEH,OAAO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CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAE3C,YAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAElD,YAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;+CAnBhB,0BAA0B;QAErB,+BAA+B;QAE9B,2BAA2B;QAEhC,qBAAqB;QAEtB,mBAAmB;QAEd,+BAA+B;QAE9B,gCAAgC;QAE3B,qCAAqC;QAE5C,uBAAuB;QAE3B,qCAAqC;QAE9B,0BAA0B;GA3BvD,uCAAuC,CAguBnD","sourcesContent":["/**\n * Resource File Upload Handler Backend Service\n *\n * Handles user-provided uploads for resource-integrated file fields after the\n * controller's pre-Multer middleware has already established execution context\n * and authorized access to the owning resource route.\n *\n * Coordinates validation, file record creation, and storage upload. UPDATE\n * routes authorize the target resource before reaching this handler, but the\n * upload itself still creates a new File record; attaching/replacing that file\n * on the resource is owned by the calling form/field mutation lane, not by this\n * upload transport.\n *\n * Flow:\n * 1. Validate file exists in request\n * 2. Resolve file constraints from resource field schema\n * 3. Validate file against constraints\n * 4. Create file record (status: PENDING)\n * 5. Upload file to storage\n * 6. Update file status to UPLOADED\n * 7. Return file metadata\n * 8. (async) Initiate AV scan if enabled (UPLOADED → SCANNING → CLEAN/INFECTED)\n */\n\nimport { injectable, inject } from 'inversify';\nimport type { Request, Response, NextFunction } from 'express';\nimport { Readable } from 'stream';\nimport fs from 'fs';\nimport { CoreResourceOperation, ResourceType, ErrorType, ErrorCustomMessageReference, File, FileStatus, FILE_DOWNLOADABLE_STATUSES, FILE_METADATA_WITHHELD_STATUSES, ResourcePrimaryScope, FileScopeIdentifiers, isWildoBackendError, parseFileServeVariant } from '@wildo-ai/saas-models';\nimport { FileGenerationSource } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FileConstraintResolverChain } from '~wildo-backend-lib/files/constraints/file-constraint-resolver-chain.backend.service';\nimport { FileValidationService } from '~wildo-backend-lib/files/constraints/file-validation.backend.service';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport { ResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/resource-operations-helper.backend.service';\nimport { validateResourceType, validateFieldName, validateResourceId, validateFileId, validateContentType, validateSize, validateUploadedBy, validateUploadedByEntityType, resolveConfiguredMaxFileSize } from '~wildo-backend-lib/files/utils/file-validation.utils';\nimport { resolveFileUploaderPrincipal } from '~wildo-backend-lib/files/utils/file-uploader.utils';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nimport { FileFieldDetectionBackendService } from '~wildo-backend-lib/files/services/file-field-detection.backend.service';\nimport { FileStoragePathResolverBackendService } from '~wildo-backend-lib/files/storage/file-storage-path-resolver.backend.service';\nimport type { StorageUploadResult, StorageUploadOptions } from '~wildo-backend-lib/files/storage/file-storage-provider.types';\nimport { FileScanningBackendService } from '~wildo-backend-lib/files/services/file-scanning.backend.service';\nimport { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { resolveStorageApplicationIdentity } from '~wildo-backend-lib/files/utils/storage-application-identity.backend.utils';\n\n@injectable()\nexport class ResourceFileUploadHandlerBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger)\n private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.FileConstraintResolverChain)\n private readonly constraintResolver: FileConstraintResolverChain,\n @inject(SAAS_SERVICE_TYPES.FileValidationService)\n private readonly fileValidator: FileValidationService,\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n @inject(SAAS_SERVICE_TYPES.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n @inject(SAAS_SERVICE_TYPES.FileFieldDetectionService)\n private readonly fileFieldDetection: FileFieldDetectionBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceOperationHelperService)\n private readonly resourceOperationHelper: ResourceOperationHelperBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.FileStoragePathResolver)\n private readonly pathResolver: FileStoragePathResolverBackendService,\n @inject(SAAS_SERVICE_TYPES.FileScanningService)\n private readonly fileScanningService: FileScanningBackendService,\n ) {\n this.logDebug = this.logger.debugByType('ResourceFileUploadHandlerBackendService');\n this.logger.setDebugTypeLogging('ResourceFileUploadHandlerBackendService', false);\n }\n\n /**\n * Extract the resource instance from the request body (if available).\n * In multipart uploads, the resource data may be present in `req.body`\n * as parsed form fields.\n */\n private extractResourceInstance(req: Request): Record<string, unknown> | undefined {\n if (req.body && typeof req.body === 'object' && Object.keys(req.body).length > 0) {\n return req.body as Record<string, unknown>;\n }\n return undefined;\n }\n\n /**\n * Handle file upload for resource-integrated file fields.\n *\n * @param request - Express request with file in request.file (Multer)\n * @param response - Express response\n * @param resourceType - Resource type (e.g., 'todos')\n * @param fieldName - File field name (e.g., 'attachments')\n * @param resourceId - Resource ID (undefined for CREATE, string for UPDATE route authorization)\n * @param operation - Route operation used for authorization; the upload always creates a new File record\n * @param executionContext - Execution context from request\n */\n async handleFileUpload(\n request: Request,\n response: Response,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string | undefined,\n operation: CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE,\n executionContext: ExecutionContext<any>\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation and security vulnerabilities)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n if (resourceId !== undefined) {\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n }\n\n this.logDebug('Handling file upload', {\n resourceType,\n fieldName,\n resourceId,\n operation,\n hasFile: !!request.file,\n });\n\n let fileRecord: { fileId: string } | undefined;\n let uploadReachedSuccessState = false;\n let blobStoredInStorage = false;\n\n try {\n // Step 1: Validate file exists in request\n if (!request.file) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_UPLOAD_NO_FILE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n const multerFile = request.file;\n const maxFileSize = resolveConfiguredMaxFileSize(this.appConfigService.config.storage?.maxFileSize);\n\n // Validate file metadata (CRITICAL: Prevents invalid file data)\n validateContentType(multerFile.mimetype, this.errorBuilder, executionContext, 'contentType');\n validateSize(multerFile.size, maxFileSize, this.errorBuilder, executionContext, 'size');\n\n // Step 2: Resolve file constraints from resource field schema\n const constraint = await this.constraintResolver.resolve({\n resourceType,\n fieldName,\n });\n\n // Step 3: Validate file against constraints\n const validationResult = await this.fileValidator.validateFile(multerFile, constraint);\n\n if (!validationResult.success) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: 'File validation failed',\n errors: validationResult.errors,\n filename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n },\n }\n );\n }\n\n // Step 4: Reject direct uploads to generated file fields FIRST —\n // before scope derivation. \"This field cannot receive user uploads at\n // all\" is a more fundamental rejection than \"what scope does the file\n // belong to\", and must not be masked by a scope-derivation error\n // (e.g. a missing applicationId) on a field that was never uploadable.\n const fieldMeta = this.fileFieldDetection.getFileFieldMetadata(resourceType, fieldName);\n if (fieldMeta?.fileMetadata.generation?.source === FileGenerationSource.PDF_TEMPLATE) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_GENERATED_FIELD_NOT_WRITABLE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n // Step 4b: Derive scope from parent resource's resourcePrimaryScope.\n const scope = this.deriveScopeFromParentResource(resourceType, executionContext);\n\n // Step 4c: Resolve storage provider from z_file() metadata.\n const storageAccepted = fieldMeta?.fileMetadata.storageAccepted;\n const storageProvider = this.fileStorageRouter.resolveProvider(storageAccepted);\n\n // Step 5: Create file record (status: PENDING) with scope\n const uploaderPrincipal = resolveFileUploaderPrincipal(executionContext);\n if (uploaderPrincipal) {\n validateUploadedBy(uploaderPrincipal.uploadedBy, this.errorBuilder, executionContext, 'uploadedBy');\n validateUploadedByEntityType(\n uploaderPrincipal.uploadedByEntityType,\n this.errorBuilder,\n executionContext,\n 'uploadedByEntityType',\n );\n }\n\n const createdFile = await this.filesService.createFile(\n {\n filename: multerFile.originalname || multerFile.filename,\n originalFilename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n storageProvider: storageProvider.providerId,\n scope,\n uploadedBy: uploaderPrincipal?.uploadedBy,\n uploadedByEntityType: uploaderPrincipal?.uploadedByEntityType,\n },\n executionContext\n );\n\n fileRecord = { fileId: createdFile.fileId };\n\n // Step 5b: Resolve upload path options now that we have the fileId.\n const resourceInstance = this.extractResourceInstance(request);\n let uploadOptions: StorageUploadOptions | undefined;\n if (fieldMeta) {\n uploadOptions = this.pathResolver.resolve(\n createdFile.fileId,\n fieldName,\n fieldMeta.fileMetadata,\n resolveStorageApplicationIdentity(this.appConfigService),\n multerFile.originalname,\n resourceInstance,\n );\n }\n\n // The resource segment of the object key comes from the row that was just created, and is\n // applied OUTSIDE the `fieldMeta` branch on purpose: a file without field metadata still\n // belongs to a resource, and keying it as unlinked would place it outside the prefix its\n // principal is granted once the session policy narrows per resource.\n //\n // Derived once, here, at create — the key never moves afterwards, so this is the only\n // moment the segment can be decided.\n // Use the handler's OWN `resourceType` parameter, NOT `createdFile.linkedResourceType`.\n //\n // `createFile` above is called WITHOUT a linked resource — the row is created unlinked and the\n // association is written later — so reading the field back off the created record is always\n // `undefined`, and every upload silently took the `_unlinked/` staging branch. Caught only by\n // uploading a real file and listing the object store: `tsc` was clean and every unit test\n // green, because nothing in either exercises the value that reaches the key builder.\n //\n // `resourceType` is a parameter of this method and is validated at entry, so it is the\n // authoritative answer to \"which resource does this blob belong to\" at the only moment the\n // key can be decided.\n // `scope` rides along so the key carries `<scope>/<scopeId>` — the same `FileScopeIdentifiers`\n // already built above for the File row, so the row and the object key agree by construction\n // rather than by two independent derivations.\n uploadOptions = { ...uploadOptions, linkedResourceType: resourceType, scope };\n\n // Step 6: Create stream from disk file (true streaming, no memory buffering)\n // With disk storage, multerFile.path contains the temp file path\n if (!multerFile.path) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Multer file path is missing (disk storage error)',\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n // Verify file exists before creating stream\n if (!fs.existsSync(multerFile.path)) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Temp file not found on disk',\n path: multerFile.path,\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n let fileStream: Readable | null = null;\n let uploadResult: StorageUploadResult | null = null;\n\n // Step 7: Upload the blob through the resolved storage provider.\n try {\n // Create stream from disk file (true streaming, no memory buffering)\n fileStream = fs.createReadStream(multerFile.path);\n\n uploadResult = await storageProvider.upload(\n fileStream,\n createdFile.fileId,\n multerFile.mimetype,\n multerFile.size,\n executionContext,\n uploadOptions,\n );\n blobStoredInStorage = true;\n\n this.logDebug('File uploaded to storage successfully', {\n fileId: createdFile.fileId,\n });\n } catch (uploadError) {\n // If upload fails, mark file as FAILED\n await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.FAILED,\n executionContext\n );\n\n throw this.errorBuilder.buildError(\n ErrorType.EXTERNAL_SERVICE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.EXTERNAL_SERVICE,\n context: {\n message: 'Failed to upload file to storage',\n fileId: createdFile.fileId,\n error: describeCaughtError(uploadError),\n },\n }\n );\n } finally {\n // Clean up temp file (always, even on error)\n // This ensures temp files are removed even if upload fails or other errors occur\n if (multerFile.path && fs.existsSync(multerFile.path)) {\n try {\n fs.unlinkSync(multerFile.path);\n this.logDebug('Temp file cleaned up', { path: multerFile.path });\n } catch (cleanupError) {\n // Log cleanup error but don't fail operation\n this.logger.warn('Failed to clean up temp file', {\n path: multerFile.path,\n ...projectCaughtErrorLogFields(cleanupError),\n });\n }\n }\n\n // Also destroy stream if it was created\n if (fileStream && !fileStream.destroyed) {\n fileStream.destroy();\n }\n }\n\n // Step 8: Update file status to UPLOADED (with retry logic)\n // CRITICAL: If updateFileStatus() fails after successful storage upload,\n // file exists in storage but status remains PENDING in database.\n // Retry logic handles transient errors (network issues, database locks, etc.)\n // Decision 5.1: Retry Logic with audit log error (Option A)\n const maxRetries = 3;\n const initialDelay = 1000; // 1 second\n\n let lastError: Error | null = null;\n let uploadedFile: File | null = null;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n uploadedFile = await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.UPLOADED,\n executionContext,\n undefined,\n uploadResult ?? undefined,\n );\n break; // Success\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(describeCaughtError(error));\n\n if (attempt < maxRetries) {\n const delay = initialDelay * Math.pow(2, attempt);\n this.logger.warn('File status update failed, retrying', {\n fileId: createdFile.fileId,\n attempt: attempt + 1,\n maxRetries,\n delay,\n error: lastError.message,\n });\n await new Promise(resolve => setTimeout(resolve, delay));\n } else {\n // Final attempt failed - audit log and re-throw\n this.logger.error('File status update failed after all retries', {\n fileId: createdFile.fileId,\n attempts: maxRetries + 1,\n error: lastError.message,\n // File exists in storage but status remains PENDING in database\n // This is a data inconsistency that needs manual intervention\n });\n\n // If the blob already reached storage but metadata could not commit to\n // UPLOADED, try to roll the blob back so the row can safely move into\n // a failed lifecycle path instead of silently pointing at live data.\n if (blobStoredInStorage && uploadResult) {\n try {\n await storageProvider.delete(\n {\n fileId: createdFile.fileId,\n storageProvider: uploadResult.provider,\n storageRef: uploadResult.storageRef,\n },\n executionContext,\n );\n blobStoredInStorage = false;\n this.logger.warn('Rolled back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n });\n } catch (rollbackError) {\n if (!isWildoBackendError(rollbackError) || rollbackError.type !== ErrorType.NOT_FOUND) {\n this.logger.error('Failed to roll back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n ...projectCaughtErrorLogFields(rollbackError),\n originalError: lastError.message,\n });\n } else {\n blobStoredInStorage = false;\n }\n }\n }\n\n // Re-throw to fail the operation\n throw lastError;\n }\n }\n }\n\n // Ensure uploadedFile is set (TypeScript safety check)\n if (!uploadedFile) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'File status update failed - uploadedFile is null after retries',\n fileId: createdFile.fileId,\n },\n }\n );\n }\n\n // Step 9: Return success response with file metadata\n const fileMetadata = this.filesService.toMetadataResponse(uploadedFile);\n uploadReachedSuccessState = uploadedFile.status === FileStatus.UPLOADED;\n\n response.status(200).json({\n success: true,\n file: fileMetadata,\n });\n\n this.logDebug('File upload completed successfully', {\n fileId: uploadedFile.fileId,\n resourceType,\n fieldName,\n });\n\n // Step 10: Post-upload async pipeline (fire-and-forget, response already sent)\n const shouldScan = this.fileScanningService.shouldScan(fieldMeta?.fileMetadata);\n\n if (shouldScan) {\n this.fileScanningService.initiateScan(uploadedFile.fileId, executionContext)\n .catch((scanError) => {\n this.logger.error('Failed to initiate file scanning', {\n fileId: uploadedFile!.fileId,\n ...projectCaughtErrorLogFields(scanError),\n });\n });\n }\n } catch (error) {\n // Only pre-success failures should transition a file to FAILED. Once the\n // upload already reached UPLOADED, later response-layer failures must not\n // corrupt the persisted state back to FAILED. Likewise, if the blob still\n // exists in storage because rollback failed, keep the row out of FAILED so\n // operators can distinguish that inconsistency from a clean failed upload.\n const shouldMarkAsFailed = !!fileRecord?.fileId && !uploadReachedSuccessState && !blobStoredInStorage;\n if (shouldMarkAsFailed) {\n try {\n await this.filesService.updateFileStatus(\n fileRecord.fileId,\n FileStatus.FAILED,\n executionContext\n );\n this.logDebug('File marked as FAILED due to upload error', {\n fileId: fileRecord.fileId,\n });\n } catch (updateError) {\n // Log but don't throw - we're already in error handling\n this.logger.error('Failed to mark file as FAILED', {\n fileId: fileRecord.fileId,\n ...projectCaughtErrorLogFields(updateError),\n });\n }\n }\n\n // Re-throw error to be handled by Express error handler\n throw error;\n }\n }\n\n /**\n * Serve (stream) a resource-linked file's bytes for INLINE preview/consumption.\n *\n * This is the read counterpart to `handleFileUpload` — the resource-integrated\n * file **serve** route (`GET .../{res}/:resourceId/files/:fieldName/:fileId`). The\n * controller has ALREADY authorized the caller against the parent resource's READ\n * operation before delegating here, so authorization **inherits from the linked\n * resource** — no consumable token, no public share (those belong to the global\n * `FileController` for its separate cross-resource/share purpose).\n *\n * The one job this method owns is the LINK-OWNERSHIP boundary: the requested\n * `fileId` MUST be linked to exactly this `{resourceType, resourceId, fieldName}`.\n * Without it, any caller who can READ a parent record could stream an arbitrary or\n * cross-resource file id through the route. A mismatch fails closed as NOT_FOUND\n * (no existence disclosure). `getFile()`'s own scope check is defense-in-depth.\n *\n * A `?variant=thumbnail` query asks for a downscaled preview rendition; it is\n * parsed fail-safe (unknown values → original bytes) and forwarded to the shared\n * streaming seam, which only transforms eligible raster images.\n *\n * @param request - Express request (`:fileId` etc. in params, `?variant=` in query).\n * @param response - Express response to stream into.\n * @param next - Express next (forwards pre-header stream errors).\n * @param resourceType - Parent resource type from the route.\n * @param fieldName - File field name from the route.\n * @param resourceId - Parent resource id from the route (authorization target).\n * @param fileId - The specific file id to serve (must belong to the field above).\n * @param executionContext - READ execution context built + authorized by the controller.\n */\n async handleFileServe(\n request: Request,\n response: Response,\n next: NextFunction,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string,\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n this.logDebug('Handling file serve', { resourceType, fieldName, resourceId, fileId });\n\n // getFile applies the file-scope access check (defense-in-depth). Primary authz —\n // the parent resource READ — was already enforced by the controller.\n const file = await this.filesService.getFile(fileId, executionContext);\n\n // SECURITY BOUNDARY: the served file MUST be linked to THIS resource + field.\n const belongsToRouteResource =\n !!file &&\n file.linkedResourceType === resourceType &&\n String(file.linkedResourceId) === String(resourceId) &&\n file.linkedFieldName === fieldName;\n\n if (!belongsToRouteResource) {\n this.logDebug('File serve denied: file not linked to route resource/field', {\n fileId,\n resourceType,\n resourceId,\n fieldName,\n linkedResourceType: file?.linkedResourceType,\n linkedResourceId: file?.linkedResourceId,\n linkedFieldName: file?.linkedFieldName,\n });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n\n // STATUS GATE — the same invariant the two GLOBAL file routes already enforce, applied at the\n // third site that streams bytes.\n //\n // It was missing here, and the omission became reachable the moment generated files got serve\n // routes (2026-08-25): a REGENERATE marks the superseded document `DELETED` while DELIBERATELY\n // retaining its `linkedResourceType/Id/FieldName`, so the link-ownership boundary above says yes\n // and the old document kept streaming — measured, 200 with 2,222 bytes. The same hole applies to\n // an UPLOADED file a privacy erasure marked `DELETED`: physical cleanup is a batch that runs much\n // later, and until it did, the erased bytes were still served in place.\n //\n // Two tiers, mirroring the existing gates rather than inventing a third posture:\n // - `FILE_METADATA_WITHHELD_STATUSES` (i.e. `DELETED`, the erasure outcome) → NOT_FOUND, because\n // for an erased file, confirming the id still resolves is itself a disclosure (the same\n // reasoning as `FileController.assertFileMetadataDisclosable`);\n // - anything else outside `FILE_DOWNLOADABLE_STATUSES` (`PENDING`, `SCANNING`, `FAILED`, …) →\n // the download route's VALIDATION shape, because such a file genuinely exists and may become\n // servable, and an uploader polling a preview needs to be told which.\n if (FILE_METADATA_WITHHELD_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: withheld status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n if (!FILE_DOWNLOADABLE_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: non-servable status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'File is not available for download', fileId, status: file.status },\n },\n );\n }\n\n // `?variant=thumbnail` → downscaled preview rendition (raster images only; the\n // streaming seam falls back to original bytes for anything else). Fail-safe parse.\n const variant = parseFileServeVariant(request.query.variant);\n\n await this.filesService.streamFileToResponse(file, response, executionContext, {\n disposition: 'inline',\n next,\n variant,\n });\n }\n\n /**\n * Derive file scope from parent resource's resourcePrimaryScope.\n *\n * Scope derivation rules:\n * - APPLICATION: sets applicationId from execution context\n * - ORGANIZATIONS: sets organizationId from execution context\n * - USER_SELF: sets userId + applicationId from execution context (no org — separate scope axis)\n *\n * @param resourceType - Parent resource type\n * @param executionContext - Execution context for scope values\n * @returns FileScopeIdentifiers derived from parent resource\n */\n private deriveScopeFromParentResource(\n resourceType: ResourceType,\n executionContext: ExecutionContext<any>\n ): FileScopeIdentifiers {\n // Get parent resource configuration to find its primaryScope\n const resourceConfig = this.resourcesRegistry.getResourceConfiguration(resourceType);\n\n // Get primaryScope from resource configuration\n // Default to ORGANIZATIONS if not specified\n const primaryScope = resourceConfig?.resourcePrimaryScope || ResourcePrimaryScope.ORGANIZATIONS;\n\n // Extract scope identifiers from execution context\n const organizationId = this.resourceOperationHelper.getInitiatorId(executionContext, 'organization');\n const userId = this.resourceOperationHelper.getInitiatorId(executionContext, 'user');\n // Fall back to the app config's applicationId when the execution context\n // doesn't carry one — same pattern this handler already uses for the path\n // binding above. There is exactly one application per backend, so\n // `appConfigService.applicationId` is the correct anchor when an internal\n // EC was built without a populated `applicationId`.\n const applicationId = executionContext.applicationId || this.appConfigService.applicationId;\n\n switch (primaryScope) {\n case ResourcePrimaryScope.APPLICATION:\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.APPLICATION,\n applicationId,\n };\n\n case ResourcePrimaryScope.ORGANIZATIONS:\n if (!organizationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.ORGANIZATIONS,\n applicationId,\n organizationId,\n };\n\n case ResourcePrimaryScope.USER_SELF:\n // USER_SELF and ORGANIZATIONS are independent primary-scope axes (separation of\n // concern): a self-owned file is owned by the USER, never by an org. Require the\n // user (owner) + applicationId (tenant/bucket anchor); do NOT read or persist an\n // organizationId here — a self-profile carries no org context.\n if (!userId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.USER_SELF,\n applicationId,\n userId,\n };\n\n default:\n throw this.errorBuilder.buildError(\n ErrorType.CONFIGURATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'File uploads only support APPLICATION, ORGANIZATIONS, and USER_SELF resource scopes',\n resourceType,\n primaryScope,\n },\n }\n );\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resource-file-upload-handler.backend.service.js","sourceRoot":"","sources":["../../../../../src/files/handlers/resource-file-upload-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAuC,SAAS,EAAE,2BAA2B,EAAQ,UAAU,EAAE,0BAA0B,EAAE,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AC,CAAA;IAEzD,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAE3C,YAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAElD,YAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,YAAA,MAAM,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;IAEjD,YAAA,MAAM,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;+CAvBnB,0BAA0B;QAErB,+BAA+B;QAE9B,2BAA2B;QAEhC,qBAAqB;QAEtB,mBAAmB;QAEd,+BAA+B;QAE9B,gCAAgC;QAE3B,qCAAqC;QAE5C,uBAAuB;QAE3B,qCAAqC;QAE9B,0BAA0B;QAEvB,6BAA6B;QAE7B,6BAA6B;GA/B7D,uCAAuC,CA2xBnD","sourcesContent":["/**\n * Resource File Upload Handler Backend Service\n *\n * Handles user-provided uploads for resource-integrated file fields after the\n * controller's pre-Multer middleware has already established execution context\n * and authorized access to the owning resource route.\n *\n * Coordinates validation, file record creation, and storage upload. UPDATE\n * routes authorize the target resource before reaching this handler, but the\n * upload itself still creates a new File record; attaching/replacing that file\n * on the resource is owned by the calling form/field mutation lane, not by this\n * upload transport.\n *\n * Flow:\n * 1. Validate file exists in request\n * 2. Resolve file constraints from resource field schema\n * 3. Validate file against constraints\n * 4. Create file record (status: PENDING)\n * 5. Upload file to storage\n * 6. Update file status to UPLOADED\n * 7. Return file metadata\n * 8. (async) Initiate AV scan if enabled (UPLOADED → SCANNING → CLEAN/INFECTED)\n */\n\nimport { injectable, inject } from 'inversify';\nimport type { Request, Response, NextFunction } from 'express';\nimport { Readable } from 'stream';\nimport fs from 'fs';\nimport { CoreResourceOperation, ResourceType, ErrorType, ErrorCustomMessageReference, File, FileStatus, FILE_DOWNLOADABLE_STATUSES, FILE_METADATA_WITHHELD_STATUSES, ResourcePrimaryScope, FileScopeIdentifiers, isWildoBackendError, parseFileServeVariant } from '@wildo-ai/saas-models';\nimport { FileGenerationSource } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FileConstraintResolverChain } from '~wildo-backend-lib/files/constraints/file-constraint-resolver-chain.backend.service';\nimport { FileValidationService } from '~wildo-backend-lib/files/constraints/file-validation.backend.service';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport { ResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/resource-operations-helper.backend.service';\nimport { validateResourceType, validateFieldName, validateResourceId, validateFileId, validateContentType, validateSize, validateUploadedBy, validateUploadedByEntityType, resolveConfiguredMaxFileSize } from '~wildo-backend-lib/files/utils/file-validation.utils';\nimport { resolveFileUploaderPrincipal } from '~wildo-backend-lib/files/utils/file-uploader.utils';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nimport { FileFieldDetectionBackendService } from '~wildo-backend-lib/files/services/file-field-detection.backend.service';\nimport { FileStoragePathResolverBackendService } from '~wildo-backend-lib/files/storage/file-storage-path-resolver.backend.service';\nimport type { StorageUploadResult, StorageUploadOptions } from '~wildo-backend-lib/files/storage/file-storage-provider.types';\nimport { FileScanningBackendService } from '~wildo-backend-lib/files/services/file-scanning.backend.service';\nimport { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { resolveStorageApplicationIdentity } from '~wildo-backend-lib/files/utils/storage-application-identity.backend.utils';\nimport { ConsumableTokenBackendService } from '~wildo-backend-lib/security/consumable-tokens/services/consumable-token.backend.service';\nimport { FileUploadGrantBackendService } from '~wildo-backend-lib/files/services/file-upload-grant.backend.service';\nimport type { FileUploadRouteGrantLocals } from '~wildo-backend-lib/files/handlers/file-upload-route-locals.backend.types';\n\n@injectable()\nexport class ResourceFileUploadHandlerBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger)\n private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.FileConstraintResolverChain)\n private readonly constraintResolver: FileConstraintResolverChain,\n @inject(SAAS_SERVICE_TYPES.FileValidationService)\n private readonly fileValidator: FileValidationService,\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n @inject(SAAS_SERVICE_TYPES.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n @inject(SAAS_SERVICE_TYPES.FileFieldDetectionService)\n private readonly fileFieldDetection: FileFieldDetectionBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceOperationHelperService)\n private readonly resourceOperationHelper: ResourceOperationHelperBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.FileStoragePathResolver)\n private readonly pathResolver: FileStoragePathResolverBackendService,\n @inject(SAAS_SERVICE_TYPES.FileScanningService)\n private readonly fileScanningService: FileScanningBackendService,\n @inject(SAAS_SERVICE_TYPES.ConsumableTokenService)\n private readonly consumableTokenService: ConsumableTokenBackendService,\n @inject(SAAS_SERVICE_TYPES.FileUploadGrantService)\n private readonly fileUploadGrantService: FileUploadGrantBackendService,\n ) {\n this.logDebug = this.logger.debugByType('ResourceFileUploadHandlerBackendService');\n this.logger.setDebugTypeLogging('ResourceFileUploadHandlerBackendService', false);\n }\n\n /**\n * Extract the resource instance from the request body (if available).\n * In multipart uploads, the resource data may be present in `req.body`\n * as parsed form fields.\n */\n private extractResourceInstance(req: Request): Record<string, unknown> | undefined {\n if (req.body && typeof req.body === 'object' && Object.keys(req.body).length > 0) {\n return req.body as Record<string, unknown>;\n }\n return undefined;\n }\n\n /**\n * Handle file upload for resource-integrated file fields.\n *\n * @param request - Express request with file in request.file (Multer)\n * @param response - Express response\n * @param resourceType - Resource type (e.g., 'todos')\n * @param fieldName - File field name (e.g., 'attachments')\n * @param resourceId - Resource ID (undefined for CREATE, string for UPDATE route authorization)\n * @param operation - Route operation used for authorization; the upload always creates a new File record\n * @param executionContext - Execution context from request\n */\n async handleFileUpload(\n request: Request,\n response: Response,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string | undefined,\n operation: CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE,\n executionContext: ExecutionContext<any>\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation and security vulnerabilities)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n if (resourceId !== undefined) {\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n }\n\n this.logDebug('Handling file upload', {\n resourceType,\n fieldName,\n resourceId,\n operation,\n hasFile: !!request.file,\n });\n\n let fileRecord: { fileId: string } | undefined;\n let uploadReachedSuccessState = false;\n let blobStoredInStorage = false;\n\n try {\n // Step 1: Validate file exists in request\n if (!request.file) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_UPLOAD_NO_FILE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n const multerFile = request.file;\n const maxFileSize = resolveConfiguredMaxFileSize(this.appConfigService.config.storage?.maxFileSize);\n\n // Validate file metadata (CRITICAL: Prevents invalid file data)\n validateContentType(multerFile.mimetype, this.errorBuilder, executionContext, 'contentType');\n validateSize(multerFile.size, maxFileSize, this.errorBuilder, executionContext, 'size');\n\n // Step 2: Resolve file constraints from resource field schema\n const constraint = await this.constraintResolver.resolve({\n resourceType,\n fieldName,\n });\n\n // Step 3: Validate file against constraints\n const validationResult = await this.fileValidator.validateFile(multerFile, constraint);\n\n if (!validationResult.success) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: 'File validation failed',\n errors: validationResult.errors,\n filename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n },\n }\n );\n }\n\n // Step 4: Reject direct uploads to generated file fields FIRST —\n // before scope derivation. \"This field cannot receive user uploads at\n // all\" is a more fundamental rejection than \"what scope does the file\n // belong to\", and must not be masked by a scope-derivation error\n // (e.g. a missing applicationId) on a field that was never uploadable.\n const fieldMeta = this.fileFieldDetection.getFileFieldMetadata(resourceType, fieldName);\n if (fieldMeta?.fileMetadata.generation?.source === FileGenerationSource.PDF_TEMPLATE) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_GENERATED_FIELD_NOT_WRITABLE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n // Step 4b: Derive scope from parent resource's resourcePrimaryScope.\n const scope = this.deriveScopeFromParentResource(resourceType, executionContext);\n\n // Step 4c: Resolve storage provider from z_file() metadata.\n const storageAccepted = fieldMeta?.fileMetadata.storageAccepted;\n const storageProvider = this.fileStorageRouter.resolveProvider(storageAccepted);\n\n // Step 4d: a file upload GRANT (issue #312) is claimed HERE — the point of no return. Every check a\n // caller can act on (no file, wrong type, too large, generated field) has run; nothing has been\n // written. A refusal above leaves the grant usable for a retry; a race loser is refused by the\n // atomic consume and writes nothing. This handler is NOT on the services-registry pipeline, so its\n // post-operation consumption never sees this request — this is the one consumption site.\n const grant = (response.locals as FileUploadRouteGrantLocals | undefined)?.fileUploadGrant;\n if (grant) {\n await this.consumableTokenService.consumeToken(executionContext.consumableTokenValue!);\n executionContext.markConsumableTokenConsumed();\n }\n\n // Step 5: Create file record (status: PENDING) with scope\n // Under a grant the file is attributed to the MINTER — the person or machine that delegated the\n // upload — never to the grant. A user-minted grant already yields that through the token context\n // (`resolveFileUploaderPrincipal`, CONSUMABLE_TOKEN case); a machine-minted one yields nothing\n // there, so the grant's own `minter` record is used. Both agree with createFile's mismatch guard.\n const uploaderPrincipal = grant\n ? this.fileUploadGrantService.resolveUploaderFromGrant(grant.metadata)\n : resolveFileUploaderPrincipal(executionContext);\n if (uploaderPrincipal) {\n validateUploadedBy(uploaderPrincipal.uploadedBy, this.errorBuilder, executionContext, 'uploadedBy');\n validateUploadedByEntityType(\n uploaderPrincipal.uploadedByEntityType,\n this.errorBuilder,\n executionContext,\n 'uploadedByEntityType',\n );\n }\n\n const createdFile = await this.filesService.createFile(\n {\n filename: multerFile.originalname || multerFile.filename,\n originalFilename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n storageProvider: storageProvider.providerId,\n scope,\n uploadedBy: uploaderPrincipal?.uploadedBy,\n uploadedByEntityType: uploaderPrincipal?.uploadedByEntityType,\n },\n executionContext\n );\n\n fileRecord = { fileId: createdFile.fileId };\n\n // Step 5b: Resolve upload path options now that we have the fileId.\n const resourceInstance = this.extractResourceInstance(request);\n let uploadOptions: StorageUploadOptions | undefined;\n if (fieldMeta) {\n uploadOptions = this.pathResolver.resolve(\n createdFile.fileId,\n fieldName,\n fieldMeta.fileMetadata,\n resolveStorageApplicationIdentity(this.appConfigService),\n multerFile.originalname,\n resourceInstance,\n );\n }\n\n // The resource segment of the object key comes from the row that was just created, and is\n // applied OUTSIDE the `fieldMeta` branch on purpose: a file without field metadata still\n // belongs to a resource, and keying it as unlinked would place it outside the prefix its\n // principal is granted once the session policy narrows per resource.\n //\n // Derived once, here, at create — the key never moves afterwards, so this is the only\n // moment the segment can be decided.\n // Use the handler's OWN `resourceType` parameter, NOT `createdFile.linkedResourceType`.\n //\n // `createFile` above is called WITHOUT a linked resource — the row is created unlinked and the\n // association is written later — so reading the field back off the created record is always\n // `undefined`, and every upload silently took the `_unlinked/` staging branch. Caught only by\n // uploading a real file and listing the object store: `tsc` was clean and every unit test\n // green, because nothing in either exercises the value that reaches the key builder.\n //\n // `resourceType` is a parameter of this method and is validated at entry, so it is the\n // authoritative answer to \"which resource does this blob belong to\" at the only moment the\n // key can be decided.\n // `scope` rides along so the key carries `<scope>/<scopeId>` — the same `FileScopeIdentifiers`\n // already built above for the File row, so the row and the object key agree by construction\n // rather than by two independent derivations.\n uploadOptions = { ...uploadOptions, linkedResourceType: resourceType, scope };\n\n // Step 6: Create stream from disk file (true streaming, no memory buffering)\n // With disk storage, multerFile.path contains the temp file path\n if (!multerFile.path) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Multer file path is missing (disk storage error)',\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n // Verify file exists before creating stream\n if (!fs.existsSync(multerFile.path)) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Temp file not found on disk',\n path: multerFile.path,\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n let fileStream: Readable | null = null;\n let uploadResult: StorageUploadResult | null = null;\n\n // Step 7: Upload the blob through the resolved storage provider.\n try {\n // Create stream from disk file (true streaming, no memory buffering)\n fileStream = fs.createReadStream(multerFile.path);\n\n uploadResult = await storageProvider.upload(\n fileStream,\n createdFile.fileId,\n multerFile.mimetype,\n multerFile.size,\n executionContext,\n uploadOptions,\n );\n blobStoredInStorage = true;\n\n this.logDebug('File uploaded to storage successfully', {\n fileId: createdFile.fileId,\n });\n } catch (uploadError) {\n // If upload fails, mark file as FAILED\n await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.FAILED,\n executionContext\n );\n\n throw this.errorBuilder.buildError(\n ErrorType.EXTERNAL_SERVICE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.EXTERNAL_SERVICE,\n context: {\n message: 'Failed to upload file to storage',\n fileId: createdFile.fileId,\n error: describeCaughtError(uploadError),\n },\n }\n );\n } finally {\n // Clean up temp file (always, even on error)\n // This ensures temp files are removed even if upload fails or other errors occur\n if (multerFile.path && fs.existsSync(multerFile.path)) {\n try {\n fs.unlinkSync(multerFile.path);\n this.logDebug('Temp file cleaned up', { path: multerFile.path });\n } catch (cleanupError) {\n // Log cleanup error but don't fail operation\n this.logger.warn('Failed to clean up temp file', {\n path: multerFile.path,\n ...projectCaughtErrorLogFields(cleanupError),\n });\n }\n }\n\n // Also destroy stream if it was created\n if (fileStream && !fileStream.destroyed) {\n fileStream.destroy();\n }\n }\n\n // Step 8: Update file status to UPLOADED (with retry logic)\n // CRITICAL: If updateFileStatus() fails after successful storage upload,\n // file exists in storage but status remains PENDING in database.\n // Retry logic handles transient errors (network issues, database locks, etc.)\n // Decision 5.1: Retry Logic with audit log error (Option A)\n const maxRetries = 3;\n const initialDelay = 1000; // 1 second\n\n let lastError: Error | null = null;\n let uploadedFile: File | null = null;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n uploadedFile = await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.UPLOADED,\n executionContext,\n undefined,\n uploadResult ?? undefined,\n );\n break; // Success\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(describeCaughtError(error));\n\n if (attempt < maxRetries) {\n const delay = initialDelay * Math.pow(2, attempt);\n this.logger.warn('File status update failed, retrying', {\n fileId: createdFile.fileId,\n attempt: attempt + 1,\n maxRetries,\n delay,\n error: lastError.message,\n });\n await new Promise(resolve => setTimeout(resolve, delay));\n } else {\n // Final attempt failed - audit log and re-throw\n this.logger.error('File status update failed after all retries', {\n fileId: createdFile.fileId,\n attempts: maxRetries + 1,\n error: lastError.message,\n // File exists in storage but status remains PENDING in database\n // This is a data inconsistency that needs manual intervention\n });\n\n // If the blob already reached storage but metadata could not commit to\n // UPLOADED, try to roll the blob back so the row can safely move into\n // a failed lifecycle path instead of silently pointing at live data.\n if (blobStoredInStorage && uploadResult) {\n try {\n await storageProvider.delete(\n {\n fileId: createdFile.fileId,\n storageProvider: uploadResult.provider,\n storageRef: uploadResult.storageRef,\n },\n executionContext,\n );\n blobStoredInStorage = false;\n this.logger.warn('Rolled back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n });\n } catch (rollbackError) {\n if (!isWildoBackendError(rollbackError) || rollbackError.type !== ErrorType.NOT_FOUND) {\n this.logger.error('Failed to roll back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n ...projectCaughtErrorLogFields(rollbackError),\n originalError: lastError.message,\n });\n } else {\n blobStoredInStorage = false;\n }\n }\n }\n\n // Re-throw to fail the operation\n throw lastError;\n }\n }\n }\n\n // Ensure uploadedFile is set (TypeScript safety check)\n if (!uploadedFile) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'File status update failed - uploadedFile is null after retries',\n fileId: createdFile.fileId,\n },\n }\n );\n }\n\n /*\n * Step 9: hold a scanned file NON-DOWNLOADABLE before anyone is told the upload succeeded.\n *\n * `initiateScan` awaits the UPLOADED -> SCANNING transition and only then fires the scan\n * pipeline asynchronously, so awaiting it here costs ONE status write, not the scan. Until\n * 2026-09-08 this ran AFTER the response, fire-and-forget (#433): the file sat at UPLOADED —\n * a downloadable status — for the whole gap between the upload committing and the transition\n * landing, so a field declaring `scanPolicy: 'required'` had a window in which its bytes were\n * servable unscanned. The control advertised more than it held.\n *\n * FAIL-CLOSED, deliberately: this is NOT wrapped in a catch. A scan that cannot be initiated\n * fails the upload, and because `uploadReachedSuccessState` is still false the catch below\n * marks the file FAILED. A caught-and-logged failure would leave the row at UPLOADED, which is\n * exactly the servable state this closes — a scanner outage would silently reopen the window\n * on every upload. An operator gets a failed upload instead, which is the behaviour a control\n * named `required` has to have.\n */\n const scanIsRequired = this.fileScanningService.shouldScan(fieldMeta?.fileMetadata);\n let uploadedFileForResponse: File = uploadedFile;\n if (scanIsRequired) {\n await this.fileScanningService.initiateScan(uploadedFile.fileId, executionContext);\n // Re-read so the response reports SCANNING rather than the UPLOADED this row no longer has.\n // A client polling `GET /files/:fileId/metadata` sees SCANNING either way; reporting\n // UPLOADED here would make the upload response the one place the two disagree. A null read\n // keeps the pre-transition row rather than failing an upload that already succeeded.\n const afterScanInitiation = await this.filesService.getFile(uploadedFile.fileId, executionContext);\n if (afterScanInitiation) {\n uploadedFileForResponse = afterScanInitiation;\n }\n }\n\n // Step 9b: Return success response with file metadata\n const fileMetadata = this.filesService.toMetadataResponse(uploadedFileForResponse);\n /*\n * SCANNING counts as reached-success alongside UPLOADED: the upload itself committed, and the\n * catch below must not roll a scanned file back to FAILED for a later response-layer failure.\n */\n uploadReachedSuccessState = uploadedFileForResponse.status === FileStatus.UPLOADED\n || uploadedFileForResponse.status === FileStatus.SCANNING;\n\n response.status(200).json({\n success: true,\n file: fileMetadata,\n });\n\n this.logDebug('File upload completed successfully', {\n fileId: uploadedFile.fileId,\n resourceType,\n fieldName,\n });\n\n // Step 10: a redeemed grant records what it produced and is audited. Best-effort by contract —\n // the upload has succeeded and the response is sent; a failure here is logged, never thrown.\n if (grant) {\n this.fileUploadGrantService\n .recordRedemption(grant, { fileId: uploadedFile.fileId, mimeType: uploadedFile.mimeType, size: uploadedFile.size }, executionContext)\n .catch((redemptionError) => {\n this.logger.error('File upload grant: redemption record failed', {\n grantId: grant.token._id,\n fileId: uploadedFile!.fileId,\n ...projectCaughtErrorLogFields(redemptionError),\n });\n });\n }\n\n } catch (error) {\n // Only pre-success failures should transition a file to FAILED. Once the\n // upload already reached UPLOADED, later response-layer failures must not\n // corrupt the persisted state back to FAILED. Likewise, if the blob still\n // exists in storage because rollback failed, keep the row out of FAILED so\n // operators can distinguish that inconsistency from a clean failed upload.\n const shouldMarkAsFailed = !!fileRecord?.fileId && !uploadReachedSuccessState && !blobStoredInStorage;\n if (shouldMarkAsFailed) {\n try {\n await this.filesService.updateFileStatus(\n fileRecord.fileId,\n FileStatus.FAILED,\n executionContext\n );\n this.logDebug('File marked as FAILED due to upload error', {\n fileId: fileRecord.fileId,\n });\n } catch (updateError) {\n // Log but don't throw - we're already in error handling\n this.logger.error('Failed to mark file as FAILED', {\n fileId: fileRecord.fileId,\n ...projectCaughtErrorLogFields(updateError),\n });\n }\n }\n\n // Re-throw error to be handled by Express error handler\n throw error;\n }\n }\n\n /**\n * Serve (stream) a resource-linked file's bytes for INLINE preview/consumption.\n *\n * This is the read counterpart to `handleFileUpload` — the resource-integrated\n * file **serve** route (`GET .../{res}/:resourceId/files/:fieldName/:fileId`). The\n * controller has ALREADY authorized the caller against the parent resource's READ\n * operation before delegating here, so authorization **inherits from the linked\n * resource** — no consumable token, no public share (those belong to the global\n * `FileController` for its separate cross-resource/share purpose).\n *\n * The one job this method owns is the LINK-OWNERSHIP boundary: the requested\n * `fileId` MUST be linked to exactly this `{resourceType, resourceId, fieldName}`.\n * Without it, any caller who can READ a parent record could stream an arbitrary or\n * cross-resource file id through the route. A mismatch fails closed as NOT_FOUND\n * (no existence disclosure). `getFile()`'s own scope check is defense-in-depth.\n *\n * A `?variant=thumbnail` query asks for a downscaled preview rendition; it is\n * parsed fail-safe (unknown values → original bytes) and forwarded to the shared\n * streaming seam, which only transforms eligible raster images.\n *\n * @param request - Express request (`:fileId` etc. in params, `?variant=` in query).\n * @param response - Express response to stream into.\n * @param next - Express next (forwards pre-header stream errors).\n * @param resourceType - Parent resource type from the route.\n * @param fieldName - File field name from the route.\n * @param resourceId - Parent resource id from the route (authorization target).\n * @param fileId - The specific file id to serve (must belong to the field above).\n * @param executionContext - READ execution context built + authorized by the controller.\n */\n async handleFileServe(\n request: Request,\n response: Response,\n next: NextFunction,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string,\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n this.logDebug('Handling file serve', { resourceType, fieldName, resourceId, fileId });\n\n // getFile applies the file-scope access check (defense-in-depth). Primary authz —\n // the parent resource READ — was already enforced by the controller.\n const file = await this.filesService.getFile(fileId, executionContext);\n\n // SECURITY BOUNDARY: the served file MUST be linked to THIS resource + field.\n const belongsToRouteResource =\n !!file &&\n file.linkedResourceType === resourceType &&\n String(file.linkedResourceId) === String(resourceId) &&\n file.linkedFieldName === fieldName;\n\n if (!belongsToRouteResource) {\n this.logDebug('File serve denied: file not linked to route resource/field', {\n fileId,\n resourceType,\n resourceId,\n fieldName,\n linkedResourceType: file?.linkedResourceType,\n linkedResourceId: file?.linkedResourceId,\n linkedFieldName: file?.linkedFieldName,\n });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n\n // STATUS GATE — the same invariant the two GLOBAL file routes already enforce, applied at the\n // third site that streams bytes.\n //\n // It was missing here, and the omission became reachable the moment generated files got serve\n // routes (2026-08-25): a REGENERATE marks the superseded document `DELETED` while DELIBERATELY\n // retaining its `linkedResourceType/Id/FieldName`, so the link-ownership boundary above says yes\n // and the old document kept streaming — measured, 200 with 2,222 bytes. The same hole applies to\n // an UPLOADED file a privacy erasure marked `DELETED`: physical cleanup is a batch that runs much\n // later, and until it did, the erased bytes were still served in place.\n //\n // Two tiers, mirroring the existing gates rather than inventing a third posture:\n // - `FILE_METADATA_WITHHELD_STATUSES` (i.e. `DELETED`, the erasure outcome) → NOT_FOUND, because\n // for an erased file, confirming the id still resolves is itself a disclosure (the same\n // reasoning as `FileController.assertFileMetadataDisclosable`);\n // - anything else outside `FILE_DOWNLOADABLE_STATUSES` (`PENDING`, `SCANNING`, `FAILED`, …) →\n // the download route's VALIDATION shape, because such a file genuinely exists and may become\n // servable, and an uploader polling a preview needs to be told which.\n if (FILE_METADATA_WITHHELD_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: withheld status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n if (!FILE_DOWNLOADABLE_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: non-servable status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'File is not available for download', fileId, status: file.status },\n },\n );\n }\n\n // `?variant=thumbnail` → downscaled preview rendition (raster images only; the\n // streaming seam falls back to original bytes for anything else). Fail-safe parse.\n const variant = parseFileServeVariant(request.query.variant);\n\n await this.filesService.streamFileToResponse(file, response, executionContext, {\n disposition: 'inline',\n next,\n variant,\n });\n }\n\n /**\n * Derive file scope from parent resource's resourcePrimaryScope.\n *\n * Scope derivation rules:\n * - APPLICATION: sets applicationId from execution context\n * - ORGANIZATIONS: sets organizationId from execution context\n * - USER_SELF: sets userId + applicationId from execution context (no org — separate scope axis)\n *\n * @param resourceType - Parent resource type\n * @param executionContext - Execution context for scope values\n * @returns FileScopeIdentifiers derived from parent resource\n */\n private deriveScopeFromParentResource(\n resourceType: ResourceType,\n executionContext: ExecutionContext<any>\n ): FileScopeIdentifiers {\n // Get parent resource configuration to find its primaryScope\n const resourceConfig = this.resourcesRegistry.getResourceConfiguration(resourceType);\n\n // Get primaryScope from resource configuration\n // Default to ORGANIZATIONS if not specified\n const primaryScope = resourceConfig?.resourcePrimaryScope || ResourcePrimaryScope.ORGANIZATIONS;\n\n // Extract scope identifiers from execution context\n const organizationId = this.resourceOperationHelper.getInitiatorId(executionContext, 'organization');\n const userId = this.resourceOperationHelper.getInitiatorId(executionContext, 'user');\n // Fall back to the app config's applicationId when the execution context\n // doesn't carry one — same pattern this handler already uses for the path\n // binding above. There is exactly one application per backend, so\n // `appConfigService.applicationId` is the correct anchor when an internal\n // EC was built without a populated `applicationId`.\n const applicationId = executionContext.applicationId || this.appConfigService.applicationId;\n\n switch (primaryScope) {\n case ResourcePrimaryScope.APPLICATION:\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.APPLICATION,\n applicationId,\n };\n\n case ResourcePrimaryScope.ORGANIZATIONS:\n if (!organizationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.ORGANIZATIONS,\n applicationId,\n organizationId,\n };\n\n case ResourcePrimaryScope.USER_SELF:\n // USER_SELF and ORGANIZATIONS are independent primary-scope axes (separation of\n // concern): a self-owned file is owned by the USER, never by an org. Require the\n // user (owner) + applicationId (tenant/bucket anchor); do NOT read or persist an\n // organizationId here — a self-profile carries no org context.\n if (!userId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.USER_SELF,\n applicationId,\n userId,\n };\n\n default:\n throw this.errorBuilder.buildError(\n ErrorType.CONFIGURATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'File uploads only support APPLICATION, ORGANIZATIONS, and USER_SELF resource scopes',\n resourceType,\n primaryScope,\n },\n }\n );\n }\n }\n}\n"]}
|
|
@@ -33,6 +33,24 @@ export declare class FileOperationHandlerBackendService {
|
|
|
33
33
|
protected logDebug: (message: string, context?: Record<string, unknown>) => void;
|
|
34
34
|
constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, fileFieldDetection: FileFieldDetectionBackendService, filesService: FilesBackendService);
|
|
35
35
|
private isGeneratedPdfFileField;
|
|
36
|
+
/**
|
|
37
|
+
* The ONE place that decides whether a file's status admits linking (issue #320).
|
|
38
|
+
*
|
|
39
|
+
* Both link-time validators (CREATE and UPDATE) used to compare against the literal
|
|
40
|
+
* `FileStatus.UPLOADED`, so a file the scanner had certified `CLEAN` — a status
|
|
41
|
+
* `FILE_STATUS_TRANSITIONS` explicitly allows to become `LINKED` — was refused with an error
|
|
42
|
+
* naming `UPLOADED` as the expected state. Whether a scanned file could be attached depended on
|
|
43
|
+
* beating the scanner. The admitted set now comes from `FILE_LINKABLE_STATUSES`, the single copy
|
|
44
|
+
* shared with `FilesBackendService.linkFileToResource`.
|
|
45
|
+
*
|
|
46
|
+
* `SCANNING` is named separately: the file is not wrong, it is not yet KNOWN to be safe, so the
|
|
47
|
+
* caller must learn to retry rather than re-upload. Every other non-linkable status (PENDING,
|
|
48
|
+
* FAILED, DELETED, ORPHANED, INFECTED, QUARANTINED, and LINKED-to-something-else, which
|
|
49
|
+
* `linkFileToResource` distinguishes further) is a terminal refusal for this write.
|
|
50
|
+
*
|
|
51
|
+
* @param diagnostics - log-only context; never rendered to the caller.
|
|
52
|
+
*/
|
|
53
|
+
private assertFileLinkable;
|
|
36
54
|
/**
|
|
37
55
|
* Best-effort cleanup for the previous generated PDF after REGENERATE.
|
|
38
56
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-operation-handler.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/files/services/file-operation-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"file-operation-handler.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/files/services/file-operation-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,EAA8E,MAAM,uBAAuB,CAAC;AAGjI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAE9G,OAAO,EAAE,gCAAgC,EAAqB,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qEAAqE,CAAC;AAUxG,UAAU,+BAA+B;IACvC;;;;OAIG;IACH,mCAAmC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;CACzE;AAED,qBACa,kCAAkC;IAK3C,OAAO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C,gBAAgB;CAuGzB"}
|
|
@@ -23,7 +23,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
23
23
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
24
24
|
};
|
|
25
25
|
import { injectable, inject } from 'inversify';
|
|
26
|
-
import { ErrorType, ErrorCustomMessageReference, FileStatus } from '@wildo-ai/saas-models';
|
|
26
|
+
import { ErrorType, ErrorCustomMessageReference, FileStatus, FILE_LINKABLE_STATUSES } from '@wildo-ai/saas-models';
|
|
27
27
|
import { FileGenerationSource } from '@wildo-ai/zod-decorators';
|
|
28
28
|
import { SAAS_SERVICE_TYPES } from '../../inject/models/service-types.js';
|
|
29
29
|
import { ErrorBuilderBackendService } from '../../errors/services/error-builder.backend.service.js';
|
|
@@ -49,6 +49,39 @@ let FileOperationHandlerBackendService = class FileOperationHandlerBackendServic
|
|
|
49
49
|
isGeneratedPdfFileField(fileField) {
|
|
50
50
|
return fileField.fileMetadata.generation?.source === FileGenerationSource.PDF_TEMPLATE;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* The ONE place that decides whether a file's status admits linking (issue #320).
|
|
54
|
+
*
|
|
55
|
+
* Both link-time validators (CREATE and UPDATE) used to compare against the literal
|
|
56
|
+
* `FileStatus.UPLOADED`, so a file the scanner had certified `CLEAN` — a status
|
|
57
|
+
* `FILE_STATUS_TRANSITIONS` explicitly allows to become `LINKED` — was refused with an error
|
|
58
|
+
* naming `UPLOADED` as the expected state. Whether a scanned file could be attached depended on
|
|
59
|
+
* beating the scanner. The admitted set now comes from `FILE_LINKABLE_STATUSES`, the single copy
|
|
60
|
+
* shared with `FilesBackendService.linkFileToResource`.
|
|
61
|
+
*
|
|
62
|
+
* `SCANNING` is named separately: the file is not wrong, it is not yet KNOWN to be safe, so the
|
|
63
|
+
* caller must learn to retry rather than re-upload. Every other non-linkable status (PENDING,
|
|
64
|
+
* FAILED, DELETED, ORPHANED, INFECTED, QUARANTINED, and LINKED-to-something-else, which
|
|
65
|
+
* `linkFileToResource` distinguishes further) is a terminal refusal for this write.
|
|
66
|
+
*
|
|
67
|
+
* @param diagnostics - log-only context; never rendered to the caller.
|
|
68
|
+
*/
|
|
69
|
+
assertFileLinkable(file, executionContext, diagnostics) {
|
|
70
|
+
if (FILE_LINKABLE_STATUSES.has(file.status)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {
|
|
74
|
+
customMessageReference: file.status === FileStatus.SCANNING
|
|
75
|
+
? ErrorCustomMessageReference.FILE_SCAN_IN_PROGRESS
|
|
76
|
+
: ErrorCustomMessageReference.FILE_NOT_LINKABLE,
|
|
77
|
+
context: {
|
|
78
|
+
// diagnostic (log-only)
|
|
79
|
+
...diagnostics,
|
|
80
|
+
fileStatus: file.status,
|
|
81
|
+
linkableStatuses: [...FILE_LINKABLE_STATUSES],
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
52
85
|
/**
|
|
53
86
|
* Best-effort cleanup for the previous generated PDF after REGENERATE.
|
|
54
87
|
*
|
|
@@ -164,19 +197,7 @@ let FileOperationHandlerBackendService = class FileOperationHandlerBackendServic
|
|
|
164
197
|
},
|
|
165
198
|
});
|
|
166
199
|
}
|
|
167
|
-
|
|
168
|
-
if (file.status !== FileStatus.UPLOADED) {
|
|
169
|
-
throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {
|
|
170
|
-
customMessageReference: ErrorCustomMessageReference.FILE_NOT_IN_UPLOADED_STATUS,
|
|
171
|
-
context: {
|
|
172
|
-
// diagnostic (log-only)
|
|
173
|
-
fileId,
|
|
174
|
-
fileStatus: file.status,
|
|
175
|
-
resourceType,
|
|
176
|
-
expectedStatus: FileStatus.UPLOADED,
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
}
|
|
200
|
+
this.assertFileLinkable(file, executionContext, { fileId, resourceType });
|
|
180
201
|
// Note: uploadContext validation can be added in Phase 2 if needed
|
|
181
202
|
// For now, we only validate that file is UPLOADED
|
|
182
203
|
}
|
|
@@ -394,20 +415,7 @@ let FileOperationHandlerBackendService = class FileOperationHandlerBackendServic
|
|
|
394
415
|
},
|
|
395
416
|
});
|
|
396
417
|
}
|
|
397
|
-
|
|
398
|
-
throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {
|
|
399
|
-
customMessageReference: ErrorCustomMessageReference.FILE_NOT_IN_UPLOADED_STATUS,
|
|
400
|
-
context: {
|
|
401
|
-
// diagnostic (log-only)
|
|
402
|
-
fileId,
|
|
403
|
-
fileStatus: file.status,
|
|
404
|
-
runtimeFieldPath,
|
|
405
|
-
resourceType,
|
|
406
|
-
resourceId,
|
|
407
|
-
expectedStatus: FileStatus.UPLOADED,
|
|
408
|
-
},
|
|
409
|
-
});
|
|
410
|
-
}
|
|
418
|
+
this.assertFileLinkable(file, executionContext, { fileId, runtimeFieldPath, resourceType, resourceId });
|
|
411
419
|
}
|
|
412
420
|
}
|
|
413
421
|
for (const oldFileId of oldFileIds) {
|