@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
|
@@ -50,8 +50,30 @@
|
|
|
50
50
|
* owns that decision and documents the full precedence, including the branch that protects an
|
|
51
51
|
* existing RAG corpus from a provider outage. Plain text never touches a provider.
|
|
52
52
|
*
|
|
53
|
+
* ## Office / OpenDocument — six served LOCALLY, three provider-only (#434, closed 2026-09-09)
|
|
54
|
+
*
|
|
55
|
+
* The framework's `Documents` media group admits Word, Excel, PowerPoint and the OpenDocument
|
|
56
|
+
* trio, and until 2026-09-08 the extractor supported NONE of them: a corpus field using the group
|
|
57
|
+
* accepted uploads that could never contribute a chunk under any configuration, skipped at debug.
|
|
58
|
+
*
|
|
59
|
+
* The nine types are THREE technical problems, and reading them as one is what produced this
|
|
60
|
+
* header's earlier claim that a local library would cost "three to six" dependencies:
|
|
61
|
+
*
|
|
62
|
+
* - **OOXML** (`.docx` `.xlsx` `.pptx`) and **OpenDocument** (`.odt` `.ods` `.odp`) are ZIP+XML —
|
|
63
|
+
* the SAME technique, so ONE module reads all six, on two dependencies rather than six
|
|
64
|
+
* (`fflate` to unzip, `fast-xml-parser` to read). See
|
|
65
|
+
* `office-document-text-extraction.backend.utils.ts`.
|
|
66
|
+
* - **Legacy binary Office** (`.doc` `.xls` `.ppt`) are OLE2 compound files from a different era.
|
|
67
|
+
* A reader for them is a project, not a dependency, so they stay PROVIDER-ONLY.
|
|
68
|
+
*
|
|
69
|
+
* So the six take exactly the ladder PDF already takes, with the office extractor in the rung
|
|
70
|
+
* `pdfjs-dist` occupies: a configured provider is preferred when the field opted into it, the
|
|
71
|
+
* local library serves everything else, and a deployment with NO provider can finally read the
|
|
72
|
+
* documents its media group accepts. The three remaining types keep the conditional support and
|
|
73
|
+
* the precise refusal, because for them the provider genuinely is the only path.
|
|
74
|
+
*
|
|
53
75
|
* Future:
|
|
54
|
-
* - Office
|
|
76
|
+
* - Legacy binary Office (`.doc` / `.xls` / `.ppt`) locally, if an OLE2 reader ever earns its place
|
|
55
77
|
* - Audio/video transcript extraction
|
|
56
78
|
*
|
|
57
79
|
* The service operates against the storage provider contract — it downloads
|
|
@@ -74,6 +96,7 @@ import { injectable, inject, optional } from 'inversify';
|
|
|
74
96
|
import { createRequire } from 'node:module';
|
|
75
97
|
import { dirname, join } from 'node:path';
|
|
76
98
|
import { ErrorType, ErrorCustomMessageReference } from '@wildo-ai/saas-models';
|
|
99
|
+
import { extractOfficeDocumentText, LEGACY_BINARY_OFFICE_MIMES, LOCALLY_EXTRACTABLE_DOCUMENT_MIMES, } from '../../files/utils/office-document-text-extraction.backend.utils.js';
|
|
77
100
|
import { SAAS_SERVICE_TYPES } from '../../inject/models/service-types.js';
|
|
78
101
|
import { ErrorBuilderBackendService } from '../../errors/services/error-builder.backend.service.js';
|
|
79
102
|
import { FileStorageRouterBackendService } from '../../files/storage/file-storage-router.backend.service.js';
|
|
@@ -94,6 +117,23 @@ const TEXT_MIME_EXACT = new Set([
|
|
|
94
117
|
'application/toml',
|
|
95
118
|
]);
|
|
96
119
|
const PDF_MIME = 'application/pdf';
|
|
120
|
+
/**
|
|
121
|
+
* The three types that STILL need a provider — pre-2007 binary Office (`.doc` / `.xls` / `.ppt`).
|
|
122
|
+
*
|
|
123
|
+
* These are OLE2 compound files, not ZIP archives, so the local ZIP+XML extractor that serves the
|
|
124
|
+
* other six cannot read them and a reader for them is a project rather than a dependency. Support
|
|
125
|
+
* is therefore CONDITIONAL, and {@link isExtractionSupported} says so by ASKING the provider rather
|
|
126
|
+
* than asserting a capability the deployment may not have.
|
|
127
|
+
*
|
|
128
|
+
* Why conditional rather than unconditional-and-fail-later: RAG ingestion treats an unsupported
|
|
129
|
+
* MIME as "no corpus from this file", logged at DEBUG and never an error. Declaring these supported
|
|
130
|
+
* everywhere would turn a configuration ABSENCE into an ERROR log on every sweep run, for every
|
|
131
|
+
* application without an extraction provider — noise that says nothing an operator can act on.
|
|
132
|
+
*
|
|
133
|
+
* The six ZIP+XML types are no longer here, and that is the whole of #434's second half: they are
|
|
134
|
+
* served by {@link LOCALLY_EXTRACTABLE_DOCUMENT_MIMES} with no provider required.
|
|
135
|
+
*/
|
|
136
|
+
const PROVIDER_ONLY_DOCUMENT_MIMES = LEGACY_BINARY_OFFICE_MIMES;
|
|
97
137
|
const moduleRequire = createRequire(import.meta.url);
|
|
98
138
|
/**
|
|
99
139
|
* Absolute path to `pdfjs-dist`'s bundled standard-font data, resolved from the INSTALLED package
|
|
@@ -167,7 +207,9 @@ let FileTextExtractionBackendService = class FileTextExtractionBackendService {
|
|
|
167
207
|
const downloadResult = await provider.download({ fileId: file.fileId, storageProvider: file.storageProvider, storageRef: file.storageRef }, executionContext);
|
|
168
208
|
try {
|
|
169
209
|
try {
|
|
170
|
-
if (mimeType === PDF_MIME
|
|
210
|
+
if (mimeType === PDF_MIME
|
|
211
|
+
|| LOCALLY_EXTRACTABLE_DOCUMENT_MIMES.has(mimeType)
|
|
212
|
+
|| PROVIDER_ONLY_DOCUMENT_MIMES.has(mimeType)) {
|
|
171
213
|
return await this.extractFromDocument(downloadResult.stream, file.fileId, mimeType, options);
|
|
172
214
|
}
|
|
173
215
|
return await this.extractFromText(downloadResult.stream, file.fileId);
|
|
@@ -225,7 +267,46 @@ let FileTextExtractionBackendService = class FileTextExtractionBackendService {
|
|
|
225
267
|
return true;
|
|
226
268
|
if (TEXT_MIME_EXACT.has(lower))
|
|
227
269
|
return true;
|
|
228
|
-
|
|
270
|
+
if (TEXT_MIME_PREFIXES.some((prefix) => lower.startsWith(prefix)))
|
|
271
|
+
return true;
|
|
272
|
+
/*
|
|
273
|
+
* OOXML + OpenDocument: UNCONDITIONALLY supported (#434). A local ZIP+XML extractor serves all
|
|
274
|
+
* six, so the answer no longer depends on a deployment's provider selection — which is the
|
|
275
|
+
* point of the local library. A provider, where one is configured and the field opted in, is
|
|
276
|
+
* still preferred inside `extractFromDocument`; it is no longer the only path.
|
|
277
|
+
*/
|
|
278
|
+
if (LOCALLY_EXTRACTABLE_DOCUMENT_MIMES.has(lower))
|
|
279
|
+
return true;
|
|
280
|
+
/*
|
|
281
|
+
* Legacy binary Office: supported IF AND ONLY IF a configured provider declares the type. Byte
|
|
282
|
+
* length is unknown at this question — it is asked before the file is fetched — so this answers
|
|
283
|
+
* the MIME half only; `resolveUsableProviderBinding` re-asks with the real length and falls
|
|
284
|
+
* through if the document is too large, which is the same shape as a PDF exceeding
|
|
285
|
+
* `maxDocumentBytes`.
|
|
286
|
+
*/
|
|
287
|
+
return PROVIDER_ONLY_DOCUMENT_MIMES.has(lower) && this.providerDeclaresMimeType(lower);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Whether the configured document-extraction provider declares this MIME type.
|
|
291
|
+
*
|
|
292
|
+
* Deliberately narrower than {@link resolveUsableProviderBinding}: no byte length, no logging, and
|
|
293
|
+
* every failure answers `false`. It is a capability QUESTION asked on a hot path (once per file
|
|
294
|
+
* per sweep), not the resolution that precedes an actual extraction.
|
|
295
|
+
*/
|
|
296
|
+
providerDeclaresMimeType(mimeType) {
|
|
297
|
+
if (!this.documentExtraction)
|
|
298
|
+
return false;
|
|
299
|
+
try {
|
|
300
|
+
const resolution = this.documentExtraction.resolveBinding(DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT);
|
|
301
|
+
if (resolution.configured === false)
|
|
302
|
+
return false;
|
|
303
|
+
return resolution.binding.supportedMimeTypes.includes(mimeType);
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
// A misconfigured provider is not a supported type. The loud version of this is logged where
|
|
307
|
+
// extraction is actually attempted; answering `false` here keeps the corpus skip quiet.
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
229
310
|
}
|
|
230
311
|
async extractFromText(stream, fileId) {
|
|
231
312
|
// Plain text keeps its ZERO-dependency path deliberately: routing text/* through a PDF parser
|
|
@@ -301,15 +382,41 @@ let FileTextExtractionBackendService = class FileTextExtractionBackendService {
|
|
|
301
382
|
const binding = options?.allowProviderExtraction === true
|
|
302
383
|
? this.resolveUsableProviderBinding(fileId, mimeType, buffer.length)
|
|
303
384
|
: undefined;
|
|
385
|
+
/*
|
|
386
|
+
* LEGACY BINARY Office only (#434). These are OLE2 compound files, so neither local library
|
|
387
|
+
* below can serve them — handing a `.doc` to pdf.js or to the ZIP+XML extractor produces an
|
|
388
|
+
* unreadable-bytes classification that blames the document for a capability the deployment does
|
|
389
|
+
* not have.
|
|
390
|
+
*
|
|
391
|
+
* The six ZIP+XML types deliberately do NOT reach this branch any more: they have a local
|
|
392
|
+
* library, so a missing binding degrades them to it rather than refusing.
|
|
393
|
+
*
|
|
394
|
+
* `isExtractionSupported` already asked the provider whether it declares this MIME, so reaching
|
|
395
|
+
* here without a binding means the answer changed between the two questions (the byte length
|
|
396
|
+
* exceeded `maxDocumentBytes`, or the provider became unresolvable). Refusing names that
|
|
397
|
+
* precisely instead of mislabelling the file.
|
|
398
|
+
*/
|
|
399
|
+
if (!binding && PROVIDER_ONLY_DOCUMENT_MIMES.has(mimeType.toLowerCase())) {
|
|
400
|
+
throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {
|
|
401
|
+
customMessageReference: ErrorCustomMessageReference.FILE_TEXT_EXTRACTION_UNSUPPORTED_TYPE,
|
|
402
|
+
context: {
|
|
403
|
+
// diagnostic (log-only)
|
|
404
|
+
fileId,
|
|
405
|
+
mimeType,
|
|
406
|
+
byteLength: buffer.length,
|
|
407
|
+
message: 'This document type is extractable only through a configured document-extraction provider, and none can serve it',
|
|
408
|
+
},
|
|
409
|
+
});
|
|
410
|
+
}
|
|
304
411
|
if (!binding && options?.allowProviderExtraction !== true) {
|
|
305
412
|
// Rung 0 — the field did not opt in. Not a fallback and not a degradation: this is the
|
|
306
413
|
// declared behaviour of a field whose author left `ocr` off (or wrote `ocr: false`), and it
|
|
307
414
|
// is where the overwhelming majority of documents belong, because a born-digital PDF gains
|
|
308
415
|
// nothing from OCR and would cost per page.
|
|
309
|
-
return await this.
|
|
416
|
+
return await this.extractLocally(buffer, fileId, mimeType, 'local-library (field did not opt into provider extraction)');
|
|
310
417
|
}
|
|
311
418
|
if (!binding) {
|
|
312
|
-
return await this.
|
|
419
|
+
return await this.extractLocally(buffer, fileId, mimeType, 'local-library (no usable provider)');
|
|
313
420
|
}
|
|
314
421
|
try {
|
|
315
422
|
const extracted = await this.documentExtraction.extractDocumentText({
|
|
@@ -348,7 +455,7 @@ let FileTextExtractionBackendService = class FileTextExtractionBackendService {
|
|
|
348
455
|
providerRef: binding.providerRef,
|
|
349
456
|
pageCount: extracted.pageCount,
|
|
350
457
|
});
|
|
351
|
-
return await this.
|
|
458
|
+
return await this.extractLocally(buffer, fileId, mimeType, 'local-library (provider returned no text)');
|
|
352
459
|
}
|
|
353
460
|
catch (providerError) {
|
|
354
461
|
if (providerError instanceof DocumentExtractionError
|
|
@@ -356,7 +463,7 @@ let FileTextExtractionBackendService = class FileTextExtractionBackendService {
|
|
|
356
463
|
// Rung 6 — the corpus-protecting branch.
|
|
357
464
|
let localResult;
|
|
358
465
|
try {
|
|
359
|
-
localResult = await this.
|
|
466
|
+
localResult = await this.extractLocally(buffer, fileId, mimeType, 'local-library (provider unavailable)');
|
|
360
467
|
}
|
|
361
468
|
catch {
|
|
362
469
|
// The local library ALSO failed. Deliberately swallowed: the provider fault is the more
|
|
@@ -389,7 +496,7 @@ let FileTextExtractionBackendService = class FileTextExtractionBackendService {
|
|
|
389
496
|
providerRef: binding.providerRef,
|
|
390
497
|
reason: providerError instanceof Error ? providerError.message : String(providerError),
|
|
391
498
|
});
|
|
392
|
-
return await this.
|
|
499
|
+
return await this.extractLocally(buffer, fileId, mimeType, 'local-library (provider could not read the document)');
|
|
393
500
|
}
|
|
394
501
|
}
|
|
395
502
|
/**
|
|
@@ -464,6 +571,58 @@ let FileTextExtractionBackendService = class FileTextExtractionBackendService {
|
|
|
464
571
|
* which rung of that seam routed here and is logged, so an operator reading the logs can tell
|
|
465
572
|
* "no provider is configured" from "the provider was down" without inspecting configuration.
|
|
466
573
|
*/
|
|
574
|
+
/**
|
|
575
|
+
* The LOCAL-LIBRARY rung of {@link extractFromDocument}'s ladder, dispatched by MIME.
|
|
576
|
+
*
|
|
577
|
+
* Two libraries sit at this rung and they are not interchangeable: `pdfjs-dist` reads a PDF's
|
|
578
|
+
* text layer, and the ZIP+XML extractor reads OOXML / OpenDocument parts. Handing a document to
|
|
579
|
+
* the wrong one produces an unreadable-bytes classification that blames the FILE for a routing
|
|
580
|
+
* mistake — which is exactly the failure the provider-only era's refusal existed to avoid, so it
|
|
581
|
+
* must not reappear now that there are two locals instead of one.
|
|
582
|
+
*
|
|
583
|
+
* One dispatcher rather than a branch at each of the five call sites, because the five rungs are
|
|
584
|
+
* the same decision reached for five different reasons; branching at each would be five places to
|
|
585
|
+
* forget the office arm the day a sixth rung appears.
|
|
586
|
+
*/
|
|
587
|
+
async extractLocally(buffer, fileId, mimeType, reason) {
|
|
588
|
+
if (LOCALLY_EXTRACTABLE_DOCUMENT_MIMES.has(mimeType.toLowerCase())) {
|
|
589
|
+
return await this.extractFromOfficeDocument(buffer, fileId, mimeType.toLowerCase(), reason);
|
|
590
|
+
}
|
|
591
|
+
return await this.extractFromPDF(buffer, fileId, reason);
|
|
592
|
+
}
|
|
593
|
+
/**
|
|
594
|
+
* OOXML / OpenDocument text, read locally (#434).
|
|
595
|
+
*
|
|
596
|
+
* `partCount` is reported as `pageCount` deliberately: for a `.pptx` it IS the slide count, and
|
|
597
|
+
* for the others it is the closest honest analogue of "how many units of this document were
|
|
598
|
+
* read". Inventing a page count by dividing characters would be a number an operator could
|
|
599
|
+
* reasonably act on and that means nothing.
|
|
600
|
+
*
|
|
601
|
+
* An {@link OfficeDocumentExtractionError} is rethrown UNTOUCHED so the caller's classifier sees
|
|
602
|
+
* it: every one of its failures is a statement about the document's own bytes — not a readable
|
|
603
|
+
* ZIP, larger than the decompression bound, or holding none of the parts its type keeps text in
|
|
604
|
+
* — which is precisely the unreadable-document bucket, and not the provider-unavailable one that
|
|
605
|
+
* must protect an existing corpus.
|
|
606
|
+
*/
|
|
607
|
+
async extractFromOfficeDocument(buffer, fileId, mimeType, reason) {
|
|
608
|
+
const extracted = await extractOfficeDocumentText(buffer, mimeType);
|
|
609
|
+
this.logDebug('Extracted text from an Office/OpenDocument file with the local library', {
|
|
610
|
+
fileId,
|
|
611
|
+
mimeType,
|
|
612
|
+
reason,
|
|
613
|
+
partCount: extracted.partCount,
|
|
614
|
+
characterCount: extracted.text.length,
|
|
615
|
+
});
|
|
616
|
+
return {
|
|
617
|
+
text: extracted.text,
|
|
618
|
+
metadata: {
|
|
619
|
+
pageCount: extracted.partCount,
|
|
620
|
+
characterCount: extracted.text.length,
|
|
621
|
+
wordCount: extracted.text.split(/\s+/).filter(Boolean).length,
|
|
622
|
+
extractionPath: 'local-library',
|
|
623
|
+
},
|
|
624
|
+
};
|
|
625
|
+
}
|
|
467
626
|
async extractFromPDF(buffer, fileId, reason) {
|
|
468
627
|
const pdfjs = await import('pdfjs-dist/legacy/build/pdf.mjs');
|
|
469
628
|
const loadingTask = pdfjs.getDocument({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-text-extraction.backend.service.js","sourceRoot":"","sources":["../../../../../src/files/services/file-text-extraction.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAa,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAE9G,OAAO,EAAE,+BAA+B,EAAE,MAAM,sEAAsE,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EACL,gCAAgC,EAChC,uBAAuB,EACvB,8BAA8B,GAE/B,MAAM,oFAAoF,CAAC;AAC5F,OAAO,EAAE,gCAAgC,EAAE,MAAM,sCAAsC,CAAC;AAuCxF,MAAM,kBAAkB,GAAG,CAAC,OAAO,CAAC,CAAC;AACrC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,kBAAkB;IAClB,iBA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7D,gCAAgC,CA6e5C","sourcesContent":["/**\n * File Text Extraction Backend Service\n *\n * Extracts text content from files. Retained through the Weaviate-lane demolition (2026-08-26):\n * this is the file-side TEXT PROVIDER the resource-native RAG capability reuses in Phase 1 of\n * `.claude/plans/resource-rag-capability.md` (extraction knobs like extractText/ocr stay file-side).\n *\n * Supported formats (first slice):\n * - Plain text (text/plain, text/markdown, text/csv, application/json, etc.)\n * - PDF (via `pdfjs-dist` — dynamically imported, but an INSTALLED dependency)\n *\n * ## Why `pdfjs-dist` and not `pdf-parse` (decided 2026-08-27)\n *\n * The header used to advertise PDF support through `pdf-parse`, which was in NO manifest and NO\n * lockfile anywhere in the repository. So every PDF that reached a `.ragSource()` field threw\n * `'pdf-parse is required for PDF text extraction'` — and because the RAG sweep treats a throw as a\n * failed ingestion and re-visits hourly, that was a permanent retry loop, not a one-off failure.\n * The advertised capability had never worked. Both halves of that are now fixed: the library is a\n * real dependency, and the sweep no longer strands on an unextractable file.\n *\n * `pdf-parse` was reconsidered rather than assumed obsolete — its modern release (2.4.5, Oct 2025)\n * is maintained, contrary to the reputation of the long-abandoned 1.1.x line. It was still rejected,\n * on dependency shape rather than hygiene: it requires `@napi-rs/canvas` (a NATIVE addon, per-platform\n * binaries, and this repository's own toolchain baseline records what a stale C++ toolchain costs)\n * and it vendors `pdfjs-dist@5.4.296` — a SECOND copy at a different major from the `^6.2.108` this\n * repository already pins centrally. `pdfjs-dist` used directly has zero required dependencies\n * (`@napi-rs/canvas` is OPTIONAL there and is needed only for RENDERING, which text extraction never\n * does), is Mozilla-maintained, and matches the `^6.2.108` the root `pnpm.overrides` already pins\n * for the PDF viewer preset. One library, one major, no native build.\n *\n * (The `pdf-parse` dependency facts above were read from the npm registry on 2026-08-27 — `npm view\n * pdf-parse dependencies` reports `pdfjs-dist@5.4.296` and `@napi-rs/canvas@0.1.80`. They are not\n * checkable from inside this repository, so the provenance is recorded rather than assumed.)\n *\n * ## The version constraint is a RANGE, not the usual `*`\n *\n * Most dependencies here are declared `*` because the root `pnpm.overrides` is the single version\n * authority. That works inside the monorepo and NOT for a generated application, which inherits no\n * root override — and `pdfjs-dist` is not in `propagated-engine-overrides.json`. Under `*` an\n * application would happily satisfy this import with the `4.10.38` its PDF viewer already pulls in\n * transitively, against which this file's API assumptions are false (`loadingTask.destroy`, the\n * absent `exports` map that makes both the deep `legacy/build` specifier and the `package.json`\n * resolution legal). `^6.2.108` states what the CODE requires. Precedent: `@react-pdf/renderer`\n * carries a real range in this same manifest for the same reason.\n *\n * ## Provider-backed extraction (OCR) — the selection seam\n *\n * A PDF is served by the application's `EngineCapability.AI_DOCUMENT_EXTRACTION` provider when one\n * is configured and can handle the bytes, and by the local library otherwise. `extractFromDocument`\n * owns that decision and documents the full precedence, including the branch that protects an\n * existing RAG corpus from a provider outage. Plain text never touches a provider.\n *\n * Future:\n * - Office documents (docx via mammoth, xlsx/pptx via dedicated libs)\n * - Audio/video transcript extraction\n *\n * The service operates against the storage provider contract — it downloads\n * the file via `FileStorageRouterBackendService`, never touching raw S3/local\n * paths directly.\n */\n\nimport { injectable, inject, optional } from 'inversify';\nimport { Readable } from 'stream';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport { ErrorType, ErrorCustomMessageReference, type File } from '@wildo-ai/saas-models';\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 { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport {\n DocumentExtractionBackendService,\n DocumentExtractionError,\n DocumentExtractionFailureClass,\n type DocumentExtractionResolvedBinding,\n} from '~wildo-backend-lib/external-providers/services/document-extraction.backend.service';\nimport { DocumentExtraction_Applicability } from '@wildo-ai/external-connectors-models';\n\n/**\n * Per-call extraction options — today, the caller's answer to \"may this document be sent to an\n * external extraction provider?\".\n *\n * The answer belongs to the CALLER because it is a per-FIELD declaration\n * (`z_file({ textExtraction: { ocr } })`) and this service is handed a `File`, which knows nothing\n * about the field it hangs off. `RagIngestionBackendService` is the layer that holds both, so it\n * is the layer that translates one into the other.\n */\nexport interface FileTextExtractionOptions {\n /**\n * Whether provider-backed extraction (OCR) is permitted for this document.\n *\n * **DEFAULT FALSE, deliberately, and it is a spending decision rather than a caution.** OCR is\n * billed per page by an external provider, and `FileTextExtractionOptions.ocr` on the schema is\n * documented to application developers as off-by-default for exactly that reason. Defaulting\n * this to true would mean that merely CONFIGURING a provider silently began charging per page\n * for every document in every corpus — including fields whose author wrote `ocr: false` and\n * explained why. Wonder Todos' `knowledge-documents` field is precisely that case.\n *\n * When false, extraction uses the local text-layer read and nothing leaves the deployment.\n */\n allowProviderExtraction?: boolean;\n}\n\nexport interface FileTextExtractionResult {\n text: string;\n language?: string;\n confidence?: number;\n metadata?: {\n pageCount?: number;\n wordCount?: number;\n characterCount?: number;\n [key: string]: unknown;\n };\n}\n\nconst TEXT_MIME_PREFIXES = ['text/'];\nconst TEXT_MIME_EXACT = new Set([\n 'application/json',\n 'application/xml',\n 'application/xhtml+xml',\n 'application/javascript',\n 'application/typescript',\n 'application/x-yaml',\n 'application/yaml',\n 'application/x-sh',\n 'application/graphql',\n 'application/toml',\n]);\nconst PDF_MIME = 'application/pdf';\n\nconst moduleRequire = createRequire(import.meta.url);\n\n/**\n * Absolute path to `pdfjs-dist`'s bundled standard-font data, resolved from the INSTALLED package\n * rather than assumed relative to this file — `saas-backend-lib` runs from `dist/` in every\n * deployed process, so a path relative to the source tree would be wrong everywhere that matters.\n *\n * Without this, pdf.js emits `Warning: UnknownErrorException: Ensure that the 'standardFontDataUrl'\n * API parameter is provided` for any document using the 14 PDF standard fonts (Helvetica, Times,\n * Courier …) — the family ordinary word processors and report generators emit.\n *\n * MEASURED 2026-08-27, because the obvious claim about this is wrong: removing this parameter does\n * NOT break extraction of the committed Helvetica fixture. Text extraction reads the string\n * operands of the content stream and maps them through the font's ENCODING, which pdf.js can build\n * for a standard font without loading its font PROGRAM. So this is supplied to silence a real\n * warning and to keep glyph mapping correct for documents whose encoding genuinely requires the\n * font program — NOT because the common case depends on it. No fixture currently pins a document\n * that would fail without it; do not claim one does.\n *\n * Resolved lazily and memoized: `require.resolve` touches the filesystem, and extraction runs per\n * file inside a sweep that can process many files in one pass.\n */\nlet cachedStandardFontDataPath: string | undefined;\nfunction resolveStandardFontDataPath(): string {\n if (cachedStandardFontDataPath === undefined) {\n // The trailing separator is REQUIRED — pdf.js concatenates the font filename onto this value.\n cachedStandardFontDataPath = join(dirname(moduleRequire.resolve('pdfjs-dist/package.json')), 'standard_fonts') + '/';\n }\n return cachedStandardFontDataPath;\n}\n\n@injectable()\nexport class FileTextExtractionBackendService {\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.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n // Appended LAST deliberately — DI constructor positions are order-sensitive.\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n // OPTIONAL, and that is not defensiveness. This service is constructed directly in several\n // tests and integration harnesses with a fixed positional argument list; a required dependency\n // appended here would break every one of them, and — worse — a harness that passed `undefined`\n // to satisfy the arity would look wired while being dead. Optional makes \"no provider\" the\n // explicit, tested path it genuinely is: an application with no `AI_DOCUMENT_EXTRACTION`\n // selection behaves identically to one whose container never bound this service.\n @inject(SAAS_SERVICE_TYPES.DocumentExtractionService)\n @optional()\n private readonly documentExtraction?: DocumentExtractionBackendService,\n ) {\n this.logDebug = this.logger.debugByType('FileTextExtractionBackendService');\n this.logger.setDebugTypeLogging('FileTextExtractionBackendService', false);\n }\n\n /**\n * Extract text from a file by downloading it through the storage provider.\n */\n async extractText(\n file: File,\n executionContext: ExecutionContext<any>,\n options?: FileTextExtractionOptions,\n ): Promise<FileTextExtractionResult> {\n const mimeType = file.mimeType?.toLowerCase() ?? '';\n\n if (!this.isExtractionSupported(mimeType)) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_TEXT_EXTRACTION_UNSUPPORTED_TYPE,\n context: {\n // diagnostic (log-only)\n fileId: file.fileId,\n mimeType,\n },\n },\n );\n }\n\n // Resolve through FilesBackendService so a LEGACY row that persisted no\n // `storageProvider` falls back to the default provider instead of failing\n // extraction. Reimplementing the lookup here is what made this one of five\n // behaviours for one input.\n //\n // Unlike the scan pipeline, the throw is propagated: this runs on a synchronous\n // request path with no terminal status to strand, so failing loudly is correct.\n // The error type moves CONFIGURATION -> INTERNAL, matching the reference — an\n // unregistered persisted id is an engine wiring fault, not an app misconfiguration.\n const provider = this.filesService.getStorageProviderForFile(file, executionContext);\n\n const downloadResult = await provider.download(\n { fileId: file.fileId, storageProvider: file.storageProvider, storageRef: file.storageRef },\n executionContext,\n );\n\n try {\n try {\n if (mimeType === PDF_MIME) {\n return await this.extractFromDocument(downloadResult.stream, file.fileId, mimeType, options);\n }\n return await this.extractFromText(downloadResult.stream, file.fileId);\n } catch (parseError) {\n // A provider fault that could not be covered by the local library reaches here as a\n // `DocumentExtractionError` of class PROVIDER_UNAVAILABLE, and it MUST NOT be classified\n // as unreadable bytes — see `extractFromDocument` for the full reasoning. Rethrowing it\n // untouched puts it in the same bucket as a storage outage, which is exactly right: both\n // mean \"we could not read this document RIGHT NOW\", and both must fail the ingestion so\n // the existing corpus survives.\n if (\n parseError instanceof DocumentExtractionError\n && parseError.failureClass === DocumentExtractionFailureClass.PROVIDER_UNAVAILABLE\n ) {\n throw parseError;\n }\n // CLASSIFY the failure, because callers must be able to tell two very different things\n // apart and a raw pdf.js exception does not let them.\n //\n // Everything ABOVE this point — resolving the storage provider, downloading the blob — can\n // fail for INFRASTRUCTURE reasons: an unregistered provider id (a wiring fault), or an\n // unreachable object store (transient). Those errors propagate untouched, and must, because\n // a batch consumer that treats them as \"this file is unreadable\" would draw a permanent\n // conclusion from a temporary outage.\n //\n // Everything INSIDE this try is parsing bytes we already hold. A failure here is a property\n // of the document — corrupt, truncated, password-protected — and re-reading it later cannot\n // help. Only that class is safe for a sweep to skip.\n //\n // The distinction is not cosmetic: `RagIngestionBackendService` deletes a field's chunk set\n // when a pass yields no text, so mislabelling a storage outage as unreadable bytes would\n // destroy a live corpus.\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.FILE_TEXT_EXTRACTION_FAILED,\n context: {\n // diagnostic (log-only)\n fileId: file.fileId,\n mimeType,\n cause: parseError instanceof Error ? parseError.message : String(parseError),\n },\n });\n }\n } finally {\n if (!downloadResult.stream.destroyed) {\n downloadResult.stream.destroy();\n }\n }\n }\n\n /**\n * Check if a MIME type supports text extraction.\n */\n isExtractionSupported(mimeType: string): boolean {\n const lower = mimeType.toLowerCase();\n if (lower === PDF_MIME) return true;\n if (TEXT_MIME_EXACT.has(lower)) return true;\n return TEXT_MIME_PREFIXES.some((prefix) => lower.startsWith(prefix));\n }\n\n private async extractFromText(stream: Readable, fileId: string): Promise<FileTextExtractionResult> {\n // Plain text keeps its ZERO-dependency path deliberately: routing text/* through a PDF parser\n // or a remote provider would add cost and an egress for bytes that are already the answer.\n const text = (await this.collectStream(stream)).toString('utf-8');\n\n this.logDebug('Extracted text from plain text file', {\n fileId,\n characterCount: text.length,\n });\n\n return {\n text,\n metadata: {\n characterCount: text.length,\n wordCount: text.split(/\\s+/).filter(Boolean).length,\n },\n };\n }\n\n /**\n * THE SELECTION SEAM — provider first when one is configured and usable, local library\n * otherwise, and a deliberate answer for every way both can fail.\n *\n * ## The precedence, and why each rung is where it is\n *\n * 0. **The FIELD did not opt into provider extraction** → local library, with no provider\n * resolution attempted at all. `z_file({ textExtraction: { ocr } })` is documented to\n * application developers as off-by-default because OCR is an external per-page cost, so\n * \"an OCR provider is configured somewhere in this application\" must never be sufficient to\n * start spending on a field whose author declared `ocr: false`. Two conditions, both\n * required — the same composition as `.ragSource()` + `AI_EMBEDDINGS`.\n * 1. **No provider configured** → local library. Identical to the behaviour before this seam\n * existed, and it is the default: an application that ingests only born-digital PDFs never\n * needs OCR and never pays for an egress.\n * 2. **Provider configured but cannot serve THESE bytes** (MIME outside the model's catalog row,\n * or larger than the effective ceiling) → local library. Checked with `canServe()`, which is\n * a pure catalog lookup: learning this from a rejected request would cost an egress of the\n * application's document to discover something already known.\n * 3. **Provider returns text** → provider wins. This is the whole point — a scanned contract has\n * no text layer, so this is the only rung that can produce anything for it.\n * 4. **Provider returns EMPTY text** → try the local library anyway. Cheap, and the two read\n * genuinely different things: an OCR model can return nothing for a page whose text layer\n * pdf.js reads perfectly well (a vector-drawn document, say). Preferring \"some text\" over\n * \"no text\" needs no further justification.\n * 5. **Provider says the DOCUMENT is unreadable** (`UNREADABLE_DOCUMENT`) → try the local\n * library, then classify as unreadable if it too yields nothing. Permanent by nature, so the\n * sweep should skip rather than retry.\n * 6. **Provider was UNREACHABLE** (`PROVIDER_UNAVAILABLE` — network, 5xx, 429, bad credential,\n * timeout) → try the local library. If it yields text, serve that, degraded but correct. If\n * it yields NOTHING, **rethrow the provider fault** rather than reporting empty text.\n *\n * Rung 6 is the one that matters, and it is the reason this method is not four lines long.\n *\n * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields\n * no text. So for a SCANNED document — one that only the provider can read — a provider outage\n * plus a \"return empty text\" response would silently destroy a live, already-embedded corpus and\n * report success, and the next sweep after the outage would rebuild it. That is data loss caused\n * by a transient network fault, which is not an acceptable trade for a tidier code path.\n * Rethrowing makes the ingestion FAIL, which leaves the existing chunks untouched and lets the\n * sweep retry next hour — the treatment that already exists for a storage outage, reused because\n * the two situations are the same situation.\n *\n * The distinction is only expressible because the provider service CLASSIFIES its failures; a\n * seam that caught a bare `Error` could not tell rung 5 from rung 6, and would have to pick one\n * wrong answer for the other.\n *\n * ## What this method never does\n *\n * It never routes `text/*` anywhere near a provider — plain text keeps its zero-dependency path,\n * because the bytes already ARE the answer and sending them would be a pointless egress of\n * application content. That gate lives in `extractText` above, not here.\n */\n private async extractFromDocument(\n stream: Readable,\n fileId: string,\n mimeType: string,\n options?: FileTextExtractionOptions,\n ): Promise<FileTextExtractionResult> {\n const buffer = await this.collectStream(stream);\n const binding = options?.allowProviderExtraction === true\n ? this.resolveUsableProviderBinding(fileId, mimeType, buffer.length)\n : undefined;\n\n if (!binding && options?.allowProviderExtraction !== true) {\n // Rung 0 — the field did not opt in. Not a fallback and not a degradation: this is the\n // declared behaviour of a field whose author left `ocr` off (or wrote `ocr: false`), and it\n // is where the overwhelming majority of documents belong, because a born-digital PDF gains\n // nothing from OCR and would cost per page.\n return await this.extractFromPDF(buffer, fileId, 'local-library (field did not opt into provider extraction)');\n }\n\n if (!binding) {\n return await this.extractFromPDF(buffer, fileId, 'local-library (no usable provider)');\n }\n\n try {\n const extracted = await this.documentExtraction!.extractDocumentText({\n document: buffer,\n mimeType,\n applicability: DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT,\n fileId,\n });\n\n if (extracted.text.trim().length > 0) {\n this.logDebug('Extracted text via the configured document-extraction provider', {\n fileId,\n providerRef: binding.providerRef,\n model: extracted.model,\n pageCount: extracted.pageCount,\n characterCount: extracted.text.length,\n });\n return {\n text: extracted.text,\n metadata: {\n pageCount: extracted.pageCount,\n characterCount: extracted.text.length,\n wordCount: extracted.text.split(/\\s+/).filter(Boolean).length,\n extractionPath: 'provider',\n extractionProviderRef: binding.providerRef,\n extractionModel: extracted.model,\n ...(extracted.usage.pagesProcessed !== undefined ? { providerPagesProcessed: extracted.usage.pagesProcessed } : {}),\n },\n };\n }\n\n // Rung 4. WARN rather than debug: a provider that read the document and found no text at all\n // is worth noticing — it is either a genuinely blank document or a model that failed quietly,\n // and this service's debug channel is OFF by default, which is how the original \"every PDF\n // throws\" defect stayed invisible for so long.\n this.logger.warn('Document-extraction provider returned no text — falling back to the local library', {\n fileId,\n providerRef: binding.providerRef,\n pageCount: extracted.pageCount,\n });\n return await this.extractFromPDF(buffer, fileId, 'local-library (provider returned no text)');\n } catch (providerError) {\n if (\n providerError instanceof DocumentExtractionError\n && providerError.failureClass === DocumentExtractionFailureClass.PROVIDER_UNAVAILABLE\n ) {\n // Rung 6 — the corpus-protecting branch.\n let localResult: FileTextExtractionResult | undefined;\n try {\n localResult = await this.extractFromPDF(buffer, fileId, 'local-library (provider unavailable)');\n } catch {\n // The local library ALSO failed. Deliberately swallowed: the provider fault is the more\n // informative of the two and is the one whose class the caller branches on, so it is\n // what gets rethrown below. Losing a pdf.js parse message here costs a log line; losing\n // the provider's classification would cost a corpus.\n localResult = undefined;\n }\n\n if (localResult && localResult.text.trim().length > 0) {\n this.logger.warn('Document-extraction provider was unavailable — served this document from the local library', {\n fileId,\n providerRef: binding.providerRef,\n httpStatus: providerError.httpStatus,\n reason: providerError.message,\n characterCount: localResult.text.length,\n });\n return localResult;\n }\n\n this.logger.warn(\n 'Document-extraction provider was unavailable and the local library produced no text — failing the extraction to protect any existing corpus',\n { fileId, providerRef: binding.providerRef, httpStatus: providerError.httpStatus, reason: providerError.message },\n );\n // NOT classified as unreadable bytes. `extractText`'s catch rethrows this untouched, so\n // the RAG sweep reports FAILED and leaves existing chunks alone — see this method's header.\n throw providerError;\n }\n\n // Rung 5, plus any non-classified throw (a CONFIGURATION error from resolveBinding, say).\n // Both are treated the same way here on purpose: try the local library, and if it produces\n // nothing let the failure fall through to `extractText`'s classifier. A configuration\n // mistake reaching this point has already been logged as itself by the provider service.\n this.logDebug('Document-extraction provider could not read the document — trying the local library', {\n fileId,\n providerRef: binding.providerRef,\n reason: providerError instanceof Error ? providerError.message : String(providerError),\n });\n return await this.extractFromPDF(buffer, fileId, 'local-library (provider could not read the document)');\n }\n }\n\n /**\n * The usable provider binding for this document, or `undefined` when the local library should\n * serve — rungs 1 and 2 of the precedence in {@link extractFromDocument}.\n *\n * Never throws. A CONFIGURATION fault here (a provider selected but declaring no contract) is\n * logged and treated as \"no provider\": extraction is an ENHANCEMENT over a local path that\n * works, so an operator's provider mistake must not take down file extraction for documents the\n * local library reads perfectly well. The provider service still throws that error loudly on the\n * `extractDocumentText` path, so the mistake is not silenced — only prevented from cascading.\n */\n private resolveUsableProviderBinding(\n fileId: string,\n mimeType: string,\n byteLength: number,\n ): DocumentExtractionResolvedBinding | undefined {\n if (!this.documentExtraction) {\n return undefined;\n }\n try {\n const resolution = this.documentExtraction.resolveBinding(DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT);\n // `=== false` rather than `!…`: this compiler configuration narrows the literal-discriminant\n // union on the explicit comparison but not on the truthiness form. Measured here too, not\n // copied on faith — `!resolution.configured` compiles and then fails to narrow `reason`.\n if (resolution.configured === false) {\n this.logDebug('No document-extraction provider configured — using the local library', { fileId, reason: resolution.reason });\n return undefined;\n }\n if (!this.documentExtraction.canServe(resolution.binding, mimeType, byteLength)) {\n this.logDebug('Configured document-extraction provider cannot serve this document — using the local library', {\n fileId,\n mimeType,\n byteLength,\n maxDocumentBytes: resolution.binding.maxDocumentBytes,\n providerRef: resolution.binding.providerRef,\n });\n return undefined;\n }\n return resolution.binding;\n } catch (resolutionError) {\n this.logger.warn('Document-extraction provider is misconfigured — falling back to the local library for this document', {\n fileId,\n reason: resolutionError instanceof Error ? resolutionError.message : String(resolutionError),\n });\n return undefined;\n }\n }\n\n /**\n * Extract text from a PDF using the LOCAL `pdfjs-dist` library.\n *\n * ## Why the import stays dynamic even though the dependency is installed\n *\n * `pdfjs-dist` is a large module graph that most backend processes never touch — only a request\n * that actually carries a PDF needs it. A dynamic import keeps it out of every other process's\n * startup cost. What changed is that the import can no longer FAIL for want of a dependency: the\n * package is declared in this package's manifest, so a resolution failure now means a broken\n * installation, which is a real fault and is correctly loud.\n *\n * The deep specifier targets the `legacy` build deliberately. It is the ESM build pdf.js ships for\n * non-browser hosts; the default build assumes browser globals. `pdfjs-dist` publishes no\n * `exports` map, so this deep path is a supported entrypoint rather than a boundary violation.\n *\n * ## When a PROVIDER serves this instead\n *\n * This local path reads the text layer a PDF already contains, and returns nothing useful for a\n * SCANNED document (an image of a page carries no text layer). That is what the provider-backed\n * OCR capability exists to handle, and {@link extractFromDocument} is the seam that chooses\n * between them. With no `AI_DOCUMENT_EXTRACTION` provider configured, a scanned PDF still\n * extracts to empty text — which the RAG ingestion path treats as \"contributes no chunks\"\n * rather than as an error.\n *\n * It takes a BUFFER rather than a stream because the selection seam above may need the same\n * bytes twice (provider first, this second), and a `Readable` is consumed once. `reason` names\n * which rung of that seam routed here and is logged, so an operator reading the logs can tell\n * \"no provider is configured\" from \"the provider was down\" without inspecting configuration.\n */\n private async extractFromPDF(buffer: Buffer, fileId: string, reason: string): Promise<FileTextExtractionResult> {\n const pdfjs = await import('pdfjs-dist/legacy/build/pdf.mjs');\n\n const loadingTask = pdfjs.getDocument({\n // A COPY, and it is mandatory rather than defensive. pdf.js transfers the backing\n // ArrayBuffer to its worker port and DETACHES it. For a small allocation Node's `Buffer`\n // is a window onto a SHARED 8 KB pool, so handing it `buffer` directly would detach a\n // region other, unrelated buffers are still using. `new Uint8Array(buffer)` copies out of\n // the pool into a private allocation. Costs 2x peak memory for the document; correctness\n // is worth it.\n data: new Uint8Array(buffer),\n // Not the hardening it looks like — measured against the shipped build 2026-08-27, and\n // recorded because the plausible reading is wrong in both directions.\n //\n // It does NOT stop a document reaching the host's font files: `useSystemFonts` only decides\n // whether the worker builds a CSS `local()` substitution descriptor, which is string\n // construction and opens nothing. And in Node it is ALREADY false by default.\n //\n // It is set explicitly for the opposite-facing reason: when `useSystemFonts` is true,\n // `fetchStandardFontData` early-returns null, which would make the `standardFontDataUrl`\n // below dead. Pinning it false is what keeps that parameter load-bearing.\n //\n // (A sibling `isEvalSupported: false` was written here first and removed: pdf.js 6 deleted\n // that option outright — zero occurrences in its types AND its shipped build — having\n // removed the eval-based font-compilation path. It type-errors, and would have advertised a\n // decision the library silently ignored.)\n useSystemFonts: false,\n standardFontDataUrl: resolveStandardFontDataPath(),\n });\n\n try {\n const pdfDocument = await loadingTask.promise;\n const pageTexts: string[] = [];\n\n for (let pageNumber = 1; pageNumber <= pdfDocument.numPages; pageNumber++) {\n const page = await pdfDocument.getPage(pageNumber);\n try {\n const textContent = await page.getTextContent();\n // Concatenate items HONOURING `hasEOL`, rather than joining every item with a space.\n //\n // pdf.js splits a visual line into several `TextItem`s at kerning and positioning\n // boundaries, so a blanket `join(' ')` inserts spaces INSIDE words on ordinary documents\n // and erases line structure entirely. That matters more here than it would in a viewer:\n // this string is what gets chunked and embedded, so the damage lands in the retrieval\n // corpus rather than on a screen where a human would notice it.\n //\n // `items` also mixes TextItem (which carries `str`) with TextMarkedContent (structural\n // markers, which do not). Narrowing on the property rather than casting keeps a future\n // pdf.js item kind from silently stringifying as `undefined`.\n let pageText = '';\n for (const item of textContent.items) {\n if (!('str' in item)) continue;\n pageText += item.str;\n if (item.hasEOL) pageText += '\\n';\n }\n pageTexts.push(pageText);\n } finally {\n page.cleanup();\n }\n }\n\n const text = pageTexts.join('\\n');\n\n this.logDebug('Extracted text from PDF via the local pdfjs-dist path', {\n fileId,\n pageCount: pdfDocument.numPages,\n characterCount: text.length,\n reason,\n });\n\n return {\n text,\n metadata: {\n pageCount: pdfDocument.numPages,\n characterCount: text.length,\n wordCount: text.split(/\\s+/).filter(Boolean).length,\n // Which path served this extraction, and why. Carried in the RESULT rather than only in\n // a log line so a caller (and a test) can assert the routing without scraping logs.\n extractionPath: 'local-library',\n extractionPathReason: reason,\n },\n };\n } finally {\n // `destroy()` lives on the LOADING TASK, not on the document proxy — `pdfDocument.destroy` is\n // not a function in pdfjs-dist 6.x. Skipping this leaks the document's worker port.\n //\n // Swallowed deliberately: `destroy()` can itself throw, and a throw from a `finally` REPLACES\n // the in-flight error. The caller classifies on that original error to decide whether a\n // document is permanently unreadable or the storage layer is merely down, so losing it would\n // corrupt exactly the decision this method exists to inform.\n await loadingTask.destroy().catch(() => undefined);\n }\n }\n\n /** Drain a download stream into a single buffer. Shared by every extraction path. */\n private async collectStream(stream: Readable): Promise<Buffer> {\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n }\n return Buffer.concat(chunks);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"file-text-extraction.backend.service.js","sourceRoot":"","sources":["../../../../../src/files/services/file-text-extraction.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,2BAA2B,EAAa,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,kCAAkC,GAEnC,MAAM,8EAA8E,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAE9G,OAAO,EAAE,+BAA+B,EAAE,MAAM,sEAAsE,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EACL,gCAAgC,EAChC,uBAAuB,EACvB,8BAA8B,GAE/B,MAAM,oFAAoF,CAAC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MAAM,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAA;IACpD,WAAA,QAAQ,EAAE,CAAA;+CAboB,0BAA0B;QAErB,+BAA+B;QAGpC,mBAAmB;QASZ,gCAAgC;GArB7D,gCAAgC,CAinB5C","sourcesContent":["/**\n * File Text Extraction Backend Service\n *\n * Extracts text content from files. Retained through the Weaviate-lane demolition (2026-08-26):\n * this is the file-side TEXT PROVIDER the resource-native RAG capability reuses in Phase 1 of\n * `.claude/plans/resource-rag-capability.md` (extraction knobs like extractText/ocr stay file-side).\n *\n * Supported formats (first slice):\n * - Plain text (text/plain, text/markdown, text/csv, application/json, etc.)\n * - PDF (via `pdfjs-dist` — dynamically imported, but an INSTALLED dependency)\n *\n * ## Why `pdfjs-dist` and not `pdf-parse` (decided 2026-08-27)\n *\n * The header used to advertise PDF support through `pdf-parse`, which was in NO manifest and NO\n * lockfile anywhere in the repository. So every PDF that reached a `.ragSource()` field threw\n * `'pdf-parse is required for PDF text extraction'` — and because the RAG sweep treats a throw as a\n * failed ingestion and re-visits hourly, that was a permanent retry loop, not a one-off failure.\n * The advertised capability had never worked. Both halves of that are now fixed: the library is a\n * real dependency, and the sweep no longer strands on an unextractable file.\n *\n * `pdf-parse` was reconsidered rather than assumed obsolete — its modern release (2.4.5, Oct 2025)\n * is maintained, contrary to the reputation of the long-abandoned 1.1.x line. It was still rejected,\n * on dependency shape rather than hygiene: it requires `@napi-rs/canvas` (a NATIVE addon, per-platform\n * binaries, and this repository's own toolchain baseline records what a stale C++ toolchain costs)\n * and it vendors `pdfjs-dist@5.4.296` — a SECOND copy at a different major from the `^6.2.108` this\n * repository already pins centrally. `pdfjs-dist` used directly has zero required dependencies\n * (`@napi-rs/canvas` is OPTIONAL there and is needed only for RENDERING, which text extraction never\n * does), is Mozilla-maintained, and matches the `^6.2.108` the root `pnpm.overrides` already pins\n * for the PDF viewer preset. One library, one major, no native build.\n *\n * (The `pdf-parse` dependency facts above were read from the npm registry on 2026-08-27 — `npm view\n * pdf-parse dependencies` reports `pdfjs-dist@5.4.296` and `@napi-rs/canvas@0.1.80`. They are not\n * checkable from inside this repository, so the provenance is recorded rather than assumed.)\n *\n * ## The version constraint is a RANGE, not the usual `*`\n *\n * Most dependencies here are declared `*` because the root `pnpm.overrides` is the single version\n * authority. That works inside the monorepo and NOT for a generated application, which inherits no\n * root override — and `pdfjs-dist` is not in `propagated-engine-overrides.json`. Under `*` an\n * application would happily satisfy this import with the `4.10.38` its PDF viewer already pulls in\n * transitively, against which this file's API assumptions are false (`loadingTask.destroy`, the\n * absent `exports` map that makes both the deep `legacy/build` specifier and the `package.json`\n * resolution legal). `^6.2.108` states what the CODE requires. Precedent: `@react-pdf/renderer`\n * carries a real range in this same manifest for the same reason.\n *\n * ## Provider-backed extraction (OCR) — the selection seam\n *\n * A PDF is served by the application's `EngineCapability.AI_DOCUMENT_EXTRACTION` provider when one\n * is configured and can handle the bytes, and by the local library otherwise. `extractFromDocument`\n * owns that decision and documents the full precedence, including the branch that protects an\n * existing RAG corpus from a provider outage. Plain text never touches a provider.\n *\n * ## Office / OpenDocument — six served LOCALLY, three provider-only (#434, closed 2026-09-09)\n *\n * The framework's `Documents` media group admits Word, Excel, PowerPoint and the OpenDocument\n * trio, and until 2026-09-08 the extractor supported NONE of them: a corpus field using the group\n * accepted uploads that could never contribute a chunk under any configuration, skipped at debug.\n *\n * The nine types are THREE technical problems, and reading them as one is what produced this\n * header's earlier claim that a local library would cost \"three to six\" dependencies:\n *\n * - **OOXML** (`.docx` `.xlsx` `.pptx`) and **OpenDocument** (`.odt` `.ods` `.odp`) are ZIP+XML —\n * the SAME technique, so ONE module reads all six, on two dependencies rather than six\n * (`fflate` to unzip, `fast-xml-parser` to read). See\n * `office-document-text-extraction.backend.utils.ts`.\n * - **Legacy binary Office** (`.doc` `.xls` `.ppt`) are OLE2 compound files from a different era.\n * A reader for them is a project, not a dependency, so they stay PROVIDER-ONLY.\n *\n * So the six take exactly the ladder PDF already takes, with the office extractor in the rung\n * `pdfjs-dist` occupies: a configured provider is preferred when the field opted into it, the\n * local library serves everything else, and a deployment with NO provider can finally read the\n * documents its media group accepts. The three remaining types keep the conditional support and\n * the precise refusal, because for them the provider genuinely is the only path.\n *\n * Future:\n * - Legacy binary Office (`.doc` / `.xls` / `.ppt`) locally, if an OLE2 reader ever earns its place\n * - Audio/video transcript extraction\n *\n * The service operates against the storage provider contract — it downloads\n * the file via `FileStorageRouterBackendService`, never touching raw S3/local\n * paths directly.\n */\n\nimport { injectable, inject, optional } from 'inversify';\nimport { Readable } from 'stream';\nimport { createRequire } from 'node:module';\nimport { dirname, join } from 'node:path';\nimport { ErrorType, ErrorCustomMessageReference, type File } from '@wildo-ai/saas-models';\nimport {\n extractOfficeDocumentText,\n LEGACY_BINARY_OFFICE_MIMES,\n LOCALLY_EXTRACTABLE_DOCUMENT_MIMES,\n OfficeDocumentExtractionError,\n} from '~wildo-backend-lib/files/utils/office-document-text-extraction.backend.utils';\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 { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport {\n DocumentExtractionBackendService,\n DocumentExtractionError,\n DocumentExtractionFailureClass,\n type DocumentExtractionResolvedBinding,\n} from '~wildo-backend-lib/external-providers/services/document-extraction.backend.service';\nimport { DocumentExtraction_Applicability } from '@wildo-ai/external-connectors-models';\n\n/**\n * Per-call extraction options — today, the caller's answer to \"may this document be sent to an\n * external extraction provider?\".\n *\n * The answer belongs to the CALLER because it is a per-FIELD declaration\n * (`z_file({ textExtraction: { ocr } })`) and this service is handed a `File`, which knows nothing\n * about the field it hangs off. `RagIngestionBackendService` is the layer that holds both, so it\n * is the layer that translates one into the other.\n */\nexport interface FileTextExtractionOptions {\n /**\n * Whether provider-backed extraction (OCR) is permitted for this document.\n *\n * **DEFAULT FALSE, deliberately, and it is a spending decision rather than a caution.** OCR is\n * billed per page by an external provider, and `FileTextExtractionOptions.ocr` on the schema is\n * documented to application developers as off-by-default for exactly that reason. Defaulting\n * this to true would mean that merely CONFIGURING a provider silently began charging per page\n * for every document in every corpus — including fields whose author wrote `ocr: false` and\n * explained why. Wonder Todos' `knowledge-documents` field is precisely that case.\n *\n * When false, extraction uses the local text-layer read and nothing leaves the deployment.\n */\n allowProviderExtraction?: boolean;\n}\n\nexport interface FileTextExtractionResult {\n text: string;\n language?: string;\n confidence?: number;\n metadata?: {\n pageCount?: number;\n wordCount?: number;\n characterCount?: number;\n [key: string]: unknown;\n };\n}\n\nconst TEXT_MIME_PREFIXES = ['text/'];\nconst TEXT_MIME_EXACT = new Set([\n 'application/json',\n 'application/xml',\n 'application/xhtml+xml',\n 'application/javascript',\n 'application/typescript',\n 'application/x-yaml',\n 'application/yaml',\n 'application/x-sh',\n 'application/graphql',\n 'application/toml',\n]);\nconst PDF_MIME = 'application/pdf';\n\n/**\n * The three types that STILL need a provider — pre-2007 binary Office (`.doc` / `.xls` / `.ppt`).\n *\n * These are OLE2 compound files, not ZIP archives, so the local ZIP+XML extractor that serves the\n * other six cannot read them and a reader for them is a project rather than a dependency. Support\n * is therefore CONDITIONAL, and {@link isExtractionSupported} says so by ASKING the provider rather\n * than asserting a capability the deployment may not have.\n *\n * Why conditional rather than unconditional-and-fail-later: RAG ingestion treats an unsupported\n * MIME as \"no corpus from this file\", logged at DEBUG and never an error. Declaring these supported\n * everywhere would turn a configuration ABSENCE into an ERROR log on every sweep run, for every\n * application without an extraction provider — noise that says nothing an operator can act on.\n *\n * The six ZIP+XML types are no longer here, and that is the whole of #434's second half: they are\n * served by {@link LOCALLY_EXTRACTABLE_DOCUMENT_MIMES} with no provider required.\n */\nconst PROVIDER_ONLY_DOCUMENT_MIMES: ReadonlySet<string> = LEGACY_BINARY_OFFICE_MIMES;\n\nconst moduleRequire = createRequire(import.meta.url);\n\n/**\n * Absolute path to `pdfjs-dist`'s bundled standard-font data, resolved from the INSTALLED package\n * rather than assumed relative to this file — `saas-backend-lib` runs from `dist/` in every\n * deployed process, so a path relative to the source tree would be wrong everywhere that matters.\n *\n * Without this, pdf.js emits `Warning: UnknownErrorException: Ensure that the 'standardFontDataUrl'\n * API parameter is provided` for any document using the 14 PDF standard fonts (Helvetica, Times,\n * Courier …) — the family ordinary word processors and report generators emit.\n *\n * MEASURED 2026-08-27, because the obvious claim about this is wrong: removing this parameter does\n * NOT break extraction of the committed Helvetica fixture. Text extraction reads the string\n * operands of the content stream and maps them through the font's ENCODING, which pdf.js can build\n * for a standard font without loading its font PROGRAM. So this is supplied to silence a real\n * warning and to keep glyph mapping correct for documents whose encoding genuinely requires the\n * font program — NOT because the common case depends on it. No fixture currently pins a document\n * that would fail without it; do not claim one does.\n *\n * Resolved lazily and memoized: `require.resolve` touches the filesystem, and extraction runs per\n * file inside a sweep that can process many files in one pass.\n */\nlet cachedStandardFontDataPath: string | undefined;\nfunction resolveStandardFontDataPath(): string {\n if (cachedStandardFontDataPath === undefined) {\n // The trailing separator is REQUIRED — pdf.js concatenates the font filename onto this value.\n cachedStandardFontDataPath = join(dirname(moduleRequire.resolve('pdfjs-dist/package.json')), 'standard_fonts') + '/';\n }\n return cachedStandardFontDataPath;\n}\n\n@injectable()\nexport class FileTextExtractionBackendService {\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.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n // Appended LAST deliberately — DI constructor positions are order-sensitive.\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n // OPTIONAL, and that is not defensiveness. This service is constructed directly in several\n // tests and integration harnesses with a fixed positional argument list; a required dependency\n // appended here would break every one of them, and — worse — a harness that passed `undefined`\n // to satisfy the arity would look wired while being dead. Optional makes \"no provider\" the\n // explicit, tested path it genuinely is: an application with no `AI_DOCUMENT_EXTRACTION`\n // selection behaves identically to one whose container never bound this service.\n @inject(SAAS_SERVICE_TYPES.DocumentExtractionService)\n @optional()\n private readonly documentExtraction?: DocumentExtractionBackendService,\n ) {\n this.logDebug = this.logger.debugByType('FileTextExtractionBackendService');\n this.logger.setDebugTypeLogging('FileTextExtractionBackendService', false);\n }\n\n /**\n * Extract text from a file by downloading it through the storage provider.\n */\n async extractText(\n file: File,\n executionContext: ExecutionContext<any>,\n options?: FileTextExtractionOptions,\n ): Promise<FileTextExtractionResult> {\n const mimeType = file.mimeType?.toLowerCase() ?? '';\n\n if (!this.isExtractionSupported(mimeType)) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_TEXT_EXTRACTION_UNSUPPORTED_TYPE,\n context: {\n // diagnostic (log-only)\n fileId: file.fileId,\n mimeType,\n },\n },\n );\n }\n\n // Resolve through FilesBackendService so a LEGACY row that persisted no\n // `storageProvider` falls back to the default provider instead of failing\n // extraction. Reimplementing the lookup here is what made this one of five\n // behaviours for one input.\n //\n // Unlike the scan pipeline, the throw is propagated: this runs on a synchronous\n // request path with no terminal status to strand, so failing loudly is correct.\n // The error type moves CONFIGURATION -> INTERNAL, matching the reference — an\n // unregistered persisted id is an engine wiring fault, not an app misconfiguration.\n const provider = this.filesService.getStorageProviderForFile(file, executionContext);\n\n const downloadResult = await provider.download(\n { fileId: file.fileId, storageProvider: file.storageProvider, storageRef: file.storageRef },\n executionContext,\n );\n\n try {\n try {\n if (\n mimeType === PDF_MIME\n || LOCALLY_EXTRACTABLE_DOCUMENT_MIMES.has(mimeType)\n || PROVIDER_ONLY_DOCUMENT_MIMES.has(mimeType)\n ) {\n return await this.extractFromDocument(downloadResult.stream, file.fileId, mimeType, options);\n }\n return await this.extractFromText(downloadResult.stream, file.fileId);\n } catch (parseError) {\n // A provider fault that could not be covered by the local library reaches here as a\n // `DocumentExtractionError` of class PROVIDER_UNAVAILABLE, and it MUST NOT be classified\n // as unreadable bytes — see `extractFromDocument` for the full reasoning. Rethrowing it\n // untouched puts it in the same bucket as a storage outage, which is exactly right: both\n // mean \"we could not read this document RIGHT NOW\", and both must fail the ingestion so\n // the existing corpus survives.\n if (\n parseError instanceof DocumentExtractionError\n && parseError.failureClass === DocumentExtractionFailureClass.PROVIDER_UNAVAILABLE\n ) {\n throw parseError;\n }\n // CLASSIFY the failure, because callers must be able to tell two very different things\n // apart and a raw pdf.js exception does not let them.\n //\n // Everything ABOVE this point — resolving the storage provider, downloading the blob — can\n // fail for INFRASTRUCTURE reasons: an unregistered provider id (a wiring fault), or an\n // unreachable object store (transient). Those errors propagate untouched, and must, because\n // a batch consumer that treats them as \"this file is unreadable\" would draw a permanent\n // conclusion from a temporary outage.\n //\n // Everything INSIDE this try is parsing bytes we already hold. A failure here is a property\n // of the document — corrupt, truncated, password-protected — and re-reading it later cannot\n // help. Only that class is safe for a sweep to skip.\n //\n // The distinction is not cosmetic: `RagIngestionBackendService` deletes a field's chunk set\n // when a pass yields no text, so mislabelling a storage outage as unreadable bytes would\n // destroy a live corpus.\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.FILE_TEXT_EXTRACTION_FAILED,\n context: {\n // diagnostic (log-only)\n fileId: file.fileId,\n mimeType,\n cause: parseError instanceof Error ? parseError.message : String(parseError),\n },\n });\n }\n } finally {\n if (!downloadResult.stream.destroyed) {\n downloadResult.stream.destroy();\n }\n }\n }\n\n /**\n * Check if a MIME type supports text extraction.\n */\n isExtractionSupported(mimeType: string): boolean {\n const lower = mimeType.toLowerCase();\n if (lower === PDF_MIME) return true;\n if (TEXT_MIME_EXACT.has(lower)) return true;\n if (TEXT_MIME_PREFIXES.some((prefix) => lower.startsWith(prefix))) return true;\n /*\n * OOXML + OpenDocument: UNCONDITIONALLY supported (#434). A local ZIP+XML extractor serves all\n * six, so the answer no longer depends on a deployment's provider selection — which is the\n * point of the local library. A provider, where one is configured and the field opted in, is\n * still preferred inside `extractFromDocument`; it is no longer the only path.\n */\n if (LOCALLY_EXTRACTABLE_DOCUMENT_MIMES.has(lower)) return true;\n /*\n * Legacy binary Office: supported IF AND ONLY IF a configured provider declares the type. Byte\n * length is unknown at this question — it is asked before the file is fetched — so this answers\n * the MIME half only; `resolveUsableProviderBinding` re-asks with the real length and falls\n * through if the document is too large, which is the same shape as a PDF exceeding\n * `maxDocumentBytes`.\n */\n return PROVIDER_ONLY_DOCUMENT_MIMES.has(lower) && this.providerDeclaresMimeType(lower);\n }\n\n /**\n * Whether the configured document-extraction provider declares this MIME type.\n *\n * Deliberately narrower than {@link resolveUsableProviderBinding}: no byte length, no logging, and\n * every failure answers `false`. It is a capability QUESTION asked on a hot path (once per file\n * per sweep), not the resolution that precedes an actual extraction.\n */\n private providerDeclaresMimeType(mimeType: string): boolean {\n if (!this.documentExtraction) return false;\n try {\n const resolution = this.documentExtraction.resolveBinding(DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT);\n if (resolution.configured === false) return false;\n return resolution.binding.supportedMimeTypes.includes(mimeType);\n } catch {\n // A misconfigured provider is not a supported type. The loud version of this is logged where\n // extraction is actually attempted; answering `false` here keeps the corpus skip quiet.\n return false;\n }\n }\n\n private async extractFromText(stream: Readable, fileId: string): Promise<FileTextExtractionResult> {\n // Plain text keeps its ZERO-dependency path deliberately: routing text/* through a PDF parser\n // or a remote provider would add cost and an egress for bytes that are already the answer.\n const text = (await this.collectStream(stream)).toString('utf-8');\n\n this.logDebug('Extracted text from plain text file', {\n fileId,\n characterCount: text.length,\n });\n\n return {\n text,\n metadata: {\n characterCount: text.length,\n wordCount: text.split(/\\s+/).filter(Boolean).length,\n },\n };\n }\n\n /**\n * THE SELECTION SEAM — provider first when one is configured and usable, local library\n * otherwise, and a deliberate answer for every way both can fail.\n *\n * ## The precedence, and why each rung is where it is\n *\n * 0. **The FIELD did not opt into provider extraction** → local library, with no provider\n * resolution attempted at all. `z_file({ textExtraction: { ocr } })` is documented to\n * application developers as off-by-default because OCR is an external per-page cost, so\n * \"an OCR provider is configured somewhere in this application\" must never be sufficient to\n * start spending on a field whose author declared `ocr: false`. Two conditions, both\n * required — the same composition as `.ragSource()` + `AI_EMBEDDINGS`.\n * 1. **No provider configured** → local library. Identical to the behaviour before this seam\n * existed, and it is the default: an application that ingests only born-digital PDFs never\n * needs OCR and never pays for an egress.\n * 2. **Provider configured but cannot serve THESE bytes** (MIME outside the model's catalog row,\n * or larger than the effective ceiling) → local library. Checked with `canServe()`, which is\n * a pure catalog lookup: learning this from a rejected request would cost an egress of the\n * application's document to discover something already known.\n * 3. **Provider returns text** → provider wins. This is the whole point — a scanned contract has\n * no text layer, so this is the only rung that can produce anything for it.\n * 4. **Provider returns EMPTY text** → try the local library anyway. Cheap, and the two read\n * genuinely different things: an OCR model can return nothing for a page whose text layer\n * pdf.js reads perfectly well (a vector-drawn document, say). Preferring \"some text\" over\n * \"no text\" needs no further justification.\n * 5. **Provider says the DOCUMENT is unreadable** (`UNREADABLE_DOCUMENT`) → try the local\n * library, then classify as unreadable if it too yields nothing. Permanent by nature, so the\n * sweep should skip rather than retry.\n * 6. **Provider was UNREACHABLE** (`PROVIDER_UNAVAILABLE` — network, 5xx, 429, bad credential,\n * timeout) → try the local library. If it yields text, serve that, degraded but correct. If\n * it yields NOTHING, **rethrow the provider fault** rather than reporting empty text.\n *\n * Rung 6 is the one that matters, and it is the reason this method is not four lines long.\n *\n * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields\n * no text. So for a SCANNED document — one that only the provider can read — a provider outage\n * plus a \"return empty text\" response would silently destroy a live, already-embedded corpus and\n * report success, and the next sweep after the outage would rebuild it. That is data loss caused\n * by a transient network fault, which is not an acceptable trade for a tidier code path.\n * Rethrowing makes the ingestion FAIL, which leaves the existing chunks untouched and lets the\n * sweep retry next hour — the treatment that already exists for a storage outage, reused because\n * the two situations are the same situation.\n *\n * The distinction is only expressible because the provider service CLASSIFIES its failures; a\n * seam that caught a bare `Error` could not tell rung 5 from rung 6, and would have to pick one\n * wrong answer for the other.\n *\n * ## What this method never does\n *\n * It never routes `text/*` anywhere near a provider — plain text keeps its zero-dependency path,\n * because the bytes already ARE the answer and sending them would be a pointless egress of\n * application content. That gate lives in `extractText` above, not here.\n */\n private async extractFromDocument(\n stream: Readable,\n fileId: string,\n mimeType: string,\n options?: FileTextExtractionOptions,\n ): Promise<FileTextExtractionResult> {\n const buffer = await this.collectStream(stream);\n const binding = options?.allowProviderExtraction === true\n ? this.resolveUsableProviderBinding(fileId, mimeType, buffer.length)\n : undefined;\n\n /*\n * LEGACY BINARY Office only (#434). These are OLE2 compound files, so neither local library\n * below can serve them — handing a `.doc` to pdf.js or to the ZIP+XML extractor produces an\n * unreadable-bytes classification that blames the document for a capability the deployment does\n * not have.\n *\n * The six ZIP+XML types deliberately do NOT reach this branch any more: they have a local\n * library, so a missing binding degrades them to it rather than refusing.\n *\n * `isExtractionSupported` already asked the provider whether it declares this MIME, so reaching\n * here without a binding means the answer changed between the two questions (the byte length\n * exceeded `maxDocumentBytes`, or the provider became unresolvable). Refusing names that\n * precisely instead of mislabelling the file.\n */\n if (!binding && PROVIDER_ONLY_DOCUMENT_MIMES.has(mimeType.toLowerCase())) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.FILE_TEXT_EXTRACTION_UNSUPPORTED_TYPE,\n context: {\n // diagnostic (log-only)\n fileId,\n mimeType,\n byteLength: buffer.length,\n message: 'This document type is extractable only through a configured document-extraction provider, and none can serve it',\n },\n });\n }\n\n if (!binding && options?.allowProviderExtraction !== true) {\n // Rung 0 — the field did not opt in. Not a fallback and not a degradation: this is the\n // declared behaviour of a field whose author left `ocr` off (or wrote `ocr: false`), and it\n // is where the overwhelming majority of documents belong, because a born-digital PDF gains\n // nothing from OCR and would cost per page.\n return await this.extractLocally(buffer, fileId, mimeType, 'local-library (field did not opt into provider extraction)');\n }\n\n if (!binding) {\n return await this.extractLocally(buffer, fileId, mimeType, 'local-library (no usable provider)');\n }\n\n try {\n const extracted = await this.documentExtraction!.extractDocumentText({\n document: buffer,\n mimeType,\n applicability: DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT,\n fileId,\n });\n\n if (extracted.text.trim().length > 0) {\n this.logDebug('Extracted text via the configured document-extraction provider', {\n fileId,\n providerRef: binding.providerRef,\n model: extracted.model,\n pageCount: extracted.pageCount,\n characterCount: extracted.text.length,\n });\n return {\n text: extracted.text,\n metadata: {\n pageCount: extracted.pageCount,\n characterCount: extracted.text.length,\n wordCount: extracted.text.split(/\\s+/).filter(Boolean).length,\n extractionPath: 'provider',\n extractionProviderRef: binding.providerRef,\n extractionModel: extracted.model,\n ...(extracted.usage.pagesProcessed !== undefined ? { providerPagesProcessed: extracted.usage.pagesProcessed } : {}),\n },\n };\n }\n\n // Rung 4. WARN rather than debug: a provider that read the document and found no text at all\n // is worth noticing — it is either a genuinely blank document or a model that failed quietly,\n // and this service's debug channel is OFF by default, which is how the original \"every PDF\n // throws\" defect stayed invisible for so long.\n this.logger.warn('Document-extraction provider returned no text — falling back to the local library', {\n fileId,\n providerRef: binding.providerRef,\n pageCount: extracted.pageCount,\n });\n return await this.extractLocally(buffer, fileId, mimeType, 'local-library (provider returned no text)');\n } catch (providerError) {\n if (\n providerError instanceof DocumentExtractionError\n && providerError.failureClass === DocumentExtractionFailureClass.PROVIDER_UNAVAILABLE\n ) {\n // Rung 6 — the corpus-protecting branch.\n let localResult: FileTextExtractionResult | undefined;\n try {\n localResult = await this.extractLocally(buffer, fileId, mimeType, 'local-library (provider unavailable)');\n } catch {\n // The local library ALSO failed. Deliberately swallowed: the provider fault is the more\n // informative of the two and is the one whose class the caller branches on, so it is\n // what gets rethrown below. Losing a pdf.js parse message here costs a log line; losing\n // the provider's classification would cost a corpus.\n localResult = undefined;\n }\n\n if (localResult && localResult.text.trim().length > 0) {\n this.logger.warn('Document-extraction provider was unavailable — served this document from the local library', {\n fileId,\n providerRef: binding.providerRef,\n httpStatus: providerError.httpStatus,\n reason: providerError.message,\n characterCount: localResult.text.length,\n });\n return localResult;\n }\n\n this.logger.warn(\n 'Document-extraction provider was unavailable and the local library produced no text — failing the extraction to protect any existing corpus',\n { fileId, providerRef: binding.providerRef, httpStatus: providerError.httpStatus, reason: providerError.message },\n );\n // NOT classified as unreadable bytes. `extractText`'s catch rethrows this untouched, so\n // the RAG sweep reports FAILED and leaves existing chunks alone — see this method's header.\n throw providerError;\n }\n\n // Rung 5, plus any non-classified throw (a CONFIGURATION error from resolveBinding, say).\n // Both are treated the same way here on purpose: try the local library, and if it produces\n // nothing let the failure fall through to `extractText`'s classifier. A configuration\n // mistake reaching this point has already been logged as itself by the provider service.\n this.logDebug('Document-extraction provider could not read the document — trying the local library', {\n fileId,\n providerRef: binding.providerRef,\n reason: providerError instanceof Error ? providerError.message : String(providerError),\n });\n return await this.extractLocally(buffer, fileId, mimeType, 'local-library (provider could not read the document)');\n }\n }\n\n /**\n * The usable provider binding for this document, or `undefined` when the local library should\n * serve — rungs 1 and 2 of the precedence in {@link extractFromDocument}.\n *\n * Never throws. A CONFIGURATION fault here (a provider selected but declaring no contract) is\n * logged and treated as \"no provider\": extraction is an ENHANCEMENT over a local path that\n * works, so an operator's provider mistake must not take down file extraction for documents the\n * local library reads perfectly well. The provider service still throws that error loudly on the\n * `extractDocumentText` path, so the mistake is not silenced — only prevented from cascading.\n */\n private resolveUsableProviderBinding(\n fileId: string,\n mimeType: string,\n byteLength: number,\n ): DocumentExtractionResolvedBinding | undefined {\n if (!this.documentExtraction) {\n return undefined;\n }\n try {\n const resolution = this.documentExtraction.resolveBinding(DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT);\n // `=== false` rather than `!…`: this compiler configuration narrows the literal-discriminant\n // union on the explicit comparison but not on the truthiness form. Measured here too, not\n // copied on faith — `!resolution.configured` compiles and then fails to narrow `reason`.\n if (resolution.configured === false) {\n this.logDebug('No document-extraction provider configured — using the local library', { fileId, reason: resolution.reason });\n return undefined;\n }\n if (!this.documentExtraction.canServe(resolution.binding, mimeType, byteLength)) {\n this.logDebug('Configured document-extraction provider cannot serve this document — using the local library', {\n fileId,\n mimeType,\n byteLength,\n maxDocumentBytes: resolution.binding.maxDocumentBytes,\n providerRef: resolution.binding.providerRef,\n });\n return undefined;\n }\n return resolution.binding;\n } catch (resolutionError) {\n this.logger.warn('Document-extraction provider is misconfigured — falling back to the local library for this document', {\n fileId,\n reason: resolutionError instanceof Error ? resolutionError.message : String(resolutionError),\n });\n return undefined;\n }\n }\n\n /**\n * Extract text from a PDF using the LOCAL `pdfjs-dist` library.\n *\n * ## Why the import stays dynamic even though the dependency is installed\n *\n * `pdfjs-dist` is a large module graph that most backend processes never touch — only a request\n * that actually carries a PDF needs it. A dynamic import keeps it out of every other process's\n * startup cost. What changed is that the import can no longer FAIL for want of a dependency: the\n * package is declared in this package's manifest, so a resolution failure now means a broken\n * installation, which is a real fault and is correctly loud.\n *\n * The deep specifier targets the `legacy` build deliberately. It is the ESM build pdf.js ships for\n * non-browser hosts; the default build assumes browser globals. `pdfjs-dist` publishes no\n * `exports` map, so this deep path is a supported entrypoint rather than a boundary violation.\n *\n * ## When a PROVIDER serves this instead\n *\n * This local path reads the text layer a PDF already contains, and returns nothing useful for a\n * SCANNED document (an image of a page carries no text layer). That is what the provider-backed\n * OCR capability exists to handle, and {@link extractFromDocument} is the seam that chooses\n * between them. With no `AI_DOCUMENT_EXTRACTION` provider configured, a scanned PDF still\n * extracts to empty text — which the RAG ingestion path treats as \"contributes no chunks\"\n * rather than as an error.\n *\n * It takes a BUFFER rather than a stream because the selection seam above may need the same\n * bytes twice (provider first, this second), and a `Readable` is consumed once. `reason` names\n * which rung of that seam routed here and is logged, so an operator reading the logs can tell\n * \"no provider is configured\" from \"the provider was down\" without inspecting configuration.\n */\n /**\n * The LOCAL-LIBRARY rung of {@link extractFromDocument}'s ladder, dispatched by MIME.\n *\n * Two libraries sit at this rung and they are not interchangeable: `pdfjs-dist` reads a PDF's\n * text layer, and the ZIP+XML extractor reads OOXML / OpenDocument parts. Handing a document to\n * the wrong one produces an unreadable-bytes classification that blames the FILE for a routing\n * mistake — which is exactly the failure the provider-only era's refusal existed to avoid, so it\n * must not reappear now that there are two locals instead of one.\n *\n * One dispatcher rather than a branch at each of the five call sites, because the five rungs are\n * the same decision reached for five different reasons; branching at each would be five places to\n * forget the office arm the day a sixth rung appears.\n */\n private async extractLocally(\n buffer: Buffer,\n fileId: string,\n mimeType: string,\n reason: string,\n ): Promise<FileTextExtractionResult> {\n if (LOCALLY_EXTRACTABLE_DOCUMENT_MIMES.has(mimeType.toLowerCase())) {\n return await this.extractFromOfficeDocument(buffer, fileId, mimeType.toLowerCase(), reason);\n }\n return await this.extractFromPDF(buffer, fileId, reason);\n }\n\n /**\n * OOXML / OpenDocument text, read locally (#434).\n *\n * `partCount` is reported as `pageCount` deliberately: for a `.pptx` it IS the slide count, and\n * for the others it is the closest honest analogue of \"how many units of this document were\n * read\". Inventing a page count by dividing characters would be a number an operator could\n * reasonably act on and that means nothing.\n *\n * An {@link OfficeDocumentExtractionError} is rethrown UNTOUCHED so the caller's classifier sees\n * it: every one of its failures is a statement about the document's own bytes — not a readable\n * ZIP, larger than the decompression bound, or holding none of the parts its type keeps text in\n * — which is precisely the unreadable-document bucket, and not the provider-unavailable one that\n * must protect an existing corpus.\n */\n private async extractFromOfficeDocument(\n buffer: Buffer,\n fileId: string,\n mimeType: string,\n reason: string,\n ): Promise<FileTextExtractionResult> {\n const extracted = await extractOfficeDocumentText(buffer, mimeType);\n\n this.logDebug('Extracted text from an Office/OpenDocument file with the local library', {\n fileId,\n mimeType,\n reason,\n partCount: extracted.partCount,\n characterCount: extracted.text.length,\n });\n\n return {\n text: extracted.text,\n metadata: {\n pageCount: extracted.partCount,\n characterCount: extracted.text.length,\n wordCount: extracted.text.split(/\\s+/).filter(Boolean).length,\n extractionPath: 'local-library',\n },\n };\n }\n\n private async extractFromPDF(buffer: Buffer, fileId: string, reason: string): Promise<FileTextExtractionResult> {\n const pdfjs = await import('pdfjs-dist/legacy/build/pdf.mjs');\n\n const loadingTask = pdfjs.getDocument({\n // A COPY, and it is mandatory rather than defensive. pdf.js transfers the backing\n // ArrayBuffer to its worker port and DETACHES it. For a small allocation Node's `Buffer`\n // is a window onto a SHARED 8 KB pool, so handing it `buffer` directly would detach a\n // region other, unrelated buffers are still using. `new Uint8Array(buffer)` copies out of\n // the pool into a private allocation. Costs 2x peak memory for the document; correctness\n // is worth it.\n data: new Uint8Array(buffer),\n // Not the hardening it looks like — measured against the shipped build 2026-08-27, and\n // recorded because the plausible reading is wrong in both directions.\n //\n // It does NOT stop a document reaching the host's font files: `useSystemFonts` only decides\n // whether the worker builds a CSS `local()` substitution descriptor, which is string\n // construction and opens nothing. And in Node it is ALREADY false by default.\n //\n // It is set explicitly for the opposite-facing reason: when `useSystemFonts` is true,\n // `fetchStandardFontData` early-returns null, which would make the `standardFontDataUrl`\n // below dead. Pinning it false is what keeps that parameter load-bearing.\n //\n // (A sibling `isEvalSupported: false` was written here first and removed: pdf.js 6 deleted\n // that option outright — zero occurrences in its types AND its shipped build — having\n // removed the eval-based font-compilation path. It type-errors, and would have advertised a\n // decision the library silently ignored.)\n useSystemFonts: false,\n standardFontDataUrl: resolveStandardFontDataPath(),\n });\n\n try {\n const pdfDocument = await loadingTask.promise;\n const pageTexts: string[] = [];\n\n for (let pageNumber = 1; pageNumber <= pdfDocument.numPages; pageNumber++) {\n const page = await pdfDocument.getPage(pageNumber);\n try {\n const textContent = await page.getTextContent();\n // Concatenate items HONOURING `hasEOL`, rather than joining every item with a space.\n //\n // pdf.js splits a visual line into several `TextItem`s at kerning and positioning\n // boundaries, so a blanket `join(' ')` inserts spaces INSIDE words on ordinary documents\n // and erases line structure entirely. That matters more here than it would in a viewer:\n // this string is what gets chunked and embedded, so the damage lands in the retrieval\n // corpus rather than on a screen where a human would notice it.\n //\n // `items` also mixes TextItem (which carries `str`) with TextMarkedContent (structural\n // markers, which do not). Narrowing on the property rather than casting keeps a future\n // pdf.js item kind from silently stringifying as `undefined`.\n let pageText = '';\n for (const item of textContent.items) {\n if (!('str' in item)) continue;\n pageText += item.str;\n if (item.hasEOL) pageText += '\\n';\n }\n pageTexts.push(pageText);\n } finally {\n page.cleanup();\n }\n }\n\n const text = pageTexts.join('\\n');\n\n this.logDebug('Extracted text from PDF via the local pdfjs-dist path', {\n fileId,\n pageCount: pdfDocument.numPages,\n characterCount: text.length,\n reason,\n });\n\n return {\n text,\n metadata: {\n pageCount: pdfDocument.numPages,\n characterCount: text.length,\n wordCount: text.split(/\\s+/).filter(Boolean).length,\n // Which path served this extraction, and why. Carried in the RESULT rather than only in\n // a log line so a caller (and a test) can assert the routing without scraping logs.\n extractionPath: 'local-library',\n extractionPathReason: reason,\n },\n };\n } finally {\n // `destroy()` lives on the LOADING TASK, not on the document proxy — `pdfDocument.destroy` is\n // not a function in pdfjs-dist 6.x. Skipping this leaks the document's worker port.\n //\n // Swallowed deliberately: `destroy()` can itself throw, and a throw from a `finally` REPLACES\n // the in-flight error. The caller classifies on that original error to decide whether a\n // document is permanently unreadable or the storage layer is merely down, so losing it would\n // corrupt exactly the decision this method exists to inform.\n await loadingTask.destroy().catch(() => undefined);\n }\n }\n\n /** Drain a download stream into a single buffer. Shared by every extraction path. */\n private async collectStream(stream: Readable): Promise<Buffer> {\n const chunks: Buffer[] = [];\n for await (const chunk of stream) {\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n }\n return Buffer.concat(chunks);\n }\n}\n"]}
|