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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (972) hide show
  1. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  2. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
  3. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  4. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  5. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
  6. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  7. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
  8. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
  9. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
  10. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
  11. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
  12. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
  13. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
  14. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
  15. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
  16. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
  18. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  19. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts +14 -3
  20. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  21. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +138 -24
  22. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  23. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts +3 -1
  24. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  25. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js +8 -3
  26. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  27. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts +11 -0
  28. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  29. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js +11 -2
  30. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js.map +1 -1
  31. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
  32. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
  34. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  35. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
  36. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +48 -4
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +102 -30
  42. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
  44. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
  45. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
  46. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
  47. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
  48. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
  50. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  51. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js +16 -0
  53. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js.map +1 -1
  54. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts +20 -6
  55. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  56. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +96 -32
  57. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  58. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts +3 -1
  59. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  60. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js +32 -7
  61. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js.map +1 -1
  62. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts +8 -5
  63. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  64. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.js.map +1 -1
  65. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +80 -0
  66. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +298 -23
  68. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  69. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts +71 -1
  70. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  71. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +85 -5
  72. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  73. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +21 -0
  74. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  75. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +146 -4
  76. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  77. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
  78. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  79. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  80. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts +3 -26
  81. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  82. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js +3 -68
  83. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js.map +1 -1
  84. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  85. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
  86. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  87. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
  88. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  89. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
  90. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  91. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
  92. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  93. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +533 -43
  94. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  95. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
  96. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  97. package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
  98. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  99. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
  100. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
  101. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
  102. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
  103. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
  104. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
  105. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
  106. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
  107. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
  108. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
  109. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
  110. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
  111. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
  112. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
  113. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
  114. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
  115. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
  116. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  117. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
  118. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  119. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
  120. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  121. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
  122. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  123. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
  124. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
  125. package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
  126. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
  127. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
  128. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  129. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
  130. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  131. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  132. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +54 -13
  133. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  134. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
  135. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  136. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
  137. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  138. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
  139. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  140. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
  141. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  142. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
  143. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  144. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
  145. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  146. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  147. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
  148. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  149. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
  150. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  151. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
  152. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  153. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
  154. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
  155. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
  156. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
  157. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
  158. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  159. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
  160. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  161. package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
  162. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  163. package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
  164. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  165. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
  166. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  167. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +263 -13
  168. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  169. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +376 -58
  170. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  171. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +264 -7
  172. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  173. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +414 -5
  174. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  175. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  176. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
  177. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  178. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +16 -0
  179. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -0
  180. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +140 -0
  181. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -0
  182. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
  183. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  184. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +65 -6
  185. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  186. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
  187. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
  188. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
  189. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
  190. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  191. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +45 -0
  192. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  193. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
  194. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  195. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
  196. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  197. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  198. package/dist/esm/config/custom/application-config-controller.backend.service.js +7 -1
  199. package/dist/esm/config/custom/application-config-controller.backend.service.js.map +1 -1
  200. package/dist/esm/config/models/app-config.backend.schemas.d.ts +146 -46
  201. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  202. package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
  203. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  204. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
  205. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  206. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
  207. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  208. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
  209. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  210. package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
  211. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  212. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  213. package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
  214. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  215. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +43 -1
  216. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  217. package/dist/esm/config/services/app-configuration.backend.utils.js +52 -3
  218. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  219. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
  220. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  221. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
  222. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  223. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts +2 -2
  224. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js +2 -2
  225. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js.map +1 -1
  226. package/dist/esm/databases/models/filter.backend.schemas.js +2 -2
  227. package/dist/esm/databases/models/filter.backend.schemas.js.map +1 -1
  228. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  229. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js +20 -1
  230. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js.map +1 -1
  231. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  232. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
  233. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  234. package/dist/esm/databases/services/redis.service.d.ts +27 -0
  235. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  236. package/dist/esm/databases/services/redis.service.js +29 -0
  237. package/dist/esm/databases/services/redis.service.js.map +1 -1
  238. package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
  239. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  240. package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
  241. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  242. package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
  243. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  244. package/dist/esm/errors/services/error-handler.backend.service.js +134 -8
  245. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  246. package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
  247. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  248. package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
  249. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  250. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
  251. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  252. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
  253. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  254. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
  255. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  256. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
  257. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  258. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts +41 -0
  259. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -0
  260. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js +40 -0
  261. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js.map +1 -0
  262. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts +64 -0
  263. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -0
  264. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js +193 -0
  265. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js.map +1 -0
  266. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +72 -4
  267. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  268. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +60 -19
  269. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  270. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  271. package/dist/esm/external-data/external-data-transform.backend.js +7 -1
  272. package/dist/esm/external-data/external-data-transform.backend.js.map +1 -1
  273. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts +2 -0
  274. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  275. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js +13 -0
  276. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js.map +1 -1
  277. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
  278. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  279. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  280. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
  281. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
  282. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
  283. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
  284. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
  285. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
  286. package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
  287. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
  288. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
  289. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
  290. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
  291. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
  292. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
  293. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
  294. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
  295. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
  296. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
  297. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  298. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
  299. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  300. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
  301. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
  302. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
  303. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
  304. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
  305. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  306. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
  307. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  308. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  309. package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
  310. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  311. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  312. package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
  313. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  314. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +306 -7
  315. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  316. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +539 -45
  317. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  318. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  319. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
  320. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  321. package/dist/esm/files/controllers/file.controller.d.ts +24 -1
  322. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  323. package/dist/esm/files/controllers/file.controller.js +83 -11
  324. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  325. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts +17 -0
  326. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -0
  327. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js +1 -0
  328. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -0
  329. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +5 -1
  330. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  331. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +76 -13
  332. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  333. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts +18 -0
  334. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  335. package/dist/esm/files/services/file-operation-handler.backend.service.js +36 -28
  336. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  337. package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
  338. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  339. package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
  340. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  341. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
  342. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  343. package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
  344. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  345. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +214 -0
  346. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -0
  347. package/dist/esm/files/services/file-upload-grant.backend.service.js +566 -0
  348. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -0
  349. package/dist/esm/files/services/files.backend.service.d.ts +87 -0
  350. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  351. package/dist/esm/files/services/files.backend.service.js +252 -19
  352. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  353. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
  354. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
  355. package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
  356. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
  357. package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
  358. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  359. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  360. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
  361. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  362. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
  363. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  364. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  365. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
  366. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  367. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  368. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
  369. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  370. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  371. package/dist/esm/files/utils/file-uploader.utils.js +12 -0
  372. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  373. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
  374. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
  375. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
  376. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
  377. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
  378. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  379. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
  380. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  381. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  382. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
  383. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  384. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
  385. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  386. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
  387. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  388. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
  389. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  390. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +200 -44
  391. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  392. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
  393. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  394. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
  395. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  396. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
  397. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  398. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
  399. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  400. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
  401. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  402. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  403. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
  404. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  405. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
  406. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  407. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
  408. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  409. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
  410. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  411. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
  412. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  413. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  414. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
  415. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  416. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
  417. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  418. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  419. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
  420. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  421. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
  422. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
  423. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
  424. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
  425. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  426. package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
  427. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  428. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +107 -1
  429. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  430. package/dist/esm/flows-actors/services/agents.backend.service.js +519 -56
  431. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  432. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
  433. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  434. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
  435. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  436. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
  437. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  438. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
  439. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  440. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  441. package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
  442. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  443. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  444. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
  445. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  446. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
  447. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
  448. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
  449. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
  450. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
  451. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  452. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
  453. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  454. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +151 -41
  455. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  456. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +308 -143
  457. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  458. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
  459. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  460. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
  461. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  462. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  463. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  464. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
  465. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  466. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
  467. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  468. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
  469. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
  470. package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
  471. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
  472. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
  473. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  474. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
  475. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  476. package/dist/esm/index.d.ts +15 -5
  477. package/dist/esm/index.d.ts.map +1 -1
  478. package/dist/esm/index.js +45 -5
  479. package/dist/esm/index.js.map +1 -1
  480. package/dist/esm/inject/models/container.d.ts.map +1 -1
  481. package/dist/esm/inject/models/container.js +82 -10
  482. package/dist/esm/inject/models/container.js.map +1 -1
  483. package/dist/esm/inject/models/service-types.d.ts +20 -3
  484. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  485. package/dist/esm/inject/models/service-types.js +21 -3
  486. package/dist/esm/inject/models/service-types.js.map +1 -1
  487. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  488. package/dist/esm/mcp/controllers/mcp.controller.js +32 -4
  489. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  490. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts +34 -0
  491. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  492. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js +42 -0
  493. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  494. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +84 -1
  495. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  496. package/dist/esm/mcp/services/mcp-server.backend.service.js +235 -11
  497. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  498. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts +64 -2
  499. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  500. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +152 -6
  501. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  502. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  503. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
  504. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  505. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
  506. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
  507. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
  508. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
  509. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
  510. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  511. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
  512. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  513. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
  514. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  515. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  516. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
  517. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  518. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
  519. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  520. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  521. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  522. package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
  523. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  524. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
  525. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
  526. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
  527. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
  528. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
  529. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
  530. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
  531. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
  532. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
  533. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  534. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  535. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
  536. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  537. package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
  538. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  539. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
  540. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
  541. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
  542. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
  543. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
  544. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
  545. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
  546. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
  547. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
  548. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
  549. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
  550. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
  551. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
  552. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  553. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
  554. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  555. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
  556. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
  557. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
  558. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
  559. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  560. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
  561. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  562. package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
  563. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  564. package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
  565. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  566. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
  567. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  568. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  569. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
  570. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  571. package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
  572. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  573. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +108 -13
  574. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  575. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +432 -101
  576. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  577. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
  578. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  579. package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
  580. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  581. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
  582. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  583. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
  584. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  585. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
  586. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  587. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +54 -7
  588. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  589. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts +5 -5
  590. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  591. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js +14 -13
  592. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js.map +1 -1
  593. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts +2 -1
  594. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  595. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +18 -8
  596. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  597. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  598. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +20 -18
  599. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  600. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
  601. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  602. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
  603. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  604. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
  605. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
  606. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  607. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  608. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
  609. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  610. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  611. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js +4 -1
  612. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js.map +1 -1
  613. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
  614. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
  615. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
  616. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
  617. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
  618. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
  619. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
  620. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
  621. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
  622. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
  623. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
  624. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
  625. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
  626. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
  627. package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
  628. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
  629. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
  630. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  631. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
  632. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  633. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
  634. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  635. package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
  636. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  637. package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
  638. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  639. package/dist/esm/queue/job-consumer.backend.service.js +1 -4
  640. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  641. package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
  642. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  643. package/dist/esm/queue/job-executor.backend.service.js +1 -4
  644. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  645. package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
  646. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  647. package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
  648. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  649. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
  650. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  651. package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
  652. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  653. package/dist/esm/queue/queue.backend.service.d.ts +3 -3
  654. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  655. package/dist/esm/queue/queue.backend.service.js +26 -4
  656. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  657. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
  658. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  659. package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
  660. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  661. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
  662. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  663. package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
  664. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  665. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
  666. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  667. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
  668. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  669. package/dist/esm/requests/service/websocket.service.d.ts +9 -0
  670. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  671. package/dist/esm/requests/service/websocket.service.js +88 -15
  672. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  673. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  674. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +16 -2
  675. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  676. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  677. package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
  678. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  679. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  680. package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
  681. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  682. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
  683. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  684. package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
  685. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  686. package/dist/esm/resources/services/resource-id.backend.service.js +3 -3
  687. package/dist/esm/resources/services/resource-id.backend.service.js.map +1 -1
  688. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
  689. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  690. package/dist/esm/resources/services/resources-registry.backend.service.js +91 -7
  691. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  692. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
  693. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  694. package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
  695. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  696. package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
  697. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  698. package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
  699. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  700. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  701. package/dist/esm/runtime/services/execution-context-creator.backend.service.js +13 -7
  702. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  703. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
  704. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  705. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  706. package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
  707. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  708. package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
  709. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  710. package/dist/esm/runtime/services/start-application.backend.service.d.ts +47 -1
  711. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  712. package/dist/esm/runtime/services/start-application.backend.service.js +343 -77
  713. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  714. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
  715. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  716. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
  717. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  718. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
  719. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  720. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
  721. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  722. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  723. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
  724. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  725. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
  726. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  727. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
  728. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  729. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
  730. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  731. package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
  732. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  733. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts +3 -23
  734. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  735. package/dist/esm/security/authentications/models/jwt.backend.schemas.js +20 -45
  736. package/dist/esm/security/authentications/models/jwt.backend.schemas.js.map +1 -1
  737. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  738. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  739. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  740. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
  741. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  742. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
  743. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  744. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
  745. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  746. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
  747. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  748. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
  749. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  750. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
  751. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  752. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
  753. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  754. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
  755. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  756. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
  757. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  758. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
  759. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  760. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts +9 -1
  761. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  762. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +77 -2
  763. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  764. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  765. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js +5 -3
  766. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js.map +1 -1
  767. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
  768. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  769. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
  770. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  771. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  772. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
  773. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  774. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  775. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
  776. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  777. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
  778. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  779. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
  780. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  781. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +41 -1
  782. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  783. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +87 -4
  784. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  785. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
  786. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  787. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
  788. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  789. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
  790. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  791. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
  792. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  793. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  794. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
  795. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  796. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
  797. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
  798. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
  799. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
  800. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
  801. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  802. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
  803. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  804. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
  805. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  806. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
  807. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  808. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
  809. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  810. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
  811. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  812. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  813. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
  814. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  815. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  816. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
  817. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  818. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
  819. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  820. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
  821. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  822. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
  823. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  824. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
  825. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  826. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
  827. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
  828. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
  829. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
  830. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  831. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js +24 -1
  832. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js.map +1 -1
  833. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
  834. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  835. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
  836. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  837. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  838. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
  839. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  840. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts +117 -0
  841. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -0
  842. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js +104 -0
  843. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js.map +1 -0
  844. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
  845. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  846. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
  847. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  848. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
  849. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
  850. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
  851. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
  852. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
  853. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  854. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
  855. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  856. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +175 -14
  857. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  858. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +385 -49
  859. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  860. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
  861. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  862. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
  863. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  864. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
  865. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
  866. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
  867. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
  868. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
  869. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
  870. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
  871. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
  872. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
  873. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
  874. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
  875. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
  876. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
  877. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
  878. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
  879. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
  880. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
  881. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
  882. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
  883. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
  884. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
  885. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  886. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
  887. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
  888. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
  889. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
  890. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
  891. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
  892. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
  893. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
  894. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
  895. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
  896. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
  897. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
  898. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
  899. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
  900. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
  901. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
  902. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
  903. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
  904. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
  905. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  906. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
  907. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
  908. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
  909. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
  910. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
  911. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
  912. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
  913. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
  914. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
  915. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
  916. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
  917. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
  918. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
  919. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
  920. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts +18 -1
  921. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  922. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js +110 -74
  923. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js.map +1 -1
  924. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts +22 -0
  925. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -0
  926. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js +22 -0
  927. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js.map +1 -0
  928. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts +17 -3
  929. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  930. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js +12 -0
  931. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js.map +1 -1
  932. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +41 -3
  933. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  934. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +83 -20
  935. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  936. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
  937. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  938. package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
  939. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  940. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  941. package/dist/esm/security/jwt/services/jwt.backend.service.js +1 -18
  942. package/dist/esm/security/jwt/services/jwt.backend.service.js.map +1 -1
  943. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
  944. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  945. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
  946. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  947. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
  948. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  949. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
  950. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  951. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  952. package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
  953. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  954. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
  955. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  956. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
  957. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  958. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
  959. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  960. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
  961. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  962. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
  963. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
  964. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
  965. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
  966. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
  967. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
  968. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
  969. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
  970. package/dist/tsconfig.build.tsbuildinfo +1 -1
  971. package/package.json +17 -9
  972. package/dist/esm/.builder.pid +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-tool-adapter.backend.service.js","sourceRoot":"","sources":["../../../../../src/mcp/services/mcp-tool-adapter.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAIL,oBAAoB,EACpB,iCAAiC,EACjC,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,sCAAsC,GACvC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA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CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACK,gBAAgB,CAAC,mBAA2B,EAAE,SAAqC;QACzF,MAAM,YAAY,GAAG,yBAAyB,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACxE,MAAM,eAAe,GAAG,mBAAmB,KAAK,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC;eAC/E,uBAAuB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC5C,OAAO;YACL,YAAY;YACZ,eAAe;YACf,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,gCAAgC,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACtG,aAAa,EAAE,KAAK;SACrB,CAAC;IACJ,CAAC;CACF,CAAA;AA5gBY,4BAA4B;IADxC,UAAU,EAAE;IAKR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;+CACb,+BAA+B;GAN5D,4BAA4B,CA4gBxC","sourcesContent":["import { injectable, inject } from 'inversify';\nimport { z } from 'zod';\nimport {\n ResourceType,\n AnyResourceConfiguration,\n ResourceConfiguration_Operation,\n ResourcePrimaryScope,\n PRIMARY_SCOPE_TO_FIELD_IDENTIFIER,\n ResourceOperationRiskLevel,\n CoreResourceOperation,\n isDefaultUrlBearingOperation,\n createResourceSearchQueryRequestSchema,\n} from '@wildo-ai/saas-models';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { convertZodSchemaToMcpInputSchema, isMcpValueWrappedRequestDto } from '~wildo-backend-lib/mcp/utils/zod-to-mcp-json-schema.backend.utils';\nimport {\n McpToolDescriptor,\n McpToolAnnotations,\n McpToolAdapterBuildOptions,\n McpToolDescriptionProvider,\n MCP_TOOL_NAME_SEPARATOR,\n MCP_TOOL_NAME_MAX_LENGTH,\n isSpecConformantMcpToolName,\n} from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\n\n/**\n * Resource primary scopes a **machine principal** can reach — ORG / APP only. Verified against the\n * authorizer (`authorizations.backend.service.ts`): `authorizeUserSelf` requires\n * `initiatorIds.userId` and `validateFKRelationshipAccess` throws for any non-`USER_REQUEST`\n * execution type on a user-FK path. A machine principal (api-key OR OAuth client) carries no\n * `userId`, so `USER_SELF` (and `ANONYMOUS`) resources are unreachable by it and MUST NOT be\n * advertised to it — doing so would surface tools that always 403. This is the MACHINE catalog, and\n * ONLY the machine's: an anonymous caller borrowed it until 2026-08-11, which advertised twelve\n * role-gated tools to a principal holding no roles. See {@link ANONYMOUS_REACHABLE_SCOPES}.\n */\nconst MACHINE_REACHABLE_SCOPES: ReadonlySet<ResourcePrimaryScope> = new Set([\n ResourcePrimaryScope.ORGANIZATIONS,\n ResourcePrimaryScope.APPLICATION,\n]);\n\n/**\n * Resource primary scopes a **user-delegated principal** (an `authorization_code` token that carries\n * a `userId`) can reach — ORG / APP PLUS `USER_SELF`. The authorizer's `authorizeUserSelf` succeeds\n * for such a principal (it supplies `initiatorIds.userId`), so a delegated user's own USER_SELF\n * operations are legitimately callable and may be advertised to them. `ANONYMOUS` stays excluded — it\n * is the pre-auth anonymous surface, not a delegated one.\n */\nconst USER_DELEGATED_REACHABLE_SCOPES: ReadonlySet<ResourcePrimaryScope> = new Set([\n ResourcePrimaryScope.ORGANIZATIONS,\n ResourcePrimaryScope.APPLICATION,\n ResourcePrimaryScope.USER_SELF,\n]);\n\n/**\n * Scopes reachable by a caller that presented NO credentials.\n *\n * EMPTY, and empty is the honest answer rather than a placeholder. Two facts decide it:\n *\n * 1. `tools/call` requires a Bearer unconditionally — there is no anonymous dispatch path on this\n * plane at all. So no tool, of any scope, is invocable without credentials.\n * 2. `ResourcePrimaryScope.ANONYMOUS` — the framework's genuine pre-auth surface — is therefore not\n * servable over MCP either, and must NOT be advertised even if an application declares\n * `mcp: { exposed: true }` on such a resource. Advertising a tool that cannot be called is the\n * exact defect this set exists to end.\n *\n * Until 2026-08-11 an anonymous caller was classified as a MACHINE principal and handed the ORG/APP\n * catalogue — twelve tools it could not invoke, because those operations are role-gated and it holds\n * no roles. That was not a partial truth, it was a lie with a consequence: the client saw a working\n * server, was never challenged, and so never began authorization. A real client (Cursor) reported\n * \"successfully authenticated\" without ever opening a browser, because clicking Authenticate merely\n * reconnects — and `initialize` + `tools/list` both answered 200.\n *\n * When an anonymous dispatch path exists, this becomes `{ ANONYMOUS }` and the catalogue stops being\n * empty for apps that expose such tools. That is the ONLY change required here; the classification,\n * the challenge rule and the call gate are already shaped for it.\n */\nconst ANONYMOUS_REACHABLE_SCOPES: ReadonlySet<ResourcePrimaryScope> = new Set();\n\n/**\n * Who is asking. Three principals, because there are three genuinely different answers — and the\n * defect above came from encoding it as a boolean, which forced \"anonymous\" to borrow the machine\n * answer for want of a third value.\n */\nexport enum McpCallerPrincipal {\n /** No credentials presented. */\n ANONYMOUS = 'anonymous',\n /** A `client_credentials` token — acts as ITSELF, carries no `userId`. */\n MACHINE = 'machine',\n /** An `authorization_code` token — acts FOR a consenting user, carries a `userId`. */\n USER_DELEGATED = 'user_delegated',\n}\n\n/**\n * The MCP tool scopes reachable by the caller (progressive principal-awareness). Both the\n * `tools/list` catalog and the `callTool` exposability gate derive their scope set from THIS single\n * source, so advertise ≡ callable per principal — no tool an agent sees is un-callable by it, and\n * none it can call is hidden. That invariant was CLAIMED here before 2026-08-11 and was false for the\n * anonymous caller; it is true now.\n */\n/**\n * Classify a caller that has ALREADY authenticated.\n *\n * `tools/call` and the `callTool` exposability gate both run after `authenticateExternalToken`\n * succeeded, so ANONYMOUS is unreachable there by construction — the only question left is whether\n * the token carries a `userId`. Named rather than inlined so those sites cannot accidentally pass a\n * boolean into the three-valued resolver and silently mean \"machine\" when they mean \"anonymous\",\n * which is the shape of the defect this whole model replaced.\n */\nexport function mcpPrincipalForAuthenticatedCaller(isUserDelegated: boolean): McpCallerPrincipal {\n return isUserDelegated ? McpCallerPrincipal.USER_DELEGATED : McpCallerPrincipal.MACHINE;\n}\n\nexport function mcpReachableScopesForPrincipal(principal: McpCallerPrincipal): ReadonlySet<ResourcePrimaryScope> {\n switch (principal) {\n case McpCallerPrincipal.USER_DELEGATED:\n return USER_DELEGATED_REACHABLE_SCOPES;\n case McpCallerPrincipal.MACHINE:\n return MACHINE_REACHABLE_SCOPES;\n case McpCallerPrincipal.ANONYMOUS:\n return ANONYMOUS_REACHABLE_SCOPES;\n }\n}\n\n/**\n * The operation a tool REALLY performs — a custom operation declares what it behaves like via\n * `resourceOperationLike`, and every decision keyed on operation identity must ask this, not the\n * raw identifier.\n *\n * Lives here, and is exported, because three surfaces now need the same answer: the catalogue\n * (which input envelope to ADVERTISE), the input normalisation, and the output pagination wrapper.\n * `McpServerBackendService` derived it privately and its own comment records why that mattered —\n * when two of those surfaces answered separately, a custom LIST-like operation that only one of\n * them recognised was normalised as a collection on the way in and dispatched without pagination on\n * the way out. A third private copy in the adapter would have reopened exactly that.\n */\nexport function resolveEffectiveMcpOperation(operation: { resourceOperationLike?: unknown; operationIdentifier: unknown }): string {\n return String(operation.resourceOperationLike ?? operation.operationIdentifier);\n}\n\n/**\n * Collection-shaped queries — the operations that take the `{ filters, pagination, sorting }`\n * argument envelope. Exported for the same reason as {@link resolveEffectiveMcpOperation}: the\n * catalogue and the dispatch must agree on the set, or one advertises an envelope the other refuses\n * (or, as shipped until now, refuses an envelope the other accepts).\n *\n * `COUNT` belongs here even though it returns a scalar: it FILTERS like a collection. The output\n * side is deliberately a different set (see `isPaginationWrappedOperation`), and conflating the two\n * would ask the repository to wrap a scalar in a pagination envelope its response DTO never declares.\n */\nexport function isCollectionQueryMcpOperation(effectiveOperation: string): boolean {\n return effectiveOperation === CoreResourceOperation.LIST\n || effectiveOperation === CoreResourceOperation.SEARCH\n || effectiveOperation === CoreResourceOperation.COUNT;\n}\n\n/** Core operations that only read — surfaced as `annotations.readOnlyHint`. */\nconst READ_ONLY_CORE_OPERATIONS: ReadonlySet<string> = new Set<string>([\n CoreResourceOperation.READ,\n CoreResourceOperation.LIST,\n CoreResourceOperation.SEARCH,\n CoreResourceOperation.COUNT,\n]);\n\n/**\n * Write operations where repeating the call with the same arguments changes nothing further.\n *\n * UPDATE settles the row to the same value; DELETE removes an already-removed row and reports\n * not-found. CREATE is deliberately ABSENT — calling it twice makes two rows, which is exactly the\n * case an agent retrying after a timeout needs to know about.\n * spec-cite: MCP schema — `ToolAnnotations.idempotentHint`\n */\nconst IDEMPOTENT_WRITE_CORE_OPERATIONS: ReadonlySet<string> = new Set<string>([\n CoreResourceOperation.UPDATE,\n CoreResourceOperation.DELETE,\n]);\n\n/** Risk levels that flag a tool as destructive. */\nconst DESTRUCTIVE_RISK_LEVELS: ReadonlySet<ResourceOperationRiskLevel> = new Set([\n ResourceOperationRiskLevel.HIGH,\n ResourceOperationRiskLevel.CRITICAL,\n]);\n\n/**\n * Adapts registered resource operations into MCP tool descriptors.\n *\n * # What it exposes\n *\n * For each in-scope resource, it enumerates the DEFAULT, non-bulk, URL-bearing\n * operations (`API_CALL` / `API_CALL_WITH_CALLBACK` — the only variants carrying an\n * HTTP surface, selected via `isDefaultUrlBearingOperation`) that OPT IN via\n * `operation.mcp.exposed === true` (D4 — fail-closed) and builds a tool\n * descriptor `{ name, description, inputSchema, annotations }` where:\n * - `name` = `<resourceIdentifier>__<operationIdentifier>`,\n * - `inputSchema` = the operation `requestDto` converted to JSON Schema, PLUS the\n * resource's own id (a required string) for instance-scoped operations whose URL\n * binds it — see {@link McpToolAdapterBackendService.withInstanceIdParameter}\n * (kept symmetric with the transport's `extractResourceId`),\n * - `description` = spec `purpose`/`whenToUse` (injected — see below) or a\n * synthesized fallback,\n * - `annotations` = read-only / destructive hints from the op identifier + `riskLevel`.\n *\n * # Scope constraint (verified, principal-aware)\n *\n * Exposability is filtered by the CALLER's reachable scopes (progressive principal-awareness). A\n * MACHINE principal reaches ORGANIZATION / APPLICATION only (a machine carries no `userId`, so\n * `USER_SELF` always 403s); an ANONYMOUS caller reaches nothing at all. A USER-DELEGATED principal\n * (`authorization_code`, carries a `userId`) additionally reaches `USER_SELF`, including its collection\n * reads — the socket path scopes those to the caller by seeding the authenticated `userId` into the\n * context map (`buildContextFromSocketAuth`). See {@link mcpReachableScopesForPrincipal}; `ANONYMOUS`\n * is never exposed.\n *\n * # Description sourcing\n *\n * Priority: (1) the authored `operation.mcp.description` (D4 config-local field — the\n * agent-facing description the app author wrote for this tool); else (2) a caller-injected\n * {@link McpToolDescriptionProvider} sourcing the spec `purpose`/`whenToUse` (the backend\n * cannot import `saas-specifications` without inverting the layer graph); else (3) a\n * synthesized fallback from config metadata.\n */\n@injectable()\nexport class McpToolAdapterBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) protected readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n protected readonly resourcesRegistry: ResourcesRegistryBackendService,\n ) {\n this.logDebug = this.logger.debugByType('McpToolAdapterBackendService');\n this.logger.setDebugTypeLogging('McpToolAdapterBackendService', false);\n }\n\n /**\n * Build the MCP tool descriptor set for the requested resources, filtered to the caller's reachable\n * scopes (`options.reachableScopes`, default = machine-reachable ORG/APP). A user-delegated caller\n * passes the delegated set so their USER_SELF tools are advertised too. Tools are returned in\n * deterministic order (resource type, then operation identifier) so `tools/list` output is stable.\n */\n public buildToolDescriptors(options: McpToolAdapterBuildOptions = {}): McpToolDescriptor[] {\n const resourceTypes = options.resourceTypes ?? this.resourcesRegistry.getResourceTypes();\n const reachableScopes = options.reachableScopes ?? MACHINE_REACHABLE_SCOPES;\n const descriptors: McpToolDescriptor[] = [];\n\n for (const resourceType of [...resourceTypes].sort()) {\n const config = this.resourcesRegistry.tryGetResourceConfiguration(resourceType);\n if (!config) {\n this.logDebug('Skipping unregistered resource type requested for MCP exposure', { resourceType });\n continue;\n }\n if (!this.isResourceExposable(config, reachableScopes)) continue;\n // Tool-name round-trip invariant: a tool name is `<resourceIdentifier>__<operationIdentifier>`\n // and `McpServerBackendService.parseToolName` splits on the FIRST separator, so a resource\n // identifier that itself contains `__` would mis-parse into a non-existent resource/operation\n // and produce an un-callable tool. Skip such a resource (fail-closed) and surface the\n // misconfiguration rather than emit a broken descriptor.\n if (String(config.resourceIdentifier).includes(MCP_TOOL_NAME_SEPARATOR)) {\n this.logger.warn('Skipping MCP exposure for a resource whose identifier contains the tool-name separator', {\n resourceIdentifier: config.resourceIdentifier,\n separator: MCP_TOOL_NAME_SEPARATOR,\n });\n continue;\n }\n\n const operationDescriptors = this.buildResourceToolDescriptors(config, options.descriptionProvider, options.instanceRef);\n descriptors.push(...operationDescriptors);\n }\n\n return descriptors;\n }\n\n /**\n * Resolve the single exposable operation for a `resourceType` +\n * `operationIdentifier`, or `undefined` if it is not exposable. This is the\n * SINGLE source of exposability truth — {@link McpServerBackendService.callTool}\n * calls it (with the caller's reachable scopes) before authorizing so a crafted tool name can never\n * reach a scope the caller cannot use (e.g. a machine principal hitting a USER_SELF operation).\n * Applies the exact same filter as {@link buildToolDescriptors}: reachable scope + default, non-bulk,\n * URL-bearing variant, opted in, not an acknowledged gap, on this instance, and a conformant name.\n * `reachableScopes` defaults to machine-reachable (ORG/APP); a user-delegated caller passes the\n * delegated set so a USER_SELF operation resolves for THEM.\n *\n * \"the exact same filter\" is load-bearing, and it was FALSE until 2026-08-13: this method omitted\n * {@link isAcknowledgedUnimplemented}, so an operation withdrawn from the catalogue for provably\n * not working stayed invocable by name. That is the harm that guard exists to prevent (an agent\n * that cannot tell \"not implemented\" from \"bad arguments\" retries forever), arriving through the\n * one door the guard did not cover — and every pin on it was green throughout, because all of them\n * interrogate the advertise side. Any clause added to one of these two lists belongs in the other\n * in the same edit.\n */\n public resolveExposableOperation(\n resourceType: ResourceType,\n operationIdentifier: string,\n reachableScopes: ReadonlySet<ResourcePrimaryScope> = MACHINE_REACHABLE_SCOPES,\n instanceRef?: string,\n ): ResourceConfiguration_Operation<any, any, any> | undefined {\n const config = this.resourcesRegistry.tryGetResourceConfiguration(resourceType);\n if (!config || !this.isResourceExposable(config, reachableScopes)) return undefined;\n // SEP-986 naming, checked on the SAME composed name the catalogue would advertise. A name the\n // catalogue refuses to publish must not remain callable by a client that guessed it, or the\n // withdrawal is cosmetic.\n if (!isSpecConformantMcpToolName(this.buildToolName(config.resourceIdentifier, operationIdentifier))) return undefined;\n return config.operations.find(\n (operation) =>\n String(operation.operationIdentifier) === operationIdentifier\n && isDefaultUrlBearingOperation(operation, String(operation.operationIdentifier))\n && this.isMcpExposed(operation)\n && !this.isAcknowledgedUnimplemented(operation)\n // R-2: the tool must belong to the server instance it is being called on — so a tool curated\n // onto `support` cannot be invoked at `/mcp` (or at `ops`) even by name. Keeps\n // advertise ≡ callable per (principal, instance).\n && this.isOnMcpServerInstance(operation, instanceRef),\n );\n }\n\n /**\n * A resource is exposable only if its primary scope is in the caller's reachable set. The default\n * (machine) set is ORG / APP — USER_SELF and ANONYMOUS excluded fail-closed; a user-delegated caller\n * passes a set that also includes USER_SELF (see {@link mcpReachableScopesForPrincipal}).\n */\n private isResourceExposable(config: AnyResourceConfiguration, reachableScopes: ReadonlySet<ResourcePrimaryScope>): boolean {\n return reachableScopes.has(config.resourcePrimaryScope);\n }\n\n /**\n * Remove the resource's PRIMARY-SCOPE field from an advertised tool schema.\n *\n * A tool schema is derived from the operation's `requestDto`, and a search or list DTO commonly\n * declares its own scope FK (`organizationId`) among its filterable fields. On the REST plane that\n * is harmless — the field also appears on the URL, and `validateInitiatorCriticalParameters`\n * refuses any request whose sources disagree. Advertised as a TOOL PARAMETER it is neither\n * harmless nor even meaningful: a machine caller's tenant comes from its token, so the only reason\n * to set it is to try another tenant's.\n *\n * The repository now refuses such a call outright, so this is defence in depth rather than the\n * control — but advertising a parameter whose only use is an attack, and which is guaranteed to\n * fail, is a catalogue defect on its own: an agent reading the schema is invited to set it and is\n * then refused for reasons it cannot see.\n *\n * Both nesting positions are stripped, top level and inside `filters`, because the DTO builder\n * places it in either depending on the operation.\n *\n * assurance-control: WILDO.DATA.TENANT_ISOLATION — an agent is never offered its tenant as a knob\n */\n private withoutScopeParameters(schema: Record<string, unknown>, primaryScope: ResourcePrimaryScope): Record<string, unknown> {\n const scopeField = PRIMARY_SCOPE_TO_FIELD_IDENTIFIER[primaryScope];\n if (!scopeField) return schema;\n\n const strip = (node: unknown): unknown => {\n if (!node || typeof node !== 'object') return node;\n const obj = node as Record<string, any>;\n if (!obj.properties || typeof obj.properties !== 'object') return obj;\n const properties: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj.properties as Record<string, unknown>)) {\n if (key === scopeField) continue;\n properties[key] = strip(value);\n }\n const required = Array.isArray(obj.required)\n ? (obj.required as string[]).filter((r) => r !== scopeField)\n : obj.required;\n return { ...obj, properties, ...(required === undefined ? {} : { required }) };\n };\n\n return strip(schema) as Record<string, unknown>;\n }\n\n /**\n * D4 opt-in (fail-closed): an operation is exposed as an MCP tool ONLY when its config\n * explicitly sets `mcp.exposed === true`. Absent/false ⇒ not exposed. This is a discovery\n * gate, NOT authorization — `callTool` still runs `authorizeInController` per call.\n */\n private isMcpExposed(operation: ResourceConfiguration_Operation<any, any, any>): boolean {\n return operation.mcp?.exposed === true;\n }\n\n /**\n * An operation declared a KNOWN implementation gap is never advertised, whatever its config says.\n *\n * `unimplementedAcknowledgement` marks a variant that both unblocks startup AND makes the request\n * refuse, so it can never answer 2xx. Advertising it as a tool tells an agent a capability exists\n * that provably does not: the agent calls it, is refused, and — having no way to distinguish \"not\n * implemented\" from \"bad arguments\" — retries with different arguments and loops. That is the same\n * agent-facing harm the fail-closed opt-in exists to prevent, arriving through a different door.\n *\n * This OVERRIDES the author's opt-in rather than trusting it, because the two declarations are\n * written at different times by different people: `mcp.exposed` is authored when the verb is\n * designed, `unimplementedAcknowledgement` is added later when someone discovers it does not work.\n * A rule that asks the author to remember to also retract the exposure is a rule that will be\n * missed exactly when it matters most.\n */\n private isAcknowledgedUnimplemented(operation: ResourceConfiguration_Operation<any, any, any>): boolean {\n return (operation as { unimplementedAcknowledgement?: unknown }).unimplementedAcknowledgement !== undefined;\n }\n\n /**\n * Instance membership (R-2, multiple named MCP servers). Membership is EXCLUSIVE and defaults safely:\n *\n * - `operation.mcp.servers` ABSENT ⇒ the operation belongs to the DEFAULT server (the plain `/mcp`\n * endpoint) and to no named server. This is what makes multi-server strictly additive: every\n * already-exposed operation keeps appearing exactly where it does today.\n * - `servers` PRESENT ⇒ the operation belongs ONLY to the named servers (it leaves the default\n * catalog). Curating a server is therefore a deliberate move, never an accidental duplication.\n *\n * @param instanceRef - the server being served, or `undefined` for the default server.\n */\n private isOnMcpServerInstance(\n operation: ResourceConfiguration_Operation<any, any, any>,\n instanceRef: string | undefined,\n ): boolean {\n const servers = operation.mcp?.servers;\n if (!servers || servers.length === 0) return instanceRef === undefined;\n return instanceRef !== undefined && servers.includes(instanceRef);\n }\n\n /**\n * Enumerate the exposable default URL-bearing operations of one resource and\n * build their tool descriptors, sorted by operation identifier.\n */\n private buildResourceToolDescriptors(\n config: AnyResourceConfiguration,\n descriptionProvider: McpToolDescriptionProvider | undefined,\n instanceRef: string | undefined,\n ): McpToolDescriptor[] {\n const seen = new Set<string>();\n const descriptors: McpToolDescriptor[] = [];\n\n // The resource's own id field identifier (e.g. `todolistId`). This is the SAME value\n // the transport's `extractResourceId` pulls out of the tool arguments\n // (`MCPControllerBackendService.extractResourceId` reads the identical registry map),\n // so advertising it here keeps advertise ≡ extract for instance-scoped tools.\n const selfFieldIdentifier: string | undefined = this.resourcesRegistry.getAllResourceFieldIdentifiers()[config.resourceIdentifier];\n\n for (const operation of config.operations) {\n const operationIdentifier = String(operation.operationIdentifier);\n // `isDefaultUrlBearingOperation` narrows to API_CALL / API_CALL_WITH_CALLBACK,\n // requires isOperationDefault, and excludes bulk — the exact HTTP-surface set.\n if (!isDefaultUrlBearingOperation(operation, operationIdentifier)) continue;\n // D4 opt-in (fail-closed): only operations that explicitly set `mcp.exposed` are tools.\n if (!this.isMcpExposed(operation)) continue;\n // …and an acknowledged implementation gap is withdrawn even when it opted in.\n if (this.isAcknowledgedUnimplemented(operation)) continue;\n // R-2: only the operations belonging to the server instance being served.\n if (!this.isOnMcpServerInstance(operation, instanceRef)) continue;\n // A resource can carry multiple default url-bearing variants for the same\n // identifier only across data modes; de-dupe by the tool name so `tools/list`\n // never returns two tools with the same name.\n const name = this.buildToolName(config.resourceIdentifier, operationIdentifier);\n // SEP-986 naming (`2025-11-25`). Checked on the COMPOSED name rather than on either half,\n // because that is the string the client parses and the length bound applies to the whole of it.\n // Fail-closed and per-OPERATION: one badly named custom operation withdraws itself, while its\n // resource's other tools keep working — unlike the `__`-separator guard above, which has to\n // skip the whole resource because it corrupts the round-trip identity of every name under it.\n // Mirrored in `resolveExposableOperation`, so the tool is un-callable as well as unadvertised.\n if (!isSpecConformantMcpToolName(name)) {\n this.logger.warn('Skipping MCP exposure for a tool whose name does not satisfy the MCP naming guidance', {\n toolName: name,\n resourceIdentifier: config.resourceIdentifier,\n operationIdentifier,\n allowedCharacters: 'A-Z a-z 0-9 _ - .',\n maxLength: MCP_TOOL_NAME_MAX_LENGTH,\n });\n continue;\n }\n if (seen.has(name)) continue;\n seen.add(name);\n\n // Instance-scoped operation? An entity-level op (READ / UPDATE / DELETE and\n // instance-scoped custom ops) binds the resource's OWN id as a URL path param —\n // `getOperationSegments` stamps it as `{ fieldIdentifier: <selfFieldIdentifier>,\n // resourceType: <this resource> }` (one-to-one / complete-M2M singletons omit it\n // and are identified by parent scope instead). That id lives on the URL, NOT in\n // `requestDto`, so without advertising it the calling agent is never told it must\n // supply an id. `operation` is narrowed to the URL-bearing variant here, so\n // `initiatorInfos` is a safe read.\n const bindsInstanceId = !!selfFieldIdentifier\n && (operation.initiatorInfos ?? []).some((info) =>\n info.parameters.some(\n (parameter) =>\n parameter.fieldIdentifier === selfFieldIdentifier\n && parameter.resourceType === config.resourceIdentifier,\n ),\n );\n\n const baseInputSchema = this.withoutUnsupportedTextSearch(\n convertZodSchemaToMcpInputSchema(this.advertisedRequestSchema(operation)),\n operation,\n );\n // A `{value:...}`-wrapped union/primitive-root DTO is dispatched by the transport WITHOUT\n // an id split — it unwraps the envelope and passes the payload straight through\n // (`MCPControllerBackendService`), so an id must NOT be advertised for it. Only a genuine\n // object-root DTO (or the empty-object no-body case) carries the resource-id, keeping\n // advertise ≡ extract. Gate on the SAME predicate the transport uses, not on the built\n // schema's `type` (the value-wrapper is itself object-root and would slip past a type check).\n const advertisedSchema = bindsInstanceId\n && selfFieldIdentifier\n && !isMcpValueWrappedRequestDto(operation.requestDto)\n ? this.withInstanceIdParameter(baseInputSchema, selfFieldIdentifier, config.resourceIdentifier)\n : baseInputSchema;\n // …then withdraw the SCOPE field, wherever the DTO happens to place it.\n const inputSchema = this.withoutScopeParameters(advertisedSchema, config.resourcePrimaryScope);\n\n descriptors.push({\n name,\n description: this.resolveDescription(config.resourceIdentifier, operationIdentifier, operation, descriptionProvider),\n inputSchema,\n annotations: this.buildAnnotations(operationIdentifier, operation.riskLevel),\n resourceType: config.resourceIdentifier,\n operationIdentifier,\n });\n }\n\n return descriptors.sort((a, b) => a.operationIdentifier.localeCompare(b.operationIdentifier));\n }\n\n /** `<resourceIdentifier>__<operationIdentifier>`. */\n private buildToolName(resourceIdentifier: ResourceType, operationIdentifier: string): string {\n return `${String(resourceIdentifier)}${MCP_TOOL_NAME_SEPARATOR}${operationIdentifier}`;\n }\n\n /**\n * Advertise the resource's own id as a REQUIRED string on an instance-scoped tool's\n * `inputSchema`, mirroring the URL path parameter the transport splits back out\n * (`MCPControllerBackendService.extractResourceId`). Without it, an agent reading the\n * schema is never told it must supply the id, so instance READ / UPDATE / DELETE tools\n * are un-invokable as advertised.\n *\n * Only OBJECT-root schemas are augmented: a `{value:...}`-wrapped union/primitive-root\n * DTO (e.g. a discriminated-union create) is dispatched WITHOUT an id split by the\n * transport, so injecting an id there would break the advertise ≡ extract symmetry.\n * `instanceIdField` is the resource's registry field identifier — the exact key the\n * transport reads back — so a compliant agent supplies it under the name the server expects.\n */\n private withInstanceIdParameter(\n baseInputSchema: Record<string, unknown>,\n instanceIdField: string,\n resourceType: ResourceType,\n ): Record<string, unknown> {\n if (baseInputSchema.type !== 'object') return baseInputSchema;\n const properties: Record<string, unknown> = {\n ...(baseInputSchema.properties as Record<string, unknown> | undefined),\n [instanceIdField]: {\n type: 'string',\n description: `Identifier of the ${String(resourceType)} record to act on (URL path parameter).`,\n },\n };\n const required: string[] = Array.isArray(baseInputSchema.required)\n ? [...(baseInputSchema.required as string[])]\n : [];\n if (!required.includes(instanceIdField)) required.push(instanceIdField);\n return { ...baseInputSchema, properties, required };\n }\n\n /**\n * Prefer spec-sourced prose from the injected provider; fall back to a\n * synthesized description built from the operation's own config metadata.\n */\n private resolveDescription(\n resourceType: ResourceType,\n operationIdentifier: string,\n operation: ResourceConfiguration_Operation<any, any, any>,\n descriptionProvider: McpToolDescriptionProvider | undefined,\n ): string {\n // D4: an authored `mcp.description` on the operation config wins — it is the\n // agent-facing tool description the app author wrote explicitly for this tool.\n const authored = operation.mcp?.description?.trim();\n if (authored) return this.withEnvelopeNote(operation, authored);\n const spec = descriptionProvider?.(resourceType, operationIdentifier);\n if (spec && (spec.purpose || spec.whenToUse)) {\n const parts: string[] = [];\n if (spec.purpose) parts.push(spec.purpose.trim());\n if (spec.whenToUse) parts.push(`When to use: ${spec.whenToUse.trim()}`);\n return this.withEnvelopeNote(operation, parts.join('\\n\\n'));\n }\n return this.withEnvelopeNote(operation, this.synthesizeDescription(resourceType, operationIdentifier, operation));\n }\n\n /**\n * Name the `{ value: … }` envelope, because nothing else does.\n *\n * A resource whose main schema is a FAMILY (a discriminated union) produces a union-root request\n * DTO, which the transport wraps as `{ value: <payload> }` — so `todos__create` advertises one\n * opaque `value` property carrying a `oneOf`, where its sibling `tasks__create` advertises eight\n * named fields. The schema is correct and an agent that validates against it succeeds; the hazard\n * is the DESCRIPTION, which an app author writes about the payload (\"provide a title; optionally\n * description, priority…\") and which therefore describes the INSIDE of an envelope it never\n * mentions. An agent that reads the prose and skips the schema builds `{title}` and is rejected.\n *\n * Appended by the ENGINE rather than asked of the author, deliberately: the envelope is an artefact\n * of how the framework compiles a schema family, so requiring every app author to hand-write it\n * would push an engine internal into app prose and go stale the moment a resource stops being\n * polymorphic. The note is derived from the same predicate the transport uses to decide whether to\n * unwrap, so it appears exactly when the envelope is real.\n */\n private withEnvelopeNote(operation: ResourceConfiguration_Operation<any, any, any>, description: string): string {\n if (!isMcpValueWrappedRequestDto(operation.requestDto)) return description;\n return `${description}\\n\\nArguments must be wrapped: pass the payload as the \"value\" property (this resource accepts several shapes, listed under \"value\" in the input schema).`;\n }\n\n /**\n * Minimal fallback description from config metadata. Honest about being\n * auto-generated so an operator can tell which tools still need authored prose.\n */\n private synthesizeDescription(\n resourceType: ResourceType,\n operationIdentifier: string,\n operation: ResourceConfiguration_Operation<any, any, any>,\n ): string {\n const riskNote = DESTRUCTIVE_RISK_LEVELS.has(operation.riskLevel)\n ? ` (risk: ${operation.riskLevel})`\n : '';\n return `Perform the \"${operationIdentifier}\" operation on ${String(resourceType)} resources${riskNote}.`;\n }\n\n /**\n * Withdraw `filters.searchRequest` from an operation that cannot perform a text search.\n *\n * The shared collection envelope extends a BASE filter schema that always carries\n * `searchRequest`, because it was written for SEARCH. Advertising it on an operation that does not\n * declare `isSearchable` would promise a text search the repository refuses outright\n * (`REPOSITORY_RESOURCE_SEARCH_NOT_ENABLED`) — or, worse on the LIST path, one that is quietly\n * discarded by the filter allow-list, handing the agent an UNFILTERED collection it believes was\n * narrowed. That is the exact failure the collection normalisation was introduced to end, and\n * reintroducing it while fixing its mirror image would be a poor trade.\n *\n * `createdAt` / `updatedAt` stay: generic date-range filtering IS translated for any collection\n * operation, so those two are honoured wherever they are advertised.\n */\n private withoutUnsupportedTextSearch(\n schema: Record<string, unknown>,\n operation: ResourceConfiguration_Operation<any, any, any>,\n ): Record<string, unknown> {\n if ((operation as { isSearchable?: boolean }).isSearchable) return schema;\n const schemaProperties = schema.properties as Record<string, unknown> | undefined;\n const filters = schemaProperties?.filters as { properties?: Record<string, unknown>; required?: string[] } | undefined;\n if (!filters?.properties || !('searchRequest' in filters.properties)) return schema;\n const { searchRequest: _withdrawn, ...remainingFilterProperties } = filters.properties;\n return {\n ...schema,\n properties: {\n ...schemaProperties,\n filters: {\n ...filters,\n properties: remainingFilterProperties,\n ...(filters.required ? { required: filters.required.filter((name) => name !== 'searchRequest') } : {}),\n },\n },\n };\n }\n\n /**\n * The schema this tool ADVERTISES as its arguments.\n *\n * For almost every operation that is simply `requestDto`. Collection-shaped operations are the\n * exception, and the reason is a split between two contracts that only LOOKS like one:\n *\n * - **SEARCH** is a POST; the factory promotes its `searchQueryRequestSchema` to `requestDto`, so\n * `{ filters, pagination, sorting }` is already advertised.\n * - **LIST / COUNT** are GETs. Their filters travel in the QUERY STRING, so their `requestDto`\n * stays `z.object({})` — correctly, because giving a GET a request body would misdescribe the\n * REST contract and the generated OpenAPI.\n *\n * But MCP has no query string. `McpServerBackendService.toDispatchArguments` routes EVERY\n * collection-shaped operation through `normalizeCollectionQueryRequestData`, bypassing the strict\n * `requestDto.parse` entirely — so a LIST tool has always ACCEPTED `{ filters, pagination,\n * sorting }` and applied the operation's filter allow-list to it. It just advertised\n * `{properties:{}, additionalProperties:false}`, which tells a conformant agent the opposite: that\n * arguments are forbidden.\n *\n * That is this surface's own \"the advertised contract is not the enforced contract\" defect,\n * inverted. The earlier instance advertised filters and silently ignored them; this one accepts\n * filters and refuses to admit it. An agent could only discover the capability by violating the\n * schema it was given.\n *\n * The envelope is built from the SAME `filterFields` / `sortFields` the dispatch allow-lists\n * against, through the same builder the factory uses for SEARCH — so advertise ≡ extract holds by\n * construction rather than by two definitions happening to agree.\n *\n * `requestDto` is deliberately NOT modified: the REST contract, the OpenAPI document and the\n * response shape are all untouched by this. Only what MCP tells an agent changes.\n */\n private advertisedRequestSchema(operation: ResourceConfiguration_Operation<any, any, any>): z.ZodTypeAny | undefined {\n if (!isCollectionQueryMcpOperation(resolveEffectiveMcpOperation(operation))) return operation.requestDto;\n // A collection operation that already advertises a non-empty contract (SEARCH, or any operation\n // carrying an explicit authored `requestDto`) is left exactly as authored — this fills a gap, it\n // does not override an author.\n const advertised = convertZodSchemaToMcpInputSchema(operation.requestDto);\n if (Object.keys(advertised.properties ?? {}).length > 0) return operation.requestDto;\n\n const { filterFields, sortFields } = operation as unknown as {\n filterFields?: Record<string, unknown>;\n sortFields?: readonly string[];\n };\n // Nothing declared to filter or sort by ⇒ nothing to advertise beyond pagination. Emitting the\n // envelope anyway is still right: pagination is what makes a collection tool usable past its\n // first page, and it needs no per-resource declaration.\n const primitiveFilterFields: Record<string, any> = {};\n Object.entries(filterFields ?? {}).forEach(([key, value]) => {\n // A FUNCTION-valued entry is a filter REFERENCE (a cross-resource pointer the factory resolves\n // elsewhere), not a schema — the same exclusion the factory applies when it builds SEARCH's\n // envelope. Advertising it would put an uncallable key in front of the agent.\n if (typeof value !== 'function') primitiveFilterFields[key] = value;\n });\n\n return createResourceSearchQueryRequestSchema({\n filterFields: primitiveFilterFields,\n allowedSortFields: sortFields ?? [],\n pagination: true,\n });\n }\n\n /**\n * Behaviour hints from the operation identifier + risk level.\n *\n * Every one of these has a DEFAULT in the specification, so an omitted hint is not a neutral\n * silence — it is an assertion of that default. Two of them defaulted against us:\n *\n * - `openWorldHint` defaults to **true**, so omitting it advertised every Wildo tool as\n * potentially reaching arbitrary external systems. It is always `false` here: a tool operates on\n * this application's own resources, through its own authorization, and reaches nothing else.\n * - `idempotentHint` defaults to **false**, i.e. \"retrying may double the effect\" — true for\n * CREATE, wrong for UPDATE and DELETE. This is the hint an agent uses to decide whether a retry\n * after a timeout is safe, which makes the wrong default an availability problem, not a\n * cosmetic one.\n *\n * `idempotentHint` is emitted ONLY for writes because the specification defines it as \"meaningful\n * only when `readOnlyHint == false`\". `destructiveHint` is emitted unconditionally despite the same\n * caveat: `false` is TRUE of a read tool, and a client that reads it without first checking\n * `readOnlyHint` is safer for having it.\n *\n * spec-cite: MCP 2026-07-28 — `ToolAnnotations`, `idempotentHint` and `destructiveHint` doc\n * comments (\"(This property is meaningful only when `readOnlyHint == false`)\"), and the `Default:`\n * lines on `openWorldHint` (true), `idempotentHint` (false) and `destructiveHint` (true).\n * <https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2026-07-28/schema.ts>\n */\n private buildAnnotations(operationIdentifier: string, riskLevel: ResourceOperationRiskLevel): McpToolAnnotations {\n const readOnlyHint = READ_ONLY_CORE_OPERATIONS.has(operationIdentifier);\n const destructiveHint = operationIdentifier === String(CoreResourceOperation.DELETE)\n || DESTRUCTIVE_RISK_LEVELS.has(riskLevel);\n return {\n readOnlyHint,\n destructiveHint,\n ...(readOnlyHint ? {} : { idempotentHint: IDEMPOTENT_WRITE_CORE_OPERATIONS.has(operationIdentifier) }),\n openWorldHint: false,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"mcp-tool-adapter.backend.service.js","sourceRoot":"","sources":["../../../../../src/mcp/services/mcp-tool-adapter.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAIL,oBAAoB,EACpB,iCAAiC,EACjC,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,sCAAsC,EACtC,sCAAsC,EACtC,iCAAiC,EACjC,0BAA0B,GAE3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGpF,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAC3H,OAAO,EAAE,gCAAgC,EA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';\nimport { z } from 'zod';\nimport {\n ResourceType,\n AnyResourceConfiguration,\n ResourceConfiguration_Operation,\n ResourcePrimaryScope,\n PRIMARY_SCOPE_TO_FIELD_IDENTIFIER,\n ResourceOperationRiskLevel,\n CoreResourceOperation,\n isDefaultUrlBearingOperation,\n createResourceSearchQueryRequestSchema,\n FILE_UPLOAD_GRANT_ABSOLUTE_MAX_MINUTES,\n FILE_UPLOAD_GRANT_DEFAULT_MINUTES,\n ResourcesConfigNamingUtils,\n type FileUploadGrantOperation,\n} from '@wildo-ai/saas-models';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { FileFieldDetectionBackendService, FileFieldMetadata } from '~wildo-backend-lib/files/services/file-field-detection.backend.service';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { convertZodSchemaToMcpInputSchema, isMcpValueWrappedRequestDto } from '~wildo-backend-lib/mcp/utils/zod-to-mcp-json-schema.backend.utils';\nimport {\n McpToolDescriptor,\n McpToolAnnotations,\n McpToolAdapterBuildOptions,\n McpToolDescriptionProvider,\n MCP_TOOL_NAME_SEPARATOR,\n MCP_TOOL_NAME_MAX_LENGTH,\n isSpecConformantMcpToolName,\n buildUploadGrantToolOperationPart,\n parseUploadGrantToolOperationPart,\n} from '~wildo-backend-lib/mcp/models/mcp-tool.backend.schemas';\n\n/**\n * Resource primary scopes a **machine principal** can reach — ORG / APP only. Verified against the\n * authorizer (`authorizations.backend.service.ts`): `authorizeUserSelf` requires\n * `initiatorIds.userId` and `validateFKRelationshipAccess` throws for any non-`USER_REQUEST`\n * execution type on a user-FK path. A machine principal (api-key OR OAuth client) carries no\n * `userId`, so `USER_SELF` (and `ANONYMOUS`) resources are unreachable by it and MUST NOT be\n * advertised to it — doing so would surface tools that always 403. This is the MACHINE catalog, and\n * ONLY the machine's: an anonymous caller borrowed it until 2026-08-11, which advertised twelve\n * role-gated tools to a principal holding no roles. See {@link ANONYMOUS_REACHABLE_SCOPES}.\n */\nconst MACHINE_REACHABLE_SCOPES: ReadonlySet<ResourcePrimaryScope> = new Set([\n ResourcePrimaryScope.ORGANIZATIONS,\n ResourcePrimaryScope.APPLICATION,\n]);\n\n/**\n * Resource primary scopes a **user-delegated principal** (an `authorization_code` token that carries\n * a `userId`) can reach — ORG / APP PLUS `USER_SELF`. The authorizer's `authorizeUserSelf` succeeds\n * for such a principal (it supplies `initiatorIds.userId`), so a delegated user's own USER_SELF\n * operations are legitimately callable and may be advertised to them. `ANONYMOUS` stays excluded — it\n * is the pre-auth anonymous surface, not a delegated one.\n */\nconst USER_DELEGATED_REACHABLE_SCOPES: ReadonlySet<ResourcePrimaryScope> = new Set([\n ResourcePrimaryScope.ORGANIZATIONS,\n ResourcePrimaryScope.APPLICATION,\n ResourcePrimaryScope.USER_SELF,\n]);\n\n/**\n * Scopes reachable by a caller that presented NO credentials.\n *\n * EMPTY, and empty is the honest answer rather than a placeholder. Two facts decide it:\n *\n * 1. `tools/call` requires a Bearer unconditionally — there is no anonymous dispatch path on this\n * plane at all. So no tool, of any scope, is invocable without credentials.\n * 2. `ResourcePrimaryScope.ANONYMOUS` — the framework's genuine pre-auth surface — is therefore not\n * servable over MCP either, and must NOT be advertised even if an application declares\n * `mcp: { exposed: true }` on such a resource. Advertising a tool that cannot be called is the\n * exact defect this set exists to end.\n *\n * Until 2026-08-11 an anonymous caller was classified as a MACHINE principal and handed the ORG/APP\n * catalogue — twelve tools it could not invoke, because those operations are role-gated and it holds\n * no roles. That was not a partial truth, it was a lie with a consequence: the client saw a working\n * server, was never challenged, and so never began authorization. A real client (Cursor) reported\n * \"successfully authenticated\" without ever opening a browser, because clicking Authenticate merely\n * reconnects — and `initialize` + `tools/list` both answered 200.\n *\n * When an anonymous dispatch path exists, this becomes `{ ANONYMOUS }` and the catalogue stops being\n * empty for apps that expose such tools. That is the ONLY change required here; the classification,\n * the challenge rule and the call gate are already shaped for it.\n */\nconst ANONYMOUS_REACHABLE_SCOPES: ReadonlySet<ResourcePrimaryScope> = new Set();\n\n/**\n * Who is asking. Three principals, because there are three genuinely different answers — and the\n * defect above came from encoding it as a boolean, which forced \"anonymous\" to borrow the machine\n * answer for want of a third value.\n */\nexport enum McpCallerPrincipal {\n /** No credentials presented. */\n ANONYMOUS = 'anonymous',\n /** A `client_credentials` token — acts as ITSELF, carries no `userId`. */\n MACHINE = 'machine',\n /** An `authorization_code` token — acts FOR a consenting user, carries a `userId`. */\n USER_DELEGATED = 'user_delegated',\n}\n\n/**\n * The MCP tool scopes reachable by the caller (progressive principal-awareness). Both the\n * `tools/list` catalog and the `callTool` exposability gate derive their scope set from THIS single\n * source, so advertise ≡ callable per principal — no tool an agent sees is un-callable by it, and\n * none it can call is hidden. That invariant was CLAIMED here before 2026-08-11 and was false for the\n * anonymous caller; it is true now.\n */\n/**\n * Classify a caller that has ALREADY authenticated.\n *\n * `tools/call` and the `callTool` exposability gate both run after `authenticateExternalToken`\n * succeeded, so ANONYMOUS is unreachable there by construction — the only question left is whether\n * the token carries a `userId`. Named rather than inlined so those sites cannot accidentally pass a\n * boolean into the three-valued resolver and silently mean \"machine\" when they mean \"anonymous\",\n * which is the shape of the defect this whole model replaced.\n */\nexport function mcpPrincipalForAuthenticatedCaller(isUserDelegated: boolean): McpCallerPrincipal {\n return isUserDelegated ? McpCallerPrincipal.USER_DELEGATED : McpCallerPrincipal.MACHINE;\n}\n\nexport function mcpReachableScopesForPrincipal(principal: McpCallerPrincipal): ReadonlySet<ResourcePrimaryScope> {\n switch (principal) {\n case McpCallerPrincipal.USER_DELEGATED:\n return USER_DELEGATED_REACHABLE_SCOPES;\n case McpCallerPrincipal.MACHINE:\n return MACHINE_REACHABLE_SCOPES;\n case McpCallerPrincipal.ANONYMOUS:\n return ANONYMOUS_REACHABLE_SCOPES;\n }\n}\n\n/**\n * The operation a tool REALLY performs — a custom operation declares what it behaves like via\n * `resourceOperationLike`, and every decision keyed on operation identity must ask this, not the\n * raw identifier.\n *\n * Lives here, and is exported, because three surfaces now need the same answer: the catalogue\n * (which input envelope to ADVERTISE), the input normalisation, and the output pagination wrapper.\n * `McpServerBackendService` derived it privately and its own comment records why that mattered —\n * when two of those surfaces answered separately, a custom LIST-like operation that only one of\n * them recognised was normalised as a collection on the way in and dispatched without pagination on\n * the way out. A third private copy in the adapter would have reopened exactly that.\n */\nexport function resolveEffectiveMcpOperation(operation: { resourceOperationLike?: unknown; operationIdentifier: unknown }): string {\n return String(operation.resourceOperationLike ?? operation.operationIdentifier);\n}\n\n/**\n * Collection-shaped queries — the operations that take the `{ filters, pagination, sorting }`\n * argument envelope. Exported for the same reason as {@link resolveEffectiveMcpOperation}: the\n * catalogue and the dispatch must agree on the set, or one advertises an envelope the other refuses\n * (or, as shipped until now, refuses an envelope the other accepts).\n *\n * `COUNT` belongs here even though it returns a scalar: it FILTERS like a collection. The output\n * side is deliberately a different set (see `isPaginationWrappedOperation`), and conflating the two\n * would ask the repository to wrap a scalar in a pagination envelope its response DTO never declares.\n */\nexport function isCollectionQueryMcpOperation(effectiveOperation: string): boolean {\n return effectiveOperation === CoreResourceOperation.LIST\n || effectiveOperation === CoreResourceOperation.SEARCH\n || effectiveOperation === CoreResourceOperation.COUNT;\n}\n\n/**\n * The kebab-case segment a file field gets in its upload ROUTE (`…/files/<segment>`) — the same\n * transform `ResourcesConfigOperationsUrlsBuilderUtils.buildFileUploadRouteForOperation` applies, so\n * a derived tool name and the route it mints for agree by construction.\n */\nexport function fileFieldRouteSegment(fieldName: string): string {\n return ResourcesConfigNamingUtils.toKebabCase(fieldName.replace(/\\./g, '-'));\n}\n\n/** Core operations that only read — surfaced as `annotations.readOnlyHint`. */\nconst READ_ONLY_CORE_OPERATIONS: ReadonlySet<string> = new Set<string>([\n CoreResourceOperation.READ,\n CoreResourceOperation.LIST,\n CoreResourceOperation.SEARCH,\n CoreResourceOperation.COUNT,\n]);\n\n/**\n * Write operations where repeating the call with the same arguments changes nothing further.\n *\n * UPDATE settles the row to the same value; DELETE removes an already-removed row and reports\n * not-found. CREATE is deliberately ABSENT — calling it twice makes two rows, which is exactly the\n * case an agent retrying after a timeout needs to know about.\n * spec-cite: MCP schema — `ToolAnnotations.idempotentHint`\n */\nconst IDEMPOTENT_WRITE_CORE_OPERATIONS: ReadonlySet<string> = new Set<string>([\n CoreResourceOperation.UPDATE,\n CoreResourceOperation.DELETE,\n]);\n\n/** Risk levels that flag a tool as destructive. */\nconst DESTRUCTIVE_RISK_LEVELS: ReadonlySet<ResourceOperationRiskLevel> = new Set([\n ResourceOperationRiskLevel.HIGH,\n ResourceOperationRiskLevel.CRITICAL,\n]);\n\n/**\n * Adapts registered resource operations into MCP tool descriptors.\n *\n * # What it exposes\n *\n * For each in-scope resource, it enumerates the DEFAULT, non-bulk, URL-bearing\n * operations (`API_CALL` / `API_CALL_WITH_CALLBACK` — the only variants carrying an\n * HTTP surface, selected via `isDefaultUrlBearingOperation`) that OPT IN via\n * `operation.mcp.exposed === true` (D4 — fail-closed) and builds a tool\n * descriptor `{ name, description, inputSchema, annotations }` where:\n * - `name` = `<resourceIdentifier>__<operationIdentifier>`,\n * - `inputSchema` = the operation `requestDto` converted to JSON Schema, PLUS the\n * resource's own id (a required string) for instance-scoped operations whose URL\n * binds it — see {@link McpToolAdapterBackendService.withInstanceIdParameter}\n * (kept symmetric with the transport's `extractResourceId`),\n * - `description` = spec `purpose`/`whenToUse` (injected — see below) or a\n * synthesized fallback,\n * - `annotations` = read-only / destructive hints from the op identifier + `riskLevel`.\n *\n * # Scope constraint (verified, principal-aware)\n *\n * Exposability is filtered by the CALLER's reachable scopes (progressive principal-awareness). A\n * MACHINE principal reaches ORGANIZATION / APPLICATION only (a machine carries no `userId`, so\n * `USER_SELF` always 403s); an ANONYMOUS caller reaches nothing at all. A USER-DELEGATED principal\n * (`authorization_code`, carries a `userId`) additionally reaches `USER_SELF`, including its collection\n * reads — the socket path scopes those to the caller by seeding the authenticated `userId` into the\n * context map (`buildContextFromSocketAuth`). See {@link mcpReachableScopesForPrincipal}; `ANONYMOUS`\n * is never exposed.\n *\n * # Description sourcing\n *\n * Priority: (1) the authored `operation.mcp.description` (D4 config-local field — the\n * agent-facing description the app author wrote for this tool); else (2) a caller-injected\n * {@link McpToolDescriptionProvider} sourcing the spec `purpose`/`whenToUse` (the backend\n * cannot import `saas-specifications` without inverting the layer graph); else (3) a\n * synthesized fallback from config metadata.\n */\n@injectable()\nexport class McpToolAdapterBackendService {\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) protected readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n protected readonly resourcesRegistry: ResourcesRegistryBackendService,\n /**\n * Detects the user-uploadable file fields a resource carries — the same detector the resource\n * controller uses to REGISTER upload routes, so a derived upload-grant tool is advertised for\n * exactly the fields that have a route. Optional only so harnesses that never look at file\n * fields can construct the adapter; the container always binds it, and without it no derived\n * tool is advertised or callable (fail-closed, logged once).\n */\n @inject(SAAS_SERVICE_TYPES.FileFieldDetectionService) @optional()\n protected readonly fileFieldDetection?: FileFieldDetectionBackendService,\n ) {\n this.logDebug = this.logger.debugByType('McpToolAdapterBackendService');\n this.logger.setDebugTypeLogging('McpToolAdapterBackendService', false);\n }\n\n /**\n * Build the MCP tool descriptor set for the requested resources, filtered to the caller's reachable\n * scopes (`options.reachableScopes`, default = machine-reachable ORG/APP). A user-delegated caller\n * passes the delegated set so their USER_SELF tools are advertised too. Tools are returned in\n * deterministic order (resource type, then operation identifier) so `tools/list` output is stable.\n */\n public buildToolDescriptors(options: McpToolAdapterBuildOptions = {}): McpToolDescriptor[] {\n const resourceTypes = options.resourceTypes ?? this.resourcesRegistry.getResourceTypes();\n const reachableScopes = options.reachableScopes ?? MACHINE_REACHABLE_SCOPES;\n const descriptors: McpToolDescriptor[] = [];\n\n for (const resourceType of [...resourceTypes].sort()) {\n const config = this.resourcesRegistry.tryGetResourceConfiguration(resourceType);\n if (!config) {\n this.logDebug('Skipping unregistered resource type requested for MCP exposure', { resourceType });\n continue;\n }\n if (!this.isResourceExposable(config, reachableScopes)) continue;\n // Tool-name round-trip invariant: a tool name is `<resourceIdentifier>__<operationIdentifier>`\n // and `McpServerBackendService.parseToolName` splits on the FIRST separator, so a resource\n // identifier that itself contains `__` would mis-parse into a non-existent resource/operation\n // and produce an un-callable tool. Skip such a resource (fail-closed) and surface the\n // misconfiguration rather than emit a broken descriptor.\n if (String(config.resourceIdentifier).includes(MCP_TOOL_NAME_SEPARATOR)) {\n this.logger.warn('Skipping MCP exposure for a resource whose identifier contains the tool-name separator', {\n resourceIdentifier: config.resourceIdentifier,\n separator: MCP_TOOL_NAME_SEPARATOR,\n });\n continue;\n }\n\n const operationDescriptors = this.buildResourceToolDescriptors(config, options.descriptionProvider, options.instanceRef);\n descriptors.push(...operationDescriptors);\n }\n\n return descriptors;\n }\n\n /**\n * Resolve the single exposable operation for a `resourceType` +\n * `operationIdentifier`, or `undefined` if it is not exposable. This is the\n * SINGLE source of exposability truth — {@link McpServerBackendService.callTool}\n * calls it (with the caller's reachable scopes) before authorizing so a crafted tool name can never\n * reach a scope the caller cannot use (e.g. a machine principal hitting a USER_SELF operation).\n * Applies the exact same filter as {@link buildToolDescriptors}: reachable scope + default, non-bulk,\n * URL-bearing variant, opted in, not an acknowledged gap, on this instance, and a conformant name.\n * `reachableScopes` defaults to machine-reachable (ORG/APP); a user-delegated caller passes the\n * delegated set so a USER_SELF operation resolves for THEM.\n *\n * \"the exact same filter\" is load-bearing, and it was FALSE until 2026-08-13: this method omitted\n * {@link isAcknowledgedUnimplemented}, so an operation withdrawn from the catalogue for provably\n * not working stayed invocable by name. That is the harm that guard exists to prevent (an agent\n * that cannot tell \"not implemented\" from \"bad arguments\" retries forever), arriving through the\n * one door the guard did not cover — and every pin on it was green throughout, because all of them\n * interrogate the advertise side. Any clause added to one of these two lists belongs in the other\n * in the same edit.\n */\n public resolveExposableOperation(\n resourceType: ResourceType,\n operationIdentifier: string,\n reachableScopes: ReadonlySet<ResourcePrimaryScope> = MACHINE_REACHABLE_SCOPES,\n instanceRef?: string,\n ): ResourceConfiguration_Operation<any, any, any> | undefined {\n const config = this.resourcesRegistry.tryGetResourceConfiguration(resourceType);\n if (!config || !this.isResourceExposable(config, reachableScopes)) return undefined;\n // SEP-986 naming, checked on the SAME composed name the catalogue would advertise. A name the\n // catalogue refuses to publish must not remain callable by a client that guessed it, or the\n // withdrawal is cosmetic.\n if (!isSpecConformantMcpToolName(this.buildToolName(config.resourceIdentifier, operationIdentifier))) return undefined;\n return config.operations.find(\n (operation) =>\n String(operation.operationIdentifier) === operationIdentifier\n && isDefaultUrlBearingOperation(operation, String(operation.operationIdentifier))\n && this.isMcpExposed(operation)\n && !this.isAcknowledgedUnimplemented(operation)\n // R-2: the tool must belong to the server instance it is being called on — so a tool curated\n // onto `support` cannot be invoked at `/mcp` (or at `ops`) even by name. Keeps\n // advertise ≡ callable per (principal, instance).\n && this.isOnMcpServerInstance(operation, instanceRef),\n );\n }\n\n /**\n * A resource is exposable only if its primary scope is in the caller's reachable set. The default\n * (machine) set is ORG / APP — USER_SELF and ANONYMOUS excluded fail-closed; a user-delegated caller\n * passes a set that also includes USER_SELF (see {@link mcpReachableScopesForPrincipal}).\n */\n private isResourceExposable(config: AnyResourceConfiguration, reachableScopes: ReadonlySet<ResourcePrimaryScope>): boolean {\n return reachableScopes.has(config.resourcePrimaryScope);\n }\n\n /**\n * Remove the resource's PRIMARY-SCOPE field from an advertised tool schema.\n *\n * A tool schema is derived from the operation's `requestDto`, and a search or list DTO commonly\n * declares its own scope FK (`organizationId`) among its filterable fields. On the REST plane that\n * is harmless — the field also appears on the URL, and `validateInitiatorCriticalParameters`\n * refuses any request whose sources disagree. Advertised as a TOOL PARAMETER it is neither\n * harmless nor even meaningful: a machine caller's tenant comes from its token, so the only reason\n * to set it is to try another tenant's.\n *\n * The repository now refuses such a call outright, so this is defence in depth rather than the\n * control — but advertising a parameter whose only use is an attack, and which is guaranteed to\n * fail, is a catalogue defect on its own: an agent reading the schema is invited to set it and is\n * then refused for reasons it cannot see.\n *\n * Both nesting positions are stripped, top level and inside `filters`, because the DTO builder\n * places it in either depending on the operation.\n *\n * assurance-control: WILDO.DATA.TENANT_ISOLATION — an agent is never offered its tenant as a knob\n */\n private withoutScopeParameters(schema: Record<string, unknown>, primaryScope: ResourcePrimaryScope): Record<string, unknown> {\n const scopeField = PRIMARY_SCOPE_TO_FIELD_IDENTIFIER[primaryScope];\n if (!scopeField) return schema;\n\n const strip = (node: unknown): unknown => {\n if (!node || typeof node !== 'object') return node;\n const obj = node as Record<string, any>;\n if (!obj.properties || typeof obj.properties !== 'object') return obj;\n const properties: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj.properties as Record<string, unknown>)) {\n if (key === scopeField) continue;\n properties[key] = strip(value);\n }\n const required = Array.isArray(obj.required)\n ? (obj.required as string[]).filter((r) => r !== scopeField)\n : obj.required;\n return { ...obj, properties, ...(required === undefined ? {} : { required }) };\n };\n\n return strip(schema) as Record<string, unknown>;\n }\n\n /**\n * D4 opt-in (fail-closed): an operation is exposed as an MCP tool ONLY when its config\n * explicitly sets `mcp.exposed === true`. Absent/false ⇒ not exposed. This is a discovery\n * gate, NOT authorization — `callTool` still runs `authorizeInController` per call.\n */\n private isMcpExposed(operation: ResourceConfiguration_Operation<any, any, any>): boolean {\n return operation.mcp?.exposed === true;\n }\n\n /**\n * An operation declared a KNOWN implementation gap is never advertised, whatever its config says.\n *\n * `unimplementedAcknowledgement` marks a variant that both unblocks startup AND makes the request\n * refuse, so it can never answer 2xx. Advertising it as a tool tells an agent a capability exists\n * that provably does not: the agent calls it, is refused, and — having no way to distinguish \"not\n * implemented\" from \"bad arguments\" — retries with different arguments and loops. That is the same\n * agent-facing harm the fail-closed opt-in exists to prevent, arriving through a different door.\n *\n * This OVERRIDES the author's opt-in rather than trusting it, because the two declarations are\n * written at different times by different people: `mcp.exposed` is authored when the verb is\n * designed, `unimplementedAcknowledgement` is added later when someone discovers it does not work.\n * A rule that asks the author to remember to also retract the exposure is a rule that will be\n * missed exactly when it matters most.\n */\n private isAcknowledgedUnimplemented(operation: ResourceConfiguration_Operation<any, any, any>): boolean {\n return (operation as { unimplementedAcknowledgement?: unknown }).unimplementedAcknowledgement !== undefined;\n }\n\n /**\n * Instance membership (R-2, multiple named MCP servers). Membership is EXCLUSIVE and defaults safely:\n *\n * - `operation.mcp.servers` ABSENT ⇒ the operation belongs to the DEFAULT server (the plain `/mcp`\n * endpoint) and to no named server. This is what makes multi-server strictly additive: every\n * already-exposed operation keeps appearing exactly where it does today.\n * - `servers` PRESENT ⇒ the operation belongs ONLY to the named servers (it leaves the default\n * catalog). Curating a server is therefore a deliberate move, never an accidental duplication.\n *\n * @param instanceRef - the server being served, or `undefined` for the default server.\n */\n private isOnMcpServerInstance(\n operation: ResourceConfiguration_Operation<any, any, any>,\n instanceRef: string | undefined,\n ): boolean {\n const servers = operation.mcp?.servers;\n if (!servers || servers.length === 0) return instanceRef === undefined;\n return instanceRef !== undefined && servers.includes(instanceRef);\n }\n\n /**\n * Enumerate the exposable default URL-bearing operations of one resource and\n * build their tool descriptors, sorted by operation identifier.\n */\n private buildResourceToolDescriptors(\n config: AnyResourceConfiguration,\n descriptionProvider: McpToolDescriptionProvider | undefined,\n instanceRef: string | undefined,\n ): McpToolDescriptor[] {\n const seen = new Set<string>();\n const descriptors: McpToolDescriptor[] = [];\n\n // The resource's own id field identifier (e.g. `todolistId`). This is the SAME value\n // the transport's `extractResourceId` pulls out of the tool arguments\n // (`MCPControllerBackendService.extractResourceId` reads the identical registry map),\n // so advertising it here keeps advertise ≡ extract for instance-scoped tools.\n const selfFieldIdentifier: string | undefined = this.resourcesRegistry.getAllResourceFieldIdentifiers()[config.resourceIdentifier];\n\n for (const operation of config.operations) {\n const operationIdentifier = String(operation.operationIdentifier);\n // `isDefaultUrlBearingOperation` narrows to API_CALL / API_CALL_WITH_CALLBACK,\n // requires isOperationDefault, and excludes bulk — the exact HTTP-surface set.\n if (!isDefaultUrlBearingOperation(operation, operationIdentifier)) continue;\n // D4 opt-in (fail-closed): only operations that explicitly set `mcp.exposed` are tools.\n if (!this.isMcpExposed(operation)) continue;\n // …and an acknowledged implementation gap is withdrawn even when it opted in.\n if (this.isAcknowledgedUnimplemented(operation)) continue;\n // R-2: only the operations belonging to the server instance being served.\n if (!this.isOnMcpServerInstance(operation, instanceRef)) continue;\n // A resource can carry multiple default url-bearing variants for the same\n // identifier only across data modes; de-dupe by the tool name so `tools/list`\n // never returns two tools with the same name.\n const name = this.buildToolName(config.resourceIdentifier, operationIdentifier);\n // SEP-986 naming (`2025-11-25`). Checked on the COMPOSED name rather than on either half,\n // because that is the string the client parses and the length bound applies to the whole of it.\n // Fail-closed and per-OPERATION: one badly named custom operation withdraws itself, while its\n // resource's other tools keep working — unlike the `__`-separator guard above, which has to\n // skip the whole resource because it corrupts the round-trip identity of every name under it.\n // Mirrored in `resolveExposableOperation`, so the tool is un-callable as well as unadvertised.\n if (!isSpecConformantMcpToolName(name)) {\n this.logger.warn('Skipping MCP exposure for a tool whose name does not satisfy the MCP naming guidance', {\n toolName: name,\n resourceIdentifier: config.resourceIdentifier,\n operationIdentifier,\n allowedCharacters: 'A-Z a-z 0-9 _ - .',\n maxLength: MCP_TOOL_NAME_MAX_LENGTH,\n });\n continue;\n }\n if (seen.has(name)) continue;\n seen.add(name);\n\n // Instance-scoped operation? An entity-level op (READ / UPDATE / DELETE and\n // instance-scoped custom ops) binds the resource's OWN id as a URL path param —\n // `getOperationSegments` stamps it as `{ fieldIdentifier: <selfFieldIdentifier>,\n // resourceType: <this resource> }` (one-to-one / complete-M2M singletons omit it\n // and are identified by parent scope instead). That id lives on the URL, NOT in\n // `requestDto`, so without advertising it the calling agent is never told it must\n // supply an id. `operation` is narrowed to the URL-bearing variant here, so\n // `initiatorInfos` is a safe read.\n const bindsInstanceId = !!selfFieldIdentifier\n && (operation.initiatorInfos ?? []).some((info) =>\n info.parameters.some(\n (parameter) =>\n parameter.fieldIdentifier === selfFieldIdentifier\n && parameter.resourceType === config.resourceIdentifier,\n ),\n );\n\n const baseInputSchema = this.withoutUnsupportedTextSearch(\n convertZodSchemaToMcpInputSchema(this.advertisedRequestSchema(operation)),\n operation,\n );\n // A `{value:...}`-wrapped union/primitive-root DTO is dispatched by the transport WITHOUT\n // an id split — it unwraps the envelope and passes the payload straight through\n // (`MCPControllerBackendService`), so an id must NOT be advertised for it. Only a genuine\n // object-root DTO (or the empty-object no-body case) carries the resource-id, keeping\n // advertise ≡ extract. Gate on the SAME predicate the transport uses, not on the built\n // schema's `type` (the value-wrapper is itself object-root and would slip past a type check).\n const advertisedSchema = bindsInstanceId\n && selfFieldIdentifier\n && !isMcpValueWrappedRequestDto(operation.requestDto)\n ? this.withInstanceIdParameter(baseInputSchema, selfFieldIdentifier, config.resourceIdentifier)\n : baseInputSchema;\n // …then withdraw the SCOPE field, wherever the DTO happens to place it.\n const inputSchema = this.withoutScopeParameters(advertisedSchema, config.resourcePrimaryScope);\n\n const uploadableFileFields = this.uploadableFileFieldsFor(config.resourceIdentifier, operationIdentifier);\n\n descriptors.push({\n name,\n description: this.withUploadGrantNote(\n config.resourceIdentifier,\n operationIdentifier,\n uploadableFileFields,\n this.resolveDescription(config.resourceIdentifier, operationIdentifier, operation, descriptionProvider),\n ),\n inputSchema,\n annotations: this.buildAnnotations(operationIdentifier, operation.riskLevel),\n resourceType: config.resourceIdentifier,\n operationIdentifier,\n });\n\n /*\n * ## Coverage: unit tests only, accepted deliberately — 2026-09-08 (#467)\n *\n * NO application reaches this derivation. Neither dogfood exposes an MCP operation carrying a\n * user-uploadable file field: the two file fields declared belong to `todo-lists` and\n * `knowledge-documents`, neither MCP-exposed, and the only file field on an MCP-exposed\n * resource is `todos.generatedSummaryPdf` — PDF-template generated, and therefore excluded\n * from uploadable fields BY DESIGN. So the derivation below, `resolveUploadGrantTool` and the\n * mint path are covered by unit tests only.\n *\n * Nothing is wrong; the shape that reaches this code simply does not exist in any application.\n * Buying the proof would mean authoring an uploadable file field for the purpose of testing\n * it, which proves the harness more than the product — weighed and accepted.\n *\n * **What would change the answer:** an MCP-exposed resource gaining a user-uploadable file\n * field. That author is the first party to execute this path.\n */\n // Issue #312, D11: one DERIVED upload-grant tool per user-uploadable file field of an exposed\n // CREATE / UPDATE. It inherits every gate the parent just passed (exposure, instance, scope) by\n // construction — it is emitted inside the parent's own iteration — and is resolved back through\n // the parent by `resolveUploadGrantTool`, so advertised ≡ callable holds for it too.\n for (const fileField of uploadableFileFields) {\n const derivedName = this.buildToolName(config.resourceIdentifier, buildUploadGrantToolOperationPart(operationIdentifier, fileFieldRouteSegment(fileField.fieldName)));\n if (!isSpecConformantMcpToolName(derivedName)) {\n // Same withdrawal as the parent's guard above: a name the client could not parse is not\n // advertised, and `resolveUploadGrantTool` mirrors the check so it is not callable either.\n this.logger.warn('Skipping MCP upload-grant tool whose derived name does not satisfy the MCP naming guidance', {\n toolName: derivedName, resourceIdentifier: config.resourceIdentifier, operationIdentifier, fieldName: fileField.fieldName, maxLength: MCP_TOOL_NAME_MAX_LENGTH,\n });\n continue;\n }\n if (seen.has(derivedName)) continue;\n seen.add(derivedName);\n descriptors.push(this.buildUploadGrantDescriptor(config.resourceIdentifier, operationIdentifier, fileField, derivedName, bindsInstanceId ? selfFieldIdentifier : undefined, name));\n }\n }\n\n return descriptors.sort((a, b) => a.operationIdentifier.localeCompare(b.operationIdentifier));\n }\n\n /**\n * The user-uploadable file fields a CREATE / UPDATE operation carries; `[]` for every other operation\n * (a READ or DELETE never receives a file) and whenever no detector is bound.\n */\n private uploadableFileFieldsFor(resourceType: ResourceType, operationIdentifier: string): FileFieldMetadata[] {\n if (operationIdentifier !== String(CoreResourceOperation.CREATE) && operationIdentifier !== String(CoreResourceOperation.UPDATE)) return [];\n if (!this.fileFieldDetection) {\n this.warnOnceNoFileFieldDetection();\n return [];\n }\n return this.fileFieldDetection.getUploadableFileFields(resourceType);\n }\n\n private warnedNoFileFieldDetection = false;\n /**\n * Debug, not warn: the container always binds the detector, so in production this never fires; where\n * it does fire — a harness that constructs the adapter bare — a warning would be noise about a\n * dependency the harness deliberately left out.\n */\n private warnOnceNoFileFieldDetection(): void {\n if (this.warnedNoFileFieldDetection) return;\n this.warnedNoFileFieldDetection = true;\n this.logDebug('No FileFieldDetectionService bound — no upload-grant tool is advertised or callable');\n }\n\n /**\n * Append, to the PARENT tool's description, where each file field's `fileId` comes from. Engine-\n * appended for the same reason as the envelope note: how a file reaches a resource is a framework\n * fact, not app prose, and an agent reading `attachments.fileId: string` would otherwise have no way\n * to learn that the value cannot be invented.\n */\n private withUploadGrantNote(resourceType: ResourceType, operationIdentifier: string, fileFields: FileFieldMetadata[], description: string): string {\n if (fileFields.length === 0) return description;\n const lines = fileFields.map((f) =>\n `\"${f.fieldName}.${f.fileMetadata.multiple ? 'fileIds' : 'fileId'}\" is obtained by calling ${this.buildToolName(resourceType, buildUploadGrantToolOperationPart(operationIdentifier, fileFieldRouteSegment(f.fieldName)))} and uploading the file with the link it returns; a fileId cannot be invented.`);\n return `${description}\n\nFile fields: ${lines.join(' ')}`;\n }\n\n /**\n * The derived upload-grant descriptor. Its arguments are the parent's instance id (UPDATE only —\n * the same id the parent advertises, split out by the transport exactly the same way) and an\n * optional lifetime bounded by the engine ceiling. Nothing about the file itself: bytes never\n * travel through a tool call, which is the whole reason this tool exists.\n */\n private buildUploadGrantDescriptor(\n resourceType: ResourceType,\n parentOperationIdentifier: string,\n fileField: FileFieldMetadata,\n name: string,\n instanceIdField: string | undefined,\n parentToolName: string,\n ): McpToolDescriptor {\n const properties: Record<string, unknown> = {\n ...(instanceIdField ? { [instanceIdField]: { type: 'string', description: `The ${String(resourceType)} record the file is for — the same id ${parentToolName} takes.` } } : {}),\n expiresInMinutes: {\n type: 'integer', minimum: 1, maximum: FILE_UPLOAD_GRANT_ABSOLUTE_MAX_MINUTES,\n description: `How long the link stays usable (default ${FILE_UPLOAD_GRANT_DEFAULT_MINUTES}, at most ${FILE_UPLOAD_GRANT_ABSOLUTE_MAX_MINUTES}).`,\n },\n // Declaring the file up front lets the server refuse an impossible one BEFORE a link exists — the\n // same facts the MCP File Objects proposal has a client declare when it asks to upload.\n name: { type: 'string', maxLength: 255, description: 'The file name you intend to upload (used in the returned command).' },\n mimeType: { type: 'string', maxLength: 255, description: `Declared MIME type; refused now if the field does not accept it (accepted: ${(fileField.fileMetadata.allowedMimeTypes as string[] | undefined)?.join(', ') || 'any'}).` },\n size: { type: 'integer', minimum: 1, description: 'Declared size in bytes; refused now if above the field maximum.' },\n };\n const target = `the \"${fileField.fieldName}\" file of a ${String(resourceType)} record (${parentOperationIdentifier})`;\n return {\n name,\n description:\n `Mint a single-use upload link for ${target}. NOTHING is uploaded by this call and no bytes ever travel through a tool call. `\n + 'It returns uploadCommand — run it if you can execute commands and the file is on your filesystem — and uploadPageUrl — show it to the user otherwise, so they can drop the file in their browser. '\n + 'The link is not the caller\\'s credential: it unlocks exactly ONE upload of ONE file into this field and then dies. '\n + `Afterwards read the produced fileId (from the upload response, or from statusUrl if a human uploaded) and pass it as \"${fileField.fieldName}.${fileField.fileMetadata.multiple ? 'fileIds' : 'fileId'}\" in ${parentToolName}. `\n + 'If the link expires or the upload is refused, call this again.',\n inputSchema: { type: 'object', properties, ...(instanceIdField ? { required: [instanceIdField] } : {}), additionalProperties: false },\n annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },\n resourceType,\n operationIdentifier: buildUploadGrantToolOperationPart(parentOperationIdentifier, fileFieldRouteSegment(fileField.fieldName)),\n };\n }\n\n /**\n * Resolve a DERIVED upload-grant tool back to its parent operation and file field — the callable\n * half of `buildToolDescriptors`' derived emission, kept symmetric with it: the parent is resolved\n * through `resolveExposableOperation` (so exposure, instance and principal-scope gating are\n * inherited verbatim), the field must be one of the resource's uploadable file fields, and the\n * composed name must satisfy the naming guidance. `undefined` for anything that is not a well-formed,\n * advertised derived tool.\n */\n resolveUploadGrantTool(\n resourceType: ResourceType,\n operationPart: string,\n reachableScopes: ReadonlySet<ResourcePrimaryScope>,\n instanceRef?: string,\n ): { parentOperation: ResourceConfiguration_Operation<any, any, any>; fieldName: string; operationKind: FileUploadGrantOperation } | undefined {\n const parsed = parseUploadGrantToolOperationPart(operationPart);\n if (!parsed) return undefined;\n const kind = parsed.parentOperationIdentifier;\n if (kind !== String(CoreResourceOperation.CREATE) && kind !== String(CoreResourceOperation.UPDATE)) return undefined;\n if (!isSpecConformantMcpToolName(this.buildToolName(resourceType, operationPart))) return undefined;\n const parentOperation = this.resolveExposableOperation(resourceType, kind, reachableScopes, instanceRef);\n if (!parentOperation) return undefined;\n const field = this.uploadableFileFieldsFor(resourceType, kind).find((f) => fileFieldRouteSegment(f.fieldName) === parsed.fieldRouteSegment);\n if (!field) return undefined;\n return { parentOperation, fieldName: field.fieldName, operationKind: kind as FileUploadGrantOperation };\n }\n\n /** `<resourceIdentifier>__<operationIdentifier>`. */\n private buildToolName(resourceIdentifier: ResourceType, operationIdentifier: string): string {\n return `${String(resourceIdentifier)}${MCP_TOOL_NAME_SEPARATOR}${operationIdentifier}`;\n }\n\n /**\n * Advertise the resource's own id as a REQUIRED string on an instance-scoped tool's\n * `inputSchema`, mirroring the URL path parameter the transport splits back out\n * (`MCPControllerBackendService.extractResourceId`). Without it, an agent reading the\n * schema is never told it must supply the id, so instance READ / UPDATE / DELETE tools\n * are un-invokable as advertised.\n *\n * Only OBJECT-root schemas are augmented: a `{value:...}`-wrapped union/primitive-root\n * DTO (e.g. a discriminated-union create) is dispatched WITHOUT an id split by the\n * transport, so injecting an id there would break the advertise ≡ extract symmetry.\n * `instanceIdField` is the resource's registry field identifier — the exact key the\n * transport reads back — so a compliant agent supplies it under the name the server expects.\n */\n private withInstanceIdParameter(\n baseInputSchema: Record<string, unknown>,\n instanceIdField: string,\n resourceType: ResourceType,\n ): Record<string, unknown> {\n if (baseInputSchema.type !== 'object') return baseInputSchema;\n const properties: Record<string, unknown> = {\n ...(baseInputSchema.properties as Record<string, unknown> | undefined),\n [instanceIdField]: {\n type: 'string',\n description: `Identifier of the ${String(resourceType)} record to act on (URL path parameter).`,\n },\n };\n const required: string[] = Array.isArray(baseInputSchema.required)\n ? [...(baseInputSchema.required as string[])]\n : [];\n if (!required.includes(instanceIdField)) required.push(instanceIdField);\n return { ...baseInputSchema, properties, required };\n }\n\n /**\n * Prefer spec-sourced prose from the injected provider; fall back to a\n * synthesized description built from the operation's own config metadata.\n */\n private resolveDescription(\n resourceType: ResourceType,\n operationIdentifier: string,\n operation: ResourceConfiguration_Operation<any, any, any>,\n descriptionProvider: McpToolDescriptionProvider | undefined,\n ): string {\n // D4: an authored `mcp.description` on the operation config wins — it is the\n // agent-facing tool description the app author wrote explicitly for this tool.\n const authored = operation.mcp?.description?.trim();\n if (authored) return this.withEnvelopeNote(operation, authored);\n const spec = descriptionProvider?.(resourceType, operationIdentifier);\n if (spec && (spec.purpose || spec.whenToUse)) {\n const parts: string[] = [];\n if (spec.purpose) parts.push(spec.purpose.trim());\n if (spec.whenToUse) parts.push(`When to use: ${spec.whenToUse.trim()}`);\n return this.withEnvelopeNote(operation, parts.join('\\n\\n'));\n }\n return this.withEnvelopeNote(operation, this.synthesizeDescription(resourceType, operationIdentifier, operation));\n }\n\n /**\n * Name the `{ value: … }` envelope, because nothing else does.\n *\n * A resource whose main schema is a FAMILY (a discriminated union) produces a union-root request\n * DTO, which the transport wraps as `{ value: <payload> }` — so `todos__create` advertises one\n * opaque `value` property carrying a `oneOf`, where its sibling `tasks__create` advertises eight\n * named fields. The schema is correct and an agent that validates against it succeeds; the hazard\n * is the DESCRIPTION, which an app author writes about the payload (\"provide a title; optionally\n * description, priority…\") and which therefore describes the INSIDE of an envelope it never\n * mentions. An agent that reads the prose and skips the schema builds `{title}` and is rejected.\n *\n * Appended by the ENGINE rather than asked of the author, deliberately: the envelope is an artefact\n * of how the framework compiles a schema family, so requiring every app author to hand-write it\n * would push an engine internal into app prose and go stale the moment a resource stops being\n * polymorphic. The note is derived from the same predicate the transport uses to decide whether to\n * unwrap, so it appears exactly when the envelope is real.\n */\n private withEnvelopeNote(operation: ResourceConfiguration_Operation<any, any, any>, description: string): string {\n if (!isMcpValueWrappedRequestDto(operation.requestDto)) return description;\n return `${description}\\n\\nArguments must be wrapped: pass the payload as the \"value\" property (this resource accepts several shapes, listed under \"value\" in the input schema).`;\n }\n\n /**\n * Minimal fallback description from config metadata. Honest about being\n * auto-generated so an operator can tell which tools still need authored prose.\n */\n private synthesizeDescription(\n resourceType: ResourceType,\n operationIdentifier: string,\n operation: ResourceConfiguration_Operation<any, any, any>,\n ): string {\n const riskNote = DESTRUCTIVE_RISK_LEVELS.has(operation.riskLevel)\n ? ` (risk: ${operation.riskLevel})`\n : '';\n return `Perform the \"${operationIdentifier}\" operation on ${String(resourceType)} resources${riskNote}.`;\n }\n\n /**\n * Withdraw `filters.searchRequest` from an operation that cannot perform a text search.\n *\n * The shared collection envelope extends a BASE filter schema that always carries\n * `searchRequest`, because it was written for SEARCH. Advertising it on an operation that does not\n * declare `isSearchable` would promise a text search the repository refuses outright\n * (`REPOSITORY_RESOURCE_SEARCH_NOT_ENABLED`) — or, worse on the LIST path, one that is quietly\n * discarded by the filter allow-list, handing the agent an UNFILTERED collection it believes was\n * narrowed. That is the exact failure the collection normalisation was introduced to end, and\n * reintroducing it while fixing its mirror image would be a poor trade.\n *\n * `createdAt` / `updatedAt` stay: generic date-range filtering IS translated for any collection\n * operation, so those two are honoured wherever they are advertised.\n */\n private withoutUnsupportedTextSearch(\n schema: Record<string, unknown>,\n operation: ResourceConfiguration_Operation<any, any, any>,\n ): Record<string, unknown> {\n if ((operation as { isSearchable?: boolean }).isSearchable) return schema;\n const schemaProperties = schema.properties as Record<string, unknown> | undefined;\n const filters = schemaProperties?.filters as { properties?: Record<string, unknown>; required?: string[] } | undefined;\n if (!filters?.properties || !('searchRequest' in filters.properties)) return schema;\n const { searchRequest: _withdrawn, ...remainingFilterProperties } = filters.properties;\n return {\n ...schema,\n properties: {\n ...schemaProperties,\n filters: {\n ...filters,\n properties: remainingFilterProperties,\n ...(filters.required ? { required: filters.required.filter((name) => name !== 'searchRequest') } : {}),\n },\n },\n };\n }\n\n /**\n * The schema this tool ADVERTISES as its arguments.\n *\n * For almost every operation that is simply `requestDto`. Collection-shaped operations are the\n * exception, and the reason is a split between two contracts that only LOOKS like one:\n *\n * - **SEARCH** is a POST; the factory promotes its `searchQueryRequestSchema` to `requestDto`, so\n * `{ filters, pagination, sorting }` is already advertised.\n * - **LIST / COUNT** are GETs. Their filters travel in the QUERY STRING, so their `requestDto`\n * stays `z.object({})` — correctly, because giving a GET a request body would misdescribe the\n * REST contract and the generated OpenAPI.\n *\n * But MCP has no query string. `McpServerBackendService.toDispatchArguments` routes EVERY\n * collection-shaped operation through `normalizeCollectionQueryRequestData`, bypassing the strict\n * `requestDto.parse` entirely — so a LIST tool has always ACCEPTED `{ filters, pagination,\n * sorting }` and applied the operation's filter allow-list to it. It just advertised\n * `{properties:{}, additionalProperties:false}`, which tells a conformant agent the opposite: that\n * arguments are forbidden.\n *\n * That is this surface's own \"the advertised contract is not the enforced contract\" defect,\n * inverted. The earlier instance advertised filters and silently ignored them; this one accepts\n * filters and refuses to admit it. An agent could only discover the capability by violating the\n * schema it was given.\n *\n * The envelope is built from the SAME `filterFields` / `sortFields` the dispatch allow-lists\n * against, through the same builder the factory uses for SEARCH — so advertise ≡ extract holds by\n * construction rather than by two definitions happening to agree.\n *\n * `requestDto` is deliberately NOT modified: the REST contract, the OpenAPI document and the\n * response shape are all untouched by this. Only what MCP tells an agent changes.\n */\n private advertisedRequestSchema(operation: ResourceConfiguration_Operation<any, any, any>): z.ZodTypeAny | undefined {\n if (!isCollectionQueryMcpOperation(resolveEffectiveMcpOperation(operation))) return operation.requestDto;\n // A collection operation that already advertises a non-empty contract (SEARCH, or any operation\n // carrying an explicit authored `requestDto`) is left exactly as authored — this fills a gap, it\n // does not override an author.\n const advertised = convertZodSchemaToMcpInputSchema(operation.requestDto);\n if (Object.keys(advertised.properties ?? {}).length > 0) return operation.requestDto;\n\n const { filterFields, sortFields } = operation as unknown as {\n filterFields?: Record<string, unknown>;\n sortFields?: readonly string[];\n };\n // Nothing declared to filter or sort by ⇒ nothing to advertise beyond pagination. Emitting the\n // envelope anyway is still right: pagination is what makes a collection tool usable past its\n // first page, and it needs no per-resource declaration.\n const primitiveFilterFields: Record<string, any> = {};\n Object.entries(filterFields ?? {}).forEach(([key, value]) => {\n // A FUNCTION-valued entry is a filter REFERENCE (a cross-resource pointer the factory resolves\n // elsewhere), not a schema — the same exclusion the factory applies when it builds SEARCH's\n // envelope. Advertising it would put an uncallable key in front of the agent.\n if (typeof value !== 'function') primitiveFilterFields[key] = value;\n });\n\n return createResourceSearchQueryRequestSchema({\n filterFields: primitiveFilterFields,\n allowedSortFields: sortFields ?? [],\n pagination: true,\n });\n }\n\n /**\n * Behaviour hints from the operation identifier + risk level.\n *\n * Every one of these has a DEFAULT in the specification, so an omitted hint is not a neutral\n * silence — it is an assertion of that default. Two of them defaulted against us:\n *\n * - `openWorldHint` defaults to **true**, so omitting it advertised every Wildo tool as\n * potentially reaching arbitrary external systems. It is always `false` here: a tool operates on\n * this application's own resources, through its own authorization, and reaches nothing else.\n * - `idempotentHint` defaults to **false**, i.e. \"retrying may double the effect\" — true for\n * CREATE, wrong for UPDATE and DELETE. This is the hint an agent uses to decide whether a retry\n * after a timeout is safe, which makes the wrong default an availability problem, not a\n * cosmetic one.\n *\n * `idempotentHint` is emitted ONLY for writes because the specification defines it as \"meaningful\n * only when `readOnlyHint == false`\". `destructiveHint` is emitted unconditionally despite the same\n * caveat: `false` is TRUE of a read tool, and a client that reads it without first checking\n * `readOnlyHint` is safer for having it.\n *\n * spec-cite: MCP 2026-07-28 — `ToolAnnotations`, `idempotentHint` and `destructiveHint` doc\n * comments (\"(This property is meaningful only when `readOnlyHint == false`)\"), and the `Default:`\n * lines on `openWorldHint` (true), `idempotentHint` (false) and `destructiveHint` (true).\n * <https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/2026-07-28/schema.ts>\n */\n private buildAnnotations(operationIdentifier: string, riskLevel: ResourceOperationRiskLevel): McpToolAnnotations {\n const readOnlyHint = READ_ONLY_CORE_OPERATIONS.has(operationIdentifier);\n const destructiveHint = operationIdentifier === String(CoreResourceOperation.DELETE)\n || DESTRUCTIVE_RISK_LEVELS.has(riskLevel);\n return {\n readOnlyHint,\n destructiveHint,\n ...(readOnlyHint ? {} : { idempotentHint: IDEMPOTENT_WRITE_CORE_OPERATIONS.has(operationIdentifier) }),\n openWorldHint: false,\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.backend.controller.d.ts","sourceRoot":"","sources":["../../../../../../src/monitoring/analytics/controllers/analytics.backend.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,kEAAkE,CAAC;AACvG,OAAO,EAAE,gCAAgC,EAAE,MAAM,0FAA0F,CAAC;AAC5I,OAAO,EAAE,qCAAqC,EAAE,MAAM,+EAA+E,CAAC;AACtI,OAAO,EAAE,+BAA+B,EAAE,MAAM,sFAAsF,CAAC;AACvI,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,oFAAoF,CAAC;AAEpJ,qBACa,0BAA2B,SAAQ,gCAAgC;IAKV,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAC5D,OAAO,CAAC,MAAM;IACJ,OAAO,CAAC,iBAAiB;gBAL9C,MAAM,EAAE,aAAa,EACR,YAAY,EAAE,0BAA0B,EACxC,YAAY,EAAE,mBAAmB,EACE,uBAAuB,EAAE,qCAAqC,EAC3F,MAAM,EAAE,+BAA+B,EAC7B,iBAAiB,EAAE,yCAAyC;IAK9H,SAAS,CAAC,WAAW,IAAI,IAAI;IAO7B;;;OAGG;YACW,YAAY;IA4B1B;;;OAGG;YACW,kBAAkB;IAMhC;;OAEG;YACW,kBAAkB;IA4BhC;;;OAGG;YACW,uBAAuB;CAItC"}
1
+ {"version":3,"file":"analytics.backend.controller.d.ts","sourceRoot":"","sources":["../../../../../../src/monitoring/analytics/controllers/analytics.backend.controller.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,kEAAkE,CAAC;AACvG,OAAO,EAAE,gCAAgC,EAAE,MAAM,0FAA0F,CAAC;AAC5I,OAAO,EAAE,qCAAqC,EAAE,MAAM,+EAA+E,CAAC;AACtI,OAAO,EAAE,+BAA+B,EAAE,MAAM,sFAAsF,CAAC;AAEvI,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,oFAAoF,CAAC;AAEpJ,qBACa,0BAA2B,SAAQ,gCAAgC;IAKV,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAC5D,OAAO,CAAC,MAAM;IACJ,OAAO,CAAC,iBAAiB;gBAL9C,MAAM,EAAE,aAAa,EACR,YAAY,EAAE,0BAA0B,EACxC,YAAY,EAAE,mBAAmB,EACE,uBAAuB,EAAE,qCAAqC,EAC3F,MAAM,EAAE,+BAA+B,EAC7B,iBAAiB,EAAE,yCAAyC;IAK9H,SAAS,CAAC,WAAW,IAAI,IAAI;IAO7B;;;OAGG;YACW,YAAY;IAqC1B;;;OAGG;YACW,kBAAkB;IAShC;;OAEG;YACW,kBAAkB;IAiEhC;;;OAGG;YACW,uBAAuB;CAItC"}
@@ -19,6 +19,7 @@ import { ErrorHandlerService } from '../../../errors/services/error-handler.back
19
19
  import { AbstractControllerBackendService } from '../../../base-classes/services/controllers/abstract-controller.backend.service.js';
20
20
  import { ExecutionContextCreatorBackendService } from '../../../runtime/services/execution-context-creator.backend.service.js';
21
21
  import { ValueMomentEngineBackendService } from '../../../monitoring/analytics/services/value-moment-engine.backend.service.js';
22
+ import { ValueMomentWriteOutcome } from '../../../monitoring/analytics/services/value-moment-engine.backend.service.js';
22
23
  let AnalyticsBackendController = class AnalyticsBackendController extends AbstractControllerBackendService {
23
24
  executionContextCreator;
24
25
  engine;
@@ -55,7 +56,16 @@ let AnalyticsBackendController = class AnalyticsBackendController extends Abstra
55
56
  resourceType: event.properties.resourceType ?? 'unknown',
56
57
  operationIdentifier: event.properties.operation ?? 'unknown',
57
58
  operationResult: event.properties,
58
- executionContext,
59
+ /*
60
+ * The IDENTITY, not the whole execution context. The engine resolves which progression-
61
+ * state row to write from the user and organization ids and needs nothing else; handing it
62
+ * the context would let a future change read request-shaped state inside an evaluator that
63
+ * also runs from a cron and from a worker.
64
+ */
65
+ principal: {
66
+ userId: executionContext.initiatorIds?.userId,
67
+ organizationId: executionContext.initiatorIds?.organizationId,
68
+ },
59
69
  }).catch(err => this.logger.error('[Analytics] Signal evaluation failed', err));
60
70
  }
61
71
  }
@@ -67,7 +77,10 @@ let AnalyticsBackendController = class AnalyticsBackendController extends Abstra
67
77
  */
68
78
  async getAchievedMoments(req, res, _next) {
69
79
  const executionContext = await this.executionContextCreator.createExecutionContextForManualController(req);
70
- const moments = await this.engine.getAchievedMoments(executionContext);
80
+ const moments = await this.engine.getAchievedMoments({
81
+ userId: executionContext.initiatorIds?.userId,
82
+ organizationId: executionContext.initiatorIds?.organizationId,
83
+ });
71
84
  res.json({ moments: moments.map(m => m.momentIdentifier) });
72
85
  }
73
86
  /**
@@ -92,8 +105,40 @@ let AnalyticsBackendController = class AnalyticsBackendController extends Abstra
92
105
  return;
93
106
  }
94
107
  }
95
- await this.engine.markAchieved(momentIdentifier, executionContext, scope);
96
- res.status(201).json({ success: true, momentIdentifier });
108
+ /*
109
+ * ─── THE STATUS CODE FOLLOWS THE OUTCOME ───────────────────────────────────────────────────
110
+ *
111
+ * This answered 201 unconditionally while the engine behind it stored nothing (#414), so a
112
+ * caller could not tell an accepted write from a discarded one — the part of the placeholder
113
+ * engine that actively misled rather than merely under-delivering.
114
+ *
115
+ * RECORDED 201 — newly achieved and persisted.
116
+ * ALREADY_ACHIEVED 200 — success, and nothing changed. Distinct from 201 because a value
117
+ * moment is achieved ONCE; a client re-syncing its local set must be able to
118
+ * tell that it did not just cause anything.
119
+ * SCOPE_UNAVAILABLE 422 — the request is well-formed and the moment is real, but the scope it
120
+ * measures is not present on this execution. Not 403: nothing was forbidden.
121
+ * NOT_PERSISTED 503 — the store could not be reached. The honest answer, and the one that
122
+ * makes the frontend retry rather than mark the moment done locally.
123
+ */
124
+ const outcome = await this.engine.markAchieved(momentIdentifier, {
125
+ userId: executionContext.initiatorIds?.userId,
126
+ organizationId: executionContext.initiatorIds?.organizationId,
127
+ }, scope);
128
+ switch (outcome) {
129
+ case ValueMomentWriteOutcome.RECORDED:
130
+ res.status(201).json({ success: true, momentIdentifier, outcome });
131
+ return;
132
+ case ValueMomentWriteOutcome.ALREADY_ACHIEVED:
133
+ res.status(200).json({ success: true, momentIdentifier, outcome });
134
+ return;
135
+ case ValueMomentWriteOutcome.SCOPE_UNAVAILABLE:
136
+ res.status(422).json({ success: false, momentIdentifier, outcome, error: 'The scope this moment measures is not present on this execution' });
137
+ return;
138
+ case ValueMomentWriteOutcome.NOT_PERSISTED:
139
+ res.status(503).json({ success: false, momentIdentifier, outcome, error: 'Value moment could not be persisted' });
140
+ return;
141
+ }
97
142
  }
98
143
  /**
99
144
  * Return all registered milestone definitions.
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.backend.controller.js","sourceRoot":"","sources":["../../../../../../src/monitoring/analytics/controllers/analytics.backend.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,6BAA6B,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MA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,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAChE,WAAA,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;IAC5C,WAAA,MAAM,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,CAAA;qCALZ,aAAa;QACM,0BAA0B;QAC1B,mBAAmB;QAC2B,qCAAqC;QACnF,+BAA+B;GANpF,0BAA0B,CAoGtC","sourcesContent":["import { injectable, inject } from 'inversify';\nimport { Request, Response, NextFunction } from 'express';\nimport { AnalyticsEventName, MANUAL_CONTROLLER_ROUTES_URLS, ManualControllerRouteKey, ValueMomentScope } from '@wildo-ai/saas-models';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ErrorHandlerService } from '~wildo-backend-lib/errors/services/error-handler.backend.service';\nimport { AbstractControllerBackendService } from '~wildo-backend-lib/base-classes/services/controllers/abstract-controller.backend.service';\nimport { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport { ValueMomentEngineBackendService } from '~wildo-backend-lib/monitoring/analytics/services/value-moment-engine.backend.service';\nimport type { MilestoneDefinitionRegistryBackendService } from '~wildo-backend-lib/guidance/services/milestone-definition-registry.backend.service';\n\n@injectable()\nexport class AnalyticsBackendController extends AbstractControllerBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorHandlerService) errorHandler: ErrorHandlerService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.ValueMomentEngine) private engine: ValueMomentEngineBackendService,\n @inject(SAAS_SERVICE_TYPES.MilestoneDefinitionRegistry) private milestoneRegistry: MilestoneDefinitionRegistryBackendService,\n ) {\n super(logger, errorBuilder, errorHandler, 'AnalyticsBackendController');\n }\n\n protected setupRoutes(): void {\n this.router.post(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.ANALYTICS_EVENTS], this.asyncHandler(this.ingestEvents.bind(this)));\n this.router.get(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.ANALYTICS_MOMENTS_ACHIEVED], this.asyncHandler(this.getAchievedMoments.bind(this)));\n this.router.post(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.ANALYTICS_MOMENTS_ACHIEVED], this.asyncHandler(this.markMomentAchieved.bind(this)));\n this.router.get(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.PROGRESSION_MILESTONES], this.asyncHandler(this.getMilestoneDefinitions.bind(this)));\n }\n\n /**\n * Ingest a batch of analytics events from the frontend BackendProxyAnalyticsProvider.\n * Accepts { events: AnalyticsEvent[], userId?: string } and returns 202 Accepted.\n */\n private async ingestEvents(req: Request, res: Response, _next: NextFunction): Promise<void> {\n const { events } = req.body ?? {};\n const eventList = Array.isArray(events) ? events.slice(0, 500) : [];\n\n if (eventList.length === 0) {\n res.status(400).json({ error: 'No valid events provided' });\n return;\n }\n\n const executionContext = await this.executionContextCreator.createExecutionContextForManualController(req);\n const userId = executionContext.initiatorIds?.userId ?? 'anonymous';\n\n this.logDebug(`[Analytics] Ingested ${eventList.length} events from user=${userId}`);\n\n for (const event of eventList) {\n if (event?.name === AnalyticsEventName.RESOURCE_OPERATION && event?.properties) {\n this.engine.evaluateOperationSignal({\n resourceType: event.properties.resourceType ?? 'unknown',\n operationIdentifier: event.properties.operation ?? 'unknown',\n operationResult: event.properties,\n executionContext,\n }).catch(err => this.logger.error('[Analytics] Signal evaluation failed', err));\n }\n }\n\n res.status(202).json({ accepted: eventList.length });\n }\n\n /**\n * Return the list of achieved value moment identifiers for the current execution context.\n * Frontend expects { moments: string[] }.\n */\n private async getAchievedMoments(req: Request, res: Response, _next: NextFunction): Promise<void> {\n const executionContext = await this.executionContextCreator.createExecutionContextForManualController(req);\n const moments = await this.engine.getAchievedMoments(executionContext);\n res.json({ moments: moments.map(m => m.momentIdentifier) });\n }\n\n /**\n * Mark a specific value moment as achieved.\n */\n private async markMomentAchieved(req: Request, res: Response, _next: NextFunction): Promise<void> {\n const { momentIdentifier, scope } = req.body ?? {};\n\n if (!momentIdentifier) {\n res.status(400).json({ error: 'momentIdentifier is required' });\n return;\n }\n\n const validScopes = Object.values(ValueMomentScope) as string[];\n if (scope && !validScopes.includes(scope)) {\n res.status(400).json({ error: `Invalid scope: ${scope}. Must be one of: ${validScopes.join(', ')}` });\n return;\n }\n\n const executionContext = await this.executionContextCreator.createExecutionContextForManualController(req);\n\n if (scope === ValueMomentScope.ORGANIZATION) {\n const orgId = executionContext.initiatorIds?.organizationId;\n if (!orgId) {\n res.status(403).json({ error: 'Organization-scoped moments require an active organization context' });\n return;\n }\n }\n\n await this.engine.markAchieved(momentIdentifier, executionContext, scope);\n res.status(201).json({ success: true, momentIdentifier });\n }\n\n /**\n * Return all registered milestone definitions.\n * Frontend uses this to render milestone trackers, browse milestones, etc.\n */\n private async getMilestoneDefinitions(_req: Request, res: Response, _next: NextFunction): Promise<void> {\n const definitions = this.milestoneRegistry.getAllDefinitions();\n res.json({ definitions });\n }\n}\n"]}
1
+ {"version":3,"file":"analytics.backend.controller.js","sourceRoot":"","sources":["../../../../../../src/monitoring/analytics/controllers/analytics.backend.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE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,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAChE,WAAA,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA;IAC5C,WAAA,MAAM,CAAC,kBAAkB,CAAC,2BAA2B,CAAC,CAAA;qCALZ,aAAa;QACM,0BAA0B;QAC1B,mBAAmB;QAC2B,qCAAqC;QACnF,+BAA+B;GANpF,0BAA0B,CAqJtC","sourcesContent":["import { injectable, inject } from 'inversify';\nimport { Request, Response, NextFunction } from 'express';\nimport { AnalyticsEventName, MANUAL_CONTROLLER_ROUTES_URLS, ManualControllerRouteKey, ValueMomentScope } from '@wildo-ai/saas-models';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { ErrorHandlerService } from '~wildo-backend-lib/errors/services/error-handler.backend.service';\nimport { AbstractControllerBackendService } from '~wildo-backend-lib/base-classes/services/controllers/abstract-controller.backend.service';\nimport { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport { ValueMomentEngineBackendService } from '~wildo-backend-lib/monitoring/analytics/services/value-moment-engine.backend.service';\nimport { ValueMomentWriteOutcome } from '~wildo-backend-lib/monitoring/analytics/services/value-moment-engine.backend.service';\nimport type { MilestoneDefinitionRegistryBackendService } from '~wildo-backend-lib/guidance/services/milestone-definition-registry.backend.service';\n\n@injectable()\nexport class AnalyticsBackendController extends AbstractControllerBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorHandlerService) errorHandler: ErrorHandlerService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.ValueMomentEngine) private engine: ValueMomentEngineBackendService,\n @inject(SAAS_SERVICE_TYPES.MilestoneDefinitionRegistry) private milestoneRegistry: MilestoneDefinitionRegistryBackendService,\n ) {\n super(logger, errorBuilder, errorHandler, 'AnalyticsBackendController');\n }\n\n protected setupRoutes(): void {\n this.router.post(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.ANALYTICS_EVENTS], this.asyncHandler(this.ingestEvents.bind(this)));\n this.router.get(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.ANALYTICS_MOMENTS_ACHIEVED], this.asyncHandler(this.getAchievedMoments.bind(this)));\n this.router.post(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.ANALYTICS_MOMENTS_ACHIEVED], this.asyncHandler(this.markMomentAchieved.bind(this)));\n this.router.get(MANUAL_CONTROLLER_ROUTES_URLS[ManualControllerRouteKey.PROGRESSION_MILESTONES], this.asyncHandler(this.getMilestoneDefinitions.bind(this)));\n }\n\n /**\n * Ingest a batch of analytics events from the frontend BackendProxyAnalyticsProvider.\n * Accepts { events: AnalyticsEvent[], userId?: string } and returns 202 Accepted.\n */\n private async ingestEvents(req: Request, res: Response, _next: NextFunction): Promise<void> {\n const { events } = req.body ?? {};\n const eventList = Array.isArray(events) ? events.slice(0, 500) : [];\n\n if (eventList.length === 0) {\n res.status(400).json({ error: 'No valid events provided' });\n return;\n }\n\n const executionContext = await this.executionContextCreator.createExecutionContextForManualController(req);\n const userId = executionContext.initiatorIds?.userId ?? 'anonymous';\n\n this.logDebug(`[Analytics] Ingested ${eventList.length} events from user=${userId}`);\n\n for (const event of eventList) {\n if (event?.name === AnalyticsEventName.RESOURCE_OPERATION && event?.properties) {\n this.engine.evaluateOperationSignal({\n resourceType: event.properties.resourceType ?? 'unknown',\n operationIdentifier: event.properties.operation ?? 'unknown',\n operationResult: event.properties,\n /*\n * The IDENTITY, not the whole execution context. The engine resolves which progression-\n * state row to write from the user and organization ids and needs nothing else; handing it\n * the context would let a future change read request-shaped state inside an evaluator that\n * also runs from a cron and from a worker.\n */\n principal: {\n userId: executionContext.initiatorIds?.userId,\n organizationId: executionContext.initiatorIds?.organizationId,\n },\n }).catch(err => this.logger.error('[Analytics] Signal evaluation failed', err));\n }\n }\n\n res.status(202).json({ accepted: eventList.length });\n }\n\n /**\n * Return the list of achieved value moment identifiers for the current execution context.\n * Frontend expects { moments: string[] }.\n */\n private async getAchievedMoments(req: Request, res: Response, _next: NextFunction): Promise<void> {\n const executionContext = await this.executionContextCreator.createExecutionContextForManualController(req);\n const moments = await this.engine.getAchievedMoments({\n userId: executionContext.initiatorIds?.userId,\n organizationId: executionContext.initiatorIds?.organizationId,\n });\n res.json({ moments: moments.map(m => m.momentIdentifier) });\n }\n\n /**\n * Mark a specific value moment as achieved.\n */\n private async markMomentAchieved(req: Request, res: Response, _next: NextFunction): Promise<void> {\n const { momentIdentifier, scope } = req.body ?? {};\n\n if (!momentIdentifier) {\n res.status(400).json({ error: 'momentIdentifier is required' });\n return;\n }\n\n const validScopes = Object.values(ValueMomentScope) as string[];\n if (scope && !validScopes.includes(scope)) {\n res.status(400).json({ error: `Invalid scope: ${scope}. Must be one of: ${validScopes.join(', ')}` });\n return;\n }\n\n const executionContext = await this.executionContextCreator.createExecutionContextForManualController(req);\n\n if (scope === ValueMomentScope.ORGANIZATION) {\n const orgId = executionContext.initiatorIds?.organizationId;\n if (!orgId) {\n res.status(403).json({ error: 'Organization-scoped moments require an active organization context' });\n return;\n }\n }\n\n /*\n * ─── THE STATUS CODE FOLLOWS THE OUTCOME ───────────────────────────────────────────────────\n *\n * This answered 201 unconditionally while the engine behind it stored nothing (#414), so a\n * caller could not tell an accepted write from a discarded one — the part of the placeholder\n * engine that actively misled rather than merely under-delivering.\n *\n * RECORDED 201 — newly achieved and persisted.\n * ALREADY_ACHIEVED 200 — success, and nothing changed. Distinct from 201 because a value\n * moment is achieved ONCE; a client re-syncing its local set must be able to\n * tell that it did not just cause anything.\n * SCOPE_UNAVAILABLE 422 — the request is well-formed and the moment is real, but the scope it\n * measures is not present on this execution. Not 403: nothing was forbidden.\n * NOT_PERSISTED 503 — the store could not be reached. The honest answer, and the one that\n * makes the frontend retry rather than mark the moment done locally.\n */\n const outcome = await this.engine.markAchieved(\n momentIdentifier,\n {\n userId: executionContext.initiatorIds?.userId,\n organizationId: executionContext.initiatorIds?.organizationId,\n },\n scope,\n );\n\n switch (outcome) {\n case ValueMomentWriteOutcome.RECORDED:\n res.status(201).json({ success: true, momentIdentifier, outcome });\n return;\n case ValueMomentWriteOutcome.ALREADY_ACHIEVED:\n res.status(200).json({ success: true, momentIdentifier, outcome });\n return;\n case ValueMomentWriteOutcome.SCOPE_UNAVAILABLE:\n res.status(422).json({ success: false, momentIdentifier, outcome, error: 'The scope this moment measures is not present on this execution' });\n return;\n case ValueMomentWriteOutcome.NOT_PERSISTED:\n res.status(503).json({ success: false, momentIdentifier, outcome, error: 'Value moment could not be persisted' });\n return;\n }\n }\n\n /**\n * Return all registered milestone definitions.\n * Frontend uses this to render milestone trackers, browse milestones, etc.\n */\n private async getMilestoneDefinitions(_req: Request, res: Response, _next: NextFunction): Promise<void> {\n const definitions = this.milestoneRegistry.getAllDefinitions();\n res.json({ definitions });\n }\n}\n"]}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The registered value-moment definitions, indexed by what can trigger them.
3
+ *
4
+ * Mirrors `MilestoneDefinitionRegistryBackendService` deliberately: same registration-at-startup
5
+ * shape, same trigger index, same fail-fast validation. The two vocabularies are distinct (a
6
+ * milestone is authored progression; a value moment is a measured behavioural moment with a role, a
7
+ * composition mode and typed signals) but the REGISTRY problem is identical, and solving it a second
8
+ * way would have produced two answers to "which definitions does this operation touch".
9
+ *
10
+ * Before #414 nothing registered these at all. The definitions were read once at startup, purely to
11
+ * warn about invalid feature references, and then discarded — so `ValueMomentEngineBackendService`
12
+ * had nothing to evaluate even if it had been implemented.
13
+ */
14
+ import 'reflect-metadata';
15
+ import type { ValueMoment, ValueSignal } from '@wildo-ai/saas-models';
16
+ import type { LoggerService } from '../../../monitoring/logger/services/logger.service';
17
+ /**
18
+ * The stable key of one signal WITHIN one moment.
19
+ *
20
+ * `ValueMomentMode.ALL` has to remember which signals have already fired, and it has to survive the
21
+ * definition being edited. An INDEX would not: inserting a signal at the front of the list silently
22
+ * re-points every recorded observation at a different signal. The key is derived from the signal's
23
+ * own content, so a signal that did not change keeps its identity, and one that did legitimately
24
+ * loses its recorded observation.
25
+ */
26
+ export declare function valueSignalKey(signal: ValueSignal): string;
27
+ export declare class ValueMomentDefinitionRegistryBackendService {
28
+ private readonly logger;
29
+ private definitions;
30
+ /** `<resourceType>:<operation>` → moments carrying a matching RESOURCE_OPERATION signal. */
31
+ private operationIndex;
32
+ /** custom event name → moments carrying a matching CUSTOM_EVENT signal. */
33
+ private eventIndex;
34
+ /**
35
+ * resource type → moments carrying a RESOURCE_STATE signal on it.
36
+ *
37
+ * Indexed by TYPE alone, not by operation: a state signal asks "how many rows match", and any
38
+ * write to that resource can change the answer. Keying it by operation would evaluate it only
39
+ * after a CREATE and miss the UPDATE that moved a row into the filter.
40
+ */
41
+ private stateIndex;
42
+ private logDebug;
43
+ constructor(logger: LoggerService);
44
+ registerDefinitions(definitions: ValueMoment[]): void;
45
+ private registerDefinition;
46
+ private removeFromIndexes;
47
+ /**
48
+ * Fail-fast validation, run at startup after registration.
49
+ *
50
+ * Reports rather than throws. A milestone misconfiguration prevents boot because milestones gate
51
+ * feature unlocks; a value moment MEASURES and gates nothing, so refusing to start an application
52
+ * over a mis-declared metric would be a worse failure than the metric being wrong. The findings go
53
+ * to the log at WARN, which is where the startup summary of every other registry lands.
54
+ */
55
+ validateDefinitions(): string[];
56
+ getDefinition(identifier: string): ValueMoment | undefined;
57
+ getAllDefinitions(): ValueMoment[];
58
+ /** Moments with a RESOURCE_OPERATION signal for this exact resource + operation. */
59
+ getMomentsForOperation(resourceType: string, operationIdentifier: string): ValueMoment[];
60
+ /** Moments with a CUSTOM_EVENT signal for this event name. */
61
+ getMomentsForEvent(eventName: string): ValueMoment[];
62
+ /** Moments with a RESOURCE_STATE signal on this resource type. */
63
+ getMomentsForResourceState(resourceType: string): ValueMoment[];
64
+ logStartupSummary(): void;
65
+ }
66
+ //# sourceMappingURL=value-moment-definition-registry.backend.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value-moment-definition-registry.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../src/monitoring/analytics/services/value-moment-definition-registry.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,kBAAkB,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAElG;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAa1D;AAED,qBACa,2CAA2C;IAkBjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAjB5D,OAAO,CAAC,WAAW,CAAuC;IAC1D,4FAA4F;IAC5F,OAAO,CAAC,cAAc,CAAyC;IAC/D,2EAA2E;IAC3E,OAAO,CAAC,UAAU,CAAyC;IAC3D;;;;;;OAMG;IACH,OAAO,CAAC,UAAU,CAAyC;IAE3D,OAAO,CAAC,QAAQ,CAA+D;gBAGzB,MAAM,EAAE,aAAa;IAMpE,mBAAmB,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,IAAI;IAO5D,OAAO,CAAC,kBAAkB;IAyB1B,OAAO,CAAC,iBAAiB;IAUzB;;;;;;;OAOG;IACI,mBAAmB,IAAI,MAAM,EAAE;IA2C/B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAI1D,iBAAiB,IAAI,WAAW,EAAE;IAIzC,oFAAoF;IAC7E,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAG,WAAW,EAAE;IAI/F,8DAA8D;IACvD,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE;IAI3D,kEAAkE;IAC3D,0BAA0B,CAAC,YAAY,EAAE,MAAM,GAAG,WAAW,EAAE;IAI/D,iBAAiB,IAAI,IAAI;CASjC"}