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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1056) hide show
  1. package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +1 -1
  2. package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +1 -1
  3. package/dist/esm/__tests__/setup.d.ts.map +1 -1
  4. package/dist/esm/__tests__/test-container.d.ts.map +1 -1
  5. package/dist/esm/applications/models/applications.backend.schemas.d.ts.map +1 -1
  6. package/dist/esm/applications/seeds/application-metadata-defaults.seeds.d.ts.map +1 -1
  7. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  8. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  9. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  10. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  11. package/dist/esm/base-classes/models/repositories.backend.schemas.d.ts.map +1 -1
  12. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +1 -1
  13. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +1 -1
  14. package/dist/esm/base-classes/services/batches/batches-cronjobs-custom-execution.service.d.ts.map +1 -1
  15. package/dist/esm/base-classes/services/batches/batches-cronjobs-executor.backend.service.d.ts.map +1 -1
  16. package/dist/esm/base-classes/services/batches/batches-cronjobs-resource-execution.backend.service.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -1
  19. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -1
  20. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +12 -1
  21. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -1
  22. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  23. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  24. package/dist/esm/base-classes/services/batches/resource-retention-sweep.batch.backend.service.d.ts.map +1 -1
  25. package/dist/esm/base-classes/services/batches/suspension-reactivation-sweep.batch.backend.service.d.ts.map +1 -1
  26. package/dist/esm/base-classes/services/controllers/abstract-controller.backend.service.d.ts.map +1 -1
  27. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  28. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  29. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  30. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  31. package/dist/esm/base-classes/services/controllers/utils/audit-access-fields.backend.utils.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/controllers/utils/operation-response-serializer.backend.utils.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/controllers/validate-field-handler.backend.service.d.ts.map +1 -1
  34. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +1 -1
  35. package/dist/esm/base-classes/services/repositories/__tests__/mock-repositories-registry-handler.service.d.ts.map +1 -1
  36. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-filter-translation.backend.d.ts.map +1 -1
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +13 -4
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-query.backend.d.ts.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +17 -0
  44. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  46. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  47. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -1
  48. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/http-api/http-api-row-projection.backend.d.ts.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/http-api/http-api-subject-erasure-effect.backend.d.ts.map +1 -1
  51. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  54. package/dist/esm/base-classes/services/repositories/http-api/odoo-jsonrpc-compiler.backend.d.ts.map +1 -1
  55. package/dist/esm/base-classes/services/repositories/http-api/rest-json-query-compiler.backend.d.ts.map +1 -1
  56. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  58. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  59. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  60. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +57 -0
  61. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  62. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +95 -2
  63. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  64. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  65. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  66. package/dist/esm/base-classes/services/repositories/repository-guarded-mutation.backend.types.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +5 -2
  68. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  69. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +14 -3
  70. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  71. package/dist/esm/base-classes/services/repositories/repository-version-metadata.backend.utils.d.ts.map +1 -1
  72. package/dist/esm/base-classes/services/repositories/resource-write-integrity.backend.d.ts.map +1 -1
  73. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts +72 -0
  74. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts.map +1 -0
  75. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js +88 -0
  76. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js.map +1 -0
  77. package/dist/esm/base-classes/services/repositories/unique-constraint-conflict-reference.backend.d.ts.map +1 -1
  78. package/dist/esm/base-classes/services/resource-operations-helper.backend.service.d.ts.map +1 -1
  79. package/dist/esm/base-classes/services/services/__tests__/mock-services-registry-handler.service.d.ts.map +1 -1
  80. package/dist/esm/base-classes/services/services/__tests__/mock-system-access.service.d.ts.map +1 -1
  81. package/dist/esm/base-classes/services/services/read-only-field-change.backend.utils.d.ts.map +1 -1
  82. package/dist/esm/base-classes/services/services/resource-operation-audit-emission.backend.utils.d.ts.map +1 -1
  83. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  84. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  85. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts.map +1 -1
  86. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts.map +1 -1
  87. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  88. package/dist/esm/base-classes/services/services/resource-operation-server-injected-fields.backend.utils.d.ts.map +1 -1
  89. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts.map +1 -1
  90. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  91. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  92. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  93. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  94. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  95. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +44 -6
  96. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  97. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  98. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  99. package/dist/esm/base-classes/utils/backend-type-utils.d.ts.map +1 -1
  100. package/dist/esm/base-classes/utils/single-subject-addressing.backend.utils.d.ts.map +1 -1
  101. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -1
  102. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -1
  103. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -1
  104. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -1
  105. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -1
  106. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -1
  107. package/dist/esm/billing/services/back-office/abstract-billing.backend.service.d.ts.map +1 -1
  108. package/dist/esm/billing/services/back-office/billing-feature-sync.backend.service.d.ts.map +1 -1
  109. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +1 -1
  110. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -1
  111. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +5 -4
  112. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -1
  113. package/dist/esm/billing/services/back-office/billing-state.backend.service.d.ts.map +1 -1
  114. package/dist/esm/billing/services/back-office/billing-state.backend.service.js +11 -1
  115. package/dist/esm/billing/services/back-office/billing-state.backend.service.js.map +1 -1
  116. package/dist/esm/billing/services/back-office/billing-subject-erasure-effect.backend.d.ts.map +1 -1
  117. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  118. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  119. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  120. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  121. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -1
  122. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -1
  123. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  124. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  125. package/dist/esm/billing/services/billing.utils.d.ts.map +1 -1
  126. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  127. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  128. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +32 -0
  129. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  130. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +32 -1
  131. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  132. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  133. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  134. package/dist/esm/billing/services/custom-impl/credit-pool.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  135. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  136. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  137. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  138. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  139. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +9 -6
  140. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  141. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +9 -6
  142. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  143. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -1
  144. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -1
  145. package/dist/esm/billing/services/webhooks/billing-webhook-adapter.backend.service.d.ts.map +1 -1
  146. package/dist/esm/billing/services/webhooks/billing-webhook-capability-handler.backend.service.d.ts.map +1 -1
  147. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  148. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +50 -3
  149. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  150. package/dist/esm/billing/testing/billing-test-fixtures.d.ts.map +1 -1
  151. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  152. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  153. package/dist/esm/charts/controllers/chart.backend.controller.d.ts.map +1 -1
  154. package/dist/esm/charts/services/chart-registry.backend.service.d.ts +80 -7
  155. package/dist/esm/charts/services/chart-registry.backend.service.d.ts.map +1 -1
  156. package/dist/esm/charts/services/chart-registry.backend.service.js +115 -8
  157. package/dist/esm/charts/services/chart-registry.backend.service.js.map +1 -1
  158. package/dist/esm/companion-exports.d.ts.map +1 -1
  159. package/dist/esm/compliance/audit-trails/audit-logs.custom-impl.backend.service.d.ts.map +1 -1
  160. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.d.ts.map +1 -1
  161. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  162. package/dist/esm/compliance/audit-trails/batches/immudb-audit-reconcile.batch.backend.service.d.ts.map +1 -1
  163. package/dist/esm/compliance/audit-trails/batches/siem-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  164. package/dist/esm/compliance/audit-trails/services/__tests__/mock-audit-logs.service.d.ts.map +1 -1
  165. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  166. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  167. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +107 -4
  168. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  169. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +176 -5
  170. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  171. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  172. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  173. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  174. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  175. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  176. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  177. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -1
  178. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -1
  179. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  180. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +21 -0
  181. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  182. package/dist/esm/compliance/audit-trails/services/utils/ocsf-class-mapping.backend.utils.d.ts.map +1 -1
  183. package/dist/esm/compliance/audit-trails/services/utils/siem-dictionary.backend.utils.d.ts.map +1 -1
  184. package/dist/esm/compliance/audit-trails/services/utils/siem-ocsf-projection.backend.utils.d.ts.map +1 -1
  185. package/dist/esm/compliance/audit-trails/services/utils/siem-projection-contract.backend.utils.d.ts.map +1 -1
  186. package/dist/esm/compliance/audit-trails/utils/audit-actor.backend.utils.d.ts.map +1 -1
  187. package/dist/esm/compliance/audit-trails/utils/layer2-audit-provider-boot-diagnostic.backend.utils.d.ts.map +1 -1
  188. package/dist/esm/compliance/index.d.ts.map +1 -1
  189. package/dist/esm/compliance/privacy/retention-hide-predicate.backend.d.ts.map +1 -1
  190. package/dist/esm/compliance/privacy/services/subject-erasure-external-effects.backend.service.d.ts.map +1 -1
  191. package/dist/esm/compliance/privacy/services/subject-session-revocation.backend.service.d.ts.map +1 -1
  192. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  193. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  194. package/dist/esm/config/bootstrap/minion-initialization-projection.backend.d.ts.map +1 -1
  195. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.d.ts.map +1 -1
  196. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js +3 -0
  197. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js.map +1 -1
  198. package/dist/esm/config/bootstrap/runtime-principal.backend.service.d.ts.map +1 -1
  199. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  200. package/dist/esm/config/models/app-config-secrets.backend.schemas.d.ts.map +1 -1
  201. package/dist/esm/config/models/app-config.backend-authored.definitions.d.ts.map +1 -1
  202. package/dist/esm/config/models/app-config.backend.schemas.d.ts +4 -4
  203. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  204. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  205. package/dist/esm/config/models/app-env-config.backend.schemas.d.ts.map +1 -1
  206. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts +36 -0
  207. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts.map +1 -0
  208. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js +36 -0
  209. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js.map +1 -0
  210. package/dist/esm/config/models/config-mutation-boundary.utils.d.ts.map +1 -1
  211. package/dist/esm/config/models/postgresql-env-config.backend.schemas.d.ts.map +1 -1
  212. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  213. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  214. package/dist/esm/config/models/runtime-topology.backend.contracts.d.ts.map +1 -1
  215. package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +1 -1
  216. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  217. package/dist/esm/config/services/app-configuration-loader.backend.service.js +3 -0
  218. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  219. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  220. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  221. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  222. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  223. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +12 -0
  224. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  225. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +28 -0
  226. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  227. package/dist/esm/data-seeding/batches/data-seeding-run-cleanup.batch.backend.service.d.ts.map +1 -1
  228. package/dist/esm/data-seeding/batches/data-seeding-scheduled-rerun.batch.backend.service.d.ts.map +1 -1
  229. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.contracts.d.ts.map +1 -1
  230. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.controller.d.ts.map +1 -1
  231. package/dist/esm/data-seeding/data-seeding-models.d.ts.map +1 -1
  232. package/dist/esm/data-seeding/models/business-key-resolver.shared.utils.d.ts.map +1 -1
  233. package/dist/esm/data-seeding/models/data-seed-execution-context.shared.types.d.ts.map +1 -1
  234. package/dist/esm/data-seeding/models/data-seed-migrator-runner.shared.utils.d.ts.map +1 -1
  235. package/dist/esm/data-seeding/models/data-seed-reconciler.shared.utils.d.ts.map +1 -1
  236. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.schemas.d.ts.map +1 -1
  237. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.utils.d.ts.map +1 -1
  238. package/dist/esm/data-seeding/models/data-seed-run.shared.resources-config.schemas.d.ts.map +1 -1
  239. package/dist/esm/data-seeding/models/data-seed-run.shared.schemas.d.ts.map +1 -1
  240. package/dist/esm/data-seeding/models/data-seed-trigger-mode-matrix.shared.utils.d.ts.map +1 -1
  241. package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
  242. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
  243. package/dist/esm/data-seeding/services/data-seed-dispatcher.backend.service.d.ts.map +1 -1
  244. package/dist/esm/data-seeding/services/data-seed-registry.backend.service.d.ts.map +1 -1
  245. package/dist/esm/data-seeding/services/data-seed-scope-resolver-registry.backend.service.d.ts.map +1 -1
  246. package/dist/esm/data-seeding/services/engines/additive-seed-engine.backend.service.d.ts.map +1 -1
  247. package/dist/esm/data-seeding/services/engines/lazy-seed-engine.backend.service.d.ts.map +1 -1
  248. package/dist/esm/data-seeding/services/engines/manual-seed-engine.backend.service.d.ts.map +1 -1
  249. package/dist/esm/data-seeding/services/engines/sync-seed-engine.backend.service.d.ts.map +1 -1
  250. package/dist/esm/data-seeding/services/engines/upgrade-seed-engine.backend.service.d.ts.map +1 -1
  251. package/dist/esm/data-seeding/services/shared/data-seed-business-key.shared.utils.d.ts.map +1 -1
  252. package/dist/esm/data-seeding/services/shared/data-seed-error.shared.utils.d.ts.map +1 -1
  253. package/dist/esm/data-seeding/services/shared/data-seed-run-counters.shared.types.d.ts.map +1 -1
  254. package/dist/esm/data-seeding/services/shared/data-seed-run-ledger.backend.d.ts.map +1 -1
  255. package/dist/esm/data-seeding/services/shared/data-seed-scope-anchor.shared.types.d.ts.map +1 -1
  256. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts.map +1 -1
  257. package/dist/esm/data-seeding/services/shared/data-seed-scope-resolution.backend.d.ts.map +1 -1
  258. package/dist/esm/databases/models/aggregation.backend.schemas.d.ts.map +1 -1
  259. package/dist/esm/databases/models/databases.backend.schemas.d.ts.map +1 -1
  260. package/dist/esm/databases/models/filter.backend.schemas.d.ts.map +1 -1
  261. package/dist/esm/databases/models/resolve-persistence-adapter.backend.utils.d.ts.map +1 -1
  262. package/dist/esm/databases/models/sql.backend.schemas.d.ts.map +1 -1
  263. package/dist/esm/databases/models/transaction.shared.schemas.d.ts.map +1 -1
  264. package/dist/esm/databases/services/__tests__/mock-mongo-transaction-registry.service.d.ts.map +1 -1
  265. package/dist/esm/databases/services/__tests__/mock-mongodb.service.d.ts.map +1 -1
  266. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +1 -1
  267. package/dist/esm/databases/services/__tests__/mock-redis.service.d.ts.map +1 -1
  268. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +1 -1
  269. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  270. package/dist/esm/databases/services/aggregation/aggregation-query.backend.service.d.ts.map +1 -1
  271. package/dist/esm/databases/services/aggregation/computed-measure-evaluator.backend.service.d.ts.map +1 -1
  272. package/dist/esm/databases/services/aggregation/field-access-validator.backend.service.d.ts.map +1 -1
  273. package/dist/esm/databases/services/aggregation/time-series-densifier.backend.service.d.ts.map +1 -1
  274. package/dist/esm/databases/services/aggregation/topn-processor.backend.service.d.ts.map +1 -1
  275. package/dist/esm/databases/services/aggregation/window-function-processor.backend.service.d.ts.map +1 -1
  276. package/dist/esm/databases/services/db-utils.d.ts.map +1 -1
  277. package/dist/esm/databases/services/mongo-aggregation.backend.service.d.ts.map +1 -1
  278. package/dist/esm/databases/services/mongodb.service.d.ts.map +1 -1
  279. package/dist/esm/databases/services/postgresql-aggregation.backend.service.d.ts.map +1 -1
  280. package/dist/esm/databases/services/postgresql-database.backend.service.d.ts.map +1 -1
  281. package/dist/esm/databases/services/postgresql-development-provisioning.backend.d.ts.map +1 -1
  282. package/dist/esm/databases/services/postgresql-filter.backend.service.d.ts.map +1 -1
  283. package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
  284. package/dist/esm/databases/services/postgresql-schema-ddl.backend.d.ts.map +1 -1
  285. package/dist/esm/databases/services/postgresql-schema-migration-sql.backend.d.ts.map +1 -1
  286. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  287. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  288. package/dist/esm/databases/services/postgresql-schema-plan-lockfile.backend.d.ts.map +1 -1
  289. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  290. package/dist/esm/databases/services/resource-persistence-unit-of-work.backend.service.d.ts.map +1 -1
  291. package/dist/esm/databases/services/schema-planning-standalone.backend.d.ts.map +1 -1
  292. package/dist/esm/databases/services/zod-to-mongoose-schema-convertor.backend.service.d.ts.map +1 -1
  293. package/dist/esm/databases/services/zod-to-sql-hybrid-schema.planner.d.ts.map +1 -1
  294. package/dist/esm/databases/utils/postgresql-identifier.backend.utils.d.ts.map +1 -1
  295. package/dist/esm/errors/services/__tests__/mock-error-builder.service.d.ts.map +1 -1
  296. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  297. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  298. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  299. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  300. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  301. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  302. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  303. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  304. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  305. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  306. package/dist/esm/external-data/batches/external-data-pipeline-scheduled-run.batch.backend.service.d.ts.map +1 -1
  307. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -1
  308. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -1
  309. package/dist/esm/external-data/external-data-extraction-source.backend.d.ts.map +1 -1
  310. package/dist/esm/external-data/external-data-models.exports.d.ts.map +1 -1
  311. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  312. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  313. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  314. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  315. package/dist/esm/external-providers/models/external-providers.backend.schemas.d.ts.map +1 -1
  316. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  317. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  318. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +102 -52
  319. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -1
  320. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +117 -71
  321. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -1
  322. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -1
  323. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -1
  324. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -1
  325. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +26 -7
  326. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -1
  327. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -1
  328. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -1
  329. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  330. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  331. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -1
  332. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -1
  333. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  334. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  335. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts +81 -34
  336. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  337. package/dist/esm/external-providers/services/document-extraction.backend.service.js +179 -98
  338. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  339. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  340. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  341. package/dist/esm/external-providers/services/external-api-handler.backend.service.d.ts.map +1 -1
  342. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +121 -0
  343. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  344. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +151 -0
  345. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  346. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts +15 -1
  347. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  348. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +60 -4
  349. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  350. package/dist/esm/features/controllers/features.backend.controller.d.ts.map +1 -1
  351. package/dist/esm/features/services/__tests__/mock-feature-definition-registry.service.d.ts.map +1 -1
  352. package/dist/esm/features/services/__tests__/mock-feature-resolution.service.d.ts.map +1 -1
  353. package/dist/esm/features/services/application-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  354. package/dist/esm/features/services/feature-definition-registry.backend.service.d.ts.map +1 -1
  355. package/dist/esm/features/services/feature-gate.backend.service.d.ts.map +1 -1
  356. package/dist/esm/features/services/feature-resolution.backend.service.d.ts.map +1 -1
  357. package/dist/esm/features/services/organization-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  358. package/dist/esm/features/services/scope-feature-ledger-relationship.backend.utils.d.ts.map +1 -1
  359. package/dist/esm/features/services/scope-features-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  360. package/dist/esm/features/testing/feature-test-utils.d.ts.map +1 -1
  361. package/dist/esm/files/batches/files-cleanup.batch.backend.service.d.ts.map +1 -1
  362. package/dist/esm/files/constraints/file-analyzers.types.d.ts.map +1 -1
  363. package/dist/esm/files/constraints/file-constraint-resolver-chain.backend.service.d.ts.map +1 -1
  364. package/dist/esm/files/constraints/file-constraint.types.d.ts.map +1 -1
  365. package/dist/esm/files/constraints/file-validation.backend.service.d.ts.map +1 -1
  366. package/dist/esm/files/constraints/resource-field-constraint-resolver.backend.service.d.ts.map +1 -1
  367. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  368. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  369. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -1
  370. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -1
  371. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +37 -0
  372. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  373. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +221 -21
  374. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  375. package/dist/esm/files/scanning/clamav-scanner.backend.service.d.ts.map +1 -1
  376. package/dist/esm/files/scanning/file-scan.types.d.ts.map +1 -1
  377. package/dist/esm/files/scanning/yara-scanner.backend.service.d.ts.map +1 -1
  378. package/dist/esm/files/scanning/yara-scanner.backend.service.js +20 -2
  379. package/dist/esm/files/scanning/yara-scanner.backend.service.js.map +1 -1
  380. package/dist/esm/files/services/__tests__/mock-file-field-detection.service.d.ts.map +1 -1
  381. package/dist/esm/files/services/__tests__/mock-file-operation-handler.service.d.ts.map +1 -1
  382. package/dist/esm/files/services/__tests__/mock-file-repository.service.d.ts.map +1 -1
  383. package/dist/esm/files/services/file-field-detection.backend.service.d.ts.map +1 -1
  384. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  385. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  386. package/dist/esm/files/services/file-population.backend.service.d.ts.map +1 -1
  387. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  388. package/dist/esm/files/services/file-scanning.backend.service.js +5 -0
  389. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  390. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  391. package/dist/esm/files/services/file-text-extraction.backend.service.js +8 -5
  392. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  393. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  394. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  395. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  396. package/dist/esm/files/services/files.backend.service.js +3 -1
  397. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  398. package/dist/esm/files/services/rag-source-field-detection.backend.service.d.ts.map +1 -1
  399. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -1
  400. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -1
  401. package/dist/esm/files/storage/file-storage-path-resolver.backend.service.d.ts.map +1 -1
  402. package/dist/esm/files/storage/file-storage-provider.types.d.ts +36 -1
  403. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  404. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  405. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts +21 -3
  406. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts.map +1 -1
  407. package/dist/esm/files/storage/file-storage-router.backend.service.js +38 -5
  408. package/dist/esm/files/storage/file-storage-router.backend.service.js.map +1 -1
  409. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts +87 -0
  410. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts.map +1 -0
  411. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js +340 -0
  412. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js.map +1 -0
  413. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  414. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  415. package/dist/esm/files/storage/storage-credential-provider.backend.utils.d.ts.map +1 -1
  416. package/dist/esm/files/storage/storage-platform-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  417. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  418. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js +10 -3
  419. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js.map +1 -1
  420. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  421. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  422. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  423. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  424. package/dist/esm/files/utils/file-upload.utils.d.ts.map +1 -1
  425. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  426. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  427. package/dist/esm/files/utils/file-validation.utils.d.ts.map +1 -1
  428. package/dist/esm/files/utils/image-derivation.backend.utils.d.ts.map +1 -1
  429. package/dist/esm/files/utils/image-thumbnail.backend.utils.d.ts.map +1 -1
  430. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -1
  431. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -1
  432. package/dist/esm/files/utils/rag-source-field-schema-path.backend.utils.d.ts.map +1 -1
  433. package/dist/esm/files/utils/storage-application-identity.backend.utils.d.ts.map +1 -1
  434. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  435. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  436. package/dist/esm/flows-actors/a2a/batches/a2a-push-delivery.batch.backend.service.d.ts.map +1 -1
  437. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  438. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  439. package/dist/esm/flows-actors/a2a/models/a2a-dialect.backend.schemas.d.ts.map +1 -1
  440. package/dist/esm/flows-actors/a2a/models/a2a-push-notification-delivery.backend.utils.d.ts.map +1 -1
  441. package/dist/esm/flows-actors/a2a/models/a2a-push-notification.backend.schemas.d.ts.map +1 -1
  442. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  443. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  444. package/dist/esm/flows-actors/a2a/services/a2a-push-delivery-log.repository.d.ts.map +1 -1
  445. package/dist/esm/flows-actors/a2a/services/a2a-push-dispatcher.backend.service.d.ts.map +1 -1
  446. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  447. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  448. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  449. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  450. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  451. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  452. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  453. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  454. package/dist/esm/flows-actors/controllers/flows-actors.controller.d.ts.map +1 -1
  455. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  456. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  457. package/dist/esm/flows-actors/models/agent-facets.backend.definitions.d.ts.map +1 -1
  458. package/dist/esm/flows-actors/models/agents.backend.definitions.d.ts.map +1 -1
  459. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  460. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  461. package/dist/esm/flows-actors/models/flows-actors.backend.definitions.d.ts.map +1 -1
  462. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  463. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  464. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +107 -16
  465. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  466. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +118 -18
  467. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  468. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  469. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  470. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -1
  471. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -1
  472. package/dist/esm/flows-actors/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +1 -1
  473. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  474. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  475. package/dist/esm/flows-actors/services/agent-call-trace-sink.backend.d.ts.map +1 -1
  476. package/dist/esm/flows-actors/services/agent-facets.backend.service.d.ts.map +1 -1
  477. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +104 -5
  478. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  479. package/dist/esm/flows-actors/services/agents.backend.service.js +263 -31
  480. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  481. package/dist/esm/flows-actors/services/context-curation.backend.service.d.ts.map +1 -1
  482. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +46 -1
  483. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  484. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +193 -6
  485. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  486. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  487. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  488. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  489. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  490. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  491. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  492. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -1
  493. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +3 -0
  494. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -1
  495. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts +99 -0
  496. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts.map +1 -0
  497. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js +155 -0
  498. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js.map +1 -0
  499. package/dist/esm/flows-actors/services/meta-workflow-evaluation-treatment-compiler.backend.service.d.ts.map +1 -1
  500. package/dist/esm/flows-actors/services/meta-workflow-standard-action-contracts.backend.service.d.ts.map +1 -1
  501. package/dist/esm/flows-actors/services/meta-workflow-standard-evaluation-contracts.backend.service.d.ts.map +1 -1
  502. package/dist/esm/flows-actors/services/meta-workflow-structured-artifact-action-compiler.backend.service.d.ts.map +1 -1
  503. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  504. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  505. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  506. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +9 -0
  507. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  508. package/dist/esm/flows-actors/utils/bounded-subprocess.backend.utils.d.ts.map +1 -1
  509. package/dist/esm/flows-actors/utils/flows-actors-frontend-extractor.utils.d.ts.map +1 -1
  510. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  511. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  512. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  513. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  514. package/dist/esm/flows-actors/utils/prompt-ir-adapters.backend.utils.d.ts.map +1 -1
  515. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts +77 -0
  516. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts.map +1 -0
  517. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js +164 -0
  518. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js.map +1 -0
  519. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts +48 -0
  520. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts.map +1 -0
  521. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js +101 -0
  522. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js.map +1 -0
  523. package/dist/esm/guidance/batches/dormancy-detection.batch.backend.service.d.ts.map +1 -1
  524. package/dist/esm/guidance/services/guidance-trigger-evaluator.backend.service.d.ts.map +1 -1
  525. package/dist/esm/guidance/services/lifecycle-custom-implementations.backend.d.ts.map +1 -1
  526. package/dist/esm/guidance/services/lifecycle-evaluator.backend.service.d.ts.map +1 -1
  527. package/dist/esm/guidance/services/lifecycle-scope-id.backend.utils.d.ts.map +1 -1
  528. package/dist/esm/guidance/services/milestone-condition-registry.backend.service.d.ts.map +1 -1
  529. package/dist/esm/guidance/services/milestone-definition-registry.backend.service.d.ts.map +1 -1
  530. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  531. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  532. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -1
  533. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -1
  534. package/dist/esm/guidance/services/scoped-state-read-custom-implementations.backend.d.ts.map +1 -1
  535. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  536. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  537. package/dist/esm/i18n/services/i18n.backend.service.d.ts.map +1 -1
  538. package/dist/esm/index.d.ts +0 -1
  539. package/dist/esm/index.d.ts.map +1 -1
  540. package/dist/esm/index.js +0 -1
  541. package/dist/esm/index.js.map +1 -1
  542. package/dist/esm/inject/models/container.d.ts +10 -0
  543. package/dist/esm/inject/models/container.d.ts.map +1 -1
  544. package/dist/esm/inject/models/container.js +49 -1
  545. package/dist/esm/inject/models/container.js.map +1 -1
  546. package/dist/esm/inject/models/service-types.d.ts +3 -0
  547. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  548. package/dist/esm/inject/models/service-types.js +3 -0
  549. package/dist/esm/inject/models/service-types.js.map +1 -1
  550. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  551. package/dist/esm/mcp/controllers/mcp.controller.js +50 -3
  552. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  553. package/dist/esm/mcp/models/mcp-protocol.backend.schemas.d.ts.map +1 -1
  554. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  555. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  556. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  557. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  558. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  559. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  560. package/dist/esm/mcp/services/resource-server-instances-registry.backend.service.d.ts.map +1 -1
  561. package/dist/esm/mcp/utils/zod-to-mcp-json-schema.backend.utils.d.ts.map +1 -1
  562. package/dist/esm/meta-workflow-runtime.exports.d.ts.map +1 -1
  563. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  564. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  565. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -1
  566. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -1
  567. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  568. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  569. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  570. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  571. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  572. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  573. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +1 -1
  574. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  575. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  576. package/dist/esm/monitoring/logger/services/logger.service.js +3 -3
  577. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  578. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -1
  579. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -1
  580. package/dist/esm/monitoring/logger/utils/log-value-normalization.backend.utils.d.ts.map +1 -1
  581. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +10 -6
  582. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -1
  583. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +10 -6
  584. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -1
  585. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  586. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  587. package/dist/esm/monitoring/observability/otel-preload.d.ts.map +1 -1
  588. package/dist/esm/monitoring/observability/otel-sdk-global-handle.d.ts.map +1 -1
  589. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +1 -1
  590. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  591. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  592. package/dist/esm/monitoring/observability/services/observability.backend.service.d.ts.map +1 -1
  593. package/dist/esm/notifications/email/components/email-components.d.ts.map +1 -1
  594. package/dist/esm/notifications/email/models/email-template-definition.d.ts.map +1 -1
  595. package/dist/esm/notifications/email/models/email-transport.backend.definitions.d.ts.map +1 -1
  596. package/dist/esm/notifications/email/services/email-batch-send.batch.backend.service.d.ts.map +1 -1
  597. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  598. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  599. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  600. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  601. package/dist/esm/notifications/email/services/email.backend.service.d.ts +47 -6
  602. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  603. package/dist/esm/notifications/email/services/email.backend.service.js +86 -36
  604. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  605. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  606. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  607. package/dist/esm/notifications/email/utils/interpolate-email-label.utils.d.ts.map +1 -1
  608. package/dist/esm/notifications/email/utils/zod-to-typescript.utils.d.ts.map +1 -1
  609. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  610. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  611. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  612. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  613. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts +32 -0
  614. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts.map +1 -0
  615. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js +32 -0
  616. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js.map +1 -0
  617. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +64 -10
  618. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  619. package/dist/esm/notifications/sms/services/sms.backend.service.js +277 -82
  620. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  621. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  622. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  623. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  624. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  625. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  626. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  627. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  628. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.d.ts.map +1 -1
  629. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.repository.d.ts.map +1 -1
  630. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-dispatcher.backend.service.d.ts.map +1 -1
  631. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service.d.ts.map +1 -1
  632. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  633. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  634. package/dist/esm/notifications/webhooks/outbound/services/webhook-config.backend.service.d.ts.map +1 -1
  635. package/dist/esm/notifications/webhooks/services/polymorphic-lookup.backend.service.d.ts.map +1 -1
  636. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  637. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  638. package/dist/esm/organizations/batches/organization-member-invitation-sweep.batch.backend.service.d.ts.map +1 -1
  639. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts.map +1 -1
  640. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  641. package/dist/esm/organizations/services/authority-change-audit.backend.utils.d.ts.map +1 -1
  642. package/dist/esm/organizations/services/invitation-acceptance.backend.utils.d.ts.map +1 -1
  643. package/dist/esm/organizations/services/org-creation-on-registration.backend.utils.d.ts.map +1 -1
  644. package/dist/esm/organizations/services/org-member-roles-validation.backend.utils.d.ts.map +1 -1
  645. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  646. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  647. package/dist/esm/organizations/services/organization-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  648. package/dist/esm/organizations/services/organization-member-custom-implementation.backend.service.d.ts.map +1 -1
  649. package/dist/esm/organizations/services/organization-onboarding-operation.backend.utils.d.ts.map +1 -1
  650. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  651. package/dist/esm/organizations/services/organization-unit-member-custom-implementation.backend.service.d.ts.map +1 -1
  652. package/dist/esm/organizations/services/scim-provisioning-gate.backend.utils.d.ts.map +1 -1
  653. package/dist/esm/organizations/services/user-org-type-grant.backend.utils.d.ts.map +1 -1
  654. package/dist/esm/organizations/services/user-type-revocation-on-org-leave.backend.utils.d.ts.map +1 -1
  655. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +1 -1
  656. package/dist/esm/pdf-templates/models/pdf-template-binding.d.ts.map +1 -1
  657. package/dist/esm/pdf-templates/models/pdf-template-definition.d.ts.map +1 -1
  658. package/dist/esm/pdf-templates/services/pdf-generated-file-writer.backend.service.d.ts.map +1 -1
  659. package/dist/esm/pdf-templates/services/pdf-generation-orchestrator.backend.service.d.ts.map +1 -1
  660. package/dist/esm/pdf-templates/services/pdf-renderer.backend.service.d.ts.map +1 -1
  661. package/dist/esm/pdf-templates/services/pdf-template-binding.backend.service.d.ts.map +1 -1
  662. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -1
  663. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -1
  664. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -1
  665. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -1
  666. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -1
  667. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -1
  668. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -1
  669. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -1
  670. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  671. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  672. package/dist/esm/queue/apps-crontabs-manager.backend.service.d.ts.map +1 -1
  673. package/dist/esm/queue/cron-job-sync.backend.service.d.ts.map +1 -1
  674. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  675. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  676. package/dist/esm/queue/job-completion-registry.backend.service.d.ts.map +1 -1
  677. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  678. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  679. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  680. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  681. package/dist/esm/queue/job-payload-storage.backend.service.d.ts.map +1 -1
  682. package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
  683. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  684. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  685. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  686. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  687. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  688. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  689. package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
  690. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  691. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  692. package/dist/esm/rag/batches/rag-embedding-drain.batch.backend.service.d.ts.map +1 -1
  693. package/dist/esm/rag/batches/rag-reconciliation-sweep.batch.backend.service.d.ts.map +1 -1
  694. package/dist/esm/rag/models/rag-chunk-store.backend.types.d.ts.map +1 -1
  695. package/dist/esm/rag/models/rag-retrieval.backend.types.d.ts.map +1 -1
  696. package/dist/esm/rag/services/mongodb-rag-chunk-store.backend.service.d.ts.map +1 -1
  697. package/dist/esm/rag/services/postgresql-rag-chunk-store.backend.service.d.ts.map +1 -1
  698. package/dist/esm/rag/services/rag-chunk-collection.mongodb-ddl.backend.d.ts.map +1 -1
  699. package/dist/esm/rag/services/rag-chunk-retrieval.mongodb-query.backend.d.ts.map +1 -1
  700. package/dist/esm/rag/services/rag-chunk-retrieval.postgresql-query.backend.d.ts.map +1 -1
  701. package/dist/esm/rag/services/rag-chunk-store.backend.service.d.ts.map +1 -1
  702. package/dist/esm/rag/services/rag-chunk-table.postgresql-ddl.backend.d.ts.map +1 -1
  703. package/dist/esm/rag/services/rag-ingestion.backend.service.d.ts.map +1 -1
  704. package/dist/esm/rag/services/rag-retrieval.backend.service.d.ts.map +1 -1
  705. package/dist/esm/rag/utils/rag-chunk-fusion.backend.utils.d.ts.map +1 -1
  706. package/dist/esm/rag/utils/rag-chunk-removal.backend.utils.d.ts.map +1 -1
  707. package/dist/esm/rag/utils/rag-chunk-row-shaping.backend.utils.d.ts.map +1 -1
  708. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  709. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  710. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  711. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  712. package/dist/esm/rag/utils/rag-ingestion-trigger.backend.utils.d.ts.map +1 -1
  713. package/dist/esm/rag/utils/rag-retrieval-scope.backend.utils.d.ts.map +1 -1
  714. package/dist/esm/rag/utils/rag-source-field-value.backend.utils.d.ts.map +1 -1
  715. package/dist/esm/requests/models/api-routes.backend.defintions.d.ts.map +1 -1
  716. package/dist/esm/requests/models/requests.backend.schemas.d.ts.map +1 -1
  717. package/dist/esm/requests/service/platform-mutualized-handler.backend.service.d.ts.map +1 -1
  718. package/dist/esm/requests/service/platform-requests.backend.utils.d.ts.map +1 -1
  719. package/dist/esm/requests/service/remote-client-base.backend.service.d.ts.map +1 -1
  720. package/dist/esm/requests/service/serverless-services-handler.backend.service.d.ts.map +1 -1
  721. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  722. package/dist/esm/requests/service/websocket.service.js +49 -1
  723. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  724. package/dist/esm/resources/backend-resource-registry.exports.d.ts.map +1 -1
  725. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  726. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +2 -0
  727. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  728. package/dist/esm/resources/models/index.d.ts.map +1 -1
  729. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  730. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  731. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  732. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  733. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  734. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  735. package/dist/esm/resources/models/resources.backend.schemas.d.ts.map +1 -1
  736. package/dist/esm/resources/models/virtual-fields.backend.types.d.ts.map +1 -1
  737. package/dist/esm/resources/services/__tests__/mock-resources-registry.service.d.ts.map +1 -1
  738. package/dist/esm/resources/services/resource-context.backend.service.d.ts.map +1 -1
  739. package/dist/esm/resources/services/resource-id.backend.service.d.ts.map +1 -1
  740. package/dist/esm/resources/services/resource-population.backend.service.d.ts +17 -2
  741. package/dist/esm/resources/services/resource-population.backend.service.d.ts.map +1 -1
  742. package/dist/esm/resources/services/resource-population.backend.service.js +74 -18
  743. package/dist/esm/resources/services/resource-population.backend.service.js.map +1 -1
  744. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +23 -0
  745. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  746. package/dist/esm/resources/services/resources-registry.backend.service.js +31 -0
  747. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  748. package/dist/esm/resources/services/virtual-fields.backend.service.d.ts.map +1 -1
  749. package/dist/esm/resources/utils/resource-retention.backend.utils.d.ts.map +1 -1
  750. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  751. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  752. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  753. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  754. package/dist/esm/runtime/models/execution-context.backend.schemas.d.ts.map +1 -1
  755. package/dist/esm/runtime/models/request-context.als.backend.d.ts.map +1 -1
  756. package/dist/esm/runtime/models/runtime.backend.schemas.d.ts.map +1 -1
  757. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  758. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  759. package/dist/esm/runtime/services/execution-context-handler.backend.service.d.ts.map +1 -1
  760. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  761. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  762. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  763. package/dist/esm/runtime/services/http-server.backend.service.js +10 -0
  764. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  765. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  766. package/dist/esm/runtime/services/start-application.backend.service.js +26 -12
  767. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  768. package/dist/esm/runtime/services/utils/oauth-body-cap.backend.utils.d.ts.map +1 -1
  769. package/dist/esm/runtime/testing/execution-context-test-fixtures.d.ts.map +1 -1
  770. package/dist/esm/runtime/testing/mock-execution-context-creator.service.d.ts.map +1 -1
  771. package/dist/esm/runtime/utils/application-startup-config-access.backend.utils.d.ts.map +1 -1
  772. package/dist/esm/runtime/utils/feature-gated-core-resource-exclusions.backend.utils.d.ts.map +1 -1
  773. package/dist/esm/runtime/utils/request-client-ip.utils.d.ts.map +1 -1
  774. package/dist/esm/runtime/utils/scan-default-exports.backend.utils.d.ts.map +1 -1
  775. package/dist/esm/security/api-keys/api-key-generation.backend.utils.d.ts.map +1 -1
  776. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  777. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  778. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  779. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  780. package/dist/esm/security/authentications/controllers/auth-method-management-controller.backend.service.d.ts.map +1 -1
  781. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts +22 -0
  782. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  783. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +84 -0
  784. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  785. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  786. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  787. package/dist/esm/security/authentications/models/auth-constants.backend.d.ts.map +1 -1
  788. package/dist/esm/security/authentications/models/authentications.backend.schemas.d.ts.map +1 -1
  789. package/dist/esm/security/authentications/models/authorization-client.backend.schemas.d.ts.map +1 -1
  790. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  791. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  792. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts +37 -0
  793. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts.map +1 -0
  794. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js +37 -0
  795. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js.map +1 -0
  796. package/dist/esm/security/authentications/models/identity-persistence-boundaries.backend.d.ts.map +1 -1
  797. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  798. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  799. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  800. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  801. package/dist/esm/security/authentications/models/saml-authentication.backend.schemas.d.ts.map +1 -1
  802. package/dist/esm/security/authentications/models/sso-connection.backend.schemas.d.ts.map +1 -1
  803. package/dist/esm/security/authentications/models/user-authorization-version.backend.utils.d.ts.map +1 -1
  804. package/dist/esm/security/authentications/seeds/enterprise-config-defaults.seeds.d.ts.map +1 -1
  805. package/dist/esm/security/authentications/services/__tests__/mock-auth-execution-context-factory.service.d.ts.map +1 -1
  806. package/dist/esm/security/authentications/services/__tests__/mock-auth-token-issuer.service.d.ts.map +1 -1
  807. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +1 -1
  808. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-domain-to-org-lookup.service.d.ts.map +1 -1
  809. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-enterprise-user-provisioning.service.d.ts.map +1 -1
  810. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  811. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  812. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  813. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  814. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  815. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  816. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  817. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  818. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.d.ts.map +1 -1
  819. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js +2 -1
  820. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js.map +1 -1
  821. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +9 -2
  822. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  823. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +9 -2
  824. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  825. package/dist/esm/security/authentications/services/auth-credential-verifier.backend.service.d.ts.map +1 -1
  826. package/dist/esm/security/authentications/services/auth-execution-context-factory.backend.service.d.ts.map +1 -1
  827. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  828. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  829. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  830. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts.map +1 -1
  831. package/dist/esm/security/authentications/services/auth-methods/auth-phone-verification.backend.service.d.ts.map +1 -1
  832. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  833. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  834. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts +97 -0
  835. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  836. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +218 -26
  837. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  838. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts +14 -0
  839. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  840. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +36 -0
  841. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  842. package/dist/esm/security/authentications/services/auth-methods/saml-assertion-validator.backend.service.d.ts.map +1 -1
  843. package/dist/esm/security/authentications/services/auth-methods/saml-authentication.backend.service.d.ts.map +1 -1
  844. package/dist/esm/security/authentications/services/auth-methods/saml-metadata.backend.service.d.ts.map +1 -1
  845. package/dist/esm/security/authentications/services/auth-methods/saml-replay-guard.backend.service.d.ts.map +1 -1
  846. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  847. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  848. package/dist/esm/security/authentications/services/auth-session-store.backend.service.d.ts.map +1 -1
  849. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  850. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  851. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  852. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  853. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  854. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  855. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  856. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  857. package/dist/esm/security/authentications/services/custom-impls/scim-tokens.custom-impl.backend.service.d.ts.map +1 -1
  858. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.d.ts.map +1 -1
  859. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -1
  860. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +57 -1
  861. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -1
  862. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  863. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  864. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.d.ts.map +1 -1
  865. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js +11 -1
  866. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js.map +1 -1
  867. package/dist/esm/security/authentications/services/email-verification-initiator.backend.service.d.ts.map +1 -1
  868. package/dist/esm/security/authentications/services/machine-token-issuer.backend.service.d.ts.map +1 -1
  869. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  870. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  871. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  872. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  873. package/dist/esm/security/authentications/services/oidc-user-claims.backend.service.d.ts.map +1 -1
  874. package/dist/esm/security/authentications/services/resolve-active-member-orgs.backend.utils.d.ts.map +1 -1
  875. package/dist/esm/security/authentications/services/utils/__tests__/mock-auth-user-lookup.service.d.ts.map +1 -1
  876. package/dist/esm/security/authentications/services/utils/auth-controller.utils.d.ts.map +1 -1
  877. package/dist/esm/security/authentications/services/utils/auth-credential-ops.backend.service.d.ts.map +1 -1
  878. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  879. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  880. package/dist/esm/security/authentications/services/utils/auth-response-helper.backend.service.d.ts.map +1 -1
  881. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  882. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  883. package/dist/esm/security/authentications/services/utils/concurrent-session-eviction.backend.utils.d.ts.map +1 -1
  884. package/dist/esm/security/authentications/services/utils/ensure-user-profile.backend.utils.d.ts.map +1 -1
  885. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  886. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  887. package/dist/esm/security/authentications/services/utils/machine-auth-rate-limit.backend.utils.d.ts.map +1 -1
  888. package/dist/esm/security/authentications/services/utils/pkce.backend.utils.d.ts.map +1 -1
  889. package/dist/esm/security/authentications/services/utils/saml-java-availability.d.ts.map +1 -1
  890. package/dist/esm/security/authentications/utils/application-auth-policy-audit.backend.utils.d.ts.map +1 -1
  891. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  892. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  893. package/dist/esm/security/authentications/utils/one-off-session-lifetime.backend.utils.d.ts.map +1 -1
  894. package/dist/esm/security/authentications/utils/social-oauth2-purpose.backend.utils.d.ts.map +1 -1
  895. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts +59 -0
  896. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts.map +1 -0
  897. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js +111 -0
  898. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js.map +1 -0
  899. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts +57 -0
  900. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts.map +1 -0
  901. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js +133 -0
  902. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js.map +1 -0
  903. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts +41 -0
  904. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts.map +1 -0
  905. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js +157 -0
  906. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js.map +1 -0
  907. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts +84 -0
  908. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts.map +1 -0
  909. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js +99 -0
  910. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js.map +1 -0
  911. package/dist/esm/security/authorizations/authorization-denial-audit.backend.utils.d.ts.map +1 -1
  912. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -1
  913. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -1
  914. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  915. package/dist/esm/security/authorizations/junction-scope-resolution.backend.d.ts.map +1 -1
  916. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  917. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  918. package/dist/esm/security/authorizations/organization-unit-narrowing-enforcement.backend.d.ts.map +1 -1
  919. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  920. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +20 -181
  921. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  922. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -1
  923. package/dist/esm/security/authorizations/relationship-foreign-key-filter.backend.d.ts.map +1 -1
  924. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  925. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  926. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +40 -0
  927. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -1
  928. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +43 -1
  929. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -1
  930. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +27 -17
  931. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  932. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +27 -17
  933. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  934. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +72 -0
  935. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  936. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +153 -10
  937. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  938. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  939. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  940. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -1
  941. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -1
  942. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +139 -1
  943. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -1
  944. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +474 -33
  945. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -1
  946. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +40 -0
  947. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -1
  948. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -1
  949. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -1
  950. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -1
  951. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +19 -0
  952. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -1
  953. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +38 -0
  954. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -1
  955. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -1
  956. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -1
  957. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -1
  958. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +17 -1
  959. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -1
  960. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +14 -0
  961. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -1
  962. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +16 -0
  963. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -1
  964. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -1
  965. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +1 -1
  966. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -1
  967. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +19 -0
  968. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -1
  969. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +45 -2
  970. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -1
  971. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -1
  972. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -1
  973. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +37 -1
  974. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -1
  975. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -1
  976. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -1
  977. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -1
  978. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -1
  979. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -1
  980. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts +34 -0
  981. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts.map +1 -0
  982. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js +39 -0
  983. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js.map +1 -0
  984. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  985. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -1
  986. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  987. package/dist/esm/security/consumable-tokens/models/consumable-tokens.shared.schemas.d.ts.map +1 -1
  988. package/dist/esm/security/consumable-tokens/models/index.d.ts.map +1 -1
  989. package/dist/esm/security/consumable-tokens/services/__tests__/mock-consumable-token.service.d.ts.map +1 -1
  990. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  991. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  992. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  993. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  994. package/dist/esm/security/jwt/services/auth-jwt-guard.backend.service.d.ts.map +1 -1
  995. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  996. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts +13 -0
  997. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts.map +1 -1
  998. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js +14 -0
  999. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js.map +1 -1
  1000. package/dist/esm/security/jwt/utils/jwt-verification-error-classification.backend.utils.d.ts.map +1 -1
  1001. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  1002. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  1003. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  1004. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  1005. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts +39 -0
  1006. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts.map +1 -0
  1007. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js +60 -0
  1008. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js.map +1 -0
  1009. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts +66 -0
  1010. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts.map +1 -0
  1011. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js +75 -0
  1012. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js.map +1 -0
  1013. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  1014. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  1015. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  1016. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  1017. package/dist/esm/security/scim/utils/scim-attribute-path-resolver.backend.utils.d.ts.map +1 -1
  1018. package/dist/esm/security/scim/utils/scim-filter-parser.d.ts.map +1 -1
  1019. package/dist/esm/security/scim/utils/scim-response-formatter.d.ts.map +1 -1
  1020. package/dist/esm/security/session-invalidation-fence.backend.utils.d.ts.map +1 -1
  1021. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  1022. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  1023. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -1
  1024. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -1
  1025. package/dist/esm/security/token-invalidation-fence.backend.utils.d.ts.map +1 -1
  1026. package/dist/esm/testing.d.ts.map +1 -1
  1027. package/dist/esm/users/services/inbound-contact-custom-implementation.backend.service.d.ts.map +1 -1
  1028. package/dist/esm/users/services/user-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  1029. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts.map +1 -1
  1030. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -1
  1031. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -1
  1032. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.d.ts.map +1 -1
  1033. package/dist/esm/users/services/user-self-custom-implementations.backend.d.ts.map +1 -1
  1034. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.d.ts.map +1 -1
  1035. package/dist/tsconfig.build.tsbuildinfo +1 -1
  1036. package/package.json +9 -9
  1037. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts +0 -45
  1038. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts.map +0 -1
  1039. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js +0 -22
  1040. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js.map +0 -1
  1041. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -0
  1042. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -0
  1043. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -0
  1044. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -0
  1045. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -0
  1046. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -0
  1047. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -0
  1048. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -0
  1049. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -0
  1050. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -0
  1051. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -0
  1052. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -0
  1053. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -0
  1054. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -0
  1055. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -0
  1056. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"composite-audit-log-sink.backend.d.ts","sourceRoot":"","sources":["../../../../../../src/compliance/audit-trails/services/composite-audit-log-sink.backend.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,6BAA6B,EAC7B,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAS/B,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,4FAA4F,CAAC;AAC1J,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,0FAA0F,CAAC;AACtJ,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sEAAsE,CAAC;AAa3G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,qBAAsB,YAAW,YAAY;IAMtD,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAE1C,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAExC,OAAO,CAAC,QAAQ,CAAC,cAAc;IATjC,oFAAoF;IACpF,OAAO,CAAC,aAAa,CAA8C;gBAIhD,yBAAyB,EAAE,uCAAuC,EAElE,uBAAuB,EAAE,qCAAqC,EAE9D,cAAc,EAAE,cAAc;IAGjD;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAuDtB,2DAA2D;IACpD,QAAQ,IAAI,OAAO;IAI1B;;;;;;;;OAQG;IACI,oBAAoB,IAAI,KAAK,CAAC,YAAY,GAAG,6BAA6B,CAAC;IAUlF;;;;;;;OAOG;IACI,kBAAkB,IAAI,KAAK,CAAC,YAAY,GAAG,oBAAoB,CAAC;IASvE;;;;OAIG;IACU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB1E,mEAAmE;IACtD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAcvC"}
1
+ {"version":3,"file":"composite-audit-log-sink.backend.d.ts","sourceRoot":"","sources":["../../../../../src/compliance/audit-trails/services/composite-audit-log-sink.backend.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,qBAAqB,EACrB,6BAA6B,EAC7B,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAS/B,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,4FAA4F,CAAC;AAC1J,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,0FAA0F,CAAC;AACtJ,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sEAAsE,CAAC;AAa3G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBACa,qBAAsB,YAAW,YAAY;IAMtD,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAE1C,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAExC,OAAO,CAAC,QAAQ,CAAC,cAAc;IATjC,oFAAoF;IACpF,OAAO,CAAC,aAAa,CAA8C;gBAIhD,yBAAyB,EAAE,uCAAuC,EAElE,uBAAuB,EAAE,qCAAqC,EAE9D,cAAc,EAAE,cAAc;IAGjD;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAuDtB,2DAA2D;IACpD,QAAQ,IAAI,OAAO;IAI1B;;;;;;;;OAQG;IACI,oBAAoB,IAAI,KAAK,CAAC,YAAY,GAAG,6BAA6B,CAAC;IAUlF;;;;;;;OAOG;IACI,kBAAkB,IAAI,KAAK,CAAC,YAAY,GAAG,oBAAoB,CAAC;IASvE;;;;OAIG;IACU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB1E,mEAAmE;IACtD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAcvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"composite-audit-log-sink.backend.js","sourceRoot":"","sources":["../../../../../../src/compliance/audit-trails/services/composite-audit-log-sink.backend.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAOzD;;;;;GAKG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AACpG,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAIpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,8EAA8E,CAAC;AAY3H;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAMb;IAEA;IAEA;IATnB,oFAAoF;IAC5E,aAAa,GAAoC,SAAS,CAAC;IAEnE,YAEmB,yBAAkE,EAElE,uBAA8D,EAE9D,cAA8B;QAJ9B,8BAAyB,GAAzB,yBAAyB,CAAyC;QAElE,4BAAuB,GAAvB,uBAAuB,CAAuC;QAE9D,mBAAc,GAAd,cAAc,CAAgB;IAC9C,CAAC;IAEJ;;;;OAIG;IACK,cAAc;QACpB,IAAI,IAAI,CAAC,aAAa,KAAK,SA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OAAO,GAAG,EAAE,CAAC;gBACb,0EAA0E;gBAC1E,wEAAwE;gBACxE,wEAAwE;gBACxE,gDAAgD;gBAChD,IAAI,CAAC,cAAc,CAAC,sBAAsB,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;gBACjE,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE;oBACxD,WAAW,EAAE,GAAG;oBAChB,GAAG,2BAA2B,CAAC,GAAG,CAAC;iBACpC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,mEAAmE;IAC5D,KAAK,CAAC,QAAQ;QACnB,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;YACrC,OAAO;QACT,CAAC;QACD,MAAM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACxC,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC1B,CAAC;YAAC,MAAM,CAAC;gBACP,oBAAoB;YACtB,CAAC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AA9JY,qBAAqB;IADjC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,kBAAkB,CAAC,gCAAgC,CAAC,CAAA;IAE3D,WAAA,MAAM,CAAC,kBAAkB,CAAC,8BAA8B,CAAC,CAAA;IAEzD,WAAA,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;;GATjC,qBAAqB,CA8JjC","sourcesContent":["import { injectable, inject } from 'inversify';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport type {\n AuditLogSink,\n AuditLogEventEmission,\n AuditReconcileCheckpointStore,\n AuditLogVerification,\n} from '@wildo-ai/saas-models';\n/*\n * `/backend-runtime`, not `/backend` (#330). The two barrels expose the same builder; `/backend` also\n * re-exports the engine's EAGERLY composed provider catalogue, and ES module semantics mean that one\n * value import evaluates all twenty-two provider modules — six of them pulling an `@ai-sdk/*` client\n * — into whatever process imports this file. This file is in every backend's boot graph.\n */\nimport { buildAuditLogSinkFromModule } from '@wildo-ai/external-connectors-private/backend-runtime';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { ExternalProvidersRegistryBackendService } from '~wildo-backend-lib/external-providers/services/external-providers-registry.backend.service';\nimport type { BackendProviderRegistryBackendService } from '~wildo-backend-lib/external-providers/services/backend-provider-registry.backend.service';\nimport type { MetricsService } from '~wildo-backend-lib/monitoring/observability/services/metrics.service';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\n\n/**\n * A resolved audit sink paired with the provider ref it was built from. Keeping\n * the ref lets failure metrics + logs name the offending provider (immudb, a\n * SIEM, …) instead of an anonymous index.\n */\ninterface ResolvedAuditSink {\n ref: string;\n sink: AuditLogSink;\n}\n\n/**\n * Engine-side `AuditLogSink` that fans EVERY audit event out to ALL providers\n * declaring `EngineCapability.COMPLIANCE_AUDIT_TRAIL` (a FAN_OUT capability),\n * resolved LAZILY from the app's `defineSaaSProviders` config.\n *\n * This is the Layer-2 provider fan-out — layered ON TOP of the always-on Layer-1\n * database audit store (`AuditLogsBackendService`). It is NOT the authoritative\n * store; a backend with zero audit providers keeps this a byte-identical no-op.\n *\n * **Why lazy.** The selection-aware registry only knows the declared providers\n * after `initialize()` (during startup, after the DI container is built), and\n * `AuditLogsBackendService` caches this reference at construction. So this object\n * is bound EAGERLY (a stable reference) but resolves providers on first use — by\n * which point (an actual audit event) the registry is initialized. Mirrors\n * `LlmObservabilityAgentCallTraceSink` / `EmailBackendService`.\n *\n * **Delivery.** Every resolved sink receives every event; a single sink's failure\n * is ISOLATED and never thrown onto the caller (the business-op path — F7). A\n * failure is ALSO made OBSERVABLE via `MetricsService.recordAuditSinkFailure`\n * (F6): fire-and-forget is correct (audit must never break the business op), but\n * a silently-failing sink must not masquerade as a healthy pipeline — the metric\n * lets \"we think we're auditing but we aren't\" surface on the observability layer\n * (→ an alert via the alerting workstream), not just a swallowed log line. This\n * honours the `AuditLogSink` contract (at-least-once per sink, non-blocking) —\n * the sinks own their own durable buffering + retry.\n *\n * Each resolved sink is kept paired with the provider ref it was built from, so\n * the completeness reconciler ({@link getReconcilableSinks}) and external-auditor\n * verification ({@link getVerifiableSinks}) can narrow to the sinks supporting\n * those optional capabilities.\n */\n@injectable()\nexport class CompositeAuditLogSink implements AuditLogSink {\n /** `undefined` = not yet resolved; else the (possibly empty) resolved sink list. */\n private resolvedSinks: ResolvedAuditSink[] | undefined = undefined;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.ExternalProvidersRegistryService)\n private readonly externalProvidersRegistry: ExternalProvidersRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.BackendProviderRegistryService)\n private readonly backendProviderRegistry: BackendProviderRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.MetricsService)\n private readonly metricsService: MetricsService,\n ) {}\n\n /**\n * Resolve (once) every declared audit-provider sink. Caches the result,\n * including an empty list. If the registry is not yet initialized (a call before\n * startup completes), the attempt is NOT cached so a later call retries.\n */\n private ensureResolved(): ResolvedAuditSink[] {\n if (this.resolvedSinks !== undefined) {\n return this.resolvedSinks;\n }\n // Expected pre-startup window: the selection-aware registry isn't populated\n // until initialize() runs. Stay unresolved (retry on the next event) WITHOUT\n // logging — this is normal boot ordering, not a fault.\n if (!this.externalProvidersRegistry.isReady()) {\n return [];\n }\n try {\n const providerRefs = this.externalProvidersRegistry.getResolvedProviderRefsForCapability(\n EngineCapability.COMPLIANCE_AUDIT_TRAIL,\n );\n const sinks: ResolvedAuditSink[] = [];\n for (const providerRef of providerRefs) {\n const module = this.backendProviderRegistry.getProvider(providerRef);\n if (!module) {\n continue;\n }\n // Thread a tamper-metric hook bound to this provider ref: a sink that PROVES its store was\n // rolled back/tampered (immudb's durable-state consistency proof) surfaces on the distinct\n // `audit_tamper_detected_total{provider}` counter. The sink cannot import `MetricsService`\n // (dependency direction), so this callback is how the signal crosses the wall.\n const sink = buildAuditLogSinkFromModule(\n module,\n console,\n () => this.metricsService.recordAuditTamperDetected({ providerRef }),\n // Assurance DEGRADATION (ephemeral / corrupt anchor / un-pinned identity change / per-op proof\n // failure) — distinct `audit_integrity_assurance_degraded_total{provider,reason}`, non-latching.\n (reason) => this.metricsService.recordAuditIntegrityAssuranceDegraded({ providerRef, reason }),\n );\n if (sink) {\n sinks.push({ ref: providerRef, sink });\n }\n }\n this.resolvedSinks = sinks;\n return sinks;\n } catch (err) {\n // Post-init resolution fault (a mis-projected registry, a throwing module\n // factory) — NOT the expected pre-init path (guarded above). Do NOT cache\n // (so a later event retries) and SURFACE it: a silently-failing audit\n // pipeline masquerading as \"no providers declared\" is exactly the audit\n // black hole this guards against.\n // `projectCaughtErrorLogFields`, not an `instanceof Error` ternary: a\n // `WildoError_Backend` is a plain object, so the ternary would render the very\n // fault this guard exists to surface as the literal `'[object Object]'`.\n console.error(\n '[audit] failed to resolve provider sinks (non-fatal, will retry)',\n projectCaughtErrorLogFields(err),\n );\n return [];\n }\n }\n\n /** Whether any audit provider is declared + configured. */\n public isActive(): boolean {\n return this.ensureResolved().length > 0;\n }\n\n /**\n * The resolved audit sinks that ALSO support reconcile-checkpointing\n * ({@link AuditReconcileCheckpointStore}) — i.e. can persist the completeness\n * reconciler's high-water mark in their own store (immudb). The reconciler drives\n * these per-sink (get checkpoint → replay DB events since it → set checkpoint); a\n * sink that can't checkpoint (a fire-and-forget SIEM webhook) is simply absent.\n * Returns the SAME sink instances the real-time fan-out uses, so the reconciler\n * shares ONE immudb connection with the live write path.\n */\n public getReconcilableSinks(): Array<AuditLogSink & AuditReconcileCheckpointStore> {\n return this.ensureResolved()\n .map((entry) => entry.sink)\n .filter(\n (sink): sink is AuditLogSink & AuditReconcileCheckpointStore =>\n typeof (sink as Partial<AuditReconcileCheckpointStore>).getAuditReconcileCheckpoint === 'function' &&\n typeof (sink as Partial<AuditReconcileCheckpointStore>).setAuditReconcileCheckpoint === 'function',\n );\n }\n\n /**\n * The resolved audit sinks that ALSO support cryptographic VERIFICATION\n * ({@link AuditLogVerification}) — i.e. can prove a recorded event is present +\n * untampered (immudb inclusion proofs). This is an EXTERNAL-AUDITOR read path,\n * resolved SEPARATELY from the write fan-out; a sink whose technology can't prove\n * non-tampering (a fire-and-forget SIEM webhook) is simply absent. Returns the\n * SAME sink instances the fan-out uses, sharing their live connection.\n */\n public getVerifiableSinks(): Array<AuditLogSink & AuditLogVerification> {\n return this.ensureResolved()\n .map((entry) => entry.sink)\n .filter(\n (sink): sink is AuditLogSink & AuditLogVerification =>\n typeof (sink as Partial<AuditLogVerification>).verifyAuditEvent === 'function',\n );\n }\n\n /**\n * Fan the event out to EVERY resolved sink, isolating per-sink failures so one\n * never affects the others (each destination is independent — F7), and NEVER\n * throwing onto the caller (fire-and-forget from the business op).\n */\n public async recordAuditEvent(event: AuditLogEventEmission): Promise<void> {\n const sinks = this.ensureResolved();\n if (sinks.length === 0) {\n return;\n }\n await Promise.all(\n sinks.map(async ({ ref, sink }) => {\n try {\n await sink.recordAuditEvent(event);\n } catch (err) {\n // F6 (Phase 5): a sink failing mid-operation must be OBSERVABLE, not just\n // a swallowed log line — emit a metric so a silently-failing audit sink\n // surfaces on the observability layer (→ alert). Still fire-and-forget:\n // the throw never reaches the business-op path.\n this.metricsService.recordAuditSinkFailure({ providerRef: ref });\n console.error('[audit] provider sink failed (non-fatal)', {\n providerRef: ref,\n ...projectCaughtErrorLogFields(err),\n });\n }\n }),\n );\n }\n\n /** Drain every already-resolved sink on shutdown (best-effort). */\n public async shutdown(): Promise<void> {\n if (this.resolvedSinks === undefined) {\n return;\n }\n await Promise.all(\n this.resolvedSinks.map(async ({ sink }) => {\n try {\n await sink.shutdown?.();\n } catch {\n // best-effort drain\n }\n }),\n );\n }\n}\n"]}
1
+ {"version":3,"file":"composite-audit-log-sink.backend.js","sourceRoot":"","sources":["../../../../../src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AM,OAAO,CAAC,GAAG,CACf,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YACxC,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC;YAC1B,CAAC;YAAC,MAAM,CAAC;gBACP,oBAAoB;YACtB,CAAC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAA;AA9JY,qBAAqB;IADjC,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,kBAAkB,CAAC,gCAAgC,CAAC,CAAA;IAE3D,WAAA,MAAM,CAAC,kBAAkB,CAAC,8BAA8B,CAAC,CAAA;IAEzD,WAAA,MAAM,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;;GATjC,qBAAqB,CA8JjC","sourcesContent":["import { injectable, inject } from 'inversify';\nimport { EngineCapability } from '@wildo-ai/saas-models';\nimport type {\n AuditLogSink,\n AuditLogEventEmission,\n AuditReconcileCheckpointStore,\n AuditLogVerification,\n} from '@wildo-ai/saas-models';\n/*\n * `/backend-runtime`, not `/backend` (#330). The two barrels expose the same builder; `/backend` also\n * re-exports the engine's EAGERLY composed provider catalogue, and ES module semantics mean that one\n * value import evaluates all twenty-two provider modules — six of them pulling an `@ai-sdk/*` client\n * — into whatever process imports this file. This file is in every backend's boot graph.\n */\nimport { buildAuditLogSinkFromModule } from '@wildo-ai/external-connectors-private/backend-runtime';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { ExternalProvidersRegistryBackendService } from '~wildo-backend-lib/external-providers/services/external-providers-registry.backend.service';\nimport type { BackendProviderRegistryBackendService } from '~wildo-backend-lib/external-providers/services/backend-provider-registry.backend.service';\nimport type { MetricsService } from '~wildo-backend-lib/monitoring/observability/services/metrics.service';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\n\n/**\n * A resolved audit sink paired with the provider ref it was built from. Keeping\n * the ref lets failure metrics + logs name the offending provider (immudb, a\n * SIEM, …) instead of an anonymous index.\n */\ninterface ResolvedAuditSink {\n ref: string;\n sink: AuditLogSink;\n}\n\n/**\n * Engine-side `AuditLogSink` that fans EVERY audit event out to ALL providers\n * declaring `EngineCapability.COMPLIANCE_AUDIT_TRAIL` (a FAN_OUT capability),\n * resolved LAZILY from the app's `defineSaaSProviders` config.\n *\n * This is the Layer-2 provider fan-out — layered ON TOP of the always-on Layer-1\n * database audit store (`AuditLogsBackendService`). It is NOT the authoritative\n * store; a backend with zero audit providers keeps this a byte-identical no-op.\n *\n * **Why lazy.** The selection-aware registry only knows the declared providers\n * after `initialize()` (during startup, after the DI container is built), and\n * `AuditLogsBackendService` caches this reference at construction. So this object\n * is bound EAGERLY (a stable reference) but resolves providers on first use — by\n * which point (an actual audit event) the registry is initialized. Mirrors\n * `LlmObservabilityAgentCallTraceSink` / `EmailBackendService`.\n *\n * **Delivery.** Every resolved sink receives every event; a single sink's failure\n * is ISOLATED and never thrown onto the caller (the business-op path — F7). A\n * failure is ALSO made OBSERVABLE via `MetricsService.recordAuditSinkFailure`\n * (F6): fire-and-forget is correct (audit must never break the business op), but\n * a silently-failing sink must not masquerade as a healthy pipeline — the metric\n * lets \"we think we're auditing but we aren't\" surface on the observability layer\n * (→ an alert via the alerting workstream), not just a swallowed log line. This\n * honours the `AuditLogSink` contract (at-least-once per sink, non-blocking) —\n * the sinks own their own durable buffering + retry.\n *\n * Each resolved sink is kept paired with the provider ref it was built from, so\n * the completeness reconciler ({@link getReconcilableSinks}) and external-auditor\n * verification ({@link getVerifiableSinks}) can narrow to the sinks supporting\n * those optional capabilities.\n */\n@injectable()\nexport class CompositeAuditLogSink implements AuditLogSink {\n /** `undefined` = not yet resolved; else the (possibly empty) resolved sink list. */\n private resolvedSinks: ResolvedAuditSink[] | undefined = undefined;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.ExternalProvidersRegistryService)\n private readonly externalProvidersRegistry: ExternalProvidersRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.BackendProviderRegistryService)\n private readonly backendProviderRegistry: BackendProviderRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.MetricsService)\n private readonly metricsService: MetricsService,\n ) {}\n\n /**\n * Resolve (once) every declared audit-provider sink. Caches the result,\n * including an empty list. If the registry is not yet initialized (a call before\n * startup completes), the attempt is NOT cached so a later call retries.\n */\n private ensureResolved(): ResolvedAuditSink[] {\n if (this.resolvedSinks !== undefined) {\n return this.resolvedSinks;\n }\n // Expected pre-startup window: the selection-aware registry isn't populated\n // until initialize() runs. Stay unresolved (retry on the next event) WITHOUT\n // logging — this is normal boot ordering, not a fault.\n if (!this.externalProvidersRegistry.isReady()) {\n return [];\n }\n try {\n const providerRefs = this.externalProvidersRegistry.getResolvedProviderRefsForCapability(\n EngineCapability.COMPLIANCE_AUDIT_TRAIL,\n );\n const sinks: ResolvedAuditSink[] = [];\n for (const providerRef of providerRefs) {\n const module = this.backendProviderRegistry.getProvider(providerRef);\n if (!module) {\n continue;\n }\n // Thread a tamper-metric hook bound to this provider ref: a sink that PROVES its store was\n // rolled back/tampered (immudb's durable-state consistency proof) surfaces on the distinct\n // `audit_tamper_detected_total{provider}` counter. The sink cannot import `MetricsService`\n // (dependency direction), so this callback is how the signal crosses the wall.\n const sink = buildAuditLogSinkFromModule(\n module,\n console,\n () => this.metricsService.recordAuditTamperDetected({ providerRef }),\n // Assurance DEGRADATION (ephemeral / corrupt anchor / un-pinned identity change / per-op proof\n // failure) — distinct `audit_integrity_assurance_degraded_total{provider,reason}`, non-latching.\n (reason) => this.metricsService.recordAuditIntegrityAssuranceDegraded({ providerRef, reason }),\n );\n if (sink) {\n sinks.push({ ref: providerRef, sink });\n }\n }\n this.resolvedSinks = sinks;\n return sinks;\n } catch (err) {\n // Post-init resolution fault (a mis-projected registry, a throwing module\n // factory) — NOT the expected pre-init path (guarded above). Do NOT cache\n // (so a later event retries) and SURFACE it: a silently-failing audit\n // pipeline masquerading as \"no providers declared\" is exactly the audit\n // black hole this guards against.\n // `projectCaughtErrorLogFields`, not an `instanceof Error` ternary: a\n // `WildoError_Backend` is a plain object, so the ternary would render the very\n // fault this guard exists to surface as the literal `'[object Object]'`.\n console.error(\n '[audit] failed to resolve provider sinks (non-fatal, will retry)',\n projectCaughtErrorLogFields(err),\n );\n return [];\n }\n }\n\n /** Whether any audit provider is declared + configured. */\n public isActive(): boolean {\n return this.ensureResolved().length > 0;\n }\n\n /**\n * The resolved audit sinks that ALSO support reconcile-checkpointing\n * ({@link AuditReconcileCheckpointStore}) — i.e. can persist the completeness\n * reconciler's high-water mark in their own store (immudb). The reconciler drives\n * these per-sink (get checkpoint → replay DB events since it → set checkpoint); a\n * sink that can't checkpoint (a fire-and-forget SIEM webhook) is simply absent.\n * Returns the SAME sink instances the real-time fan-out uses, so the reconciler\n * shares ONE immudb connection with the live write path.\n */\n public getReconcilableSinks(): Array<AuditLogSink & AuditReconcileCheckpointStore> {\n return this.ensureResolved()\n .map((entry) => entry.sink)\n .filter(\n (sink): sink is AuditLogSink & AuditReconcileCheckpointStore =>\n typeof (sink as Partial<AuditReconcileCheckpointStore>).getAuditReconcileCheckpoint === 'function' &&\n typeof (sink as Partial<AuditReconcileCheckpointStore>).setAuditReconcileCheckpoint === 'function',\n );\n }\n\n /**\n * The resolved audit sinks that ALSO support cryptographic VERIFICATION\n * ({@link AuditLogVerification}) — i.e. can prove a recorded event is present +\n * untampered (immudb inclusion proofs). This is an EXTERNAL-AUDITOR read path,\n * resolved SEPARATELY from the write fan-out; a sink whose technology can't prove\n * non-tampering (a fire-and-forget SIEM webhook) is simply absent. Returns the\n * SAME sink instances the fan-out uses, sharing their live connection.\n */\n public getVerifiableSinks(): Array<AuditLogSink & AuditLogVerification> {\n return this.ensureResolved()\n .map((entry) => entry.sink)\n .filter(\n (sink): sink is AuditLogSink & AuditLogVerification =>\n typeof (sink as Partial<AuditLogVerification>).verifyAuditEvent === 'function',\n );\n }\n\n /**\n * Fan the event out to EVERY resolved sink, isolating per-sink failures so one\n * never affects the others (each destination is independent — F7), and NEVER\n * throwing onto the caller (fire-and-forget from the business op).\n */\n public async recordAuditEvent(event: AuditLogEventEmission): Promise<void> {\n const sinks = this.ensureResolved();\n if (sinks.length === 0) {\n return;\n }\n await Promise.all(\n sinks.map(async ({ ref, sink }) => {\n try {\n await sink.recordAuditEvent(event);\n } catch (err) {\n // F6 (Phase 5): a sink failing mid-operation must be OBSERVABLE, not just\n // a swallowed log line — emit a metric so a silently-failing audit sink\n // surfaces on the observability layer (→ alert). Still fire-and-forget:\n // the throw never reaches the business-op path.\n this.metricsService.recordAuditSinkFailure({ providerRef: ref });\n console.error('[audit] provider sink failed (non-fatal)', {\n providerRef: ref,\n ...projectCaughtErrorLogFields(err),\n });\n }\n }),\n );\n }\n\n /** Drain every already-resolved sink on shutdown (best-effort). */\n public async shutdown(): Promise<void> {\n if (this.resolvedSinks === undefined) {\n return;\n }\n await Promise.all(\n this.resolvedSinks.map(async ({ sink }) => {\n try {\n await sink.shutdown?.();\n } catch {\n // best-effort drain\n }\n }),\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../src/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.ts"],"names":[],"mappings":"AAoEA,OAAO,EAEL,KAAK,0CAA0C,EAChD,MAAM,4GAA4G,CAAC;AAkDpH;;;;;;;;;;;;GAYG;AACH,wBAAgB,gDAAgD,IAAI,0CAA0C,EAAE,CAuC/G"}
1
+ {"version":3,"file":"siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.ts"],"names":[],"mappings":"AAoEA,OAAO,EAEL,KAAK,0CAA0C,EAChD,MAAM,4GAA4G,CAAC;AAkDpH;;;;;;;;;;;;GAYG;AACH,wBAAgB,gDAAgD,IAAI,0CAA0C,EAAE,CAuC/G"}
@@ -1 +1 @@
1
- {"version":3,"file":"siem-export-config-cache-invalidation.custom-impl.backend.service.js","sourceRoot":"","sources":["../../../../../../src/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yCAAyC,GAE1C,MAAM,4GAA4G,CAAC;AAEpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAKpF,mGAAmG;AACnG,MAAM,uBAAuB,GAAG;IAC9B,qBAAqB,CAAC,MAAM;IAC5B,qBAAqB,CAAC,MAAM;CACpB,CAAC;AAEX,MAAM,qBAAqB,GAAG;IAC5B,WAAW,EAAE,4BAA4B,CAAC,aAAa;IACvD,kBAAkB,EAAE,IAAI;CAChB,CAAC;AAIX;;;;;;;;;;;;GAYG;AACH,SAAS,qBAAqB,CAC5B,MAAe,EACf,KAAmD,EACnD,gBAAuC;IAEvC,MAAM,UAAU,GACd,MAAM,IAAI,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,gBAAgB,IAAI,MAAM;QACxE,CAAC,CAAE,MAAgC,CAAC,cAAc;QAClD,CAAC,CAAC,SAAS,CAAC;IAChB,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAElC,MAAM,WAAW,GAAI,KAAK,CAAC,aAAmD,EAAE,cAAc,CAAC;IAC/F,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IAEpC,OAAO,gBAAgB,CAAC,cAAc,IAAI,SAAS,CAAC;AACtD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gDAAgD;IAC9D,OAAO,uBAAuB,CAAC,GAAG,CAChC,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAC9B,kBAAkB,CAAC,2BAA2B,CAC/C,CAAC;QACF,OAAO,yCAAyC,CAAC;YAC/C,aAAa,EAAE;gBACb,kBAAkB,EAAE,gBAAgB,CAAC,+BAA+B;gBACpE,mBAAmB;gBACnB,GAAG,qBAAqB;aACzB;YACD,QAAQ,EAAE;gBACR,qBAAqB,EAAE,KAAK,EAC1B,GAAuB,EACvB,GAAY,EACZ,gBAAuC,EACvC,aAA4D,EAC5D,KAAmD,EACjC,EAAE;oBACpB,MAAM,cAAc,GAAG,qBAAqB,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;oBAC3E,IAAI,CAAC,cAAc,EAAE,CAAC;wBACpB,KAAK,CAAC,MAAM,CAAC,IAAI,CACf,wIAAwI,EACxI;4BACE,mBAAmB,EAAE,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC;4BAC9D,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;4BACpD,KAAK,EAAE,GAAG;yBACX,CACF,CAAC;wBACF,OAAO,GAAG,CAAC;oBACb,CAAC;oBACD,UAAU,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;oBAChD,OAAO,GAAG,CAAC;gBACb,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Postfix-hook custom-service implementation that drops an organization's cached SIEM export\n * config after an engine-routed write to `ORGANIZATION_SIEM_EXPORT_CONFIG`.\n *\n * Without this, `AuditEventDispatcherBackendService` served a stale config for up to\n * `SIEM_CONFIG_REFRESH_AFTER_MS` with no invalidation of any kind, so an organization that ENABLED its\n * SIEM sink kept resolving the cached `null` and had its authenticated audit events routed to no sink\n * for that window. Audit events are not replayed, so those deliveries were lost rather than delayed.\n *\n * **The \"N independent windows\" this file's first revision described is CLOSED.** That revision noted\n * the window was PER PROCESS because the cache is an in-process `Map`, and stopped there — which left\n * the hook correct for exactly one replica and inert for the rest of a real deployment.\n * `invalidateSiemConfig` now drops the local entry AND publishes the organization id on a Redis channel\n * every replica subscribes to, so an engine-routed write converges fleet-wide in milliseconds. Read that\n * method's JSDoc for the broadcast, and `SIEM_CONFIG_REFRESH_AFTER_MS` for the lease that still carries\n * everything the broadcast cannot reach.\n *\n * ## Why the hook sits on the RESOURCE and not on the config service\n *\n * `AuthOrganizationConfigurationService.saveSiemExportConfig` is the obvious call site and is only\n * ONE of the writers: the config is an ordinary resource, so an update also lands through\n * `ServicesRegistryHandler.update` on `organizationSiemExportConfig` directly. Hooking the service\n * would have applied the invariant at one of two sites — the shape\n * `.claude/rules/invariant-call-site-enumeration.md` records twenty-odd times. The resource\n * operation is the chokepoint both writers pass through, because `saveSiemExportConfig` dispatches\n * its own write via `ServicesRegistryHandler`.\n *\n * ## Coverage matrix\n *\n * | Operation | Variant | Covered | Why |\n * |-----------|------------------|---------|-----|\n * | `CREATE` | `INTERNAL_CALL` | ✅ | The lazy `createAsSystem` materialisation on the userless login path, and the first real configuration. Service tier, so a postfix hook is reachable. |\n * | `UPDATE` | `INTERNAL_CALL` | ✅ | Every edit, including `saveSiemExportConfig`. Service tier. |\n * | `DELETE` | `REPOSITORY_ONLY`| ❌ | Deliberate, twice over: `doOperation` throws on `REPOSITORY_ONLY`, so the service tier where custom implementations run is unreachable BY CONSTRUCTION and a registration here would fail startup; and its only caller is the `onParentDelete` cascade, which fires when the owning organization is itself being hard-deleted — nothing dispatches audit events for a deleted tenant, so the entry is moot and TTL-expires. |\n * | `READ` | `API_CALL` | ❌ | Reads do not stale a cache. |\n *\n * **`APPLICATION_SIEM_EXPORT_CONFIG` is deliberately NOT registered.** The dispatcher's cache is\n * keyed by `organizationId` and it only ever loads the ORGANIZATION variant\n * (`loadSiemExportConfig(ec, ORGANIZATION, orgId)`), because SIEM fan-out is per authenticated\n * tenant. The APPLICATION variant is settable and inert — no producer emits app-scoped deliveries —\n * so there is no app-scoped cache entry to invalidate. When an app-scoped producer lands, it gets\n * its own cache and its own registration in the same change.\n *\n * **The framework default-seed is also not covered, and does not need to be.**\n * `organizationSiemExportConfigDefaultSeed` writes a DISABLED default at the repository tier during\n * organization creation, before the organization can have raised an audit event, so there is no\n * entry in the map to stale.\n *\n * ## What no hook on this tier can ever cover — and who relies on it today\n *\n * Repository-direct writes and raw database writes never reach the service tier, so they raise no\n * postfix hook and produce no broadcast. This is not hypothetical: `examples/wonder-todos/e2e/adapter.ts`\n * (`case 'siem'`) repoints an organization's export config with\n * `upsertOrganizationSingleton('organizationSiemExportConfig', …)`, straight at the store. Its own\n * comment records the consequence — the lane works *\"because a freshly provisioned org has a cold\n * config cache\"*, i.e. by ORDERING itself before the organization's first audited action rather than by\n * anything invalidating.\n *\n * For that class of write the LEASE is the entire guarantee, which is why\n * `SIEM_CONFIG_REFRESH_AFTER_MS` states its number, its arithmetic and its reason rather than being an\n * incidental five minutes. Do not read this file as \"engine writes are covered, the rest is someone\n * else's problem\": the two mechanisms are one guarantee, and the lease is the half that has no hook.\n */\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ResourceOperationVariantType,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport { AuditEventDispatcherBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-event-dispatcher.backend.service';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { ResourceOperation_CustomImplementation_Utils } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation-base.backend.service';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport type { ResourceConfiguration_OperationPath } from '@wildo-ai/saas-models';\n\n/** The operations whose writes can stale the dispatcher's cache. See the coverage matrix above. */\nconst INVALIDATING_OPERATIONS = [\n CoreResourceOperation.CREATE,\n CoreResourceOperation.UPDATE,\n] as const;\n\nconst INTERNAL_DEFAULT_PATH = {\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isOperationDefault: true,\n} as const;\n\ntype RowWithOrganizationId = { organizationId?: string };\n\n/**\n * Resolve the organization whose cache entry must go, with a three-tier fallback.\n *\n * 1. **The postfix result** — the persisted row. CREATE and UPDATE both return it, and it carries\n * `organizationId` (injected by the polymorphism engine), so this is the normal path.\n * 2. **`utils.currentObject`** — fetched by the framework before a non-CREATE custom impl runs.\n * Load-bearing when an implementation returns something other than the row.\n * 3. **`executionContext.organizationId`** — the scope the request runs under.\n *\n * Mirrors `resolveOrgIdsForInvalidation` in\n * `scope-features-cache-invalidation.custom-impl.backend.service.ts`; see that file for the\n * reasoning behind each tier.\n */\nfunction resolveOrganizationId(\n result: unknown,\n utils: ResourceOperation_CustomImplementation_Utils,\n executionContext: ExecutionContext<any>,\n): string | undefined {\n const fromResult =\n result != null && typeof result === 'object' && 'organizationId' in result\n ? (result as RowWithOrganizationId).organizationId\n : undefined;\n if (fromResult) return fromResult;\n\n const fromCurrent = (utils.currentObject as RowWithOrganizationId | undefined)?.organizationId;\n if (fromCurrent) return fromCurrent;\n\n return executionContext.organizationId ?? undefined;\n}\n\n/**\n * Registers the postfix invalidation on the ORGANIZATION SIEM-export-config CREATE and UPDATE.\n *\n * The handler is synchronous and cannot fail. `invalidateSiemConfig` drops a map entry and then kicks a\n * fire-and-forget Redis publish that swallows its own error — so unlike the Redis-backed feature-cache\n * equivalent, which awaits its `del`, there is still nothing here to await and no error path. That is a\n * deliberate property of `invalidateSiemConfig`, not an accident of it: a broadcast that fails leaves\n * the other replicas exactly where the lease already puts them, and refusing a configuration write to\n * protect a cache would invert the priority.\n * A `logger.warn` on an unresolvable organization id keeps the gap observable rather than silent:\n * failing the write would be the wrong trade, because refusing a config edit to protect a cache\n * inverts the priority, but a silently un-invalidated entry is the exact defect this file fixes.\n */\nexport function createSiemExportConfigCacheInvalidationFactories(): ResourceCustomServiceImplementationFactory[] {\n return INVALIDATING_OPERATIONS.map(\n (operationIdentifier) => (_rr, container) => {\n const dispatcher = container.get<AuditEventDispatcherBackendService>(\n SAAS_SERVICE_TYPES.AuditEventDispatcherService,\n );\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_SIEM_EXPORT_CONFIG,\n operationIdentifier,\n ...INTERNAL_DEFAULT_PATH,\n },\n handlers: {\n postfixCoreOperations: async (\n _id: string | undefined,\n res: unknown,\n executionContext: ExecutionContext<any>,\n operationPath: ResourceConfiguration_OperationPath<any, any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n ): Promise<unknown> => {\n const organizationId = resolveOrganizationId(res, utils, executionContext);\n if (!organizationId) {\n utils.logger.warn(\n 'Could not resolve organizationId for SIEM export config cache invalidation — the dispatcher may serve a stale config for up to its TTL',\n {\n operationIdentifier: String(operationPath.operationIdentifier),\n resourceIdentifier: operationPath.resourceIdentifier,\n rowId: _id,\n },\n );\n return res;\n }\n dispatcher.invalidateSiemConfig(organizationId);\n return res;\n },\n },\n });\n },\n );\n}\n"]}
1
+ {"version":3,"file":"siem-export-config-cache-invalidation.custom-impl.backend.service.js","sourceRoot":"","sources":["../../../../../src/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yCAAyC,GAE1C,MAAM,4GAA4G,CAAC;AAEpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAKpF,mGAAmG;AACnG,MAAM,uBAAuB,GAAG;IAC9B,qBAAqB,CAAC,MAAM;IAC5B,q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K,CAAC,MAAM,CAAC,IAAI,CACf,wIAAwI,EACxI;4BACE,mBAAmB,EAAE,MAAM,CAAC,aAAa,CAAC,mBAAmB,CAAC;4BAC9D,kBAAkB,EAAE,aAAa,CAAC,kBAAkB;4BACpD,KAAK,EAAE,GAAG;yBACX,CACF,CAAC;wBACF,OAAO,GAAG,CAAC;oBACb,CAAC;oBACD,UAAU,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;oBAChD,OAAO,GAAG,CAAC;gBACb,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Postfix-hook custom-service implementation that drops an organization's cached SIEM export\n * config after an engine-routed write to `ORGANIZATION_SIEM_EXPORT_CONFIG`.\n *\n * Without this, `AuditEventDispatcherBackendService` served a stale config for up to\n * `SIEM_CONFIG_REFRESH_AFTER_MS` with no invalidation of any kind, so an organization that ENABLED its\n * SIEM sink kept resolving the cached `null` and had its authenticated audit events routed to no sink\n * for that window. Audit events are not replayed, so those deliveries were lost rather than delayed.\n *\n * **The \"N independent windows\" this file's first revision described is CLOSED.** That revision noted\n * the window was PER PROCESS because the cache is an in-process `Map`, and stopped there — which left\n * the hook correct for exactly one replica and inert for the rest of a real deployment.\n * `invalidateSiemConfig` now drops the local entry AND publishes the organization id on a Redis channel\n * every replica subscribes to, so an engine-routed write converges fleet-wide in milliseconds. Read that\n * method's JSDoc for the broadcast, and `SIEM_CONFIG_REFRESH_AFTER_MS` for the lease that still carries\n * everything the broadcast cannot reach.\n *\n * ## Why the hook sits on the RESOURCE and not on the config service\n *\n * `AuthOrganizationConfigurationService.saveSiemExportConfig` is the obvious call site and is only\n * ONE of the writers: the config is an ordinary resource, so an update also lands through\n * `ServicesRegistryHandler.update` on `organizationSiemExportConfig` directly. Hooking the service\n * would have applied the invariant at one of two sites — the shape\n * `.claude/rules/invariant-call-site-enumeration.md` records twenty-odd times. The resource\n * operation is the chokepoint both writers pass through, because `saveSiemExportConfig` dispatches\n * its own write via `ServicesRegistryHandler`.\n *\n * ## Coverage matrix\n *\n * | Operation | Variant | Covered | Why |\n * |-----------|------------------|---------|-----|\n * | `CREATE` | `INTERNAL_CALL` | ✅ | The lazy `createAsSystem` materialisation on the userless login path, and the first real configuration. Service tier, so a postfix hook is reachable. |\n * | `UPDATE` | `INTERNAL_CALL` | ✅ | Every edit, including `saveSiemExportConfig`. Service tier. |\n * | `DELETE` | `REPOSITORY_ONLY`| ❌ | Deliberate, twice over: `doOperation` throws on `REPOSITORY_ONLY`, so the service tier where custom implementations run is unreachable BY CONSTRUCTION and a registration here would fail startup; and its only caller is the `onParentDelete` cascade, which fires when the owning organization is itself being hard-deleted — nothing dispatches audit events for a deleted tenant, so the entry is moot and TTL-expires. |\n * | `READ` | `API_CALL` | ❌ | Reads do not stale a cache. |\n *\n * **`APPLICATION_SIEM_EXPORT_CONFIG` is deliberately NOT registered.** The dispatcher's cache is\n * keyed by `organizationId` and it only ever loads the ORGANIZATION variant\n * (`loadSiemExportConfig(ec, ORGANIZATION, orgId)`), because SIEM fan-out is per authenticated\n * tenant. The APPLICATION variant is settable and inert — no producer emits app-scoped deliveries —\n * so there is no app-scoped cache entry to invalidate. When an app-scoped producer lands, it gets\n * its own cache and its own registration in the same change.\n *\n * **The framework default-seed is also not covered, and does not need to be.**\n * `organizationSiemExportConfigDefaultSeed` writes a DISABLED default at the repository tier during\n * organization creation, before the organization can have raised an audit event, so there is no\n * entry in the map to stale.\n *\n * ## What no hook on this tier can ever cover — and who relies on it today\n *\n * Repository-direct writes and raw database writes never reach the service tier, so they raise no\n * postfix hook and produce no broadcast. This is not hypothetical: `examples/wonder-todos/e2e/adapter.ts`\n * (`case 'siem'`) repoints an organization's export config with\n * `upsertOrganizationSingleton('organizationSiemExportConfig', …)`, straight at the store. Its own\n * comment records the consequence — the lane works *\"because a freshly provisioned org has a cold\n * config cache\"*, i.e. by ORDERING itself before the organization's first audited action rather than by\n * anything invalidating.\n *\n * For that class of write the LEASE is the entire guarantee, which is why\n * `SIEM_CONFIG_REFRESH_AFTER_MS` states its number, its arithmetic and its reason rather than being an\n * incidental five minutes. Do not read this file as \"engine writes are covered, the rest is someone\n * else's problem\": the two mechanisms are one guarantee, and the lease is the half that has no hook.\n */\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ResourceOperationVariantType,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport { AuditEventDispatcherBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-event-dispatcher.backend.service';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { ResourceOperation_CustomImplementation_Utils } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation-base.backend.service';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport type { ResourceConfiguration_OperationPath } from '@wildo-ai/saas-models';\n\n/** The operations whose writes can stale the dispatcher's cache. See the coverage matrix above. */\nconst INVALIDATING_OPERATIONS = [\n CoreResourceOperation.CREATE,\n CoreResourceOperation.UPDATE,\n] as const;\n\nconst INTERNAL_DEFAULT_PATH = {\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isOperationDefault: true,\n} as const;\n\ntype RowWithOrganizationId = { organizationId?: string };\n\n/**\n * Resolve the organization whose cache entry must go, with a three-tier fallback.\n *\n * 1. **The postfix result** — the persisted row. CREATE and UPDATE both return it, and it carries\n * `organizationId` (injected by the polymorphism engine), so this is the normal path.\n * 2. **`utils.currentObject`** — fetched by the framework before a non-CREATE custom impl runs.\n * Load-bearing when an implementation returns something other than the row.\n * 3. **`executionContext.organizationId`** — the scope the request runs under.\n *\n * Mirrors `resolveOrgIdsForInvalidation` in\n * `scope-features-cache-invalidation.custom-impl.backend.service.ts`; see that file for the\n * reasoning behind each tier.\n */\nfunction resolveOrganizationId(\n result: unknown,\n utils: ResourceOperation_CustomImplementation_Utils,\n executionContext: ExecutionContext<any>,\n): string | undefined {\n const fromResult =\n result != null && typeof result === 'object' && 'organizationId' in result\n ? (result as RowWithOrganizationId).organizationId\n : undefined;\n if (fromResult) return fromResult;\n\n const fromCurrent = (utils.currentObject as RowWithOrganizationId | undefined)?.organizationId;\n if (fromCurrent) return fromCurrent;\n\n return executionContext.organizationId ?? undefined;\n}\n\n/**\n * Registers the postfix invalidation on the ORGANIZATION SIEM-export-config CREATE and UPDATE.\n *\n * The handler is synchronous and cannot fail. `invalidateSiemConfig` drops a map entry and then kicks a\n * fire-and-forget Redis publish that swallows its own error — so unlike the Redis-backed feature-cache\n * equivalent, which awaits its `del`, there is still nothing here to await and no error path. That is a\n * deliberate property of `invalidateSiemConfig`, not an accident of it: a broadcast that fails leaves\n * the other replicas exactly where the lease already puts them, and refusing a configuration write to\n * protect a cache would invert the priority.\n * A `logger.warn` on an unresolvable organization id keeps the gap observable rather than silent:\n * failing the write would be the wrong trade, because refusing a config edit to protect a cache\n * inverts the priority, but a silently un-invalidated entry is the exact defect this file fixes.\n */\nexport function createSiemExportConfigCacheInvalidationFactories(): ResourceCustomServiceImplementationFactory[] {\n return INVALIDATING_OPERATIONS.map(\n (operationIdentifier) => (_rr, container) => {\n const dispatcher = container.get<AuditEventDispatcherBackendService>(\n SAAS_SERVICE_TYPES.AuditEventDispatcherService,\n );\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.ORGANIZATION_SIEM_EXPORT_CONFIG,\n operationIdentifier,\n ...INTERNAL_DEFAULT_PATH,\n },\n handlers: {\n postfixCoreOperations: async (\n _id: string | undefined,\n res: unknown,\n executionContext: ExecutionContext<any>,\n operationPath: ResourceConfiguration_OperationPath<any, any>,\n utils: ResourceOperation_CustomImplementation_Utils,\n ): Promise<unknown> => {\n const organizationId = resolveOrganizationId(res, utils, executionContext);\n if (!organizationId) {\n utils.logger.warn(\n 'Could not resolve organizationId for SIEM export config cache invalidation — the dispatcher may serve a stale config for up to its TTL',\n {\n operationIdentifier: String(operationPath.operationIdentifier),\n resourceIdentifier: operationPath.resourceIdentifier,\n rowId: _id,\n },\n );\n return res;\n }\n dispatcher.invalidateSiemConfig(organizationId);\n return res;\n },\n },\n });\n },\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"siem-webhook-delivery.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../src/compliance/audit-trails/services/siem-webhook-delivery.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AAChK,OAAO,EAAE,qCAAqC,EAAE,MAAM,+EAA+E,CAAC;AACtI,OAAO,EACL,KAAK,0BAA0B,EAU/B,aAAa,EAId,MAAM,uBAAuB,CAAC;AAiC/B,mEAAmE;AACnE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE;QACV,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACvC,QAAQ,EAAE;YACR,SAAS,EAAE,MA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AAO,CAAC,uBAAuB;IA6B/B;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAa/B;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;IACH,OAAO,CAAC,aAAa;IA0DrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;YACW,aAAa;IAuC3B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,+BAA+B;IAQvC,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,cAAc;IAwBtB;;;;OAIG;YACW,aAAa;IA0D3B;;;;;;;;;;;;;;;;;;OAkBG;YACW,uBAAuB;IAoBrC;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAOhC;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAmC1B;;;;;OAKG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAWnD;;OAEG;IACH,OAAO,CAAC,MAAM;CAGf"}
1
+ {"version":3,"file":"siem-webhook-delivery.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/compliance/audit-trails/services/siem-webhook-delivery.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,kBAAkB,CAAC;AAI1B,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,uBAAuB,EAAE,MAAM,sEAAsE,CAAC;AAC/G,OAAO,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AAChK,OAAO,EAAE,qCAAqC,EAAE,MAAM,+EAA+E,CAAC;AACtI,OAAO,EACL,KAAK,0BAA0B,EAU/B,aAAa,EAId,MAAM,uBAAuB,CAAC;AAiC/B,mEAAmE;AACnE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,0BAA0B,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CA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AAC,aAAa;IA4BrB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,yBAAyB;IA4DjC;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAmBvB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,wBAAwB;IAQhC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,sBAAsB;IAS9B;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;IAczB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,SAAS;IASjB;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,uBAAuB;IA6B/B;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAa/B;;;;;;;;;OASG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;IACH,OAAO,CAAC,aAAa;IA0DrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;YACW,aAAa;IAuC3B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,+BAA+B;IAQvC,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,cAAc;IAwBtB;;;;OAIG;YACW,aAAa;IA0D3B;;;;;;;;;;;;;;;;;;OAkBG;YACW,uBAAuB;IAoBrC;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAOhC;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAmC1B;;;;;OAKG;IACI,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAWnD;;OAEG;IACH,OAAO,CAAC,MAAM;CAGf"}
@@ -1 +1 @@
1
- {"version":3,"file":"siem-webhook-delivery.backend.service.js","sourceRoot":"","sources":["../../../../../../src/compliance/audit-trails/services/siem-webhook-delivery.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,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","sourcesContent":["/**\n * SIEM Webhook Delivery Backend Service\n *\n * Layer 3 of the three-layer audit event pipeline (Step 18).\n * Purpose-built for delivering security audit events to customer SIEM endpoints.\n * NOT a generic M2M webhook sender.\n *\n * Responsibilities:\n * - HTTP POST to webhook URL with configured auth\n * - HMAC-SHA256 signature for hmac_sha256 auth method\n * - Exponential backoff retries\n * - Circuit breaker after N consecutive failures per org\n * - CEF/LEEF format conversion (when eventFormat !== json_structured)\n * - Idempotency via eventId\n */\n\nimport 'reflect-metadata';\nimport { inject, injectable } from 'inversify';\nimport { createHmac, createHash, createCipheriv, createDecipheriv, randomBytes } from 'crypto';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { AuditEventDispatcherBackendService } from './audit-event-dispatcher.backend.service';\nimport { RepositoriesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/repositories/repositories-registry-handler.backend.service';\nimport { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport {\n type SecurityAuditEventEnvelope,\n type SiemExportConfigBase,\n type ResourceType,\n CoreResourceType,\n CoreResourceOperation,\n CORE_APP_ROLES,\n ResourcePrimaryScope,\n WildoHeaderKeys,\n SiemDeliveryDlqStatus,\n SIEMEventFormat,\n AuthScopeType,\n coreResourceShared_FieldIdentifier,\n SIEM_DELIVERY_RELIABILITY_CONTRACT,\n SIEM_CIRCUIT_BREAKER_COOLDOWN_MS,\n} from '@wildo-ai/saas-models';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport {\n CEF_PROJECTION,\n LEEF_PROJECTION,\n cefAgentSeverityHeaderValue,\n SiemFieldProjectionKind,\n type SiemProjectionContext,\n type SiemProjectionContract,\n} from './utils/siem-projection-contract.backend.utils';\nimport { buildOcsfEvent } from './utils/siem-ocsf-projection.backend.utils';\nimport {\n CEF_HEADER_MAX_CHARACTERS,\n CEF_MAX_CHARACTERS,\n LEEF_HEADER_MAX_CHARACTERS,\n LEEF_MAX_CHARACTERS,\n LEEF_TAB_DELIMITER_HEADER_VALUE,\n type CefWireKey,\n type LeefWireKey,\n} from './utils/siem-dictionary.backend.utils';\nimport {\n describeCaughtError,\n projectCaughtErrorLogFields,\n} from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { pinnedOutboundFetch } from '~wildo-backend-lib/security/ssrf/pinned-outbound-fetch.backend.utils';\n\n/** Circuit breaker state per organization */\ninterface CircuitBreakerState {\n consecutiveFailures: number;\n lastFailureAt: Date | null;\n circuitOpenUntil: Date | null;\n}\n\n/** Payload shape enqueued by AuditEventDispatcherBackendService */\nexport interface SIEMDeliveryJobPayload {\n envelope: SecurityAuditEventEnvelope;\n envelopeHmac?: string; // F6: HMAC integrity signature\n organizationId: string;\n /**\n * Delivery scope. Defaults to {@link AuthScopeType.ORGANIZATION}. The worker is scope-generic (the\n * circuit-breaker key, DLQ variant, and scope FK all derive from it), but `'application'`\n * is currently produced ONLY by the SIEM-DLQ retry custom-impl — there is no first-time\n * app-scoped producer, so the APPLICATION path is reserved / dormant. See\n * `AuditEventDispatcherBackendService.dispatchToOrganizationAuditSinks`.\n */\n scopeType?: AuthScopeType;\n scopeId?: string;\n siemConfig: {\n webhookUrl: string;\n authMethod: string;\n authCredential?: string;\n authHeaderName?: string;\n eventFormat: string;\n customHeaders?: Record<string, string>;\n delivery: {\n batchSize: number;\n batchWindowSeconds: number;\n retryAttempts: number;\n retryBackoffSeconds: number;\n timeoutSeconds: number;\n };\n };\n}\n\n/**\n * Circuit-breaker bounds come from `SIEM_DELIVERY_RELIABILITY_CONTRACT`, which the customer\n * documentation also projects: what an operator is told about a paused destination is what this\n * service applies.\n */\nconst CIRCUIT_BREAKER_THRESHOLD = SIEM_DELIVERY_RELIABILITY_CONTRACT.circuitBreakerFailureThreshold;\nconst CIRCUIT_BREAKER_COOLDOWN_MS = SIEM_CIRCUIT_BREAKER_COOLDOWN_MS;\n/** Prefix for encrypted credentials (H6) */\nconst ENCRYPTED_CREDENTIAL_PREFIX = 'encrypted:aes-256-gcm:';\n/** HKDF-like domain separator for SIEM encryption key derivation */\nconst SIEM_KEY_DOMAIN = 'wildo:siem:credential:v1';\n/**\n * Appended when the `eventData` detail bag is truncated, so the loss is VISIBLE to the receiver\n * rather than silent. A SOC that sees a JSON fragment ending mid-object cannot tell a truncation\n * from a serializer bug; this marker makes the difference explicit on the wire.\n */\nconst SIEM_EVENT_DATA_TRUNCATION_MARKER = '...[truncated]';\n/**\n * Maximum characters of serialized `eventData` carried in the single CEF/LEEF detail field,\n * INCLUDING {@link SIEM_EVENT_DATA_TRUNCATION_MARKER} when truncation occurs — the emitted value\n * never exceeds this bound.\n *\n * This is the CEF extension dictionary's own published length for `msg`, not a Wildo-invented\n * policy. LEEF publishes no per-attribute ceiling, so the same bound is applied there for\n * cross-format consistency: an unbounded detail bag is the realistic way a CEF/LEEF line grows\n * large enough for a receiver to reject it, which would fail the delivery into the DLQ.\n *\n * spec-cite: Implementing ArcSight CEF v26, Oct 2023 — ArcSight Extension Dictionary, \"CEF Key\n * Names for Event Producers\", `msg` row: full name `message`, data type `String`, length `1023`,\n * \"An arbitrary message giving more details about the event.\"\n *\n * The bound is applied to the ESCAPED value, i.e. to what actually goes on the wire. An earlier\n * revision bounded the value BEFORE escaping, on the reading that the ceiling describes the field's\n * CONTENT and escape sequences are transport encoding a receiver strips before it ever sees the\n * field. That reading is defensible and the document does not settle it — which is precisely why the\n * post-escape bound is the one to hold: escaping only ever expands (`=` → `\\=`, `\\` → `\\\\`), so a\n * value within the ceiling once encoded is necessarily within it once decoded. Bounding the encoded\n * form satisfies BOTH readings; bounding the decoded form satisfies only one, and an escape-heavy\n * bag sitting at the ceiling would have gone out over-long under the other.\n */\nconst SIEM_EVENT_DATA_DETAIL_MAX_CHARS = 1023;\n\n// The per-key ceilings and the `devTimeFormat` pattern used to live here as hand-kept constants\n// beside the formatter. They now live in the dictionary spine (`siem-dictionary.backend.utils.ts`),\n// DERIVED from the transcribed rows, because a ceiling maintained next to a key list is the same\n// artefact as the key list itself: adding a key and forgetting its published maximum was possible\n// right up until the derivation existed.\n//\n// Line comments, not a JSDoc block — a `/** */` here would attach to the class below it.\n\n@injectable()\nexport class SIEMWebhookDeliveryBackendService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private readonly circuitBreakers: Map<string, CircuitBreakerState> = new Map();\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.AuditEventDispatcherService) private readonly auditEventDispatcher: AuditEventDispatcherBackendService,\n @inject(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService) private readonly repositoriesRegistry: RepositoriesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n ) {\n this.logDebug = this.logger.debugByType('SIEMWebhookDeliveryBackendService');\n this.logger.setDebugTypeLogging('SIEMWebhookDeliveryBackendService', false);\n }\n\n /**\n * Process a SIEM delivery job from the queue.\n * Called by the job consumer when a `siem.webhook-delivery` batch job is dequeued.\n */\n public async processDelivery(payload: SIEMDeliveryJobPayload): Promise<void> {\n const { envelope, envelopeHmac, organizationId, siemConfig } = payload;\n const scopeType = payload.scopeType ?? AuthScopeType.ORGANIZATION;\n const scopeId = payload.scopeId ?? organizationId;\n const circuitKey = `${scopeType}:${scopeId}`;\n\n // F6: Verify envelope integrity before processing\n if (envelopeHmac) {\n if (!this.auditEventDispatcher.verifyEnvelopeHmac(envelope, envelopeHmac)) {\n this.logger.error?.('SIEM envelope HMAC verification failed — possible tampering', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n });\n await this._enqueueToDLQ(payload, 'hmac_verification_failed');\n return;\n }\n }\n\n // Circuit breaker check — M11: DLQ instead of silent drop\n if (this._isCircuitOpen(circuitKey)) {\n this.logDebug('Circuit breaker open for scope, sending to DLQ', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n });\n await this._enqueueToDLQ(payload, 'circuit_breaker_open');\n return;\n }\n\n // Format the body\n const body = this._formatBody(envelope, siemConfig.eventFormat);\n\n // Build headers\n const headers = this._buildHeaders(body, siemConfig);\n\n // Attempt delivery with retries\n const maxRetries = siemConfig.delivery.retryAttempts;\n const baseBackoffMs = siemConfig.delivery.retryBackoffSeconds * 1000;\n const timeoutMs = siemConfig.delivery.timeoutSeconds * 1000;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n await this._sendHttpPost(siemConfig.webhookUrl, body, headers, timeoutMs);\n\n this._recordSuccess(circuitKey);\n\n this.logDebug('SIEM webhook delivered successfully', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n attempt,\n });\n return;\n } catch (error) {\n const isLastAttempt = attempt === maxRetries;\n\n if (isLastAttempt) {\n this._recordFailure(circuitKey);\n\n this.logger.error?.('SIEM webhook delivery failed after all retries', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n attempts: attempt + 1,\n ...projectCaughtErrorLogFields(error),\n });\n\n // `describeCaughtError`, not an `instanceof Error` ternary: this string is\n // PERSISTED as the DLQ record's failure reason, and a `WildoError_Backend`\n // is a plain object — the ternary would store `'[object Object]'` for every\n // structured fault, making the DLQ untriageable.\n await this._enqueueToDLQ(payload, 'retries_exhausted', describeCaughtError(error));\n } else {\n const backoffMs = baseBackoffMs * Math.pow(2, attempt);\n this.logDebug('SIEM webhook delivery failed, retrying', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n attempt,\n nextRetryMs: backoffMs,\n });\n await this._sleep(backoffMs);\n }\n }\n }\n }\n\n /**\n * Format the event body based on the configured event format.\n *\n * `json_structured` ships the envelope verbatim. CEF and LEEF are flat, single-line `key=value`\n * grammars, so they project the envelope in two tiers: the standard/indexed keys each grammar\n * defines (`cat`, `outcome`, `src`, …), followed by the free-form `eventData` bag serialized\n * into that grammar's single detail field. Every envelope field therefore reaches all three\n * formats; only the ENCODING differs.\n */\n private _formatBody(envelope: SecurityAuditEventEnvelope, eventFormat: string): string {\n switch (eventFormat) {\n case SIEMEventFormat.CEF:\n return this._formatAsCEF(envelope);\n case SIEMEventFormat.LEEF:\n return this._formatAsLEEF(envelope);\n case SIEMEventFormat.OCSF:\n // OCSF is JSON, so there is no escaping/bounding layer here — the projection returns a\n // document and the only transport concern is serialisation.\n return JSON.stringify(buildOcsfEvent(envelope));\n case SIEMEventFormat.JSON_STRUCTURED:\n default:\n return JSON.stringify(envelope);\n }\n }\n\n /**\n * Format event as CEF (Common Event Format).\n * CEF:Version|Device Vendor|Device Product|Device Version|Signature ID|Name|Severity|Extension\n */\n private _formatAsCEF(envelope: SecurityAuditEventEnvelope): string {\n const cefSeverity = cefAgentSeverityHeaderValue(envelope.severity);\n const ext = (value: string): string => this._escapeCEFExtensionValue(value);\n const header = (field: string, value: string): string => this._emitBoundedHeaderField(field, value, CEF_HEADER_MAX_CHARACTERS);\n const eventDataDetail = this._serializeEventDataDetail(envelope, ext);\n // CEF extensions are SPACE-delimited, so that is what `join` means for this grammar.\n const pair = (key: CefWireKey, value: string): string => this._emitPair(key, value, ext, CEF_MAX_CHARACTERS);\n const join = (...fragments: readonly string[]): string => fragments.join(' ');\n\n // Driven by CEF_PROJECTION, so a field cannot be dropped by being forgotten — the contract is\n // exhaustive over the envelope type and declaration order is wire order. The per-field reasoning,\n // citations and the csN-budget decision all live there, next to the mapping they justify.\n const extensions = this._renderProjection(CEF_PROJECTION, envelope, { pair, join, eventDataDetail })\n .join(' ');\n\n // Header fields 5 and 6 are DIFFERENT questions and used to receive the same answer. Field 5,\n // `Device Event Class ID`, is the stable signature a QID/correlation rule keys on — `eventType` is\n // exactly that. Field 6, `Name`, is documented as \"a human-readable and understandable description\n // of the event\", so `user_account_locked` twice gave a SOC a machine token in the column its\n // console renders as the event title.\n // spec-cite: Implementing ArcSight CEF v26, Oct 2023 — \"Header Field Definitions\", `deviceEventClassId`\n // row (\"a unique identifier for each event-type … also known as Signature ID\") and `name` row\n // (String, 512): \"a string representing a human-readable and understandable description of the event.\"\n return `CEF:0|${header('deviceVendor', 'Wildo')}|${header('deviceProduct', 'SecurityAudit')}|${header('deviceVersion', envelope.sourceVersion)}|${header('deviceEventClassId', envelope.eventType)}|${header('name', this._humanizeEventType(envelope.eventType))}|${cefSeverity}|${extensions}`;\n }\n\n /**\n * Format event as LEEF (Log Event Extended Format — IBM QRadar).\n * LEEF:Version|Vendor|Product|Version|EventID|Extension\n *\n * The serialized `eventData` bag rides a custom `eventData` attribute. It is deliberately NOT\n * called `msg` as in the CEF projection: `msg` earns that name in CEF by being a dictionary key\n * with a defined meaning, whereas LEEF publishes no such key — borrowing CEF's vocabulary here\n * would imply a standard attribute that does not exist. Each grammar gets the name that is\n * correct within it.\n * spec-cite: N/A — `eventData` is a Wildo-chosen custom attribute name, not a LEEF-defined key.\n */\n private _formatAsLEEF(envelope: SecurityAuditEventEnvelope): string {\n const val = (value: string): string => this._escapeLEEFValue(value);\n const header = (field: string, value: string): string => this._emitBoundedHeaderField(field, value, LEEF_HEADER_MAX_CHARACTERS);\n const eventDataDetail = this._serializeEventDataDetail(envelope, val);\n // LEEF attributes are TAB-delimited (we emit no `DelimiterCharacter`), so that is `join` here.\n const pair = (key: LeefWireKey, value: string): string => this._emitPair(key, value, val, LEEF_MAX_CHARACTERS);\n const join = (...fragments: readonly string[]): string => fragments.join('\\t');\n\n // Driven by LEEF_PROJECTION. LEEF reaches ALL 27 envelope fields because a LEEF custom key stays\n // searchable in QRadar, where a CEF custom extension does not — see the contract for the citation.\n //\n // `sev`, `devTime` and `devTimeFormat` are rendered BY the contract now. They used to be appended\n // here, which looked like a formatter detail and was a hole: a key emitted outside `pair` skips\n // its published ceiling, the duplicate-key check, and the declared-vs-emitted test — and `sev`\n // is precisely a key with a published constraint (`1-10`).\n const extensions = this._renderProjection(LEEF_PROJECTION, envelope, { pair, join, eventDataDetail })\n .join('\\t');\n\n // Six header fields, not five. The sixth is the attribute DelimiterCharacter, which every\n // LEEF 2.0 example in the guide carries and ours omitted — see LEEF_TAB_DELIMITER_HEADER_VALUE:\n // a parser splitting a 2.0 header into six fields was consuming our first attribute as it.\n // Vendor and Product go through `header()` too, though they are constants that need neither\n // escaping nor bounding. The point is that EVERY header field goes through the one door, so\n // \"is this field covered?\" is answerable by looking rather than by reasoning about each value —\n // the same reason `rt` was routed through `pair` even though digits never change.\n return `LEEF:2.0|${header('vendor', 'Wildo')}|${header('product', 'SecurityAudit')}|${header('productVersion', envelope.sourceVersion)}|${header('eventId', envelope.eventType)}|${LEEF_TAB_DELIMITER_HEADER_VALUE}|${extensions}`;\n }\n\n /**\n * Serialize `envelope.eventData` into the single detail field that CEF (`msg`) and LEEF\n * (`eventData`) each carry, or `undefined` when there is nothing worth saying — the caller's\n * `.filter(Boolean)` then drops the key entirely instead of emitting an empty one.\n *\n * Without this, CEF/LEEF subscribers received ONLY the curated standard keys while\n * `json_structured` subscribers received the whole bag: a silent capability gap between\n * formats, not a deliberate reduction.\n *\n * REJECTED ALTERNATIVE — flattening each `eventData` entry into its own extension key\n * (`lockoutDuration=15`, `sessionId=…`). It reads better as SIEM columns, but it is unsound\n * here. `eventData` is an OPEN, app-extensible bag whose keys routinely collide both with the\n * CEF/LEEF dictionaries and with the envelope fields already projected above it: the\n * `USER_LOGIN_FAILED` bag alone carries `failureReason`, `ipAddress` and `email`, which the\n * dispatcher has already promoted onto the envelope and which this formatter already emits as\n * `reason`, `src` and `suser`. Flattening would therefore put `src=` on the line TWICE and leave\n * which one wins to the receiver's parser. Nested objects and arrays have no flat\n * representation either. One JSON field keeps the standard keys authoritative AND the bag\n * lossless, at the cost of a second parse step on the receiving end.\n *\n * The returned JSON is escaped by the CALLER for its grammar, so a backslash ends up encoded\n * twice — once by `JSON.stringify`, once by the CEF/LEEF escaper. That is correct and\n * required: a receiver un-escapes the wire grammar first, then parses the JSON.\n */\n private _serializeEventDataDetail(\n envelope: SecurityAuditEventEnvelope,\n escapeForGrammar: (value: string) => string,\n ): string | undefined {\n // Defensive: the envelope TYPE requires `eventData`, but this formatter also runs over\n // envelopes replayed from the DLQ, where a stored bag can be absent or malformed. An\n // unguarded `Object.keys(undefined)` here would throw inside delivery.\n const eventData: unknown = envelope.eventData;\n if (!eventData || typeof eventData !== 'object' || Object.keys(eventData).length === 0) {\n return undefined;\n }\n\n let serialized: string;\n try {\n serialized = JSON.stringify(eventData);\n } catch {\n // A circular / unserializable bag must not fail the whole delivery — the standard keys\n // above it are still valuable to a SOC, so drop only the detail field.\n this.logDebug('SIEM eventData detail omitted — bag is not JSON-serializable', {\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n });\n return undefined;\n }\n\n // `JSON.stringify` returns `undefined` for a value it cannot represent at all; the guard\n // above makes that unreachable for a non-empty plain object, but a `toJSON()` returning\n // `undefined` would still land here.\n if (!serialized) return undefined;\n\n if (escapeForGrammar(serialized).length <= SIEM_EVENT_DATA_DETAIL_MAX_CHARS) return serialized;\n\n // Largest prefix whose ESCAPED form, marker included, still fits. A prefix length cannot be\n // computed arithmetically because expansion depends on which characters the prefix contains,\n // and it is not uniform across the two grammars (CEF escapes `=`, LEEF does not). Binary search\n // costs O(log n) escape passes and is exact; a fixed safety margin would be a guess that is\n // simultaneously too small for a delimiter-dense bag and wasteful for an ordinary one.\n let fits = 0;\n let tooLong = serialized.length;\n while (fits < tooLong) {\n const candidate = Math.ceil((fits + tooLong) / 2);\n if (escapeForGrammar(this._truncateDetail(serialized, candidate)).length <= SIEM_EVENT_DATA_DETAIL_MAX_CHARS) {\n fits = candidate;\n } else {\n tooLong = candidate - 1;\n }\n }\n const truncated = this._truncateDetail(serialized, fits);\n\n this.logDebug('SIEM eventData detail truncated to the CEF/LEEF detail-field ceiling', {\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n originalLength: serialized.length,\n emittedLength: truncated.length,\n escapedLength: escapeForGrammar(truncated).length,\n maxChars: SIEM_EVENT_DATA_DETAIL_MAX_CHARS,\n });\n return truncated;\n }\n\n /**\n * Cut `serialized` to `length` UTF-16 units and append the truncation marker.\n *\n * The marker is counted INSIDE the ceiling by the caller's search, not appended beyond it — a\n * bound that its own truncation overshoots is not a bound. A cut landing between the halves of a\n * surrogate pair would emit a lone surrogate, which `JSON.parse` on the receiving end rejects with\n * a different error than the truncation it actually is, so the trailing half-pair is dropped.\n */\n private _truncateDetail(serialized: string, length: number): string {\n const cut = serialized.slice(0, length);\n const last = cut.charCodeAt(cut.length - 1);\n const endsOnHighSurrogate = last >= 0xd800 && last <= 0xdbff;\n return `${endsOnHighSurrogate ? cut.slice(0, -1) : cut}${SIEM_EVENT_DATA_TRUNCATION_MARKER}`;\n }\n\n // ─────────────────────────────────────────────────────────────\n // Wire-format escaping\n //\n // CEF and LEEF are single-line, delimiter-separated grammars with NO quoting construct: a\n // delimiter appearing raw inside a value does not produce a malformed record that a parser\n // rejects — it produces a WELL-FORMED record with silently wrong fields. That failure mode is\n // why these helpers exist and why EVERY interpolated string value goes through one of them\n // rather than only the fields believed to be risky today. `outcomeReason` in particular is free\n // text sourced from `eventData.failureReason` / `eventData.reason`, so it is the first projected\n // field with no vocabulary constraining its characters.\n // ─────────────────────────────────────────────────────────────\n\n /**\n * Escape a value for a CEF *extension* (`key=value`) slot.\n *\n * The extension is a space-separated `key=value` list whose parser delimits on the next\n * `<key>=`, so per the CEF standard:\n * - `\\` becomes `\\\\` — it is the escape character itself, which is why it MUST be replaced\n * first; doing it later would re-escape the backslashes introduced by the rules below.\n * - `=` becomes `\\=` — an unescaped `=` is read as the start of the next key/value pair.\n * - CR/LF become the two-character sequences `\\r` / `\\n` — a real newline terminates the\n * record and truncates every remaining field.\n *\n * Spaces are deliberately NOT escaped: the grammar permits them inside extension values (a\n * value is delimited by the next `<key>=`, not by whitespace).\n * spec-cite: Implementing ArcSight CEF v26, Oct 2023 — \"Character Encoding\" / the extension\n * escaping rules for pipe, backslash and equals in the Extension field.\n */\n private _escapeCEFExtensionValue(value: string): string {\n return value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/=/g, '\\\\=')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\n/g, '\\\\n');\n }\n\n /**\n * Escape a value for a LEEF attribute slot.\n *\n * LEEF pairs are TAB-delimited, so a literal tab fabricates an extra attribute and a newline\n * terminates the record; both are encoded as their escape sequences (`\\` first, for the same\n * reason as above). `=` needs NO escaping here — a LEEF parser splits each pair on its FIRST\n * `=`, so subsequent `=` characters remain part of the value.\n * spec-cite: N/A — LEEF publishes no escaping table for attribute values; these rules are\n * derived from its tab-delimited, newline-terminated record structure, which is why the `=`\n * asymmetry with CEF above is deliberate rather than an oversight.\n */\n private _escapeLEEFValue(value: string): string {\n // ⚠️ `|` and `^` are deliberately NOT escaped, and the reasoning is the point rather than the\n // conclusion. The guide's best practices say to AVOID them in keys and values — it defines no\n // escape for them, because LEEF 2.0's answer is the header's `DelimiterCharacter`, which lets a\n // producer CHOOSE the attribute delimiter (caret is a documented choice). Inventing `\\|` would\n // therefore corrupt the value at every conformant receiver, which is strictly worse than the\n // mis-parse it guards against — and that mis-parse needs a non-conformant parser splitting the\n // whole line on `|`, since the header ends at its fifth. We emit no `DelimiterCharacter`, so the\n // delimiter is TAB and a caret in a value is inert. If a `DelimiterCharacter` is ever emitted,\n // THAT character becomes escapable-or-forbidden and this decision must be re-taken.\n // spec-cite: IBM QRadar LEEF Version 2 (© IBM 2013, 2016) — \"Best practices Guidelines for LEEF\n // events\": \"Use alphanumeric (A-Z, a-z, and 0-9) characters, but avoid tab, pipe, or caret\n // delimiters in your event payload keys and values\"; Table 2, `Delimiter Character` row.\n return value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\n/g, '\\\\n');\n }\n\n /**\n * Escape a value for a CEF or LEEF *header* slot (the `|`-delimited prefix shared by both\n * grammars).\n *\n * A literal `|` would fabricate a header field and shift every subsequent one — including the\n * severity and the entire extension — so it is escaped as `\\|`. Headers cannot span lines at\n * all (there is no multi-line encoding for them, unlike extension values), so newlines are\n * folded to a space rather than escaped.\n *\n * Applied defensively: `sourceVersion` is read straight from the `APP_VERSION` environment\n * variable and `eventType` is app-extensible, so neither is guaranteed delimiter-free.\n */\n private _escapeSIEMHeaderField(value: string): string {\n return value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\|/g, '\\\\|')\n // Any CR or LF, in any combination — not just `\\r?\\n`. A LONE `\\r` slipped through that form,\n // and a bare CR terminates a record for readers that treat it as a line ending.\n .replace(/[\\r\\n]+/g, ' ');\n }\n\n /**\n * Render a projection contract into its emitted fragments, in declaration order.\n *\n * Only `extension` entries produce wire output. `header` entries are carried by the caller's header\n * construction and `not-projected` entries deliberately produce nothing — both exist in the contract\n * so that COVERAGE is a property of the type rather than of anyone's memory.\n */\n private _renderProjection<K extends string>(\n contract: SiemProjectionContract<SecurityAuditEventEnvelope, K>,\n envelope: SecurityAuditEventEnvelope,\n context: SiemProjectionContext<K>,\n ): string[] {\n const fragments: string[] = [];\n for (const projection of Object.values(contract)) {\n if (projection.kind !== SiemFieldProjectionKind.EXTENSION) continue;\n const fragment = projection.render(envelope, context);\n if (fragment) fragments.push(fragment);\n }\n return fragments;\n }\n\n /**\n * Emit one `key=value` pair, escaped for its grammar and bounded by the key's PUBLISHED ceiling.\n *\n * The bound is measured on the ESCAPED value for the same reason as the detail bag: escaping only\n * expands, so bounding the encoded form is the only bound that holds under both readings of what a\n * published length governs. A key absent from `maxByKey` has no published limit and is emitted\n * whole — the table never invents one.\n *\n * Truncation is LOUD. Losing the tail of an id or an email is a data defect, not a formatting\n * detail, and the receiver cannot tell a truncated value from a short one.\n */\n private _emitPair<K extends string>(\n key: K,\n rawValue: string,\n escapeForGrammar: (value: string) => string,\n maxByKey: Readonly<Record<string, number>>,\n ): string {\n return `${key}=${this._boundToPublishedLength(key, rawValue, escapeForGrammar, maxByKey[key])}`;\n }\n\n /**\n * Escape a value and bound the ESCAPED result at its published ceiling, or emit it whole when the\n * document publishes none.\n *\n * Shared by the extension path ({@link _emitPair}) and the header path\n * ({@link _emitBoundedHeaderField}) because both answer the same question and only one of them used\n * to. Header fields never passed through `_emitPair`, so every published header size — most\n * pointedly `deviceVersion`'s 31 characters, which carries `APP_VERSION` — was unenforced while the\n * extension ceilings were being carefully derived from the dictionary one layer away. Two code\n * paths for one rule is how that happened; there is one now.\n *\n * The bound is measured on the escaped form for the reason given at\n * {@link SIEM_EVENT_DATA_DETAIL_MAX_CHARS}: escaping only expands, so a value within the ceiling\n * once encoded is within it once decoded, which satisfies both readings of what a published length\n * governs. Truncation is LOUD — losing the tail of a version or an id is a data defect, and the\n * receiver cannot tell a truncated value from a short one.\n */\n private _boundToPublishedLength(\n fieldName: string,\n rawValue: string,\n escapeForGrammar: (value: string) => string,\n max: number | undefined,\n ): string {\n const escaped = escapeForGrammar(rawValue);\n if (max === undefined || escaped.length <= max) return escaped;\n\n let fits = 0;\n let tooLong = rawValue.length;\n while (fits < tooLong) {\n const candidate = Math.ceil((fits + tooLong) / 2);\n if (escapeForGrammar(rawValue.slice(0, candidate)).length <= max) fits = candidate;\n else tooLong = candidate - 1;\n }\n const cut = rawValue.slice(0, fits);\n const lastCode = cut.charCodeAt(cut.length - 1);\n const kept = lastCode >= 0xd800 && lastCode <= 0xdbff ? cut.slice(0, -1) : cut;\n\n this.logger.warn?.('SIEM field truncated to its published ceiling', {\n key: fieldName,\n maxChars: max,\n originalLength: rawValue.length,\n emittedLength: kept.length,\n });\n return escapeForGrammar(kept);\n }\n\n /**\n * Emit one `|`-delimited header field, escaped for the shared header grammar and bounded by the\n * size its document publishes for THAT slot.\n *\n * A header field cannot be dropped when it misbehaves — an omitted field shifts every field after\n * it and silently re-interprets the whole record — so the only available degradation is truncation.\n */\n private _emitBoundedHeaderField(\n fieldName: string,\n rawValue: string,\n maxByField: Readonly<Record<string, number>>,\n ): string {\n return this._boundToPublishedLength(\n fieldName,\n rawValue,\n (value) => this._escapeSIEMHeaderField(value),\n maxByField[fieldName],\n );\n }\n\n /**\n * `user_account_locked` → `User account locked`, for CEF's human-readable `Name` header field.\n *\n * Derived rather than authored: the envelope carries no display label, and inventing a lookup table\n * would be a second vocabulary to keep in sync with `CoreAuditableEventType` — the drift shape this\n * codebase keeps paying for. A derivation cannot go stale.\n *\n * Deliberately NOT applied to `Device Event Class ID`, which must stay the machine token: a\n * correlation rule keyed on a prettified string would break the moment the prettifier changed.\n */\n private _humanizeEventType(eventType: string): string {\n const words = eventType.replace(/[_-]+/g, ' ').trim();\n return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : eventType;\n }\n\n /**\n * Build HTTP headers for the SIEM webhook request.\n */\n private _buildHeaders(\n body: string,\n siemConfig: SIEMDeliveryJobPayload['siemConfig'],\n ): Record<string, string> {\n const headers: Record<string, string> = {\n // Second reader of `eventFormat` in this file (the first is `_formatBody`). Both route\n // through the SIEMEventFormat vocabulary so a future format value cannot be added to the\n // switch and silently forgotten here, where the wrong Content-Type makes a receiver reject\n // an otherwise well-formed body.\n // OCSF is JSON too, so the test is \"is this a TEXT grammar\", not \"is it json_structured\".\n // Reading it the other way would have shipped OCSF as `text/plain` — a well-formed body a\n // receiver may refuse to parse, which is this workstream's signature failure shape.\n [WildoHeaderKeys.CONTENT_TYPE]: siemConfig.eventFormat === SIEMEventFormat.CEF || siemConfig.eventFormat === SIEMEventFormat.LEEF\n ? 'text/plain'\n : 'application/json',\n };\n\n // Apply custom headers first (auth headers override if needed)\n if (siemConfig.customHeaders) {\n Object.assign(headers, siemConfig.customHeaders);\n }\n\n // H6: Resolve (decrypt) the credential before use\n const resolvedCredential = this._resolveCredential(siemConfig.authCredential);\n\n // Apply auth method\n switch (siemConfig.authMethod) {\n case 'bearer_token':\n if (resolvedCredential) {\n headers[WildoHeaderKeys.AUTHORIZATION] = `Bearer ${resolvedCredential}`;\n }\n break;\n\n case 'api_key_header': {\n const headerName = siemConfig.authHeaderName || WildoHeaderKeys.API_KEY;\n if (resolvedCredential) {\n headers[headerName] = resolvedCredential;\n }\n break;\n }\n\n case 'hmac_sha256':\n if (resolvedCredential) {\n const hmac = createHmac('sha256', resolvedCredential)\n .update(body)\n .digest('hex');\n headers[WildoHeaderKeys.X_SIGNATURE_256] = `sha256=${hmac}`;\n }\n break;\n\n case 'none':\n default:\n break;\n }\n\n return headers;\n }\n\n /**\n * Send HTTP POST to the SIEM webhook endpoint.\n *\n * ## Why this is not a plain `fetch`\n *\n * `webhookUrl` is TENANT-authored: an organization administrator types it, and this worker POSTs\n * to it holding the deployment's own network position. That is the fifth of the five outbound\n * target classes `security/ssrf/outbound-target-guard.backend.utils.ts` was written for — its\n * header names \"SIEM collectors\" explicitly — and it was the one class that never called it. A\n * `webhookUrl` of `http://169.254.169.254/latest/meta-data/iam/security-credentials/` was\n * delivered to, with the tenant's own auth headers attached, and the response body came back\n * inside the thrown error's message.\n *\n * {@link pinnedOutboundFetch} closes three separate holes here, not one:\n *\n * 1. **No classification at all.** The shape check now refuses a literal internal address and a\n * reserved special-use hostname before anything leaves the process.\n * 2. **Check-then-connect.** The address is classified inside the connection's `lookup` hook, so a\n * name that answers public to a validator and private to the socket never gets one.\n * 3. **Redirects.** The old call omitted `redirect: 'error'`, so even a perfect check would have\n * been walked past by a collector answering `302 Location: http://169.254.169.254/`. This\n * client cannot follow a redirect at all — a 302 arrives as a 302 and fails the `ok` test\n * below, landing in the retry/DLQ path like any other bad response.\n *\n * ## The behaviour change, stated rather than discovered\n *\n * A collector that today answers a redirect stops being followed and starts failing. That is\n * deliberate: a redirect is precisely how the guard is bypassed, and a SIEM endpoint that needs\n * one should be reconfigured to its final address. A collector on a PRIVATE network keeps working\n * only when the operator has declared\n * `auditTrail.allowPrivateNetworkSiemCollectors` — see {@link _admitsPrivateNetworkCollectors}.\n */\n private async _sendHttpPost(\n url: string,\n body: string,\n headers: Record<string, string>,\n timeoutMs: number,\n ): Promise<void> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeoutMs);\n\n try {\n const response = await pinnedOutboundFetch(url, {\n method: 'POST',\n headers,\n body,\n signal: controller.signal,\n /**\n * BOTH schemes, unlike CIMD's https-only policy, and the asymmetry is deliberate rather than\n * an oversight. `webhookUrl` is authored configuration that predates this guard and `http:`\n * collectors exist in the field on trusted internal networks; refusing plaintext here would\n * silently stop delivering security events for those deployments, which is a worse security\n * outcome than the transport weakness it would remove. Narrowing this to `https:` is a\n * separate, operator-visible decision with its own migration — not a side effect of adding\n * an SSRF guard.\n */\n admittedProtocols: ['https:', 'http:'],\n admitPrivateAddresses: this._admitsPrivateNetworkCollectors(),\n });\n\n if (!response.ok) {\n const responseText = await response.text().catch(() => '');\n throw new Error(\n `SIEM webhook returned HTTP ${response.status}: ${responseText.slice(0, 200)}`\n );\n }\n } finally {\n clearTimeout(timeoutId);\n }\n }\n\n /**\n * Has the DEPLOYMENT OPERATOR declared that SIEM collectors may sit on a private network?\n *\n * Read from the application configuration, never from the SIEM config row. The row is authored by\n * an organization administrator — the same party that supplies the URL — so a flag there would let\n * the attacker disarm the guard aimed at them. The operator declares the network posture; the\n * tenant chooses a destination within it.\n *\n * Absent reads as `false`. The field is deliberately un-defaulted in\n * {@link AuditTrailConfigSchema} so that an application which never authored the block gets the\n * refusing posture by doing nothing.\n */\n private _admitsPrivateNetworkCollectors(): boolean {\n return this.appConfigService.config?.auditTrail?.allowPrivateNetworkSiemCollectors === true;\n }\n\n // ─────────────────────────────────────────────────────────────\n // Circuit Breaker\n // ─────────────────────────────────────────────────────────────\n\n private _isCircuitOpen(circuitKey: string): boolean {\n const state = this.circuitBreakers.get(circuitKey);\n if (!state || !state.circuitOpenUntil) return false;\n\n if (new Date() > state.circuitOpenUntil) {\n state.circuitOpenUntil = null;\n return false;\n }\n\n return true;\n }\n\n private _recordSuccess(circuitKey: string): void {\n this.circuitBreakers.delete(circuitKey);\n }\n\n private _recordFailure(circuitKey: string): void {\n let state = this.circuitBreakers.get(circuitKey);\n if (!state) {\n state = { consecutiveFailures: 0, lastFailureAt: null, circuitOpenUntil: null };\n this.circuitBreakers.set(circuitKey, state);\n }\n\n state.consecutiveFailures++;\n state.lastFailureAt = new Date();\n\n if (state.consecutiveFailures >= CIRCUIT_BREAKER_THRESHOLD) {\n state.circuitOpenUntil = new Date(Date.now() + CIRCUIT_BREAKER_COOLDOWN_MS);\n this.logger.warn('SIEM circuit breaker opened', {\n circuitKey,\n consecutiveFailures: state.consecutiveFailures,\n cooldownMs: CIRCUIT_BREAKER_COOLDOWN_MS,\n });\n }\n }\n\n // ─────────────────────────────────────────────────────────────\n // M11: Dead Letter Queue\n // ─────────────────────────────────────────────────────────────\n\n /**\n * Persist failed SIEM delivery events to a MongoDB-backed DLQ resource\n * instead of silently dropping them. DLQ entries conform to SiemDeliveryDlqBase\n * and are queryable/retryable through the standard resource engine.\n */\n private async _enqueueToDLQ(\n payload: SIEMDeliveryJobPayload,\n failureReason: string,\n errorMessage?: string,\n ): Promise<void> {\n const scopeType = payload.scopeType ?? AuthScopeType.ORGANIZATION;\n const scopeId = payload.scopeId ?? payload.organizationId;\n try {\n const dlqResourceType = scopeType === AuthScopeType.APPLICATION\n ? CoreResourceType.APPLICATION_SIEM_DELIVERY_DLQ\n : CoreResourceType.ORGANIZATION_SIEM_DELIVERY_DLQ;\n // Polymorphic scope FK field name: `organizationId` for the ORG variant,\n // `applicationId` for the APP variant (the polymorphism engine's per-variant column).\n const scopeFieldIdentifier = scopeType === AuthScopeType.APPLICATION\n ? coreResourceShared_FieldIdentifier[CoreResourceType.APPLICATION]\n : coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS];\n\n const ec = await this._getDlqExecutionContext(dlqResourceType, scopeFieldIdentifier, scopeId);\n const dlqRepo = this.repositoriesRegistry.getRepositoryOrThrow(dlqResourceType);\n\n const dlqEntry = {\n // The polymorphic scope FK (organizationId / applicationId) is NOT on\n // SiemDeliveryDlqBaseSchema — the polymorphism engine appends it per variant as an\n // excludeFromCreate, context-injected column. Its AUTHORITATIVE write comes from\n // `enrichDataWithContext` reading it off the EC's context map (seeded in\n // `_getDlqExecutionContext`), because the strict CREATE-DTO strips this field from\n // the payload. We ALSO set it here — mirroring the M2M webhook-delivery-log sibling\n // (`buildScopeFkInjection`) — so both delivery-failure paths read identically; it is\n // harmless (stripped, then re-injected by enrichment) rather than the source of truth.\n [scopeFieldIdentifier]: scopeId,\n eventId: payload.envelope.eventId,\n eventPayload: payload.envelope,\n failureReason: `${failureReason}${errorMessage ? `: ${errorMessage}` : ''}`,\n failureCount: 1,\n lastAttemptAt: new Date(),\n nextRetryAt: failureReason === 'retries_exhausted' ? undefined : new Date(Date.now() + 5 * 60 * 1000),\n status: failureReason === 'retries_exhausted' ? SiemDeliveryDlqStatus.EXHAUSTED : SiemDeliveryDlqStatus.PENDING_RETRY,\n };\n\n await dlqRepo.create(ec, dlqEntry);\n\n this.logger.warn('SIEM delivery event persisted to DLQ', {\n scopeType,\n scopeId,\n eventId: payload.envelope.eventId,\n eventType: payload.envelope.eventType,\n failureReason,\n });\n } catch (dlqError) {\n this.logger.error?.('Failed to enqueue SIEM event to DLQ', {\n scopeType,\n scopeId,\n eventId: payload.envelope.eventId,\n ...projectCaughtErrorLogFields(dlqError),\n });\n }\n }\n\n /**\n * Create a REPOSITORY-DIRECT internal ExecutionContext for the DLQ create.\n *\n * SIEM delivery runs in an async queue worker with no user EC, so this synthesises a\n * system super-admin context via `createForInternalRepositoryOperation` — the blessed seam\n * for repository-tier internal writes (shared with FILES / JOB_* / notification-badge) that\n * resolves the DLQ's `REPOSITORY_ONLY` CREATE variant. It also uses the CORRECT polymorphic\n * `dlqResourceType` (the prior hand-rolled path hardcoded the ORG variant even for APP-scoped\n * deliveries).\n *\n * CRITICAL — the scope-FK injection channel: the DLQ's scope FK (organizationId /\n * applicationId) is an excludeFromCreate, context-injected column the polymorphism engine\n * appends per variant; the strict CREATE-DTO strips it from the payload, so it is persisted\n * ONLY by `enrichDataWithContext` reading it off THIS context map. An earlier version passed\n * an EMPTY map → the required scope FK was never injected → Mongoose \"organizationId: Path\n * required\" → every retries-exhausted SIEM delivery was silently lost instead of\n * dead-lettered. An INTERNALLY_INITIATED EC fail-closed rejects org/user identity on\n * `initiatorIds`, so the context map is the ONLY correct channel for the ORGANIZATION scope FK.\n */\n private async _getDlqExecutionContext(\n dlqResourceType: ResourceType,\n scopeFieldIdentifier: string,\n scopeId: string,\n ): Promise<ExecutionContext<any>> {\n return this.executionContextCreator.createForInternalRepositoryOperation({\n resourceType: dlqResourceType,\n operationIdentifier: CoreResourceOperation.CREATE,\n contextResourcesFieldIdentifier: new Map([[scopeFieldIdentifier, scopeId]]),\n initiatorIds: null,\n initiatorRoles: [\n { roles: [CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN], relatedPrimaryScope: ResourcePrimaryScope.APPLICATION },\n ],\n });\n }\n\n // ─────────────────────────────────────────────────────────────\n // H6: SIEM Credential Encryption/Decryption\n // ─────────────────────────────────────────────────────────────\n\n /**\n * Derive a 32-byte AES-256 key from the app's session encryption key\n * using a domain-specific separator to avoid key reuse.\n */\n private _deriveSIEMEncryptionKey(): Buffer {\n const baseKey = this.appConfigService.secrets.security.session.encryptionKey;\n return createHash('sha256')\n .update(`${SIEM_KEY_DOMAIN}:${baseKey}`)\n .digest();\n }\n\n /**\n * H6: Resolve a credential value — decrypts if encrypted, returns as-is if plaintext.\n * Encrypted format: `encrypted:aes-256-gcm:{iv_hex}:{authTag_hex}:{ciphertext_hex}`\n */\n private _resolveCredential(credential: string | undefined): string | undefined {\n if (!credential) return undefined;\n\n if (!credential.startsWith(ENCRYPTED_CREDENTIAL_PREFIX)) {\n // Plaintext credential — log a warning for security awareness\n this.logDebug('SIEM credential is plaintext (not encrypted at rest). Consider re-saving via admin API to encrypt.');\n return credential;\n }\n\n try {\n const payload = credential.slice(ENCRYPTED_CREDENTIAL_PREFIX.length);\n const [ivHex, authTagHex, ciphertextHex] = payload.split(':');\n if (!ivHex || !authTagHex || !ciphertextHex) {\n throw new Error('Invalid encrypted credential format');\n }\n\n const key = this._deriveSIEMEncryptionKey();\n const iv = Buffer.from(ivHex, 'hex');\n const authTag = Buffer.from(authTagHex, 'hex');\n const ciphertext = Buffer.from(ciphertextHex, 'hex');\n\n const decipher = createDecipheriv('aes-256-gcm', key, iv);\n decipher.setAuthTag(authTag);\n\n const decrypted = Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n return decrypted.toString('utf8');\n } catch (error) {\n this.logger.error?.(\n 'Failed to decrypt SIEM credential',\n projectCaughtErrorLogFields(error),\n );\n return undefined;\n }\n }\n\n /**\n * H6: Encrypt a plaintext credential for storage.\n * Returns the encrypted string in format: `encrypted:aes-256-gcm:{iv}:{authTag}:{ciphertext}`\n *\n * Called by admin API when saving SIEM configuration.\n */\n public encryptCredential(plaintext: string): string {\n const key = this._deriveSIEMEncryptionKey();\n const iv = randomBytes(12); // 96-bit IV for GCM\n const cipher = createCipheriv('aes-256-gcm', key, iv);\n\n const encrypted = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);\n const authTag = cipher.getAuthTag();\n\n return `${ENCRYPTED_CREDENTIAL_PREFIX}${iv.toString('hex')}:${authTag.toString('hex')}:${encrypted.toString('hex')}`;\n }\n\n /**\n * Sleep utility for exponential backoff.\n */\n private _sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n }\n}\n"]}
1
+ {"version":3,"file":"siem-webhook-delivery.backend.service.js","sourceRoot":"","sources":["../../../../../src/compliance/audit-trails/services/siem-webhook-delivery.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EA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n * SIEM Webhook Delivery Backend Service\n *\n * Layer 3 of the three-layer audit event pipeline (Step 18).\n * Purpose-built for delivering security audit events to customer SIEM endpoints.\n * NOT a generic M2M webhook sender.\n *\n * Responsibilities:\n * - HTTP POST to webhook URL with configured auth\n * - HMAC-SHA256 signature for hmac_sha256 auth method\n * - Exponential backoff retries\n * - Circuit breaker after N consecutive failures per org\n * - CEF/LEEF format conversion (when eventFormat !== json_structured)\n * - Idempotency via eventId\n */\n\nimport 'reflect-metadata';\nimport { inject, injectable } from 'inversify';\nimport { createHmac, createHash, createCipheriv, createDecipheriv, randomBytes } from 'crypto';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { AuditEventDispatcherBackendService } from './audit-event-dispatcher.backend.service';\nimport { RepositoriesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/repositories/repositories-registry-handler.backend.service';\nimport { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport {\n type SecurityAuditEventEnvelope,\n type SiemExportConfigBase,\n type ResourceType,\n CoreResourceType,\n CoreResourceOperation,\n CORE_APP_ROLES,\n ResourcePrimaryScope,\n WildoHeaderKeys,\n SiemDeliveryDlqStatus,\n SIEMEventFormat,\n AuthScopeType,\n coreResourceShared_FieldIdentifier,\n SIEM_DELIVERY_RELIABILITY_CONTRACT,\n SIEM_CIRCUIT_BREAKER_COOLDOWN_MS,\n} from '@wildo-ai/saas-models';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport {\n CEF_PROJECTION,\n LEEF_PROJECTION,\n cefAgentSeverityHeaderValue,\n SiemFieldProjectionKind,\n type SiemProjectionContext,\n type SiemProjectionContract,\n} from './utils/siem-projection-contract.backend.utils';\nimport { buildOcsfEvent } from './utils/siem-ocsf-projection.backend.utils';\nimport {\n CEF_HEADER_MAX_CHARACTERS,\n CEF_MAX_CHARACTERS,\n LEEF_HEADER_MAX_CHARACTERS,\n LEEF_MAX_CHARACTERS,\n LEEF_TAB_DELIMITER_HEADER_VALUE,\n type CefWireKey,\n type LeefWireKey,\n} from './utils/siem-dictionary.backend.utils';\nimport {\n describeCaughtError,\n projectCaughtErrorLogFields,\n} from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { pinnedOutboundFetch } from '~wildo-backend-lib/security/ssrf/pinned-outbound-fetch.backend.utils';\n\n/** Circuit breaker state per organization */\ninterface CircuitBreakerState {\n consecutiveFailures: number;\n lastFailureAt: Date | null;\n circuitOpenUntil: Date | null;\n}\n\n/** Payload shape enqueued by AuditEventDispatcherBackendService */\nexport interface SIEMDeliveryJobPayload {\n envelope: SecurityAuditEventEnvelope;\n envelopeHmac?: string; // F6: HMAC integrity signature\n organizationId: string;\n /**\n * Delivery scope. Defaults to {@link AuthScopeType.ORGANIZATION}. The worker is scope-generic (the\n * circuit-breaker key, DLQ variant, and scope FK all derive from it), but `'application'`\n * is currently produced ONLY by the SIEM-DLQ retry custom-impl — there is no first-time\n * app-scoped producer, so the APPLICATION path is reserved / dormant. See\n * `AuditEventDispatcherBackendService.dispatchToOrganizationAuditSinks`.\n */\n scopeType?: AuthScopeType;\n scopeId?: string;\n siemConfig: {\n webhookUrl: string;\n authMethod: string;\n authCredential?: string;\n authHeaderName?: string;\n eventFormat: string;\n customHeaders?: Record<string, string>;\n delivery: {\n batchSize: number;\n batchWindowSeconds: number;\n retryAttempts: number;\n retryBackoffSeconds: number;\n timeoutSeconds: number;\n };\n };\n}\n\n/**\n * Circuit-breaker bounds come from `SIEM_DELIVERY_RELIABILITY_CONTRACT`, which the customer\n * documentation also projects: what an operator is told about a paused destination is what this\n * service applies.\n */\nconst CIRCUIT_BREAKER_THRESHOLD = SIEM_DELIVERY_RELIABILITY_CONTRACT.circuitBreakerFailureThreshold;\nconst CIRCUIT_BREAKER_COOLDOWN_MS = SIEM_CIRCUIT_BREAKER_COOLDOWN_MS;\n/** Prefix for encrypted credentials (H6) */\nconst ENCRYPTED_CREDENTIAL_PREFIX = 'encrypted:aes-256-gcm:';\n/** HKDF-like domain separator for SIEM encryption key derivation */\nconst SIEM_KEY_DOMAIN = 'wildo:siem:credential:v1';\n/**\n * Appended when the `eventData` detail bag is truncated, so the loss is VISIBLE to the receiver\n * rather than silent. A SOC that sees a JSON fragment ending mid-object cannot tell a truncation\n * from a serializer bug; this marker makes the difference explicit on the wire.\n */\nconst SIEM_EVENT_DATA_TRUNCATION_MARKER = '...[truncated]';\n/**\n * Maximum characters of serialized `eventData` carried in the single CEF/LEEF detail field,\n * INCLUDING {@link SIEM_EVENT_DATA_TRUNCATION_MARKER} when truncation occurs — the emitted value\n * never exceeds this bound.\n *\n * This is the CEF extension dictionary's own published length for `msg`, not a Wildo-invented\n * policy. LEEF publishes no per-attribute ceiling, so the same bound is applied there for\n * cross-format consistency: an unbounded detail bag is the realistic way a CEF/LEEF line grows\n * large enough for a receiver to reject it, which would fail the delivery into the DLQ.\n *\n * spec-cite: Implementing ArcSight CEF v26, Oct 2023 — ArcSight Extension Dictionary, \"CEF Key\n * Names for Event Producers\", `msg` row: full name `message`, data type `String`, length `1023`,\n * \"An arbitrary message giving more details about the event.\"\n *\n * The bound is applied to the ESCAPED value, i.e. to what actually goes on the wire. An earlier\n * revision bounded the value BEFORE escaping, on the reading that the ceiling describes the field's\n * CONTENT and escape sequences are transport encoding a receiver strips before it ever sees the\n * field. That reading is defensible and the document does not settle it — which is precisely why the\n * post-escape bound is the one to hold: escaping only ever expands (`=` → `\\=`, `\\` → `\\\\`), so a\n * value within the ceiling once encoded is necessarily within it once decoded. Bounding the encoded\n * form satisfies BOTH readings; bounding the decoded form satisfies only one, and an escape-heavy\n * bag sitting at the ceiling would have gone out over-long under the other.\n */\nconst SIEM_EVENT_DATA_DETAIL_MAX_CHARS = 1023;\n\n// The per-key ceilings and the `devTimeFormat` pattern used to live here as hand-kept constants\n// beside the formatter. They now live in the dictionary spine (`siem-dictionary.backend.utils.ts`),\n// DERIVED from the transcribed rows, because a ceiling maintained next to a key list is the same\n// artefact as the key list itself: adding a key and forgetting its published maximum was possible\n// right up until the derivation existed.\n//\n// Line comments, not a JSDoc block — a `/** */` here would attach to the class below it.\n\n@injectable()\nexport class SIEMWebhookDeliveryBackendService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private readonly circuitBreakers: Map<string, CircuitBreakerState> = new Map();\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.AuditEventDispatcherService) private readonly auditEventDispatcher: AuditEventDispatcherBackendService,\n @inject(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService) private readonly repositoriesRegistry: RepositoriesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n ) {\n this.logDebug = this.logger.debugByType('SIEMWebhookDeliveryBackendService');\n this.logger.setDebugTypeLogging('SIEMWebhookDeliveryBackendService', false);\n }\n\n /**\n * Process a SIEM delivery job from the queue.\n * Called by the job consumer when a `siem.webhook-delivery` batch job is dequeued.\n */\n public async processDelivery(payload: SIEMDeliveryJobPayload): Promise<void> {\n const { envelope, envelopeHmac, organizationId, siemConfig } = payload;\n const scopeType = payload.scopeType ?? AuthScopeType.ORGANIZATION;\n const scopeId = payload.scopeId ?? organizationId;\n const circuitKey = `${scopeType}:${scopeId}`;\n\n // F6: Verify envelope integrity before processing\n if (envelopeHmac) {\n if (!this.auditEventDispatcher.verifyEnvelopeHmac(envelope, envelopeHmac)) {\n this.logger.error?.('SIEM envelope HMAC verification failed — possible tampering', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n });\n await this._enqueueToDLQ(payload, 'hmac_verification_failed');\n return;\n }\n }\n\n // Circuit breaker check — M11: DLQ instead of silent drop\n if (this._isCircuitOpen(circuitKey)) {\n this.logDebug('Circuit breaker open for scope, sending to DLQ', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n });\n await this._enqueueToDLQ(payload, 'circuit_breaker_open');\n return;\n }\n\n // Format the body\n const body = this._formatBody(envelope, siemConfig.eventFormat);\n\n // Build headers\n const headers = this._buildHeaders(body, siemConfig);\n\n // Attempt delivery with retries\n const maxRetries = siemConfig.delivery.retryAttempts;\n const baseBackoffMs = siemConfig.delivery.retryBackoffSeconds * 1000;\n const timeoutMs = siemConfig.delivery.timeoutSeconds * 1000;\n\n for (let attempt = 0; attempt <= maxRetries; attempt++) {\n try {\n await this._sendHttpPost(siemConfig.webhookUrl, body, headers, timeoutMs);\n\n this._recordSuccess(circuitKey);\n\n this.logDebug('SIEM webhook delivered successfully', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n attempt,\n });\n return;\n } catch (error) {\n const isLastAttempt = attempt === maxRetries;\n\n if (isLastAttempt) {\n this._recordFailure(circuitKey);\n\n this.logger.error?.('SIEM webhook delivery failed after all retries', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n attempts: attempt + 1,\n ...projectCaughtErrorLogFields(error),\n });\n\n // `describeCaughtError`, not an `instanceof Error` ternary: this string is\n // PERSISTED as the DLQ record's failure reason, and a `WildoError_Backend`\n // is a plain object — the ternary would store `'[object Object]'` for every\n // structured fault, making the DLQ untriageable.\n await this._enqueueToDLQ(payload, 'retries_exhausted', describeCaughtError(error));\n } else {\n const backoffMs = baseBackoffMs * Math.pow(2, attempt);\n this.logDebug('SIEM webhook delivery failed, retrying', {\n scopeType,\n scopeId,\n eventId: envelope.eventId,\n attempt,\n nextRetryMs: backoffMs,\n });\n await this._sleep(backoffMs);\n }\n }\n }\n }\n\n /**\n * Format the event body based on the configured event format.\n *\n * `json_structured` ships the envelope verbatim. CEF and LEEF are flat, single-line `key=value`\n * grammars, so they project the envelope in two tiers: the standard/indexed keys each grammar\n * defines (`cat`, `outcome`, `src`, …), followed by the free-form `eventData` bag serialized\n * into that grammar's single detail field. Every envelope field therefore reaches all three\n * formats; only the ENCODING differs.\n */\n private _formatBody(envelope: SecurityAuditEventEnvelope, eventFormat: string): string {\n switch (eventFormat) {\n case SIEMEventFormat.CEF:\n return this._formatAsCEF(envelope);\n case SIEMEventFormat.LEEF:\n return this._formatAsLEEF(envelope);\n case SIEMEventFormat.OCSF:\n // OCSF is JSON, so there is no escaping/bounding layer here — the projection returns a\n // document and the only transport concern is serialisation.\n return JSON.stringify(buildOcsfEvent(envelope));\n case SIEMEventFormat.JSON_STRUCTURED:\n default:\n return JSON.stringify(envelope);\n }\n }\n\n /**\n * Format event as CEF (Common Event Format).\n * CEF:Version|Device Vendor|Device Product|Device Version|Signature ID|Name|Severity|Extension\n */\n private _formatAsCEF(envelope: SecurityAuditEventEnvelope): string {\n const cefSeverity = cefAgentSeverityHeaderValue(envelope.severity);\n const ext = (value: string): string => this._escapeCEFExtensionValue(value);\n const header = (field: string, value: string): string => this._emitBoundedHeaderField(field, value, CEF_HEADER_MAX_CHARACTERS);\n const eventDataDetail = this._serializeEventDataDetail(envelope, ext);\n // CEF extensions are SPACE-delimited, so that is what `join` means for this grammar.\n const pair = (key: CefWireKey, value: string): string => this._emitPair(key, value, ext, CEF_MAX_CHARACTERS);\n const join = (...fragments: readonly string[]): string => fragments.join(' ');\n\n // Driven by CEF_PROJECTION, so a field cannot be dropped by being forgotten — the contract is\n // exhaustive over the envelope type and declaration order is wire order. The per-field reasoning,\n // citations and the csN-budget decision all live there, next to the mapping they justify.\n const extensions = this._renderProjection(CEF_PROJECTION, envelope, { pair, join, eventDataDetail })\n .join(' ');\n\n // Header fields 5 and 6 are DIFFERENT questions and used to receive the same answer. Field 5,\n // `Device Event Class ID`, is the stable signature a QID/correlation rule keys on — `eventType` is\n // exactly that. Field 6, `Name`, is documented as \"a human-readable and understandable description\n // of the event\", so `user_account_locked` twice gave a SOC a machine token in the column its\n // console renders as the event title.\n // spec-cite: Implementing ArcSight CEF v26, Oct 2023 — \"Header Field Definitions\", `deviceEventClassId`\n // row (\"a unique identifier for each event-type … also known as Signature ID\") and `name` row\n // (String, 512): \"a string representing a human-readable and understandable description of the event.\"\n return `CEF:0|${header('deviceVendor', 'Wildo')}|${header('deviceProduct', 'SecurityAudit')}|${header('deviceVersion', envelope.sourceVersion)}|${header('deviceEventClassId', envelope.eventType)}|${header('name', this._humanizeEventType(envelope.eventType))}|${cefSeverity}|${extensions}`;\n }\n\n /**\n * Format event as LEEF (Log Event Extended Format — IBM QRadar).\n * LEEF:Version|Vendor|Product|Version|EventID|Extension\n *\n * The serialized `eventData` bag rides a custom `eventData` attribute. It is deliberately NOT\n * called `msg` as in the CEF projection: `msg` earns that name in CEF by being a dictionary key\n * with a defined meaning, whereas LEEF publishes no such key — borrowing CEF's vocabulary here\n * would imply a standard attribute that does not exist. Each grammar gets the name that is\n * correct within it.\n * spec-cite: N/A — `eventData` is a Wildo-chosen custom attribute name, not a LEEF-defined key.\n */\n private _formatAsLEEF(envelope: SecurityAuditEventEnvelope): string {\n const val = (value: string): string => this._escapeLEEFValue(value);\n const header = (field: string, value: string): string => this._emitBoundedHeaderField(field, value, LEEF_HEADER_MAX_CHARACTERS);\n const eventDataDetail = this._serializeEventDataDetail(envelope, val);\n // LEEF attributes are TAB-delimited (we emit no `DelimiterCharacter`), so that is `join` here.\n const pair = (key: LeefWireKey, value: string): string => this._emitPair(key, value, val, LEEF_MAX_CHARACTERS);\n const join = (...fragments: readonly string[]): string => fragments.join('\\t');\n\n // Driven by LEEF_PROJECTION. LEEF reaches ALL 27 envelope fields because a LEEF custom key stays\n // searchable in QRadar, where a CEF custom extension does not — see the contract for the citation.\n //\n // `sev`, `devTime` and `devTimeFormat` are rendered BY the contract now. They used to be appended\n // here, which looked like a formatter detail and was a hole: a key emitted outside `pair` skips\n // its published ceiling, the duplicate-key check, and the declared-vs-emitted test — and `sev`\n // is precisely a key with a published constraint (`1-10`).\n const extensions = this._renderProjection(LEEF_PROJECTION, envelope, { pair, join, eventDataDetail })\n .join('\\t');\n\n // Six header fields, not five. The sixth is the attribute DelimiterCharacter, which every\n // LEEF 2.0 example in the guide carries and ours omitted — see LEEF_TAB_DELIMITER_HEADER_VALUE:\n // a parser splitting a 2.0 header into six fields was consuming our first attribute as it.\n // Vendor and Product go through `header()` too, though they are constants that need neither\n // escaping nor bounding. The point is that EVERY header field goes through the one door, so\n // \"is this field covered?\" is answerable by looking rather than by reasoning about each value —\n // the same reason `rt` was routed through `pair` even though digits never change.\n return `LEEF:2.0|${header('vendor', 'Wildo')}|${header('product', 'SecurityAudit')}|${header('productVersion', envelope.sourceVersion)}|${header('eventId', envelope.eventType)}|${LEEF_TAB_DELIMITER_HEADER_VALUE}|${extensions}`;\n }\n\n /**\n * Serialize `envelope.eventData` into the single detail field that CEF (`msg`) and LEEF\n * (`eventData`) each carry, or `undefined` when there is nothing worth saying — the caller's\n * `.filter(Boolean)` then drops the key entirely instead of emitting an empty one.\n *\n * Without this, CEF/LEEF subscribers received ONLY the curated standard keys while\n * `json_structured` subscribers received the whole bag: a silent capability gap between\n * formats, not a deliberate reduction.\n *\n * REJECTED ALTERNATIVE — flattening each `eventData` entry into its own extension key\n * (`lockoutDuration=15`, `sessionId=…`). It reads better as SIEM columns, but it is unsound\n * here. `eventData` is an OPEN, app-extensible bag whose keys routinely collide both with the\n * CEF/LEEF dictionaries and with the envelope fields already projected above it: the\n * `USER_LOGIN_FAILED` bag alone carries `failureReason`, `ipAddress` and `email`, which the\n * dispatcher has already promoted onto the envelope and which this formatter already emits as\n * `reason`, `src` and `suser`. Flattening would therefore put `src=` on the line TWICE and leave\n * which one wins to the receiver's parser. Nested objects and arrays have no flat\n * representation either. One JSON field keeps the standard keys authoritative AND the bag\n * lossless, at the cost of a second parse step on the receiving end.\n *\n * The returned JSON is escaped by the CALLER for its grammar, so a backslash ends up encoded\n * twice — once by `JSON.stringify`, once by the CEF/LEEF escaper. That is correct and\n * required: a receiver un-escapes the wire grammar first, then parses the JSON.\n */\n private _serializeEventDataDetail(\n envelope: SecurityAuditEventEnvelope,\n escapeForGrammar: (value: string) => string,\n ): string | undefined {\n // Defensive: the envelope TYPE requires `eventData`, but this formatter also runs over\n // envelopes replayed from the DLQ, where a stored bag can be absent or malformed. An\n // unguarded `Object.keys(undefined)` here would throw inside delivery.\n const eventData: unknown = envelope.eventData;\n if (!eventData || typeof eventData !== 'object' || Object.keys(eventData).length === 0) {\n return undefined;\n }\n\n let serialized: string;\n try {\n serialized = JSON.stringify(eventData);\n } catch {\n // A circular / unserializable bag must not fail the whole delivery — the standard keys\n // above it are still valuable to a SOC, so drop only the detail field.\n this.logDebug('SIEM eventData detail omitted — bag is not JSON-serializable', {\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n });\n return undefined;\n }\n\n // `JSON.stringify` returns `undefined` for a value it cannot represent at all; the guard\n // above makes that unreachable for a non-empty plain object, but a `toJSON()` returning\n // `undefined` would still land here.\n if (!serialized) return undefined;\n\n if (escapeForGrammar(serialized).length <= SIEM_EVENT_DATA_DETAIL_MAX_CHARS) return serialized;\n\n // Largest prefix whose ESCAPED form, marker included, still fits. A prefix length cannot be\n // computed arithmetically because expansion depends on which characters the prefix contains,\n // and it is not uniform across the two grammars (CEF escapes `=`, LEEF does not). Binary search\n // costs O(log n) escape passes and is exact; a fixed safety margin would be a guess that is\n // simultaneously too small for a delimiter-dense bag and wasteful for an ordinary one.\n let fits = 0;\n let tooLong = serialized.length;\n while (fits < tooLong) {\n const candidate = Math.ceil((fits + tooLong) / 2);\n if (escapeForGrammar(this._truncateDetail(serialized, candidate)).length <= SIEM_EVENT_DATA_DETAIL_MAX_CHARS) {\n fits = candidate;\n } else {\n tooLong = candidate - 1;\n }\n }\n const truncated = this._truncateDetail(serialized, fits);\n\n this.logDebug('SIEM eventData detail truncated to the CEF/LEEF detail-field ceiling', {\n eventId: envelope.eventId,\n eventType: envelope.eventType,\n originalLength: serialized.length,\n emittedLength: truncated.length,\n escapedLength: escapeForGrammar(truncated).length,\n maxChars: SIEM_EVENT_DATA_DETAIL_MAX_CHARS,\n });\n return truncated;\n }\n\n /**\n * Cut `serialized` to `length` UTF-16 units and append the truncation marker.\n *\n * The marker is counted INSIDE the ceiling by the caller's search, not appended beyond it — a\n * bound that its own truncation overshoots is not a bound. A cut landing between the halves of a\n * surrogate pair would emit a lone surrogate, which `JSON.parse` on the receiving end rejects with\n * a different error than the truncation it actually is, so the trailing half-pair is dropped.\n */\n private _truncateDetail(serialized: string, length: number): string {\n const cut = serialized.slice(0, length);\n const last = cut.charCodeAt(cut.length - 1);\n const endsOnHighSurrogate = last >= 0xd800 && last <= 0xdbff;\n return `${endsOnHighSurrogate ? cut.slice(0, -1) : cut}${SIEM_EVENT_DATA_TRUNCATION_MARKER}`;\n }\n\n // ─────────────────────────────────────────────────────────────\n // Wire-format escaping\n //\n // CEF and LEEF are single-line, delimiter-separated grammars with NO quoting construct: a\n // delimiter appearing raw inside a value does not produce a malformed record that a parser\n // rejects — it produces a WELL-FORMED record with silently wrong fields. That failure mode is\n // why these helpers exist and why EVERY interpolated string value goes through one of them\n // rather than only the fields believed to be risky today. `outcomeReason` in particular is free\n // text sourced from `eventData.failureReason` / `eventData.reason`, so it is the first projected\n // field with no vocabulary constraining its characters.\n // ─────────────────────────────────────────────────────────────\n\n /**\n * Escape a value for a CEF *extension* (`key=value`) slot.\n *\n * The extension is a space-separated `key=value` list whose parser delimits on the next\n * `<key>=`, so per the CEF standard:\n * - `\\` becomes `\\\\` — it is the escape character itself, which is why it MUST be replaced\n * first; doing it later would re-escape the backslashes introduced by the rules below.\n * - `=` becomes `\\=` — an unescaped `=` is read as the start of the next key/value pair.\n * - CR/LF become the two-character sequences `\\r` / `\\n` — a real newline terminates the\n * record and truncates every remaining field.\n *\n * Spaces are deliberately NOT escaped: the grammar permits them inside extension values (a\n * value is delimited by the next `<key>=`, not by whitespace).\n * spec-cite: Implementing ArcSight CEF v26, Oct 2023 — \"Character Encoding\" / the extension\n * escaping rules for pipe, backslash and equals in the Extension field.\n */\n private _escapeCEFExtensionValue(value: string): string {\n return value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/=/g, '\\\\=')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\n/g, '\\\\n');\n }\n\n /**\n * Escape a value for a LEEF attribute slot.\n *\n * LEEF pairs are TAB-delimited, so a literal tab fabricates an extra attribute and a newline\n * terminates the record; both are encoded as their escape sequences (`\\` first, for the same\n * reason as above). `=` needs NO escaping here — a LEEF parser splits each pair on its FIRST\n * `=`, so subsequent `=` characters remain part of the value.\n * spec-cite: N/A — LEEF publishes no escaping table for attribute values; these rules are\n * derived from its tab-delimited, newline-terminated record structure, which is why the `=`\n * asymmetry with CEF above is deliberate rather than an oversight.\n */\n private _escapeLEEFValue(value: string): string {\n // ⚠️ `|` and `^` are deliberately NOT escaped, and the reasoning is the point rather than the\n // conclusion. The guide's best practices say to AVOID them in keys and values — it defines no\n // escape for them, because LEEF 2.0's answer is the header's `DelimiterCharacter`, which lets a\n // producer CHOOSE the attribute delimiter (caret is a documented choice). Inventing `\\|` would\n // therefore corrupt the value at every conformant receiver, which is strictly worse than the\n // mis-parse it guards against — and that mis-parse needs a non-conformant parser splitting the\n // whole line on `|`, since the header ends at its fifth. We emit no `DelimiterCharacter`, so the\n // delimiter is TAB and a caret in a value is inert. If a `DelimiterCharacter` is ever emitted,\n // THAT character becomes escapable-or-forbidden and this decision must be re-taken.\n // spec-cite: IBM QRadar LEEF Version 2 (© IBM 2013, 2016) — \"Best practices Guidelines for LEEF\n // events\": \"Use alphanumeric (A-Z, a-z, and 0-9) characters, but avoid tab, pipe, or caret\n // delimiters in your event payload keys and values\"; Table 2, `Delimiter Character` row.\n return value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\t/g, '\\\\t')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\n/g, '\\\\n');\n }\n\n /**\n * Escape a value for a CEF or LEEF *header* slot (the `|`-delimited prefix shared by both\n * grammars).\n *\n * A literal `|` would fabricate a header field and shift every subsequent one — including the\n * severity and the entire extension — so it is escaped as `\\|`. Headers cannot span lines at\n * all (there is no multi-line encoding for them, unlike extension values), so newlines are\n * folded to a space rather than escaped.\n *\n * Applied defensively: `sourceVersion` is read straight from the `APP_VERSION` environment\n * variable and `eventType` is app-extensible, so neither is guaranteed delimiter-free.\n */\n private _escapeSIEMHeaderField(value: string): string {\n return value\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\\|/g, '\\\\|')\n // Any CR or LF, in any combination — not just `\\r?\\n`. A LONE `\\r` slipped through that form,\n // and a bare CR terminates a record for readers that treat it as a line ending.\n .replace(/[\\r\\n]+/g, ' ');\n }\n\n /**\n * Render a projection contract into its emitted fragments, in declaration order.\n *\n * Only `extension` entries produce wire output. `header` entries are carried by the caller's header\n * construction and `not-projected` entries deliberately produce nothing — both exist in the contract\n * so that COVERAGE is a property of the type rather than of anyone's memory.\n */\n private _renderProjection<K extends string>(\n contract: SiemProjectionContract<SecurityAuditEventEnvelope, K>,\n envelope: SecurityAuditEventEnvelope,\n context: SiemProjectionContext<K>,\n ): string[] {\n const fragments: string[] = [];\n for (const projection of Object.values(contract)) {\n if (projection.kind !== SiemFieldProjectionKind.EXTENSION) continue;\n const fragment = projection.render(envelope, context);\n if (fragment) fragments.push(fragment);\n }\n return fragments;\n }\n\n /**\n * Emit one `key=value` pair, escaped for its grammar and bounded by the key's PUBLISHED ceiling.\n *\n * The bound is measured on the ESCAPED value for the same reason as the detail bag: escaping only\n * expands, so bounding the encoded form is the only bound that holds under both readings of what a\n * published length governs. A key absent from `maxByKey` has no published limit and is emitted\n * whole — the table never invents one.\n *\n * Truncation is LOUD. Losing the tail of an id or an email is a data defect, not a formatting\n * detail, and the receiver cannot tell a truncated value from a short one.\n */\n private _emitPair<K extends string>(\n key: K,\n rawValue: string,\n escapeForGrammar: (value: string) => string,\n maxByKey: Readonly<Record<string, number>>,\n ): string {\n return `${key}=${this._boundToPublishedLength(key, rawValue, escapeForGrammar, maxByKey[key])}`;\n }\n\n /**\n * Escape a value and bound the ESCAPED result at its published ceiling, or emit it whole when the\n * document publishes none.\n *\n * Shared by the extension path ({@link _emitPair}) and the header path\n * ({@link _emitBoundedHeaderField}) because both answer the same question and only one of them used\n * to. Header fields never passed through `_emitPair`, so every published header size — most\n * pointedly `deviceVersion`'s 31 characters, which carries `APP_VERSION` — was unenforced while the\n * extension ceilings were being carefully derived from the dictionary one layer away. Two code\n * paths for one rule is how that happened; there is one now.\n *\n * The bound is measured on the escaped form for the reason given at\n * {@link SIEM_EVENT_DATA_DETAIL_MAX_CHARS}: escaping only expands, so a value within the ceiling\n * once encoded is within it once decoded, which satisfies both readings of what a published length\n * governs. Truncation is LOUD — losing the tail of a version or an id is a data defect, and the\n * receiver cannot tell a truncated value from a short one.\n */\n private _boundToPublishedLength(\n fieldName: string,\n rawValue: string,\n escapeForGrammar: (value: string) => string,\n max: number | undefined,\n ): string {\n const escaped = escapeForGrammar(rawValue);\n if (max === undefined || escaped.length <= max) return escaped;\n\n let fits = 0;\n let tooLong = rawValue.length;\n while (fits < tooLong) {\n const candidate = Math.ceil((fits + tooLong) / 2);\n if (escapeForGrammar(rawValue.slice(0, candidate)).length <= max) fits = candidate;\n else tooLong = candidate - 1;\n }\n const cut = rawValue.slice(0, fits);\n const lastCode = cut.charCodeAt(cut.length - 1);\n const kept = lastCode >= 0xd800 && lastCode <= 0xdbff ? cut.slice(0, -1) : cut;\n\n this.logger.warn?.('SIEM field truncated to its published ceiling', {\n key: fieldName,\n maxChars: max,\n originalLength: rawValue.length,\n emittedLength: kept.length,\n });\n return escapeForGrammar(kept);\n }\n\n /**\n * Emit one `|`-delimited header field, escaped for the shared header grammar and bounded by the\n * size its document publishes for THAT slot.\n *\n * A header field cannot be dropped when it misbehaves — an omitted field shifts every field after\n * it and silently re-interprets the whole record — so the only available degradation is truncation.\n */\n private _emitBoundedHeaderField(\n fieldName: string,\n rawValue: string,\n maxByField: Readonly<Record<string, number>>,\n ): string {\n return this._boundToPublishedLength(\n fieldName,\n rawValue,\n (value) => this._escapeSIEMHeaderField(value),\n maxByField[fieldName],\n );\n }\n\n /**\n * `user_account_locked` → `User account locked`, for CEF's human-readable `Name` header field.\n *\n * Derived rather than authored: the envelope carries no display label, and inventing a lookup table\n * would be a second vocabulary to keep in sync with `CoreAuditableEventType` — the drift shape this\n * codebase keeps paying for. A derivation cannot go stale.\n *\n * Deliberately NOT applied to `Device Event Class ID`, which must stay the machine token: a\n * correlation rule keyed on a prettified string would break the moment the prettifier changed.\n */\n private _humanizeEventType(eventType: string): string {\n const words = eventType.replace(/[_-]+/g, ' ').trim();\n return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : eventType;\n }\n\n /**\n * Build HTTP headers for the SIEM webhook request.\n */\n private _buildHeaders(\n body: string,\n siemConfig: SIEMDeliveryJobPayload['siemConfig'],\n ): Record<string, string> {\n const headers: Record<string, string> = {\n // Second reader of `eventFormat` in this file (the first is `_formatBody`). Both route\n // through the SIEMEventFormat vocabulary so a future format value cannot be added to the\n // switch and silently forgotten here, where the wrong Content-Type makes a receiver reject\n // an otherwise well-formed body.\n // OCSF is JSON too, so the test is \"is this a TEXT grammar\", not \"is it json_structured\".\n // Reading it the other way would have shipped OCSF as `text/plain` — a well-formed body a\n // receiver may refuse to parse, which is this workstream's signature failure shape.\n [WildoHeaderKeys.CONTENT_TYPE]: siemConfig.eventFormat === SIEMEventFormat.CEF || siemConfig.eventFormat === SIEMEventFormat.LEEF\n ? 'text/plain'\n : 'application/json',\n };\n\n // Apply custom headers first (auth headers override if needed)\n if (siemConfig.customHeaders) {\n Object.assign(headers, siemConfig.customHeaders);\n }\n\n // H6: Resolve (decrypt) the credential before use\n const resolvedCredential = this._resolveCredential(siemConfig.authCredential);\n\n // Apply auth method\n switch (siemConfig.authMethod) {\n case 'bearer_token':\n if (resolvedCredential) {\n headers[WildoHeaderKeys.AUTHORIZATION] = `Bearer ${resolvedCredential}`;\n }\n break;\n\n case 'api_key_header': {\n const headerName = siemConfig.authHeaderName || WildoHeaderKeys.API_KEY;\n if (resolvedCredential) {\n headers[headerName] = resolvedCredential;\n }\n break;\n }\n\n case 'hmac_sha256':\n if (resolvedCredential) {\n const hmac = createHmac('sha256', resolvedCredential)\n .update(body)\n .digest('hex');\n headers[WildoHeaderKeys.X_SIGNATURE_256] = `sha256=${hmac}`;\n }\n break;\n\n case 'none':\n default:\n break;\n }\n\n return headers;\n }\n\n /**\n * Send HTTP POST to the SIEM webhook endpoint.\n *\n * ## Why this is not a plain `fetch`\n *\n * `webhookUrl` is TENANT-authored: an organization administrator types it, and this worker POSTs\n * to it holding the deployment's own network position. That is the fifth of the five outbound\n * target classes `security/ssrf/outbound-target-guard.backend.utils.ts` was written for — its\n * header names \"SIEM collectors\" explicitly — and it was the one class that never called it. A\n * `webhookUrl` of `http://169.254.169.254/latest/meta-data/iam/security-credentials/` was\n * delivered to, with the tenant's own auth headers attached, and the response body came back\n * inside the thrown error's message.\n *\n * {@link pinnedOutboundFetch} closes three separate holes here, not one:\n *\n * 1. **No classification at all.** The shape check now refuses a literal internal address and a\n * reserved special-use hostname before anything leaves the process.\n * 2. **Check-then-connect.** The address is classified inside the connection's `lookup` hook, so a\n * name that answers public to a validator and private to the socket never gets one.\n * 3. **Redirects.** The old call omitted `redirect: 'error'`, so even a perfect check would have\n * been walked past by a collector answering `302 Location: http://169.254.169.254/`. This\n * client cannot follow a redirect at all — a 302 arrives as a 302 and fails the `ok` test\n * below, landing in the retry/DLQ path like any other bad response.\n *\n * ## The behaviour change, stated rather than discovered\n *\n * A collector that today answers a redirect stops being followed and starts failing. That is\n * deliberate: a redirect is precisely how the guard is bypassed, and a SIEM endpoint that needs\n * one should be reconfigured to its final address. A collector on a PRIVATE network keeps working\n * only when the operator has declared\n * `auditTrail.allowPrivateNetworkSiemCollectors` — see {@link _admitsPrivateNetworkCollectors}.\n */\n private async _sendHttpPost(\n url: string,\n body: string,\n headers: Record<string, string>,\n timeoutMs: number,\n ): Promise<void> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeoutMs);\n\n try {\n const response = await pinnedOutboundFetch(url, {\n method: 'POST',\n headers,\n body,\n signal: controller.signal,\n /**\n * BOTH schemes, unlike CIMD's https-only policy, and the asymmetry is deliberate rather than\n * an oversight. `webhookUrl` is authored configuration that predates this guard and `http:`\n * collectors exist in the field on trusted internal networks; refusing plaintext here would\n * silently stop delivering security events for those deployments, which is a worse security\n * outcome than the transport weakness it would remove. Narrowing this to `https:` is a\n * separate, operator-visible decision with its own migration — not a side effect of adding\n * an SSRF guard.\n */\n admittedProtocols: ['https:', 'http:'],\n admitPrivateAddresses: this._admitsPrivateNetworkCollectors(),\n });\n\n if (!response.ok) {\n const responseText = await response.text().catch(() => '');\n throw new Error(\n `SIEM webhook returned HTTP ${response.status}: ${responseText.slice(0, 200)}`\n );\n }\n } finally {\n clearTimeout(timeoutId);\n }\n }\n\n /**\n * Has the DEPLOYMENT OPERATOR declared that SIEM collectors may sit on a private network?\n *\n * Read from the application configuration, never from the SIEM config row. The row is authored by\n * an organization administrator — the same party that supplies the URL — so a flag there would let\n * the attacker disarm the guard aimed at them. The operator declares the network posture; the\n * tenant chooses a destination within it.\n *\n * Absent reads as `false`. The field is deliberately un-defaulted in\n * {@link AuditTrailConfigSchema} so that an application which never authored the block gets the\n * refusing posture by doing nothing.\n */\n private _admitsPrivateNetworkCollectors(): boolean {\n return this.appConfigService.config?.auditTrail?.allowPrivateNetworkSiemCollectors === true;\n }\n\n // ─────────────────────────────────────────────────────────────\n // Circuit Breaker\n // ─────────────────────────────────────────────────────────────\n\n private _isCircuitOpen(circuitKey: string): boolean {\n const state = this.circuitBreakers.get(circuitKey);\n if (!state || !state.circuitOpenUntil) return false;\n\n if (new Date() > state.circuitOpenUntil) {\n state.circuitOpenUntil = null;\n return false;\n }\n\n return true;\n }\n\n private _recordSuccess(circuitKey: string): void {\n this.circuitBreakers.delete(circuitKey);\n }\n\n private _recordFailure(circuitKey: string): void {\n let state = this.circuitBreakers.get(circuitKey);\n if (!state) {\n state = { consecutiveFailures: 0, lastFailureAt: null, circuitOpenUntil: null };\n this.circuitBreakers.set(circuitKey, state);\n }\n\n state.consecutiveFailures++;\n state.lastFailureAt = new Date();\n\n if (state.consecutiveFailures >= CIRCUIT_BREAKER_THRESHOLD) {\n state.circuitOpenUntil = new Date(Date.now() + CIRCUIT_BREAKER_COOLDOWN_MS);\n this.logger.warn('SIEM circuit breaker opened', {\n circuitKey,\n consecutiveFailures: state.consecutiveFailures,\n cooldownMs: CIRCUIT_BREAKER_COOLDOWN_MS,\n });\n }\n }\n\n // ─────────────────────────────────────────────────────────────\n // M11: Dead Letter Queue\n // ─────────────────────────────────────────────────────────────\n\n /**\n * Persist failed SIEM delivery events to a MongoDB-backed DLQ resource\n * instead of silently dropping them. DLQ entries conform to SiemDeliveryDlqBase\n * and are queryable/retryable through the standard resource engine.\n */\n private async _enqueueToDLQ(\n payload: SIEMDeliveryJobPayload,\n failureReason: string,\n errorMessage?: string,\n ): Promise<void> {\n const scopeType = payload.scopeType ?? AuthScopeType.ORGANIZATION;\n const scopeId = payload.scopeId ?? payload.organizationId;\n try {\n const dlqResourceType = scopeType === AuthScopeType.APPLICATION\n ? CoreResourceType.APPLICATION_SIEM_DELIVERY_DLQ\n : CoreResourceType.ORGANIZATION_SIEM_DELIVERY_DLQ;\n // Polymorphic scope FK field name: `organizationId` for the ORG variant,\n // `applicationId` for the APP variant (the polymorphism engine's per-variant column).\n const scopeFieldIdentifier = scopeType === AuthScopeType.APPLICATION\n ? coreResourceShared_FieldIdentifier[CoreResourceType.APPLICATION]\n : coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS];\n\n const ec = await this._getDlqExecutionContext(dlqResourceType, scopeFieldIdentifier, scopeId);\n const dlqRepo = this.repositoriesRegistry.getRepositoryOrThrow(dlqResourceType);\n\n const dlqEntry = {\n // The polymorphic scope FK (organizationId / applicationId) is NOT on\n // SiemDeliveryDlqBaseSchema — the polymorphism engine appends it per variant as an\n // excludeFromCreate, context-injected column. Its AUTHORITATIVE write comes from\n // `enrichDataWithContext` reading it off the EC's context map (seeded in\n // `_getDlqExecutionContext`), because the strict CREATE-DTO strips this field from\n // the payload. We ALSO set it here — mirroring the M2M webhook-delivery-log sibling\n // (`buildScopeFkInjection`) — so both delivery-failure paths read identically; it is\n // harmless (stripped, then re-injected by enrichment) rather than the source of truth.\n [scopeFieldIdentifier]: scopeId,\n eventId: payload.envelope.eventId,\n eventPayload: payload.envelope,\n failureReason: `${failureReason}${errorMessage ? `: ${errorMessage}` : ''}`,\n failureCount: 1,\n lastAttemptAt: new Date(),\n nextRetryAt: failureReason === 'retries_exhausted' ? undefined : new Date(Date.now() + 5 * 60 * 1000),\n status: failureReason === 'retries_exhausted' ? SiemDeliveryDlqStatus.EXHAUSTED : SiemDeliveryDlqStatus.PENDING_RETRY,\n };\n\n await dlqRepo.create(ec, dlqEntry);\n\n this.logger.warn('SIEM delivery event persisted to DLQ', {\n scopeType,\n scopeId,\n eventId: payload.envelope.eventId,\n eventType: payload.envelope.eventType,\n failureReason,\n });\n } catch (dlqError) {\n this.logger.error?.('Failed to enqueue SIEM event to DLQ', {\n scopeType,\n scopeId,\n eventId: payload.envelope.eventId,\n ...projectCaughtErrorLogFields(dlqError),\n });\n }\n }\n\n /**\n * Create a REPOSITORY-DIRECT internal ExecutionContext for the DLQ create.\n *\n * SIEM delivery runs in an async queue worker with no user EC, so this synthesises a\n * system super-admin context via `createForInternalRepositoryOperation` — the blessed seam\n * for repository-tier internal writes (shared with FILES / JOB_* / notification-badge) that\n * resolves the DLQ's `REPOSITORY_ONLY` CREATE variant. It also uses the CORRECT polymorphic\n * `dlqResourceType` (the prior hand-rolled path hardcoded the ORG variant even for APP-scoped\n * deliveries).\n *\n * CRITICAL — the scope-FK injection channel: the DLQ's scope FK (organizationId /\n * applicationId) is an excludeFromCreate, context-injected column the polymorphism engine\n * appends per variant; the strict CREATE-DTO strips it from the payload, so it is persisted\n * ONLY by `enrichDataWithContext` reading it off THIS context map. An earlier version passed\n * an EMPTY map → the required scope FK was never injected → Mongoose \"organizationId: Path\n * required\" → every retries-exhausted SIEM delivery was silently lost instead of\n * dead-lettered. An INTERNALLY_INITIATED EC fail-closed rejects org/user identity on\n * `initiatorIds`, so the context map is the ONLY correct channel for the ORGANIZATION scope FK.\n */\n private async _getDlqExecutionContext(\n dlqResourceType: ResourceType,\n scopeFieldIdentifier: string,\n scopeId: string,\n ): Promise<ExecutionContext<any>> {\n return this.executionContextCreator.createForInternalRepositoryOperation({\n resourceType: dlqResourceType,\n operationIdentifier: CoreResourceOperation.CREATE,\n contextResourcesFieldIdentifier: new Map([[scopeFieldIdentifier, scopeId]]),\n initiatorIds: null,\n initiatorRoles: [\n { roles: [CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN], relatedPrimaryScope: ResourcePrimaryScope.APPLICATION },\n ],\n });\n }\n\n // ─────────────────────────────────────────────────────────────\n // H6: SIEM Credential Encryption/Decryption\n // ─────────────────────────────────────────────────────────────\n\n /**\n * Derive a 32-byte AES-256 key from the app's session encryption key\n * using a domain-specific separator to avoid key reuse.\n */\n private _deriveSIEMEncryptionKey(): Buffer {\n const baseKey = this.appConfigService.secrets.security.session.encryptionKey;\n return createHash('sha256')\n .update(`${SIEM_KEY_DOMAIN}:${baseKey}`)\n .digest();\n }\n\n /**\n * H6: Resolve a credential value — decrypts if encrypted, returns as-is if plaintext.\n * Encrypted format: `encrypted:aes-256-gcm:{iv_hex}:{authTag_hex}:{ciphertext_hex}`\n */\n private _resolveCredential(credential: string | undefined): string | undefined {\n if (!credential) return undefined;\n\n if (!credential.startsWith(ENCRYPTED_CREDENTIAL_PREFIX)) {\n // Plaintext credential — log a warning for security awareness\n this.logDebug('SIEM credential is plaintext (not encrypted at rest). Consider re-saving via admin API to encrypt.');\n return credential;\n }\n\n try {\n const payload = credential.slice(ENCRYPTED_CREDENTIAL_PREFIX.length);\n const [ivHex, authTagHex, ciphertextHex] = payload.split(':');\n if (!ivHex || !authTagHex || !ciphertextHex) {\n throw new Error('Invalid encrypted credential format');\n }\n\n const key = this._deriveSIEMEncryptionKey();\n const iv = Buffer.from(ivHex, 'hex');\n const authTag = Buffer.from(authTagHex, 'hex');\n const ciphertext = Buffer.from(ciphertextHex, 'hex');\n\n const decipher = createDecipheriv('aes-256-gcm', key, iv);\n decipher.setAuthTag(authTag);\n\n const decrypted = Buffer.concat([decipher.update(ciphertext), decipher.final()]);\n return decrypted.toString('utf8');\n } catch (error) {\n this.logger.error?.(\n 'Failed to decrypt SIEM credential',\n projectCaughtErrorLogFields(error),\n );\n return undefined;\n }\n }\n\n /**\n * H6: Encrypt a plaintext credential for storage.\n * Returns the encrypted string in format: `encrypted:aes-256-gcm:{iv}:{authTag}:{ciphertext}`\n *\n * Called by admin API when saving SIEM configuration.\n */\n public encryptCredential(plaintext: string): string {\n const key = this._deriveSIEMEncryptionKey();\n const iv = randomBytes(12); // 96-bit IV for GCM\n const cipher = createCipheriv('aes-256-gcm', key, iv);\n\n const encrypted = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);\n const authTag = cipher.getAuthTag();\n\n return `${ENCRYPTED_CREDENTIAL_PREFIX}${iv.toString('hex')}:${authTag.toString('hex')}:${encrypted.toString('hex')}`;\n }\n\n /**\n * Sleep utility for exponential backoff.\n */\n private _sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"leased-value-cache.backend.utils.d.ts","sourceRoot":"","sources":["../../../../../../../src/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AASH,yHAAyH;AACzH,MAAM,WAAW,uBAAuB;IACtC,kHAAkH;IAClH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,qFAAqF;IACrF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnE;AAED;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAOjB,OAAO,CAAC,QAAQ,CAAC,OAAO;IANpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,0GAA0G;IAC1G,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;gBAE5B,OAAO,EAAE,uBAAuB;IAE7D;;;;;;;;OAQG;IACU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IA+BjE;;;;;;;;;OASG;IACI,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKpC,6FAA6F;IACtF,IAAI,IAAI,MAAM;IAIrB,0EAA0E;IACnE,KAAK,IAAI,IAAI;IAMpB;;;;;;OAMG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAMpC,2GAA2G;IAC3G,OAAO,CAAC,SAAS;IAsCjB,sFAAsF;IACtF,OAAO,CAAC,KAAK;CAqBd"}
1
+ {"version":3,"file":"leased-value-cache.backend.utils.d.ts","sourceRoot":"","sources":["../../../../../../src/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AASH,yHAAyH;AACzH,MAAM,WAAW,uBAAuB;IACtC,kHAAkH;IAClH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,qFAAqF;IACrF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnE;AAED;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC;IAOjB,OAAO,CAAC,QAAQ,CAAC,OAAO;IANpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqC;IAC7D,0GAA0G;IAC1G,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,kFAAkF;IAClF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;gBAE5B,OAAO,EAAE,uBAAuB;IAE7D;;;;;;;;OAQG;IACU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IA+BjE;;;;;;;;;OASG;IACI,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKpC,6FAA6F;IACtF,IAAI,IAAI,MAAM;IAIrB,0EAA0E;IACnE,KAAK,IAAI,IAAI;IAMpB;;;;;;OAMG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAMpC,2GAA2G;IAC3G,OAAO,CAAC,SAAS;IAsCjB,sFAAsF;IACtF,OAAO,CAAC,KAAK;CAqBd"}