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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (853) hide show
  1. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  2. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
  3. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  4. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  5. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
  6. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  7. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
  8. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
  9. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
  10. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
  11. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
  12. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
  13. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
  14. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
  15. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
  16. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
  18. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  19. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  20. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
  21. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  22. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
  23. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  24. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
  25. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  26. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
  27. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  28. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
  29. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  30. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
  31. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
  33. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  34. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
  35. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
  36. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
  44. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +49 -0
  46. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  47. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +171 -18
  48. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
  51. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +20 -0
  54. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  55. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
  56. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  58. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  59. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
  60. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  61. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
  62. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  63. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
  64. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  65. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
  66. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +529 -41
  68. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  69. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
  70. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  71. package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
  72. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  73. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
  74. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
  75. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
  76. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
  77. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
  78. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
  79. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
  80. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
  81. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
  82. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
  83. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
  84. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
  85. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
  86. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
  87. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
  88. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
  89. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
  90. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  91. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
  92. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  93. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
  94. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  95. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
  96. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  97. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
  98. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
  99. package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
  100. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
  101. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
  102. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  103. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
  104. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  105. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  106. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
  107. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  108. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
  109. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  110. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
  111. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  112. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
  113. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  114. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
  115. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  116. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
  117. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  118. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
  119. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  120. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  121. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
  122. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  123. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
  124. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  125. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
  126. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  127. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
  128. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
  129. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
  130. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
  131. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
  132. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  133. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
  134. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  135. package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
  136. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  137. package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
  138. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  139. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
  140. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  141. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
  142. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  143. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
  144. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  145. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +244 -7
  146. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  147. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +386 -5
  148. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  149. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  150. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
  151. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  152. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
  153. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  154. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
  155. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  156. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
  157. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  158. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
  159. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  160. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
  161. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
  162. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
  163. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
  164. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  165. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +31 -0
  166. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  167. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
  168. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  169. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
  170. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  171. package/dist/esm/config/models/app-config.backend.schemas.d.ts +142 -46
  172. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  173. package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
  174. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  175. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
  176. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  177. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
  178. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  179. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
  180. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  181. package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
  182. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  183. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  184. package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
  185. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  186. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
  187. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  188. package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
  189. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  190. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
  191. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  192. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
  193. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  194. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  195. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
  196. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  197. package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
  198. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  199. package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
  200. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  201. package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
  202. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  203. package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
  204. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  205. package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
  206. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  207. package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
  208. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  209. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
  210. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  211. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
  212. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  213. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
  214. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  215. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
  216. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  217. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
  218. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  219. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
  220. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  221. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
  222. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  223. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  224. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
  225. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
  226. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
  227. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
  228. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
  229. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
  230. package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
  231. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
  232. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
  233. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
  234. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
  235. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
  236. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
  237. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
  238. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
  239. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
  240. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
  241. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  242. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
  243. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  244. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
  245. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
  246. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
  247. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
  248. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
  249. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  250. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
  251. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  252. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  253. package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
  254. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  255. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  256. package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
  257. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  258. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +292 -7
  259. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  260. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +533 -45
  261. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  262. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  263. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
  264. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  265. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  266. package/dist/esm/files/controllers/file.controller.js +21 -13
  267. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  268. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  269. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +39 -15
  270. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  271. package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
  272. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  273. package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
  274. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  275. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
  276. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  277. package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
  278. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  279. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
  280. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  281. package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
  282. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  283. package/dist/esm/files/services/files.backend.service.d.ts +68 -0
  284. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  285. package/dist/esm/files/services/files.backend.service.js +175 -5
  286. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  287. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
  288. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
  289. package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
  290. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
  291. package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
  292. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  293. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  294. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
  295. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  296. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
  297. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  298. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  299. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
  300. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  301. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  302. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
  303. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  304. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
  305. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
  306. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
  307. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
  308. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
  309. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  310. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
  311. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  312. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  313. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
  314. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  315. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
  316. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  317. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
  318. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  319. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
  320. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  321. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
  322. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  323. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
  324. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  325. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
  326. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  327. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
  328. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  329. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
  330. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  331. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
  332. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  333. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  334. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
  335. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  336. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
  337. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  338. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
  339. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  340. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
  341. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  342. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
  343. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  344. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  345. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
  346. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  347. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
  348. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  349. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  350. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
  351. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  352. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
  353. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
  354. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
  355. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
  356. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  357. package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
  358. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  359. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +28 -1
  360. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  361. package/dist/esm/flows-actors/services/agents.backend.service.js +204 -18
  362. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  363. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
  364. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  365. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
  366. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  367. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
  368. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  369. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
  370. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  371. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  372. package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
  373. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  374. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  375. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
  376. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  377. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
  378. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
  379. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
  380. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
  381. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
  382. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  383. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
  384. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  385. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  386. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +8 -4
  387. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  388. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
  389. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  390. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
  391. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  392. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  393. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  394. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
  395. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  396. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
  397. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  398. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
  399. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
  400. package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
  401. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
  402. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
  403. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  404. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
  405. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  406. package/dist/esm/index.d.ts +11 -4
  407. package/dist/esm/index.d.ts.map +1 -1
  408. package/dist/esm/index.js +31 -4
  409. package/dist/esm/index.js.map +1 -1
  410. package/dist/esm/inject/models/container.d.ts.map +1 -1
  411. package/dist/esm/inject/models/container.js +78 -10
  412. package/dist/esm/inject/models/container.js.map +1 -1
  413. package/dist/esm/inject/models/service-types.d.ts +17 -3
  414. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  415. package/dist/esm/inject/models/service-types.js +19 -3
  416. package/dist/esm/inject/models/service-types.js.map +1 -1
  417. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  418. package/dist/esm/mcp/controllers/mcp.controller.js +20 -0
  419. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  420. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
  421. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  422. package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
  423. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  424. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  425. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
  426. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  427. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  428. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
  429. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  430. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
  431. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
  432. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
  433. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
  434. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
  435. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  436. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
  437. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  438. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
  439. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  440. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  441. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
  442. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  443. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
  444. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  445. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  446. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  447. package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
  448. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  449. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
  450. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
  451. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
  452. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
  453. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
  454. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
  455. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
  456. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
  457. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
  458. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  459. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  460. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
  461. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  462. package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
  463. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  464. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
  465. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
  466. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
  467. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
  468. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
  469. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
  470. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
  471. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
  472. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
  473. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
  474. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
  475. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
  476. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
  477. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  478. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
  479. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  480. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
  481. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
  482. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
  483. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
  484. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  485. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
  486. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  487. package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
  488. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  489. package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
  490. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  491. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
  492. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  493. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  494. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
  495. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  496. package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
  497. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  498. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
  499. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  500. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
  501. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  502. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
  503. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  504. package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
  505. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  506. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
  507. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  508. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
  509. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  510. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
  511. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  512. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
  513. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  514. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  515. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
  516. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  517. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  518. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
  519. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  520. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
  521. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  522. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
  523. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  524. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
  525. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
  526. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  527. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  528. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
  529. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  530. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
  531. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
  532. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
  533. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
  534. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
  535. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
  536. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
  537. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
  538. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
  539. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
  540. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
  541. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
  542. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
  543. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
  544. package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
  545. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
  546. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
  547. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  548. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
  549. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  550. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
  551. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  552. package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
  553. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  554. package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
  555. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  556. package/dist/esm/queue/job-consumer.backend.service.js +1 -4
  557. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  558. package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
  559. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  560. package/dist/esm/queue/job-executor.backend.service.js +1 -4
  561. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  562. package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
  563. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  564. package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
  565. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  566. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
  567. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  568. package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
  569. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  570. package/dist/esm/queue/queue.backend.service.d.ts +3 -3
  571. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  572. package/dist/esm/queue/queue.backend.service.js +26 -4
  573. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  574. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
  575. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  576. package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
  577. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  578. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
  579. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  580. package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
  581. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  582. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
  583. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  584. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
  585. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  586. package/dist/esm/requests/service/websocket.service.d.ts +9 -0
  587. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  588. package/dist/esm/requests/service/websocket.service.js +32 -8
  589. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  590. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  591. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +14 -2
  592. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  593. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  594. package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
  595. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  596. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  597. package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
  598. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  599. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
  600. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  601. package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
  602. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  603. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
  604. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  605. package/dist/esm/resources/services/resources-registry.backend.service.js +90 -6
  606. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  607. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
  608. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  609. package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
  610. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  611. package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
  612. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  613. package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
  614. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  615. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
  616. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  617. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  618. package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
  619. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  620. package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
  621. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  622. package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
  623. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  624. package/dist/esm/runtime/services/start-application.backend.service.js +261 -77
  625. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  626. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
  627. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  628. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
  629. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  630. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
  631. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  632. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
  633. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  634. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  635. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
  636. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  637. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
  638. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  639. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
  640. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  641. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
  642. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  643. package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
  644. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  645. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  646. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  647. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  648. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
  649. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  650. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
  651. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  652. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
  653. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  654. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
  655. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  656. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
  657. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  658. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
  659. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  660. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
  661. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  662. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
  663. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  664. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
  665. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  666. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
  667. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  668. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  669. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
  670. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  671. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
  672. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  673. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
  674. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  675. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  676. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
  677. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  678. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  679. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
  680. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  681. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
  682. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  683. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
  684. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  685. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
  686. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  687. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
  688. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  689. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
  690. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  691. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
  692. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  693. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
  694. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  695. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
  696. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  697. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  698. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
  699. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  700. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
  701. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
  702. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
  703. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
  704. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
  705. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  706. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
  707. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  708. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
  709. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  710. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
  711. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  712. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
  713. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  714. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
  715. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  716. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  717. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
  718. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  719. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  720. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
  721. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  722. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
  723. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  724. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
  725. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  726. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
  727. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  728. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
  729. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  730. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
  731. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
  732. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
  733. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
  734. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
  735. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  736. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
  737. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  738. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  739. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
  740. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  741. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
  742. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  743. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
  744. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  745. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
  746. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
  747. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
  748. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
  749. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
  750. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  751. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
  752. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  753. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +74 -8
  754. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  755. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +175 -19
  756. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  757. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
  758. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  759. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
  760. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  761. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
  762. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
  763. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
  764. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
  765. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
  766. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
  767. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
  768. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
  769. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
  770. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
  771. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
  772. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
  773. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
  774. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
  775. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
  776. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
  777. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
  778. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
  779. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
  780. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
  781. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
  782. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  783. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
  784. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
  785. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
  786. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
  787. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
  788. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
  789. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
  790. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
  791. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
  792. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
  793. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
  794. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
  795. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
  796. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
  797. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
  798. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
  799. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
  800. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
  801. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
  802. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  803. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
  804. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
  805. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
  806. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
  807. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
  808. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
  809. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
  810. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
  811. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
  812. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
  813. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
  814. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
  815. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
  816. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
  817. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
  818. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  819. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
  820. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  821. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
  822. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  823. package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
  824. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  825. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
  826. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  827. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
  828. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  829. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
  830. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  831. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
  832. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  833. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  834. package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
  835. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  836. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
  837. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  838. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
  839. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  840. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
  841. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  842. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
  843. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  844. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
  845. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
  846. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
  847. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
  848. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
  849. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
  850. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
  851. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
  852. package/dist/tsconfig.build.tsbuildinfo +1 -1
  853. package/package.json +11 -9
@@ -1 +1 @@
1
- {"version":3,"file":"resource-file-upload-handler.backend.service.js","sourceRoot":"","sources":["../../../../../src/files/handlers/resource-file-upload-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAuC,SAAS,EAAE,2BAA2B,EAAQ,UAAU,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,oBAAoB,EAAwB,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC3R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AAM,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;+CAvBnB,0BAA0B;QAErB,+BAA+B;QAE9B,2BAA2B;QAEhC,qBAAqB;QAEtB,mBAAmB;QAEd,+BAA+B;QAE9B,gCAAgC;QAE3B,qCAAqC;QAE5C,uBAAuB;QAE3B,qCAAqC;QAE9B,0BAA0B;QAEvB,6BAA6B;QAE7B,6BAA6B;GA/B7D,uCAAuC,CAmwBnD","sourcesContent":["/**\n * Resource File Upload Handler Backend Service\n *\n * Handles user-provided uploads for resource-integrated file fields after the\n * controller's pre-Multer middleware has already established execution context\n * and authorized access to the owning resource route.\n *\n * Coordinates validation, file record creation, and storage upload. UPDATE\n * routes authorize the target resource before reaching this handler, but the\n * upload itself still creates a new File record; attaching/replacing that file\n * on the resource is owned by the calling form/field mutation lane, not by this\n * upload transport.\n *\n * Flow:\n * 1. Validate file exists in request\n * 2. Resolve file constraints from resource field schema\n * 3. Validate file against constraints\n * 4. Create file record (status: PENDING)\n * 5. Upload file to storage\n * 6. Update file status to UPLOADED\n * 7. Return file metadata\n * 8. (async) Initiate AV scan if enabled (UPLOADED → SCANNING → CLEAN/INFECTED)\n */\n\nimport { injectable, inject } from 'inversify';\nimport type { Request, Response, NextFunction } from 'express';\nimport { Readable } from 'stream';\nimport fs from 'fs';\nimport { CoreResourceOperation, ResourceType, ErrorType, ErrorCustomMessageReference, File, FileStatus, FILE_DOWNLOADABLE_STATUSES, FILE_METADATA_WITHHELD_STATUSES, ResourcePrimaryScope, FileScopeIdentifiers, isWildoBackendError, parseFileServeVariant } from '@wildo-ai/saas-models';\nimport { FileGenerationSource } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FileConstraintResolverChain } from '~wildo-backend-lib/files/constraints/file-constraint-resolver-chain.backend.service';\nimport { FileValidationService } from '~wildo-backend-lib/files/constraints/file-validation.backend.service';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport { ResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/resource-operations-helper.backend.service';\nimport { validateResourceType, validateFieldName, validateResourceId, validateFileId, validateContentType, validateSize, validateUploadedBy, validateUploadedByEntityType, resolveConfiguredMaxFileSize } from '~wildo-backend-lib/files/utils/file-validation.utils';\nimport { resolveFileUploaderPrincipal } from '~wildo-backend-lib/files/utils/file-uploader.utils';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nimport { FileFieldDetectionBackendService } from '~wildo-backend-lib/files/services/file-field-detection.backend.service';\nimport { FileStoragePathResolverBackendService } from '~wildo-backend-lib/files/storage/file-storage-path-resolver.backend.service';\nimport type { StorageUploadResult, StorageUploadOptions } from '~wildo-backend-lib/files/storage/file-storage-provider.types';\nimport { FileScanningBackendService } from '~wildo-backend-lib/files/services/file-scanning.backend.service';\nimport { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { resolveStorageApplicationIdentity } from '~wildo-backend-lib/files/utils/storage-application-identity.backend.utils';\nimport { ConsumableTokenBackendService } from '~wildo-backend-lib/security/consumable-tokens/services/consumable-token.backend.service';\nimport { FileUploadGrantBackendService } from '~wildo-backend-lib/files/services/file-upload-grant.backend.service';\nimport type { FileUploadRouteGrantLocals } from '~wildo-backend-lib/files/handlers/file-upload-route-locals.backend.types';\n\n@injectable()\nexport class ResourceFileUploadHandlerBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger)\n private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.FileConstraintResolverChain)\n private readonly constraintResolver: FileConstraintResolverChain,\n @inject(SAAS_SERVICE_TYPES.FileValidationService)\n private readonly fileValidator: FileValidationService,\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n @inject(SAAS_SERVICE_TYPES.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n @inject(SAAS_SERVICE_TYPES.FileFieldDetectionService)\n private readonly fileFieldDetection: FileFieldDetectionBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceOperationHelperService)\n private readonly resourceOperationHelper: ResourceOperationHelperBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.FileStoragePathResolver)\n private readonly pathResolver: FileStoragePathResolverBackendService,\n @inject(SAAS_SERVICE_TYPES.FileScanningService)\n private readonly fileScanningService: FileScanningBackendService,\n @inject(SAAS_SERVICE_TYPES.ConsumableTokenService)\n private readonly consumableTokenService: ConsumableTokenBackendService,\n @inject(SAAS_SERVICE_TYPES.FileUploadGrantService)\n private readonly fileUploadGrantService: FileUploadGrantBackendService,\n ) {\n this.logDebug = this.logger.debugByType('ResourceFileUploadHandlerBackendService');\n this.logger.setDebugTypeLogging('ResourceFileUploadHandlerBackendService', false);\n }\n\n /**\n * Extract the resource instance from the request body (if available).\n * In multipart uploads, the resource data may be present in `req.body`\n * as parsed form fields.\n */\n private extractResourceInstance(req: Request): Record<string, unknown> | undefined {\n if (req.body && typeof req.body === 'object' && Object.keys(req.body).length > 0) {\n return req.body as Record<string, unknown>;\n }\n return undefined;\n }\n\n /**\n * Handle file upload for resource-integrated file fields.\n *\n * @param request - Express request with file in request.file (Multer)\n * @param response - Express response\n * @param resourceType - Resource type (e.g., 'todos')\n * @param fieldName - File field name (e.g., 'attachments')\n * @param resourceId - Resource ID (undefined for CREATE, string for UPDATE route authorization)\n * @param operation - Route operation used for authorization; the upload always creates a new File record\n * @param executionContext - Execution context from request\n */\n async handleFileUpload(\n request: Request,\n response: Response,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string | undefined,\n operation: CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE,\n executionContext: ExecutionContext<any>\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation and security vulnerabilities)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n if (resourceId !== undefined) {\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n }\n\n this.logDebug('Handling file upload', {\n resourceType,\n fieldName,\n resourceId,\n operation,\n hasFile: !!request.file,\n });\n\n let fileRecord: { fileId: string } | undefined;\n let uploadReachedSuccessState = false;\n let blobStoredInStorage = false;\n\n try {\n // Step 1: Validate file exists in request\n if (!request.file) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_UPLOAD_NO_FILE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n const multerFile = request.file;\n const maxFileSize = resolveConfiguredMaxFileSize(this.appConfigService.config.storage?.maxFileSize);\n\n // Validate file metadata (CRITICAL: Prevents invalid file data)\n validateContentType(multerFile.mimetype, this.errorBuilder, executionContext, 'contentType');\n validateSize(multerFile.size, maxFileSize, this.errorBuilder, executionContext, 'size');\n\n // Step 2: Resolve file constraints from resource field schema\n const constraint = await this.constraintResolver.resolve({\n resourceType,\n fieldName,\n });\n\n // Step 3: Validate file against constraints\n const validationResult = await this.fileValidator.validateFile(multerFile, constraint);\n\n if (!validationResult.success) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: 'File validation failed',\n errors: validationResult.errors,\n filename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n },\n }\n );\n }\n\n // Step 4: Reject direct uploads to generated file fields FIRST —\n // before scope derivation. \"This field cannot receive user uploads at\n // all\" is a more fundamental rejection than \"what scope does the file\n // belong to\", and must not be masked by a scope-derivation error\n // (e.g. a missing applicationId) on a field that was never uploadable.\n const fieldMeta = this.fileFieldDetection.getFileFieldMetadata(resourceType, fieldName);\n if (fieldMeta?.fileMetadata.generation?.source === FileGenerationSource.PDF_TEMPLATE) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_GENERATED_FIELD_NOT_WRITABLE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n // Step 4b: Derive scope from parent resource's resourcePrimaryScope.\n const scope = this.deriveScopeFromParentResource(resourceType, executionContext);\n\n // Step 4c: Resolve storage provider from z_file() metadata.\n const storageAccepted = fieldMeta?.fileMetadata.storageAccepted;\n const storageProvider = this.fileStorageRouter.resolveProvider(storageAccepted);\n\n // Step 4d: a file upload GRANT (issue #312) is claimed HERE — the point of no return. Every check a\n // caller can act on (no file, wrong type, too large, generated field) has run; nothing has been\n // written. A refusal above leaves the grant usable for a retry; a race loser is refused by the\n // atomic consume and writes nothing. This handler is NOT on the services-registry pipeline, so its\n // post-operation consumption never sees this request — this is the one consumption site.\n const grant = (response.locals as FileUploadRouteGrantLocals | undefined)?.fileUploadGrant;\n if (grant) {\n await this.consumableTokenService.consumeToken(executionContext.consumableTokenValue!);\n executionContext.markConsumableTokenConsumed();\n }\n\n // Step 5: Create file record (status: PENDING) with scope\n // Under a grant the file is attributed to the MINTER — the person or machine that delegated the\n // upload — never to the grant. A user-minted grant already yields that through the token context\n // (`resolveFileUploaderPrincipal`, CONSUMABLE_TOKEN case); a machine-minted one yields nothing\n // there, so the grant's own `minter` record is used. Both agree with createFile's mismatch guard.\n const uploaderPrincipal = grant\n ? this.fileUploadGrantService.resolveUploaderFromGrant(grant.metadata)\n : resolveFileUploaderPrincipal(executionContext);\n if (uploaderPrincipal) {\n validateUploadedBy(uploaderPrincipal.uploadedBy, this.errorBuilder, executionContext, 'uploadedBy');\n validateUploadedByEntityType(\n uploaderPrincipal.uploadedByEntityType,\n this.errorBuilder,\n executionContext,\n 'uploadedByEntityType',\n );\n }\n\n const createdFile = await this.filesService.createFile(\n {\n filename: multerFile.originalname || multerFile.filename,\n originalFilename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n storageProvider: storageProvider.providerId,\n scope,\n uploadedBy: uploaderPrincipal?.uploadedBy,\n uploadedByEntityType: uploaderPrincipal?.uploadedByEntityType,\n },\n executionContext\n );\n\n fileRecord = { fileId: createdFile.fileId };\n\n // Step 5b: Resolve upload path options now that we have the fileId.\n const resourceInstance = this.extractResourceInstance(request);\n let uploadOptions: StorageUploadOptions | undefined;\n if (fieldMeta) {\n uploadOptions = this.pathResolver.resolve(\n createdFile.fileId,\n fieldName,\n fieldMeta.fileMetadata,\n resolveStorageApplicationIdentity(this.appConfigService),\n multerFile.originalname,\n resourceInstance,\n );\n }\n\n // The resource segment of the object key comes from the row that was just created, and is\n // applied OUTSIDE the `fieldMeta` branch on purpose: a file without field metadata still\n // belongs to a resource, and keying it as unlinked would place it outside the prefix its\n // principal is granted once the session policy narrows per resource.\n //\n // Derived once, here, at create — the key never moves afterwards, so this is the only\n // moment the segment can be decided.\n // Use the handler's OWN `resourceType` parameter, NOT `createdFile.linkedResourceType`.\n //\n // `createFile` above is called WITHOUT a linked resource — the row is created unlinked and the\n // association is written later — so reading the field back off the created record is always\n // `undefined`, and every upload silently took the `_unlinked/` staging branch. Caught only by\n // uploading a real file and listing the object store: `tsc` was clean and every unit test\n // green, because nothing in either exercises the value that reaches the key builder.\n //\n // `resourceType` is a parameter of this method and is validated at entry, so it is the\n // authoritative answer to \"which resource does this blob belong to\" at the only moment the\n // key can be decided.\n // `scope` rides along so the key carries `<scope>/<scopeId>` — the same `FileScopeIdentifiers`\n // already built above for the File row, so the row and the object key agree by construction\n // rather than by two independent derivations.\n uploadOptions = { ...uploadOptions, linkedResourceType: resourceType, scope };\n\n // Step 6: Create stream from disk file (true streaming, no memory buffering)\n // With disk storage, multerFile.path contains the temp file path\n if (!multerFile.path) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Multer file path is missing (disk storage error)',\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n // Verify file exists before creating stream\n if (!fs.existsSync(multerFile.path)) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Temp file not found on disk',\n path: multerFile.path,\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n let fileStream: Readable | null = null;\n let uploadResult: StorageUploadResult | null = null;\n\n // Step 7: Upload the blob through the resolved storage provider.\n try {\n // Create stream from disk file (true streaming, no memory buffering)\n fileStream = fs.createReadStream(multerFile.path);\n\n uploadResult = await storageProvider.upload(\n fileStream,\n createdFile.fileId,\n multerFile.mimetype,\n multerFile.size,\n executionContext,\n uploadOptions,\n );\n blobStoredInStorage = true;\n\n this.logDebug('File uploaded to storage successfully', {\n fileId: createdFile.fileId,\n });\n } catch (uploadError) {\n // If upload fails, mark file as FAILED\n await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.FAILED,\n executionContext\n );\n\n throw this.errorBuilder.buildError(\n ErrorType.EXTERNAL_SERVICE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.EXTERNAL_SERVICE,\n context: {\n message: 'Failed to upload file to storage',\n fileId: createdFile.fileId,\n error: describeCaughtError(uploadError),\n },\n }\n );\n } finally {\n // Clean up temp file (always, even on error)\n // This ensures temp files are removed even if upload fails or other errors occur\n if (multerFile.path && fs.existsSync(multerFile.path)) {\n try {\n fs.unlinkSync(multerFile.path);\n this.logDebug('Temp file cleaned up', { path: multerFile.path });\n } catch (cleanupError) {\n // Log cleanup error but don't fail operation\n this.logger.warn('Failed to clean up temp file', {\n path: multerFile.path,\n ...projectCaughtErrorLogFields(cleanupError),\n });\n }\n }\n\n // Also destroy stream if it was created\n if (fileStream && !fileStream.destroyed) {\n fileStream.destroy();\n }\n }\n\n // Step 8: Update file status to UPLOADED (with retry logic)\n // CRITICAL: If updateFileStatus() fails after successful storage upload,\n // file exists in storage but status remains PENDING in database.\n // Retry logic handles transient errors (network issues, database locks, etc.)\n // Decision 5.1: Retry Logic with audit log error (Option A)\n const maxRetries = 3;\n const initialDelay = 1000; // 1 second\n\n let lastError: Error | null = null;\n let uploadedFile: File | null = null;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n uploadedFile = await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.UPLOADED,\n executionContext,\n undefined,\n uploadResult ?? undefined,\n );\n break; // Success\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(describeCaughtError(error));\n\n if (attempt < maxRetries) {\n const delay = initialDelay * Math.pow(2, attempt);\n this.logger.warn('File status update failed, retrying', {\n fileId: createdFile.fileId,\n attempt: attempt + 1,\n maxRetries,\n delay,\n error: lastError.message,\n });\n await new Promise(resolve => setTimeout(resolve, delay));\n } else {\n // Final attempt failed - audit log and re-throw\n this.logger.error('File status update failed after all retries', {\n fileId: createdFile.fileId,\n attempts: maxRetries + 1,\n error: lastError.message,\n // File exists in storage but status remains PENDING in database\n // This is a data inconsistency that needs manual intervention\n });\n\n // If the blob already reached storage but metadata could not commit to\n // UPLOADED, try to roll the blob back so the row can safely move into\n // a failed lifecycle path instead of silently pointing at live data.\n if (blobStoredInStorage && uploadResult) {\n try {\n await storageProvider.delete(\n {\n fileId: createdFile.fileId,\n storageProvider: uploadResult.provider,\n storageRef: uploadResult.storageRef,\n },\n executionContext,\n );\n blobStoredInStorage = false;\n this.logger.warn('Rolled back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n });\n } catch (rollbackError) {\n if (!isWildoBackendError(rollbackError) || rollbackError.type !== ErrorType.NOT_FOUND) {\n this.logger.error('Failed to roll back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n ...projectCaughtErrorLogFields(rollbackError),\n originalError: lastError.message,\n });\n } else {\n blobStoredInStorage = false;\n }\n }\n }\n\n // Re-throw to fail the operation\n throw lastError;\n }\n }\n }\n\n // Ensure uploadedFile is set (TypeScript safety check)\n if (!uploadedFile) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'File status update failed - uploadedFile is null after retries',\n fileId: createdFile.fileId,\n },\n }\n );\n }\n\n // Step 9: Return success response with file metadata\n const fileMetadata = this.filesService.toMetadataResponse(uploadedFile);\n uploadReachedSuccessState = uploadedFile.status === FileStatus.UPLOADED;\n\n response.status(200).json({\n success: true,\n file: fileMetadata,\n });\n\n this.logDebug('File upload completed successfully', {\n fileId: uploadedFile.fileId,\n resourceType,\n fieldName,\n });\n\n // Step 9b: a redeemed grant records what it produced and is audited. Best-effort by contract —\n // the upload has succeeded and the response is sent; a failure here is logged, never thrown.\n if (grant) {\n this.fileUploadGrantService\n .recordRedemption(grant, { fileId: uploadedFile.fileId, mimeType: uploadedFile.mimeType, size: uploadedFile.size }, executionContext)\n .catch((redemptionError) => {\n this.logger.error('File upload grant: redemption record failed', {\n grantId: grant.token._id,\n fileId: uploadedFile!.fileId,\n ...projectCaughtErrorLogFields(redemptionError),\n });\n });\n }\n\n // Step 10: Post-upload async pipeline (fire-and-forget, response already sent)\n const shouldScan = this.fileScanningService.shouldScan(fieldMeta?.fileMetadata);\n\n if (shouldScan) {\n this.fileScanningService.initiateScan(uploadedFile.fileId, executionContext)\n .catch((scanError) => {\n this.logger.error('Failed to initiate file scanning', {\n fileId: uploadedFile!.fileId,\n ...projectCaughtErrorLogFields(scanError),\n });\n });\n }\n } catch (error) {\n // Only pre-success failures should transition a file to FAILED. Once the\n // upload already reached UPLOADED, later response-layer failures must not\n // corrupt the persisted state back to FAILED. Likewise, if the blob still\n // exists in storage because rollback failed, keep the row out of FAILED so\n // operators can distinguish that inconsistency from a clean failed upload.\n const shouldMarkAsFailed = !!fileRecord?.fileId && !uploadReachedSuccessState && !blobStoredInStorage;\n if (shouldMarkAsFailed) {\n try {\n await this.filesService.updateFileStatus(\n fileRecord.fileId,\n FileStatus.FAILED,\n executionContext\n );\n this.logDebug('File marked as FAILED due to upload error', {\n fileId: fileRecord.fileId,\n });\n } catch (updateError) {\n // Log but don't throw - we're already in error handling\n this.logger.error('Failed to mark file as FAILED', {\n fileId: fileRecord.fileId,\n ...projectCaughtErrorLogFields(updateError),\n });\n }\n }\n\n // Re-throw error to be handled by Express error handler\n throw error;\n }\n }\n\n /**\n * Serve (stream) a resource-linked file's bytes for INLINE preview/consumption.\n *\n * This is the read counterpart to `handleFileUpload` — the resource-integrated\n * file **serve** route (`GET .../{res}/:resourceId/files/:fieldName/:fileId`). The\n * controller has ALREADY authorized the caller against the parent resource's READ\n * operation before delegating here, so authorization **inherits from the linked\n * resource** — no consumable token, no public share (those belong to the global\n * `FileController` for its separate cross-resource/share purpose).\n *\n * The one job this method owns is the LINK-OWNERSHIP boundary: the requested\n * `fileId` MUST be linked to exactly this `{resourceType, resourceId, fieldName}`.\n * Without it, any caller who can READ a parent record could stream an arbitrary or\n * cross-resource file id through the route. A mismatch fails closed as NOT_FOUND\n * (no existence disclosure). `getFile()`'s own scope check is defense-in-depth.\n *\n * A `?variant=thumbnail` query asks for a downscaled preview rendition; it is\n * parsed fail-safe (unknown values → original bytes) and forwarded to the shared\n * streaming seam, which only transforms eligible raster images.\n *\n * @param request - Express request (`:fileId` etc. in params, `?variant=` in query).\n * @param response - Express response to stream into.\n * @param next - Express next (forwards pre-header stream errors).\n * @param resourceType - Parent resource type from the route.\n * @param fieldName - File field name from the route.\n * @param resourceId - Parent resource id from the route (authorization target).\n * @param fileId - The specific file id to serve (must belong to the field above).\n * @param executionContext - READ execution context built + authorized by the controller.\n */\n async handleFileServe(\n request: Request,\n response: Response,\n next: NextFunction,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string,\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n this.logDebug('Handling file serve', { resourceType, fieldName, resourceId, fileId });\n\n // getFile applies the file-scope access check (defense-in-depth). Primary authz —\n // the parent resource READ — was already enforced by the controller.\n const file = await this.filesService.getFile(fileId, executionContext);\n\n // SECURITY BOUNDARY: the served file MUST be linked to THIS resource + field.\n const belongsToRouteResource =\n !!file &&\n file.linkedResourceType === resourceType &&\n String(file.linkedResourceId) === String(resourceId) &&\n file.linkedFieldName === fieldName;\n\n if (!belongsToRouteResource) {\n this.logDebug('File serve denied: file not linked to route resource/field', {\n fileId,\n resourceType,\n resourceId,\n fieldName,\n linkedResourceType: file?.linkedResourceType,\n linkedResourceId: file?.linkedResourceId,\n linkedFieldName: file?.linkedFieldName,\n });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n\n // STATUS GATE — the same invariant the two GLOBAL file routes already enforce, applied at the\n // third site that streams bytes.\n //\n // It was missing here, and the omission became reachable the moment generated files got serve\n // routes (2026-08-25): a REGENERATE marks the superseded document `DELETED` while DELIBERATELY\n // retaining its `linkedResourceType/Id/FieldName`, so the link-ownership boundary above says yes\n // and the old document kept streaming — measured, 200 with 2,222 bytes. The same hole applies to\n // an UPLOADED file a privacy erasure marked `DELETED`: physical cleanup is a batch that runs much\n // later, and until it did, the erased bytes were still served in place.\n //\n // Two tiers, mirroring the existing gates rather than inventing a third posture:\n // - `FILE_METADATA_WITHHELD_STATUSES` (i.e. `DELETED`, the erasure outcome) → NOT_FOUND, because\n // for an erased file, confirming the id still resolves is itself a disclosure (the same\n // reasoning as `FileController.assertFileMetadataDisclosable`);\n // - anything else outside `FILE_DOWNLOADABLE_STATUSES` (`PENDING`, `SCANNING`, `FAILED`, …) →\n // the download route's VALIDATION shape, because such a file genuinely exists and may become\n // servable, and an uploader polling a preview needs to be told which.\n if (FILE_METADATA_WITHHELD_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: withheld status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n if (!FILE_DOWNLOADABLE_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: non-servable status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'File is not available for download', fileId, status: file.status },\n },\n );\n }\n\n // `?variant=thumbnail` → downscaled preview rendition (raster images only; the\n // streaming seam falls back to original bytes for anything else). Fail-safe parse.\n const variant = parseFileServeVariant(request.query.variant);\n\n await this.filesService.streamFileToResponse(file, response, executionContext, {\n disposition: 'inline',\n next,\n variant,\n });\n }\n\n /**\n * Derive file scope from parent resource's resourcePrimaryScope.\n *\n * Scope derivation rules:\n * - APPLICATION: sets applicationId from execution context\n * - ORGANIZATIONS: sets organizationId from execution context\n * - USER_SELF: sets userId + applicationId from execution context (no org — separate scope axis)\n *\n * @param resourceType - Parent resource type\n * @param executionContext - Execution context for scope values\n * @returns FileScopeIdentifiers derived from parent resource\n */\n private deriveScopeFromParentResource(\n resourceType: ResourceType,\n executionContext: ExecutionContext<any>\n ): FileScopeIdentifiers {\n // Get parent resource configuration to find its primaryScope\n const resourceConfig = this.resourcesRegistry.getResourceConfiguration(resourceType);\n\n // Get primaryScope from resource configuration\n // Default to ORGANIZATIONS if not specified\n const primaryScope = resourceConfig?.resourcePrimaryScope || ResourcePrimaryScope.ORGANIZATIONS;\n\n // Extract scope identifiers from execution context\n const organizationId = this.resourceOperationHelper.getInitiatorId(executionContext, 'organization');\n const userId = this.resourceOperationHelper.getInitiatorId(executionContext, 'user');\n // Fall back to the app config's applicationId when the execution context\n // doesn't carry one — same pattern this handler already uses for the path\n // binding above. There is exactly one application per backend, so\n // `appConfigService.applicationId` is the correct anchor when an internal\n // EC was built without a populated `applicationId`.\n const applicationId = executionContext.applicationId || this.appConfigService.applicationId;\n\n switch (primaryScope) {\n case ResourcePrimaryScope.APPLICATION:\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.APPLICATION,\n applicationId,\n };\n\n case ResourcePrimaryScope.ORGANIZATIONS:\n if (!organizationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.ORGANIZATIONS,\n applicationId,\n organizationId,\n };\n\n case ResourcePrimaryScope.USER_SELF:\n // USER_SELF and ORGANIZATIONS are independent primary-scope axes (separation of\n // concern): a self-owned file is owned by the USER, never by an org. Require the\n // user (owner) + applicationId (tenant/bucket anchor); do NOT read or persist an\n // organizationId here — a self-profile carries no org context.\n if (!userId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.USER_SELF,\n applicationId,\n userId,\n };\n\n default:\n throw this.errorBuilder.buildError(\n ErrorType.CONFIGURATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'File uploads only support APPLICATION, ORGANIZATIONS, and USER_SELF resource scopes',\n resourceType,\n primaryScope,\n },\n }\n );\n }\n }\n}\n"]}
1
+ {"version":3,"file":"resource-file-upload-handler.backend.service.js","sourceRoot":"","sources":["../../../../../src/files/handlers/resource-file-upload-handler.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAG/C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAuC,SAAS,EAAE,2BAA2B,EAAQ,UAAU,EAAE,0BAA0B,EAAE,+BAA+B,EAAE,oBAAoB,EAAwB,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC3R,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;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D,YAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,YAAA,MAAM,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;IAEjD,YAAA,MAAM,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;+CAvBnB,0BAA0B;QAErB,+BAA+B;QAE9B,2BAA2B;QAEhC,qBAAqB;QAEtB,mBAAmB;QAEd,+BAA+B;QAE9B,gCAAgC;QAE3B,qCAAqC;QAE5C,uBAAuB;QAE3B,qCAAqC;QAE9B,0BAA0B;QAEvB,6BAA6B;QAE7B,6BAA6B;GA/B7D,uCAAuC,CA2xBnD","sourcesContent":["/**\n * Resource File Upload Handler Backend Service\n *\n * Handles user-provided uploads for resource-integrated file fields after the\n * controller's pre-Multer middleware has already established execution context\n * and authorized access to the owning resource route.\n *\n * Coordinates validation, file record creation, and storage upload. UPDATE\n * routes authorize the target resource before reaching this handler, but the\n * upload itself still creates a new File record; attaching/replacing that file\n * on the resource is owned by the calling form/field mutation lane, not by this\n * upload transport.\n *\n * Flow:\n * 1. Validate file exists in request\n * 2. Resolve file constraints from resource field schema\n * 3. Validate file against constraints\n * 4. Create file record (status: PENDING)\n * 5. Upload file to storage\n * 6. Update file status to UPLOADED\n * 7. Return file metadata\n * 8. (async) Initiate AV scan if enabled (UPLOADED → SCANNING → CLEAN/INFECTED)\n */\n\nimport { injectable, inject } from 'inversify';\nimport type { Request, Response, NextFunction } from 'express';\nimport { Readable } from 'stream';\nimport fs from 'fs';\nimport { CoreResourceOperation, ResourceType, ErrorType, ErrorCustomMessageReference, File, FileStatus, FILE_DOWNLOADABLE_STATUSES, FILE_METADATA_WITHHELD_STATUSES, ResourcePrimaryScope, FileScopeIdentifiers, isWildoBackendError, parseFileServeVariant } from '@wildo-ai/saas-models';\nimport { FileGenerationSource } from '@wildo-ai/zod-decorators';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { FileConstraintResolverChain } from '~wildo-backend-lib/files/constraints/file-constraint-resolver-chain.backend.service';\nimport { FileValidationService } from '~wildo-backend-lib/files/constraints/file-validation.backend.service';\nimport { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport { ResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/resource-operations-helper.backend.service';\nimport { validateResourceType, validateFieldName, validateResourceId, validateFileId, validateContentType, validateSize, validateUploadedBy, validateUploadedByEntityType, resolveConfiguredMaxFileSize } from '~wildo-backend-lib/files/utils/file-validation.utils';\nimport { resolveFileUploaderPrincipal } from '~wildo-backend-lib/files/utils/file-uploader.utils';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { FileStorageRouterBackendService } from '~wildo-backend-lib/files/storage/file-storage-router.backend.service';\nimport { FileFieldDetectionBackendService } from '~wildo-backend-lib/files/services/file-field-detection.backend.service';\nimport { FileStoragePathResolverBackendService } from '~wildo-backend-lib/files/storage/file-storage-path-resolver.backend.service';\nimport type { StorageUploadResult, StorageUploadOptions } from '~wildo-backend-lib/files/storage/file-storage-provider.types';\nimport { FileScanningBackendService } from '~wildo-backend-lib/files/services/file-scanning.backend.service';\nimport { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { resolveStorageApplicationIdentity } from '~wildo-backend-lib/files/utils/storage-application-identity.backend.utils';\nimport { ConsumableTokenBackendService } from '~wildo-backend-lib/security/consumable-tokens/services/consumable-token.backend.service';\nimport { FileUploadGrantBackendService } from '~wildo-backend-lib/files/services/file-upload-grant.backend.service';\nimport type { FileUploadRouteGrantLocals } from '~wildo-backend-lib/files/handlers/file-upload-route-locals.backend.types';\n\n@injectable()\nexport class ResourceFileUploadHandlerBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger)\n private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.FileConstraintResolverChain)\n private readonly constraintResolver: FileConstraintResolverChain,\n @inject(SAAS_SERVICE_TYPES.FileValidationService)\n private readonly fileValidator: FileValidationService,\n @inject(SAAS_SERVICE_TYPES.FilesBackendService)\n private readonly filesService: FilesBackendService,\n @inject(SAAS_SERVICE_TYPES.FileStorageRouter)\n private readonly fileStorageRouter: FileStorageRouterBackendService,\n @inject(SAAS_SERVICE_TYPES.FileFieldDetectionService)\n private readonly fileFieldDetection: FileFieldDetectionBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceOperationHelperService)\n private readonly resourceOperationHelper: ResourceOperationHelperBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.FileStoragePathResolver)\n private readonly pathResolver: FileStoragePathResolverBackendService,\n @inject(SAAS_SERVICE_TYPES.FileScanningService)\n private readonly fileScanningService: FileScanningBackendService,\n @inject(SAAS_SERVICE_TYPES.ConsumableTokenService)\n private readonly consumableTokenService: ConsumableTokenBackendService,\n @inject(SAAS_SERVICE_TYPES.FileUploadGrantService)\n private readonly fileUploadGrantService: FileUploadGrantBackendService,\n ) {\n this.logDebug = this.logger.debugByType('ResourceFileUploadHandlerBackendService');\n this.logger.setDebugTypeLogging('ResourceFileUploadHandlerBackendService', false);\n }\n\n /**\n * Extract the resource instance from the request body (if available).\n * In multipart uploads, the resource data may be present in `req.body`\n * as parsed form fields.\n */\n private extractResourceInstance(req: Request): Record<string, unknown> | undefined {\n if (req.body && typeof req.body === 'object' && Object.keys(req.body).length > 0) {\n return req.body as Record<string, unknown>;\n }\n return undefined;\n }\n\n /**\n * Handle file upload for resource-integrated file fields.\n *\n * @param request - Express request with file in request.file (Multer)\n * @param response - Express response\n * @param resourceType - Resource type (e.g., 'todos')\n * @param fieldName - File field name (e.g., 'attachments')\n * @param resourceId - Resource ID (undefined for CREATE, string for UPDATE route authorization)\n * @param operation - Route operation used for authorization; the upload always creates a new File record\n * @param executionContext - Execution context from request\n */\n async handleFileUpload(\n request: Request,\n response: Response,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string | undefined,\n operation: CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE,\n executionContext: ExecutionContext<any>\n ): Promise<void> {\n // Validate inputs (CRITICAL: Prevents invalid data propagation and security vulnerabilities)\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n if (resourceId !== undefined) {\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n }\n\n this.logDebug('Handling file upload', {\n resourceType,\n fieldName,\n resourceId,\n operation,\n hasFile: !!request.file,\n });\n\n let fileRecord: { fileId: string } | undefined;\n let uploadReachedSuccessState = false;\n let blobStoredInStorage = false;\n\n try {\n // Step 1: Validate file exists in request\n if (!request.file) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_UPLOAD_NO_FILE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n const multerFile = request.file;\n const maxFileSize = resolveConfiguredMaxFileSize(this.appConfigService.config.storage?.maxFileSize);\n\n // Validate file metadata (CRITICAL: Prevents invalid file data)\n validateContentType(multerFile.mimetype, this.errorBuilder, executionContext, 'contentType');\n validateSize(multerFile.size, maxFileSize, this.errorBuilder, executionContext, 'size');\n\n // Step 2: Resolve file constraints from resource field schema\n const constraint = await this.constraintResolver.resolve({\n resourceType,\n fieldName,\n });\n\n // Step 3: Validate file against constraints\n const validationResult = await this.fileValidator.validateFile(multerFile, constraint);\n\n if (!validationResult.success) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: 'File validation failed',\n errors: validationResult.errors,\n filename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n },\n }\n );\n }\n\n // Step 4: Reject direct uploads to generated file fields FIRST —\n // before scope derivation. \"This field cannot receive user uploads at\n // all\" is a more fundamental rejection than \"what scope does the file\n // belong to\", and must not be masked by a scope-derivation error\n // (e.g. a missing applicationId) on a field that was never uploadable.\n const fieldMeta = this.fileFieldDetection.getFileFieldMetadata(resourceType, fieldName);\n if (fieldMeta?.fileMetadata.generation?.source === FileGenerationSource.PDF_TEMPLATE) {\n throw this.errorBuilder.buildError(\n ErrorType.BUSINESS_RULE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_GENERATED_FIELD_NOT_WRITABLE,\n context: {\n // diagnostic (log-only)\n resourceType,\n fieldName,\n },\n }\n );\n }\n\n // Step 4b: Derive scope from parent resource's resourcePrimaryScope.\n const scope = this.deriveScopeFromParentResource(resourceType, executionContext);\n\n // Step 4c: Resolve storage provider from z_file() metadata.\n const storageAccepted = fieldMeta?.fileMetadata.storageAccepted;\n const storageProvider = this.fileStorageRouter.resolveProvider(storageAccepted);\n\n // Step 4d: a file upload GRANT (issue #312) is claimed HERE — the point of no return. Every check a\n // caller can act on (no file, wrong type, too large, generated field) has run; nothing has been\n // written. A refusal above leaves the grant usable for a retry; a race loser is refused by the\n // atomic consume and writes nothing. This handler is NOT on the services-registry pipeline, so its\n // post-operation consumption never sees this request — this is the one consumption site.\n const grant = (response.locals as FileUploadRouteGrantLocals | undefined)?.fileUploadGrant;\n if (grant) {\n await this.consumableTokenService.consumeToken(executionContext.consumableTokenValue!);\n executionContext.markConsumableTokenConsumed();\n }\n\n // Step 5: Create file record (status: PENDING) with scope\n // Under a grant the file is attributed to the MINTER — the person or machine that delegated the\n // upload — never to the grant. A user-minted grant already yields that through the token context\n // (`resolveFileUploaderPrincipal`, CONSUMABLE_TOKEN case); a machine-minted one yields nothing\n // there, so the grant's own `minter` record is used. Both agree with createFile's mismatch guard.\n const uploaderPrincipal = grant\n ? this.fileUploadGrantService.resolveUploaderFromGrant(grant.metadata)\n : resolveFileUploaderPrincipal(executionContext);\n if (uploaderPrincipal) {\n validateUploadedBy(uploaderPrincipal.uploadedBy, this.errorBuilder, executionContext, 'uploadedBy');\n validateUploadedByEntityType(\n uploaderPrincipal.uploadedByEntityType,\n this.errorBuilder,\n executionContext,\n 'uploadedByEntityType',\n );\n }\n\n const createdFile = await this.filesService.createFile(\n {\n filename: multerFile.originalname || multerFile.filename,\n originalFilename: multerFile.originalname,\n mimeType: multerFile.mimetype,\n size: multerFile.size,\n storageProvider: storageProvider.providerId,\n scope,\n uploadedBy: uploaderPrincipal?.uploadedBy,\n uploadedByEntityType: uploaderPrincipal?.uploadedByEntityType,\n },\n executionContext\n );\n\n fileRecord = { fileId: createdFile.fileId };\n\n // Step 5b: Resolve upload path options now that we have the fileId.\n const resourceInstance = this.extractResourceInstance(request);\n let uploadOptions: StorageUploadOptions | undefined;\n if (fieldMeta) {\n uploadOptions = this.pathResolver.resolve(\n createdFile.fileId,\n fieldName,\n fieldMeta.fileMetadata,\n resolveStorageApplicationIdentity(this.appConfigService),\n multerFile.originalname,\n resourceInstance,\n );\n }\n\n // The resource segment of the object key comes from the row that was just created, and is\n // applied OUTSIDE the `fieldMeta` branch on purpose: a file without field metadata still\n // belongs to a resource, and keying it as unlinked would place it outside the prefix its\n // principal is granted once the session policy narrows per resource.\n //\n // Derived once, here, at create — the key never moves afterwards, so this is the only\n // moment the segment can be decided.\n // Use the handler's OWN `resourceType` parameter, NOT `createdFile.linkedResourceType`.\n //\n // `createFile` above is called WITHOUT a linked resource — the row is created unlinked and the\n // association is written later — so reading the field back off the created record is always\n // `undefined`, and every upload silently took the `_unlinked/` staging branch. Caught only by\n // uploading a real file and listing the object store: `tsc` was clean and every unit test\n // green, because nothing in either exercises the value that reaches the key builder.\n //\n // `resourceType` is a parameter of this method and is validated at entry, so it is the\n // authoritative answer to \"which resource does this blob belong to\" at the only moment the\n // key can be decided.\n // `scope` rides along so the key carries `<scope>/<scopeId>` — the same `FileScopeIdentifiers`\n // already built above for the File row, so the row and the object key agree by construction\n // rather than by two independent derivations.\n uploadOptions = { ...uploadOptions, linkedResourceType: resourceType, scope };\n\n // Step 6: Create stream from disk file (true streaming, no memory buffering)\n // With disk storage, multerFile.path contains the temp file path\n if (!multerFile.path) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Multer file path is missing (disk storage error)',\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n // Verify file exists before creating stream\n if (!fs.existsSync(multerFile.path)) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'Temp file not found on disk',\n path: multerFile.path,\n filename: multerFile.originalname,\n },\n }\n );\n }\n\n let fileStream: Readable | null = null;\n let uploadResult: StorageUploadResult | null = null;\n\n // Step 7: Upload the blob through the resolved storage provider.\n try {\n // Create stream from disk file (true streaming, no memory buffering)\n fileStream = fs.createReadStream(multerFile.path);\n\n uploadResult = await storageProvider.upload(\n fileStream,\n createdFile.fileId,\n multerFile.mimetype,\n multerFile.size,\n executionContext,\n uploadOptions,\n );\n blobStoredInStorage = true;\n\n this.logDebug('File uploaded to storage successfully', {\n fileId: createdFile.fileId,\n });\n } catch (uploadError) {\n // If upload fails, mark file as FAILED\n await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.FAILED,\n executionContext\n );\n\n throw this.errorBuilder.buildError(\n ErrorType.EXTERNAL_SERVICE,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.EXTERNAL_SERVICE,\n context: {\n message: 'Failed to upload file to storage',\n fileId: createdFile.fileId,\n error: describeCaughtError(uploadError),\n },\n }\n );\n } finally {\n // Clean up temp file (always, even on error)\n // This ensures temp files are removed even if upload fails or other errors occur\n if (multerFile.path && fs.existsSync(multerFile.path)) {\n try {\n fs.unlinkSync(multerFile.path);\n this.logDebug('Temp file cleaned up', { path: multerFile.path });\n } catch (cleanupError) {\n // Log cleanup error but don't fail operation\n this.logger.warn('Failed to clean up temp file', {\n path: multerFile.path,\n ...projectCaughtErrorLogFields(cleanupError),\n });\n }\n }\n\n // Also destroy stream if it was created\n if (fileStream && !fileStream.destroyed) {\n fileStream.destroy();\n }\n }\n\n // Step 8: Update file status to UPLOADED (with retry logic)\n // CRITICAL: If updateFileStatus() fails after successful storage upload,\n // file exists in storage but status remains PENDING in database.\n // Retry logic handles transient errors (network issues, database locks, etc.)\n // Decision 5.1: Retry Logic with audit log error (Option A)\n const maxRetries = 3;\n const initialDelay = 1000; // 1 second\n\n let lastError: Error | null = null;\n let uploadedFile: File | null = null;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n uploadedFile = await this.filesService.updateFileStatus(\n createdFile.fileId,\n FileStatus.UPLOADED,\n executionContext,\n undefined,\n uploadResult ?? undefined,\n );\n break; // Success\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(describeCaughtError(error));\n\n if (attempt < maxRetries) {\n const delay = initialDelay * Math.pow(2, attempt);\n this.logger.warn('File status update failed, retrying', {\n fileId: createdFile.fileId,\n attempt: attempt + 1,\n maxRetries,\n delay,\n error: lastError.message,\n });\n await new Promise(resolve => setTimeout(resolve, delay));\n } else {\n // Final attempt failed - audit log and re-throw\n this.logger.error('File status update failed after all retries', {\n fileId: createdFile.fileId,\n attempts: maxRetries + 1,\n error: lastError.message,\n // File exists in storage but status remains PENDING in database\n // This is a data inconsistency that needs manual intervention\n });\n\n // If the blob already reached storage but metadata could not commit to\n // UPLOADED, try to roll the blob back so the row can safely move into\n // a failed lifecycle path instead of silently pointing at live data.\n if (blobStoredInStorage && uploadResult) {\n try {\n await storageProvider.delete(\n {\n fileId: createdFile.fileId,\n storageProvider: uploadResult.provider,\n storageRef: uploadResult.storageRef,\n },\n executionContext,\n );\n blobStoredInStorage = false;\n this.logger.warn('Rolled back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n });\n } catch (rollbackError) {\n if (!isWildoBackendError(rollbackError) || rollbackError.type !== ErrorType.NOT_FOUND) {\n this.logger.error('Failed to roll back stored blob after upload status commit failure', {\n fileId: createdFile.fileId,\n ...projectCaughtErrorLogFields(rollbackError),\n originalError: lastError.message,\n });\n } else {\n blobStoredInStorage = false;\n }\n }\n }\n\n // Re-throw to fail the operation\n throw lastError;\n }\n }\n }\n\n // Ensure uploadedFile is set (TypeScript safety check)\n if (!uploadedFile) {\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.INTERNAL,\n context: {\n message: 'File status update failed - uploadedFile is null after retries',\n fileId: createdFile.fileId,\n },\n }\n );\n }\n\n /*\n * Step 9: hold a scanned file NON-DOWNLOADABLE before anyone is told the upload succeeded.\n *\n * `initiateScan` awaits the UPLOADED -> SCANNING transition and only then fires the scan\n * pipeline asynchronously, so awaiting it here costs ONE status write, not the scan. Until\n * 2026-09-08 this ran AFTER the response, fire-and-forget (#433): the file sat at UPLOADED —\n * a downloadable status — for the whole gap between the upload committing and the transition\n * landing, so a field declaring `scanPolicy: 'required'` had a window in which its bytes were\n * servable unscanned. The control advertised more than it held.\n *\n * FAIL-CLOSED, deliberately: this is NOT wrapped in a catch. A scan that cannot be initiated\n * fails the upload, and because `uploadReachedSuccessState` is still false the catch below\n * marks the file FAILED. A caught-and-logged failure would leave the row at UPLOADED, which is\n * exactly the servable state this closes — a scanner outage would silently reopen the window\n * on every upload. An operator gets a failed upload instead, which is the behaviour a control\n * named `required` has to have.\n */\n const scanIsRequired = this.fileScanningService.shouldScan(fieldMeta?.fileMetadata);\n let uploadedFileForResponse: File = uploadedFile;\n if (scanIsRequired) {\n await this.fileScanningService.initiateScan(uploadedFile.fileId, executionContext);\n // Re-read so the response reports SCANNING rather than the UPLOADED this row no longer has.\n // A client polling `GET /files/:fileId/metadata` sees SCANNING either way; reporting\n // UPLOADED here would make the upload response the one place the two disagree. A null read\n // keeps the pre-transition row rather than failing an upload that already succeeded.\n const afterScanInitiation = await this.filesService.getFile(uploadedFile.fileId, executionContext);\n if (afterScanInitiation) {\n uploadedFileForResponse = afterScanInitiation;\n }\n }\n\n // Step 9b: Return success response with file metadata\n const fileMetadata = this.filesService.toMetadataResponse(uploadedFileForResponse);\n /*\n * SCANNING counts as reached-success alongside UPLOADED: the upload itself committed, and the\n * catch below must not roll a scanned file back to FAILED for a later response-layer failure.\n */\n uploadReachedSuccessState = uploadedFileForResponse.status === FileStatus.UPLOADED\n || uploadedFileForResponse.status === FileStatus.SCANNING;\n\n response.status(200).json({\n success: true,\n file: fileMetadata,\n });\n\n this.logDebug('File upload completed successfully', {\n fileId: uploadedFile.fileId,\n resourceType,\n fieldName,\n });\n\n // Step 10: a redeemed grant records what it produced and is audited. Best-effort by contract —\n // the upload has succeeded and the response is sent; a failure here is logged, never thrown.\n if (grant) {\n this.fileUploadGrantService\n .recordRedemption(grant, { fileId: uploadedFile.fileId, mimeType: uploadedFile.mimeType, size: uploadedFile.size }, executionContext)\n .catch((redemptionError) => {\n this.logger.error('File upload grant: redemption record failed', {\n grantId: grant.token._id,\n fileId: uploadedFile!.fileId,\n ...projectCaughtErrorLogFields(redemptionError),\n });\n });\n }\n\n } catch (error) {\n // Only pre-success failures should transition a file to FAILED. Once the\n // upload already reached UPLOADED, later response-layer failures must not\n // corrupt the persisted state back to FAILED. Likewise, if the blob still\n // exists in storage because rollback failed, keep the row out of FAILED so\n // operators can distinguish that inconsistency from a clean failed upload.\n const shouldMarkAsFailed = !!fileRecord?.fileId && !uploadReachedSuccessState && !blobStoredInStorage;\n if (shouldMarkAsFailed) {\n try {\n await this.filesService.updateFileStatus(\n fileRecord.fileId,\n FileStatus.FAILED,\n executionContext\n );\n this.logDebug('File marked as FAILED due to upload error', {\n fileId: fileRecord.fileId,\n });\n } catch (updateError) {\n // Log but don't throw - we're already in error handling\n this.logger.error('Failed to mark file as FAILED', {\n fileId: fileRecord.fileId,\n ...projectCaughtErrorLogFields(updateError),\n });\n }\n }\n\n // Re-throw error to be handled by Express error handler\n throw error;\n }\n }\n\n /**\n * Serve (stream) a resource-linked file's bytes for INLINE preview/consumption.\n *\n * This is the read counterpart to `handleFileUpload` — the resource-integrated\n * file **serve** route (`GET .../{res}/:resourceId/files/:fieldName/:fileId`). The\n * controller has ALREADY authorized the caller against the parent resource's READ\n * operation before delegating here, so authorization **inherits from the linked\n * resource** — no consumable token, no public share (those belong to the global\n * `FileController` for its separate cross-resource/share purpose).\n *\n * The one job this method owns is the LINK-OWNERSHIP boundary: the requested\n * `fileId` MUST be linked to exactly this `{resourceType, resourceId, fieldName}`.\n * Without it, any caller who can READ a parent record could stream an arbitrary or\n * cross-resource file id through the route. A mismatch fails closed as NOT_FOUND\n * (no existence disclosure). `getFile()`'s own scope check is defense-in-depth.\n *\n * A `?variant=thumbnail` query asks for a downscaled preview rendition; it is\n * parsed fail-safe (unknown values → original bytes) and forwarded to the shared\n * streaming seam, which only transforms eligible raster images.\n *\n * @param request - Express request (`:fileId` etc. in params, `?variant=` in query).\n * @param response - Express response to stream into.\n * @param next - Express next (forwards pre-header stream errors).\n * @param resourceType - Parent resource type from the route.\n * @param fieldName - File field name from the route.\n * @param resourceId - Parent resource id from the route (authorization target).\n * @param fileId - The specific file id to serve (must belong to the field above).\n * @param executionContext - READ execution context built + authorized by the controller.\n */\n async handleFileServe(\n request: Request,\n response: Response,\n next: NextFunction,\n resourceType: ResourceType,\n fieldName: string,\n resourceId: string,\n fileId: string,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n validateResourceType(resourceType, this.errorBuilder, executionContext, 'resourceType');\n validateFieldName(fieldName, this.errorBuilder, executionContext, 'fieldName');\n validateResourceId(resourceId, this.errorBuilder, executionContext, 'resourceId');\n validateFileId(fileId, this.errorBuilder, executionContext, 'fileId');\n\n this.logDebug('Handling file serve', { resourceType, fieldName, resourceId, fileId });\n\n // getFile applies the file-scope access check (defense-in-depth). Primary authz —\n // the parent resource READ — was already enforced by the controller.\n const file = await this.filesService.getFile(fileId, executionContext);\n\n // SECURITY BOUNDARY: the served file MUST be linked to THIS resource + field.\n const belongsToRouteResource =\n !!file &&\n file.linkedResourceType === resourceType &&\n String(file.linkedResourceId) === String(resourceId) &&\n file.linkedFieldName === fieldName;\n\n if (!belongsToRouteResource) {\n this.logDebug('File serve denied: file not linked to route resource/field', {\n fileId,\n resourceType,\n resourceId,\n fieldName,\n linkedResourceType: file?.linkedResourceType,\n linkedResourceId: file?.linkedResourceId,\n linkedFieldName: file?.linkedFieldName,\n });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n\n // STATUS GATE — the same invariant the two GLOBAL file routes already enforce, applied at the\n // third site that streams bytes.\n //\n // It was missing here, and the omission became reachable the moment generated files got serve\n // routes (2026-08-25): a REGENERATE marks the superseded document `DELETED` while DELIBERATELY\n // retaining its `linkedResourceType/Id/FieldName`, so the link-ownership boundary above says yes\n // and the old document kept streaming — measured, 200 with 2,222 bytes. The same hole applies to\n // an UPLOADED file a privacy erasure marked `DELETED`: physical cleanup is a batch that runs much\n // later, and until it did, the erased bytes were still served in place.\n //\n // Two tiers, mirroring the existing gates rather than inventing a third posture:\n // - `FILE_METADATA_WITHHELD_STATUSES` (i.e. `DELETED`, the erasure outcome) → NOT_FOUND, because\n // for an erased file, confirming the id still resolves is itself a disclosure (the same\n // reasoning as `FileController.assertFileMetadataDisclosable`);\n // - anything else outside `FILE_DOWNLOADABLE_STATUSES` (`PENDING`, `SCANNING`, `FAILED`, …) →\n // the download route's VALIDATION shape, because such a file genuinely exists and may become\n // servable, and an uploader polling a preview needs to be told which.\n if (FILE_METADATA_WITHHELD_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: withheld status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_NOT_FOUND,\n context: { fileId }, // diagnostic (log-only)\n },\n );\n }\n if (!FILE_DOWNLOADABLE_STATUSES.has(file.status)) {\n this.logDebug('File serve denied: non-servable status', { fileId, status: file.status });\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { message: 'File is not available for download', fileId, status: file.status },\n },\n );\n }\n\n // `?variant=thumbnail` → downscaled preview rendition (raster images only; the\n // streaming seam falls back to original bytes for anything else). Fail-safe parse.\n const variant = parseFileServeVariant(request.query.variant);\n\n await this.filesService.streamFileToResponse(file, response, executionContext, {\n disposition: 'inline',\n next,\n variant,\n });\n }\n\n /**\n * Derive file scope from parent resource's resourcePrimaryScope.\n *\n * Scope derivation rules:\n * - APPLICATION: sets applicationId from execution context\n * - ORGANIZATIONS: sets organizationId from execution context\n * - USER_SELF: sets userId + applicationId from execution context (no org — separate scope axis)\n *\n * @param resourceType - Parent resource type\n * @param executionContext - Execution context for scope values\n * @returns FileScopeIdentifiers derived from parent resource\n */\n private deriveScopeFromParentResource(\n resourceType: ResourceType,\n executionContext: ExecutionContext<any>\n ): FileScopeIdentifiers {\n // Get parent resource configuration to find its primaryScope\n const resourceConfig = this.resourcesRegistry.getResourceConfiguration(resourceType);\n\n // Get primaryScope from resource configuration\n // Default to ORGANIZATIONS if not specified\n const primaryScope = resourceConfig?.resourcePrimaryScope || ResourcePrimaryScope.ORGANIZATIONS;\n\n // Extract scope identifiers from execution context\n const organizationId = this.resourceOperationHelper.getInitiatorId(executionContext, 'organization');\n const userId = this.resourceOperationHelper.getInitiatorId(executionContext, 'user');\n // Fall back to the app config's applicationId when the execution context\n // doesn't carry one — same pattern this handler already uses for the path\n // binding above. There is exactly one application per backend, so\n // `appConfigService.applicationId` is the correct anchor when an internal\n // EC was built without a populated `applicationId`.\n const applicationId = executionContext.applicationId || this.appConfigService.applicationId;\n\n switch (primaryScope) {\n case ResourcePrimaryScope.APPLICATION:\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.APPLICATION,\n applicationId,\n };\n\n case ResourcePrimaryScope.ORGANIZATIONS:\n if (!organizationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.ORGANIZATIONS,\n applicationId,\n organizationId,\n };\n\n case ResourcePrimaryScope.USER_SELF:\n // USER_SELF and ORGANIZATIONS are independent primary-scope axes (separation of\n // concern): a self-owned file is owned by the USER, never by an org. Require the\n // user (owner) + applicationId (tenant/bucket anchor); do NOT read or persist an\n // organizationId here — a self-profile carries no org context.\n if (!userId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n if (!applicationId) {\n throw this.errorBuilder.buildError(\n ErrorType.VALIDATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.FILE_SCOPE_IDENTIFIER_MISSING,\n context: {\n resourceType, // diagnostic (log-only)\n },\n }\n );\n }\n return {\n primaryScope: ResourcePrimaryScope.USER_SELF,\n applicationId,\n userId,\n };\n\n default:\n throw this.errorBuilder.buildError(\n ErrorType.CONFIGURATION,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message: 'File uploads only support APPLICATION, ORGANIZATIONS, and USER_SELF resource scopes',\n resourceType,\n primaryScope,\n },\n }\n );\n }\n }\n}\n"]}
@@ -11,16 +11,33 @@
11
11
  * 5. Processes combined results (CLEAN / INFECTED)
12
12
  * 6. Quarantines infected files
13
13
  *
14
- * Scanning is **optimistic**: the upload response returns immediately
15
- * with status UPLOADED. The file becomes downloadable only after
16
- * transitioning to CLEAN (when scanning is enabled). If scanning is
17
- * disabled, the file stays at UPLOADED and remains downloadable.
14
+ * Scanning is **fail-closed at the gate, asynchronous in the pipeline** (#433). The upload handler
15
+ * AWAITS `initiateScan`, which awaits the UPLOADED -> SCANNING transition and only then fires the
16
+ * pipeline — so the upload response costs one status write, not a scan, and the file is already
17
+ * non-downloadable when the caller is told the upload succeeded. It becomes downloadable when the
18
+ * result handler transitions it to CLEAN.
19
+ *
20
+ * This paragraph used to say the response "returns immediately with status UPLOADED", and that was
21
+ * the defect: UPLOADED is a downloadable status, so a field declaring `scanPolicy: 'required'` had
22
+ * a window in which unscanned bytes were servable. If scanning is not required for the field, the
23
+ * file stays at UPLOADED and remains downloadable — that half is unchanged and deliberate.
18
24
  *
19
25
  * Configuration:
20
- * - Global: `appConfig.files.scanning.enabled` (default: false)
21
- * - Per-field: `z_file({ scanPolicy: 'required' | 'skip' })` overrides global
26
+ * - Application-wide: DERIVED, not declared. Scanning is on for a field that states no policy of its
27
+ * own exactly when a scanner is reachable — `fileScanning.antivirus` (seeded from `CLAMAV_HOST`) or
28
+ * `fileScanning.yara` both enabled and reachable (`YARA_ENABLED` + `YARA_HOST`). Provisioning the
29
+ * sidecar IS the application-level opt-in; there is no separate on/off flag. See
30
+ * {@link FileScanningBackendService.isGlobalScanningEnabled} for why it is derived rather than declared.
31
+ * - Per-field: `z_file({ scanPolicy: 'required' | 'skip' })` overrides that, in both directions.
32
+ *
33
+ * These two lines used to name `appConfig.files.scanning.enabled`, a configuration path no schema has
34
+ * ever declared — so the application-wide half was documented, cast through `any`, and dead.
35
+ *
36
+ * A scan that was REQUESTED and finds no scanner now FAILS the file rather than passing it; the tail of
37
+ * `executeScan` carries the reasoning.
22
38
  */
23
39
  import type { FileSchemaMetadata } from '@wildo-ai/zod-decorators';
40
+ import type { AuditLogsBackendService } from '../../compliance/audit-trails/services/audit-logs.backend.service';
24
41
  import type { LoggerService } from '../../monitoring/logger/services/logger.service';
25
42
  import { ErrorBuilderBackendService } from '../../errors/services/error-builder.backend.service';
26
43
  import { ExecutionContext } from '../../runtime/models/execution-context.backend.schemas';
@@ -39,19 +56,72 @@ export declare class FileScanningBackendService {
39
56
  private readonly clamavScanner;
40
57
  private readonly yaraScanner;
41
58
  private readonly fileStorageRouter;
59
+ private readonly auditLogsService?;
42
60
  protected logDebug: (message: string, context?: Record<string, unknown>) => void;
43
61
  private readonly onCleanCallbacks;
44
- constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, filesService: FilesBackendService, appConfigService: AppConfigurationService, clamavScanner: ClamAVScannerBackendService, yaraScanner: YaraScannerBackendService, fileStorageRouter: FileStorageRouterBackendService);
62
+ constructor(logger: LoggerService, errorBuilder: ErrorBuilderBackendService, filesService: FilesBackendService, appConfigService: AppConfigurationService, clamavScanner: ClamAVScannerBackendService, yaraScanner: YaraScannerBackendService, fileStorageRouter: FileStorageRouterBackendService, auditLogsService?: AuditLogsBackendService);
45
63
  /**
46
64
  * Determine whether a file should be scanned after upload.
47
65
  *
48
66
  * Resolution order:
49
67
  * 1. Per-field `z_file({ scanPolicy })` wins if set
50
- * 2. Falls back to global `appConfig.files.scanning.enabled`
68
+ * 2. Falls back to the application-wide answer, {@link isGlobalScanningEnabled}
69
+ *
70
+ * assurance-control: WILDO.SECURITY.INGESTED_CONTENT_INSPECTION — whether ingested content is
71
+ * inspected is a declared decision, per field and then per application, rather than an implicit one.
72
+ *
73
+ * The per-APPLICATION half of that claim was false until 2026-09-09: step 2 read a configuration path
74
+ * no schema declares, so it answered `false` in every application ever built and `scanPolicy` was the
75
+ * only reachable declaration. It is true now because the application-wide answer is DERIVED from the
76
+ * scanner topology the operator provisions — a declaration made by supplying `CLAMAV_HOST`, and
77
+ * refused a default. Nothing here is implicit in either direction: a field can still override, and a
78
+ * requested scan with no scanner refuses rather than passing (see the tail of `executeScan`).
51
79
  */
52
80
  shouldScan(fileMetadata?: FileSchemaMetadata): boolean;
53
81
  /**
54
- * Check if global scanning is enabled in the app configuration.
82
+ * Whether scanning is on APPLICATION-WIDE, for a file field that states no `scanPolicy` of its own.
83
+ *
84
+ * DERIVED from the platform-injected `fileScanning` topology: a scanner being reachable IS the
85
+ * application-level opt-in.
86
+ *
87
+ * ## What this replaced
88
+ *
89
+ * `(this.appConfigService.config as Record<string, any>)?.files?.scanning?.enabled === true`. The
90
+ * `any` cast is the tell — `AppConfigurationSchema` declares no `files` section, `z.object` strips
91
+ * unknown keys, so the parsed configuration could never carry that path and the expression was
92
+ * `undefined === true` for every application, for the whole life of the flag. The service's own
93
+ * docstring documented it as the global switch.
94
+ *
95
+ * ## Why DERIVED rather than declared
96
+ *
97
+ * Adding an `enabled` boolean to `AppConfiguration_FileScanningSchema` was the other candidate and is
98
+ * rejected on three counts:
99
+ *
100
+ * - **the answer already exists.** `fileScanning` is a mutation-boundary-PROTECTED section
101
+ * (`APP_CONFIG_MUTATION_BOUNDARY_RULES` in `app-config.backend-authored.definitions.ts`: "file-scanning
102
+ * sidecar topology and its platform-level opt-in are env/bootstrap-owned"), so an application cannot
103
+ * author it. A boolean would have to be seeded from a NEW environment key sitting beside the host key
104
+ * that already says the same thing — a second source of truth that can disagree with the first;
105
+ * - **it matches the convention of the thing it gates.** ClamAV has no enable flag anywhere in this
106
+ * subsystem: `ClamAVScannerBackendService.isConfigured()` states "presence of a host IS the opt-in",
107
+ * and `buildFileServicesTopologyFromEnvironment` refuses to emit a plausible default host for exactly
108
+ * that reason;
109
+ * - **it closes the hole the repair would otherwise open.** A separate boolean makes "globally on, no
110
+ * scanner reachable" a REPRESENTABLE state, and that state is precisely the one the pipeline used to
111
+ * answer with a CLEAN verdict. Derived, the state cannot exist: the switch is on only when something
112
+ * can actually run. The runtime refusal in `executeScan` stays regardless, because `scanPolicy:
113
+ * 'required'` reaches the same tail without consulting this switch at all.
114
+ *
115
+ * The two predicates are the pipeline's OWN — `executeScan` gates its two layers on exactly
116
+ * `clamavScanner.isConfigured()` and `yaraScanner.isEnabled()` — so the switch and the pipeline cannot
117
+ * come to different conclusions about whether a scan is possible. Note `isEnabled()` is already the
118
+ * conjunction of YARA's two independent axes (opted in AND reachable), which is why the "enabled but
119
+ * unreachable" misconfiguration does not read as an application-wide opt-in here; the startup validator
120
+ * reports it as its own issue instead.
121
+ *
122
+ * The `isInitialized()` guard stays: both scanner reads deliberately throw
123
+ * `app_configuration_not_initialized` rather than softening to `false`, and a scan decision taken before
124
+ * configuration has landed is not a decision.
55
125
  */
56
126
  isGlobalScanningEnabled(): boolean;
57
127
  /**
@@ -88,6 +158,21 @@ export declare class FileScanningBackendService {
88
158
  * - ERROR: transition to FAILED (retryable via re-scan)
89
159
  */
90
160
  handleScanResult(fileId: string, result: FileScanResult, executionContext: ExecutionContext<any>): Promise<void>;
161
+ /**
162
+ * Write the scan outcome to the audit trail (#506).
163
+ *
164
+ * Best-effort and never throwing: the file's status transition is the enforcement, and an audit
165
+ * store being unavailable must not convert a successful quarantine into an exception that leaves
166
+ * the caller believing the scan failed.
167
+ *
168
+ * A CLEAN verdict is deliberately NOT audited. Every upload is scanned, so a clean row per upload
169
+ * would be the highest-volume event in the trail and would bury the two that matter — and the
170
+ * upload itself is already recorded by `FILE_UPLOAD_GRANT_REDEEMED`. What is added here is the
171
+ * conclusion an operator would want to be alerted on.
172
+ */
173
+ private recordScanOutcomeAudit;
174
+ /** The status the FILES row actually carries after the transition, or `unknown` if it cannot be read. */
175
+ private resolveRecordedFileStatus;
91
176
  /**
92
177
  * Quarantine an infected file.
93
178
  *
@@ -1 +1 @@
1
- {"version":3,"file":"file-scanning.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/files/services/file-scanning.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAE9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AACvG,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,EAEL,KAAK,cAAc,EACpB,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,EAAE,+BAA+B,EAAE,MAAM,sEAAsE,CAAC;AACvH,OAAO,EACL,eAAe,EACf,KAAK,cAAc,GACpB,MAAM,mDAAmD,CAAC;AAM3D,qBACa,0BAA0B;IAOnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAEvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAE7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAEjC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAE9B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAE5B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAlBpC,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,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;IAKrE;;;;;;OAMG;IACH,UAAU,CAAC,YAAY,CAAC,EAAE,kBAAkB,GAAG,OAAO;IAStD;;OAEG;IACH,uBAAuB,IAAI,OAAO;IAMlC;;;;;;;;;;;;;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;IA0HzB;;;;;;OAMG;IACG,gBAAgB,CACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,cAAc,EACtB,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,GACtC,OAAO,CAAC,IAAI,CAAC;IAmEhB;;;;;;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,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