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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (853) hide show
  1. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  2. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
  3. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  4. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  5. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
  6. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  7. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
  8. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
  9. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
  10. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
  11. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
  12. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
  13. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
  14. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
  15. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
  16. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
  18. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  19. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  20. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
  21. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  22. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
  23. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  24. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
  25. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  26. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
  27. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  28. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
  29. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  30. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
  31. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
  33. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  34. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
  35. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
  36. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
  44. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +49 -0
  46. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  47. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +171 -18
  48. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
  51. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +20 -0
  54. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  55. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
  56. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  58. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  59. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
  60. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  61. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
  62. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  63. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
  64. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  65. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
  66. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +529 -41
  68. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  69. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
  70. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  71. package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
  72. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  73. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
  74. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
  75. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
  76. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
  77. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
  78. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
  79. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
  80. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
  81. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
  82. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
  83. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
  84. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
  85. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
  86. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
  87. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
  88. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
  89. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
  90. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  91. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
  92. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  93. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
  94. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  95. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
  96. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  97. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
  98. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
  99. package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
  100. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
  101. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
  102. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  103. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
  104. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  105. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  106. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
  107. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  108. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
  109. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  110. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
  111. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  112. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
  113. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  114. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
  115. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  116. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
  117. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  118. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
  119. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  120. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  121. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
  122. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  123. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
  124. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  125. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
  126. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  127. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
  128. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
  129. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
  130. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
  131. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
  132. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  133. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
  134. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  135. package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
  136. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  137. package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
  138. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  139. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
  140. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  141. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
  142. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  143. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
  144. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  145. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +244 -7
  146. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  147. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +386 -5
  148. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  149. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  150. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
  151. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  152. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
  153. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  154. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
  155. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  156. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
  157. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  158. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
  159. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  160. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
  161. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
  162. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
  163. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
  164. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  165. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +31 -0
  166. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  167. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
  168. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  169. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
  170. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  171. package/dist/esm/config/models/app-config.backend.schemas.d.ts +142 -46
  172. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  173. package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
  174. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  175. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
  176. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  177. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
  178. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  179. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
  180. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  181. package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
  182. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  183. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  184. package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
  185. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  186. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
  187. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  188. package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
  189. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  190. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
  191. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  192. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
  193. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  194. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  195. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
  196. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  197. package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
  198. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  199. package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
  200. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  201. package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
  202. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  203. package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
  204. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  205. package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
  206. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  207. package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
  208. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  209. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
  210. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  211. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
  212. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  213. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
  214. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  215. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
  216. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  217. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
  218. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  219. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
  220. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  221. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
  222. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  223. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  224. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
  225. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
  226. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
  227. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
  228. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
  229. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
  230. package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
  231. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
  232. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
  233. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
  234. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
  235. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
  236. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
  237. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
  238. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
  239. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
  240. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
  241. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  242. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
  243. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  244. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
  245. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
  246. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
  247. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
  248. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
  249. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  250. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
  251. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  252. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  253. package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
  254. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  255. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  256. package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
  257. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  258. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +292 -7
  259. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  260. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +533 -45
  261. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  262. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  263. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
  264. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  265. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  266. package/dist/esm/files/controllers/file.controller.js +21 -13
  267. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  268. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  269. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +39 -15
  270. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  271. package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
  272. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  273. package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
  274. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  275. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
  276. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  277. package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
  278. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  279. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
  280. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  281. package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
  282. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  283. package/dist/esm/files/services/files.backend.service.d.ts +68 -0
  284. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  285. package/dist/esm/files/services/files.backend.service.js +175 -5
  286. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  287. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
  288. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
  289. package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
  290. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
  291. package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
  292. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  293. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  294. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
  295. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  296. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
  297. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  298. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  299. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
  300. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  301. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  302. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
  303. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  304. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
  305. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
  306. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
  307. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
  308. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
  309. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  310. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
  311. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  312. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  313. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
  314. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  315. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
  316. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  317. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
  318. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  319. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
  320. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  321. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
  322. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  323. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
  324. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  325. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
  326. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  327. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
  328. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  329. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
  330. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  331. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
  332. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  333. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  334. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
  335. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  336. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
  337. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  338. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
  339. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  340. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
  341. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  342. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
  343. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  344. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  345. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
  346. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  347. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
  348. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  349. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  350. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
  351. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  352. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
  353. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
  354. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
  355. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
  356. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  357. package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
  358. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  359. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +28 -1
  360. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  361. package/dist/esm/flows-actors/services/agents.backend.service.js +204 -18
  362. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  363. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
  364. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  365. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
  366. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  367. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
  368. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  369. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
  370. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  371. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  372. package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
  373. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  374. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  375. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
  376. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  377. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
  378. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
  379. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
  380. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
  381. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
  382. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  383. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
  384. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  385. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  386. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +8 -4
  387. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  388. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
  389. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  390. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
  391. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  392. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  393. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  394. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
  395. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  396. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
  397. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  398. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
  399. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
  400. package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
  401. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
  402. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
  403. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  404. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
  405. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  406. package/dist/esm/index.d.ts +11 -4
  407. package/dist/esm/index.d.ts.map +1 -1
  408. package/dist/esm/index.js +31 -4
  409. package/dist/esm/index.js.map +1 -1
  410. package/dist/esm/inject/models/container.d.ts.map +1 -1
  411. package/dist/esm/inject/models/container.js +78 -10
  412. package/dist/esm/inject/models/container.js.map +1 -1
  413. package/dist/esm/inject/models/service-types.d.ts +17 -3
  414. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  415. package/dist/esm/inject/models/service-types.js +19 -3
  416. package/dist/esm/inject/models/service-types.js.map +1 -1
  417. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  418. package/dist/esm/mcp/controllers/mcp.controller.js +20 -0
  419. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  420. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
  421. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  422. package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
  423. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  424. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  425. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
  426. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  427. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  428. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
  429. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  430. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
  431. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
  432. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
  433. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
  434. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
  435. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  436. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
  437. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  438. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
  439. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  440. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  441. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
  442. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  443. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
  444. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  445. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  446. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  447. package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
  448. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  449. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
  450. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
  451. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
  452. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
  453. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
  454. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
  455. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
  456. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
  457. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
  458. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  459. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  460. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
  461. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  462. package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
  463. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  464. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
  465. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
  466. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
  467. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
  468. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
  469. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
  470. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
  471. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
  472. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
  473. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
  474. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
  475. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
  476. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
  477. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  478. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
  479. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  480. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
  481. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
  482. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
  483. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
  484. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  485. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
  486. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  487. package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
  488. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  489. package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
  490. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  491. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
  492. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  493. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  494. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
  495. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  496. package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
  497. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  498. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
  499. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  500. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
  501. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  502. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
  503. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  504. package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
  505. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  506. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
  507. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  508. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
  509. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  510. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
  511. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  512. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
  513. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  514. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  515. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
  516. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  517. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  518. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
  519. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  520. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
  521. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  522. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
  523. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  524. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
  525. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
  526. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  527. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  528. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
  529. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  530. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
  531. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
  532. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
  533. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
  534. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
  535. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
  536. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
  537. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
  538. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
  539. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
  540. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
  541. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
  542. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
  543. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
  544. package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
  545. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
  546. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
  547. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  548. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
  549. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  550. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
  551. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  552. package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
  553. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  554. package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
  555. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  556. package/dist/esm/queue/job-consumer.backend.service.js +1 -4
  557. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  558. package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
  559. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  560. package/dist/esm/queue/job-executor.backend.service.js +1 -4
  561. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  562. package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
  563. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  564. package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
  565. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  566. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
  567. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  568. package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
  569. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  570. package/dist/esm/queue/queue.backend.service.d.ts +3 -3
  571. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  572. package/dist/esm/queue/queue.backend.service.js +26 -4
  573. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  574. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
  575. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  576. package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
  577. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  578. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
  579. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  580. package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
  581. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  582. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
  583. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  584. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
  585. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  586. package/dist/esm/requests/service/websocket.service.d.ts +9 -0
  587. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  588. package/dist/esm/requests/service/websocket.service.js +32 -8
  589. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  590. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  591. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +14 -2
  592. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  593. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  594. package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
  595. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  596. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  597. package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
  598. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  599. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
  600. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  601. package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
  602. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  603. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
  604. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  605. package/dist/esm/resources/services/resources-registry.backend.service.js +90 -6
  606. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  607. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
  608. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  609. package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
  610. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  611. package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
  612. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  613. package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
  614. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  615. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
  616. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  617. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  618. package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
  619. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  620. package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
  621. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  622. package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
  623. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  624. package/dist/esm/runtime/services/start-application.backend.service.js +261 -77
  625. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  626. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
  627. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  628. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
  629. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  630. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
  631. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  632. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
  633. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  634. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  635. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
  636. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  637. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
  638. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  639. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
  640. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  641. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
  642. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  643. package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
  644. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  645. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  646. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  647. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  648. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
  649. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  650. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
  651. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  652. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
  653. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  654. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
  655. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  656. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
  657. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  658. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
  659. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  660. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
  661. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  662. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
  663. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  664. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
  665. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  666. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
  667. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  668. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  669. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
  670. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  671. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
  672. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  673. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
  674. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  675. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  676. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
  677. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  678. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  679. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
  680. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  681. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
  682. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  683. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
  684. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  685. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
  686. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  687. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
  688. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  689. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
  690. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  691. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
  692. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  693. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
  694. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  695. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
  696. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  697. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  698. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
  699. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  700. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
  701. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
  702. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
  703. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
  704. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
  705. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  706. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
  707. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  708. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
  709. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  710. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
  711. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  712. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
  713. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  714. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
  715. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  716. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  717. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
  718. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  719. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  720. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
  721. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  722. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
  723. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  724. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
  725. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  726. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
  727. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  728. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
  729. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  730. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
  731. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
  732. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
  733. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
  734. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
  735. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  736. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
  737. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  738. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  739. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
  740. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  741. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
  742. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  743. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
  744. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  745. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
  746. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
  747. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
  748. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
  749. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
  750. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  751. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
  752. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  753. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +74 -8
  754. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  755. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +175 -19
  756. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  757. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
  758. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  759. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
  760. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  761. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
  762. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
  763. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
  764. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
  765. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
  766. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
  767. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
  768. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
  769. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
  770. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
  771. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
  772. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
  773. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
  774. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
  775. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
  776. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
  777. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
  778. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
  779. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
  780. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
  781. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
  782. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  783. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
  784. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
  785. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
  786. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
  787. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
  788. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
  789. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
  790. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
  791. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
  792. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
  793. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
  794. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
  795. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
  796. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
  797. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
  798. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
  799. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
  800. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
  801. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
  802. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  803. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
  804. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
  805. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
  806. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
  807. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
  808. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
  809. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
  810. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
  811. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
  812. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
  813. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
  814. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
  815. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
  816. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
  817. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
  818. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  819. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
  820. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  821. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
  822. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  823. package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
  824. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  825. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
  826. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  827. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
  828. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  829. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
  830. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  831. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
  832. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  833. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  834. package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
  835. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  836. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
  837. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  838. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
  839. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  840. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
  841. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  842. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
  843. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  844. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
  845. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
  846. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
  847. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
  848. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
  849. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
  850. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
  851. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
  852. package/dist/tsconfig.build.tsbuildinfo +1 -1
  853. package/package.json +11 -9
@@ -0,0 +1,258 @@
1
+ /**
2
+ * An outbound HTTP request that CONNECTS to the address it VALIDATED — the half
3
+ * {@link classifyOutboundTargetUrl} and {@link resolvesOnlyToPublicAddresses} structurally cannot do.
4
+ *
5
+ * ## The hole this closes, and why the classifier alone could never close it
6
+ *
7
+ * Every guard in the sibling module answers a question and then hands the answer to somebody else,
8
+ * who makes a SEPARATE connection. That is a check-then-connect, and the guard's own header says so:
9
+ *
10
+ * "⚠️ Residual, stated rather than hidden: this is a check-then-connect, so a DNS entry that
11
+ * changes between the two (rebinding) is not covered. Closing it needs the request pinned to the
12
+ * validated address, which Node's `fetch` does not expose."
13
+ *
14
+ * So a name whose A record answers `93.184.216.34` to the validating resolver and `169.254.169.254`
15
+ * to the connecting one passes every check in this directory and still reaches cloud instance
16
+ * metadata. The window is small and entirely attacker-controlled: the attacker owns the zone, so the
17
+ * attacker chooses the TTL and therefore the width of the window.
18
+ *
19
+ * The classifier cannot fix this at any level of effort, because the defect is not in the answer —
20
+ * the answer was correct when it was given. The defect is that the answer is thrown away before the
21
+ * socket is opened.
22
+ *
23
+ * ## The mechanism, chosen after measuring the alternatives
24
+ *
25
+ * `net.Socket.connect` accepts a **`lookup` hook**, and `http.request` / `https.request` pass it
26
+ * straight through. Node calls it at CONNECT time, and the address it returns is the address the
27
+ * socket is opened to — there is no second resolution and therefore no window. Classifying inside
28
+ * the hook makes validation and connection the SAME event rather than two events with a gap.
29
+ *
30
+ * Measured on this Node (2026-09-08) rather than assumed, because each of these decided the design:
31
+ *
32
+ * | probe | result |
33
+ * |---|---|
34
+ * | is `lookup` called for a hostname? | yes, as `lookup(host, { hints, all: true }, cb)` — note `all` |
35
+ * | is `lookup` called for an IP LITERAL? | **no** — `net` short-circuits, so literals need the shape check |
36
+ * | does an error raised inside the hook reach the caller? | yes, same error object, `message` and `code` intact |
37
+ * | does TLS still verify against the NAME while connected to the pinned IP? | **yes** — a cert for `pinned.test` validated over a socket to `127.0.0.1` |
38
+ *
39
+ * That last row is what makes the whole approach viable. Pinning by rewriting the URL's host to the
40
+ * validated IP — the obvious alternative — breaks SNI and certificate verification, i.e. it trades an
41
+ * SSRF hole for a transport-security hole. Pinning through `lookup` keeps the hostname everywhere it
42
+ * is a security input (SNI, certificate subject, the `Host` header) and replaces it only where it is
43
+ * a routing input.
44
+ *
45
+ * ## Why this is not `fetch` with a dispatcher
46
+ *
47
+ * Node's `fetch` exposes no `lookup` hook. The undici route (`new Agent({ connect: { lookup } })`)
48
+ * would work, but undici is not a declared dependency of this package — it is present in the store
49
+ * only transitively — so taking it would add a second HTTP stack beside the one Node already embeds,
50
+ * for a hook `node:https` exposes natively. Rejected on that basis, not on preference.
51
+ *
52
+ * `node:https` also gives one property for free that `fetch` needs an option for: **it does not
53
+ * follow redirects at all.** A 302 arrives as a 302 the caller can see. `redirect: 'error'` is
54
+ * therefore not something this module has to remember to pass — following a redirect to a target the
55
+ * guard never saw is unrepresentable here.
56
+ *
57
+ * ## What this still does NOT do
58
+ *
59
+ * It does not defend a target that is public at connect time and hostile at the application layer,
60
+ * and it does not stop a public host from being an open proxy into somebody else's private network.
61
+ * Those are different problems with different answers. What it removes is the specific gap between
62
+ * "we checked this name" and "we opened this socket".
63
+ *
64
+ * assurance-control: WILDO.NETWORK.OUTBOUND_TARGET_CONTROL — a server-side request initiated from
65
+ * application- or tenant-authored configuration reaches only an address the deployment admits
66
+ */
67
+ import { lookup as dnsLookup } from 'node:dns';
68
+ import { request as httpRequest, Agent as HttpAgent } from 'node:http';
69
+ import { request as httpsRequest, Agent as HttpsAgent } from 'node:https';
70
+ import { Readable } from 'node:stream';
71
+ import { OutboundTargetRejection, classifyOutboundTargetUrl, isPrivateOrReservedIpAddress, } from '../../security/ssrf/outbound-target-guard.backend.utils.js';
72
+ /**
73
+ * Raised when the target was refused. Carries the closed-vocabulary reason so a caller can map it
74
+ * onto its OWN rejection vocabulary rather than pattern-matching a message.
75
+ *
76
+ * `refusedAddress` is present only for a connect-time refusal — it is the address the resolver
77
+ * returned at the moment of connection, which is the evidence that a rebinding attempt happened
78
+ * rather than a merely mis-authored URL.
79
+ */
80
+ export class OutboundTargetRefusedError extends Error {
81
+ rejection;
82
+ refusedAddress;
83
+ /**
84
+ * A stable `code` alongside the class, because the error crosses `net`'s internals on its way out
85
+ * of the `lookup` hook. The class identity survives on this Node (measured), but a `code` is what
86
+ * every other error in that path carries and it costs nothing to be robust to a future wrap.
87
+ */
88
+ code = 'WILDO_OUTBOUND_TARGET_REFUSED';
89
+ constructor(rejection, refusedAddress) {
90
+ super(`Outbound target refused: ${rejection}${refusedAddress ? ` (${refusedAddress})` : ''}`);
91
+ this.rejection = rejection;
92
+ this.refusedAddress = refusedAddress;
93
+ this.name = 'OutboundTargetRefusedError';
94
+ }
95
+ }
96
+ /**
97
+ * Connections are NOT pooled, deliberately.
98
+ *
99
+ * Two reasons, in order of weight. First, a pooled socket skips the `lookup` hook on reuse, so the
100
+ * connect-time classification would run on the first request to a host and not on later ones — the
101
+ * guard would hold or not hold depending on pool state, which is the least auditable property a
102
+ * security control can have. (Reuse would in fact be SAFE, because a pooled socket is already
103
+ * connected to an address this module validated — but "safe because of a subtlety in another
104
+ * module's cache" is not a property to rest a control on.) Second, these targets are strangers:
105
+ * pooling keeps an idle socket open per tenant-authored host, which is an unbounded resource keyed
106
+ * on attacker-supplied strings.
107
+ *
108
+ * The cost is one TCP+TLS handshake per request, on a path that runs at webhook cadence rather than
109
+ * per user request.
110
+ */
111
+ const PINNED_HTTP_AGENT = new HttpAgent({ keepAlive: false });
112
+ const PINNED_HTTPS_AGENT = new HttpsAgent({ keepAlive: false });
113
+ /**
114
+ * Classify the URL's SHAPE before anything leaves the process.
115
+ *
116
+ * This is not redundant with the connection hook, and the reason is measured: `net` short-circuits
117
+ * DNS for an IP LITERAL, so `https://169.254.169.254/latest/meta-data` never calls `lookup` and the
118
+ * hook would never see it. The shape check is the ONLY thing standing in front of a literal target.
119
+ */
120
+ function classifyShape(rawUrl, init) {
121
+ const rejection = classifyOutboundTargetUrl(rawUrl, { admittedProtocols: init.admittedProtocols });
122
+ if (rejection === undefined)
123
+ return undefined;
124
+ if (init.admitPrivateAddresses
125
+ && (rejection === OutboundTargetRejection.PRIVATE_OR_RESERVED_ADDRESS
126
+ || rejection === OutboundTargetRejection.RESERVED_SPECIAL_USE_HOSTNAME)) {
127
+ // The operator declared this deployment reaches internal collectors. The scheme and
128
+ // credentials-in-URL refusals are NOT part of that declaration and fall through unchanged.
129
+ return undefined;
130
+ }
131
+ return rejection;
132
+ }
133
+ const defaultResolver = (hostname) => new Promise((resolve, reject) => {
134
+ dnsLookup(hostname, { all: true }, (error, addresses) => (error ? reject(error) : resolve(addresses)));
135
+ });
136
+ /**
137
+ * Make the request, connecting only to an address classified at the moment of connection.
138
+ *
139
+ * Returns a real {@link Response} built over the incoming message, so callers keep `ok`, `status`,
140
+ * `headers.get()`, `body.getReader()` and `text()` — every surface the `fetch` this replaces gave
141
+ * them. It is a genuine `Response`, not a look-alike: streaming size enforcement (CIMD reads the body
142
+ * with a running byte counter and cancels the reader) works unchanged.
143
+ *
144
+ * Throws {@link OutboundTargetRefusedError} for a refusal, and whatever `node:http` throws for a
145
+ * transport failure — callers already distinguish those, and conflating them would turn "your
146
+ * collector is down" into "your collector is an SSRF attempt".
147
+ */
148
+ export async function pinnedOutboundFetch(rawUrl, init) {
149
+ const shapeRejection = classifyShape(rawUrl, init);
150
+ if (shapeRejection !== undefined)
151
+ throw new OutboundTargetRefusedError(shapeRejection);
152
+ const url = new URL(rawUrl);
153
+ const resolve = init.resolveAddresses ?? defaultResolver;
154
+ /**
155
+ * The refusal is recorded here as well as thrown, because the throw happens INSIDE a `net`
156
+ * callback. The error object does survive that path on this Node — measured — but a caught error
157
+ * on the outside is only usefully classified if we can answer "was it ours?" without depending on
158
+ * that. The box answers it from our own frame.
159
+ */
160
+ let connectRefusal;
161
+ const requestFn = url.protocol === 'https:' ? httpsRequest : httpRequest;
162
+ const agent = url.protocol === 'https:' ? PINNED_HTTPS_AGENT : PINNED_HTTP_AGENT;
163
+ const body = init.body;
164
+ const headers = { ...init.headers };
165
+ if (body !== undefined)
166
+ headers['content-length'] = String(Buffer.byteLength(body, 'utf8'));
167
+ try {
168
+ const response = await new Promise((resolveResponse, rejectResponse) => {
169
+ const request = requestFn({
170
+ protocol: url.protocol,
171
+ hostname: url.hostname.replace(/^\[|\]$/g, ''), // an IPv6 literal arrives bracketed from `URL`
172
+ port: url.port || undefined,
173
+ path: `${url.pathname}${url.search}`,
174
+ method: init.method ?? 'GET',
175
+ headers,
176
+ agent,
177
+ signal: init.signal,
178
+ /**
179
+ * THE PIN. Every address the resolver returns is classified here, and the connection is
180
+ * made to one of the addresses that passed — the same values, in the same event.
181
+ *
182
+ * ALL answers are checked rather than the one we hand back, because a hostile resolver can
183
+ * return one public and one private address and rely on the client picking the other. That
184
+ * is the same reasoning `resolvesOnlyToPublicAddresses` states; keeping it here means the
185
+ * property does not depend on which resolver the caller pre-checked with.
186
+ *
187
+ * An empty answer is a refusal rather than a fall-through: the resolver succeeded and told
188
+ * us nothing usable, which is not evidence the name is safe.
189
+ */
190
+ lookup: ((hostname, options, callback) => {
191
+ /**
192
+ * `callback` is typed as requiring an address even on the error path, so every refusal
193
+ * hands back an empty list beside the error. Node's `lookupAndConnect` tests the error
194
+ * FIRST and destroys the socket, so the list is never read — this is a type obligation,
195
+ * not a fallback the connection could take.
196
+ */
197
+ const refuse = (refusal) => {
198
+ connectRefusal = refusal;
199
+ callback(refusal, []);
200
+ };
201
+ resolve(hostname).then((resolved) => {
202
+ const addresses = resolved.map((entry) => ({ address: entry.address, family: entry.family }));
203
+ if (addresses.length === 0) {
204
+ refuse(new OutboundTargetRefusedError(OutboundTargetRejection.PRIVATE_OR_RESERVED_ADDRESS));
205
+ return;
206
+ }
207
+ if (!init.admitPrivateAddresses) {
208
+ const refused = addresses.find((entry) => isPrivateOrReservedIpAddress(entry.address));
209
+ if (refused) {
210
+ refuse(new OutboundTargetRefusedError(OutboundTargetRejection.PRIVATE_OR_RESERVED_ADDRESS, refused.address));
211
+ return;
212
+ }
213
+ }
214
+ // `all` is what Node passes today; the single-address form is honoured so a future
215
+ // Node calling the hook the other way does not silently reach the `Invalid IP
216
+ // address: undefined` failure that the first draft of this hook produced.
217
+ if (options.all)
218
+ callback(null, addresses);
219
+ else
220
+ callback(null, addresses[0].address, addresses[0].family);
221
+ }, (error) => callback(error, []));
222
+ }),
223
+ }, (incoming) => {
224
+ const responseHeaders = new Headers();
225
+ for (const [name, value] of Object.entries(incoming.headers)) {
226
+ if (typeof value === 'string')
227
+ responseHeaders.set(name, value);
228
+ else if (Array.isArray(value))
229
+ for (const one of value)
230
+ responseHeaders.append(name, one);
231
+ }
232
+ resolveResponse(new Response(
233
+ // A 204/304 carries no body; `Response` refuses a body on those statuses, so the
234
+ // stream is only attached where one is permitted.
235
+ incoming.statusCode === 204 || incoming.statusCode === 304
236
+ ? null
237
+ : Readable.toWeb(incoming), {
238
+ status: incoming.statusCode ?? 502,
239
+ statusText: incoming.statusMessage ?? '',
240
+ headers: responseHeaders,
241
+ }));
242
+ });
243
+ request.on('error', rejectResponse);
244
+ if (body !== undefined)
245
+ request.write(body);
246
+ request.end();
247
+ });
248
+ return response;
249
+ }
250
+ catch (error) {
251
+ // A refusal raised inside the hook surfaces here wrapped in whatever `net` did with it. Prefer
252
+ // our own record of it, so the caller's classification never depends on error identity.
253
+ if (connectRefusal)
254
+ throw connectRefusal;
255
+ throw error;
256
+ }
257
+ }
258
+ //# sourceMappingURL=pinned-outbound-fetch.backend.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pinned-outbound-fetch.backend.utils.js","sourceRoot":"","sources":["../../../../../src/security/ssrf/pinned-outbound-fetch.backend.utils.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * An outbound HTTP request that CONNECTS to the address it VALIDATED — the half\n * {@link classifyOutboundTargetUrl} and {@link resolvesOnlyToPublicAddresses} structurally cannot do.\n *\n * ## The hole this closes, and why the classifier alone could never close it\n *\n * Every guard in the sibling module answers a question and then hands the answer to somebody else,\n * who makes a SEPARATE connection. That is a check-then-connect, and the guard's own header says so:\n *\n * \"⚠️ Residual, stated rather than hidden: this is a check-then-connect, so a DNS entry that\n * changes between the two (rebinding) is not covered. Closing it needs the request pinned to the\n * validated address, which Node's `fetch` does not expose.\"\n *\n * So a name whose A record answers `93.184.216.34` to the validating resolver and `169.254.169.254`\n * to the connecting one passes every check in this directory and still reaches cloud instance\n * metadata. The window is small and entirely attacker-controlled: the attacker owns the zone, so the\n * attacker chooses the TTL and therefore the width of the window.\n *\n * The classifier cannot fix this at any level of effort, because the defect is not in the answer —\n * the answer was correct when it was given. The defect is that the answer is thrown away before the\n * socket is opened.\n *\n * ## The mechanism, chosen after measuring the alternatives\n *\n * `net.Socket.connect` accepts a **`lookup` hook**, and `http.request` / `https.request` pass it\n * straight through. Node calls it at CONNECT time, and the address it returns is the address the\n * socket is opened to — there is no second resolution and therefore no window. Classifying inside\n * the hook makes validation and connection the SAME event rather than two events with a gap.\n *\n * Measured on this Node (2026-09-08) rather than assumed, because each of these decided the design:\n *\n * | probe | result |\n * |---|---|\n * | is `lookup` called for a hostname? | yes, as `lookup(host, { hints, all: true }, cb)` — note `all` |\n * | is `lookup` called for an IP LITERAL? | **no** — `net` short-circuits, so literals need the shape check |\n * | does an error raised inside the hook reach the caller? | yes, same error object, `message` and `code` intact |\n * | does TLS still verify against the NAME while connected to the pinned IP? | **yes** — a cert for `pinned.test` validated over a socket to `127.0.0.1` |\n *\n * That last row is what makes the whole approach viable. Pinning by rewriting the URL's host to the\n * validated IP — the obvious alternative — breaks SNI and certificate verification, i.e. it trades an\n * SSRF hole for a transport-security hole. Pinning through `lookup` keeps the hostname everywhere it\n * is a security input (SNI, certificate subject, the `Host` header) and replaces it only where it is\n * a routing input.\n *\n * ## Why this is not `fetch` with a dispatcher\n *\n * Node's `fetch` exposes no `lookup` hook. The undici route (`new Agent({ connect: { lookup } })`)\n * would work, but undici is not a declared dependency of this package — it is present in the store\n * only transitively — so taking it would add a second HTTP stack beside the one Node already embeds,\n * for a hook `node:https` exposes natively. Rejected on that basis, not on preference.\n *\n * `node:https` also gives one property for free that `fetch` needs an option for: **it does not\n * follow redirects at all.** A 302 arrives as a 302 the caller can see. `redirect: 'error'` is\n * therefore not something this module has to remember to pass — following a redirect to a target the\n * guard never saw is unrepresentable here.\n *\n * ## What this still does NOT do\n *\n * It does not defend a target that is public at connect time and hostile at the application layer,\n * and it does not stop a public host from being an open proxy into somebody else's private network.\n * Those are different problems with different answers. What it removes is the specific gap between\n * \"we checked this name\" and \"we opened this socket\".\n *\n * assurance-control: WILDO.NETWORK.OUTBOUND_TARGET_CONTROL — a server-side request initiated from\n * application- or tenant-authored configuration reaches only an address the deployment admits\n */\n\nimport { lookup as dnsLookup, type LookupAddress } from 'node:dns';\nimport { request as httpRequest, Agent as HttpAgent, type ClientRequest, type IncomingMessage } from 'node:http';\nimport type { LookupFunction } from 'node:net';\nimport { request as httpsRequest, Agent as HttpsAgent } from 'node:https';\nimport { Readable } from 'node:stream';\n\nimport {\n OutboundTargetRejection,\n classifyOutboundTargetUrl,\n isPrivateOrReservedIpAddress,\n type OutboundTargetPolicy,\n} from '~wildo-backend-lib/security/ssrf/outbound-target-guard.backend.utils';\n\n/**\n * Raised when the target was refused. Carries the closed-vocabulary reason so a caller can map it\n * onto its OWN rejection vocabulary rather than pattern-matching a message.\n *\n * `refusedAddress` is present only for a connect-time refusal — it is the address the resolver\n * returned at the moment of connection, which is the evidence that a rebinding attempt happened\n * rather than a merely mis-authored URL.\n */\nexport class OutboundTargetRefusedError extends Error {\n /**\n * A stable `code` alongside the class, because the error crosses `net`'s internals on its way out\n * of the `lookup` hook. The class identity survives on this Node (measured), but a `code` is what\n * every other error in that path carries and it costs nothing to be robust to a future wrap.\n */\n public readonly code = 'WILDO_OUTBOUND_TARGET_REFUSED';\n\n constructor(\n public readonly rejection: OutboundTargetRejection,\n public readonly refusedAddress?: string,\n ) {\n super(`Outbound target refused: ${rejection}${refusedAddress ? ` (${refusedAddress})` : ''}`);\n this.name = 'OutboundTargetRefusedError';\n }\n}\n\n/** The `dns.lookup` shape the connection hook needs, injectable so a test can drive both branches. */\nexport type PinnedAddressResolver = (hostname: string) => Promise<readonly LookupAddress[]>;\n\nexport interface PinnedOutboundRequestInit extends OutboundTargetPolicy {\n method?: string;\n headers?: Readonly<Record<string, string>>;\n /** Already-serialized request body. `content-length` is computed here; do not pass one. */\n body?: string;\n signal?: AbortSignal;\n\n /**\n * OPERATOR-authored escape: admit an address the public internet cannot reach.\n *\n * It exists because one legitimate outbound target class genuinely lives on a private network — a\n * self-hosted SIEM collector on the same VPC as the application. Refusing that unconditionally\n * would not be \"safe\", it would break a supported deployment shape.\n *\n * Three properties keep it from being an SSRF bypass with a checkbox, and all three are the\n * caller's obligation rather than this module's:\n *\n * 1. **It is never the default.** Absent means refuse.\n * 2. **It must be authored by the DEPLOYMENT OPERATOR, never by the tenant whose row supplies the\n * URL.** A tenant-settable \"allow private addresses\" flag hands the attacker the switch that\n * disarms the guard aimed at them. This is why the SIEM escape lives on the application\n * configuration and not on `siemExportConfig`, which an organization administrator authors.\n * 3. **It must never reach a target class whose URL comes from an UNAUTHENTICATED stranger.** CIMD\n * resolves a `client_id` supplied by anyone who can reach the authorization endpoint; there is\n * no operator on earth who means \"let strangers address my metadata service\".\n *\n * Note what it does NOT relax: the scheme policy and the credentials-in-URL refusal still apply,\n * and the connection is still pinned. It widens WHICH addresses are admitted, never whether the\n * address that was admitted is the one connected to.\n */\n admitPrivateAddresses?: boolean;\n\n /**\n * Resolver used by the connection hook. Defaults to the system resolver.\n *\n * Injectable for the same reason `resolvesOnlyToPublicAddresses` takes one: the two branches that\n * matter (a name that answers public, a name that answers private) cannot be exercised against a\n * real resolver without owning a zone, and a rebinding pin needs a resolver that answers\n * DIFFERENTLY on its second call — which is exactly what no real resolver will do on demand.\n */\n resolveAddresses?: PinnedAddressResolver;\n}\n\n/**\n * Connections are NOT pooled, deliberately.\n *\n * Two reasons, in order of weight. First, a pooled socket skips the `lookup` hook on reuse, so the\n * connect-time classification would run on the first request to a host and not on later ones — the\n * guard would hold or not hold depending on pool state, which is the least auditable property a\n * security control can have. (Reuse would in fact be SAFE, because a pooled socket is already\n * connected to an address this module validated — but \"safe because of a subtlety in another\n * module's cache\" is not a property to rest a control on.) Second, these targets are strangers:\n * pooling keeps an idle socket open per tenant-authored host, which is an unbounded resource keyed\n * on attacker-supplied strings.\n *\n * The cost is one TCP+TLS handshake per request, on a path that runs at webhook cadence rather than\n * per user request.\n */\nconst PINNED_HTTP_AGENT = new HttpAgent({ keepAlive: false });\nconst PINNED_HTTPS_AGENT = new HttpsAgent({ keepAlive: false });\n\n/**\n * Classify the URL's SHAPE before anything leaves the process.\n *\n * This is not redundant with the connection hook, and the reason is measured: `net` short-circuits\n * DNS for an IP LITERAL, so `https://169.254.169.254/latest/meta-data` never calls `lookup` and the\n * hook would never see it. The shape check is the ONLY thing standing in front of a literal target.\n */\nfunction classifyShape(rawUrl: string, init: PinnedOutboundRequestInit): OutboundTargetRejection | undefined {\n const rejection = classifyOutboundTargetUrl(rawUrl, { admittedProtocols: init.admittedProtocols });\n if (rejection === undefined) return undefined;\n\n if (init.admitPrivateAddresses\n && (rejection === OutboundTargetRejection.PRIVATE_OR_RESERVED_ADDRESS\n || rejection === OutboundTargetRejection.RESERVED_SPECIAL_USE_HOSTNAME)) {\n // The operator declared this deployment reaches internal collectors. The scheme and\n // credentials-in-URL refusals are NOT part of that declaration and fall through unchanged.\n return undefined;\n }\n return rejection;\n}\n\nconst defaultResolver: PinnedAddressResolver = (hostname) =>\n new Promise((resolve, reject) => {\n dnsLookup(hostname, { all: true }, (error, addresses) => (error ? reject(error) : resolve(addresses)));\n });\n\n/**\n * Make the request, connecting only to an address classified at the moment of connection.\n *\n * Returns a real {@link Response} built over the incoming message, so callers keep `ok`, `status`,\n * `headers.get()`, `body.getReader()` and `text()` — every surface the `fetch` this replaces gave\n * them. It is a genuine `Response`, not a look-alike: streaming size enforcement (CIMD reads the body\n * with a running byte counter and cancels the reader) works unchanged.\n *\n * Throws {@link OutboundTargetRefusedError} for a refusal, and whatever `node:http` throws for a\n * transport failure — callers already distinguish those, and conflating them would turn \"your\n * collector is down\" into \"your collector is an SSRF attempt\".\n */\nexport async function pinnedOutboundFetch(rawUrl: string, init: PinnedOutboundRequestInit): Promise<Response> {\n const shapeRejection = classifyShape(rawUrl, init);\n if (shapeRejection !== undefined) throw new OutboundTargetRefusedError(shapeRejection);\n\n const url = new URL(rawUrl);\n const resolve = init.resolveAddresses ?? defaultResolver;\n\n /**\n * The refusal is recorded here as well as thrown, because the throw happens INSIDE a `net`\n * callback. The error object does survive that path on this Node — measured — but a caught error\n * on the outside is only usefully classified if we can answer \"was it ours?\" without depending on\n * that. The box answers it from our own frame.\n */\n let connectRefusal: OutboundTargetRefusedError | undefined;\n\n const requestFn = url.protocol === 'https:' ? httpsRequest : httpRequest;\n const agent = url.protocol === 'https:' ? PINNED_HTTPS_AGENT : PINNED_HTTP_AGENT;\n\n const body = init.body;\n const headers: Record<string, string> = { ...init.headers };\n if (body !== undefined) headers['content-length'] = String(Buffer.byteLength(body, 'utf8'));\n\n try {\n const response = await new Promise<Response>((resolveResponse, rejectResponse) => {\n const request: ClientRequest = requestFn(\n {\n protocol: url.protocol,\n hostname: url.hostname.replace(/^\\[|\\]$/g, ''), // an IPv6 literal arrives bracketed from `URL`\n port: url.port || undefined,\n path: `${url.pathname}${url.search}`,\n method: init.method ?? 'GET',\n headers,\n agent,\n signal: init.signal,\n\n /**\n * THE PIN. Every address the resolver returns is classified here, and the connection is\n * made to one of the addresses that passed — the same values, in the same event.\n *\n * ALL answers are checked rather than the one we hand back, because a hostile resolver can\n * return one public and one private address and rely on the client picking the other. That\n * is the same reasoning `resolvesOnlyToPublicAddresses` states; keeping it here means the\n * property does not depend on which resolver the caller pre-checked with.\n *\n * An empty answer is a refusal rather than a fall-through: the resolver succeeded and told\n * us nothing usable, which is not evidence the name is safe.\n */\n lookup: ((hostname, options, callback) => {\n /**\n * `callback` is typed as requiring an address even on the error path, so every refusal\n * hands back an empty list beside the error. Node's `lookupAndConnect` tests the error\n * FIRST and destroys the socket, so the list is never read — this is a type obligation,\n * not a fallback the connection could take.\n */\n const refuse = (refusal: OutboundTargetRefusedError): void => {\n connectRefusal = refusal;\n callback(refusal as NodeJS.ErrnoException, []);\n };\n resolve(hostname).then(\n (resolved) => {\n const addresses: LookupAddress[] = resolved.map((entry) => ({ address: entry.address, family: entry.family }));\n if (addresses.length === 0) {\n refuse(new OutboundTargetRefusedError(OutboundTargetRejection.PRIVATE_OR_RESERVED_ADDRESS));\n return;\n }\n if (!init.admitPrivateAddresses) {\n const refused = addresses.find((entry) => isPrivateOrReservedIpAddress(entry.address));\n if (refused) {\n refuse(new OutboundTargetRefusedError(OutboundTargetRejection.PRIVATE_OR_RESERVED_ADDRESS, refused.address));\n return;\n }\n }\n // `all` is what Node passes today; the single-address form is honoured so a future\n // Node calling the hook the other way does not silently reach the `Invalid IP\n // address: undefined` failure that the first draft of this hook produced.\n if ((options as { all?: boolean }).all) callback(null, addresses);\n else callback(null, addresses[0].address, addresses[0].family);\n },\n (error: NodeJS.ErrnoException) => callback(error, []),\n );\n }) satisfies LookupFunction,\n },\n (incoming: IncomingMessage) => {\n const responseHeaders = new Headers();\n for (const [name, value] of Object.entries(incoming.headers)) {\n if (typeof value === 'string') responseHeaders.set(name, value);\n else if (Array.isArray(value)) for (const one of value) responseHeaders.append(name, one);\n }\n resolveResponse(\n new Response(\n // A 204/304 carries no body; `Response` refuses a body on those statuses, so the\n // stream is only attached where one is permitted.\n incoming.statusCode === 204 || incoming.statusCode === 304\n ? null\n : (Readable.toWeb(incoming) as ReadableStream<Uint8Array>),\n {\n status: incoming.statusCode ?? 502,\n statusText: incoming.statusMessage ?? '',\n headers: responseHeaders,\n },\n ),\n );\n },\n );\n\n request.on('error', rejectResponse);\n if (body !== undefined) request.write(body);\n request.end();\n });\n return response;\n } catch (error) {\n // A refusal raised inside the hook surfaces here wrapped in whatever `net` did with it. Prefer\n // our own record of it, so the caller's classification never depends on error identity.\n if (connectRefusal) throw connectRefusal;\n throw error;\n }\n}\n"]}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * `users | read_retained` — the operator surface for the audited see-through read (#490).
3
+ *
4
+ * # What this replaced: a capability nothing could reach
5
+ *
6
+ * `SystemAccessBackendService.readRetainedAsSystem` is the sanctioned way to reveal a RETAINED
7
+ * (erased-and-impersonalized) user row. It has been complete and correct since retention landed —
8
+ * it asserts the `seeRetained` policy verb, demands a privileged role, refuses a blank attribution,
9
+ * sets the see-through flag for that read only, and emits a human-attributed `RETAINED_DATA_ACCESS`
10
+ * audit row.
11
+ *
12
+ * And it had **no caller**. Measured: the only references were the factory that derives its grant
13
+ * and the schema prose describing it as LIVE. So the capability existed, was audited by
14
+ * construction, and the only route an operator actually had to a retained record was a database
15
+ * console — which is precisely the unaudited path the primitive was built to replace.
16
+ *
17
+ * # Why an authenticated resource operation, and not an admin controller
18
+ *
19
+ * The engine already has an operator-facing admin controller pattern (`data-seeding-admin`), and it
20
+ * is the wrong shape here: it authenticates with a shared `X-Admin-Secret`, which yields no user id
21
+ * and no roles. The primitive requires BOTH — it fail-closes on a blank `accessingUserId`, and the
22
+ * audit row's entire purpose is to say WHO looked. A shared secret answers "someone who holds the
23
+ * secret", which is the question the record exists to improve on.
24
+ *
25
+ * A resource operation runs inside the application's own authentication and authorization, so the
26
+ * caller's identity and roles arrive already established and cannot be self-asserted.
27
+ *
28
+ * # Application tier, deliberately — not platform tier
29
+ *
30
+ * A retention policy is an application's decision about its own data, the role gate the primitive
31
+ * enforces (`APP_ADMIN_SUPER_ADMIN`) is an application role, and the system context the primitive
32
+ * builds is APPLICATION-scoped. A platform-tier version would cross tenants, and would therefore
33
+ * come under the declared cross-tenant admission rules and the `PLATFORM_ACCESS_GRANTS` requirement
34
+ * rather than an ordinary role check. That is a bigger, different door; it is not this one, and it
35
+ * should not be added by widening this one.
36
+ */
37
+ import { type ResourceCustomServiceImplementationFactory } from '../../base-classes/services/services/resource-operation-custom-implementation.factory.backend';
38
+ export declare function createUserReadRetainedFactories(): ResourceCustomServiceImplementationFactory[];
39
+ //# sourceMappingURL=user-read-retained.custom-impl.backend.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-read-retained.custom-impl.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/users/services/user-read-retained.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAWH,OAAO,EAEL,KAAK,0CAA0C,EAChD,MAAM,4GAA4G,CAAC;AA0GpH,wBAAgB,+BAA+B,IAAI,0CAA0C,EAAE,CA4D9F"}
@@ -0,0 +1,159 @@
1
+ /**
2
+ * `users | read_retained` — the operator surface for the audited see-through read (#490).
3
+ *
4
+ * # What this replaced: a capability nothing could reach
5
+ *
6
+ * `SystemAccessBackendService.readRetainedAsSystem` is the sanctioned way to reveal a RETAINED
7
+ * (erased-and-impersonalized) user row. It has been complete and correct since retention landed —
8
+ * it asserts the `seeRetained` policy verb, demands a privileged role, refuses a blank attribution,
9
+ * sets the see-through flag for that read only, and emits a human-attributed `RETAINED_DATA_ACCESS`
10
+ * audit row.
11
+ *
12
+ * And it had **no caller**. Measured: the only references were the factory that derives its grant
13
+ * and the schema prose describing it as LIVE. So the capability existed, was audited by
14
+ * construction, and the only route an operator actually had to a retained record was a database
15
+ * console — which is precisely the unaudited path the primitive was built to replace.
16
+ *
17
+ * # Why an authenticated resource operation, and not an admin controller
18
+ *
19
+ * The engine already has an operator-facing admin controller pattern (`data-seeding-admin`), and it
20
+ * is the wrong shape here: it authenticates with a shared `X-Admin-Secret`, which yields no user id
21
+ * and no roles. The primitive requires BOTH — it fail-closes on a blank `accessingUserId`, and the
22
+ * audit row's entire purpose is to say WHO looked. A shared secret answers "someone who holds the
23
+ * secret", which is the question the record exists to improve on.
24
+ *
25
+ * A resource operation runs inside the application's own authentication and authorization, so the
26
+ * caller's identity and roles arrive already established and cannot be self-asserted.
27
+ *
28
+ * # Application tier, deliberately — not platform tier
29
+ *
30
+ * A retention policy is an application's decision about its own data, the role gate the primitive
31
+ * enforces (`APP_ADMIN_SUPER_ADMIN`) is an application role, and the system context the primitive
32
+ * builds is APPLICATION-scoped. A platform-tier version would cross tenants, and would therefore
33
+ * come under the declared cross-tenant admission rules and the `PLATFORM_ACCESS_GRANTS` requirement
34
+ * rather than an ordinary role check. That is a bigger, different door; it is not this one, and it
35
+ * should not be added by widening this one.
36
+ */
37
+ import { CoreResourceType, ErrorCustomMessageReference, ErrorType, ResourceOperationVariantType, Users_Operations, } from '@wildo-ai/saas-models';
38
+ import { createResourceCustomServiceImplementation, } from '../../base-classes/services/services/resource-operation-custom-implementation.factory.backend.js';
39
+ import { describeUnaddressableShape, resolveSingleSubjectId, } from '../../base-classes/utils/single-subject-addressing.backend.utils.js';
40
+ import { SAAS_SERVICE_TYPES } from '../../inject/models/service-types.js';
41
+ /**
42
+ * Resolve and validate the whole request, or throw.
43
+ *
44
+ * PURE and idempotent, so the PREFIX phase can run it to refuse before anything happens and the
45
+ * REPLACE phase can re-derive the same values without state threaded between them — the shape the
46
+ * sibling `force_password_reset` implementation records.
47
+ */
48
+ function resolveValidatedRetainedReadRequest(id, input, executionContext, utils) {
49
+ // Exactly one subject. A population-addressed reveal would disclose every retained row matching a
50
+ // filter on one operator's single stated reason, and the audit row would record that reason
51
+ // against a disclosure nobody sized.
52
+ const subjectUserId = resolveSingleSubjectId(id);
53
+ if (subjectUserId === undefined) {
54
+ throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {
55
+ customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,
56
+ context: {
57
+ reason: 'read_retained requires a single addressed user id',
58
+ receivedAddressing: describeUnaddressableShape(id),
59
+ },
60
+ });
61
+ }
62
+ /*
63
+ * A HUMAN, and only a human.
64
+ *
65
+ * The sibling `force_password_reset` accepts a machine credential as attribution, and that is
66
+ * right there: a forced reset is an administrative ACT whose provenance is the strongest
67
+ * attribution available for a machine caller. This is different. The record being written says a
68
+ * named person chose to look at data an erasure removed, for a reason they wrote down — and an
69
+ * API key can supply neither half. `machineCredential` would answer "which credential", never
70
+ * "who", and the audit row is the whole reason this read is permitted at all.
71
+ */
72
+ const accessingUserId = executionContext.initiatorIds?.userId;
73
+ if (!accessingUserId) {
74
+ throw utils.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {
75
+ context: {
76
+ reason: 'read_retained_requires_human_principal',
77
+ message: 'Revealing a retained (erased) record requires an authenticated human principal. A machine '
78
+ + 'credential cannot supply the attribution this reveal is audited on.',
79
+ },
80
+ });
81
+ }
82
+ /*
83
+ * Roles from the ESTABLISHED session, never from the request body.
84
+ *
85
+ * The primitive re-asserts the privileged role itself, and it can only assert what it is handed —
86
+ * so handing it a request-supplied list would let a caller name their own authorization. The
87
+ * execution context's roles were established by authentication and cannot be written by the
88
+ * caller. Flattened across scopes because the primitive tests for one member, not for a scope.
89
+ */
90
+ const accessingUserRoles = (executionContext.initiatorRoles ?? []).flatMap((roleInfo) => [...roleInfo.roles]);
91
+ const reason = typeof input?.reason === 'string'
92
+ ? (input.reason).trim()
93
+ : '';
94
+ if (!reason) {
95
+ // Also enforced by the request DTO and again inside the primitive. Three sites, because the
96
+ // audit store persists `eventData` unparsed: a blank reason that reached the row would produce a
97
+ // reveal recorded with no justification, which is indistinguishable from an unaudited one.
98
+ throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {
99
+ customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,
100
+ context: {
101
+ reason: 'read_retained requires a non-empty justification',
102
+ message: 'Provide `reason`: why this retained record is being revealed (legal hold, dispute, investigation).',
103
+ },
104
+ });
105
+ }
106
+ return { subjectUserId, accessingUserId, accessingUserRoles, reason };
107
+ }
108
+ export function createUserReadRetainedFactories() {
109
+ const factory = (_resourcesRegistryService, container) => createResourceCustomServiceImplementation({
110
+ operationPath: {
111
+ resourceIdentifier: CoreResourceType.USERS,
112
+ operationIdentifier: Users_Operations.READ_RETAINED,
113
+ variantType: ResourceOperationVariantType.API_CALL,
114
+ isOperationDefault: true,
115
+ },
116
+ debugLabel: 'users.read_retained.see-through-reveal',
117
+ handlers: {
118
+ // Every refusal lives in PREFIX, the only phase that runs before the core write — so a
119
+ // rejected request cannot have touched the row on its way to being rejected.
120
+ prefixCoreOperations: async (id, input, executionContext, _operationPath, utils) => {
121
+ resolveValidatedRetainedReadRequest(id, input, executionContext, utils);
122
+ return input;
123
+ },
124
+ /*
125
+ * REPLACE, because the operation is UPDATE-like and must WRITE NOTHING.
126
+ *
127
+ * `resourceOperationLike: UPDATE` is how the operation gets a PUT with a body — the request
128
+ * carries a free-text justification, and a GET would put it in the URL and therefore in
129
+ * every access log between the operator and the server. Left to the generic core path, that
130
+ * declaration would make this a real update: a retained row is frozen, so it would fail, and
131
+ * on a resource that did not freeze it, it would silently write. Replacing the core
132
+ * operation is what makes an UPDATE-shaped route a read.
133
+ */
134
+ replaceCoreOperations: async (id, input, executionContext, _operationPath, utils) => {
135
+ const { subjectUserId, accessingUserId, accessingUserRoles, reason } = resolveValidatedRetainedReadRequest(id, input, executionContext, utils);
136
+ const systemAccess = container.get(SAAS_SERVICE_TYPES.SystemAccessService);
137
+ /*
138
+ * Through the PRIMITIVE, never through the repository.
139
+ *
140
+ * This is the line the whole issue turns on. The same row is reachable by building a
141
+ * super-admin context and reading it directly — and that path asserts no `seeRetained`
142
+ * grant, sets no see-through flag, and writes no audit row. Reaching the repository here
143
+ * would reveal exactly the same personal data with no record of it, which is the outcome
144
+ * the audited pair exists to prevent.
145
+ */
146
+ return await systemAccess.readRetainedAsSystem(CoreResourceType.USERS, subjectUserId, { accessingUserId, accessingUserRoles, reason }, {
147
+ // Scoped to the organization the caller is acting in, when there is one. The primitive
148
+ // suppresses the RETENTION predicate only — never the scope filter — so this cannot
149
+ // widen the read beyond what the caller could otherwise address.
150
+ scopeContext: executionContext.initiatorIds?.organizationId
151
+ ? { organizationId: executionContext.initiatorIds.organizationId }
152
+ : undefined,
153
+ });
154
+ },
155
+ },
156
+ });
157
+ return [factory];
158
+ }
159
+ //# sourceMappingURL=user-read-retained.custom-impl.backend.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-read-retained.custom-impl.backend.service.js","sourceRoot":"","sources":["../../../../../src/users/services/user-read-retained.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EACT,4BAA4B,EAC5B,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,yCAAyC,GAE1C,MAAM,4GAA4G,CAAC;AACpH,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,GACvB,MAAM,+EAA+E,CAAC;AAEvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAsBpF;;;;;;GAMG;AACH,SAAS,mCAAmC,CAC1C,EAAW,EACX,KAAc,EACd,gBAAuC,EACvC,KAAyB;IAEzB,kGAAkG;IAClG,4FAA4F;IAC5F,qCAAqC;IACrC,MAAM,aAAa,GAAG,sBAAsB,CAAC,EAAW,CAAC,CAAC;IAC1D,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,gBAAgB,EAAE;YAC1E,sBAAsB,EAAE,2BAA2B,CAAC,kCAAkC;YACtF,OAAO,EAAE;gBACP,MAAM,EAAE,mDAAmD;gBAC3D,kBAAkB,EAAE,0BAA0B,CAAC,EAAW,CAAC;aAC5D;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,eAAe,GAAG,gBAAgB,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9D,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,EAAE,gBAAgB,EAAE;YAC7E,OAAO,EAAE;gBACP,MAAM,EAAE,wCAAwC;gBAChD,OAAO,EACL,4FAA4F;sBAC1F,qEAAqE;aAC1E;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,kBAAkB,GAAG,CAAC,gBAAgB,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9G,MAAM,MAAM,GAAG,OAAQ,KAA8B,EAAE,MAAM,KAAK,QAAQ;QACxE,CAAC,CAAC,CAAE,KAA4B,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAC/C,CAAC,CAAC,EAAE,CAAC;IACP,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,4FAA4F;QAC5F,iGAAiG;QACjG,2FAA2F;QAC3F,MAAM,KAAK,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,EAAE,gBAAgB,EAAE;YAC1E,sBAAsB,EAAE,2BAA2B,CAAC,kCAAkC;YACtF,OAAO,EAAE;gBACP,MAAM,EAAE,kDAAkD;gBAC1D,OAAO,EAAE,oGAAoG;aAC9G;SACF,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC;AACxE,CAAC;AAED,MAAM,UAAU,+BAA+B;IAC7C,MAAM,OAAO,GAAG,CAAC,yBAA0D,EAAE,SAAoB,EAAE,EAAE,CACnG,yCAAyC,CAAC;QACxC,aAAa,EAAE;YACb,kBAAkB,EAAE,gBAAgB,CAAC,KAAK;YAC1C,mBAAmB,EAAE,gBAAgB,CAAC,aAAa;YACnD,WAAW,EAAE,4BAA4B,CAAC,QAAQ;YAClD,kBAAkB,EAAE,IAAI;SACzB;QACD,UAAU,EAAE,wCAAwC;QACpD,QAAQ,EAAE;YACR,uFAAuF;YACvF,6EAA6E;YAC7E,oBAAoB,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE;gBACjF,mCAAmC,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;gBACxE,OAAO,KAAK,CAAC;YACf,CAAC;YACD;;;;;;;;;eASG;YACH,qBAAqB,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE;gBAClF,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,GAClE,mCAAmC,CAAC,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAC;gBAE1E,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAA6B,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;gBAEvG;;;;;;;;mBAQG;gBACH,OAAO,MAAM,YAAY,CAAC,oBAAoB,CAC5C,gBAAgB,CAAC,KAAK,EACtB,aAAa,EACb,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,EAAE,EAC/C;oBACE,uFAAuF;oBACvF,oFAAoF;oBACpF,iEAAiE;oBACjE,YAAY,EAAE,gBAAgB,CAAC,YAAY,EAAE,cAAc;wBACzD,CAAC,CAAC,EAAE,cAAc,EAAE,gBAAgB,CAAC,YAAY,CAAC,cAAc,EAAE;wBAClE,CAAC,CAAC,SAAS;iBACd,CACF,CAAC;YACJ,CAAC;SACF;KACF,CAAC,CAAC;IAEL,OAAO,CAAC,OAAO,CAAC,CAAC;AACnB,CAAC","sourcesContent":["/**\n * `users | read_retained` — the operator surface for the audited see-through read (#490).\n *\n * # What this replaced: a capability nothing could reach\n *\n * `SystemAccessBackendService.readRetainedAsSystem` is the sanctioned way to reveal a RETAINED\n * (erased-and-impersonalized) user row. It has been complete and correct since retention landed —\n * it asserts the `seeRetained` policy verb, demands a privileged role, refuses a blank attribution,\n * sets the see-through flag for that read only, and emits a human-attributed `RETAINED_DATA_ACCESS`\n * audit row.\n *\n * And it had **no caller**. Measured: the only references were the factory that derives its grant\n * and the schema prose describing it as LIVE. So the capability existed, was audited by\n * construction, and the only route an operator actually had to a retained record was a database\n * console — which is precisely the unaudited path the primitive was built to replace.\n *\n * # Why an authenticated resource operation, and not an admin controller\n *\n * The engine already has an operator-facing admin controller pattern (`data-seeding-admin`), and it\n * is the wrong shape here: it authenticates with a shared `X-Admin-Secret`, which yields no user id\n * and no roles. The primitive requires BOTH — it fail-closes on a blank `accessingUserId`, and the\n * audit row's entire purpose is to say WHO looked. A shared secret answers \"someone who holds the\n * secret\", which is the question the record exists to improve on.\n *\n * A resource operation runs inside the application's own authentication and authorization, so the\n * caller's identity and roles arrive already established and cannot be self-asserted.\n *\n * # Application tier, deliberately — not platform tier\n *\n * A retention policy is an application's decision about its own data, the role gate the primitive\n * enforces (`APP_ADMIN_SUPER_ADMIN`) is an application role, and the system context the primitive\n * builds is APPLICATION-scoped. A platform-tier version would cross tenants, and would therefore\n * come under the declared cross-tenant admission rules and the `PLATFORM_ACCESS_GRANTS` requirement\n * rather than an ordinary role check. That is a bigger, different door; it is not this one, and it\n * should not be added by widening this one.\n */\n\nimport {\n CoreResourceType,\n ErrorCustomMessageReference,\n ErrorType,\n ResourceOperationVariantType,\n Users_Operations,\n} from '@wildo-ai/saas-models';\nimport type { Container } from 'inversify';\n\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport {\n describeUnaddressableShape,\n resolveSingleSubjectId,\n} from '~wildo-backend-lib/base-classes/utils/single-subject-addressing.backend.utils';\nimport type { SystemAccessBackendService } from '~wildo-backend-lib/base-classes/services/services/system-access.backend.service';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\n\ninterface ErrorBuildingUtils {\n errorBuilder: {\n buildError: (\n type: ErrorType,\n executionContext?: unknown,\n options?: { customMessageReference?: ErrorCustomMessageReference; context?: Record<string, unknown> },\n ) => unknown;\n };\n}\n\n/** Everything the reveal needs, resolved from the request and the established session. */\ninterface ValidatedRetainedReadRequest {\n subjectUserId: string;\n accessingUserId: string;\n accessingUserRoles: string[];\n reason: string;\n}\n\n/**\n * Resolve and validate the whole request, or throw.\n *\n * PURE and idempotent, so the PREFIX phase can run it to refuse before anything happens and the\n * REPLACE phase can re-derive the same values without state threaded between them — the shape the\n * sibling `force_password_reset` implementation records.\n */\nfunction resolveValidatedRetainedReadRequest(\n id: unknown,\n input: unknown,\n executionContext: ExecutionContext<any>,\n utils: ErrorBuildingUtils,\n): ValidatedRetainedReadRequest {\n // Exactly one subject. A population-addressed reveal would disclose every retained row matching a\n // filter on one operator's single stated reason, and the audit row would record that reason\n // against a disclosure nobody sized.\n const subjectUserId = resolveSingleSubjectId(id as never);\n if (subjectUserId === undefined) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n reason: 'read_retained requires a single addressed user id',\n receivedAddressing: describeUnaddressableShape(id as never),\n },\n });\n }\n\n /*\n * A HUMAN, and only a human.\n *\n * The sibling `force_password_reset` accepts a machine credential as attribution, and that is\n * right there: a forced reset is an administrative ACT whose provenance is the strongest\n * attribution available for a machine caller. This is different. The record being written says a\n * named person chose to look at data an erasure removed, for a reason they wrote down — and an\n * API key can supply neither half. `machineCredential` would answer \"which credential\", never\n * \"who\", and the audit row is the whole reason this read is permitted at all.\n */\n const accessingUserId = executionContext.initiatorIds?.userId;\n if (!accessingUserId) {\n throw utils.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n context: {\n reason: 'read_retained_requires_human_principal',\n message:\n 'Revealing a retained (erased) record requires an authenticated human principal. A machine '\n + 'credential cannot supply the attribution this reveal is audited on.',\n },\n });\n }\n\n /*\n * Roles from the ESTABLISHED session, never from the request body.\n *\n * The primitive re-asserts the privileged role itself, and it can only assert what it is handed —\n * so handing it a request-supplied list would let a caller name their own authorization. The\n * execution context's roles were established by authentication and cannot be written by the\n * caller. Flattened across scopes because the primitive tests for one member, not for a scope.\n */\n const accessingUserRoles = (executionContext.initiatorRoles ?? []).flatMap((roleInfo) => [...roleInfo.roles]);\n\n const reason = typeof (input as { reason?: unknown })?.reason === 'string'\n ? ((input as { reason: string }).reason).trim()\n : '';\n if (!reason) {\n // Also enforced by the request DTO and again inside the primitive. Three sites, because the\n // audit store persists `eventData` unparsed: a blank reason that reached the row would produce a\n // reveal recorded with no justification, which is indistinguishable from an unaudited one.\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n reason: 'read_retained requires a non-empty justification',\n message: 'Provide `reason`: why this retained record is being revealed (legal hold, dispute, investigation).',\n },\n });\n }\n\n return { subjectUserId, accessingUserId, accessingUserRoles, reason };\n}\n\nexport function createUserReadRetainedFactories(): ResourceCustomServiceImplementationFactory[] {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService, container: Container) =>\n createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.USERS,\n operationIdentifier: Users_Operations.READ_RETAINED,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'users.read_retained.see-through-reveal',\n handlers: {\n // Every refusal lives in PREFIX, the only phase that runs before the core write — so a\n // rejected request cannot have touched the row on its way to being rejected.\n prefixCoreOperations: async (id, input, executionContext, _operationPath, utils) => {\n resolveValidatedRetainedReadRequest(id, input, executionContext, utils);\n return input;\n },\n /*\n * REPLACE, because the operation is UPDATE-like and must WRITE NOTHING.\n *\n * `resourceOperationLike: UPDATE` is how the operation gets a PUT with a body — the request\n * carries a free-text justification, and a GET would put it in the URL and therefore in\n * every access log between the operator and the server. Left to the generic core path, that\n * declaration would make this a real update: a retained row is frozen, so it would fail, and\n * on a resource that did not freeze it, it would silently write. Replacing the core\n * operation is what makes an UPDATE-shaped route a read.\n */\n replaceCoreOperations: async (id, input, executionContext, _operationPath, utils) => {\n const { subjectUserId, accessingUserId, accessingUserRoles, reason } =\n resolveValidatedRetainedReadRequest(id, input, executionContext, utils);\n\n const systemAccess = container.get<SystemAccessBackendService>(SAAS_SERVICE_TYPES.SystemAccessService);\n\n /*\n * Through the PRIMITIVE, never through the repository.\n *\n * This is the line the whole issue turns on. The same row is reachable by building a\n * super-admin context and reading it directly — and that path asserts no `seeRetained`\n * grant, sets no see-through flag, and writes no audit row. Reaching the repository here\n * would reveal exactly the same personal data with no record of it, which is the outcome\n * the audited pair exists to prevent.\n */\n return await systemAccess.readRetainedAsSystem(\n CoreResourceType.USERS,\n subjectUserId,\n { accessingUserId, accessingUserRoles, reason },\n {\n // Scoped to the organization the caller is acting in, when there is one. The primitive\n // suppresses the RETENTION predicate only — never the scope filter — so this cannot\n // widen the read beyond what the caller could otherwise address.\n scopeContext: executionContext.initiatorIds?.organizationId\n ? { organizationId: executionContext.initiatorIds.organizationId }\n : undefined,\n },\n );\n },\n },\n });\n\n return [factory];\n}\n"]}