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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1056) hide show
  1. package/dist/esm/__tests__/fixture-deep-partial.d.ts.map +1 -1
  2. package/dist/esm/__tests__/integration/redis-integration-gate.d.ts.map +1 -1
  3. package/dist/esm/__tests__/setup.d.ts.map +1 -1
  4. package/dist/esm/__tests__/test-container.d.ts.map +1 -1
  5. package/dist/esm/applications/models/applications.backend.schemas.d.ts.map +1 -1
  6. package/dist/esm/applications/seeds/application-metadata-defaults.seeds.d.ts.map +1 -1
  7. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  8. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  9. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  10. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  11. package/dist/esm/base-classes/models/repositories.backend.schemas.d.ts.map +1 -1
  12. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts +1 -1
  13. package/dist/esm/base-classes/services/__tests__/mock-resource-operation-helper.service.d.ts.map +1 -1
  14. package/dist/esm/base-classes/services/batches/batches-cronjobs-custom-execution.service.d.ts.map +1 -1
  15. package/dist/esm/base-classes/services/batches/batches-cronjobs-executor.backend.service.d.ts.map +1 -1
  16. package/dist/esm/base-classes/services/batches/batches-cronjobs-resource-execution.backend.service.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -1
  19. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -1
  20. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +12 -1
  21. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -1
  22. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  23. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  24. package/dist/esm/base-classes/services/batches/resource-retention-sweep.batch.backend.service.d.ts.map +1 -1
  25. package/dist/esm/base-classes/services/batches/suspension-reactivation-sweep.batch.backend.service.d.ts.map +1 -1
  26. package/dist/esm/base-classes/services/controllers/abstract-controller.backend.service.d.ts.map +1 -1
  27. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  28. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  29. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  30. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  31. package/dist/esm/base-classes/services/controllers/utils/audit-access-fields.backend.utils.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/controllers/utils/operation-response-serializer.backend.utils.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/controllers/validate-field-handler.backend.service.d.ts.map +1 -1
  34. package/dist/esm/base-classes/services/repositories/__tests__/method-span-scan.guard-helpers.d.ts.map +1 -1
  35. package/dist/esm/base-classes/services/repositories/__tests__/mock-repositories-registry-handler.service.d.ts.map +1 -1
  36. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-filter-translation.backend.d.ts.map +1 -1
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +13 -4
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-query.backend.d.ts.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +17 -0
  44. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  46. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  47. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -1
  48. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/http-api/http-api-row-projection.backend.d.ts.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/http-api/http-api-subject-erasure-effect.backend.d.ts.map +1 -1
  51. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  54. package/dist/esm/base-classes/services/repositories/http-api/odoo-jsonrpc-compiler.backend.d.ts.map +1 -1
  55. package/dist/esm/base-classes/services/repositories/http-api/rest-json-query-compiler.backend.d.ts.map +1 -1
  56. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  58. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  59. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  60. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +57 -0
  61. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  62. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +95 -2
  63. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  64. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  65. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  66. package/dist/esm/base-classes/services/repositories/repository-guarded-mutation.backend.types.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +5 -2
  68. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  69. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +14 -3
  70. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  71. package/dist/esm/base-classes/services/repositories/repository-version-metadata.backend.utils.d.ts.map +1 -1
  72. package/dist/esm/base-classes/services/repositories/resource-write-integrity.backend.d.ts.map +1 -1
  73. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts +72 -0
  74. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.d.ts.map +1 -0
  75. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js +88 -0
  76. package/dist/esm/base-classes/services/repositories/seed-row-default-materialization.backend.js.map +1 -0
  77. package/dist/esm/base-classes/services/repositories/unique-constraint-conflict-reference.backend.d.ts.map +1 -1
  78. package/dist/esm/base-classes/services/resource-operations-helper.backend.service.d.ts.map +1 -1
  79. package/dist/esm/base-classes/services/services/__tests__/mock-services-registry-handler.service.d.ts.map +1 -1
  80. package/dist/esm/base-classes/services/services/__tests__/mock-system-access.service.d.ts.map +1 -1
  81. package/dist/esm/base-classes/services/services/read-only-field-change.backend.utils.d.ts.map +1 -1
  82. package/dist/esm/base-classes/services/services/resource-operation-audit-emission.backend.utils.d.ts.map +1 -1
  83. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  84. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  85. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts.map +1 -1
  86. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts.map +1 -1
  87. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  88. package/dist/esm/base-classes/services/services/resource-operation-server-injected-fields.backend.utils.d.ts.map +1 -1
  89. package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts.map +1 -1
  90. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  91. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  92. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  93. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  94. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  95. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +44 -6
  96. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  97. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  98. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  99. package/dist/esm/base-classes/utils/backend-type-utils.d.ts.map +1 -1
  100. package/dist/esm/base-classes/utils/single-subject-addressing.backend.utils.d.ts.map +1 -1
  101. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -1
  102. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -1
  103. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -1
  104. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -1
  105. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -1
  106. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -1
  107. package/dist/esm/billing/services/back-office/abstract-billing.backend.service.d.ts.map +1 -1
  108. package/dist/esm/billing/services/back-office/billing-feature-sync.backend.service.d.ts.map +1 -1
  109. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +1 -1
  110. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -1
  111. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +5 -4
  112. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -1
  113. package/dist/esm/billing/services/back-office/billing-state.backend.service.d.ts.map +1 -1
  114. package/dist/esm/billing/services/back-office/billing-state.backend.service.js +11 -1
  115. package/dist/esm/billing/services/back-office/billing-state.backend.service.js.map +1 -1
  116. package/dist/esm/billing/services/back-office/billing-subject-erasure-effect.backend.d.ts.map +1 -1
  117. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  118. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  119. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  120. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  121. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -1
  122. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -1
  123. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  124. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  125. package/dist/esm/billing/services/billing.utils.d.ts.map +1 -1
  126. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  127. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  128. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +32 -0
  129. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  130. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +32 -1
  131. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  132. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  133. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  134. package/dist/esm/billing/services/custom-impl/credit-pool.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  135. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  136. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  137. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  138. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  139. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +9 -6
  140. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  141. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +9 -6
  142. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  143. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -1
  144. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -1
  145. package/dist/esm/billing/services/webhooks/billing-webhook-adapter.backend.service.d.ts.map +1 -1
  146. package/dist/esm/billing/services/webhooks/billing-webhook-capability-handler.backend.service.d.ts.map +1 -1
  147. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  148. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +50 -3
  149. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  150. package/dist/esm/billing/testing/billing-test-fixtures.d.ts.map +1 -1
  151. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  152. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  153. package/dist/esm/charts/controllers/chart.backend.controller.d.ts.map +1 -1
  154. package/dist/esm/charts/services/chart-registry.backend.service.d.ts +80 -7
  155. package/dist/esm/charts/services/chart-registry.backend.service.d.ts.map +1 -1
  156. package/dist/esm/charts/services/chart-registry.backend.service.js +115 -8
  157. package/dist/esm/charts/services/chart-registry.backend.service.js.map +1 -1
  158. package/dist/esm/companion-exports.d.ts.map +1 -1
  159. package/dist/esm/compliance/audit-trails/audit-logs.custom-impl.backend.service.d.ts.map +1 -1
  160. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.d.ts.map +1 -1
  161. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  162. package/dist/esm/compliance/audit-trails/batches/immudb-audit-reconcile.batch.backend.service.d.ts.map +1 -1
  163. package/dist/esm/compliance/audit-trails/batches/siem-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  164. package/dist/esm/compliance/audit-trails/services/__tests__/mock-audit-logs.service.d.ts.map +1 -1
  165. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  166. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  167. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +107 -4
  168. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  169. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +176 -5
  170. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  171. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  172. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  173. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  174. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  175. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  176. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  177. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -1
  178. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -1
  179. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  180. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +21 -0
  181. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  182. package/dist/esm/compliance/audit-trails/services/utils/ocsf-class-mapping.backend.utils.d.ts.map +1 -1
  183. package/dist/esm/compliance/audit-trails/services/utils/siem-dictionary.backend.utils.d.ts.map +1 -1
  184. package/dist/esm/compliance/audit-trails/services/utils/siem-ocsf-projection.backend.utils.d.ts.map +1 -1
  185. package/dist/esm/compliance/audit-trails/services/utils/siem-projection-contract.backend.utils.d.ts.map +1 -1
  186. package/dist/esm/compliance/audit-trails/utils/audit-actor.backend.utils.d.ts.map +1 -1
  187. package/dist/esm/compliance/audit-trails/utils/layer2-audit-provider-boot-diagnostic.backend.utils.d.ts.map +1 -1
  188. package/dist/esm/compliance/index.d.ts.map +1 -1
  189. package/dist/esm/compliance/privacy/retention-hide-predicate.backend.d.ts.map +1 -1
  190. package/dist/esm/compliance/privacy/services/subject-erasure-external-effects.backend.service.d.ts.map +1 -1
  191. package/dist/esm/compliance/privacy/services/subject-session-revocation.backend.service.d.ts.map +1 -1
  192. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  193. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  194. package/dist/esm/config/bootstrap/minion-initialization-projection.backend.d.ts.map +1 -1
  195. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.d.ts.map +1 -1
  196. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js +3 -0
  197. package/dist/esm/config/bootstrap/runtime-principal-attestation.backend.service.js.map +1 -1
  198. package/dist/esm/config/bootstrap/runtime-principal.backend.service.d.ts.map +1 -1
  199. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  200. package/dist/esm/config/models/app-config-secrets.backend.schemas.d.ts.map +1 -1
  201. package/dist/esm/config/models/app-config.backend-authored.definitions.d.ts.map +1 -1
  202. package/dist/esm/config/models/app-config.backend.schemas.d.ts +4 -4
  203. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  204. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  205. package/dist/esm/config/models/app-env-config.backend.schemas.d.ts.map +1 -1
  206. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts +36 -0
  207. package/dist/esm/config/models/apps-manager-transport.backend.definitions.d.ts.map +1 -0
  208. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js +36 -0
  209. package/dist/esm/config/models/apps-manager-transport.backend.definitions.js.map +1 -0
  210. package/dist/esm/config/models/config-mutation-boundary.utils.d.ts.map +1 -1
  211. package/dist/esm/config/models/postgresql-env-config.backend.schemas.d.ts.map +1 -1
  212. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  213. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  214. package/dist/esm/config/models/runtime-topology.backend.contracts.d.ts.map +1 -1
  215. package/dist/esm/config/services/__tests__/mock-app-configuration.service.d.ts.map +1 -1
  216. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  217. package/dist/esm/config/services/app-configuration-loader.backend.service.js +3 -0
  218. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  219. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  220. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  221. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  222. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  223. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +12 -0
  224. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  225. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +28 -0
  226. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  227. package/dist/esm/data-seeding/batches/data-seeding-run-cleanup.batch.backend.service.d.ts.map +1 -1
  228. package/dist/esm/data-seeding/batches/data-seeding-scheduled-rerun.batch.backend.service.d.ts.map +1 -1
  229. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.contracts.d.ts.map +1 -1
  230. package/dist/esm/data-seeding/controllers/data-seeding-admin.backend.controller.d.ts.map +1 -1
  231. package/dist/esm/data-seeding/data-seeding-models.d.ts.map +1 -1
  232. package/dist/esm/data-seeding/models/business-key-resolver.shared.utils.d.ts.map +1 -1
  233. package/dist/esm/data-seeding/models/data-seed-execution-context.shared.types.d.ts.map +1 -1
  234. package/dist/esm/data-seeding/models/data-seed-migrator-runner.shared.utils.d.ts.map +1 -1
  235. package/dist/esm/data-seeding/models/data-seed-reconciler.shared.utils.d.ts.map +1 -1
  236. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.schemas.d.ts.map +1 -1
  237. package/dist/esm/data-seeding/models/data-seed-row-metadata.shared.utils.d.ts.map +1 -1
  238. package/dist/esm/data-seeding/models/data-seed-run.shared.resources-config.schemas.d.ts.map +1 -1
  239. package/dist/esm/data-seeding/models/data-seed-run.shared.schemas.d.ts.map +1 -1
  240. package/dist/esm/data-seeding/models/data-seed-trigger-mode-matrix.shared.utils.d.ts.map +1 -1
  241. package/dist/esm/data-seeding/models/data-seed.shared.schemas.d.ts.map +1 -1
  242. package/dist/esm/data-seeding/services/data-seed-application-bootstrap.backend.d.ts.map +1 -1
  243. package/dist/esm/data-seeding/services/data-seed-dispatcher.backend.service.d.ts.map +1 -1
  244. package/dist/esm/data-seeding/services/data-seed-registry.backend.service.d.ts.map +1 -1
  245. package/dist/esm/data-seeding/services/data-seed-scope-resolver-registry.backend.service.d.ts.map +1 -1
  246. package/dist/esm/data-seeding/services/engines/additive-seed-engine.backend.service.d.ts.map +1 -1
  247. package/dist/esm/data-seeding/services/engines/lazy-seed-engine.backend.service.d.ts.map +1 -1
  248. package/dist/esm/data-seeding/services/engines/manual-seed-engine.backend.service.d.ts.map +1 -1
  249. package/dist/esm/data-seeding/services/engines/sync-seed-engine.backend.service.d.ts.map +1 -1
  250. package/dist/esm/data-seeding/services/engines/upgrade-seed-engine.backend.service.d.ts.map +1 -1
  251. package/dist/esm/data-seeding/services/shared/data-seed-business-key.shared.utils.d.ts.map +1 -1
  252. package/dist/esm/data-seeding/services/shared/data-seed-error.shared.utils.d.ts.map +1 -1
  253. package/dist/esm/data-seeding/services/shared/data-seed-run-counters.shared.types.d.ts.map +1 -1
  254. package/dist/esm/data-seeding/services/shared/data-seed-run-ledger.backend.d.ts.map +1 -1
  255. package/dist/esm/data-seeding/services/shared/data-seed-scope-anchor.shared.types.d.ts.map +1 -1
  256. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts.map +1 -1
  257. package/dist/esm/data-seeding/services/shared/data-seed-scope-resolution.backend.d.ts.map +1 -1
  258. package/dist/esm/databases/models/aggregation.backend.schemas.d.ts.map +1 -1
  259. package/dist/esm/databases/models/databases.backend.schemas.d.ts.map +1 -1
  260. package/dist/esm/databases/models/filter.backend.schemas.d.ts.map +1 -1
  261. package/dist/esm/databases/models/resolve-persistence-adapter.backend.utils.d.ts.map +1 -1
  262. package/dist/esm/databases/models/sql.backend.schemas.d.ts.map +1 -1
  263. package/dist/esm/databases/models/transaction.shared.schemas.d.ts.map +1 -1
  264. package/dist/esm/databases/services/__tests__/mock-mongo-transaction-registry.service.d.ts.map +1 -1
  265. package/dist/esm/databases/services/__tests__/mock-mongodb.service.d.ts.map +1 -1
  266. package/dist/esm/databases/services/__tests__/mock-mongoose-model.service.d.ts.map +1 -1
  267. package/dist/esm/databases/services/__tests__/mock-redis.service.d.ts.map +1 -1
  268. package/dist/esm/databases/services/__tests__/mock-zod-mongoose-schema-convertor.service.d.ts.map +1 -1
  269. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  270. package/dist/esm/databases/services/aggregation/aggregation-query.backend.service.d.ts.map +1 -1
  271. package/dist/esm/databases/services/aggregation/computed-measure-evaluator.backend.service.d.ts.map +1 -1
  272. package/dist/esm/databases/services/aggregation/field-access-validator.backend.service.d.ts.map +1 -1
  273. package/dist/esm/databases/services/aggregation/time-series-densifier.backend.service.d.ts.map +1 -1
  274. package/dist/esm/databases/services/aggregation/topn-processor.backend.service.d.ts.map +1 -1
  275. package/dist/esm/databases/services/aggregation/window-function-processor.backend.service.d.ts.map +1 -1
  276. package/dist/esm/databases/services/db-utils.d.ts.map +1 -1
  277. package/dist/esm/databases/services/mongo-aggregation.backend.service.d.ts.map +1 -1
  278. package/dist/esm/databases/services/mongodb.service.d.ts.map +1 -1
  279. package/dist/esm/databases/services/postgresql-aggregation.backend.service.d.ts.map +1 -1
  280. package/dist/esm/databases/services/postgresql-database.backend.service.d.ts.map +1 -1
  281. package/dist/esm/databases/services/postgresql-development-provisioning.backend.d.ts.map +1 -1
  282. package/dist/esm/databases/services/postgresql-filter.backend.service.d.ts.map +1 -1
  283. package/dist/esm/databases/services/postgresql-migration-runner.backend.d.ts.map +1 -1
  284. package/dist/esm/databases/services/postgresql-schema-ddl.backend.d.ts.map +1 -1
  285. package/dist/esm/databases/services/postgresql-schema-migration-sql.backend.d.ts.map +1 -1
  286. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  287. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  288. package/dist/esm/databases/services/postgresql-schema-plan-lockfile.backend.d.ts.map +1 -1
  289. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  290. package/dist/esm/databases/services/resource-persistence-unit-of-work.backend.service.d.ts.map +1 -1
  291. package/dist/esm/databases/services/schema-planning-standalone.backend.d.ts.map +1 -1
  292. package/dist/esm/databases/services/zod-to-mongoose-schema-convertor.backend.service.d.ts.map +1 -1
  293. package/dist/esm/databases/services/zod-to-sql-hybrid-schema.planner.d.ts.map +1 -1
  294. package/dist/esm/databases/utils/postgresql-identifier.backend.utils.d.ts.map +1 -1
  295. package/dist/esm/errors/services/__tests__/mock-error-builder.service.d.ts.map +1 -1
  296. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  297. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  298. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  299. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  300. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  301. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  302. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  303. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  304. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  305. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  306. package/dist/esm/external-data/batches/external-data-pipeline-scheduled-run.batch.backend.service.d.ts.map +1 -1
  307. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -1
  308. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -1
  309. package/dist/esm/external-data/external-data-extraction-source.backend.d.ts.map +1 -1
  310. package/dist/esm/external-data/external-data-models.exports.d.ts.map +1 -1
  311. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  312. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  313. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  314. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  315. package/dist/esm/external-providers/models/external-providers.backend.schemas.d.ts.map +1 -1
  316. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  317. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  318. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +102 -52
  319. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -1
  320. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +117 -71
  321. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -1
  322. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -1
  323. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -1
  324. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -1
  325. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +26 -7
  326. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -1
  327. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -1
  328. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -1
  329. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  330. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  331. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -1
  332. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -1
  333. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  334. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  335. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts +81 -34
  336. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  337. package/dist/esm/external-providers/services/document-extraction.backend.service.js +179 -98
  338. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  339. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  340. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  341. package/dist/esm/external-providers/services/external-api-handler.backend.service.d.ts.map +1 -1
  342. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +121 -0
  343. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  344. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +151 -0
  345. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  346. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts +15 -1
  347. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  348. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +60 -4
  349. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  350. package/dist/esm/features/controllers/features.backend.controller.d.ts.map +1 -1
  351. package/dist/esm/features/services/__tests__/mock-feature-definition-registry.service.d.ts.map +1 -1
  352. package/dist/esm/features/services/__tests__/mock-feature-resolution.service.d.ts.map +1 -1
  353. package/dist/esm/features/services/application-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  354. package/dist/esm/features/services/feature-definition-registry.backend.service.d.ts.map +1 -1
  355. package/dist/esm/features/services/feature-gate.backend.service.d.ts.map +1 -1
  356. package/dist/esm/features/services/feature-resolution.backend.service.d.ts.map +1 -1
  357. package/dist/esm/features/services/organization-features-admin-write-path.custom-impl.backend.service.d.ts.map +1 -1
  358. package/dist/esm/features/services/scope-feature-ledger-relationship.backend.utils.d.ts.map +1 -1
  359. package/dist/esm/features/services/scope-features-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  360. package/dist/esm/features/testing/feature-test-utils.d.ts.map +1 -1
  361. package/dist/esm/files/batches/files-cleanup.batch.backend.service.d.ts.map +1 -1
  362. package/dist/esm/files/constraints/file-analyzers.types.d.ts.map +1 -1
  363. package/dist/esm/files/constraints/file-constraint-resolver-chain.backend.service.d.ts.map +1 -1
  364. package/dist/esm/files/constraints/file-constraint.types.d.ts.map +1 -1
  365. package/dist/esm/files/constraints/file-validation.backend.service.d.ts.map +1 -1
  366. package/dist/esm/files/constraints/resource-field-constraint-resolver.backend.service.d.ts.map +1 -1
  367. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  368. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  369. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -1
  370. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -1
  371. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +37 -0
  372. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  373. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +221 -21
  374. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  375. package/dist/esm/files/scanning/clamav-scanner.backend.service.d.ts.map +1 -1
  376. package/dist/esm/files/scanning/file-scan.types.d.ts.map +1 -1
  377. package/dist/esm/files/scanning/yara-scanner.backend.service.d.ts.map +1 -1
  378. package/dist/esm/files/scanning/yara-scanner.backend.service.js +20 -2
  379. package/dist/esm/files/scanning/yara-scanner.backend.service.js.map +1 -1
  380. package/dist/esm/files/services/__tests__/mock-file-field-detection.service.d.ts.map +1 -1
  381. package/dist/esm/files/services/__tests__/mock-file-operation-handler.service.d.ts.map +1 -1
  382. package/dist/esm/files/services/__tests__/mock-file-repository.service.d.ts.map +1 -1
  383. package/dist/esm/files/services/file-field-detection.backend.service.d.ts.map +1 -1
  384. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  385. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  386. package/dist/esm/files/services/file-population.backend.service.d.ts.map +1 -1
  387. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  388. package/dist/esm/files/services/file-scanning.backend.service.js +5 -0
  389. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  390. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  391. package/dist/esm/files/services/file-text-extraction.backend.service.js +8 -5
  392. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  393. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  394. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  395. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  396. package/dist/esm/files/services/files.backend.service.js +3 -1
  397. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  398. package/dist/esm/files/services/rag-source-field-detection.backend.service.d.ts.map +1 -1
  399. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -1
  400. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -1
  401. package/dist/esm/files/storage/file-storage-path-resolver.backend.service.d.ts.map +1 -1
  402. package/dist/esm/files/storage/file-storage-provider.types.d.ts +36 -1
  403. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  404. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  405. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts +21 -3
  406. package/dist/esm/files/storage/file-storage-router.backend.service.d.ts.map +1 -1
  407. package/dist/esm/files/storage/file-storage-router.backend.service.js +38 -5
  408. package/dist/esm/files/storage/file-storage-router.backend.service.js.map +1 -1
  409. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts +87 -0
  410. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.d.ts.map +1 -0
  411. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js +340 -0
  412. package/dist/esm/files/storage/google-drive-storage-provider.backend.service.js.map +1 -0
  413. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  414. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  415. package/dist/esm/files/storage/storage-credential-provider.backend.utils.d.ts.map +1 -1
  416. package/dist/esm/files/storage/storage-platform-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  417. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.d.ts.map +1 -1
  418. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js +10 -3
  419. package/dist/esm/files/storage/storage-sts-credential-resolver.backend.utils.js.map +1 -1
  420. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  421. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  422. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  423. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  424. package/dist/esm/files/utils/file-upload.utils.d.ts.map +1 -1
  425. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  426. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  427. package/dist/esm/files/utils/file-validation.utils.d.ts.map +1 -1
  428. package/dist/esm/files/utils/image-derivation.backend.utils.d.ts.map +1 -1
  429. package/dist/esm/files/utils/image-thumbnail.backend.utils.d.ts.map +1 -1
  430. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -1
  431. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -1
  432. package/dist/esm/files/utils/rag-source-field-schema-path.backend.utils.d.ts.map +1 -1
  433. package/dist/esm/files/utils/storage-application-identity.backend.utils.d.ts.map +1 -1
  434. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  435. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  436. package/dist/esm/flows-actors/a2a/batches/a2a-push-delivery.batch.backend.service.d.ts.map +1 -1
  437. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  438. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  439. package/dist/esm/flows-actors/a2a/models/a2a-dialect.backend.schemas.d.ts.map +1 -1
  440. package/dist/esm/flows-actors/a2a/models/a2a-push-notification-delivery.backend.utils.d.ts.map +1 -1
  441. package/dist/esm/flows-actors/a2a/models/a2a-push-notification.backend.schemas.d.ts.map +1 -1
  442. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  443. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  444. package/dist/esm/flows-actors/a2a/services/a2a-push-delivery-log.repository.d.ts.map +1 -1
  445. package/dist/esm/flows-actors/a2a/services/a2a-push-dispatcher.backend.service.d.ts.map +1 -1
  446. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  447. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  448. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  449. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  450. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  451. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  452. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  453. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  454. package/dist/esm/flows-actors/controllers/flows-actors.controller.d.ts.map +1 -1
  455. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  456. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  457. package/dist/esm/flows-actors/models/agent-facets.backend.definitions.d.ts.map +1 -1
  458. package/dist/esm/flows-actors/models/agents.backend.definitions.d.ts.map +1 -1
  459. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  460. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  461. package/dist/esm/flows-actors/models/flows-actors.backend.definitions.d.ts.map +1 -1
  462. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  463. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  464. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +107 -16
  465. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  466. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +118 -18
  467. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  468. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  469. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  470. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -1
  471. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -1
  472. package/dist/esm/flows-actors/services/__tests__/fixtures/meta-workflow-evaluation-treatment.test-fixture.d.ts.map +1 -1
  473. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  474. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  475. package/dist/esm/flows-actors/services/agent-call-trace-sink.backend.d.ts.map +1 -1
  476. package/dist/esm/flows-actors/services/agent-facets.backend.service.d.ts.map +1 -1
  477. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +104 -5
  478. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  479. package/dist/esm/flows-actors/services/agents.backend.service.js +263 -31
  480. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  481. package/dist/esm/flows-actors/services/context-curation.backend.service.d.ts.map +1 -1
  482. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +46 -1
  483. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  484. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +193 -6
  485. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  486. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  487. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  488. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  489. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  490. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  491. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  492. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -1
  493. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +3 -0
  494. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -1
  495. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts +99 -0
  496. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.d.ts.map +1 -0
  497. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js +155 -0
  498. package/dist/esm/flows-actors/services/mcp-credential-resolver.backend.service.js.map +1 -0
  499. package/dist/esm/flows-actors/services/meta-workflow-evaluation-treatment-compiler.backend.service.d.ts.map +1 -1
  500. package/dist/esm/flows-actors/services/meta-workflow-standard-action-contracts.backend.service.d.ts.map +1 -1
  501. package/dist/esm/flows-actors/services/meta-workflow-standard-evaluation-contracts.backend.service.d.ts.map +1 -1
  502. package/dist/esm/flows-actors/services/meta-workflow-structured-artifact-action-compiler.backend.service.d.ts.map +1 -1
  503. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  504. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  505. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  506. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +9 -0
  507. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  508. package/dist/esm/flows-actors/utils/bounded-subprocess.backend.utils.d.ts.map +1 -1
  509. package/dist/esm/flows-actors/utils/flows-actors-frontend-extractor.utils.d.ts.map +1 -1
  510. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  511. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  512. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  513. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  514. package/dist/esm/flows-actors/utils/prompt-ir-adapters.backend.utils.d.ts.map +1 -1
  515. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts +77 -0
  516. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.d.ts.map +1 -0
  517. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js +164 -0
  518. package/dist/esm/flows-actors/utils/tool-approval-modification.backend.utils.js.map +1 -0
  519. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts +48 -0
  520. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.d.ts.map +1 -0
  521. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js +101 -0
  522. package/dist/esm/flows-actors/utils/tool-approval-signing.backend.utils.js.map +1 -0
  523. package/dist/esm/guidance/batches/dormancy-detection.batch.backend.service.d.ts.map +1 -1
  524. package/dist/esm/guidance/services/guidance-trigger-evaluator.backend.service.d.ts.map +1 -1
  525. package/dist/esm/guidance/services/lifecycle-custom-implementations.backend.d.ts.map +1 -1
  526. package/dist/esm/guidance/services/lifecycle-evaluator.backend.service.d.ts.map +1 -1
  527. package/dist/esm/guidance/services/lifecycle-scope-id.backend.utils.d.ts.map +1 -1
  528. package/dist/esm/guidance/services/milestone-condition-registry.backend.service.d.ts.map +1 -1
  529. package/dist/esm/guidance/services/milestone-definition-registry.backend.service.d.ts.map +1 -1
  530. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  531. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  532. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -1
  533. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -1
  534. package/dist/esm/guidance/services/scoped-state-read-custom-implementations.backend.d.ts.map +1 -1
  535. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  536. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  537. package/dist/esm/i18n/services/i18n.backend.service.d.ts.map +1 -1
  538. package/dist/esm/index.d.ts +0 -1
  539. package/dist/esm/index.d.ts.map +1 -1
  540. package/dist/esm/index.js +0 -1
  541. package/dist/esm/index.js.map +1 -1
  542. package/dist/esm/inject/models/container.d.ts +10 -0
  543. package/dist/esm/inject/models/container.d.ts.map +1 -1
  544. package/dist/esm/inject/models/container.js +49 -1
  545. package/dist/esm/inject/models/container.js.map +1 -1
  546. package/dist/esm/inject/models/service-types.d.ts +3 -0
  547. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  548. package/dist/esm/inject/models/service-types.js +3 -0
  549. package/dist/esm/inject/models/service-types.js.map +1 -1
  550. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  551. package/dist/esm/mcp/controllers/mcp.controller.js +50 -3
  552. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  553. package/dist/esm/mcp/models/mcp-protocol.backend.schemas.d.ts.map +1 -1
  554. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  555. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  556. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  557. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  558. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  559. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  560. package/dist/esm/mcp/services/resource-server-instances-registry.backend.service.d.ts.map +1 -1
  561. package/dist/esm/mcp/utils/zod-to-mcp-json-schema.backend.utils.d.ts.map +1 -1
  562. package/dist/esm/meta-workflow-runtime.exports.d.ts.map +1 -1
  563. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  564. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  565. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -1
  566. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -1
  567. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  568. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  569. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  570. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  571. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  572. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  573. package/dist/esm/monitoring/logger/services/__tests__/mock-logger.service.d.ts.map +1 -1
  574. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  575. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  576. package/dist/esm/monitoring/logger/services/logger.service.js +3 -3
  577. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  578. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -1
  579. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -1
  580. package/dist/esm/monitoring/logger/utils/log-value-normalization.backend.utils.d.ts.map +1 -1
  581. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +10 -6
  582. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -1
  583. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +10 -6
  584. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -1
  585. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  586. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  587. package/dist/esm/monitoring/observability/otel-preload.d.ts.map +1 -1
  588. package/dist/esm/monitoring/observability/otel-sdk-global-handle.d.ts.map +1 -1
  589. package/dist/esm/monitoring/observability/services/__tests__/mock-metrics.service.d.ts.map +1 -1
  590. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  591. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  592. package/dist/esm/monitoring/observability/services/observability.backend.service.d.ts.map +1 -1
  593. package/dist/esm/notifications/email/components/email-components.d.ts.map +1 -1
  594. package/dist/esm/notifications/email/models/email-template-definition.d.ts.map +1 -1
  595. package/dist/esm/notifications/email/models/email-transport.backend.definitions.d.ts.map +1 -1
  596. package/dist/esm/notifications/email/services/email-batch-send.batch.backend.service.d.ts.map +1 -1
  597. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  598. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  599. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  600. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  601. package/dist/esm/notifications/email/services/email.backend.service.d.ts +47 -6
  602. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  603. package/dist/esm/notifications/email/services/email.backend.service.js +86 -36
  604. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  605. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  606. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  607. package/dist/esm/notifications/email/utils/interpolate-email-label.utils.d.ts.map +1 -1
  608. package/dist/esm/notifications/email/utils/zod-to-typescript.utils.d.ts.map +1 -1
  609. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  610. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  611. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  612. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  613. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts +32 -0
  614. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.d.ts.map +1 -0
  615. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js +32 -0
  616. package/dist/esm/notifications/sms/models/sms-transport.backend.definitions.js.map +1 -0
  617. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +64 -10
  618. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  619. package/dist/esm/notifications/sms/services/sms.backend.service.js +277 -82
  620. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  621. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  622. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  623. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  624. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  625. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  626. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  627. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  628. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.d.ts.map +1 -1
  629. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.repository.d.ts.map +1 -1
  630. package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-dispatcher.backend.service.d.ts.map +1 -1
  631. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service.d.ts.map +1 -1
  632. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  633. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  634. package/dist/esm/notifications/webhooks/outbound/services/webhook-config.backend.service.d.ts.map +1 -1
  635. package/dist/esm/notifications/webhooks/services/polymorphic-lookup.backend.service.d.ts.map +1 -1
  636. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  637. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  638. package/dist/esm/organizations/batches/organization-member-invitation-sweep.batch.backend.service.d.ts.map +1 -1
  639. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts.map +1 -1
  640. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  641. package/dist/esm/organizations/services/authority-change-audit.backend.utils.d.ts.map +1 -1
  642. package/dist/esm/organizations/services/invitation-acceptance.backend.utils.d.ts.map +1 -1
  643. package/dist/esm/organizations/services/org-creation-on-registration.backend.utils.d.ts.map +1 -1
  644. package/dist/esm/organizations/services/org-member-roles-validation.backend.utils.d.ts.map +1 -1
  645. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  646. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  647. package/dist/esm/organizations/services/organization-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  648. package/dist/esm/organizations/services/organization-member-custom-implementation.backend.service.d.ts.map +1 -1
  649. package/dist/esm/organizations/services/organization-onboarding-operation.backend.utils.d.ts.map +1 -1
  650. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  651. package/dist/esm/organizations/services/organization-unit-member-custom-implementation.backend.service.d.ts.map +1 -1
  652. package/dist/esm/organizations/services/scim-provisioning-gate.backend.utils.d.ts.map +1 -1
  653. package/dist/esm/organizations/services/user-org-type-grant.backend.utils.d.ts.map +1 -1
  654. package/dist/esm/organizations/services/user-type-revocation-on-org-leave.backend.utils.d.ts.map +1 -1
  655. package/dist/esm/pdf-templates/__tests__/fixtures/tiny-pdf-template.fixture.d.ts.map +1 -1
  656. package/dist/esm/pdf-templates/models/pdf-template-binding.d.ts.map +1 -1
  657. package/dist/esm/pdf-templates/models/pdf-template-definition.d.ts.map +1 -1
  658. package/dist/esm/pdf-templates/services/pdf-generated-file-writer.backend.service.d.ts.map +1 -1
  659. package/dist/esm/pdf-templates/services/pdf-generation-orchestrator.backend.service.d.ts.map +1 -1
  660. package/dist/esm/pdf-templates/services/pdf-renderer.backend.service.d.ts.map +1 -1
  661. package/dist/esm/pdf-templates/services/pdf-template-binding.backend.service.d.ts.map +1 -1
  662. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -1
  663. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -1
  664. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -1
  665. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -1
  666. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -1
  667. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -1
  668. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -1
  669. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -1
  670. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  671. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  672. package/dist/esm/queue/apps-crontabs-manager.backend.service.d.ts.map +1 -1
  673. package/dist/esm/queue/cron-job-sync.backend.service.d.ts.map +1 -1
  674. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  675. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  676. package/dist/esm/queue/job-completion-registry.backend.service.d.ts.map +1 -1
  677. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  678. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  679. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  680. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  681. package/dist/esm/queue/job-payload-storage.backend.service.d.ts.map +1 -1
  682. package/dist/esm/queue/job-status-tracking.backend.service.d.ts.map +1 -1
  683. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  684. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  685. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  686. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  687. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  688. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  689. package/dist/esm/queue/scheduled-message-verifier.backend.service.d.ts.map +1 -1
  690. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  691. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  692. package/dist/esm/rag/batches/rag-embedding-drain.batch.backend.service.d.ts.map +1 -1
  693. package/dist/esm/rag/batches/rag-reconciliation-sweep.batch.backend.service.d.ts.map +1 -1
  694. package/dist/esm/rag/models/rag-chunk-store.backend.types.d.ts.map +1 -1
  695. package/dist/esm/rag/models/rag-retrieval.backend.types.d.ts.map +1 -1
  696. package/dist/esm/rag/services/mongodb-rag-chunk-store.backend.service.d.ts.map +1 -1
  697. package/dist/esm/rag/services/postgresql-rag-chunk-store.backend.service.d.ts.map +1 -1
  698. package/dist/esm/rag/services/rag-chunk-collection.mongodb-ddl.backend.d.ts.map +1 -1
  699. package/dist/esm/rag/services/rag-chunk-retrieval.mongodb-query.backend.d.ts.map +1 -1
  700. package/dist/esm/rag/services/rag-chunk-retrieval.postgresql-query.backend.d.ts.map +1 -1
  701. package/dist/esm/rag/services/rag-chunk-store.backend.service.d.ts.map +1 -1
  702. package/dist/esm/rag/services/rag-chunk-table.postgresql-ddl.backend.d.ts.map +1 -1
  703. package/dist/esm/rag/services/rag-ingestion.backend.service.d.ts.map +1 -1
  704. package/dist/esm/rag/services/rag-retrieval.backend.service.d.ts.map +1 -1
  705. package/dist/esm/rag/utils/rag-chunk-fusion.backend.utils.d.ts.map +1 -1
  706. package/dist/esm/rag/utils/rag-chunk-removal.backend.utils.d.ts.map +1 -1
  707. package/dist/esm/rag/utils/rag-chunk-row-shaping.backend.utils.d.ts.map +1 -1
  708. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  709. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  710. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  711. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  712. package/dist/esm/rag/utils/rag-ingestion-trigger.backend.utils.d.ts.map +1 -1
  713. package/dist/esm/rag/utils/rag-retrieval-scope.backend.utils.d.ts.map +1 -1
  714. package/dist/esm/rag/utils/rag-source-field-value.backend.utils.d.ts.map +1 -1
  715. package/dist/esm/requests/models/api-routes.backend.defintions.d.ts.map +1 -1
  716. package/dist/esm/requests/models/requests.backend.schemas.d.ts.map +1 -1
  717. package/dist/esm/requests/service/platform-mutualized-handler.backend.service.d.ts.map +1 -1
  718. package/dist/esm/requests/service/platform-requests.backend.utils.d.ts.map +1 -1
  719. package/dist/esm/requests/service/remote-client-base.backend.service.d.ts.map +1 -1
  720. package/dist/esm/requests/service/serverless-services-handler.backend.service.d.ts.map +1 -1
  721. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  722. package/dist/esm/requests/service/websocket.service.js +49 -1
  723. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  724. package/dist/esm/resources/backend-resource-registry.exports.d.ts.map +1 -1
  725. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  726. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +2 -0
  727. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  728. package/dist/esm/resources/models/index.d.ts.map +1 -1
  729. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  730. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  731. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  732. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  733. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  734. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  735. package/dist/esm/resources/models/resources.backend.schemas.d.ts.map +1 -1
  736. package/dist/esm/resources/models/virtual-fields.backend.types.d.ts.map +1 -1
  737. package/dist/esm/resources/services/__tests__/mock-resources-registry.service.d.ts.map +1 -1
  738. package/dist/esm/resources/services/resource-context.backend.service.d.ts.map +1 -1
  739. package/dist/esm/resources/services/resource-id.backend.service.d.ts.map +1 -1
  740. package/dist/esm/resources/services/resource-population.backend.service.d.ts +17 -2
  741. package/dist/esm/resources/services/resource-population.backend.service.d.ts.map +1 -1
  742. package/dist/esm/resources/services/resource-population.backend.service.js +74 -18
  743. package/dist/esm/resources/services/resource-population.backend.service.js.map +1 -1
  744. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +23 -0
  745. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  746. package/dist/esm/resources/services/resources-registry.backend.service.js +31 -0
  747. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  748. package/dist/esm/resources/services/virtual-fields.backend.service.d.ts.map +1 -1
  749. package/dist/esm/resources/utils/resource-retention.backend.utils.d.ts.map +1 -1
  750. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  751. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  752. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  753. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  754. package/dist/esm/runtime/models/execution-context.backend.schemas.d.ts.map +1 -1
  755. package/dist/esm/runtime/models/request-context.als.backend.d.ts.map +1 -1
  756. package/dist/esm/runtime/models/runtime.backend.schemas.d.ts.map +1 -1
  757. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  758. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  759. package/dist/esm/runtime/services/execution-context-handler.backend.service.d.ts.map +1 -1
  760. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  761. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  762. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  763. package/dist/esm/runtime/services/http-server.backend.service.js +10 -0
  764. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  765. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  766. package/dist/esm/runtime/services/start-application.backend.service.js +26 -12
  767. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  768. package/dist/esm/runtime/services/utils/oauth-body-cap.backend.utils.d.ts.map +1 -1
  769. package/dist/esm/runtime/testing/execution-context-test-fixtures.d.ts.map +1 -1
  770. package/dist/esm/runtime/testing/mock-execution-context-creator.service.d.ts.map +1 -1
  771. package/dist/esm/runtime/utils/application-startup-config-access.backend.utils.d.ts.map +1 -1
  772. package/dist/esm/runtime/utils/feature-gated-core-resource-exclusions.backend.utils.d.ts.map +1 -1
  773. package/dist/esm/runtime/utils/request-client-ip.utils.d.ts.map +1 -1
  774. package/dist/esm/runtime/utils/scan-default-exports.backend.utils.d.ts.map +1 -1
  775. package/dist/esm/security/api-keys/api-key-generation.backend.utils.d.ts.map +1 -1
  776. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  777. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  778. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  779. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  780. package/dist/esm/security/authentications/controllers/auth-method-management-controller.backend.service.d.ts.map +1 -1
  781. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts +22 -0
  782. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  783. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +84 -0
  784. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  785. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  786. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  787. package/dist/esm/security/authentications/models/auth-constants.backend.d.ts.map +1 -1
  788. package/dist/esm/security/authentications/models/authentications.backend.schemas.d.ts.map +1 -1
  789. package/dist/esm/security/authentications/models/authorization-client.backend.schemas.d.ts.map +1 -1
  790. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  791. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  792. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts +37 -0
  793. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.d.ts.map +1 -0
  794. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js +37 -0
  795. package/dist/esm/security/authentications/models/federated-auth-transport.backend.definitions.js.map +1 -0
  796. package/dist/esm/security/authentications/models/identity-persistence-boundaries.backend.d.ts.map +1 -1
  797. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  798. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  799. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  800. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  801. package/dist/esm/security/authentications/models/saml-authentication.backend.schemas.d.ts.map +1 -1
  802. package/dist/esm/security/authentications/models/sso-connection.backend.schemas.d.ts.map +1 -1
  803. package/dist/esm/security/authentications/models/user-authorization-version.backend.utils.d.ts.map +1 -1
  804. package/dist/esm/security/authentications/seeds/enterprise-config-defaults.seeds.d.ts.map +1 -1
  805. package/dist/esm/security/authentications/services/__tests__/mock-auth-execution-context-factory.service.d.ts.map +1 -1
  806. package/dist/esm/security/authentications/services/__tests__/mock-auth-token-issuer.service.d.ts.map +1 -1
  807. package/dist/esm/security/authentications/services/__tests__/oauth-provider-audit-spies.mock.d.ts.map +1 -1
  808. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-domain-to-org-lookup.service.d.ts.map +1 -1
  809. package/dist/esm/security/authentications/services/admin-config/__tests__/mock-enterprise-user-provisioning.service.d.ts.map +1 -1
  810. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  811. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  812. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  813. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  814. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  815. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  816. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  817. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  818. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.d.ts.map +1 -1
  819. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js +2 -1
  820. package/dist/esm/security/authentications/services/admin-config/oidc-discovery.backend.service.js.map +1 -1
  821. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +9 -2
  822. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  823. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +9 -2
  824. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  825. package/dist/esm/security/authentications/services/auth-credential-verifier.backend.service.d.ts.map +1 -1
  826. package/dist/esm/security/authentications/services/auth-execution-context-factory.backend.service.d.ts.map +1 -1
  827. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  828. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  829. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  830. package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts.map +1 -1
  831. package/dist/esm/security/authentications/services/auth-methods/auth-phone-verification.backend.service.d.ts.map +1 -1
  832. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  833. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  834. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts +97 -0
  835. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  836. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +218 -26
  837. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  838. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts +14 -0
  839. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  840. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +36 -0
  841. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  842. package/dist/esm/security/authentications/services/auth-methods/saml-assertion-validator.backend.service.d.ts.map +1 -1
  843. package/dist/esm/security/authentications/services/auth-methods/saml-authentication.backend.service.d.ts.map +1 -1
  844. package/dist/esm/security/authentications/services/auth-methods/saml-metadata.backend.service.d.ts.map +1 -1
  845. package/dist/esm/security/authentications/services/auth-methods/saml-replay-guard.backend.service.d.ts.map +1 -1
  846. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  847. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  848. package/dist/esm/security/authentications/services/auth-session-store.backend.service.d.ts.map +1 -1
  849. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  850. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  851. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  852. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  853. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  854. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  855. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  856. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  857. package/dist/esm/security/authentications/services/custom-impls/scim-tokens.custom-impl.backend.service.d.ts.map +1 -1
  858. package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.d.ts.map +1 -1
  859. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -1
  860. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +57 -1
  861. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -1
  862. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  863. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  864. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.d.ts.map +1 -1
  865. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js +11 -1
  866. package/dist/esm/security/authentications/services/custom-impls/sso-connection.custom-impl.backend.service.js.map +1 -1
  867. package/dist/esm/security/authentications/services/email-verification-initiator.backend.service.d.ts.map +1 -1
  868. package/dist/esm/security/authentications/services/machine-token-issuer.backend.service.d.ts.map +1 -1
  869. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  870. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  871. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  872. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  873. package/dist/esm/security/authentications/services/oidc-user-claims.backend.service.d.ts.map +1 -1
  874. package/dist/esm/security/authentications/services/resolve-active-member-orgs.backend.utils.d.ts.map +1 -1
  875. package/dist/esm/security/authentications/services/utils/__tests__/mock-auth-user-lookup.service.d.ts.map +1 -1
  876. package/dist/esm/security/authentications/services/utils/auth-controller.utils.d.ts.map +1 -1
  877. package/dist/esm/security/authentications/services/utils/auth-credential-ops.backend.service.d.ts.map +1 -1
  878. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  879. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  880. package/dist/esm/security/authentications/services/utils/auth-response-helper.backend.service.d.ts.map +1 -1
  881. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  882. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  883. package/dist/esm/security/authentications/services/utils/concurrent-session-eviction.backend.utils.d.ts.map +1 -1
  884. package/dist/esm/security/authentications/services/utils/ensure-user-profile.backend.utils.d.ts.map +1 -1
  885. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  886. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  887. package/dist/esm/security/authentications/services/utils/machine-auth-rate-limit.backend.utils.d.ts.map +1 -1
  888. package/dist/esm/security/authentications/services/utils/pkce.backend.utils.d.ts.map +1 -1
  889. package/dist/esm/security/authentications/services/utils/saml-java-availability.d.ts.map +1 -1
  890. package/dist/esm/security/authentications/utils/application-auth-policy-audit.backend.utils.d.ts.map +1 -1
  891. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  892. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  893. package/dist/esm/security/authentications/utils/one-off-session-lifetime.backend.utils.d.ts.map +1 -1
  894. package/dist/esm/security/authentications/utils/social-oauth2-purpose.backend.utils.d.ts.map +1 -1
  895. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts +59 -0
  896. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.d.ts.map +1 -0
  897. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js +111 -0
  898. package/dist/esm/security/authorizations/access-grant-decision.factory.backend.js.map +1 -0
  899. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts +57 -0
  900. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.d.ts.map +1 -0
  901. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js +133 -0
  902. package/dist/esm/security/authorizations/access-grant-lifecycle-audit.backend.js.map +1 -0
  903. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts +41 -0
  904. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.d.ts.map +1 -0
  905. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js +157 -0
  906. package/dist/esm/security/authorizations/application-access-grant-custom-implementation.backend.service.js.map +1 -0
  907. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts +84 -0
  908. package/dist/esm/security/authorizations/application-wide-read-admission.backend.d.ts.map +1 -0
  909. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js +99 -0
  910. package/dist/esm/security/authorizations/application-wide-read-admission.backend.js.map +1 -0
  911. package/dist/esm/security/authorizations/authorization-denial-audit.backend.utils.d.ts.map +1 -1
  912. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -1
  913. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -1
  914. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  915. package/dist/esm/security/authorizations/junction-scope-resolution.backend.d.ts.map +1 -1
  916. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  917. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  918. package/dist/esm/security/authorizations/organization-unit-narrowing-enforcement.backend.d.ts.map +1 -1
  919. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  920. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +20 -181
  921. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  922. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -1
  923. package/dist/esm/security/authorizations/relationship-foreign-key-filter.backend.d.ts.map +1 -1
  924. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  925. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  926. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +40 -0
  927. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -1
  928. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +43 -1
  929. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -1
  930. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +27 -17
  931. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  932. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +27 -17
  933. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  934. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +72 -0
  935. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  936. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +153 -10
  937. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  938. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  939. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  940. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -1
  941. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -1
  942. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +139 -1
  943. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -1
  944. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +474 -33
  945. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -1
  946. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +40 -0
  947. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -1
  948. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -1
  949. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -1
  950. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -1
  951. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +19 -0
  952. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -1
  953. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +38 -0
  954. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -1
  955. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -1
  956. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -1
  957. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -1
  958. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +17 -1
  959. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -1
  960. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +14 -0
  961. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -1
  962. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +16 -0
  963. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -1
  964. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -1
  965. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +1 -1
  966. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -1
  967. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +19 -0
  968. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -1
  969. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +45 -2
  970. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -1
  971. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -1
  972. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -1
  973. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +37 -1
  974. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -1
  975. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -1
  976. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -1
  977. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -1
  978. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -1
  979. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -1
  980. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts +34 -0
  981. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.d.ts.map +1 -0
  982. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js +39 -0
  983. package/dist/esm/security/connected-accounts/utils/user-delegated-access-token-slot.backend.utils.js.map +1 -0
  984. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  985. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -1
  986. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  987. package/dist/esm/security/consumable-tokens/models/consumable-tokens.shared.schemas.d.ts.map +1 -1
  988. package/dist/esm/security/consumable-tokens/models/index.d.ts.map +1 -1
  989. package/dist/esm/security/consumable-tokens/services/__tests__/mock-consumable-token.service.d.ts.map +1 -1
  990. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  991. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  992. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  993. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  994. package/dist/esm/security/jwt/services/auth-jwt-guard.backend.service.d.ts.map +1 -1
  995. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  996. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts +13 -0
  997. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.d.ts.map +1 -1
  998. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js +14 -0
  999. package/dist/esm/security/jwt/services/wildo-worker-bootstrap-client.backend.service.js.map +1 -1
  1000. package/dist/esm/security/jwt/utils/jwt-verification-error-classification.backend.utils.d.ts.map +1 -1
  1001. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  1002. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  1003. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  1004. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  1005. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts +39 -0
  1006. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.d.ts.map +1 -0
  1007. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js +60 -0
  1008. package/dist/esm/security/outbound/outbound-request-deadline.backend.utils.js.map +1 -0
  1009. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts +66 -0
  1010. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.d.ts.map +1 -0
  1011. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js +75 -0
  1012. package/dist/esm/security/outbound/outbound-request-headers.backend.utils.js.map +1 -0
  1013. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  1014. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  1015. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  1016. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  1017. package/dist/esm/security/scim/utils/scim-attribute-path-resolver.backend.utils.d.ts.map +1 -1
  1018. package/dist/esm/security/scim/utils/scim-filter-parser.d.ts.map +1 -1
  1019. package/dist/esm/security/scim/utils/scim-response-formatter.d.ts.map +1 -1
  1020. package/dist/esm/security/session-invalidation-fence.backend.utils.d.ts.map +1 -1
  1021. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  1022. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  1023. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -1
  1024. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -1
  1025. package/dist/esm/security/token-invalidation-fence.backend.utils.d.ts.map +1 -1
  1026. package/dist/esm/testing.d.ts.map +1 -1
  1027. package/dist/esm/users/services/inbound-contact-custom-implementation.backend.service.d.ts.map +1 -1
  1028. package/dist/esm/users/services/user-deletion-audit.custom-impl.backend.service.d.ts.map +1 -1
  1029. package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts.map +1 -1
  1030. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -1
  1031. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -1
  1032. package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.d.ts.map +1 -1
  1033. package/dist/esm/users/services/user-self-custom-implementations.backend.d.ts.map +1 -1
  1034. package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.d.ts.map +1 -1
  1035. package/dist/tsconfig.build.tsbuildinfo +1 -1
  1036. package/package.json +9 -9
  1037. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts +0 -45
  1038. package/dist/esm/external-providers/services/flow-actor-design.backend.service.d.ts.map +0 -1
  1039. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js +0 -22
  1040. package/dist/esm/external-providers/services/flow-actor-design.backend.service.js.map +0 -1
  1041. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -0
  1042. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -0
  1043. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -0
  1044. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -0
  1045. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -0
  1046. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -0
  1047. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -0
  1048. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -0
  1049. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -0
  1050. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -0
  1051. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -0
  1052. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -0
  1053. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -0
  1054. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -0
  1055. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -0
  1056. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"billing-state.backend.service.js","sourceRoot":"","sources":["../../../../../../src/billing/services/back-office/billing-state.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAUL,gBAAgB,EAChB,qBAAqB,EAErB,kBAAkB,EAClB,SAAS,EACT,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAOpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kFAAkF,CAAC;AAEjI,OAAO,EAEL,mCAAmC,GACpC,MAAM,mFAAmF,CAAC;AAE3F,uEAAuE;AAGhE,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,6BAA6B;IAOP;IACD;IAPnE,YACqC,MAAqB,EACG,gBAAuD,EAChD,uBAA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scopeType + scopeEntityId, resolves the billing account internally\n * (auto-creates if missing), and returns the full aggregated state:\n * billing account, subscription, products, prices, credit pools, usage.\n *\n * This is the single entry point the frontend BillingProvider calls on mount.\n */\n\nimport { injectable, inject } from 'inversify';\nimport {\n type BillingAccount,\n type BillingSubscriptionBase,\n type Product,\n type Price,\n type Promotion,\n type InvoiceRef,\n type CreditPool,\n type BillingStateResponse,\n type UsageSummary,\n CoreResourceType,\n CoreResourceOperation,\n ResourcePrimaryScope,\n SubscriptionStatus,\n ErrorType,\n ErrorCustomMessageReference,\n} from '@wildo-ai/saas-models';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport type { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport type { SystemAccessBackendService } from '~wildo-backend-lib/base-classes/services/services/system-access.backend.service';\nimport { AbstractBillingBackendService } from '~wildo-backend-lib/billing/services/back-office/abstract-billing.backend.service';\nimport type { UsageMeteringBackendService } from '~wildo-backend-lib/billing/services/back-office/usage-metering.backend.service';\nimport {\n type BillingResolvedVariants,\n resolveBillingVariantsFromScopeType,\n} from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-impl-utils.backend';\n\n// ── Service ─────────────────────────────────────────────────────────\n\n@injectable()\nexport class BillingStateBackendService extends AbstractBillingBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) servicesRegistry: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.UsageMeteringService) private readonly usageMeteringService: UsageMeteringBackendService,\n @inject(SAAS_SERVICE_TYPES.SystemAccessService) private readonly systemAccessService: SystemAccessBackendService,\n ) {\n super(logger, servicesRegistry, executionContextCreator, resourcesRegistry, errorBuilder);\n }\n\n /**\n * Fetch the full aggregated billing state for a scope entity.\n *\n * Flow:\n * 1. Validate scopeType against enabledScopes\n * 2. Resolve polymorphic variants for this scope\n * 3. DEFENSE-IN-DEPTH: assert `scopeEntityId` belongs to the caller's authenticated scope\n * 4. Query billing account (auto-create if missing)\n * 5. Query subscription, products, prices, credit pools\n * 6. Return aggregated response\n *\n * @param executionContext the CALLER's authenticated context — the ownership authority for the DiD\n * guard in step 3. Pass the request/operation EC, NOT the internal context this service builds.\n */\n public async getState(\n scopeType: ResourcePrimaryScope,\n scopeEntityId: string,\n enabledScopes: ResourcePrimaryScope[],\n executionContext: ExecutionContext<any>,\n ): Promise<BillingStateResponse> {\n this.logDebug('getState called', { scopeType, scopeEntityId });\n\n if (!enabledScopes.includes(scopeType)) {\n throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, undefined, {\n customMessageReference: ErrorCustomMessageReference.BILLING_SCOPE_NOT_ENABLED,\n context: { scopeType, enabledScopes },\n });\n }\n\n const variants = resolveBillingVariantsFromScopeType(scopeType);\n if (!variants) {\n throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, undefined, {\n customMessageReference: ErrorCustomMessageReference.BILLING_SCOPE_NOT_ENABLED,\n context: { scopeType },\n });\n }\n\n // DEFENSE-IN-DEPTH: this method runs on an INTERNAL context that bypasses the contextual scope\n // filter and derives the billing account straight from `scopeEntityId`. So it must not blindly\n // trust an id a future caller might forward from client input. When the caller's execution context\n // carries a scope id for this scopeType (every authenticated request does), it MUST equal\n // `scopeEntityId`; a mismatch means the caller is reaching for a scope it does not own → refuse.\n // A system/internal context with no bound scope id is exempt — it legitimately queries any scope\n // (e.g. a billing batch). Both current callers derive `scopeEntityId` from exactly this key, so\n // this fires only on genuine cross-scope misuse, never on the intended own-scope call.\n const principalScopeId = (executionContext as unknown as Record<string, unknown> | undefined)?.[variants.scopeKey];\n if (principalScopeId !== undefined && principalScopeId !== null && String(principalScopeId) !== String(scopeEntityId)) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n context: {\n message: 'billing getState scopeEntityId does not match the authenticated principal scope',\n scopeType,\n },\n });\n }\n\n const billingAccount = await this.resolveOrCreateBillingAccount(variants, scopeEntityId);\n const billingAccountId = billingAccount?._id ?? null;\n\n const [subscription, allProducts, prices, invoices, creditPools] = await Promise.all([\n billingAccountId ? this.getActiveSubscription(billingAccountId, variants) : null,\n this.getAllProducts(),\n this.getAllPrices(),\n billingAccountId ? this.getInvoices(billingAccountId, variants) : [],\n billingAccountId ? this.getCreditPools(billingAccountId, variants) : {},\n ]);\n\n const products = allProducts.filter(\n (p: Product) => !p.targetScopes || p.targetScopes.includes(scopeType),\n );\n const activePromotions = await this.getActivePromotions(\n new Set(products.map(product => product.key)),\n );\n const usage = billingAccountId\n ? await this.getUsageSummary(variants, billingAccountId, subscription)\n : { byProduct: {} };\n\n return {\n billingAccount,\n subscription,\n products,\n prices,\n invoices,\n usage,\n creditPools,\n activePromotions,\n scopeType,\n };\n }\n\n // ════════════════════════════════════════════════════════════════\n // Private — Billing Account Resolution\n // ════════════════════════════════════════════════════════════════\n\n private async resolveOrCreateBillingAccount(\n variants: BillingResolvedVariants,\n scopeEntityId: string,\n ): Promise<BillingAccount | null> {\n const existing = await this.findBillingAccount(variants, scopeEntityId);\n if (existing) return existing;\n\n this.logDebug('No billing account found, auto-creating', {\n billingAccountType: variants.billingAccount,\n scopeEntityDocField: variants.scopeEntityDocField,\n scopeEntityId,\n });\n\n try {\n // Auto-create through the blessed SystemAccess path (`createAsSystem`), NOT a\n // plain `servicesRegistry.create` over the internal EC.\n //\n // Why the previous plain create failed: `internalCtx` →\n // `createForInternalServiceOperation` seeds an EMPTY context map and null\n // `initiatorIds`, and the create request DTO STRIPS context-auto-populated FK\n // names (`organizationId` / `userId` are in `CONTEXT_AUTO_POPULATED_FIELD_IDENTIFIERS`).\n // So the scope FK passed in the DATA payload was dropped, `enrichDataWithContext`\n // found neither Source A (context map) nor Source B (`initiatorIds`), and Mongoose\n // rejected the write with `Path <scopeFK> is required`.\n //\n // `createAsSystem` injects the scope FK via the execution CONTEXT MAP\n // (`contextResourcesFieldIdentifier`, i.e. Source A) — the channel\n // `enrichDataWithContext` reads — instead of the data payload or `initiatorIds`\n // (the internal EC is fail-closed and REJECTS identity fields on `initiatorIds`).\n // The FK is carried on `scopeContext`, keyed generically off the resolved\n // variant's `scopeEntityDocField` so ORGANIZATIONS → `organizationId` and\n // USER_SELF → `userId` both route correctly. Requires\n // `systemAccessPolicy.create = ALLOWED` on both billing-account variant configs.\n const scopeContext: { organizationId?: string; userId?: string } =\n variants.scopeEntityDocField === 'userId'\n ? { userId: scopeEntityId }\n : { organizationId: scopeEntityId };\n const created = await this.systemAccessService.createAsSystem<BillingAccount>(\n variants.billingAccount as CoreResourceType,\n {},\n { scopeContext },\n );\n return created ?? null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to auto-create billing account', {\n billingAccountType: variants.billingAccount,\n scopeEntityId,\n }, 'error');\n return null;\n }\n }\n\n private async findBillingAccount(\n variants: BillingResolvedVariants,\n scopeEntityId: string,\n ): Promise<BillingAccount | null> {\n // Context construction stays OUTSIDE the try: failing to resolve the\n // INTERNAL_CALL operation path is a wiring fault, never \"no billing account\".\n const ctx = await this.internalCtx(variants.billingAccount as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const results = await this.servicesRegistry.list<BillingAccount>(\n variants.billingAccount as CoreResourceType,\n ctx,\n { [variants.scopeEntityDocField]: scopeEntityId },\n { limit: 1 },\n ) as BillingAccount[];\n return results.length > 0 ? results[0] : null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query billing account', {\n billingAccountType: variants.billingAccount,\n scopeEntityId,\n });\n return null;\n }\n }\n\n // ════════════════════════════════════════════════════════════════\n // Private — Related Resource Queries\n // ════════════════════════════════════════════════════════════════\n\n private async getActiveSubscription(\n billingAccountId: string,\n variants: BillingResolvedVariants,\n ): Promise<BillingSubscriptionBase | null> {\n const ctx = await this.internalCtx(variants.subscription as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const results = await this.servicesRegistry.list<BillingSubscriptionBase>(\n variants.subscription as CoreResourceType,\n ctx,\n {\n [variants.billingAccountFkField]: billingAccountId,\n status: { $in: [SubscriptionStatus.ACTIVE, SubscriptionStatus.TRIALING] },\n },\n { limit: 1 },\n ) as BillingSubscriptionBase[];\n return results.length > 0 ? results[0] : null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query subscription', { billingAccountId });\n return null;\n }\n }\n\n private async getAllProducts(): Promise<Product[]> {\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.LIST);\n try {\n return await this.servicesRegistry.list<Product>(CoreResourceType.PRODUCTS, ctx) as Product[];\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query products');\n return [];\n }\n }\n\n private async getAllPrices(): Promise<Price[]> {\n const ctx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n try {\n return await this.servicesRegistry.list<Price>(CoreResourceType.PRICES, ctx) as Price[];\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query prices');\n return [];\n }\n }\n\n private async getInvoices(\n billingAccountId: string,\n variants: BillingResolvedVariants,\n ): Promise<InvoiceRef[]> {\n const ctx = await this.internalCtx(variants.invoiceRef as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const results = await this.servicesRegistry.list<InvoiceRef>(\n variants.invoiceRef as CoreResourceType,\n ctx,\n { [variants.billingAccountFkField]: billingAccountId },\n { limit: 50 },\n ) as InvoiceRef[];\n results.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());\n return results;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query invoices', { billingAccountId });\n return [];\n }\n }\n\n private async getCreditPools(\n billingAccountId: string,\n variants: BillingResolvedVariants,\n ): Promise<Record<string, { available: number; totalPurchased: number; totalConsumed: number }>> {\n const ctx = await this.internalCtx(variants.creditPool as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const pools = await this.servicesRegistry.list<CreditPool>(\n variants.creditPool as CoreResourceType,\n ctx,\n { [variants.billingAccountFkField]: billingAccountId },\n ) as CreditPool[];\n\n const result: Record<string, { available: number; totalPurchased: number; totalConsumed: number }> = {};\n for (const pool of pools) {\n result[pool.poolKey ?? pool._id] = {\n available: pool.available ?? 0,\n totalPurchased: pool.totalPurchased ?? 0,\n totalConsumed: pool.totalConsumed ?? 0,\n };\n }\n return result;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query credit pools', { billingAccountId });\n return {};\n }\n }\n\n private async getUsageSummary(\n variants: BillingResolvedVariants,\n billingAccountId: string,\n subscription: BillingSubscriptionBase | null,\n ): Promise<UsageSummary> {\n try {\n const hasCurrentPeriod = subscription?.currentPeriodStart && subscription?.currentPeriodEnd;\n const period = hasCurrentPeriod\n ? {\n start: new Date(subscription.currentPeriodStart),\n end: new Date(subscription.currentPeriodEnd),\n }\n : undefined;\n\n const usageByProduct = await this.usageMeteringService.getUsage(\n variants,\n billingAccountId,\n undefined,\n period,\n );\n\n return {\n byProduct: Object.fromEntries(\n Object.entries(usageByProduct).map(([productKey, currentPeriodUsage]) => [\n productKey,\n { currentPeriodUsage },\n ]),\n ),\n };\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query usage summary', { billingAccountId });\n return { byProduct: {} };\n }\n }\n\n /**\n * Return promotions that are valid for the current billing scope surface.\n *\n * The billing-state endpoint is consumed before the user has selected an exact\n * checkout item, so this intentionally stays broader than \"guaranteed\n * redeemable for the next product click\". What it guarantees instead:\n * - the promotion is currently active and within its validity window\n * - the promotion is synced to the billing provider\n * - if it targets products explicitly, at least one targeted product is visible\n * in the current billing scope\n */\n private async getActivePromotions(visibleProductKeys: Set<string>): Promise<Promotion[]> {\n const ctx = await this.internalCtx(CoreResourceType.PROMOTIONS, CoreResourceOperation.LIST);\n try {\n const promotions = await this.servicesRegistry.list<Promotion>(\n CoreResourceType.PROMOTIONS,\n ctx,\n { isActive: true },\n ) as Promotion[];\n\n const now = new Date();\n return promotions.filter(p => {\n if (p.validFrom && now < new Date(p.validFrom)) return false;\n if (p.validUntil && now > new Date(p.validUntil)) return false;\n if (p.maxRedemptions !== null && p.maxRedemptions !== undefined && (p.timesRedeemed ?? 0) >= p.maxRedemptions) return false;\n if (!p.providerCouponId && !p.providerPromotionId) return false;\n if (p.applicableProducts?.length > 0 && !p.applicableProducts.some(productKey => visibleProductKeys.has(productKey))) return false;\n return true;\n });\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query active promotions');\n return [];\n }\n }\n}\n"]}
1
+ {"version":3,"file":"billing-state.backend.service.js","sourceRoot":"","sources":["../../../../../src/billing/services/back-office/billing-state.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAUL,gBAAgB,EAChB,qBAAqB,EAErB,kBAAkB,EAClB,SAAS,EACT,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAOpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kFAAkF,CAAC;AAEjI,OAAO,EAEL,mBAAmB,EACnB,mCAAmC,GACpC,MAAM,mFAAmF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C,CAAA;IACzD,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAChE,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAC9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAA;IAC/C,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;;GARtC,0BAA0B,CAmWtC","sourcesContent":["/**\n * Billing State Backend Service\n *\n * Aggregated billing state endpoint (Strategy C — lazy facade).\n *\n * Accepts scopeType + scopeEntityId, resolves the billing account internally\n * (auto-creates if missing), and returns the full aggregated state:\n * billing account, subscription, products, prices, credit pools, usage.\n *\n * This is the single entry point the frontend BillingProvider calls on mount.\n */\n\nimport { injectable, inject } from 'inversify';\nimport {\n type BillingAccount,\n type BillingSubscriptionBase,\n type Product,\n type Price,\n type Promotion,\n type InvoiceRef,\n type CreditPool,\n type BillingStateResponse,\n type UsageSummary,\n CoreResourceType,\n CoreResourceOperation,\n ResourcePrimaryScope,\n SubscriptionStatus,\n ErrorType,\n ErrorCustomMessageReference,\n} from '@wildo-ai/saas-models';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport type { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport type { SystemAccessBackendService } from '~wildo-backend-lib/base-classes/services/services/system-access.backend.service';\nimport { AbstractBillingBackendService } from '~wildo-backend-lib/billing/services/back-office/abstract-billing.backend.service';\nimport type { UsageMeteringBackendService } from '~wildo-backend-lib/billing/services/back-office/usage-metering.backend.service';\nimport {\n type BillingResolvedVariants,\n isProductAcquirable,\n resolveBillingVariantsFromScopeType,\n} from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-impl-utils.backend';\n\n// ── Service ─────────────────────────────────────────────────────────\n\n@injectable()\nexport class BillingStateBackendService extends AbstractBillingBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) servicesRegistry: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.UsageMeteringService) private readonly usageMeteringService: UsageMeteringBackendService,\n @inject(SAAS_SERVICE_TYPES.SystemAccessService) private readonly systemAccessService: SystemAccessBackendService,\n ) {\n super(logger, servicesRegistry, executionContextCreator, resourcesRegistry, errorBuilder);\n }\n\n /**\n * Fetch the full aggregated billing state for a scope entity.\n *\n * Flow:\n * 1. Validate scopeType against enabledScopes\n * 2. Resolve polymorphic variants for this scope\n * 3. DEFENSE-IN-DEPTH: assert `scopeEntityId` belongs to the caller's authenticated scope\n * 4. Query billing account (auto-create if missing)\n * 5. Query subscription, products, prices, credit pools\n * 6. Return aggregated response\n *\n * @param executionContext the CALLER's authenticated context — the ownership authority for the DiD\n * guard in step 3. Pass the request/operation EC, NOT the internal context this service builds.\n */\n public async getState(\n scopeType: ResourcePrimaryScope,\n scopeEntityId: string,\n enabledScopes: ResourcePrimaryScope[],\n executionContext: ExecutionContext<any>,\n ): Promise<BillingStateResponse> {\n this.logDebug('getState called', { scopeType, scopeEntityId });\n\n if (!enabledScopes.includes(scopeType)) {\n throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, undefined, {\n customMessageReference: ErrorCustomMessageReference.BILLING_SCOPE_NOT_ENABLED,\n context: { scopeType, enabledScopes },\n });\n }\n\n const variants = resolveBillingVariantsFromScopeType(scopeType);\n if (!variants) {\n throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, undefined, {\n customMessageReference: ErrorCustomMessageReference.BILLING_SCOPE_NOT_ENABLED,\n context: { scopeType },\n });\n }\n\n // DEFENSE-IN-DEPTH: this method runs on an INTERNAL context that bypasses the contextual scope\n // filter and derives the billing account straight from `scopeEntityId`. So it must not blindly\n // trust an id a future caller might forward from client input. When the caller's execution context\n // carries a scope id for this scopeType (every authenticated request does), it MUST equal\n // `scopeEntityId`; a mismatch means the caller is reaching for a scope it does not own → refuse.\n // A system/internal context with no bound scope id is exempt — it legitimately queries any scope\n // (e.g. a billing batch). Both current callers derive `scopeEntityId` from exactly this key, so\n // this fires only on genuine cross-scope misuse, never on the intended own-scope call.\n const principalScopeId = (executionContext as unknown as Record<string, unknown> | undefined)?.[variants.scopeKey];\n if (principalScopeId !== undefined && principalScopeId !== null && String(principalScopeId) !== String(scopeEntityId)) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n context: {\n message: 'billing getState scopeEntityId does not match the authenticated principal scope',\n scopeType,\n },\n });\n }\n\n const billingAccount = await this.resolveOrCreateBillingAccount(variants, scopeEntityId);\n const billingAccountId = billingAccount?._id ?? null;\n\n const [subscription, allProducts, prices, invoices, creditPools] = await Promise.all([\n billingAccountId ? this.getActiveSubscription(billingAccountId, variants) : null,\n this.getAllProducts(),\n this.getAllPrices(),\n billingAccountId ? this.getInvoices(billingAccountId, variants) : [],\n billingAccountId ? this.getCreditPools(billingAccountId, variants) : {},\n ]);\n\n const products = allProducts.filter(\n (p: Product) => !p.targetScopes || p.targetScopes.includes(scopeType),\n );\n // The ACQUISITION half of catalogue retirement. `products` deliberately keeps every\n // scope-visible row — including retired ones — so a customer already ON a retired plan can\n // still be shown what they hold; this set is what an acquisition surface offers.\n //\n // Derived by `isProductAcquirable`, the SAME predicate `readProductByKey`'s ACQUIRE arm\n // applies, so a plan this set offers is a plan checkout will accept: the listing cannot drift\n // from the gate the way a re-derived `p.isActive` filter can. Total over `products` by\n // construction rather than a second list to keep.\n const acquirableProductKeys = products.filter(isProductAcquirable).map(product => product.key);\n\n const activePromotions = await this.getActivePromotions(\n new Set(products.map(product => product.key)),\n );\n const usage = billingAccountId\n ? await this.getUsageSummary(variants, billingAccountId, subscription)\n : { byProduct: {} };\n\n return {\n billingAccount,\n subscription,\n products,\n prices,\n invoices,\n usage,\n creditPools,\n activePromotions,\n acquirableProductKeys,\n scopeType,\n };\n }\n\n // ════════════════════════════════════════════════════════════════\n // Private — Billing Account Resolution\n // ════════════════════════════════════════════════════════════════\n\n private async resolveOrCreateBillingAccount(\n variants: BillingResolvedVariants,\n scopeEntityId: string,\n ): Promise<BillingAccount | null> {\n const existing = await this.findBillingAccount(variants, scopeEntityId);\n if (existing) return existing;\n\n this.logDebug('No billing account found, auto-creating', {\n billingAccountType: variants.billingAccount,\n scopeEntityDocField: variants.scopeEntityDocField,\n scopeEntityId,\n });\n\n try {\n // Auto-create through the blessed SystemAccess path (`createAsSystem`), NOT a\n // plain `servicesRegistry.create` over the internal EC.\n //\n // Why the previous plain create failed: `internalCtx` →\n // `createForInternalServiceOperation` seeds an EMPTY context map and null\n // `initiatorIds`, and the create request DTO STRIPS context-auto-populated FK\n // names (`organizationId` / `userId` are in `CONTEXT_AUTO_POPULATED_FIELD_IDENTIFIERS`).\n // So the scope FK passed in the DATA payload was dropped, `enrichDataWithContext`\n // found neither Source A (context map) nor Source B (`initiatorIds`), and Mongoose\n // rejected the write with `Path <scopeFK> is required`.\n //\n // `createAsSystem` injects the scope FK via the execution CONTEXT MAP\n // (`contextResourcesFieldIdentifier`, i.e. Source A) — the channel\n // `enrichDataWithContext` reads — instead of the data payload or `initiatorIds`\n // (the internal EC is fail-closed and REJECTS identity fields on `initiatorIds`).\n // The FK is carried on `scopeContext`, keyed generically off the resolved\n // variant's `scopeEntityDocField` so ORGANIZATIONS → `organizationId` and\n // USER_SELF → `userId` both route correctly. Requires\n // `systemAccessPolicy.create = ALLOWED` on both billing-account variant configs.\n const scopeContext: { organizationId?: string; userId?: string } =\n variants.scopeEntityDocField === 'userId'\n ? { userId: scopeEntityId }\n : { organizationId: scopeEntityId };\n const created = await this.systemAccessService.createAsSystem<BillingAccount>(\n variants.billingAccount as CoreResourceType,\n {},\n { scopeContext },\n );\n return created ?? null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to auto-create billing account', {\n billingAccountType: variants.billingAccount,\n scopeEntityId,\n }, 'error');\n return null;\n }\n }\n\n private async findBillingAccount(\n variants: BillingResolvedVariants,\n scopeEntityId: string,\n ): Promise<BillingAccount | null> {\n // Context construction stays OUTSIDE the try: failing to resolve the\n // INTERNAL_CALL operation path is a wiring fault, never \"no billing account\".\n const ctx = await this.internalCtx(variants.billingAccount as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const results = await this.servicesRegistry.list<BillingAccount>(\n variants.billingAccount as CoreResourceType,\n ctx,\n { [variants.scopeEntityDocField]: scopeEntityId },\n { limit: 1 },\n ) as BillingAccount[];\n return results.length > 0 ? results[0] : null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query billing account', {\n billingAccountType: variants.billingAccount,\n scopeEntityId,\n });\n return null;\n }\n }\n\n // ════════════════════════════════════════════════════════════════\n // Private — Related Resource Queries\n // ════════════════════════════════════════════════════════════════\n\n private async getActiveSubscription(\n billingAccountId: string,\n variants: BillingResolvedVariants,\n ): Promise<BillingSubscriptionBase | null> {\n const ctx = await this.internalCtx(variants.subscription as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const results = await this.servicesRegistry.list<BillingSubscriptionBase>(\n variants.subscription as CoreResourceType,\n ctx,\n {\n [variants.billingAccountFkField]: billingAccountId,\n status: { $in: [SubscriptionStatus.ACTIVE, SubscriptionStatus.TRIALING] },\n },\n { limit: 1 },\n ) as BillingSubscriptionBase[];\n return results.length > 0 ? results[0] : null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query subscription', { billingAccountId });\n return null;\n }\n }\n\n private async getAllProducts(): Promise<Product[]> {\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.LIST);\n try {\n return await this.servicesRegistry.list<Product>(CoreResourceType.PRODUCTS, ctx) as Product[];\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query products');\n return [];\n }\n }\n\n private async getAllPrices(): Promise<Price[]> {\n const ctx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n try {\n return await this.servicesRegistry.list<Price>(CoreResourceType.PRICES, ctx) as Price[];\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query prices');\n return [];\n }\n }\n\n private async getInvoices(\n billingAccountId: string,\n variants: BillingResolvedVariants,\n ): Promise<InvoiceRef[]> {\n const ctx = await this.internalCtx(variants.invoiceRef as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const results = await this.servicesRegistry.list<InvoiceRef>(\n variants.invoiceRef as CoreResourceType,\n ctx,\n { [variants.billingAccountFkField]: billingAccountId },\n { limit: 50 },\n ) as InvoiceRef[];\n results.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());\n return results;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query invoices', { billingAccountId });\n return [];\n }\n }\n\n private async getCreditPools(\n billingAccountId: string,\n variants: BillingResolvedVariants,\n ): Promise<Record<string, { available: number; totalPurchased: number; totalConsumed: number }>> {\n const ctx = await this.internalCtx(variants.creditPool as CoreResourceType, CoreResourceOperation.LIST);\n try {\n const pools = await this.servicesRegistry.list<CreditPool>(\n variants.creditPool as CoreResourceType,\n ctx,\n { [variants.billingAccountFkField]: billingAccountId },\n ) as CreditPool[];\n\n const result: Record<string, { available: number; totalPurchased: number; totalConsumed: number }> = {};\n for (const pool of pools) {\n result[pool.poolKey ?? pool._id] = {\n available: pool.available ?? 0,\n totalPurchased: pool.totalPurchased ?? 0,\n totalConsumed: pool.totalConsumed ?? 0,\n };\n }\n return result;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query credit pools', { billingAccountId });\n return {};\n }\n }\n\n private async getUsageSummary(\n variants: BillingResolvedVariants,\n billingAccountId: string,\n subscription: BillingSubscriptionBase | null,\n ): Promise<UsageSummary> {\n try {\n const hasCurrentPeriod = subscription?.currentPeriodStart && subscription?.currentPeriodEnd;\n const period = hasCurrentPeriod\n ? {\n start: new Date(subscription.currentPeriodStart),\n end: new Date(subscription.currentPeriodEnd),\n }\n : undefined;\n\n const usageByProduct = await this.usageMeteringService.getUsage(\n variants,\n billingAccountId,\n undefined,\n period,\n );\n\n return {\n byProduct: Object.fromEntries(\n Object.entries(usageByProduct).map(([productKey, currentPeriodUsage]) => [\n productKey,\n { currentPeriodUsage },\n ]),\n ),\n };\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query usage summary', { billingAccountId });\n return { byProduct: {} };\n }\n }\n\n /**\n * Return promotions that are valid for the current billing scope surface.\n *\n * The billing-state endpoint is consumed before the user has selected an exact\n * checkout item, so this intentionally stays broader than \"guaranteed\n * redeemable for the next product click\". What it guarantees instead:\n * - the promotion is currently active and within its validity window\n * - the promotion is synced to the billing provider\n * - if it targets products explicitly, at least one targeted product is visible\n * in the current billing scope\n */\n private async getActivePromotions(visibleProductKeys: Set<string>): Promise<Promotion[]> {\n const ctx = await this.internalCtx(CoreResourceType.PROMOTIONS, CoreResourceOperation.LIST);\n try {\n const promotions = await this.servicesRegistry.list<Promotion>(\n CoreResourceType.PROMOTIONS,\n ctx,\n { isActive: true },\n ) as Promotion[];\n\n const now = new Date();\n return promotions.filter(p => {\n if (p.validFrom && now < new Date(p.validFrom)) return false;\n if (p.validUntil && now > new Date(p.validUntil)) return false;\n if (p.maxRedemptions !== null && p.maxRedemptions !== undefined && (p.timesRedeemed ?? 0) >= p.maxRedemptions) return false;\n if (!p.providerCouponId && !p.providerPromotionId) return false;\n if (p.applicableProducts?.length > 0 && !p.applicableProducts.some(productKey => visibleProductKeys.has(productKey))) return false;\n return true;\n });\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to query active promotions');\n return [];\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"billing-subject-erasure-effect.backend.d.ts","sourceRoot":"","sources":["../../../../../../src/billing/services/back-office/billing-subject-erasure-effect.backend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAGhB,kBAAkB,EAGnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,iGAAiG,CAAC;AAGzG,6DAA6D;AAC7D,eAAO,MAAM,kCAAkC,qBAAqB,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,oBAAoB,CAAC;AAE/D,mGAAmG;AACnG,MAAM,WAAW,iCAAiC;IAChD,iEAAiE;IACjE,kBAAkB,IAAI,yBAAyB,GAAG,IAAI,CAAC;IACvD,8EAA8E;IAC9E,6BAA6B,CAC3B,0BAA0B,EAAE,gBAAgB,EAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAChE,8DAA8D;IAC9D,uBAAuB,CACrB,wBAAwB,EAAE,gBAAgB,EAC1C,qBAAqB,EAAE,MAAM,EAC7B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACnE;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,iCAAiC,GAC9C,4BAA4B,CA8L9B;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,8BAA8B,EAAE,SAAS,kBAAkB,EAGvE,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,uCAAuC,EAAE,SAAS,qBAAqB,EAEnF,CAAC"}
1
+ {"version":3,"file":"billing-subject-erasure-effect.backend.d.ts","sourceRoot":"","sources":["../../../../../src/billing/services/back-office/billing-subject-erasure-effect.backend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAGhB,kBAAkB,EAGnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACtF,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,iGAAiG,CAAC;AAGzG,6DAA6D;AAC7D,eAAO,MAAM,kCAAkC,qBAAqB,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,oBAAoB,CAAC;AAE/D,mGAAmG;AACnG,MAAM,WAAW,iCAAiC;IAChD,iEAAiE;IACjE,kBAAkB,IAAI,yBAAyB,GAAG,IAAI,CAAC;IACvD,8EAA8E;IAC9E,6BAA6B,CAC3B,0BAA0B,EAAE,gBAAgB,EAC5C,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAAE,GACnB,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IAChE,8DAA8D;IAC9D,uBAAuB,CACrB,wBAAwB,EAAE,gBAAgB,EAC1C,qBAAqB,EAAE,MAAM,EAC7B,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,sBAAsB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACnE;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,iCAAiC,GAC9C,4BAA4B,CA8L9B;AAMD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,8BAA8B,EAAE,SAAS,kBAAkB,EAGvE,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,uCAAuC,EAAE,SAAS,qBAAqB,EAEnF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"product-catalog-sync.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../src/billing/services/back-office/product-catalog-sync.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,OAAO,EAQb,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kFAAkF,CAAC;AAOjI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,6FAA6F,CAAC;AACzJ,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,+EAA+E,CAAC;AAC3I,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAChI,OAA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AC,QAAQ,CAAC,2BAA2B,CAAM;YAM3C,gBAAgB;YAehB,aAAa;YAkCb,YAAY;IA4C1B;;;;;;;OAOG;IACH,OAAO,CAAC,+BAA+B;YAWzB,qBAAqB;IAsCnC;;;;;;OAMG;YACW,4BAA4B;IAwE1C;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,uBAAuB;IAY/B;;;OAGG;IACH,OAAO,CAAC,eAAe;CAuBxB"}
1
+ {"version":3,"file":"product-catalog-sync.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/billing/services/back-office/product-catalog-sync.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,OAAO,EAQb,MAAM,uBAAuB,CAAC;AAK/B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEtF,OAAO,EAAE,6BAA6B,EAAE,MAAM,kFAAkF,CAAC;AAOjI,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,6FAA6F,CAAC;AACzJ,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,+EAA+E,CAAC;AAC3I,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAChI,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AAMnH,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;;OAIG;IACH,0BAA0B,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrF,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAMD,qBACa,gCAAiC,SAAQ,6BAA6B;IAEjF,4DAA4D;IAC5D,OAAO,CAAC,cAAc,CAA2B;gBAGZ,MAAM,EAAE,aAAa,EACG,gBAAgB,EAAE,qCAAqC,EAChD,uBAAuB,EAAE,qCAAqC,EAC5E,iBAAiB,EAAE,+BAA+B,EACtD,YAAY,EAAE,0BAA0B;IAS1F;;OAEG;IACU,UAAU,CACrB,cAAc,EAAE,iBAAiB,EAAE,EACnC,QAAQ,EAAE,yBAAyB,GAClC,OAAO,CAAC,IAAI,CAAC;IAWhB;;;OAGG;IACI,qBAAqB,IAAI,iBAAiB,EAAE;IAQnD;;;;;;;;;OASG;IACU,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAoCtE;;;;;;OAMG;IACU,kBAAkB,IAAI,OAAO,CAAC,wBAAwB,CAAC;IAiFpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;YACW,wBAAwB;IAuCtC;;;;;;;OAOG;YACW,sCAAsC;IAiCpD;;;;;;;OAOG;YACW,0BAA0B;IAgBxC,8CAA8C;IAC9C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAO;IAE1D;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,2BAA2B,CAAM;YAM3C,gBAAgB;YAehB,aAAa;YAkCb,YAAY;IA4C1B;;;;;;;OAOG;IACH,OAAO,CAAC,+BAA+B;YAWzB,qBAAqB;IAsCnC;;;;;;OAMG;YACW,4BAA4B;IAwE1C;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,uBAAuB;IAY/B;;;OAGG;IACH,OAAO,CAAC,eAAe;CAuBxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"product-catalog-sync.backend.service.js","sourceRoot":"","sources":["../../../../../../src/billing/services/back-office/product-catalog-sync.backend.service.ts"],"names":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B,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;;GAVtC,gCAAgC,CAknB5C","sourcesContent":["/**\n * Product Catalog Sync Backend Service\n *\n * Synchronizes the code-defined ProductDefinition catalog with the database\n * and the billing provider. Two modes:\n *\n * 1. LAZY: `ensureProductSynced(key)` — On-demand, single product (first checkout or admin view)\n * 2. BULK: `syncProductCatalog()` — Admin action, all products (post-deploy hook)\n *\n * Design:\n * - Config (code) is the source of truth → DB always reflects code\n * - Provider sync is separate from DB sync (happens on first use or bulk sync)\n * - \"features-dirty\" detection: when grantedFeatures/grantedLimits change, trigger\n * feature recomputation for all affected subscriptions\n *\n * @see billing-and-features-system.md §8.6 (Product Catalog Versioning Strategy)\n */\n\nimport { injectable, inject } from 'inversify';\nimport {\n type ProductDefinition,\n type Product,\n type Price,\n type BillingSubscriptionBase,\n CoreResourceType,\n CoreResourceOperation,\n ErrorType,\n ErrorCustomMessageReference,\n deriveTrustedSystemWritePreservedFields,\n} from '@wildo-ai/saas-models';\n// MoneyValue fields use bigint at an AUTHORED scale; the provider interface uses a number in the\n// CURRENCY's smallest unit. `Number()` alone crosses only the first of those two gaps, which is why\n// it was wrong here for as long as it stood — see `toProviderAmountOrThrow` (#515).\nimport { MoneyMinorUnitConversionError, toCurrencyMinorUnitAmountOrThrow } from '@wildo-ai/zod-decorators';\nimport type { StandardBilling_Interface } from '@wildo-ai/external-connectors-models';\nimport type { ServiceOptions } from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport { AbstractBillingBackendService } from '~wildo-backend-lib/billing/services/back-office/abstract-billing.backend.service';\nimport { TERMINAL_SUBSCRIPTION_STATUSES } from '~wildo-backend-lib/billing/services/back-office/billing-subject-erasure-effect.backend';\nimport {\n BILLING_SCOPE_TO_VARIANTS,\n type BillingResolvedVariants,\n} from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-impl-utils.backend';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport type { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\n\n// =====================================================\n// Types\n// =====================================================\n\nexport interface ProductCatalogSyncResult {\n synced: number;\n created: number;\n updated: number;\n featuresDirty: string[];\n /**\n * Keys that exist in the DATABASE and no longer in the code catalogue, and were soft-retired by\n * this run (`isActive: false` on the product and every one of its prices).\n */\n retired: string[];\n /**\n * Retired keys that STILL HAVE LIVE SUBSCRIBERS. Reported, never acted on — see\n * {@link ProductCatalogSyncBackendService.reconcileRetiredProducts} for why the framework refuses\n * to decide what happens to those customers.\n */\n retiredWithLiveSubscribers: Array<{ productKey: string; liveSubscriptions: number }>;\n errors: string[];\n}\n\n// =====================================================\n// Service\n// =====================================================\n\n@injectable()\nexport class ProductCatalogSyncBackendService extends AbstractBillingBackendService {\n\n /** The product catalog from code (set at initialization) */\n private productCatalog: ProductDefinition[] = [];\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) servicesRegistry: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n ) {\n super(logger, servicesRegistry, executionContextCreator, resourcesRegistry, errorBuilder);\n }\n\n // ════════════════════════════════════════════════════════════\n // Initialization\n // ════════════════════════════════════════════════════════════\n\n /**\n * Initialize with the code-defined product catalog and billing provider.\n */\n public async initialize(\n productCatalog: ProductDefinition[],\n provider: StandardBilling_Interface,\n ): Promise<void> {\n if (this.isInitialized) return;\n\n this.productCatalog = productCatalog;\n this.initializeProvider(provider);\n\n this.logDebug('Product catalog sync initialized', {\n productsInCatalog: productCatalog.length,\n });\n }\n\n /**\n * Returns the in-memory product catalog (set at initialization).\n * Used by the companion labelling service to discover billing keys for i18n.\n */\n public getProductDefinitions(): ProductDefinition[] {\n return this.productCatalog;\n }\n\n // ════════════════════════════════════════════════════════════\n // Lazy Sync (on-demand, single product)\n // ════════════════════════════════════════════════════════════\n\n /**\n * Ensure a single product and its prices exist in DB and provider.\n * Idempotent: safe to call multiple times.\n *\n * Flow:\n * 1. Look up ProductDefinition by key in code catalog\n * 2. Upsert Product DB record (key → _id mapping)\n * 3. Upsert Price DB records for each inline price\n * 4. If providerProductId is missing: sync to billing provider\n */\n public async ensureProductSynced(productKey: string): Promise<Product> {\n this.ensureInitialized();\n this.logDebug('Ensuring product synced', { productKey });\n\n // 1. Find in code catalog\n const definition = this.productCatalog.find(p => p.key === productKey);\n if (!definition) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PRODUCT_NOT_FOUND,\n context: { productKey },\n });\n }\n\n // 2. Upsert product in DB\n const product = await this.upsertProduct(definition);\n\n // 3. Upsert prices\n await this.upsertPrices(product._id, definition);\n\n // 4. Sync to provider when available.\n // Existing provider-linked products must still push any newly added local\n // prices, otherwise the DB/provider catalogs silently drift.\n if (this.billingProvider) {\n if (!product.providerProductId) {\n return await this.syncProductToProvider(product);\n }\n await this.syncUnsyncedPricesToProvider(product, product.providerProductId);\n }\n\n return product;\n }\n\n // ════════════════════════════════════════════════════════════\n // Bulk Sync (admin action)\n // ════════════════════════════════════════════════════════════\n\n /**\n * Sync ALL products from code catalog to DB + provider.\n * Detects \"features-dirty\" products and returns their keys for\n * downstream feature recomputation.\n *\n * Idempotent and safe to run multiple times.\n */\n public async syncProductCatalog(): Promise<ProductCatalogSyncResult> {\n this.ensureInitialized();\n this.logDebug('Starting bulk product catalog sync', {\n productsInCatalog: this.productCatalog.length,\n });\n\n const result: ProductCatalogSyncResult = {\n synced: 0,\n created: 0,\n updated: 0,\n featuresDirty: [],\n retired: [],\n retiredWithLiveSubscribers: [],\n errors: [],\n };\n\n for (const definition of this.productCatalog) {\n try {\n // Check if existing product has different features/limits\n const existingProduct = await this.findProductByKey(definition.key);\n const isFeaturesDirty = existingProduct\n ? this.isFeaturesDirty(existingProduct, definition)\n : false;\n\n // Upsert product (pass existing to avoid a second DB lookup)\n const product = await this.upsertProduct(definition, existingProduct);\n result.synced++;\n\n if (!existingProduct) {\n result.created++;\n } else {\n result.updated++;\n }\n\n // Upsert prices\n await this.upsertPrices(product._id, definition);\n\n // Sync to provider when available.\n if (this.billingProvider) {\n if (!product.providerProductId) {\n await this.syncProductToProvider(product);\n } else {\n await this.syncUnsyncedPricesToProvider(product, product.providerProductId);\n }\n }\n\n // Track features-dirty products\n if (isFeaturesDirty) {\n result.featuresDirty.push(definition.key);\n }\n } catch (error) {\n result.errors.push(`${definition.key}: ${(error as Error).message}`);\n this.logger.error('Failed to sync product', {\n productKey: definition.key,\n error: (error as Error).message,\n });\n }\n }\n\n /*\n * The other direction, and it runs LAST so that a key present in both is upserted before it is\n * examined for retirement — otherwise a first-ever sync would race itself.\n *\n * A failure here does not fail the sync: pushing the code catalogue is the primary job, and\n * refusing to do it because the retirement pass could not read subscriptions would make an\n * unrelated read fault block every deploy.\n */\n try {\n await this.reconcileRetiredProducts(result);\n } catch (error) {\n result.errors.push(`Retired-product reconciliation failed: ${(error as Error).message}`);\n }\n\n this.logDebug('Bulk product catalog sync complete', { ...result });\n return result;\n }\n\n // ════════════════════════════════════════════════════════════\n // Retirement — the catalogue's OTHER direction\n // ════════════════════════════════════════════════════════════\n\n /**\n * Soft-retire every local product whose key has left the code catalogue.\n *\n * ## What was wrong\n *\n * `syncProductCatalog` iterated `this.productCatalog` and nothing else, so it could only ever ADD\n * and UPDATE. A key deleted from the code catalogue left its `Product` row `isActive: true`, its\n * `Price` rows active, and its provider product and prices live — and because the purchase path\n * reads the DATABASE rather than the code catalogue, a product that no longer existed in code\n * could still be bought, granting whatever `grantedFeatures` the last sync happened to write.\n *\n * ## The policy, stated because it changes what a paying customer experiences\n *\n * **Retire LOCALLY, always. Report the provider. Never migrate a subscriber. Never delete.**\n *\n * - **`isActive: false` on the product and on every one of its prices, unconditionally** — even\n * when subscribers are on it. It is entitlement-SAFE, which is the fact that makes the policy\n * possible: `BillingFeatureSyncBackendService.getProduct` resolves a subscription item's product\n * by `_id` with no `isActive` filter, and renewal happens entirely at the provider against the\n * provider price, which this does not touch. So an existing subscriber keeps their features and\n * keeps renewing; what stops is NEW acquisition, through the gate in\n * `readProductByKey(..., BillingCatalogReadIntent.ACQUIRE, ...)`.\n *\n * - **The PROVIDER catalogue is left completely alone.** REJECTED ALTERNATIVE: archive the\n * provider product and prices in the same pass. The provider is the party that actually charges,\n * and archiving a price a live subscription renews against is a customer-visible failed renewal\n * — the exact outcome this whole policy is arranged to avoid. It would also mean adding a\n * destructive provider write (`StandardBilling_Interface` has no archive verb today) in the same\n * change as the sweep that calls it. An operator archives provider rows deliberately, after\n * deciding what happens to the subscribers, and the report below is what tells them to.\n *\n * - **A retired key WITH LIVE SUBSCRIBERS is reported and otherwise untouched.** REJECTED\n * ALTERNATIVE: migrate them to the nearest surviving plan tier, or cancel them. Which plan a\n * customer should move to — and whether they should be moved at all rather than grandfathered —\n * is a commercial decision with a price attached, and a framework that guesses it either\n * overcharges someone or cancels a paying customer because a key was deleted in a refactor.\n * The count is reported at error level so the decision is put in front of a human.\n *\n * - **Nothing is ever deleted.** The `Product` and `Price` rows are the only local record of what\n * a RETAINED subscription and its retained invoices refer to, and billing rows deliberately\n * survive the deletion of their scope for a tax/audit obligation. Deleting a retired product\n * would strand exactly the trail that retention exists to preserve.\n */\n private async reconcileRetiredProducts(result: ProductCatalogSyncResult): Promise<void> {\n const catalogKeys = new Set(this.productCatalog.map(definition => definition.key));\n\n const listCtx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.LIST);\n const localProducts = await this.servicesRegistry.list<Product>(\n CoreResourceType.PRODUCTS, listCtx, { isActive: true },\n ) as Product[];\n\n const retiredProducts = localProducts.filter(product => !catalogKeys.has(product.key));\n if (retiredProducts.length === 0) return;\n\n const liveProductIds = await this.collectProductIdsWithLiveSubscriptions();\n\n for (const product of retiredProducts) {\n const liveSubscriptions = liveProductIds.get(product._id) ?? 0;\n try {\n await this.deactivateProductAndPrices(product);\n result.retired.push(product.key);\n } catch (error) {\n result.errors.push(`Failed to retire product ${product.key}: ${(error as Error).message}`);\n continue;\n }\n\n if (liveSubscriptions > 0) {\n result.retiredWithLiveSubscribers.push({ productKey: product.key, liveSubscriptions });\n this.logger.error('Retired product still has live subscribers', {\n productKey: product.key,\n productId: product._id,\n liveSubscriptions,\n message:\n 'This product left the code catalogue and is no longer purchasable, but subscriptions still ' +\n 'renew against it at the provider and still grant its last-synced features. Decide whether to ' +\n 'migrate, grandfather or cancel these subscribers — the framework deliberately does not choose. ' +\n 'Its provider product and prices were NOT archived, so renewals keep working until you act.',\n });\n }\n }\n }\n\n /**\n * How many LIVE subscriptions reference each product, across every billing scope.\n *\n * Built by paging live subscriptions and reading their items, rather than by filtering on\n * `items.productId` per product. Two reasons: a nested-path filter over an array is a document-store\n * idiom that does not translate to the PostgreSQL adapter's JSON column, and one pass over the live\n * set answers the question for every retired product at once instead of one query each.\n */\n private async collectProductIdsWithLiveSubscriptions(): Promise<Map<string, number>> {\n const counts = new Map<string, number>();\n\n for (const [scopeKey, scopeData] of Object.entries(BILLING_SCOPE_TO_VARIANTS)) {\n const variants: BillingResolvedVariants = { scopeKey, ...scopeData };\n const ctx = await this.internalCtx(variants.subscription as CoreResourceType, CoreResourceOperation.LIST);\n\n for (let page = 1; page <= ProductCatalogSyncBackendService.MAX_SUBSCRIPTION_SCAN_PAGES; page += 1) {\n const subscriptions = await this.servicesRegistry.list<BillingSubscriptionBase>(\n variants.subscription as CoreResourceType,\n ctx,\n { status: { $nin: TERMINAL_SUBSCRIPTION_STATUSES } },\n { page, limit: ProductCatalogSyncBackendService.SUBSCRIPTION_SCAN_PAGE_SIZE },\n ) as BillingSubscriptionBase[];\n\n for (const subscription of subscriptions) {\n const seen = new Set<string>();\n for (const item of subscription.items ?? []) {\n // One subscription counts ONCE per product however many items name it — the number is\n // \"how many customers am I about to strand\", not \"how many line items exist\".\n if (!item?.productId || seen.has(item.productId)) continue;\n seen.add(item.productId);\n counts.set(item.productId, (counts.get(item.productId) ?? 0) + 1);\n }\n }\n\n if (subscriptions.length < ProductCatalogSyncBackendService.SUBSCRIPTION_SCAN_PAGE_SIZE) break;\n }\n }\n\n return counts;\n }\n\n /**\n * `isActive: false` on the product and on every price beneath it.\n *\n * The prices matter as much as the product: an application that lists prices directly, or a caller\n * that names a price id, would otherwise still transact against a retired product's price — and\n * `readPriceForProduct` refuses on the PRICE's own flag, so leaving them active would leave a\n * second door open on the surface the gate was built for.\n */\n private async deactivateProductAndPrices(product: Product): Promise<void> {\n const productUpdate = { isActive: false };\n const productCtx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Product>(CoreResourceType.PRODUCTS, productCtx, product._id, productUpdate);\n\n const pricesCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n const prices = await this.servicesRegistry.list<Price>(\n CoreResourceType.PRICES, pricesCtx, { productId: product._id, isActive: true },\n ) as Price[];\n\n for (const price of prices) {\n const priceCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Price>(CoreResourceType.PRICES, priceCtx, price._id, { isActive: false });\n }\n }\n\n /** One page of the live-subscription scan. */\n private static readonly SUBSCRIPTION_SCAN_PAGE_SIZE = 200;\n\n /**\n * Page ceiling for the live-subscription scan. Reaching it UNDER-counts, which is the safe\n * direction here for exactly one reason: the count only ever decides whether a WARNING is emitted\n * — the retirement itself is unconditional — so a missed page costs a quieter log line, never a\n * different write.\n */\n private static readonly MAX_SUBSCRIPTION_SCAN_PAGES = 50;\n\n // ════════════════════════════════════════════════════════════\n // Private — Product Operations\n // ════════════════════════════════════════════════════════════\n\n private async findProductByKey(productKey: string): Promise<Product | null> {\n // Context construction stays OUTSIDE the try: failing to resolve the\n // INTERNAL_CALL operation path is a wiring fault, never \"product absent\".\n // A masked failure is worse here than a missing read — callers treat null as\n // \"not yet in the catalog\" and CREATE, so a swallowed fault duplicates products.\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.LIST);\n try {\n const items = await this.servicesRegistry.list<Product>(CoreResourceType.PRODUCTS, ctx, { key: productKey }) as Product[];\n return items.length > 0 ? items[0] : null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to find product by key', { productKey });\n return null;\n }\n }\n\n private async upsertProduct(definition: ProductDefinition, existingProductHint?: Product | null): Promise<Product> {\n // Use the pre-fetched product if available (avoids double DB lookup in bulk sync)\n const existingProduct = existingProductHint !== undefined\n ? existingProductHint\n : await this.findProductByKey(definition.key);\n\n const productData: Partial<Product> = {\n type: definition.type,\n key: definition.key,\n targetScopes: definition.targetScopes,\n grantedFeatures: definition.grantedFeatures,\n grantedLimits: definition.grantedLimits,\n planTier: definition.planTier,\n planTierOrder: definition.planTierOrder,\n requiredPlanTiers: definition.requiredPlanTiers,\n taxDisplayMode: definition.taxDisplayMode,\n purchaseConfig: definition.purchaseConfig,\n behaviorPolicy: definition.behaviorPolicy,\n sortOrder: definition.sortOrder,\n isPublic: definition.isPublic,\n isActive: true,\n };\n\n if (existingProduct) {\n // Update\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.UPDATE);\n return await this.servicesRegistry.update<Product>(CoreResourceType.PRODUCTS, ctx, existingProduct._id, productData) as Product;\n } else {\n // Create\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.CREATE);\n return await this.servicesRegistry.create<Product>(CoreResourceType.PRODUCTS, ctx, productData);\n }\n }\n\n private async upsertPrices(productId: string, definition: ProductDefinition): Promise<void> {\n for (const priceDef of definition.prices) {\n const priceData: Partial<Price> = {\n productId,\n model: priceDef.model,\n unitPrice: priceDef.unitPrice,\n interval: priceDef.interval,\n intervalCount: priceDef.intervalCount,\n tiers: priceDef.tiers,\n packageSize: priceDef.packageSize,\n usageAggregation: priceDef.usageAggregation,\n taxBehavior: priceDef.taxBehavior,\n isDefault: priceDef.isDefault,\n isActive: true,\n };\n\n // Try to find existing price for this product with same model+interval+currency\n try {\n const listCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n const items = await this.servicesRegistry.list<Price>(CoreResourceType.PRICES, listCtx, {\n productId,\n model: priceDef.model,\n 'unitPrice.currency': priceDef.unitPrice.currency,\n ...(priceDef.interval && { interval: priceDef.interval }),\n }) as Price[];\n\n if (items.length > 0) {\n const updateCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Price>(CoreResourceType.PRICES, updateCtx, items[0]._id, priceData);\n } else {\n const createCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.CREATE);\n await this.servicesRegistry.create<Price>(CoreResourceType.PRICES, createCtx, priceData);\n }\n } catch (error) {\n this.logger.error('Failed to upsert price', {\n productId,\n model: priceDef.model,\n currency: priceDef.unitPrice.currency,\n error: (error as Error).message,\n });\n }\n }\n }\n\n /**\n * `ServiceOptions` that re-attach the backend-only provider-link field(s) a plain update request\n * DTO would strip. The billing catalog sync is a trusted in-process write of provider identifiers\n * (`providerProductId` / `providerPriceId`, both `.isBackendOnly()`); without this the strict\n * request-DTO parse drops them and the update persists nothing. Mirrors the billing webhook\n * event router's trusted-system write (`deriveTrustedSystemWritePreservedFields` — schema-aware,\n * so it only preserves fields that are genuinely backend-only AND present in the payload).\n */\n private trustedProviderLinkWriteOptions(resourceType: CoreResourceType, payload: Record<string, unknown>): ServiceOptions {\n const { mainSchema } = this.resourcesRegistry.getResourceConfiguration(resourceType);\n return {\n preserveServerInjectedFields: deriveTrustedSystemWritePreservedFields(\n mainSchema,\n Object.keys(payload),\n CoreResourceOperation.UPDATE,\n ),\n };\n }\n\n private async syncProductToProvider(product: Product): Promise<Product> {\n if (!this.billingProvider) return product;\n\n try {\n // Sync product\n const { providerProductId } = await this.billingProvider.syncProduct({\n productKey: product.key,\n name: product.key,\n metadata: { key: product.key, type: product.type },\n });\n\n // Persist the provider link locally. `providerProductId` is `.isBackendOnly()`, so a plain\n // update request DTO STRIPS it: the write \"succeeds\" but the field never lands, leaving the\n // local link null forever — which is what made every catalog sync re-create the provider\n // product (accumulating duplicates). Re-attach it through the trusted-system-write allowlist,\n // the same seam the billing webhook path uses for the same class of backend-only field.\n const providerLink = { providerProductId };\n const updateCtx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.UPDATE);\n const updated = await this.servicesRegistry.update<Product>(\n CoreResourceType.PRODUCTS,\n updateCtx,\n product._id,\n providerLink,\n this.trustedProviderLinkWriteOptions(CoreResourceType.PRODUCTS, providerLink),\n ) as Product;\n\n await this.syncUnsyncedPricesToProvider(updated, providerProductId);\n\n return updated;\n } catch (error) {\n this.logger.error('Failed to sync product to provider', {\n productKey: product.key,\n error: (error as Error).message,\n });\n return product;\n }\n }\n\n /**\n * Sync any locally defined prices that do not yet have a provider identifier.\n *\n * This must run for both first-time product syncs and already-synced products,\n * otherwise adding a new local price after the initial product sync leaves the\n * provider catalog stale.\n */\n private async syncUnsyncedPricesToProvider(product: Product, providerProductId: string): Promise<void> {\n if (!this.billingProvider) return;\n\n const listCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n const prices = await this.servicesRegistry.list<Price>(CoreResourceType.PRICES, listCtx, { productId: product._id }) as Price[];\n\n for (const price of prices) {\n if (price.providerPriceId) continue;\n\n try {\n /*\n * Convert every amount from its AUTHORED scale to the CURRENCY's smallest unit (#515).\n *\n * This was `Number(price.unitPrice.amount)` and two more like it — the stored amount handed\n * over verbatim, with `MoneyValue.decimals` discarded. A price authored at any scale other\n * than the currency's was therefore synced at the wrong magnitude, by a factor of 10 per\n * decimal place of disagreement, and the three amounts in one price could each carry a\n * different scale and still be combined as if they shared one.\n *\n * A conversion that cannot be made exactly REFUSES the price rather than rounding it. The\n * throw is caught by the loop below, which logs and moves to the next price — so one\n * unrepresentable price does not stop a catalogue sync, and it does not reach the provider\n * either.\n */\n const priceCurrency = price.unitPrice.currency;\n const amount = this.toProviderAmountOrThrow(price.unitPrice, priceCurrency, `price ${price._id}`);\n const { providerPriceId } = await this.billingProvider.syncPrice({\n providerProductId,\n amount,\n currency: price.unitPrice.currency,\n interval: price.interval,\n model: price.model,\n tiers: price.tiers?.map((t, index) => ({\n upTo: t.upTo ?? null,\n unitAmount: this.toProviderAmountOrThrow(t.unitPrice, priceCurrency, `price ${price._id} tier ${index} unit amount`),\n flatAmount: this.toProviderAmountOrThrow(t.flatPrice, priceCurrency, `price ${price._id} tier ${index} flat amount`),\n })),\n packageSize: price.packageSize,\n taxBehavior: price.taxBehavior,\n metadata: { productKey: product.key },\n });\n\n // `providerPriceId` is `.isBackendOnly()` too — same trusted-system-write preservation as\n // the product link above, or the price link would silently never persist.\n const priceLink = { providerPriceId };\n const priceUpdateCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Price>(\n CoreResourceType.PRICES,\n priceUpdateCtx,\n price._id,\n priceLink,\n this.trustedProviderLinkWriteOptions(CoreResourceType.PRICES, priceLink),\n );\n } catch (error) {\n this.logger.error('Failed to sync price to provider', {\n priceId: price._id,\n productKey: product.key,\n /*\n * The CLASSIFIED reason when the failure is a scale one (#515), because the three have\n * different remedies and an operator should not have to read prose to tell them apart:\n * `unknown_minor_unit` is a catalogue problem, `precision_loss` is an authoring problem,\n * `unsafe_magnitude` is a limit of the provider's number type. This `instanceof` is why the\n * conversion throws a TYPED error rather than returning a result union — the engine compiles\n * with `strict: false`, where a discriminated union does not narrow.\n */\n ...(error instanceof MoneyMinorUnitConversionError ? { moneyScaleFailure: error.reason } : {}),\n error: (error as Error).message,\n });\n }\n }\n }\n\n /**\n * One amount, converted from its authored scale to the currency's smallest unit — or a throw naming\n * exactly why it cannot be (#515).\n *\n * Throws rather than returning a result, because every caller is inside the per-price `try` and the\n * only correct response to any of the three failures is the same: do not sync this price. Returning\n * a union here would give each of the three call sites its own chance to forget one.\n *\n * **The currency is passed in rather than read off the value**, and that is the second half of the\n * defect. A tier's `unitPrice`/`flatPrice` carry an OPTIONAL currency — they inherit the price's —\n * so reading each amount's own currency would resolve a scale per amount and let one price be\n * converted at up to three different ones. One price is denominated in one currency; the amounts\n * are its parts.\n */\n private toProviderAmountOrThrow(\n value: { amount: bigint; decimals: number },\n currency: string,\n subject: string,\n ): number {\n return toCurrencyMinorUnitAmountOrThrow({ ...value, currency }, subject);\n }\n\n // ════════════════════════════════════════════════════════════\n // Private — Dirty Detection\n // ════════════════════════════════════════════════════════════\n\n /**\n * Check if a product's features/limits have changed relative to the catalog definition.\n * If so, all subscriptions using this product need feature recomputation.\n */\n private isFeaturesDirty(existing: Product, definition: ProductDefinition): boolean {\n // Check grantedFeatures\n const existingFeatures = new Set(existing.grantedFeatures ?? []);\n const newFeatures = new Set(definition.grantedFeatures ?? []);\n if (existingFeatures.size !== newFeatures.size) return true;\n for (const f of existingFeatures) {\n if (!newFeatures.has(f)) return true;\n }\n\n // Check grantedLimits\n const existingLimits = existing.grantedLimits ?? {};\n const newLimits = definition.grantedLimits ?? {};\n const existingKeys = Object.keys(existingLimits);\n const newKeys = Object.keys(newLimits);\n if (existingKeys.length !== newKeys.length) return true;\n for (const key of existingKeys) {\n if (!newLimits[key]) return true;\n if (existingLimits[key].value !== newLimits[key].value) return true;\n if (existingLimits[key].mode !== newLimits[key].mode) return true;\n }\n\n return false;\n }\n}\n"]}
1
+ {"version":3,"file":"product-catalog-sync.backend.service.js","sourceRoot":"","sources":["../../../../../src/billing/services/back-office/product-catalog-sync.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAKL,gBAAgB,EAChB,qBAAqB,EACrB,SAAS,EACT,2BAA2B,EAC3B,uCAAuC,GACxC,MAAM,uBAAuB,CAAC;AAC/B,iGAAiG;AACjG,oGAAoG;AACpG,oFAAoF;AACpF,OAAO,EAAE,6BAA6B,EAAE,gCAAgC,EAAE,MAAM,0BAA0B,CAAC;AAG3G,OAAO,EAAE,6BAA6B,EAAE,MAAM,kFAAkF,CAAC;AACjI,OAAO,EAAE,8BAA8B,EAAE,MAAM,wFAAwF,CAAC;AACxI,OAAO,EACL,yBAAyB,GAE1B,MAAM,mFAAmF,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AA8BpF,wDAAwD;AACxD,UAAU;AACV,wDAAwD;AAGjD,IAAM,gCAAgC,GAAtC,MAAM,gCAAiC,SAAQ,6BAA6B;;IAEjF,4DAA4D;IACpD,cAAc,GAAwB,EAAE,CAAC;IAEjD,YACqC,MAAqB,EACG,gBAAuD,EAChD,uBAA8D,EAC5E,iBAAkD,EACtD,YAAwC;QAExF,KAAK,CAAC,MAAM,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;IAC5F,CAAC;IAED,+DAA+D;IAC/D,iBAAiB;IACjB,+DAA+D;IAE/D;;OAEG;IACI,KAAK,CAAC,UAAU,CACrB,cAAmC,EACnC,QAAmC;QAEnC,IAAI,IAAI,CAAC,aAAa;YAAE,OAAO;QAE/B,IAAI,CAAC,cAAc,GA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AAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,8BAA8B,CAAC,CAAA;IACzD,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAChE,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;;GAVtC,gCAAgC,CAknB5C","sourcesContent":["/**\n * Product Catalog Sync Backend Service\n *\n * Synchronizes the code-defined ProductDefinition catalog with the database\n * and the billing provider. Two modes:\n *\n * 1. LAZY: `ensureProductSynced(key)` — On-demand, single product (first checkout or admin view)\n * 2. BULK: `syncProductCatalog()` — Admin action, all products (post-deploy hook)\n *\n * Design:\n * - Config (code) is the source of truth → DB always reflects code\n * - Provider sync is separate from DB sync (happens on first use or bulk sync)\n * - \"features-dirty\" detection: when grantedFeatures/grantedLimits change, trigger\n * feature recomputation for all affected subscriptions\n *\n * @see billing-and-features-system.md §8.6 (Product Catalog Versioning Strategy)\n */\n\nimport { injectable, inject } from 'inversify';\nimport {\n type ProductDefinition,\n type Product,\n type Price,\n type BillingSubscriptionBase,\n CoreResourceType,\n CoreResourceOperation,\n ErrorType,\n ErrorCustomMessageReference,\n deriveTrustedSystemWritePreservedFields,\n} from '@wildo-ai/saas-models';\n// MoneyValue fields use bigint at an AUTHORED scale; the provider interface uses a number in the\n// CURRENCY's smallest unit. `Number()` alone crosses only the first of those two gaps, which is why\n// it was wrong here for as long as it stood — see `toProviderAmountOrThrow` (#515).\nimport { MoneyMinorUnitConversionError, toCurrencyMinorUnitAmountOrThrow } from '@wildo-ai/zod-decorators';\nimport type { StandardBilling_Interface } from '@wildo-ai/external-connectors-models';\nimport type { ServiceOptions } from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport { AbstractBillingBackendService } from '~wildo-backend-lib/billing/services/back-office/abstract-billing.backend.service';\nimport { TERMINAL_SUBSCRIPTION_STATUSES } from '~wildo-backend-lib/billing/services/back-office/billing-subject-erasure-effect.backend';\nimport {\n BILLING_SCOPE_TO_VARIANTS,\n type BillingResolvedVariants,\n} from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-impl-utils.backend';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport type { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\n\n// =====================================================\n// Types\n// =====================================================\n\nexport interface ProductCatalogSyncResult {\n synced: number;\n created: number;\n updated: number;\n featuresDirty: string[];\n /**\n * Keys that exist in the DATABASE and no longer in the code catalogue, and were soft-retired by\n * this run (`isActive: false` on the product and every one of its prices).\n */\n retired: string[];\n /**\n * Retired keys that STILL HAVE LIVE SUBSCRIBERS. Reported, never acted on — see\n * {@link ProductCatalogSyncBackendService.reconcileRetiredProducts} for why the framework refuses\n * to decide what happens to those customers.\n */\n retiredWithLiveSubscribers: Array<{ productKey: string; liveSubscriptions: number }>;\n errors: string[];\n}\n\n// =====================================================\n// Service\n// =====================================================\n\n@injectable()\nexport class ProductCatalogSyncBackendService extends AbstractBillingBackendService {\n\n /** The product catalog from code (set at initialization) */\n private productCatalog: ProductDefinition[] = [];\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) servicesRegistry: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) errorBuilder: ErrorBuilderBackendService,\n ) {\n super(logger, servicesRegistry, executionContextCreator, resourcesRegistry, errorBuilder);\n }\n\n // ════════════════════════════════════════════════════════════\n // Initialization\n // ════════════════════════════════════════════════════════════\n\n /**\n * Initialize with the code-defined product catalog and billing provider.\n */\n public async initialize(\n productCatalog: ProductDefinition[],\n provider: StandardBilling_Interface,\n ): Promise<void> {\n if (this.isInitialized) return;\n\n this.productCatalog = productCatalog;\n this.initializeProvider(provider);\n\n this.logDebug('Product catalog sync initialized', {\n productsInCatalog: productCatalog.length,\n });\n }\n\n /**\n * Returns the in-memory product catalog (set at initialization).\n * Used by the companion labelling service to discover billing keys for i18n.\n */\n public getProductDefinitions(): ProductDefinition[] {\n return this.productCatalog;\n }\n\n // ════════════════════════════════════════════════════════════\n // Lazy Sync (on-demand, single product)\n // ════════════════════════════════════════════════════════════\n\n /**\n * Ensure a single product and its prices exist in DB and provider.\n * Idempotent: safe to call multiple times.\n *\n * Flow:\n * 1. Look up ProductDefinition by key in code catalog\n * 2. Upsert Product DB record (key → _id mapping)\n * 3. Upsert Price DB records for each inline price\n * 4. If providerProductId is missing: sync to billing provider\n */\n public async ensureProductSynced(productKey: string): Promise<Product> {\n this.ensureInitialized();\n this.logDebug('Ensuring product synced', { productKey });\n\n // 1. Find in code catalog\n const definition = this.productCatalog.find(p => p.key === productKey);\n if (!definition) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.BILLING_PRODUCT_NOT_FOUND,\n context: { productKey },\n });\n }\n\n // 2. Upsert product in DB\n const product = await this.upsertProduct(definition);\n\n // 3. Upsert prices\n await this.upsertPrices(product._id, definition);\n\n // 4. Sync to provider when available.\n // Existing provider-linked products must still push any newly added local\n // prices, otherwise the DB/provider catalogs silently drift.\n if (this.billingProvider) {\n if (!product.providerProductId) {\n return await this.syncProductToProvider(product);\n }\n await this.syncUnsyncedPricesToProvider(product, product.providerProductId);\n }\n\n return product;\n }\n\n // ════════════════════════════════════════════════════════════\n // Bulk Sync (admin action)\n // ════════════════════════════════════════════════════════════\n\n /**\n * Sync ALL products from code catalog to DB + provider.\n * Detects \"features-dirty\" products and returns their keys for\n * downstream feature recomputation.\n *\n * Idempotent and safe to run multiple times.\n */\n public async syncProductCatalog(): Promise<ProductCatalogSyncResult> {\n this.ensureInitialized();\n this.logDebug('Starting bulk product catalog sync', {\n productsInCatalog: this.productCatalog.length,\n });\n\n const result: ProductCatalogSyncResult = {\n synced: 0,\n created: 0,\n updated: 0,\n featuresDirty: [],\n retired: [],\n retiredWithLiveSubscribers: [],\n errors: [],\n };\n\n for (const definition of this.productCatalog) {\n try {\n // Check if existing product has different features/limits\n const existingProduct = await this.findProductByKey(definition.key);\n const isFeaturesDirty = existingProduct\n ? this.isFeaturesDirty(existingProduct, definition)\n : false;\n\n // Upsert product (pass existing to avoid a second DB lookup)\n const product = await this.upsertProduct(definition, existingProduct);\n result.synced++;\n\n if (!existingProduct) {\n result.created++;\n } else {\n result.updated++;\n }\n\n // Upsert prices\n await this.upsertPrices(product._id, definition);\n\n // Sync to provider when available.\n if (this.billingProvider) {\n if (!product.providerProductId) {\n await this.syncProductToProvider(product);\n } else {\n await this.syncUnsyncedPricesToProvider(product, product.providerProductId);\n }\n }\n\n // Track features-dirty products\n if (isFeaturesDirty) {\n result.featuresDirty.push(definition.key);\n }\n } catch (error) {\n result.errors.push(`${definition.key}: ${(error as Error).message}`);\n this.logger.error('Failed to sync product', {\n productKey: definition.key,\n error: (error as Error).message,\n });\n }\n }\n\n /*\n * The other direction, and it runs LAST so that a key present in both is upserted before it is\n * examined for retirement — otherwise a first-ever sync would race itself.\n *\n * A failure here does not fail the sync: pushing the code catalogue is the primary job, and\n * refusing to do it because the retirement pass could not read subscriptions would make an\n * unrelated read fault block every deploy.\n */\n try {\n await this.reconcileRetiredProducts(result);\n } catch (error) {\n result.errors.push(`Retired-product reconciliation failed: ${(error as Error).message}`);\n }\n\n this.logDebug('Bulk product catalog sync complete', { ...result });\n return result;\n }\n\n // ════════════════════════════════════════════════════════════\n // Retirement — the catalogue's OTHER direction\n // ════════════════════════════════════════════════════════════\n\n /**\n * Soft-retire every local product whose key has left the code catalogue.\n *\n * ## What was wrong\n *\n * `syncProductCatalog` iterated `this.productCatalog` and nothing else, so it could only ever ADD\n * and UPDATE. A key deleted from the code catalogue left its `Product` row `isActive: true`, its\n * `Price` rows active, and its provider product and prices live — and because the purchase path\n * reads the DATABASE rather than the code catalogue, a product that no longer existed in code\n * could still be bought, granting whatever `grantedFeatures` the last sync happened to write.\n *\n * ## The policy, stated because it changes what a paying customer experiences\n *\n * **Retire LOCALLY, always. Report the provider. Never migrate a subscriber. Never delete.**\n *\n * - **`isActive: false` on the product and on every one of its prices, unconditionally** — even\n * when subscribers are on it. It is entitlement-SAFE, which is the fact that makes the policy\n * possible: `BillingFeatureSyncBackendService.getProduct` resolves a subscription item's product\n * by `_id` with no `isActive` filter, and renewal happens entirely at the provider against the\n * provider price, which this does not touch. So an existing subscriber keeps their features and\n * keeps renewing; what stops is NEW acquisition, through the gate in\n * `readProductByKey(..., BillingCatalogReadIntent.ACQUIRE, ...)`.\n *\n * - **The PROVIDER catalogue is left completely alone.** REJECTED ALTERNATIVE: archive the\n * provider product and prices in the same pass. The provider is the party that actually charges,\n * and archiving a price a live subscription renews against is a customer-visible failed renewal\n * — the exact outcome this whole policy is arranged to avoid. It would also mean adding a\n * destructive provider write (`StandardBilling_Interface` has no archive verb today) in the same\n * change as the sweep that calls it. An operator archives provider rows deliberately, after\n * deciding what happens to the subscribers, and the report below is what tells them to.\n *\n * - **A retired key WITH LIVE SUBSCRIBERS is reported and otherwise untouched.** REJECTED\n * ALTERNATIVE: migrate them to the nearest surviving plan tier, or cancel them. Which plan a\n * customer should move to — and whether they should be moved at all rather than grandfathered —\n * is a commercial decision with a price attached, and a framework that guesses it either\n * overcharges someone or cancels a paying customer because a key was deleted in a refactor.\n * The count is reported at error level so the decision is put in front of a human.\n *\n * - **Nothing is ever deleted.** The `Product` and `Price` rows are the only local record of what\n * a RETAINED subscription and its retained invoices refer to, and billing rows deliberately\n * survive the deletion of their scope for a tax/audit obligation. Deleting a retired product\n * would strand exactly the trail that retention exists to preserve.\n */\n private async reconcileRetiredProducts(result: ProductCatalogSyncResult): Promise<void> {\n const catalogKeys = new Set(this.productCatalog.map(definition => definition.key));\n\n const listCtx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.LIST);\n const localProducts = await this.servicesRegistry.list<Product>(\n CoreResourceType.PRODUCTS, listCtx, { isActive: true },\n ) as Product[];\n\n const retiredProducts = localProducts.filter(product => !catalogKeys.has(product.key));\n if (retiredProducts.length === 0) return;\n\n const liveProductIds = await this.collectProductIdsWithLiveSubscriptions();\n\n for (const product of retiredProducts) {\n const liveSubscriptions = liveProductIds.get(product._id) ?? 0;\n try {\n await this.deactivateProductAndPrices(product);\n result.retired.push(product.key);\n } catch (error) {\n result.errors.push(`Failed to retire product ${product.key}: ${(error as Error).message}`);\n continue;\n }\n\n if (liveSubscriptions > 0) {\n result.retiredWithLiveSubscribers.push({ productKey: product.key, liveSubscriptions });\n this.logger.error('Retired product still has live subscribers', {\n productKey: product.key,\n productId: product._id,\n liveSubscriptions,\n message:\n 'This product left the code catalogue and is no longer purchasable, but subscriptions still ' +\n 'renew against it at the provider and still grant its last-synced features. Decide whether to ' +\n 'migrate, grandfather or cancel these subscribers — the framework deliberately does not choose. ' +\n 'Its provider product and prices were NOT archived, so renewals keep working until you act.',\n });\n }\n }\n }\n\n /**\n * How many LIVE subscriptions reference each product, across every billing scope.\n *\n * Built by paging live subscriptions and reading their items, rather than by filtering on\n * `items.productId` per product. Two reasons: a nested-path filter over an array is a document-store\n * idiom that does not translate to the PostgreSQL adapter's JSON column, and one pass over the live\n * set answers the question for every retired product at once instead of one query each.\n */\n private async collectProductIdsWithLiveSubscriptions(): Promise<Map<string, number>> {\n const counts = new Map<string, number>();\n\n for (const [scopeKey, scopeData] of Object.entries(BILLING_SCOPE_TO_VARIANTS)) {\n const variants: BillingResolvedVariants = { scopeKey, ...scopeData };\n const ctx = await this.internalCtx(variants.subscription as CoreResourceType, CoreResourceOperation.LIST);\n\n for (let page = 1; page <= ProductCatalogSyncBackendService.MAX_SUBSCRIPTION_SCAN_PAGES; page += 1) {\n const subscriptions = await this.servicesRegistry.list<BillingSubscriptionBase>(\n variants.subscription as CoreResourceType,\n ctx,\n { status: { $nin: TERMINAL_SUBSCRIPTION_STATUSES } },\n { page, limit: ProductCatalogSyncBackendService.SUBSCRIPTION_SCAN_PAGE_SIZE },\n ) as BillingSubscriptionBase[];\n\n for (const subscription of subscriptions) {\n const seen = new Set<string>();\n for (const item of subscription.items ?? []) {\n // One subscription counts ONCE per product however many items name it — the number is\n // \"how many customers am I about to strand\", not \"how many line items exist\".\n if (!item?.productId || seen.has(item.productId)) continue;\n seen.add(item.productId);\n counts.set(item.productId, (counts.get(item.productId) ?? 0) + 1);\n }\n }\n\n if (subscriptions.length < ProductCatalogSyncBackendService.SUBSCRIPTION_SCAN_PAGE_SIZE) break;\n }\n }\n\n return counts;\n }\n\n /**\n * `isActive: false` on the product and on every price beneath it.\n *\n * The prices matter as much as the product: an application that lists prices directly, or a caller\n * that names a price id, would otherwise still transact against a retired product's price — and\n * `readPriceForProduct` refuses on the PRICE's own flag, so leaving them active would leave a\n * second door open on the surface the gate was built for.\n */\n private async deactivateProductAndPrices(product: Product): Promise<void> {\n const productUpdate = { isActive: false };\n const productCtx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Product>(CoreResourceType.PRODUCTS, productCtx, product._id, productUpdate);\n\n const pricesCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n const prices = await this.servicesRegistry.list<Price>(\n CoreResourceType.PRICES, pricesCtx, { productId: product._id, isActive: true },\n ) as Price[];\n\n for (const price of prices) {\n const priceCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Price>(CoreResourceType.PRICES, priceCtx, price._id, { isActive: false });\n }\n }\n\n /** One page of the live-subscription scan. */\n private static readonly SUBSCRIPTION_SCAN_PAGE_SIZE = 200;\n\n /**\n * Page ceiling for the live-subscription scan. Reaching it UNDER-counts, which is the safe\n * direction here for exactly one reason: the count only ever decides whether a WARNING is emitted\n * — the retirement itself is unconditional — so a missed page costs a quieter log line, never a\n * different write.\n */\n private static readonly MAX_SUBSCRIPTION_SCAN_PAGES = 50;\n\n // ════════════════════════════════════════════════════════════\n // Private — Product Operations\n // ════════════════════════════════════════════════════════════\n\n private async findProductByKey(productKey: string): Promise<Product | null> {\n // Context construction stays OUTSIDE the try: failing to resolve the\n // INTERNAL_CALL operation path is a wiring fault, never \"product absent\".\n // A masked failure is worse here than a missing read — callers treat null as\n // \"not yet in the catalog\" and CREATE, so a swallowed fault duplicates products.\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.LIST);\n try {\n const items = await this.servicesRegistry.list<Product>(CoreResourceType.PRODUCTS, ctx, { key: productKey }) as Product[];\n return items.length > 0 ? items[0] : null;\n } catch (error) {\n this.degradeOrRethrow(error, 'Failed to find product by key', { productKey });\n return null;\n }\n }\n\n private async upsertProduct(definition: ProductDefinition, existingProductHint?: Product | null): Promise<Product> {\n // Use the pre-fetched product if available (avoids double DB lookup in bulk sync)\n const existingProduct = existingProductHint !== undefined\n ? existingProductHint\n : await this.findProductByKey(definition.key);\n\n const productData: Partial<Product> = {\n type: definition.type,\n key: definition.key,\n targetScopes: definition.targetScopes,\n grantedFeatures: definition.grantedFeatures,\n grantedLimits: definition.grantedLimits,\n planTier: definition.planTier,\n planTierOrder: definition.planTierOrder,\n requiredPlanTiers: definition.requiredPlanTiers,\n taxDisplayMode: definition.taxDisplayMode,\n purchaseConfig: definition.purchaseConfig,\n behaviorPolicy: definition.behaviorPolicy,\n sortOrder: definition.sortOrder,\n isPublic: definition.isPublic,\n isActive: true,\n };\n\n if (existingProduct) {\n // Update\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.UPDATE);\n return await this.servicesRegistry.update<Product>(CoreResourceType.PRODUCTS, ctx, existingProduct._id, productData) as Product;\n } else {\n // Create\n const ctx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.CREATE);\n return await this.servicesRegistry.create<Product>(CoreResourceType.PRODUCTS, ctx, productData);\n }\n }\n\n private async upsertPrices(productId: string, definition: ProductDefinition): Promise<void> {\n for (const priceDef of definition.prices) {\n const priceData: Partial<Price> = {\n productId,\n model: priceDef.model,\n unitPrice: priceDef.unitPrice,\n interval: priceDef.interval,\n intervalCount: priceDef.intervalCount,\n tiers: priceDef.tiers,\n packageSize: priceDef.packageSize,\n usageAggregation: priceDef.usageAggregation,\n taxBehavior: priceDef.taxBehavior,\n isDefault: priceDef.isDefault,\n isActive: true,\n };\n\n // Try to find existing price for this product with same model+interval+currency\n try {\n const listCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n const items = await this.servicesRegistry.list<Price>(CoreResourceType.PRICES, listCtx, {\n productId,\n model: priceDef.model,\n 'unitPrice.currency': priceDef.unitPrice.currency,\n ...(priceDef.interval && { interval: priceDef.interval }),\n }) as Price[];\n\n if (items.length > 0) {\n const updateCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Price>(CoreResourceType.PRICES, updateCtx, items[0]._id, priceData);\n } else {\n const createCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.CREATE);\n await this.servicesRegistry.create<Price>(CoreResourceType.PRICES, createCtx, priceData);\n }\n } catch (error) {\n this.logger.error('Failed to upsert price', {\n productId,\n model: priceDef.model,\n currency: priceDef.unitPrice.currency,\n error: (error as Error).message,\n });\n }\n }\n }\n\n /**\n * `ServiceOptions` that re-attach the backend-only provider-link field(s) a plain update request\n * DTO would strip. The billing catalog sync is a trusted in-process write of provider identifiers\n * (`providerProductId` / `providerPriceId`, both `.isBackendOnly()`); without this the strict\n * request-DTO parse drops them and the update persists nothing. Mirrors the billing webhook\n * event router's trusted-system write (`deriveTrustedSystemWritePreservedFields` — schema-aware,\n * so it only preserves fields that are genuinely backend-only AND present in the payload).\n */\n private trustedProviderLinkWriteOptions(resourceType: CoreResourceType, payload: Record<string, unknown>): ServiceOptions {\n const { mainSchema } = this.resourcesRegistry.getResourceConfiguration(resourceType);\n return {\n preserveServerInjectedFields: deriveTrustedSystemWritePreservedFields(\n mainSchema,\n Object.keys(payload),\n CoreResourceOperation.UPDATE,\n ),\n };\n }\n\n private async syncProductToProvider(product: Product): Promise<Product> {\n if (!this.billingProvider) return product;\n\n try {\n // Sync product\n const { providerProductId } = await this.billingProvider.syncProduct({\n productKey: product.key,\n name: product.key,\n metadata: { key: product.key, type: product.type },\n });\n\n // Persist the provider link locally. `providerProductId` is `.isBackendOnly()`, so a plain\n // update request DTO STRIPS it: the write \"succeeds\" but the field never lands, leaving the\n // local link null forever — which is what made every catalog sync re-create the provider\n // product (accumulating duplicates). Re-attach it through the trusted-system-write allowlist,\n // the same seam the billing webhook path uses for the same class of backend-only field.\n const providerLink = { providerProductId };\n const updateCtx = await this.internalCtx(CoreResourceType.PRODUCTS, CoreResourceOperation.UPDATE);\n const updated = await this.servicesRegistry.update<Product>(\n CoreResourceType.PRODUCTS,\n updateCtx,\n product._id,\n providerLink,\n this.trustedProviderLinkWriteOptions(CoreResourceType.PRODUCTS, providerLink),\n ) as Product;\n\n await this.syncUnsyncedPricesToProvider(updated, providerProductId);\n\n return updated;\n } catch (error) {\n this.logger.error('Failed to sync product to provider', {\n productKey: product.key,\n error: (error as Error).message,\n });\n return product;\n }\n }\n\n /**\n * Sync any locally defined prices that do not yet have a provider identifier.\n *\n * This must run for both first-time product syncs and already-synced products,\n * otherwise adding a new local price after the initial product sync leaves the\n * provider catalog stale.\n */\n private async syncUnsyncedPricesToProvider(product: Product, providerProductId: string): Promise<void> {\n if (!this.billingProvider) return;\n\n const listCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.LIST);\n const prices = await this.servicesRegistry.list<Price>(CoreResourceType.PRICES, listCtx, { productId: product._id }) as Price[];\n\n for (const price of prices) {\n if (price.providerPriceId) continue;\n\n try {\n /*\n * Convert every amount from its AUTHORED scale to the CURRENCY's smallest unit (#515).\n *\n * This was `Number(price.unitPrice.amount)` and two more like it — the stored amount handed\n * over verbatim, with `MoneyValue.decimals` discarded. A price authored at any scale other\n * than the currency's was therefore synced at the wrong magnitude, by a factor of 10 per\n * decimal place of disagreement, and the three amounts in one price could each carry a\n * different scale and still be combined as if they shared one.\n *\n * A conversion that cannot be made exactly REFUSES the price rather than rounding it. The\n * throw is caught by the loop below, which logs and moves to the next price — so one\n * unrepresentable price does not stop a catalogue sync, and it does not reach the provider\n * either.\n */\n const priceCurrency = price.unitPrice.currency;\n const amount = this.toProviderAmountOrThrow(price.unitPrice, priceCurrency, `price ${price._id}`);\n const { providerPriceId } = await this.billingProvider.syncPrice({\n providerProductId,\n amount,\n currency: price.unitPrice.currency,\n interval: price.interval,\n model: price.model,\n tiers: price.tiers?.map((t, index) => ({\n upTo: t.upTo ?? null,\n unitAmount: this.toProviderAmountOrThrow(t.unitPrice, priceCurrency, `price ${price._id} tier ${index} unit amount`),\n flatAmount: this.toProviderAmountOrThrow(t.flatPrice, priceCurrency, `price ${price._id} tier ${index} flat amount`),\n })),\n packageSize: price.packageSize,\n taxBehavior: price.taxBehavior,\n metadata: { productKey: product.key },\n });\n\n // `providerPriceId` is `.isBackendOnly()` too — same trusted-system-write preservation as\n // the product link above, or the price link would silently never persist.\n const priceLink = { providerPriceId };\n const priceUpdateCtx = await this.internalCtx(CoreResourceType.PRICES, CoreResourceOperation.UPDATE);\n await this.servicesRegistry.update<Price>(\n CoreResourceType.PRICES,\n priceUpdateCtx,\n price._id,\n priceLink,\n this.trustedProviderLinkWriteOptions(CoreResourceType.PRICES, priceLink),\n );\n } catch (error) {\n this.logger.error('Failed to sync price to provider', {\n priceId: price._id,\n productKey: product.key,\n /*\n * The CLASSIFIED reason when the failure is a scale one (#515), because the three have\n * different remedies and an operator should not have to read prose to tell them apart:\n * `unknown_minor_unit` is a catalogue problem, `precision_loss` is an authoring problem,\n * `unsafe_magnitude` is a limit of the provider's number type. This `instanceof` is why the\n * conversion throws a TYPED error rather than returning a result union — the engine compiles\n * with `strict: false`, where a discriminated union does not narrow.\n */\n ...(error instanceof MoneyMinorUnitConversionError ? { moneyScaleFailure: error.reason } : {}),\n error: (error as Error).message,\n });\n }\n }\n }\n\n /**\n * One amount, converted from its authored scale to the currency's smallest unit — or a throw naming\n * exactly why it cannot be (#515).\n *\n * Throws rather than returning a result, because every caller is inside the per-price `try` and the\n * only correct response to any of the three failures is the same: do not sync this price. Returning\n * a union here would give each of the three call sites its own chance to forget one.\n *\n * **The currency is passed in rather than read off the value**, and that is the second half of the\n * defect. A tier's `unitPrice`/`flatPrice` carry an OPTIONAL currency — they inherit the price's —\n * so reading each amount's own currency would resolve a scale per amount and let one price be\n * converted at up to three different ones. One price is denominated in one currency; the amounts\n * are its parts.\n */\n private toProviderAmountOrThrow(\n value: { amount: bigint; decimals: number },\n currency: string,\n subject: string,\n ): number {\n return toCurrencyMinorUnitAmountOrThrow({ ...value, currency }, subject);\n }\n\n // ════════════════════════════════════════════════════════════\n // Private — Dirty Detection\n // ════════════════════════════════════════════════════════════\n\n /**\n * Check if a product's features/limits have changed relative to the catalog definition.\n * If so, all subscriptions using this product need feature recomputation.\n */\n private isFeaturesDirty(existing: Product, definition: ProductDefinition): boolean {\n // Check grantedFeatures\n const existingFeatures = new Set(existing.grantedFeatures ?? []);\n const newFeatures = new Set(definition.grantedFeatures ?? []);\n if (existingFeatures.size !== newFeatures.size) return true;\n for (const f of existingFeatures) {\n if (!newFeatures.has(f)) return true;\n }\n\n // Check grantedLimits\n const existingLimits = existing.grantedLimits ?? {};\n const newLimits = definition.grantedLimits ?? {};\n const existingKeys = Object.keys(existingLimits);\n const newKeys = Object.keys(newLimits);\n if (existingKeys.length !== newKeys.length) return true;\n for (const key of existingKeys) {\n if (!newLimits[key]) return true;\n if (existingLimits[key].value !== newLimits[key].value) return true;\n if (existingLimits[key].mode !== newLimits[key].mode) return true;\n }\n\n return false;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"usage-metering.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../src/billing/services/back-office/usage-metering.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAKL,KAAK,+BAA+B,EACpC,eAAe,EAQhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,yBAAyB,EAAsC,MAAM,sCAAsC,CAAC;AAC1H,OAAO,EAAE,6BAA6B,EAAE,MAAM,kFAAkF,CAAC;AACjI,OAAO,EAAE,KAAK,uBAAuB,EAAqD,MAAM,mFAAmF,CAAC;AAEpL,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,6FAA6F,CAAC;AACzJ,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,+EAA+E,CAAC;AAC3I,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAChI,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AACnH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AAC5G,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,qGAAqG,CAAC;AAMrK,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,eAAe,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,WAA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OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,OAAO,CAAC;IA0BnB;;;;;;;;;;;;;;;;OAgBG;IACU,4BAA4B,CACvC,WAAW,EAAE,+BAA+B,EAC5C,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,eAAe,EAAE,OAAO,GACvB,OAAO,CAAC,MAAM,CAAC;IAiDlB;;;;;;;OAOG;IACH,OAAO,CAAC,uBAAuB;IAyB/B,2GAA2G;YAC7F,+BAA+B;IAgB7C;;;;OAIG;IACU,QAAQ,CACnB,QAAQ,EAAE,uBAAuB,EACjC,gBAAgB,EAAE,MAAM,EACxB,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,IAAI,CAAC;QAAC,GAAG,EAAE,IAAI,CAAA;KAAE,GAClC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IA8BlC;;;;;;OAMG;IACU,eAAe,IAAI,OAAO,CAAC,gBAAgB,CAAC;YA4E3C,oBAAoB;IAiBlC;;;;;;;;;;OAUG;YACW,wBAAwB;IAkCtC;;;;;;;;;;;;;;;OAeG;YACW,gBAAgB;IA2B9B;;;;;;;;;;;;OAYG;YACW,gBAAgB;YAkEhB,WAAW;IAqHzB;;;;;;;;;;OAUG;YACW,eAAe;IA2B7B;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IAcjC,oFAAoF;YACtE,qBAAqB;IAwBnC;;;;;;;OAOG;YACW,qBAAqB;IAmDnC;;;;;;OAMG;YACW,4BAA4B;IAoC1C;;;;;;;;;;;;;;;;;;;OAmBG;YACW,uBAAuB;IAiBrC;;;;;;;;;;;OAWG;YACW,qBAAqB;CAkCpC"}
1
+ {"version":3,"file":"usage-metering.backend.service.d.ts","sourceRoot":"","sources":["../../../../../src/billing/services/back-office/usage-metering.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAKL,KAAK,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