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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (853) hide show
  1. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
  2. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
  3. package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
  4. package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
  5. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
  6. package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
  7. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
  8. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
  9. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
  10. package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
  11. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
  12. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
  13. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
  14. package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
  15. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
  16. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
  17. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
  18. package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
  19. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  20. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
  21. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  22. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
  23. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
  24. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
  25. package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
  26. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
  27. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
  28. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
  29. package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
  30. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
  31. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  32. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
  33. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  34. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
  35. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
  36. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
  37. package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
  38. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
  39. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
  40. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
  41. package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
  42. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  43. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
  44. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  45. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +49 -0
  46. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  47. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +171 -18
  48. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  49. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  50. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
  51. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  52. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  53. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +20 -0
  54. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  55. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
  56. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
  57. package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
  58. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
  59. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
  60. package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
  61. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
  62. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
  63. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
  64. package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
  65. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
  66. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  67. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +529 -41
  68. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  69. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
  70. package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
  71. package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
  72. package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
  73. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
  74. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
  75. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
  76. package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
  77. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
  78. package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
  79. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
  80. package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
  81. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
  82. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
  83. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
  84. package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
  85. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
  86. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
  87. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
  88. package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
  89. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
  90. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
  91. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
  92. package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
  93. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
  94. package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
  95. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
  96. package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
  97. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
  98. package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
  99. package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
  100. package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
  101. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
  102. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
  103. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
  104. package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
  105. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
  106. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
  107. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  108. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
  109. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
  110. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
  111. package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
  112. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
  113. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
  114. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
  115. package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
  116. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
  117. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
  118. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
  119. package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
  120. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
  121. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
  122. package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
  123. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
  124. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
  125. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
  126. package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
  127. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
  128. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
  129. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
  130. package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
  131. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
  132. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
  133. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
  134. package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
  135. package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
  136. package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
  137. package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
  138. package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
  139. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
  140. package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
  141. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
  142. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  143. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
  144. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  145. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +244 -7
  146. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  147. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +386 -5
  148. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  149. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
  150. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
  151. package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
  152. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
  153. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
  154. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
  155. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
  156. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
  157. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  158. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
  159. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  160. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
  161. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
  162. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
  163. package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
  164. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  165. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +31 -0
  166. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  167. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
  168. package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
  169. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
  170. package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
  171. package/dist/esm/config/models/app-config.backend.schemas.d.ts +142 -46
  172. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  173. package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
  174. package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
  175. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
  176. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
  177. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
  178. package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
  179. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
  180. package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
  181. package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
  182. package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
  183. package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
  184. package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
  185. package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
  186. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
  187. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  188. package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
  189. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  190. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
  191. package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
  192. package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
  193. package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
  194. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
  195. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
  196. package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
  197. package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
  198. package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
  199. package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
  200. package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
  201. package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
  202. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  203. package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
  204. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  205. package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
  206. package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
  207. package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
  208. package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
  209. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
  210. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
  211. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
  212. package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
  213. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
  214. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
  215. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
  216. package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
  217. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
  218. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  219. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
  220. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  221. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
  222. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
  223. package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
  224. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
  225. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
  226. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
  227. package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
  228. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
  229. package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
  230. package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
  231. package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
  232. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
  233. package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
  234. package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
  235. package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
  236. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
  237. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
  238. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
  239. package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
  240. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
  241. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
  242. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
  243. package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
  244. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
  245. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
  246. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
  247. package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
  248. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
  249. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
  250. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
  251. package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
  252. package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
  253. package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
  254. package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
  255. package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
  256. package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
  257. package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
  258. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +292 -7
  259. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  260. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +533 -45
  261. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  262. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
  263. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
  264. package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
  265. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  266. package/dist/esm/files/controllers/file.controller.js +21 -13
  267. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  268. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  269. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +39 -15
  270. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  271. package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
  272. package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
  273. package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
  274. package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
  275. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
  276. package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
  277. package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
  278. package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
  279. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
  280. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
  281. package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
  282. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
  283. package/dist/esm/files/services/files.backend.service.d.ts +68 -0
  284. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  285. package/dist/esm/files/services/files.backend.service.js +175 -5
  286. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  287. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
  288. package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
  289. package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
  290. package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
  291. package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
  292. package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
  293. package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
  294. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
  295. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
  296. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
  297. package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
  298. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
  299. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
  300. package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
  301. package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
  302. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
  303. package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
  304. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
  305. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
  306. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
  307. package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
  308. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
  309. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
  310. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
  311. package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
  312. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
  313. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
  314. package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
  315. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
  316. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
  317. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
  318. package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
  319. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
  320. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
  321. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
  322. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  323. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
  324. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
  325. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
  326. package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
  327. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
  328. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
  329. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
  330. package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
  331. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
  332. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
  333. package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
  334. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
  335. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
  336. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
  337. package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
  338. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
  339. package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
  340. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
  341. package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
  342. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
  343. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
  344. package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
  345. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
  346. package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
  347. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
  348. package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
  349. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
  350. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
  351. package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
  352. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
  353. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
  354. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
  355. package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
  356. package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
  357. package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
  358. package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
  359. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +28 -1
  360. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  361. package/dist/esm/flows-actors/services/agents.backend.service.js +204 -18
  362. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  363. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
  364. package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
  365. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
  366. package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
  367. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
  368. package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
  369. package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
  370. package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
  371. package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
  372. package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
  373. package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
  374. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
  375. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
  376. package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
  377. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
  378. package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
  379. package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
  380. package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
  381. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
  382. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
  383. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
  384. package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
  385. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  386. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +8 -4
  387. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  388. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
  389. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
  390. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
  391. package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
  392. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
  393. package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
  394. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
  395. package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
  396. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
  397. package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
  398. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
  399. package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
  400. package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
  401. package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
  402. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
  403. package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
  404. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
  405. package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
  406. package/dist/esm/index.d.ts +11 -4
  407. package/dist/esm/index.d.ts.map +1 -1
  408. package/dist/esm/index.js +31 -4
  409. package/dist/esm/index.js.map +1 -1
  410. package/dist/esm/inject/models/container.d.ts.map +1 -1
  411. package/dist/esm/inject/models/container.js +78 -10
  412. package/dist/esm/inject/models/container.js.map +1 -1
  413. package/dist/esm/inject/models/service-types.d.ts +17 -3
  414. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  415. package/dist/esm/inject/models/service-types.js +19 -3
  416. package/dist/esm/inject/models/service-types.js.map +1 -1
  417. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  418. package/dist/esm/mcp/controllers/mcp.controller.js +20 -0
  419. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  420. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
  421. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  422. package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
  423. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  424. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  425. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
  426. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  427. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
  428. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
  429. package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
  430. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
  431. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
  432. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
  433. package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
  434. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
  435. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
  436. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
  437. package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
  438. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
  439. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
  440. package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
  441. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
  442. package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
  443. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
  444. package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
  445. package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
  446. package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
  447. package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
  448. package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
  449. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
  450. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
  451. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
  452. package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
  453. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
  454. package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
  455. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
  456. package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
  457. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
  458. package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
  459. package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
  460. package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
  461. package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
  462. package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
  463. package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
  464. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
  465. package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
  466. package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
  467. package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
  468. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
  469. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
  470. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
  471. package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
  472. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
  473. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
  474. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
  475. package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
  476. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
  477. package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
  478. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
  479. package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
  480. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
  481. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
  482. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
  483. package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
  484. package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
  485. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
  486. package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
  487. package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
  488. package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
  489. package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
  490. package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
  491. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
  492. package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
  493. package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
  494. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
  495. package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
  496. package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
  497. package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
  498. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
  499. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  500. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
  501. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  502. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
  503. package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
  504. package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
  505. package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
  506. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
  507. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
  508. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
  509. package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
  510. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
  511. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  512. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
  513. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  514. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  515. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
  516. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  517. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  518. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
  519. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  520. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
  521. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
  522. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
  523. package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
  524. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
  525. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
  526. package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
  527. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
  528. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
  529. package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
  530. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
  531. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
  532. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
  533. package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
  534. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
  535. package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
  536. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
  537. package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
  538. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
  539. package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
  540. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
  541. package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
  542. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
  543. package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
  544. package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
  545. package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
  546. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
  547. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
  548. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
  549. package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
  550. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
  551. package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
  552. package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
  553. package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
  554. package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
  555. package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
  556. package/dist/esm/queue/job-consumer.backend.service.js +1 -4
  557. package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
  558. package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
  559. package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
  560. package/dist/esm/queue/job-executor.backend.service.js +1 -4
  561. package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
  562. package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
  563. package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
  564. package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
  565. package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
  566. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
  567. package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
  568. package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
  569. package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
  570. package/dist/esm/queue/queue.backend.service.d.ts +3 -3
  571. package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
  572. package/dist/esm/queue/queue.backend.service.js +26 -4
  573. package/dist/esm/queue/queue.backend.service.js.map +1 -1
  574. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
  575. package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
  576. package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
  577. package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
  578. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
  579. package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
  580. package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
  581. package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
  582. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
  583. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
  584. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
  585. package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
  586. package/dist/esm/requests/service/websocket.service.d.ts +9 -0
  587. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  588. package/dist/esm/requests/service/websocket.service.js +32 -8
  589. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  590. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  591. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +14 -2
  592. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  593. package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
  594. package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
  595. package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
  596. package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
  597. package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
  598. package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
  599. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
  600. package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
  601. package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
  602. package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
  603. package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
  604. package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
  605. package/dist/esm/resources/services/resources-registry.backend.service.js +90 -6
  606. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  607. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
  608. package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
  609. package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
  610. package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
  611. package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
  612. package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
  613. package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
  614. package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
  615. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
  616. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
  617. package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
  618. package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
  619. package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
  620. package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
  621. package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
  622. package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
  623. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  624. package/dist/esm/runtime/services/start-application.backend.service.js +261 -77
  625. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  626. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
  627. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
  628. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
  629. package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
  630. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
  631. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
  632. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
  633. package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
  634. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
  635. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
  636. package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
  637. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
  638. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
  639. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
  640. package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
  641. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
  642. package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
  643. package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
  644. package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
  645. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
  646. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
  647. package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
  648. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
  649. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
  650. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
  651. package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
  652. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
  653. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
  654. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
  655. package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
  656. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
  657. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
  658. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
  659. package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
  660. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
  661. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
  662. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
  663. package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
  664. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
  665. package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
  666. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
  667. package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
  668. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  669. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
  670. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  671. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
  672. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
  673. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
  674. package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
  675. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
  676. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
  677. package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
  678. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
  679. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
  680. package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
  681. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
  682. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
  683. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
  684. package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
  685. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
  686. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  687. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
  688. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  689. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
  690. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
  691. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
  692. package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
  693. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
  694. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
  695. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
  696. package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
  697. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
  698. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
  699. package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
  700. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
  701. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
  702. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
  703. package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
  704. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
  705. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
  706. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
  707. package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
  708. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
  709. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
  710. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
  711. package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
  712. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
  713. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
  714. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
  715. package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
  716. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
  717. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
  718. package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
  719. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
  720. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
  721. package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
  722. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
  723. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
  724. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
  725. package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
  726. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
  727. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
  728. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
  729. package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
  730. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
  731. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
  732. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
  733. package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
  734. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
  735. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
  736. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
  737. package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
  738. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
  739. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
  740. package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
  741. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
  742. package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
  743. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
  744. package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
  745. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
  746. package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
  747. package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
  748. package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
  749. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
  750. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
  751. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
  752. package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
  753. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +74 -8
  754. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  755. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +175 -19
  756. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  757. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
  758. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
  759. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
  760. package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
  761. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
  762. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
  763. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
  764. package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
  765. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
  766. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
  767. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
  768. package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
  769. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
  770. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
  771. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
  772. package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
  773. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
  774. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
  775. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
  776. package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
  777. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
  778. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
  779. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
  780. package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
  781. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
  782. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  783. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
  784. package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
  785. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
  786. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
  787. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
  788. package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
  789. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
  790. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
  791. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
  792. package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
  793. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
  794. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
  795. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
  796. package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
  797. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
  798. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
  799. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
  800. package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
  801. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
  802. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
  803. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
  804. package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
  805. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
  806. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
  807. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
  808. package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
  809. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
  810. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
  811. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
  812. package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
  813. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
  814. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
  815. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
  816. package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
  817. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
  818. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  819. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
  820. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  821. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
  822. package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
  823. package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
  824. package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
  825. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
  826. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
  827. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
  828. package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
  829. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
  830. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
  831. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
  832. package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
  833. package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
  834. package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
  835. package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
  836. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
  837. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
  838. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
  839. package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
  840. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
  841. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
  842. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
  843. package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
  844. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
  845. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
  846. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
  847. package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
  848. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
  849. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
  850. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
  851. package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
  852. package/dist/tsconfig.build.tsbuildinfo +1 -1
  853. package/package.json +11 -9
@@ -1 +1 @@
1
- {"version":3,"file":"auth-registration.backend.service.js","sourceRoot":"","sources":["../../../../../../../src/security/authentications/services/auth-methods/auth-registration.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,6BAA6B,EAAE,MAAM,gFAAgF,CAAC;AAE/H,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAA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A;IAI5D,YAAA,MAAM,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAA;IACnD,YAAA,MAAM,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,CAAA;qCAnCJ,aAAa;QACM,0BAA0B;QACzB,uBAAuB;QACX,6BAA6B;QACjC,oCAAoC;QAClD,6BAA6B;QACxB,4BAA4B;QAChB,gCAAgC;QACvC,+BAA+B;QACnC,uBAAuB,YAEN,wCAAwC;GAfhI,8BAA8B,CA04D1C","sourcesContent":["import 'reflect-metadata';\nimport crypto from 'crypto';\nimport { injectable, inject } from 'inversify';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { isOrgActivelyDirectoryManaged } from '~wildo-backend-lib/organizations/services/scim-provisioning-gate.backend.utils';\nimport type { FeatureResolutionBackendService } from '~wildo-backend-lib/features/services/feature-resolution.backend.service';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { ConsumableTokenBackendService } from '~wildo-backend-lib/security/consumable-tokens/services/consumable-token.backend.service';\nimport type { AuthExecutionContextFactoryBackendService } from '~wildo-backend-lib/security/authentications/services/auth-execution-context-factory.backend.service';\nimport { AuthCredentialVerifierBackendService } from '~wildo-backend-lib/security/authentications/services/auth-credential-verifier.backend.service';\nimport { AuthTokenIssuerBackendService } from '~wildo-backend-lib/security/authentications/services/auth-token-issuer.backend.service';\nimport { AuthUserLookupBackendService } from '~wildo-backend-lib/security/authentications/services/utils/auth-user-lookup.backend.service';\nimport { AuthResponseHelperBackendService } from '~wildo-backend-lib/security/authentications/services/utils/auth-response-helper.backend.service';\nimport { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { DomainToOrgLookupBackendService } from '~wildo-backend-lib/security/authentications/services/admin-config/domain-to-org-lookup.backend.service';\nimport { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\nimport type { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { SystemAccessBackendService } from '~wildo-backend-lib/base-classes/services/services/system-access.backend.service';\nimport type { ResourcePersistenceUnitOfWorkBackendService } from '~wildo-backend-lib/databases/services/resource-persistence-unit-of-work.backend.service';\nimport {\n applyInvitationAcceptanceCore,\n assertInvitationUserTypeAcquisitionAllowed,\n} from '~wildo-backend-lib/organizations/services/invitation-acceptance.backend.utils';\nimport {\n createOrgOnRegistration,\n OrgCreationOnRegistrationPlanInvalidReason,\n OrgCreationOnRegistrationPlanMode,\n resolveOrgCreationOnRegistrationPlan,\n} from '~wildo-backend-lib/organizations/services/org-creation-on-registration.backend.utils';\nimport { AUTH_AUDIT_METHOD } from '~wildo-backend-lib/security/authentications/models/auth-constants.backend';\nimport {\n createAuthenticatedInvitationAcceptancePersistenceRequest,\n createPublicInvitationAcceptancePersistenceRequest,\n createSelfRegistrationPersistenceRequest,\n} from '~wildo-backend-lib/security/authentications/models/identity-persistence-boundaries.backend';\nimport { AuthenticationOrchestratorBackendService } from '~wildo-backend-lib/security/authentications/services/authentication-orchestrator.backend.service';\nimport type { EmailVerificationInitiatorBackendService } from '~wildo-backend-lib/security/authentications/services/email-verification-initiator.backend.service';\nimport type { WebAuthnBackendService } from '~wildo-backend-lib/security/authentications/services/auth-methods/webauthn.backend.service';\nimport type { PublicKeyCredentialCreationOptionsJSON } from '@simplewebauthn/server';\n\nimport {\n CoreConsumableTokenTypes,\n ConsumableToken_ConsumptionMode,\n CoreResourceType,\n ErrorType,\n ErrorCustomMessageReference,\n EmailTemplateType,\n SystemEmailTemplateRef,\n UserStatus,\n CORE_APP_ROLES,\n AuthMethod,\n AuthNextStep,\n AuthSessionPurpose,\n AuthenticationSessionState,\n isWildoBackendError,\n EmailVerificationMode,\n OrganizationMemberStatus,\n OrganizationMembers_Operations,\n InvitationManagementMode,\n AuthInvitationInfoResponseSchema,\n getEnabledMethods,\n AuthScopeType,\n RegistrationAcquisitionChannel,\n RegistrationMode,\n evaluateUserTypeAcquisition,\n isRegistrationAcquisitionAllowed,\n} from '@wildo-ai/saas-models';\nimport type { User, OrganizationMember, AuthInvitationInfoResponse, UserCredentials, InvitationAcceptCredentialMethod } from '@wildo-ai/saas-models';\nimport { AvailableLanguage, AuthResponseMessageRef } from '@wildo-ai/presets-components-models';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\n\nexport interface RegisterUserParams {\n email: string;\n firstName: string;\n lastName: string;\n password?: string;\n /** W5.5: Org name provided during registration when orgNameSource is 'ask'. */\n organizationName?: string;\n}\n\nexport interface RegisterUserContext {\n frontendUrl: string;\n ipAddress: string;\n userAgent: string;\n frontendServiceName?: string;\n /** W3.4: Resolved from X-Frontend-Service-Name → frontendServices → userType. Determines userTypes and defaultAppRoles on new user. */\n activeUserType?: string;\n}\n\nexport interface VerifyEmailParams {\n token: string;\n email: string;\n ipAddress: string;\n userAgent: string;\n}\n\nexport interface ResendVerificationParams {\n email: string;\n frontendUrl: string;\n ipAddress: string;\n userAgent: string;\n}\n\nexport interface AcceptInvitationParams {\n invitationToken: string;\n password?: string;\n /** Required at acceptance (mirrors registration) — seeds the profile's first/last name. */\n firstName: string;\n lastName: string;\n ipAddress: string;\n userAgent: string;\n /**\n * The first-factor credential the invitee chose to establish (from the multi-method accept\n * screen). Absent intentionally means password-or-none acceptance: set\n * `password` when provided, otherwise activate with no local credential.\n * Only `PASSWORD` / `MAGIC_LINK` / `PASSKEY` are handled\n * here; enterprise-SSO invitees are routed to the IdP authorize flow, not this endpoint. Typed as\n * the DTO-derived subset (not the full `AuthMethod`) so it can never widen past the wire contract.\n */\n credentialMethod?: InvitationAcceptCredentialMethod;\n}\n\n/**\n * Discriminates the two shapes an accept can resolve to. The password / no-password / passkey\n * paths issue a session (the invitation token bootstraps it — a set password or an enrolled\n * passkey is the GO-FORWARD credential, not this session's authenticator); the magic-link path\n * issues NO session — a link is emailed and the session is established when the invitee clicks it.\n */\nexport enum AcceptInvitationOutcome {\n /** A session was issued (or is gated behind MFA enrollment) — password / no-password / passkey. */\n SESSION = 'session',\n /** No session; a magic link was minted for the controller to email. */\n MAGIC_LINK_SENT = 'magic-link-sent',\n}\n\n/** Session-issuing accept result (password / no-password / passkey). */\nexport interface AcceptInvitationSessionResult {\n outcome: AcceptInvitationOutcome.SESSION;\n sessionId: string;\n state: string;\n purpose: string;\n nextStep?: string;\n userId?: string;\n accessToken?: string;\n refreshToken?: string;\n expiresIn?: number;\n requiresMFA?: boolean;\n availableEnrollmentMethods?: string[];\n /**\n * PASSKEY-enroll-at-accept: the pre-generated WebAuthn registration challenge. Present ONLY\n * on the passkey path AND only once a session was issued (the frontend runs the ceremony and\n * completes it against the existing authenticated `/auth/passkey/register/verify` route). Omitted\n * on the MFA-gated branch — no session yet, so the invitee enrolls post-MFA via the same route.\n */\n passkeyRegistrationOptions?: PublicKeyCredentialCreationOptionsJSON;\n}\n\n/**\n * Magic-link accept result — carries the minted token back to the controller for email dispatch\n * (the URL needs the request-derived frontend origin, an HTTP-layer concern). The `token` is NEVER\n * serialized to the client; the controller consumes it to send the email and responds with a\n * generic \"check your email\" message (anti-enumeration, identical to `POST /auth/magic-link/send`).\n */\nexport interface AcceptInvitationMagicLinkResult {\n outcome: AcceptInvitationOutcome.MAGIC_LINK_SENT;\n magicLinkDelivery: {\n token: string;\n submissionId?: string;\n email: string;\n userId: string;\n expiresInMinutes?: number;\n };\n}\n\nexport type AcceptInvitationResult = AcceptInvitationSessionResult | AcceptInvitationMagicLinkResult;\n\n/** A pending invitation addressed to the authenticated caller, for the in-app surface. */\nexport interface MyPendingInvitation {\n /** The INVITED membership row id — the accept/reject target (was the invitation id). */\n membershipId: string;\n organizationId: string;\n organizationName?: string;\n roles: string[];\n createdAt?: string;\n}\n\n@injectable()\nexport class AuthRegistrationBackendService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.ConsumableTokenService) private readonly consumableTokenService: ConsumableTokenBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthCredentialVerifier) private readonly credentialVerifier: AuthCredentialVerifierBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthTokenIssuer) private readonly tokenIssuer: AuthTokenIssuerBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthUserLookupService) private readonly userLookup: AuthUserLookupBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthResponseHelperService) private readonly authResponseHelper: AuthResponseHelperBackendService,\n @inject(SAAS_SERVICE_TYPES.DomainToOrgLookupService) private readonly domainLookup: DomainToOrgLookupBackendService,\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) private readonly auditLogsService: AuditLogsBackendService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) private readonly servicesRegistryHandler: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthenticationOrchestratorService) private readonly authOrchestrator: AuthenticationOrchestratorBackendService,\n // Guard 3: the ACL-bypassing system reads (invitation list/read across orgs)\n // come from the dedicated, deliberately-injected SystemAccessService — the\n // handler above no longer exposes readAsSystem/listAsSystem. (Appended LAST to\n // keep the test's positional construction stable.)\n @inject(SAAS_SERVICE_TYPES.SystemAccessService) private readonly systemAccessService: SystemAccessBackendService,\n // Invitee-driven invitation REVOKE needs a super-admin EC: the invitee is\n // not an org admin, so the ORG_ADMIN-gated REVOKE runs under a synthesised system\n // context (same pattern as EnterpriseUserProvisioning). Appended LAST to keep the\n // test's positional construction stable. (A dedicated `deleteAsSystem` primitive would\n // be cleaner — noted as a follow-up; today only create/read/list/update AsSystem exist.)\n @inject(SAAS_SERVICE_TYPES.AuthExecutionContextFactory) private readonly authEcFactory: AuthExecutionContextFactoryBackendService,\n // Passkey-enroll-at-accept reuses the shared WebAuthn ceremony service to mint the\n // registration challenge bound to the just-activated invitee. Appended LAST to keep the\n // test's positional construction stable.\n @inject(SAAS_SERVICE_TYPES.WebAuthnService) private readonly webAuthnService: WebAuthnBackendService,\n // Shared EMAIL_VERIFICATION token+email sender (also used by SCIM provisioning). Registration\n // and resend delegate their verification send here so the flow has ONE implementation.\n // Appended LAST to keep the test's positional construction stable.\n @inject(SAAS_SERVICE_TYPES.EmailVerificationInitiatorService) private readonly emailVerificationInitiator: EmailVerificationInitiatorBackendService,\n // Per-org DIRECTORY_PROVISIONING resolution for the invite-accept credential block\n // (Concern B — see `isOrgActivelyDirectoryManaged`). Appended LAST: DI binds by token,\n // but the positional-append convention keeps existing wiring undisturbed.\n @inject(SAAS_SERVICE_TYPES.FeatureResolutionService) private readonly featureResolution: FeatureResolutionBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourcePersistenceUnitOfWorkService)\n private readonly resourcePersistenceUnitOfWork:\n ResourcePersistenceUnitOfWorkBackendService,\n ) {\n this.logDebug = this.logger.debugByType('AuthRegistration');\n this.logger.setDebugTypeLogging('AuthRegistration', false);\n }\n\n /**\n * Invitation-accept DISCOVERY (Phase 1b) — the PUBLIC, NON-consuming read the\n * multi-method accept screen calls to learn what the invited org allows.\n *\n * Distinct from `acceptInvitation` (which CONSUMES the token and mutates state):\n * this only VALIDATES the token (`validateToken` — no consume) and reads. It\n * returns the invitee's email, the org name, the org's available first-factor\n * methods (resolved for the invitee's user type via the ORG-KEYED policy\n * resolver — the invitee's INVITED membership is excluded from the ACTIVE-\n * membership-based `resolveEffectiveAuthPolicy`, hence the org-keyed variant),\n * and the org's identity-management posture:\n * - `scim` → directory-managed; the screen shows an informational state, NO\n * local credential (locked product decision).\n * - `sso` → the org ENFORCES enterprise SSO (an org-SSO method is available\n * and PASSWORD is not) — route the invitee to the IdP (JIT consumes the invite).\n * - `open` → full method chooser.\n *\n * `managementMode` (incl. SSO-enforced) is derived from the resolved POLICY.\n * SSO-org invitees get enriched ORG_SAML/ORG_OPENID_CONNECT entries (per-connection\n * `ssoIds`/`config`), resolved via an org-keyed SSO lookup (`buildLookupForScope`) —\n * identical to `identify()`, but keyed by the invitation's `organizationId` instead\n * of an email domain.\n *\n * PASSKEY, if policy-enabled, appears as an ENROLL-at-accept option — NOT a login of\n * an existing credential — so `identify()`'s no-enrolled-credential filter\n * deliberately does not apply here; the frontend renders it disabled until the\n * passkey-enroll-at-accept backend (Phase 3) lands.\n */\n async getInvitationInfo(\n ec: ExecutionContext<any>,\n invitationToken: string,\n ): Promise<AuthInvitationInfoResponse> {\n // 1. Validate the token WITHOUT consuming it (accept consumes; discovery must not).\n // NO TOKEN ORACLE + RESIDUAL TIMING CHANNEL: every rejection below throws the SAME uniform\n // `INVITATION_NO_LONGER_VALID`; the fast (validateToken-fail) vs slow (membership-read) timing\n // residual is ASSESSED WONTFIX. See the canonical rationale on `acceptInvitation` (review FU-4/5/6)\n // before adding a per-cause message or a constant-time \"fix\" here.\n let tokenResult;\n try {\n tokenResult = await this.consumableTokenService.validateToken(\n invitationToken,\n [CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION],\n );\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const membershipId = tokenResult.relatedId;\n if (!membershipId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n // 2. Read the INVITED membership (mirrors acceptInvitation). The invite IS the\n // membership in the junction model; the token's relatedId points at it.\n const membership = await this.servicesRegistryHandler.read<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS, ec, { _id: membershipId },\n );\n if (!membership || membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const organizationId = membership.organizationId;\n const inviteeEmail = (membership.userEmail ?? '').toLowerCase();\n\n // 3-4. Org join-context (display name + type + org-join user type) via the SHARED resolver —\n // one system-access-door read (`readAsSystem(ORGANIZATIONS, { _id })`; the endpoint runs\n // under an UNAUTHENTICATED pre-auth EC, so a plain ACL-scoped read would fail-closed). This is\n // the SAME org-join projection `acceptInvitation` uses — single source, no drift. LOAD-BEARING:\n // `orgType` drives the method resolution in step 5, so a failed read empties the method list,\n // not just the name (the resolver degrades name → undefined and org-join type → undefined).\n //\n // Method resolution keys off the org-join user type the accept WILL grant, NOT the invitee's\n // CURRENT types (provisioned `userTypes: []`, grant DEFERRED to INVITED→ACTIVE, so\n // `invitee.userTypes[0]` would be `undefined` → an EMPTY method list). Discovery is\n // ORG-JOIN-FIRST (mirrors the accept-time enablement guard), falling back to an existing\n // invitee's own first type, then undefined.\n const { orgType, orgJoinUserType, organizationName: resolvedOrgName } = await this._resolveOrgJoinUserType(membership);\n const organizationName = resolvedOrgName ?? '';\n const invitee = await this.userLookup.findUserById(ec, membership.userId);\n const resolutionUserType = orgJoinUserType ?? invitee?.userTypes?.[0];\n\n // 5. Available first-factor methods — resolve the policy from the org-join user\n // type + the org TYPE already read in step 3-4. `resolveAuthPolicyForOrgType` is\n // PURE (no ORGANIZATIONS read): the pre-auth `APP_PUBLIC` EC cannot read\n // ORGANIZATIONS, so a per-call org re-read would fail-closed and silently drop\n // the org's auth overrides (SSO-only / password-disabled).\n const resolvedPolicy = resolutionUserType\n ? this.userLookup.resolveAuthPolicyForOrgType(resolutionUserType, orgType)\n : null;\n const invitationPolicy = (\n resolvedPolicy\n && !resolvedPolicy.registration.allowedMethods.includes(\n AuthMethod.PASSWORD,\n )\n )\n ? {\n ...resolvedPolicy,\n authMethodsEnabled: {\n ...resolvedPolicy.authMethodsEnabled,\n [AuthMethod.PASSWORD]: false,\n },\n }\n : resolvedPolicy;\n const enabledMethods = invitationPolicy\n ? getEnabledMethods(invitationPolicy.authMethodsEnabled)\n : new Set<AuthMethod>();\n\n // Enrich org-SSO methods (ORG_SAML/ORG_OPENID_CONNECT) with per-connection\n // ssoIds/config — IDENTICALLY to identify() — by resolving the invite's org SSO\n // connection by ORGANIZATION ID (not email domain). Only when the policy enables an\n // org-SSO method (a non-SSO org pays no extra reads). `buildLookupForScope` reads\n // via the system-access door; a null result (no SSO config/connection) simply drops\n // the SSO methods, as before. (Passing the lookup also lets the OAuth arm honor the\n // org's `oauth2ProviderRestrictions` — resolved via the same ACL-independent door.)\n const orgSsoLookup = (enabledMethods.has(AuthMethod.ORG_SAML) || enabledMethods.has(AuthMethod.ORG_OPENID_CONNECT))\n ? await this.domainLookup.buildLookupForScope(ec, AuthScopeType.ORGANIZATION, organizationId)\n : undefined;\n\n const availableFirstFactorMethods = invitationPolicy\n ? await this.authOrchestrator.buildFirstFactorMethodsForPolicy(ec, invitationPolicy, orgSsoLookup)\n : [];\n\n // 6. Management mode — strongest identity authority wins. SCIM now reflects ACTIVE\n // directory management (DIRECTORY_PROVISIONING feature + a live SCIM token), NOT the\n // org-TYPE mount flag — kept COHERENT with the accept-mutation credential block\n // (AUTH-23 / .claude/plans/scim-vs-auth-authority-axis.md) so the UI never hides the\n // credential chooser for a SCIM-capable-but-not-actually-managed org whose accept\n // WOULD allow a local credential. SSO enforcement is read from the resolved POLICY's\n // enabled methods. This is the LENIENT display path: a token/feature read failure\n // degrades to \"not actively managed\" and lets the MUTATION path be the fail-closed gate.\n let scimEnabled = false;\n try {\n scimEnabled = await isOrgActivelyDirectoryManaged({\n organizationId,\n featureResolution: this.featureResolution,\n systemAccessService: this.systemAccessService,\n });\n } catch {\n scimEnabled = false;\n }\n const hasOrgSso = enabledMethods.has(AuthMethod.ORG_SAML) || enabledMethods.has(AuthMethod.ORG_OPENID_CONNECT);\n const hasPassword = enabledMethods.has(AuthMethod.PASSWORD);\n const managementMode = scimEnabled\n ? InvitationManagementMode.SCIM\n : hasOrgSso && !hasPassword\n ? InvitationManagementMode.SSO\n : InvitationManagementMode.OPEN;\n\n // Validate the response against its schema before returning (matches `identify`).\n // `passwordPolicy` carries the SAME org-merged policy the accept endpoint validates\n // against (`resolveAuthPolicyForOrgType` above), so the chooser's PASSWORD form shows\n // the invitee the org's real requirements. `PasswordPolicyConfig` is field-identical to\n // the DTO's `PasswordPolicyRulesSchema`, so `.parse` carries it through losslessly (and\n // strips any extra keys); absent policy ⇒ `undefined` ⇒ frontend app-level fallback.\n return AuthInvitationInfoResponseSchema.parse({\n inviteeEmail,\n organizationName,\n availableFirstFactorMethods,\n managementMode,\n passwordPolicy: enabledMethods.has(AuthMethod.PASSWORD)\n ? invitationPolicy?.passwordPolicy\n : undefined,\n });\n }\n\n /**\n * User registration.\n * Returns generic success on email collision (anti-enumeration).\n */\n async registerUser(\n ec: ExecutionContext<any>,\n params: RegisterUserParams,\n ctx: RegisterUserContext,\n ): Promise<{ messageRef: string; message: string; ssoRedirectHint?: boolean; sessionId?: string; state?: string; purpose?: string; nextStep?: string; userId?: string; accessToken?: string; refreshToken?: string; expiresIn?: number }> {\n const { email, firstName, lastName, password, organizationName } = params;\n const { frontendUrl, ipAddress, userAgent, frontendServiceName, activeUserType } = ctx;\n const successResponse = this.authResponseHelper.getAuthResponse(AuthResponseMessageRef.REGISTRATION_SUCCESS);\n\n this.logDebug('Registration attempt', { email, activeUserType });\n\n // PR 8a (rate-limit unification, Step 5 — Option D / first\n // service-layer lift): the per-domain 50/hour rate-limit\n // (formerly `AUTH_REDIS_KEYS.REGISTER_DOMAIN` keyed on\n // `email.split('@')[1].toLowerCase()`, raw `checkRateLimit`)\n // moved UP to `AuthenticationController.register` as the third\n // declarative `checkPolicy` companion alongside the existing\n // per-email + per-IP buckets. Rationale: rate limits are\n // intrinsically HTTP concerns — bucket keys (email, IP, derived\n // domain) all live at the HTTP layer, the 429 feedback signal\n // (`X-RateLimit-*` + `Retry-After` headers) is HTTP-only, and\n // service contracts must remain free of HTTP types.\n // `RateLimitBackendService` and `AUTH_REDIS_KEYS` imports also\n // removed — domain throttle was their sole consumer in this\n // file. See plan body for the full Option D architectural\n // re-analysis.\n\n // W3.4: Resolve per-user-type auth policy (for registration config, password policy, etc.)\n const userTypeAuthPolicy = activeUserType\n ? this.appConfigService.getUserTypeAuthPolicy(activeUserType)\n : null;\n\n if (frontendServiceName && activeUserType) {\n const userManagement = this.appConfigService.getFrontendServiceUserManagementEntry(frontendServiceName, activeUserType);\n if (userManagement?.register !== true) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n context: {\n // Diagnostic (log-only): AUTHORIZATION strips context at the wire.\n frontendServiceName,\n activeUserType,\n },\n });\n }\n }\n\n const config = this.appConfigService.config;\n\n const registrationConfig = userTypeAuthPolicy?.registration;\n if (!registrationConfig) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n });\n }\n\n // Gate self-service registration through the canonical acquisition matrix. The map below\n // selects only the mode-specific client message; it does not own the allow/deny semantics\n // (that stays with `isRegistrationAcquisitionAllowed`). Typed `Record<RegistrationMode, …>`\n // so a newly added mode cannot ship without deciding its self-service denial message here —\n // the message stays exhaustive alongside the matrix instead of silently defaulting to DISABLED.\n const registrationMode = registrationConfig.mode;\n if (!isRegistrationAcquisitionAllowed(\n registrationMode,\n RegistrationAcquisitionChannel.PUBLIC_SELF_SERVICE,\n )) {\n // OPEN is unreachable here (it is always self-service-allowed) but is listed to satisfy the Record.\n const denialMessageReferenceByMode: Record<RegistrationMode, ErrorCustomMessageReference> = {\n [RegistrationMode.OPEN]: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n [RegistrationMode.INVITATION_ONLY]: ErrorCustomMessageReference.REGISTRATION_INVITATION_ONLY,\n [RegistrationMode.ADMIN_ONLY]: ErrorCustomMessageReference.REGISTRATION_ADMIN_ONLY,\n [RegistrationMode.DISABLED]: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n };\n // `mode` is typed RegistrationMode, but the runtime boundary is untrusted (an unparsed config\n // object can carry no/unknown mode — the same stance `isRegistrationAcquisitionAllowed` takes),\n // so fall back to the generic denial message rather than emitting an undefined reference.\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference:\n denialMessageReferenceByMode[registrationMode] ?? ErrorCustomMessageReference.REGISTRATION_DISABLED,\n });\n }\n\n // Resolve organization creation once, before authorization and adapter\n // selection. The same immutable plan drives prospective grants and writes.\n const configuredOrganizationTypes = this.appConfigService.isInitialized()\n ? config.organizationTypes\n : undefined;\n const orgCreationPlan = activeUserType\n ? resolveOrgCreationOnRegistrationPlan({\n userEmail: email.toLowerCase(),\n activeUserType,\n organizationName,\n organizationTypes: configuredOrganizationTypes,\n })\n : {\n mode: OrgCreationOnRegistrationPlanMode.NONE,\n } as const;\n if (orgCreationPlan.mode === OrgCreationOnRegistrationPlanMode.INVALID) {\n if (\n orgCreationPlan.reason\n === OrgCreationOnRegistrationPlanInvalidReason\n .MISSING_REQUIRED_ORGANIZATION_NAME\n ) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.ORG_NAME_REQUIRED,\n context: {\n organizationType: orgCreationPlan.orgType,\n },\n });\n }\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n reason:\n 'registration_user_type_has_ambiguous_organization_creation_policy',\n activeUserType,\n matchingOrgTypes: orgCreationPlan.matchingOrgTypes,\n },\n });\n }\n\n // Synchronous and deferred creation both later grant the selected\n // organization type's user types, so authorize those prospective additions\n // before any user/org/member mutation.\n const plannedOrganizationType =\n orgCreationPlan.mode === OrgCreationOnRegistrationPlanMode.NONE\n ? undefined\n : configuredOrganizationTypes?.[orgCreationPlan.orgType];\n const automaticOrgGrantAcquisition = evaluateUserTypeAcquisition(\n this.appConfigService.isInitialized() ? config.userTypes : undefined,\n plannedOrganizationType?.userTypes ?? [],\n activeUserType ? [activeUserType] : [],\n RegistrationAcquisitionChannel.PUBLIC_SELF_SERVICE,\n );\n if (!automaticOrgGrantAcquisition.allowed) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n context: {\n channel: RegistrationAcquisitionChannel.PUBLIC_SELF_SERVICE,\n deniedUserTypes: automaticOrgGrantAcquisition.deniedUserTypes,\n },\n });\n }\n\n const allowedMethods = registrationConfig.allowedMethods;\n if (!allowedMethods.includes(AuthMethod.PASSWORD)) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_METHOD_NOT_SUPPORTED,\n context: { method: AuthMethod.PASSWORD, allowedMethods },\n });\n }\n\n if (!password) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference:\n ErrorCustomMessageReference.REGISTRATION_PASSWORD_REQUIRED,\n });\n }\n const passwordPolicy = userTypeAuthPolicy?.passwordPolicy;\n const policyValidation =\n this.credentialVerifier.validatePasswordPolicy(\n password,\n passwordPolicy,\n );\n if (!policyValidation.valid) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference:\n ErrorCustomMessageReference\n .VALIDATION_PASSWORD_POLICY_VIOLATION,\n context: {\n violations: policyValidation.violations,\n minLength: passwordPolicy?.minLength,\n maxLength: passwordPolicy?.maxLength,\n },\n });\n }\n\n const existing = await this.userLookup.findUserByEmail(ec, email);\n if (existing) {\n this.logDebug('Registration: email already in use, returning success to prevent enumeration', { email });\n return successResponse;\n }\n\n // W2.7: Block self-registration for SSO-managed domains.\n if (registrationConfig.blockForSSODomains) {\n const domain = email.split('@')[1];\n if (domain) {\n const domainResult = await this.domainLookup.findOrgByDomain(ec, domain);\n if (domainResult?.enforcement?.requireSSO) {\n this.logDebug('Registration blocked: SSO-enforced domain', { email, domain });\n return { ...successResponse, ssoRedirectHint: true };\n }\n }\n }\n\n const passwordHash = await this.credentialVerifier.hashPassword(\n password,\n config.auth.passwordHashing,\n );\n\n // W2.6: Email verification mode — DEFERRED creates user as ACTIVE immediately\n const isDeferredVerification = registrationConfig.emailVerification === EmailVerificationMode.DEFERRED;\n const initialStatus = isDeferredVerification ? UserStatus.ACTIVE : UserStatus.PENDING_VERIFICATION;\n\n // W3.4: Resolve userTypes and defaultAppRoles from the active user type definition\n const userTypes = activeUserType ? [activeUserType] : [];\n const userTypeDefinition = activeUserType\n ? config.userTypes?.[activeUserType]\n : undefined;\n const defaultAppRoles = userTypeDefinition?.defaultAppRoles ?? [CORE_APP_ROLES.APP_USER];\n let newUser: User;\n let pendingOrgType: string | undefined;\n try {\n const registrationPersistence =\n await this.resourcePersistenceUnitOfWork.executeTransaction(\n createSelfRegistrationPersistenceRequest({\n includeCredentials: passwordHash !== undefined,\n includeSynchronousOrganizationCreation:\n orgCreationPlan.mode\n === OrgCreationOnRegistrationPlanMode.SYNCHRONOUS,\n }),\n async serviceOptions => {\n const createdUser = await this.servicesRegistryHandler.create<User>(\n CoreResourceType.USERS,\n ec,\n {\n email: email.toLowerCase(),\n status: initialStatus,\n appRoles: defaultAppRoles,\n userTypes,\n },\n {\n ...serviceOptions,\n // `defaultAppRoles` is resolved from the ACTIVE USER-TYPE CONFIGURATION\n // (`userTypeDefinition.defaultAppRoles ?? [APP_USER]`) — it is never read from the signup\n // payload. Declaring it server-injected is what tells the `users | create` role-ceiling\n // gate not to measure it against the caller, whose roles here are `APP_PUBLIC` by\n // definition: an anonymous registrant cannot \"hold\" the role self-registration grants\n // them. Without this the gate denied every signup with `role_ceiling_exceeded`.\n //\n // This does NOT weaken the gate. `users | create` stays `APP_ADMIN_SUPER_ADMIN`-gated as\n // an API operation, and a genuine client call still has its authored `appRoles` measured\n // — `preserveServerInjectedFields` is a trusted-server option that no client payload can\n // reach. Sign-up is a different mechanism from administrative user creation, and this is\n // the seam that says so.\n preserveServerInjectedFields: [\n ...(serviceOptions?.preserveServerInjectedFields ?? []),\n 'appRoles',\n ],\n },\n );\n\n if (passwordHash) {\n await this.systemAccessService.createAsSystem(\n CoreResourceType.USER_CREDENTIALS,\n {\n userId: createdUser._id,\n passwordHash,\n },\n serviceOptions,\n );\n }\n\n let deferredOrgType: string | undefined;\n if (activeUserType && this.appConfigService.isInitialized()) {\n const organizationTypes = this.appConfigService.config.organizationTypes;\n const orgResult = await createOrgOnRegistration(ec, {\n userId: createdUser._id,\n userEmail: createdUser.email,\n activeUserType,\n organizationName,\n organizationTypes,\n servicesRegistryHandler: this.servicesRegistryHandler,\n systemAccessService: this.systemAccessService,\n serviceOptions,\n plan: orgCreationPlan,\n });\n if (orgResult.pendingOnboarding) {\n deferredOrgType = orgResult.orgType;\n }\n }\n return { createdUser, deferredOrgType };\n },\n {\n // Tier-2 input-derived composition seed: the profile fields\n // originate outside the USERS payload. The service layer queues the\n // profile seed on this unit of work and emits it only after commit.\n compositionSeedRequestInput: {\n firstName,\n lastName,\n displayName: `${firstName} ${lastName}`,\n },\n },\n );\n newUser = registrationPersistence.createdUser;\n pendingOrgType = registrationPersistence.deferredOrgType;\n } catch (createError: any) {\n if (\n (isWildoBackendError(createError) && createError.statusCode === 409)\n || createError?.code === 11000\n || createError?.message?.includes('duplicate key')\n || createError?.message?.includes('E11000')\n ) {\n // A duplicate from USERS.email is the expected concurrent-registration\n // race and must retain the anti-enumeration response. A duplicate from a\n // different participant (for example an organization slug) is a real\n // failure; treating every 409 as an email race would silently discard a\n // valid registration attempt.\n const winningUser = await this.userLookup.findAnyUserByEmail(\n ec,\n email,\n );\n if (winningUser) {\n this.logDebug(\n 'Registration: concurrent email registration won, returning anti-enumeration success',\n {\n email,\n winningUserId: winningUser._id,\n },\n );\n return successResponse;\n }\n }\n throw createError;\n }\n\n // USER_PROFILES is now seeded declaratively by the USERS→USER_PROFILES\n // `onParentCreate` composition lifecycle (input threaded via\n // `compositionSeedRequestInput` on the create above), replacing the former\n // best-effort hand-seed here. The seed is idempotent (unique `userId` index)\n // and swallow-on-failure, so registration is never blocked by a profile write.\n\n if (pendingOrgType) {\n this.logDebug('Org creation deferred to onboarding', {\n userId: newUser._id,\n orgType: pendingOrgType,\n });\n }\n\n // W2.6: Only send verification email when emailVerification !== DEFERRED. Delegated to the\n // shared initiator (one implementation across registration / resend / SCIM provisioning).\n if (!isDeferredVerification) {\n await this.emailVerificationInitiator.sendVerificationEmail({\n userId: newUser._id,\n email: newUser.email,\n firstName,\n frontendBaseUrl: frontendUrl,\n });\n }\n\n this.auditLogsService.logUserRegistered({ userId: newUser._id, email: newUser.email, ipAddress, userAgent }, ec).catch(() => {});\n\n // F7 fix: When email verification is deferred, the user is ACTIVE immediately.\n // Process through the registration pipeline (MFA check, etc.) and issue tokens\n // so the user can start using the app without a separate login step.\n if (isDeferredVerification) {\n const pipelineSession = await this.authOrchestrator.processEmailVerification(\n ec, newUser._id, newUser.email, activeUserType,\n { ipAddress, userAgent }, AuthSessionPurpose.REGISTRATION,\n );\n\n if (pipelineSession.state === AuthenticationSessionState.COMPLETED || pipelineSession.state === AuthenticationSessionState.MFA_ENROLLMENT_GRACE) {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(newUser._id, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n\n this.logDebug('Registration completed — deferred verification, tokens issued', { userId: newUser._id });\n return {\n ...successResponse,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: pipelineSession.purpose,\n // Expose `userId` so the controller can transpose anonymous website\n // captures onto this account. Deferred-verification registration\n // issues real tokens right here (immediate login) — the same\n // anonymous→authenticated conversion moment that `verifyEmail()` and\n // `acceptInvitation()` already surface `userId` for.\n userId: newUser._id,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken,\n expiresIn: tokenResult.expiresIn,\n };\n }\n\n this.logDebug('Registration completed — deferred verification, pipeline requires further steps', {\n userId: newUser._id,\n state: pipelineSession.state,\n nextStep: pipelineSession.nextStep,\n });\n return {\n ...successResponse,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: pipelineSession.purpose,\n nextStep: pipelineSession.nextStep,\n };\n }\n\n // W4.1: Create registration session to track the pipeline state (non-deferred)\n const regSession = await this.authOrchestrator.createRegistrationSession(\n newUser._id,\n newUser.email,\n {\n activeUserType,\n purpose: AuthSessionPurpose.REGISTRATION,\n deviceInfo: { ipAddress, userAgent },\n pendingOrgType,\n },\n );\n\n this.logDebug('Registration completed — awaiting email verification', { userId: newUser._id, sessionId: regSession.sessionId });\n return {\n ...successResponse,\n sessionId: regSession.sessionId,\n state: regSession.state,\n purpose: regSession.purpose,\n };\n }\n\n /**\n * W4.1: Consumes EMAIL_VERIFICATION token, activates user, processes through registration pipeline.\n * Instead of issuing tokens directly, creates/resumes an auth session and advances through\n * the pipeline (email verified → MFA check → enrollment/grace/complete).\n * Returns session state with nextStep for frontend routing.\n */\n async verifyEmail(\n ec: ExecutionContext<any>,\n params: VerifyEmailParams,\n ): Promise<{\n userId?: string;\n sessionId: string;\n state: string;\n nextStep?: string;\n accessToken?: string;\n refreshToken?: string;\n expiresIn?: number;\n mfaGraceExpiresAt?: string;\n requiresMFA?: boolean;\n availableEnrollmentMethods?: string[];\n requireStrongMFA?: boolean;\n }> {\n const { token, email: requestEmail, ipAddress, userAgent } = params;\n\n this.logDebug('Email verification attempted');\n\n let consumedToken;\n try {\n consumedToken = await this.consumableTokenService.consumeToken(token);\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n if (consumedToken.tokenType !== CoreConsumableTokenTypes.EMAIL_VERIFICATION) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const userId = consumedToken.userId || consumedToken.relatedId;\n if (!userId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const metadata = consumedToken.metadata as Record<string, unknown> | undefined;\n const metadataEmail = metadata?.email as string | undefined;\n\n if (!metadataEmail) {\n this.logger.warn('Email verification token metadata missing email — data integrity issue', { userId });\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const tokenEmailBuf = Buffer.from(metadataEmail.toLowerCase());\n const requestEmailBuf = Buffer.from(requestEmail.toLowerCase());\n if (tokenEmailBuf.length !== requestEmailBuf.length || !crypto.timingSafeEqual(tokenEmailBuf, requestEmailBuf)) {\n this.logger.warn('Email verification email mismatch — possible URL tampering', { userId, requestEmail });\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const user = await this.servicesRegistryHandler.read<User>(CoreResourceType.USERS, ec, userId);\n\n if (!user) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_USER_NOT_FOUND,\n });\n }\n\n if (user.status === UserStatus.ACTIVE) {\n this.logDebug('Email verification: user already active', { userId });\n } else if (user.status !== UserStatus.PENDING_VERIFICATION) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.ACCOUNT_ACTIVATION_NOT_ALLOWED,\n });\n } else {\n // `status` is `.excludeFromUpdate()` — the client-facing UPDATE contract cannot carry it, so\n // a handler write is stripped by the repository's strict re-parse and the account would never\n // activate, with no error. The system door re-attaches it. Deliberately NOT a lifecycle verb:\n // activation here follows from a confirmed email, not an administrative decision.\n await this.systemAccessService.updateAsSystem(CoreResourceType.USERS, userId, { status: UserStatus.ACTIVE });\n this.logDebug('User activated via email verification', { userId });\n }\n\n await this.consumableTokenService.revokeTokensByRelatedId(userId, CoreConsumableTokenTypes.EMAIL_VERIFICATION);\n\n this.auditLogsService.logUserEmailVerified({ userId: user._id, email: user.email, ipAddress, userAgent }, ec).catch(() => {});\n\n // W4.1: Process through registration pipeline instead of direct token issuance.\n // Resolve activeUserType from user's userTypes (first entry, if any).\n const activeUserType = user.userTypes?.[0] ?? undefined;\n const session = await this.authOrchestrator.processEmailVerification(\n ec,\n user._id,\n user.email,\n activeUserType,\n { ipAddress, userAgent },\n );\n\n this.logDebug('Email verification complete — pipeline advanced', { userId, state: session.state, nextStep: session.nextStep });\n\n // If pipeline completed (no MFA required), issue tokens\n if (session.state === 'COMPLETED' || session.state === 'MFA_ENROLLMENT_GRACE') {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(user._id, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n return {\n userId,\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep ?? AuthNextStep.COMPLETE,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken ?? '',\n expiresIn: tokenResult.expiresIn ?? 3600,\n mfaGraceExpiresAt: session.mfaGraceExpiresAt,\n };\n }\n\n // MFA enrollment required — return session info for frontend to route to enrollment\n return {\n userId,\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep ?? AuthNextStep.MFA_ENROLLMENT,\n requiresMFA: session.requiresMFA,\n availableEnrollmentMethods: session.availableEnrollmentMethods,\n requireStrongMFA: session.requireStrongMFA,\n };\n }\n\n /**\n * Resend verification email. Returns generic success (anti-enumeration).\n */\n async resendVerificationEmail(\n ec: ExecutionContext<any>,\n params: ResendVerificationParams,\n ): Promise<{ messageRef: string; message: string }> {\n const { email, frontendUrl, ipAddress, userAgent } = params;\n const successResponse = this.authResponseHelper.getAuthResponse(AuthResponseMessageRef.RESEND_VERIFICATION_SUCCESS);\n\n this.logDebug('Resend verification email requested', { email });\n\n try {\n const user = await this.userLookup.findAnyUserByEmail(ec, email);\n\n if (!user || user.status !== UserStatus.PENDING_VERIFICATION) {\n this.logDebug('Resend verification: user not found or not PENDING_VERIFICATION, returning generic success', { email });\n return successResponse;\n }\n\n // Delegated to the shared initiator (revokes the stale token + mints a fresh one + sends).\n await this.emailVerificationInitiator.sendVerificationEmail({\n userId: user._id,\n email: user.email,\n frontendBaseUrl: frontendUrl,\n revokeExisting: true,\n });\n\n this.auditLogsService.logUserVerificationEmailResent({ userId: user._id, email: user.email, ipAddress, userAgent }).catch(() => {});\n } catch (error) {\n if (isWildoBackendError(error)) throw error;\n this.logger.error('Unexpected error during resend verification email', {\n ...projectCaughtErrorLogFields(error),\n });\n }\n\n return successResponse;\n }\n\n /**\n * W4.4: Accept an organization member invitation.\n *\n * The token→membership→user resolution, the INVITED→ACTIVE flip (via the shared\n * `applyInvitationAcceptanceCore`), and the org-join user-type grant are IDENTICAL across every\n * `credentialMethod`; only the credential step + session issuance differ:\n *\n * - **`PASSWORD` / absent**: set the password if one was provided, else\n * intentionally activate with no local credential. The invitation token bootstraps a session (tokens issued unless\n * MFA enrollment gates them).\n * - **`MAGIC_LINK`**: activate with no local credential, then mint + email a magic link (reusing\n * `AuthenticationOrchestrator.sendMagicLink`). NO session is issued here — the invitee clicks the\n * link and the existing `verifyMagicLink` establishes the session. Returns `MAGIC_LINK_SENT`.\n * - **`PASSKEY`**: enroll a NEW WebAuthn credential. The invitation token bootstraps the session\n * exactly like the password path (a passkey, like a password, is the GO-FORWARD credential — not\n * this session's authenticator); the pre-generated registration challenge rides back on the\n * result and the frontend completes the ceremony against the existing authenticated\n * `/auth/passkey/register/verify` route.\n *\n * `MAGIC_LINK` / `PASSKEY` are fail-closed against the invited org's effective auth policy (a\n * method the org disabled is rejected — never trust the client's choice).\n *\n * The effective user type governing the password + MFA policies is resolved by\n * `_resolveOrgJoinUserType` with deliberately split precedence (OWN-first for the pipeline,\n * ORG-JOIN-first for the method-enablement guard) — see that helper for the rationale.\n */\n async acceptInvitation(\n ec: ExecutionContext<any>,\n params: AcceptInvitationParams,\n ): Promise<AcceptInvitationResult> {\n const { invitationToken, password, firstName, lastName, ipAddress, userAgent, credentialMethod } = params;\n\n // 1. VALIDATE the invitation token — do NOT consume it yet. The consume is DEFERRED to the\n // point of no return (just before the first mutation, below) so a validation failure —\n // a non-INVITED membership, a locked user status, a disabled credential method, a weak\n // password — does NOT spend the single-use token and strand the invitee (who could\n // otherwise never retry the same link). The deferred `consumeToken` is also the\n // concurrency guard: a racing second accept of the same token fails there, before mutating.\n //\n // NO TOKEN ORACLE (review FU-4/FU-5, finding #5 — TREATED): every unusable-invitation rejection on\n // the THREE PUBLIC token-based endpoints (`getInvitationInfo`, `acceptInvitation`, `rejectInvitation`)\n // throws the SAME `ErrorType.AUTHENTICATION` with the SAME `INVITATION_NO_LONGER_VALID` reference —\n // deliberately UNIFORM, regardless of cause (unrecognised / expired / already-consumed token, wrong\n // token type, missing invitation reference, non-INVITED membership, orphaned membership, or a revoke\n // that raced the accept). Rationale: a `customMessageReference` is a TOP-LEVEL field that SURVIVES\n // `sanitizeErrorForClient` (which strips `context` for AUTHENTICATION errors), so a per-cause\n // reference IS client-visible and would let a token holder distinguish \"unrecognised token\" from\n // \"recognised-but-superseded invite\". The status code is already uniform (AUTHENTICATION), so the\n // reference was the last distinguishing signal.\n //\n // Keep the granular cause in the LOGS (the throw site + surrounding `logDebug`), NEVER in the\n // reference. DO NOT re-split this into per-cause references — that re-opens the oracle. The\n // AUTHENTICATED in-app paths (`acceptMyInvitation` / `loadOwnedPendingInvitation`) MAY stay granular:\n // they are gated by userId-ownership rather than token possession, so they leak nothing.\n //\n // RESIDUAL TIMING CHANNEL (review FU-6 — ASSESSED, WONTFIX): the uniform error closes the MESSAGE\n // oracle but not a TIMING one. An unrecognised/expired/consumed token fails FAST at `validateToken`\n // (one indexed `findOne({ token })`, no membership read); a token that PASSES `validateToken` but\n // whose membership is non-INVITED does the extra `ORGANIZATION_MEMBERS` read before the IDENTICAL\n // rejection — so response latency can distinguish the two branches. This is deliberately NOT\n // equalized, and MUST NOT be \"fixed\" with a compensating read or a normalizing delay. Reason: the\n // branch bit is observable ONLY by presenting a token that passes `validateToken`, and the token is a\n // 256-bit crypto-random single-use secret (`crypto.randomBytes(32)`) delivered only to the invitee.\n // • An attacker ENUMERATING tokens never reaches the slow branch — every probe misses `findOne`, so\n // latency is a CONSTANT (fast) independent of any server-side secret → zero bits leaked (and the\n // endpoints are per-IP rate-limited, blunting the many-sample averaging a network timing attack\n // needs). The channel cannot even be actuated without the token.\n // • A LEGITIMATE holder only ever learns the state of THEIR OWN invite (INVITED vs consumed/\n // superseded/orphaned) — which they already possess and the endpoint reports anyway.\n // The channel is therefore SELF-REFERENTIAL (its only output is a fact about the very token you had to\n // already hold to read it) — NOT a cross-user / cross-tenant oracle, unlike a password/HMAC/account-\n // existence compare where the branch is gated on a SERVER secret the caller is guessing. Constant-time\n // equalization would add real complexity + steady-state DB load to protect a non-secret, and MongoDB\n // read latency is itself too high-variance (cache warmth, working-set residency, pool contention, GC)\n // to actually flatten the distribution — while risking a NEW leak via metrics/traces. See the review\n // doc FU-6 for the full weighing. (`acceptInvitation`'s deeper rejections — user status, method\n // enablement, password policy — extend this into a GRADUATED profile, but every step past the first is\n // gated behind BOTH a valid token AND a valid INVITED membership, so the whole profile stays\n // self-referential.)\n let tokenResult;\n try {\n tokenResult = await this.consumableTokenService.validateToken(\n invitationToken,\n [CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION],\n );\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n if (tokenResult.tokenType !== CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const invitationId = tokenResult.relatedId;\n if (!invitationId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n // 2. Read the INVITED membership row. In the junction model the invite IS the\n // membership (status INVITED); the token's `relatedId` points at THIS row.\n const membershipId = invitationId;\n const membership = await this.servicesRegistryHandler.read<OrganizationMember>(CoreResourceType.ORGANIZATION_MEMBERS, ec, { _id: membershipId });\n if (!membership || membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const organizationId = membership.organizationId;\n const invitationEmail = (membership.userEmail ?? '').toLowerCase();\n\n // 3. Resolve the invitee user. The invite eagerly provisioned it (PENDING_INVITATION if\n // brand-new, or an existing account), so `membership.userId` always resolves.\n let user = await this.userLookup.findUserById(ec, membership.userId);\n if (!user) {\n // Orphaned membership (user reaped) — surface as an invalid invite, not a 500.\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n // Only a not-yet-activated invitee (PENDING_INVITATION), a pending-verification account,\n // or an already-ACTIVE user may accept. INACTIVE / SUSPENDED / DELETED is a hard stop.\n if (\n user.status !== UserStatus.ACTIVE &&\n user.status !== UserStatus.PENDING_VERIFICATION &&\n user.status !== UserStatus.PENDING_INVITATION\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_USER_NOT_ACTIVE,\n context: { userId: user._id, userStatus: user.status },\n });\n }\n\n // First activation = the invite-provisioned PENDING_INVITATION account claiming its\n // identity for the first time — where password + profile are set. (Also drives the\n // audit auth-method below.)\n const isNewUser = user.status === UserStatus.PENDING_INVITATION;\n\n // CONTRACT (review FU-4, finding F): `firstName` / `lastName` / `password` are applied ONLY on the\n // first-activation branch below (a brand-new invitee). An EXISTING (ACTIVE / PENDING_VERIFICATION)\n // invitee already has a profile, so their submitted names are harmlessly ignored — the invitation\n // token still bootstraps a session (email-possession auth, like a magic link). A submitted PASSWORD\n // is NOT harmless to drop, though: the credential write is gated on `isNewUser`, so an existing\n // user would BELIEVE they set a login credential that was never persisted. REJECT it explicitly\n // rather than silently no-op. The password field is OPTIONAL, so this does NOT block the legitimate\n // existing-user accept — they accept WITHOUT a password and continue with their existing login\n // method (password / SSO / social); a new password can be added later in account settings.\n if (!isNewUser && password) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_EXISTING_ACCOUNT_NO_PASSWORD,\n context: {\n // organizationId is diagnostic (log-only); not in the VALIDATION client allowlist.\n organizationId,\n },\n });\n }\n\n // Resolve the invited org's ORG-JOIN user type ONCE (the type the accept will grant). Its two\n // consumers apply OPPOSITE precedence on purpose (see `_resolveOrgJoinUserType`):\n // • `activeUserType` for the password/MFA pipeline is OWN-FIRST. A brand-new invitee is\n // provisioned with `userTypes: []` (the grant is DEFERRED to activation by\n // `applyInvitationAcceptanceCore` below), so `user.userTypes[0]` is `undefined` and it falls\n // through to the org-join type — closing the weak-password + MFA hole. An EXISTING user keeps\n // their OWN type: a weaker org-join type must NOT re-govern them and silently reset their MFA\n // enrollment state (`_advanceRegistrationPipeline` persists `mfaEnrollmentState → NOT_REQUIRED`\n // when the resolved policy drops the requirement). Org overrides still merge for existing users\n // via `resolveEffectiveAuthPolicy` (which reads the just-activated membership).\n // • the fail-closed method-enablement guard is ORG-JOIN-FIRST — the org's method restrictions\n // must gate the choice even for an existing user (see below).\n const { orgType, orgJoinUserType, orgReadFailed } = await this._resolveOrgJoinUserType(membership);\n const activeUserType = user.userTypes?.[0] ?? orgJoinUserType;\n\n // Fail-closed method-enablement + directory-management enforcement, BEFORE the consume/mutation.\n // `getInvitationInfo` gates the UI, but the accept endpoint must NEVER trust the client — a DIRECT\n // API call could name a method (or set a password) the org disabled, or set a local credential on an\n // actively directory-managed org. So whenever the accept ESTABLISHES A LOCAL CREDENTIAL — a password,\n // an enrolled passkey, or an emailed magic link — enforce BOTH axes:\n // (1) DEPROVISIONING integrity: an ACTIVELY directory-managed org (DIRECTORY_PROVISIONING feature\n // + a live SCIM token — the IdP provisions AND deprovisions, so a local credential would\n // survive deprovisioning) rejects ANY local credential. Re-keyed 2026-07-18 from the org-TYPE\n // `scimProvisioning.enabled` MOUNT flag to this per-org signal (AUTH-23 /\n // .claude/plans/scim-vs-auth-authority-axis.md), which stopped over-blocking password orgs of a\n // SCIM-capable type;\n // (2) AUTH AUTHORITY (SSO): the method must be in the org's effective `authMethodsEnabled`\n // (ORG-JOIN-FIRST, mirroring `getInvitationInfo` — covers PASSWORD too).\n // A password-less activation (no `password`, no `credentialMethod`) sets NO credential and is left\n // open — an SSO/SCIM invitee may activate here and then authenticate via their IdP.\n const establishedCredentialMethod: AuthMethod | undefined =\n credentialMethod === AuthMethod.MAGIC_LINK || credentialMethod === AuthMethod.PASSKEY\n ? credentialMethod\n : (password ? AuthMethod.PASSWORD : undefined);\n if (establishedCredentialMethod) {\n if (orgReadFailed) {\n // The org read FAILED (transient) — its type / `managementMode` and enabled-method set are\n // UNKNOWN. Fail CLOSED: never establish a local credential on an org we could not classify (the\n // downstream directory-management and effective-policy checks below BOTH need a classified org —\n // `_assertInvitationCredentialMethodEnabled` in particular keys on `orgType`). `getInvitationInfo`\n // stays lenient for display; the MUTATION path must not. INTERNAL (retryable) — the invitee can\n // retry once the read recovers; the single-use token is NOT yet consumed at this point.\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_ORG_VERIFICATION_FAILED,\n context: {\n // organizationId is diagnostic (log-only): INTERNAL strips context at the wire.\n // The user-facing text is now localized via the customMessageReference above.\n organizationId,\n },\n });\n }\n // Concern B (deprovisioning integrity): refuse a local credential when the org is\n // ACTIVELY directory-managed. Re-keyed 2026-07-18 (AUTH-23 /\n // .claude/plans/scim-vs-auth-authority-axis.md) from the org-TYPE\n // `scimProvisioning.enabled` MOUNT flag — which over-blocked EVERY org of a\n // SCIM-capable type (stranding password-based test/non-directory orgs) — to the\n // honest per-org signal (DIRECTORY_PROVISIONING feature AND a live SCIM token).\n // Concern A (the org's effective policy disallowing the method) is enforced\n // immediately below by `_assertInvitationCredentialMethodEnabled`.\n let activelyDirectoryManaged: boolean;\n try {\n activelyDirectoryManaged = await isOrgActivelyDirectoryManaged({\n organizationId,\n featureResolution: this.featureResolution,\n systemAccessService: this.systemAccessService,\n });\n } catch (error) {\n // Could not classify the org's directory-management posture (transient read\n // failure). Fail CLOSED exactly like the `orgReadFailed` branch above: throw a\n // RETRYABLE INTERNAL error rather than establish a local credential we might\n // regret. The single-use token is NOT yet consumed, so the invitee can retry.\n this.logger.warn('Failed to resolve directory-management posture at invite-accept', {\n organizationId,\n ...projectCaughtErrorLogFields(error),\n });\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_ORG_VERIFICATION_FAILED,\n context: { organizationId },\n });\n }\n if (activelyDirectoryManaged) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_SCIM_LOCAL_CREDENTIAL_BLOCKED,\n context: {\n // organizationId is diagnostic (log-only): AUTHORIZATION strips context at the wire.\n organizationId,\n },\n });\n }\n // ORG-JOIN-FIRST (opposite of `activeUserType`): the org's method restrictions must gate the\n // choice even for an existing user who carries their own type. Mirrors `getInvitationInfo`.\n const enablementUserType = orgJoinUserType ?? user.userTypes?.[0];\n this._assertInvitationCredentialMethodEnabled(organizationId, orgType, enablementUserType, establishedCredentialMethod);\n }\n\n // Validate the initial password against the ORG-MERGED policy (new invitee setting one) BEFORE\n // consuming the token — a policy rejection must NOT spend the single-use token (else a weak\n // password strands the invitee, unable to retry). `resolveAuthPolicyForOrgType` applies the\n // org's `authOverrides` most-restrictively (consistent with the enablement guard above, the M1\n // discovery policy, and the MFA path), so an org that STRENGTHENS `passwordPolicy` is honored. A\n // brand-new invitee's `activeUserType` IS the org-join type (own `userTypes: []`) so the\n // single-org resolver is exact; an unresolvable type degrades to the schema default\n // (`validatePasswordPolicy(pw, undefined)`).\n if (isNewUser && password) {\n const passwordPolicy = (activeUserType\n ? this.userLookup.resolveAuthPolicyForOrgType(activeUserType, orgType)\n : null)?.passwordPolicy;\n const policyValidation = this.credentialVerifier.validatePasswordPolicy(password, passwordPolicy);\n if (!policyValidation.valid) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION_PASSWORD_POLICY_VIOLATION,\n context: { violations: policyValidation.violations, minLength: passwordPolicy?.minLength, maxLength: passwordPolicy?.maxLength },\n });\n }\n }\n\n // Registration policy is checked before the token point-of-no-return. The shared acceptance\n // core repeats this check immediately before membership mutation for policy drift and for the\n // tokenless/OAuth entry points.\n await assertInvitationUserTypeAcquisitionAllowed({\n user,\n organizationId,\n appConfigService: this.appConfigService,\n errorBuilder: this.errorBuilder,\n systemAccessService: this.systemAccessService,\n });\n\n // Hash outside the transaction: Argon2 is CPU work and must not extend the\n // database lock window. The policy validation above has already succeeded.\n const hashedPassword = isNewUser && password\n ? await this.credentialVerifier.hashPassword(\n password,\n this.appConfigService.config.auth.passwordHashing,\n )\n : undefined;\n\n try {\n user = await this.resourcePersistenceUnitOfWork.executeTransaction(\n createPublicInvitationAcceptancePersistenceRequest({\n includeCredentials: hashedPassword !== undefined,\n }),\n async serviceOptions => {\n // Token consumption, membership activation, user activation, credential\n // persistence, and org-type grants are one commit. Any revoked membership\n // or later write failure rolls the single-use token back to usable state.\n await this.consumableTokenService.consumeToken(\n invitationToken,\n serviceOptions.transaction!,\n );\n\n const currentMembership = await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: membership._id },\n serviceOptions,\n );\n const currentUser = await this.servicesRegistryHandler.read<User>(\n CoreResourceType.USERS,\n ec,\n { _id: user._id },\n serviceOptions,\n );\n if (\n !currentMembership\n || (\n currentMembership.status !== OrganizationMemberStatus.INVITED\n && currentMembership.status !== OrganizationMemberStatus.ACTIVE\n )\n || currentMembership.userId !== user._id\n || !currentUser\n || currentUser.status !== user.status\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n if (hashedPassword) {\n const existingCredential = await this.servicesRegistryHandler.read<UserCredentials>(\n CoreResourceType.USER_CREDENTIALS,\n ec,\n { userId: currentUser._id },\n serviceOptions,\n );\n if (existingCredential) {\n await this.credentialVerifier.updatePasswordHash(\n ec,\n currentUser._id,\n hashedPassword,\n serviceOptions,\n );\n } else {\n await this.systemAccessService.createAsSystem(\n CoreResourceType.USER_CREDENTIALS,\n {\n userId: currentUser._id,\n passwordHash: hashedPassword,\n },\n serviceOptions,\n );\n }\n }\n\n let activatedUser = currentUser;\n if (\n currentUser.status === UserStatus.PENDING_INVITATION\n || currentUser.status === UserStatus.PENDING_VERIFICATION\n ) {\n // SYSTEM door, not the handler: `status` is `.excludeFromUpdate()`, so the client-facing\n // UPDATE contract cannot carry it and the repository's strict re-parse STRIPS it from a\n // handler write. The row still comes back — the filter matched — so the write reports\n // success while persisting nothing, and the invitee is left PENDING_INVITATION.\n //\n // That silence is what made this expensive to find. Nothing threw; `accept` answered 200;\n // and the failure surfaced two steps later as a magic link that was never emailed, because\n // `sendMagicLink` resolves the user BY EMAIL and takes its anti-enumeration no-op when that\n // user is not ACTIVE. An e2e scenario reported \"no email arrived\" for a defect three hops\n // upstream.\n //\n // The sibling activation (email verification, ~line 900) was moved to the system door on\n // 2026-08-06; this call site was missed, which is the failure shape\n // `.claude/rules/invariant-call-site-enumeration.md` exists to catch — the invariant is\n // \"a `status` write goes through the system door\", and it holds at every site or none.\n //\n // The compare-and-swap is PRESERVED: the filter still pins the status observed above, so a\n // concurrent activation still loses the race and is still refused below rather than\n // blind-overwriting.\n const updated = await this.systemAccessService.updateAsSystem<User>(\n CoreResourceType.USERS,\n { _id: currentUser._id, status: currentUser.status },\n { status: UserStatus.ACTIVE },\n serviceOptions,\n );\n if (!updated) {\n throw this.errorBuilder.buildError(ErrorType.CONFLICT, undefined, {\n context: {\n reason: 'invitation_user_activation_race_lost',\n userId: currentUser._id,\n },\n });\n }\n activatedUser = updated;\n }\n\n const { membershipActivated } = await applyInvitationAcceptanceCore(ec, {\n membership: currentMembership,\n user: activatedUser,\n appConfigService: this.appConfigService,\n errorBuilder: this.errorBuilder,\n servicesRegistryHandler: this.servicesRegistryHandler,\n systemAccessService: this.systemAccessService,\n serviceOptions,\n logDebug: this.logDebug,\n });\n if (!membershipActivated) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n return activatedUser;\n },\n );\n } catch (error) {\n this.logger.warn('Invitation acceptance transaction rolled back', {\n membershipId: membership._id,\n userId: user._id,\n organizationId,\n ...(isWildoBackendError(error)\n ? {\n errorType: error.type,\n errorStatusCode: error.statusCode,\n errorContext: error.context,\n }\n : {\n errorMessage: describeCaughtError(error),\n }),\n });\n // Preserve the public no-oracle contract for expected token/state races,\n // but never relabel infrastructure, database, or configuration failures\n // as an invalid invitation. Those failures are retryable/operator-actionable\n // and masking them would strand a valid invite behind a false 401.\n if (\n isWildoBackendError(error)\n && (\n error.type === ErrorType.AUTHENTICATION\n || error.type === ErrorType.CONFLICT\n )\n ) {\n throw this.errorBuilder.buildError(\n ErrorType.AUTHENTICATION,\n undefined,\n {\n customMessageReference:\n ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n },\n );\n }\n throw error;\n }\n\n if (isNewUser) {\n // Profile enrichment is not an authorization precondition. It runs only\n // after the durable acceptance commit and remains idempotent/best-effort.\n try {\n await this.systemAccessService.createAsSystem(CoreResourceType.USER_PROFILES, {\n userId: user._id,\n firstName,\n lastName,\n displayName: `${firstName} ${lastName}`,\n });\n } catch (profileError) {\n this.logger.error('Failed to create user profile during invitation acceptance (non-fatal)', {\n userId: user._id,\n ...projectCaughtErrorLogFields(profileError),\n });\n }\n this.logDebug('Invitee account activated via invitation acceptance', {\n userId: user._id,\n organizationId,\n });\n }\n\n // MAGIC_LINK path — the invitee established NO local credential and gets NO session here.\n // Mint a magic link (reusing the shared token machinery, `sendMagicLink`) bound to the\n // just-activated invitee and hand it back for the controller to email. `sendMagicLink`\n // resolves the user BY EMAIL — which now resolves to THIS ACTIVE account — so the token's\n // `relatedId` IS the invitee's userId and its `metadata.email` the invitee email; the eventual\n // `verifyMagicLink` click (which hard-rejects non-ACTIVE users) establishes the session. No\n // login is audited here: `sendMagicLink` audits the send, `verifyMagicLink` audits the login.\n if (credentialMethod === AuthMethod.MAGIC_LINK) {\n // `skipGlobalEnablementCheck: true` — MAGIC_LINK was ALREADY authorized above against the\n // invited org's precise, org-EXPANDED policy (`_assertInvitationCredentialMethodEnabled`). We\n // are PAST the mutations (activate + membership flip + token consume), so `sendMagicLink` must\n // NOT re-reject on its coarse base-policy global gate — that would strand the just-activated\n // invitee (see the reconciliation note on `sendMagicLink`).\n const magic = await this.authOrchestrator.sendMagicLink(ec, { email: invitationEmail }, { ipAddress, userAgent }, true);\n this.logDebug('Invitation accepted via magic link — link minted for delivery', { userId: user._id, organizationId });\n return {\n outcome: AcceptInvitationOutcome.MAGIC_LINK_SENT,\n magicLinkDelivery: {\n // Empty only in the (post-activation) anti-enumeration no-op — the controller then\n // simply sends no email; the invitee we just activated always resolves to a token.\n token: magic.token ?? '',\n submissionId: magic.submissionId,\n email: invitationEmail,\n userId: user._id,\n expiresInMinutes: magic.expiresInMinutes,\n },\n };\n }\n\n // PASSKEY path — the invitee will enroll a NEW WebAuthn credential. `passkeyCredentials` live on\n // the USER_CREDENTIALS document, and both the challenge generation below and the later verify\n // require that row to EXIST — so ensure a password-less row now (a brand-new invitee has none;\n // an existing user may already have one). Runs on BOTH the token-issued and MFA-gated branches so\n // a post-MFA enrollment via the existing authenticated route also finds the row.\n if (credentialMethod === AuthMethod.PASSKEY) {\n // NON-FATAL: the token is already consumed + the membership flipped, so a failure here must\n // NOT 500 and strand the invitee (activated but session-less). A missing row just means the\n // challenge below no-ops (also non-fatal) and the invitee enrolls a passkey later via the\n // authenticated register route.\n try {\n await this._ensurePasswordlessCredentialRecord(ec, user._id);\n } catch (error) {\n this.logger.error('Password-less credential row provisioning failed at passkey accept (non-fatal)', {\n userId: user._id,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n // 6. Create registration session with purpose 'invitation'\n const session = await this.authOrchestrator.createRegistrationSession(\n user._id,\n invitationEmail,\n {\n activeUserType,\n purpose: AuthSessionPurpose.INVITATION,\n deviceInfo: { ipAddress, userAgent },\n },\n );\n\n const auditAuthMethod = isNewUser\n ? (password ? AuthMethod.PASSWORD : AUTH_AUDIT_METHOD.INVITATION_ACCEPTANCE)\n : AUTH_AUDIT_METHOD.INVITATION_LINK;\n this.auditLogsService.logUserLogin({\n userId: user._id,\n email: invitationEmail,\n authMethod: auditAuthMethod,\n ipAddress,\n userAgent,\n sessionId: session.sessionId,\n organizationId,\n }, await this.authEcFactory.createForAuditRoutingOrFallback(ec, organizationId, user._id)).catch(() => {});\n\n // 7. Process through the registration pipeline\n // Invitations from trusted source → skip email verification, go straight to MFA check\n const pipelineSession = await this.authOrchestrator.processEmailVerification(\n ec,\n user._id,\n invitationEmail,\n activeUserType,\n { ipAddress, userAgent },\n AuthSessionPurpose.INVITATION,\n );\n\n // 8. If pipeline completed, issue tokens\n if (pipelineSession.state === 'COMPLETED' || pipelineSession.state === 'MFA_ENROLLMENT_GRACE') {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(user._id, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n\n // PASSKEY: with a session now issued, generate the WebAuthn registration challenge bound to\n // the invitee and ride it back on the result. The frontend runs the browser ceremony and\n // completes it against the EXISTING authenticated `/auth/passkey/register/verify` route\n // (authenticated by the access token just issued) — no bespoke accept-verify endpoint.\n // NON-FATAL: the session is ALREADY issued (the invitation token bootstrapped it + was\n // consumed), so a challenge-generation failure must NOT 500 and strand the invitee — they\n // proceed signed in (no challenge on the wire) and enroll a passkey later in security\n // settings, exactly like the frontend's own swallowed ceremony failure.\n let passkeyRegistrationOptions: PublicKeyCredentialCreationOptionsJSON | undefined;\n if (credentialMethod === AuthMethod.PASSKEY) {\n try {\n passkeyRegistrationOptions = await this.webAuthnService.generateRegistrationOptions(ec, user._id, invitationEmail);\n } catch (error) {\n this.logger.error('Passkey challenge generation failed at accept — returning the issued session without a challenge (non-fatal)', {\n userId: user._id,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n return {\n outcome: AcceptInvitationOutcome.SESSION,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: AuthSessionPurpose.INVITATION,\n nextStep: pipelineSession.nextStep,\n userId: user._id,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken,\n expiresIn: tokenResult.expiresIn,\n passkeyRegistrationOptions,\n };\n }\n\n // MFA enrollment required — return session info for frontend routing. Passkey options are\n // deliberately NOT generated here: there is no session yet, and the 5-minute challenge would\n // likely expire before MFA enrollment finishes. The frontend enrolls the passkey post-MFA via\n // the existing authenticated route (the credential row was already ensured above).\n return {\n outcome: AcceptInvitationOutcome.SESSION,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: AuthSessionPurpose.INVITATION,\n nextStep: pipelineSession.nextStep,\n userId: user._id,\n requiresMFA: true,\n availableEnrollmentMethods: pipelineSession.availableEnrollmentMethods,\n };\n }\n\n /**\n * Resolve the invited organization's join context in a SINGLE system read: its `type`, the\n * ORG-JOIN user type the accept will GRANT (`organizationTypes[orgType].userTypes[0]`), and its\n * display name. The one read is shared by `acceptInvitation` (uses `orgType` + `orgJoinUserType`)\n * and `getInvitationInfo` (uses all three), so the org-join projection lives in ONE place — no\n * drift between the accept path and its public discovery counterpart.\n *\n * **Why `[0]`** — `grantUserTypesOnOrgJoin` grants ALL of `organizationTypes[orgType].userTypes`\n * ADDITIVELY, but `[0]` is the PRIMARY (governing) type: it matches the `userTypes[0]` convention\n * every auth surface uses (orchestrator, token issuer, password reset, method-management), and a\n * brand-new invitee's additive grant appends to `[]` so their post-grant `userTypes[0]` IS this\n * `[0]`. Resolving the accept-time policy against `[0]` therefore matches the invitee's\n * steady-state login policy EXACTLY. The remaining granted types are supplementary capabilities,\n * not the governing auth type — validating against the most-restrictive of ALL granted types would\n * make accept STRICTER than every subsequent login (an accept-vs-steady-state discrepancy).\n *\n * Returns the RAW org-join type — deliberately NOT pre-merged with the invitee's own type —\n * because the two accept consumers need OPPOSITE precedence:\n * - the effective `activeUserType` for the password/MFA pipeline is OWN-FIRST\n * (`user.userTypes[0] ?? orgJoinUserType`): a brand-new invitee (own `userTypes: []`, grant\n * deferred) falls through to the org-join type — closing the weak-password + MFA hole — while\n * an EXISTING user keeps their own type so a weaker org-join type cannot re-govern them or\n * reset their MFA enrollment state;\n * - the fail-closed method-enablement guard is ORG-JOIN-FIRST\n * (`orgJoinUserType ?? user.userTypes[0]`): the org's method restrictions must gate the choice\n * even for an existing user.\n *\n * Read via the system-access door because both callers run under a pre-auth `APP_PUBLIC` EC that\n * cannot ACL-read ORGANIZATIONS. `organizationName` is `displayName ?? name` (`undefined` if the\n * org is unreadable — callers coalesce). (A full accept performs ~3 org reads; the org-type grant\n * and `resolveEffectiveAuthPolicy` read it too — this read is shared by the guard + the\n * initial-password policy + discovery.)\n */\n private async _resolveOrgJoinUserType(\n membership: Pick<OrganizationMember, 'organizationId'>,\n ): Promise<{ orgType: string | undefined; orgJoinUserType: string | undefined; organizationName: string | undefined; orgReadFailed: boolean }> {\n let orgType: string | undefined;\n let organizationName: string | undefined;\n let orgReadFailed = false;\n try {\n const org = await this.systemAccessService.readAsSystem<{ _id: string; type?: string; name?: string; displayName?: string }>(\n CoreResourceType.ORGANIZATIONS, { _id: membership.organizationId },\n );\n orgType = org?.type;\n organizationName = org?.displayName ?? org?.name ?? undefined;\n } catch (error) {\n // Non-fatal read failure → orgType/name stay undefined → org-join type unresolved. `orgReadFailed`\n // DISAMBIGUATES this from a genuinely type-less org (both leave `orgType` undefined). For a\n // brand-new invitee (own `userTypes: []`) an unresolved type degrades the initial-password policy\n // to the schema default and the MFA policy to FALLBACK — acceptable for DISPLAY. But the\n // credential-establishment guard fail-CLOSES on `orgReadFailed` (a degraded read must never be\n // mistaken for a non-SCIM / unrestricted org and let a local credential slip past enforcement).\n // Logged so the degrade is observable rather than silent.\n orgReadFailed = true;\n this.logDebug('Invitation accept: ORGANIZATIONS read failed — org-join user type unresolved, policy will degrade', {\n organizationId: membership.organizationId,\n ...projectCaughtErrorLogFields(error),\n });\n }\n\n const orgJoinUserType = orgType\n ? this.appConfigService.config.organizationTypes?.[orgType]?.userTypes?.[0]\n : undefined;\n\n return { orgType, orgJoinUserType, organizationName, orgReadFailed };\n }\n\n /**\n * Fail-closed check that a chosen accept-time credential method is enabled by the invited\n * organization's EFFECTIVE auth policy. Receives the ORG-JOIN-FIRST resolved user type + the org\n * type (both from `_resolveOrgJoinUserType`, resolved once per accept); the PURE\n * `resolveAuthPolicyForOrgType` merges the org overrides (most-restrictive-wins) and\n * `getEnabledMethods` projects the enabled set.\n *\n * Throws `AUTHORIZATION` when the method is not enabled (or the org type / policy cannot be\n * resolved — fail-closed: an unresolvable policy never silently permits a password-less method).\n */\n private _assertInvitationCredentialMethodEnabled(\n organizationId: string,\n orgType: string | undefined,\n resolutionUserType: string | undefined,\n credentialMethod: AuthMethod,\n ): void {\n const resolvedPolicy = resolutionUserType\n ? this.userLookup.resolveAuthPolicyForOrgType(resolutionUserType, orgType)\n : null;\n const enabledMethods = resolvedPolicy\n ? getEnabledMethods(resolvedPolicy.authMethodsEnabled)\n : new Set<AuthMethod>();\n const registrationMethodAllowed =\n credentialMethod !== AuthMethod.PASSWORD\n || resolvedPolicy?.registration.allowedMethods.includes(\n AuthMethod.PASSWORD,\n ) === true;\n\n if (\n !registrationMethodAllowed\n || !enabledMethods.has(credentialMethod)\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_METHOD_NOT_SUPPORTED,\n context: {\n // Diagnostic (log-only): AUTHENTICATION strips non-allowlisted context at the wire.\n method: credentialMethod,\n organizationId,\n },\n });\n }\n }\n\n /**\n * Ensure a USER_CREDENTIALS document exists for a user, creating a PASSWORD-LESS one if absent.\n * Passkey-enroll-at-accept needs the credential row to exist BEFORE the WebAuthn ceremony (the\n * challenge generation + verify both resolve it, and a brand-new invitee has none). `passwordHash`\n * is optional precisely so this row is creatable with no password. Idempotent: an existing row\n * (e.g. an already-registered user accepting a further invite) is left untouched.\n */\n private async _ensurePasswordlessCredentialRecord(ec: ExecutionContext<any>, userId: string): Promise<void> {\n const existing = await this.servicesRegistryHandler.read<UserCredentials>(\n CoreResourceType.USER_CREDENTIALS, ec, { userId },\n );\n if (existing) return;\n\n // Trusted system write: USER_CREDENTIALS is INTERNAL_CALL-only and its `userId` (context FK) is\n // stripped from the client-shaped request DTO; `createAsSystem` re-attaches it after the strict\n // parse (systemAccessPolicy.create opt-in). No `passwordHash` — this is a password-less row.\n await this.systemAccessService.createAsSystem(CoreResourceType.USER_CREDENTIALS, { userId });\n this.logDebug('Password-less credential record provisioned for passkey enrollment', { userId });\n }\n\n /**\n * W4.4: Reject an organization member invitation through the public token-based auth flow.\n *\n * The junction row is the invitation, so rejection and admin revocation have\n * distinct authorization/audit intent but the same terminal persistence:\n * atomically revoke the accept token and delete the still-INVITED row.\n */\n async rejectInvitation(\n ec: ExecutionContext<any>,\n params: {\n invitationToken: string;\n rejectionReason?: string;\n },\n ): Promise<{ rejected: true }> {\n const { invitationToken, rejectionReason } = params;\n\n // NO TOKEN ORACLE + RESIDUAL TIMING CHANNEL: rejection is uniform (`INVITATION_NO_LONGER_VALID`); the\n // fast (validateToken-fail) vs slow (membership-read) timing residual is ASSESSED WONTFIX. See the\n // canonical rationale on `acceptInvitation` (review FU-4/5/6) before \"fixing\" the timing here.\n let tokenResult;\n try {\n // Preflight is deliberately read-only. The invited-only REVOKE mutation\n // revokes this token by membership relatedId in the same transaction as\n // deleting the row. Consuming here would strand a valid INVITED row if\n // the process crashed or deletion failed afterward.\n tokenResult = await this.consumableTokenService.validateToken(\n invitationToken,\n [CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION],\n );\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const invitationId = tokenResult.relatedId;\n if (!invitationId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const membership = await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: invitationId },\n );\n if (!membership || membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n try {\n await this.applyInvitationRejectionCore(ec, {\n membership,\n rejectionReason,\n });\n } catch (error) {\n // Acceptance/revocation may win after the read-only preflight. Preserve\n // the public no-oracle contract for those expected state races, while\n // leaving infrastructure/configuration failures visible and retryable.\n if (\n isWildoBackendError(error)\n && (\n error.type === ErrorType.AUTHENTICATION\n || error.type === ErrorType.AUTHORIZATION\n || error.type === ErrorType.NOT_FOUND\n || error.type === ErrorType.CONFLICT\n )\n ) {\n throw this.errorBuilder.buildError(\n ErrorType.AUTHENTICATION,\n undefined,\n {\n customMessageReference:\n ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n },\n );\n }\n throw error;\n }\n\n return { rejected: true };\n }\n\n /**\n * Shared rejection core — REVOKE the pending membership (decline). Reused by the\n * token-based `rejectInvitation` and the authenticated in-app `rejectMyInvitation`.\n *\n * In the junction model there is no `REJECTED` status to set: a declined invite leaves no\n * membership. Revoking the INVITED row uses the exact invited-only REVOKE\n * implementation, whose declarative token contract revokes the accept token\n * inside the same transaction. The invitee\n * is not an org admin, so the ORG_ADMIN-gated DELETE runs under a synthesised super-admin EC.\n *\n * ## The decline IS audited — as the invitee, not as the system\n *\n * REVOKE emits `ORGANIZATION_MEMBER_REMOVED` from a post-commit effect, carrying `operation`,\n * `previousStatus`, `roles` and this `reason`. What that event could not say, until the\n * `onBehalfOfUserId` below, was WHO declined: a borrowed-authority context carries no\n * `initiatorIds.userId` (the `ExecutionContext` constructor rejects one), so the actor resolved to\n * `SYSTEM` — the identical row the stale-invitation sweep writes when it reaps an invitation nobody\n * answered. An access review could not tell an active refusal from silence.\n *\n * `membership.userId` is the right source for BOTH callers rather than the caller id: the token\n * path identifies the invitee through the token, the in-app path has already verified the caller\n * owns this row, and taking it from the row keeps the two from drifting.\n *\n * With the actor recorded, the three REVOKE causes are distinguishable with no new event type:\n * a self-decline is `removedBy === removedUserId`, an administrative cancellation is a different\n * real user id, and the expiry sweep remains `SYSTEM`.\n */\n private async applyInvitationRejectionCore(\n _ec: ExecutionContext<any>,\n { membership, rejectionReason }: { membership: OrganizationMember; rejectionReason?: string },\n ): Promise<void> {\n const systemEc = await this.authEcFactory.createForSystemAuthOperation(\n this.authEcFactory.getOrganizationMembersRevokeOperationPath(),\n { onBehalfOfUserId: membership.userId },\n );\n await this.servicesRegistryHandler.executeCustomOperation(\n CoreResourceType.ORGANIZATION_MEMBERS,\n OrganizationMembers_Operations.REVOKE,\n systemEc,\n membership._id,\n {\n reason: rejectionReason?.trim() || undefined,\n },\n );\n\n this.logDebug('Invitation declined — pending membership removed', {\n membershipId: membership._id,\n userId: membership.userId,\n organizationId: membership.organizationId,\n rejectionReason: rejectionReason?.trim() || undefined,\n });\n }\n\n /**\n * In-app authenticated accept (Approach P) — list the caller's OWN pending\n * invitations across every organization, matched by their `userId`.\n *\n * Since the invitation→membership collapse, the invite binds the pending\n * `ORGANIZATION_MEMBERS` row to the invitee's `userId` (an eagerly-created\n * `PENDING_INVITATION` user), so the inbox is a direct userId-owned query — no\n * email round-trip. Cross-org by construction (the invitee is not yet a scoped\n * member of the inviting orgs), so invitations + org names are read via the\n * system-context primitives (`listAsSystem`/`readAsSystem`). Authorization is\n * the userId-ownership match: only INVITED rows bound to the caller's `userId`\n * are returned. The caller's identity comes from the authenticated route\n * (`callerUserId`).\n */\n async listMyPendingInvitations(\n _ec: ExecutionContext<any>,\n params: { callerUserId: string },\n ): Promise<MyPendingInvitation[]> {\n // The invite bound the pending membership to the caller's `userId`, so the inbox is a\n // direct userId-owned query — no email round-trip. Cross-org by construction (the invitee\n // is not yet a scoped member of the inviting orgs), so read via the system context.\n const result = await this.systemAccessService.listAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { userId: params.callerUserId, status: OrganizationMemberStatus.INVITED },\n );\n const memberships = Array.isArray(result) ? result : result.data;\n\n return Promise.all(memberships.map(async (membership): Promise<MyPendingInvitation> => {\n let organizationName: string | undefined;\n try {\n const org = await this.systemAccessService.readAsSystem<{ displayName?: string; name?: string }>(\n CoreResourceType.ORGANIZATIONS,\n { _id: membership.organizationId },\n );\n organizationName = org?.displayName ?? org?.name ?? undefined;\n } catch {\n organizationName = undefined;\n }\n return {\n membershipId: membership._id,\n organizationId: membership.organizationId,\n organizationName,\n roles: membership.roles ?? [],\n createdAt: membership.createdAt ? new Date(membership.createdAt).toISOString() : undefined,\n };\n }));\n }\n\n /**\n * In-app authenticated accept (Approach P) — accept ONE of the caller's own pending\n * invitations by membership id, WITHOUT a token and WITHOUT issuing a new session (the\n * caller is already authenticated). Authorization = userId-ownership of the INVITED row.\n * The shared `applyInvitationAcceptanceCore` flips it to ACTIVE + grants org-join types.\n */\n async acceptMyInvitation(\n ec: ExecutionContext<any>,\n params: { callerUserId: string; membershipId: string },\n ): Promise<{ accepted: true; organizationId: string }> {\n const { caller, membership } = await this.loadOwnedPendingInvitation(ec, params.callerUserId, params.membershipId);\n\n await this.resourcePersistenceUnitOfWork.executeTransaction(\n createAuthenticatedInvitationAcceptancePersistenceRequest(),\n async serviceOptions => {\n // MongoDB does not support concurrent operations on the same session.\n // Sequential reads are portable across both supported adapters.\n const currentCaller = await this.servicesRegistryHandler.read<User>(\n CoreResourceType.USERS,\n ec,\n { _id: caller._id },\n serviceOptions,\n );\n const currentMembership =\n await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: membership._id },\n serviceOptions,\n );\n if (\n !currentCaller\n || !currentMembership\n || currentMembership.userId !== currentCaller._id\n || currentMembership.status !== OrganizationMemberStatus.INVITED\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const { membershipActivated } = await applyInvitationAcceptanceCore(ec, {\n membership: currentMembership,\n user: currentCaller,\n appConfigService: this.appConfigService,\n errorBuilder: this.errorBuilder,\n servicesRegistryHandler: this.servicesRegistryHandler,\n systemAccessService: this.systemAccessService,\n serviceOptions,\n logDebug: this.logDebug,\n });\n if (!membershipActivated) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n },\n );\n\n this.logDebug('Invitation accepted in-app', {\n membershipId: membership._id,\n userId: caller._id,\n organizationId: membership.organizationId,\n });\n\n return { accepted: true, organizationId: membership.organizationId };\n }\n\n /**\n * In-app authenticated reject (Approach P) — decline ONE of the caller's own pending\n * invitations by membership id. Same userId-ownership gate as `acceptMyInvitation`. In the\n * junction model the decline REVOKEs the INVITED row (which revokes its accept token via\n * the invitation-cancellation prefix) rather than setting a terminal status.\n */\n async rejectMyInvitation(\n ec: ExecutionContext<any>,\n params: { callerUserId: string; membershipId: string; rejectionReason?: string },\n ): Promise<{ rejected: true; organizationId: string }> {\n const { membership } = await this.loadOwnedPendingInvitation(ec, params.callerUserId, params.membershipId);\n\n await this.applyInvitationRejectionCore(ec, { membership, rejectionReason: params.rejectionReason });\n\n return { rejected: true, organizationId: membership.organizationId };\n }\n\n /**\n * Load + authorize one of the caller's own pending invitations (INVITED membership rows)\n * for the in-app (authenticated, tokenless) accept/reject flow. Reads the caller + the\n * membership via the cross-org system context, then enforces:\n * 1. userId-ownership — `membership.userId === caller._id` (else 403 AUTHORIZATION);\n * 2. INVITED status (else AUTHENTICATION \"no longer valid\", matching the token flow).\n *\n * \"Not found\" and \"not addressed to you\" deliberately surface the SAME ownership error so\n * a caller cannot probe for the existence of other people's invitations.\n */\n private async loadOwnedPendingInvitation(\n ec: ExecutionContext<any>,\n callerUserId: string,\n membershipId: string,\n ): Promise<{ caller: User; membership: OrganizationMember }> {\n const caller = await this.userLookup.findUserById(ec, callerUserId);\n if (!caller) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, ec, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_USER_NOT_FOUND,\n });\n }\n\n const membership = await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: membershipId },\n );\n\n if (!membership || membership.userId !== caller._id) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, ec, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NOT_ADDRESSED_TO_CALLER,\n });\n }\n\n if (membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, ec, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n return { caller, membership };\n }\n\n /**\n * W5.7: Complete org onboarding — called by the guidance/onboarding flow\n * after collecting the organization name from the user.\n * Creates the deferred org, grants user types, issues tokens, transitions session to COMPLETED.\n */\n async completeOrgOnboarding(\n ec: ExecutionContext<any>,\n params: {\n sessionId: string;\n organizationName: string;\n },\n ): Promise<{\n sessionId: string;\n state: string;\n nextStep?: string;\n organizationId?: string;\n accessToken?: string;\n refreshToken?: string;\n expiresIn?: number;\n }> {\n const session = await this.authOrchestrator.completeOrgOnboarding(\n ec,\n params.sessionId,\n params.organizationName,\n );\n\n if (session.state === AuthenticationSessionState.COMPLETED && session.userId) {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(session.userId, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n return {\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep,\n organizationId: session.organizationId,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken,\n expiresIn: tokenResult.expiresIn,\n };\n }\n\n return {\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep,\n organizationId: session.organizationId,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"auth-registration.backend.service.js","sourceRoot":"","sources":["../../../../../../../src/security/authentications/services/auth-methods/auth-registration.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,6BAA6B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B,YAEN,wCAAwC;GAfhI,8BAA8B,CAokE1C","sourcesContent":["import 'reflect-metadata';\nimport crypto from 'crypto';\nimport { injectable, inject } from 'inversify';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { isOrgActivelyDirectoryManaged } from '~wildo-backend-lib/organizations/services/scim-provisioning-gate.backend.utils';\nimport type { FeatureResolutionBackendService } from '~wildo-backend-lib/features/services/feature-resolution.backend.service';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport { ConsumableTokenBackendService } from '~wildo-backend-lib/security/consumable-tokens/services/consumable-token.backend.service';\nimport type { AuthExecutionContextFactoryBackendService } from '~wildo-backend-lib/security/authentications/services/auth-execution-context-factory.backend.service';\nimport { AuthCredentialVerifierBackendService } from '~wildo-backend-lib/security/authentications/services/auth-credential-verifier.backend.service';\nimport { AuthTokenIssuerBackendService } from '~wildo-backend-lib/security/authentications/services/auth-token-issuer.backend.service';\nimport { AuthUserLookupBackendService } from '~wildo-backend-lib/security/authentications/services/utils/auth-user-lookup.backend.service';\nimport { AuthResponseHelperBackendService } from '~wildo-backend-lib/security/authentications/services/utils/auth-response-helper.backend.service';\nimport { describeCaughtError, projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { DomainToOrgLookupBackendService } from '~wildo-backend-lib/security/authentications/services/admin-config/domain-to-org-lookup.backend.service';\nimport { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\nimport type { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { SystemAccessBackendService } from '~wildo-backend-lib/base-classes/services/services/system-access.backend.service';\nimport type { ResourcePersistenceUnitOfWorkBackendService } from '~wildo-backend-lib/databases/services/resource-persistence-unit-of-work.backend.service';\nimport {\n applyInvitationAcceptanceCore,\n assertInvitationUserTypeAcquisitionAllowed,\n} from '~wildo-backend-lib/organizations/services/invitation-acceptance.backend.utils';\nimport {\n createOrgOnRegistration,\n OrgCreationOnRegistrationPlanInvalidReason,\n OrgCreationOnRegistrationPlanMode,\n resolveOrgCreationOnRegistrationPlan,\n} from '~wildo-backend-lib/organizations/services/org-creation-on-registration.backend.utils';\nimport { AUTH_AUDIT_METHOD } from '~wildo-backend-lib/security/authentications/models/auth-constants.backend';\nimport {\n createAuthenticatedInvitationAcceptancePersistenceRequest,\n createPublicInvitationAcceptancePersistenceRequest,\n createSelfRegistrationPersistenceRequest,\n} from '~wildo-backend-lib/security/authentications/models/identity-persistence-boundaries.backend';\nimport { AuthenticationOrchestratorBackendService } from '~wildo-backend-lib/security/authentications/services/authentication-orchestrator.backend.service';\nimport type { EmailVerificationInitiatorBackendService } from '~wildo-backend-lib/security/authentications/services/email-verification-initiator.backend.service';\nimport type { WebAuthnBackendService } from '~wildo-backend-lib/security/authentications/services/auth-methods/webauthn.backend.service';\nimport type { PublicKeyCredentialCreationOptionsJSON } from '@simplewebauthn/server';\n\nimport {\n CoreConsumableTokenTypes,\n ConsumableToken_ConsumptionMode,\n CoreResourceType,\n ErrorType,\n ErrorCustomMessageReference,\n EmailTemplateType,\n SystemEmailTemplateRef,\n UserStatus,\n CORE_APP_ROLES,\n AuthMethod,\n AuthNextStep,\n AuthSessionPurpose,\n AuthenticationSessionState,\n isWildoBackendError,\n EmailVerificationMode,\n OrganizationMemberStatus,\n OrganizationMembers_Operations,\n InvitationManagementMode,\n AuthInvitationInfoResponseSchema,\n getEnabledMethods,\n AuthScopeType,\n RegistrationAcquisitionChannel,\n RegistrationMode,\n evaluateUserTypeAcquisition,\n isRegistrationAcquisitionAllowed,\n} from '@wildo-ai/saas-models';\nimport type { User, OrganizationMember, AuthInvitationInfoResponse, UserCredentials, InvitationAcceptCredentialMethod } from '@wildo-ai/saas-models';\nimport { AvailableLanguage, AuthResponseMessageRef } from '@wildo-ai/presets-components-models';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\n\nexport interface RegisterUserParams {\n email: string;\n firstName: string;\n lastName: string;\n password?: string;\n /** W5.5: Org name provided during registration when orgNameSource is 'ask'. */\n organizationName?: string;\n /**\n * How the registrant will authenticate afterwards. Absent ⇒ {@link AuthMethod.PASSWORD}, which is\n * what every caller meant before there was a choice (#463).\n *\n * Only a method the user type lists in `registration.allowedMethods` is accepted, and only\n * PASSWORD, MAGIC_LINK and PASSKEY have a public-signup implementation.\n */\n method?: AuthMethod;\n}\n\nexport interface RegisterUserContext {\n frontendUrl: string;\n ipAddress: string;\n userAgent: string;\n frontendServiceName?: string;\n /** W3.4: Resolved from X-Frontend-Service-Name → frontendServices → userType. Determines userTypes and defaultAppRoles on new user. */\n activeUserType?: string;\n}\n\nexport interface VerifyEmailParams {\n token: string;\n email: string;\n ipAddress: string;\n userAgent: string;\n}\n\nexport interface ResendVerificationParams {\n email: string;\n frontendUrl: string;\n ipAddress: string;\n userAgent: string;\n}\n\nexport interface AcceptInvitationParams {\n invitationToken: string;\n password?: string;\n /** Required at acceptance (mirrors registration) — seeds the profile's first/last name. */\n firstName: string;\n lastName: string;\n ipAddress: string;\n userAgent: string;\n /**\n * The first-factor credential the invitee chose to establish (from the multi-method accept\n * screen). Absent intentionally means password-or-none acceptance: set\n * `password` when provided, otherwise activate with no local credential.\n * Only `PASSWORD` / `MAGIC_LINK` / `PASSKEY` are handled\n * here; enterprise-SSO invitees are routed to the IdP authorize flow, not this endpoint. Typed as\n * the DTO-derived subset (not the full `AuthMethod`) so it can never widen past the wire contract.\n */\n credentialMethod?: InvitationAcceptCredentialMethod;\n}\n\n/**\n * Discriminates the two shapes an accept can resolve to. The password / no-password / passkey\n * paths issue a session (the invitation token bootstraps it — a set password or an enrolled\n * passkey is the GO-FORWARD credential, not this session's authenticator); the magic-link path\n * issues NO session — a link is emailed and the session is established when the invitee clicks it.\n */\nexport enum AcceptInvitationOutcome {\n /** A session was issued (or is gated behind MFA enrollment) — password / no-password / passkey. */\n SESSION = 'session',\n /** No session; a magic link was minted for the controller to email. */\n MAGIC_LINK_SENT = 'magic-link-sent',\n}\n\n/** Session-issuing accept result (password / no-password / passkey). */\nexport interface AcceptInvitationSessionResult {\n outcome: AcceptInvitationOutcome.SESSION;\n sessionId: string;\n state: string;\n purpose: string;\n nextStep?: string;\n userId?: string;\n accessToken?: string;\n refreshToken?: string;\n expiresIn?: number;\n requiresMFA?: boolean;\n availableEnrollmentMethods?: string[];\n /**\n * PASSKEY-enroll-at-accept: the pre-generated WebAuthn registration challenge. Present ONLY\n * on the passkey path AND only once a session was issued (the frontend runs the ceremony and\n * completes it against the existing authenticated `/auth/passkey/register/verify` route). Omitted\n * on the MFA-gated branch — no session yet, so the invitee enrolls post-MFA via the same route.\n */\n passkeyRegistrationOptions?: PublicKeyCredentialCreationOptionsJSON;\n}\n\n/**\n * Magic-link accept result — carries the minted token back to the controller for email dispatch\n * (the URL needs the request-derived frontend origin, an HTTP-layer concern). The `token` is NEVER\n * serialized to the client; the controller consumes it to send the email and responds with a\n * generic \"check your email\" message (anti-enumeration, identical to `POST /auth/magic-link/send`).\n */\nexport interface AcceptInvitationMagicLinkResult {\n outcome: AcceptInvitationOutcome.MAGIC_LINK_SENT;\n magicLinkDelivery: {\n token: string;\n submissionId?: string;\n email: string;\n userId: string;\n expiresInMinutes?: number;\n };\n}\n\nexport type AcceptInvitationResult = AcceptInvitationSessionResult | AcceptInvitationMagicLinkResult;\n\n/** A pending invitation addressed to the authenticated caller, for the in-app surface. */\nexport interface MyPendingInvitation {\n /** The INVITED membership row id — the accept/reject target (was the invitation id). */\n membershipId: string;\n organizationId: string;\n organizationName?: string;\n roles: string[];\n createdAt?: string;\n}\n\n@injectable()\nexport class AuthRegistrationBackendService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService) private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.AppConfigService) private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.ConsumableTokenService) private readonly consumableTokenService: ConsumableTokenBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthCredentialVerifier) private readonly credentialVerifier: AuthCredentialVerifierBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthTokenIssuer) private readonly tokenIssuer: AuthTokenIssuerBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthUserLookupService) private readonly userLookup: AuthUserLookupBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthResponseHelperService) private readonly authResponseHelper: AuthResponseHelperBackendService,\n @inject(SAAS_SERVICE_TYPES.DomainToOrgLookupService) private readonly domainLookup: DomainToOrgLookupBackendService,\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) private readonly auditLogsService: AuditLogsBackendService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) private readonly servicesRegistryHandler: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.AuthenticationOrchestratorService) private readonly authOrchestrator: AuthenticationOrchestratorBackendService,\n // Guard 3: the ACL-bypassing system reads (invitation list/read across orgs)\n // come from the dedicated, deliberately-injected SystemAccessService — the\n // handler above no longer exposes readAsSystem/listAsSystem. (Appended LAST to\n // keep the test's positional construction stable.)\n @inject(SAAS_SERVICE_TYPES.SystemAccessService) private readonly systemAccessService: SystemAccessBackendService,\n // Invitee-driven invitation REVOKE needs a super-admin EC: the invitee is\n // not an org admin, so the ORG_ADMIN-gated REVOKE runs under a synthesised system\n // context (same pattern as EnterpriseUserProvisioning). Appended LAST to keep the\n // test's positional construction stable. (A dedicated `deleteAsSystem` primitive would\n // be cleaner — noted as a follow-up; today only create/read/list/update AsSystem exist.)\n @inject(SAAS_SERVICE_TYPES.AuthExecutionContextFactory) private readonly authEcFactory: AuthExecutionContextFactoryBackendService,\n // Passkey-enroll-at-accept reuses the shared WebAuthn ceremony service to mint the\n // registration challenge bound to the just-activated invitee. Appended LAST to keep the\n // test's positional construction stable.\n @inject(SAAS_SERVICE_TYPES.WebAuthnService) private readonly webAuthnService: WebAuthnBackendService,\n // Shared EMAIL_VERIFICATION token+email sender (also used by SCIM provisioning). Registration\n // and resend delegate their verification send here so the flow has ONE implementation.\n // Appended LAST to keep the test's positional construction stable.\n @inject(SAAS_SERVICE_TYPES.EmailVerificationInitiatorService) private readonly emailVerificationInitiator: EmailVerificationInitiatorBackendService,\n // Per-org DIRECTORY_PROVISIONING resolution for the invite-accept credential block\n // (Concern B — see `isOrgActivelyDirectoryManaged`). Appended LAST: DI binds by token,\n // but the positional-append convention keeps existing wiring undisturbed.\n @inject(SAAS_SERVICE_TYPES.FeatureResolutionService) private readonly featureResolution: FeatureResolutionBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourcePersistenceUnitOfWorkService)\n private readonly resourcePersistenceUnitOfWork:\n ResourcePersistenceUnitOfWorkBackendService,\n ) {\n this.logDebug = this.logger.debugByType('AuthRegistration');\n this.logger.setDebugTypeLogging('AuthRegistration', false);\n }\n\n /**\n * Invitation-accept DISCOVERY (Phase 1b) — the PUBLIC, NON-consuming read the\n * multi-method accept screen calls to learn what the invited org allows.\n *\n * Distinct from `acceptInvitation` (which CONSUMES the token and mutates state):\n * this only VALIDATES the token (`validateToken` — no consume) and reads. It\n * returns the invitee's email, the org name, the org's available first-factor\n * methods (resolved for the invitee's user type via the ORG-KEYED policy\n * resolver — the invitee's INVITED membership is excluded from the ACTIVE-\n * membership-based `resolveEffectiveAuthPolicy`, hence the org-keyed variant),\n * and the org's identity-management posture:\n * - `scim` → directory-managed; the screen shows an informational state, NO\n * local credential (locked product decision).\n * - `sso` → the org ENFORCES enterprise SSO (an org-SSO method is available\n * and PASSWORD is not) — route the invitee to the IdP (JIT consumes the invite).\n * - `open` → full method chooser.\n *\n * `managementMode` (incl. SSO-enforced) is derived from the resolved POLICY.\n * SSO-org invitees get enriched ORG_SAML/ORG_OPENID_CONNECT entries (per-connection\n * `ssoIds`/`config`), resolved via an org-keyed SSO lookup (`buildLookupForScope`) —\n * identical to `identify()`, but keyed by the invitation's `organizationId` instead\n * of an email domain.\n *\n * PASSKEY, if policy-enabled, appears as an ENROLL-at-accept option — NOT a login of\n * an existing credential — so `identify()`'s no-enrolled-credential filter\n * deliberately does not apply here; the frontend renders it disabled until the\n * passkey-enroll-at-accept backend (Phase 3) lands.\n */\n async getInvitationInfo(\n ec: ExecutionContext<any>,\n invitationToken: string,\n ): Promise<AuthInvitationInfoResponse> {\n // 1. Validate the token WITHOUT consuming it (accept consumes; discovery must not).\n // NO TOKEN ORACLE + RESIDUAL TIMING CHANNEL: every rejection below throws the SAME uniform\n // `INVITATION_NO_LONGER_VALID`; the fast (validateToken-fail) vs slow (membership-read) timing\n // residual is ASSESSED WONTFIX. See the canonical rationale on `acceptInvitation` (review FU-4/5/6)\n // before adding a per-cause message or a constant-time \"fix\" here.\n let tokenResult;\n try {\n tokenResult = await this.consumableTokenService.validateToken(\n invitationToken,\n [CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION],\n );\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const membershipId = tokenResult.relatedId;\n if (!membershipId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n // 2. Read the INVITED membership (mirrors acceptInvitation). The invite IS the\n // membership in the junction model; the token's relatedId points at it.\n const membership = await this.servicesRegistryHandler.read<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS, ec, { _id: membershipId },\n );\n if (!membership || membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const organizationId = membership.organizationId;\n const inviteeEmail = (membership.userEmail ?? '').toLowerCase();\n\n // 3-4. Org join-context (display name + type + org-join user type) via the SHARED resolver —\n // one system-access-door read (`readAsSystem(ORGANIZATIONS, { _id })`; the endpoint runs\n // under an UNAUTHENTICATED pre-auth EC, so a plain ACL-scoped read would fail-closed). This is\n // the SAME org-join projection `acceptInvitation` uses — single source, no drift. LOAD-BEARING:\n // `orgType` drives the method resolution in step 5, so a failed read empties the method list,\n // not just the name (the resolver degrades name → undefined and org-join type → undefined).\n //\n // Method resolution keys off the org-join user type the accept WILL grant, NOT the invitee's\n // CURRENT types (provisioned `userTypes: []`, grant DEFERRED to INVITED→ACTIVE, so\n // `invitee.userTypes[0]` would be `undefined` → an EMPTY method list). Discovery is\n // ORG-JOIN-FIRST (mirrors the accept-time enablement guard), falling back to an existing\n // invitee's own first type, then undefined.\n const { orgType, orgJoinUserType, organizationName: resolvedOrgName } = await this._resolveOrgJoinUserType(membership);\n const organizationName = resolvedOrgName ?? '';\n const invitee = await this.userLookup.findUserById(ec, membership.userId);\n const resolutionUserType = orgJoinUserType ?? invitee?.userTypes?.[0];\n\n // 5. Available first-factor methods — resolve the policy from the org-join user\n // type + the org TYPE already read in step 3-4. `resolveAuthPolicyForOrgType` is\n // PURE (no ORGANIZATIONS read): the pre-auth `APP_PUBLIC` EC cannot read\n // ORGANIZATIONS, so a per-call org re-read would fail-closed and silently drop\n // the org's auth overrides (SSO-only / password-disabled).\n const resolvedPolicy = resolutionUserType\n ? this.userLookup.resolveAuthPolicyForOrgType(resolutionUserType, orgType)\n : null;\n const invitationPolicy = (\n resolvedPolicy\n && !resolvedPolicy.registration.allowedMethods.includes(\n AuthMethod.PASSWORD,\n )\n )\n ? {\n ...resolvedPolicy,\n authMethodsEnabled: {\n ...resolvedPolicy.authMethodsEnabled,\n [AuthMethod.PASSWORD]: false,\n },\n }\n : resolvedPolicy;\n const enabledMethods = invitationPolicy\n ? getEnabledMethods(invitationPolicy.authMethodsEnabled)\n : new Set<AuthMethod>();\n\n // Enrich org-SSO methods (ORG_SAML/ORG_OPENID_CONNECT) with per-connection\n // ssoIds/config — IDENTICALLY to identify() — by resolving the invite's org SSO\n // connection by ORGANIZATION ID (not email domain). Only when the policy enables an\n // org-SSO method (a non-SSO org pays no extra reads). `buildLookupForScope` reads\n // via the system-access door; a null result (no SSO config/connection) simply drops\n // the SSO methods, as before. (Passing the lookup also lets the OAuth arm honor the\n // org's `oauth2ProviderRestrictions` — resolved via the same ACL-independent door.)\n const orgSsoLookup = (enabledMethods.has(AuthMethod.ORG_SAML) || enabledMethods.has(AuthMethod.ORG_OPENID_CONNECT))\n ? await this.domainLookup.buildLookupForScope(ec, AuthScopeType.ORGANIZATION, organizationId)\n : undefined;\n\n const availableFirstFactorMethods = invitationPolicy\n ? await this.authOrchestrator.buildFirstFactorMethodsForPolicy(ec, invitationPolicy, orgSsoLookup)\n : [];\n\n // 6. Management mode — strongest identity authority wins. SCIM now reflects ACTIVE\n // directory management (DIRECTORY_PROVISIONING feature + a live SCIM token), NOT the\n // org-TYPE mount flag — kept COHERENT with the accept-mutation credential block\n // (AUTH-23 / .claude/plans/scim-vs-auth-authority-axis.md) so the UI never hides the\n // credential chooser for a SCIM-capable-but-not-actually-managed org whose accept\n // WOULD allow a local credential. SSO enforcement is read from the resolved POLICY's\n // enabled methods. This is the LENIENT display path: a token/feature read failure\n // degrades to \"not actively managed\" and lets the MUTATION path be the fail-closed gate.\n let scimEnabled = false;\n try {\n scimEnabled = await isOrgActivelyDirectoryManaged({\n organizationId,\n featureResolution: this.featureResolution,\n systemAccessService: this.systemAccessService,\n });\n } catch {\n scimEnabled = false;\n }\n const hasOrgSso = enabledMethods.has(AuthMethod.ORG_SAML) || enabledMethods.has(AuthMethod.ORG_OPENID_CONNECT);\n const hasPassword = enabledMethods.has(AuthMethod.PASSWORD);\n const managementMode = scimEnabled\n ? InvitationManagementMode.SCIM\n : hasOrgSso && !hasPassword\n ? InvitationManagementMode.SSO\n : InvitationManagementMode.OPEN;\n\n // Validate the response against its schema before returning (matches `identify`).\n // `passwordPolicy` carries the SAME org-merged policy the accept endpoint validates\n // against (`resolveAuthPolicyForOrgType` above), so the chooser's PASSWORD form shows\n // the invitee the org's real requirements. `PasswordPolicyConfig` is field-identical to\n // the DTO's `PasswordPolicyRulesSchema`, so `.parse` carries it through losslessly (and\n // strips any extra keys); absent policy ⇒ `undefined` ⇒ frontend app-level fallback.\n return AuthInvitationInfoResponseSchema.parse({\n inviteeEmail,\n organizationName,\n availableFirstFactorMethods,\n managementMode,\n passwordPolicy: enabledMethods.has(AuthMethod.PASSWORD)\n ? invitationPolicy?.passwordPolicy\n : undefined,\n });\n }\n\n /**\n * User registration.\n * Returns generic success on email collision (anti-enumeration).\n *\n * ## Password-less registration, and the three questions it owed (#463)\n *\n * `params.method` selects how the registrant will authenticate afterwards. PASSWORD is unchanged\n * and is the default. MAGIC_LINK and PASSKEY create the account with NO credential and hand back a\n * magic link; there is no session at signup, because nothing has been proven yet.\n *\n * **Verification.** The link IS the proof — clicking it establishes both the address and the first\n * session, so a magic-link registration cannot reach an authenticated state without verifying. For\n * PASSKEY this is the only available proof: a passkey attests possession of an authenticator and\n * says nothing whatsoever about an email address, and enrolling one needs a session bound to a\n * user, which public signup has no invitation token to stand in for. So a public passkey signup\n * necessarily routes through the link.\n *\n * **Anti-enumeration.** Unchanged and load-bearing: an address already in use returns the same\n * success response and sends nothing. The observable a magic-link signup adds — whether a mail\n * arrives — is exactly the one the existing password flow already exposes through its verification\n * mail, so the surface is not widened. No `userId` is returned for a password-less registration,\n * which the password path does return under DEFERRED: handing an unauthenticated caller an\n * identifier for an account they have not shown they own would be a new disclosure.\n *\n * **Recovery — the question this issue said to settle first, and the design answers it.** A\n * passkey-only account that loses its authenticator is NOT locked out, because the account always\n * has a proven address and the magic link is a standing way in. The registrant requests a link,\n * signs in, and enrolls a replacement passkey through the authenticated route. No separate recovery\n * mechanism was needed, and none was invented — which is the strongest form the answer could take,\n * because a recovery path that exists only for one method is a path nobody maintains.\n *\n * The corollary is worth stating so it is not weakened later: **a passkey-only account must keep a\n * usable email address**, and anything that would let an application disable magic links for a user\n * type while allowing passkey registration would recreate the lockout. That pairing belongs in\n * `registration.allowedMethods` validation the day such a switch exists.\n */\n async registerUser(\n ec: ExecutionContext<any>,\n params: RegisterUserParams,\n ctx: RegisterUserContext,\n ): Promise<{ messageRef: string; message: string; ssoRedirectHint?: boolean; sessionId?: string; state?: string; purpose?: string; nextStep?: string; userId?: string; accessToken?: string; refreshToken?: string; expiresIn?: number }> {\n const { email, firstName, lastName, password, organizationName } = params;\n /*\n * PASSWORD when unstated — every caller predating #463 meant that, and defaulting keeps a\n * registration that omits the field behaving exactly as it did.\n */\n const method = params.method ?? AuthMethod.PASSWORD;\n /*\n * MAGIC_LINK and PASSKEY both establish the account WITHOUT a local credential and prove the\n * address by a link the registrant must click. So neither can issue a session at signup — there\n * is nothing yet to authenticate — and both are handled by one branch below.\n *\n * PASSKEY is that branch plus an enrollment step, and the reason is worth stating because it was\n * the design question this issue said to settle first: a passkey proves possession of an\n * authenticator and says NOTHING about an email address, and enrolling one needs a session bound\n * to a user. Public signup has no invitation token to stand in for that proof. So a passkey\n * registration necessarily routes through an address proof, which is the magic link — and that\n * is also what answers the recovery question, below.\n */\n const isPasswordlessMethod = method === AuthMethod.MAGIC_LINK || method === AuthMethod.PASSKEY;\n const { frontendUrl, ipAddress, userAgent, frontendServiceName, activeUserType } = ctx;\n const successResponse = this.authResponseHelper.getAuthResponse(AuthResponseMessageRef.REGISTRATION_SUCCESS);\n\n this.logDebug('Registration attempt', { email, activeUserType });\n\n // PR 8a (rate-limit unification, Step 5 — Option D / first\n // service-layer lift): the per-domain 50/hour rate-limit\n // (formerly `AUTH_REDIS_KEYS.REGISTER_DOMAIN` keyed on\n // `email.split('@')[1].toLowerCase()`, raw `checkRateLimit`)\n // moved UP to `AuthenticationController.register` as the third\n // declarative `checkPolicy` companion alongside the existing\n // per-email + per-IP buckets. Rationale: rate limits are\n // intrinsically HTTP concerns — bucket keys (email, IP, derived\n // domain) all live at the HTTP layer, the 429 feedback signal\n // (`X-RateLimit-*` + `Retry-After` headers) is HTTP-only, and\n // service contracts must remain free of HTTP types.\n // `RateLimitBackendService` and `AUTH_REDIS_KEYS` imports also\n // removed — domain throttle was their sole consumer in this\n // file. See plan body for the full Option D architectural\n // re-analysis.\n\n // W3.4: Resolve per-user-type auth policy (for registration config, password policy, etc.)\n const userTypeAuthPolicy = activeUserType\n ? this.appConfigService.getUserTypeAuthPolicy(activeUserType)\n : null;\n\n if (frontendServiceName && activeUserType) {\n const userManagement = this.appConfigService.getFrontendServiceUserManagementEntry(frontendServiceName, activeUserType);\n if (userManagement?.register !== true) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n context: {\n // Diagnostic (log-only): AUTHORIZATION strips context at the wire.\n frontendServiceName,\n activeUserType,\n },\n });\n }\n }\n\n const config = this.appConfigService.config;\n\n const registrationConfig = userTypeAuthPolicy?.registration;\n if (!registrationConfig) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n });\n }\n\n // Gate self-service registration through the canonical acquisition matrix. The map below\n // selects only the mode-specific client message; it does not own the allow/deny semantics\n // (that stays with `isRegistrationAcquisitionAllowed`). Typed `Record<RegistrationMode, …>`\n // so a newly added mode cannot ship without deciding its self-service denial message here —\n // the message stays exhaustive alongside the matrix instead of silently defaulting to DISABLED.\n const registrationMode = registrationConfig.mode;\n if (!isRegistrationAcquisitionAllowed(\n registrationMode,\n RegistrationAcquisitionChannel.PUBLIC_SELF_SERVICE,\n )) {\n // OPEN is unreachable here (it is always self-service-allowed) but is listed to satisfy the Record.\n const denialMessageReferenceByMode: Record<RegistrationMode, ErrorCustomMessageReference> = {\n [RegistrationMode.OPEN]: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n [RegistrationMode.INVITATION_ONLY]: ErrorCustomMessageReference.REGISTRATION_INVITATION_ONLY,\n [RegistrationMode.ADMIN_ONLY]: ErrorCustomMessageReference.REGISTRATION_ADMIN_ONLY,\n [RegistrationMode.DISABLED]: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n };\n // `mode` is typed RegistrationMode, but the runtime boundary is untrusted (an unparsed config\n // object can carry no/unknown mode — the same stance `isRegistrationAcquisitionAllowed` takes),\n // so fall back to the generic denial message rather than emitting an undefined reference.\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference:\n denialMessageReferenceByMode[registrationMode] ?? ErrorCustomMessageReference.REGISTRATION_DISABLED,\n });\n }\n\n // Resolve organization creation once, before authorization and adapter\n // selection. The same immutable plan drives prospective grants and writes.\n const configuredOrganizationTypes = this.appConfigService.isInitialized()\n ? config.organizationTypes\n : undefined;\n const orgCreationPlan = activeUserType\n ? resolveOrgCreationOnRegistrationPlan({\n userEmail: email.toLowerCase(),\n activeUserType,\n organizationName,\n organizationTypes: configuredOrganizationTypes,\n })\n : {\n mode: OrgCreationOnRegistrationPlanMode.NONE,\n } as const;\n if (orgCreationPlan.mode === OrgCreationOnRegistrationPlanMode.INVALID) {\n if (\n orgCreationPlan.reason\n === OrgCreationOnRegistrationPlanInvalidReason\n .MISSING_REQUIRED_ORGANIZATION_NAME\n ) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.ORG_NAME_REQUIRED,\n context: {\n organizationType: orgCreationPlan.orgType,\n },\n });\n }\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n reason:\n 'registration_user_type_has_ambiguous_organization_creation_policy',\n activeUserType,\n matchingOrgTypes: orgCreationPlan.matchingOrgTypes,\n },\n });\n }\n\n // Synchronous and deferred creation both later grant the selected\n // organization type's user types, so authorize those prospective additions\n // before any user/org/member mutation.\n const plannedOrganizationType =\n orgCreationPlan.mode === OrgCreationOnRegistrationPlanMode.NONE\n ? undefined\n : configuredOrganizationTypes?.[orgCreationPlan.orgType];\n const automaticOrgGrantAcquisition = evaluateUserTypeAcquisition(\n this.appConfigService.isInitialized() ? config.userTypes : undefined,\n plannedOrganizationType?.userTypes ?? [],\n activeUserType ? [activeUserType] : [],\n RegistrationAcquisitionChannel.PUBLIC_SELF_SERVICE,\n );\n if (!automaticOrgGrantAcquisition.allowed) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.REGISTRATION_DISABLED,\n context: {\n channel: RegistrationAcquisitionChannel.PUBLIC_SELF_SERVICE,\n deniedUserTypes: automaticOrgGrantAcquisition.deniedUserTypes,\n },\n });\n }\n\n const allowedMethods = registrationConfig.allowedMethods;\n // The requested method, not a hardcoded PASSWORD. An application that lists only MAGIC_LINK now\n // refuses a password signup, which is the point of the list.\n if (!allowedMethods.includes(method)) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_METHOD_NOT_SUPPORTED,\n context: { method, allowedMethods },\n });\n }\n\n /*\n * The credential the method requires, and ONLY for the method that requires one. A password sent\n * alongside `method: MAGIC_LINK` is ignored rather than refused: the registrant's client may\n * carry a stale field, and refusing would fail a signup for a value that changes nothing.\n */\n if (method === AuthMethod.PASSWORD) {\n if (!password) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference:\n ErrorCustomMessageReference.REGISTRATION_PASSWORD_REQUIRED,\n });\n }\n const passwordPolicy = userTypeAuthPolicy?.passwordPolicy;\n const policyValidation =\n this.credentialVerifier.validatePasswordPolicy(\n password,\n passwordPolicy,\n );\n if (!policyValidation.valid) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference:\n ErrorCustomMessageReference\n .VALIDATION_PASSWORD_POLICY_VIOLATION,\n context: {\n violations: policyValidation.violations,\n minLength: passwordPolicy?.minLength,\n maxLength: passwordPolicy?.maxLength,\n },\n });\n }\n }\n\n const existing = await this.userLookup.findUserByEmail(ec, email);\n if (existing) {\n this.logDebug('Registration: email already in use, returning success to prevent enumeration', { email });\n return successResponse;\n }\n\n // W2.7: Block self-registration for SSO-managed domains.\n if (registrationConfig.blockForSSODomains) {\n const domain = email.split('@')[1];\n if (domain) {\n const domainResult = await this.domainLookup.findOrgByDomain(ec, domain);\n if (domainResult?.enforcement?.requireSSO) {\n this.logDebug('Registration blocked: SSO-enforced domain', { email, domain });\n return { ...successResponse, ssoRedirectHint: true };\n }\n }\n }\n\n // Undefined for a password-less method, which the persistence request already understands:\n // `includeCredentials: passwordHash !== undefined` below was written for exactly this shape.\n const passwordHash = method === AuthMethod.PASSWORD && password\n ? await this.credentialVerifier.hashPassword(password, config.auth.passwordHashing)\n : undefined;\n\n // W2.6: Email verification mode — DEFERRED creates user as ACTIVE immediately.\n const isDeferredVerification = registrationConfig.emailVerification === EmailVerificationMode.DEFERRED;\n\n /*\n * A PASSWORD-LESS registrant is created ACTIVE whatever the verification mode says, and the\n * status is what makes the flow work at all (#463).\n *\n * `verifyMagicLink` REFUSES any non-ACTIVE user (generically, as an invalid link — the status is\n * recorded in the audit trail rather than told to the caller). So a magic-link or passkey\n * registrant created `PENDING_VERIFICATION` would be sent a link that is rejected the moment they\n * click it — an account reachable by nobody, created by the flow meant to reach it. The\n * invitation-accept path already does exactly this: it ACTIVATES the invitee and only then mints\n * the link.\n *\n * ACTIVE here does not mean \"access granted\". A password-less account holds no credential, so\n * possession of the emailed link is the ONLY way in, and clicking it is what proves the address.\n * The status gate and the verification gate are not the same gate, and conflating them is what\n * makes this look wrong at first glance.\n *\n * Recorded because the first version of this code had it exactly inverted — it forced\n * `PENDING_VERIFICATION` reasoning that \"an ACTIVE account with an unproven address is worse\",\n * which reads well and would have shipped a flow that could not complete.\n */\n const initialStatusForMethod = isPasswordlessMethod\n ? UserStatus.ACTIVE\n : (isDeferredVerification ? UserStatus.ACTIVE : UserStatus.PENDING_VERIFICATION);\n const initialStatus = initialStatusForMethod;\n\n // W3.4: Resolve userTypes and defaultAppRoles from the active user type definition\n const userTypes = activeUserType ? [activeUserType] : [];\n const userTypeDefinition = activeUserType\n ? config.userTypes?.[activeUserType]\n : undefined;\n const defaultAppRoles = userTypeDefinition?.defaultAppRoles ?? [CORE_APP_ROLES.APP_USER];\n let newUser: User;\n let pendingOrgType: string | undefined;\n try {\n const registrationPersistence =\n await this.resourcePersistenceUnitOfWork.executeTransaction(\n createSelfRegistrationPersistenceRequest({\n includeCredentials: passwordHash !== undefined,\n includeSynchronousOrganizationCreation:\n orgCreationPlan.mode\n === OrgCreationOnRegistrationPlanMode.SYNCHRONOUS,\n }),\n async serviceOptions => {\n const createdUser = await this.servicesRegistryHandler.create<User>(\n CoreResourceType.USERS,\n ec,\n {\n email: email.toLowerCase(),\n status: initialStatus,\n appRoles: defaultAppRoles,\n userTypes,\n },\n {\n ...serviceOptions,\n // `defaultAppRoles` is resolved from the ACTIVE USER-TYPE CONFIGURATION\n // (`userTypeDefinition.defaultAppRoles ?? [APP_USER]`) — it is never read from the signup\n // payload. Declaring it server-injected is what tells the `users | create` role-ceiling\n // gate not to measure it against the caller, whose roles here are `APP_PUBLIC` by\n // definition: an anonymous registrant cannot \"hold\" the role self-registration grants\n // them. Without this the gate denied every signup with `role_ceiling_exceeded`.\n //\n // This does NOT weaken the gate. `users | create` stays `APP_ADMIN_SUPER_ADMIN`-gated as\n // an API operation, and a genuine client call still has its authored `appRoles` measured\n // — `preserveServerInjectedFields` is a trusted-server option that no client payload can\n // reach. Sign-up is a different mechanism from administrative user creation, and this is\n // the seam that says so.\n preserveServerInjectedFields: [\n ...(serviceOptions?.preserveServerInjectedFields ?? []),\n 'appRoles',\n ],\n },\n );\n\n if (passwordHash) {\n await this.systemAccessService.createAsSystem(\n CoreResourceType.USER_CREDENTIALS,\n {\n userId: createdUser._id,\n passwordHash,\n },\n serviceOptions,\n );\n }\n\n let deferredOrgType: string | undefined;\n if (activeUserType && this.appConfigService.isInitialized()) {\n const organizationTypes = this.appConfigService.config.organizationTypes;\n const orgResult = await createOrgOnRegistration(ec, {\n userId: createdUser._id,\n userEmail: createdUser.email,\n activeUserType,\n organizationName,\n organizationTypes,\n servicesRegistryHandler: this.servicesRegistryHandler,\n systemAccessService: this.systemAccessService,\n serviceOptions,\n plan: orgCreationPlan,\n });\n if (orgResult.pendingOnboarding) {\n deferredOrgType = orgResult.orgType;\n }\n }\n return { createdUser, deferredOrgType };\n },\n {\n // Tier-2 input-derived composition seed: the profile fields\n // originate outside the USERS payload. The service layer queues the\n // profile seed on this unit of work and emits it only after commit.\n compositionSeedRequestInput: {\n firstName,\n lastName,\n displayName: `${firstName} ${lastName}`,\n },\n },\n );\n newUser = registrationPersistence.createdUser;\n pendingOrgType = registrationPersistence.deferredOrgType;\n } catch (createError: any) {\n if (\n (isWildoBackendError(createError) && createError.statusCode === 409)\n || createError?.code === 11000\n || createError?.message?.includes('duplicate key')\n || createError?.message?.includes('E11000')\n ) {\n // A duplicate from USERS.email is the expected concurrent-registration\n // race and must retain the anti-enumeration response. A duplicate from a\n // different participant (for example an organization slug) is a real\n // failure; treating every 409 as an email race would silently discard a\n // valid registration attempt.\n const winningUser = await this.userLookup.findAnyUserByEmail(\n ec,\n email,\n );\n if (winningUser) {\n this.logDebug(\n 'Registration: concurrent email registration won, returning anti-enumeration success',\n {\n email,\n winningUserId: winningUser._id,\n },\n );\n return successResponse;\n }\n }\n throw createError;\n }\n\n // USER_PROFILES is now seeded declaratively by the USERS→USER_PROFILES\n // `onParentCreate` composition lifecycle (input threaded via\n // `compositionSeedRequestInput` on the create above), replacing the former\n // best-effort hand-seed here. The seed is idempotent (unique `userId` index)\n // and swallow-on-failure, so registration is never blocked by a profile write.\n\n if (pendingOrgType) {\n this.logDebug('Org creation deferred to onboarding', {\n userId: newUser._id,\n orgType: pendingOrgType,\n });\n }\n\n // W2.6: Only send verification email when emailVerification !== DEFERRED. Delegated to the\n // shared initiator (one implementation across registration / resend / SCIM provisioning).\n // Not for a password-less registration: the magic link below IS the address proof, and a second\n // \"confirm your address\" mail arriving beside it asks the registrant to do the same thing twice\n // through a link that grants less.\n if (!isDeferredVerification && !isPasswordlessMethod) {\n await this.emailVerificationInitiator.sendVerificationEmail({\n userId: newUser._id,\n email: newUser.email,\n firstName,\n frontendBaseUrl: frontendUrl,\n });\n }\n\n this.auditLogsService.logUserRegistered({ userId: newUser._id, email: newUser.email, ipAddress, userAgent }, ec).catch(() => {});\n\n /*\n * PASSWORD-LESS REGISTRATION (#463) — the account exists, holds no credential, and its address is\n * still unproven. A magic link is what closes both: clicking it proves the address AND\n * establishes the first session.\n *\n * No session, no tokens and no `userId` are returned. That is not caution, it is the only honest\n * answer: nothing has been proven yet, and returning a `userId` here would hand an unauthenticated\n * caller a fact about an account they have not shown they own.\n *\n * No separate verification mail is sent: this link IS the address proof, and a second \"confirm\n * your address\" message beside it would ask the registrant to do the same thing twice through a\n * link that grants less.\n */\n if (isPasswordlessMethod) {\n /*\n * PASSKEY only: the WebAuthn challenge and the later verify both require a USER_CREDENTIALS row\n * to exist, and a brand-new registrant has none. Provisioned here for the same reason and in the\n * same non-fatal way as the invitation-accept path — a failure must not strand an account that\n * has already been created, and the registrant can still enroll later through the authenticated\n * route once the magic link has let them in.\n */\n if (method === AuthMethod.PASSKEY) {\n try {\n await this._ensurePasswordlessCredentialRecord(ec, newUser._id);\n } catch (error) {\n this.logger.error('Password-less credential row provisioning failed at passkey registration (non-fatal)', {\n userId: newUser._id,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n /*\n * `skipGlobalEnablementCheck: true`, for the reason the invitation path records: the method was\n * already authorized above against this user type's own `registration.allowedMethods`, and we\n * are PAST the account creation. Re-rejecting on `sendMagicLink`'s coarser base-policy gate\n * would strand an account that now exists and has no other way in.\n */\n const magic = await this.authOrchestrator.sendMagicLink(\n ec,\n { email: newUser.email },\n { ipAddress, userAgent },\n true,\n );\n\n this.logDebug('Password-less registration completed — magic link minted for delivery', {\n userId: newUser._id,\n method,\n // Diagnostic only: an absent token is the anti-enumeration no-op, which cannot happen for an\n // account we have just created and activated-by-construction, so its absence is worth seeing.\n hasToken: Boolean(magic.token),\n });\n\n return {\n ...successResponse,\n /*\n * The registrant's next act differs by method and the client cannot infer it: a magic-link\n * signup is finished once they click, a passkey signup has an enrollment step waiting on the\n * other side of the same click.\n */\n nextStep: method === AuthMethod.PASSKEY\n ? AuthNextStep.PASSKEY_ENROLLMENT\n : AuthNextStep.MAGIC_LINK_SENT,\n };\n }\n\n // F7 fix: When email verification is deferred, the user is ACTIVE immediately.\n // Process through the registration pipeline (MFA check, etc.) and issue tokens\n // so the user can start using the app without a separate login step.\n if (isDeferredVerification) {\n const pipelineSession = await this.authOrchestrator.processEmailVerification(\n ec, newUser._id, newUser.email, activeUserType,\n { ipAddress, userAgent }, AuthSessionPurpose.REGISTRATION,\n );\n\n if (pipelineSession.state === AuthenticationSessionState.COMPLETED || pipelineSession.state === AuthenticationSessionState.MFA_ENROLLMENT_GRACE) {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(newUser._id, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n\n this.logDebug('Registration completed — deferred verification, tokens issued', { userId: newUser._id });\n return {\n ...successResponse,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: pipelineSession.purpose,\n // Expose `userId` so the controller can transpose anonymous website\n // captures onto this account. Deferred-verification registration\n // issues real tokens right here (immediate login) — the same\n // anonymous→authenticated conversion moment that `verifyEmail()` and\n // `acceptInvitation()` already surface `userId` for.\n userId: newUser._id,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken,\n expiresIn: tokenResult.expiresIn,\n };\n }\n\n this.logDebug('Registration completed — deferred verification, pipeline requires further steps', {\n userId: newUser._id,\n state: pipelineSession.state,\n nextStep: pipelineSession.nextStep,\n });\n return {\n ...successResponse,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: pipelineSession.purpose,\n nextStep: pipelineSession.nextStep,\n };\n }\n\n // W4.1: Create registration session to track the pipeline state (non-deferred)\n const regSession = await this.authOrchestrator.createRegistrationSession(\n newUser._id,\n newUser.email,\n {\n activeUserType,\n purpose: AuthSessionPurpose.REGISTRATION,\n deviceInfo: { ipAddress, userAgent },\n pendingOrgType,\n },\n );\n\n this.logDebug('Registration completed — awaiting email verification', { userId: newUser._id, sessionId: regSession.sessionId });\n return {\n ...successResponse,\n sessionId: regSession.sessionId,\n state: regSession.state,\n purpose: regSession.purpose,\n };\n }\n\n /**\n * W4.1: Consumes EMAIL_VERIFICATION token, activates user, processes through registration pipeline.\n * Instead of issuing tokens directly, creates/resumes an auth session and advances through\n * the pipeline (email verified → MFA check → enrollment/grace/complete).\n * Returns session state with nextStep for frontend routing.\n */\n async verifyEmail(\n ec: ExecutionContext<any>,\n params: VerifyEmailParams,\n ): Promise<{\n userId?: string;\n sessionId: string;\n state: string;\n nextStep?: string;\n accessToken?: string;\n refreshToken?: string;\n expiresIn?: number;\n mfaGraceExpiresAt?: string;\n requiresMFA?: boolean;\n availableEnrollmentMethods?: string[];\n requireStrongMFA?: boolean;\n }> {\n const { token, email: requestEmail, ipAddress, userAgent } = params;\n\n this.logDebug('Email verification attempted');\n\n let consumedToken;\n try {\n consumedToken = await this.consumableTokenService.consumeToken(token);\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n if (consumedToken.tokenType !== CoreConsumableTokenTypes.EMAIL_VERIFICATION) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const userId = consumedToken.userId || consumedToken.relatedId;\n if (!userId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const metadata = consumedToken.metadata as Record<string, unknown> | undefined;\n const metadataEmail = metadata?.email as string | undefined;\n\n if (!metadataEmail) {\n this.logger.warn('Email verification token metadata missing email — data integrity issue', { userId });\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const tokenEmailBuf = Buffer.from(metadataEmail.toLowerCase());\n const requestEmailBuf = Buffer.from(requestEmail.toLowerCase());\n if (tokenEmailBuf.length !== requestEmailBuf.length || !crypto.timingSafeEqual(tokenEmailBuf, requestEmailBuf)) {\n this.logger.warn('Email verification email mismatch — possible URL tampering', { userId, requestEmail });\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_INVALID_TOKEN,\n });\n }\n\n const user = await this.servicesRegistryHandler.read<User>(CoreResourceType.USERS, ec, userId);\n\n if (!user) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_USER_NOT_FOUND,\n });\n }\n\n if (user.status === UserStatus.ACTIVE) {\n this.logDebug('Email verification: user already active', { userId });\n } else if (user.status !== UserStatus.PENDING_VERIFICATION) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.ACCOUNT_ACTIVATION_NOT_ALLOWED,\n });\n } else {\n // `status` is `.excludeFromUpdate()` — the client-facing UPDATE contract cannot carry it, so\n // a handler write is stripped by the repository's strict re-parse and the account would never\n // activate, with no error. The system door re-attaches it. Deliberately NOT a lifecycle verb:\n // activation here follows from a confirmed email, not an administrative decision.\n await this.systemAccessService.updateAsSystem(CoreResourceType.USERS, userId, { status: UserStatus.ACTIVE });\n this.logDebug('User activated via email verification', { userId });\n }\n\n await this.consumableTokenService.revokeTokensByRelatedId(userId, CoreConsumableTokenTypes.EMAIL_VERIFICATION);\n\n this.auditLogsService.logUserEmailVerified({ userId: user._id, email: user.email, ipAddress, userAgent }, ec).catch(() => {});\n\n // W4.1: Process through registration pipeline instead of direct token issuance.\n // Resolve activeUserType from user's userTypes (first entry, if any).\n const activeUserType = user.userTypes?.[0] ?? undefined;\n const session = await this.authOrchestrator.processEmailVerification(\n ec,\n user._id,\n user.email,\n activeUserType,\n { ipAddress, userAgent },\n );\n\n this.logDebug('Email verification complete — pipeline advanced', { userId, state: session.state, nextStep: session.nextStep });\n\n // If pipeline completed (no MFA required), issue tokens\n if (session.state === 'COMPLETED' || session.state === 'MFA_ENROLLMENT_GRACE') {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(user._id, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n return {\n userId,\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep ?? AuthNextStep.COMPLETE,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken ?? '',\n expiresIn: tokenResult.expiresIn ?? 3600,\n mfaGraceExpiresAt: session.mfaGraceExpiresAt,\n };\n }\n\n // MFA enrollment required — return session info for frontend to route to enrollment\n return {\n userId,\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep ?? AuthNextStep.MFA_ENROLLMENT,\n requiresMFA: session.requiresMFA,\n availableEnrollmentMethods: session.availableEnrollmentMethods,\n requireStrongMFA: session.requireStrongMFA,\n };\n }\n\n /**\n * Resend verification email. Returns generic success (anti-enumeration).\n */\n async resendVerificationEmail(\n ec: ExecutionContext<any>,\n params: ResendVerificationParams,\n ): Promise<{ messageRef: string; message: string }> {\n const { email, frontendUrl, ipAddress, userAgent } = params;\n const successResponse = this.authResponseHelper.getAuthResponse(AuthResponseMessageRef.RESEND_VERIFICATION_SUCCESS);\n\n this.logDebug('Resend verification email requested', { email });\n\n try {\n const user = await this.userLookup.findAnyUserByEmail(ec, email);\n\n if (!user || user.status !== UserStatus.PENDING_VERIFICATION) {\n this.logDebug('Resend verification: user not found or not PENDING_VERIFICATION, returning generic success', { email });\n return successResponse;\n }\n\n // Delegated to the shared initiator (revokes the stale token + mints a fresh one + sends).\n await this.emailVerificationInitiator.sendVerificationEmail({\n userId: user._id,\n email: user.email,\n frontendBaseUrl: frontendUrl,\n revokeExisting: true,\n });\n\n this.auditLogsService.logUserVerificationEmailResent({ userId: user._id, email: user.email, ipAddress, userAgent }).catch(() => {});\n } catch (error) {\n if (isWildoBackendError(error)) throw error;\n this.logger.error('Unexpected error during resend verification email', {\n ...projectCaughtErrorLogFields(error),\n });\n }\n\n return successResponse;\n }\n\n /**\n * W4.4: Accept an organization member invitation.\n *\n * The token→membership→user resolution, the INVITED→ACTIVE flip (via the shared\n * `applyInvitationAcceptanceCore`), and the org-join user-type grant are IDENTICAL across every\n * `credentialMethod`; only the credential step + session issuance differ:\n *\n * - **`PASSWORD` / absent**: set the password if one was provided, else\n * intentionally activate with no local credential. The invitation token bootstraps a session (tokens issued unless\n * MFA enrollment gates them).\n * - **`MAGIC_LINK`**: activate with no local credential, then mint + email a magic link (reusing\n * `AuthenticationOrchestrator.sendMagicLink`). NO session is issued here — the invitee clicks the\n * link and the existing `verifyMagicLink` establishes the session. Returns `MAGIC_LINK_SENT`.\n * - **`PASSKEY`**: enroll a NEW WebAuthn credential. The invitation token bootstraps the session\n * exactly like the password path (a passkey, like a password, is the GO-FORWARD credential — not\n * this session's authenticator); the pre-generated registration challenge rides back on the\n * result and the frontend completes the ceremony against the existing authenticated\n * `/auth/passkey/register/verify` route.\n *\n * `MAGIC_LINK` / `PASSKEY` are fail-closed against the invited org's effective auth policy (a\n * method the org disabled is rejected — never trust the client's choice).\n *\n * The effective user type governing the password + MFA policies is resolved by\n * `_resolveOrgJoinUserType` with deliberately split precedence (OWN-first for the pipeline,\n * ORG-JOIN-first for the method-enablement guard) — see that helper for the rationale.\n */\n async acceptInvitation(\n ec: ExecutionContext<any>,\n params: AcceptInvitationParams,\n ): Promise<AcceptInvitationResult> {\n const { invitationToken, password, firstName, lastName, ipAddress, userAgent, credentialMethod } = params;\n\n // 1. VALIDATE the invitation token — do NOT consume it yet. The consume is DEFERRED to the\n // point of no return (just before the first mutation, below) so a validation failure —\n // a non-INVITED membership, a locked user status, a disabled credential method, a weak\n // password — does NOT spend the single-use token and strand the invitee (who could\n // otherwise never retry the same link). The deferred `consumeToken` is also the\n // concurrency guard: a racing second accept of the same token fails there, before mutating.\n //\n // NO TOKEN ORACLE (review FU-4/FU-5, finding #5 — TREATED): every unusable-invitation rejection on\n // the THREE PUBLIC token-based endpoints (`getInvitationInfo`, `acceptInvitation`, `rejectInvitation`)\n // throws the SAME `ErrorType.AUTHENTICATION` with the SAME `INVITATION_NO_LONGER_VALID` reference —\n // deliberately UNIFORM, regardless of cause (unrecognised / expired / already-consumed token, wrong\n // token type, missing invitation reference, non-INVITED membership, orphaned membership, or a revoke\n // that raced the accept). Rationale: a `customMessageReference` is a TOP-LEVEL field that SURVIVES\n // `sanitizeErrorForClient` (which strips `context` for AUTHENTICATION errors), so a per-cause\n // reference IS client-visible and would let a token holder distinguish \"unrecognised token\" from\n // \"recognised-but-superseded invite\". The status code is already uniform (AUTHENTICATION), so the\n // reference was the last distinguishing signal.\n //\n // Keep the granular cause in the LOGS (the throw site + surrounding `logDebug`), NEVER in the\n // reference. DO NOT re-split this into per-cause references — that re-opens the oracle. The\n // AUTHENTICATED in-app paths (`acceptMyInvitation` / `loadOwnedPendingInvitation`) MAY stay granular:\n // they are gated by userId-ownership rather than token possession, so they leak nothing.\n //\n // RESIDUAL TIMING CHANNEL (review FU-6 — ASSESSED, WONTFIX): the uniform error closes the MESSAGE\n // oracle but not a TIMING one. An unrecognised/expired/consumed token fails FAST at `validateToken`\n // (one indexed `findOne({ token })`, no membership read); a token that PASSES `validateToken` but\n // whose membership is non-INVITED does the extra `ORGANIZATION_MEMBERS` read before the IDENTICAL\n // rejection — so response latency can distinguish the two branches. This is deliberately NOT\n // equalized, and MUST NOT be \"fixed\" with a compensating read or a normalizing delay. Reason: the\n // branch bit is observable ONLY by presenting a token that passes `validateToken`, and the token is a\n // 256-bit crypto-random single-use secret (`crypto.randomBytes(32)`) delivered only to the invitee.\n // • An attacker ENUMERATING tokens never reaches the slow branch — every probe misses `findOne`, so\n // latency is a CONSTANT (fast) independent of any server-side secret → zero bits leaked (and the\n // endpoints are per-IP rate-limited, blunting the many-sample averaging a network timing attack\n // needs). The channel cannot even be actuated without the token.\n // • A LEGITIMATE holder only ever learns the state of THEIR OWN invite (INVITED vs consumed/\n // superseded/orphaned) — which they already possess and the endpoint reports anyway.\n // The channel is therefore SELF-REFERENTIAL (its only output is a fact about the very token you had to\n // already hold to read it) — NOT a cross-user / cross-tenant oracle, unlike a password/HMAC/account-\n // existence compare where the branch is gated on a SERVER secret the caller is guessing. Constant-time\n // equalization would add real complexity + steady-state DB load to protect a non-secret, and MongoDB\n // read latency is itself too high-variance (cache warmth, working-set residency, pool contention, GC)\n // to actually flatten the distribution — while risking a NEW leak via metrics/traces. See the review\n // doc FU-6 for the full weighing. (`acceptInvitation`'s deeper rejections — user status, method\n // enablement, password policy — extend this into a GRADUATED profile, but every step past the first is\n // gated behind BOTH a valid token AND a valid INVITED membership, so the whole profile stays\n // self-referential.)\n let tokenResult;\n try {\n tokenResult = await this.consumableTokenService.validateToken(\n invitationToken,\n [CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION],\n );\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n if (tokenResult.tokenType !== CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const invitationId = tokenResult.relatedId;\n if (!invitationId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n // 2. Read the INVITED membership row. In the junction model the invite IS the\n // membership (status INVITED); the token's `relatedId` points at THIS row.\n const membershipId = invitationId;\n const membership = await this.servicesRegistryHandler.read<OrganizationMember>(CoreResourceType.ORGANIZATION_MEMBERS, ec, { _id: membershipId });\n if (!membership || membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const organizationId = membership.organizationId;\n const invitationEmail = (membership.userEmail ?? '').toLowerCase();\n\n // 3. Resolve the invitee user. The invite eagerly provisioned it (PENDING_INVITATION if\n // brand-new, or an existing account), so `membership.userId` always resolves.\n let user = await this.userLookup.findUserById(ec, membership.userId);\n if (!user) {\n // Orphaned membership (user reaped) — surface as an invalid invite, not a 500.\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n // Only a not-yet-activated invitee (PENDING_INVITATION), a pending-verification account,\n // or an already-ACTIVE user may accept. INACTIVE / SUSPENDED / DELETED is a hard stop.\n if (\n user.status !== UserStatus.ACTIVE &&\n user.status !== UserStatus.PENDING_VERIFICATION &&\n user.status !== UserStatus.PENDING_INVITATION\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_USER_NOT_ACTIVE,\n context: { userId: user._id, userStatus: user.status },\n });\n }\n\n // First activation = the invite-provisioned PENDING_INVITATION account claiming its\n // identity for the first time — where password + profile are set. (Also drives the\n // audit auth-method below.)\n const isNewUser = user.status === UserStatus.PENDING_INVITATION;\n\n // CONTRACT (review FU-4, finding F): `firstName` / `lastName` / `password` are applied ONLY on the\n // first-activation branch below (a brand-new invitee). An EXISTING (ACTIVE / PENDING_VERIFICATION)\n // invitee already has a profile, so their submitted names are harmlessly ignored — the invitation\n // token still bootstraps a session (email-possession auth, like a magic link). A submitted PASSWORD\n // is NOT harmless to drop, though: the credential write is gated on `isNewUser`, so an existing\n // user would BELIEVE they set a login credential that was never persisted. REJECT it explicitly\n // rather than silently no-op. The password field is OPTIONAL, so this does NOT block the legitimate\n // existing-user accept — they accept WITHOUT a password and continue with their existing login\n // method (password / SSO / social); a new password can be added later in account settings.\n if (!isNewUser && password) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_EXISTING_ACCOUNT_NO_PASSWORD,\n context: {\n // organizationId is diagnostic (log-only); not in the VALIDATION client allowlist.\n organizationId,\n },\n });\n }\n\n // Resolve the invited org's ORG-JOIN user type ONCE (the type the accept will grant). Its two\n // consumers apply OPPOSITE precedence on purpose (see `_resolveOrgJoinUserType`):\n // • `activeUserType` for the password/MFA pipeline is OWN-FIRST. A brand-new invitee is\n // provisioned with `userTypes: []` (the grant is DEFERRED to activation by\n // `applyInvitationAcceptanceCore` below), so `user.userTypes[0]` is `undefined` and it falls\n // through to the org-join type — closing the weak-password + MFA hole. An EXISTING user keeps\n // their OWN type: a weaker org-join type must NOT re-govern them and silently reset their MFA\n // enrollment state (`_advanceRegistrationPipeline` persists `mfaEnrollmentState → NOT_REQUIRED`\n // when the resolved policy drops the requirement). Org overrides still merge for existing users\n // via `resolveEffectiveAuthPolicy` (which reads the just-activated membership).\n // • the fail-closed method-enablement guard is ORG-JOIN-FIRST — the org's method restrictions\n // must gate the choice even for an existing user (see below).\n const { orgType, orgJoinUserType, orgReadFailed } = await this._resolveOrgJoinUserType(membership);\n const activeUserType = user.userTypes?.[0] ?? orgJoinUserType;\n\n // Fail-closed method-enablement + directory-management enforcement, BEFORE the consume/mutation.\n // `getInvitationInfo` gates the UI, but the accept endpoint must NEVER trust the client — a DIRECT\n // API call could name a method (or set a password) the org disabled, or set a local credential on an\n // actively directory-managed org. So whenever the accept ESTABLISHES A LOCAL CREDENTIAL — a password,\n // an enrolled passkey, or an emailed magic link — enforce BOTH axes:\n // (1) DEPROVISIONING integrity: an ACTIVELY directory-managed org (DIRECTORY_PROVISIONING feature\n // + a live SCIM token — the IdP provisions AND deprovisions, so a local credential would\n // survive deprovisioning) rejects ANY local credential. Re-keyed 2026-07-18 from the org-TYPE\n // `scimProvisioning.enabled` MOUNT flag to this per-org signal (AUTH-23 /\n // .claude/plans/scim-vs-auth-authority-axis.md), which stopped over-blocking password orgs of a\n // SCIM-capable type;\n // (2) AUTH AUTHORITY (SSO): the method must be in the org's effective `authMethodsEnabled`\n // (ORG-JOIN-FIRST, mirroring `getInvitationInfo` — covers PASSWORD too).\n // A password-less activation (no `password`, no `credentialMethod`) sets NO credential and is left\n // open — an SSO/SCIM invitee may activate here and then authenticate via their IdP.\n const establishedCredentialMethod: AuthMethod | undefined =\n credentialMethod === AuthMethod.MAGIC_LINK || credentialMethod === AuthMethod.PASSKEY\n ? credentialMethod\n : (password ? AuthMethod.PASSWORD : undefined);\n if (establishedCredentialMethod) {\n if (orgReadFailed) {\n // The org read FAILED (transient) — its type / `managementMode` and enabled-method set are\n // UNKNOWN. Fail CLOSED: never establish a local credential on an org we could not classify (the\n // downstream directory-management and effective-policy checks below BOTH need a classified org —\n // `_assertInvitationCredentialMethodEnabled` in particular keys on `orgType`). `getInvitationInfo`\n // stays lenient for display; the MUTATION path must not. INTERNAL (retryable) — the invitee can\n // retry once the read recovers; the single-use token is NOT yet consumed at this point.\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_ORG_VERIFICATION_FAILED,\n context: {\n // organizationId is diagnostic (log-only): INTERNAL strips context at the wire.\n // The user-facing text is now localized via the customMessageReference above.\n organizationId,\n },\n });\n }\n // Concern B (deprovisioning integrity): refuse a local credential when the org is\n // ACTIVELY directory-managed. Re-keyed 2026-07-18 (AUTH-23 /\n // .claude/plans/scim-vs-auth-authority-axis.md) from the org-TYPE\n // `scimProvisioning.enabled` MOUNT flag — which over-blocked EVERY org of a\n // SCIM-capable type (stranding password-based test/non-directory orgs) — to the\n // honest per-org signal (DIRECTORY_PROVISIONING feature AND a live SCIM token).\n // Concern A (the org's effective policy disallowing the method) is enforced\n // immediately below by `_assertInvitationCredentialMethodEnabled`.\n let activelyDirectoryManaged: boolean;\n try {\n activelyDirectoryManaged = await isOrgActivelyDirectoryManaged({\n organizationId,\n featureResolution: this.featureResolution,\n systemAccessService: this.systemAccessService,\n });\n } catch (error) {\n // Could not classify the org's directory-management posture (transient read\n // failure). Fail CLOSED exactly like the `orgReadFailed` branch above: throw a\n // RETRYABLE INTERNAL error rather than establish a local credential we might\n // regret. The single-use token is NOT yet consumed, so the invitee can retry.\n this.logger.warn('Failed to resolve directory-management posture at invite-accept', {\n organizationId,\n ...projectCaughtErrorLogFields(error),\n });\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_ORG_VERIFICATION_FAILED,\n context: { organizationId },\n });\n }\n if (activelyDirectoryManaged) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_SCIM_LOCAL_CREDENTIAL_BLOCKED,\n context: {\n // organizationId is diagnostic (log-only): AUTHORIZATION strips context at the wire.\n organizationId,\n },\n });\n }\n // ORG-JOIN-FIRST (opposite of `activeUserType`): the org's method restrictions must gate the\n // choice even for an existing user who carries their own type. Mirrors `getInvitationInfo`.\n const enablementUserType = orgJoinUserType ?? user.userTypes?.[0];\n this._assertInvitationCredentialMethodEnabled(organizationId, orgType, enablementUserType, establishedCredentialMethod);\n }\n\n // Validate the initial password against the ORG-MERGED policy (new invitee setting one) BEFORE\n // consuming the token — a policy rejection must NOT spend the single-use token (else a weak\n // password strands the invitee, unable to retry). `resolveAuthPolicyForOrgType` applies the\n // org's `authOverrides` most-restrictively (consistent with the enablement guard above, the M1\n // discovery policy, and the MFA path), so an org that STRENGTHENS `passwordPolicy` is honored. A\n // brand-new invitee's `activeUserType` IS the org-join type (own `userTypes: []`) so the\n // single-org resolver is exact; an unresolvable type degrades to the schema default\n // (`validatePasswordPolicy(pw, undefined)`).\n if (isNewUser && password) {\n const passwordPolicy = (activeUserType\n ? this.userLookup.resolveAuthPolicyForOrgType(activeUserType, orgType)\n : null)?.passwordPolicy;\n const policyValidation = this.credentialVerifier.validatePasswordPolicy(password, passwordPolicy);\n if (!policyValidation.valid) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION_PASSWORD_POLICY_VIOLATION,\n context: { violations: policyValidation.violations, minLength: passwordPolicy?.minLength, maxLength: passwordPolicy?.maxLength },\n });\n }\n }\n\n // Registration policy is checked before the token point-of-no-return. The shared acceptance\n // core repeats this check immediately before membership mutation for policy drift and for the\n // tokenless/OAuth entry points.\n await assertInvitationUserTypeAcquisitionAllowed({\n user,\n organizationId,\n appConfigService: this.appConfigService,\n errorBuilder: this.errorBuilder,\n systemAccessService: this.systemAccessService,\n });\n\n // Hash outside the transaction: Argon2 is CPU work and must not extend the\n // database lock window. The policy validation above has already succeeded.\n const hashedPassword = isNewUser && password\n ? await this.credentialVerifier.hashPassword(\n password,\n this.appConfigService.config.auth.passwordHashing,\n )\n : undefined;\n\n try {\n user = await this.resourcePersistenceUnitOfWork.executeTransaction(\n createPublicInvitationAcceptancePersistenceRequest({\n includeCredentials: hashedPassword !== undefined,\n }),\n async serviceOptions => {\n // Token consumption, membership activation, user activation, credential\n // persistence, and org-type grants are one commit. Any revoked membership\n // or later write failure rolls the single-use token back to usable state.\n await this.consumableTokenService.consumeToken(\n invitationToken,\n serviceOptions.transaction!,\n );\n\n const currentMembership = await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: membership._id },\n serviceOptions,\n );\n const currentUser = await this.servicesRegistryHandler.read<User>(\n CoreResourceType.USERS,\n ec,\n { _id: user._id },\n serviceOptions,\n );\n if (\n !currentMembership\n || (\n currentMembership.status !== OrganizationMemberStatus.INVITED\n && currentMembership.status !== OrganizationMemberStatus.ACTIVE\n )\n || currentMembership.userId !== user._id\n || !currentUser\n || currentUser.status !== user.status\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n if (hashedPassword) {\n const existingCredential = await this.servicesRegistryHandler.read<UserCredentials>(\n CoreResourceType.USER_CREDENTIALS,\n ec,\n { userId: currentUser._id },\n serviceOptions,\n );\n if (existingCredential) {\n await this.credentialVerifier.updatePasswordHash(\n ec,\n currentUser._id,\n hashedPassword,\n serviceOptions,\n );\n } else {\n await this.systemAccessService.createAsSystem(\n CoreResourceType.USER_CREDENTIALS,\n {\n userId: currentUser._id,\n passwordHash: hashedPassword,\n },\n serviceOptions,\n );\n }\n }\n\n let activatedUser = currentUser;\n if (\n currentUser.status === UserStatus.PENDING_INVITATION\n || currentUser.status === UserStatus.PENDING_VERIFICATION\n ) {\n // SYSTEM door, not the handler: `status` is `.excludeFromUpdate()`, so the client-facing\n // UPDATE contract cannot carry it and the repository's strict re-parse STRIPS it from a\n // handler write. The row still comes back — the filter matched — so the write reports\n // success while persisting nothing, and the invitee is left PENDING_INVITATION.\n //\n // That silence is what made this expensive to find. Nothing threw; `accept` answered 200;\n // and the failure surfaced two steps later as a magic link that was never emailed, because\n // `sendMagicLink` resolves the user BY EMAIL and takes its anti-enumeration no-op when that\n // user is not ACTIVE. An e2e scenario reported \"no email arrived\" for a defect three hops\n // upstream.\n //\n // The sibling activation (email verification, ~line 900) was moved to the system door on\n // 2026-08-06; this call site was missed, which is the failure shape\n // `.claude/rules/invariant-call-site-enumeration.md` exists to catch — the invariant is\n // \"a `status` write goes through the system door\", and it holds at every site or none.\n //\n // The compare-and-swap is PRESERVED: the filter still pins the status observed above, so a\n // concurrent activation still loses the race and is still refused below rather than\n // blind-overwriting.\n const updated = await this.systemAccessService.updateAsSystem<User>(\n CoreResourceType.USERS,\n { _id: currentUser._id, status: currentUser.status },\n { status: UserStatus.ACTIVE },\n serviceOptions,\n );\n if (!updated) {\n throw this.errorBuilder.buildError(ErrorType.CONFLICT, undefined, {\n context: {\n reason: 'invitation_user_activation_race_lost',\n userId: currentUser._id,\n },\n });\n }\n activatedUser = updated;\n }\n\n const { membershipActivated } = await applyInvitationAcceptanceCore(ec, {\n membership: currentMembership,\n user: activatedUser,\n appConfigService: this.appConfigService,\n errorBuilder: this.errorBuilder,\n servicesRegistryHandler: this.servicesRegistryHandler,\n systemAccessService: this.systemAccessService,\n serviceOptions,\n logDebug: this.logDebug,\n });\n if (!membershipActivated) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n return activatedUser;\n },\n );\n } catch (error) {\n this.logger.warn('Invitation acceptance transaction rolled back', {\n membershipId: membership._id,\n userId: user._id,\n organizationId,\n ...(isWildoBackendError(error)\n ? {\n errorType: error.type,\n errorStatusCode: error.statusCode,\n errorContext: error.context,\n }\n : {\n errorMessage: describeCaughtError(error),\n }),\n });\n // Preserve the public no-oracle contract for expected token/state races,\n // but never relabel infrastructure, database, or configuration failures\n // as an invalid invitation. Those failures are retryable/operator-actionable\n // and masking them would strand a valid invite behind a false 401.\n if (\n isWildoBackendError(error)\n && (\n error.type === ErrorType.AUTHENTICATION\n || error.type === ErrorType.CONFLICT\n )\n ) {\n throw this.errorBuilder.buildError(\n ErrorType.AUTHENTICATION,\n undefined,\n {\n customMessageReference:\n ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n },\n );\n }\n throw error;\n }\n\n if (isNewUser) {\n // Profile enrichment is not an authorization precondition. It runs only\n // after the durable acceptance commit and remains idempotent/best-effort.\n try {\n await this.systemAccessService.createAsSystem(CoreResourceType.USER_PROFILES, {\n userId: user._id,\n firstName,\n lastName,\n displayName: `${firstName} ${lastName}`,\n });\n } catch (profileError) {\n this.logger.error('Failed to create user profile during invitation acceptance (non-fatal)', {\n userId: user._id,\n ...projectCaughtErrorLogFields(profileError),\n });\n }\n this.logDebug('Invitee account activated via invitation acceptance', {\n userId: user._id,\n organizationId,\n });\n }\n\n // MAGIC_LINK path — the invitee established NO local credential and gets NO session here.\n // Mint a magic link (reusing the shared token machinery, `sendMagicLink`) bound to the\n // just-activated invitee and hand it back for the controller to email. `sendMagicLink`\n // resolves the user BY EMAIL — which now resolves to THIS ACTIVE account — so the token's\n // `relatedId` IS the invitee's userId and its `metadata.email` the invitee email; the eventual\n // `verifyMagicLink` click (which hard-rejects non-ACTIVE users) establishes the session. No\n // login is audited here: `sendMagicLink` audits the send, `verifyMagicLink` audits the login.\n if (credentialMethod === AuthMethod.MAGIC_LINK) {\n // `skipGlobalEnablementCheck: true` — MAGIC_LINK was ALREADY authorized above against the\n // invited org's precise, org-EXPANDED policy (`_assertInvitationCredentialMethodEnabled`). We\n // are PAST the mutations (activate + membership flip + token consume), so `sendMagicLink` must\n // NOT re-reject on its coarse base-policy global gate — that would strand the just-activated\n // invitee (see the reconciliation note on `sendMagicLink`).\n const magic = await this.authOrchestrator.sendMagicLink(ec, { email: invitationEmail }, { ipAddress, userAgent }, true);\n this.logDebug('Invitation accepted via magic link — link minted for delivery', { userId: user._id, organizationId });\n return {\n outcome: AcceptInvitationOutcome.MAGIC_LINK_SENT,\n magicLinkDelivery: {\n // Empty only in the (post-activation) anti-enumeration no-op — the controller then\n // simply sends no email; the invitee we just activated always resolves to a token.\n token: magic.token ?? '',\n submissionId: magic.submissionId,\n email: invitationEmail,\n userId: user._id,\n expiresInMinutes: magic.expiresInMinutes,\n },\n };\n }\n\n // PASSKEY path — the invitee will enroll a NEW WebAuthn credential. `passkeyCredentials` live on\n // the USER_CREDENTIALS document, and both the challenge generation below and the later verify\n // require that row to EXIST — so ensure a password-less row now (a brand-new invitee has none;\n // an existing user may already have one). Runs on BOTH the token-issued and MFA-gated branches so\n // a post-MFA enrollment via the existing authenticated route also finds the row.\n if (credentialMethod === AuthMethod.PASSKEY) {\n // NON-FATAL: the token is already consumed + the membership flipped, so a failure here must\n // NOT 500 and strand the invitee (activated but session-less). A missing row just means the\n // challenge below no-ops (also non-fatal) and the invitee enrolls a passkey later via the\n // authenticated register route.\n try {\n await this._ensurePasswordlessCredentialRecord(ec, user._id);\n } catch (error) {\n this.logger.error('Password-less credential row provisioning failed at passkey accept (non-fatal)', {\n userId: user._id,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n // 6. Create registration session with purpose 'invitation'\n const session = await this.authOrchestrator.createRegistrationSession(\n user._id,\n invitationEmail,\n {\n activeUserType,\n purpose: AuthSessionPurpose.INVITATION,\n deviceInfo: { ipAddress, userAgent },\n },\n );\n\n const auditAuthMethod = isNewUser\n ? (password ? AuthMethod.PASSWORD : AUTH_AUDIT_METHOD.INVITATION_ACCEPTANCE)\n : AUTH_AUDIT_METHOD.INVITATION_LINK;\n this.auditLogsService.logUserLogin({\n userId: user._id,\n email: invitationEmail,\n authMethod: auditAuthMethod,\n ipAddress,\n userAgent,\n sessionId: session.sessionId,\n organizationId,\n }, await this.authEcFactory.createForAuditRoutingOrFallback(ec, organizationId, user._id)).catch(() => {});\n\n // 7. Process through the registration pipeline\n // Invitations from trusted source → skip email verification, go straight to MFA check\n const pipelineSession = await this.authOrchestrator.processEmailVerification(\n ec,\n user._id,\n invitationEmail,\n activeUserType,\n { ipAddress, userAgent },\n AuthSessionPurpose.INVITATION,\n );\n\n // 8. If pipeline completed, issue tokens\n if (pipelineSession.state === 'COMPLETED' || pipelineSession.state === 'MFA_ENROLLMENT_GRACE') {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(user._id, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n\n // PASSKEY: with a session now issued, generate the WebAuthn registration challenge bound to\n // the invitee and ride it back on the result. The frontend runs the browser ceremony and\n // completes it against the EXISTING authenticated `/auth/passkey/register/verify` route\n // (authenticated by the access token just issued) — no bespoke accept-verify endpoint.\n // NON-FATAL: the session is ALREADY issued (the invitation token bootstrapped it + was\n // consumed), so a challenge-generation failure must NOT 500 and strand the invitee — they\n // proceed signed in (no challenge on the wire) and enroll a passkey later in security\n // settings, exactly like the frontend's own swallowed ceremony failure.\n let passkeyRegistrationOptions: PublicKeyCredentialCreationOptionsJSON | undefined;\n if (credentialMethod === AuthMethod.PASSKEY) {\n try {\n passkeyRegistrationOptions = await this.webAuthnService.generateRegistrationOptions(ec, user._id, invitationEmail);\n } catch (error) {\n this.logger.error('Passkey challenge generation failed at accept — returning the issued session without a challenge (non-fatal)', {\n userId: user._id,\n ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n return {\n outcome: AcceptInvitationOutcome.SESSION,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: AuthSessionPurpose.INVITATION,\n nextStep: pipelineSession.nextStep,\n userId: user._id,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken,\n expiresIn: tokenResult.expiresIn,\n passkeyRegistrationOptions,\n };\n }\n\n // MFA enrollment required — return session info for frontend routing. Passkey options are\n // deliberately NOT generated here: there is no session yet, and the 5-minute challenge would\n // likely expire before MFA enrollment finishes. The frontend enrolls the passkey post-MFA via\n // the existing authenticated route (the credential row was already ensured above).\n return {\n outcome: AcceptInvitationOutcome.SESSION,\n sessionId: pipelineSession.sessionId,\n state: pipelineSession.state,\n purpose: AuthSessionPurpose.INVITATION,\n nextStep: pipelineSession.nextStep,\n userId: user._id,\n requiresMFA: true,\n availableEnrollmentMethods: pipelineSession.availableEnrollmentMethods,\n };\n }\n\n /**\n * Resolve the invited organization's join context in a SINGLE system read: its `type`, the\n * ORG-JOIN user type the accept will GRANT (`organizationTypes[orgType].userTypes[0]`), and its\n * display name. The one read is shared by `acceptInvitation` (uses `orgType` + `orgJoinUserType`)\n * and `getInvitationInfo` (uses all three), so the org-join projection lives in ONE place — no\n * drift between the accept path and its public discovery counterpart.\n *\n * **Why `[0]`** — `grantUserTypesOnOrgJoin` grants ALL of `organizationTypes[orgType].userTypes`\n * ADDITIVELY, but `[0]` is the PRIMARY (governing) type: it matches the `userTypes[0]` convention\n * every auth surface uses (orchestrator, token issuer, password reset, method-management), and a\n * brand-new invitee's additive grant appends to `[]` so their post-grant `userTypes[0]` IS this\n * `[0]`. Resolving the accept-time policy against `[0]` therefore matches the invitee's\n * steady-state login policy EXACTLY. The remaining granted types are supplementary capabilities,\n * not the governing auth type — validating against the most-restrictive of ALL granted types would\n * make accept STRICTER than every subsequent login (an accept-vs-steady-state discrepancy).\n *\n * Returns the RAW org-join type — deliberately NOT pre-merged with the invitee's own type —\n * because the two accept consumers need OPPOSITE precedence:\n * - the effective `activeUserType` for the password/MFA pipeline is OWN-FIRST\n * (`user.userTypes[0] ?? orgJoinUserType`): a brand-new invitee (own `userTypes: []`, grant\n * deferred) falls through to the org-join type — closing the weak-password + MFA hole — while\n * an EXISTING user keeps their own type so a weaker org-join type cannot re-govern them or\n * reset their MFA enrollment state;\n * - the fail-closed method-enablement guard is ORG-JOIN-FIRST\n * (`orgJoinUserType ?? user.userTypes[0]`): the org's method restrictions must gate the choice\n * even for an existing user.\n *\n * Read via the system-access door because both callers run under a pre-auth `APP_PUBLIC` EC that\n * cannot ACL-read ORGANIZATIONS. `organizationName` is `displayName ?? name` (`undefined` if the\n * org is unreadable — callers coalesce). (A full accept performs ~3 org reads; the org-type grant\n * and `resolveEffectiveAuthPolicy` read it too — this read is shared by the guard + the\n * initial-password policy + discovery.)\n */\n private async _resolveOrgJoinUserType(\n membership: Pick<OrganizationMember, 'organizationId'>,\n ): Promise<{ orgType: string | undefined; orgJoinUserType: string | undefined; organizationName: string | undefined; orgReadFailed: boolean }> {\n let orgType: string | undefined;\n let organizationName: string | undefined;\n let orgReadFailed = false;\n try {\n const org = await this.systemAccessService.readAsSystem<{ _id: string; type?: string; name?: string; displayName?: string }>(\n CoreResourceType.ORGANIZATIONS, { _id: membership.organizationId },\n );\n orgType = org?.type;\n organizationName = org?.displayName ?? org?.name ?? undefined;\n } catch (error) {\n // Non-fatal read failure → orgType/name stay undefined → org-join type unresolved. `orgReadFailed`\n // DISAMBIGUATES this from a genuinely type-less org (both leave `orgType` undefined). For a\n // brand-new invitee (own `userTypes: []`) an unresolved type degrades the initial-password policy\n // to the schema default and the MFA policy to FALLBACK — acceptable for DISPLAY. But the\n // credential-establishment guard fail-CLOSES on `orgReadFailed` (a degraded read must never be\n // mistaken for a non-SCIM / unrestricted org and let a local credential slip past enforcement).\n // Logged so the degrade is observable rather than silent.\n orgReadFailed = true;\n this.logDebug('Invitation accept: ORGANIZATIONS read failed — org-join user type unresolved, policy will degrade', {\n organizationId: membership.organizationId,\n ...projectCaughtErrorLogFields(error),\n });\n }\n\n const orgJoinUserType = orgType\n ? this.appConfigService.config.organizationTypes?.[orgType]?.userTypes?.[0]\n : undefined;\n\n return { orgType, orgJoinUserType, organizationName, orgReadFailed };\n }\n\n /**\n * Fail-closed check that a chosen accept-time credential method is enabled by the invited\n * organization's EFFECTIVE auth policy. Receives the ORG-JOIN-FIRST resolved user type + the org\n * type (both from `_resolveOrgJoinUserType`, resolved once per accept); the PURE\n * `resolveAuthPolicyForOrgType` merges the org overrides (most-restrictive-wins) and\n * `getEnabledMethods` projects the enabled set.\n *\n * Throws `AUTHORIZATION` when the method is not enabled (or the org type / policy cannot be\n * resolved — fail-closed: an unresolvable policy never silently permits a password-less method).\n */\n private _assertInvitationCredentialMethodEnabled(\n organizationId: string,\n orgType: string | undefined,\n resolutionUserType: string | undefined,\n credentialMethod: AuthMethod,\n ): void {\n const resolvedPolicy = resolutionUserType\n ? this.userLookup.resolveAuthPolicyForOrgType(resolutionUserType, orgType)\n : null;\n const enabledMethods = resolvedPolicy\n ? getEnabledMethods(resolvedPolicy.authMethodsEnabled)\n : new Set<AuthMethod>();\n const registrationMethodAllowed =\n credentialMethod !== AuthMethod.PASSWORD\n || resolvedPolicy?.registration.allowedMethods.includes(\n AuthMethod.PASSWORD,\n ) === true;\n\n /*\n * An UNRESOLVABLE policy and a DISABLED method are different faults, and they must not share a\n * message (#388).\n *\n * When no user type resolves for the organization being joined, `resolvedPolicy` is null and the\n * enabled set is EMPTY — so every method fails the check below identically, and reporting that as\n * `AUTHENTICATION_METHOD_NOT_SUPPORTED` names the one thing that is NOT the cause. Measured: an\n * application whose `userTypes.member` enabled PASSWORD *and* listed it in\n * `registration.allowedMethods` was refused for PASSWORD, MAGIC_LINK and PASSKEY alike, because\n * it declared no `organizationTypes` at all. Three methods were tried before anyone looked one\n * level up, and the first written diagnosis was a false claim that the application had no auth\n * policy.\n *\n * The refusal itself is unchanged and still fail-closed — an unresolvable policy must never\n * silently permit a method. Only the DIAGNOSTIC is split, so the message names the missing\n * declaration rather than the method that could never have satisfied it.\n */\n if (!resolvedPolicy) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_ORGANIZATION_TYPE_UNRESOLVED,\n context: {\n // Diagnostic (log-only): AUTHORIZATION strips non-allowlisted context at the wire.\n organizationId,\n orgType,\n resolutionUserType,\n method: credentialMethod,\n hint: orgType\n ? 'No user type resolved for this organization type. Declare `organizationTypes[<orgType>].userTypes` in the application configuration.'\n : 'The organization carries no `type`, so no organization-type entry could be looked up. Set the organization type, and declare `organizationTypes` in the application configuration.',\n },\n });\n }\n\n if (\n !registrationMethodAllowed\n || !enabledMethods.has(credentialMethod)\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_METHOD_NOT_SUPPORTED,\n context: {\n // Diagnostic (log-only): AUTHENTICATION strips non-allowlisted context at the wire.\n method: credentialMethod,\n organizationId,\n },\n });\n }\n }\n\n /**\n * Ensure a USER_CREDENTIALS document exists for a user, creating a PASSWORD-LESS one if absent.\n * Passkey-enroll-at-accept needs the credential row to exist BEFORE the WebAuthn ceremony (the\n * challenge generation + verify both resolve it, and a brand-new invitee has none). `passwordHash`\n * is optional precisely so this row is creatable with no password. Idempotent: an existing row\n * (e.g. an already-registered user accepting a further invite) is left untouched.\n */\n private async _ensurePasswordlessCredentialRecord(ec: ExecutionContext<any>, userId: string): Promise<void> {\n const existing = await this.servicesRegistryHandler.read<UserCredentials>(\n CoreResourceType.USER_CREDENTIALS, ec, { userId },\n );\n if (existing) return;\n\n // Trusted system write: USER_CREDENTIALS is INTERNAL_CALL-only and its `userId` (context FK) is\n // stripped from the client-shaped request DTO; `createAsSystem` re-attaches it after the strict\n // parse (systemAccessPolicy.create opt-in). No `passwordHash` — this is a password-less row.\n await this.systemAccessService.createAsSystem(CoreResourceType.USER_CREDENTIALS, { userId });\n this.logDebug('Password-less credential record provisioned for passkey enrollment', { userId });\n }\n\n /**\n * W4.4: Reject an organization member invitation through the public token-based auth flow.\n *\n * The junction row is the invitation, so rejection and admin revocation have\n * distinct authorization/audit intent but the same terminal persistence:\n * atomically revoke the accept token and delete the still-INVITED row.\n */\n async rejectInvitation(\n ec: ExecutionContext<any>,\n params: {\n invitationToken: string;\n rejectionReason?: string;\n },\n ): Promise<{ rejected: true }> {\n const { invitationToken, rejectionReason } = params;\n\n // NO TOKEN ORACLE + RESIDUAL TIMING CHANNEL: rejection is uniform (`INVITATION_NO_LONGER_VALID`); the\n // fast (validateToken-fail) vs slow (membership-read) timing residual is ASSESSED WONTFIX. See the\n // canonical rationale on `acceptInvitation` (review FU-4/5/6) before \"fixing\" the timing here.\n let tokenResult;\n try {\n // Preflight is deliberately read-only. The invited-only REVOKE mutation\n // revokes this token by membership relatedId in the same transaction as\n // deleting the row. Consuming here would strand a valid INVITED row if\n // the process crashed or deletion failed afterward.\n tokenResult = await this.consumableTokenService.validateToken(\n invitationToken,\n [CoreConsumableTokenTypes.ORGANIZATION_MEMBER_INVITATION],\n );\n } catch {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const invitationId = tokenResult.relatedId;\n if (!invitationId) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const membership = await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: invitationId },\n );\n if (!membership || membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n try {\n await this.applyInvitationRejectionCore(ec, {\n membership,\n rejectionReason,\n });\n } catch (error) {\n // Acceptance/revocation may win after the read-only preflight. Preserve\n // the public no-oracle contract for those expected state races, while\n // leaving infrastructure/configuration failures visible and retryable.\n if (\n isWildoBackendError(error)\n && (\n error.type === ErrorType.AUTHENTICATION\n || error.type === ErrorType.AUTHORIZATION\n || error.type === ErrorType.NOT_FOUND\n || error.type === ErrorType.CONFLICT\n )\n ) {\n throw this.errorBuilder.buildError(\n ErrorType.AUTHENTICATION,\n undefined,\n {\n customMessageReference:\n ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n },\n );\n }\n throw error;\n }\n\n return { rejected: true };\n }\n\n /**\n * Shared rejection core — REVOKE the pending membership (decline). Reused by the\n * token-based `rejectInvitation` and the authenticated in-app `rejectMyInvitation`.\n *\n * In the junction model there is no `REJECTED` status to set: a declined invite leaves no\n * membership. Revoking the INVITED row uses the exact invited-only REVOKE\n * implementation, whose declarative token contract revokes the accept token\n * inside the same transaction. The invitee\n * is not an org admin, so the ORG_ADMIN-gated DELETE runs under a synthesised super-admin EC.\n *\n * ## The decline IS audited — as the invitee, not as the system\n *\n * REVOKE emits `ORGANIZATION_MEMBER_REMOVED` from a post-commit effect, carrying `operation`,\n * `previousStatus`, `roles` and this `reason`. What that event could not say, until the\n * `onBehalfOfUserId` below, was WHO declined: a borrowed-authority context carries no\n * `initiatorIds.userId` (the `ExecutionContext` constructor rejects one), so the actor resolved to\n * `SYSTEM` — the identical row the stale-invitation sweep writes when it reaps an invitation nobody\n * answered. An access review could not tell an active refusal from silence.\n *\n * `membership.userId` is the right source for BOTH callers rather than the caller id: the token\n * path identifies the invitee through the token, the in-app path has already verified the caller\n * owns this row, and taking it from the row keeps the two from drifting.\n *\n * With the actor recorded, the three REVOKE causes are distinguishable with no new event type:\n * a self-decline is `removedBy === removedUserId`, an administrative cancellation is a different\n * real user id, and the expiry sweep remains `SYSTEM`.\n */\n private async applyInvitationRejectionCore(\n _ec: ExecutionContext<any>,\n { membership, rejectionReason }: { membership: OrganizationMember; rejectionReason?: string },\n ): Promise<void> {\n const systemEc = await this.authEcFactory.createForSystemAuthOperation(\n this.authEcFactory.getOrganizationMembersRevokeOperationPath(),\n { onBehalfOfUserId: membership.userId },\n );\n await this.servicesRegistryHandler.executeCustomOperation(\n CoreResourceType.ORGANIZATION_MEMBERS,\n OrganizationMembers_Operations.REVOKE,\n systemEc,\n membership._id,\n {\n reason: rejectionReason?.trim() || undefined,\n },\n );\n\n this.logDebug('Invitation declined — pending membership removed', {\n membershipId: membership._id,\n userId: membership.userId,\n organizationId: membership.organizationId,\n rejectionReason: rejectionReason?.trim() || undefined,\n });\n }\n\n /**\n * In-app authenticated accept (Approach P) — list the caller's OWN pending\n * invitations across every organization, matched by their `userId`.\n *\n * Since the invitation→membership collapse, the invite binds the pending\n * `ORGANIZATION_MEMBERS` row to the invitee's `userId` (an eagerly-created\n * `PENDING_INVITATION` user), so the inbox is a direct userId-owned query — no\n * email round-trip. Cross-org by construction (the invitee is not yet a scoped\n * member of the inviting orgs), so invitations + org names are read via the\n * system-context primitives (`listAsSystem`/`readAsSystem`). Authorization is\n * the userId-ownership match: only INVITED rows bound to the caller's `userId`\n * are returned. The caller's identity comes from the authenticated route\n * (`callerUserId`).\n */\n async listMyPendingInvitations(\n _ec: ExecutionContext<any>,\n params: { callerUserId: string },\n ): Promise<MyPendingInvitation[]> {\n // The invite bound the pending membership to the caller's `userId`, so the inbox is a\n // direct userId-owned query — no email round-trip. Cross-org by construction (the invitee\n // is not yet a scoped member of the inviting orgs), so read via the system context.\n const result = await this.systemAccessService.listAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { userId: params.callerUserId, status: OrganizationMemberStatus.INVITED },\n );\n const memberships = Array.isArray(result) ? result : result.data;\n\n return Promise.all(memberships.map(async (membership): Promise<MyPendingInvitation> => {\n let organizationName: string | undefined;\n try {\n const org = await this.systemAccessService.readAsSystem<{ displayName?: string; name?: string }>(\n CoreResourceType.ORGANIZATIONS,\n { _id: membership.organizationId },\n );\n organizationName = org?.displayName ?? org?.name ?? undefined;\n } catch {\n organizationName = undefined;\n }\n return {\n membershipId: membership._id,\n organizationId: membership.organizationId,\n organizationName,\n roles: membership.roles ?? [],\n createdAt: membership.createdAt ? new Date(membership.createdAt).toISOString() : undefined,\n };\n }));\n }\n\n /**\n * In-app authenticated accept (Approach P) — accept ONE of the caller's own pending\n * invitations by membership id, WITHOUT a token and WITHOUT issuing a new session (the\n * caller is already authenticated). Authorization = userId-ownership of the INVITED row.\n * The shared `applyInvitationAcceptanceCore` flips it to ACTIVE + grants org-join types.\n */\n async acceptMyInvitation(\n ec: ExecutionContext<any>,\n params: { callerUserId: string; membershipId: string },\n ): Promise<{ accepted: true; organizationId: string }> {\n const { caller, membership } = await this.loadOwnedPendingInvitation(ec, params.callerUserId, params.membershipId);\n\n await this.resourcePersistenceUnitOfWork.executeTransaction(\n createAuthenticatedInvitationAcceptancePersistenceRequest(),\n async serviceOptions => {\n // MongoDB does not support concurrent operations on the same session.\n // Sequential reads are portable across both supported adapters.\n const currentCaller = await this.servicesRegistryHandler.read<User>(\n CoreResourceType.USERS,\n ec,\n { _id: caller._id },\n serviceOptions,\n );\n const currentMembership =\n await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: membership._id },\n serviceOptions,\n );\n if (\n !currentCaller\n || !currentMembership\n || currentMembership.userId !== currentCaller._id\n || currentMembership.status !== OrganizationMemberStatus.INVITED\n ) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n const { membershipActivated } = await applyInvitationAcceptanceCore(ec, {\n membership: currentMembership,\n user: currentCaller,\n appConfigService: this.appConfigService,\n errorBuilder: this.errorBuilder,\n servicesRegistryHandler: this.servicesRegistryHandler,\n systemAccessService: this.systemAccessService,\n serviceOptions,\n logDebug: this.logDebug,\n });\n if (!membershipActivated) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n },\n );\n\n this.logDebug('Invitation accepted in-app', {\n membershipId: membership._id,\n userId: caller._id,\n organizationId: membership.organizationId,\n });\n\n return { accepted: true, organizationId: membership.organizationId };\n }\n\n /**\n * In-app authenticated reject (Approach P) — decline ONE of the caller's own pending\n * invitations by membership id. Same userId-ownership gate as `acceptMyInvitation`. In the\n * junction model the decline REVOKEs the INVITED row (which revokes its accept token via\n * the invitation-cancellation prefix) rather than setting a terminal status.\n */\n async rejectMyInvitation(\n ec: ExecutionContext<any>,\n params: { callerUserId: string; membershipId: string; rejectionReason?: string },\n ): Promise<{ rejected: true; organizationId: string }> {\n const { membership } = await this.loadOwnedPendingInvitation(ec, params.callerUserId, params.membershipId);\n\n await this.applyInvitationRejectionCore(ec, { membership, rejectionReason: params.rejectionReason });\n\n return { rejected: true, organizationId: membership.organizationId };\n }\n\n /**\n * Load + authorize one of the caller's own pending invitations (INVITED membership rows)\n * for the in-app (authenticated, tokenless) accept/reject flow. Reads the caller + the\n * membership via the cross-org system context, then enforces:\n * 1. userId-ownership — `membership.userId === caller._id` (else 403 AUTHORIZATION);\n * 2. INVITED status (else AUTHENTICATION \"no longer valid\", matching the token flow).\n *\n * \"Not found\" and \"not addressed to you\" deliberately surface the SAME ownership error so\n * a caller cannot probe for the existence of other people's invitations.\n */\n private async loadOwnedPendingInvitation(\n ec: ExecutionContext<any>,\n callerUserId: string,\n membershipId: string,\n ): Promise<{ caller: User; membership: OrganizationMember }> {\n const caller = await this.userLookup.findUserById(ec, callerUserId);\n if (!caller) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, ec, {\n customMessageReference: ErrorCustomMessageReference.AUTHENTICATION_USER_NOT_FOUND,\n });\n }\n\n const membership = await this.systemAccessService.readAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { _id: membershipId },\n );\n\n if (!membership || membership.userId !== caller._id) {\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, ec, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NOT_ADDRESSED_TO_CALLER,\n });\n }\n\n if (membership.status !== OrganizationMemberStatus.INVITED) {\n throw this.errorBuilder.buildError(ErrorType.AUTHENTICATION, ec, {\n customMessageReference: ErrorCustomMessageReference.INVITATION_NO_LONGER_VALID,\n });\n }\n\n return { caller, membership };\n }\n\n /**\n * W5.7: Complete org onboarding — called by the guidance/onboarding flow\n * after collecting the organization name from the user.\n * Creates the deferred org, grants user types, issues tokens, transitions session to COMPLETED.\n */\n async completeOrgOnboarding(\n ec: ExecutionContext<any>,\n params: {\n sessionId: string;\n organizationName: string;\n },\n ): Promise<{\n sessionId: string;\n state: string;\n nextStep?: string;\n organizationId?: string;\n accessToken?: string;\n refreshToken?: string;\n expiresIn?: number;\n }> {\n const session = await this.authOrchestrator.completeOrgOnboarding(\n ec,\n params.sessionId,\n params.organizationName,\n );\n\n if (session.state === AuthenticationSessionState.COMPLETED && session.userId) {\n const tokenResult = await this.tokenIssuer.issueTokensForUser(session.userId, undefined, {\n lastAuthenticatedAt: Math.floor(Date.now() / 1000),\n });\n return {\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep,\n organizationId: session.organizationId,\n accessToken: tokenResult.accessToken,\n refreshToken: tokenResult.refreshToken,\n expiresIn: tokenResult.expiresIn,\n };\n }\n\n return {\n sessionId: session.sessionId,\n state: session.state,\n nextStep: session.nextStep,\n organizationId: session.organizationId,\n };\n }\n}\n"]}