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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1358) hide show
  1. package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +1 -1
  2. package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +1 -1
  3. package/dist/esm/__tests__/setup.d.ts.map +1 -1
  4. package/dist/esm/__tests__/test-container.d.ts.map +1 -1
  5. package/dist/esm/applications/models/applications.backend.schemas.d.ts.map +1 -1
  6. package/dist/esm/applications/seeds/application-metadata-defaults.seeds.d.ts.map +1 -1
  7. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  8. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
  9. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  10. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  11. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
  12. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  13. package/dist/esm/base-classes/models/repositories.backend.schemas.d.ts.map +1 -1
  14. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +1 -1
  15. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +1 -1
  16. package/dist/esm/base-classes/services/batches/batches-cronjobs-custom-execution.service.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/batches-cronjobs-executor.backend.service.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/batches/batches-cronjobs-resource-execution.backend.service.d.ts.map +1 -1
  19. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
  20. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
  21. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
  22. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
  23. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
  24. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
  25. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +210 -0
  26. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
  27. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
  28. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  29. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
  30. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  31. package/dist/esm/base-classes/services/batches/resource-retention-sweep.batch.backend.service.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/batches/suspension-reactivation-sweep.batch.backend.service.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/controllers/abstract-controller.backend.service.d.ts.map +1 -1
  34. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  35. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
  36. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  37. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  38. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  39. package/dist/esm/base-classes/services/controllers/utils/audit-access-fields.backend.utils.d.ts.map +1 -1
  40. package/dist/esm/base-classes/services/controllers/utils/operation-response-serializer.backend.utils.d.ts.map +1 -1
  41. package/dist/esm/base-classes/services/controllers/validate-field-handler.backend.service.d.ts.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/__tests__/mock-repositories-registry-handler.service.d.ts.map +1 -1
  44. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/http-api/http-api-filter-translation.backend.d.ts.map +1 -1
  46. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
  47. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  48. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +220 -25
  49. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/http-api/http-api-query.backend.d.ts.map +1 -1
  51. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
  52. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +191 -26
  54. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  55. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
  56. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
  58. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  59. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
  60. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
  61. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
  62. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
  63. package/dist/esm/base-classes/services/repositories/http-api/http-api-row-projection.backend.d.ts.map +1 -1
  64. package/dist/esm/base-classes/services/repositories/http-api/http-api-subject-erasure-effect.backend.d.ts.map +1 -1
  65. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
  66. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
  68. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  69. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  70. package/dist/esm/base-classes/services/repositories/http-api/odoo-jsonrpc-compiler.backend.d.ts.map +1 -1
  71. package/dist/esm/base-classes/services/repositories/http-api/rest-json-query-compiler.backend.d.ts.map +1 -1
  72. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  73. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
  74. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  75. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  76. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  77. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +106 -0
  78. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  79. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +266 -20
  80. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  81. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  82. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
  83. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  84. package/dist/esm/base-classes/services/repositories/repository-guarded-mutation.backend.types.d.ts.map +1 -1
  85. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +5 -2
  86. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  87. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +34 -3
  88. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  89. package/dist/esm/base-classes/services/repositories/repository-version-metadata.backend.utils.d.ts.map +1 -1
  90. package/dist/esm/base-classes/services/repositories/resource-write-integrity.backend.d.ts.map +1 -1
  91. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts +72 -0
  92. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts.map +1 -0
  93. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js +88 -0
  94. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js.map +1 -0
  95. package/dist/esm/base-classes/services/repositories/unique-constraint-conflict-reference.backend.d.ts.map +1 -1
  96. package/dist/esm/base-classes/services/resource-operations-helper.backend.service.d.ts.map +1 -1
  97. package/dist/esm/base-classes/services/services/__tests__/mock-services-registry-handler.service.d.ts.map +1 -1
  98. package/dist/esm/base-classes/services/services/__tests__/mock-system-access.service.d.ts.map +1 -1
  99. package/dist/esm/base-classes/services/services/read-only-field-change.backend.utils.d.ts.map +1 -1
  100. package/dist/esm/base-classes/services/services/resource-operation-audit-emission.backend.utils.d.ts.map +1 -1
  101. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
  102. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  103. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  104. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts.map +1 -1
  105. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts.map +1 -1
  106. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  107. package/dist/esm/base-classes/services/services/resource-operation-server-injected-fields.backend.utils.d.ts.map +1 -1
  108. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts.map +1 -1
  109. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  110. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
  111. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  112. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
  113. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  114. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
  115. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  116. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
  117. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  118. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +571 -45
  119. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  120. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
  121. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  122. package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
  123. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  124. package/dist/esm/base-classes/utils/backend-type-utils.d.ts.map +1 -1
  125. package/dist/esm/base-classes/utils/single-subject-addressing.backend.utils.d.ts.map +1 -1
  126. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
  127. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
  128. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
  129. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
  130. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
  131. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
  132. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
  133. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
  134. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
  135. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
  136. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
  137. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
  138. package/dist/esm/billing/services/back-office/abstract-billing.backend.service.d.ts.map +1 -1
  139. package/dist/esm/billing/services/back-office/billing-feature-sync.backend.service.d.ts.map +1 -1
  140. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
  141. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
  142. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +475 -0
  143. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
  144. package/dist/esm/billing/services/back-office/billing-state.backend.service.d.ts.map +1 -1
  145. package/dist/esm/billing/services/back-office/billing-state.backend.service.js +11 -1
  146. package/dist/esm/billing/services/back-office/billing-state.backend.service.js.map +1 -1
  147. package/dist/esm/billing/services/back-office/billing-subject-erasure-effect.backend.d.ts.map +1 -1
  148. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
  149. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  150. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
  151. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  152. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
  153. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  154. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
  155. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  156. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
  157. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
  158. package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
  159. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
  160. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
  161. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  162. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
  163. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  164. package/dist/esm/billing/services/billing.utils.d.ts.map +1 -1
  165. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  166. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
  167. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  168. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +70 -1
  169. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  170. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +98 -2
  171. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  172. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
  173. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  174. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
  175. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  176. package/dist/esm/billing/services/custom-impl/credit-pool.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  177. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
  178. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  179. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
  180. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  181. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  182. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
  183. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  184. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +21 -1
  185. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  186. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +109 -2
  187. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  188. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
  189. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
  190. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
  191. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
  192. package/dist/esm/billing/services/webhooks/billing-webhook-adapter.backend.service.d.ts.map +1 -1
  193. package/dist/esm/billing/services/webhooks/billing-webhook-capability-handler.backend.service.d.ts.map +1 -1
  194. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
  195. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  196. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +310 -29
  197. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  198. package/dist/esm/billing/testing/billing-test-fixtures.d.ts.map +1 -1
  199. package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
  200. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  201. package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
  202. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  203. package/dist/esm/charts/controllers/chart.backend.controller.d.ts.map +1 -1
  204. package/dist/esm/charts/services/chart-registry.backend.service.d.ts +80 -7
  205. package/dist/esm/charts/services/chart-registry.backend.service.d.ts.map +1 -1
  206. package/dist/esm/charts/services/chart-registry.backend.service.js +115 -8
  207. package/dist/esm/charts/services/chart-registry.backend.service.js.map +1 -1
  208. package/dist/esm/companion-exports.d.ts.map +1 -1
  209. package/dist/esm/compliance/audit-trails/audit-logs.custom-impl.backend.service.d.ts.map +1 -1
  210. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.d.ts.map +1 -1
  211. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
  212. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  213. package/dist/esm/compliance/audit-trails/batches/immudb-audit-reconcile.batch.backend.service.d.ts.map +1 -1
  214. package/dist/esm/compliance/audit-trails/batches/siem-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  215. package/dist/esm/compliance/audit-trails/services/__tests__/mock-audit-logs.service.d.ts.map +1 -1
  216. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
  217. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  218. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
  219. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  220. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +350 -10
  221. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  222. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +562 -10
  223. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  224. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  225. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
  226. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  227. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
  228. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  229. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
  230. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  231. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
  232. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  233. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
  234. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  235. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
  236. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
  237. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
  238. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
  239. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  240. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +52 -0
  241. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  242. package/dist/esm/compliance/audit-trails/services/utils/ocsf-class-mapping.backend.utils.d.ts.map +1 -1
  243. package/dist/esm/compliance/audit-trails/services/utils/siem-dictionary.backend.utils.d.ts.map +1 -1
  244. package/dist/esm/compliance/audit-trails/services/utils/siem-ocsf-projection.backend.utils.d.ts.map +1 -1
  245. package/dist/esm/compliance/audit-trails/services/utils/siem-projection-contract.backend.utils.d.ts.map +1 -1
  246. package/dist/esm/compliance/audit-trails/utils/audit-actor.backend.utils.d.ts.map +1 -1
  247. package/dist/esm/compliance/audit-trails/utils/layer2-audit-provider-boot-diagnostic.backend.utils.d.ts.map +1 -1
  248. package/dist/esm/compliance/index.d.ts.map +1 -1
  249. package/dist/esm/compliance/privacy/retention-hide-predicate.backend.d.ts.map +1 -1
  250. package/dist/esm/compliance/privacy/services/subject-erasure-external-effects.backend.service.d.ts.map +1 -1
  251. package/dist/esm/compliance/privacy/services/subject-session-revocation.backend.service.d.ts.map +1 -1
  252. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
  253. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  254. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
  255. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  256. package/dist/esm/config/bootstrap/minion-initialization-projection.backend.d.ts.map +1 -1
  257. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.d.ts.map +1 -1
  258. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js +3 -0
  259. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js.map +1 -1
  260. package/dist/esm/config/bootstrap/runtime-principal.backend.service.d.ts.map +1 -1
  261. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  262. package/dist/esm/config/models/app-config-secrets.backend.schemas.d.ts.map +1 -1
  263. package/dist/esm/config/models/app-config.backend-authored.definitions.d.ts.map +1 -1
  264. package/dist/esm/config/models/app-config.backend.schemas.d.ts +145 -49
  265. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  266. package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
  267. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  268. package/dist/esm/config/models/app-env-config.backend.schemas.d.ts.map +1 -1
  269. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts +36 -0
  270. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts.map +1 -0
  271. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js +36 -0
  272. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js.map +1 -0
  273. package/dist/esm/config/models/config-mutation-boundary.utils.d.ts.map +1 -1
  274. package/dist/esm/config/models/postgresql-env-config.backend.schemas.d.ts.map +1 -1
  275. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
  276. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  277. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
  278. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  279. package/dist/esm/config/models/runtime-topology.backend.contracts.d.ts.map +1 -1
  280. package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +1 -1
  281. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
  282. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  283. package/dist/esm/config/services/app-configuration-loader.backend.service.js +71 -76
  284. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  285. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  286. package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
  287. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  288. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
  289. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  290. package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
  291. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  292. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +37 -0
  293. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  294. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +69 -1
  295. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  296. package/dist/esm/data-seeding/batches/data-seeding-run-cleanup.batch.backend.service.d.ts.map +1 -1
  297. package/dist/esm/data-seeding/batches/data-seeding-scheduled-rerun.batch.backend.service.d.ts.map +1 -1
  298. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.contracts.d.ts.map +1 -1
  299. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.controller.d.ts.map +1 -1
  300. package/dist/esm/data-seeding/data-seeding-models.d.ts.map +1 -1
  301. package/dist/esm/data-seeding/models/business-key-resolver.shared.utils.d.ts.map +1 -1
  302. package/dist/esm/data-seeding/models/data-seed-execution-context.shared.types.d.ts.map +1 -1
  303. package/dist/esm/data-seeding/models/data-seed-migrator-runner.shared.utils.d.ts.map +1 -1
  304. package/dist/esm/data-seeding/models/data-seed-reconciler.shared.utils.d.ts.map +1 -1
  305. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.schemas.d.ts.map +1 -1
  306. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.utils.d.ts.map +1 -1
  307. package/dist/esm/data-seeding/models/data-seed-run.shared.resources-config.schemas.d.ts.map +1 -1
  308. package/dist/esm/data-seeding/models/data-seed-run.shared.schemas.d.ts.map +1 -1
  309. package/dist/esm/data-seeding/models/data-seed-trigger-mode-matrix.shared.utils.d.ts.map +1 -1
  310. package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
  311. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
  312. package/dist/esm/data-seeding/services/data-seed-dispatcher.backend.service.d.ts.map +1 -1
  313. package/dist/esm/data-seeding/services/data-seed-registry.backend.service.d.ts.map +1 -1
  314. package/dist/esm/data-seeding/services/data-seed-scope-resolver-registry.backend.service.d.ts.map +1 -1
  315. package/dist/esm/data-seeding/services/engines/additive-seed-engine.backend.service.d.ts.map +1 -1
  316. package/dist/esm/data-seeding/services/engines/lazy-seed-engine.backend.service.d.ts.map +1 -1
  317. package/dist/esm/data-seeding/services/engines/manual-seed-engine.backend.service.d.ts.map +1 -1
  318. package/dist/esm/data-seeding/services/engines/sync-seed-engine.backend.service.d.ts.map +1 -1
  319. package/dist/esm/data-seeding/services/engines/upgrade-seed-engine.backend.service.d.ts.map +1 -1
  320. package/dist/esm/data-seeding/services/shared/data-seed-business-key.shared.utils.d.ts.map +1 -1
  321. package/dist/esm/data-seeding/services/shared/data-seed-error.shared.utils.d.ts.map +1 -1
  322. package/dist/esm/data-seeding/services/shared/data-seed-run-counters.shared.types.d.ts.map +1 -1
  323. package/dist/esm/data-seeding/services/shared/data-seed-run-ledger.backend.d.ts.map +1 -1
  324. package/dist/esm/data-seeding/services/shared/data-seed-scope-anchor.shared.types.d.ts.map +1 -1
  325. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts.map +1 -1
  326. package/dist/esm/data-seeding/services/shared/data-seed-scope-resolution.backend.d.ts.map +1 -1
  327. package/dist/esm/databases/models/aggregation.backend.schemas.d.ts.map +1 -1
  328. package/dist/esm/databases/models/databases.backend.schemas.d.ts.map +1 -1
  329. package/dist/esm/databases/models/filter.backend.schemas.d.ts.map +1 -1
  330. package/dist/esm/databases/models/resolve-persistence-adapter.backend.utils.d.ts.map +1 -1
  331. package/dist/esm/databases/models/sql.backend.schemas.d.ts.map +1 -1
  332. package/dist/esm/databases/models/transaction.shared.schemas.d.ts.map +1 -1
  333. package/dist/esm/databases/services/__tests__/mock-mongo-transaction-registry.service.d.ts.map +1 -1
  334. package/dist/esm/databases/services/__tests__/mock-mongodb.service.d.ts.map +1 -1
  335. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +1 -1
  336. package/dist/esm/databases/services/__tests__/mock-redis.service.d.ts.map +1 -1
  337. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +1 -1
  338. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  339. package/dist/esm/databases/services/aggregation/aggregation-query.backend.service.d.ts.map +1 -1
  340. package/dist/esm/databases/services/aggregation/computed-measure-evaluator.backend.service.d.ts.map +1 -1
  341. package/dist/esm/databases/services/aggregation/field-access-validator.backend.service.d.ts.map +1 -1
  342. package/dist/esm/databases/services/aggregation/time-series-densifier.backend.service.d.ts.map +1 -1
  343. package/dist/esm/databases/services/aggregation/topn-processor.backend.service.d.ts.map +1 -1
  344. package/dist/esm/databases/services/aggregation/window-function-processor.backend.service.d.ts.map +1 -1
  345. package/dist/esm/databases/services/db-utils.d.ts.map +1 -1
  346. package/dist/esm/databases/services/mongo-aggregation.backend.service.d.ts.map +1 -1
  347. package/dist/esm/databases/services/mongodb.service.d.ts.map +1 -1
  348. package/dist/esm/databases/services/postgresql-aggregation.backend.service.d.ts.map +1 -1
  349. package/dist/esm/databases/services/postgresql-database.backend.service.d.ts.map +1 -1
  350. package/dist/esm/databases/services/postgresql-development-provisioning.backend.d.ts.map +1 -1
  351. package/dist/esm/databases/services/postgresql-filter.backend.service.d.ts.map +1 -1
  352. package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
  353. package/dist/esm/databases/services/postgresql-schema-ddl.backend.d.ts.map +1 -1
  354. package/dist/esm/databases/services/postgresql-schema-migration-sql.backend.d.ts.map +1 -1
  355. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  356. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
  357. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  358. package/dist/esm/databases/services/postgresql-schema-plan-lockfile.backend.d.ts.map +1 -1
  359. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  360. package/dist/esm/databases/services/resource-persistence-unit-of-work.backend.service.d.ts.map +1 -1
  361. package/dist/esm/databases/services/schema-planning-standalone.backend.d.ts.map +1 -1
  362. package/dist/esm/databases/services/zod-to-mongoose-schema-convertor.backend.service.d.ts.map +1 -1
  363. package/dist/esm/databases/services/zod-to-sql-hybrid-schema.planner.d.ts.map +1 -1
  364. package/dist/esm/databases/utils/postgresql-identifier.backend.utils.d.ts.map +1 -1
  365. package/dist/esm/errors/services/__tests__/mock-error-builder.service.d.ts.map +1 -1
  366. package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
  367. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  368. package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
  369. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  370. package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
  371. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  372. package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
  373. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  374. package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
  375. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  376. package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
  377. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  378. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
  379. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  380. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
  381. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  382. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
  383. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  384. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
  385. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  386. package/dist/esm/external-data/batches/external-data-pipeline-scheduled-run.batch.backend.service.d.ts.map +1 -1
  387. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -1
  388. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -1
  389. package/dist/esm/external-data/external-data-extraction-source.backend.d.ts.map +1 -1
  390. package/dist/esm/external-data/external-data-models.exports.d.ts.map +1 -1
  391. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
  392. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  393. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
  394. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  395. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  396. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  397. package/dist/esm/external-providers/models/external-providers.backend.schemas.d.ts.map +1 -1
  398. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
  399. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  400. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  401. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +306 -0
  402. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
  403. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +379 -0
  404. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
  405. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
  406. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
  407. package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
  408. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
  409. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
  410. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
  411. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +235 -0
  412. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
  413. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
  414. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
  415. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
  416. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
  417. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
  418. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  419. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
  420. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  421. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
  422. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
  423. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
  424. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
  425. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
  426. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  427. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
  428. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  429. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts +81 -34
  430. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  431. package/dist/esm/external-providers/services/document-extraction.backend.service.js +181 -100
  432. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  433. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  434. package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
  435. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  436. package/dist/esm/external-providers/services/external-api-handler.backend.service.d.ts.map +1 -1
  437. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +413 -7
  438. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  439. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +684 -45
  440. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  441. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts +15 -1
  442. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  443. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +84 -5
  444. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  445. package/dist/esm/features/controllers/features.backend.controller.d.ts.map +1 -1
  446. package/dist/esm/features/services/__tests__/mock-feature-definition-registry.service.d.ts.map +1 -1
  447. package/dist/esm/features/services/__tests__/mock-feature-resolution.service.d.ts.map +1 -1
  448. package/dist/esm/features/services/application-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  449. package/dist/esm/features/services/feature-definition-registry.backend.service.d.ts.map +1 -1
  450. package/dist/esm/features/services/feature-gate.backend.service.d.ts.map +1 -1
  451. package/dist/esm/features/services/feature-resolution.backend.service.d.ts.map +1 -1
  452. package/dist/esm/features/services/organization-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  453. package/dist/esm/features/services/scope-feature-ledger-relationship.backend.utils.d.ts.map +1 -1
  454. package/dist/esm/features/services/scope-features-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  455. package/dist/esm/features/testing/feature-test-utils.d.ts.map +1 -1
  456. package/dist/esm/files/batches/files-cleanup.batch.backend.service.d.ts.map +1 -1
  457. package/dist/esm/files/constraints/file-analyzers.types.d.ts.map +1 -1
  458. package/dist/esm/files/constraints/file-constraint-resolver-chain.backend.service.d.ts.map +1 -1
  459. package/dist/esm/files/constraints/file-constraint.types.d.ts.map +1 -1
  460. package/dist/esm/files/constraints/file-validation.backend.service.d.ts.map +1 -1
  461. package/dist/esm/files/constraints/resource-field-constraint-resolver.backend.service.d.ts.map +1 -1
  462. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  463. package/dist/esm/files/controllers/file.controller.js +21 -13
  464. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  465. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -1
  466. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -1
  467. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +37 -0
  468. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  469. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +260 -36
  470. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  471. package/dist/esm/files/scanning/clamav-scanner.backend.service.d.ts.map +1 -1
  472. package/dist/esm/files/scanning/file-scan.types.d.ts.map +1 -1
  473. package/dist/esm/files/scanning/yara-scanner.backend.service.d.ts.map +1 -1
  474. package/dist/esm/files/scanning/yara-scanner.backend.service.js +20 -2
  475. package/dist/esm/files/scanning/yara-scanner.backend.service.js.map +1 -1
  476. package/dist/esm/files/services/__tests__/mock-file-field-detection.service.d.ts.map +1 -1
  477. package/dist/esm/files/services/__tests__/mock-file-operation-handler.service.d.ts.map +1 -1
  478. package/dist/esm/files/services/__tests__/mock-file-repository.service.d.ts.map +1 -1
  479. package/dist/esm/files/services/file-field-detection.backend.service.d.ts.map +1 -1
  480. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  481. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  482. package/dist/esm/files/services/file-population.backend.service.d.ts.map +1 -1
  483. package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
  484. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  485. package/dist/esm/files/services/file-scanning.backend.service.js +202 -17
  486. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  487. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
  488. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  489. package/dist/esm/files/services/file-text-extraction.backend.service.js +175 -13
  490. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  491. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
  492. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  493. package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
  494. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  495. package/dist/esm/files/services/files.backend.service.d.ts +68 -0
  496. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  497. package/dist/esm/files/services/files.backend.service.js +177 -5
  498. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  499. package/dist/esm/files/services/rag-source-field-detection.backend.service.d.ts.map +1 -1
  500. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
  501. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
  502. package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
  503. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
  504. package/dist/esm/files/storage/file-storage-path-resolver.backend.service.d.ts.map +1 -1
  505. package/dist/esm/files/storage/file-storage-provider.types.d.ts +52 -11
  506. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  507. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  508. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts +21 -3
  509. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts.map +1 -1
  510. package/dist/esm/files/storage/file-storage-router.backend.service.js +38 -5
  511. package/dist/esm/files/storage/file-storage-router.backend.service.js.map +1 -1
  512. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts +87 -0
  513. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts.map +1 -0
  514. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js +340 -0
  515. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js.map +1 -0
  516. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
  517. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  518. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
  519. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  520. package/dist/esm/files/storage/storage-credential-provider.backend.utils.d.ts.map +1 -1
  521. package/dist/esm/files/storage/storage-platform-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  522. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  523. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js +10 -3
  524. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js.map +1 -1
  525. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  526. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
  527. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  528. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  529. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
  530. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  531. package/dist/esm/files/utils/file-upload.utils.d.ts.map +1 -1
  532. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  533. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  534. package/dist/esm/files/utils/file-validation.utils.d.ts.map +1 -1
  535. package/dist/esm/files/utils/image-derivation.backend.utils.d.ts.map +1 -1
  536. package/dist/esm/files/utils/image-thumbnail.backend.utils.d.ts.map +1 -1
  537. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
  538. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
  539. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
  540. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
  541. package/dist/esm/files/utils/rag-source-field-schema-path.backend.utils.d.ts.map +1 -1
  542. package/dist/esm/files/utils/storage-application-identity.backend.utils.d.ts.map +1 -1
  543. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
  544. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  545. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
  546. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  547. package/dist/esm/flows-actors/a2a/batches/a2a-push-delivery.batch.backend.service.d.ts.map +1 -1
  548. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  549. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
  550. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  551. package/dist/esm/flows-actors/a2a/models/a2a-dialect.backend.schemas.d.ts.map +1 -1
  552. package/dist/esm/flows-actors/a2a/models/a2a-push-notification-delivery.backend.utils.d.ts.map +1 -1
  553. package/dist/esm/flows-actors/a2a/models/a2a-push-notification.backend.schemas.d.ts.map +1 -1
  554. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
  555. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  556. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
  557. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  558. package/dist/esm/flows-actors/a2a/services/a2a-push-delivery-log.repository.d.ts.map +1 -1
  559. package/dist/esm/flows-actors/a2a/services/a2a-push-dispatcher.backend.service.d.ts.map +1 -1
  560. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
  561. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  562. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
  563. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  564. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
  565. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  566. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
  567. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  568. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
  569. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  570. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
  571. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  572. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
  573. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  574. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  575. package/dist/esm/flows-actors/controllers/flows-actors.controller.d.ts.map +1 -1
  576. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
  577. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  578. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
  579. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  580. package/dist/esm/flows-actors/models/agent-facets.backend.definitions.d.ts.map +1 -1
  581. package/dist/esm/flows-actors/models/agents.backend.definitions.d.ts.map +1 -1
  582. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
  583. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  584. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
  585. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  586. package/dist/esm/flows-actors/models/flows-actors.backend.definitions.d.ts.map +1 -1
  587. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
  588. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  589. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  590. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +179 -8
  591. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  592. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +436 -34
  593. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  594. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  595. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
  596. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  597. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
  598. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
  599. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
  600. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
  601. package/dist/esm/flows-actors/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +1 -1
  602. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  603. package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
  604. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  605. package/dist/esm/flows-actors/services/agent-call-trace-sink.backend.d.ts.map +1 -1
  606. package/dist/esm/flows-actors/services/agent-facets.backend.service.d.ts.map +1 -1
  607. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +132 -6
  608. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  609. package/dist/esm/flows-actors/services/agents.backend.service.js +467 -49
  610. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  611. package/dist/esm/flows-actors/services/context-curation.backend.service.d.ts.map +1 -1
  612. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +50 -1
  613. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  614. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +270 -20
  615. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  616. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
  617. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  618. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
  619. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  620. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  621. package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
  622. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  623. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  624. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
  625. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  626. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
  627. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
  628. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +371 -0
  629. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
  630. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts +99 -0
  631. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts.map +1 -0
  632. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js +155 -0
  633. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js.map +1 -0
  634. package/dist/esm/flows-actors/services/meta-workflow-evaluation-treatment-compiler.backend.service.d.ts.map +1 -1
  635. package/dist/esm/flows-actors/services/meta-workflow-standard-action-contracts.backend.service.d.ts.map +1 -1
  636. package/dist/esm/flows-actors/services/meta-workflow-standard-evaluation-contracts.backend.service.d.ts.map +1 -1
  637. package/dist/esm/flows-actors/services/meta-workflow-structured-artifact-action-compiler.backend.service.d.ts.map +1 -1
  638. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
  639. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  640. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
  641. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  642. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  643. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +17 -4
  644. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  645. package/dist/esm/flows-actors/utils/bounded-subprocess.backend.utils.d.ts.map +1 -1
  646. package/dist/esm/flows-actors/utils/flows-actors-frontend-extractor.utils.d.ts.map +1 -1
  647. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
  648. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  649. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
  650. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  651. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  652. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  653. package/dist/esm/flows-actors/utils/prompt-ir-adapters.backend.utils.d.ts.map +1 -1
  654. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts +77 -0
  655. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts.map +1 -0
  656. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js +164 -0
  657. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js.map +1 -0
  658. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts +48 -0
  659. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts.map +1 -0
  660. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js +101 -0
  661. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js.map +1 -0
  662. package/dist/esm/guidance/batches/dormancy-detection.batch.backend.service.d.ts.map +1 -1
  663. package/dist/esm/guidance/services/guidance-trigger-evaluator.backend.service.d.ts.map +1 -1
  664. package/dist/esm/guidance/services/lifecycle-custom-implementations.backend.d.ts.map +1 -1
  665. package/dist/esm/guidance/services/lifecycle-evaluator.backend.service.d.ts.map +1 -1
  666. package/dist/esm/guidance/services/lifecycle-scope-id.backend.utils.d.ts.map +1 -1
  667. package/dist/esm/guidance/services/milestone-condition-registry.backend.service.d.ts.map +1 -1
  668. package/dist/esm/guidance/services/milestone-definition-registry.backend.service.d.ts.map +1 -1
  669. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
  670. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  671. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
  672. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  673. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
  674. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
  675. package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
  676. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
  677. package/dist/esm/guidance/services/scoped-state-read-custom-implementations.backend.d.ts.map +1 -1
  678. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
  679. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  680. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
  681. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  682. package/dist/esm/i18n/services/i18n.backend.service.d.ts.map +1 -1
  683. package/dist/esm/index.d.ts +11 -5
  684. package/dist/esm/index.d.ts.map +1 -1
  685. package/dist/esm/index.js +31 -5
  686. package/dist/esm/index.js.map +1 -1
  687. package/dist/esm/inject/models/container.d.ts +10 -0
  688. package/dist/esm/inject/models/container.d.ts.map +1 -1
  689. package/dist/esm/inject/models/container.js +126 -10
  690. package/dist/esm/inject/models/container.js.map +1 -1
  691. package/dist/esm/inject/models/service-types.d.ts +20 -3
  692. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  693. package/dist/esm/inject/models/service-types.js +22 -3
  694. package/dist/esm/inject/models/service-types.js.map +1 -1
  695. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  696. package/dist/esm/mcp/controllers/mcp.controller.js +70 -3
  697. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  698. package/dist/esm/mcp/models/mcp-protocol.backend.schemas.d.ts.map +1 -1
  699. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  700. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  701. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
  702. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  703. package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
  704. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  705. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  706. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
  707. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  708. package/dist/esm/mcp/services/resource-server-instances-registry.backend.service.d.ts.map +1 -1
  709. package/dist/esm/mcp/utils/zod-to-mcp-json-schema.backend.utils.d.ts.map +1 -1
  710. package/dist/esm/meta-workflow-runtime.exports.d.ts.map +1 -1
  711. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  712. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
  713. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  714. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
  715. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
  716. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
  717. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
  718. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
  719. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  720. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
  721. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  722. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
  723. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  724. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  725. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
  726. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  727. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
  728. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  729. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +1 -1
  730. package/dist/esm/monitoring/logger/services/logger.service.d.ts +24 -0
  731. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  732. package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
  733. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  734. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
  735. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
  736. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
  737. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
  738. package/dist/esm/monitoring/logger/utils/log-value-normalization.backend.utils.d.ts.map +1 -1
  739. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +313 -0
  740. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
  741. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +389 -0
  742. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
  743. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
  744. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  745. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  746. package/dist/esm/monitoring/observability/otel-preload.d.ts.map +1 -1
  747. package/dist/esm/monitoring/observability/otel-sdk-global-handle.d.ts.map +1 -1
  748. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +1 -1
  749. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
  750. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  751. package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
  752. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  753. package/dist/esm/monitoring/observability/services/observability.backend.service.d.ts.map +1 -1
  754. package/dist/esm/notifications/email/components/email-components.d.ts.map +1 -1
  755. package/dist/esm/notifications/email/models/email-template-definition.d.ts.map +1 -1
  756. package/dist/esm/notifications/email/models/email-transport.backend.definitions.d.ts.map +1 -1
  757. package/dist/esm/notifications/email/services/email-batch-send.batch.backend.service.d.ts.map +1 -1
  758. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
  759. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  760. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
  761. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  762. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  763. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
  764. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  765. package/dist/esm/notifications/email/services/email.backend.service.d.ts +102 -5
  766. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  767. package/dist/esm/notifications/email/services/email.backend.service.js +222 -70
  768. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  769. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
  770. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  771. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  772. package/dist/esm/notifications/email/utils/interpolate-email-label.utils.d.ts.map +1 -1
  773. package/dist/esm/notifications/email/utils/zod-to-typescript.utils.d.ts.map +1 -1
  774. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
  775. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  776. package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
  777. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  778. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
  779. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  780. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
  781. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  782. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts +32 -0
  783. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts.map +1 -0
  784. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js +32 -0
  785. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js.map +1 -0
  786. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +64 -10
  787. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  788. package/dist/esm/notifications/sms/services/sms.backend.service.js +277 -82
  789. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  790. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
  791. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  792. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
  793. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  794. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
  795. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  796. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
  797. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  798. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  799. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  800. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
  801. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  802. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.d.ts.map +1 -1
  803. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.repository.d.ts.map +1 -1
  804. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-dispatcher.backend.service.d.ts.map +1 -1
  805. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service.d.ts.map +1 -1
  806. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  807. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
  808. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  809. package/dist/esm/notifications/webhooks/outbound/services/webhook-config.backend.service.d.ts.map +1 -1
  810. package/dist/esm/notifications/webhooks/services/polymorphic-lookup.backend.service.d.ts.map +1 -1
  811. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
  812. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  813. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
  814. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  815. package/dist/esm/organizations/batches/organization-member-invitation-sweep.batch.backend.service.d.ts.map +1 -1
  816. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
  817. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts.map +1 -1
  818. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
  819. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  820. package/dist/esm/organizations/services/authority-change-audit.backend.utils.d.ts.map +1 -1
  821. package/dist/esm/organizations/services/invitation-acceptance.backend.utils.d.ts.map +1 -1
  822. package/dist/esm/organizations/services/org-creation-on-registration.backend.utils.d.ts.map +1 -1
  823. package/dist/esm/organizations/services/org-member-roles-validation.backend.utils.d.ts.map +1 -1
  824. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  825. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
  826. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  827. package/dist/esm/organizations/services/organization-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  828. package/dist/esm/organizations/services/organization-member-custom-implementation.backend.service.d.ts.map +1 -1
  829. package/dist/esm/organizations/services/organization-onboarding-operation.backend.utils.d.ts.map +1 -1
  830. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  831. package/dist/esm/organizations/services/organization-unit-member-custom-implementation.backend.service.d.ts.map +1 -1
  832. package/dist/esm/organizations/services/scim-provisioning-gate.backend.utils.d.ts.map +1 -1
  833. package/dist/esm/organizations/services/user-org-type-grant.backend.utils.d.ts.map +1 -1
  834. package/dist/esm/organizations/services/user-type-revocation-on-org-leave.backend.utils.d.ts.map +1 -1
  835. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +1 -1
  836. package/dist/esm/pdf-templates/models/pdf-template-binding.d.ts.map +1 -1
  837. package/dist/esm/pdf-templates/models/pdf-template-definition.d.ts.map +1 -1
  838. package/dist/esm/pdf-templates/services/pdf-generated-file-writer.backend.service.d.ts.map +1 -1
  839. package/dist/esm/pdf-templates/services/pdf-generation-orchestrator.backend.service.d.ts.map +1 -1
  840. package/dist/esm/pdf-templates/services/pdf-renderer.backend.service.d.ts.map +1 -1
  841. package/dist/esm/pdf-templates/services/pdf-template-binding.backend.service.d.ts.map +1 -1
  842. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
  843. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
  844. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
  845. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
  846. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
  847. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
  848. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
  849. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
  850. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
  851. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
  852. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
  853. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
  854. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
  855. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
  856. package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
  857. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
  858. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
  859. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  860. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
  861. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  862. package/dist/esm/queue/apps-crontabs-manager.backend.service.d.ts.map +1 -1
  863. package/dist/esm/queue/cron-job-sync.backend.service.d.ts.map +1 -1
  864. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
  865. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  866. package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
  867. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  868. package/dist/esm/queue/job-completion-registry.backend.service.d.ts.map +1 -1
  869. package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
  870. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  871. package/dist/esm/queue/job-consumer.backend.service.js +1 -4
  872. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  873. package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
  874. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  875. package/dist/esm/queue/job-executor.backend.service.js +1 -4
  876. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  877. package/dist/esm/queue/job-payload-storage.backend.service.d.ts.map +1 -1
  878. package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
  879. package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
  880. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  881. package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
  882. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  883. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
  884. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  885. package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
  886. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  887. package/dist/esm/queue/queue.backend.service.d.ts +3 -3
  888. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  889. package/dist/esm/queue/queue.backend.service.js +26 -4
  890. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  891. package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
  892. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
  893. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  894. package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
  895. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  896. package/dist/esm/rag/batches/rag-embedding-drain.batch.backend.service.d.ts.map +1 -1
  897. package/dist/esm/rag/batches/rag-reconciliation-sweep.batch.backend.service.d.ts.map +1 -1
  898. package/dist/esm/rag/models/rag-chunk-store.backend.types.d.ts.map +1 -1
  899. package/dist/esm/rag/models/rag-retrieval.backend.types.d.ts.map +1 -1
  900. package/dist/esm/rag/services/mongodb-rag-chunk-store.backend.service.d.ts.map +1 -1
  901. package/dist/esm/rag/services/postgresql-rag-chunk-store.backend.service.d.ts.map +1 -1
  902. package/dist/esm/rag/services/rag-chunk-collection.mongodb-ddl.backend.d.ts.map +1 -1
  903. package/dist/esm/rag/services/rag-chunk-retrieval.mongodb-query.backend.d.ts.map +1 -1
  904. package/dist/esm/rag/services/rag-chunk-retrieval.postgresql-query.backend.d.ts.map +1 -1
  905. package/dist/esm/rag/services/rag-chunk-store.backend.service.d.ts.map +1 -1
  906. package/dist/esm/rag/services/rag-chunk-table.postgresql-ddl.backend.d.ts.map +1 -1
  907. package/dist/esm/rag/services/rag-ingestion.backend.service.d.ts.map +1 -1
  908. package/dist/esm/rag/services/rag-retrieval.backend.service.d.ts.map +1 -1
  909. package/dist/esm/rag/utils/rag-chunk-fusion.backend.utils.d.ts.map +1 -1
  910. package/dist/esm/rag/utils/rag-chunk-removal.backend.utils.d.ts.map +1 -1
  911. package/dist/esm/rag/utils/rag-chunk-row-shaping.backend.utils.d.ts.map +1 -1
  912. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
  913. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  914. package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
  915. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  916. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
  917. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  918. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
  919. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  920. package/dist/esm/rag/utils/rag-ingestion-trigger.backend.utils.d.ts.map +1 -1
  921. package/dist/esm/rag/utils/rag-retrieval-scope.backend.utils.d.ts.map +1 -1
  922. package/dist/esm/rag/utils/rag-source-field-value.backend.utils.d.ts.map +1 -1
  923. package/dist/esm/requests/models/api-routes.backend.defintions.d.ts.map +1 -1
  924. package/dist/esm/requests/models/requests.backend.schemas.d.ts.map +1 -1
  925. package/dist/esm/requests/service/platform-mutualized-handler.backend.service.d.ts.map +1 -1
  926. package/dist/esm/requests/service/platform-requests.backend.utils.d.ts.map +1 -1
  927. package/dist/esm/requests/service/remote-client-base.backend.service.d.ts.map +1 -1
  928. package/dist/esm/requests/service/serverless-services-handler.backend.service.d.ts.map +1 -1
  929. package/dist/esm/requests/service/websocket.service.d.ts +9 -0
  930. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  931. package/dist/esm/requests/service/websocket.service.js +81 -9
  932. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  933. package/dist/esm/resources/backend-resource-registry.exports.d.ts.map +1 -1
  934. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  935. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +16 -2
  936. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  937. package/dist/esm/resources/models/index.d.ts.map +1 -1
  938. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  939. package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
  940. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  941. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  942. package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
  943. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  944. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
  945. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  946. package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
  947. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  948. package/dist/esm/resources/models/resources.backend.schemas.d.ts.map +1 -1
  949. package/dist/esm/resources/models/virtual-fields.backend.types.d.ts.map +1 -1
  950. package/dist/esm/resources/services/__tests__/mock-resources-registry.service.d.ts.map +1 -1
  951. package/dist/esm/resources/services/resource-context.backend.service.d.ts.map +1 -1
  952. package/dist/esm/resources/services/resource-id.backend.service.d.ts.map +1 -1
  953. package/dist/esm/resources/services/resource-population.backend.service.d.ts +17 -2
  954. package/dist/esm/resources/services/resource-population.backend.service.d.ts.map +1 -1
  955. package/dist/esm/resources/services/resource-population.backend.service.js +74 -18
  956. package/dist/esm/resources/services/resource-population.backend.service.js.map +1 -1
  957. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +83 -5
  958. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  959. package/dist/esm/resources/services/resources-registry.backend.service.js +121 -6
  960. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  961. package/dist/esm/resources/services/virtual-fields.backend.service.d.ts.map +1 -1
  962. package/dist/esm/resources/utils/resource-retention.backend.utils.d.ts.map +1 -1
  963. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
  964. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  965. package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
  966. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  967. package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
  968. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  969. package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
  970. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  971. package/dist/esm/runtime/models/execution-context.backend.schemas.d.ts.map +1 -1
  972. package/dist/esm/runtime/models/request-context.als.backend.d.ts.map +1 -1
  973. package/dist/esm/runtime/models/runtime.backend.schemas.d.ts.map +1 -1
  974. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  975. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  976. package/dist/esm/runtime/services/execution-context-handler.backend.service.d.ts.map +1 -1
  977. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
  978. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  979. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  980. package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
  981. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  982. package/dist/esm/runtime/services/http-server.backend.service.js +191 -1
  983. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  984. package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
  985. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  986. package/dist/esm/runtime/services/start-application.backend.service.js +287 -89
  987. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  988. package/dist/esm/runtime/services/utils/oauth-body-cap.backend.utils.d.ts.map +1 -1
  989. package/dist/esm/runtime/testing/execution-context-test-fixtures.d.ts.map +1 -1
  990. package/dist/esm/runtime/testing/mock-execution-context-creator.service.d.ts.map +1 -1
  991. package/dist/esm/runtime/utils/application-startup-config-access.backend.utils.d.ts.map +1 -1
  992. package/dist/esm/runtime/utils/feature-gated-core-resource-exclusions.backend.utils.d.ts.map +1 -1
  993. package/dist/esm/runtime/utils/request-client-ip.utils.d.ts.map +1 -1
  994. package/dist/esm/runtime/utils/scan-default-exports.backend.utils.d.ts.map +1 -1
  995. package/dist/esm/security/api-keys/api-key-generation.backend.utils.d.ts.map +1 -1
  996. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
  997. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  998. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
  999. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  1000. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
  1001. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  1002. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
  1003. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  1004. package/dist/esm/security/authentications/controllers/auth-method-management-controller.backend.service.d.ts.map +1 -1
  1005. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts +22 -0
  1006. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  1007. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +113 -4
  1008. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  1009. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
  1010. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  1011. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
  1012. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  1013. package/dist/esm/security/authentications/models/auth-constants.backend.d.ts.map +1 -1
  1014. package/dist/esm/security/authentications/models/authentications.backend.schemas.d.ts.map +1 -1
  1015. package/dist/esm/security/authentications/models/authorization-client.backend.schemas.d.ts.map +1 -1
  1016. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
  1017. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  1018. package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
  1019. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  1020. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts +37 -0
  1021. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts.map +1 -0
  1022. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js +37 -0
  1023. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js.map +1 -0
  1024. package/dist/esm/security/authentications/models/identity-persistence-boundaries.backend.d.ts.map +1 -1
  1025. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  1026. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +30 -0
  1027. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  1028. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  1029. package/dist/esm/security/authentications/models/saml-authentication.backend.schemas.d.ts.map +1 -1
  1030. package/dist/esm/security/authentications/models/sso-connection.backend.schemas.d.ts.map +1 -1
  1031. package/dist/esm/security/authentications/models/user-authorization-version.backend.utils.d.ts.map +1 -1
  1032. package/dist/esm/security/authentications/seeds/enterprise-config-defaults.seeds.d.ts.map +1 -1
  1033. package/dist/esm/security/authentications/services/__tests__/mock-auth-execution-context-factory.service.d.ts.map +1 -1
  1034. package/dist/esm/security/authentications/services/__tests__/mock-auth-token-issuer.service.d.ts.map +1 -1
  1035. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +1 -1
  1036. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-domain-to-org-lookup.service.d.ts.map +1 -1
  1037. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-enterprise-user-provisioning.service.d.ts.map +1 -1
  1038. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
  1039. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  1040. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
  1041. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  1042. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
  1043. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  1044. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
  1045. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  1046. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
  1047. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  1048. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
  1049. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  1050. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
  1051. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  1052. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
  1053. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  1054. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.d.ts.map +1 -1
  1055. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js +2 -1
  1056. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js.map +1 -1
  1057. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +197 -0
  1058. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  1059. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +384 -53
  1060. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  1061. package/dist/esm/security/authentications/services/auth-credential-verifier.backend.service.d.ts.map +1 -1
  1062. package/dist/esm/security/authentications/services/auth-execution-context-factory.backend.service.d.ts.map +1 -1
  1063. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  1064. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
  1065. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  1066. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  1067. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts.map +1 -1
  1068. package/dist/esm/security/authentications/services/auth-methods/auth-phone-verification.backend.service.d.ts.map +1 -1
  1069. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
  1070. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  1071. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
  1072. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  1073. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts +97 -0
  1074. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  1075. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +260 -27
  1076. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  1077. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts +14 -0
  1078. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  1079. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +70 -4
  1080. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  1081. package/dist/esm/security/authentications/services/auth-methods/saml-assertion-validator.backend.service.d.ts.map +1 -1
  1082. package/dist/esm/security/authentications/services/auth-methods/saml-authentication.backend.service.d.ts.map +1 -1
  1083. package/dist/esm/security/authentications/services/auth-methods/saml-metadata.backend.service.d.ts.map +1 -1
  1084. package/dist/esm/security/authentications/services/auth-methods/saml-replay-guard.backend.service.d.ts.map +1 -1
  1085. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
  1086. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  1087. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
  1088. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  1089. package/dist/esm/security/authentications/services/auth-session-store.backend.service.d.ts.map +1 -1
  1090. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
  1091. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  1092. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
  1093. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  1094. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
  1095. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  1096. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
  1097. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  1098. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
  1099. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  1100. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
  1101. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  1102. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  1103. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
  1104. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  1105. package/dist/esm/security/authentications/services/custom-impls/scim-tokens.custom-impl.backend.service.d.ts.map +1 -1
  1106. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.d.ts.map +1 -1
  1107. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
  1108. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
  1109. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +339 -0
  1110. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
  1111. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
  1112. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  1113. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
  1114. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  1115. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.d.ts.map +1 -1
  1116. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js +11 -1
  1117. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js.map +1 -1
  1118. package/dist/esm/security/authentications/services/email-verification-initiator.backend.service.d.ts.map +1 -1
  1119. package/dist/esm/security/authentications/services/machine-token-issuer.backend.service.d.ts.map +1 -1
  1120. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
  1121. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  1122. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
  1123. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  1124. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
  1125. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  1126. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
  1127. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  1128. package/dist/esm/security/authentications/services/oidc-user-claims.backend.service.d.ts.map +1 -1
  1129. package/dist/esm/security/authentications/services/resolve-active-member-orgs.backend.utils.d.ts.map +1 -1
  1130. package/dist/esm/security/authentications/services/utils/__tests__/mock-auth-user-lookup.service.d.ts.map +1 -1
  1131. package/dist/esm/security/authentications/services/utils/auth-controller.utils.d.ts.map +1 -1
  1132. package/dist/esm/security/authentications/services/utils/auth-credential-ops.backend.service.d.ts.map +1 -1
  1133. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  1134. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
  1135. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  1136. package/dist/esm/security/authentications/services/utils/auth-response-helper.backend.service.d.ts.map +1 -1
  1137. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  1138. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
  1139. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  1140. package/dist/esm/security/authentications/services/utils/concurrent-session-eviction.backend.utils.d.ts.map +1 -1
  1141. package/dist/esm/security/authentications/services/utils/ensure-user-profile.backend.utils.d.ts.map +1 -1
  1142. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
  1143. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  1144. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
  1145. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  1146. package/dist/esm/security/authentications/services/utils/machine-auth-rate-limit.backend.utils.d.ts.map +1 -1
  1147. package/dist/esm/security/authentications/services/utils/pkce.backend.utils.d.ts.map +1 -1
  1148. package/dist/esm/security/authentications/services/utils/saml-java-availability.d.ts.map +1 -1
  1149. package/dist/esm/security/authentications/utils/application-auth-policy-audit.backend.utils.d.ts.map +1 -1
  1150. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
  1151. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  1152. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
  1153. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  1154. package/dist/esm/security/authentications/utils/one-off-session-lifetime.backend.utils.d.ts.map +1 -1
  1155. package/dist/esm/security/authentications/utils/social-oauth2-purpose.backend.utils.d.ts.map +1 -1
  1156. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts +59 -0
  1157. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts.map +1 -0
  1158. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js +111 -0
  1159. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js.map +1 -0
  1160. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts +57 -0
  1161. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts.map +1 -0
  1162. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js +133 -0
  1163. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js.map +1 -0
  1164. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts +41 -0
  1165. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts.map +1 -0
  1166. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js +157 -0
  1167. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js.map +1 -0
  1168. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts +84 -0
  1169. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts.map +1 -0
  1170. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js +99 -0
  1171. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js.map +1 -0
  1172. package/dist/esm/security/authorizations/authorization-denial-audit.backend.utils.d.ts.map +1 -1
  1173. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
  1174. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
  1175. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
  1176. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
  1177. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  1178. package/dist/esm/security/authorizations/junction-scope-resolution.backend.d.ts.map +1 -1
  1179. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
  1180. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  1181. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
  1182. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  1183. package/dist/esm/security/authorizations/organization-unit-narrowing-enforcement.backend.d.ts.map +1 -1
  1184. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  1185. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +37 -124
  1186. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  1187. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -1
  1188. package/dist/esm/security/authorizations/relationship-foreign-key-filter.backend.d.ts.map +1 -1
  1189. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
  1190. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  1191. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
  1192. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  1193. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +133 -0
  1194. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
  1195. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +137 -0
  1196. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
  1197. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +134 -1
  1198. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  1199. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +152 -5
  1200. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  1201. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +146 -8
  1202. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  1203. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +328 -29
  1204. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  1205. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
  1206. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  1207. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
  1208. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  1209. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
  1210. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
  1211. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
  1212. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
  1213. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +299 -0
  1214. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
  1215. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +953 -0
  1216. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
  1217. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +99 -0
  1218. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
  1219. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
  1220. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
  1221. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
  1222. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
  1223. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
  1224. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
  1225. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +210 -0
  1226. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
  1227. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +423 -0
  1228. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
  1229. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
  1230. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  1231. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
  1232. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
  1233. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
  1234. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
  1235. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +282 -0
  1236. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
  1237. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +125 -0
  1238. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
  1239. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +123 -0
  1240. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
  1241. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
  1242. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
  1243. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
  1244. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
  1245. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +214 -0
  1246. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
  1247. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +430 -0
  1248. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
  1249. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
  1250. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  1251. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
  1252. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
  1253. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +98 -0
  1254. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
  1255. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
  1256. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
  1257. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
  1258. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
  1259. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
  1260. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
  1261. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
  1262. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
  1263. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
  1264. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
  1265. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts +34 -0
  1266. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts.map +1 -0
  1267. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js +39 -0
  1268. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js.map +1 -0
  1269. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  1270. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -1
  1271. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  1272. package/dist/esm/security/consumable-tokens/models/consumable-tokens.shared.schemas.d.ts.map +1 -1
  1273. package/dist/esm/security/consumable-tokens/models/index.d.ts.map +1 -1
  1274. package/dist/esm/security/consumable-tokens/services/__tests__/mock-consumable-token.service.d.ts.map +1 -1
  1275. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
  1276. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  1277. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
  1278. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  1279. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
  1280. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  1281. package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
  1282. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  1283. package/dist/esm/security/jwt/services/auth-jwt-guard.backend.service.d.ts.map +1 -1
  1284. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  1285. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts +13 -0
  1286. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts.map +1 -1
  1287. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js +14 -0
  1288. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js.map +1 -1
  1289. package/dist/esm/security/jwt/utils/jwt-verification-error-classification.backend.utils.d.ts.map +1 -1
  1290. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
  1291. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  1292. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
  1293. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  1294. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
  1295. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  1296. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
  1297. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  1298. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts +39 -0
  1299. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts.map +1 -0
  1300. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js +60 -0
  1301. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js.map +1 -0
  1302. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts +66 -0
  1303. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts.map +1 -0
  1304. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js +75 -0
  1305. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js.map +1 -0
  1306. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  1307. package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
  1308. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  1309. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
  1310. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  1311. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
  1312. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  1313. package/dist/esm/security/scim/utils/scim-attribute-path-resolver.backend.utils.d.ts.map +1 -1
  1314. package/dist/esm/security/scim/utils/scim-filter-parser.d.ts.map +1 -1
  1315. package/dist/esm/security/scim/utils/scim-response-formatter.d.ts.map +1 -1
  1316. package/dist/esm/security/session-invalidation-fence.backend.utils.d.ts.map +1 -1
  1317. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
  1318. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  1319. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
  1320. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  1321. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
  1322. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
  1323. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
  1324. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
  1325. package/dist/esm/security/token-invalidation-fence.backend.utils.d.ts.map +1 -1
  1326. package/dist/esm/testing.d.ts.map +1 -1
  1327. package/dist/esm/users/services/inbound-contact-custom-implementation.backend.service.d.ts.map +1 -1
  1328. package/dist/esm/users/services/user-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  1329. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts.map +1 -1
  1330. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
  1331. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
  1332. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
  1333. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
  1334. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.d.ts.map +1 -1
  1335. package/dist/esm/users/services/user-self-custom-implementations.backend.d.ts.map +1 -1
  1336. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.d.ts.map +1 -1
  1337. package/dist/tsconfig.build.tsbuildinfo +1 -1
  1338. package/package.json +11 -9
  1339. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts +0 -45
  1340. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts.map +0 -1
  1341. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js +0 -22
  1342. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js.map +0 -1
  1343. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
  1344. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
  1345. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
  1346. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
  1347. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
  1348. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
  1349. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
  1350. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
  1351. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
  1352. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
  1353. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
  1354. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
  1355. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
  1356. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
  1357. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
  1358. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"promotion.custom-ops.custom-impl.backend.service.js","sourceRoot":"","sources":["../../../../../../src/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,qBAAqB,EACrB,SAAS,EACT,2BAA2B,EAC3B,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yCAAyC,GAE1C,MAAM,4GAA4G,CAAC;AAEpH,OAAO,EAAE,kBAAkB,EAAE,MAAM,wFAAwF,CAAC;AAE5H,uEAAuE;AACvE,kCAAkC;AAClC,uEAAuE;AAEvE;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,4BAA4B;IAC1C,MAAM,OAAO,GAAG,CAAC,yBAA0D,EAAE,EAAE;QAC7E,OAAO,yCAAyC,CAAC;YAC/C,aAAa,EAAE;gBACb,kBAAkB,EAAE,gBAAgB,CAAC,UAAU;gBAC/C,mBAAmB,EAAE,qBAAqB,CAAC,MAAM;gBACjD,WAAW,EAAE,4BAA4B,CAAC,aAAa;gBACvD,kBAAkB,EAAE,IAAI;aACzB;YACD,QAAQ,EAAE;gBACR,oBAAoB,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE;oBAClF,+DAA+D;oBAC/D,IAAI,KAAK,CAAC,YAAY,KAAK,YAAY,CAAC,UAAU,IAAI,C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AO,GAAG,CAAC,yBAA0D,EAAE,EAAE;QAC7E,OAAO,yCAAyC,CAAC;YAC/C,aAAa,EAAE;gBACb,kBAAkB,EAAE,gBAAgB,CAAC,UAAU;gBAC/C,mBAAmB,EAAE,oBAAoB,CAAC,UAAU;gBACpD,WAAW,EAAE,4BAA4B,CAAC,QAAQ;gBAClD,kBAAkB,EAAE,IAAI;aACzB;YACD,QAAQ,EAAE;gBACR,oBAAoB,EAAE,KAAK,IAAI,EAAE;oBAC/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAC7B,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,OAAgE,CAAC;AAC1E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC;IAClD,MAAM,OAAO,GAAG,CAAC,yBAA0D,EAAE,EAAE;QAC7E,OAAO,yCAAyC,CAAC;YAC/C,aAAa,EAAE;gBACb,kBAAkB,EAAE,gBAAgB,CAAC,UAAU;gBAC/C,mBAAmB,EAAE,oBAAoB,CAAC,UAAU;gBACpD,WAAW,EAAE,4BAA4B,CAAC,QAAQ;gBAClD,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE,IAAI;aACtB;YACD,QAAQ,EAAE;gBACR,oBAAoB,EAAE,KAAK,IAAI,EAAE;oBAC/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAC7B,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,OAAgE,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * Promotion Custom Operations — CREATE (prefix), APPLY (replace), DEACTIVATE (prefix)\n *\n * Promotions are APPLICATION-scoped (not polymorphic) — 1 factory per operation.\n *\n * CREATE: PREFIX syncs coupon to billing provider → core CREATE writes to DB with provider IDs\n * APPLY: REPLACE validates the promotion + records redemption. No standard CRUD equivalent.\n * DEACTIVATE: PREFIX returns { isActive: false } → core UPDATE writes to DB\n *\n * @see billing-polymorphic-full-implementation.md §4.6.3 + §4.6.4 + §4.6.5\n */\n\nimport {\n CoreResourceType,\n ResourceOperationVariantType,\n CoreResourceOperation,\n ErrorType,\n ErrorCustomMessageReference,\n PromotionType,\n DiscountType,\n PromotionDuration,\n Promotion_Operations,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { getBillingProvider } from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-implementations.backend';\n\n// ════════════════════════════════════════════════════════════════════\n// CREATE — PREFIX_CORE_OPERATIONS\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create Promotion CREATE prefix factory.\n *\n * Syncs the coupon (and optionally promotion code) to the billing provider\n * before the core CREATE writes to DB. Augments input with provider IDs.\n *\n * Registered on `INTERNAL_CALL` — the variant the resource configuration actually declares\n * for CREATE. Same drift class as the billing-account CREATE prefix: authored against\n * `REPOSITORY_ONLY`, orphaned once the configured variant moved, and silent because custom\n * implementations resolve by an EXACT operation-path key embedding `variantType`. Orphaned,\n * the promotion row is persisted with no `providerCouponId` / `providerPromotionId`, and\n * OPEN_CHECKOUT later rejects it as \"not synced to billing provider\". Pinned by\n * `billing-custom-impl-operation-path-coherence.test.ts`.\n */\nexport function createPromotionCreateFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: CoreResourceOperation.CREATE,\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n // L5: Validate discount fields match the declared discountType\n if (input.discountType === DiscountType.PERCENTAGE && (input.discountPercentage === undefined || input.discountPercentage === null)) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { reason: 'discountPercentage is required for PERCENTAGE discount type' },\n });\n }\n if (input.discountType === DiscountType.FIXED_AMOUNT && !input.discountFixedAmount) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { reason: 'discountFixedAmount is required for FIXED_AMOUNT discount type' },\n });\n }\n\n const durationMap: Record<string, 'once' | 'repeating' | 'forever'> = {\n [PromotionDuration.ONCE]: 'once',\n [PromotionDuration.REPEATING]: 'repeating',\n [PromotionDuration.FOREVER]: 'forever',\n };\n\n // H1: Provider sync must succeed — throw on failure\n const provider = getBillingProvider();\n const couponResult = await provider.createCoupon({\n ...(input.discountType === DiscountType.PERCENTAGE && { percentOff: input.discountPercentage }),\n ...(input.discountType === DiscountType.FIXED_AMOUNT && input.discountFixedAmount && {\n amountOff: Number(input.discountFixedAmount.amount),\n currency: input.discountFixedAmount.currency,\n }),\n duration: durationMap[input.duration] ?? 'once',\n ...(input.durationInMonths && { durationInMonths: input.durationInMonths }),\n ...(input.maxRedemptions && { maxRedemptions: input.maxRedemptions }),\n ...(input.metadata && { metadata: input.metadata }),\n });\n const providerCouponId = couponResult.providerCouponId;\n\n let providerPromotionId: string | undefined;\n if (input.type === PromotionType.PROMOTION_CODE && input.code && providerCouponId) {\n const promoResult = await provider.createPromotionCode(providerCouponId, input.code);\n providerPromotionId = promoResult.providerPromotionId;\n }\n\n return {\n ...input,\n providerCouponId,\n providerPromotionId,\n isActive: true,\n timesRedeemed: 0,\n };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n// ════════════════════════════════════════════════════════════════════\n// APPLY — REPLACE_CORE_OPERATIONS\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create Promotion APPLY replace factory.\n *\n * Validates the promotion, records a redemption, and returns discount info.\n * The caller (typically OPEN_CHECKOUT) uses the returned discount to pass the coupon to Stripe.\n */\nexport function createPromotionApplyFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: Promotion_Operations.APPLY,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n replaceCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const promotion = utils.currentObject;\n\n // Validate promotion is active\n if (!promotion.isActive) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Promotion is not active' },\n });\n }\n\n // Validate date range\n const now = new Date();\n if (promotion.validFrom && now < new Date(promotion.validFrom)) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Promotion has not started yet' },\n });\n }\n if (promotion.validUntil && now > new Date(promotion.validUntil)) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Promotion has expired' },\n });\n }\n\n // Validate max redemptions\n if (promotion.maxRedemptions !== null && promotion.maxRedemptions !== undefined) {\n if ((promotion.timesRedeemed ?? 0) >= promotion.maxRedemptions) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Maximum redemptions reached' },\n });\n }\n }\n\n // Validate code match (when the promotion has a code)\n if (promotion.code && input.code !== promotion.code) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Code does not match' },\n });\n }\n\n // C2: Atomically increment timesRedeemed to prevent race conditions\n if (promotion.maxRedemptions !== null && promotion.maxRedemptions !== undefined) {\n const result = await utils.repositoriesRegistry.atomicGuardedMutation(\n CoreResourceType.PROMOTIONS,\n { _id, timesRedeemed: { $lt: promotion.maxRedemptions } },\n { increment: { timesRedeemed: 1 } },\n executionContext,\n );\n if (!result) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Maximum redemptions reached' },\n });\n }\n } else {\n await utils.repositoriesRegistry.atomicGuardedMutation(\n CoreResourceType.PROMOTIONS,\n { _id },\n { increment: { timesRedeemed: 1 } },\n executionContext,\n );\n }\n\n // Return discount info for the caller\n return {\n valid: true,\n promotionId: _id,\n providerCouponId: promotion.providerCouponId,\n providerPromotionId: promotion.providerPromotionId,\n discount: {\n type: promotion.discountType,\n ...(promotion.discountType === DiscountType.PERCENTAGE && { percentage: promotion.discountPercentage }),\n ...(promotion.discountType === DiscountType.FIXED_AMOUNT && { amount: promotion.discountFixedAmount }),\n },\n };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n// ════════════════════════════════════════════════════════════════════\n// DEACTIVATE — PREFIX_CORE_OPERATIONS\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create Promotion DEACTIVATE prefix factory.\n *\n * Trivially returns { isActive: false } — core UPDATE writes to DB.\n *\n * The operation declares `requestDto: z.object({})` (single) / `{ _ids }` (bulk), so `isActive`\n * can ONLY arrive from here. Before that narrowing the verb inherited the resource's full update\n * contract — including `isActive` itself, so \"deactivate\" could re-activate — and this return was\n * MERGED onto the caller payload rather than replacing it, leaving `code`, `discountPercentage`\n * and `maxRedemptions` writable through a route named deactivate.\n */\nexport function createPromotionDeactivateFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: Promotion_Operations.DEACTIVATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async () => {\n return { isActive: false };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n/**\n * Create Promotion DEACTIVATE prefix factory — BULK companion (`haveBulkOperation: true`).\n *\n * A bulk companion is a SEPARATE operation variant with its own path key (`isOperationDefault:\n * false` + `isBulkOperation: true`), so it needs its own registration: the single-row factory\n * above does not cover it. The bulk contract is `{ _ids }` and `_ids` is not a persisted field,\n * so without this handler the route would validate a list of promotion ids and write nothing.\n */\nexport function createPromotionDeactivateBulkFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: Promotion_Operations.DEACTIVATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: false,\n isBulkOperation: true,\n },\n handlers: {\n prefixCoreOperations: async () => {\n return { isActive: false };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n"]}
1
+ {"version":3,"file":"promotion.custom-ops.custom-impl.backend.service.js","sourceRoot":"","sources":["../../../../../src/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,qBAAqB,EACrB,SAAS,EACT,2BAA2B,EAC3B,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,uBAA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AAC,UAAU;gBACpD,WAAW,EAAE,4BAA4B,CAAC,QAAQ;gBAClD,kBAAkB,EAAE,IAAI;aACzB;YACD,QAAQ,EAAE;gBACR,oBAAoB,EAAE,KAAK,IAAI,EAAE;oBAC/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAC7B,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,OAAgE,CAAC;AAC1E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oCAAoC;IAClD,MAAM,OAAO,GAAG,CAAC,yBAA0D,EAAE,EAAE;QAC7E,OAAO,yCAAyC,CAAC;YAC/C,aAAa,EAAE;gBACb,kBAAkB,EAAE,gBAAgB,CAAC,UAAU;gBAC/C,mBAAmB,EAAE,oBAAoB,CAAC,UAAU;gBACpD,WAAW,EAAE,4BAA4B,CAAC,QAAQ;gBAClD,kBAAkB,EAAE,KAAK;gBACzB,eAAe,EAAE,IAAI;aACtB;YACD,QAAQ,EAAE;gBACR,oBAAoB,EAAE,KAAK,IAAI,EAAE;oBAC/B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAC7B,CAAC;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,OAAgE,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * Promotion Custom Operations — CREATE (prefix), APPLY (replace), DEACTIVATE (prefix)\n *\n * Promotions are APPLICATION-scoped (not polymorphic) — 1 factory per operation.\n *\n * CREATE: PREFIX syncs coupon to billing provider → core CREATE writes to DB with provider IDs\n * APPLY: REPLACE validates the promotion and reports its discount. No standard CRUD equivalent,\n * and it records NO redemption — completion does (see the factory's docstring).\n * DEACTIVATE: PREFIX returns { isActive: false } → core UPDATE writes to DB\n *\n * @see billing-polymorphic-full-implementation.md §4.6.3 + §4.6.4 + §4.6.5\n */\n\nimport {\n CoreResourceType,\n ResourceOperationVariantType,\n CoreResourceOperation,\n ErrorType,\n ErrorCustomMessageReference,\n PromotionType,\n DiscountType,\n PromotionDuration,\n Promotion_Operations,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { getBillingProvider } from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-implementations.backend';\n\n// ════════════════════════════════════════════════════════════════════\n// CREATE — PREFIX_CORE_OPERATIONS\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create Promotion CREATE prefix factory.\n *\n * Syncs the coupon (and optionally promotion code) to the billing provider\n * before the core CREATE writes to DB. Augments input with provider IDs.\n *\n * Registered on `INTERNAL_CALL` — the variant the resource configuration actually declares\n * for CREATE. Same drift class as the billing-account CREATE prefix: authored against\n * `REPOSITORY_ONLY`, orphaned once the configured variant moved, and silent because custom\n * implementations resolve by an EXACT operation-path key embedding `variantType`. Orphaned,\n * the promotion row is persisted with no `providerCouponId` / `providerPromotionId`, and\n * OPEN_CHECKOUT later rejects it as \"not synced to billing provider\". Pinned by\n * `billing-custom-impl-operation-path-coherence.test.ts`.\n */\nexport function createPromotionCreateFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: CoreResourceOperation.CREATE,\n variantType: ResourceOperationVariantType.INTERNAL_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n // L5: Validate discount fields match the declared discountType\n if (input.discountType === DiscountType.PERCENTAGE && (input.discountPercentage === undefined || input.discountPercentage === null)) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { reason: 'discountPercentage is required for PERCENTAGE discount type' },\n });\n }\n if (input.discountType === DiscountType.FIXED_AMOUNT && !input.discountFixedAmount) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { reason: 'discountFixedAmount is required for FIXED_AMOUNT discount type' },\n });\n }\n\n const durationMap: Record<string, 'once' | 'repeating' | 'forever'> = {\n [PromotionDuration.ONCE]: 'once',\n [PromotionDuration.REPEATING]: 'repeating',\n [PromotionDuration.FOREVER]: 'forever',\n };\n\n // H1: Provider sync must succeed — throw on failure\n const provider = getBillingProvider();\n const couponResult = await provider.createCoupon({\n ...(input.discountType === DiscountType.PERCENTAGE && { percentOff: input.discountPercentage }),\n ...(input.discountType === DiscountType.FIXED_AMOUNT && input.discountFixedAmount && {\n amountOff: Number(input.discountFixedAmount.amount),\n currency: input.discountFixedAmount.currency,\n }),\n duration: durationMap[input.duration] ?? 'once',\n ...(input.durationInMonths && { durationInMonths: input.durationInMonths }),\n ...(input.maxRedemptions && { maxRedemptions: input.maxRedemptions }),\n ...(input.metadata && { metadata: input.metadata }),\n });\n const providerCouponId = couponResult.providerCouponId;\n\n let providerPromotionId: string | undefined;\n if (input.type === PromotionType.PROMOTION_CODE && input.code && providerCouponId) {\n const promoResult = await provider.createPromotionCode(providerCouponId, input.code);\n providerPromotionId = promoResult.providerPromotionId;\n }\n\n return {\n ...input,\n providerCouponId,\n providerPromotionId,\n isActive: true,\n timesRedeemed: 0,\n };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n// ════════════════════════════════════════════════════════════════════\n// APPLY — REPLACE_CORE_OPERATIONS\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create Promotion APPLY replace factory.\n *\n * VALIDATES the promotion and returns its discount info. It records NOTHING.\n *\n * The redemption is counted when the purchase COMPLETES — `handleCheckoutCompleted`, behind the\n * durable settlement claim — because entering a code is not redeeming one. See the block where the\n * increment used to be for the full reasoning, including why leaving it here would double-count.\n *\n * The docstring here previously said \"the caller (typically OPEN_CHECKOUT)\". `OPEN_CHECKOUT` has\n * never called this verb: it re-validates a supplied code inline. This is a CLIENT-facing verb, for\n * a purchase form that wants to show the discount before the customer commits.\n */\nexport function createPromotionApplyFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: Promotion_Operations.APPLY,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n replaceCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const promotion = utils.currentObject;\n\n // Validate promotion is active\n if (!promotion.isActive) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Promotion is not active' },\n });\n }\n\n // Validate date range\n const now = new Date();\n if (promotion.validFrom && now < new Date(promotion.validFrom)) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Promotion has not started yet' },\n });\n }\n if (promotion.validUntil && now > new Date(promotion.validUntil)) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Promotion has expired' },\n });\n }\n\n // Validate max redemptions\n if (promotion.maxRedemptions !== null && promotion.maxRedemptions !== undefined) {\n if ((promotion.timesRedeemed ?? 0) >= promotion.maxRedemptions) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Maximum redemptions reached' },\n });\n }\n }\n\n // Validate code match (when the promotion has a code)\n if (promotion.code && input.code !== promotion.code) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PROMOTION_INVALID,\n context: { promotionId: _id, reason: 'Code does not match' },\n });\n }\n\n /*\n * COUNTS NOTHING, and that is the change (#518 follow-up).\n *\n * This used to increment `timesRedeemed` here, guarded by the cap. It was the only place\n * a redemption was ever counted, and it counted at the WRONG MOMENT — this verb runs when\n * a customer types a code into a purchase form, which is not a redemption. A customer who\n * types a code and closes the tab consumed one anyway, so a limited campaign was exhausted\n * by window-shoppers.\n *\n * A redemption is now counted exactly where the money moves: the\n * `checkout.session.completed` webhook, behind the durable settlement claim that makes the\n * count exactly-once across replicas and retries. Leaving the increment here as well would\n * double-count every customer who used this verb and then completed the purchase — the two\n * are two views of ONE redemption, not two redemptions.\n *\n * The cap check above stays, because it is what makes this verb answer honestly: an\n * exhausted code must be refused at the moment it is entered, not silently accepted and\n * then refused at completion when the customer has already paid.\n */\n\n // Return discount info for the caller\n return {\n valid: true,\n promotionId: _id,\n providerCouponId: promotion.providerCouponId,\n providerPromotionId: promotion.providerPromotionId,\n discount: {\n type: promotion.discountType,\n ...(promotion.discountType === DiscountType.PERCENTAGE && { percentage: promotion.discountPercentage }),\n ...(promotion.discountType === DiscountType.FIXED_AMOUNT && { amount: promotion.discountFixedAmount }),\n },\n };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n// ════════════════════════════════════════════════════════════════════\n// DEACTIVATE — PREFIX_CORE_OPERATIONS\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create Promotion DEACTIVATE prefix factory.\n *\n * Trivially returns { isActive: false } — core UPDATE writes to DB.\n *\n * The operation declares `requestDto: z.object({})` (single) / `{ _ids }` (bulk), so `isActive`\n * can ONLY arrive from here. Before that narrowing the verb inherited the resource's full update\n * contract — including `isActive` itself, so \"deactivate\" could re-activate — and this return was\n * MERGED onto the caller payload rather than replacing it, leaving `code`, `discountPercentage`\n * and `maxRedemptions` writable through a route named deactivate.\n */\nexport function createPromotionDeactivateFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: Promotion_Operations.DEACTIVATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async () => {\n return { isActive: false };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n\n/**\n * Create Promotion DEACTIVATE prefix factory — BULK companion (`haveBulkOperation: true`).\n *\n * A bulk companion is a SEPARATE operation variant with its own path key (`isOperationDefault:\n * false` + `isBulkOperation: true`), so it needs its own registration: the single-row factory\n * above does not cover it. The bulk contract is `{ _ids }` and `_ids` is not a persisted field,\n * so without this handler the route would validate a list of promotion ids and write nothing.\n */\nexport function createPromotionDeactivateBulkFactory(): ResourceCustomServiceImplementationFactory {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: CoreResourceType.PROMOTIONS,\n operationIdentifier: Promotion_Operations.DEACTIVATE,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: false,\n isBulkOperation: true,\n },\n handlers: {\n prefixCoreOperations: async () => {\n return { isActive: false };\n },\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.mutations.custom-impl.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../src/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiBH,OAAO,EAEL,KAAK,0CAA0C,EAChD,MAAM,4GAA4G,CAAC;AAuBpH,wBAAgB,iCAAiC,IAAI,0CAA0C,EAAE,CAqChG;AAMD;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,IAAI,0CAA0C,EAAE,CAwChG;AAMD;;;;;;;;GAQG;AACH,wBAAgB,qCAAqC,IAAI,0CAA0C,EAAE,CAiHpG;AAMD;;;;;;;;GAQG;AACH,wBAAgB,mCAAmC,IAAI,0CAA0C,EAAE,CAuFlG;AAMD;;;;;;;;GAQG;AACH,wBAAgB,sCAAsC,IAAI,0CAA0C,EAAE,CA8CrG"}
1
+ {"version":3,"file":"subscription.mutations.custom-impl.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAiBH,OAAO,EAEL,KAAK,0CAA0C,EAChD,MAAM,4GAA4G,CAAC;AA8CpH,wBAAgB,iCAAiC,IAAI,0CAA0C,EAAE,CA0FhG;AAMD;;;;;;;GAOG;AACH,wBAAgB,iCAAiC,IAAI,0CAA0C,EAAE,CAwChG;AAMD;;;;;;;;GAQG;AACH,wBAAgB,qCAAqC,IAAI,0CAA0C,EAAE,CA0HpG;AAMD;;;;;;;;GAQG;AACH,wBAAgB,mCAAmC,IAAI,0CAA0C,EAAE,CAoFlG;AAMD;;;;;;;;GAQG;AACH,wBAAgB,sCAAsC,IAAI,0CAA0C,EAAE,CAmDrG"}
@@ -17,12 +17,29 @@
17
17
  import { CoreResourceType, ResourceOperationVariantType, SubscriptionStatus, ErrorType, ErrorCustomMessageReference, ProductType, ProrationBehavior, BillingTiming, BillingSubscription_Operations, BillingSubscription_CancelRequestDto, BillingSubscription_ChangePlanRequestDto, BillingSubscription_AddAddonRequestDto, BillingSubscription_RemoveAddonRequestDto, } from '@wildo-ai/saas-models';
18
18
  import { createResourceCustomServiceImplementation, } from '../../../base-classes/services/services/resource-operation-custom-implementation.factory.backend.js';
19
19
  import { getBillingProvider, getBillingConfig } from '../../../billing/services/custom-impl/billing-custom-implementations.backend.js';
20
- import { readProductByKey, readProductById, readPriceById, readPriceForProduct, validateProviderSubscription, resolveProviderItems, } from '../../../billing/services/custom-impl/billing-custom-impl-utils.backend.js';
20
+ import { BillingCatalogReadIntent, readProductByKey, readProductById, readPriceById, readPriceForProduct, validateProviderSubscription, resolveProviderItems, } from '../../../billing/services/custom-impl/billing-custom-impl-utils.backend.js';
21
21
  // ── Subscription polymorphic variant types ───────────────────────────
22
22
  const SUBSCRIPTION_VARIANT_TYPES = [
23
23
  CoreResourceType.ORGANIZATION_SUBSCRIPTIONS,
24
24
  CoreResourceType.USER_SUBSCRIPTIONS,
25
25
  ];
26
+ /**
27
+ * The subscription item carrying the PLAN, or `null` when a subscription holds only addons.
28
+ *
29
+ * A subscription's items are a plan plus any addons, and three places in this file needed to find
30
+ * the plan among them — the change-plan path, the addon plan-tier gate, and now the cancellation
31
+ * policy (#408). Each had its own inline loop. One helper because "which item is the plan" is a
32
+ * single question with a single answer, and three copies is how the fourth one comes to differ.
33
+ */
34
+ async function resolvePlanItem(subscription, executionContext, utils) {
35
+ for (const item of subscription.items) {
36
+ const itemProduct = await readProductById(item.productId, executionContext, utils);
37
+ if (itemProduct.type === ProductType.PLAN) {
38
+ return item;
39
+ }
40
+ }
41
+ return null;
42
+ }
26
43
  // ════════════════════════════════════════════════════════════════════
27
44
  // CANCEL
28
45
  // ════════════════════════════════════════════════════════════════════
@@ -41,7 +58,58 @@ export function createSubscriptionCancelFactories() {
41
58
  prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {
42
59
  const subscription = utils.currentObject;
43
60
  validateProviderSubscription(subscription, _id, executionContext, utils);
44
- const cancelImmediately = input.cancelImmediately;
61
+ /*
62
+ * `ProductBehaviorPolicy.cancellation` now governs this operation (#408, decided
63
+ * 2026-09-08). Until then it was read by NOTHING: timing came solely from the caller's
64
+ * `cancelImmediately` flag, so a product declaring that immediate cancellation is not
65
+ * allowed could not refuse one — and Wonder Todos authors `allowImmediate: false` on
66
+ * BOTH plans, unenforced.
67
+ *
68
+ * Two distinct things come from the policy, and conflating them was the trap:
69
+ * - `allowImmediate` is a REFUSAL. A caller who asks for immediate cancellation
70
+ * against a product that forbids it gets a 409, not a silent downgrade to
71
+ * period-end. Silently honouring the safer timing would tell the caller their
72
+ * subscription had ended when it has not, which is worse than refusing.
73
+ * - `defaultBehavior` decides the timing when the caller expresses NO preference.
74
+ * `cancelImmediately` is optional on the request DTO, so "absent" is a real state
75
+ * and is where an authored default belongs.
76
+ *
77
+ * The policy is read from the subscription's PLAN product, resolved the same way the
78
+ * change-plan path above resolves it. An addon does not carry the cancellation policy
79
+ * of the subscription it rides on.
80
+ */
81
+ const planItem = await resolvePlanItem(subscription, executionContext, utils);
82
+ const planProduct = planItem
83
+ ? await readProductById(planItem.productId, executionContext, utils)
84
+ : null;
85
+ const cancellationPolicy = planProduct?.behaviorPolicy?.cancellation;
86
+ const requestedImmediate = input.cancelImmediately;
87
+ if (requestedImmediate === true && cancellationPolicy?.allowImmediate === false) {
88
+ throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {
89
+ customMessageReference: ErrorCustomMessageReference.CONFLICT,
90
+ context: {
91
+ reason: 'billing_product_forbids_immediate_cancellation',
92
+ message: 'This plan does not allow immediate cancellation; it can only be cancelled at the end of the current period.',
93
+ productKey: planProduct?.key,
94
+ },
95
+ });
96
+ }
97
+ /*
98
+ * Absent preference resolves down a chain, most specific first: the caller, the plan
99
+ * product's own default, the application's `defaultCancellation`, then period-end.
100
+ *
101
+ * The application-level step is what makes `billing.defaultBehaviorPolicy.defaultCancellation`
102
+ * mean something. It was dead alongside its neighbours, and it is BOUND rather than
103
+ * relabelled because — unlike grace periods and retry counts, which are dunning settings
104
+ * living at the provider — cancellation timing is resolved locally. The only thing
105
+ * standing between that key and an effect was a reader.
106
+ *
107
+ * Period-end is the floor because it never ends access a customer has already paid for.
108
+ */
109
+ const resolvedTiming = cancellationPolicy?.defaultBehavior
110
+ ?? getBillingConfig().defaultBehaviorPolicy?.defaultCancellation;
111
+ const cancelImmediately = requestedImmediate
112
+ ?? (resolvedTiming === BillingTiming.IMMEDIATE);
45
113
  const atPeriodEnd = !cancelImmediately;
46
114
  const provider = getBillingProvider();
47
115
  await provider.cancelSubscription(subscription.providerSubscriptionId, { atPeriodEnd });
@@ -133,7 +201,8 @@ export function createSubscriptionChangePlanFactories() {
133
201
  prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {
134
202
  const subscription = utils.currentObject;
135
203
  validateProviderSubscription(subscription, _id, executionContext, utils);
136
- const newProduct = await readProductByKey(input.newProductKey, executionContext, utils);
204
+ // ACQUIRE: the subscription is being moved ONTO this product.
205
+ const newProduct = await readProductByKey(input.newProductKey, BillingCatalogReadIntent.ACQUIRE, executionContext, utils);
137
206
  // The price MUST belong to the product being switched to. These were resolved
138
207
  // independently, so pairing a premium `newProductKey` with a cheap `newPriceId` billed the
139
208
  // provider the cheap price while the local item — and every entitlement derived from
@@ -146,14 +215,8 @@ export function createSubscriptionChangePlanFactories() {
146
215
  });
147
216
  }
148
217
  // Find the current plan item (type === PLAN) and determine upgrade/downgrade
149
- let planItemIndex = -1;
150
- for (let i = 0; i < subscription.items.length; i++) {
151
- const itemProduct = await readProductById(subscription.items[i].productId, executionContext, utils);
152
- if (itemProduct.type === ProductType.PLAN) {
153
- planItemIndex = i;
154
- break;
155
- }
156
- }
218
+ const currentPlanItem = await resolvePlanItem(subscription, executionContext, utils);
219
+ const planItemIndex = currentPlanItem ? subscription.items.indexOf(currentPlanItem) : -1;
157
220
  // Build provider items: replace plan item, preserve addons
158
221
  const providerItems = [];
159
222
  const localItems = [];
@@ -205,11 +268,25 @@ export function createSubscriptionChangePlanFactories() {
205
268
  const provider = getBillingProvider();
206
269
  await provider.updateSubscription(subscription.providerSubscriptionId, {
207
270
  items: providerItems,
271
+ /*
272
+ * The resolved proration, as a REQUEST FIELD (#516).
273
+ *
274
+ * It was `metadata.prorationBehavior` until 2026-09-08 — a free-form key/value bag the
275
+ * provider stores and never reads — so this policy was correctly resolved from the target
276
+ * product's `upgrade`/`downgrade` block and then discarded at the boundary. A product
277
+ * declaring `ProrationBehavior.NONE` for a downgrade was prorated anyway, by the
278
+ * provider's account default. Wonder Todos authors exactly that.
279
+ */
280
+ prorationBehavior: policy.proration,
208
281
  metadata: {
209
- prorationBehavior: policy.proration,
210
- // Timing is captured for provider connectors that support deferred changes
211
- // (e.g., Stripe subscription schedules). Connectors that don't support it
212
- // will ignore the field and apply the change immediately.
282
+ /*
283
+ * TIMING remains metadata, and that is honest rather than an oversight: a provider's
284
+ * proration parameter says HOW a change settles, not WHEN it applies. Deferring a
285
+ * change to the period end needs a subscription schedule, which is a different call and
286
+ * a different mechanism — so `prorationTiming` is still carried for a connector that
287
+ * grows one, and still changes nothing today. Do not read this field's presence as the
288
+ * timing being honoured.
289
+ */
213
290
  prorationTiming: policy.timing,
214
291
  },
215
292
  });
@@ -250,7 +327,8 @@ export function createSubscriptionAddAddonFactories() {
250
327
  const subscription = utils.currentObject;
251
328
  validateProviderSubscription(subscription, _id, executionContext, utils);
252
329
  // Resolve addon product and validate
253
- const addonProduct = await readProductByKey(input.addonProductKey, executionContext, utils);
330
+ // ACQUIRE: an add-on is being bought.
331
+ const addonProduct = await readProductByKey(input.addonProductKey, BillingCatalogReadIntent.ACQUIRE, executionContext, utils);
254
332
  if (addonProduct.type !== ProductType.ADDON) {
255
333
  throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {
256
334
  customMessageReference: ErrorCustomMessageReference.BILLING_INVALID_PRODUCT_TYPE,
@@ -259,14 +337,10 @@ export function createSubscriptionAddAddonFactories() {
259
337
  }
260
338
  // Validate requiredPlanTiers
261
339
  if (addonProduct.requiredPlanTiers && addonProduct.requiredPlanTiers.length > 0) {
262
- let currentPlanTier;
263
- for (const item of subscription.items) {
264
- const itemProduct = await readProductById(item.productId, executionContext, utils);
265
- if (itemProduct.type === ProductType.PLAN) {
266
- currentPlanTier = itemProduct.planTier;
267
- break;
268
- }
269
- }
340
+ const planItemForTier = await resolvePlanItem(subscription, executionContext, utils);
341
+ const currentPlanTier = planItemForTier
342
+ ? (await readProductById(planItemForTier.productId, executionContext, utils)).planTier
343
+ : undefined;
270
344
  if (!currentPlanTier || !addonProduct.requiredPlanTiers.includes(currentPlanTier)) {
271
345
  throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {
272
346
  customMessageReference: ErrorCustomMessageReference.BILLING_PLAN_TIER_REQUIRED,
@@ -341,7 +415,12 @@ export function createSubscriptionRemoveAddonFactories() {
341
415
  const subscription = utils.currentObject;
342
416
  validateProviderSubscription(subscription, _id, executionContext, utils);
343
417
  // Resolve addon product
344
- const addonProduct = await readProductByKey(input.addonProductKey, executionContext, utils);
418
+ /*
419
+ * REFERENCE, deliberately — the ONE site of the four that must not refuse a retired
420
+ * product. This resolves the add-on the subscription ALREADY carries in order to drop
421
+ * it, so gating it would trap a customer on the very add-on the catalogue withdrew.
422
+ */
423
+ const addonProduct = await readProductByKey(input.addonProductKey, BillingCatalogReadIntent.REFERENCE, executionContext, utils);
345
424
  // Find and remove the addon item
346
425
  const remainingItems = subscription.items.filter((item) => item.productId !== addonProduct._id);
347
426
  if (remainingItems.length === subscription.items.length) {
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.mutations.custom-impl.backend.service.js","sourceRoot":"","sources":["../../../../../../src/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,kBAAkB,EAClB,SAAS,EACT,2BAA2B,EAC3B,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,8BAA8B,EAC9B,oCAAoC,EACpC,wCAAwC,EACxC,sCAAsC,EACtC,yCAAyC,GAC1C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yCAAyC,GAE1C,MAAM,4GAA4G,CAAC;AAEp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AAkB,EAAE,CAAC;wBACtC,MAAM,QAAQ,CAAC,kBAAkB,CAAC,YAAY,CAAC,sBAAsB,EAAE;4BACrE,KAAK,EAAE,aAAa;yBACrB,CAAC,CAAC;wBAEH,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;oBACnC,CAAC;oBAED,kFAAkF;iBACnF;aACF,CAAC,CAAC;QACL,CAAC,CAAC;QAEF,OAAO,OAAgE,CAAC;IAC1E,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * Subscription Mutations Custom Implementations\n *\n * Implements CANCEL, RESUME, CHANGE_PLAN, ADD_ADDON, REMOVE_ADDON operations\n * on subscription polymorphic variants.\n *\n * Pattern: PREFIX_CORE_OPERATIONS\n * PREFIX → validate, call billing provider (Stripe), return update payload\n * CORE → standard UPDATE (engine handles DB write)\n * Feature sync is handled automatically by the post-operation hook infrastructure.\n *\n * One factory per polymorphic variant (org, user) per operation.\n * All variants share the same handler logic.\n *\n * @see billing-polymorphic-full-implementation.md §4.2 + §4.3\n */\n\nimport {\n CoreResourceType,\n ResourceOperationVariantType,\n SubscriptionStatus,\n ErrorType,\n ErrorCustomMessageReference,\n ProductType,\n ProrationBehavior,\n BillingTiming,\n BillingSubscription_Operations,\n BillingSubscription_CancelRequestDto,\n BillingSubscription_ChangePlanRequestDto,\n BillingSubscription_AddAddonRequestDto,\n BillingSubscription_RemoveAddonRequestDto,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { getBillingProvider, getBillingConfig } from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-implementations.backend';\nimport {\n readProductByKey,\n readProductById,\n readPriceById,\n readPriceForProduct,\n validateProviderSubscription,\n resolveProviderItems,\n} from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-impl-utils.backend';\n\n// ── Subscription polymorphic variant types ───────────────────────────\n\nconst SUBSCRIPTION_VARIANT_TYPES = [\n CoreResourceType.ORGANIZATION_SUBSCRIPTIONS,\n CoreResourceType.USER_SUBSCRIPTIONS,\n] as const;\n\n// ════════════════════════════════════════════════════════════════════\n// CANCEL\n// ════════════════════════════════════════════════════════════════════\n\nexport function createSubscriptionCancelFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.CANCEL,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_CancelRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n const cancelImmediately = input.cancelImmediately;\n const atPeriodEnd = !cancelImmediately;\n\n const provider = getBillingProvider();\n await provider.cancelSubscription(subscription.providerSubscriptionId, { atPeriodEnd });\n\n return {\n cancelAtPeriodEnd: atPeriodEnd,\n cancelledAt: new Date(),\n ...(!atPeriodEnd && { status: SubscriptionStatus.CANCELLED }),\n ...(input.reason && { cancellationReason: input.reason }),\n };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// RESUME\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create RESUME custom impl factories for all subscription variants.\n *\n * RESUME un-cancels a subscription that has cancelAtPeriodEnd = true.\n * PREFIX: validates subscription is pending cancellation, calls provider resumeSubscription()\n * CORE: standard UPDATE clears cancellation fields\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionResumeFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.RESUME,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async (_id, _input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n if (!subscription.cancelAtPeriodEnd) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_NO_ACTIVE_SUBSCRIPTION,\n context: { subscriptionId: _id, reason: 'Subscription is not pending cancellation' },\n });\n }\n\n const provider = getBillingProvider();\n await provider.resumeSubscription(subscription.providerSubscriptionId);\n\n return {\n cancelAtPeriodEnd: false,\n cancelledAt: null,\n cancellationReason: null,\n status: SubscriptionStatus.ACTIVE,\n };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// CHANGE_PLAN\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create CHANGE_PLAN custom impl factories for all subscription variants.\n *\n * CHANGE_PLAN upgrades or downgrades the subscription plan.\n * PREFIX: resolves new product/price, determines proration, builds provider items,\n * calls provider updateSubscription(), returns update payload with new items\n * CORE: standard UPDATE writes new items to DB\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionChangePlanFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.CHANGE_PLAN,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_ChangePlanRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n const newProduct = await readProductByKey(input.newProductKey, executionContext, utils);\n // The price MUST belong to the product being switched to. These were resolved\n // independently, so pairing a premium `newProductKey` with a cheap `newPriceId` billed the\n // provider the cheap price while the local item — and every entitlement derived from\n // `item.productId` — recorded the premium product.\n const newPrice = await readPriceForProduct(input.newPriceId, newProduct, executionContext, utils);\n\n if (!newPrice.providerPriceId) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_NO_PROVIDER_PRICE,\n context: { priceId: input.newPriceId, productKey: input.newProductKey },\n });\n }\n\n // Find the current plan item (type === PLAN) and determine upgrade/downgrade\n let planItemIndex = -1;\n for (let i = 0; i < subscription.items.length; i++) {\n const itemProduct = await readProductById(subscription.items[i].productId, executionContext, utils);\n if (itemProduct.type === ProductType.PLAN) {\n planItemIndex = i;\n break;\n }\n }\n\n // Build provider items: replace plan item, preserve addons\n const providerItems: Array<{ providerSubscriptionItemId?: string; providerPriceId: string; quantity: number }> = [];\n const localItems: Array<any> = [];\n\n for (let i = 0; i < subscription.items.length; i++) {\n if (i === planItemIndex) {\n providerItems.push({\n providerSubscriptionItemId: subscription.items[i].providerSubscriptionItemId,\n providerPriceId: newPrice.providerPriceId,\n quantity: 1,\n });\n localItems.push({\n _id: subscription.items[i]._id,\n productId: newProduct._id,\n priceId: newPrice._id,\n quantity: 1,\n });\n } else {\n const price = await readPriceById(subscription.items[i].priceId, executionContext, utils);\n providerItems.push({\n providerSubscriptionItemId: subscription.items[i].providerSubscriptionItemId,\n providerPriceId: price.providerPriceId || subscription.items[i].priceId,\n quantity: subscription.items[i].quantity,\n });\n localItems.push(subscription.items[i]);\n }\n }\n\n // If no plan item found, prepend the new plan\n if (planItemIndex === -1) {\n providerItems.unshift({ providerPriceId: newPrice.providerPriceId, quantity: 1 });\n localItems.unshift({\n _id: `${subscription.providerSubscriptionId}_item_plan`,\n productId: newProduct._id,\n priceId: newPrice._id,\n quantity: 1,\n });\n }\n\n // Determine proration from product behavior policy\n const currentProduct = planItemIndex >= 0\n ? await readProductById(subscription.items[planItemIndex].productId, executionContext, utils)\n : null;\n const isUpgrade = currentProduct\n ? (newProduct.planTierOrder ?? 0) > (currentProduct.planTierOrder ?? 0)\n : true;\n const config = getBillingConfig();\n const policy = isUpgrade\n ? (newProduct.behaviorPolicy?.upgrade ?? { proration: config.defaultBehaviorPolicy.defaultProration, timing: BillingTiming.IMMEDIATE })\n : (newProduct.behaviorPolicy?.downgrade ?? { proration: ProrationBehavior.NONE, timing: BillingTiming.AT_PERIOD_END });\n\n const provider = getBillingProvider();\n await provider.updateSubscription(subscription.providerSubscriptionId, {\n items: providerItems,\n metadata: {\n prorationBehavior: policy.proration,\n // Timing is captured for provider connectors that support deferred changes\n // (e.g., Stripe subscription schedules). Connectors that don't support it\n // will ignore the field and apply the change immediately.\n prorationTiming: policy.timing,\n },\n });\n\n return { items: localItems };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// ADD_ADDON\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create ADD_ADDON custom impl factories for all subscription variants.\n *\n * ADD_ADDON adds an addon product to the existing subscription.\n * PREFIX: validates addon product (type, requiredPlanTiers), builds provider items,\n * calls provider updateSubscription(), returns update payload with expanded items\n * CORE: standard UPDATE writes new items to DB\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionAddAddonFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.ADD_ADDON,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_AddAddonRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n // Resolve addon product and validate\n const addonProduct = await readProductByKey(input.addonProductKey, executionContext, utils);\n if (addonProduct.type !== ProductType.ADDON) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_INVALID_PRODUCT_TYPE,\n context: { productKey: input.addonProductKey, expectedType: ProductType.ADDON, actualType: addonProduct.type },\n });\n }\n\n // Validate requiredPlanTiers\n if (addonProduct.requiredPlanTiers && addonProduct.requiredPlanTiers.length > 0) {\n let currentPlanTier: string | undefined;\n for (const item of subscription.items) {\n const itemProduct = await readProductById(item.productId, executionContext, utils);\n if (itemProduct.type === ProductType.PLAN) {\n currentPlanTier = itemProduct.planTier;\n break;\n }\n }\n if (!currentPlanTier || !addonProduct.requiredPlanTiers.includes(currentPlanTier)) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PLAN_TIER_REQUIRED,\n context: { addonProductKey: input.addonProductKey, requiredTiers: addonProduct.requiredPlanTiers, currentTier: currentPlanTier ?? null },\n });\n }\n }\n\n // Resolve addon price — and prove it belongs to the addon product. Same defect shape as\n // CHANGE_PLAN: the addon's entitlements come from `addonProduct._id` on the local item\n // while the provider is billed `addonPrice.providerPriceId`.\n const addonPrice = await readPriceForProduct(input.priceId, addonProduct, executionContext, utils);\n if (!addonPrice.providerPriceId) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_NO_PROVIDER_PRICE,\n context: { priceId: input.priceId, productKey: input.addonProductKey },\n });\n }\n\n // Build provider items: existing items + new addon\n const existingProviderItems = await resolveProviderItems(subscription.items, executionContext, utils);\n existingProviderItems.push({\n providerPriceId: addonPrice.providerPriceId,\n quantity: 1,\n });\n\n const provider = getBillingProvider();\n await provider.updateSubscription(subscription.providerSubscriptionId, {\n items: existingProviderItems,\n });\n\n // Build local items with the new addon appended\n const newItems = [\n ...subscription.items,\n {\n _id: `${subscription.providerSubscriptionId}_item_${subscription.items.length}`,\n productId: addonProduct._id,\n priceId: addonPrice._id,\n quantity: 1,\n },\n ];\n\n return { items: newItems };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// REMOVE_ADDON\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create REMOVE_ADDON custom impl factories for all subscription variants.\n *\n * REMOVE_ADDON removes an addon product from the subscription.\n * PREFIX: finds addon item, builds remaining items, calls provider updateSubscription(),\n * returns update payload with remaining items\n * CORE: standard UPDATE writes remaining items to DB\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionRemoveAddonFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.REMOVE_ADDON,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_RemoveAddonRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n // Resolve addon product\n const addonProduct = await readProductByKey(input.addonProductKey, executionContext, utils);\n\n // Find and remove the addon item\n const remainingItems = subscription.items.filter((item: any) => item.productId !== addonProduct._id);\n if (remainingItems.length === subscription.items.length) {\n throw utils.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_ADDON_NOT_ON_SUBSCRIPTION,\n context: { addonProductKey: input.addonProductKey, subscriptionId: _id },\n });\n }\n\n // Build provider items from remaining items\n const providerItems = await resolveProviderItems(remainingItems, executionContext, utils);\n\n const provider = getBillingProvider();\n await provider.updateSubscription(subscription.providerSubscriptionId, {\n items: providerItems,\n });\n\n return { items: remainingItems };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n"]}
1
+ {"version":3,"file":"subscription.mutations.custom-impl.backend.service.js","sourceRoot":"","sources":["../../../../../src/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,kBAAkB,EAClB,SAAS,EACT,2BAA2B,EAC3B,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,8BAA8B,EAC9B,oCAAoC,EACpC,wCAAwC,EACxC,sCAAsC,EACtC,yCAAyC,GAC1C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yCAAyC,GAE1C,MAAM,4GAA4G,CAAC;AAEpH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,wFAAwF,CAAC;AAC9I,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,mFAAmF,CAAC;AAE3F,wEAAwE;AAExE,MAAM,0BAA0B,GAAG;IACjC,gBAAgB,CAAC,0BAA0B;IAC3C,gBAAgB,CAAC,kBAAkB;CAC3B,CAAC;A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CHANGE_PLAN, ADD_ADDON, REMOVE_ADDON operations\n * on subscription polymorphic variants.\n *\n * Pattern: PREFIX_CORE_OPERATIONS\n * PREFIX → validate, call billing provider (Stripe), return update payload\n * CORE → standard UPDATE (engine handles DB write)\n * Feature sync is handled automatically by the post-operation hook infrastructure.\n *\n * One factory per polymorphic variant (org, user) per operation.\n * All variants share the same handler logic.\n *\n * @see billing-polymorphic-full-implementation.md §4.2 + §4.3\n */\n\nimport {\n CoreResourceType,\n ResourceOperationVariantType,\n SubscriptionStatus,\n ErrorType,\n ErrorCustomMessageReference,\n ProductType,\n ProrationBehavior,\n BillingTiming,\n BillingSubscription_Operations,\n BillingSubscription_CancelRequestDto,\n BillingSubscription_ChangePlanRequestDto,\n BillingSubscription_AddAddonRequestDto,\n BillingSubscription_RemoveAddonRequestDto,\n} from '@wildo-ai/saas-models';\nimport {\n createResourceCustomServiceImplementation,\n type ResourceCustomServiceImplementationFactory,\n} from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { getBillingProvider, getBillingConfig } from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-implementations.backend';\nimport {\n BillingCatalogReadIntent,\n readProductByKey,\n readProductById,\n readPriceById,\n readPriceForProduct,\n validateProviderSubscription,\n resolveProviderItems,\n} from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-impl-utils.backend';\n\n// ── Subscription polymorphic variant types ───────────────────────────\n\nconst SUBSCRIPTION_VARIANT_TYPES = [\n CoreResourceType.ORGANIZATION_SUBSCRIPTIONS,\n CoreResourceType.USER_SUBSCRIPTIONS,\n] as const;\n\n/**\n * The subscription item carrying the PLAN, or `null` when a subscription holds only addons.\n *\n * A subscription's items are a plan plus any addons, and three places in this file needed to find\n * the plan among them — the change-plan path, the addon plan-tier gate, and now the cancellation\n * policy (#408). Each had its own inline loop. One helper because \"which item is the plan\" is a\n * single question with a single answer, and three copies is how the fourth one comes to differ.\n */\nasync function resolvePlanItem(\n subscription: { items: Array<{ productId: string }> },\n executionContext: Parameters<typeof readProductById>[1],\n utils: Parameters<typeof readProductById>[2],\n): Promise<{ productId: string } | null> {\n for (const item of subscription.items) {\n const itemProduct = await readProductById(item.productId, executionContext, utils);\n if (itemProduct.type === ProductType.PLAN) {\n return item;\n }\n }\n return null;\n}\n\n// ════════════════════════════════════════════════════════════════════\n// CANCEL\n// ════════════════════════════════════════════════════════════════════\n\nexport function createSubscriptionCancelFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.CANCEL,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_CancelRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n /*\n * `ProductBehaviorPolicy.cancellation` now governs this operation (#408, decided\n * 2026-09-08). Until then it was read by NOTHING: timing came solely from the caller's\n * `cancelImmediately` flag, so a product declaring that immediate cancellation is not\n * allowed could not refuse one — and Wonder Todos authors `allowImmediate: false` on\n * BOTH plans, unenforced.\n *\n * Two distinct things come from the policy, and conflating them was the trap:\n * - `allowImmediate` is a REFUSAL. A caller who asks for immediate cancellation\n * against a product that forbids it gets a 409, not a silent downgrade to\n * period-end. Silently honouring the safer timing would tell the caller their\n * subscription had ended when it has not, which is worse than refusing.\n * - `defaultBehavior` decides the timing when the caller expresses NO preference.\n * `cancelImmediately` is optional on the request DTO, so \"absent\" is a real state\n * and is where an authored default belongs.\n *\n * The policy is read from the subscription's PLAN product, resolved the same way the\n * change-plan path above resolves it. An addon does not carry the cancellation policy\n * of the subscription it rides on.\n */\n const planItem = await resolvePlanItem(subscription, executionContext, utils);\n const planProduct = planItem\n ? await readProductById(planItem.productId, executionContext, utils)\n : null;\n const cancellationPolicy = planProduct?.behaviorPolicy?.cancellation;\n\n const requestedImmediate = input.cancelImmediately;\n if (requestedImmediate === true && cancellationPolicy?.allowImmediate === false) {\n throw utils.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFLICT,\n context: {\n reason: 'billing_product_forbids_immediate_cancellation',\n message: 'This plan does not allow immediate cancellation; it can only be cancelled at the end of the current period.',\n productKey: planProduct?.key,\n },\n });\n }\n\n /*\n * Absent preference resolves down a chain, most specific first: the caller, the plan\n * product's own default, the application's `defaultCancellation`, then period-end.\n *\n * The application-level step is what makes `billing.defaultBehaviorPolicy.defaultCancellation`\n * mean something. It was dead alongside its neighbours, and it is BOUND rather than\n * relabelled because — unlike grace periods and retry counts, which are dunning settings\n * living at the provider — cancellation timing is resolved locally. The only thing\n * standing between that key and an effect was a reader.\n *\n * Period-end is the floor because it never ends access a customer has already paid for.\n */\n const resolvedTiming = cancellationPolicy?.defaultBehavior\n ?? getBillingConfig().defaultBehaviorPolicy?.defaultCancellation;\n const cancelImmediately = requestedImmediate\n ?? (resolvedTiming === BillingTiming.IMMEDIATE);\n const atPeriodEnd = !cancelImmediately;\n\n const provider = getBillingProvider();\n await provider.cancelSubscription(subscription.providerSubscriptionId, { atPeriodEnd });\n\n return {\n cancelAtPeriodEnd: atPeriodEnd,\n cancelledAt: new Date(),\n ...(!atPeriodEnd && { status: SubscriptionStatus.CANCELLED }),\n ...(input.reason && { cancellationReason: input.reason }),\n };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// RESUME\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create RESUME custom impl factories for all subscription variants.\n *\n * RESUME un-cancels a subscription that has cancelAtPeriodEnd = true.\n * PREFIX: validates subscription is pending cancellation, calls provider resumeSubscription()\n * CORE: standard UPDATE clears cancellation fields\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionResumeFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.RESUME,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n handlers: {\n prefixCoreOperations: async (_id, _input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n if (!subscription.cancelAtPeriodEnd) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_NO_ACTIVE_SUBSCRIPTION,\n context: { subscriptionId: _id, reason: 'Subscription is not pending cancellation' },\n });\n }\n\n const provider = getBillingProvider();\n await provider.resumeSubscription(subscription.providerSubscriptionId);\n\n return {\n cancelAtPeriodEnd: false,\n cancelledAt: null,\n cancellationReason: null,\n status: SubscriptionStatus.ACTIVE,\n };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// CHANGE_PLAN\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create CHANGE_PLAN custom impl factories for all subscription variants.\n *\n * CHANGE_PLAN upgrades or downgrades the subscription plan.\n * PREFIX: resolves new product/price, determines proration, builds provider items,\n * calls provider updateSubscription(), returns update payload with new items\n * CORE: standard UPDATE writes new items to DB\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionChangePlanFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.CHANGE_PLAN,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_ChangePlanRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n // ACQUIRE: the subscription is being moved ONTO this product.\n const newProduct = await readProductByKey(input.newProductKey, BillingCatalogReadIntent.ACQUIRE, executionContext, utils);\n // The price MUST belong to the product being switched to. These were resolved\n // independently, so pairing a premium `newProductKey` with a cheap `newPriceId` billed the\n // provider the cheap price while the local item — and every entitlement derived from\n // `item.productId` — recorded the premium product.\n const newPrice = await readPriceForProduct(input.newPriceId, newProduct, executionContext, utils);\n\n if (!newPrice.providerPriceId) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_NO_PROVIDER_PRICE,\n context: { priceId: input.newPriceId, productKey: input.newProductKey },\n });\n }\n\n // Find the current plan item (type === PLAN) and determine upgrade/downgrade\n const currentPlanItem = await resolvePlanItem(subscription, executionContext, utils);\n const planItemIndex = currentPlanItem ? subscription.items.indexOf(currentPlanItem as typeof subscription.items[number]) : -1;\n\n // Build provider items: replace plan item, preserve addons\n const providerItems: Array<{ providerSubscriptionItemId?: string; providerPriceId: string; quantity: number }> = [];\n const localItems: Array<any> = [];\n\n for (let i = 0; i < subscription.items.length; i++) {\n if (i === planItemIndex) {\n providerItems.push({\n providerSubscriptionItemId: subscription.items[i].providerSubscriptionItemId,\n providerPriceId: newPrice.providerPriceId,\n quantity: 1,\n });\n localItems.push({\n _id: subscription.items[i]._id,\n productId: newProduct._id,\n priceId: newPrice._id,\n quantity: 1,\n });\n } else {\n const price = await readPriceById(subscription.items[i].priceId, executionContext, utils);\n providerItems.push({\n providerSubscriptionItemId: subscription.items[i].providerSubscriptionItemId,\n providerPriceId: price.providerPriceId || subscription.items[i].priceId,\n quantity: subscription.items[i].quantity,\n });\n localItems.push(subscription.items[i]);\n }\n }\n\n // If no plan item found, prepend the new plan\n if (planItemIndex === -1) {\n providerItems.unshift({ providerPriceId: newPrice.providerPriceId, quantity: 1 });\n localItems.unshift({\n _id: `${subscription.providerSubscriptionId}_item_plan`,\n productId: newProduct._id,\n priceId: newPrice._id,\n quantity: 1,\n });\n }\n\n // Determine proration from product behavior policy\n const currentProduct = planItemIndex >= 0\n ? await readProductById(subscription.items[planItemIndex].productId, executionContext, utils)\n : null;\n const isUpgrade = currentProduct\n ? (newProduct.planTierOrder ?? 0) > (currentProduct.planTierOrder ?? 0)\n : true;\n const config = getBillingConfig();\n const policy = isUpgrade\n ? (newProduct.behaviorPolicy?.upgrade ?? { proration: config.defaultBehaviorPolicy.defaultProration, timing: BillingTiming.IMMEDIATE })\n : (newProduct.behaviorPolicy?.downgrade ?? { proration: ProrationBehavior.NONE, timing: BillingTiming.AT_PERIOD_END });\n\n const provider = getBillingProvider();\n await provider.updateSubscription(subscription.providerSubscriptionId, {\n items: providerItems,\n /*\n * The resolved proration, as a REQUEST FIELD (#516).\n *\n * It was `metadata.prorationBehavior` until 2026-09-08 — a free-form key/value bag the\n * provider stores and never reads — so this policy was correctly resolved from the target\n * product's `upgrade`/`downgrade` block and then discarded at the boundary. A product\n * declaring `ProrationBehavior.NONE` for a downgrade was prorated anyway, by the\n * provider's account default. Wonder Todos authors exactly that.\n */\n prorationBehavior: policy.proration,\n metadata: {\n /*\n * TIMING remains metadata, and that is honest rather than an oversight: a provider's\n * proration parameter says HOW a change settles, not WHEN it applies. Deferring a\n * change to the period end needs a subscription schedule, which is a different call and\n * a different mechanism — so `prorationTiming` is still carried for a connector that\n * grows one, and still changes nothing today. Do not read this field's presence as the\n * timing being honoured.\n */\n prorationTiming: policy.timing,\n },\n });\n\n return { items: localItems };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// ADD_ADDON\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create ADD_ADDON custom impl factories for all subscription variants.\n *\n * ADD_ADDON adds an addon product to the existing subscription.\n * PREFIX: validates addon product (type, requiredPlanTiers), builds provider items,\n * calls provider updateSubscription(), returns update payload with expanded items\n * CORE: standard UPDATE writes new items to DB\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionAddAddonFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.ADD_ADDON,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_AddAddonRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n // Resolve addon product and validate\n // ACQUIRE: an add-on is being bought.\n const addonProduct = await readProductByKey(input.addonProductKey, BillingCatalogReadIntent.ACQUIRE, executionContext, utils);\n if (addonProduct.type !== ProductType.ADDON) {\n throw utils.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_INVALID_PRODUCT_TYPE,\n context: { productKey: input.addonProductKey, expectedType: ProductType.ADDON, actualType: addonProduct.type },\n });\n }\n\n // Validate requiredPlanTiers\n if (addonProduct.requiredPlanTiers && addonProduct.requiredPlanTiers.length > 0) {\n const planItemForTier = await resolvePlanItem(subscription, executionContext, utils);\n const currentPlanTier = planItemForTier\n ? (await readProductById(planItemForTier.productId, executionContext, utils)).planTier\n : undefined;\n if (!currentPlanTier || !addonProduct.requiredPlanTiers.includes(currentPlanTier)) {\n throw utils.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PLAN_TIER_REQUIRED,\n context: { addonProductKey: input.addonProductKey, requiredTiers: addonProduct.requiredPlanTiers, currentTier: currentPlanTier ?? null },\n });\n }\n }\n\n // Resolve addon price — and prove it belongs to the addon product. Same defect shape as\n // CHANGE_PLAN: the addon's entitlements come from `addonProduct._id` on the local item\n // while the provider is billed `addonPrice.providerPriceId`.\n const addonPrice = await readPriceForProduct(input.priceId, addonProduct, executionContext, utils);\n if (!addonPrice.providerPriceId) {\n throw utils.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_NO_PROVIDER_PRICE,\n context: { priceId: input.priceId, productKey: input.addonProductKey },\n });\n }\n\n // Build provider items: existing items + new addon\n const existingProviderItems = await resolveProviderItems(subscription.items, executionContext, utils);\n existingProviderItems.push({\n providerPriceId: addonPrice.providerPriceId,\n quantity: 1,\n });\n\n const provider = getBillingProvider();\n await provider.updateSubscription(subscription.providerSubscriptionId, {\n items: existingProviderItems,\n });\n\n // Build local items with the new addon appended\n const newItems = [\n ...subscription.items,\n {\n _id: `${subscription.providerSubscriptionId}_item_${subscription.items.length}`,\n productId: addonProduct._id,\n priceId: addonPrice._id,\n quantity: 1,\n },\n ];\n\n return { items: newItems };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n\n// ════════════════════════════════════════════════════════════════════\n// REMOVE_ADDON\n// ════════════════════════════════════════════════════════════════════\n\n/**\n * Create REMOVE_ADDON custom impl factories for all subscription variants.\n *\n * REMOVE_ADDON removes an addon product from the subscription.\n * PREFIX: finds addon item, builds remaining items, calls provider updateSubscription(),\n * returns update payload with remaining items\n * CORE: standard UPDATE writes remaining items to DB\n * (Feature sync handled by post-operation hook)\n */\nexport function createSubscriptionRemoveAddonFactories(): ResourceCustomServiceImplementationFactory[] {\n return SUBSCRIPTION_VARIANT_TYPES.map((variantResourceType) => {\n const factory = (_resourcesRegistryService: ResourcesRegistryBackendService) => {\n return createResourceCustomServiceImplementation({\n operationPath: {\n resourceIdentifier: variantResourceType,\n operationIdentifier: BillingSubscription_Operations.REMOVE_ADDON,\n variantType: ResourceOperationVariantType.API_CALL,\n isOperationDefault: true,\n },\n requestDtoSchema: BillingSubscription_RemoveAddonRequestDto,\n handlers: {\n prefixCoreOperations: async (_id, input, executionContext, _operationPath, utils) => {\n const subscription = utils.currentObject;\n validateProviderSubscription(subscription, _id!, executionContext, utils);\n\n // Resolve addon product\n /*\n * REFERENCE, deliberately — the ONE site of the four that must not refuse a retired\n * product. This resolves the add-on the subscription ALREADY carries in order to drop\n * it, so gating it would trap a customer on the very add-on the catalogue withdrew.\n */\n const addonProduct = await readProductByKey(input.addonProductKey, BillingCatalogReadIntent.REFERENCE, executionContext, utils);\n\n // Find and remove the addon item\n const remainingItems = subscription.items.filter((item: any) => item.productId !== addonProduct._id);\n if (remainingItems.length === subscription.items.length) {\n throw utils.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.BILLING_ADDON_NOT_ON_SUBSCRIPTION,\n context: { addonProductKey: input.addonProductKey, subscriptionId: _id },\n });\n }\n\n // Build provider items from remaining items\n const providerItems = await resolveProviderItems(remainingItems, executionContext, utils);\n\n const provider = getBillingProvider();\n await provider.updateSubscription(subscription.providerSubscriptionId, {\n items: providerItems,\n });\n\n return { items: remainingItems };\n },\n\n // Feature sync is handled automatically by the post-operation hook infrastructure\n },\n });\n };\n\n return factory as unknown as ResourceCustomServiceImplementationFactory;\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { type StandardBilling_Interface, type StandardBilling_CreateCustomerRequest, type StandardBilling_CreateCustomerResponse, type StandardBilling_UpdateCustomerRequest, type StandardBilling_PaymentMethodSummary, type StandardBilling_SyncProductRequest, type StandardBilling_SyncProductResponse, type StandardBilling_SyncPriceRequest, type StandardBilling_SyncPriceResponse, type StandardBilling_CreateSubscriptionRequest, type StandardBilling_CreateSubscriptionResponse, type StandardBilling_UpdateSubscriptionRequest, type StandardBilling_CancelSubscriptionOptions, type StandardBilling_SubscriptionData, type StandardBilling_InvoicePreview, type StandardBilling_CreateCheckoutSessionRequest, type StandardBilling_CreateCheckoutSessionResponse, type StandardBilling_CreateCustomerPortalSessionResponse, type StandardBilling_ReportUsageRequest, type StandardBilling_WebhookEvent, type StandardBilling_CreateCouponRequest, type StandardBilling_CreateCouponResponse, type StandardBilling_CreatePromotionCodeResponse } from '@wildo-ai/external-connectors-models';
1
+ import { type StandardBilling_Interface, type StandardBilling_CreateCustomerRequest, type StandardBilling_CreateCustomerResponse, type StandardBilling_UpdateCustomerRequest, type StandardBilling_PaymentMethodSummary, type StandardBilling_SyncProductRequest, type StandardBilling_SyncProductResponse, type StandardBilling_SyncPriceRequest, type StandardBilling_SyncPriceResponse, type StandardBilling_CreateSubscriptionRequest, type StandardBilling_CreateSubscriptionResponse, type StandardBilling_UpdateSubscriptionRequest, type StandardBilling_CancelSubscriptionOptions, type StandardBilling_SubscriptionData, type StandardBilling_InvoicePreview, type StandardBilling_InvoiceData, type StandardBilling_CreateCheckoutSessionRequest, type StandardBilling_CreateCheckoutSessionResponse, type StandardBilling_CreateCustomerPortalSessionResponse, type StandardBilling_ReportUsageRequest, type StandardBilling_WebhookEvent, type StandardBilling_CreateCouponRequest, type StandardBilling_CreateCouponResponse, type StandardBilling_CreatePromotionCodeResponse } from '@wildo-ai/external-connectors-models';
2
2
  export declare class StripeStandardBillingProvider implements StandardBilling_Interface {
3
3
  private readonly secretKey;
4
4
  private readonly apiVersion;
@@ -37,6 +37,26 @@ export declare class StripeStandardBillingProvider implements StandardBilling_In
37
37
  resumeSubscription(providerSubscriptionId: string): Promise<void>;
38
38
  retrieveSubscription(providerSubscriptionId: string): Promise<StandardBilling_SubscriptionData>;
39
39
  retrieveUpcomingInvoice(providerSubscriptionId: string, newPriceId?: string): Promise<StandardBilling_InvoicePreview>;
40
+ /**
41
+ * One page of the customer's invoices, newest first.
42
+ *
43
+ * `total` rather than `amount_paid`, deliberately — the local field is the invoice's TOTAL, and
44
+ * `amount_paid` is a different fact about money that has no home on that row.
45
+ *
46
+ * The webhook router used to disagree here: it read `amount_paid ?? total`, which is `0` for every
47
+ * invoice that is finalized-but-unpaid, so an OPEN invoice landed locally at zero. That was
48
+ * corrected on its own write path (2026-09-09) and both writers now read `total`. The structural
49
+ * guarantee is unchanged and is what makes the agreement safe rather than merely current: the
50
+ * reconciliation sweep only ever INSERTS a total and never updates one, so the two cannot fight
51
+ * over money on a tick even if they were to diverge again.
52
+ *
53
+ * An invoice whose Stripe status is not in {@link STRIPE_INVOICE_STATUS_MAP} is SKIPPED rather
54
+ * than defaulted. A defaulted status is a wrong fact about money written into a durable row; an
55
+ * omitted invoice stays missing and is found again on the next tick, once the mapping is fixed.
56
+ */
57
+ listInvoices(providerCustomerId: string, options?: {
58
+ limit?: number;
59
+ }): Promise<StandardBilling_InvoiceData[]>;
40
60
  createCheckoutSession(request: StandardBilling_CreateCheckoutSessionRequest): Promise<StandardBilling_CreateCheckoutSessionResponse>;
41
61
  createCustomerPortalSession(providerCustomerId: string, returnUrl: string): Promise<StandardBilling_CreateCustomerPortalSessionResponse>;
42
62
  reportUsage(request: StandardBilling_ReportUsageRequest): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"stripe-standard-billing-provider.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/billing/services/stripe-standard-billing-provider.backend.service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,qCAAqC,EAC1C,KAAK,sCAAsC,EAC3C,KAAK,qCAAqC,EAC1C,KAAK,oCAAoC,EACzC,KAAK,kC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+ {"version":3,"file":"stripe-standard-billing-provider.backend.service.d.ts","sourceRoot":"","sources":["../../../../src/billing/services/stripe-standard-billing-provider.backend.service.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,yBAAyB,EAC9B,KAAK,qCAAqC,EAC1C,KAAK,sCAAsC,EAC3C,KAAK,qCAAqC,EAC1C,KAAK,oCAAoC,EACzC,KAAK,kCAAkC,EACvC,KAAK,mCAAmC,EACxC,KAAK,gCAAgC,EACrC,KAAK,iCAAiC,EACtC,KAAK,yCAAyC,EAC9C,KAAK,0CAA0C,EAC/C,KAAK,yCAAyC,EAC9C,KAAK,yCAAyC,EAC9C,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,EAChC,KAAK,4CAA4C,EACjD,KAAK,6CAA6C,EAClD,KAAK,mDAAmD,EACxD,KAAK,kCAAkC,EACvC,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,2CAA2C,EAIjD,MAAM,sCAAsC,CAAC;AAwD9C,qBAAa,6BAA8B,YAAW,yBAAyB;IAK3E,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAL7B,QAAQ,CAAC,0BAA0B,sBAAsB;IACzD,OAAO,CAAC,MAAM,CAAoB;gBAGf,SAAS,EAAE,MAAM,EACjB,UAAU,SAAsB;IAGnD,OAAO,CAAC,SAAS;IAYX,cAAc,CAAC,OAAO,EAAE,qCAAqC,GAAG,OAAO,CAAC,sCAAsC,CAAC;IAS/G,cAAc,CAAC,kBAAkB,EAAE,MAAM,EAAE,OAAO,EAAE,qCAAqC,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBzG,cAAc,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIzD,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,oCAAoC,EAAE,CAAC;IAc/F,mB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