@wildo-ai/saas-backend-lib 1.1.3 → 1.1.4

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.
Files changed (1056) hide show
  1. package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +1 -1
  2. package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +1 -1
  3. package/dist/esm/__tests__/setup.d.ts.map +1 -1
  4. package/dist/esm/__tests__/test-container.d.ts.map +1 -1
  5. package/dist/esm/applications/models/applications.backend.schemas.d.ts.map +1 -1
  6. package/dist/esm/applications/seeds/application-metadata-defaults.seeds.d.ts.map +1 -1
  7. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  8. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  9. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  10. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  11. package/dist/esm/base-classes/models/repositories.backend.schemas.d.ts.map +1 -1
  12. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +1 -1
  13. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +1 -1
  14. package/dist/esm/base-classes/services/batches/batches-cronjobs-custom-execution.service.d.ts.map +1 -1
  15. package/dist/esm/base-classes/services/batches/batches-cronjobs-executor.backend.service.d.ts.map +1 -1
  16. package/dist/esm/base-classes/services/batches/batches-cronjobs-resource-execution.backend.service.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -1
  19. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -1
  20. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +12 -1
  21. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -1
  22. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  23. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  24. package/dist/esm/base-classes/services/batches/resource-retention-sweep.batch.backend.service.d.ts.map +1 -1
  25. package/dist/esm/base-classes/services/batches/suspension-reactivation-sweep.batch.backend.service.d.ts.map +1 -1
  26. package/dist/esm/base-classes/services/controllers/abstract-controller.backend.service.d.ts.map +1 -1
  27. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  28. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  29. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  30. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  31. package/dist/esm/base-classes/services/controllers/utils/audit-access-fields.backend.utils.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/controllers/utils/operation-response-serializer.backend.utils.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/controllers/validate-field-handler.backend.service.d.ts.map +1 -1
  34. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +1 -1
  35. package/dist/esm/base-classes/services/repositories/__tests__/mock-repositories-registry-handler.service.d.ts.map +1 -1
  36. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-filter-translation.backend.d.ts.map +1 -1
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +13 -4
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-query.backend.d.ts.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +17 -0
  44. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  46. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  47. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -1
  48. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/http-api/http-api-row-projection.backend.d.ts.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/http-api/http-api-subject-erasure-effect.backend.d.ts.map +1 -1
  51. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  54. package/dist/esm/base-classes/services/repositories/http-api/odoo-jsonrpc-compiler.backend.d.ts.map +1 -1
  55. package/dist/esm/base-classes/services/repositories/http-api/rest-json-query-compiler.backend.d.ts.map +1 -1
  56. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  58. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  59. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  60. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +57 -0
  61. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  62. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +95 -2
  63. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  64. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  65. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  66. package/dist/esm/base-classes/services/repositories/repository-guarded-mutation.backend.types.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +5 -2
  68. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  69. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +14 -3
  70. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  71. package/dist/esm/base-classes/services/repositories/repository-version-metadata.backend.utils.d.ts.map +1 -1
  72. package/dist/esm/base-classes/services/repositories/resource-write-integrity.backend.d.ts.map +1 -1
  73. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts +72 -0
  74. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts.map +1 -0
  75. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js +88 -0
  76. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js.map +1 -0
  77. package/dist/esm/base-classes/services/repositories/unique-constraint-conflict-reference.backend.d.ts.map +1 -1
  78. package/dist/esm/base-classes/services/resource-operations-helper.backend.service.d.ts.map +1 -1
  79. package/dist/esm/base-classes/services/services/__tests__/mock-services-registry-handler.service.d.ts.map +1 -1
  80. package/dist/esm/base-classes/services/services/__tests__/mock-system-access.service.d.ts.map +1 -1
  81. package/dist/esm/base-classes/services/services/read-only-field-change.backend.utils.d.ts.map +1 -1
  82. package/dist/esm/base-classes/services/services/resource-operation-audit-emission.backend.utils.d.ts.map +1 -1
  83. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  84. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  85. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts.map +1 -1
  86. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts.map +1 -1
  87. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  88. package/dist/esm/base-classes/services/services/resource-operation-server-injected-fields.backend.utils.d.ts.map +1 -1
  89. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts.map +1 -1
  90. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  91. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  92. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  93. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  94. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  95. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +44 -6
  96. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  97. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  98. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  99. package/dist/esm/base-classes/utils/backend-type-utils.d.ts.map +1 -1
  100. package/dist/esm/base-classes/utils/single-subject-addressing.backend.utils.d.ts.map +1 -1
  101. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -1
  102. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -1
  103. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -1
  104. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -1
  105. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -1
  106. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -1
  107. package/dist/esm/billing/services/back-office/abstract-billing.backend.service.d.ts.map +1 -1
  108. package/dist/esm/billing/services/back-office/billing-feature-sync.backend.service.d.ts.map +1 -1
  109. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +1 -1
  110. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -1
  111. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +5 -4
  112. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -1
  113. package/dist/esm/billing/services/back-office/billing-state.backend.service.d.ts.map +1 -1
  114. package/dist/esm/billing/services/back-office/billing-state.backend.service.js +11 -1
  115. package/dist/esm/billing/services/back-office/billing-state.backend.service.js.map +1 -1
  116. package/dist/esm/billing/services/back-office/billing-subject-erasure-effect.backend.d.ts.map +1 -1
  117. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  118. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  119. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  120. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  121. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -1
  122. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -1
  123. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  124. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  125. package/dist/esm/billing/services/billing.utils.d.ts.map +1 -1
  126. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  127. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  128. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +32 -0
  129. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  130. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +32 -1
  131. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  132. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  133. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  134. package/dist/esm/billing/services/custom-impl/credit-pool.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  135. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  136. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  137. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  138. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  139. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +9 -6
  140. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  141. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +9 -6
  142. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  143. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -1
  144. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -1
  145. package/dist/esm/billing/services/webhooks/billing-webhook-adapter.backend.service.d.ts.map +1 -1
  146. package/dist/esm/billing/services/webhooks/billing-webhook-capability-handler.backend.service.d.ts.map +1 -1
  147. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  148. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +50 -3
  149. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  150. package/dist/esm/billing/testing/billing-test-fixtures.d.ts.map +1 -1
  151. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  152. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  153. package/dist/esm/charts/controllers/chart.backend.controller.d.ts.map +1 -1
  154. package/dist/esm/charts/services/chart-registry.backend.service.d.ts +80 -7
  155. package/dist/esm/charts/services/chart-registry.backend.service.d.ts.map +1 -1
  156. package/dist/esm/charts/services/chart-registry.backend.service.js +115 -8
  157. package/dist/esm/charts/services/chart-registry.backend.service.js.map +1 -1
  158. package/dist/esm/companion-exports.d.ts.map +1 -1
  159. package/dist/esm/compliance/audit-trails/audit-logs.custom-impl.backend.service.d.ts.map +1 -1
  160. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.d.ts.map +1 -1
  161. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  162. package/dist/esm/compliance/audit-trails/batches/immudb-audit-reconcile.batch.backend.service.d.ts.map +1 -1
  163. package/dist/esm/compliance/audit-trails/batches/siem-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  164. package/dist/esm/compliance/audit-trails/services/__tests__/mock-audit-logs.service.d.ts.map +1 -1
  165. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  166. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  167. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +107 -4
  168. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  169. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +176 -5
  170. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  171. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  172. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  173. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  174. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  175. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  176. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  177. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -1
  178. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -1
  179. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  180. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +21 -0
  181. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  182. package/dist/esm/compliance/audit-trails/services/utils/ocsf-class-mapping.backend.utils.d.ts.map +1 -1
  183. package/dist/esm/compliance/audit-trails/services/utils/siem-dictionary.backend.utils.d.ts.map +1 -1
  184. package/dist/esm/compliance/audit-trails/services/utils/siem-ocsf-projection.backend.utils.d.ts.map +1 -1
  185. package/dist/esm/compliance/audit-trails/services/utils/siem-projection-contract.backend.utils.d.ts.map +1 -1
  186. package/dist/esm/compliance/audit-trails/utils/audit-actor.backend.utils.d.ts.map +1 -1
  187. package/dist/esm/compliance/audit-trails/utils/layer2-audit-provider-boot-diagnostic.backend.utils.d.ts.map +1 -1
  188. package/dist/esm/compliance/index.d.ts.map +1 -1
  189. package/dist/esm/compliance/privacy/retention-hide-predicate.backend.d.ts.map +1 -1
  190. package/dist/esm/compliance/privacy/services/subject-erasure-external-effects.backend.service.d.ts.map +1 -1
  191. package/dist/esm/compliance/privacy/services/subject-session-revocation.backend.service.d.ts.map +1 -1
  192. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  193. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  194. package/dist/esm/config/bootstrap/minion-initialization-projection.backend.d.ts.map +1 -1
  195. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.d.ts.map +1 -1
  196. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js +3 -0
  197. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js.map +1 -1
  198. package/dist/esm/config/bootstrap/runtime-principal.backend.service.d.ts.map +1 -1
  199. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  200. package/dist/esm/config/models/app-config-secrets.backend.schemas.d.ts.map +1 -1
  201. package/dist/esm/config/models/app-config.backend-authored.definitions.d.ts.map +1 -1
  202. package/dist/esm/config/models/app-config.backend.schemas.d.ts +4 -4
  203. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  204. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  205. package/dist/esm/config/models/app-env-config.backend.schemas.d.ts.map +1 -1
  206. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts +36 -0
  207. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts.map +1 -0
  208. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js +36 -0
  209. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js.map +1 -0
  210. package/dist/esm/config/models/config-mutation-boundary.utils.d.ts.map +1 -1
  211. package/dist/esm/config/models/postgresql-env-config.backend.schemas.d.ts.map +1 -1
  212. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  213. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  214. package/dist/esm/config/models/runtime-topology.backend.contracts.d.ts.map +1 -1
  215. package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +1 -1
  216. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  217. package/dist/esm/config/services/app-configuration-loader.backend.service.js +3 -0
  218. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  219. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  220. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  221. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  222. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  223. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +12 -0
  224. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  225. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +28 -0
  226. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  227. package/dist/esm/data-seeding/batches/data-seeding-run-cleanup.batch.backend.service.d.ts.map +1 -1
  228. package/dist/esm/data-seeding/batches/data-seeding-scheduled-rerun.batch.backend.service.d.ts.map +1 -1
  229. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.contracts.d.ts.map +1 -1
  230. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.controller.d.ts.map +1 -1
  231. package/dist/esm/data-seeding/data-seeding-models.d.ts.map +1 -1
  232. package/dist/esm/data-seeding/models/business-key-resolver.shared.utils.d.ts.map +1 -1
  233. package/dist/esm/data-seeding/models/data-seed-execution-context.shared.types.d.ts.map +1 -1
  234. package/dist/esm/data-seeding/models/data-seed-migrator-runner.shared.utils.d.ts.map +1 -1
  235. package/dist/esm/data-seeding/models/data-seed-reconciler.shared.utils.d.ts.map +1 -1
  236. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.schemas.d.ts.map +1 -1
  237. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.utils.d.ts.map +1 -1
  238. package/dist/esm/data-seeding/models/data-seed-run.shared.resources-config.schemas.d.ts.map +1 -1
  239. package/dist/esm/data-seeding/models/data-seed-run.shared.schemas.d.ts.map +1 -1
  240. package/dist/esm/data-seeding/models/data-seed-trigger-mode-matrix.shared.utils.d.ts.map +1 -1
  241. package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
  242. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
  243. package/dist/esm/data-seeding/services/data-seed-dispatcher.backend.service.d.ts.map +1 -1
  244. package/dist/esm/data-seeding/services/data-seed-registry.backend.service.d.ts.map +1 -1
  245. package/dist/esm/data-seeding/services/data-seed-scope-resolver-registry.backend.service.d.ts.map +1 -1
  246. package/dist/esm/data-seeding/services/engines/additive-seed-engine.backend.service.d.ts.map +1 -1
  247. package/dist/esm/data-seeding/services/engines/lazy-seed-engine.backend.service.d.ts.map +1 -1
  248. package/dist/esm/data-seeding/services/engines/manual-seed-engine.backend.service.d.ts.map +1 -1
  249. package/dist/esm/data-seeding/services/engines/sync-seed-engine.backend.service.d.ts.map +1 -1
  250. package/dist/esm/data-seeding/services/engines/upgrade-seed-engine.backend.service.d.ts.map +1 -1
  251. package/dist/esm/data-seeding/services/shared/data-seed-business-key.shared.utils.d.ts.map +1 -1
  252. package/dist/esm/data-seeding/services/shared/data-seed-error.shared.utils.d.ts.map +1 -1
  253. package/dist/esm/data-seeding/services/shared/data-seed-run-counters.shared.types.d.ts.map +1 -1
  254. package/dist/esm/data-seeding/services/shared/data-seed-run-ledger.backend.d.ts.map +1 -1
  255. package/dist/esm/data-seeding/services/shared/data-seed-scope-anchor.shared.types.d.ts.map +1 -1
  256. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts.map +1 -1
  257. package/dist/esm/data-seeding/services/shared/data-seed-scope-resolution.backend.d.ts.map +1 -1
  258. package/dist/esm/databases/models/aggregation.backend.schemas.d.ts.map +1 -1
  259. package/dist/esm/databases/models/databases.backend.schemas.d.ts.map +1 -1
  260. package/dist/esm/databases/models/filter.backend.schemas.d.ts.map +1 -1
  261. package/dist/esm/databases/models/resolve-persistence-adapter.backend.utils.d.ts.map +1 -1
  262. package/dist/esm/databases/models/sql.backend.schemas.d.ts.map +1 -1
  263. package/dist/esm/databases/models/transaction.shared.schemas.d.ts.map +1 -1
  264. package/dist/esm/databases/services/__tests__/mock-mongo-transaction-registry.service.d.ts.map +1 -1
  265. package/dist/esm/databases/services/__tests__/mock-mongodb.service.d.ts.map +1 -1
  266. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +1 -1
  267. package/dist/esm/databases/services/__tests__/mock-redis.service.d.ts.map +1 -1
  268. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +1 -1
  269. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  270. package/dist/esm/databases/services/aggregation/aggregation-query.backend.service.d.ts.map +1 -1
  271. package/dist/esm/databases/services/aggregation/computed-measure-evaluator.backend.service.d.ts.map +1 -1
  272. package/dist/esm/databases/services/aggregation/field-access-validator.backend.service.d.ts.map +1 -1
  273. package/dist/esm/databases/services/aggregation/time-series-densifier.backend.service.d.ts.map +1 -1
  274. package/dist/esm/databases/services/aggregation/topn-processor.backend.service.d.ts.map +1 -1
  275. package/dist/esm/databases/services/aggregation/window-function-processor.backend.service.d.ts.map +1 -1
  276. package/dist/esm/databases/services/db-utils.d.ts.map +1 -1
  277. package/dist/esm/databases/services/mongo-aggregation.backend.service.d.ts.map +1 -1
  278. package/dist/esm/databases/services/mongodb.service.d.ts.map +1 -1
  279. package/dist/esm/databases/services/postgresql-aggregation.backend.service.d.ts.map +1 -1
  280. package/dist/esm/databases/services/postgresql-database.backend.service.d.ts.map +1 -1
  281. package/dist/esm/databases/services/postgresql-development-provisioning.backend.d.ts.map +1 -1
  282. package/dist/esm/databases/services/postgresql-filter.backend.service.d.ts.map +1 -1
  283. package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
  284. package/dist/esm/databases/services/postgresql-schema-ddl.backend.d.ts.map +1 -1
  285. package/dist/esm/databases/services/postgresql-schema-migration-sql.backend.d.ts.map +1 -1
  286. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  287. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  288. package/dist/esm/databases/services/postgresql-schema-plan-lockfile.backend.d.ts.map +1 -1
  289. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  290. package/dist/esm/databases/services/resource-persistence-unit-of-work.backend.service.d.ts.map +1 -1
  291. package/dist/esm/databases/services/schema-planning-standalone.backend.d.ts.map +1 -1
  292. package/dist/esm/databases/services/zod-to-mongoose-schema-convertor.backend.service.d.ts.map +1 -1
  293. package/dist/esm/databases/services/zod-to-sql-hybrid-schema.planner.d.ts.map +1 -1
  294. package/dist/esm/databases/utils/postgresql-identifier.backend.utils.d.ts.map +1 -1
  295. package/dist/esm/errors/services/__tests__/mock-error-builder.service.d.ts.map +1 -1
  296. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  297. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  298. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  299. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  300. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  301. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  302. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  303. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  304. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  305. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  306. package/dist/esm/external-data/batches/external-data-pipeline-scheduled-run.batch.backend.service.d.ts.map +1 -1
  307. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -1
  308. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -1
  309. package/dist/esm/external-data/external-data-extraction-source.backend.d.ts.map +1 -1
  310. package/dist/esm/external-data/external-data-models.exports.d.ts.map +1 -1
  311. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  312. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  313. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  314. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  315. package/dist/esm/external-providers/models/external-providers.backend.schemas.d.ts.map +1 -1
  316. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  317. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  318. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +102 -52
  319. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -1
  320. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +117 -71
  321. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -1
  322. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -1
  323. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -1
  324. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -1
  325. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +26 -7
  326. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -1
  327. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -1
  328. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -1
  329. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  330. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  331. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -1
  332. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -1
  333. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  334. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  335. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts +81 -34
  336. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  337. package/dist/esm/external-providers/services/document-extraction.backend.service.js +179 -98
  338. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  339. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  340. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  341. package/dist/esm/external-providers/services/external-api-handler.backend.service.d.ts.map +1 -1
  342. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +121 -0
  343. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  344. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +151 -0
  345. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  346. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts +15 -1
  347. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  348. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +60 -4
  349. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  350. package/dist/esm/features/controllers/features.backend.controller.d.ts.map +1 -1
  351. package/dist/esm/features/services/__tests__/mock-feature-definition-registry.service.d.ts.map +1 -1
  352. package/dist/esm/features/services/__tests__/mock-feature-resolution.service.d.ts.map +1 -1
  353. package/dist/esm/features/services/application-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  354. package/dist/esm/features/services/feature-definition-registry.backend.service.d.ts.map +1 -1
  355. package/dist/esm/features/services/feature-gate.backend.service.d.ts.map +1 -1
  356. package/dist/esm/features/services/feature-resolution.backend.service.d.ts.map +1 -1
  357. package/dist/esm/features/services/organization-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  358. package/dist/esm/features/services/scope-feature-ledger-relationship.backend.utils.d.ts.map +1 -1
  359. package/dist/esm/features/services/scope-features-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  360. package/dist/esm/features/testing/feature-test-utils.d.ts.map +1 -1
  361. package/dist/esm/files/batches/files-cleanup.batch.backend.service.d.ts.map +1 -1
  362. package/dist/esm/files/constraints/file-analyzers.types.d.ts.map +1 -1
  363. package/dist/esm/files/constraints/file-constraint-resolver-chain.backend.service.d.ts.map +1 -1
  364. package/dist/esm/files/constraints/file-constraint.types.d.ts.map +1 -1
  365. package/dist/esm/files/constraints/file-validation.backend.service.d.ts.map +1 -1
  366. package/dist/esm/files/constraints/resource-field-constraint-resolver.backend.service.d.ts.map +1 -1
  367. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  368. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  369. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -1
  370. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -1
  371. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +37 -0
  372. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  373. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +221 -21
  374. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  375. package/dist/esm/files/scanning/clamav-scanner.backend.service.d.ts.map +1 -1
  376. package/dist/esm/files/scanning/file-scan.types.d.ts.map +1 -1
  377. package/dist/esm/files/scanning/yara-scanner.backend.service.d.ts.map +1 -1
  378. package/dist/esm/files/scanning/yara-scanner.backend.service.js +20 -2
  379. package/dist/esm/files/scanning/yara-scanner.backend.service.js.map +1 -1
  380. package/dist/esm/files/services/__tests__/mock-file-field-detection.service.d.ts.map +1 -1
  381. package/dist/esm/files/services/__tests__/mock-file-operation-handler.service.d.ts.map +1 -1
  382. package/dist/esm/files/services/__tests__/mock-file-repository.service.d.ts.map +1 -1
  383. package/dist/esm/files/services/file-field-detection.backend.service.d.ts.map +1 -1
  384. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  385. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  386. package/dist/esm/files/services/file-population.backend.service.d.ts.map +1 -1
  387. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  388. package/dist/esm/files/services/file-scanning.backend.service.js +5 -0
  389. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  390. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  391. package/dist/esm/files/services/file-text-extraction.backend.service.js +8 -5
  392. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  393. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  394. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  395. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  396. package/dist/esm/files/services/files.backend.service.js +3 -1
  397. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  398. package/dist/esm/files/services/rag-source-field-detection.backend.service.d.ts.map +1 -1
  399. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -1
  400. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -1
  401. package/dist/esm/files/storage/file-storage-path-resolver.backend.service.d.ts.map +1 -1
  402. package/dist/esm/files/storage/file-storage-provider.types.d.ts +36 -1
  403. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  404. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  405. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts +21 -3
  406. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts.map +1 -1
  407. package/dist/esm/files/storage/file-storage-router.backend.service.js +38 -5
  408. package/dist/esm/files/storage/file-storage-router.backend.service.js.map +1 -1
  409. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts +87 -0
  410. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts.map +1 -0
  411. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js +340 -0
  412. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js.map +1 -0
  413. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  414. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  415. package/dist/esm/files/storage/storage-credential-provider.backend.utils.d.ts.map +1 -1
  416. package/dist/esm/files/storage/storage-platform-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  417. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  418. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js +10 -3
  419. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js.map +1 -1
  420. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  421. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  422. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  423. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  424. package/dist/esm/files/utils/file-upload.utils.d.ts.map +1 -1
  425. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  426. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  427. package/dist/esm/files/utils/file-validation.utils.d.ts.map +1 -1
  428. package/dist/esm/files/utils/image-derivation.backend.utils.d.ts.map +1 -1
  429. package/dist/esm/files/utils/image-thumbnail.backend.utils.d.ts.map +1 -1
  430. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -1
  431. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -1
  432. package/dist/esm/files/utils/rag-source-field-schema-path.backend.utils.d.ts.map +1 -1
  433. package/dist/esm/files/utils/storage-application-identity.backend.utils.d.ts.map +1 -1
  434. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  435. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  436. package/dist/esm/flows-actors/a2a/batches/a2a-push-delivery.batch.backend.service.d.ts.map +1 -1
  437. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  438. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  439. package/dist/esm/flows-actors/a2a/models/a2a-dialect.backend.schemas.d.ts.map +1 -1
  440. package/dist/esm/flows-actors/a2a/models/a2a-push-notification-delivery.backend.utils.d.ts.map +1 -1
  441. package/dist/esm/flows-actors/a2a/models/a2a-push-notification.backend.schemas.d.ts.map +1 -1
  442. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  443. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  444. package/dist/esm/flows-actors/a2a/services/a2a-push-delivery-log.repository.d.ts.map +1 -1
  445. package/dist/esm/flows-actors/a2a/services/a2a-push-dispatcher.backend.service.d.ts.map +1 -1
  446. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  447. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  448. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  449. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  450. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  451. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  452. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  453. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  454. package/dist/esm/flows-actors/controllers/flows-actors.controller.d.ts.map +1 -1
  455. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  456. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  457. package/dist/esm/flows-actors/models/agent-facets.backend.definitions.d.ts.map +1 -1
  458. package/dist/esm/flows-actors/models/agents.backend.definitions.d.ts.map +1 -1
  459. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  460. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  461. package/dist/esm/flows-actors/models/flows-actors.backend.definitions.d.ts.map +1 -1
  462. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  463. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  464. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +107 -16
  465. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  466. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +118 -18
  467. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  468. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  469. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  470. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -1
  471. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -1
  472. package/dist/esm/flows-actors/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +1 -1
  473. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  474. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  475. package/dist/esm/flows-actors/services/agent-call-trace-sink.backend.d.ts.map +1 -1
  476. package/dist/esm/flows-actors/services/agent-facets.backend.service.d.ts.map +1 -1
  477. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +104 -5
  478. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  479. package/dist/esm/flows-actors/services/agents.backend.service.js +263 -31
  480. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  481. package/dist/esm/flows-actors/services/context-curation.backend.service.d.ts.map +1 -1
  482. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +46 -1
  483. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  484. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +193 -6
  485. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  486. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  487. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  488. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  489. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  490. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  491. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  492. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -1
  493. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +3 -0
  494. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -1
  495. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts +99 -0
  496. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts.map +1 -0
  497. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js +155 -0
  498. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js.map +1 -0
  499. package/dist/esm/flows-actors/services/meta-workflow-evaluation-treatment-compiler.backend.service.d.ts.map +1 -1
  500. package/dist/esm/flows-actors/services/meta-workflow-standard-action-contracts.backend.service.d.ts.map +1 -1
  501. package/dist/esm/flows-actors/services/meta-workflow-standard-evaluation-contracts.backend.service.d.ts.map +1 -1
  502. package/dist/esm/flows-actors/services/meta-workflow-structured-artifact-action-compiler.backend.service.d.ts.map +1 -1
  503. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  504. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  505. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  506. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +9 -0
  507. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  508. package/dist/esm/flows-actors/utils/bounded-subprocess.backend.utils.d.ts.map +1 -1
  509. package/dist/esm/flows-actors/utils/flows-actors-frontend-extractor.utils.d.ts.map +1 -1
  510. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  511. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  512. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  513. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  514. package/dist/esm/flows-actors/utils/prompt-ir-adapters.backend.utils.d.ts.map +1 -1
  515. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts +77 -0
  516. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts.map +1 -0
  517. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js +164 -0
  518. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js.map +1 -0
  519. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts +48 -0
  520. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts.map +1 -0
  521. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js +101 -0
  522. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js.map +1 -0
  523. package/dist/esm/guidance/batches/dormancy-detection.batch.backend.service.d.ts.map +1 -1
  524. package/dist/esm/guidance/services/guidance-trigger-evaluator.backend.service.d.ts.map +1 -1
  525. package/dist/esm/guidance/services/lifecycle-custom-implementations.backend.d.ts.map +1 -1
  526. package/dist/esm/guidance/services/lifecycle-evaluator.backend.service.d.ts.map +1 -1
  527. package/dist/esm/guidance/services/lifecycle-scope-id.backend.utils.d.ts.map +1 -1
  528. package/dist/esm/guidance/services/milestone-condition-registry.backend.service.d.ts.map +1 -1
  529. package/dist/esm/guidance/services/milestone-definition-registry.backend.service.d.ts.map +1 -1
  530. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  531. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  532. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -1
  533. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -1
  534. package/dist/esm/guidance/services/scoped-state-read-custom-implementations.backend.d.ts.map +1 -1
  535. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  536. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  537. package/dist/esm/i18n/services/i18n.backend.service.d.ts.map +1 -1
  538. package/dist/esm/index.d.ts +0 -1
  539. package/dist/esm/index.d.ts.map +1 -1
  540. package/dist/esm/index.js +0 -1
  541. package/dist/esm/index.js.map +1 -1
  542. package/dist/esm/inject/models/container.d.ts +10 -0
  543. package/dist/esm/inject/models/container.d.ts.map +1 -1
  544. package/dist/esm/inject/models/container.js +49 -1
  545. package/dist/esm/inject/models/container.js.map +1 -1
  546. package/dist/esm/inject/models/service-types.d.ts +3 -0
  547. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  548. package/dist/esm/inject/models/service-types.js +3 -0
  549. package/dist/esm/inject/models/service-types.js.map +1 -1
  550. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  551. package/dist/esm/mcp/controllers/mcp.controller.js +50 -3
  552. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  553. package/dist/esm/mcp/models/mcp-protocol.backend.schemas.d.ts.map +1 -1
  554. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  555. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  556. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  557. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  558. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  559. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  560. package/dist/esm/mcp/services/resource-server-instances-registry.backend.service.d.ts.map +1 -1
  561. package/dist/esm/mcp/utils/zod-to-mcp-json-schema.backend.utils.d.ts.map +1 -1
  562. package/dist/esm/meta-workflow-runtime.exports.d.ts.map +1 -1
  563. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  564. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  565. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -1
  566. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -1
  567. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  568. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  569. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  570. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  571. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  572. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  573. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +1 -1
  574. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  575. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  576. package/dist/esm/monitoring/logger/services/logger.service.js +3 -3
  577. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  578. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -1
  579. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -1
  580. package/dist/esm/monitoring/logger/utils/log-value-normalization.backend.utils.d.ts.map +1 -1
  581. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +10 -6
  582. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -1
  583. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +10 -6
  584. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -1
  585. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  586. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  587. package/dist/esm/monitoring/observability/otel-preload.d.ts.map +1 -1
  588. package/dist/esm/monitoring/observability/otel-sdk-global-handle.d.ts.map +1 -1
  589. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +1 -1
  590. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  591. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  592. package/dist/esm/monitoring/observability/services/observability.backend.service.d.ts.map +1 -1
  593. package/dist/esm/notifications/email/components/email-components.d.ts.map +1 -1
  594. package/dist/esm/notifications/email/models/email-template-definition.d.ts.map +1 -1
  595. package/dist/esm/notifications/email/models/email-transport.backend.definitions.d.ts.map +1 -1
  596. package/dist/esm/notifications/email/services/email-batch-send.batch.backend.service.d.ts.map +1 -1
  597. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  598. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  599. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  600. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  601. package/dist/esm/notifications/email/services/email.backend.service.d.ts +47 -6
  602. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  603. package/dist/esm/notifications/email/services/email.backend.service.js +86 -36
  604. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  605. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  606. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  607. package/dist/esm/notifications/email/utils/interpolate-email-label.utils.d.ts.map +1 -1
  608. package/dist/esm/notifications/email/utils/zod-to-typescript.utils.d.ts.map +1 -1
  609. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  610. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  611. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  612. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  613. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts +32 -0
  614. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts.map +1 -0
  615. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js +32 -0
  616. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js.map +1 -0
  617. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +64 -10
  618. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  619. package/dist/esm/notifications/sms/services/sms.backend.service.js +277 -82
  620. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  621. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  622. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  623. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  624. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  625. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  626. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  627. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  628. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.d.ts.map +1 -1
  629. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.repository.d.ts.map +1 -1
  630. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-dispatcher.backend.service.d.ts.map +1 -1
  631. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service.d.ts.map +1 -1
  632. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  633. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  634. package/dist/esm/notifications/webhooks/outbound/services/webhook-config.backend.service.d.ts.map +1 -1
  635. package/dist/esm/notifications/webhooks/services/polymorphic-lookup.backend.service.d.ts.map +1 -1
  636. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  637. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  638. package/dist/esm/organizations/batches/organization-member-invitation-sweep.batch.backend.service.d.ts.map +1 -1
  639. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts.map +1 -1
  640. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  641. package/dist/esm/organizations/services/authority-change-audit.backend.utils.d.ts.map +1 -1
  642. package/dist/esm/organizations/services/invitation-acceptance.backend.utils.d.ts.map +1 -1
  643. package/dist/esm/organizations/services/org-creation-on-registration.backend.utils.d.ts.map +1 -1
  644. package/dist/esm/organizations/services/org-member-roles-validation.backend.utils.d.ts.map +1 -1
  645. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  646. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  647. package/dist/esm/organizations/services/organization-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  648. package/dist/esm/organizations/services/organization-member-custom-implementation.backend.service.d.ts.map +1 -1
  649. package/dist/esm/organizations/services/organization-onboarding-operation.backend.utils.d.ts.map +1 -1
  650. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  651. package/dist/esm/organizations/services/organization-unit-member-custom-implementation.backend.service.d.ts.map +1 -1
  652. package/dist/esm/organizations/services/scim-provisioning-gate.backend.utils.d.ts.map +1 -1
  653. package/dist/esm/organizations/services/user-org-type-grant.backend.utils.d.ts.map +1 -1
  654. package/dist/esm/organizations/services/user-type-revocation-on-org-leave.backend.utils.d.ts.map +1 -1
  655. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +1 -1
  656. package/dist/esm/pdf-templates/models/pdf-template-binding.d.ts.map +1 -1
  657. package/dist/esm/pdf-templates/models/pdf-template-definition.d.ts.map +1 -1
  658. package/dist/esm/pdf-templates/services/pdf-generated-file-writer.backend.service.d.ts.map +1 -1
  659. package/dist/esm/pdf-templates/services/pdf-generation-orchestrator.backend.service.d.ts.map +1 -1
  660. package/dist/esm/pdf-templates/services/pdf-renderer.backend.service.d.ts.map +1 -1
  661. package/dist/esm/pdf-templates/services/pdf-template-binding.backend.service.d.ts.map +1 -1
  662. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -1
  663. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -1
  664. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -1
  665. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -1
  666. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -1
  667. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -1
  668. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -1
  669. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -1
  670. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  671. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  672. package/dist/esm/queue/apps-crontabs-manager.backend.service.d.ts.map +1 -1
  673. package/dist/esm/queue/cron-job-sync.backend.service.d.ts.map +1 -1
  674. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  675. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  676. package/dist/esm/queue/job-completion-registry.backend.service.d.ts.map +1 -1
  677. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  678. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  679. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  680. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  681. package/dist/esm/queue/job-payload-storage.backend.service.d.ts.map +1 -1
  682. package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
  683. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  684. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  685. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  686. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  687. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  688. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  689. package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
  690. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  691. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  692. package/dist/esm/rag/batches/rag-embedding-drain.batch.backend.service.d.ts.map +1 -1
  693. package/dist/esm/rag/batches/rag-reconciliation-sweep.batch.backend.service.d.ts.map +1 -1
  694. package/dist/esm/rag/models/rag-chunk-store.backend.types.d.ts.map +1 -1
  695. package/dist/esm/rag/models/rag-retrieval.backend.types.d.ts.map +1 -1
  696. package/dist/esm/rag/services/mongodb-rag-chunk-store.backend.service.d.ts.map +1 -1
  697. package/dist/esm/rag/services/postgresql-rag-chunk-store.backend.service.d.ts.map +1 -1
  698. package/dist/esm/rag/services/rag-chunk-collection.mongodb-ddl.backend.d.ts.map +1 -1
  699. package/dist/esm/rag/services/rag-chunk-retrieval.mongodb-query.backend.d.ts.map +1 -1
  700. package/dist/esm/rag/services/rag-chunk-retrieval.postgresql-query.backend.d.ts.map +1 -1
  701. package/dist/esm/rag/services/rag-chunk-store.backend.service.d.ts.map +1 -1
  702. package/dist/esm/rag/services/rag-chunk-table.postgresql-ddl.backend.d.ts.map +1 -1
  703. package/dist/esm/rag/services/rag-ingestion.backend.service.d.ts.map +1 -1
  704. package/dist/esm/rag/services/rag-retrieval.backend.service.d.ts.map +1 -1
  705. package/dist/esm/rag/utils/rag-chunk-fusion.backend.utils.d.ts.map +1 -1
  706. package/dist/esm/rag/utils/rag-chunk-removal.backend.utils.d.ts.map +1 -1
  707. package/dist/esm/rag/utils/rag-chunk-row-shaping.backend.utils.d.ts.map +1 -1
  708. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  709. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  710. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  711. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  712. package/dist/esm/rag/utils/rag-ingestion-trigger.backend.utils.d.ts.map +1 -1
  713. package/dist/esm/rag/utils/rag-retrieval-scope.backend.utils.d.ts.map +1 -1
  714. package/dist/esm/rag/utils/rag-source-field-value.backend.utils.d.ts.map +1 -1
  715. package/dist/esm/requests/models/api-routes.backend.defintions.d.ts.map +1 -1
  716. package/dist/esm/requests/models/requests.backend.schemas.d.ts.map +1 -1
  717. package/dist/esm/requests/service/platform-mutualized-handler.backend.service.d.ts.map +1 -1
  718. package/dist/esm/requests/service/platform-requests.backend.utils.d.ts.map +1 -1
  719. package/dist/esm/requests/service/remote-client-base.backend.service.d.ts.map +1 -1
  720. package/dist/esm/requests/service/serverless-services-handler.backend.service.d.ts.map +1 -1
  721. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  722. package/dist/esm/requests/service/websocket.service.js +49 -1
  723. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  724. package/dist/esm/resources/backend-resource-registry.exports.d.ts.map +1 -1
  725. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  726. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +2 -0
  727. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  728. package/dist/esm/resources/models/index.d.ts.map +1 -1
  729. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  730. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  731. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  732. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  733. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  734. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  735. package/dist/esm/resources/models/resources.backend.schemas.d.ts.map +1 -1
  736. package/dist/esm/resources/models/virtual-fields.backend.types.d.ts.map +1 -1
  737. package/dist/esm/resources/services/__tests__/mock-resources-registry.service.d.ts.map +1 -1
  738. package/dist/esm/resources/services/resource-context.backend.service.d.ts.map +1 -1
  739. package/dist/esm/resources/services/resource-id.backend.service.d.ts.map +1 -1
  740. package/dist/esm/resources/services/resource-population.backend.service.d.ts +17 -2
  741. package/dist/esm/resources/services/resource-population.backend.service.d.ts.map +1 -1
  742. package/dist/esm/resources/services/resource-population.backend.service.js +74 -18
  743. package/dist/esm/resources/services/resource-population.backend.service.js.map +1 -1
  744. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +23 -0
  745. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  746. package/dist/esm/resources/services/resources-registry.backend.service.js +31 -0
  747. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  748. package/dist/esm/resources/services/virtual-fields.backend.service.d.ts.map +1 -1
  749. package/dist/esm/resources/utils/resource-retention.backend.utils.d.ts.map +1 -1
  750. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  751. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  752. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  753. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  754. package/dist/esm/runtime/models/execution-context.backend.schemas.d.ts.map +1 -1
  755. package/dist/esm/runtime/models/request-context.als.backend.d.ts.map +1 -1
  756. package/dist/esm/runtime/models/runtime.backend.schemas.d.ts.map +1 -1
  757. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  758. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  759. package/dist/esm/runtime/services/execution-context-handler.backend.service.d.ts.map +1 -1
  760. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  761. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  762. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  763. package/dist/esm/runtime/services/http-server.backend.service.js +10 -0
  764. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  765. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  766. package/dist/esm/runtime/services/start-application.backend.service.js +26 -12
  767. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  768. package/dist/esm/runtime/services/utils/oauth-body-cap.backend.utils.d.ts.map +1 -1
  769. package/dist/esm/runtime/testing/execution-context-test-fixtures.d.ts.map +1 -1
  770. package/dist/esm/runtime/testing/mock-execution-context-creator.service.d.ts.map +1 -1
  771. package/dist/esm/runtime/utils/application-startup-config-access.backend.utils.d.ts.map +1 -1
  772. package/dist/esm/runtime/utils/feature-gated-core-resource-exclusions.backend.utils.d.ts.map +1 -1
  773. package/dist/esm/runtime/utils/request-client-ip.utils.d.ts.map +1 -1
  774. package/dist/esm/runtime/utils/scan-default-exports.backend.utils.d.ts.map +1 -1
  775. package/dist/esm/security/api-keys/api-key-generation.backend.utils.d.ts.map +1 -1
  776. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  777. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  778. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  779. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  780. package/dist/esm/security/authentications/controllers/auth-method-management-controller.backend.service.d.ts.map +1 -1
  781. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts +22 -0
  782. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  783. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +84 -0
  784. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  785. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  786. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  787. package/dist/esm/security/authentications/models/auth-constants.backend.d.ts.map +1 -1
  788. package/dist/esm/security/authentications/models/authentications.backend.schemas.d.ts.map +1 -1
  789. package/dist/esm/security/authentications/models/authorization-client.backend.schemas.d.ts.map +1 -1
  790. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  791. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  792. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts +37 -0
  793. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts.map +1 -0
  794. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js +37 -0
  795. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js.map +1 -0
  796. package/dist/esm/security/authentications/models/identity-persistence-boundaries.backend.d.ts.map +1 -1
  797. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  798. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  799. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  800. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  801. package/dist/esm/security/authentications/models/saml-authentication.backend.schemas.d.ts.map +1 -1
  802. package/dist/esm/security/authentications/models/sso-connection.backend.schemas.d.ts.map +1 -1
  803. package/dist/esm/security/authentications/models/user-authorization-version.backend.utils.d.ts.map +1 -1
  804. package/dist/esm/security/authentications/seeds/enterprise-config-defaults.seeds.d.ts.map +1 -1
  805. package/dist/esm/security/authentications/services/__tests__/mock-auth-execution-context-factory.service.d.ts.map +1 -1
  806. package/dist/esm/security/authentications/services/__tests__/mock-auth-token-issuer.service.d.ts.map +1 -1
  807. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +1 -1
  808. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-domain-to-org-lookup.service.d.ts.map +1 -1
  809. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-enterprise-user-provisioning.service.d.ts.map +1 -1
  810. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  811. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  812. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  813. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  814. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  815. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  816. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  817. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  818. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.d.ts.map +1 -1
  819. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js +2 -1
  820. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js.map +1 -1
  821. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +9 -2
  822. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  823. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +9 -2
  824. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  825. package/dist/esm/security/authentications/services/auth-credential-verifier.backend.service.d.ts.map +1 -1
  826. package/dist/esm/security/authentications/services/auth-execution-context-factory.backend.service.d.ts.map +1 -1
  827. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  828. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  829. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  830. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts.map +1 -1
  831. package/dist/esm/security/authentications/services/auth-methods/auth-phone-verification.backend.service.d.ts.map +1 -1
  832. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  833. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  834. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts +97 -0
  835. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  836. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +218 -26
  837. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  838. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts +14 -0
  839. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  840. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +36 -0
  841. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  842. package/dist/esm/security/authentications/services/auth-methods/saml-assertion-validator.backend.service.d.ts.map +1 -1
  843. package/dist/esm/security/authentications/services/auth-methods/saml-authentication.backend.service.d.ts.map +1 -1
  844. package/dist/esm/security/authentications/services/auth-methods/saml-metadata.backend.service.d.ts.map +1 -1
  845. package/dist/esm/security/authentications/services/auth-methods/saml-replay-guard.backend.service.d.ts.map +1 -1
  846. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  847. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  848. package/dist/esm/security/authentications/services/auth-session-store.backend.service.d.ts.map +1 -1
  849. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  850. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  851. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  852. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  853. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  854. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  855. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  856. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  857. package/dist/esm/security/authentications/services/custom-impls/scim-tokens.custom-impl.backend.service.d.ts.map +1 -1
  858. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.d.ts.map +1 -1
  859. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -1
  860. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +57 -1
  861. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -1
  862. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  863. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  864. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.d.ts.map +1 -1
  865. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js +11 -1
  866. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js.map +1 -1
  867. package/dist/esm/security/authentications/services/email-verification-initiator.backend.service.d.ts.map +1 -1
  868. package/dist/esm/security/authentications/services/machine-token-issuer.backend.service.d.ts.map +1 -1
  869. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  870. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  871. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  872. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  873. package/dist/esm/security/authentications/services/oidc-user-claims.backend.service.d.ts.map +1 -1
  874. package/dist/esm/security/authentications/services/resolve-active-member-orgs.backend.utils.d.ts.map +1 -1
  875. package/dist/esm/security/authentications/services/utils/__tests__/mock-auth-user-lookup.service.d.ts.map +1 -1
  876. package/dist/esm/security/authentications/services/utils/auth-controller.utils.d.ts.map +1 -1
  877. package/dist/esm/security/authentications/services/utils/auth-credential-ops.backend.service.d.ts.map +1 -1
  878. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  879. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  880. package/dist/esm/security/authentications/services/utils/auth-response-helper.backend.service.d.ts.map +1 -1
  881. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  882. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  883. package/dist/esm/security/authentications/services/utils/concurrent-session-eviction.backend.utils.d.ts.map +1 -1
  884. package/dist/esm/security/authentications/services/utils/ensure-user-profile.backend.utils.d.ts.map +1 -1
  885. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  886. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  887. package/dist/esm/security/authentications/services/utils/machine-auth-rate-limit.backend.utils.d.ts.map +1 -1
  888. package/dist/esm/security/authentications/services/utils/pkce.backend.utils.d.ts.map +1 -1
  889. package/dist/esm/security/authentications/services/utils/saml-java-availability.d.ts.map +1 -1
  890. package/dist/esm/security/authentications/utils/application-auth-policy-audit.backend.utils.d.ts.map +1 -1
  891. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  892. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  893. package/dist/esm/security/authentications/utils/one-off-session-lifetime.backend.utils.d.ts.map +1 -1
  894. package/dist/esm/security/authentications/utils/social-oauth2-purpose.backend.utils.d.ts.map +1 -1
  895. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts +59 -0
  896. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts.map +1 -0
  897. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js +111 -0
  898. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js.map +1 -0
  899. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts +57 -0
  900. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts.map +1 -0
  901. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js +133 -0
  902. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js.map +1 -0
  903. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts +41 -0
  904. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts.map +1 -0
  905. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js +157 -0
  906. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js.map +1 -0
  907. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts +84 -0
  908. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts.map +1 -0
  909. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js +99 -0
  910. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js.map +1 -0
  911. package/dist/esm/security/authorizations/authorization-denial-audit.backend.utils.d.ts.map +1 -1
  912. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -1
  913. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -1
  914. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  915. package/dist/esm/security/authorizations/junction-scope-resolution.backend.d.ts.map +1 -1
  916. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  917. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  918. package/dist/esm/security/authorizations/organization-unit-narrowing-enforcement.backend.d.ts.map +1 -1
  919. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  920. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +20 -181
  921. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  922. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -1
  923. package/dist/esm/security/authorizations/relationship-foreign-key-filter.backend.d.ts.map +1 -1
  924. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  925. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  926. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +40 -0
  927. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -1
  928. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +43 -1
  929. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -1
  930. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +27 -17
  931. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  932. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +27 -17
  933. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  934. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +72 -0
  935. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  936. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +153 -10
  937. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  938. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  939. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  940. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -1
  941. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -1
  942. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +139 -1
  943. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -1
  944. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +474 -33
  945. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -1
  946. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +40 -0
  947. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -1
  948. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -1
  949. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -1
  950. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -1
  951. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +19 -0
  952. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -1
  953. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +38 -0
  954. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -1
  955. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -1
  956. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -1
  957. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -1
  958. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +17 -1
  959. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -1
  960. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +14 -0
  961. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -1
  962. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +16 -0
  963. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -1
  964. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -1
  965. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +1 -1
  966. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -1
  967. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +19 -0
  968. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -1
  969. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +45 -2
  970. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -1
  971. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -1
  972. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -1
  973. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +37 -1
  974. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -1
  975. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -1
  976. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -1
  977. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -1
  978. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -1
  979. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -1
  980. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts +34 -0
  981. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts.map +1 -0
  982. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js +39 -0
  983. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js.map +1 -0
  984. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  985. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -1
  986. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  987. package/dist/esm/security/consumable-tokens/models/consumable-tokens.shared.schemas.d.ts.map +1 -1
  988. package/dist/esm/security/consumable-tokens/models/index.d.ts.map +1 -1
  989. package/dist/esm/security/consumable-tokens/services/__tests__/mock-consumable-token.service.d.ts.map +1 -1
  990. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  991. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  992. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  993. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  994. package/dist/esm/security/jwt/services/auth-jwt-guard.backend.service.d.ts.map +1 -1
  995. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  996. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts +13 -0
  997. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts.map +1 -1
  998. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js +14 -0
  999. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js.map +1 -1
  1000. package/dist/esm/security/jwt/utils/jwt-verification-error-classification.backend.utils.d.ts.map +1 -1
  1001. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  1002. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  1003. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  1004. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  1005. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts +39 -0
  1006. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts.map +1 -0
  1007. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js +60 -0
  1008. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js.map +1 -0
  1009. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts +66 -0
  1010. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts.map +1 -0
  1011. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js +75 -0
  1012. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js.map +1 -0
  1013. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  1014. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  1015. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  1016. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  1017. package/dist/esm/security/scim/utils/scim-attribute-path-resolver.backend.utils.d.ts.map +1 -1
  1018. package/dist/esm/security/scim/utils/scim-filter-parser.d.ts.map +1 -1
  1019. package/dist/esm/security/scim/utils/scim-response-formatter.d.ts.map +1 -1
  1020. package/dist/esm/security/session-invalidation-fence.backend.utils.d.ts.map +1 -1
  1021. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  1022. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  1023. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -1
  1024. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -1
  1025. package/dist/esm/security/token-invalidation-fence.backend.utils.d.ts.map +1 -1
  1026. package/dist/esm/testing.d.ts.map +1 -1
  1027. package/dist/esm/users/services/inbound-contact-custom-implementation.backend.service.d.ts.map +1 -1
  1028. package/dist/esm/users/services/user-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  1029. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts.map +1 -1
  1030. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -1
  1031. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -1
  1032. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.d.ts.map +1 -1
  1033. package/dist/esm/users/services/user-self-custom-implementations.backend.d.ts.map +1 -1
  1034. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.d.ts.map +1 -1
  1035. package/dist/tsconfig.build.tsbuildinfo +1 -1
  1036. package/package.json +9 -9
  1037. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts +0 -45
  1038. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts.map +0 -1
  1039. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js +0 -22
  1040. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js.map +0 -1
  1041. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -0
  1042. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -0
  1043. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -0
  1044. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -0
  1045. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -0
  1046. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -0
  1047. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -0
  1048. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -0
  1049. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -0
  1050. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -0
  1051. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -0
  1052. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -0
  1053. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -0
  1054. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -0
  1055. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -0
  1056. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"file-operation-handler.backend.service.js","sourceRoot":"","sources":["../../../../../src/files/services/file-operation-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAgB,SAAS,EAAE,2BAA2B,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACjI,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,8EAA8E,CAAC;AAC3H,OAAO,EAAE,gCAAgC,EAAqB,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAA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CAAC,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,MAAM,yBAAyB,GAC7B,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;YAC7D,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAEhE,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1D,KAAK,CAAC,IAAI,CAAC;gBACT,aAAa,EAAE,YAAY,CAAC,KAAK,EAAE;gBACnC,aAAa,EAAE,YAAY,CAAC,KAAK,EAAE;aACpC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,KAAK;YACL,yBAAyB;SAC1B,CAAC;IACJ,CAAC;CACF,CAAA;AAjnCY,kCAAkC;IAD9C,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAEjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAA;IAEpD,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;+CAHhB,0BAA0B;QAEpB,gCAAgC;QAEtC,mBAAmB;GAXzC,kCAAkC,CAinC9C","sourcesContent":["/**\n * File Operation Handler Backend Service\n *\n * Handles file field operations during resource CRUD operations.\n * Validates and processes file fields when resources are created, updated, or deleted.\n *\n * Features:\n * - File validation before resource creation/update\n * - File linking/unlinking during resource operations\n * - Cascade behavior on resource deletion\n * - Idempotent operations (safe to retry)\n */\n\nimport { injectable, inject } from 'inversify';\nimport { ResourceType, ErrorType, ErrorCustomMessageReference, FileStatus, FILE_LINKABLE_STATUSES } from '@wildo-ai/saas-models';\nimport { FileGenerationSource } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { FileFieldDetectionBackendService, FileFieldMetadata } from './file-field-detection.backend.service';\nimport { FilesBackendService } from './files.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { RepositoryOptions } from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport { File } from '@wildo-ai/saas-models';\nimport { validateFileId, validateResourceType, validateResourceId, validateFieldName } from '~wildo-backend-lib/files/utils/file-validation.utils';\nimport {\n enumerateFileFieldValueOccurrences,\n hasExplicitCanonicalFieldMutation,\n mergeEffectiveResourceState,\n type FileFieldValueOccurrence,\n} from '~wildo-backend-lib/files/utils/file-field-schema-path.backend.utils';\n\ninterface FileFieldWriteProcessingOptions {\n /**\n * Internal-only escape hatch for framework materializers. Public write DTOs\n * still fail closed for generated PDF fields; only the exact generated\n * field/file-id pairs created by the service registry are accepted here.\n */\n frameworkGeneratedPdfFileIdsByField?: Record<string, readonly string[]>;\n}\n\n@injectable()\nexport class FileOperationHandlerBackendService {\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.FileFieldDetectionService)\n private readonly fileFieldDetection: FileFieldDetectionBackendService,\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n ) {\n this.logDebug = this.logger.debugByType('FileOperationHandlerBackendService');\n this.logger.setDebugTypeLogging('FileOperationHandlerBackendService', false);\n }\n\n private isGeneratedPdfFileField(fileField: FileFieldMetadata): boolean {\n return fileField.fileMetadata.generation?.source === FileGenerationSource.PDF_TEMPLATE;\n }\n\n /**\n * The ONE place that decides whether a file's status admits linking (issue #320).\n *\n * Both link-time validators (CREATE and UPDATE) used to compare against the literal\n * `FileStatus.UPLOADED`, so a file the scanner had certified `CLEAN` — a status\n * `FILE_STATUS_TRANSITIONS` explicitly allows to become `LINKED` — was refused with an error\n * naming `UPLOADED` as the expected state. Whether a scanned file could be attached depended on\n * beating the scanner. The admitted set now comes from `FILE_LINKABLE_STATUSES`, the single copy\n * shared with `FilesBackendService.linkFileToResource`.\n *\n * `SCANNING` is named separately: the file is not wrong, it is not yet KNOWN to be safe, so the\n * caller must learn to retry rather than re-upload. Every other non-linkable status (PENDING,\n * FAILED, DELETED, ORPHANED, INFECTED, QUARANTINED, and LINKED-to-something-else, which\n * `linkFileToResource` distinguishes further) is a terminal refusal for this write.\n *\n * @param diagnostics - log-only context; never rendered to the caller.\n */\n private assertFileLinkable(\n file: Pick<File, 'status'>,\n executionContext: ExecutionContext<any>,\n diagnostics: Record<string, unknown>,\n ): void {\n if (FILE_LINKABLE_STATUSES.has(file.status)) {\n return;\n }\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: file.status === FileStatus.SCANNING\n ? ErrorCustomMessageReference.FILE_SCAN_IN_PROGRESS\n : ErrorCustomMessageReference.FILE_NOT_LINKABLE,\n context: {\n // diagnostic (log-only)\n ...diagnostics,\n fileStatus: file.status,\n linkableStatuses: [...FILE_LINKABLE_STATUSES],\n },\n }\n );\n }\n\n /**\n * Best-effort cleanup for the previous generated PDF after REGENERATE.\n *\n * The parent field already points at the newly rendered file when this runs.\n * A cleanup failure must not roll back a successful regeneration; the normal\n * file cleanup path can still pick up the stale generated file later.\n */\n async softDeleteGeneratedFileReplacement(params: {\n fileId: string | undefined;\n replacementFileId: string;\n fieldName: string;\n executionContext: ExecutionContext<any>;\n options?: RepositoryOptions;\n }): Promise<void> {\n if (!params.fileId || params.fileId === params.replacementFileId) {\n return;\n }\n\n try {\n await this.filesService.deleteFile(\n params.fileId,\n params.executionContext,\n params.options,\n );\n } catch (error) {\n this.logger.warn('Failed to soft-delete replaced generated PDF file', {\n fileId: params.fileId,\n replacementFileId: params.replacementFileId,\n fieldName: params.fieldName,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n private assertGeneratedFileFieldNotUserSupplied(params: {\n data: Record<string, any>;\n fileField: FileFieldMetadata;\n occurrences: FileFieldValueOccurrence[];\n resourceType: ResourceType;\n executionContext: ExecutionContext<any>;\n processingOptions?: FileFieldWriteProcessingOptions;\n }): void {\n if (\n !this.isGeneratedPdfFileField(params.fileField)\n || (\n params.occurrences.length === 0\n && !hasExplicitCanonicalFieldMutation(params.data, params.fileField.fieldName)\n )\n ) {\n return;\n }\n\n const allowedFileIds = params.processingOptions?.frameworkGeneratedPdfFileIdsByField?.[params.fileField.fieldName];\n if (allowedFileIds && params.occurrences.length > 0) {\n const allowed = new Set(allowedFileIds);\n const submittedFileIds = params.occurrences.flatMap((occurrence) =>\n this.extractFileIds(occurrence.value, params.executionContext, true),\n );\n if (submittedFileIds.length > 0 && submittedFileIds.every((fileId) => allowed.has(fileId))) {\n return;\n }\n }\n\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n params.executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_GENERATED_FIELD_NOT_WRITABLE,\n context: {\n // diagnostic (log-only)\n fieldName: params.fileField.fieldName,\n resourceType: params.resourceType,\n },\n }\n );\n }\n\n /**\n * Validate file fields before resource creation.\n * Ensures files exist, are in UPLOADED status, and are ready to be linked.\n *\n * @param data - Resource data being created\n * @param resourceType - Resource type\n * @param executionContext - Execution context\n * @param options - Repository options (for transaction support)\n * @throws Error if validation fails (fail fast before resource creation)\n */\n async validateFileFieldsForCreate(\n data: Record<string, any>,\n resourceType: ResourceType,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions,\n processingOptions?: FileFieldWriteProcessingOptions,\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n\n this.logDebug('Validating file fields for CREATE', {\n resourceType,\n fileFieldsCount: fileFields.length,\n });\n\n // Collect all fileIds to validate\n const fileIdsToValidate: string[] = [];\n\n for (const fileField of fileFields) {\n const occurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n this.assertGeneratedFileFieldNotUserSupplied({\n data,\n fileField,\n occurrences,\n resourceType,\n executionContext,\n processingOptions,\n });\n\n for (const occurrence of occurrences) {\n const fieldFileIds = this.extractFileIds(occurrence.value, executionContext, true);\n\n // F4-01: Enforce maxFiles constraint per concrete occurrence\n const { maxFiles, multiple } = fileField.fileMetadata;\n if (multiple && maxFiles !== undefined && fieldFileIds.length > maxFiles) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_TOO_MANY_FILES,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath: occurrence.runtimeFieldPath,\n resourceType,\n maxFiles,\n receivedCount: fieldFileIds.length,\n },\n }\n );\n }\n\n fileIdsToValidate.push(...fieldFileIds);\n }\n }\n\n // Validate each file\n for (const fileId of fileIdsToValidate) {\n // Validate fileId format (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n const file = await this.filesService.getFile(fileId, executionContext, options);\n\n if (!file) {\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: {\n // diagnostic (log-only)\n fileId,\n resourceType,\n },\n }\n );\n }\n\n this.assertFileLinkable(file, executionContext, { fileId, resourceType });\n\n // Note: uploadContext validation can be added in Phase 2 if needed\n // For now, we only validate that file is UPLOADED\n }\n\n this.logDebug('File fields validation for CREATE completed', {\n resourceType,\n validatedFilesCount: fileIdsToValidate.length,\n });\n }\n\n /**\n * Process file fields after resource creation.\n * Links files to the newly created resource.\n *\n * @param data - Resource data that was created\n * @param resourceType - Resource type\n * @param resourceId - ID of the created resource\n * @param executionContext - Execution context\n */\n /**\n * Strip the PARENT resource's optimistic-lock version from options before any\n * child-file write.\n *\n * When a resource CREATE/UPDATE links/unlinks a `z_file()` field, the file is a\n * SEPARATE document with its own `_version_db_doc` lifecycle. If the parent request\n * carried an `If-Match` header, its `ifMatchVersion` must NOT fence the file update:\n * the repository would add a `{ _version_db_doc: <parentVersion> }` filter to the\n * FILE query, which (mis)matches the file by the PARENT's version and yields a\n * spurious `version_conflict` (the avatar-save 409: parent `If-Match: 0` leaking onto\n * the internal `files | update`). The transaction context is preserved so the file\n * write still participates in the parent's atomic boundary.\n */\n private stripParentVersionFence(options?: RepositoryOptions): RepositoryOptions | undefined {\n if (!options || options.ifMatchVersion === undefined) return options;\n const { ifMatchVersion: _parentVersionFence, ...fileWriteOptions } = options;\n return fileWriteOptions;\n }\n\n async processFileFieldsForCreate(\n data: Record<string, any>,\n resourceType: ResourceType,\n resourceId: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions,\n processingOptions?: FileFieldWriteProcessingOptions,\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n\n // A child-file link/unlink must not inherit the parent's optimistic-lock version.\n options = this.stripParentVersionFence(options);\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n\n this.logDebug('Processing file fields for CREATE', {\n resourceType,\n resourceId,\n fileFieldsCount: fileFields.length,\n });\n\n // Process each file field\n for (const fileField of fileFields) {\n const submittedOccurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n this.assertGeneratedFileFieldNotUserSupplied({\n data,\n fileField,\n occurrences: submittedOccurrences,\n resourceType,\n executionContext,\n processingOptions,\n });\n if (\n this.isGeneratedPdfFileField(fileField)\n && !processingOptions?.frameworkGeneratedPdfFileIdsByField?.[fileField.fieldName]\n ) {\n continue;\n }\n const occurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n\n for (const occurrence of occurrences) {\n const fieldFileIds = this.extractFileIds(occurrence.value, executionContext, true);\n for (const fileId of fieldFileIds) {\n await this.linkFileToResource(\n fileId,\n resourceType,\n resourceId,\n fileField.fieldName,\n executionContext,\n options\n );\n }\n }\n }\n\n this.logDebug('File fields processing for CREATE completed', {\n resourceType,\n resourceId,\n });\n }\n\n /**\n * Process file fields after resource update.\n * Unlinks old files and links new files.\n * Validates new files BEFORE unlinking old ones (fail fast).\n *\n * Note: This method handles partial updates correctly. If a file field is not present\n * in `data`, it is treated as unchanged (not removed). Only explicit changes to file\n * field values trigger unlinking/linking operations.\n *\n * @param data - Updated resource data (may be partial update - only changed fields)\n * @param existingResource - Existing resource before update (complete state)\n * @param resourceType - Resource type\n * @param resourceId - Resource ID\n * @param executionContext - Execution context\n */\n async processFileFieldsForUpdate(\n data: Record<string, any>,\n existingResource: Record<string, any>,\n resourceType: ResourceType,\n resourceId: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions,\n processingOptions?: FileFieldWriteProcessingOptions,\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n\n // A child-file link/unlink must not inherit the parent's optimistic-lock version.\n options = this.stripParentVersionFence(options);\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n const effectiveNewResource = mergeEffectiveResourceState(existingResource, data) as Record<string, any>;\n\n this.logDebug('Processing file fields for UPDATE', {\n resourceType,\n resourceId,\n fileFieldsCount: fileFields.length,\n });\n\n // Process each file field\n for (const fileField of fileFields) {\n const submittedOccurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n this.assertGeneratedFileFieldNotUserSupplied({\n data,\n fileField,\n occurrences: submittedOccurrences,\n resourceType,\n executionContext,\n processingOptions,\n });\n if (\n this.isGeneratedPdfFileField(fileField)\n && !processingOptions?.frameworkGeneratedPdfFileIdsByField?.[fileField.fieldName]\n ) {\n continue;\n }\n const oldOccurrences = this.prepareOccurrences(\n enumerateFileFieldValueOccurrences(existingResource, fileField.fieldName),\n executionContext,\n false,\n );\n const newOccurrences = this.prepareOccurrences(\n enumerateFileFieldValueOccurrences(effectiveNewResource, fileField.fieldName),\n executionContext,\n true,\n );\n\n const occurrencePairs = this.matchOccurrences(oldOccurrences, newOccurrences);\n if (occurrencePairs.requiresAmbiguousFallback && fileField.fileMetadata.overridable === false) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NESTED_UPDATE_AMBIGUOUS,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n resourceType,\n resourceId,\n },\n }\n );\n }\n\n for (const pair of occurrencePairs.pairs) {\n const oldFileIds = pair.oldOccurrence?.fileIds ?? [];\n const newFileIds = pair.newOccurrence?.fileIds ?? [];\n const oldSet = new Set(oldFileIds);\n const newSet = new Set(newFileIds);\n const hasChanged =\n oldSet.size !== newSet.size ||\n !oldFileIds.every(id => newSet.has(id)) ||\n !newFileIds.every(id => oldSet.has(id));\n\n if (!hasChanged) {\n continue;\n }\n\n const runtimeFieldPath = pair.newOccurrence?.occurrence.runtimeFieldPath\n ?? pair.oldOccurrence?.occurrence.runtimeFieldPath;\n\n // F4-02: Enforce overridable constraint\n const { overridable, multiple, maxFiles } = fileField.fileMetadata;\n if (overridable === false) {\n const removedFileIds = oldFileIds.filter(id => !newSet.has(id));\n\n if (!multiple) {\n if (removedFileIds.length > 0) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_FIELD_NOT_OVERRIDABLE,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath,\n resourceType,\n resourceId,\n },\n }\n );\n }\n } else if (removedFileIds.length > 0) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_FIELD_NOT_OVERRIDABLE,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath,\n resourceType,\n resourceId,\n removedFileIds,\n },\n }\n );\n }\n }\n\n if (multiple && maxFiles !== undefined && newFileIds.length > maxFiles) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_TOO_MANY_FILES,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath,\n resourceType,\n resourceId,\n maxFiles,\n newTotal: newFileIds.length,\n },\n }\n );\n }\n\n for (const fileId of newFileIds) {\n if (!oldSet.has(fileId)) {\n // New file - validate fileId format (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n const file = await this.filesService.getFile(fileId, executionContext, options);\n\n if (!file) {\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: {\n // diagnostic (log-only)\n fileId,\n resourceType,\n resourceId,\n runtimeFieldPath,\n },\n }\n );\n }\n\n this.assertFileLinkable(file, executionContext, { fileId, runtimeFieldPath, resourceType, resourceId });\n }\n }\n\n for (const oldFileId of oldFileIds) {\n if (!newSet.has(oldFileId)) {\n // File removed - unlink it\n await this.unlinkFileFromResource(\n oldFileId,\n fileField.fieldName,\n executionContext,\n options\n );\n }\n }\n\n for (const newFileId of newFileIds) {\n if (!oldSet.has(newFileId)) {\n // New file - link it\n await this.linkFileToResource(\n newFileId,\n resourceType,\n resourceId,\n fileField.fieldName,\n executionContext,\n options\n );\n }\n }\n }\n }\n\n this.logDebug('File fields processing for UPDATE completed', {\n resourceType,\n resourceId,\n });\n }\n\n /**\n * Process file fields before resource deletion.\n * Applies onParentDelete behavior to all linked files.\n *\n * @param resourceType - Resource type being deleted\n * @param resourceId - Resource ID being deleted\n * @param executionContext - Execution context\n */\n /**\n * Carry the owner ALREADY VERIFIED by `listFilesForResource` (which authorized each returned file\n * against the parent resource's derived scope) onto the options used for the subsequent delete/erase,\n * so the deletion gate (`getFile`'s per-file authorize) checks against that owner rather than the\n * identity-less system-cascade EC — which would otherwise DENY the subject's own file and abort the\n * erasure. Never widens access: `authorizeFileAccess` still matches this against the file's own scope.\n */\n private withAuthoritativeFileScope(options: RepositoryOptions | undefined, file: File): RepositoryOptions {\n return {\n ...(options ?? {}),\n authoritativeFileScope: {\n applicationId: file.applicationId,\n organizationId: file.organizationId,\n userId: file.userId,\n },\n };\n }\n\n async processFileFieldsForDelete(\n resourceType: ResourceType,\n resourceId: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n // A child-file cleanup must not inherit the parent's optimistic-lock version.\n options = this.stripParentVersionFence(options);\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n\n this.logDebug('Processing file fields for DELETE', {\n resourceType,\n resourceId,\n fileFieldsCount: fileFields.length,\n });\n\n // Get all files linked to this resource\n const linkedFiles = await this.filesService.listFilesForResource(\n resourceType,\n resourceId,\n undefined, // fieldName - undefined means all fields\n executionContext,\n options\n );\n\n // Process each file based on onParentDelete behavior from field metadata\n for (const file of linkedFiles) {\n // Forward the owner `listFilesForResource` already verified for THIS file to the deletion gate,\n // so a system-cascade teardown (identity-less EC) does not deny the subject's own file.\n const teardownOptions = this.withAuthoritativeFileScope(options, file);\n if (!file.linkedFieldName) {\n this.logger.warn('Linked file missing linkedFieldName during parent delete; defaulting to cascade cleanup', {\n fileId: file.fileId,\n resourceType,\n resourceId,\n });\n await this.applyOnParentDeleteBehavior(\n file.fileId,\n 'cascade',\n executionContext,\n teardownOptions\n );\n continue;\n }\n\n const fileField = this.fileFieldDetection.getFileFieldMetadata(\n resourceType,\n file.linkedFieldName\n );\n\n if (!fileField) {\n // Field not found - use default cascade behavior\n await this.applyOnParentDeleteBehavior(\n file.fileId,\n 'cascade',\n executionContext,\n teardownOptions\n );\n continue;\n }\n\n const onParentDelete = fileField.fileMetadata.onParentDelete || 'cascade';\n\n await this.applyOnParentDeleteBehavior(\n file.fileId,\n onParentDelete,\n executionContext,\n teardownOptions\n );\n }\n\n this.logDebug('File fields processing for DELETE completed', {\n resourceType,\n resourceId,\n processedFilesCount: linkedFiles.length,\n });\n }\n\n /**\n * Process file fields when a resource row is IMPERSONALIZED-AND-RETAINED (gate **G-FILE**).\n *\n * The row survives for a legal/audit obligation, so this is NOT the delete cascade — but \"keep the\n * record\" must not become \"keep the personal data\". A field-level scrub cannot reach inside a stored\n * blob (a passport scan stays a passport scan however the row is rewritten), so for a file field the\n * only real erasure is deleting the file.\n *\n * Which files? Exactly the ones whose field the author marked personal with `.impersonalizeWith()` —\n * the SAME author-responsibility contract as ordinary fields, reusing the same vocabulary rather\n * than inventing a second axis. The caller passes the scrub patch's field names:\n * - field IS scrubbed (REMOVE) ⇒ delete the file. The scrub patch nulls the pointer in the same\n * write, so the retained row keeps no dangling reference.\n * - field NOT scrubbed (KEEP / untreated) ⇒ leave the file. This is how a legally-required artifact\n * (an invoice PDF that IS the retained record) survives the erasure.\n *\n * Why deletion is required rather than relying on the row being hidden: the resource-scoped serve\n * route inherits the parent's READ authorization, so a hidden retained row already blocks it — but\n * the GLOBAL `/files/:fileId` route (direct / consumable-token / public-share) is explicitly NOT\n * resource-scoped and re-checks only the file's OWN scope. A file left ACTIVE therefore stays\n * reachable there even though its parent row is invisible.\n *\n * Erasure here goes through `FilesBackendService.eraseFile`, NOT `deleteFile`: besides marking the\n * file DELETED it scrubs the file row's OWN personal data (`originalFilename`, `uploadedBy`) in the\n * same write. Without that, the row's metadata stayed readable on the global metadata route for the\n * weeks until physical cleanup — an \"erasure\" that leaked `passport-jane-doe.pdf` the whole time. A\n * lifecycle delete deliberately keeps that provenance; a privacy erasure must not.\n *\n * Physical storage cleanup stays with the existing cleanup batch, so an erasure never mixes a DB\n * rollback with non-transactional storage side effects.\n *\n * ## The MIDDLE state — keep-but-hide — is deliberately NOT built (decided 2026-08-09)\n *\n * There are only two outcomes above, and the consequence of the second is worth stating plainly: a KEEP\n * file stays ORDINARILY READABLE to the file's own scope (its organization) through the global route,\n * indefinitely, even though its parent row is now invisible. A third state — retained but reachable only\n * through the audited see-through door, mirroring the parent row's posture — was considered and refused\n * for three reasons, in order of weight:\n *\n * 1. **It would contradict a decision already taken.** The concrete case that motivates it is the\n * invoice PDF, and the billing retention decision was explicitly \"retained as audit material, and\n * invoices stay VISIBLE\" for ordinary accounting. Hiding retained invoice documents would reverse\n * that, and the sibling ruling on invoice URLs went the same way: keep the document, close the\n * ordinary door only where the document is not itself the record.\n * 2. **A hiding door is worthless without its reading door, and shipping one alone is worse than\n * neither.** Withholding the file without also building an audited retrieval primitive would make\n * the legally-required artifact unreachable by ANYONE — destroying the very access the retention\n * obligation exists to preserve. (Same pairing rule as the cross-tenant repair doors: a marking\n * door without its release door is a one-way door calling itself a window.)\n * 3. **No shipped resource needs it.** The author already controls both ends per field: mark the field\n * and the file is erased, leave it and the file survives. The gap is only the middle, and nothing in\n * the tree declares a file field that is simultaneously personal, legally required, and must stop\n * being ordinarily visible.\n *\n * **What would trigger building it:** a resource declaring exactly that combination. The shape is then a\n * new `FileStatus` member excluded from `FILE_DOWNLOADABLE_STATUSES` and added to\n * `FILE_METADATA_WITHHELD_STATUSES`, a `FILE_STATUS_TRANSITIONS` entry, and — non-optional — an audited\n * see-through retrieval primitive alongside it. Do not add the status without the door.\n */\n async processFileFieldsForImpersonalize(\n resourceType: ResourceType,\n resourceId: string,\n scrubbedFieldNames: readonly string[],\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n options = this.stripParentVersionFence(options);\n\n if (scrubbedFieldNames.length === 0 || !this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const scrubbedFields = new Set(scrubbedFieldNames);\n const linkedFiles = await this.filesService.listFilesForResource(\n resourceType,\n resourceId,\n undefined, // all fields — we filter by treatment below\n executionContext,\n options\n );\n\n let erasedCount = 0;\n let unattributableCount = 0;\n for (const file of linkedFiles) {\n // Fail-closed on an unattributable file: without `linkedFieldName` we cannot tell whether its\n // field was marked personal, and silently keeping it risks retaining an erased subject's\n // document. The delete cascade defaults such a file to cleanup for the same reason.\n const isUnattributable = !file.linkedFieldName;\n const isScrubbedField = isUnattributable || scrubbedFields.has(file.linkedFieldName!);\n if (!isScrubbedField) {\n continue;\n }\n if (isUnattributable) {\n /**\n * WARN, not debug: this is an irreversible deletion taken on a GUESS.\n *\n * The fail-closed default is right — a file we cannot attribute might be the erased subject's\n * passport scan — but it can equally destroy a file the retention obligation existed to KEEP\n * (an invoice PDF whose link lost its field name). Either way the cause is upstream metadata,\n * so it has to be visible: the sibling delete cascade has warned here since before this path\n * existed, and this one erased silently. Same decision, same audibility.\n */\n unattributableCount += 1;\n this.logger.warn(\n '[Retention] Erasing a linked file with no `linkedFieldName` during impersonalize — it cannot '\n + 'be attributed to a field, so the fail-closed default deletes it. If this file was meant to '\n + 'be RETAINED, its link metadata is the defect.',\n { resourceType, resourceId, fileId: file.fileId },\n );\n }\n // Forward the owner `listFilesForResource` already verified for THIS file to the deletion gate,\n // so a system-cascade (identity-less EC) impersonalize erase does not deny the subject's own file.\n await this.filesService.eraseFile(file.fileId, executionContext, this.withAuthoritativeFileScope(options, file));\n erasedCount++;\n }\n\n this.logDebug('File fields processing for IMPERSONALIZE completed', {\n resourceType,\n resourceId,\n linkedFilesCount: linkedFiles.length,\n erasedCount,\n retainedCount: linkedFiles.length - erasedCount,\n unattributableCount,\n });\n }\n\n /**\n * Extract file IDs from field value (handles single file or array).\n *\n * @param fieldValue - The raw field value from the resource object\n * @param executionContext - Current execution context\n * @param strict - When true (user input / new values), throws on invalid fileIds.\n * When false (existing DB data), silently filters and logs warnings.\n */\n private extractFileIds(fieldValue: any, executionContext?: ExecutionContext<any>, strict: boolean = false): string[] {\n if (fieldValue === null || fieldValue === undefined) {\n return [];\n }\n\n if (typeof fieldValue === 'object' && !Array.isArray(fieldValue)) {\n if ('fileId' in fieldValue) {\n return this.extractFileIds((fieldValue as { fileId?: unknown }).fileId, executionContext, strict);\n }\n\n if ('fileIds' in fieldValue) {\n return this.extractFileIds((fieldValue as { fileIds?: unknown }).fileIds, executionContext, strict);\n }\n }\n\n if (Array.isArray(fieldValue)) {\n const validFileIds: string[] = [];\n for (const fileId of fieldValue) {\n if (typeof fileId !== 'string' || fileId.trim() === '') {\n if (strict) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_ID_VALIDATION_FAILED,\n context: {\n // diagnostic (log-only)\n fileId,\n receivedType: typeof fileId,\n },\n }\n );\n }\n continue;\n }\n try {\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n validFileIds.push(fileId);\n } catch (error) {\n if (strict) {\n throw error; // Re-throw in strict mode — user provided invalid input\n }\n // Tolerant mode: filter out and warn (handles corrupt DB data gracefully)\n this.logger.warn('Invalid fileId filtered out during extraction', {\n fileId,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n return validFileIds;\n }\n\n if (typeof fieldValue === 'string' && fieldValue.trim() !== '') {\n try {\n validateFileId(fieldValue, this.errorBuilder, executionContext, 'fileId');\n return [fieldValue];\n } catch (error) {\n if (strict) {\n throw error;\n }\n this.logger.warn('Invalid fileId filtered out during extraction', {\n fileId: fieldValue,\n ...projectCaughtErrorLogFields(error),\n });\n return [];\n }\n }\n\n if (strict && fieldValue !== null && fieldValue !== undefined) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_FIELD_VALUE_INVALID,\n context: {\n // diagnostic (log-only)\n receivedType: typeof fieldValue,\n },\n }\n );\n }\n\n return [];\n }\n\n /**\n * Link a file to a resource.\n * Handles race conditions (idempotent - safe to call multiple times).\n */\n private async linkFileToResource(\n fileId: string,\n resourceType: ResourceType,\n resourceId: string,\n fieldName: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n\n // Check if file is already linked to the same resource (idempotent check - before calling service)\n // This prevents unnecessary service calls and handles idempotent cases early\n const file = await this.filesService.getFile(fileId, executionContext, options);\n if (file &&\n file.status === FileStatus.LINKED &&\n file.linkedResourceType === resourceType &&\n file.linkedResourceId === resourceId &&\n file.linkedFieldName === fieldName) {\n // Already linked to same resource - skip (idempotent)\n this.logDebug('File already linked to same resource, skipping', {\n fileId,\n resourceType,\n resourceId,\n fieldName,\n });\n return;\n }\n\n // Link file - errors propagate to fail the transaction (Decision 2.2: Option A)\n // FilesBackendService.linkFileToResource() handles idempotent cases internally (returns existing file)\n // All other errors (NOT_FOUND, BUSINESS_RULE, INTERNAL) should fail the operation\n await this.filesService.linkFileToResource(\n fileId,\n resourceType,\n resourceId,\n fieldName,\n executionContext,\n options\n );\n }\n\n /**\n * Unlink a file from a resource.\n * Applies onParentDelete behavior.\n */\n private async unlinkFileFromResource(\n fileId: string,\n fieldName: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n // Validate fileId format (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n const file = await this.filesService.getFile(fileId, executionContext, options);\n if (!file || file.status !== FileStatus.LINKED) {\n // Already unlinked or doesn't exist - skip (idempotent)\n return;\n }\n\n // Unlink file (sets status to ORPHANED)\n await this.filesService.unlinkFileFromResource(fileId, executionContext, options);\n }\n\n /**\n * Apply onParentDelete behavior to a file.\n *\n * @param fileId - File ID\n * @param behavior - Behavior: 'cascade', 'soft-delete', or 'orphan'\n * @param executionContext - Execution context\n */\n private async applyOnParentDeleteBehavior(\n fileId: string,\n behavior: 'cascade' | 'soft-delete' | 'orphan',\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n this.logDebug('Applying onParentDelete behavior', {\n fileId,\n behavior,\n });\n\n switch (behavior) {\n case 'cascade':\n // Cascade now marks the file as DELETED only. Physical storage cleanup is\n // intentionally deferred to the cleanup batch so resource deletes never\n // mix Mongo rollback with non-transactional storage side effects.\n await this.filesService.deleteFile(fileId, executionContext, options);\n break;\n\n case 'soft-delete':\n // Soft delete: update status to DELETED\n await this.filesService.deleteFile(fileId, executionContext, options);\n break;\n\n case 'orphan':\n // Unlink: clear parent fields, set status to ORPHANED\n await this.filesService.unlinkFileFromResource(fileId, executionContext, options);\n break;\n\n default:\n // Default to cascade\n await this.filesService.deleteFile(fileId, executionContext, options);\n }\n }\n\n private prepareOccurrences(\n occurrences: FileFieldValueOccurrence[],\n executionContext: ExecutionContext<any>,\n strict: boolean,\n ): Array<{\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n }> {\n return occurrences.map((occurrence) => {\n const fileIds = this.extractFileIds(occurrence.value, executionContext, strict);\n return {\n occurrence,\n fileIds,\n signature: JSON.stringify([...fileIds].sort()),\n };\n });\n }\n\n private matchOccurrences(\n oldOccurrences: Array<{\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n }>,\n newOccurrences: Array<{\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n }>,\n ): {\n pairs: Array<{\n oldOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n newOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n }>;\n requiresAmbiguousFallback: boolean;\n } {\n const pairs: Array<{\n oldOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n newOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n }> = [];\n\n const remainingOld = [...oldOccurrences];\n const remainingNew = [...newOccurrences];\n\n const stableIds = new Set(\n [...remainingOld, ...remainingNew]\n .map((entry) => entry.occurrence.ownerStableId)\n .filter((value): value is string => typeof value === 'string' && value.trim() !== ''),\n );\n\n for (const stableId of stableIds) {\n const oldMatches = remainingOld.filter((entry) => entry.occurrence.ownerStableId === stableId);\n const newMatches = remainingNew.filter((entry) => entry.occurrence.ownerStableId === stableId);\n\n while (oldMatches.length > 0 && newMatches.length > 0) {\n const oldEntry = oldMatches.shift()!;\n const newEntry = newMatches.shift()!;\n remainingOld.splice(remainingOld.indexOf(oldEntry), 1);\n remainingNew.splice(remainingNew.indexOf(newEntry), 1);\n pairs.push({ oldOccurrence: oldEntry, newOccurrence: newEntry });\n }\n }\n\n const oldSignatureBuckets = new Map<string, typeof remainingOld>();\n for (const entry of remainingOld) {\n if (entry.occurrence.ownerStableId) {\n continue;\n }\n const bucket = oldSignatureBuckets.get(entry.signature) ?? [];\n bucket.push(entry);\n oldSignatureBuckets.set(entry.signature, bucket);\n }\n\n for (const newEntry of [...remainingNew]) {\n if (newEntry.occurrence.ownerStableId) {\n continue;\n }\n\n const bucket = oldSignatureBuckets.get(newEntry.signature);\n const oldEntry = bucket?.shift();\n if (!oldEntry) {\n continue;\n }\n\n remainingOld.splice(remainingOld.indexOf(oldEntry), 1);\n remainingNew.splice(remainingNew.indexOf(newEntry), 1);\n pairs.push({ oldOccurrence: oldEntry, newOccurrence: newEntry });\n }\n\n const requiresAmbiguousFallback =\n remainingOld.some((entry) => !entry.occurrence.ownerStableId) &&\n remainingNew.some((entry) => !entry.occurrence.ownerStableId);\n\n while (remainingOld.length > 0 || remainingNew.length > 0) {\n pairs.push({\n oldOccurrence: remainingOld.shift(),\n newOccurrence: remainingNew.shift(),\n });\n }\n\n return {\n pairs,\n requiresAmbiguousFallback,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"file-operation-handler.backend.service.js","sourceRoot":"","sources":["../../../../src/files/services/file-operation-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAgB,SAAS,EAAE,2BAA2B,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACjI,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,2BAA2B,EAAE,MAAM,8EAA8E,CAAC;AAC3H,OAAO,EAAE,gCAAgC,EAAqB,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAI9D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE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AAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,MAAM,yBAAyB,GAC7B,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;YAC7D,YAAY,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QAEhE,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1D,KAAK,CAAC,IAAI,CAAC;gBACT,aAAa,EAAE,YAAY,CAAC,KAAK,EAAE;gBACnC,aAAa,EAAE,YAAY,CAAC,KAAK,EAAE;aACpC,CAAC,CAAC;QACL,CAAC;QAED,OAAO;YACL,KAAK;YACL,yBAAyB;SAC1B,CAAC;IACJ,CAAC;CACF,CAAA;AAjnCY,kCAAkC;IAD9C,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IAEjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,yBAAyB,CAAC,CAAA;IAEpD,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;+CAHhB,0BAA0B;QAEpB,gCAAgC;QAEtC,mBAAmB;GAXzC,kCAAkC,CAinC9C","sourcesContent":["/**\n * File Operation Handler Backend Service\n *\n * Handles file field operations during resource CRUD operations.\n * Validates and processes file fields when resources are created, updated, or deleted.\n *\n * Features:\n * - File validation before resource creation/update\n * - File linking/unlinking during resource operations\n * - Cascade behavior on resource deletion\n * - Idempotent operations (safe to retry)\n */\n\nimport { injectable, inject } from 'inversify';\nimport { ResourceType, ErrorType, ErrorCustomMessageReference, FileStatus, FILE_LINKABLE_STATUSES } from '@wildo-ai/saas-models';\nimport { FileGenerationSource } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { FileFieldDetectionBackendService, FileFieldMetadata } from './file-field-detection.backend.service';\nimport { FilesBackendService } from './files.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { RepositoryOptions } from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport { File } from '@wildo-ai/saas-models';\nimport { validateFileId, validateResourceType, validateResourceId, validateFieldName } from '~wildo-backend-lib/files/utils/file-validation.utils';\nimport {\n enumerateFileFieldValueOccurrences,\n hasExplicitCanonicalFieldMutation,\n mergeEffectiveResourceState,\n type FileFieldValueOccurrence,\n} from '~wildo-backend-lib/files/utils/file-field-schema-path.backend.utils';\n\ninterface FileFieldWriteProcessingOptions {\n /**\n * Internal-only escape hatch for framework materializers. Public write DTOs\n * still fail closed for generated PDF fields; only the exact generated\n * field/file-id pairs created by the service registry are accepted here.\n */\n frameworkGeneratedPdfFileIdsByField?: Record<string, readonly string[]>;\n}\n\n@injectable()\nexport class FileOperationHandlerBackendService {\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.FileFieldDetectionService)\n private readonly fileFieldDetection: FileFieldDetectionBackendService,\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n ) {\n this.logDebug = this.logger.debugByType('FileOperationHandlerBackendService');\n this.logger.setDebugTypeLogging('FileOperationHandlerBackendService', false);\n }\n\n private isGeneratedPdfFileField(fileField: FileFieldMetadata): boolean {\n return fileField.fileMetadata.generation?.source === FileGenerationSource.PDF_TEMPLATE;\n }\n\n /**\n * The ONE place that decides whether a file's status admits linking (issue #320).\n *\n * Both link-time validators (CREATE and UPDATE) used to compare against the literal\n * `FileStatus.UPLOADED`, so a file the scanner had certified `CLEAN` — a status\n * `FILE_STATUS_TRANSITIONS` explicitly allows to become `LINKED` — was refused with an error\n * naming `UPLOADED` as the expected state. Whether a scanned file could be attached depended on\n * beating the scanner. The admitted set now comes from `FILE_LINKABLE_STATUSES`, the single copy\n * shared with `FilesBackendService.linkFileToResource`.\n *\n * `SCANNING` is named separately: the file is not wrong, it is not yet KNOWN to be safe, so the\n * caller must learn to retry rather than re-upload. Every other non-linkable status (PENDING,\n * FAILED, DELETED, ORPHANED, INFECTED, QUARANTINED, and LINKED-to-something-else, which\n * `linkFileToResource` distinguishes further) is a terminal refusal for this write.\n *\n * @param diagnostics - log-only context; never rendered to the caller.\n */\n private assertFileLinkable(\n file: Pick<File, 'status'>,\n executionContext: ExecutionContext<any>,\n diagnostics: Record<string, unknown>,\n ): void {\n if (FILE_LINKABLE_STATUSES.has(file.status)) {\n return;\n }\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: file.status === FileStatus.SCANNING\n ? ErrorCustomMessageReference.FILE_SCAN_IN_PROGRESS\n : ErrorCustomMessageReference.FILE_NOT_LINKABLE,\n context: {\n // diagnostic (log-only)\n ...diagnostics,\n fileStatus: file.status,\n linkableStatuses: [...FILE_LINKABLE_STATUSES],\n },\n }\n );\n }\n\n /**\n * Best-effort cleanup for the previous generated PDF after REGENERATE.\n *\n * The parent field already points at the newly rendered file when this runs.\n * A cleanup failure must not roll back a successful regeneration; the normal\n * file cleanup path can still pick up the stale generated file later.\n */\n async softDeleteGeneratedFileReplacement(params: {\n fileId: string | undefined;\n replacementFileId: string;\n fieldName: string;\n executionContext: ExecutionContext<any>;\n options?: RepositoryOptions;\n }): Promise<void> {\n if (!params.fileId || params.fileId === params.replacementFileId) {\n return;\n }\n\n try {\n await this.filesService.deleteFile(\n params.fileId,\n params.executionContext,\n params.options,\n );\n } catch (error) {\n this.logger.warn('Failed to soft-delete replaced generated PDF file', {\n fileId: params.fileId,\n replacementFileId: params.replacementFileId,\n fieldName: params.fieldName,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n private assertGeneratedFileFieldNotUserSupplied(params: {\n data: Record<string, any>;\n fileField: FileFieldMetadata;\n occurrences: FileFieldValueOccurrence[];\n resourceType: ResourceType;\n executionContext: ExecutionContext<any>;\n processingOptions?: FileFieldWriteProcessingOptions;\n }): void {\n if (\n !this.isGeneratedPdfFileField(params.fileField)\n || (\n params.occurrences.length === 0\n && !hasExplicitCanonicalFieldMutation(params.data, params.fileField.fieldName)\n )\n ) {\n return;\n }\n\n const allowedFileIds = params.processingOptions?.frameworkGeneratedPdfFileIdsByField?.[params.fileField.fieldName];\n if (allowedFileIds && params.occurrences.length > 0) {\n const allowed = new Set(allowedFileIds);\n const submittedFileIds = params.occurrences.flatMap((occurrence) =>\n this.extractFileIds(occurrence.value, params.executionContext, true),\n );\n if (submittedFileIds.length > 0 && submittedFileIds.every((fileId) => allowed.has(fileId))) {\n return;\n }\n }\n\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n params.executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_GENERATED_FIELD_NOT_WRITABLE,\n context: {\n // diagnostic (log-only)\n fieldName: params.fileField.fieldName,\n resourceType: params.resourceType,\n },\n }\n );\n }\n\n /**\n * Validate file fields before resource creation.\n * Ensures files exist, are in UPLOADED status, and are ready to be linked.\n *\n * @param data - Resource data being created\n * @param resourceType - Resource type\n * @param executionContext - Execution context\n * @param options - Repository options (for transaction support)\n * @throws Error if validation fails (fail fast before resource creation)\n */\n async validateFileFieldsForCreate(\n data: Record<string, any>,\n resourceType: ResourceType,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions,\n processingOptions?: FileFieldWriteProcessingOptions,\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n\n this.logDebug('Validating file fields for CREATE', {\n resourceType,\n fileFieldsCount: fileFields.length,\n });\n\n // Collect all fileIds to validate\n const fileIdsToValidate: string[] = [];\n\n for (const fileField of fileFields) {\n const occurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n this.assertGeneratedFileFieldNotUserSupplied({\n data,\n fileField,\n occurrences,\n resourceType,\n executionContext,\n processingOptions,\n });\n\n for (const occurrence of occurrences) {\n const fieldFileIds = this.extractFileIds(occurrence.value, executionContext, true);\n\n // F4-01: Enforce maxFiles constraint per concrete occurrence\n const { maxFiles, multiple } = fileField.fileMetadata;\n if (multiple && maxFiles !== undefined && fieldFileIds.length > maxFiles) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_TOO_MANY_FILES,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath: occurrence.runtimeFieldPath,\n resourceType,\n maxFiles,\n receivedCount: fieldFileIds.length,\n },\n }\n );\n }\n\n fileIdsToValidate.push(...fieldFileIds);\n }\n }\n\n // Validate each file\n for (const fileId of fileIdsToValidate) {\n // Validate fileId format (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n const file = await this.filesService.getFile(fileId, executionContext, options);\n\n if (!file) {\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: {\n // diagnostic (log-only)\n fileId,\n resourceType,\n },\n }\n );\n }\n\n this.assertFileLinkable(file, executionContext, { fileId, resourceType });\n\n // Note: uploadContext validation can be added in Phase 2 if needed\n // For now, we only validate that file is UPLOADED\n }\n\n this.logDebug('File fields validation for CREATE completed', {\n resourceType,\n validatedFilesCount: fileIdsToValidate.length,\n });\n }\n\n /**\n * Process file fields after resource creation.\n * Links files to the newly created resource.\n *\n * @param data - Resource data that was created\n * @param resourceType - Resource type\n * @param resourceId - ID of the created resource\n * @param executionContext - Execution context\n */\n /**\n * Strip the PARENT resource's optimistic-lock version from options before any\n * child-file write.\n *\n * When a resource CREATE/UPDATE links/unlinks a `z_file()` field, the file is a\n * SEPARATE document with its own `_version_db_doc` lifecycle. If the parent request\n * carried an `If-Match` header, its `ifMatchVersion` must NOT fence the file update:\n * the repository would add a `{ _version_db_doc: <parentVersion> }` filter to the\n * FILE query, which (mis)matches the file by the PARENT's version and yields a\n * spurious `version_conflict` (the avatar-save 409: parent `If-Match: 0` leaking onto\n * the internal `files | update`). The transaction context is preserved so the file\n * write still participates in the parent's atomic boundary.\n */\n private stripParentVersionFence(options?: RepositoryOptions): RepositoryOptions | undefined {\n if (!options || options.ifMatchVersion === undefined) return options;\n const { ifMatchVersion: _parentVersionFence, ...fileWriteOptions } = options;\n return fileWriteOptions;\n }\n\n async processFileFieldsForCreate(\n data: Record<string, any>,\n resourceType: ResourceType,\n resourceId: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions,\n processingOptions?: FileFieldWriteProcessingOptions,\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n\n // A child-file link/unlink must not inherit the parent's optimistic-lock version.\n options = this.stripParentVersionFence(options);\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n\n this.logDebug('Processing file fields for CREATE', {\n resourceType,\n resourceId,\n fileFieldsCount: fileFields.length,\n });\n\n // Process each file field\n for (const fileField of fileFields) {\n const submittedOccurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n this.assertGeneratedFileFieldNotUserSupplied({\n data,\n fileField,\n occurrences: submittedOccurrences,\n resourceType,\n executionContext,\n processingOptions,\n });\n if (\n this.isGeneratedPdfFileField(fileField)\n && !processingOptions?.frameworkGeneratedPdfFileIdsByField?.[fileField.fieldName]\n ) {\n continue;\n }\n const occurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n\n for (const occurrence of occurrences) {\n const fieldFileIds = this.extractFileIds(occurrence.value, executionContext, true);\n for (const fileId of fieldFileIds) {\n await this.linkFileToResource(\n fileId,\n resourceType,\n resourceId,\n fileField.fieldName,\n executionContext,\n options\n );\n }\n }\n }\n\n this.logDebug('File fields processing for CREATE completed', {\n resourceType,\n resourceId,\n });\n }\n\n /**\n * Process file fields after resource update.\n * Unlinks old files and links new files.\n * Validates new files BEFORE unlinking old ones (fail fast).\n *\n * Note: This method handles partial updates correctly. If a file field is not present\n * in `data`, it is treated as unchanged (not removed). Only explicit changes to file\n * field values trigger unlinking/linking operations.\n *\n * @param data - Updated resource data (may be partial update - only changed fields)\n * @param existingResource - Existing resource before update (complete state)\n * @param resourceType - Resource type\n * @param resourceId - Resource ID\n * @param executionContext - Execution context\n */\n async processFileFieldsForUpdate(\n data: Record<string, any>,\n existingResource: Record<string, any>,\n resourceType: ResourceType,\n resourceId: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions,\n processingOptions?: FileFieldWriteProcessingOptions,\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n\n // A child-file link/unlink must not inherit the parent's optimistic-lock version.\n options = this.stripParentVersionFence(options);\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n const effectiveNewResource = mergeEffectiveResourceState(existingResource, data) as Record<string, any>;\n\n this.logDebug('Processing file fields for UPDATE', {\n resourceType,\n resourceId,\n fileFieldsCount: fileFields.length,\n });\n\n // Process each file field\n for (const fileField of fileFields) {\n const submittedOccurrences = enumerateFileFieldValueOccurrences(data, fileField.fieldName);\n this.assertGeneratedFileFieldNotUserSupplied({\n data,\n fileField,\n occurrences: submittedOccurrences,\n resourceType,\n executionContext,\n processingOptions,\n });\n if (\n this.isGeneratedPdfFileField(fileField)\n && !processingOptions?.frameworkGeneratedPdfFileIdsByField?.[fileField.fieldName]\n ) {\n continue;\n }\n const oldOccurrences = this.prepareOccurrences(\n enumerateFileFieldValueOccurrences(existingResource, fileField.fieldName),\n executionContext,\n false,\n );\n const newOccurrences = this.prepareOccurrences(\n enumerateFileFieldValueOccurrences(effectiveNewResource, fileField.fieldName),\n executionContext,\n true,\n );\n\n const occurrencePairs = this.matchOccurrences(oldOccurrences, newOccurrences);\n if (occurrencePairs.requiresAmbiguousFallback && fileField.fileMetadata.overridable === false) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NESTED_UPDATE_AMBIGUOUS,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n resourceType,\n resourceId,\n },\n }\n );\n }\n\n for (const pair of occurrencePairs.pairs) {\n const oldFileIds = pair.oldOccurrence?.fileIds ?? [];\n const newFileIds = pair.newOccurrence?.fileIds ?? [];\n const oldSet = new Set(oldFileIds);\n const newSet = new Set(newFileIds);\n const hasChanged =\n oldSet.size !== newSet.size ||\n !oldFileIds.every(id => newSet.has(id)) ||\n !newFileIds.every(id => oldSet.has(id));\n\n if (!hasChanged) {\n continue;\n }\n\n const runtimeFieldPath = pair.newOccurrence?.occurrence.runtimeFieldPath\n ?? pair.oldOccurrence?.occurrence.runtimeFieldPath;\n\n // F4-02: Enforce overridable constraint\n const { overridable, multiple, maxFiles } = fileField.fileMetadata;\n if (overridable === false) {\n const removedFileIds = oldFileIds.filter(id => !newSet.has(id));\n\n if (!multiple) {\n if (removedFileIds.length > 0) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_FIELD_NOT_OVERRIDABLE,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath,\n resourceType,\n resourceId,\n },\n }\n );\n }\n } else if (removedFileIds.length > 0) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_FIELD_NOT_OVERRIDABLE,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath,\n resourceType,\n resourceId,\n removedFileIds,\n },\n }\n );\n }\n }\n\n if (multiple && maxFiles !== undefined && newFileIds.length > maxFiles) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_TOO_MANY_FILES,\n context: {\n // diagnostic (log-only)\n fieldName: fileField.fieldName,\n runtimeFieldPath,\n resourceType,\n resourceId,\n maxFiles,\n newTotal: newFileIds.length,\n },\n }\n );\n }\n\n for (const fileId of newFileIds) {\n if (!oldSet.has(fileId)) {\n // New file - validate fileId format (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n const file = await this.filesService.getFile(fileId, executionContext, options);\n\n if (!file) {\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: {\n // diagnostic (log-only)\n fileId,\n resourceType,\n resourceId,\n runtimeFieldPath,\n },\n }\n );\n }\n\n this.assertFileLinkable(file, executionContext, { fileId, runtimeFieldPath, resourceType, resourceId });\n }\n }\n\n for (const oldFileId of oldFileIds) {\n if (!newSet.has(oldFileId)) {\n // File removed - unlink it\n await this.unlinkFileFromResource(\n oldFileId,\n fileField.fieldName,\n executionContext,\n options\n );\n }\n }\n\n for (const newFileId of newFileIds) {\n if (!oldSet.has(newFileId)) {\n // New file - link it\n await this.linkFileToResource(\n newFileId,\n resourceType,\n resourceId,\n fileField.fieldName,\n executionContext,\n options\n );\n }\n }\n }\n }\n\n this.logDebug('File fields processing for UPDATE completed', {\n resourceType,\n resourceId,\n });\n }\n\n /**\n * Process file fields before resource deletion.\n * Applies onParentDelete behavior to all linked files.\n *\n * @param resourceType - Resource type being deleted\n * @param resourceId - Resource ID being deleted\n * @param executionContext - Execution context\n */\n /**\n * Carry the owner ALREADY VERIFIED by `listFilesForResource` (which authorized each returned file\n * against the parent resource's derived scope) onto the options used for the subsequent delete/erase,\n * so the deletion gate (`getFile`'s per-file authorize) checks against that owner rather than the\n * identity-less system-cascade EC — which would otherwise DENY the subject's own file and abort the\n * erasure. Never widens access: `authorizeFileAccess` still matches this against the file's own scope.\n */\n private withAuthoritativeFileScope(options: RepositoryOptions | undefined, file: File): RepositoryOptions {\n return {\n ...(options ?? {}),\n authoritativeFileScope: {\n applicationId: file.applicationId,\n organizationId: file.organizationId,\n userId: file.userId,\n },\n };\n }\n\n async processFileFieldsForDelete(\n resourceType: ResourceType,\n resourceId: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n // A child-file cleanup must not inherit the parent's optimistic-lock version.\n options = this.stripParentVersionFence(options);\n\n // Check if resource has file fields\n if (!this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const fileFields = this.fileFieldDetection.detectFileFields(resourceType);\n\n this.logDebug('Processing file fields for DELETE', {\n resourceType,\n resourceId,\n fileFieldsCount: fileFields.length,\n });\n\n // Get all files linked to this resource\n const linkedFiles = await this.filesService.listFilesForResource(\n resourceType,\n resourceId,\n undefined, // fieldName - undefined means all fields\n executionContext,\n options\n );\n\n // Process each file based on onParentDelete behavior from field metadata\n for (const file of linkedFiles) {\n // Forward the owner `listFilesForResource` already verified for THIS file to the deletion gate,\n // so a system-cascade teardown (identity-less EC) does not deny the subject's own file.\n const teardownOptions = this.withAuthoritativeFileScope(options, file);\n if (!file.linkedFieldName) {\n this.logger.warn('Linked file missing linkedFieldName during parent delete; defaulting to cascade cleanup', {\n fileId: file.fileId,\n resourceType,\n resourceId,\n });\n await this.applyOnParentDeleteBehavior(\n file.fileId,\n 'cascade',\n executionContext,\n teardownOptions\n );\n continue;\n }\n\n const fileField = this.fileFieldDetection.getFileFieldMetadata(\n resourceType,\n file.linkedFieldName\n );\n\n if (!fileField) {\n // Field not found - use default cascade behavior\n await this.applyOnParentDeleteBehavior(\n file.fileId,\n 'cascade',\n executionContext,\n teardownOptions\n );\n continue;\n }\n\n const onParentDelete = fileField.fileMetadata.onParentDelete || 'cascade';\n\n await this.applyOnParentDeleteBehavior(\n file.fileId,\n onParentDelete,\n executionContext,\n teardownOptions\n );\n }\n\n this.logDebug('File fields processing for DELETE completed', {\n resourceType,\n resourceId,\n processedFilesCount: linkedFiles.length,\n });\n }\n\n /**\n * Process file fields when a resource row is IMPERSONALIZED-AND-RETAINED (gate **G-FILE**).\n *\n * The row survives for a legal/audit obligation, so this is NOT the delete cascade — but \"keep the\n * record\" must not become \"keep the personal data\". A field-level scrub cannot reach inside a stored\n * blob (a passport scan stays a passport scan however the row is rewritten), so for a file field the\n * only real erasure is deleting the file.\n *\n * Which files? Exactly the ones whose field the author marked personal with `.impersonalizeWith()` —\n * the SAME author-responsibility contract as ordinary fields, reusing the same vocabulary rather\n * than inventing a second axis. The caller passes the scrub patch's field names:\n * - field IS scrubbed (REMOVE) ⇒ delete the file. The scrub patch nulls the pointer in the same\n * write, so the retained row keeps no dangling reference.\n * - field NOT scrubbed (KEEP / untreated) ⇒ leave the file. This is how a legally-required artifact\n * (an invoice PDF that IS the retained record) survives the erasure.\n *\n * Why deletion is required rather than relying on the row being hidden: the resource-scoped serve\n * route inherits the parent's READ authorization, so a hidden retained row already blocks it — but\n * the GLOBAL `/files/:fileId` route (direct / consumable-token / public-share) is explicitly NOT\n * resource-scoped and re-checks only the file's OWN scope. A file left ACTIVE therefore stays\n * reachable there even though its parent row is invisible.\n *\n * Erasure here goes through `FilesBackendService.eraseFile`, NOT `deleteFile`: besides marking the\n * file DELETED it scrubs the file row's OWN personal data (`originalFilename`, `uploadedBy`) in the\n * same write. Without that, the row's metadata stayed readable on the global metadata route for the\n * weeks until physical cleanup — an \"erasure\" that leaked `passport-jane-doe.pdf` the whole time. A\n * lifecycle delete deliberately keeps that provenance; a privacy erasure must not.\n *\n * Physical storage cleanup stays with the existing cleanup batch, so an erasure never mixes a DB\n * rollback with non-transactional storage side effects.\n *\n * ## The MIDDLE state — keep-but-hide — is deliberately NOT built (decided 2026-08-09)\n *\n * There are only two outcomes above, and the consequence of the second is worth stating plainly: a KEEP\n * file stays ORDINARILY READABLE to the file's own scope (its organization) through the global route,\n * indefinitely, even though its parent row is now invisible. A third state — retained but reachable only\n * through the audited see-through door, mirroring the parent row's posture — was considered and refused\n * for three reasons, in order of weight:\n *\n * 1. **It would contradict a decision already taken.** The concrete case that motivates it is the\n * invoice PDF, and the billing retention decision was explicitly \"retained as audit material, and\n * invoices stay VISIBLE\" for ordinary accounting. Hiding retained invoice documents would reverse\n * that, and the sibling ruling on invoice URLs went the same way: keep the document, close the\n * ordinary door only where the document is not itself the record.\n * 2. **A hiding door is worthless without its reading door, and shipping one alone is worse than\n * neither.** Withholding the file without also building an audited retrieval primitive would make\n * the legally-required artifact unreachable by ANYONE — destroying the very access the retention\n * obligation exists to preserve. (Same pairing rule as the cross-tenant repair doors: a marking\n * door without its release door is a one-way door calling itself a window.)\n * 3. **No shipped resource needs it.** The author already controls both ends per field: mark the field\n * and the file is erased, leave it and the file survives. The gap is only the middle, and nothing in\n * the tree declares a file field that is simultaneously personal, legally required, and must stop\n * being ordinarily visible.\n *\n * **What would trigger building it:** a resource declaring exactly that combination. The shape is then a\n * new `FileStatus` member excluded from `FILE_DOWNLOADABLE_STATUSES` and added to\n * `FILE_METADATA_WITHHELD_STATUSES`, a `FILE_STATUS_TRANSITIONS` entry, and — non-optional — an audited\n * see-through retrieval primitive alongside it. Do not add the status without the door.\n */\n async processFileFieldsForImpersonalize(\n resourceType: ResourceType,\n resourceId: string,\n scrubbedFieldNames: readonly string[],\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n options = this.stripParentVersionFence(options);\n\n if (scrubbedFieldNames.length === 0 || !this.fileFieldDetection.hasFileFields(resourceType)) {\n return;\n }\n\n const scrubbedFields = new Set(scrubbedFieldNames);\n const linkedFiles = await this.filesService.listFilesForResource(\n resourceType,\n resourceId,\n undefined, // all fields — we filter by treatment below\n executionContext,\n options\n );\n\n let erasedCount = 0;\n let unattributableCount = 0;\n for (const file of linkedFiles) {\n // Fail-closed on an unattributable file: without `linkedFieldName` we cannot tell whether its\n // field was marked personal, and silently keeping it risks retaining an erased subject's\n // document. The delete cascade defaults such a file to cleanup for the same reason.\n const isUnattributable = !file.linkedFieldName;\n const isScrubbedField = isUnattributable || scrubbedFields.has(file.linkedFieldName!);\n if (!isScrubbedField) {\n continue;\n }\n if (isUnattributable) {\n /**\n * WARN, not debug: this is an irreversible deletion taken on a GUESS.\n *\n * The fail-closed default is right — a file we cannot attribute might be the erased subject's\n * passport scan — but it can equally destroy a file the retention obligation existed to KEEP\n * (an invoice PDF whose link lost its field name). Either way the cause is upstream metadata,\n * so it has to be visible: the sibling delete cascade has warned here since before this path\n * existed, and this one erased silently. Same decision, same audibility.\n */\n unattributableCount += 1;\n this.logger.warn(\n '[Retention] Erasing a linked file with no `linkedFieldName` during impersonalize — it cannot '\n + 'be attributed to a field, so the fail-closed default deletes it. If this file was meant to '\n + 'be RETAINED, its link metadata is the defect.',\n { resourceType, resourceId, fileId: file.fileId },\n );\n }\n // Forward the owner `listFilesForResource` already verified for THIS file to the deletion gate,\n // so a system-cascade (identity-less EC) impersonalize erase does not deny the subject's own file.\n await this.filesService.eraseFile(file.fileId, executionContext, this.withAuthoritativeFileScope(options, file));\n erasedCount++;\n }\n\n this.logDebug('File fields processing for IMPERSONALIZE completed', {\n resourceType,\n resourceId,\n linkedFilesCount: linkedFiles.length,\n erasedCount,\n retainedCount: linkedFiles.length - erasedCount,\n unattributableCount,\n });\n }\n\n /**\n * Extract file IDs from field value (handles single file or array).\n *\n * @param fieldValue - The raw field value from the resource object\n * @param executionContext - Current execution context\n * @param strict - When true (user input / new values), throws on invalid fileIds.\n * When false (existing DB data), silently filters and logs warnings.\n */\n private extractFileIds(fieldValue: any, executionContext?: ExecutionContext<any>, strict: boolean = false): string[] {\n if (fieldValue === null || fieldValue === undefined) {\n return [];\n }\n\n if (typeof fieldValue === 'object' && !Array.isArray(fieldValue)) {\n if ('fileId' in fieldValue) {\n return this.extractFileIds((fieldValue as { fileId?: unknown }).fileId, executionContext, strict);\n }\n\n if ('fileIds' in fieldValue) {\n return this.extractFileIds((fieldValue as { fileIds?: unknown }).fileIds, executionContext, strict);\n }\n }\n\n if (Array.isArray(fieldValue)) {\n const validFileIds: string[] = [];\n for (const fileId of fieldValue) {\n if (typeof fileId !== 'string' || fileId.trim() === '') {\n if (strict) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_ID_VALIDATION_FAILED,\n context: {\n // diagnostic (log-only)\n fileId,\n receivedType: typeof fileId,\n },\n }\n );\n }\n continue;\n }\n try {\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n validFileIds.push(fileId);\n } catch (error) {\n if (strict) {\n throw error; // Re-throw in strict mode — user provided invalid input\n }\n // Tolerant mode: filter out and warn (handles corrupt DB data gracefully)\n this.logger.warn('Invalid fileId filtered out during extraction', {\n fileId,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n return validFileIds;\n }\n\n if (typeof fieldValue === 'string' && fieldValue.trim() !== '') {\n try {\n validateFileId(fieldValue, this.errorBuilder, executionContext, 'fileId');\n return [fieldValue];\n } catch (error) {\n if (strict) {\n throw error;\n }\n this.logger.warn('Invalid fileId filtered out during extraction', {\n fileId: fieldValue,\n ...projectCaughtErrorLogFields(error),\n });\n return [];\n }\n }\n\n if (strict && fieldValue !== null && fieldValue !== undefined) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_FIELD_VALUE_INVALID,\n context: {\n // diagnostic (log-only)\n receivedType: typeof fieldValue,\n },\n }\n );\n }\n\n return [];\n }\n\n /**\n * Link a file to a resource.\n * Handles race conditions (idempotent - safe to call multiple times).\n */\n private async linkFileToResource(\n fileId: string,\n resourceType: ResourceType,\n resourceId: string,\n fieldName: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n\n // Check if file is already linked to the same resource (idempotent check - before calling service)\n // This prevents unnecessary service calls and handles idempotent cases early\n const file = await this.filesService.getFile(fileId, executionContext, options);\n if (file &&\n file.status === FileStatus.LINKED &&\n file.linkedResourceType === resourceType &&\n file.linkedResourceId === resourceId &&\n file.linkedFieldName === fieldName) {\n // Already linked to same resource - skip (idempotent)\n this.logDebug('File already linked to same resource, skipping', {\n fileId,\n resourceType,\n resourceId,\n fieldName,\n });\n return;\n }\n\n // Link file - errors propagate to fail the transaction (Decision 2.2: Option A)\n // FilesBackendService.linkFileToResource() handles idempotent cases internally (returns existing file)\n // All other errors (NOT_FOUND, BUSINESS_RULE, INTERNAL) should fail the operation\n await this.filesService.linkFileToResource(\n fileId,\n resourceType,\n resourceId,\n fieldName,\n executionContext,\n options\n );\n }\n\n /**\n * Unlink a file from a resource.\n * Applies onParentDelete behavior.\n */\n private async unlinkFileFromResource(\n fileId: string,\n fieldName: string,\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n // Validate fileId format (CRITICAL: Prevents query injection and database errors)\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n const file = await this.filesService.getFile(fileId, executionContext, options);\n if (!file || file.status !== FileStatus.LINKED) {\n // Already unlinked or doesn't exist - skip (idempotent)\n return;\n }\n\n // Unlink file (sets status to ORPHANED)\n await this.filesService.unlinkFileFromResource(fileId, executionContext, options);\n }\n\n /**\n * Apply onParentDelete behavior to a file.\n *\n * @param fileId - File ID\n * @param behavior - Behavior: 'cascade', 'soft-delete', or 'orphan'\n * @param executionContext - Execution context\n */\n private async applyOnParentDeleteBehavior(\n fileId: string,\n behavior: 'cascade' | 'soft-delete' | 'orphan',\n executionContext: ExecutionContext<any>,\n options?: RepositoryOptions\n ): Promise<void> {\n this.logDebug('Applying onParentDelete behavior', {\n fileId,\n behavior,\n });\n\n switch (behavior) {\n case 'cascade':\n // Cascade now marks the file as DELETED only. Physical storage cleanup is\n // intentionally deferred to the cleanup batch so resource deletes never\n // mix Mongo rollback with non-transactional storage side effects.\n await this.filesService.deleteFile(fileId, executionContext, options);\n break;\n\n case 'soft-delete':\n // Soft delete: update status to DELETED\n await this.filesService.deleteFile(fileId, executionContext, options);\n break;\n\n case 'orphan':\n // Unlink: clear parent fields, set status to ORPHANED\n await this.filesService.unlinkFileFromResource(fileId, executionContext, options);\n break;\n\n default:\n // Default to cascade\n await this.filesService.deleteFile(fileId, executionContext, options);\n }\n }\n\n private prepareOccurrences(\n occurrences: FileFieldValueOccurrence[],\n executionContext: ExecutionContext<any>,\n strict: boolean,\n ): Array<{\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n }> {\n return occurrences.map((occurrence) => {\n const fileIds = this.extractFileIds(occurrence.value, executionContext, strict);\n return {\n occurrence,\n fileIds,\n signature: JSON.stringify([...fileIds].sort()),\n };\n });\n }\n\n private matchOccurrences(\n oldOccurrences: Array<{\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n }>,\n newOccurrences: Array<{\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n }>,\n ): {\n pairs: Array<{\n oldOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n newOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n }>;\n requiresAmbiguousFallback: boolean;\n } {\n const pairs: Array<{\n oldOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n newOccurrence?: {\n occurrence: FileFieldValueOccurrence;\n fileIds: string[];\n signature: string;\n };\n }> = [];\n\n const remainingOld = [...oldOccurrences];\n const remainingNew = [...newOccurrences];\n\n const stableIds = new Set(\n [...remainingOld, ...remainingNew]\n .map((entry) => entry.occurrence.ownerStableId)\n .filter((value): value is string => typeof value === 'string' && value.trim() !== ''),\n );\n\n for (const stableId of stableIds) {\n const oldMatches = remainingOld.filter((entry) => entry.occurrence.ownerStableId === stableId);\n const newMatches = remainingNew.filter((entry) => entry.occurrence.ownerStableId === stableId);\n\n while (oldMatches.length > 0 && newMatches.length > 0) {\n const oldEntry = oldMatches.shift()!;\n const newEntry = newMatches.shift()!;\n remainingOld.splice(remainingOld.indexOf(oldEntry), 1);\n remainingNew.splice(remainingNew.indexOf(newEntry), 1);\n pairs.push({ oldOccurrence: oldEntry, newOccurrence: newEntry });\n }\n }\n\n const oldSignatureBuckets = new Map<string, typeof remainingOld>();\n for (const entry of remainingOld) {\n if (entry.occurrence.ownerStableId) {\n continue;\n }\n const bucket = oldSignatureBuckets.get(entry.signature) ?? [];\n bucket.push(entry);\n oldSignatureBuckets.set(entry.signature, bucket);\n }\n\n for (const newEntry of [...remainingNew]) {\n if (newEntry.occurrence.ownerStableId) {\n continue;\n }\n\n const bucket = oldSignatureBuckets.get(newEntry.signature);\n const oldEntry = bucket?.shift();\n if (!oldEntry) {\n continue;\n }\n\n remainingOld.splice(remainingOld.indexOf(oldEntry), 1);\n remainingNew.splice(remainingNew.indexOf(newEntry), 1);\n pairs.push({ oldOccurrence: oldEntry, newOccurrence: newEntry });\n }\n\n const requiresAmbiguousFallback =\n remainingOld.some((entry) => !entry.occurrence.ownerStableId) &&\n remainingNew.some((entry) => !entry.occurrence.ownerStableId);\n\n while (remainingOld.length > 0 || remainingNew.length > 0) {\n pairs.push({\n oldOccurrence: remainingOld.shift(),\n newOccurrence: remainingNew.shift(),\n });\n }\n\n return {\n pairs,\n requiresAmbiguousFallback,\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"file-population.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/files/services/file-population.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,EAA0C,MAAM,uBAAuB,CAAC;AAE7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAqB,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AAEvG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAG9G,OAAO,EAAE,iBAAiB,EAAE,MAAM,qEAAqE,CAAC;AAMxG;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,sDAAsD;IACtD,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,qBACa,4BAA4B;IAKrC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAEnC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAV/B,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;gBAI9D,MAAM,EAAE,aAAa,EAErB,kBAAkB,EAAE,gCAAgC,EAEpD,YAAY,EAAE,mBAAmB,EAEjC,YAAY,EAAE,0BAA0B;IAM3D;;;;;;;;;;OAUG;IACG,kBAAkB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAC5E,IAAI,EAAE,CAAC,EACP,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,iBAAiB,GAAE,qBAA0B,EAC7C,iBAAiB,CAAC,EAAE,iBAAiB,GACpC,OAAO,CAAC,CAAC,CAAC;IAqBb;;;;;;;;;OASG;YACW,yBAAyB;IAuGvC;;;;;;;;OAQG;YACW,2BAA2B;IAqEzC,OAAO,CAAC,cAAc;IA0BtB,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,wBAAwB;YAyElB,wBAAwB;CAoEvC"}
1
+ {"version":3,"file":"file-population.backend.service.d.ts","sourceRoot":"","sources":["../../../../src/files/services/file-population.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,EAA0C,MAAM,uBAAuB,CAAC;AAE7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,gCAAgC,EAAqB,MAAM,wCAAwC,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAA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,CAAC,KAAK,IAAI,CAAC;IAEjF,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA0C;gBAIxD,MAAM,EAAE,aAAa,EAErB,YAAY,EAAE,0BAA0B,EAExC,YAAY,EAAE,mBAAmB,EAEjC,gBAAgB,EAAE,uBAAuB,EAEzC,aAAa,EAAE,2BAA2B,EAE1C,WAAW,EAAE,yBAAyB,EAEtC,iBAAiB,EAAE,+BAA+B,EAUlD,gBAAgB,CAAC,EAAE,uBAAuB;IAK7D;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CAAC,YAAY,CAAC,EAAE,kBAAkB,GAAG,OAAO;IAStD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,uBAAuB,IAAI,OAAO;IAKlC;;;;;;;;;;;;;OAaG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC;IAsChB;;;;;;;;;OASG;YACW,WAAW;IA2JzB;;;;;;OAMG;IACG,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC;IAoFhB;;;;;;;;;;;OAWG;YACW,sBAAsB;IA2CpC,yGAAyG;YAC3F,yBAAyB;IAYvC;;;;;;OAMG;YACW,sBAAsB;CAsBrC"}
1
+ {"version":3,"file":"file-scanning.backend.service.d.ts","sourceRoot":"","sources":["../../../../src/files/services/file-scanning.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AASH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,M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,2BAA2B,EAE1C,WAAW,EAAE,yBAAyB,EAEtC,iBAAiB,EAAE,+BAA+B,EAUlD,gBAAgB,CAAC,EAAE,uBAAuB;IAK7D;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CAAC,YAAY,CAAC,EAAE,kBAAkB,GAAG,OAAO;IAStD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,uBAAuB,IAAI,OAAO;IAKlC;;;;;;;;;;;;;OAaG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAC5B,OAAO,CAAC,IAAI,CAAC;IAsChB;;;;;;;;;OASG;YACW,WAAW;IAgKzB;;;;;;OAMG;IACG,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC;IAoFhB;;;;;;;;;;;OAWG;YACW,sBAAsB;IA2CpC,yGAAyG;YAC3F,yBAAyB;IAYvC;;;;;;OAMG;YACW,sBAAsB;CAsBrC"}
@@ -245,10 +245,15 @@ let FileScanningBackendService = class FileScanningBackendService {
245
245
  });
246
246
  return;
247
247
  }
248
+ // Carries `uploadedBy` / `uploadedByEntityType` beside the three routing fields: a vendor-backed
249
+ // storage resolves the LINKER's grant from them, and a scanner that dropped them could never
250
+ // download a Drive file — every layer would answer ERROR on a healthy row (#394 P5).
248
251
  const downloadParams = {
249
252
  fileId: file.fileId,
250
253
  storageProvider: file.storageProvider,
251
254
  storageRef: file.storageRef,
255
+ uploadedBy: file.uploadedBy,
256
+ uploadedByEntityType: file.uploadedByEntityType,
252
257
  };
253
258
  const executedScannerLayers = [];
254
259
  // ── Layer 1: ClamAV ────────────────────────────────────────────────
@@ -1 +1 @@
1
- {"version":3,"file":"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BAAyB;QAEnB,+BAA+B;GAnB1D,0BAA0B,CA2gBtC","sourcesContent":["/**\n * File Scanning Backend Service\n *\n * Orchestrates antivirus scanning for uploaded files. After a file\n * reaches UPLOADED status, this service:\n *\n * 1. Transitions the file to SCANNING\n * 2. Downloads the file from storage\n * 3. Submits to ClamAV via TCP (signature-based)\n * 4. If ClamAV passes, submits to YARA via REST (pattern-based, optional)\n * 5. Processes combined results (CLEAN / INFECTED)\n * 6. Quarantines infected files\n *\n * Scanning is **fail-closed at the gate, asynchronous in the pipeline** (#433). The upload handler\n * AWAITS `initiateScan`, which awaits the UPLOADED -> SCANNING transition and only then fires the\n * pipeline — so the upload response costs one status write, not a scan, and the file is already\n * non-downloadable when the caller is told the upload succeeded. It becomes downloadable when the\n * result handler transitions it to CLEAN.\n *\n * This paragraph used to say the response \"returns immediately with status UPLOADED\", and that was\n * the defect: UPLOADED is a downloadable status, so a field declaring `scanPolicy: 'required'` had\n * a window in which unscanned bytes were servable. If scanning is not required for the field, the\n * file stays at UPLOADED and remains downloadable — that half is unchanged and deliberate.\n *\n * Configuration:\n * - Application-wide: DERIVED, not declared. Scanning is on for a field that states no policy of its\n * own exactly when a scanner is reachable — `fileScanning.antivirus` (seeded from `CLAMAV_HOST`) or\n * `fileScanning.yara` both enabled and reachable (`YARA_ENABLED` + `YARA_HOST`). Provisioning the\n * sidecar IS the application-level opt-in; there is no separate on/off flag. See\n * {@link FileScanningBackendService.isGlobalScanningEnabled} for why it is derived rather than declared.\n * - Per-field: `z_file({ scanPolicy: 'required' | 'skip' })` overrides that, in both directions.\n *\n * These two lines used to name `appConfig.files.scanning.enabled`, a configuration path no schema has\n * ever declared — so the application-wide half was documented, cast through `any`, and dead.\n *\n * A scan that was REQUESTED and finds no scanner now FAILS the file rather than passing it; the tail of\n * `executeScan` carries the reasoning.\n */\n\nimport { injectable, inject, optional } from 'inversify';\nimport {\n ErrorType,\n ErrorCustomMessageReference,\n FileStatus,\n FILE_STATUS_TRANSITIONS,\n} from '@wildo-ai/saas-models';\nimport type { FileSchemaMetadata } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\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 { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { ClamAVScannerBackendService } from '~wildo-backend-lib/files/scanning/clamav-scanner.backend.service';\nimport {\n FileScanVerdict,\n type FileScanResult,\n} from '~wildo-backend-lib/files/scanning/file-scan.types';\nimport { YaraScannerBackendService } from '~wildo-backend-lib/files/scanning/yara-scanner.backend.service';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nexport {\n FileScanVerdict,\n type FileScanResult,\n} from '~wildo-backend-lib/files/scanning/file-scan.types';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Service\n// ─────────────────────────────────────────────────────────────────────────────\n\n@injectable()\nexport class FileScanningBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n private readonly onCleanCallbacks = new Map<string, () => Promise<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.FilesBackendService)\n private readonly filesService: FilesBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.ClamAVScannerService)\n private readonly clamavScanner: ClamAVScannerBackendService,\n @inject(SAAS_SERVICE_TYPES.YaraScannerService)\n private readonly yaraScanner: YaraScannerBackendService,\n @inject(SAAS_SERVICE_TYPES.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n /*\n * `@optional()` because a container without the audit service must still SCAN (#506). The record\n * is what this issue adds; refusing to inspect content when the recorder is absent would trade a\n * missing audit row for missing malware detection, which is the worse of the two.\n *\n * The emission below is likewise best-effort: an audit failure must not turn a successful\n * quarantine into an exception that leaves the file mid-transition.\n */\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) @optional()\n private readonly auditLogsService?: AuditLogsBackendService,\n ) {\n this.logDebug = this.logger.debugByType('FileScanningBackendService');\n }\n\n /**\n * Determine whether a file should be scanned after upload.\n *\n * Resolution order:\n * 1. Per-field `z_file({ scanPolicy })` wins if set\n * 2. Falls back to the application-wide answer, {@link isGlobalScanningEnabled}\n *\n * assurance-control: WILDO.SECURITY.INGESTED_CONTENT_INSPECTION — whether ingested content is\n * inspected is a declared decision, per field and then per application, rather than an implicit one.\n *\n * The per-APPLICATION half of that claim was false until 2026-09-09: step 2 read a configuration path\n * no schema declares, so it answered `false` in every application ever built and `scanPolicy` was the\n * only reachable declaration. It is true now because the application-wide answer is DERIVED from the\n * scanner topology the operator provisions — a declaration made by supplying `CLAMAV_HOST`, and\n * refused a default. Nothing here is implicit in either direction: a field can still override, and a\n * requested scan with no scanner refuses rather than passing (see the tail of `executeScan`).\n */\n shouldScan(fileMetadata?: FileSchemaMetadata): boolean {\n const scanPolicy = fileMetadata?.scanPolicy;\n\n if (scanPolicy === 'required') return true;\n if (scanPolicy === 'skip') return false;\n\n return this.isGlobalScanningEnabled();\n }\n\n /**\n * Whether scanning is on APPLICATION-WIDE, for a file field that states no `scanPolicy` of its own.\n *\n * DERIVED from the platform-injected `fileScanning` topology: a scanner being reachable IS the\n * application-level opt-in.\n *\n * ## What this replaced\n *\n * `(this.appConfigService.config as Record<string, any>)?.files?.scanning?.enabled === true`. The\n * `any` cast is the tell — `AppConfigurationSchema` declares no `files` section, `z.object` strips\n * unknown keys, so the parsed configuration could never carry that path and the expression was\n * `undefined === true` for every application, for the whole life of the flag. The service's own\n * docstring documented it as the global switch.\n *\n * ## Why DERIVED rather than declared\n *\n * Adding an `enabled` boolean to `AppConfiguration_FileScanningSchema` was the other candidate and is\n * rejected on three counts:\n *\n * - **the answer already exists.** `fileScanning` is a mutation-boundary-PROTECTED section\n * (`APP_CONFIG_MUTATION_BOUNDARY_RULES` in `app-config.backend-authored.definitions.ts`: \"file-scanning\n * sidecar topology and its platform-level opt-in are env/bootstrap-owned\"), so an application cannot\n * author it. A boolean would have to be seeded from a NEW environment key sitting beside the host key\n * that already says the same thing — a second source of truth that can disagree with the first;\n * - **it matches the convention of the thing it gates.** ClamAV has no enable flag anywhere in this\n * subsystem: `ClamAVScannerBackendService.isConfigured()` states \"presence of a host IS the opt-in\",\n * and `buildFileServicesTopologyFromEnvironment` refuses to emit a plausible default host for exactly\n * that reason;\n * - **it closes the hole the repair would otherwise open.** A separate boolean makes \"globally on, no\n * scanner reachable\" a REPRESENTABLE state, and that state is precisely the one the pipeline used to\n * answer with a CLEAN verdict. Derived, the state cannot exist: the switch is on only when something\n * can actually run. The runtime refusal in `executeScan` stays regardless, because `scanPolicy:\n * 'required'` reaches the same tail without consulting this switch at all.\n *\n * The two predicates are the pipeline's OWN — `executeScan` gates its two layers on exactly\n * `clamavScanner.isConfigured()` and `yaraScanner.isEnabled()` — so the switch and the pipeline cannot\n * come to different conclusions about whether a scan is possible. Note `isEnabled()` is already the\n * conjunction of YARA's two independent axes (opted in AND reachable), which is why the \"enabled but\n * unreachable\" misconfiguration does not read as an application-wide opt-in here; the startup validator\n * reports it as its own issue instead.\n *\n * The `isInitialized()` guard stays: both scanner reads deliberately throw\n * `app_configuration_not_initialized` rather than softening to `false`, and a scan decision taken before\n * configuration has landed is not a decision.\n */\n isGlobalScanningEnabled(): boolean {\n if (!this.appConfigService.isInitialized()) return false;\n return this.clamavScanner.isConfigured() || this.yaraScanner.isEnabled();\n }\n\n /**\n * Initiate scanning for a file that just reached UPLOADED status.\n *\n * Transitions to SCANNING, then dispatches the scan job.\n * The response is fire-and-forget: the caller does not wait for scan\n * completion — scan results are processed asynchronously via\n * `handleScanResult()`.\n *\n * @param onClean - Optional callback invoked when scan verdict is CLEAN.\n * Used to chain post-scan work that must only run on safe bytes. Note the file\n * STATUS lifecycle ends at CLEAN for processing purposes — RAG chunking of a\n * `ragSource` file field is per-field derived data (chunk rows), never a file\n * status transition.\n */\n async initiateScan(\n fileId: string,\n executionContext: ExecutionContext<any>,\n onClean?: () => Promise<void>,\n ): Promise<void> {\n const allowedTransitions = FILE_STATUS_TRANSITIONS[FileStatus.UPLOADED];\n if (!allowedTransitions.includes(FileStatus.SCANNING)) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_INVALID_STATUS_TRANSITION,\n context: {\n fileId, // diagnostic (log-only)\n },\n },\n );\n }\n\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.SCANNING,\n executionContext,\n );\n\n if (onClean) {\n this.onCleanCallbacks.set(fileId, onClean);\n }\n\n this.logDebug('File transitioned to SCANNING, dispatching scan', { fileId });\n\n // Run the full scanning pipeline asynchronously. The file is already in\n // SCANNING status so downloads are blocked until the result handler\n // transitions it to CLEAN / INFECTED / FAILED.\n this.executeScan(fileId, executionContext).catch((err) => {\n this.logger.error('Scan execution failed unexpectedly', {\n fileId,\n ...projectCaughtErrorLogFields(err),\n });\n });\n }\n\n /**\n * Download the file from storage and run the scanning pipeline.\n *\n * Pipeline order:\n * 1. ClamAV (signature-based) — if configured\n * 2. YARA (pattern-based) — if enabled and ClamAV passed\n *\n * Short-circuits on first INFECTED verdict. YARA only runs if the\n * file survived ClamAV — no point in pattern-matching a known virus.\n */\n private async executeScan(\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n const file = await this.filesService.getFile(fileId, executionContext);\n if (!file) {\n this.logger.error('File not found for scanning', { fileId });\n return;\n }\n\n // Resolve through FilesBackendService rather than the router directly, so a\n // LEGACY row that persisted no `storageProvider` falls back to the default\n // provider instead of failing the scan. Reimplementing the lookup here is what\n // made this one of five different behaviours for a provider-less row.\n //\n // The throw is deliberately converted back into a terminal verdict rather than\n // propagated. `getStorageProviderForFile` throws INTERNAL when the persisted id\n // is not registered, and this pipeline is fire-and-forget — its dispatcher's\n // `.catch()` only LOGS. An escaping throw would therefore leave the file in\n // SCANNING permanently, and downloads stay blocked until a result handler moves\n // it out. That is strictly worse than the ERROR verdict this site already\n // recorded, so the drift is closed WITHOUT adopting the reference behaviour on\n // the throwing branch.\n let provider;\n try {\n provider = this.filesService.getStorageProviderForFile(file, executionContext);\n } catch (err) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: `Storage provider '${file.storageProvider}' not available for scan download`,\n scannerRef: 'scan-pipeline',\n }, executionContext);\n this.logger.error('Scan aborted: persisted storage provider is not registered', {\n fileId,\n storageProvider: file.storageProvider,\n ...projectCaughtErrorLogFields(err),\n });\n return;\n }\n\n const downloadParams = {\n fileId: file.fileId,\n storageProvider: file.storageProvider,\n storageRef: file.storageRef,\n };\n const executedScannerLayers: string[] = [];\n\n // ── Layer 1: ClamAV ────────────────────────────────────────────────\n if (this.clamavScanner.isConfigured()) {\n executedScannerLayers.push('clamav');\n let downloadResult;\n try {\n downloadResult = await provider.download(downloadParams, executionContext);\n } catch (err) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: `Failed to download file for ClamAV: ${describeCaughtError(err)}`,\n scannerRef: 'clamav',\n }, executionContext);\n return;\n }\n\n try {\n const clamResult = await this.clamavScanner.scanStream(downloadResult.stream, fileId);\n\n if (clamResult.verdict !== FileScanVerdict.CLEAN) {\n await this.handleScanResult(fileId, clamResult, executionContext);\n return;\n }\n\n this.logDebug('ClamAV layer passed', { fileId, durationMs: clamResult.durationMs });\n } finally {\n if (!downloadResult.stream.destroyed) {\n downloadResult.stream.destroy();\n }\n }\n } else {\n this.logDebug('ClamAV not configured — skipping signature scan', { fileId });\n }\n\n // ── Layer 2: YARA (optional, platform-level) ───────────────────────\n if (this.yaraScanner.isEnabled()) {\n executedScannerLayers.push('yara');\n let downloadResult;\n try {\n downloadResult = await provider.download(downloadParams, executionContext);\n } catch (err) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: `Failed to download file for YARA: ${describeCaughtError(err)}`,\n scannerRef: 'yara',\n }, executionContext);\n return;\n }\n\n try {\n const yaraResult = await this.yaraScanner.scanStream(downloadResult.stream, fileId);\n\n if (yaraResult.verdict !== FileScanVerdict.CLEAN) {\n await this.handleScanResult(fileId, yaraResult, executionContext);\n return;\n }\n\n this.logDebug('YARA layer passed', { fileId, durationMs: yaraResult.durationMs });\n } finally {\n if (!downloadResult.stream.destroyed) {\n downloadResult.stream.destroy();\n }\n }\n }\n\n // ── Nothing ran: refuse, do not certify ────────────────────────────\n //\n // This branch used to log a warning and then hand `handleScanResult` a CLEAN verdict with\n // `scannerRef: 'none'` — which transitions the file to `FileStatus.CLEAN`, a member of\n // `FILE_DOWNLOADABLE_STATUSES`. A scan had been REQUESTED (`shouldScan` said yes, `initiateScan`\n // moved the file to SCANNING, the uploader was told the upload succeeded), and the answer returned\n // was the answer a PASSING scan gives, produced by no scanner. That is strictly worse than not\n // scanning at all: a field declaring `scanPolicy: 'required'` ended with bytes certified clean, and\n // the only trace was a warning in a log nobody reads.\n //\n // ERROR -> `FileStatus.FAILED` is the fail-closed terminal, and the right one rather than merely the\n // safe one: FAILED is outside `FILE_DOWNLOADABLE_STATUSES` so the bytes are blocked, it is outside\n // `FILE_METADATA_WITHHELD_STATUSES` so the uploader can still poll and see WHY, and\n // `FILE_STATUS_TRANSITIONS` keeps SCANNING -> FAILED, so nothing about the lifecycle has to move.\n // A file that failed this way becomes scannable again the moment a scanner is provisioned.\n //\n // Keyed on `executedScannerLayers` — direct evidence that nothing ran — rather than on re-asking the\n // two `isConfigured()` predicates. Re-asking would be a second copy of the decision the two layer\n // gates above already took, and the copies can disagree if a layer ever grows another skip reason.\n //\n // Not redundant with the boot gate, which is the obvious objection. `collectScanningIssues` refuses\n // to start an application whose fields declare `scanPolicy: 'required'` when ClamAV is unconfigured,\n // so in a well-formed deployment this branch is unreachable. But that gate builds its population by\n // walking every resource's file fields inside `try { … } catch { continue; }`: a resource whose field\n // detection throws contributes no fields and is silently absent from the count. A boot check that can\n // under-report the population it protects is not a substitute for the refusal at the site itself.\n if (executedScannerLayers.length === 0) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: 'Scan was requested but no scanner is configured (no ClamAV host, and YARA not enabled/reachable) — refusing to certify the file as clean',\n scannerRef: 'none',\n }, executionContext);\n return;\n }\n\n // ── All layers that ran, passed ────────────────────────────────────\n // `join('+')` needs no `|| 'none'` fallback any more: the empty case returned above, so a CLEAN\n // verdict from here always names at least one scanner that actually executed.\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.CLEAN,\n scannerRef: executedScannerLayers.join('+'),\n }, executionContext);\n }\n\n /**\n * Process the result of a scan job.\n *\n * - CLEAN: transition to CLEAN (file becomes downloadable)\n * - INFECTED: transition to INFECTED, then quarantine\n * - ERROR: transition to FAILED (retryable via re-scan)\n */\n async handleScanResult(\n fileId: string,\n result: FileScanResult,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n this.logDebug('Processing scan result', {\n fileId,\n verdict: result.verdict,\n threatName: result.threatName,\n scannerRef: result.scannerRef,\n durationMs: result.durationMs,\n });\n\n /*\n * assurance-control: WILDO.SECURITY.INGESTED_CONTENT_INSPECTION — the scanner's verdict becomes a\n * member of `FileStatus`, which is also what `FILE_DOWNLOADABLE_STATUSES` reads, so \"inspected\" and\n * \"servable\" are one decision rather than two that could disagree. `FileScanVerdict` names the\n * scanner's answer; `FileStatus` is the one with consequence, which is why the assurance capability\n * derives from it.\n *\n * The outcome now ALSO reaches the audit trail (#506): `FILE_MALWARE_DETECTED` when a scanner\n * concludes an infection, `FILE_MALWARE_SCAN_FAILED` when the scan could not run. Both are\n * emitted AFTER the terminal transition, so the row can never describe a state the record does\n * not hold. Until they existed, an infection produced a status change and nothing else — the only\n * way to learn malware had arrived was to notice a row sitting at `QUARANTINED`.\n */\n switch (result.verdict) {\n case FileScanVerdict.CLEAN:\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.CLEAN,\n executionContext,\n );\n this.logDebug('File marked as CLEAN after scan', { fileId });\n\n // Invoke the post-clean callback (generic post-scan work registered by initiateScan's\n // caller). RAG ingestion is deliberately NOT chained here: the service-tier write hook and\n // the hourly reconciliation sweep own corpus derivation, and the ingestion pipeline itself\n // refuses non-downloadable files — so a file that finishes scanning is picked up by the\n // next sweep run with no per-file callback wiring.\n const onClean = this.onCleanCallbacks.get(fileId);\n if (onClean) {\n this.onCleanCallbacks.delete(fileId);\n onClean().catch((err) => {\n this.logger.error('Post-clean callback failed', {\n fileId,\n ...projectCaughtErrorLogFields(err),\n });\n });\n }\n break;\n\n case FileScanVerdict.INFECTED:\n this.onCleanCallbacks.delete(fileId);\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.INFECTED,\n executionContext,\n );\n this.logger.warn('File flagged as INFECTED', {\n fileId,\n threatName: result.threatName,\n scannerRef: result.scannerRef,\n });\n\n await this.quarantineInfectedFile(fileId, result, executionContext);\n // AFTER the quarantine transition, so `fileStatus` is what the record holds rather than what\n // this method intended. If the quarantine failed, the row says INFECTED, which is true.\n await this.recordScanOutcomeAudit(fileId, result, executionContext);\n break;\n\n case FileScanVerdict.ERROR:\n this.onCleanCallbacks.delete(fileId);\n this.logger.error('Scan failed with error', {\n fileId,\n errorMessage: result.errorMessage,\n scannerRef: result.scannerRef,\n });\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.FAILED,\n executionContext,\n );\n await this.recordScanOutcomeAudit(fileId, result, executionContext);\n break;\n }\n }\n\n /**\n * Write the scan outcome to the audit trail (#506).\n *\n * Best-effort and never throwing: the file's status transition is the enforcement, and an audit\n * store being unavailable must not convert a successful quarantine into an exception that leaves\n * the caller believing the scan failed.\n *\n * A CLEAN verdict is deliberately NOT audited. Every upload is scanned, so a clean row per upload\n * would be the highest-volume event in the trail and would bury the two that matter — and the\n * upload itself is already recorded by `FILE_UPLOAD_GRANT_REDEEMED`. What is added here is the\n * conclusion an operator would want to be alerted on.\n */\n private async recordScanOutcomeAudit(\n fileId: string,\n result: FileScanResult,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n if (!this.auditLogsService) return;\n\n try {\n // Re-read rather than assume: the transition may have failed, and the audit row must describe\n // the record, not the intent.\n const fileStatus = await this.resolveRecordedFileStatus(fileId, executionContext);\n const organizationId = executionContext.initiatorIds?.organizationId;\n const userId = executionContext.initiatorIds?.userId;\n\n if (result.verdict === FileScanVerdict.INFECTED) {\n await this.auditLogsService.logFileMalwareDetected({\n fileId,\n scannerRef: result.scannerRef,\n threatName: result.threatName,\n organizationId,\n userId,\n fileStatus,\n }, executionContext);\n return;\n }\n\n await this.auditLogsService.logFileMalwareScanFailed({\n fileId,\n scannerRef: result.scannerRef,\n failureReason: result.errorMessage,\n organizationId,\n userId,\n fileStatus,\n }, executionContext);\n } catch (error) {\n this.logger.warn('Failed to record the file scan outcome in the audit trail', {\n fileId,\n verdict: result.verdict,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n /** The status the FILES row actually carries after the transition, or `unknown` if it cannot be read. */\n private async resolveRecordedFileStatus(\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<string> {\n try {\n const file = await this.filesService.getFile(fileId, executionContext) as { status?: string } | null;\n return file?.status ?? 'unknown';\n } catch {\n return 'unknown';\n }\n }\n\n /**\n * Quarantine an infected file.\n *\n * Transitions INFECTED → QUARANTINED. The blob remains in storage\n * but the file is permanently blocked from download. Operators can\n * delete quarantined files via admin tooling.\n */\n private async quarantineInfectedFile(\n fileId: string,\n result: FileScanResult,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n try {\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.QUARANTINED,\n executionContext,\n );\n this.logDebug('Infected file quarantined', {\n fileId,\n threatName: result.threatName,\n });\n } catch (error) {\n this.logger.error('Failed to quarantine infected file', {\n fileId,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n}\n"]}
1
+ {"version":3,"file":"file-scanning.backend.service.js","sourceRoot":"","sources":["../../../../src/files/services/file-scanning.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EACL,SAAS,EACT,2BAA2B,EAC3B,UAAU,EACV,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,2BAA2B,EAAE,MAAM,8EAA8E,CAAC;AAEhJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,2BAA2B,EAAE,MAAM,kEAAkE,CAAC;AAC/G,OAAO,EACL,eAAe,GAEhB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,EAAE,+BAA+B,EAAE,MAAM,sEAAsE,CAAC;AACvH,OAAO,EACL,eAAe,GAEhB,MAAM,mDAAmD,CAAC;AAE3D,gFAAgF;AAChF,UAAU;AACV,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E9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAE3C,WAAA,MAAM,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;IAE/C,WAAA,MAAM,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;IAE7C,WAAA,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;IAU5C,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAAE,WAAA,QAAQ,EAAE,CAAA;+CAnBzB,0BAA0B;QAE1B,mBAAmB;QAEf,uBAAuB;QAE1B,2BAA2B;QAE7B,yBAAyB;QAEnB,+BAA+B;GAnB1D,0BAA0B,CAghBtC","sourcesContent":["/**\n * File Scanning Backend Service\n *\n * Orchestrates antivirus scanning for uploaded files. After a file\n * reaches UPLOADED status, this service:\n *\n * 1. Transitions the file to SCANNING\n * 2. Downloads the file from storage\n * 3. Submits to ClamAV via TCP (signature-based)\n * 4. If ClamAV passes, submits to YARA via REST (pattern-based, optional)\n * 5. Processes combined results (CLEAN / INFECTED)\n * 6. Quarantines infected files\n *\n * Scanning is **fail-closed at the gate, asynchronous in the pipeline** (#433). The upload handler\n * AWAITS `initiateScan`, which awaits the UPLOADED -> SCANNING transition and only then fires the\n * pipeline — so the upload response costs one status write, not a scan, and the file is already\n * non-downloadable when the caller is told the upload succeeded. It becomes downloadable when the\n * result handler transitions it to CLEAN.\n *\n * This paragraph used to say the response \"returns immediately with status UPLOADED\", and that was\n * the defect: UPLOADED is a downloadable status, so a field declaring `scanPolicy: 'required'` had\n * a window in which unscanned bytes were servable. If scanning is not required for the field, the\n * file stays at UPLOADED and remains downloadable — that half is unchanged and deliberate.\n *\n * Configuration:\n * - Application-wide: DERIVED, not declared. Scanning is on for a field that states no policy of its\n * own exactly when a scanner is reachable — `fileScanning.antivirus` (seeded from `CLAMAV_HOST`) or\n * `fileScanning.yara` both enabled and reachable (`YARA_ENABLED` + `YARA_HOST`). Provisioning the\n * sidecar IS the application-level opt-in; there is no separate on/off flag. See\n * {@link FileScanningBackendService.isGlobalScanningEnabled} for why it is derived rather than declared.\n * - Per-field: `z_file({ scanPolicy: 'required' | 'skip' })` overrides that, in both directions.\n *\n * These two lines used to name `appConfig.files.scanning.enabled`, a configuration path no schema has\n * ever declared — so the application-wide half was documented, cast through `any`, and dead.\n *\n * A scan that was REQUESTED and finds no scanner now FAILS the file rather than passing it; the tail of\n * `executeScan` carries the reasoning.\n */\n\nimport { injectable, inject, optional } from 'inversify';\nimport {\n ErrorType,\n ErrorCustomMessageReference,\n FileStatus,\n FILE_STATUS_TRANSITIONS,\n} from '@wildo-ai/saas-models';\nimport type { FileSchemaMetadata } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\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 { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { ClamAVScannerBackendService } from '~wildo-backend-lib/files/scanning/clamav-scanner.backend.service';\nimport {\n FileScanVerdict,\n type FileScanResult,\n} from '~wildo-backend-lib/files/scanning/file-scan.types';\nimport { YaraScannerBackendService } from '~wildo-backend-lib/files/scanning/yara-scanner.backend.service';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nexport {\n FileScanVerdict,\n type FileScanResult,\n} from '~wildo-backend-lib/files/scanning/file-scan.types';\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Service\n// ─────────────────────────────────────────────────────────────────────────────\n\n@injectable()\nexport class FileScanningBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n private readonly onCleanCallbacks = new Map<string, () => Promise<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.FilesBackendService)\n private readonly filesService: FilesBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.ClamAVScannerService)\n private readonly clamavScanner: ClamAVScannerBackendService,\n @inject(SAAS_SERVICE_TYPES.YaraScannerService)\n private readonly yaraScanner: YaraScannerBackendService,\n @inject(SAAS_SERVICE_TYPES.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n /*\n * `@optional()` because a container without the audit service must still SCAN (#506). The record\n * is what this issue adds; refusing to inspect content when the recorder is absent would trade a\n * missing audit row for missing malware detection, which is the worse of the two.\n *\n * The emission below is likewise best-effort: an audit failure must not turn a successful\n * quarantine into an exception that leaves the file mid-transition.\n */\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) @optional()\n private readonly auditLogsService?: AuditLogsBackendService,\n ) {\n this.logDebug = this.logger.debugByType('FileScanningBackendService');\n }\n\n /**\n * Determine whether a file should be scanned after upload.\n *\n * Resolution order:\n * 1. Per-field `z_file({ scanPolicy })` wins if set\n * 2. Falls back to the application-wide answer, {@link isGlobalScanningEnabled}\n *\n * assurance-control: WILDO.SECURITY.INGESTED_CONTENT_INSPECTION — whether ingested content is\n * inspected is a declared decision, per field and then per application, rather than an implicit one.\n *\n * The per-APPLICATION half of that claim was false until 2026-09-09: step 2 read a configuration path\n * no schema declares, so it answered `false` in every application ever built and `scanPolicy` was the\n * only reachable declaration. It is true now because the application-wide answer is DERIVED from the\n * scanner topology the operator provisions — a declaration made by supplying `CLAMAV_HOST`, and\n * refused a default. Nothing here is implicit in either direction: a field can still override, and a\n * requested scan with no scanner refuses rather than passing (see the tail of `executeScan`).\n */\n shouldScan(fileMetadata?: FileSchemaMetadata): boolean {\n const scanPolicy = fileMetadata?.scanPolicy;\n\n if (scanPolicy === 'required') return true;\n if (scanPolicy === 'skip') return false;\n\n return this.isGlobalScanningEnabled();\n }\n\n /**\n * Whether scanning is on APPLICATION-WIDE, for a file field that states no `scanPolicy` of its own.\n *\n * DERIVED from the platform-injected `fileScanning` topology: a scanner being reachable IS the\n * application-level opt-in.\n *\n * ## What this replaced\n *\n * `(this.appConfigService.config as Record<string, any>)?.files?.scanning?.enabled === true`. The\n * `any` cast is the tell — `AppConfigurationSchema` declares no `files` section, `z.object` strips\n * unknown keys, so the parsed configuration could never carry that path and the expression was\n * `undefined === true` for every application, for the whole life of the flag. The service's own\n * docstring documented it as the global switch.\n *\n * ## Why DERIVED rather than declared\n *\n * Adding an `enabled` boolean to `AppConfiguration_FileScanningSchema` was the other candidate and is\n * rejected on three counts:\n *\n * - **the answer already exists.** `fileScanning` is a mutation-boundary-PROTECTED section\n * (`APP_CONFIG_MUTATION_BOUNDARY_RULES` in `app-config.backend-authored.definitions.ts`: \"file-scanning\n * sidecar topology and its platform-level opt-in are env/bootstrap-owned\"), so an application cannot\n * author it. A boolean would have to be seeded from a NEW environment key sitting beside the host key\n * that already says the same thing — a second source of truth that can disagree with the first;\n * - **it matches the convention of the thing it gates.** ClamAV has no enable flag anywhere in this\n * subsystem: `ClamAVScannerBackendService.isConfigured()` states \"presence of a host IS the opt-in\",\n * and `buildFileServicesTopologyFromEnvironment` refuses to emit a plausible default host for exactly\n * that reason;\n * - **it closes the hole the repair would otherwise open.** A separate boolean makes \"globally on, no\n * scanner reachable\" a REPRESENTABLE state, and that state is precisely the one the pipeline used to\n * answer with a CLEAN verdict. Derived, the state cannot exist: the switch is on only when something\n * can actually run. The runtime refusal in `executeScan` stays regardless, because `scanPolicy:\n * 'required'` reaches the same tail without consulting this switch at all.\n *\n * The two predicates are the pipeline's OWN — `executeScan` gates its two layers on exactly\n * `clamavScanner.isConfigured()` and `yaraScanner.isEnabled()` — so the switch and the pipeline cannot\n * come to different conclusions about whether a scan is possible. Note `isEnabled()` is already the\n * conjunction of YARA's two independent axes (opted in AND reachable), which is why the \"enabled but\n * unreachable\" misconfiguration does not read as an application-wide opt-in here; the startup validator\n * reports it as its own issue instead.\n *\n * The `isInitialized()` guard stays: both scanner reads deliberately throw\n * `app_configuration_not_initialized` rather than softening to `false`, and a scan decision taken before\n * configuration has landed is not a decision.\n */\n isGlobalScanningEnabled(): boolean {\n if (!this.appConfigService.isInitialized()) return false;\n return this.clamavScanner.isConfigured() || this.yaraScanner.isEnabled();\n }\n\n /**\n * Initiate scanning for a file that just reached UPLOADED status.\n *\n * Transitions to SCANNING, then dispatches the scan job.\n * The response is fire-and-forget: the caller does not wait for scan\n * completion — scan results are processed asynchronously via\n * `handleScanResult()`.\n *\n * @param onClean - Optional callback invoked when scan verdict is CLEAN.\n * Used to chain post-scan work that must only run on safe bytes. Note the file\n * STATUS lifecycle ends at CLEAN for processing purposes — RAG chunking of a\n * `ragSource` file field is per-field derived data (chunk rows), never a file\n * status transition.\n */\n async initiateScan(\n fileId: string,\n executionContext: ExecutionContext<any>,\n onClean?: () => Promise<void>,\n ): Promise<void> {\n const allowedTransitions = FILE_STATUS_TRANSITIONS[FileStatus.UPLOADED];\n if (!allowedTransitions.includes(FileStatus.SCANNING)) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_INVALID_STATUS_TRANSITION,\n context: {\n fileId, // diagnostic (log-only)\n },\n },\n );\n }\n\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.SCANNING,\n executionContext,\n );\n\n if (onClean) {\n this.onCleanCallbacks.set(fileId, onClean);\n }\n\n this.logDebug('File transitioned to SCANNING, dispatching scan', { fileId });\n\n // Run the full scanning pipeline asynchronously. The file is already in\n // SCANNING status so downloads are blocked until the result handler\n // transitions it to CLEAN / INFECTED / FAILED.\n this.executeScan(fileId, executionContext).catch((err) => {\n this.logger.error('Scan execution failed unexpectedly', {\n fileId,\n ...projectCaughtErrorLogFields(err),\n });\n });\n }\n\n /**\n * Download the file from storage and run the scanning pipeline.\n *\n * Pipeline order:\n * 1. ClamAV (signature-based) — if configured\n * 2. YARA (pattern-based) — if enabled and ClamAV passed\n *\n * Short-circuits on first INFECTED verdict. YARA only runs if the\n * file survived ClamAV — no point in pattern-matching a known virus.\n */\n private async executeScan(\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n const file = await this.filesService.getFile(fileId, executionContext);\n if (!file) {\n this.logger.error('File not found for scanning', { fileId });\n return;\n }\n\n // Resolve through FilesBackendService rather than the router directly, so a\n // LEGACY row that persisted no `storageProvider` falls back to the default\n // provider instead of failing the scan. Reimplementing the lookup here is what\n // made this one of five different behaviours for a provider-less row.\n //\n // The throw is deliberately converted back into a terminal verdict rather than\n // propagated. `getStorageProviderForFile` throws INTERNAL when the persisted id\n // is not registered, and this pipeline is fire-and-forget — its dispatcher's\n // `.catch()` only LOGS. An escaping throw would therefore leave the file in\n // SCANNING permanently, and downloads stay blocked until a result handler moves\n // it out. That is strictly worse than the ERROR verdict this site already\n // recorded, so the drift is closed WITHOUT adopting the reference behaviour on\n // the throwing branch.\n let provider;\n try {\n provider = this.filesService.getStorageProviderForFile(file, executionContext);\n } catch (err) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: `Storage provider '${file.storageProvider}' not available for scan download`,\n scannerRef: 'scan-pipeline',\n }, executionContext);\n this.logger.error('Scan aborted: persisted storage provider is not registered', {\n fileId,\n storageProvider: file.storageProvider,\n ...projectCaughtErrorLogFields(err),\n });\n return;\n }\n\n // Carries `uploadedBy` / `uploadedByEntityType` beside the three routing fields: a vendor-backed\n // storage resolves the LINKER's grant from them, and a scanner that dropped them could never\n // download a Drive file — every layer would answer ERROR on a healthy row (#394 P5).\n const downloadParams = {\n fileId: file.fileId,\n storageProvider: file.storageProvider,\n storageRef: file.storageRef,\n uploadedBy: file.uploadedBy,\n uploadedByEntityType: file.uploadedByEntityType,\n };\n const executedScannerLayers: string[] = [];\n\n // ── Layer 1: ClamAV ────────────────────────────────────────────────\n if (this.clamavScanner.isConfigured()) {\n executedScannerLayers.push('clamav');\n let downloadResult;\n try {\n downloadResult = await provider.download(downloadParams, executionContext);\n } catch (err) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: `Failed to download file for ClamAV: ${describeCaughtError(err)}`,\n scannerRef: 'clamav',\n }, executionContext);\n return;\n }\n\n try {\n const clamResult = await this.clamavScanner.scanStream(downloadResult.stream, fileId);\n\n if (clamResult.verdict !== FileScanVerdict.CLEAN) {\n await this.handleScanResult(fileId, clamResult, executionContext);\n return;\n }\n\n this.logDebug('ClamAV layer passed', { fileId, durationMs: clamResult.durationMs });\n } finally {\n if (!downloadResult.stream.destroyed) {\n downloadResult.stream.destroy();\n }\n }\n } else {\n this.logDebug('ClamAV not configured — skipping signature scan', { fileId });\n }\n\n // ── Layer 2: YARA (optional, platform-level) ───────────────────────\n if (this.yaraScanner.isEnabled()) {\n executedScannerLayers.push('yara');\n let downloadResult;\n try {\n downloadResult = await provider.download(downloadParams, executionContext);\n } catch (err) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: `Failed to download file for YARA: ${describeCaughtError(err)}`,\n scannerRef: 'yara',\n }, executionContext);\n return;\n }\n\n try {\n const yaraResult = await this.yaraScanner.scanStream(downloadResult.stream, fileId);\n\n if (yaraResult.verdict !== FileScanVerdict.CLEAN) {\n await this.handleScanResult(fileId, yaraResult, executionContext);\n return;\n }\n\n this.logDebug('YARA layer passed', { fileId, durationMs: yaraResult.durationMs });\n } finally {\n if (!downloadResult.stream.destroyed) {\n downloadResult.stream.destroy();\n }\n }\n }\n\n // ── Nothing ran: refuse, do not certify ────────────────────────────\n //\n // This branch used to log a warning and then hand `handleScanResult` a CLEAN verdict with\n // `scannerRef: 'none'` — which transitions the file to `FileStatus.CLEAN`, a member of\n // `FILE_DOWNLOADABLE_STATUSES`. A scan had been REQUESTED (`shouldScan` said yes, `initiateScan`\n // moved the file to SCANNING, the uploader was told the upload succeeded), and the answer returned\n // was the answer a PASSING scan gives, produced by no scanner. That is strictly worse than not\n // scanning at all: a field declaring `scanPolicy: 'required'` ended with bytes certified clean, and\n // the only trace was a warning in a log nobody reads.\n //\n // ERROR -> `FileStatus.FAILED` is the fail-closed terminal, and the right one rather than merely the\n // safe one: FAILED is outside `FILE_DOWNLOADABLE_STATUSES` so the bytes are blocked, it is outside\n // `FILE_METADATA_WITHHELD_STATUSES` so the uploader can still poll and see WHY, and\n // `FILE_STATUS_TRANSITIONS` keeps SCANNING -> FAILED, so nothing about the lifecycle has to move.\n // A file that failed this way becomes scannable again the moment a scanner is provisioned.\n //\n // Keyed on `executedScannerLayers` — direct evidence that nothing ran — rather than on re-asking the\n // two `isConfigured()` predicates. Re-asking would be a second copy of the decision the two layer\n // gates above already took, and the copies can disagree if a layer ever grows another skip reason.\n //\n // Not redundant with the boot gate, which is the obvious objection. `collectScanningIssues` refuses\n // to start an application whose fields declare `scanPolicy: 'required'` when ClamAV is unconfigured,\n // so in a well-formed deployment this branch is unreachable. But that gate builds its population by\n // walking every resource's file fields inside `try { … } catch { continue; }`: a resource whose field\n // detection throws contributes no fields and is silently absent from the count. A boot check that can\n // under-report the population it protects is not a substitute for the refusal at the site itself.\n if (executedScannerLayers.length === 0) {\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.ERROR,\n errorMessage: 'Scan was requested but no scanner is configured (no ClamAV host, and YARA not enabled/reachable) — refusing to certify the file as clean',\n scannerRef: 'none',\n }, executionContext);\n return;\n }\n\n // ── All layers that ran, passed ────────────────────────────────────\n // `join('+')` needs no `|| 'none'` fallback any more: the empty case returned above, so a CLEAN\n // verdict from here always names at least one scanner that actually executed.\n await this.handleScanResult(fileId, {\n verdict: FileScanVerdict.CLEAN,\n scannerRef: executedScannerLayers.join('+'),\n }, executionContext);\n }\n\n /**\n * Process the result of a scan job.\n *\n * - CLEAN: transition to CLEAN (file becomes downloadable)\n * - INFECTED: transition to INFECTED, then quarantine\n * - ERROR: transition to FAILED (retryable via re-scan)\n */\n async handleScanResult(\n fileId: string,\n result: FileScanResult,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n this.logDebug('Processing scan result', {\n fileId,\n verdict: result.verdict,\n threatName: result.threatName,\n scannerRef: result.scannerRef,\n durationMs: result.durationMs,\n });\n\n /*\n * assurance-control: WILDO.SECURITY.INGESTED_CONTENT_INSPECTION — the scanner's verdict becomes a\n * member of `FileStatus`, which is also what `FILE_DOWNLOADABLE_STATUSES` reads, so \"inspected\" and\n * \"servable\" are one decision rather than two that could disagree. `FileScanVerdict` names the\n * scanner's answer; `FileStatus` is the one with consequence, which is why the assurance capability\n * derives from it.\n *\n * The outcome now ALSO reaches the audit trail (#506): `FILE_MALWARE_DETECTED` when a scanner\n * concludes an infection, `FILE_MALWARE_SCAN_FAILED` when the scan could not run. Both are\n * emitted AFTER the terminal transition, so the row can never describe a state the record does\n * not hold. Until they existed, an infection produced a status change and nothing else — the only\n * way to learn malware had arrived was to notice a row sitting at `QUARANTINED`.\n */\n switch (result.verdict) {\n case FileScanVerdict.CLEAN:\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.CLEAN,\n executionContext,\n );\n this.logDebug('File marked as CLEAN after scan', { fileId });\n\n // Invoke the post-clean callback (generic post-scan work registered by initiateScan's\n // caller). RAG ingestion is deliberately NOT chained here: the service-tier write hook and\n // the hourly reconciliation sweep own corpus derivation, and the ingestion pipeline itself\n // refuses non-downloadable files — so a file that finishes scanning is picked up by the\n // next sweep run with no per-file callback wiring.\n const onClean = this.onCleanCallbacks.get(fileId);\n if (onClean) {\n this.onCleanCallbacks.delete(fileId);\n onClean().catch((err) => {\n this.logger.error('Post-clean callback failed', {\n fileId,\n ...projectCaughtErrorLogFields(err),\n });\n });\n }\n break;\n\n case FileScanVerdict.INFECTED:\n this.onCleanCallbacks.delete(fileId);\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.INFECTED,\n executionContext,\n );\n this.logger.warn('File flagged as INFECTED', {\n fileId,\n threatName: result.threatName,\n scannerRef: result.scannerRef,\n });\n\n await this.quarantineInfectedFile(fileId, result, executionContext);\n // AFTER the quarantine transition, so `fileStatus` is what the record holds rather than what\n // this method intended. If the quarantine failed, the row says INFECTED, which is true.\n await this.recordScanOutcomeAudit(fileId, result, executionContext);\n break;\n\n case FileScanVerdict.ERROR:\n this.onCleanCallbacks.delete(fileId);\n this.logger.error('Scan failed with error', {\n fileId,\n errorMessage: result.errorMessage,\n scannerRef: result.scannerRef,\n });\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.FAILED,\n executionContext,\n );\n await this.recordScanOutcomeAudit(fileId, result, executionContext);\n break;\n }\n }\n\n /**\n * Write the scan outcome to the audit trail (#506).\n *\n * Best-effort and never throwing: the file's status transition is the enforcement, and an audit\n * store being unavailable must not convert a successful quarantine into an exception that leaves\n * the caller believing the scan failed.\n *\n * A CLEAN verdict is deliberately NOT audited. Every upload is scanned, so a clean row per upload\n * would be the highest-volume event in the trail and would bury the two that matter — and the\n * upload itself is already recorded by `FILE_UPLOAD_GRANT_REDEEMED`. What is added here is the\n * conclusion an operator would want to be alerted on.\n */\n private async recordScanOutcomeAudit(\n fileId: string,\n result: FileScanResult,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n if (!this.auditLogsService) return;\n\n try {\n // Re-read rather than assume: the transition may have failed, and the audit row must describe\n // the record, not the intent.\n const fileStatus = await this.resolveRecordedFileStatus(fileId, executionContext);\n const organizationId = executionContext.initiatorIds?.organizationId;\n const userId = executionContext.initiatorIds?.userId;\n\n if (result.verdict === FileScanVerdict.INFECTED) {\n await this.auditLogsService.logFileMalwareDetected({\n fileId,\n scannerRef: result.scannerRef,\n threatName: result.threatName,\n organizationId,\n userId,\n fileStatus,\n }, executionContext);\n return;\n }\n\n await this.auditLogsService.logFileMalwareScanFailed({\n fileId,\n scannerRef: result.scannerRef,\n failureReason: result.errorMessage,\n organizationId,\n userId,\n fileStatus,\n }, executionContext);\n } catch (error) {\n this.logger.warn('Failed to record the file scan outcome in the audit trail', {\n fileId,\n verdict: result.verdict,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n /** The status the FILES row actually carries after the transition, or `unknown` if it cannot be read. */\n private async resolveRecordedFileStatus(\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<string> {\n try {\n const file = await this.filesService.getFile(fileId, executionContext) as { status?: string } | null;\n return file?.status ?? 'unknown';\n } catch {\n return 'unknown';\n }\n }\n\n /**\n * Quarantine an infected file.\n *\n * Transitions INFECTED → QUARANTINED. The blob remains in storage\n * but the file is permanently blocked from download. Operators can\n * delete quarantined files via admin tooling.\n */\n private async quarantineInfectedFile(\n fileId: string,\n result: FileScanResult,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n try {\n await this.filesService.updateFileStatus(\n fileId,\n FileStatus.QUARANTINED,\n executionContext,\n );\n this.logDebug('Infected file quarantined', {\n fileId,\n threatName: result.threatName,\n });\n } catch (error) {\n this.logger.error('Failed to quarantine infected file', {\n fileId,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"file-text-extraction.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/files/services/file-text-extraction.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAMH,OAAO,EAA0C,KAAK,IAAI,EAAE,MAAM,uB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AAE,mBAAmB,EASjC,kBAAkB,CAAC,EAAE,gCAAgC;IAMxE;;OAEG;IACG,WAAW,CACf,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,wBAAwB,CAAC;IA0FpC;;OAEG;IACH,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAsBhD;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;YAalB,eAAe;IAmB7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;YACW,mBAAmB;IA4IjC;;;;;;;;;OASG;IACH,OAAO,CAAC,4BAA4B;IAqCpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH;;;;;;;;;;;;OAYG;YACW,cAAc;IAY5B;;;;;;;;;;;;;OAaG;YACW,yBAAyB;YA2BzB,cAAc;IA8F5B,qFAAqF;YACvE,aAAa;CAO5B"}
1
+ {"version":3,"file":"file-text-extraction.backend.service.d.ts","sourceRoot":"","sources":["../../../../src/files/services/file-text-extraction.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiFG;AAMH,OAAO,EAA0C,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAQ1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AACvG,OAAO,EAAE,+BAA+B,EAAE,MAAM,sEAAsE,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EACL,gCAAgC,EAGjC,MAAM,oFAAoF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