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

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 (265) hide show
  1. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts +14 -3
  2. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
  3. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +115 -22
  4. package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
  5. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts +3 -1
  6. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
  7. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js +8 -3
  8. package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
  9. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts +11 -0
  10. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
  11. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js +11 -2
  12. package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js.map +1 -1
  13. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +1 -0
  14. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
  15. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +6 -1
  16. package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
  17. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.d.ts.map +1 -1
  18. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js +16 -0
  19. package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js.map +1 -1
  20. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts +20 -6
  21. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
  22. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +88 -32
  23. package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
  24. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts +3 -1
  25. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
  26. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js +32 -7
  27. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js.map +1 -1
  28. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts +8 -5
  29. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
  30. package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.js.map +1 -1
  31. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +31 -0
  32. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
  33. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +127 -5
  34. package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
  35. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts +71 -1
  36. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
  37. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +62 -2
  38. package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
  39. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts +21 -0
  40. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
  41. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +126 -4
  42. package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
  43. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts +3 -26
  44. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
  45. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js +3 -68
  46. package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js.map +1 -1
  47. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
  48. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +4 -2
  49. package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
  50. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +6 -6
  51. package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
  52. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +38 -0
  53. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
  54. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +40 -0
  55. package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
  56. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +20 -0
  57. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
  58. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +28 -0
  59. package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
  60. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +12 -0
  61. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -0
  62. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +118 -0
  63. package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -0
  64. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
  65. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +8 -5
  66. package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
  67. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
  68. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +14 -0
  69. package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
  70. package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
  71. package/dist/esm/config/custom/application-config-controller.backend.service.js +7 -1
  72. package/dist/esm/config/custom/application-config-controller.backend.service.js.map +1 -1
  73. package/dist/esm/config/models/app-config.backend.schemas.d.ts +4 -0
  74. package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
  75. package/dist/esm/config/services/app-configuration.backend.utils.d.ts +10 -1
  76. package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
  77. package/dist/esm/config/services/app-configuration.backend.utils.js +13 -2
  78. package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
  79. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts +2 -2
  80. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js +2 -2
  81. package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js.map +1 -1
  82. package/dist/esm/databases/models/filter.backend.schemas.js +2 -2
  83. package/dist/esm/databases/models/filter.backend.schemas.js.map +1 -1
  84. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
  85. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js +20 -1
  86. package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js.map +1 -1
  87. package/dist/esm/databases/services/redis.service.d.ts +27 -0
  88. package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
  89. package/dist/esm/databases/services/redis.service.js +29 -0
  90. package/dist/esm/databases/services/redis.service.js.map +1 -1
  91. package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
  92. package/dist/esm/errors/services/error-handler.backend.service.js +5 -0
  93. package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
  94. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts +41 -0
  95. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -0
  96. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js +40 -0
  97. package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js.map +1 -0
  98. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts +64 -0
  99. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -0
  100. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js +193 -0
  101. package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js.map +1 -0
  102. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +13 -2
  103. package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
  104. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +8 -2
  105. package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
  106. package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
  107. package/dist/esm/external-data/external-data-transform.backend.js +7 -1
  108. package/dist/esm/external-data/external-data-transform.backend.js.map +1 -1
  109. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts +2 -0
  110. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
  111. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js +13 -0
  112. package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js.map +1 -1
  113. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +14 -0
  114. package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
  115. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +6 -0
  116. package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
  117. package/dist/esm/files/controllers/file.controller.d.ts +24 -1
  118. package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
  119. package/dist/esm/files/controllers/file.controller.js +66 -2
  120. package/dist/esm/files/controllers/file.controller.js.map +1 -1
  121. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts +17 -0
  122. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -0
  123. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js +1 -0
  124. package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -0
  125. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +5 -1
  126. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
  127. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +42 -3
  128. package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
  129. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts +18 -0
  130. package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
  131. package/dist/esm/files/services/file-operation-handler.backend.service.js +36 -28
  132. package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
  133. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +163 -0
  134. package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -0
  135. package/dist/esm/files/services/file-upload-grant.backend.service.js +442 -0
  136. package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -0
  137. package/dist/esm/files/services/files.backend.service.d.ts +19 -0
  138. package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
  139. package/dist/esm/files/services/files.backend.service.js +78 -15
  140. package/dist/esm/files/services/files.backend.service.js.map +1 -1
  141. package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
  142. package/dist/esm/files/utils/file-uploader.utils.js +12 -0
  143. package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
  144. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +5 -5
  145. package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
  146. package/dist/esm/flows-actors/services/agents.backend.service.d.ts +79 -0
  147. package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
  148. package/dist/esm/flows-actors/services/agents.backend.service.js +319 -42
  149. package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
  150. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +151 -41
  151. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
  152. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +300 -139
  153. package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
  154. package/dist/esm/index.d.ts +4 -1
  155. package/dist/esm/index.d.ts.map +1 -1
  156. package/dist/esm/index.js +14 -1
  157. package/dist/esm/index.js.map +1 -1
  158. package/dist/esm/inject/models/container.d.ts.map +1 -1
  159. package/dist/esm/inject/models/container.js +4 -0
  160. package/dist/esm/inject/models/container.js.map +1 -1
  161. package/dist/esm/inject/models/service-types.d.ts +3 -0
  162. package/dist/esm/inject/models/service-types.d.ts.map +1 -1
  163. package/dist/esm/inject/models/service-types.js +2 -0
  164. package/dist/esm/inject/models/service-types.js.map +1 -1
  165. package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
  166. package/dist/esm/mcp/controllers/mcp.controller.js +12 -4
  167. package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
  168. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts +34 -0
  169. package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
  170. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js +42 -0
  171. package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
  172. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +29 -1
  173. package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
  174. package/dist/esm/mcp/services/mcp-server.backend.service.js +131 -3
  175. package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
  176. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts +64 -2
  177. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
  178. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +130 -6
  179. package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
  180. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +9 -0
  181. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
  182. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +11 -36
  183. package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
  184. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
  185. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +9 -7
  186. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
  187. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts +5 -5
  188. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
  189. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js +14 -13
  190. package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js.map +1 -1
  191. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts +2 -1
  192. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
  193. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +2 -2
  194. package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
  195. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
  196. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +9 -7
  197. package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
  198. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
  199. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js +4 -1
  200. package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js.map +1 -1
  201. package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
  202. package/dist/esm/requests/service/websocket.service.js +56 -7
  203. package/dist/esm/requests/service/websocket.service.js.map +1 -1
  204. package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
  205. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +2 -0
  206. package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
  207. package/dist/esm/resources/services/resource-id.backend.service.js +3 -3
  208. package/dist/esm/resources/services/resource-id.backend.service.js.map +1 -1
  209. package/dist/esm/resources/services/resources-registry.backend.service.js +1 -1
  210. package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
  211. package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
  212. package/dist/esm/runtime/services/execution-context-creator.backend.service.js +13 -7
  213. package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
  214. package/dist/esm/runtime/services/start-application.backend.service.d.ts +28 -0
  215. package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
  216. package/dist/esm/runtime/services/start-application.backend.service.js +82 -0
  217. package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
  218. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts +3 -23
  219. package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
  220. package/dist/esm/security/authentications/models/jwt.backend.schemas.js +20 -45
  221. package/dist/esm/security/authentications/models/jwt.backend.schemas.js.map +1 -1
  222. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts +9 -1
  223. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
  224. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +9 -1
  225. package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
  226. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.d.ts.map +1 -1
  227. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js +5 -3
  228. package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js.map +1 -1
  229. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +25 -1
  230. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
  231. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +55 -4
  232. package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
  233. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
  234. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js +24 -1
  235. package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js.map +1 -1
  236. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts +117 -0
  237. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -0
  238. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js +104 -0
  239. package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js.map +1 -0
  240. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +101 -6
  241. package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
  242. package/dist/esm/security/authorizations/services/authorizations.backend.service.js +210 -30
  243. package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
  244. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts +18 -1
  245. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
  246. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js +110 -74
  247. package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js.map +1 -1
  248. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts +22 -0
  249. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -0
  250. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js +22 -0
  251. package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js.map +1 -0
  252. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts +17 -3
  253. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
  254. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js +12 -0
  255. package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js.map +1 -1
  256. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +20 -0
  257. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
  258. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +58 -5
  259. package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
  260. package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
  261. package/dist/esm/security/jwt/services/jwt.backend.service.js +1 -18
  262. package/dist/esm/security/jwt/services/jwt.backend.service.js.map +1 -1
  263. package/dist/tsconfig.build.tsbuildinfo +1 -1
  264. package/package.json +15 -9
  265. package/dist/esm/.builder.pid +0 -9
@@ -1 +1 @@
1
- {"version":3,"file":"infrastructure-tier-contract.backend.d.ts","sourceRoot":"","sources":["../../../../../../src/base-classes/services/repositories/infrastructure-tier-contract.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH;;;;;;;GAOG;AACH,oBAAY,kBAAkB;IAC5B,gGAAgG;IAChG,eAAe,oCAAoC;IACnD,gFAAgF;IAChF,SAAS,8BAA8B;IACvC,oFAAoF;IACpF,oBAAoB,sBAAsB;IAC1C,sEAAsE;IACtE,eAAe,oCAAoC;IACnD,qFAAqF;IACrF,WAAW,gCAAgC;IAC3C,yCAAyC;IACzC,uBAAuB,0BAA0B;IACjD,iEAAiE;IACjE,sBAAsB,yBAAyB;IAC/C,wCAAwC;IACxC,sBAAsB,yBAAyB;CAChD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oBAAY,iCAAiC;IAC3C;;;OAGG;IACH,aAAa,kBAAkB;IAC/B;;;;;;;;;;;OAWG;IACH,cAAc,kBAAkB;IAChC;;;;OAIG;IACH,iBAAiB,qBAAqB;IACtC;;;;;OAKG;IACH,cAAc,kBAAkB;IAChC;;;;OAIG;IACH,kBAAkB,qBAAqB;IACvC;;;OAGG;IACH,WAAW,eAAe;IAC1B;;;;;;;;;OASG;IACH,yBAAyB,6BAA6B;IACtD;;;;OAIG;IACH,kBAAkB,sBAAsB;CACzC;AAED,oBAAY,4BAA4B;IACtC,6CAA6C;IAC7C,SAAS,cAAc;IACvB,sFAAsF;IACtF,MAAM,WAAW;IACjB,mGAAmG;IACnG,cAAc,mBAAmB;CAClC;AAED;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GACxC;IAAE,OAAO,EAAE,4BAA4B,CAAC,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,OAAO,EAAE,4BAA4B,CAAC,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC7F;IAAE,OAAO,EAAE,4BAA4B,CAAC,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAmI7E,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAC/C,kBAAkB,EAClB,MAAM,CAAC,iCAAiC,EAAE,gCAAgC,CAAC,CA0O5E,CAAC;AAIF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,8CAA8C,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAM3F,CAAC;AAEF;;;;;;;;GAQG;AACH,oBAAY,sCAAsC;IAChD,YAAY,gBAAgB;IAC5B,4BAA4B,+BAA+B;CAC5D;AAED,eAAO,MAAM,0CAA0C,EAAE,MAAM,CAC7D,sCAAsC,EACtC,MAAM,CAcP,CAAC"}
1
+ {"version":3,"file":"infrastructure-tier-contract.backend.d.ts","sourceRoot":"","sources":["../../../../../../src/base-classes/services/repositories/infrastructure-tier-contract.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAEH;;;;;;;GAOG;AACH,oBAAY,kBAAkB;IAC5B,gGAAgG;IAChG,eAAe,oCAAoC;IACnD,gFAAgF;IAChF,SAAS,8BAA8B;IACvC,oFAAoF;IACpF,oBAAoB,sBAAsB;IAC1C,sEAAsE;IACtE,eAAe,oCAAoC;IACnD,qFAAqF;IACrF,WAAW,gCAAgC;IAC3C,+DAA+D;IAC/D,WAAW,gCAAgC;IAC3C,yCAAyC;IACzC,uBAAuB,0BAA0B;IACjD,iEAAiE;IACjE,sBAAsB,yBAAyB;IAC/C,wCAAwC;IACxC,sBAAsB,yBAAyB;CAChD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oBAAY,iCAAiC;IAC3C;;;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ate bypass: its doors sit BELOW the service tier, take a
8
8
  * pre-built filter or an already-final document, and run no declared operation and no authorization.
9
- * Its clearest warrant is field-uniqueness validation, which runs INSIDE an in-flight operation's own
10
- * validation, where routing back through a declared operation would be circular.
9
+ * Its clearest warrant is the field-uniqueness check behind the `validate-field` route. A field
10
+ * declared unique with `scope: 'global'` must be counted across the ENTIRE collection — "no additional
11
+ * filter (intentional — check entire collection)" — including tenants the caller cannot see, and the
12
+ * answer returned as nothing but a number. A declared operation cannot serve that: `buildContextualFilter`
13
+ * would scope the count to the caller's tenant and the answer would simply be wrong. So the door
14
+ * deliberately waives tenant scoping and deliberately does NOT waive the retention hide, because
15
+ * counting a hidden row would turn the same number into an existence oracle.
11
16
  *
12
17
  * Its WEAKEST warrant is the one the tier has most often cited, and issue #100 asked for it to be
13
18
  * settled: "a consumable token is minted by a system action and consumed BEFORE authentication, so
@@ -17,7 +22,14 @@
17
22
  * fail-closes unless the resource opts in with `systemAccessPolicy.create = ALLOWED`, synthesises an
18
23
  * APPLICATION-scope super-admin context, and dispatches the resource's OWN declared CREATE —
19
24
  * which `CONSUMABLE_TOKENS` declares. So the framework does not owe a new "system principal"
20
- * vocabulary; one door is not using the one that exists. See `INSERT_DOCUMENT / authorization` below.
25
+ * vocabulary.
26
+ *
27
+ * That settles the FRAMEWORK question and deliberately does not settle the CALLER's: this door turns
28
+ * out to have a second, stronger reason to bypass the declared pipeline. `createsOneOffSession` is
29
+ * sealed `.excludeFromCreate()` so that no repository-create path can mint a session-establishing
30
+ * token, which is what makes `createToken` the sole minter and therefore the single funnel enforcing
31
+ * the impersonation-credential lifetime ceiling. A raw door is the shape that seal depends on. See
32
+ * `INSERT_DOCUMENT / authorization` below, and issue #102.
21
33
  *
22
34
  * What was missing is not correctness, it is a CONTRACT. Each door carried its own hand-written prose
23
35
  * about which cross-cutting invariant it upheld and which it skipped, so the tier's posture existed
@@ -31,10 +43,10 @@
31
43
  * EITHER enum fails to compile until every new cell is filled in. That is the property this file is
32
44
  * for: the missing case becomes a compiler error rather than something a reviewer has to notice.
33
45
  *
34
- * ## The tier is EIGHT doors, not the four that share a name
46
+ * ## The tier is NINE doors, not the four that share a name
35
47
  *
36
48
  * Issue #100 listed four, all suffixed `*ForInfrastructure`. That is the population the SUFFIX
37
- * describes, and it is half the tier. Four more handler members have the identical posture under a
49
+ * describes, and it was half the tier. Four more handler members have the identical posture under a
38
50
  * different name — `atomicIncrementField` and `atomicConditionalSet` carry, verbatim, the same
39
51
  * `@internal Framework-internal infrastructure primitive — NOT part of the operation lifecycle. The
40
52
  * caller owns authorization, scope-aware filter construction, and audit logging.` that the suffixed
@@ -81,6 +93,8 @@ export var InfrastructureDoor;
81
93
  InfrastructureDoor["INSERT_DOCUMENT"] = "insertDocumentForInfrastructure";
82
94
  /** Multi-row guarded write (token revocation by relatedId, usage-record marking). */
83
95
  InfrastructureDoor["BULK_UPDATE"] = "bulkUpdateForInfrastructure";
96
+ /** Multi-row DELETE (the consumable-token retention sweep). */
97
+ InfrastructureDoor["DELETE_MANY"] = "deleteManyForInfrastructure";
84
98
  /** Single-row compare-and-swap write. */
85
99
  InfrastructureDoor["ATOMIC_GUARDED_MUTATION"] = "atomicGuardedMutation";
86
100
  /** Single-row counter increment (metering, quota accounting). */
@@ -104,7 +118,7 @@ export var InfrastructureDoor;
104
118
  * it, and the family has broken it in production (retention hide, transaction participation,
105
119
  * adapter neutrality).
106
120
  *
107
- * This set is OPEN. Adding a member is the point: it immediately breaks compilation at all eight doors
121
+ * This set is OPEN. Adding a member is the point: it immediately breaks compilation at every door
108
122
  * until each declares a posture. Candidates DELIBERATELY excluded are recorded as data in
109
123
  * {@link INFRASTRUCTURE_CONCERN_CANDIDATES_EXCLUDED} rather than left absent — an absence is
110
124
  * indistinguishable from an oversight, which is the shape this whole file is about.
@@ -187,7 +201,7 @@ const { AUTHORIZATION, TENANT_SCOPING, SCHEMA_VALIDATION, RETENTION_HIDE, RAG_IN
187
201
  // written at the door — moved from that door's JSDoc rather than paraphrased, so the rationale exists
188
202
  // in exactly one place and cannot drift from the copy it was summarised into.
189
203
  /**
190
- * Identical at all eight doors. The placement note is the real mitigation: these members live on the
204
+ * Identical at every door. The placement note is the real mitigation: these members live on the
191
205
  * HANDLER and not on the `BackendResourceRepository` interface an application's custom code is handed.
192
206
  */
193
207
  const AUTHORIZATION_WAIVED = {
@@ -198,7 +212,7 @@ const AUTHORIZATION_WAIVED = {
198
212
  compensation: 'Declared on the handler rather than on the `BackendResourceRepository` interface, so custom '
199
213
  + 'application code cannot reach these doors through the repository it is given.',
200
214
  };
201
- /** Identical at all eight doors: the caller's filter or document is the whole confinement. */
215
+ /** Identical at every door: the caller's filter or document is the whole confinement. */
202
216
  const TENANT_SCOPING_WAIVED = {
203
217
  posture: WAIVED,
204
218
  reason: 'The adapters\' `buildContextualFilter` — which injects the resource\'s scope FK — runs on the '
@@ -209,7 +223,7 @@ const TENANT_SCOPING_WAIVED = {
209
223
  + 'reached today only by field-uniqueness validation, consumable tokens and usage metering, each '
210
224
  + 'of which builds its own filter. Nothing mechanical enforces that on a future caller.',
211
225
  };
212
- /** Identical at all eight doors: the door emits nothing, and nothing downstream substitutes for it. */
226
+ /** Identical at every door: the door emits nothing, and nothing downstream substitutes for it. */
213
227
  const AUDIT_TRAIL_WAIVED = {
214
228
  posture: WAIVED,
215
229
  reason: 'No operation lifecycle runs, so no auditable event is emitted by the door itself.',
@@ -226,8 +240,8 @@ const RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ = {
226
240
  reason: 'Read-only: writes nothing, so no `.ragSource()` field can change through it.',
227
241
  };
228
242
  /**
229
- * The five write doors, minus {@link InfrastructureDoor.INSERT_DOCUMENT}, which has its own partial
230
- * compensation (the cast).
243
+ * The pre-built WRITE doors, minus {@link InfrastructureDoor.INSERT_DOCUMENT}, which has its own partial
244
+ * compensation (the cast), and minus {@link InfrastructureDoor.DELETE_MANY}, which materializes no value.
231
245
  */
232
246
  const SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE = {
233
247
  posture: WAIVED,
@@ -237,7 +251,7 @@ const SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE = {
237
251
  compensation: 'Shape only, never values: `describeGuardedMutationInexpressibility` refuses a mutation that '
238
252
  + 'cannot be expressed on every adapter. Nothing checks what the mutation SAYS.',
239
253
  };
240
- /** Seven of the eight doors accept `RepositoryOptions` and forward them unchanged. */
254
+ /** Every door but {@link InfrastructureDoor.COUNT_DOCUMENTS} accepts `RepositoryOptions` and forwards them unchanged. */
241
255
  const TRANSACTION_PARTICIPATION_PRESERVED = {
242
256
  posture: PRESERVED,
243
257
  how: 'Accepts `RepositoryOptions` and forwards them to the primitive, so a caller already inside a '
@@ -246,7 +260,8 @@ const TRANSACTION_PARTICIPATION_PRESERVED = {
246
260
  /**
247
261
  * The four doors whose only adapter-neutrality claim is that they dispatch a primitive declared on the
248
262
  * `BackendResourceRepository` interface — so an adapter omitting one fails to compile rather than
249
- * throwing on first use. All eight raw primitives are declared there and implemented on both arms.
263
+ * throwing on first use. Every raw primitive is declared there and implemented on both persisting arms
264
+ * (the read-only HTTP-API and introspection arms declare each one as an explicit refusal).
250
265
  */
251
266
  const ADAPTER_NEUTRALITY_PRESERVED_BY_CONTRACT = (primitive) => ({
252
267
  posture: PRESERVED,
@@ -267,8 +282,8 @@ const RETENTION_HIDE_PRESERVED_AT_DISPATCH = (consequence) => ({
267
282
  + 'a future adapter inherits the predicate by construction.',
268
283
  });
269
284
  /**
270
- * The five write doors' RAG posture, identical in mechanism and differing only in what the sweep
271
- * reconciles for that door's shape. Moved from each door's own `rag-ingestion-gate: N/A —` comment,
285
+ * The materializing write doors' RAG posture, identical in mechanism and differing only in what the
286
+ * sweep reconciles for that door's shape. Moved from each door's own `rag-ingestion-gate: N/A —` comment,
272
287
  * which the sibling guard `rag-ingestion-write-door-coverage.guard.test.ts` still requires to be
273
288
  * present AT the door; that guard checks the waiver EXISTS, this table records what it says.
274
289
  */
@@ -294,16 +309,15 @@ export const INFRASTRUCTURE_TIER_CONTRACT = {
294
309
  [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ,
295
310
  [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,
296
311
  [TRANSACTION_PARTICIPATION]: {
297
- posture: WAIVED,
298
- reason: 'THE ONE DOOR THAT CANNOT PARTICIPATE, and not by decision: it accepts no `RepositoryOptions` '
299
- + 'parameter at all, so a caller inside a transaction counts OUTSIDE it and cannot see its own '
300
- + 'uncommitted rows. `countByRawFilter` accepts and honours options on both arms; only this '
301
- + 'door drops them — the identical shape its sibling `bulkUpdateForInfrastructure` records as '
302
- + '"a silent correctness hole", at the one door nobody enumerated. Surfaced by filling this '
303
- + 'table, deliberately recorded rather than repaired here: fixing a door inside the change that '
304
- + 'declares the contract would hide the demonstration that the contract works. Filed as issue '
305
- + '#104; flip this cell to PRESERVED when it lands.',
306
- compensation: null,
312
+ posture: PRESERVED,
313
+ how: 'Accepts `RepositoryOptions` and forwards them to `countByRawFilter`, matching all seven '
314
+ + 'siblings. It was the ONE door in the tier that accepted none, so a caller inside a '
315
+ + 'transaction counted OUTSIDE it — the identical shape `bulkUpdateForInfrastructure` records '
316
+ + 'as a silent correctness hole, at the door nobody enumerated until this table gave every '
317
+ + 'door a row to fill in. Surfaced by filling the table (issue #104), fixed separately from '
318
+ + 'the change that declared the contract so the demonstration stayed visible. No caller passes '
319
+ + 'options today, so the forward is pinned rather than behaviour-verified: '
320
+ + '`__tests__/infrastructure-tier-transaction-forwarding.test.ts`.',
307
321
  },
308
322
  [ADAPTER_NEUTRALITY]: {
309
323
  posture: PRESERVED,
@@ -354,13 +368,18 @@ export const INFRASTRUCTURE_TIER_CONTRACT = {
354
368
  + '(INTERNAL_CALL, ORG_ADMIN, with a requestDto). Routing through it would restore schema '
355
369
  + 'validation, the RAG ingestion hook, the audit trail and the scope-context channel at this '
356
370
  + 'door — five of the eight rows below stop being waivers.',
357
- compensation: 'Handler-only placement, as for every door here. What stops the migration is narrow and '
358
- + 'specific rather than principled — the declared requestDto omits the `_id`, `createdAt` and '
359
- + '`updatedAt` this caller supplies deliberately; `CONSUMABLE_TOKENS` declares no '
360
- + '`systemAccessPolicy`, so `createAsSystem` fail-closes today; the declared variant is gated '
361
- + 'on ORG_ADMIN at organization scope, which a signup-time magic-link mint does not have; and '
362
- + 'the caller reads the raw duplicate-key error to detect an `activeGenerationKey` conflict. '
363
- + 'Tracked as issue #102 — the decision to migrate the caller — rather than answered here.',
371
+ compensation: 'Handler-only placement, as for every door here — AND, at this door only, a deliberate '
372
+ + 'security seal that makes the raw insert load-bearing rather than incidental. '
373
+ + '`createsOneOffSession` is `.excludeFromCreate().excludeFromUpdate()` so that no '
374
+ + 'repository-create path can mint a session-establishing token, which leaves `createToken` — '
375
+ + 'this door\'s caller — the SOLE minter and therefore the single funnel enforcing '
376
+ + '`ONE_OFF_SESSION_ABSOLUTE_MAX_MINUTES` fail-closed at issuance. That token is an '
377
+ + 'impersonation credential: exchanging it mints a JWT session for another user. Routing the '
378
+ + 'mint through `createAsSystem` would strip the field (measured: the preserve list resolves to '
379
+ + '`["organizationId","userId"]`, because a defaulted excluded field is deliberately withheld) '
380
+ + 'and silently mint every such token as non-session-establishing; relaxing the exclusion to '
381
+ + 'fix that would open a second mint path that never meets the ceiling. So the waiver here is '
382
+ + 'not an unpaid debt — it is the shape the credential ceiling depends on. See issue #102.',
364
383
  },
365
384
  [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,
366
385
  [SCHEMA_VALIDATION]: {
@@ -415,6 +434,43 @@ export const INFRASTRUCTURE_TIER_CONTRACT = {
415
434
  + 'not be bulk-updated at all.',
416
435
  },
417
436
  },
437
+ [InfrastructureDoor.DELETE_MANY]: {
438
+ [AUTHORIZATION]: AUTHORIZATION_WAIVED,
439
+ [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,
440
+ [SCHEMA_VALIDATION]: {
441
+ posture: NOT_APPLICABLE,
442
+ reason: 'A DELETE writes no value, so there is nothing for a declared schema to validate. This is the '
443
+ + 'one WRITE door for which the concern is genuinely inapplicable rather than waived — its '
444
+ + 'siblings all carry a pre-built payload a schema could have checked and did not.',
445
+ },
446
+ [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH('a retained (erased-but-kept) row is immutable, and DESTROYING one is the sharpest form of '
447
+ + 'mutating it — the retention posture exists precisely to keep a row that must be kept, so a '
448
+ + 'framework sweep must not be the thing that reaps it.'),
449
+ [RAG_INGESTION_GATE]: {
450
+ posture: NOT_APPLICABLE,
451
+ reason: 'Materializes no value, so no `.ragSource()` field can change through it and there is nothing '
452
+ + 'to re-index. The mirror obligation — REMOVING a deleted row\'s chunks — is not this concern '
453
+ + 'and is not owned here either: the removal-seam guard '
454
+ + '(`rag-chunk-removal-seam-coverage.guard.test.ts`) excludes the raw repository doors BY '
455
+ + 'DECLARATION, bounding every one of them on the hourly reconciliation sweep\'s orphan pass, '
456
+ + 'and this door joins that family rather than opening a new question.',
457
+ },
458
+ [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,
459
+ [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,
460
+ [ADAPTER_NEUTRALITY]: {
461
+ posture: PRESERVED,
462
+ how: 'Dispatches the interface-declared `deleteManyByRawFilter`, so an adapter that omits it fails '
463
+ + 'to compile. THE DOOR EXISTS BECAUSE ITS ABSENCE WAS THE DEFECT: with a bulk UPDATE on the '
464
+ + 'tier and no bulk DELETE, the consumable-tokens cleanup batch had one route to reap rows — '
465
+ + 'reaching past the contract for `MongoDBService.getConnection()` — which made the framework\'s '
466
+ + 'only credential-retention sweep MongoDB-only. It was invisible while every application ran a '
467
+ + 'mongod beside PostgreSQL, and failed every six hours on the first one (`wonder-crm`) that '
468
+ + 'did not, with spent password-reset / invitation / magic-link rows accumulating with no '
469
+ + 'sweep. Note the neutrality this door CANNOT confer: an unexpressible predicate (`$expr`, a '
470
+ + 'column-to-column comparison) is still the caller\'s problem, and the batch resolves its one '
471
+ + 'such lane by reading candidates and comparing in memory.',
472
+ },
473
+ },
418
474
  [InfrastructureDoor.ATOMIC_GUARDED_MUTATION]: {
419
475
  [AUTHORIZATION]: AUTHORIZATION_WAIVED,
420
476
  [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,
@@ -1 +1 @@
1
- {"version":3,"file":"infrastructure-tier-contract.backend.js","sourceRoot":"","sources":["../../../../../../src/base-classes/services/repositories/infrastructure-tier-contract.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,kBAiBX;AAjBD,WAAY,kBAAkB;IAC5B,gGAAgG;IAChG,yEAAmD,CAAA;IACnD,gFAAgF;IAChF,6DAAuC,CAAA;IACvC,oFAAoF;IACpF,gEAA0C,CAAA;IAC1C,sEAAsE;IACtE,yEAAmD,CAAA;IACnD,qFAAqF;IACrF,iEAA2C,CAAA;IAC3C,yCAAyC;IACzC,uEAAiD,CAAA;IACjD,iEAAiE;IACjE,qEAA+C,CAAA;IAC/C,wCAAwC;IACxC,qEAA+C,CAAA;AACjD,CAAC,EAjBW,kBAAkB,KAAlB,kBAAkB,QAiB7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAN,IAAY,iCA4DX;AA5DD,WAAY,iCAAiC;IAC3C;;;OAGG;IACH,oEAA+B,CAAA;IAC/B;;;;;;;;;;;OAWG;IACH,qEAAgC,CAAA;IAChC;;;;OAIG;IACH,2EAAsC,CAAA;IACtC;;;;;OAKG;IACH,qEAAgC,CAAA;IAChC;;;;OAIG;IACH,4EAAuC,CAAA;IACvC;;;OAGG;IACH,+DAA0B,CAAA;IAC1B;;;;;;;;;OASG;IACH,2FAAsD,CAAA;IACtD;;;;OAIG;IACH,6EAAwC,CAAA;AAC1C,CAAC,EA5DW,iCAAiC,KAAjC,iCAAiC,QA4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,CAAA;AAC7D,CAAC,EAHW,sCAAsC,KAAtC,sCAAsC,QAGjD;AAED,MAAM,CAAC,MAAM,0CAA0C,GAGnD;IACF,CAAC,sCAAsC,CAAC,YAAY,CAAC,EACnD,8FAA8F;UAC5F,mGAAmG;UACnG,kGAAkG;UAClG,kDAAkD;IACtD,CAAC,sCAAsC,CAAC,4BAA4B,CAAC,EACnE,qGAAqG;UACnG,+FAA+F;UAC/F,mGAAmG;UACnG,kGAAkG;UAClG,+FAA+F;UAC/F,6DAA6D;CAClE,CAAC","sourcesContent":["/**\n * The contract every INFRASTRUCTURE-TIER door on {@link RepositoriesRegistryHandlerBackendService}\n * answers to.\n *\n * ## Why this file exists\n *\n * The infrastructure tier is a deliberate bypass: its doors sit BELOW the service tier, take a\n * pre-built filter or an already-final document, and run no declared operation and no authorization.\n * Its clearest warrant is field-uniqueness validation, which runs INSIDE an in-flight operation's own\n * validation, where routing back through a declared operation would be circular.\n *\n * Its WEAKEST warrant is the one the tier has most often cited, and issue #100 asked for it to be\n * settled: \"a consumable token is minted by a system action and consumed BEFORE authentication, so\n * there is genuinely no principal to authorize\". That conflates two moments. CONSUMPTION has no\n * principal — the token IS the credential. MINTING is a write the running system performs inside a\n * flow it controls, and the framework already has a vocabulary for exactly that: `createAsSystem`\n * fail-closes unless the resource opts in with `systemAccessPolicy.create = ALLOWED`, synthesises an\n * APPLICATION-scope super-admin context, and dispatches the resource's OWN declared CREATE —\n * which `CONSUMABLE_TOKENS` declares. So the framework does not owe a new \"system principal\"\n * vocabulary; one door is not using the one that exists. See `INSERT_DOCUMENT / authorization` below.\n *\n * What was missing is not correctness, it is a CONTRACT. Each door carried its own hand-written prose\n * about which cross-cutting invariant it upheld and which it skipped, so the tier's posture existed\n * only as a set of independent rationales. Adding a door, or a new invariant, meant re-deriving the\n * obligation by hand at every site with nothing mechanical to say whether it had been done — the exact\n * failure shape `.claude/rules/invariant-call-site-enumeration.md` records, where an invariant is\n * applied at one of its N sites and the miss is invisible.\n *\n * So the posture is DECLARED here instead, once, as data. Because the table is typed\n * `Record<InfrastructureDoor, Record<InfrastructureCrossCuttingConcern, …>>`, adding a member to\n * EITHER enum fails to compile until every new cell is filled in. That is the property this file is\n * for: the missing case becomes a compiler error rather than something a reviewer has to notice.\n *\n * ## The tier is EIGHT doors, not the four that share a name\n *\n * Issue #100 listed four, all suffixed `*ForInfrastructure`. That is the population the SUFFIX\n * describes, and it is half the tier. Four more handler members have the identical posture under a\n * different name — `atomicIncrementField` and `atomicConditionalSet` carry, verbatim, the same\n * `@internal Framework-internal infrastructure primitive — NOT part of the operation lifecycle. The\n * caller owns authorization, scope-aware filter construction, and audit logging.` that the suffixed\n * doors carry; `atomicGuardedMutation` and `readUnscopedByKey` likewise dispatch a caller-built filter\n * straight to an adapter with no operation above them.\n *\n * That is why {@link INFRASTRUCTURE_TIER_CONTRACT}'s pin discovers the tier by what a member DOES —\n * resolving a repository and dispatching to it — rather than by what it is called. Enumerating by name\n * finds every site that agrees with you about naming, which is `invariant-call-site-enumeration.md`\n * #12 and #20 in one. The sibling guard `rag-ingestion-write-door-coverage.guard.test.ts` had already\n * reached the same population from the write side: three of its five raw write doors carry no suffix.\n *\n * ## What this file is NOT\n *\n * It does not gate anything at runtime. A door's behaviour lives in the door; this is the record of\n * what that behaviour promises, kept adjacent and kept complete. Turning it into a runtime guard would\n * add a second authority that can disagree with the code, which is the failure this repository has\n * paid for repeatedly (see `.claude/rules/one-source-of-truth.md`).\n *\n * It is also not a place to fix a door. Filling the table surfaced one real asymmetry — see\n * {@link InfrastructureCrossCuttingConcern.TRANSACTION_PARTICIPATION} at\n * {@link InfrastructureDoor.COUNT_DOCUMENTS} — and it is RECORDED here rather than quietly repaired,\n * because a waiver nobody can see is the condition this contract exists to end.\n *\n * @see issue #100 — the decision this file implements.\n */\n\n/**\n * The doors.\n *\n * Each value is the METHOD NAME on the handler, deliberately, so\n * `__tests__/infrastructure-tier-contract.guard.test.ts` can discover the real tier from the handler's\n * source and assert this enum matches it exactly. A hand-maintained list that merely LOOKS complete is\n * what this file exists to prevent, so the list is checked against the class rather than trusted.\n */\nexport enum InfrastructureDoor {\n /** Backs field-uniqueness validation, which runs INSIDE an in-flight operation's validation. */\n COUNT_DOCUMENTS = 'countDocumentsForInfrastructure',\n /** Multi-row read for a framework-internal reader (consumable-token lookup). */\n FIND_MANY = 'findManyForInfrastructure',\n /** Single-row read below BOTH the operation tier and the execution-context tier. */\n READ_UNSCOPED_BY_KEY = 'readUnscopedByKey',\n /** INSERT of an already-final document (consumable-token minting). */\n INSERT_DOCUMENT = 'insertDocumentForInfrastructure',\n /** Multi-row guarded write (token revocation by relatedId, usage-record marking). */\n BULK_UPDATE = 'bulkUpdateForInfrastructure',\n /** Single-row compare-and-swap write. */\n ATOMIC_GUARDED_MUTATION = 'atomicGuardedMutation',\n /** Single-row counter increment (metering, quota accounting). */\n ATOMIC_INCREMENT_FIELD = 'atomicIncrementField',\n /** Single-row conditional set/clear. */\n ATOMIC_CONDITIONAL_SET = 'atomicConditionalSet',\n}\n\n/**\n * The cross-cutting invariants a door must answer for explicitly.\n *\n * ## The admission criterion, so the next member is not settled by taste\n *\n * A concern belongs here when it is an invariant that holds across the whole persistence boundary AND\n * a door can silently fail to uphold it. Members arrive on one of two bases, and each member's own\n * doc-comment names which:\n *\n * - **conferred from above** — an ordinary declared operation gets it for free at the controller or\n * service tier, and a door that runs no operation therefore does not (authorization, tenant\n * scoping, schema validation, the RAG ingestion gate, the audit trail);\n * - **promised by the door itself** — nothing above confers it; the door's own general name promises\n * it, and the family has broken it in production (retention hide, transaction participation,\n * adapter neutrality).\n *\n * This set is OPEN. Adding a member is the point: it immediately breaks compilation at all eight doors\n * until each declares a posture. Candidates DELIBERATELY excluded are recorded as data in\n * {@link INFRASTRUCTURE_CONCERN_CANDIDATES_EXCLUDED} rather than left absent — an absence is\n * indistinguishable from an oversight, which is the shape this whole file is about.\n */\nexport enum InfrastructureCrossCuttingConcern {\n /**\n * CONFERRED FROM ABOVE. Who may do this. The controller resolves it from the declared operation's\n * roles and variant; these doors run no operation, so nothing resolves a principal.\n */\n AUTHORIZATION = 'authorization',\n /**\n * CONFERRED FROM ABOVE. Which TENANT'S rows this statement may reach. The adapters' own\n * `buildContextualFilter` injects the scope FK (organizationId / userId) into every operation-tier\n * filter; the raw primitives these doors dispatch deliberately do not call it — \"the caller's filter\n * is the whole confinement, by design\".\n *\n * Distinct from {@link AUTHORIZATION} on purpose, and the distinction is the tier's own: the handler\n * states at `readUnscopedByKey` that \"a read that skips tenant scoping must NOT also skip erasure\n * retention: those are different questions\". Roles and rows are two gates, answered from two inputs,\n * and fusing them is what `.claude/rules/administrative-continuity-floors.md` records as producing\n * cross-tenant reach nobody declared.\n */\n TENANT_SCOPING = 'tenantScoping',\n /**\n * CONFERRED FROM ABOVE. That a written value was checked against a declared schema. The controller's\n * `validateRequestData` parses the payload through the operation's `requestDto` before any write;\n * these doors take an already-built document or mutation descriptor and no Zod schema sees it.\n */\n SCHEMA_VALIDATION = 'schemaValidation',\n /**\n * PROMISED BY THE DOOR. An erased-but-retained row must stay invisible to reads and unaffected by\n * writes — \"kept but frozen\". The tier applies it at its own single dispatch point\n * (`applyRetentionHideToRawFilter`) rather than in each adapter, so a future adapter inherits it by\n * construction.\n */\n RETENTION_HIDE = 'retentionHide',\n /**\n * CONFERRED FROM ABOVE. A `.ragSource()` field changing must re-derive the affected chunk set. The\n * hook lives at the service tier's single post-commit chokepoint, which is ABOVE these doors, so no\n * door can feed it.\n */\n RAG_INGESTION_GATE = 'ragIngestionGate',\n /**\n * CONFERRED FROM ABOVE. A security-relevant action must leave an auditable record. The operation\n * lifecycle emits it; no lifecycle runs here.\n */\n AUDIT_TRAIL = 'auditTrail',\n /**\n * PROMISED BY THE DOOR. A statement issued inside a caller's transaction must ENROL in it. Every\n * underlying primitive accepts `RepositoryOptions` and both adapters honour it, so whether a door\n * participates is decided entirely by whether the door accepts and forwards them.\n *\n * This is a member because the family has already lost it once, silently and expensively:\n * `bulkUpdateForInfrastructure` neither accepted nor forwarded options, so `revokeTokensByRelatedId`\n * committed immediately regardless of its caller's transaction and a driver retry observed a count\n * of 0 for work that had happened exactly once.\n */\n TRANSACTION_PARTICIPATION = 'transactionParticipation',\n /**\n * PROMISED BY THE DOOR. A generally-named capability must work on every persistence adapter, not\n * only the one it was written against. A member here is one the family has broken twice — both\n * breakages were a reach for `(repository as any).mongooseModel` behind a neutral-sounding name.\n */\n ADAPTER_NEUTRALITY = 'adapterNeutrality',\n}\n\nexport enum InfrastructureConcernPosture {\n /** The door itself upholds the invariant. */\n PRESERVED = 'preserved',\n /** The invariant could apply and deliberately is not upheld. A reason is required. */\n WAIVED = 'waived',\n /** The invariant cannot apply to this door's shape at all (e.g. a retention hide on an INSERT). */\n NOT_APPLICABLE = 'not-applicable',\n}\n\n/**\n * `compensation` is the field that makes a waiver reviewable: it names what ELSE catches the gap, or\n * is `null` to state plainly that nothing does. A waiver with no compensation is not forbidden — it is\n * simply visible, which is the whole ask of issue #100.\n */\nexport type InfrastructureConcernDeclaration =\n | { posture: InfrastructureConcernPosture.PRESERVED; how: string }\n | { posture: InfrastructureConcernPosture.WAIVED; reason: string; compensation: string | null }\n | { posture: InfrastructureConcernPosture.NOT_APPLICABLE; reason: string };\n\nconst { PRESERVED, WAIVED, NOT_APPLICABLE } = InfrastructureConcernPosture;\nconst {\n AUTHORIZATION,\n TENANT_SCOPING,\n SCHEMA_VALIDATION,\n RETENTION_HIDE,\n RAG_INGESTION_GATE,\n AUDIT_TRAIL,\n TRANSACTION_PARTICIPATION,\n ADAPTER_NEUTRALITY,\n} = InfrastructureCrossCuttingConcern;\n\n// ── Declarations shared verbatim across doors ────────────────────────────────────────────────────\n// Written once where the reason is genuinely the same one. Where a door's reason is its own, it is\n// written at the door — moved from that door's JSDoc rather than paraphrased, so the rationale exists\n// in exactly one place and cannot drift from the copy it was summarised into.\n\n/**\n * Identical at all eight doors. The placement note is the real mitigation: these members live on the\n * HANDLER and not on the `BackendResourceRepository` interface an application's custom code is handed.\n */\nconst AUTHORIZATION_WAIVED: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason:\n 'Below the service tier: no declared operation runs, so there is no principal to resolve. The '\n + 'caller authorizes before calling; `executionContext` here is error context only and is never '\n + 'read for authorization.',\n compensation:\n 'Declared on the handler rather than on the `BackendResourceRepository` interface, so custom '\n + 'application code cannot reach these doors through the repository it is given.',\n};\n\n/** Identical at all eight doors: the caller's filter or document is the whole confinement. */\nconst TENANT_SCOPING_WAIVED: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason:\n 'The adapters\\' `buildContextualFilter` — which injects the resource\\'s scope FK — runs on the '\n + 'operation-tier paths only. A raw primitive takes the caller\\'s filter as given, so a door '\n + 'reaching a scope-bearing resource without its scope predicate returns cross-tenant rows and '\n + 'nothing below the door re-adds it.',\n compensation:\n 'Handler-only placement (as for authorization), plus the narrowness of the callers: the tier is '\n + 'reached today only by field-uniqueness validation, consumable tokens and usage metering, each '\n + 'of which builds its own filter. Nothing mechanical enforces that on a future caller.',\n};\n\n/** Identical at all eight doors: the door emits nothing, and nothing downstream substitutes for it. */\nconst AUDIT_TRAIL_WAIVED: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason: 'No operation lifecycle runs, so no auditable event is emitted by the door itself.',\n compensation: null,\n};\n\n/** The three read doors: a read materializes no value, so no schema could be applied to one. */\nconst SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ: InfrastructureConcernDeclaration = {\n posture: NOT_APPLICABLE,\n reason: 'Read-only: writes no value, so there is nothing for a declared schema to validate.',\n};\n\n/** The three read doors. */\nconst RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ: InfrastructureConcernDeclaration = {\n posture: NOT_APPLICABLE,\n reason: 'Read-only: writes nothing, so no `.ragSource()` field can change through it.',\n};\n\n/**\n * The five write doors, minus {@link InfrastructureDoor.INSERT_DOCUMENT}, which has its own partial\n * compensation (the cast).\n */\nconst SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason:\n 'The door takes an already-built mutation descriptor. The ordinary UPDATE path validates the '\n + 'after-image against the resource\\'s main schema; nothing on this path does, so a value outside '\n + 'a declared Zod constraint is stored as given.',\n compensation:\n 'Shape only, never values: `describeGuardedMutationInexpressibility` refuses a mutation that '\n + 'cannot be expressed on every adapter. Nothing checks what the mutation SAYS.',\n};\n\n/** Seven of the eight doors accept `RepositoryOptions` and forward them unchanged. */\nconst TRANSACTION_PARTICIPATION_PRESERVED: InfrastructureConcernDeclaration = {\n posture: PRESERVED,\n how:\n 'Accepts `RepositoryOptions` and forwards them to the primitive, so a caller already inside a '\n + 'transaction enrols this statement in it (Mongo session / PG trx).',\n};\n\n/**\n * The four doors whose only adapter-neutrality claim is that they dispatch a primitive declared on the\n * `BackendResourceRepository` interface — so an adapter omitting one fails to compile rather than\n * throwing on first use. All eight raw primitives are declared there and implemented on both arms.\n */\nconst ADAPTER_NEUTRALITY_PRESERVED_BY_CONTRACT = (primitive: string): InfrastructureConcernDeclaration => ({\n posture: PRESERVED,\n how:\n `Dispatches \\`${primitive}\\`, which is declared on the \\`BackendResourceRepository\\` interface and `\n + 'implemented by both the MongoDB and PostgreSQL arms — so an adapter that omits it fails to '\n + 'compile rather than throwing on first use. No `as any` and no runtime `typeof` probe.',\n});\n\n/**\n * The retention hide as five of the six filter-bearing doors state it: applied at THIS dispatch point\n * and only here, so both adapter arms receive an already-hidden filter and the predicate lives in one\n * place. {@link InfrastructureDoor.COUNT_DOCUMENTS} states a stronger, caller-specific reason and\n * carries its own.\n */\nconst RETENTION_HIDE_PRESERVED_AT_DISPATCH = (consequence: string): InfrastructureConcernDeclaration => ({\n posture: PRESERVED,\n how:\n `The filter passes through \\`applyRetentionHideToRawFilter\\` HERE and only here — ${consequence} `\n + 'Enforcing it at the single dispatch point rather than in each adapter is what stops it drifting: '\n + 'a future adapter inherits the predicate by construction.',\n});\n\n/**\n * The five write doors' RAG posture, identical in mechanism and differing only in what the sweep\n * reconciles for that door's shape. Moved from each door's own `rag-ingestion-gate: N/A —` comment,\n * which the sibling guard `rag-ingestion-write-door-coverage.guard.test.ts` still requires to be\n * present AT the door; that guard checks the waiver EXISTS, this table records what it says.\n */\nconst RAG_INGESTION_GATE_WAIVED_TO_SWEEP = (bound: string): InfrastructureConcernDeclaration => ({\n posture: WAIVED,\n reason:\n 'Below the service tier, so the post-commit ingestion chokepoint cannot observe this door. A '\n + '`.ragSource()` field written through it is not re-indexed at write time.',\n compensation: `The hourly RAG reconciliation sweep: ${bound}`,\n});\n\nexport const INFRASTRUCTURE_TIER_CONTRACT: Record<\n InfrastructureDoor,\n Record<InfrastructureCrossCuttingConcern, InfrastructureConcernDeclaration>\n> = {\n [InfrastructureDoor.COUNT_DOCUMENTS]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ,\n [RETENTION_HIDE]: {\n posture: PRESERVED,\n how:\n 'The filter passes through `applyRetentionHideToRawFilter` here and only here. Counting a '\n + 'hidden row would report a collision against a record the caller cannot see — an existence '\n + 'oracle for the field-uniqueness-validation caller. The consequence (a later INSERT can then '\n + 'collide on a plain unique business-key index) is the separate, tracked G-BKEY gate, and is '\n + 'NOT resolved by re-leaking the row here.',\n },\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ,\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: {\n posture: WAIVED,\n reason:\n 'THE ONE DOOR THAT CANNOT PARTICIPATE, and not by decision: it accepts no `RepositoryOptions` '\n + 'parameter at all, so a caller inside a transaction counts OUTSIDE it and cannot see its own '\n + 'uncommitted rows. `countByRawFilter` accepts and honours options on both arms; only this '\n + 'door drops them — the identical shape its sibling `bulkUpdateForInfrastructure` records as '\n + '\"a silent correctness hole\", at the one door nobody enumerated. Surfaced by filling this '\n + 'table, deliberately recorded rather than repaired here: fixing a door inside the change that '\n + 'declares the contract would hide the demonstration that the contract works. Filed as issue '\n + '#104; flip this cell to PRESERVED when it lands.',\n compensation: null,\n },\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Delegates to `countByRawFilter`. It previously reached `(repository as any).mongooseModel`, '\n + 'which made it MongoDB-only and left field-uniqueness validation unable to answer \"is this '\n + 'value already taken?\" on any PostgreSQL-backed resource — a generally-named capability one '\n + 'adapter did not have.',\n },\n },\n\n [InfrastructureDoor.FIND_MANY]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained row must stay invisible to reads, and this is the single place the predicate is added '\n + 'for this path.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ,\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: ADAPTER_NEUTRALITY_PRESERVED_BY_CONTRACT('findManyByRawFilter'),\n },\n\n [InfrastructureDoor.READ_UNSCOPED_BY_KEY]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: {\n posture: WAIVED,\n reason:\n 'Unscoped BY NAME and by design — the only read on the repository contract that takes no '\n + 'execution context at all. Scope narrowing is the caller\\'s filter to express here.',\n compensation:\n 'Only the boundary this door does NOT relax: a read that skips tenant scoping must not also '\n + 'skip erasure retention — those are different questions — so the hide is applied '\n + 'unconditionally below. Nothing re-adds the scope predicate.',\n },\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'no caller may opt out of erasure retention by choosing this entry point, however unscoped the '\n + 'read itself is.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ,\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: ADAPTER_NEUTRALITY_PRESERVED_BY_CONTRACT('readUnscopedByKey'),\n },\n\n [InfrastructureDoor.INSERT_DOCUMENT]: {\n [AUTHORIZATION]: {\n posture: WAIVED,\n reason:\n 'Below the service tier, so no principal is resolved — but unlike its siblings this door has '\n + 'a DECLARED alternative it is not using, and the reason it gives for not using it does not '\n + 'hold. \"A consumable token is consumed before authentication, so there is no principal to '\n + 'authorize\" is true of CONSUMPTION and not of MINTING, which is a write the running system '\n + 'performs inside a flow it controls. `SystemAccessBackendService.createAsSystem` exists for '\n + 'precisely that principal, and `CONSUMABLE_TOKENS` already declares a CREATE operation '\n + '(INTERNAL_CALL, ORG_ADMIN, with a requestDto). Routing through it would restore schema '\n + 'validation, the RAG ingestion hook, the audit trail and the scope-context channel at this '\n + 'door — five of the eight rows below stop being waivers.',\n compensation:\n 'Handler-only placement, as for every door here. What stops the migration is narrow and '\n + 'specific rather than principled — the declared requestDto omits the `_id`, `createdAt` and '\n + '`updatedAt` this caller supplies deliberately; `CONSUMABLE_TOKENS` declares no '\n + '`systemAccessPolicy`, so `createAsSystem` fail-closes today; the declared variant is gated '\n + 'on ORG_ADMIN at organization scope, which a signup-time magic-link mint does not have; and '\n + 'the caller reads the raw duplicate-key error to detect an `activeGenerationKey` conflict. '\n + 'Tracked as issue #102 — the decision to migrate the caller — rather than answered here.',\n },\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: {\n posture: WAIVED,\n reason:\n 'The callers build a COMPLETE document — their own `_id`, their own `createdAt`/`updatedAt` — '\n + 'so the write deliberately skips the model create path: `Model.castObject` applies the '\n + 'schema\\'s type CASTS only, no defaults, no timestamps, NO VALIDATION. A value outside a '\n + 'declared Zod constraint is stored as given.',\n compensation:\n 'The cast THROWS on a value the schema cannot represent (a non-ObjectId string on an '\n + '`isForeignKey` path), so a structurally impossible write fails loudly at the write instead '\n + 'of storing a row no cast filter can ever match — issue #71\\'s silent form. Field-level '\n + 'constraints are not checked by anything.',\n },\n [RETENTION_HIDE]: {\n posture: NOT_APPLICABLE,\n reason:\n 'An INSERT creates a brand-new row, so there is no existing row to protect. A retained row is '\n + 'reached only through a filter, and this statement carries none.',\n },\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its missing-set row scan picks the row up.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Delegates to `insertRawDocument`, which casts the document through the model before the driver '\n + 'sees it — the fix for issue #71. Uncast, this tier wrote a string where every sibling queries '\n + 'an ObjectId, so a row written by this tier was not reliably findable BY this tier '\n + '(`revokeTokensByRelatedId` matched 0 rows that existed). The PostgreSQL arm routes the same '\n + 'insert through `toSqlWriteRow` for exactly this reason.',\n },\n },\n\n [InfrastructureDoor.BULK_UPDATE]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a bulk infrastructure update must never rewrite an erased-but-retained row, and retained rows are '\n + 'excluded from the modified count.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison reconciles the affected chunk sets.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: {\n posture: PRESERVED,\n how:\n 'Accepts `RepositoryOptions` and forwards them — and this door is WHY the concern is on this '\n + 'axis. It did neither until recently, so every bulk infrastructure update committed '\n + 'immediately regardless of the transaction its caller was inside: `revokeTokensByRelatedId`\\'s '\n + 'revocation could not be rolled back, and on a driver retry the caller observed a count of 0 '\n + 'for work that had in fact happened exactly once.',\n },\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Takes an ADAPTER-NEUTRAL mutation descriptor rather than a raw `{ $set: … }`, and refuses a '\n + 'mutation it cannot express on every adapter instead of silently degrading. The dialect used '\n + 'to sit in the SIGNATURE, so every caller wrote MongoDB and a PostgreSQL-backed resource could '\n + 'not be bulk-updated at all.',\n },\n },\n\n [InfrastructureDoor.ATOMIC_GUARDED_MUTATION]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained row is immutable, so the compare-and-swap must never match one.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison reconciles the affected chunk set.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Refuses a mutation that is not adapter-neutral (`describeGuardedMutationInexpressibility`) '\n + 'BEFORE dispatching, rather than degrading on the arm that cannot express it, and dispatches '\n + 'an interface-declared primitive.',\n },\n },\n\n [InfrastructureDoor.ATOMIC_INCREMENT_FIELD]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained (erased-but-kept) row is immutable and must never be incremented.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison re-derives the chunk set. In practice this door writes counters, '\n + 'never corpus text.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Dispatches the interface-declared `atomicIncrementField`. Its predecessor took a MongoDB update '\n + 'expression and reached for `mongooseModel`, so a counter built on it did not merely degrade '\n + 'on PostgreSQL — it failed every write, and where the caller swallowed the error (as metering '\n + 'paths do, so accounting never breaks a served request) the counter silently stayed at zero '\n + 'and any cap built on it never fired.',\n },\n },\n\n [InfrastructureDoor.ATOMIC_CONDITIONAL_SET]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained row is immutable, so neither the set nor the clear may reach one.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison reconciles the chunk set of a field set or cleared through it.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Dispatches the interface-declared `atomicConditionalSet`. Until the neutral primitives '\n + 'existed, CLEARING a field had no adapter-neutral expression at all — the only route was the '\n + 'raw-MongoDB `atomicConditionalUpdate` (since retired), so every clear was silently also a '\n + 'MongoDB pin. The file-cleanup batch is the case that forced it: it clears stale link '\n + 'metadata from timed-out and malformed rows, so a PostgreSQL-backed FILES resource would '\n + 'have accepted writes and then stranded every row that batch exists to normalize.',\n },\n },\n};\n\n// ── The boundary of the enumeration, recorded rather than left implicit ──────────────────────────\n\n/**\n * Handler members that resolve a repository and dispatch to it, and are NOT infrastructure doors.\n *\n * The pin discovers the tier behaviourally — \"resolves a repository, then dispatches to it\" — which is\n * the only discovery that survives a rename. That query also finds the one member for which the answer\n * is legitimately different, and it is named here so the exclusion is a declaration a reader can\n * challenge rather than a silent filter inside a test.\n *\n * The pin asserts each of these is actually FOUND by the discovery, so an entry that stops matching\n * cannot quietly shrink the population it is excluded from.\n */\nexport const INFRASTRUCTURE_TIER_OPERATION_DISPATCH_MEMBERS: Readonly<Record<string, string>> = {\n doByExecutionContext:\n 'The DECLARED-operation dispatcher — the opposite of this tier. It carries an `ExecutionContext` '\n + 'whose operation the service and controller tiers have already authorized, and `doByPath` / '\n + '`doByKey` both funnel into it. It is found by the same query because it, too, resolves a '\n + 'repository and calls it.',\n};\n\n/**\n * Cross-cutting concerns CONSIDERED for {@link InfrastructureCrossCuttingConcern} and deliberately\n * left out, with the reason each collapses into an existing member.\n *\n * Recorded as data, not omitted, because `.claude/rules/invariant-call-site-enumeration.md` #14 is\n * exactly this: a site that DECLARES itself exempt is quieter than a missing one, so the declaration\n * has to be somewhere a reader can check it. Both entries below were checked against code rather than\n * reasoned about — the citations are the point.\n */\nexport enum InfrastructureExcludedConcernCandidate {\n SIEM_ROUTING = 'siemRouting',\n SUBJECT_ERASURE_REACHABILITY = 'subjectErasureReachability',\n}\n\nexport const INFRASTRUCTURE_CONCERN_CANDIDATES_EXCLUDED: Record<\n InfrastructureExcludedConcernCandidate,\n string\n> = {\n [InfrastructureExcludedConcernCandidate.SIEM_ROUTING]:\n 'Entailed by AUDIT_TRAIL, not independent of it. The routing service is declared as one that '\n + '\"dispatches AUDIT EVENTS to org SIEM endpoints\" (`inject/models/service-types.ts`), so its input '\n + 'is an emitted event. A door that emits none produces nothing to route, and a per-door SIEM cell '\n + 'could only ever restate that door\\'s audit cell.',\n [InfrastructureExcludedConcernCandidate.SUBJECT_ERASURE_REACHABILITY]:\n 'Splits cleanly into a half that is already a member and a half that is not a property of the door. '\n + 'The VISIBILITY-and-immutability half of erasure IS the retention hide — same predicate, same '\n + 'dispatch point — and is declared per door as RETENTION_HIDE. The DISCOVERY half (can the erasure '\n + 'orchestrator find the rows?) is answered by the resource graph: `eraseSubjectInPlace` walks the '\n + 'edges of the subject resource\\'s own configuration, so a row is reachable because of how its '\n + 'resource is declared, never because of which door wrote it.',\n};\n"]}
1
+ {"version":3,"file":"infrastructure-tier-contract.backend.js","sourceRoot":"","sources":["../../../../../../src/base-classes/services/repositories/infrastructure-tier-contract.backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0EG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,kBAmBX;AAnBD,WAAY,kBAAkB;IAC5B,gGAAgG;IAChG,yEAAmD,CAAA;IACnD,gFAAgF;IAChF,6DAAuC,CAAA;IACvC,oFAAoF;IACpF,gEAA0C,CAAA;IAC1C,sEAAsE;IACtE,yEAAmD,CAAA;IACnD,qFAAqF;IACrF,iEAA2C,CAAA;IAC3C,+DAA+D;IAC/D,iEAA2C,CAAA;IAC3C,yCAAyC;IACzC,uEAAiD,CAAA;IACjD,iEAAiE;IACjE,qEAA+C,CAAA;IAC/C,wCAAwC;IACxC,qEAA+C,CAAA;AACjD,CAAC,EAnBW,kBAAkB,KAAlB,kBAAkB,QAmB7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAN,IAAY,iCA4DX;AA5DD,WAAY,iCAAiC;IAC3C;;;OAG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HW,sCAAsC,KAAtC,sCAAsC,QAGjD;AAED,MAAM,CAAC,MAAM,0CAA0C,GAGnD;IACF,CAAC,sCAAsC,CAAC,YAAY,CAAC,EACnD,8FAA8F;UAC5F,mGAAmG;UACnG,kGAAkG;UAClG,kDAAkD;IACtD,CAAC,sCAAsC,CAAC,4BAA4B,CAAC,EACnE,qGAAqG;UACnG,+FAA+F;UAC/F,mGAAmG;UACnG,kGAAkG;UAClG,+FAA+F;UAC/F,6DAA6D;CAClE,CAAC","sourcesContent":["/**\n * The contract every INFRASTRUCTURE-TIER door on {@link RepositoriesRegistryHandlerBackendService}\n * answers to.\n *\n * ## Why this file exists\n *\n * The infrastructure tier is a deliberate bypass: its doors sit BELOW the service tier, take a\n * pre-built filter or an already-final document, and run no declared operation and no authorization.\n * Its clearest warrant is the field-uniqueness check behind the `validate-field` route. A field\n * declared unique with `scope: 'global'` must be counted across the ENTIRE collection — \"no additional\n * filter (intentional — check entire collection)\" — including tenants the caller cannot see, and the\n * answer returned as nothing but a number. A declared operation cannot serve that: `buildContextualFilter`\n * would scope the count to the caller's tenant and the answer would simply be wrong. So the door\n * deliberately waives tenant scoping and deliberately does NOT waive the retention hide, because\n * counting a hidden row would turn the same number into an existence oracle.\n *\n * Its WEAKEST warrant is the one the tier has most often cited, and issue #100 asked for it to be\n * settled: \"a consumable token is minted by a system action and consumed BEFORE authentication, so\n * there is genuinely no principal to authorize\". That conflates two moments. CONSUMPTION has no\n * principal — the token IS the credential. MINTING is a write the running system performs inside a\n * flow it controls, and the framework already has a vocabulary for exactly that: `createAsSystem`\n * fail-closes unless the resource opts in with `systemAccessPolicy.create = ALLOWED`, synthesises an\n * APPLICATION-scope super-admin context, and dispatches the resource's OWN declared CREATE —\n * which `CONSUMABLE_TOKENS` declares. So the framework does not owe a new \"system principal\"\n * vocabulary.\n *\n * That settles the FRAMEWORK question and deliberately does not settle the CALLER's: this door turns\n * out to have a second, stronger reason to bypass the declared pipeline. `createsOneOffSession` is\n * sealed `.excludeFromCreate()` so that no repository-create path can mint a session-establishing\n * token, which is what makes `createToken` the sole minter and therefore the single funnel enforcing\n * the impersonation-credential lifetime ceiling. A raw door is the shape that seal depends on. See\n * `INSERT_DOCUMENT / authorization` below, and issue #102.\n *\n * What was missing is not correctness, it is a CONTRACT. Each door carried its own hand-written prose\n * about which cross-cutting invariant it upheld and which it skipped, so the tier's posture existed\n * only as a set of independent rationales. Adding a door, or a new invariant, meant re-deriving the\n * obligation by hand at every site with nothing mechanical to say whether it had been done — the exact\n * failure shape `.claude/rules/invariant-call-site-enumeration.md` records, where an invariant is\n * applied at one of its N sites and the miss is invisible.\n *\n * So the posture is DECLARED here instead, once, as data. Because the table is typed\n * `Record<InfrastructureDoor, Record<InfrastructureCrossCuttingConcern, …>>`, adding a member to\n * EITHER enum fails to compile until every new cell is filled in. That is the property this file is\n * for: the missing case becomes a compiler error rather than something a reviewer has to notice.\n *\n * ## The tier is NINE doors, not the four that share a name\n *\n * Issue #100 listed four, all suffixed `*ForInfrastructure`. That is the population the SUFFIX\n * describes, and it was half the tier. Four more handler members have the identical posture under a\n * different name — `atomicIncrementField` and `atomicConditionalSet` carry, verbatim, the same\n * `@internal Framework-internal infrastructure primitive — NOT part of the operation lifecycle. The\n * caller owns authorization, scope-aware filter construction, and audit logging.` that the suffixed\n * doors carry; `atomicGuardedMutation` and `readUnscopedByKey` likewise dispatch a caller-built filter\n * straight to an adapter with no operation above them.\n *\n * That is why {@link INFRASTRUCTURE_TIER_CONTRACT}'s pin discovers the tier by what a member DOES —\n * resolving a repository and dispatching to it — rather than by what it is called. Enumerating by name\n * finds every site that agrees with you about naming, which is `invariant-call-site-enumeration.md`\n * #12 and #20 in one. The sibling guard `rag-ingestion-write-door-coverage.guard.test.ts` had already\n * reached the same population from the write side: three of its five raw write doors carry no suffix.\n *\n * ## What this file is NOT\n *\n * It does not gate anything at runtime. A door's behaviour lives in the door; this is the record of\n * what that behaviour promises, kept adjacent and kept complete. Turning it into a runtime guard would\n * add a second authority that can disagree with the code, which is the failure this repository has\n * paid for repeatedly (see `.claude/rules/one-source-of-truth.md`).\n *\n * It is also not a place to fix a door. Filling the table surfaced one real asymmetry — see\n * {@link InfrastructureCrossCuttingConcern.TRANSACTION_PARTICIPATION} at\n * {@link InfrastructureDoor.COUNT_DOCUMENTS} — and it is RECORDED here rather than quietly repaired,\n * because a waiver nobody can see is the condition this contract exists to end.\n *\n * @see issue #100 — the decision this file implements.\n */\n\n/**\n * The doors.\n *\n * Each value is the METHOD NAME on the handler, deliberately, so\n * `__tests__/infrastructure-tier-contract.guard.test.ts` can discover the real tier from the handler's\n * source and assert this enum matches it exactly. A hand-maintained list that merely LOOKS complete is\n * what this file exists to prevent, so the list is checked against the class rather than trusted.\n */\nexport enum InfrastructureDoor {\n /** Backs field-uniqueness validation, which runs INSIDE an in-flight operation's validation. */\n COUNT_DOCUMENTS = 'countDocumentsForInfrastructure',\n /** Multi-row read for a framework-internal reader (consumable-token lookup). */\n FIND_MANY = 'findManyForInfrastructure',\n /** Single-row read below BOTH the operation tier and the execution-context tier. */\n READ_UNSCOPED_BY_KEY = 'readUnscopedByKey',\n /** INSERT of an already-final document (consumable-token minting). */\n INSERT_DOCUMENT = 'insertDocumentForInfrastructure',\n /** Multi-row guarded write (token revocation by relatedId, usage-record marking). */\n BULK_UPDATE = 'bulkUpdateForInfrastructure',\n /** Multi-row DELETE (the consumable-token retention sweep). */\n DELETE_MANY = 'deleteManyForInfrastructure',\n /** Single-row compare-and-swap write. */\n ATOMIC_GUARDED_MUTATION = 'atomicGuardedMutation',\n /** Single-row counter increment (metering, quota accounting). */\n ATOMIC_INCREMENT_FIELD = 'atomicIncrementField',\n /** Single-row conditional set/clear. */\n ATOMIC_CONDITIONAL_SET = 'atomicConditionalSet',\n}\n\n/**\n * The cross-cutting invariants a door must answer for explicitly.\n *\n * ## The admission criterion, so the next member is not settled by taste\n *\n * A concern belongs here when it is an invariant that holds across the whole persistence boundary AND\n * a door can silently fail to uphold it. Members arrive on one of two bases, and each member's own\n * doc-comment names which:\n *\n * - **conferred from above** — an ordinary declared operation gets it for free at the controller or\n * service tier, and a door that runs no operation therefore does not (authorization, tenant\n * scoping, schema validation, the RAG ingestion gate, the audit trail);\n * - **promised by the door itself** — nothing above confers it; the door's own general name promises\n * it, and the family has broken it in production (retention hide, transaction participation,\n * adapter neutrality).\n *\n * This set is OPEN. Adding a member is the point: it immediately breaks compilation at every door\n * until each declares a posture. Candidates DELIBERATELY excluded are recorded as data in\n * {@link INFRASTRUCTURE_CONCERN_CANDIDATES_EXCLUDED} rather than left absent — an absence is\n * indistinguishable from an oversight, which is the shape this whole file is about.\n */\nexport enum InfrastructureCrossCuttingConcern {\n /**\n * CONFERRED FROM ABOVE. Who may do this. The controller resolves it from the declared operation's\n * roles and variant; these doors run no operation, so nothing resolves a principal.\n */\n AUTHORIZATION = 'authorization',\n /**\n * CONFERRED FROM ABOVE. Which TENANT'S rows this statement may reach. The adapters' own\n * `buildContextualFilter` injects the scope FK (organizationId / userId) into every operation-tier\n * filter; the raw primitives these doors dispatch deliberately do not call it — \"the caller's filter\n * is the whole confinement, by design\".\n *\n * Distinct from {@link AUTHORIZATION} on purpose, and the distinction is the tier's own: the handler\n * states at `readUnscopedByKey` that \"a read that skips tenant scoping must NOT also skip erasure\n * retention: those are different questions\". Roles and rows are two gates, answered from two inputs,\n * and fusing them is what `.claude/rules/administrative-continuity-floors.md` records as producing\n * cross-tenant reach nobody declared.\n */\n TENANT_SCOPING = 'tenantScoping',\n /**\n * CONFERRED FROM ABOVE. That a written value was checked against a declared schema. The controller's\n * `validateRequestData` parses the payload through the operation's `requestDto` before any write;\n * these doors take an already-built document or mutation descriptor and no Zod schema sees it.\n */\n SCHEMA_VALIDATION = 'schemaValidation',\n /**\n * PROMISED BY THE DOOR. An erased-but-retained row must stay invisible to reads and unaffected by\n * writes — \"kept but frozen\". The tier applies it at its own single dispatch point\n * (`applyRetentionHideToRawFilter`) rather than in each adapter, so a future adapter inherits it by\n * construction.\n */\n RETENTION_HIDE = 'retentionHide',\n /**\n * CONFERRED FROM ABOVE. A `.ragSource()` field changing must re-derive the affected chunk set. The\n * hook lives at the service tier's single post-commit chokepoint, which is ABOVE these doors, so no\n * door can feed it.\n */\n RAG_INGESTION_GATE = 'ragIngestionGate',\n /**\n * CONFERRED FROM ABOVE. A security-relevant action must leave an auditable record. The operation\n * lifecycle emits it; no lifecycle runs here.\n */\n AUDIT_TRAIL = 'auditTrail',\n /**\n * PROMISED BY THE DOOR. A statement issued inside a caller's transaction must ENROL in it. Every\n * underlying primitive accepts `RepositoryOptions` and both adapters honour it, so whether a door\n * participates is decided entirely by whether the door accepts and forwards them.\n *\n * This is a member because the family has already lost it once, silently and expensively:\n * `bulkUpdateForInfrastructure` neither accepted nor forwarded options, so `revokeTokensByRelatedId`\n * committed immediately regardless of its caller's transaction and a driver retry observed a count\n * of 0 for work that had happened exactly once.\n */\n TRANSACTION_PARTICIPATION = 'transactionParticipation',\n /**\n * PROMISED BY THE DOOR. A generally-named capability must work on every persistence adapter, not\n * only the one it was written against. A member here is one the family has broken twice — both\n * breakages were a reach for `(repository as any).mongooseModel` behind a neutral-sounding name.\n */\n ADAPTER_NEUTRALITY = 'adapterNeutrality',\n}\n\nexport enum InfrastructureConcernPosture {\n /** The door itself upholds the invariant. */\n PRESERVED = 'preserved',\n /** The invariant could apply and deliberately is not upheld. A reason is required. */\n WAIVED = 'waived',\n /** The invariant cannot apply to this door's shape at all (e.g. a retention hide on an INSERT). */\n NOT_APPLICABLE = 'not-applicable',\n}\n\n/**\n * `compensation` is the field that makes a waiver reviewable: it names what ELSE catches the gap, or\n * is `null` to state plainly that nothing does. A waiver with no compensation is not forbidden — it is\n * simply visible, which is the whole ask of issue #100.\n */\nexport type InfrastructureConcernDeclaration =\n | { posture: InfrastructureConcernPosture.PRESERVED; how: string }\n | { posture: InfrastructureConcernPosture.WAIVED; reason: string; compensation: string | null }\n | { posture: InfrastructureConcernPosture.NOT_APPLICABLE; reason: string };\n\nconst { PRESERVED, WAIVED, NOT_APPLICABLE } = InfrastructureConcernPosture;\nconst {\n AUTHORIZATION,\n TENANT_SCOPING,\n SCHEMA_VALIDATION,\n RETENTION_HIDE,\n RAG_INGESTION_GATE,\n AUDIT_TRAIL,\n TRANSACTION_PARTICIPATION,\n ADAPTER_NEUTRALITY,\n} = InfrastructureCrossCuttingConcern;\n\n// ── Declarations shared verbatim across doors ────────────────────────────────────────────────────\n// Written once where the reason is genuinely the same one. Where a door's reason is its own, it is\n// written at the door — moved from that door's JSDoc rather than paraphrased, so the rationale exists\n// in exactly one place and cannot drift from the copy it was summarised into.\n\n/**\n * Identical at every door. The placement note is the real mitigation: these members live on the\n * HANDLER and not on the `BackendResourceRepository` interface an application's custom code is handed.\n */\nconst AUTHORIZATION_WAIVED: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason:\n 'Below the service tier: no declared operation runs, so there is no principal to resolve. The '\n + 'caller authorizes before calling; `executionContext` here is error context only and is never '\n + 'read for authorization.',\n compensation:\n 'Declared on the handler rather than on the `BackendResourceRepository` interface, so custom '\n + 'application code cannot reach these doors through the repository it is given.',\n};\n\n/** Identical at every door: the caller's filter or document is the whole confinement. */\nconst TENANT_SCOPING_WAIVED: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason:\n 'The adapters\\' `buildContextualFilter` — which injects the resource\\'s scope FK — runs on the '\n + 'operation-tier paths only. A raw primitive takes the caller\\'s filter as given, so a door '\n + 'reaching a scope-bearing resource without its scope predicate returns cross-tenant rows and '\n + 'nothing below the door re-adds it.',\n compensation:\n 'Handler-only placement (as for authorization), plus the narrowness of the callers: the tier is '\n + 'reached today only by field-uniqueness validation, consumable tokens and usage metering, each '\n + 'of which builds its own filter. Nothing mechanical enforces that on a future caller.',\n};\n\n/** Identical at every door: the door emits nothing, and nothing downstream substitutes for it. */\nconst AUDIT_TRAIL_WAIVED: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason: 'No operation lifecycle runs, so no auditable event is emitted by the door itself.',\n compensation: null,\n};\n\n/** The three read doors: a read materializes no value, so no schema could be applied to one. */\nconst SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ: InfrastructureConcernDeclaration = {\n posture: NOT_APPLICABLE,\n reason: 'Read-only: writes no value, so there is nothing for a declared schema to validate.',\n};\n\n/** The three read doors. */\nconst RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ: InfrastructureConcernDeclaration = {\n posture: NOT_APPLICABLE,\n reason: 'Read-only: writes nothing, so no `.ragSource()` field can change through it.',\n};\n\n/**\n * The pre-built WRITE doors, minus {@link InfrastructureDoor.INSERT_DOCUMENT}, which has its own partial\n * compensation (the cast), and minus {@link InfrastructureDoor.DELETE_MANY}, which materializes no value.\n */\nconst SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE: InfrastructureConcernDeclaration = {\n posture: WAIVED,\n reason:\n 'The door takes an already-built mutation descriptor. The ordinary UPDATE path validates the '\n + 'after-image against the resource\\'s main schema; nothing on this path does, so a value outside '\n + 'a declared Zod constraint is stored as given.',\n compensation:\n 'Shape only, never values: `describeGuardedMutationInexpressibility` refuses a mutation that '\n + 'cannot be expressed on every adapter. Nothing checks what the mutation SAYS.',\n};\n\n/** Every door but {@link InfrastructureDoor.COUNT_DOCUMENTS} accepts `RepositoryOptions` and forwards them unchanged. */\nconst TRANSACTION_PARTICIPATION_PRESERVED: InfrastructureConcernDeclaration = {\n posture: PRESERVED,\n how:\n 'Accepts `RepositoryOptions` and forwards them to the primitive, so a caller already inside a '\n + 'transaction enrols this statement in it (Mongo session / PG trx).',\n};\n\n/**\n * The four doors whose only adapter-neutrality claim is that they dispatch a primitive declared on the\n * `BackendResourceRepository` interface — so an adapter omitting one fails to compile rather than\n * throwing on first use. Every raw primitive is declared there and implemented on both persisting arms\n * (the read-only HTTP-API and introspection arms declare each one as an explicit refusal).\n */\nconst ADAPTER_NEUTRALITY_PRESERVED_BY_CONTRACT = (primitive: string): InfrastructureConcernDeclaration => ({\n posture: PRESERVED,\n how:\n `Dispatches \\`${primitive}\\`, which is declared on the \\`BackendResourceRepository\\` interface and `\n + 'implemented by both the MongoDB and PostgreSQL arms — so an adapter that omits it fails to '\n + 'compile rather than throwing on first use. No `as any` and no runtime `typeof` probe.',\n});\n\n/**\n * The retention hide as five of the six filter-bearing doors state it: applied at THIS dispatch point\n * and only here, so both adapter arms receive an already-hidden filter and the predicate lives in one\n * place. {@link InfrastructureDoor.COUNT_DOCUMENTS} states a stronger, caller-specific reason and\n * carries its own.\n */\nconst RETENTION_HIDE_PRESERVED_AT_DISPATCH = (consequence: string): InfrastructureConcernDeclaration => ({\n posture: PRESERVED,\n how:\n `The filter passes through \\`applyRetentionHideToRawFilter\\` HERE and only here — ${consequence} `\n + 'Enforcing it at the single dispatch point rather than in each adapter is what stops it drifting: '\n + 'a future adapter inherits the predicate by construction.',\n});\n\n/**\n * The materializing write doors' RAG posture, identical in mechanism and differing only in what the\n * sweep reconciles for that door's shape. Moved from each door's own `rag-ingestion-gate: N/A —` comment,\n * which the sibling guard `rag-ingestion-write-door-coverage.guard.test.ts` still requires to be\n * present AT the door; that guard checks the waiver EXISTS, this table records what it says.\n */\nconst RAG_INGESTION_GATE_WAIVED_TO_SWEEP = (bound: string): InfrastructureConcernDeclaration => ({\n posture: WAIVED,\n reason:\n 'Below the service tier, so the post-commit ingestion chokepoint cannot observe this door. A '\n + '`.ragSource()` field written through it is not re-indexed at write time.',\n compensation: `The hourly RAG reconciliation sweep: ${bound}`,\n});\n\nexport const INFRASTRUCTURE_TIER_CONTRACT: Record<\n InfrastructureDoor,\n Record<InfrastructureCrossCuttingConcern, InfrastructureConcernDeclaration>\n> = {\n [InfrastructureDoor.COUNT_DOCUMENTS]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ,\n [RETENTION_HIDE]: {\n posture: PRESERVED,\n how:\n 'The filter passes through `applyRetentionHideToRawFilter` here and only here. Counting a '\n + 'hidden row would report a collision against a record the caller cannot see — an existence '\n + 'oracle for the field-uniqueness-validation caller. The consequence (a later INSERT can then '\n + 'collide on a plain unique business-key index) is the separate, tracked G-BKEY gate, and is '\n + 'NOT resolved by re-leaking the row here.',\n },\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ,\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: {\n posture: PRESERVED,\n how:\n 'Accepts `RepositoryOptions` and forwards them to `countByRawFilter`, matching all seven '\n + 'siblings. It was the ONE door in the tier that accepted none, so a caller inside a '\n + 'transaction counted OUTSIDE it — the identical shape `bulkUpdateForInfrastructure` records '\n + 'as a silent correctness hole, at the door nobody enumerated until this table gave every '\n + 'door a row to fill in. Surfaced by filling the table (issue #104), fixed separately from '\n + 'the change that declared the contract so the demonstration stayed visible. No caller passes '\n + 'options today, so the forward is pinned rather than behaviour-verified: '\n + '`__tests__/infrastructure-tier-transaction-forwarding.test.ts`.',\n },\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Delegates to `countByRawFilter`. It previously reached `(repository as any).mongooseModel`, '\n + 'which made it MongoDB-only and left field-uniqueness validation unable to answer \"is this '\n + 'value already taken?\" on any PostgreSQL-backed resource — a generally-named capability one '\n + 'adapter did not have.',\n },\n },\n\n [InfrastructureDoor.FIND_MANY]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained row must stay invisible to reads, and this is the single place the predicate is added '\n + 'for this path.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ,\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: ADAPTER_NEUTRALITY_PRESERVED_BY_CONTRACT('findManyByRawFilter'),\n },\n\n [InfrastructureDoor.READ_UNSCOPED_BY_KEY]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: {\n posture: WAIVED,\n reason:\n 'Unscoped BY NAME and by design — the only read on the repository contract that takes no '\n + 'execution context at all. Scope narrowing is the caller\\'s filter to express here.',\n compensation:\n 'Only the boundary this door does NOT relax: a read that skips tenant scoping must not also '\n + 'skip erasure retention — those are different questions — so the hide is applied '\n + 'unconditionally below. Nothing re-adds the scope predicate.',\n },\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_NOT_APPLICABLE_ON_READ,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'no caller may opt out of erasure retention by choosing this entry point, however unscoped the '\n + 'read itself is.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_NOT_APPLICABLE_ON_READ,\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: ADAPTER_NEUTRALITY_PRESERVED_BY_CONTRACT('readUnscopedByKey'),\n },\n\n [InfrastructureDoor.INSERT_DOCUMENT]: {\n [AUTHORIZATION]: {\n posture: WAIVED,\n reason:\n 'Below the service tier, so no principal is resolved — but unlike its siblings this door has '\n + 'a DECLARED alternative it is not using, and the reason it gives for not using it does not '\n + 'hold. \"A consumable token is consumed before authentication, so there is no principal to '\n + 'authorize\" is true of CONSUMPTION and not of MINTING, which is a write the running system '\n + 'performs inside a flow it controls. `SystemAccessBackendService.createAsSystem` exists for '\n + 'precisely that principal, and `CONSUMABLE_TOKENS` already declares a CREATE operation '\n + '(INTERNAL_CALL, ORG_ADMIN, with a requestDto). Routing through it would restore schema '\n + 'validation, the RAG ingestion hook, the audit trail and the scope-context channel at this '\n + 'door — five of the eight rows below stop being waivers.',\n compensation:\n 'Handler-only placement, as for every door here — AND, at this door only, a deliberate '\n + 'security seal that makes the raw insert load-bearing rather than incidental. '\n + '`createsOneOffSession` is `.excludeFromCreate().excludeFromUpdate()` so that no '\n + 'repository-create path can mint a session-establishing token, which leaves `createToken` — '\n + 'this door\\'s caller — the SOLE minter and therefore the single funnel enforcing '\n + '`ONE_OFF_SESSION_ABSOLUTE_MAX_MINUTES` fail-closed at issuance. That token is an '\n + 'impersonation credential: exchanging it mints a JWT session for another user. Routing the '\n + 'mint through `createAsSystem` would strip the field (measured: the preserve list resolves to '\n + '`[\"organizationId\",\"userId\"]`, because a defaulted excluded field is deliberately withheld) '\n + 'and silently mint every such token as non-session-establishing; relaxing the exclusion to '\n + 'fix that would open a second mint path that never meets the ceiling. So the waiver here is '\n + 'not an unpaid debt — it is the shape the credential ceiling depends on. See issue #102.',\n },\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: {\n posture: WAIVED,\n reason:\n 'The callers build a COMPLETE document — their own `_id`, their own `createdAt`/`updatedAt` — '\n + 'so the write deliberately skips the model create path: `Model.castObject` applies the '\n + 'schema\\'s type CASTS only, no defaults, no timestamps, NO VALIDATION. A value outside a '\n + 'declared Zod constraint is stored as given.',\n compensation:\n 'The cast THROWS on a value the schema cannot represent (a non-ObjectId string on an '\n + '`isForeignKey` path), so a structurally impossible write fails loudly at the write instead '\n + 'of storing a row no cast filter can ever match — issue #71\\'s silent form. Field-level '\n + 'constraints are not checked by anything.',\n },\n [RETENTION_HIDE]: {\n posture: NOT_APPLICABLE,\n reason:\n 'An INSERT creates a brand-new row, so there is no existing row to protect. A retained row is '\n + 'reached only through a filter, and this statement carries none.',\n },\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its missing-set row scan picks the row up.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Delegates to `insertRawDocument`, which casts the document through the model before the driver '\n + 'sees it — the fix for issue #71. Uncast, this tier wrote a string where every sibling queries '\n + 'an ObjectId, so a row written by this tier was not reliably findable BY this tier '\n + '(`revokeTokensByRelatedId` matched 0 rows that existed). The PostgreSQL arm routes the same '\n + 'insert through `toSqlWriteRow` for exactly this reason.',\n },\n },\n\n [InfrastructureDoor.BULK_UPDATE]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a bulk infrastructure update must never rewrite an erased-but-retained row, and retained rows are '\n + 'excluded from the modified count.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison reconciles the affected chunk sets.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: {\n posture: PRESERVED,\n how:\n 'Accepts `RepositoryOptions` and forwards them — and this door is WHY the concern is on this '\n + 'axis. It did neither until recently, so every bulk infrastructure update committed '\n + 'immediately regardless of the transaction its caller was inside: `revokeTokensByRelatedId`\\'s '\n + 'revocation could not be rolled back, and on a driver retry the caller observed a count of 0 '\n + 'for work that had in fact happened exactly once.',\n },\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Takes an ADAPTER-NEUTRAL mutation descriptor rather than a raw `{ $set: … }`, and refuses a '\n + 'mutation it cannot express on every adapter instead of silently degrading. The dialect used '\n + 'to sit in the SIGNATURE, so every caller wrote MongoDB and a PostgreSQL-backed resource could '\n + 'not be bulk-updated at all.',\n },\n },\n\n [InfrastructureDoor.DELETE_MANY]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: {\n posture: NOT_APPLICABLE,\n reason:\n 'A DELETE writes no value, so there is nothing for a declared schema to validate. This is the '\n + 'one WRITE door for which the concern is genuinely inapplicable rather than waived — its '\n + 'siblings all carry a pre-built payload a schema could have checked and did not.',\n },\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained (erased-but-kept) row is immutable, and DESTROYING one is the sharpest form of '\n + 'mutating it — the retention posture exists precisely to keep a row that must be kept, so a '\n + 'framework sweep must not be the thing that reaps it.',\n ),\n [RAG_INGESTION_GATE]: {\n posture: NOT_APPLICABLE,\n reason:\n 'Materializes no value, so no `.ragSource()` field can change through it and there is nothing '\n + 'to re-index. The mirror obligation — REMOVING a deleted row\\'s chunks — is not this concern '\n + 'and is not owned here either: the removal-seam guard '\n + '(`rag-chunk-removal-seam-coverage.guard.test.ts`) excludes the raw repository doors BY '\n + 'DECLARATION, bounding every one of them on the hourly reconciliation sweep\\'s orphan pass, '\n + 'and this door joins that family rather than opening a new question.',\n },\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Dispatches the interface-declared `deleteManyByRawFilter`, so an adapter that omits it fails '\n + 'to compile. THE DOOR EXISTS BECAUSE ITS ABSENCE WAS THE DEFECT: with a bulk UPDATE on the '\n + 'tier and no bulk DELETE, the consumable-tokens cleanup batch had one route to reap rows — '\n + 'reaching past the contract for `MongoDBService.getConnection()` — which made the framework\\'s '\n + 'only credential-retention sweep MongoDB-only. It was invisible while every application ran a '\n + 'mongod beside PostgreSQL, and failed every six hours on the first one (`wonder-crm`) that '\n + 'did not, with spent password-reset / invitation / magic-link rows accumulating with no '\n + 'sweep. Note the neutrality this door CANNOT confer: an unexpressible predicate (`$expr`, a '\n + 'column-to-column comparison) is still the caller\\'s problem, and the batch resolves its one '\n + 'such lane by reading candidates and comparing in memory.',\n },\n },\n\n [InfrastructureDoor.ATOMIC_GUARDED_MUTATION]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained row is immutable, so the compare-and-swap must never match one.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison reconciles the affected chunk set.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Refuses a mutation that is not adapter-neutral (`describeGuardedMutationInexpressibility`) '\n + 'BEFORE dispatching, rather than degrading on the arm that cannot express it, and dispatches '\n + 'an interface-declared primitive.',\n },\n },\n\n [InfrastructureDoor.ATOMIC_INCREMENT_FIELD]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained (erased-but-kept) row is immutable and must never be incremented.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison re-derives the chunk set. In practice this door writes counters, '\n + 'never corpus text.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Dispatches the interface-declared `atomicIncrementField`. Its predecessor took a MongoDB update '\n + 'expression and reached for `mongooseModel`, so a counter built on it did not merely degrade '\n + 'on PostgreSQL — it failed every write, and where the caller swallowed the error (as metering '\n + 'paths do, so accounting never breaks a served request) the counter silently stayed at zero '\n + 'and any cap built on it never fired.',\n },\n },\n\n [InfrastructureDoor.ATOMIC_CONDITIONAL_SET]: {\n [AUTHORIZATION]: AUTHORIZATION_WAIVED,\n [TENANT_SCOPING]: TENANT_SCOPING_WAIVED,\n [SCHEMA_VALIDATION]: SCHEMA_VALIDATION_WAIVED_PRE_BUILT_WRITE,\n [RETENTION_HIDE]: RETENTION_HIDE_PRESERVED_AT_DISPATCH(\n 'a retained row is immutable, so neither the set nor the clear may reach one.',\n ),\n [RAG_INGESTION_GATE]: RAG_INGESTION_GATE_WAIVED_TO_SWEEP(\n 'its contentHash comparison reconciles the chunk set of a field set or cleared through it.',\n ),\n [AUDIT_TRAIL]: AUDIT_TRAIL_WAIVED,\n [TRANSACTION_PARTICIPATION]: TRANSACTION_PARTICIPATION_PRESERVED,\n [ADAPTER_NEUTRALITY]: {\n posture: PRESERVED,\n how:\n 'Dispatches the interface-declared `atomicConditionalSet`. Until the neutral primitives '\n + 'existed, CLEARING a field had no adapter-neutral expression at all — the only route was the '\n + 'raw-MongoDB `atomicConditionalUpdate` (since retired), so every clear was silently also a '\n + 'MongoDB pin. The file-cleanup batch is the case that forced it: it clears stale link '\n + 'metadata from timed-out and malformed rows, so a PostgreSQL-backed FILES resource would '\n + 'have accepted writes and then stranded every row that batch exists to normalize.',\n },\n },\n};\n\n// ── The boundary of the enumeration, recorded rather than left implicit ──────────────────────────\n\n/**\n * Handler members that resolve a repository and dispatch to it, and are NOT infrastructure doors.\n *\n * The pin discovers the tier behaviourally — \"resolves a repository, then dispatches to it\" — which is\n * the only discovery that survives a rename. That query also finds the one member for which the answer\n * is legitimately different, and it is named here so the exclusion is a declaration a reader can\n * challenge rather than a silent filter inside a test.\n *\n * The pin asserts each of these is actually FOUND by the discovery, so an entry that stops matching\n * cannot quietly shrink the population it is excluded from.\n */\nexport const INFRASTRUCTURE_TIER_OPERATION_DISPATCH_MEMBERS: Readonly<Record<string, string>> = {\n doByExecutionContext:\n 'The DECLARED-operation dispatcher — the opposite of this tier. It carries an `ExecutionContext` '\n + 'whose operation the service and controller tiers have already authorized, and `doByPath` / '\n + '`doByKey` both funnel into it. It is found by the same query because it, too, resolves a '\n + 'repository and calls it.',\n};\n\n/**\n * Cross-cutting concerns CONSIDERED for {@link InfrastructureCrossCuttingConcern} and deliberately\n * left out, with the reason each collapses into an existing member.\n *\n * Recorded as data, not omitted, because `.claude/rules/invariant-call-site-enumeration.md` #14 is\n * exactly this: a site that DECLARES itself exempt is quieter than a missing one, so the declaration\n * has to be somewhere a reader can check it. Both entries below were checked against code rather than\n * reasoned about — the citations are the point.\n */\nexport enum InfrastructureExcludedConcernCandidate {\n SIEM_ROUTING = 'siemRouting',\n SUBJECT_ERASURE_REACHABILITY = 'subjectErasureReachability',\n}\n\nexport const INFRASTRUCTURE_CONCERN_CANDIDATES_EXCLUDED: Record<\n InfrastructureExcludedConcernCandidate,\n string\n> = {\n [InfrastructureExcludedConcernCandidate.SIEM_ROUTING]:\n 'Entailed by AUDIT_TRAIL, not independent of it. The routing service is declared as one that '\n + '\"dispatches AUDIT EVENTS to org SIEM endpoints\" (`inject/models/service-types.ts`), so its input '\n + 'is an emitted event. A door that emits none produces nothing to route, and a per-door SIEM cell '\n + 'could only ever restate that door\\'s audit cell.',\n [InfrastructureExcludedConcernCandidate.SUBJECT_ERASURE_REACHABILITY]:\n 'Splits cleanly into a half that is already a member and a half that is not a property of the door. '\n + 'The VISIBILITY-and-immutability half of erasure IS the retention hide — same predicate, same '\n + 'dispatch point — and is declared per door as RETENTION_HIDE. The DISCOVERY half (can the erasure '\n + 'orchestrator find the rows?) is answered by the resource graph: `eraseSubjectInPlace` walks the '\n + 'edges of the subject resource\\'s own configuration, so a row is reachable because of how its '\n + 'resource is declared, never because of which door wrote it.',\n};\n"]}
@@ -34,9 +34,10 @@ export declare class IntrospectionResourceRepositoryBackendService {
34
34
  private readonly resolveSource;
35
35
  constructor(resourceType: string, logger: LoggerService, errorBuilder: ErrorBuilderBackendService, resolveSource: () => IntrospectionResourceSourceBackendPort | undefined);
36
36
  doByPath<T = any, U = any>(operationRepositoryPath: Parameters<typeof ResourcesConfig_OperationPathUtils.createOperationRepositoryPathKey>[0], executionContext: ExecutionContext<any>, id_or_ids_or_filter?: any, data?: U, options?: unknown): Promise<T>;
37
- doByKey<T = any, U = any>(_operationRepositoryPathKey: string, executionContext: ExecutionContext<any>, id_or_ids_or_filter?: any, data?: U, options?: unknown): Promise<T>;
37
+ doByKey<T = any, U = any>(operationRepositoryPathKey: string, executionContext: ExecutionContext<any>, id_or_ids_or_filter?: any, data?: U, options?: unknown): Promise<T>;
38
38
  doByExecutionContext<T = any>(executionContext: ExecutionContext<any>, data?: any): Promise<T>;
39
39
  private doOperation;
40
+ private doOperationByIdentifier;
40
41
  read<T = undefined>(executionContext: ExecutionContext<any>, id_or_filter: any): Promise<any>;
41
42
  readForInternalScan<T = undefined>(executionContext: ExecutionContext<any>, id_or_filter: any): Promise<any>;
42
43
  /**
@@ -74,6 +75,7 @@ export declare class IntrospectionResourceRepositoryBackendService {
74
75
  atomicConditionalSet(): Promise<never>;
75
76
  atomicGuardedMutation(): Promise<never>;
76
77
  updateManyByRawFilter(): Promise<never>;
78
+ deleteManyByRawFilter(): Promise<never>;
77
79
  insertRawDocument(): Promise<never>;
78
80
  findManyByRawFilter(): Promise<never>;
79
81
  private readOnlyRefusal;
@@ -1 +1 @@
1
- {"version":3,"file":"introspection-resource-repository.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../../src/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.ts"],"names":[],"mappings":"AAAA,OAA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AC;IACxB,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;IACxB,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;IAC5B,oBAAoB,IAAI,OAAO,CAAC,KAAK,CAAC;IACtC,oBAAoB,IAAI,OAAO,CAAC,KAAK,CAAC;IACtC,qBAAqB,IAAI,OAAO,CAAC,KAAK,CAAC;IACvC,qBAAqB,IAAI,OAAO,CAAC,KAAK,CAAC;IACvC,iBAAiB,IAAI,OAAO,CAAC,KAAK,CAAC;IACnC,mBAAmB,IAAI,OAAO,CAAC,KAAK,CAAC;IAElD,OAAO,CAAC,eAAe;CAYxB"}
1
+ {"version":3,"file":"introspection-resource-repository.backend.service.d.ts","sourceRoot":"","sources":["../../../../../../../src/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,kCAAkC,EAClC,KAAK,yBAAyB,EAC/B,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,kEAAkE,CAAC;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAClG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qEAAqE,CAAC;AAE5G,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,8CAA8C,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,6CAA6C;IAEtD,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAHb,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,aAAa,EACrB,YAAY,EAAE,0BAA0B,EACxC,aAAa,EAAE,MAAM,sCAAsC,GAAG,SAAS;IA2B7E,QAAQ,CAAC,CAAC,GAAG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B,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAI7G,MAAM,CAAC,CAAC,GAAG,GAAG,EACzB,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EACvC,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,GAAG,GACX,OAAO,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC;IAM3B,KAAK,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;YAKvF,MAAM;IAiCpB,OAAO,CAAC,cAAc;IAoBT,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;IACxB,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;IACxB,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;IAC5B,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC;IACxB,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;IAC5B,oBAAoB,IAAI,OAAO,CAAC,KAAK,CAAC;IACtC,oBAAoB,IAAI,OAAO,CAAC,KAAK,CAAC;IACtC,qBAAqB,IAAI,OAAO,CAAC,KAAK,CAAC;IACvC,qBAAqB,IAAI,OAAO,CAAC,KAAK,CAAC;IACvC,qBAAqB,IAAI,OAAO,CAAC,KAAK,CAAC;IACvC,iBAAiB,IAAI,OAAO,CAAC,KAAK,CAAC;IACnC,mBAAmB,IAAI,OAAO,CAAC,KAAK,CAAC;IAElD,OAAO,CAAC,eAAe;CAYxB"}
@@ -1,4 +1,4 @@
1
- import { CoreResourceOperation, ErrorCustomMessageReference, ErrorType, ResourceOperationsUtils, } from '@wildo-ai/saas-models';
1
+ import { CoreResourceOperation, ErrorCustomMessageReference, ErrorType, ResourceOperationsUtils, ResourcesConfig_OperationPathUtils, } from '@wildo-ai/saas-models';
2
2
  /**
3
3
  * Repository for `PersistenceAdapter.INTROSPECTION` — rows DERIVED per read, never stored.
4
4
  *
@@ -45,17 +45,33 @@ export class IntrospectionResourceRepositoryBackendService {
45
45
  * family — the adapter's writes are refused in `doOperation` as well as on their named members,
46
46
  * because the service dispatches by operation and never touches those members.
47
47
  */
48
+ /*
49
+ * The SUPPLIED path is the dispatch authority, never `executionContext.operation` — corrected
50
+ * 2026-09-01, and the distinction only becomes visible on the adapter's first non-read
51
+ * operation. The authorizer's pre-fetch reads the target of a WRITE-SHAPED operation by calling
52
+ * `doByPath({resourceIdentifier, operationIdentifier: READ}, …)` while the execution context
53
+ * still carries the operation being authorized; the Mongo and PostgreSQL repositories dispatch
54
+ * on the supplied key, so their pre-fetch reads. This repository dispatched on the CONTEXT's
55
+ * operation, so the same pre-fetch fell into the read-only refusal and every custom dispatch
56
+ * operation on an introspected resource died as 404 `authorizations_validation_failed` before
57
+ * its OVERRIDE_ALL implementation could run. Same rule as the twins: the caller names the
58
+ * repository intent; the context names what is being authorized.
59
+ */
48
60
  async doByPath(operationRepositoryPath, executionContext, id_or_ids_or_filter, data, options) {
49
- return this.doOperation(executionContext.operation, executionContext, id_or_ids_or_filter, data);
61
+ return this.doOperationByIdentifier(String(operationRepositoryPath.operationIdentifier), executionContext, id_or_ids_or_filter, data);
50
62
  }
51
- async doByKey(_operationRepositoryPathKey, executionContext, id_or_ids_or_filter, data, options) {
52
- return this.doOperation(executionContext.operation, executionContext, id_or_ids_or_filter, data);
63
+ async doByKey(operationRepositoryPathKey, executionContext, id_or_ids_or_filter, data, options) {
64
+ const parsed = ResourcesConfig_OperationPathUtils.parseOperationRepositoryPathKey(operationRepositoryPathKey);
65
+ return this.doOperationByIdentifier(String(parsed.operationIdentifier), executionContext, id_or_ids_or_filter, data);
53
66
  }
54
67
  async doByExecutionContext(executionContext, data) {
55
68
  return this.doOperation(executionContext.operation, executionContext, undefined, data);
56
69
  }
57
70
  async doOperation(operation, executionContext, id_or_ids_or_filter, data) {
58
71
  const operationIdentifier = ResourceOperationsUtils.getCoreResourceOperationFromOperation(operation);
72
+ return this.doOperationByIdentifier(String(operationIdentifier ?? ''), executionContext, id_or_ids_or_filter, data);
73
+ }
74
+ async doOperationByIdentifier(operationIdentifier, executionContext, id_or_ids_or_filter, data) {
59
75
  switch (operationIdentifier) {
60
76
  case CoreResourceOperation.READ:
61
77
  return this.read(executionContext, id_or_ids_or_filter);
@@ -66,7 +82,7 @@ export class IntrospectionResourceRepositoryBackendService {
66
82
  case CoreResourceOperation.SEARCH:
67
83
  return this.search(executionContext, data?.query ?? '', data?.filter);
68
84
  default:
69
- throw this.readOnlyRefusal(String(operationIdentifier ?? 'unknown operation'));
85
+ throw this.readOnlyRefusal(operationIdentifier || 'unknown operation');
70
86
  }
71
87
  }
72
88
  // ───────────────────────────── reads ─────────────────────────────
@@ -94,7 +110,14 @@ export class IntrospectionResourceRepositoryBackendService {
94
110
  const rows = await this.derive(executionContext, { filter: ids_or_filter });
95
111
  return {
96
112
  data: rows,
97
- pagination: { page: 1, limit: rows.length, total: rows.length, totalPages: 1 },
113
+ /*
114
+ * `limit` is the page SIZE the answer was computed with, and the envelope schema holds it to
115
+ * >= 1 — `rows.length` alone turned every EMPTY derivation into a 500 at transformOutput
116
+ * ("pagination.limit: too_small"), measured 2026-09-01 the first time an introspection
117
+ * resource could legitimately be empty (a family-aspect collection of a not-landed family).
118
+ * An empty page of size 1 is honest; a page of size 0 is not a page.
119
+ */
120
+ pagination: { page: 1, limit: Math.max(rows.length, 1), total: rows.length, totalPages: 1 },
98
121
  };
99
122
  }
100
123
  /**
@@ -106,7 +129,8 @@ export class IntrospectionResourceRepositoryBackendService {
106
129
  }
107
130
  async search(executionContext, searchQuery, filter) {
108
131
  const rows = await this.derive(executionContext, { filter, searchQuery });
109
- return { data: rows, total: rows.length, page: 1, limit: rows.length };
132
+ // Same >=1 floor as list() above — an empty search result is a page of size 1 with no rows.
133
+ return { data: rows, total: rows.length, page: 1, limit: Math.max(rows.length, 1) };
110
134
  }
111
135
  async count(executionContext, filter) {
112
136
  const rows = await this.derive(executionContext, { filter });
@@ -168,6 +192,7 @@ export class IntrospectionResourceRepositoryBackendService {
168
192
  async atomicConditionalSet() { throw this.readOnlyRefusal('atomicConditionalSet'); }
169
193
  async atomicGuardedMutation() { throw this.readOnlyRefusal('atomicGuardedMutation'); }
170
194
  async updateManyByRawFilter() { throw this.readOnlyRefusal('updateManyByRawFilter'); }
195
+ async deleteManyByRawFilter() { throw this.readOnlyRefusal('deleteManyByRawFilter'); }
171
196
  async insertRawDocument() { throw this.readOnlyRefusal('insertRawDocument'); }
172
197
  async findManyByRawFilter() { throw this.readOnlyRefusal('findManyByRawFilter'); }
173
198
  readOnlyRefusal(member) {