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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1358) hide show
  1. package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +1 -1
  2. package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +1 -1
  3. package/dist/esm/__tests__/setup.d.ts.map +1 -1
  4. package/dist/esm/__tests__/test-container.d.ts.map +1 -1
  5. package/dist/esm/applications/models/applications.backend.schemas.d.ts.map +1 -1
  6. package/dist/esm/applications/seeds/application-metadata-defaults.seeds.d.ts.map +1 -1
  7. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  8. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
  9. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  10. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  11. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
  12. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  13. package/dist/esm/base-classes/models/repositories.backend.schemas.d.ts.map +1 -1
  14. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +1 -1
  15. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +1 -1
  16. package/dist/esm/base-classes/services/batches/batches-cronjobs-custom-execution.service.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/batches-cronjobs-executor.backend.service.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/batches/batches-cronjobs-resource-execution.backend.service.d.ts.map +1 -1
  19. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
  20. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
  21. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
  22. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
  23. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
  24. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
  25. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +210 -0
  26. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
  27. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
  28. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  29. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
  30. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  31. package/dist/esm/base-classes/services/batches/resource-retention-sweep.batch.backend.service.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/batches/suspension-reactivation-sweep.batch.backend.service.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/controllers/abstract-controller.backend.service.d.ts.map +1 -1
  34. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  35. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
  36. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  37. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  38. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  39. package/dist/esm/base-classes/services/controllers/utils/audit-access-fields.backend.utils.d.ts.map +1 -1
  40. package/dist/esm/base-classes/services/controllers/utils/operation-response-serializer.backend.utils.d.ts.map +1 -1
  41. package/dist/esm/base-classes/services/controllers/validate-field-handler.backend.service.d.ts.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/__tests__/mock-repositories-registry-handler.service.d.ts.map +1 -1
  44. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/http-api/http-api-filter-translation.backend.d.ts.map +1 -1
  46. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
  47. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  48. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +220 -25
  49. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/http-api/http-api-query.backend.d.ts.map +1 -1
  51. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
  52. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +191 -26
  54. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  55. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
  56. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
  58. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  59. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
  60. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
  61. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
  62. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
  63. package/dist/esm/base-classes/services/repositories/http-api/http-api-row-projection.backend.d.ts.map +1 -1
  64. package/dist/esm/base-classes/services/repositories/http-api/http-api-subject-erasure-effect.backend.d.ts.map +1 -1
  65. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
  66. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
  68. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  69. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  70. package/dist/esm/base-classes/services/repositories/http-api/odoo-jsonrpc-compiler.backend.d.ts.map +1 -1
  71. package/dist/esm/base-classes/services/repositories/http-api/rest-json-query-compiler.backend.d.ts.map +1 -1
  72. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  73. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
  74. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  75. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  76. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  77. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +106 -0
  78. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  79. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +266 -20
  80. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  81. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  82. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
  83. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  84. package/dist/esm/base-classes/services/repositories/repository-guarded-mutation.backend.types.d.ts.map +1 -1
  85. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +5 -2
  86. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  87. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +34 -3
  88. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  89. package/dist/esm/base-classes/services/repositories/repository-version-metadata.backend.utils.d.ts.map +1 -1
  90. package/dist/esm/base-classes/services/repositories/resource-write-integrity.backend.d.ts.map +1 -1
  91. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts +72 -0
  92. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts.map +1 -0
  93. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js +88 -0
  94. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js.map +1 -0
  95. package/dist/esm/base-classes/services/repositories/unique-constraint-conflict-reference.backend.d.ts.map +1 -1
  96. package/dist/esm/base-classes/services/resource-operations-helper.backend.service.d.ts.map +1 -1
  97. package/dist/esm/base-classes/services/services/__tests__/mock-services-registry-handler.service.d.ts.map +1 -1
  98. package/dist/esm/base-classes/services/services/__tests__/mock-system-access.service.d.ts.map +1 -1
  99. package/dist/esm/base-classes/services/services/read-only-field-change.backend.utils.d.ts.map +1 -1
  100. package/dist/esm/base-classes/services/services/resource-operation-audit-emission.backend.utils.d.ts.map +1 -1
  101. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
  102. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  103. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  104. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts.map +1 -1
  105. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts.map +1 -1
  106. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  107. package/dist/esm/base-classes/services/services/resource-operation-server-injected-fields.backend.utils.d.ts.map +1 -1
  108. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts.map +1 -1
  109. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  110. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
  111. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  112. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
  113. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  114. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
  115. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  116. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
  117. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  118. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +571 -45
  119. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  120. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
  121. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  122. package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
  123. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  124. package/dist/esm/base-classes/utils/backend-type-utils.d.ts.map +1 -1
  125. package/dist/esm/base-classes/utils/single-subject-addressing.backend.utils.d.ts.map +1 -1
  126. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
  127. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
  128. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
  129. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
  130. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
  131. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
  132. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
  133. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
  134. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
  135. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
  136. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
  137. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
  138. package/dist/esm/billing/services/back-office/abstract-billing.backend.service.d.ts.map +1 -1
  139. package/dist/esm/billing/services/back-office/billing-feature-sync.backend.service.d.ts.map +1 -1
  140. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
  141. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
  142. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +475 -0
  143. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
  144. package/dist/esm/billing/services/back-office/billing-state.backend.service.d.ts.map +1 -1
  145. package/dist/esm/billing/services/back-office/billing-state.backend.service.js +11 -1
  146. package/dist/esm/billing/services/back-office/billing-state.backend.service.js.map +1 -1
  147. package/dist/esm/billing/services/back-office/billing-subject-erasure-effect.backend.d.ts.map +1 -1
  148. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
  149. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  150. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
  151. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  152. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
  153. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  154. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
  155. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  156. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
  157. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
  158. package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
  159. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
  160. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
  161. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  162. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
  163. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  164. package/dist/esm/billing/services/billing.utils.d.ts.map +1 -1
  165. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  166. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
  167. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  168. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +70 -1
  169. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  170. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +98 -2
  171. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  172. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
  173. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  174. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
  175. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  176. package/dist/esm/billing/services/custom-impl/credit-pool.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  177. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
  178. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  179. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
  180. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  181. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  182. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
  183. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  184. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +21 -1
  185. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  186. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +109 -2
  187. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  188. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
  189. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
  190. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
  191. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
  192. package/dist/esm/billing/services/webhooks/billing-webhook-adapter.backend.service.d.ts.map +1 -1
  193. package/dist/esm/billing/services/webhooks/billing-webhook-capability-handler.backend.service.d.ts.map +1 -1
  194. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
  195. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  196. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +310 -29
  197. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  198. package/dist/esm/billing/testing/billing-test-fixtures.d.ts.map +1 -1
  199. package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
  200. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  201. package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
  202. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  203. package/dist/esm/charts/controllers/chart.backend.controller.d.ts.map +1 -1
  204. package/dist/esm/charts/services/chart-registry.backend.service.d.ts +80 -7
  205. package/dist/esm/charts/services/chart-registry.backend.service.d.ts.map +1 -1
  206. package/dist/esm/charts/services/chart-registry.backend.service.js +115 -8
  207. package/dist/esm/charts/services/chart-registry.backend.service.js.map +1 -1
  208. package/dist/esm/companion-exports.d.ts.map +1 -1
  209. package/dist/esm/compliance/audit-trails/audit-logs.custom-impl.backend.service.d.ts.map +1 -1
  210. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.d.ts.map +1 -1
  211. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
  212. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  213. package/dist/esm/compliance/audit-trails/batches/immudb-audit-reconcile.batch.backend.service.d.ts.map +1 -1
  214. package/dist/esm/compliance/audit-trails/batches/siem-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  215. package/dist/esm/compliance/audit-trails/services/__tests__/mock-audit-logs.service.d.ts.map +1 -1
  216. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
  217. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  218. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
  219. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  220. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +350 -10
  221. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  222. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +562 -10
  223. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  224. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  225. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
  226. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  227. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
  228. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  229. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
  230. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  231. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
  232. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  233. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
  234. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  235. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
  236. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
  237. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
  238. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
  239. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  240. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +52 -0
  241. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  242. package/dist/esm/compliance/audit-trails/services/utils/ocsf-class-mapping.backend.utils.d.ts.map +1 -1
  243. package/dist/esm/compliance/audit-trails/services/utils/siem-dictionary.backend.utils.d.ts.map +1 -1
  244. package/dist/esm/compliance/audit-trails/services/utils/siem-ocsf-projection.backend.utils.d.ts.map +1 -1
  245. package/dist/esm/compliance/audit-trails/services/utils/siem-projection-contract.backend.utils.d.ts.map +1 -1
  246. package/dist/esm/compliance/audit-trails/utils/audit-actor.backend.utils.d.ts.map +1 -1
  247. package/dist/esm/compliance/audit-trails/utils/layer2-audit-provider-boot-diagnostic.backend.utils.d.ts.map +1 -1
  248. package/dist/esm/compliance/index.d.ts.map +1 -1
  249. package/dist/esm/compliance/privacy/retention-hide-predicate.backend.d.ts.map +1 -1
  250. package/dist/esm/compliance/privacy/services/subject-erasure-external-effects.backend.service.d.ts.map +1 -1
  251. package/dist/esm/compliance/privacy/services/subject-session-revocation.backend.service.d.ts.map +1 -1
  252. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
  253. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  254. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
  255. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  256. package/dist/esm/config/bootstrap/minion-initialization-projection.backend.d.ts.map +1 -1
  257. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.d.ts.map +1 -1
  258. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js +3 -0
  259. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js.map +1 -1
  260. package/dist/esm/config/bootstrap/runtime-principal.backend.service.d.ts.map +1 -1
  261. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  262. package/dist/esm/config/models/app-config-secrets.backend.schemas.d.ts.map +1 -1
  263. package/dist/esm/config/models/app-config.backend-authored.definitions.d.ts.map +1 -1
  264. package/dist/esm/config/models/app-config.backend.schemas.d.ts +145 -49
  265. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  266. package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
  267. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  268. package/dist/esm/config/models/app-env-config.backend.schemas.d.ts.map +1 -1
  269. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts +36 -0
  270. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts.map +1 -0
  271. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js +36 -0
  272. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js.map +1 -0
  273. package/dist/esm/config/models/config-mutation-boundary.utils.d.ts.map +1 -1
  274. package/dist/esm/config/models/postgresql-env-config.backend.schemas.d.ts.map +1 -1
  275. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
  276. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  277. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
  278. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  279. package/dist/esm/config/models/runtime-topology.backend.contracts.d.ts.map +1 -1
  280. package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +1 -1
  281. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
  282. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  283. package/dist/esm/config/services/app-configuration-loader.backend.service.js +71 -76
  284. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  285. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  286. package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
  287. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  288. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
  289. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  290. package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
  291. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  292. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +37 -0
  293. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  294. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +69 -1
  295. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  296. package/dist/esm/data-seeding/batches/data-seeding-run-cleanup.batch.backend.service.d.ts.map +1 -1
  297. package/dist/esm/data-seeding/batches/data-seeding-scheduled-rerun.batch.backend.service.d.ts.map +1 -1
  298. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.contracts.d.ts.map +1 -1
  299. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.controller.d.ts.map +1 -1
  300. package/dist/esm/data-seeding/data-seeding-models.d.ts.map +1 -1
  301. package/dist/esm/data-seeding/models/business-key-resolver.shared.utils.d.ts.map +1 -1
  302. package/dist/esm/data-seeding/models/data-seed-execution-context.shared.types.d.ts.map +1 -1
  303. package/dist/esm/data-seeding/models/data-seed-migrator-runner.shared.utils.d.ts.map +1 -1
  304. package/dist/esm/data-seeding/models/data-seed-reconciler.shared.utils.d.ts.map +1 -1
  305. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.schemas.d.ts.map +1 -1
  306. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.utils.d.ts.map +1 -1
  307. package/dist/esm/data-seeding/models/data-seed-run.shared.resources-config.schemas.d.ts.map +1 -1
  308. package/dist/esm/data-seeding/models/data-seed-run.shared.schemas.d.ts.map +1 -1
  309. package/dist/esm/data-seeding/models/data-seed-trigger-mode-matrix.shared.utils.d.ts.map +1 -1
  310. package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
  311. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
  312. package/dist/esm/data-seeding/services/data-seed-dispatcher.backend.service.d.ts.map +1 -1
  313. package/dist/esm/data-seeding/services/data-seed-registry.backend.service.d.ts.map +1 -1
  314. package/dist/esm/data-seeding/services/data-seed-scope-resolver-registry.backend.service.d.ts.map +1 -1
  315. package/dist/esm/data-seeding/services/engines/additive-seed-engine.backend.service.d.ts.map +1 -1
  316. package/dist/esm/data-seeding/services/engines/lazy-seed-engine.backend.service.d.ts.map +1 -1
  317. package/dist/esm/data-seeding/services/engines/manual-seed-engine.backend.service.d.ts.map +1 -1
  318. package/dist/esm/data-seeding/services/engines/sync-seed-engine.backend.service.d.ts.map +1 -1
  319. package/dist/esm/data-seeding/services/engines/upgrade-seed-engine.backend.service.d.ts.map +1 -1
  320. package/dist/esm/data-seeding/services/shared/data-seed-business-key.shared.utils.d.ts.map +1 -1
  321. package/dist/esm/data-seeding/services/shared/data-seed-error.shared.utils.d.ts.map +1 -1
  322. package/dist/esm/data-seeding/services/shared/data-seed-run-counters.shared.types.d.ts.map +1 -1
  323. package/dist/esm/data-seeding/services/shared/data-seed-run-ledger.backend.d.ts.map +1 -1
  324. package/dist/esm/data-seeding/services/shared/data-seed-scope-anchor.shared.types.d.ts.map +1 -1
  325. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts.map +1 -1
  326. package/dist/esm/data-seeding/services/shared/data-seed-scope-resolution.backend.d.ts.map +1 -1
  327. package/dist/esm/databases/models/aggregation.backend.schemas.d.ts.map +1 -1
  328. package/dist/esm/databases/models/databases.backend.schemas.d.ts.map +1 -1
  329. package/dist/esm/databases/models/filter.backend.schemas.d.ts.map +1 -1
  330. package/dist/esm/databases/models/resolve-persistence-adapter.backend.utils.d.ts.map +1 -1
  331. package/dist/esm/databases/models/sql.backend.schemas.d.ts.map +1 -1
  332. package/dist/esm/databases/models/transaction.shared.schemas.d.ts.map +1 -1
  333. package/dist/esm/databases/services/__tests__/mock-mongo-transaction-registry.service.d.ts.map +1 -1
  334. package/dist/esm/databases/services/__tests__/mock-mongodb.service.d.ts.map +1 -1
  335. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +1 -1
  336. package/dist/esm/databases/services/__tests__/mock-redis.service.d.ts.map +1 -1
  337. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +1 -1
  338. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  339. package/dist/esm/databases/services/aggregation/aggregation-query.backend.service.d.ts.map +1 -1
  340. package/dist/esm/databases/services/aggregation/computed-measure-evaluator.backend.service.d.ts.map +1 -1
  341. package/dist/esm/databases/services/aggregation/field-access-validator.backend.service.d.ts.map +1 -1
  342. package/dist/esm/databases/services/aggregation/time-series-densifier.backend.service.d.ts.map +1 -1
  343. package/dist/esm/databases/services/aggregation/topn-processor.backend.service.d.ts.map +1 -1
  344. package/dist/esm/databases/services/aggregation/window-function-processor.backend.service.d.ts.map +1 -1
  345. package/dist/esm/databases/services/db-utils.d.ts.map +1 -1
  346. package/dist/esm/databases/services/mongo-aggregation.backend.service.d.ts.map +1 -1
  347. package/dist/esm/databases/services/mongodb.service.d.ts.map +1 -1
  348. package/dist/esm/databases/services/postgresql-aggregation.backend.service.d.ts.map +1 -1
  349. package/dist/esm/databases/services/postgresql-database.backend.service.d.ts.map +1 -1
  350. package/dist/esm/databases/services/postgresql-development-provisioning.backend.d.ts.map +1 -1
  351. package/dist/esm/databases/services/postgresql-filter.backend.service.d.ts.map +1 -1
  352. package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
  353. package/dist/esm/databases/services/postgresql-schema-ddl.backend.d.ts.map +1 -1
  354. package/dist/esm/databases/services/postgresql-schema-migration-sql.backend.d.ts.map +1 -1
  355. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  356. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
  357. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  358. package/dist/esm/databases/services/postgresql-schema-plan-lockfile.backend.d.ts.map +1 -1
  359. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  360. package/dist/esm/databases/services/resource-persistence-unit-of-work.backend.service.d.ts.map +1 -1
  361. package/dist/esm/databases/services/schema-planning-standalone.backend.d.ts.map +1 -1
  362. package/dist/esm/databases/services/zod-to-mongoose-schema-convertor.backend.service.d.ts.map +1 -1
  363. package/dist/esm/databases/services/zod-to-sql-hybrid-schema.planner.d.ts.map +1 -1
  364. package/dist/esm/databases/utils/postgresql-identifier.backend.utils.d.ts.map +1 -1
  365. package/dist/esm/errors/services/__tests__/mock-error-builder.service.d.ts.map +1 -1
  366. package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
  367. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  368. package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
  369. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  370. package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
  371. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  372. package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
  373. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  374. package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
  375. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  376. package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
  377. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  378. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
  379. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  380. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
  381. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  382. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
  383. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  384. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
  385. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  386. package/dist/esm/external-data/batches/external-data-pipeline-scheduled-run.batch.backend.service.d.ts.map +1 -1
  387. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -1
  388. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -1
  389. package/dist/esm/external-data/external-data-extraction-source.backend.d.ts.map +1 -1
  390. package/dist/esm/external-data/external-data-models.exports.d.ts.map +1 -1
  391. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
  392. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  393. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
  394. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  395. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  396. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  397. package/dist/esm/external-providers/models/external-providers.backend.schemas.d.ts.map +1 -1
  398. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
  399. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  400. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  401. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +306 -0
  402. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
  403. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +379 -0
  404. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
  405. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
  406. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
  407. package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
  408. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
  409. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
  410. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
  411. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +235 -0
  412. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
  413. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
  414. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
  415. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
  416. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
  417. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
  418. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  419. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
  420. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  421. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
  422. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
  423. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
  424. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
  425. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
  426. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  427. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
  428. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  429. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts +81 -34
  430. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  431. package/dist/esm/external-providers/services/document-extraction.backend.service.js +181 -100
  432. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  433. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  434. package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
  435. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  436. package/dist/esm/external-providers/services/external-api-handler.backend.service.d.ts.map +1 -1
  437. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +413 -7
  438. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  439. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +684 -45
  440. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  441. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts +15 -1
  442. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  443. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +84 -5
  444. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  445. package/dist/esm/features/controllers/features.backend.controller.d.ts.map +1 -1
  446. package/dist/esm/features/services/__tests__/mock-feature-definition-registry.service.d.ts.map +1 -1
  447. package/dist/esm/features/services/__tests__/mock-feature-resolution.service.d.ts.map +1 -1
  448. package/dist/esm/features/services/application-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  449. package/dist/esm/features/services/feature-definition-registry.backend.service.d.ts.map +1 -1
  450. package/dist/esm/features/services/feature-gate.backend.service.d.ts.map +1 -1
  451. package/dist/esm/features/services/feature-resolution.backend.service.d.ts.map +1 -1
  452. package/dist/esm/features/services/organization-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  453. package/dist/esm/features/services/scope-feature-ledger-relationship.backend.utils.d.ts.map +1 -1
  454. package/dist/esm/features/services/scope-features-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  455. package/dist/esm/features/testing/feature-test-utils.d.ts.map +1 -1
  456. package/dist/esm/files/batches/files-cleanup.batch.backend.service.d.ts.map +1 -1
  457. package/dist/esm/files/constraints/file-analyzers.types.d.ts.map +1 -1
  458. package/dist/esm/files/constraints/file-constraint-resolver-chain.backend.service.d.ts.map +1 -1
  459. package/dist/esm/files/constraints/file-constraint.types.d.ts.map +1 -1
  460. package/dist/esm/files/constraints/file-validation.backend.service.d.ts.map +1 -1
  461. package/dist/esm/files/constraints/resource-field-constraint-resolver.backend.service.d.ts.map +1 -1
  462. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  463. package/dist/esm/files/controllers/file.controller.js +21 -13
  464. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  465. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -1
  466. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -1
  467. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +37 -0
  468. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  469. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +260 -36
  470. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  471. package/dist/esm/files/scanning/clamav-scanner.backend.service.d.ts.map +1 -1
  472. package/dist/esm/files/scanning/file-scan.types.d.ts.map +1 -1
  473. package/dist/esm/files/scanning/yara-scanner.backend.service.d.ts.map +1 -1
  474. package/dist/esm/files/scanning/yara-scanner.backend.service.js +20 -2
  475. package/dist/esm/files/scanning/yara-scanner.backend.service.js.map +1 -1
  476. package/dist/esm/files/services/__tests__/mock-file-field-detection.service.d.ts.map +1 -1
  477. package/dist/esm/files/services/__tests__/mock-file-operation-handler.service.d.ts.map +1 -1
  478. package/dist/esm/files/services/__tests__/mock-file-repository.service.d.ts.map +1 -1
  479. package/dist/esm/files/services/file-field-detection.backend.service.d.ts.map +1 -1
  480. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  481. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  482. package/dist/esm/files/services/file-population.backend.service.d.ts.map +1 -1
  483. package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
  484. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  485. package/dist/esm/files/services/file-scanning.backend.service.js +202 -17
  486. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  487. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
  488. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  489. package/dist/esm/files/services/file-text-extraction.backend.service.js +175 -13
  490. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  491. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
  492. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  493. package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
  494. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  495. package/dist/esm/files/services/files.backend.service.d.ts +68 -0
  496. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  497. package/dist/esm/files/services/files.backend.service.js +177 -5
  498. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  499. package/dist/esm/files/services/rag-source-field-detection.backend.service.d.ts.map +1 -1
  500. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
  501. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
  502. package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
  503. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
  504. package/dist/esm/files/storage/file-storage-path-resolver.backend.service.d.ts.map +1 -1
  505. package/dist/esm/files/storage/file-storage-provider.types.d.ts +52 -11
  506. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  507. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  508. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts +21 -3
  509. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts.map +1 -1
  510. package/dist/esm/files/storage/file-storage-router.backend.service.js +38 -5
  511. package/dist/esm/files/storage/file-storage-router.backend.service.js.map +1 -1
  512. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts +87 -0
  513. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts.map +1 -0
  514. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js +340 -0
  515. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js.map +1 -0
  516. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
  517. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  518. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
  519. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  520. package/dist/esm/files/storage/storage-credential-provider.backend.utils.d.ts.map +1 -1
  521. package/dist/esm/files/storage/storage-platform-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  522. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  523. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js +10 -3
  524. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js.map +1 -1
  525. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  526. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
  527. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  528. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  529. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
  530. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  531. package/dist/esm/files/utils/file-upload.utils.d.ts.map +1 -1
  532. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  533. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  534. package/dist/esm/files/utils/file-validation.utils.d.ts.map +1 -1
  535. package/dist/esm/files/utils/image-derivation.backend.utils.d.ts.map +1 -1
  536. package/dist/esm/files/utils/image-thumbnail.backend.utils.d.ts.map +1 -1
  537. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
  538. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
  539. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
  540. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
  541. package/dist/esm/files/utils/rag-source-field-schema-path.backend.utils.d.ts.map +1 -1
  542. package/dist/esm/files/utils/storage-application-identity.backend.utils.d.ts.map +1 -1
  543. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
  544. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  545. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
  546. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  547. package/dist/esm/flows-actors/a2a/batches/a2a-push-delivery.batch.backend.service.d.ts.map +1 -1
  548. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  549. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
  550. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  551. package/dist/esm/flows-actors/a2a/models/a2a-dialect.backend.schemas.d.ts.map +1 -1
  552. package/dist/esm/flows-actors/a2a/models/a2a-push-notification-delivery.backend.utils.d.ts.map +1 -1
  553. package/dist/esm/flows-actors/a2a/models/a2a-push-notification.backend.schemas.d.ts.map +1 -1
  554. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
  555. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  556. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
  557. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  558. package/dist/esm/flows-actors/a2a/services/a2a-push-delivery-log.repository.d.ts.map +1 -1
  559. package/dist/esm/flows-actors/a2a/services/a2a-push-dispatcher.backend.service.d.ts.map +1 -1
  560. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
  561. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  562. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
  563. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  564. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
  565. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  566. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
  567. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  568. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
  569. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  570. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
  571. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  572. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
  573. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  574. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  575. package/dist/esm/flows-actors/controllers/flows-actors.controller.d.ts.map +1 -1
  576. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
  577. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  578. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
  579. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  580. package/dist/esm/flows-actors/models/agent-facets.backend.definitions.d.ts.map +1 -1
  581. package/dist/esm/flows-actors/models/agents.backend.definitions.d.ts.map +1 -1
  582. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
  583. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  584. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
  585. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  586. package/dist/esm/flows-actors/models/flows-actors.backend.definitions.d.ts.map +1 -1
  587. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
  588. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  589. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  590. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +179 -8
  591. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  592. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +436 -34
  593. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  594. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  595. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
  596. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  597. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
  598. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
  599. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
  600. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
  601. package/dist/esm/flows-actors/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +1 -1
  602. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  603. package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
  604. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  605. package/dist/esm/flows-actors/services/agent-call-trace-sink.backend.d.ts.map +1 -1
  606. package/dist/esm/flows-actors/services/agent-facets.backend.service.d.ts.map +1 -1
  607. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +132 -6
  608. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  609. package/dist/esm/flows-actors/services/agents.backend.service.js +467 -49
  610. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  611. package/dist/esm/flows-actors/services/context-curation.backend.service.d.ts.map +1 -1
  612. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +50 -1
  613. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  614. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +270 -20
  615. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  616. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
  617. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  618. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
  619. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  620. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  621. package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
  622. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  623. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  624. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
  625. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  626. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
  627. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
  628. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +371 -0
  629. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
  630. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts +99 -0
  631. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts.map +1 -0
  632. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js +155 -0
  633. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js.map +1 -0
  634. package/dist/esm/flows-actors/services/meta-workflow-evaluation-treatment-compiler.backend.service.d.ts.map +1 -1
  635. package/dist/esm/flows-actors/services/meta-workflow-standard-action-contracts.backend.service.d.ts.map +1 -1
  636. package/dist/esm/flows-actors/services/meta-workflow-standard-evaluation-contracts.backend.service.d.ts.map +1 -1
  637. package/dist/esm/flows-actors/services/meta-workflow-structured-artifact-action-compiler.backend.service.d.ts.map +1 -1
  638. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
  639. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  640. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
  641. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  642. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  643. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +17 -4
  644. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  645. package/dist/esm/flows-actors/utils/bounded-subprocess.backend.utils.d.ts.map +1 -1
  646. package/dist/esm/flows-actors/utils/flows-actors-frontend-extractor.utils.d.ts.map +1 -1
  647. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
  648. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  649. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
  650. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  651. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  652. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  653. package/dist/esm/flows-actors/utils/prompt-ir-adapters.backend.utils.d.ts.map +1 -1
  654. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts +77 -0
  655. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts.map +1 -0
  656. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js +164 -0
  657. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js.map +1 -0
  658. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts +48 -0
  659. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts.map +1 -0
  660. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js +101 -0
  661. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js.map +1 -0
  662. package/dist/esm/guidance/batches/dormancy-detection.batch.backend.service.d.ts.map +1 -1
  663. package/dist/esm/guidance/services/guidance-trigger-evaluator.backend.service.d.ts.map +1 -1
  664. package/dist/esm/guidance/services/lifecycle-custom-implementations.backend.d.ts.map +1 -1
  665. package/dist/esm/guidance/services/lifecycle-evaluator.backend.service.d.ts.map +1 -1
  666. package/dist/esm/guidance/services/lifecycle-scope-id.backend.utils.d.ts.map +1 -1
  667. package/dist/esm/guidance/services/milestone-condition-registry.backend.service.d.ts.map +1 -1
  668. package/dist/esm/guidance/services/milestone-definition-registry.backend.service.d.ts.map +1 -1
  669. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
  670. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  671. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
  672. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  673. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
  674. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
  675. package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
  676. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
  677. package/dist/esm/guidance/services/scoped-state-read-custom-implementations.backend.d.ts.map +1 -1
  678. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
  679. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  680. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
  681. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  682. package/dist/esm/i18n/services/i18n.backend.service.d.ts.map +1 -1
  683. package/dist/esm/index.d.ts +11 -5
  684. package/dist/esm/index.d.ts.map +1 -1
  685. package/dist/esm/index.js +31 -5
  686. package/dist/esm/index.js.map +1 -1
  687. package/dist/esm/inject/models/container.d.ts +10 -0
  688. package/dist/esm/inject/models/container.d.ts.map +1 -1
  689. package/dist/esm/inject/models/container.js +126 -10
  690. package/dist/esm/inject/models/container.js.map +1 -1
  691. package/dist/esm/inject/models/service-types.d.ts +20 -3
  692. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  693. package/dist/esm/inject/models/service-types.js +22 -3
  694. package/dist/esm/inject/models/service-types.js.map +1 -1
  695. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  696. package/dist/esm/mcp/controllers/mcp.controller.js +70 -3
  697. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  698. package/dist/esm/mcp/models/mcp-protocol.backend.schemas.d.ts.map +1 -1
  699. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  700. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  701. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
  702. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  703. package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
  704. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  705. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  706. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
  707. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  708. package/dist/esm/mcp/services/resource-server-instances-registry.backend.service.d.ts.map +1 -1
  709. package/dist/esm/mcp/utils/zod-to-mcp-json-schema.backend.utils.d.ts.map +1 -1
  710. package/dist/esm/meta-workflow-runtime.exports.d.ts.map +1 -1
  711. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  712. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
  713. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  714. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
  715. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
  716. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
  717. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
  718. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
  719. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  720. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
  721. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  722. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
  723. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  724. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  725. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
  726. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  727. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
  728. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  729. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +1 -1
  730. package/dist/esm/monitoring/logger/services/logger.service.d.ts +24 -0
  731. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  732. package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
  733. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  734. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
  735. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
  736. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
  737. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
  738. package/dist/esm/monitoring/logger/utils/log-value-normalization.backend.utils.d.ts.map +1 -1
  739. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +313 -0
  740. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
  741. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +389 -0
  742. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
  743. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
  744. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  745. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  746. package/dist/esm/monitoring/observability/otel-preload.d.ts.map +1 -1
  747. package/dist/esm/monitoring/observability/otel-sdk-global-handle.d.ts.map +1 -1
  748. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +1 -1
  749. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
  750. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  751. package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
  752. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  753. package/dist/esm/monitoring/observability/services/observability.backend.service.d.ts.map +1 -1
  754. package/dist/esm/notifications/email/components/email-components.d.ts.map +1 -1
  755. package/dist/esm/notifications/email/models/email-template-definition.d.ts.map +1 -1
  756. package/dist/esm/notifications/email/models/email-transport.backend.definitions.d.ts.map +1 -1
  757. package/dist/esm/notifications/email/services/email-batch-send.batch.backend.service.d.ts.map +1 -1
  758. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
  759. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  760. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
  761. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  762. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  763. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
  764. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  765. package/dist/esm/notifications/email/services/email.backend.service.d.ts +102 -5
  766. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  767. package/dist/esm/notifications/email/services/email.backend.service.js +222 -70
  768. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  769. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
  770. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  771. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  772. package/dist/esm/notifications/email/utils/interpolate-email-label.utils.d.ts.map +1 -1
  773. package/dist/esm/notifications/email/utils/zod-to-typescript.utils.d.ts.map +1 -1
  774. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
  775. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  776. package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
  777. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  778. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
  779. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  780. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
  781. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  782. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts +32 -0
  783. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts.map +1 -0
  784. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js +32 -0
  785. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js.map +1 -0
  786. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +64 -10
  787. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  788. package/dist/esm/notifications/sms/services/sms.backend.service.js +277 -82
  789. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  790. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
  791. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  792. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
  793. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  794. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
  795. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  796. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
  797. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  798. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  799. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  800. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
  801. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  802. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.d.ts.map +1 -1
  803. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.repository.d.ts.map +1 -1
  804. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-dispatcher.backend.service.d.ts.map +1 -1
  805. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service.d.ts.map +1 -1
  806. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  807. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
  808. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  809. package/dist/esm/notifications/webhooks/outbound/services/webhook-config.backend.service.d.ts.map +1 -1
  810. package/dist/esm/notifications/webhooks/services/polymorphic-lookup.backend.service.d.ts.map +1 -1
  811. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
  812. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  813. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
  814. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  815. package/dist/esm/organizations/batches/organization-member-invitation-sweep.batch.backend.service.d.ts.map +1 -1
  816. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
  817. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts.map +1 -1
  818. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
  819. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  820. package/dist/esm/organizations/services/authority-change-audit.backend.utils.d.ts.map +1 -1
  821. package/dist/esm/organizations/services/invitation-acceptance.backend.utils.d.ts.map +1 -1
  822. package/dist/esm/organizations/services/org-creation-on-registration.backend.utils.d.ts.map +1 -1
  823. package/dist/esm/organizations/services/org-member-roles-validation.backend.utils.d.ts.map +1 -1
  824. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  825. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
  826. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  827. package/dist/esm/organizations/services/organization-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  828. package/dist/esm/organizations/services/organization-member-custom-implementation.backend.service.d.ts.map +1 -1
  829. package/dist/esm/organizations/services/organization-onboarding-operation.backend.utils.d.ts.map +1 -1
  830. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  831. package/dist/esm/organizations/services/organization-unit-member-custom-implementation.backend.service.d.ts.map +1 -1
  832. package/dist/esm/organizations/services/scim-provisioning-gate.backend.utils.d.ts.map +1 -1
  833. package/dist/esm/organizations/services/user-org-type-grant.backend.utils.d.ts.map +1 -1
  834. package/dist/esm/organizations/services/user-type-revocation-on-org-leave.backend.utils.d.ts.map +1 -1
  835. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +1 -1
  836. package/dist/esm/pdf-templates/models/pdf-template-binding.d.ts.map +1 -1
  837. package/dist/esm/pdf-templates/models/pdf-template-definition.d.ts.map +1 -1
  838. package/dist/esm/pdf-templates/services/pdf-generated-file-writer.backend.service.d.ts.map +1 -1
  839. package/dist/esm/pdf-templates/services/pdf-generation-orchestrator.backend.service.d.ts.map +1 -1
  840. package/dist/esm/pdf-templates/services/pdf-renderer.backend.service.d.ts.map +1 -1
  841. package/dist/esm/pdf-templates/services/pdf-template-binding.backend.service.d.ts.map +1 -1
  842. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
  843. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
  844. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
  845. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
  846. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
  847. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
  848. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
  849. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
  850. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
  851. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
  852. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
  853. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
  854. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
  855. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
  856. package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
  857. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
  858. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
  859. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  860. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
  861. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  862. package/dist/esm/queue/apps-crontabs-manager.backend.service.d.ts.map +1 -1
  863. package/dist/esm/queue/cron-job-sync.backend.service.d.ts.map +1 -1
  864. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
  865. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  866. package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
  867. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  868. package/dist/esm/queue/job-completion-registry.backend.service.d.ts.map +1 -1
  869. package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
  870. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  871. package/dist/esm/queue/job-consumer.backend.service.js +1 -4
  872. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  873. package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
  874. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  875. package/dist/esm/queue/job-executor.backend.service.js +1 -4
  876. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  877. package/dist/esm/queue/job-payload-storage.backend.service.d.ts.map +1 -1
  878. package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
  879. package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
  880. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  881. package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
  882. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  883. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
  884. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  885. package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
  886. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  887. package/dist/esm/queue/queue.backend.service.d.ts +3 -3
  888. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  889. package/dist/esm/queue/queue.backend.service.js +26 -4
  890. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  891. package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
  892. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
  893. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  894. package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
  895. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  896. package/dist/esm/rag/batches/rag-embedding-drain.batch.backend.service.d.ts.map +1 -1
  897. package/dist/esm/rag/batches/rag-reconciliation-sweep.batch.backend.service.d.ts.map +1 -1
  898. package/dist/esm/rag/models/rag-chunk-store.backend.types.d.ts.map +1 -1
  899. package/dist/esm/rag/models/rag-retrieval.backend.types.d.ts.map +1 -1
  900. package/dist/esm/rag/services/mongodb-rag-chunk-store.backend.service.d.ts.map +1 -1
  901. package/dist/esm/rag/services/postgresql-rag-chunk-store.backend.service.d.ts.map +1 -1
  902. package/dist/esm/rag/services/rag-chunk-collection.mongodb-ddl.backend.d.ts.map +1 -1
  903. package/dist/esm/rag/services/rag-chunk-retrieval.mongodb-query.backend.d.ts.map +1 -1
  904. package/dist/esm/rag/services/rag-chunk-retrieval.postgresql-query.backend.d.ts.map +1 -1
  905. package/dist/esm/rag/services/rag-chunk-store.backend.service.d.ts.map +1 -1
  906. package/dist/esm/rag/services/rag-chunk-table.postgresql-ddl.backend.d.ts.map +1 -1
  907. package/dist/esm/rag/services/rag-ingestion.backend.service.d.ts.map +1 -1
  908. package/dist/esm/rag/services/rag-retrieval.backend.service.d.ts.map +1 -1
  909. package/dist/esm/rag/utils/rag-chunk-fusion.backend.utils.d.ts.map +1 -1
  910. package/dist/esm/rag/utils/rag-chunk-removal.backend.utils.d.ts.map +1 -1
  911. package/dist/esm/rag/utils/rag-chunk-row-shaping.backend.utils.d.ts.map +1 -1
  912. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
  913. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  914. package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
  915. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  916. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
  917. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  918. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
  919. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  920. package/dist/esm/rag/utils/rag-ingestion-trigger.backend.utils.d.ts.map +1 -1
  921. package/dist/esm/rag/utils/rag-retrieval-scope.backend.utils.d.ts.map +1 -1
  922. package/dist/esm/rag/utils/rag-source-field-value.backend.utils.d.ts.map +1 -1
  923. package/dist/esm/requests/models/api-routes.backend.defintions.d.ts.map +1 -1
  924. package/dist/esm/requests/models/requests.backend.schemas.d.ts.map +1 -1
  925. package/dist/esm/requests/service/platform-mutualized-handler.backend.service.d.ts.map +1 -1
  926. package/dist/esm/requests/service/platform-requests.backend.utils.d.ts.map +1 -1
  927. package/dist/esm/requests/service/remote-client-base.backend.service.d.ts.map +1 -1
  928. package/dist/esm/requests/service/serverless-services-handler.backend.service.d.ts.map +1 -1
  929. package/dist/esm/requests/service/websocket.service.d.ts +9 -0
  930. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  931. package/dist/esm/requests/service/websocket.service.js +81 -9
  932. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  933. package/dist/esm/resources/backend-resource-registry.exports.d.ts.map +1 -1
  934. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  935. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +16 -2
  936. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  937. package/dist/esm/resources/models/index.d.ts.map +1 -1
  938. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  939. package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
  940. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  941. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  942. package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
  943. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  944. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
  945. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  946. package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
  947. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  948. package/dist/esm/resources/models/resources.backend.schemas.d.ts.map +1 -1
  949. package/dist/esm/resources/models/virtual-fields.backend.types.d.ts.map +1 -1
  950. package/dist/esm/resources/services/__tests__/mock-resources-registry.service.d.ts.map +1 -1
  951. package/dist/esm/resources/services/resource-context.backend.service.d.ts.map +1 -1
  952. package/dist/esm/resources/services/resource-id.backend.service.d.ts.map +1 -1
  953. package/dist/esm/resources/services/resource-population.backend.service.d.ts +17 -2
  954. package/dist/esm/resources/services/resource-population.backend.service.d.ts.map +1 -1
  955. package/dist/esm/resources/services/resource-population.backend.service.js +74 -18
  956. package/dist/esm/resources/services/resource-population.backend.service.js.map +1 -1
  957. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +83 -5
  958. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  959. package/dist/esm/resources/services/resources-registry.backend.service.js +121 -6
  960. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  961. package/dist/esm/resources/services/virtual-fields.backend.service.d.ts.map +1 -1
  962. package/dist/esm/resources/utils/resource-retention.backend.utils.d.ts.map +1 -1
  963. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
  964. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  965. package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
  966. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  967. package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
  968. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  969. package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
  970. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  971. package/dist/esm/runtime/models/execution-context.backend.schemas.d.ts.map +1 -1
  972. package/dist/esm/runtime/models/request-context.als.backend.d.ts.map +1 -1
  973. package/dist/esm/runtime/models/runtime.backend.schemas.d.ts.map +1 -1
  974. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  975. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  976. package/dist/esm/runtime/services/execution-context-handler.backend.service.d.ts.map +1 -1
  977. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
  978. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  979. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  980. package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
  981. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  982. package/dist/esm/runtime/services/http-server.backend.service.js +191 -1
  983. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  984. package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
  985. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  986. package/dist/esm/runtime/services/start-application.backend.service.js +287 -89
  987. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  988. package/dist/esm/runtime/services/utils/oauth-body-cap.backend.utils.d.ts.map +1 -1
  989. package/dist/esm/runtime/testing/execution-context-test-fixtures.d.ts.map +1 -1
  990. package/dist/esm/runtime/testing/mock-execution-context-creator.service.d.ts.map +1 -1
  991. package/dist/esm/runtime/utils/application-startup-config-access.backend.utils.d.ts.map +1 -1
  992. package/dist/esm/runtime/utils/feature-gated-core-resource-exclusions.backend.utils.d.ts.map +1 -1
  993. package/dist/esm/runtime/utils/request-client-ip.utils.d.ts.map +1 -1
  994. package/dist/esm/runtime/utils/scan-default-exports.backend.utils.d.ts.map +1 -1
  995. package/dist/esm/security/api-keys/api-key-generation.backend.utils.d.ts.map +1 -1
  996. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
  997. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  998. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
  999. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  1000. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
  1001. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  1002. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
  1003. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  1004. package/dist/esm/security/authentications/controllers/auth-method-management-controller.backend.service.d.ts.map +1 -1
  1005. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts +22 -0
  1006. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  1007. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +113 -4
  1008. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  1009. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
  1010. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  1011. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
  1012. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  1013. package/dist/esm/security/authentications/models/auth-constants.backend.d.ts.map +1 -1
  1014. package/dist/esm/security/authentications/models/authentications.backend.schemas.d.ts.map +1 -1
  1015. package/dist/esm/security/authentications/models/authorization-client.backend.schemas.d.ts.map +1 -1
  1016. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
  1017. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  1018. package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
  1019. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  1020. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts +37 -0
  1021. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts.map +1 -0
  1022. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js +37 -0
  1023. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js.map +1 -0
  1024. package/dist/esm/security/authentications/models/identity-persistence-boundaries.backend.d.ts.map +1 -1
  1025. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  1026. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +30 -0
  1027. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  1028. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  1029. package/dist/esm/security/authentications/models/saml-authentication.backend.schemas.d.ts.map +1 -1
  1030. package/dist/esm/security/authentications/models/sso-connection.backend.schemas.d.ts.map +1 -1
  1031. package/dist/esm/security/authentications/models/user-authorization-version.backend.utils.d.ts.map +1 -1
  1032. package/dist/esm/security/authentications/seeds/enterprise-config-defaults.seeds.d.ts.map +1 -1
  1033. package/dist/esm/security/authentications/services/__tests__/mock-auth-execution-context-factory.service.d.ts.map +1 -1
  1034. package/dist/esm/security/authentications/services/__tests__/mock-auth-token-issuer.service.d.ts.map +1 -1
  1035. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +1 -1
  1036. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-domain-to-org-lookup.service.d.ts.map +1 -1
  1037. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-enterprise-user-provisioning.service.d.ts.map +1 -1
  1038. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
  1039. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  1040. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
  1041. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  1042. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
  1043. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  1044. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
  1045. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  1046. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
  1047. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  1048. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
  1049. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  1050. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
  1051. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  1052. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
  1053. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  1054. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.d.ts.map +1 -1
  1055. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js +2 -1
  1056. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js.map +1 -1
  1057. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +197 -0
  1058. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  1059. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +384 -53
  1060. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  1061. package/dist/esm/security/authentications/services/auth-credential-verifier.backend.service.d.ts.map +1 -1
  1062. package/dist/esm/security/authentications/services/auth-execution-context-factory.backend.service.d.ts.map +1 -1
  1063. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  1064. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
  1065. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  1066. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  1067. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts.map +1 -1
  1068. package/dist/esm/security/authentications/services/auth-methods/auth-phone-verification.backend.service.d.ts.map +1 -1
  1069. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
  1070. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  1071. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
  1072. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  1073. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts +97 -0
  1074. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  1075. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +260 -27
  1076. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  1077. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts +14 -0
  1078. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  1079. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +70 -4
  1080. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  1081. package/dist/esm/security/authentications/services/auth-methods/saml-assertion-validator.backend.service.d.ts.map +1 -1
  1082. package/dist/esm/security/authentications/services/auth-methods/saml-authentication.backend.service.d.ts.map +1 -1
  1083. package/dist/esm/security/authentications/services/auth-methods/saml-metadata.backend.service.d.ts.map +1 -1
  1084. package/dist/esm/security/authentications/services/auth-methods/saml-replay-guard.backend.service.d.ts.map +1 -1
  1085. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
  1086. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  1087. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
  1088. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  1089. package/dist/esm/security/authentications/services/auth-session-store.backend.service.d.ts.map +1 -1
  1090. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
  1091. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  1092. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
  1093. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  1094. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
  1095. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  1096. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
  1097. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  1098. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
  1099. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  1100. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
  1101. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  1102. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  1103. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
  1104. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  1105. package/dist/esm/security/authentications/services/custom-impls/scim-tokens.custom-impl.backend.service.d.ts.map +1 -1
  1106. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.d.ts.map +1 -1
  1107. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
  1108. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
  1109. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +339 -0
  1110. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
  1111. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
  1112. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  1113. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
  1114. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  1115. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.d.ts.map +1 -1
  1116. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js +11 -1
  1117. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js.map +1 -1
  1118. package/dist/esm/security/authentications/services/email-verification-initiator.backend.service.d.ts.map +1 -1
  1119. package/dist/esm/security/authentications/services/machine-token-issuer.backend.service.d.ts.map +1 -1
  1120. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
  1121. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  1122. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
  1123. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  1124. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
  1125. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  1126. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
  1127. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  1128. package/dist/esm/security/authentications/services/oidc-user-claims.backend.service.d.ts.map +1 -1
  1129. package/dist/esm/security/authentications/services/resolve-active-member-orgs.backend.utils.d.ts.map +1 -1
  1130. package/dist/esm/security/authentications/services/utils/__tests__/mock-auth-user-lookup.service.d.ts.map +1 -1
  1131. package/dist/esm/security/authentications/services/utils/auth-controller.utils.d.ts.map +1 -1
  1132. package/dist/esm/security/authentications/services/utils/auth-credential-ops.backend.service.d.ts.map +1 -1
  1133. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  1134. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
  1135. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  1136. package/dist/esm/security/authentications/services/utils/auth-response-helper.backend.service.d.ts.map +1 -1
  1137. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  1138. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
  1139. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  1140. package/dist/esm/security/authentications/services/utils/concurrent-session-eviction.backend.utils.d.ts.map +1 -1
  1141. package/dist/esm/security/authentications/services/utils/ensure-user-profile.backend.utils.d.ts.map +1 -1
  1142. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
  1143. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  1144. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
  1145. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  1146. package/dist/esm/security/authentications/services/utils/machine-auth-rate-limit.backend.utils.d.ts.map +1 -1
  1147. package/dist/esm/security/authentications/services/utils/pkce.backend.utils.d.ts.map +1 -1
  1148. package/dist/esm/security/authentications/services/utils/saml-java-availability.d.ts.map +1 -1
  1149. package/dist/esm/security/authentications/utils/application-auth-policy-audit.backend.utils.d.ts.map +1 -1
  1150. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
  1151. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  1152. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
  1153. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  1154. package/dist/esm/security/authentications/utils/one-off-session-lifetime.backend.utils.d.ts.map +1 -1
  1155. package/dist/esm/security/authentications/utils/social-oauth2-purpose.backend.utils.d.ts.map +1 -1
  1156. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts +59 -0
  1157. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts.map +1 -0
  1158. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js +111 -0
  1159. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js.map +1 -0
  1160. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts +57 -0
  1161. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts.map +1 -0
  1162. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js +133 -0
  1163. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js.map +1 -0
  1164. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts +41 -0
  1165. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts.map +1 -0
  1166. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js +157 -0
  1167. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js.map +1 -0
  1168. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts +84 -0
  1169. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts.map +1 -0
  1170. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js +99 -0
  1171. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js.map +1 -0
  1172. package/dist/esm/security/authorizations/authorization-denial-audit.backend.utils.d.ts.map +1 -1
  1173. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
  1174. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
  1175. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
  1176. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
  1177. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  1178. package/dist/esm/security/authorizations/junction-scope-resolution.backend.d.ts.map +1 -1
  1179. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
  1180. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  1181. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
  1182. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  1183. package/dist/esm/security/authorizations/organization-unit-narrowing-enforcement.backend.d.ts.map +1 -1
  1184. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  1185. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +37 -124
  1186. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  1187. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -1
  1188. package/dist/esm/security/authorizations/relationship-foreign-key-filter.backend.d.ts.map +1 -1
  1189. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
  1190. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  1191. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
  1192. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  1193. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +133 -0
  1194. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
  1195. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +137 -0
  1196. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
  1197. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +134 -1
  1198. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  1199. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +152 -5
  1200. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  1201. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +146 -8
  1202. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  1203. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +328 -29
  1204. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  1205. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
  1206. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  1207. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
  1208. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  1209. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
  1210. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
  1211. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
  1212. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
  1213. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +299 -0
  1214. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
  1215. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +953 -0
  1216. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
  1217. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +99 -0
  1218. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
  1219. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
  1220. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
  1221. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
  1222. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
  1223. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
  1224. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
  1225. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +210 -0
  1226. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
  1227. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +423 -0
  1228. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
  1229. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
  1230. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  1231. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
  1232. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
  1233. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
  1234. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
  1235. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +282 -0
  1236. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
  1237. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +125 -0
  1238. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
  1239. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +123 -0
  1240. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
  1241. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
  1242. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
  1243. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
  1244. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
  1245. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +214 -0
  1246. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
  1247. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +430 -0
  1248. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
  1249. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
  1250. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  1251. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
  1252. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
  1253. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +98 -0
  1254. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
  1255. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
  1256. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
  1257. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
  1258. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
  1259. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
  1260. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
  1261. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
  1262. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
  1263. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
  1264. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
  1265. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts +34 -0
  1266. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts.map +1 -0
  1267. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js +39 -0
  1268. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js.map +1 -0
  1269. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  1270. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -1
  1271. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  1272. package/dist/esm/security/consumable-tokens/models/consumable-tokens.shared.schemas.d.ts.map +1 -1
  1273. package/dist/esm/security/consumable-tokens/models/index.d.ts.map +1 -1
  1274. package/dist/esm/security/consumable-tokens/services/__tests__/mock-consumable-token.service.d.ts.map +1 -1
  1275. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
  1276. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  1277. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
  1278. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  1279. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
  1280. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  1281. package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
  1282. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  1283. package/dist/esm/security/jwt/services/auth-jwt-guard.backend.service.d.ts.map +1 -1
  1284. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  1285. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts +13 -0
  1286. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts.map +1 -1
  1287. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js +14 -0
  1288. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js.map +1 -1
  1289. package/dist/esm/security/jwt/utils/jwt-verification-error-classification.backend.utils.d.ts.map +1 -1
  1290. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
  1291. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  1292. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
  1293. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  1294. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
  1295. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  1296. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
  1297. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  1298. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts +39 -0
  1299. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts.map +1 -0
  1300. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js +60 -0
  1301. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js.map +1 -0
  1302. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts +66 -0
  1303. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts.map +1 -0
  1304. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js +75 -0
  1305. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js.map +1 -0
  1306. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  1307. package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
  1308. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  1309. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
  1310. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  1311. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
  1312. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  1313. package/dist/esm/security/scim/utils/scim-attribute-path-resolver.backend.utils.d.ts.map +1 -1
  1314. package/dist/esm/security/scim/utils/scim-filter-parser.d.ts.map +1 -1
  1315. package/dist/esm/security/scim/utils/scim-response-formatter.d.ts.map +1 -1
  1316. package/dist/esm/security/session-invalidation-fence.backend.utils.d.ts.map +1 -1
  1317. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
  1318. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  1319. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
  1320. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  1321. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
  1322. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
  1323. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
  1324. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
  1325. package/dist/esm/security/token-invalidation-fence.backend.utils.d.ts.map +1 -1
  1326. package/dist/esm/testing.d.ts.map +1 -1
  1327. package/dist/esm/users/services/inbound-contact-custom-implementation.backend.service.d.ts.map +1 -1
  1328. package/dist/esm/users/services/user-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  1329. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts.map +1 -1
  1330. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
  1331. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
  1332. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
  1333. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
  1334. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.d.ts.map +1 -1
  1335. package/dist/esm/users/services/user-self-custom-implementations.backend.d.ts.map +1 -1
  1336. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.d.ts.map +1 -1
  1337. package/dist/tsconfig.build.tsbuildinfo +1 -1
  1338. package/package.json +11 -9
  1339. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts +0 -45
  1340. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts.map +0 -1
  1341. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js +0 -22
  1342. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js.map +0 -1
  1343. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
  1344. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
  1345. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
  1346. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
  1347. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
  1348. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
  1349. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
  1350. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
  1351. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
  1352. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
  1353. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
  1354. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
  1355. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
  1356. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
  1357. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
  1358. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
@@ -11,10 +11,10 @@
11
11
  * That is also why the resource exposes no generic CREATE or UPDATE door: a second write path would
12
12
  * be a second way to mint an elevation, which is the one thing this resource exists to prevent.
13
13
  */
14
- import { CoreResourceType, ErrorCustomMessageReference, ErrorType, PLATFORM_ACCESS_GRANT_REVOCABLE_STATUSES, PlatformAccessGrantAutoApprovalReason, PlatformAccessGrantLifecycleTransition, PlatformAccessGrantStatus, PlatformAccessGrants_Operations, ResourceOperationVariantType, resolvePlatformAccessGrantExpiry, } from '@wildo-ai/saas-models';
14
+ import { CoreResourceType, ErrorCustomMessageReference, ErrorType, PLATFORM_ACCESS_GRANT_REVOCABLE_STATUSES, PlatformAccessGrantAutoApprovalReason, PlatformAccessGrantLifecycleTransition, PlatformAccessGrantScope, PlatformAccessGrantStatus, PlatformAccessGrants_Operations, ResourceOperationVariantType, resolvePlatformAccessGrantExpiry, } from '@wildo-ai/saas-models';
15
15
  import { SAAS_SERVICE_TYPES } from '../../inject/models/service-types.js';
16
- import { registerTransactionPostCommitEffect } from '../../databases/models/transaction.shared.schemas.js';
17
- import { describeCaughtError } from '../../errors/utils/error-log-level-classification.backend.utils.js';
16
+ import { recordAccessGrantTransition } from '../../security/authorizations/access-grant-lifecycle-audit.backend.js';
17
+ import { createAccessGrantDecisionFactory } from '../../security/authorizations/access-grant-decision.factory.backend.js';
18
18
  import { createResourceCustomServiceImplementation } from '../../base-classes/services/services/resource-operation-custom-implementation.factory.backend.js';
19
19
  import { createOrganizationOwnerConferralResolver, createOrganizationOwnerFloorPopulationContext, measureUsableOrganizationOwners, } from '../../security/authorizations/organization-owner-floor.backend.utils.js';
20
20
  /**
@@ -43,56 +43,16 @@ async function tenantHasAnApprover(params) {
43
43
  return usableOwners.length > 0;
44
44
  }
45
45
  /**
46
- * Record one grant transition, AFTER the write is durable.
46
+ * Record one TENANT grant transition.
47
47
  *
48
- * Deferred to commit rather than emitted from the postfix hook directly. A postfix runs INSIDE the
49
- * declared transaction, so an audit row written there survives a rollback — the trail would then
50
- * claim an elevation that does not exist, which is worse than no trail at all.
51
- *
52
- * Best-effort in every other respect: feature-detected against the audit service (adding a `log*`
53
- * method breaks partially-mocked doubles, and the absent property throws synchronously before any
54
- * `.catch()` can help) and never allowed to fail the transition it observes.
48
+ * A thin binding of {@link recordAccessGrantTransition} with this resource's scope. The emitter — the
49
+ * post-commit deferral, the feature detection, the loss accounting — moved to
50
+ * `access-grant-lifecycle-audit.backend.ts` on 2026-09-09 when the application-wide grant arrived,
51
+ * because two near-copies of it would have drifted on exactly the parts that make the trail complete.
52
+ * Nothing about the behaviour changed; see that module for the reasoning behind each half.
55
53
  */
56
54
  function recordGrantTransition(params) {
57
- const emit = async () => {
58
- try {
59
- if (!params.container.isBound?.(SAAS_SERVICE_TYPES.AuditLogsService))
60
- return;
61
- const auditLogsService = params.container.get(SAAS_SERVICE_TYPES.AuditLogsService);
62
- if (typeof auditLogsService?.logPlatformAccessGrantLifecycle !== 'function')
63
- return;
64
- const grant = params.grant;
65
- await auditLogsService.logPlatformAccessGrantLifecycle({
66
- transition: params.transition,
67
- grantId: String(grant._id ?? ''),
68
- targetOrganizationId: String(grant.organizationId ?? ''),
69
- operatorUserId: String(grant.operatorUserId ?? ''),
70
- justification: grant.justification,
71
- resultingStatus: grant.status,
72
- expiresAt: grant.expiresAt,
73
- autoApprovalReason: grant.autoApprovalReason,
74
- decidedByUserId: params.decidedByUserId,
75
- decisionReason: grant.decisionReason,
76
- });
77
- }
78
- catch (error) {
79
- params.utils.logger?.error?.('Failed to record a platform-access-grant lifecycle event', {
80
- reason: 'platform_access_grant_lifecycle_audit_emission_failed',
81
- transition: params.transition,
82
- error: describeCaughtError(error),
83
- });
84
- }
85
- };
86
- const transaction = params.utils.serviceOptions?.transaction;
87
- if (transaction) {
88
- registerTransactionPostCommitEffect(transaction, {
89
- key: `platform-access-grant:${params.transition}:${String(params.grant._id ?? '')}`,
90
- execute: emit,
91
- });
92
- }
93
- else {
94
- void emit();
95
- }
55
+ recordAccessGrantTransition({ ...params, grantScope: PlatformAccessGrantScope.TENANT });
96
56
  }
97
57
  export function createPlatformAccessGrantFactories() {
98
58
  /**
@@ -193,82 +153,18 @@ export function createPlatformAccessGrantFactories() {
193
153
  });
194
154
  };
195
155
  /**
196
- * The three decision verbs share a shape: refuse unless the current status permits the transition,
197
- * then write exactly the fields that transition owns.
156
+ * The decision verbs. The shape moved to `access-grant-decision.factory.backend.ts` on 2026-09-09,
157
+ * when the application-wide grant needed the same four transitions plus one refusal of its own; the
158
+ * behaviour of every verb below is unchanged, and its reasoning lives in that module.
198
159
  *
199
- * `enabledCondition` on the operation config already gates each verb, but that guard is evaluated
200
- * against the row the framework fetched and is a UI-and-dispatch concern. Re-checking here is the
201
- * fail-closed half: a custom implementation is addressed by an exact operation path and inherits
202
- * nothing, so a future variant added without an `enabledCondition` would otherwise transition a
203
- * terminal grant silently.
160
+ * No `additionalPrecondition` here on purpose. The application-wide `approve` refuses a
161
+ * self-approval; this one has no equivalent because the requester is a PLATFORM operator and the
162
+ * approver is a TENANT administrator gated on `CORE_ORG_ROLES.ORG_ADMIN` with no cross-tenant
163
+ * admission — they cannot be the same principal, and the ABSENCE of that admission is what makes it
164
+ * so. Adding a same-person check here would look like defence in depth and would in fact be a
165
+ * second, weaker statement of a control the operation config already carries absolutely.
204
166
  */
205
- const makeDecisionFactory = (
206
- // The whole enum rather than a three-member union: `ResourceConfiguration_OperationPath` does not
207
- // accept a union of enum members, and narrowing it here would buy nothing — the three call sites
208
- // below are the only ones and each names its verb explicitly.
209
- operationIdentifier, options) => (_resourcesRegistryService, container) => {
210
- const containerRef = container;
211
- return createResourceCustomServiceImplementation({
212
- operationPath: {
213
- resourceIdentifier: CoreResourceType.PLATFORM_ACCESS_GRANTS,
214
- operationIdentifier,
215
- variantType: ResourceOperationVariantType.API_CALL,
216
- isOperationDefault: true,
217
- },
218
- debugLabel: options.debugLabel,
219
- authoritativeFields: options.stampsApprover
220
- ? ['status', 'approvedByUserId', 'approvedAt', 'decisionReason']
221
- : ['status', 'decisionReason'],
222
- transactionalCore: true,
223
- // No additional participants: a decision writes only the grant row itself, which the operation
224
- // resource contributes automatically. Declaring the set explicitly (even as empty) is the
225
- // authoring contract — startup proves adapter compatibility for what is declared, and it cannot
226
- // detect an omitted participant.
227
- transactionParticipants: {},
228
- handlers: {
229
- prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {
230
- const currentObject = utils.currentObject;
231
- const currentStatus = currentObject?.status;
232
- if (!currentStatus || !options.permittedFrom.includes(currentStatus)) {
233
- throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {
234
- customMessageReference: ErrorCustomMessageReference.CONFLICT,
235
- context: {
236
- reason: 'platform_access_grant_transition_not_permitted_from_current_status',
237
- currentStatus: currentStatus ?? null,
238
- permittedFrom: [...options.permittedFrom],
239
- operationIdentifier,
240
- },
241
- });
242
- }
243
- const decisionReason = input?.decisionReason;
244
- const now = new Date();
245
- return {
246
- status: options.nextStatus,
247
- ...(decisionReason ? { decisionReason } : {}),
248
- // Only an APPROVAL names a human approver. A revocation or a denial is a decision too,
249
- // but recording either in `approvedByUserId` would corrupt the one field an audit reads
250
- // to answer "did somebody in the tenant say yes?".
251
- ...(options.stampsApprover
252
- ? { approvedByUserId: executionContext.initiatorIds?.userId, approvedAt: now }
253
- : {}),
254
- };
255
- },
256
- postfixCoreOperations: async (_id, updatedGrant, executionContext, _operationPath, utils) => {
257
- recordGrantTransition({
258
- container: containerRef,
259
- utils,
260
- transition: options.auditTransition,
261
- grant: (updatedGrant ?? {}),
262
- // The tenant administrator who acted — distinct from the grant's `operatorUserId`, which
263
- // stays the operator who asked. Conflating them would make an audit unable to answer who
264
- // said yes.
265
- decidedByUserId: executionContext.initiatorIds?.userId,
266
- });
267
- return updatedGrant;
268
- },
269
- },
270
- });
271
- };
167
+ const makeDecisionFactory = (operationIdentifier, options) => createAccessGrantDecisionFactory(CoreResourceType.PLATFORM_ACCESS_GRANTS, PlatformAccessGrantScope.TENANT, operationIdentifier, { ...options, transitionRefusalReason: 'platform_access_grant_transition_not_permitted_from_current_status' });
272
168
  return [
273
169
  requestAccessFactory,
274
170
  makeDecisionFactory(PlatformAccessGrants_Operations.APPROVE, {
@@ -294,6 +190,23 @@ export function createPlatformAccessGrantFactories() {
294
190
  permittedFrom: PLATFORM_ACCESS_GRANT_REVOCABLE_STATUSES,
295
191
  stampsApprover: false,
296
192
  }),
193
+ /**
194
+ * The one transition with no human actor (#413). Everything else here records a decision
195
+ * somebody made; this records that a window closed, so `decidedByUserId` resolves to nothing and
196
+ * that absence is the fact.
197
+ *
198
+ * Permitted from ACTIVE alone. A grant the tenant DENIED or REVOKED is terminal and must keep
199
+ * saying which — relabelling it EXPIRED would rewrite the decision history a customer audit
200
+ * reads, which is the opposite of why this sweep exists.
201
+ */
202
+ makeDecisionFactory(PlatformAccessGrants_Operations.EXPIRE, {
203
+ debugLabel: 'platform-access-grants.expire.internal',
204
+ auditTransition: PlatformAccessGrantLifecycleTransition.EXPIRED,
205
+ nextStatus: PlatformAccessGrantStatus.EXPIRED,
206
+ permittedFrom: [PlatformAccessGrantStatus.ACTIVE],
207
+ stampsApprover: false,
208
+ variantType: ResourceOperationVariantType.INTERNAL_CALL,
209
+ }),
297
210
  ];
298
211
  }
299
212
  //# sourceMappingURL=platform-access-grant-custom-implementation.backend.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"platform-access-grant-custom-implementation.backend.service.js","sourceRoot":"","sources":["../../../../../src/security/authorizations/platform-access-grant-custom-implementation.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA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AC,MAAM;YAC5C,aAAa,EAAE,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;YAC3D,cAAc,EAAE,KAAK;SACtB,CAAC;QACF,mBAAmB,CAAC,+BAA+B,CAAC,MAAM,EAAE;YAC1D,UAAU,EAAE,mCAAmC;YAC/C,eAAe,EAAE,sCAAsC,CAAC,OAAO;YAC/D,UAAU,EAAE,yBAAyB,CAAC,OAAO;YAC7C,yFAAyF;YACzF,2DAA2D;YAC3D,aAAa,EAAE,wCAAwC;YACvD,cAAc,EAAE,KAAK;SACtB,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Platform access grants — the four lifecycle transitions.\n *\n * The whole resource exists to turn a STANDING platform privilege into a requested, justified,\n * tenant-scoped, self-expiring one (rungs 4–5 of the ladder in\n * `.claude/rules/administrative-continuity-floors.md`). These implementations are where the fields\n * that carry that guarantee — `operatorUserId`, `status`, `expiresAt`, `approvedByUserId` — are\n * AUTHORED BY THE SERVER. Every one of them is `.excludeFromCreate()` / `.excludeFromUpdate()`, so a\n * client cannot supply them; the strict request DTO drops them and these prefixes put them back.\n *\n * That is also why the resource exposes no generic CREATE or UPDATE door: a second write path would\n * be a second way to mint an elevation, which is the one thing this resource exists to prevent.\n */\n\nimport type { Container } from 'inversify';\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ErrorCustomMessageReference,\n ErrorType,\n PLATFORM_ACCESS_GRANT_REVOCABLE_STATUSES,\n PlatformAccessGrantAutoApprovalReason,\n PlatformAccessGrantLifecycleTransition,\n PlatformAccessGrantStatus,\n PlatformAccessGrants_Operations,\n ResourceOperationVariantType,\n resolvePlatformAccessGrantExpiry,\n} from '@wildo-ai/saas-models';\nimport type { Organization, PlatformAccessGrant } from '@wildo-ai/saas-models';\n\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { registerTransactionPostCommitEffect } from '~wildo-backend-lib/databases/models/transaction.shared.schemas';\nimport { describeCaughtError } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport type { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\nimport { createResourceCustomServiceImplementation } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourceCustomServiceImplementationFactory } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { AuthExecutionContextFactoryBackendService } from '~wildo-backend-lib/security/authentications/services/auth-execution-context-factory.backend.service';\nimport type { RepositoriesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/repositories/repositories-registry-handler.backend.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport {\n createOrganizationOwnerConferralResolver,\n createOrganizationOwnerFloorPopulationContext,\n measureUsableOrganizationOwners,\n} from '~wildo-backend-lib/security/authorizations/organization-owner-floor.backend.utils';\n\n/**\n * Can this tenant currently supply a human who could approve?\n *\n * Deliberately delegates to {@link measureUsableOrganizationOwners} — the OWNER FLOOR's own\n * measurement — rather than asking a similar-looking question here. The floor already answers\n * \"does this tenant have an administratively usable owner?\" across three axes (the role confers\n * ownership through the live table, the membership is ACTIVE, and the linked user is ACTIVE), and a\n * second implementation would drift from it the first time any axis changed.\n *\n * Drift here would be quiet and bad in both directions: over-counting makes a stranded tenant wait\n * forever for an approver who cannot act, and under-counting auto-approves operator access into a\n * tenant that could have consented.\n */\nasync function tenantHasAnApprover(params: {\n organizationId: string;\n authEcFactory: AuthExecutionContextFactoryBackendService;\n conferringRoles: readonly string[];\n repositoriesRegistry: RepositoriesRegistryHandlerBackendService;\n errorBuilder: ErrorBuilderBackendService;\n}): Promise<boolean> {\n const executionContext = await createOrganizationOwnerFloorPopulationContext(params.authEcFactory);\n const usableOwners = await measureUsableOrganizationOwners({\n organizationId: params.organizationId,\n executionContext,\n repositoriesRegistry: params.repositoriesRegistry,\n errorBuilder: params.errorBuilder,\n conferringRoles: params.conferringRoles,\n operationIdentifier: PlatformAccessGrants_Operations.REQUEST_ACCESS,\n });\n return usableOwners.length > 0;\n}\n\n/**\n * Record one grant transition, AFTER the write is durable.\n *\n * Deferred to commit rather than emitted from the postfix hook directly. A postfix runs INSIDE the\n * declared transaction, so an audit row written there survives a rollback — the trail would then\n * claim an elevation that does not exist, which is worse than no trail at all.\n *\n * Best-effort in every other respect: feature-detected against the audit service (adding a `log*`\n * method breaks partially-mocked doubles, and the absent property throws synchronously before any\n * `.catch()` can help) and never allowed to fail the transition it observes.\n */\nfunction recordGrantTransition(params: {\n container: Container;\n utils: { serviceOptions?: { transaction?: unknown }; logger?: { error?: (message: string, meta: unknown) => void } };\n transition: PlatformAccessGrantLifecycleTransition;\n grant: Record<string, unknown>;\n decidedByUserId?: string;\n}): void {\n const emit = async (): Promise<void> => {\n try {\n if (!params.container.isBound?.(SAAS_SERVICE_TYPES.AuditLogsService)) return;\n const auditLogsService = params.container.get<AuditLogsBackendService>(SAAS_SERVICE_TYPES.AuditLogsService);\n if (typeof auditLogsService?.logPlatformAccessGrantLifecycle !== 'function') return;\n\n const grant = params.grant;\n await auditLogsService.logPlatformAccessGrantLifecycle({\n transition: params.transition,\n grantId: String(grant._id ?? ''),\n targetOrganizationId: String(grant.organizationId ?? ''),\n operatorUserId: String(grant.operatorUserId ?? ''),\n justification: grant.justification as string | undefined,\n resultingStatus: grant.status as PlatformAccessGrantStatus,\n expiresAt: grant.expiresAt as Date | undefined,\n autoApprovalReason: grant.autoApprovalReason as PlatformAccessGrantAutoApprovalReason | undefined,\n decidedByUserId: params.decidedByUserId,\n decisionReason: grant.decisionReason as string | undefined,\n });\n } catch (error) {\n params.utils.logger?.error?.('Failed to record a platform-access-grant lifecycle event', {\n reason: 'platform_access_grant_lifecycle_audit_emission_failed',\n transition: params.transition,\n error: describeCaughtError(error),\n });\n }\n };\n\n const transaction = params.utils.serviceOptions?.transaction;\n if (transaction) {\n registerTransactionPostCommitEffect(transaction as never, {\n key: `platform-access-grant:${params.transition}:${String(params.grant._id ?? '')}`,\n execute: emit,\n });\n } else {\n void emit();\n }\n}\n\nexport function createPlatformAccessGrantFactories(): ResourceCustomServiceImplementationFactory[] {\n /**\n * REQUEST — the bootstrap verb, and the only one reachable without an existing grant.\n *\n * Requesting is not accessing: this writes one row and touches nothing else in the tenant, which is\n * what makes the exemption safe when the admission predicate starts requiring a grant (Step 4).\n */\n const requestAccessFactory = (\n _resourcesRegistryService: ResourcesRegistryBackendService,\n container: Container,\n ) => {\n const authEcFactory = container.get<AuthExecutionContextFactoryBackendService>(SAAS_SERVICE_TYPES.AuthExecutionContextFactory);\n const organizationOwnerConferralResolver = createOrganizationOwnerConferralResolver(container);\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PLATFORM_ACCESS_GRANTS,\n operationIdentifier: PlatformAccessGrants_Operations.REQUEST_ACCESS,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'platform-access-grants.request-access.api',\n // Every one of these is `.excludeFromCreate()`, so the strict request DTO drops whatever a\n // caller sent and the prefix's value is authoritative. Declaring them makes that explicit\n // rather than inferred — the inference has a hole for callers that reach the service tier with\n // the key already present (MCP `callTool` forwards arguments unparsed), and on THIS resource a\n // caller choosing their own `status` or `expiresAt` would defeat the entire mechanism.\n authoritativeFields: ['operatorUserId', 'status', 'expiresAt', 'autoApprovalReason', 'approvedAt'],\n transactionalCore: true,\n transactionParticipants: { targetOrganization: CoreResourceType.ORGANIZATIONS },\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const payload = input as { justification?: string; requestedDurationMinutes?: number };\n // The primary-scope URL is the one target authority. The execution-context creator has\n // already validated the mandatory `organizationId` path parameter and placed it here;\n // reading a second body value would make callers author the security boundary twice and\n // would preserve an unnecessary path/body mismatch state.\n const organizationId = executionContext.organizationId;\n const operatorUserId = executionContext.initiatorIds?.userId;\n\n if (!organizationId || !operatorUserId) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { reason: 'platform_access_grant_requires_target_and_operator' },\n });\n }\n\n // Read the tenant's posture in the same unit of work as the write. Reading it outside the\n // transaction would let a tenant that just switched Lockbox ON have a request slip through\n // as auto-approved.\n // Reuses the floor's own population context rather than inventing an organizations-read\n // helper: it is already a system context authorized for the tenant-scoped reads this needs,\n // and adding a second system-context factory for one call site is how two subtly different\n // privileged contexts start to exist.\n const systemEc = await createOrganizationOwnerFloorPopulationContext(authEcFactory);\n const organization = await utils.servicesRegistry.read<Organization>(\n CoreResourceType.ORGANIZATIONS,\n systemEc,\n { _id: organizationId },\n utils.serviceOptions,\n );\n if (!organization) {\n throw utils.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: { reason: 'platform_access_grant_target_organization_not_found' },\n });\n }\n\n const now = new Date();\n const approvalRequired = (organization as { platformAccessApprovalRequired?: boolean }).platformAccessApprovalRequired === true;\n\n // The circularity guard. A tenant with no administratively usable owner cannot approve\n // anything, so requiring its approval would make its own repair impossible — the exact\n // deadlock `organizationMembers.grantOwnership` exists to break. Measured, never assumed,\n // and never manufacturable by the operator: stranding a tenant is what the floors refuse.\n const canApprove = approvalRequired\n ? await tenantHasAnApprover({\n organizationId,\n authEcFactory,\n conferringRoles: organizationOwnerConferralResolver(),\n repositoriesRegistry: utils.repositoriesRegistry,\n errorBuilder: utils.errorBuilder,\n })\n : false;\n\n const autoApprovalReason = !approvalRequired\n ? PlatformAccessGrantAutoApprovalReason.TENANT_APPROVAL_NOT_REQUIRED\n : (canApprove ? undefined : PlatformAccessGrantAutoApprovalReason.TENANT_CANNOT_APPROVE);\n\n const status = autoApprovalReason\n ? PlatformAccessGrantStatus.ACTIVE\n : PlatformAccessGrantStatus.PENDING_APPROVAL;\n\n return {\n organizationId,\n justification: payload.justification,\n operatorUserId,\n status,\n expiresAt: resolvePlatformAccessGrantExpiry(payload.requestedDurationMinutes, now),\n ...(autoApprovalReason ? { autoApprovalReason, approvedAt: now } : {}),\n };\n },\n postfixCoreOperations: async (_id, createdGrant, _executionContext, _operationPath, utils) => {\n recordGrantTransition({\n container,\n utils,\n transition: PlatformAccessGrantLifecycleTransition.REQUESTED,\n grant: (createdGrant ?? {}) as Record<string, unknown>,\n });\n return createdGrant;\n },\n },\n });\n };\n\n /**\n * The three decision verbs share a shape: refuse unless the current status permits the transition,\n * then write exactly the fields that transition owns.\n *\n * `enabledCondition` on the operation config already gates each verb, but that guard is evaluated\n * against the row the framework fetched and is a UI-and-dispatch concern. Re-checking here is the\n * fail-closed half: a custom implementation is addressed by an exact operation path and inherits\n * nothing, so a future variant added without an `enabledCondition` would otherwise transition a\n * terminal grant silently.\n */\n const makeDecisionFactory = (\n // The whole enum rather than a three-member union: `ResourceConfiguration_OperationPath` does not\n // accept a union of enum members, and narrowing it here would buy nothing — the three call sites\n // below are the only ones and each names its verb explicitly.\n operationIdentifier: PlatformAccessGrants_Operations,\n options: {\n debugLabel: string;\n nextStatus: PlatformAccessGrantStatus;\n permittedFrom: readonly PlatformAccessGrantStatus[];\n stampsApprover: boolean;\n auditTransition: PlatformAccessGrantLifecycleTransition;\n },\n ): ResourceCustomServiceImplementationFactory =>\n (_resourcesRegistryService: ResourcesRegistryBackendService, container: Container) => {\n const containerRef = container;\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PLATFORM_ACCESS_GRANTS,\n operationIdentifier,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: options.debugLabel,\n authoritativeFields: options.stampsApprover\n ? ['status', 'approvedByUserId', 'approvedAt', 'decisionReason']\n : ['status', 'decisionReason'],\n transactionalCore: true,\n // No additional participants: a decision writes only the grant row itself, which the operation\n // resource contributes automatically. Declaring the set explicitly (even as empty) is the\n // authoring contract — startup proves adapter compatibility for what is declared, and it cannot\n // detect an omitted participant.\n transactionParticipants: {},\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const currentObject = utils.currentObject as Pick<PlatformAccessGrant, 'status'> | undefined;\n const currentStatus = currentObject?.status;\n\n if (!currentStatus || !options.permittedFrom.includes(currentStatus)) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFLICT,\n context: {\n reason: 'platform_access_grant_transition_not_permitted_from_current_status',\n currentStatus: currentStatus ?? null,\n permittedFrom: [...options.permittedFrom],\n operationIdentifier,\n },\n });\n }\n\n const decisionReason = (input as { decisionReason?: string })?.decisionReason;\n const now = new Date();\n\n return {\n status: options.nextStatus,\n ...(decisionReason ? { decisionReason } : {}),\n // Only an APPROVAL names a human approver. A revocation or a denial is a decision too,\n // but recording either in `approvedByUserId` would corrupt the one field an audit reads\n // to answer \"did somebody in the tenant say yes?\".\n ...(options.stampsApprover\n ? { approvedByUserId: executionContext.initiatorIds?.userId, approvedAt: now }\n : {}),\n };\n },\n postfixCoreOperations: async (_id, updatedGrant, executionContext, _operationPath, utils) => {\n recordGrantTransition({\n container: containerRef!,\n utils,\n transition: options.auditTransition,\n grant: (updatedGrant ?? {}) as Record<string, unknown>,\n // The tenant administrator who acted — distinct from the grant's `operatorUserId`, which\n // stays the operator who asked. Conflating them would make an audit unable to answer who\n // said yes.\n decidedByUserId: executionContext.initiatorIds?.userId,\n });\n return updatedGrant;\n },\n },\n });\n };\n\n return [\n requestAccessFactory,\n makeDecisionFactory(PlatformAccessGrants_Operations.APPROVE, {\n debugLabel: 'platform-access-grants.approve.api',\n auditTransition: PlatformAccessGrantLifecycleTransition.APPROVED,\n nextStatus: PlatformAccessGrantStatus.ACTIVE,\n permittedFrom: [PlatformAccessGrantStatus.PENDING_APPROVAL],\n stampsApprover: true,\n }),\n makeDecisionFactory(PlatformAccessGrants_Operations.DENY, {\n debugLabel: 'platform-access-grants.deny.api',\n auditTransition: PlatformAccessGrantLifecycleTransition.DENIED,\n nextStatus: PlatformAccessGrantStatus.DENIED,\n permittedFrom: [PlatformAccessGrantStatus.PENDING_APPROVAL],\n stampsApprover: false,\n }),\n makeDecisionFactory(PlatformAccessGrants_Operations.REVOKE, {\n debugLabel: 'platform-access-grants.revoke.api',\n auditTransition: PlatformAccessGrantLifecycleTransition.REVOKED,\n nextStatus: PlatformAccessGrantStatus.REVOKED,\n // Both a pending request and a live elevation can be withdrawn; a terminal one cannot be\n // re-terminated, which would rewrite the decision history.\n permittedFrom: PLATFORM_ACCESS_GRANT_REVOCABLE_STATUSES,\n stampsApprover: false,\n }),\n ];\n}\n"]}
1
+ {"version":3,"file":"platform-access-grant-custom-implementation.backend.service.js","sourceRoot":"","sources":["../../../../src/security/authorizations/platform-access-grant-custom-implementation.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAEL,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EACT,wCAAwC,EACxC,qCAAqC,EACrC,sCAAsC,EACtC,wBAAwB,EACxB,yBAAyB,EACzB,+BAA+B,EAC/B,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iFAAiF,CAAC;AAC9H,OAAO,EAAE,gCAAgC,EAAE,MAAM,kFAAkF,CAAC;AACpI,OAAO,EAAE,yCAAyC,EAAE,MAAM,4GAA4G,CAAC;AAMvK,OAAO,EACL,wCAAwC,EACxC,6CAA6C,EAC7C,+BAA+B,GAChC,MAAM,mFAAmF,CAAC;AAE3F;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,mBAAmB,CAAC,MAMlC;IACC,MAAM,gBAAgB,GAAG,MAAM,6CAA6C,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACnG,MAAM,YA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AwC;YACpD,eAAe,EAAE,sCAAsC,CAAC,OAAO;YAC/D,UAAU,EAAE,yBAAyB,CAAC,OAAO;YAC7C,aAAa,EAAE,CAAC,yBAAyB,CAAC,MAAM,CAAC;YACjD,cAAc,EAAE,KAAK;YACrB,WAAW,EAAE,4BAA4B,CAAC,aAAa;SACxD,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Platform access grants — the four lifecycle transitions.\n *\n * The whole resource exists to turn a STANDING platform privilege into a requested, justified,\n * tenant-scoped, self-expiring one (rungs 4–5 of the ladder in\n * `.claude/rules/administrative-continuity-floors.md`). These implementations are where the fields\n * that carry that guarantee — `operatorUserId`, `status`, `expiresAt`, `approvedByUserId` — are\n * AUTHORED BY THE SERVER. Every one of them is `.excludeFromCreate()` / `.excludeFromUpdate()`, so a\n * client cannot supply them; the strict request DTO drops them and these prefixes put them back.\n *\n * That is also why the resource exposes no generic CREATE or UPDATE door: a second write path would\n * be a second way to mint an elevation, which is the one thing this resource exists to prevent.\n */\n\nimport type { Container } from 'inversify';\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ErrorCustomMessageReference,\n ErrorType,\n PLATFORM_ACCESS_GRANT_REVOCABLE_STATUSES,\n PlatformAccessGrantAutoApprovalReason,\n PlatformAccessGrantLifecycleTransition,\n PlatformAccessGrantScope,\n PlatformAccessGrantStatus,\n PlatformAccessGrants_Operations,\n ResourceOperationVariantType,\n resolvePlatformAccessGrantExpiry,\n} from '@wildo-ai/saas-models';\nimport type { Organization, PlatformAccessGrant } from '@wildo-ai/saas-models';\n\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { recordAccessGrantTransition } from '~wildo-backend-lib/security/authorizations/access-grant-lifecycle-audit.backend';\nimport { createAccessGrantDecisionFactory } from '~wildo-backend-lib/security/authorizations/access-grant-decision.factory.backend';\nimport { createResourceCustomServiceImplementation } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourceCustomServiceImplementationFactory } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { AuthExecutionContextFactoryBackendService } from '~wildo-backend-lib/security/authentications/services/auth-execution-context-factory.backend.service';\nimport type { RepositoriesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/repositories/repositories-registry-handler.backend.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport {\n createOrganizationOwnerConferralResolver,\n createOrganizationOwnerFloorPopulationContext,\n measureUsableOrganizationOwners,\n} from '~wildo-backend-lib/security/authorizations/organization-owner-floor.backend.utils';\n\n/**\n * Can this tenant currently supply a human who could approve?\n *\n * Deliberately delegates to {@link measureUsableOrganizationOwners} — the OWNER FLOOR's own\n * measurement — rather than asking a similar-looking question here. The floor already answers\n * \"does this tenant have an administratively usable owner?\" across three axes (the role confers\n * ownership through the live table, the membership is ACTIVE, and the linked user is ACTIVE), and a\n * second implementation would drift from it the first time any axis changed.\n *\n * Drift here would be quiet and bad in both directions: over-counting makes a stranded tenant wait\n * forever for an approver who cannot act, and under-counting auto-approves operator access into a\n * tenant that could have consented.\n */\nasync function tenantHasAnApprover(params: {\n organizationId: string;\n authEcFactory: AuthExecutionContextFactoryBackendService;\n conferringRoles: readonly string[];\n repositoriesRegistry: RepositoriesRegistryHandlerBackendService;\n errorBuilder: ErrorBuilderBackendService;\n}): Promise<boolean> {\n const executionContext = await createOrganizationOwnerFloorPopulationContext(params.authEcFactory);\n const usableOwners = await measureUsableOrganizationOwners({\n organizationId: params.organizationId,\n executionContext,\n repositoriesRegistry: params.repositoriesRegistry,\n errorBuilder: params.errorBuilder,\n conferringRoles: params.conferringRoles,\n operationIdentifier: PlatformAccessGrants_Operations.REQUEST_ACCESS,\n });\n return usableOwners.length > 0;\n}\n\n/**\n * Record one TENANT grant transition.\n *\n * A thin binding of {@link recordAccessGrantTransition} with this resource's scope. The emitter — the\n * post-commit deferral, the feature detection, the loss accounting — moved to\n * `access-grant-lifecycle-audit.backend.ts` on 2026-09-09 when the application-wide grant arrived,\n * because two near-copies of it would have drifted on exactly the parts that make the trail complete.\n * Nothing about the behaviour changed; see that module for the reasoning behind each half.\n */\nfunction recordGrantTransition(params: {\n container: Container;\n utils: { serviceOptions?: { transaction?: unknown }; logger?: { error?: (message: string, meta: unknown) => void } };\n transition: PlatformAccessGrantLifecycleTransition;\n grant: Record<string, unknown>;\n decidedByUserId?: string;\n}): void {\n recordAccessGrantTransition({ ...params, grantScope: PlatformAccessGrantScope.TENANT });\n}\n\nexport function createPlatformAccessGrantFactories(): ResourceCustomServiceImplementationFactory[] {\n /**\n * REQUEST — the bootstrap verb, and the only one reachable without an existing grant.\n *\n * Requesting is not accessing: this writes one row and touches nothing else in the tenant, which is\n * what makes the exemption safe when the admission predicate starts requiring a grant (Step 4).\n */\n const requestAccessFactory = (\n _resourcesRegistryService: ResourcesRegistryBackendService,\n container: Container,\n ) => {\n const authEcFactory = container.get<AuthExecutionContextFactoryBackendService>(SAAS_SERVICE_TYPES.AuthExecutionContextFactory);\n const organizationOwnerConferralResolver = createOrganizationOwnerConferralResolver(container);\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PLATFORM_ACCESS_GRANTS,\n operationIdentifier: PlatformAccessGrants_Operations.REQUEST_ACCESS,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n debugLabel: 'platform-access-grants.request-access.api',\n // Every one of these is `.excludeFromCreate()`, so the strict request DTO drops whatever a\n // caller sent and the prefix's value is authoritative. Declaring them makes that explicit\n // rather than inferred — the inference has a hole for callers that reach the service tier with\n // the key already present (MCP `callTool` forwards arguments unparsed), and on THIS resource a\n // caller choosing their own `status` or `expiresAt` would defeat the entire mechanism.\n authoritativeFields: ['operatorUserId', 'status', 'expiresAt', 'autoApprovalReason', 'approvedAt'],\n transactionalCore: true,\n transactionParticipants: { targetOrganization: CoreResourceType.ORGANIZATIONS },\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const payload = input as { justification?: string; requestedDurationMinutes?: number };\n // The primary-scope URL is the one target authority. The execution-context creator has\n // already validated the mandatory `organizationId` path parameter and placed it here;\n // reading a second body value would make callers author the security boundary twice and\n // would preserve an unnecessary path/body mismatch state.\n const organizationId = executionContext.organizationId;\n const operatorUserId = executionContext.initiatorIds?.userId;\n\n if (!organizationId || !operatorUserId) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: { reason: 'platform_access_grant_requires_target_and_operator' },\n });\n }\n\n // Read the tenant's posture in the same unit of work as the write. Reading it outside the\n // transaction would let a tenant that just switched Lockbox ON have a request slip through\n // as auto-approved.\n // Reuses the floor's own population context rather than inventing an organizations-read\n // helper: it is already a system context authorized for the tenant-scoped reads this needs,\n // and adding a second system-context factory for one call site is how two subtly different\n // privileged contexts start to exist.\n const systemEc = await createOrganizationOwnerFloorPopulationContext(authEcFactory);\n const organization = await utils.servicesRegistry.read<Organization>(\n CoreResourceType.ORGANIZATIONS,\n systemEc,\n { _id: organizationId },\n utils.serviceOptions,\n );\n if (!organization) {\n throw utils.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: { reason: 'platform_access_grant_target_organization_not_found' },\n });\n }\n\n const now = new Date();\n const approvalRequired = (organization as { platformAccessApprovalRequired?: boolean }).platformAccessApprovalRequired === true;\n\n // The circularity guard. A tenant with no administratively usable owner cannot approve\n // anything, so requiring its approval would make its own repair impossible — the exact\n // deadlock `organizationMembers.grantOwnership` exists to break. Measured, never assumed,\n // and never manufacturable by the operator: stranding a tenant is what the floors refuse.\n const canApprove = approvalRequired\n ? await tenantHasAnApprover({\n organizationId,\n authEcFactory,\n conferringRoles: organizationOwnerConferralResolver(),\n repositoriesRegistry: utils.repositoriesRegistry,\n errorBuilder: utils.errorBuilder,\n })\n : false;\n\n const autoApprovalReason = !approvalRequired\n ? PlatformAccessGrantAutoApprovalReason.TENANT_APPROVAL_NOT_REQUIRED\n : (canApprove ? undefined : PlatformAccessGrantAutoApprovalReason.TENANT_CANNOT_APPROVE);\n\n const status = autoApprovalReason\n ? PlatformAccessGrantStatus.ACTIVE\n : PlatformAccessGrantStatus.PENDING_APPROVAL;\n\n return {\n organizationId,\n justification: payload.justification,\n operatorUserId,\n status,\n expiresAt: resolvePlatformAccessGrantExpiry(payload.requestedDurationMinutes, now),\n ...(autoApprovalReason ? { autoApprovalReason, approvedAt: now } : {}),\n };\n },\n postfixCoreOperations: async (_id, createdGrant, _executionContext, _operationPath, utils) => {\n recordGrantTransition({\n container,\n utils,\n transition: PlatformAccessGrantLifecycleTransition.REQUESTED,\n grant: (createdGrant ?? {}) as Record<string, unknown>,\n });\n return createdGrant;\n },\n },\n });\n };\n\n /**\n * The decision verbs. The shape moved to `access-grant-decision.factory.backend.ts` on 2026-09-09,\n * when the application-wide grant needed the same four transitions plus one refusal of its own; the\n * behaviour of every verb below is unchanged, and its reasoning lives in that module.\n *\n * No `additionalPrecondition` here on purpose. The application-wide `approve` refuses a\n * self-approval; this one has no equivalent because the requester is a PLATFORM operator and the\n * approver is a TENANT administrator gated on `CORE_ORG_ROLES.ORG_ADMIN` with no cross-tenant\n * admission — they cannot be the same principal, and the ABSENCE of that admission is what makes it\n * so. Adding a same-person check here would look like defence in depth and would in fact be a\n * second, weaker statement of a control the operation config already carries absolutely.\n */\n const makeDecisionFactory = (\n operationIdentifier: PlatformAccessGrants_Operations,\n options: {\n debugLabel: string;\n nextStatus: PlatformAccessGrantStatus;\n permittedFrom: readonly PlatformAccessGrantStatus[];\n stampsApprover: boolean;\n auditTransition: PlatformAccessGrantLifecycleTransition;\n variantType?: ResourceOperationVariantType;\n },\n ): ResourceCustomServiceImplementationFactory => createAccessGrantDecisionFactory(\n CoreResourceType.PLATFORM_ACCESS_GRANTS,\n PlatformAccessGrantScope.TENANT,\n operationIdentifier,\n { ...options, transitionRefusalReason: 'platform_access_grant_transition_not_permitted_from_current_status' },\n );\n\n return [\n requestAccessFactory,\n makeDecisionFactory(PlatformAccessGrants_Operations.APPROVE, {\n debugLabel: 'platform-access-grants.approve.api',\n auditTransition: PlatformAccessGrantLifecycleTransition.APPROVED,\n nextStatus: PlatformAccessGrantStatus.ACTIVE,\n permittedFrom: [PlatformAccessGrantStatus.PENDING_APPROVAL],\n stampsApprover: true,\n }),\n makeDecisionFactory(PlatformAccessGrants_Operations.DENY, {\n debugLabel: 'platform-access-grants.deny.api',\n auditTransition: PlatformAccessGrantLifecycleTransition.DENIED,\n nextStatus: PlatformAccessGrantStatus.DENIED,\n permittedFrom: [PlatformAccessGrantStatus.PENDING_APPROVAL],\n stampsApprover: false,\n }),\n makeDecisionFactory(PlatformAccessGrants_Operations.REVOKE, {\n debugLabel: 'platform-access-grants.revoke.api',\n auditTransition: PlatformAccessGrantLifecycleTransition.REVOKED,\n nextStatus: PlatformAccessGrantStatus.REVOKED,\n // Both a pending request and a live elevation can be withdrawn; a terminal one cannot be\n // re-terminated, which would rewrite the decision history.\n permittedFrom: PLATFORM_ACCESS_GRANT_REVOCABLE_STATUSES,\n stampsApprover: false,\n }),\n /**\n * The one transition with no human actor (#413). Everything else here records a decision\n * somebody made; this records that a window closed, so `decidedByUserId` resolves to nothing and\n * that absence is the fact.\n *\n * Permitted from ACTIVE alone. A grant the tenant DENIED or REVOKED is terminal and must keep\n * saying which — relabelling it EXPIRED would rewrite the decision history a customer audit\n * reads, which is the opposite of why this sweep exists.\n */\n makeDecisionFactory(PlatformAccessGrants_Operations.EXPIRE, {\n debugLabel: 'platform-access-grants.expire.internal',\n auditTransition: PlatformAccessGrantLifecycleTransition.EXPIRED,\n nextStatus: PlatformAccessGrantStatus.EXPIRED,\n permittedFrom: [PlatformAccessGrantStatus.ACTIVE],\n stampsApprover: false,\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n }),\n ];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"privileged-access-review.backend.utils.d.ts","sourceRoot":"","sources":["../../../../../src/security/authorizations/privileged-access-review.backend.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEhH,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AACrK,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAGnH,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AAYrK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,iEAAiE;AACjE,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAED,6EAA6E;AAC7E,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAC;CACjD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,+BAA+B,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5D,QAAQ,CAAC,gCAAgC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7D,QAAQ,CAAC,uBAAuB,EAAE,SAAS,iCAAiC,EAAE,CAAC;IAC/E,QAAQ,CAAC,wBAAwB,EAAE,SAAS,kCAAkC,EAAE,CAAC;IACjF;;;;;;;OAOG;IACH,QAAQ,CAAC,yBAAyB,EAAE,SAAS,MAAM,EAAE,CAAC;CACvD;AAUD;;;;;;;;GAQG;AACH,wBAAsB,mCAAmC,CAAC,MAAM,EAAE;IAChE,2BAA2B,EAAE,yCAAyC,CAAC;IACvE,oBAAoB,EAAE,yCAAyC,CAAC;IAChE,YAAY,EAAE,0BAA0B,CAAC;IACzC,uGAAuG;IACvG,+BAA+B,EAAE,SAAS,MAAM,EAAE,CAAC;IACnD,sDAAsD;IACtD,gCAAgC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpD,sFAAsF;IACtF,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAqFtC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2CAA2C,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAElH"}
1
+ {"version":3,"file":"privileged-access-review.backend.utils.d.ts","sourceRoot":"","sources":["../../../../src/security/authorizations/privileged-access-review.backend.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgE,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAEhH,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AACrK,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAGnH,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AAYrK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,iEAAiE;AACjE,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,QAAQ,CAAC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AG,IAAI,GAAG,OAAO,CAElH"}
@@ -1 +1 @@
1
- {"version":3,"file":"relationship-foreign-key-filter.backend.d.ts","sourceRoot":"","sources":["../../../../../src/security/authorizations/relationship-foreign-key-filter.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,2CAA2C;IAC1D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QAC5C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;KAC9B,CAAC,GAAG,IAAI,CAAC;CACX;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wCAAwC;IACvD,yCAAyC,CACvC,UAAU,EAAE,GAAG,EACf,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,GAAG;IACrB;;;;;OAKG;IACH,iBAAiB,EAAE;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACtF,MAAM,EAAE,CAAC;IACZ,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACrD,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2CAA2C,CAAC,OAAO,SAAS,MAAM,EAAE,MAAM,EAAE;IAC1F,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,2CAA2C,CAAC;IACvE,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,wCAAwC,CAAC;CAChE,GAAG,IAAI,CAmCP"}
1
+ {"version":3,"file":"relationship-foreign-key-filter.backend.d.ts","sourceRoot":"","sources":["../../../../src/security/authorizations/relationship-foreign-key-filter.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,2CAA2C;IAC1D,QAAQ,CAAC,oBAAoB,CAAC,EAAE,aAAa,CAAC;QAC5C,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;KAC9B,CAAC,GAAG,IAAI,CAAC;CACX;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wCAAwC;IACvD,yCAAyC,CACvC,UAAU,EAAE,GAAG,EACf,eAAe,EAAE,MAAM,EACvB,gBAAgB,EAAE,GAAG;IACrB;;;;;OAKG;IACH,iBAAiB,EAAE;QAAE,MAAM,EAAE,WAAW,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,GACtF,MAAM,EAAE,CAAC;IACZ,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACrD,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACpE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2CAA2C,CAAC,OAAO,SAAS,MAAM,EAAE,MAAM,EAAE;IAC1F,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,gBAAgB,EAAE,2CAA2C,CAAC;IACvE,QAAQ,CAAC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,wCAAwC,CAAC;CAChE,GAAG,IAAI,CAmCP"}
@@ -28,6 +28,8 @@ export type RoleHierarchyResolver = (role: string, scope: ResourcePrimaryScope)
28
28
  */
29
29
  export declare function createRoleHierarchyResolver(container: Container): RoleHierarchyResolver;
30
30
  /**
31
+ * @wildo_source:part:start saas.backend.authorization.role-ceiling facet:layer:backend facet:audience:app-developer
32
+ *
31
33
  * Role-ceiling gate — a principal may only grant roles it itself holds.
32
34
  *
33
35
  * WHY THIS EXISTS. Several resources carry a caller-settable `roles` array that becomes a principal's
@@ -88,6 +90,8 @@ export declare function createRoleHierarchyResolver(container: Container): RoleH
88
90
  *
89
91
  * assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — prevents a principal from granting authority it
90
92
  * does not itself hold. The denial is an access-control decision.
93
+ *
94
+ * @wildo_source:part:end saas.backend.authorization.role-ceiling
91
95
  */
92
96
  export declare function assertRequestedRolesWithinCallerCeiling(executionContext: ExecutionContext<any>, requestedRoles: readonly string[] | undefined, errorBuilder: ErrorBuilderBackendService, roleHierarchyResolver: RoleHierarchyResolver): void;
93
97
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"role-ceiling.backend.utils.d.ts","sourceRoot":"","sources":["../../../../../src/security/authorizations/role-ceiling.backend.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0F,oBAAoB,EAA8B,MAAM,uBAAuB,CAAC;AAEjL,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AAC5G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAInH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,KAAK,MAAM,EAAE,CAAC;AAE5F;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,GAAG,qBAAqB,CAMvF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AACH,wBAAgB,uCAAuC,CACrD,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,cAAc,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC7C,YAAY,EAAE,0BAA0B,EACxC,qBAAqB,EAAE,qBAAqB,GAC3C,IAAI,CAiDN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI5E"}
1
+ {"version":3,"file":"role-ceiling.backend.utils.d.ts","sourceRoot":"","sources":["../../../../src/security/authorizations/role-ceiling.backend.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0F,oBAAoB,EAA8B,MAAM,uBAAuB,CAAC;AAEjL,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AAC5G,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAInH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,KAAK,MAAM,EAAE,CAAC;AAE5F;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,SAAS,GAAG,qBAAqB,CAMvF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,wBAAgB,uCAAuC,CACrD,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,cAAc,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,EAC7C,YAAY,EAAE,0BAA0B,EACxC,qBAAqB,EAAE,qBAAqB,GAC3C,IAAI,CAiDN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI5E"}
@@ -18,6 +18,8 @@ export function createRoleHierarchyResolver(container) {
18
18
  };
19
19
  }
20
20
  /**
21
+ * @wildo_source:part:start saas.backend.authorization.role-ceiling facet:layer:backend facet:audience:app-developer
22
+ *
21
23
  * Role-ceiling gate — a principal may only grant roles it itself holds.
22
24
  *
23
25
  * WHY THIS EXISTS. Several resources carry a caller-settable `roles` array that becomes a principal's
@@ -78,6 +80,8 @@ export function createRoleHierarchyResolver(container) {
78
80
  *
79
81
  * assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — prevents a principal from granting authority it
80
82
  * does not itself hold. The denial is an access-control decision.
83
+ *
84
+ * @wildo_source:part:end saas.backend.authorization.role-ceiling
81
85
  */
82
86
  export function assertRequestedRolesWithinCallerCeiling(executionContext, requestedRoles, errorBuilder, roleHierarchyResolver) {
83
87
  if (!requestedRoles || requestedRoles.length === 0)
@@ -1 +1 @@
1
- {"version":3,"file":"role-ceiling.backend.utils.js","sourceRoot":"","sources":["../../../../../src/security/authorizations/role-ceiling.backend.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,SAAS,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAMjL,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAiBpF;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAoB;IAC9D,IAAI,qBAA+D,CAAC;IACpE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACrB,qBAAqB,KAAK,SAAS,CAAC,GAAG,CAA+B,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;QAChH,OA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QACH,CAAC;IACH,CAAC;IAED,sGAAsG;IACtG,iDAAiD;IACjD,IAAI,uBAAuB;QAAE,OAAO;IAEpC,MAAM,cAAc,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACxF,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAExC,2GAA2G;IAC3G,sFAAsF;IACtF,MAAM,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,aAAa,EAAE,gBAAgB,EAAE;QACvE,sBAAsB,EAAE,2BAA2B,CAAC,4BAA4B;QAChF,OAAO,EAAE;YACP,MAAM,EAAE,uBAAuB;YAC/B,cAAc;YACd,WAAW,EAAE,CAAC,GAAG,oBAAoB,CAAC;SACvC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mCAAmC,CAAC,KAAc;IAChE,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC3D,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAC;IAChD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import { CORE_APP_ROLES, ErrorCustomMessageReference, ErrorType, ExecutionContext_ExecutionType, ResourcePrimaryScope, isOrganizationWideRoleInfo } from '@wildo-ai/saas-models';\nimport type { Roles } from '@wildo-ai/saas-models';\nimport type { Container } from 'inversify';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport type { AuthorizationsBackendService } from '~wildo-backend-lib/security/authorizations/services/authorizations.backend.service';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\n\n/**\n * Expands one role into the full set of roles it effectively confers, within a given primary scope.\n *\n * This is the `inheritFrom` chain of the runtime role configuration — supply\n * `AuthorizationsBackendService.getRoleHierarchy` bound to its service instance. It is injected\n * rather than imported because the effective hierarchy is APPLICATION-CONFIGURABLE (apps register\n * custom roles at startup via `initializeRolesWithCustom`), so a statically-imported default table\n * would silently disagree with the roles the authorization layer actually enforces.\n *\n * The scope argument matters: `getRoleHierarchy` resolves against the APPLICATION role table or the\n * ORGANIZATIONS one, never both. A role string that is unknown in the passed scope expands to the\n * empty set — which is exactly the fail-closed behaviour this gate wants.\n */\nexport type RoleHierarchyResolver = (role: string, scope: ResourcePrimaryScope) => string[];\n\n/**\n * Bind a {@link RoleHierarchyResolver} to the container's live `AuthorizationsBackendService`.\n *\n * Resolution is LAZY (on first gate evaluation, then memoized) rather than at factory-construction\n * time: custom-implementation factories are built during module registration, which can run before\n * the authorization service is bound, and an eager `container.get` there would turn a role-gate into\n * a startup crash. Holding the service instance is safe across role reconfiguration —\n * `initializeRolesWithCustom` mutates the singleton's tables in place, and the hierarchy is read per\n * call, so a resolver captured at startup still sees roles registered afterwards.\n */\nexport function createRoleHierarchyResolver(container: Container): RoleHierarchyResolver {\n let authorizationsService: AuthorizationsBackendService | undefined;\n return (role, scope) => {\n authorizationsService ??= container.get<AuthorizationsBackendService>(SAAS_SERVICE_TYPES.AuthorizationsService);\n return authorizationsService.getRoleHierarchy(role as Roles, scope);\n };\n}\n\n/**\n * Role-ceiling gate — a principal may only grant roles it itself holds.\n *\n * WHY THIS EXISTS. Several resources carry a caller-settable `roles` array that becomes a principal's\n * live authority. Two families:\n *\n * - **Machine credentials** (`organizationOAuthClients` / `applicationOAuthClients` and their api-key\n * twins): the roles written at CREATE are exactly the roles every token minted for that client/key\n * carries at the request-auth choke point (`oauth-provider-token` → `machine-token-issuer`).\n * - **Organization membership** (`organizationMembers.roles`, and the per-unit roles nested in\n * `organizationUnitsMembership`): a membership row's `roles` array is read verbatim by\n * `execution-context-creator` to build `initiatorRoles` — the member's live authority on their very\n * next request.\n *\n * The operation-authorization layer only checks whether the CALLER may run the write at all — it never\n * compares the *requested* roles against the caller's own. Without this gate an `ORG_ADMIN` (the gate\n * for both member UPDATE and org-client CREATE) could grant `ORG_OWNER` to themselves, or mint a\n * credential carrying `APP_ADMIN_SUPER_ADMIN`. This is the missing \"you cannot grant authority you do\n * not hold\" check.\n *\n * SEMANTICS. Every requested role must lie within the caller's EFFECTIVE authority — the union of the\n * `inheritFrom` hierarchies of the roles the caller actually holds, each expanded within the scope of\n * the membership that granted it. Hierarchy-awareness is not a convenience: with the default table\n * (`ORG_OWNER → ORG_ADMIN → ORG_MANAGER → ORG_MEMBER → ORG_GUEST`) an `ORG_ADMIN`'s membership row\n * holds the literal string `ORG_ADMIN` and nothing else, so a raw set-membership test would reject\n * that admin granting the DEFAULT `ORG_MEMBER` role and break the entire invite flow — while still\n * correctly rejecting a grant of `ORG_OWNER`, which is UPSTREAM of the caller and therefore outside\n * the expansion.\n *\n * Fail-closed: a caller whose roles cannot be resolved is treated as holding none, so any requested\n * role is rejected.\n *\n * TWO DELIBERATE BYPASSES:\n * - **Platform super-admin** — a caller holding `APP_ADMIN_SUPER_ADMIN` *at APPLICATION scope* may\n * assign any role (that role IS the top of the ceiling). This also cleanly covers the cross-tenant\n * `admin` operation variant of the machine-credential resources, which is itself gated by\n * `APP_ADMIN_SUPER_ADMIN` and is meant to provision clients \"for any org\" — so no separate\n * variant-detection is needed. The scope qualifier is load-bearing: `roles` on a membership row is\n * a free-form string (`OrgRolesSchema` admits any `z.string().min(1)`), so without it a tenant\n * admin who wrote the literal text `APP_ADMIN_SUPER_ADMIN` into an ORGANIZATIONS-scoped membership\n * would unlock this bypass. The authorization layer already refuses to honour that string\n * cross-scope (`getRoleHierarchy` partitions the two role tables); this gate must not be the\n * weaker link.\n * - **System / internal writes** — an `INTERNALLY_INITIATED_REQUEST` execution (seeds, provisioning,\n * `createAsSystem`) is the framework itself, not a user principal (it synthesises a super-admin\n * system EC), and carries no human ceiling — it is trusted to assign any role.\n *\n * SCOPE OF THE COMPARISON. The caller's effective roles are unioned across every membership they\n * hold, without checking that the granting membership targets the same organization as the write.\n * That is deliberate and safe HERE because the operation-authorization layer has already confined the\n * write to a scope the caller may act in (`authorizeOrganizations` / the parent-scope filter); this\n * gate answers \"how high\", not \"where\". A future units-aware authorization axis that narrows *within*\n * an organization must revisit that assumption.\n *\n * EXTENDING. Wire this into the CREATE (and any roles-mutating UPDATE) path of ANY resource whose\n * `roles` field is caller-settable, passing the roles AS AUTHORED BY THE CALLER — not the\n * post-resolution set. Framework-injected defaults (e.g. an organization type's `defaultMemberRole`)\n * are policy-derived, not a caller request, and must not be measured against the caller's ceiling.\n *\n * assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — prevents a principal from granting authority it\n * does not itself hold. The denial is an access-control decision.\n */\nexport function assertRequestedRolesWithinCallerCeiling(\n executionContext: ExecutionContext<any>,\n requestedRoles: readonly string[] | undefined,\n errorBuilder: ErrorBuilderBackendService,\n roleHierarchyResolver: RoleHierarchyResolver,\n): void {\n if (!requestedRoles || requestedRoles.length === 0) return;\n\n // System / internal writes (seeds, provisioning, `createAsSystem`) are the framework, not a user\n // principal — they synthesise an INTERNALLY_INITIATED_REQUEST super-admin EC and assign any role.\n if (executionContext.executionType === ExecutionContext_ExecutionType.INTERNALLY_INITIATED_REQUEST) {\n return;\n }\n\n // Expand each held role into everything it confers, WITHIN the scope of the membership that granted\n // it. Cross-scope contamination is impossible by construction: an ORGANIZATIONS-scoped entry is\n // resolved against the org role table only.\n const effectiveCallerRoles = new Set<string>();\n let holdsPlatformSuperAdmin = false;\n // ORGANIZATION-WIDE GRANTS ONLY. A unit-scoped role confers authority inside ONE organization\n // unit; counting it toward the ceiling would let a member who is merely ORG_ADMIN of one team\n // grant ORG_ADMIN across the whole tenant — the exact escalation this gate exists to stop, arriving\n // through the gate itself.\n for (const roleInfo of (executionContext.initiatorRoles ?? []).filter(isOrganizationWideRoleInfo)) {\n const scope = roleInfo.relatedPrimaryScope;\n for (const heldRole of roleInfo.roles) {\n const conferredRoles = roleHierarchyResolver(heldRole, scope);\n for (const conferredRole of conferredRoles) {\n effectiveCallerRoles.add(conferredRole);\n // The platform bypass is APPLICATION-scoped ONLY — see the doc block above.\n if (scope === ResourcePrimaryScope.APPLICATION && conferredRole === CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN) {\n holdsPlatformSuperAdmin = true;\n }\n }\n }\n }\n\n // The platform / cross-tenant super-admin may assign any role (this also covers the `admin` operation\n // variant, which is gated by exactly this role).\n if (holdsPlatformSuperAdmin) return;\n\n const escalatedRoles = requestedRoles.filter((role) => !effectiveCallerRoles.has(role));\n if (escalatedRoles.length === 0) return;\n\n // assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — deny an attempt to grant authority the caller does not\n // itself hold. Fail-closed privilege-escalation prevention on role-conferring writes.\n throw errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.AUTHORIZATIONS_ACCESS_DENIED,\n context: {\n reason: 'role_ceiling_exceeded',\n escalatedRoles,\n callerRoles: [...effectiveCallerRoles],\n },\n });\n}\n\n/**\n * Collect the single authored `role` from an `ORGANIZATION_UNIT_MEMBERS` payload so it faces the\n * same ceiling as an organization-wide role grant.\n *\n * WHY THIS EXISTS. A unit assignment IS a role grant — it is the per-unit twin of\n * `OrganizationMember.roles`. It is not read by any authorization path yet (units become an\n * authorization axis in WS-C), but it is persisted and admin-editable, so an unchecked `ORG_OWNER`\n * written into an assignment is a pre-planted escalation that goes live the moment units are wired\n * into roles resolution. Gating it now removes that step.\n *\n * This replaced an array collector: until D-B5 the per-unit roles rode along inside an embedded\n * `organizationUnitsMembership` array on the members payload, so the gate had to sweep a list. As a\n * junction row there is exactly one role per payload.\n *\n * Defensive by design: this runs on UNPARSED caller input (custom-impl prefixes see the payload\n * before strict DTO validation), so a non-string role yields nothing rather than being trusted —\n * malformed input is rejected by schema validation further down the pipeline, and under-reporting\n * here can only ever deny, never grant.\n */\nexport function collectAuthoredOrganizationUnitRole(input: unknown): string[] {\n if (input === null || typeof input !== 'object') return [];\n const role = (input as { role?: unknown }).role;\n return typeof role === 'string' && role.length > 0 ? [role] : [];\n}\n"]}
1
+ {"version":3,"file":"role-ceiling.backend.utils.js","sourceRoot":"","sources":["../../../../src/security/authorizations/role-ceiling.backend.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,2BAA2B,EAAE,SAAS,EAAE,8BAA8B,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAMjL,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAiBpF;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAoB;IAC9D,IAAI,qBAA+D,CAAC;IACpE,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QACrB,qBAAqB,KAAK,SAAS,CAAC,GAAG,CAA+B,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;QAChH,OAAO,qBAAqB,CAAC,gBAAgB,CAAC,IAAa,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,UAAU,uCAAuC,CACrD,gBAAuC,EACvC,cAA6C,EAC7C,YAAwC,EACxC,qBAA4C;IAE5C,IAAI,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAE3D,iGAAiG;IACjG,kGAAkG;IAClG,IAAI,gBAAgB,CAAC,aAAa,KAAK,8BAA8B,CAAC,4BAA4B,EAAE,CAAC;QACnG,OAAO;IACT,CAAC;IAED,oGAAoG;IACpG,gGAAgG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W,EAAE,CAAC,GAAG,oBAAoB,CAAC;SACvC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,mCAAmC,CAAC,KAAc;IAChE,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC3D,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAC;IAChD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import { CORE_APP_ROLES, ErrorCustomMessageReference, ErrorType, ExecutionContext_ExecutionType, ResourcePrimaryScope, isOrganizationWideRoleInfo } from '@wildo-ai/saas-models';\nimport type { Roles } from '@wildo-ai/saas-models';\nimport type { Container } from 'inversify';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport type { AuthorizationsBackendService } from '~wildo-backend-lib/security/authorizations/services/authorizations.backend.service';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\n\n/**\n * Expands one role into the full set of roles it effectively confers, within a given primary scope.\n *\n * This is the `inheritFrom` chain of the runtime role configuration — supply\n * `AuthorizationsBackendService.getRoleHierarchy` bound to its service instance. It is injected\n * rather than imported because the effective hierarchy is APPLICATION-CONFIGURABLE (apps register\n * custom roles at startup via `initializeRolesWithCustom`), so a statically-imported default table\n * would silently disagree with the roles the authorization layer actually enforces.\n *\n * The scope argument matters: `getRoleHierarchy` resolves against the APPLICATION role table or the\n * ORGANIZATIONS one, never both. A role string that is unknown in the passed scope expands to the\n * empty set — which is exactly the fail-closed behaviour this gate wants.\n */\nexport type RoleHierarchyResolver = (role: string, scope: ResourcePrimaryScope) => string[];\n\n/**\n * Bind a {@link RoleHierarchyResolver} to the container's live `AuthorizationsBackendService`.\n *\n * Resolution is LAZY (on first gate evaluation, then memoized) rather than at factory-construction\n * time: custom-implementation factories are built during module registration, which can run before\n * the authorization service is bound, and an eager `container.get` there would turn a role-gate into\n * a startup crash. Holding the service instance is safe across role reconfiguration —\n * `initializeRolesWithCustom` mutates the singleton's tables in place, and the hierarchy is read per\n * call, so a resolver captured at startup still sees roles registered afterwards.\n */\nexport function createRoleHierarchyResolver(container: Container): RoleHierarchyResolver {\n let authorizationsService: AuthorizationsBackendService | undefined;\n return (role, scope) => {\n authorizationsService ??= container.get<AuthorizationsBackendService>(SAAS_SERVICE_TYPES.AuthorizationsService);\n return authorizationsService.getRoleHierarchy(role as Roles, scope);\n };\n}\n\n/**\n * @wildo_source:part:start saas.backend.authorization.role-ceiling facet:layer:backend facet:audience:app-developer\n *\n * Role-ceiling gate — a principal may only grant roles it itself holds.\n *\n * WHY THIS EXISTS. Several resources carry a caller-settable `roles` array that becomes a principal's\n * live authority. Two families:\n *\n * - **Machine credentials** (`organizationOAuthClients` / `applicationOAuthClients` and their api-key\n * twins): the roles written at CREATE are exactly the roles every token minted for that client/key\n * carries at the request-auth choke point (`oauth-provider-token` → `machine-token-issuer`).\n * - **Organization membership** (`organizationMembers.roles`, and the per-unit roles nested in\n * `organizationUnitsMembership`): a membership row's `roles` array is read verbatim by\n * `execution-context-creator` to build `initiatorRoles` — the member's live authority on their very\n * next request.\n *\n * The operation-authorization layer only checks whether the CALLER may run the write at all — it never\n * compares the *requested* roles against the caller's own. Without this gate an `ORG_ADMIN` (the gate\n * for both member UPDATE and org-client CREATE) could grant `ORG_OWNER` to themselves, or mint a\n * credential carrying `APP_ADMIN_SUPER_ADMIN`. This is the missing \"you cannot grant authority you do\n * not hold\" check.\n *\n * SEMANTICS. Every requested role must lie within the caller's EFFECTIVE authority — the union of the\n * `inheritFrom` hierarchies of the roles the caller actually holds, each expanded within the scope of\n * the membership that granted it. Hierarchy-awareness is not a convenience: with the default table\n * (`ORG_OWNER → ORG_ADMIN → ORG_MANAGER → ORG_MEMBER → ORG_GUEST`) an `ORG_ADMIN`'s membership row\n * holds the literal string `ORG_ADMIN` and nothing else, so a raw set-membership test would reject\n * that admin granting the DEFAULT `ORG_MEMBER` role and break the entire invite flow — while still\n * correctly rejecting a grant of `ORG_OWNER`, which is UPSTREAM of the caller and therefore outside\n * the expansion.\n *\n * Fail-closed: a caller whose roles cannot be resolved is treated as holding none, so any requested\n * role is rejected.\n *\n * TWO DELIBERATE BYPASSES:\n * - **Platform super-admin** — a caller holding `APP_ADMIN_SUPER_ADMIN` *at APPLICATION scope* may\n * assign any role (that role IS the top of the ceiling). This also cleanly covers the cross-tenant\n * `admin` operation variant of the machine-credential resources, which is itself gated by\n * `APP_ADMIN_SUPER_ADMIN` and is meant to provision clients \"for any org\" — so no separate\n * variant-detection is needed. The scope qualifier is load-bearing: `roles` on a membership row is\n * a free-form string (`OrgRolesSchema` admits any `z.string().min(1)`), so without it a tenant\n * admin who wrote the literal text `APP_ADMIN_SUPER_ADMIN` into an ORGANIZATIONS-scoped membership\n * would unlock this bypass. The authorization layer already refuses to honour that string\n * cross-scope (`getRoleHierarchy` partitions the two role tables); this gate must not be the\n * weaker link.\n * - **System / internal writes** — an `INTERNALLY_INITIATED_REQUEST` execution (seeds, provisioning,\n * `createAsSystem`) is the framework itself, not a user principal (it synthesises a super-admin\n * system EC), and carries no human ceiling — it is trusted to assign any role.\n *\n * SCOPE OF THE COMPARISON. The caller's effective roles are unioned across every membership they\n * hold, without checking that the granting membership targets the same organization as the write.\n * That is deliberate and safe HERE because the operation-authorization layer has already confined the\n * write to a scope the caller may act in (`authorizeOrganizations` / the parent-scope filter); this\n * gate answers \"how high\", not \"where\". A future units-aware authorization axis that narrows *within*\n * an organization must revisit that assumption.\n *\n * EXTENDING. Wire this into the CREATE (and any roles-mutating UPDATE) path of ANY resource whose\n * `roles` field is caller-settable, passing the roles AS AUTHORED BY THE CALLER — not the\n * post-resolution set. Framework-injected defaults (e.g. an organization type's `defaultMemberRole`)\n * are policy-derived, not a caller request, and must not be measured against the caller's ceiling.\n *\n * assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — prevents a principal from granting authority it\n * does not itself hold. The denial is an access-control decision.\n *\n * @wildo_source:part:end saas.backend.authorization.role-ceiling\n */\nexport function assertRequestedRolesWithinCallerCeiling(\n executionContext: ExecutionContext<any>,\n requestedRoles: readonly string[] | undefined,\n errorBuilder: ErrorBuilderBackendService,\n roleHierarchyResolver: RoleHierarchyResolver,\n): void {\n if (!requestedRoles || requestedRoles.length === 0) return;\n\n // System / internal writes (seeds, provisioning, `createAsSystem`) are the framework, not a user\n // principal — they synthesise an INTERNALLY_INITIATED_REQUEST super-admin EC and assign any role.\n if (executionContext.executionType === ExecutionContext_ExecutionType.INTERNALLY_INITIATED_REQUEST) {\n return;\n }\n\n // Expand each held role into everything it confers, WITHIN the scope of the membership that granted\n // it. Cross-scope contamination is impossible by construction: an ORGANIZATIONS-scoped entry is\n // resolved against the org role table only.\n const effectiveCallerRoles = new Set<string>();\n let holdsPlatformSuperAdmin = false;\n // ORGANIZATION-WIDE GRANTS ONLY. A unit-scoped role confers authority inside ONE organization\n // unit; counting it toward the ceiling would let a member who is merely ORG_ADMIN of one team\n // grant ORG_ADMIN across the whole tenant — the exact escalation this gate exists to stop, arriving\n // through the gate itself.\n for (const roleInfo of (executionContext.initiatorRoles ?? []).filter(isOrganizationWideRoleInfo)) {\n const scope = roleInfo.relatedPrimaryScope;\n for (const heldRole of roleInfo.roles) {\n const conferredRoles = roleHierarchyResolver(heldRole, scope);\n for (const conferredRole of conferredRoles) {\n effectiveCallerRoles.add(conferredRole);\n // The platform bypass is APPLICATION-scoped ONLY — see the doc block above.\n if (scope === ResourcePrimaryScope.APPLICATION && conferredRole === CORE_APP_ROLES.APP_ADMIN_SUPER_ADMIN) {\n holdsPlatformSuperAdmin = true;\n }\n }\n }\n }\n\n // The platform / cross-tenant super-admin may assign any role (this also covers the `admin` operation\n // variant, which is gated by exactly this role).\n if (holdsPlatformSuperAdmin) return;\n\n const escalatedRoles = requestedRoles.filter((role) => !effectiveCallerRoles.has(role));\n if (escalatedRoles.length === 0) return;\n\n // assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — deny an attempt to grant authority the caller does not\n // itself hold. Fail-closed privilege-escalation prevention on role-conferring writes.\n throw errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.AUTHORIZATIONS_ACCESS_DENIED,\n context: {\n reason: 'role_ceiling_exceeded',\n escalatedRoles,\n callerRoles: [...effectiveCallerRoles],\n },\n });\n}\n\n/**\n * Collect the single authored `role` from an `ORGANIZATION_UNIT_MEMBERS` payload so it faces the\n * same ceiling as an organization-wide role grant.\n *\n * WHY THIS EXISTS. A unit assignment IS a role grant — it is the per-unit twin of\n * `OrganizationMember.roles`. It is not read by any authorization path yet (units become an\n * authorization axis in WS-C), but it is persisted and admin-editable, so an unchecked `ORG_OWNER`\n * written into an assignment is a pre-planted escalation that goes live the moment units are wired\n * into roles resolution. Gating it now removes that step.\n *\n * This replaced an array collector: until D-B5 the per-unit roles rode along inside an embedded\n * `organizationUnitsMembership` array on the members payload, so the gate had to sweep a list. As a\n * junction row there is exactly one role per payload.\n *\n * Defensive by design: this runs on UNPARSED caller input (custom-impl prefixes see the payload\n * before strict DTO validation), so a non-string role yields nothing rather than being trusted —\n * malformed input is rejected by schema validation further down the pipeline, and under-reporting\n * here can only ever deny, never grant.\n */\nexport function collectAuthoredOrganizationUnitRole(input: unknown): string[] {\n if (input === null || typeof input !== 'object') return [];\n const role = (input as { role?: unknown }).role;\n return typeof role === 'string' && role.length > 0 ? [role] : [];\n}\n"]}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * # Role conferral — ONE derivation of "which role keys confer authority X, in scope S"
3
+ *
4
+ * assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — the shared derivation every authority floor
5
+ * measures its protected population with.
6
+ *
7
+ * ## The role-key vocabulary is genuinely OPEN, and closing it would be a defect
8
+ *
9
+ * Recorded here because the opposite is the obvious reading and was proposed as a finding: *"a
10
+ * membership's `roles` field is a free string, so an application-scope role value is storable in an
11
+ * organisation-scoped membership row."* Both halves of that are true. The conclusion — close the
12
+ * vocabulary — is not, and the evidence is in the framework's own contract:
13
+ *
14
+ * - `RolesSchema` is `union([enum(CORE_APP_ROLES), enum(CORE_ORG_ROLES), z.string().min(1)])`, and
15
+ * the third arm is the SUPPORTED feature, not an oversight: an application registers its own role
16
+ * keys at startup through `initializeRolesWithCustom`, and `RolesConfigurationSchema` is a
17
+ * `z.record(z.string(), RoleDefinitionSchema)`. A closed enum would delete custom roles.
18
+ * - So "is this string a valid role key?" has no static answer. It has a RUNTIME answer, per
19
+ * application, per scope — which is exactly what the role tables are.
20
+ *
21
+ * ## What IS closed, and where its one source lives
22
+ *
23
+ * The **scope partition**. Every role key belongs to exactly one `relatedPrimaryScope`, and
24
+ * `AuthorizationsBackendService.getRoleHierarchy(roleKey, scope)` is the single runtime source of
25
+ * that fact: it selects the APPLICATION table or the ORGANIZATIONS table and never consults both. A
26
+ * key unknown in the passed scope expands to the EMPTY chain, which is what makes an app-scope
27
+ * string written into an org-scoped membership row confer nothing — the safety comes from
28
+ * RESOLUTION, not from the field's type, and it must stay that way.
29
+ *
30
+ * ## What was duplicated, and is not any more
31
+ *
32
+ * The derivation BUILT ON that partition. `resolveSuperAdminConferringRoles` and
33
+ * `resolveOrganizationOwnerConferringRoles` were the same eleven lines twice, differing only in
34
+ * (table, scope, anchor) — each carrying its own paragraph re-establishing the partition argument
35
+ * above, in its own words, for its own reader. That is the shape `CLAUDE.md` asks to have one named
36
+ * runtime source for: not the role STRINGS, which cannot be closed, but the QUESTION asked of them.
37
+ *
38
+ * Two floors measure populations with it today ({@link resolveSuperAdminConferringRoles},
39
+ * {@link resolveOrganizationOwnerConferringRoles}); a third scope's floor is one call, not another
40
+ * copy.
41
+ *
42
+ * ## Why this module ships with NO test file of its own
43
+ *
44
+ * A direct suite was written and then DELETED, because measuring it showed every property it
45
+ * asserted was already covered — and its stated rationale was false. It claimed the floor suites
46
+ * "stub `getRoleHierarchy` as a function that IGNORES its scope"; both actually stub
47
+ * `(role, scope) => scope === <their own scope> ? table[role] : []`, and both tables already contain
48
+ * a CUSTOM, non-enum role key (`CUSTOM_PLATFORM_OWNER`, `CUSTOM_TENANT_PRINCIPAL`) reaching the
49
+ * anchor — so the open-vocabulary property is pinned too.
50
+ *
51
+ * Proven rather than assumed: binding the super-admin floor to `ORGANIZATIONS` scope instead of
52
+ * `APPLICATION` — the one regression the extraction newly makes possible — reddens THREE tests in
53
+ * `super-admin-floor.backend.utils.test.ts` on its own. The bindings are the coverage.
54
+ *
55
+ * So do not add a suite here to "cover the new module". If a THIRD binding appears, pin it in its
56
+ * own floor's suite the way these two are; that is where a wrong `scope` argument is observable.
57
+ */
58
+ import type { ResourcePrimaryScope } from '@wildo-ai/saas-models';
59
+ /**
60
+ * Every role key in `declaredRoleKeys` whose `inheritFrom` chain reaches `anchorRole`, within
61
+ * `scope` — i.e. every role whose holder passes a gate that requires `anchorRole`.
62
+ *
63
+ * ## Why the derivation is shaped this way
64
+ *
65
+ * **It mirrors the authorization layer's own test.** `authorize` admits a caller when
66
+ * `getRoleHierarchy(heldRole, scope).includes(requiredRole)`. Deriving the set the same way is what
67
+ * keeps a floor counting exactly the principals the gates would let through; an independently
68
+ * written membership test is how the two drift, and a floor that measures a different population
69
+ * than the gate protects is worse than no floor — it reports a healthy count for an unprotected
70
+ * scope.
71
+ *
72
+ * **The anchor is seeded unconditionally rather than discovered by the walk.** If an application's
73
+ * role table somehow omitted the anchor key, `roleHierarchyResolver` would return an empty chain for
74
+ * every key, the conferring set would be empty, and the floor would then measure a population that
75
+ * is empty BY CONSTRUCTION — refusing every removal forever while protecting nothing.
76
+ *
77
+ * **`scope` is passed to the resolver, never assumed.** That single argument is what carries the
78
+ * closed half of the vocabulary (see this module's header): the caller states which table the keys
79
+ * are to be read against, and a key belonging to the other table expands to nothing. A caller that
80
+ * passed the wrong scope would silently get `[anchorRole]` — the seed — which is the fail-CLOSED
81
+ * direction for a floor (it under-counts the protected population and so refuses more, never less).
82
+ *
83
+ * @param declaredRoleKeys the keys of the LIVE role table for `scope`. Live, because the effective
84
+ * hierarchy is application-configurable and a statically-derived set would silently disagree with
85
+ * the roles the authorization layer actually honours.
86
+ */
87
+ export declare function resolveRolesConferringAnchor(params: {
88
+ readonly anchorRole: string;
89
+ readonly scope: ResourcePrimaryScope;
90
+ readonly declaredRoleKeys: readonly string[];
91
+ readonly roleHierarchyResolver: (roleKey: string, scope: ResourcePrimaryScope) => string[];
92
+ }): string[];
93
+ /**
94
+ * Does holding `heldRoleKey` in `scope` satisfy a gate that requires `requiredRoleKey`?
95
+ *
96
+ * ## The one place the scope partition is consulted
97
+ *
98
+ * This is the ATOM. Everything this module's header argues about the vocabulary lands here: the role
99
+ * key is an open string, the SCOPE partition is what is closed, and the safety comes from RESOLUTION
100
+ * rather than from the field's type — a key unknown in `scope` expands to the EMPTY chain and
101
+ * therefore confers nothing, which is what makes an application-scope string written into an
102
+ * organisation-scoped membership row harmless. Every copy of these two lines is another place that
103
+ * argument can quietly stop being true, and the only way to notice would be a security test nobody
104
+ * wrote.
105
+ *
106
+ * ## Two names for one parameter, deliberately
107
+ *
108
+ * A FLOOR calls the target an ANCHOR — it is measuring the population that reaches an authority. A
109
+ * GATE calls it the REQUIRED ROLE — it is deciding one caller. Same question of the same table, so
110
+ * the parameter is named neutrally here rather than picked from one caller's vocabulary.
111
+ *
112
+ * ## What this does NOT do, and must not grow into
113
+ *
114
+ * It answers about ONE held key. The quantifier belongs to the caller, and the callers genuinely
115
+ * differ: `resolveRolesConferringAnchor` maps it over the declared role TABLE to produce a SET, so a
116
+ * floor can measure a protected population; an admission maps it over the roles the CALLER holds to
117
+ * produce a BOOLEAN. Those are two different questions and collapsing them into one helper that
118
+ * "does both" is the convenience-over-semantics failure `.claude/rules/design-philosophy.md` refuses.
119
+ * The distinction is kept; only the shared atom is named — which is what that rule asks for when it
120
+ * says to add helpers for controlled merging instead of collapsing a distinction.
121
+ *
122
+ * @param heldRoleKey a role key a principal holds, or a key declared in the role table.
123
+ * @param requiredRoleKey the authority being tested for — a floor's anchor, or a gate's required role.
124
+ * @param scope which role table `heldRoleKey` is to be read against. Passing the wrong one resolves
125
+ * to the empty chain and answers `false`, which is the fail-CLOSED direction for both callers.
126
+ */
127
+ export declare function roleConfersAuthority(params: {
128
+ readonly heldRoleKey: string;
129
+ readonly requiredRoleKey: string;
130
+ readonly scope: ResourcePrimaryScope;
131
+ readonly roleHierarchyResolver: (roleKey: string, scope: ResourcePrimaryScope) => string[];
132
+ }): boolean;
133
+ //# sourceMappingURL=role-conferral.backend.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-conferral.backend.utils.d.ts","sourceRoot":"","sources":["../../../../src/security/authorizations/role-conferral.backend.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,QAAQ,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,KAAK,MAAM,EAAE,CAAC;CAC5F,GAAG,MAAM,EAAE,CAeX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,KAAK,MAAM,EAAE,CAAC;CAC5F,GAAG,OAAO,CAEV"}