@stigmer/server 3.40.1 → 3.41.0

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 (527) hide show
  1. package/dist/authorization/authorizer.d.ts +16 -10
  2. package/dist/authorization/authorizer.d.ts.map +1 -1
  3. package/dist/authorization/authorizer.js +17 -9
  4. package/dist/authorization/authorizer.js.map +1 -1
  5. package/dist/authorization/derived-tuples.d.ts +7 -3
  6. package/dist/authorization/derived-tuples.d.ts.map +1 -1
  7. package/dist/authorization/derived-tuples.js +62 -6
  8. package/dist/authorization/derived-tuples.js.map +1 -1
  9. package/dist/authorization/evaluator.d.ts +11 -7
  10. package/dist/authorization/evaluator.d.ts.map +1 -1
  11. package/dist/authorization/evaluator.js +16 -10
  12. package/dist/authorization/evaluator.js.map +1 -1
  13. package/dist/authorization/list-read-scope.d.ts +4 -0
  14. package/dist/authorization/list-read-scope.d.ts.map +1 -1
  15. package/dist/authorization/list-read-scope.js +1 -0
  16. package/dist/authorization/list-read-scope.js.map +1 -1
  17. package/dist/authorization/model/data/authorization-model.json +830 -67
  18. package/dist/authorization/model/execution-viewer.d.ts.map +1 -1
  19. package/dist/authorization/model/execution-viewer.js +26 -24
  20. package/dist/authorization/model/execution-viewer.js.map +1 -1
  21. package/dist/authorization/model/index.d.ts +4 -1
  22. package/dist/authorization/model/index.d.ts.map +1 -1
  23. package/dist/authorization/model/index.js +4 -1
  24. package/dist/authorization/model/index.js.map +1 -1
  25. package/dist/authorization/model/rewrite.d.ts +5 -3
  26. package/dist/authorization/model/rewrite.d.ts.map +1 -1
  27. package/dist/authorization/organization-directory.d.ts +44 -0
  28. package/dist/authorization/organization-directory.d.ts.map +1 -1
  29. package/dist/authorization/organization-directory.js +1 -0
  30. package/dist/authorization/organization-directory.js.map +1 -1
  31. package/dist/authorization/person.d.ts +14 -1
  32. package/dist/authorization/person.d.ts.map +1 -1
  33. package/dist/authorization/person.js +16 -0
  34. package/dist/authorization/person.js.map +1 -1
  35. package/dist/authorization/policy-check.d.ts +52 -0
  36. package/dist/authorization/policy-check.d.ts.map +1 -0
  37. package/dist/authorization/policy-check.js +35 -0
  38. package/dist/authorization/policy-check.js.map +1 -0
  39. package/dist/authorization/posture.d.ts +30 -4
  40. package/dist/authorization/posture.d.ts.map +1 -1
  41. package/dist/authorization/posture.js +58 -0
  42. package/dist/authorization/posture.js.map +1 -1
  43. package/dist/authorization/resource-creators.d.ts +4 -0
  44. package/dist/authorization/resource-creators.d.ts.map +1 -0
  45. package/dist/authorization/resource-creators.js +44 -0
  46. package/dist/authorization/resource-creators.js.map +1 -0
  47. package/dist/authorization/trusted-local-authorizer.d.ts +9 -0
  48. package/dist/authorization/trusted-local-authorizer.d.ts.map +1 -0
  49. package/dist/authorization/trusted-local-authorizer.js +70 -0
  50. package/dist/authorization/trusted-local-authorizer.js.map +1 -0
  51. package/dist/authorization/tuples.d.ts +12 -0
  52. package/dist/authorization/tuples.d.ts.map +1 -1
  53. package/dist/authorization/tuples.js +3 -0
  54. package/dist/authorization/tuples.js.map +1 -1
  55. package/dist/boot/compose.d.ts.map +1 -1
  56. package/dist/boot/compose.js +132 -43
  57. package/dist/boot/compose.js.map +1 -1
  58. package/dist/boot/config.d.ts +22 -7
  59. package/dist/boot/config.d.ts.map +1 -1
  60. package/dist/boot/config.js +2 -1
  61. package/dist/boot/config.js.map +1 -1
  62. package/dist/boot/inprocess.d.ts.map +1 -1
  63. package/dist/boot/inprocess.js +10 -4
  64. package/dist/boot/inprocess.js.map +1 -1
  65. package/dist/boot/list-indexes.d.ts.map +1 -1
  66. package/dist/boot/list-indexes.js +6 -1
  67. package/dist/boot/list-indexes.js.map +1 -1
  68. package/dist/boot/logger.d.ts +3 -1
  69. package/dist/boot/logger.d.ts.map +1 -1
  70. package/dist/boot/logger.js +3 -1
  71. package/dist/boot/logger.js.map +1 -1
  72. package/dist/boot/oauth-redirect-uri.d.ts +33 -12
  73. package/dist/boot/oauth-redirect-uri.d.ts.map +1 -1
  74. package/dist/boot/oauth-redirect-uri.js +43 -14
  75. package/dist/boot/oauth-redirect-uri.js.map +1 -1
  76. package/dist/boot/skill-transfer-origin.d.ts +46 -14
  77. package/dist/boot/skill-transfer-origin.d.ts.map +1 -1
  78. package/dist/boot/skill-transfer-origin.js +53 -13
  79. package/dist/boot/skill-transfer-origin.js.map +1 -1
  80. package/dist/domain/agentchannel/steps.d.ts +8 -6
  81. package/dist/domain/agentchannel/steps.d.ts.map +1 -1
  82. package/dist/domain/agentchannel/steps.js +9 -7
  83. package/dist/domain/agentchannel/steps.js.map +1 -1
  84. package/dist/domain/agentexecution/controller.d.ts +7 -0
  85. package/dist/domain/agentexecution/controller.d.ts.map +1 -1
  86. package/dist/domain/agentexecution/controller.js +1 -1
  87. package/dist/domain/agentexecution/controller.js.map +1 -1
  88. package/dist/domain/agentexecution/create-steps.d.ts +26 -12
  89. package/dist/domain/agentexecution/create-steps.d.ts.map +1 -1
  90. package/dist/domain/agentexecution/create-steps.js +61 -43
  91. package/dist/domain/agentexecution/create-steps.js.map +1 -1
  92. package/dist/domain/agentexecution/submit-approval.d.ts.map +1 -1
  93. package/dist/domain/agentexecution/submit-approval.js +9 -6
  94. package/dist/domain/agentexecution/submit-approval.js.map +1 -1
  95. package/dist/domain/agentexecution/submit-file-decision.d.ts.map +1 -1
  96. package/dist/domain/agentexecution/submit-file-decision.js +5 -4
  97. package/dist/domain/agentexecution/submit-file-decision.js.map +1 -1
  98. package/dist/domain/agentshare/steps.d.ts +5 -3
  99. package/dist/domain/agentshare/steps.d.ts.map +1 -1
  100. package/dist/domain/agentshare/steps.js +6 -4
  101. package/dist/domain/agentshare/steps.js.map +1 -1
  102. package/dist/domain/apikey/verifier.d.ts +7 -0
  103. package/dist/domain/apikey/verifier.d.ts.map +1 -1
  104. package/dist/domain/apikey/verifier.js +34 -1
  105. package/dist/domain/apikey/verifier.js.map +1 -1
  106. package/dist/domain/channelapp/controller.d.ts +4 -3
  107. package/dist/domain/channelapp/controller.d.ts.map +1 -1
  108. package/dist/domain/channelapp/controller.js.map +1 -1
  109. package/dist/domain/executioncontext/steps.d.ts +2 -1
  110. package/dist/domain/executioncontext/steps.d.ts.map +1 -1
  111. package/dist/domain/executioncontext/steps.js +2 -1
  112. package/dist/domain/executioncontext/steps.js.map +1 -1
  113. package/dist/domain/iampolicy/access-lists.d.ts.map +1 -1
  114. package/dist/domain/iampolicy/access-lists.js +57 -2
  115. package/dist/domain/iampolicy/access-lists.js.map +1 -1
  116. package/dist/domain/iampolicy/change.d.ts +53 -0
  117. package/dist/domain/iampolicy/change.d.ts.map +1 -0
  118. package/dist/domain/iampolicy/change.js +44 -0
  119. package/dist/domain/iampolicy/change.js.map +1 -0
  120. package/dist/domain/iampolicy/constants.d.ts +6 -0
  121. package/dist/domain/iampolicy/constants.d.ts.map +1 -1
  122. package/dist/domain/iampolicy/constants.js +6 -0
  123. package/dist/domain/iampolicy/constants.js.map +1 -1
  124. package/dist/domain/iampolicy/controller.d.ts.map +1 -1
  125. package/dist/domain/iampolicy/controller.js +9 -5
  126. package/dist/domain/iampolicy/controller.js.map +1 -1
  127. package/dist/domain/iampolicy/grant-path.d.ts +31 -13
  128. package/dist/domain/iampolicy/grant-path.d.ts.map +1 -1
  129. package/dist/domain/iampolicy/grant-path.js +216 -19
  130. package/dist/domain/iampolicy/grant-path.js.map +1 -1
  131. package/dist/domain/iampolicy/membership.d.ts +11 -3
  132. package/dist/domain/iampolicy/membership.d.ts.map +1 -1
  133. package/dist/domain/iampolicy/membership.js +18 -13
  134. package/dist/domain/iampolicy/membership.js.map +1 -1
  135. package/dist/domain/iampolicy/resource-store.d.ts.map +1 -1
  136. package/dist/domain/iampolicy/resource-store.js +4 -0
  137. package/dist/domain/iampolicy/resource-store.js.map +1 -1
  138. package/dist/domain/iampolicy/role-lifecycle.d.ts.map +1 -1
  139. package/dist/domain/iampolicy/role-lifecycle.js +2 -2
  140. package/dist/domain/iampolicy/role-lifecycle.js.map +1 -1
  141. package/dist/domain/iampolicy/roles.d.ts.map +1 -1
  142. package/dist/domain/iampolicy/roles.js +7 -0
  143. package/dist/domain/iampolicy/roles.js.map +1 -1
  144. package/dist/domain/iampolicy/steps.d.ts +4 -3
  145. package/dist/domain/iampolicy/steps.d.ts.map +1 -1
  146. package/dist/domain/iampolicy/steps.js +7 -7
  147. package/dist/domain/iampolicy/steps.js.map +1 -1
  148. package/dist/domain/iampolicy/store-contract.d.ts.map +1 -1
  149. package/dist/domain/iampolicy/store-contract.js +22 -1
  150. package/dist/domain/iampolicy/store-contract.js.map +1 -1
  151. package/dist/domain/iampolicy/store.d.ts +18 -5
  152. package/dist/domain/iampolicy/store.d.ts.map +1 -1
  153. package/dist/domain/iampolicy/store.js.map +1 -1
  154. package/dist/domain/identityaccount/constants.d.ts +15 -0
  155. package/dist/domain/identityaccount/constants.d.ts.map +1 -1
  156. package/dist/domain/identityaccount/constants.js +17 -0
  157. package/dist/domain/identityaccount/constants.js.map +1 -1
  158. package/dist/domain/identityaccount/controller.d.ts.map +1 -1
  159. package/dist/domain/identityaccount/controller.js +17 -6
  160. package/dist/domain/identityaccount/controller.js.map +1 -1
  161. package/dist/domain/identityaccount/resolve.d.ts +47 -0
  162. package/dist/domain/identityaccount/resolve.d.ts.map +1 -1
  163. package/dist/domain/identityaccount/resolve.js +38 -1
  164. package/dist/domain/identityaccount/resolve.js.map +1 -1
  165. package/dist/domain/identityaccount/resource-store.d.ts.map +1 -1
  166. package/dist/domain/identityaccount/resource-store.js +11 -1
  167. package/dist/domain/identityaccount/resource-store.js.map +1 -1
  168. package/dist/domain/identityaccount/steps.d.ts +2 -1
  169. package/dist/domain/identityaccount/steps.d.ts.map +1 -1
  170. package/dist/domain/identityaccount/steps.js +4 -3
  171. package/dist/domain/identityaccount/steps.js.map +1 -1
  172. package/dist/domain/identityaccount/store-contract.js +2 -2
  173. package/dist/domain/identityaccount/store-contract.js.map +1 -1
  174. package/dist/domain/identityaccount/store.d.ts +6 -1
  175. package/dist/domain/identityaccount/store.d.ts.map +1 -1
  176. package/dist/domain/mcpserver/connect-sandbox.d.ts +67 -0
  177. package/dist/domain/mcpserver/connect-sandbox.d.ts.map +1 -0
  178. package/dist/domain/mcpserver/connect-sandbox.js +64 -0
  179. package/dist/domain/mcpserver/connect-sandbox.js.map +1 -0
  180. package/dist/domain/mcpserver/connect.d.ts +42 -10
  181. package/dist/domain/mcpserver/connect.d.ts.map +1 -1
  182. package/dist/domain/mcpserver/connect.js +147 -40
  183. package/dist/domain/mcpserver/connect.js.map +1 -1
  184. package/dist/domain/mcpserver/controller.js +4 -2
  185. package/dist/domain/mcpserver/controller.js.map +1 -1
  186. package/dist/domain/mcpserver/engine.d.ts +26 -7
  187. package/dist/domain/mcpserver/engine.d.ts.map +1 -1
  188. package/dist/domain/mcpserver/engine.js.map +1 -1
  189. package/dist/domain/mcpserver/start-connect.d.ts +5 -0
  190. package/dist/domain/mcpserver/start-connect.d.ts.map +1 -1
  191. package/dist/domain/mcpserver/start-connect.js +38 -15
  192. package/dist/domain/mcpserver/start-connect.js.map +1 -1
  193. package/dist/domain/memory/controller.js +2 -1
  194. package/dist/domain/memory/controller.js.map +1 -1
  195. package/dist/domain/memory/list-index.d.ts +2 -0
  196. package/dist/domain/memory/list-index.d.ts.map +1 -0
  197. package/dist/domain/memory/list-index.js +31 -0
  198. package/dist/domain/memory/list-index.js.map +1 -0
  199. package/dist/domain/memory/queries.d.ts +10 -0
  200. package/dist/domain/memory/queries.d.ts.map +1 -0
  201. package/dist/domain/memory/queries.js +54 -0
  202. package/dist/domain/memory/queries.js.map +1 -0
  203. package/dist/domain/memory/steps.d.ts +13 -11
  204. package/dist/domain/memory/steps.d.ts.map +1 -1
  205. package/dist/domain/memory/steps.js +26 -57
  206. package/dist/domain/memory/steps.js.map +1 -1
  207. package/dist/domain/organization/steps.d.ts.map +1 -1
  208. package/dist/domain/organization/steps.js +1 -1
  209. package/dist/domain/organization/steps.js.map +1 -1
  210. package/dist/domain/platformclient/mint.d.ts.map +1 -1
  211. package/dist/domain/platformclient/mint.js +2 -2
  212. package/dist/domain/platformclient/mint.js.map +1 -1
  213. package/dist/domain/platformclient/verifier.d.ts.map +1 -1
  214. package/dist/domain/platformclient/verifier.js +6 -3
  215. package/dist/domain/platformclient/verifier.js.map +1 -1
  216. package/dist/domain/plugin/push.d.ts.map +1 -1
  217. package/dist/domain/plugin/push.js +1 -0
  218. package/dist/domain/plugin/push.js.map +1 -1
  219. package/dist/domain/schedule/steps.d.ts +3 -1
  220. package/dist/domain/schedule/steps.d.ts.map +1 -1
  221. package/dist/domain/schedule/steps.js +3 -1
  222. package/dist/domain/schedule/steps.js.map +1 -1
  223. package/dist/domain/skill/push.d.ts.map +1 -1
  224. package/dist/domain/skill/push.js +1 -0
  225. package/dist/domain/skill/push.js.map +1 -1
  226. package/dist/domain/workflow/registry/data/task-kind-registry.json +27 -1
  227. package/dist/domain/workflowexecution/submit-approval.d.ts +5 -2
  228. package/dist/domain/workflowexecution/submit-approval.d.ts.map +1 -1
  229. package/dist/domain/workflowexecution/submit-approval.js +1 -1
  230. package/dist/domain/workflowexecution/submit-approval.js.map +1 -1
  231. package/dist/domain/workflowexecution/submit-file-decision.d.ts +5 -2
  232. package/dist/domain/workflowexecution/submit-file-decision.d.ts.map +1 -1
  233. package/dist/domain/workflowexecution/submit-file-decision.js +1 -1
  234. package/dist/domain/workflowexecution/submit-file-decision.js.map +1 -1
  235. package/dist/domain/workflowexecution/submit-workflow-task-approval.d.ts.map +1 -1
  236. package/dist/domain/workflowexecution/submit-workflow-task-approval.js +12 -1
  237. package/dist/domain/workflowexecution/submit-workflow-task-approval.js.map +1 -1
  238. package/dist/domain/workflowinstance/controller.d.ts +6 -3
  239. package/dist/domain/workflowinstance/controller.d.ts.map +1 -1
  240. package/dist/domain/workflowinstance/controller.js +12 -7
  241. package/dist/domain/workflowinstance/controller.js.map +1 -1
  242. package/dist/domain/workflowinstance/steps.d.ts +31 -0
  243. package/dist/domain/workflowinstance/steps.d.ts.map +1 -1
  244. package/dist/domain/workflowinstance/steps.js +88 -1
  245. package/dist/domain/workflowinstance/steps.js.map +1 -1
  246. package/dist/extensions/composed-services.d.ts +56 -0
  247. package/dist/extensions/composed-services.d.ts.map +1 -0
  248. package/dist/extensions/composed-services.js +2 -0
  249. package/dist/extensions/composed-services.js.map +1 -0
  250. package/dist/extensions/drivers.d.ts +32 -1
  251. package/dist/extensions/drivers.d.ts.map +1 -1
  252. package/dist/extensions/identity.d.ts +4 -1
  253. package/dist/extensions/identity.d.ts.map +1 -1
  254. package/dist/extensions/identity.js +4 -1
  255. package/dist/extensions/identity.js.map +1 -1
  256. package/dist/extensions/registry.d.ts +37 -0
  257. package/dist/extensions/registry.d.ts.map +1 -1
  258. package/dist/extensions/registry.js +50 -0
  259. package/dist/extensions/registry.js.map +1 -1
  260. package/dist/extensions/resource-authorization.d.ts +78 -0
  261. package/dist/extensions/resource-authorization.d.ts.map +1 -1
  262. package/dist/extensions/resource-row-reader.d.ts +43 -0
  263. package/dist/extensions/resource-row-reader.d.ts.map +1 -0
  264. package/dist/extensions/resource-row-reader.js +2 -0
  265. package/dist/extensions/resource-row-reader.js.map +1 -0
  266. package/dist/extensions/visitor-classifier.d.ts +41 -0
  267. package/dist/extensions/visitor-classifier.d.ts.map +1 -0
  268. package/dist/extensions/visitor-classifier.js +2 -0
  269. package/dist/extensions/visitor-classifier.js.map +1 -0
  270. package/dist/identity/oidc-userinfo.d.ts +6 -1
  271. package/dist/identity/oidc-userinfo.d.ts.map +1 -1
  272. package/dist/identity/oidc-userinfo.js.map +1 -1
  273. package/dist/identity/oidc-verifier.d.ts.map +1 -1
  274. package/dist/identity/oidc-verifier.js +37 -8
  275. package/dist/identity/oidc-verifier.js.map +1 -1
  276. package/dist/index.d.ts +14 -6
  277. package/dist/index.d.ts.map +1 -1
  278. package/dist/index.js +25 -9
  279. package/dist/index.js.map +1 -1
  280. package/dist/pipeline/errors.d.ts +8 -0
  281. package/dist/pipeline/errors.d.ts.map +1 -1
  282. package/dist/pipeline/errors.js +25 -16
  283. package/dist/pipeline/errors.js.map +1 -1
  284. package/dist/pipeline/interceptors/auth.d.ts +17 -9
  285. package/dist/pipeline/interceptors/auth.d.ts.map +1 -1
  286. package/dist/pipeline/interceptors/auth.js +17 -9
  287. package/dist/pipeline/interceptors/auth.js.map +1 -1
  288. package/dist/pipeline/steps/authorization-tuples.d.ts +23 -1
  289. package/dist/pipeline/steps/authorization-tuples.d.ts.map +1 -1
  290. package/dist/pipeline/steps/authorization-tuples.js +42 -0
  291. package/dist/pipeline/steps/authorization-tuples.js.map +1 -1
  292. package/dist/pipeline/steps/authorize.d.ts +6 -5
  293. package/dist/pipeline/steps/authorize.d.ts.map +1 -1
  294. package/dist/pipeline/steps/authorize.js +6 -5
  295. package/dist/pipeline/steps/authorize.js.map +1 -1
  296. package/dist/pipeline/steps/defaults.d.ts +12 -0
  297. package/dist/pipeline/steps/defaults.d.ts.map +1 -1
  298. package/dist/pipeline/steps/defaults.js +42 -7
  299. package/dist/pipeline/steps/defaults.js.map +1 -1
  300. package/dist/pipeline/steps/guard-memory-capture.d.ts +13 -15
  301. package/dist/pipeline/steps/guard-memory-capture.d.ts.map +1 -1
  302. package/dist/pipeline/steps/guard-memory-capture.js +2 -3
  303. package/dist/pipeline/steps/guard-memory-capture.js.map +1 -1
  304. package/dist/runnerauth/built-in-runner-credential-provider.d.ts +0 -2
  305. package/dist/runnerauth/built-in-runner-credential-provider.d.ts.map +1 -1
  306. package/dist/runnerauth/built-in-runner-credential-provider.js +8 -17
  307. package/dist/runnerauth/built-in-runner-credential-provider.js.map +1 -1
  308. package/dist/runnerauth/runner-credential-provider.d.ts +17 -7
  309. package/dist/runnerauth/runner-credential-provider.d.ts.map +1 -1
  310. package/dist/runnerauth/runner-credential-provider.js.map +1 -1
  311. package/dist/sandbox/docker.d.ts.map +1 -1
  312. package/dist/sandbox/docker.js +3 -0
  313. package/dist/sandbox/docker.js.map +1 -1
  314. package/dist/sandbox/kubernetes.d.ts.map +1 -1
  315. package/dist/sandbox/kubernetes.js +3 -0
  316. package/dist/sandbox/kubernetes.js.map +1 -1
  317. package/dist/sandbox/local-process.d.ts.map +1 -1
  318. package/dist/sandbox/local-process.js +4 -0
  319. package/dist/sandbox/local-process.js.map +1 -1
  320. package/dist/sandbox/provisioner.d.ts +18 -6
  321. package/dist/sandbox/provisioner.d.ts.map +1 -1
  322. package/dist/sandbox/provisioner.js.map +1 -1
  323. package/dist/temporal/manager.d.ts +5 -0
  324. package/dist/temporal/manager.d.ts.map +1 -1
  325. package/dist/temporal/manager.js +9 -0
  326. package/dist/temporal/manager.js.map +1 -1
  327. package/dist/temporal/mcpserver/engine-client.d.ts +2 -2
  328. package/dist/temporal/mcpserver/engine-client.d.ts.map +1 -1
  329. package/dist/temporal/mcpserver/engine-client.js +6 -4
  330. package/dist/temporal/mcpserver/engine-client.js.map +1 -1
  331. package/dist/temporal/mcpserver/names.d.ts +13 -2
  332. package/dist/temporal/mcpserver/names.d.ts.map +1 -1
  333. package/dist/temporal/mcpserver/names.js +15 -2
  334. package/dist/temporal/mcpserver/names.js.map +1 -1
  335. package/dist/temporal/sdk-logger.d.ts +74 -0
  336. package/dist/temporal/sdk-logger.d.ts.map +1 -0
  337. package/dist/temporal/sdk-logger.js +143 -0
  338. package/dist/temporal/sdk-logger.js.map +1 -0
  339. package/package.json +6 -6
  340. package/src/authorization/README.md +18 -6
  341. package/src/authorization/__tests__/authorizer.test.ts +5 -1
  342. package/src/authorization/__tests__/derived-tuples.test.ts +26 -0
  343. package/src/authorization/__tests__/evaluator.test.ts +4 -0
  344. package/src/authorization/__tests__/list-read-scope.test.ts +11 -5
  345. package/src/authorization/__tests__/store-tests.test.ts +3 -1
  346. package/src/authorization/__tests__/trusted-local-authorizer.test.ts +155 -0
  347. package/src/authorization/__tests__/unit-owned-kinds.test.ts +420 -0
  348. package/src/authorization/__tests__/wire-permissions.test.ts +31 -2
  349. package/src/authorization/authorizer.ts +21 -10
  350. package/src/authorization/derived-tuples.ts +92 -18
  351. package/src/authorization/evaluator.ts +30 -15
  352. package/src/authorization/list-read-scope.ts +4 -0
  353. package/src/authorization/model/__tests__/registry.test.ts +23 -0
  354. package/src/authorization/model/data/authorization-model.json +830 -67
  355. package/src/authorization/model/execution-viewer.ts +32 -27
  356. package/src/authorization/model/index.ts +4 -1
  357. package/src/authorization/model/rewrite.ts +5 -3
  358. package/src/authorization/organization-directory.ts +4 -0
  359. package/src/authorization/person.ts +32 -1
  360. package/src/authorization/policy-check.ts +105 -0
  361. package/src/authorization/posture.ts +45 -4
  362. package/src/authorization/resource-creators.ts +48 -0
  363. package/src/authorization/trusted-local-authorizer.ts +91 -0
  364. package/src/authorization/tuples.ts +17 -0
  365. package/src/boot/__tests__/compose.test.ts +120 -4
  366. package/src/boot/__tests__/list-indexes.test.ts +4 -0
  367. package/src/boot/__tests__/oauth-redirect-uri.test.ts +121 -10
  368. package/src/boot/__tests__/skill-transfer-origin.test.ts +96 -25
  369. package/src/boot/compose.ts +153 -61
  370. package/src/boot/config.ts +28 -12
  371. package/src/boot/inprocess.ts +18 -4
  372. package/src/boot/list-indexes.ts +6 -1
  373. package/src/boot/logger.ts +3 -1
  374. package/src/boot/oauth-redirect-uri.ts +62 -17
  375. package/src/boot/skill-transfer-origin.ts +71 -16
  376. package/src/domain/agent/__tests__/agent.test.ts +42 -1
  377. package/src/domain/agentchannel/__tests__/agentchannel.test.ts +9 -0
  378. package/src/domain/agentchannel/__tests__/channel-runtime.test.ts +2 -0
  379. package/src/domain/agentchannel/__tests__/create-authorization.test.ts +7 -6
  380. package/src/domain/agentchannel/steps.ts +9 -7
  381. package/src/domain/agentexecution/__tests__/agentexecution.test.ts +148 -56
  382. package/src/domain/agentexecution/__tests__/create-steps.test.ts +175 -12
  383. package/src/domain/agentexecution/__tests__/file-review-seed.ts +91 -0
  384. package/src/domain/agentexecution/controller.ts +8 -0
  385. package/src/domain/agentexecution/create-steps.ts +74 -44
  386. package/src/domain/agentexecution/submit-approval.ts +9 -6
  387. package/src/domain/agentexecution/submit-file-decision.ts +5 -4
  388. package/src/domain/agentinstance/__tests__/agentinstance.test.ts +2 -0
  389. package/src/domain/agentshare/__tests__/agentshare.test.ts +17 -0
  390. package/src/domain/agentshare/__tests__/create-authorization.test.ts +5 -4
  391. package/src/domain/agentshare/steps.ts +6 -4
  392. package/src/domain/apikey/__tests__/verifier.test.ts +73 -1
  393. package/src/domain/apikey/verifier.ts +45 -1
  394. package/src/domain/artifact/__tests__/artifact.test.ts +13 -24
  395. package/src/domain/channelapp/__tests__/channelapp.test.ts +7 -0
  396. package/src/domain/channelapp/controller.ts +4 -3
  397. package/src/domain/environment/__tests__/environment.test.ts +13 -0
  398. package/src/domain/executioncontext/__tests__/executioncontext.test.ts +2 -0
  399. package/src/domain/executioncontext/steps.ts +2 -1
  400. package/src/domain/iampolicy/__tests__/access-lists.test.ts +79 -0
  401. package/src/domain/iampolicy/__tests__/change.test.ts +63 -0
  402. package/src/domain/iampolicy/__tests__/controller.test.ts +39 -3
  403. package/src/domain/iampolicy/__tests__/grant-path.test.ts +595 -27
  404. package/src/domain/iampolicy/__tests__/iampolicy.test.ts +33 -2
  405. package/src/domain/iampolicy/__tests__/membership.test.ts +47 -5
  406. package/src/domain/iampolicy/__tests__/resource-store.test.ts +1 -0
  407. package/src/domain/iampolicy/__tests__/role-lifecycle.test.ts +41 -8
  408. package/src/domain/iampolicy/__tests__/roles.test.ts +3 -2
  409. package/src/domain/iampolicy/__tests__/steps.test.ts +75 -6
  410. package/src/domain/iampolicy/__tests__/support.ts +68 -4
  411. package/src/domain/iampolicy/access-lists.ts +70 -2
  412. package/src/domain/iampolicy/change.ts +109 -0
  413. package/src/domain/iampolicy/constants.ts +8 -0
  414. package/src/domain/iampolicy/controller.ts +17 -3
  415. package/src/domain/iampolicy/grant-path.ts +349 -31
  416. package/src/domain/iampolicy/membership.ts +32 -12
  417. package/src/domain/iampolicy/resource-store.ts +4 -0
  418. package/src/domain/iampolicy/role-lifecycle.ts +2 -0
  419. package/src/domain/iampolicy/roles.ts +8 -0
  420. package/src/domain/iampolicy/steps.ts +15 -5
  421. package/src/domain/iampolicy/store-contract.ts +37 -1
  422. package/src/domain/iampolicy/store.ts +19 -5
  423. package/src/domain/identityaccount/__tests__/resolve.test.ts +246 -2
  424. package/src/domain/identityaccount/__tests__/resource-store.test.ts +1 -1
  425. package/src/domain/identityaccount/constants.ts +20 -0
  426. package/src/domain/identityaccount/controller.ts +20 -5
  427. package/src/domain/identityaccount/resolve.ts +80 -1
  428. package/src/domain/identityaccount/resource-store.ts +14 -1
  429. package/src/domain/identityaccount/steps.ts +4 -3
  430. package/src/domain/identityaccount/store-contract.ts +4 -4
  431. package/src/domain/identityaccount/store.ts +6 -1
  432. package/src/domain/mcpserver/__tests__/connect-authorization.test.ts +1 -0
  433. package/src/domain/mcpserver/__tests__/connect.test.ts +358 -15
  434. package/src/domain/mcpserver/__tests__/mcpserver.test.ts +2 -0
  435. package/src/domain/mcpserver/__tests__/oauth-handshake.test.ts +2 -0
  436. package/src/domain/mcpserver/__tests__/store-faults.test.ts +2 -0
  437. package/src/domain/mcpserver/connect-sandbox.ts +135 -0
  438. package/src/domain/mcpserver/connect.ts +226 -56
  439. package/src/domain/mcpserver/controller.ts +8 -2
  440. package/src/domain/mcpserver/engine.ts +24 -6
  441. package/src/domain/mcpserver/start-connect.ts +49 -10
  442. package/src/domain/memory/__tests__/memory.test.ts +92 -22
  443. package/src/domain/memory/__tests__/queries.test.ts +173 -0
  444. package/src/domain/memory/controller.ts +2 -1
  445. package/src/domain/memory/list-index.ts +32 -0
  446. package/src/domain/memory/queries.ts +72 -0
  447. package/src/domain/memory/steps.ts +26 -63
  448. package/src/domain/oauthapp/__tests__/oauthapp.test.ts +14 -0
  449. package/src/domain/organization/__tests__/support.ts +41 -0
  450. package/src/domain/organization/steps.ts +1 -0
  451. package/src/domain/platformclient/mint.ts +6 -2
  452. package/src/domain/platformclient/verifier.ts +6 -3
  453. package/src/domain/plugin/__tests__/plugin.test.ts +11 -24
  454. package/src/domain/plugin/push.ts +1 -0
  455. package/src/domain/schedule/__tests__/schedule.composed.test.ts +2 -0
  456. package/src/domain/schedule/steps.ts +3 -1
  457. package/src/domain/session/__tests__/session.test.ts +2 -0
  458. package/src/domain/skill/__tests__/skill.test.ts +7 -25
  459. package/src/domain/skill/push.ts +1 -0
  460. package/src/domain/workflow/__tests__/workflow.test.ts +2 -0
  461. package/src/domain/workflow/registry/data/task-kind-registry.json +27 -1
  462. package/src/domain/workflowexecution/__tests__/forward-attribution-composed.test.ts +270 -0
  463. package/src/domain/workflowexecution/__tests__/submit-workflow-task-approval.test.ts +196 -0
  464. package/src/domain/workflowexecution/__tests__/workflowexecution.test.ts +3 -57
  465. package/src/domain/workflowexecution/submit-approval.ts +9 -2
  466. package/src/domain/workflowexecution/submit-file-decision.ts +6 -1
  467. package/src/domain/workflowexecution/submit-workflow-task-approval.ts +23 -5
  468. package/src/domain/workflowinstance/controller.ts +27 -9
  469. package/src/domain/workflowinstance/steps.ts +123 -1
  470. package/src/extensions/__tests__/apikey-before-sign-in-composed.test.ts +172 -0
  471. package/src/extensions/__tests__/built-in-authorization-composed.test.ts +80 -1
  472. package/src/extensions/__tests__/composed-services-composed.test.ts +236 -0
  473. package/src/extensions/__tests__/extension-composition.test.ts +229 -16
  474. package/src/extensions/__tests__/identity-account-composed.test.ts +84 -4
  475. package/src/extensions/__tests__/list-read-scope-composed.test.ts +2 -0
  476. package/src/extensions/__tests__/registry.test.ts +147 -1
  477. package/src/extensions/__tests__/secret-cleanup-composed.test.ts +2 -0
  478. package/src/extensions/__tests__/visitor-classifier-points.test.ts +42 -0
  479. package/src/extensions/composed-services.ts +61 -0
  480. package/src/extensions/drivers.ts +33 -1
  481. package/src/extensions/identity.ts +4 -1
  482. package/src/extensions/registry.ts +105 -0
  483. package/src/extensions/resource-authorization.ts +87 -0
  484. package/src/extensions/resource-row-reader.ts +43 -0
  485. package/src/extensions/visitor-classifier.ts +41 -0
  486. package/src/identity/__tests__/oidc-verifier.test.ts +38 -12
  487. package/src/identity/oidc-userinfo.ts +6 -1
  488. package/src/identity/oidc-verifier.ts +42 -8
  489. package/src/index.ts +61 -6
  490. package/src/pipeline/__tests__/steps.test.ts +31 -4
  491. package/src/pipeline/errors.ts +30 -16
  492. package/src/pipeline/interceptors/auth.ts +17 -9
  493. package/src/pipeline/steps/__tests__/authorization-tuples.test.ts +20 -0
  494. package/src/pipeline/steps/__tests__/guard-memory-capture.test.ts +72 -15
  495. package/src/pipeline/steps/authorization-tuples.ts +54 -0
  496. package/src/pipeline/steps/authorize.ts +6 -5
  497. package/src/pipeline/steps/defaults.ts +52 -7
  498. package/src/pipeline/steps/guard-memory-capture.ts +15 -20
  499. package/src/runnerauth/__tests__/built-in-runner-credential-provider.test.ts +1 -1
  500. package/src/runnerauth/__tests__/runner-subject-composed.test.ts +13 -0
  501. package/src/runnerauth/bound-execution.ts +2 -2
  502. package/src/runnerauth/built-in-runner-credential-provider.ts +8 -21
  503. package/src/runnerauth/runner-credential-provider.ts +17 -7
  504. package/src/sandbox/__tests__/docker.integration.test.ts +4 -0
  505. package/src/sandbox/__tests__/kubernetes.test.ts +18 -1
  506. package/src/sandbox/__tests__/local-process.integration.test.ts +4 -0
  507. package/src/sandbox/__tests__/provisioner.test.ts +1 -0
  508. package/src/sandbox/docker.ts +3 -0
  509. package/src/sandbox/kubernetes.ts +3 -0
  510. package/src/sandbox/local-process.ts +4 -0
  511. package/src/sandbox/provisioner.ts +18 -6
  512. package/src/store/postgres/__tests__/support.ts +11 -2
  513. package/src/temporal/README.md +1 -0
  514. package/src/temporal/__tests__/manager.test.ts +56 -4
  515. package/src/temporal/__tests__/sdk-log-workflows.ts +26 -0
  516. package/src/temporal/__tests__/sdk-logger.e2e.test.ts +150 -0
  517. package/src/temporal/__tests__/sdk-logger.test.ts +238 -0
  518. package/src/temporal/manager.ts +9 -0
  519. package/src/temporal/mcpserver/engine-client.ts +8 -3
  520. package/src/temporal/mcpserver/names.ts +16 -2
  521. package/src/temporal/sdk-logger.ts +173 -0
  522. package/dist/authorization/lane-admission.d.ts +0 -50
  523. package/dist/authorization/lane-admission.d.ts.map +0 -1
  524. package/dist/authorization/lane-admission.js +0 -13
  525. package/dist/authorization/lane-admission.js.map +0 -1
  526. package/src/authorization/__tests__/lane-admission.test.ts +0 -115
  527. package/src/authorization/lane-admission.ts +0 -73
@@ -1 +1 @@
1
- {"version":3,"file":"execution-viewer.d.ts","sourceRoot":"","sources":["../../../src/authorization/model/execution-viewer.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,eAAe,EAAE,eAiC7B,CAAC"}
1
+ {"version":3,"file":"execution-viewer.d.ts","sourceRoot":"","sources":["../../../src/authorization/model/execution-viewer.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD,eAAO,MAAM,eAAe,EAAE,eA8B7B,CAAC"}
@@ -11,40 +11,42 @@
11
11
  * `#execution_viewer@organization:<org>#viewer`, the organization's full
12
12
  * read audience (the relation also admits `#member`, the legacy shape),
13
13
  * and `private` or unset derives nothing, so each run stays its
14
- * triggerer's. Pure over the row; no related row is read.
14
+ * triggerer's. Pure over the row; no related row is read. Which level
15
+ * names which audience is `executionAudienceShapes`
16
+ * (pipeline/steps/authorization-tuples.ts), the one mapping this
17
+ * derivation and the lifecycle event a tuple-storing edition hears both
18
+ * read, so the two editions cannot disagree about who sees the runs.
15
19
  */
16
20
  import { isMessage } from "@bufbuild/protobuf";
17
21
  import { WorkflowInstanceSchema } from "@stigmer/protos/ai/stigmer/agentic/workflowinstance/v1/api_pb";
18
22
  import { WorkflowExecutionVisibility } from "@stigmer/protos/ai/stigmer/agentic/workflowinstance/v1/spec_pb";
23
+ import { executionAudienceShapes } from "../../pipeline/steps/authorization-tuples.js";
19
24
  export const executionViewer = (object, row) => {
20
25
  if (!isMessage(row, WorkflowInstanceSchema)) {
21
26
  return Promise.resolve([]);
22
27
  }
23
28
  const level = row.spec?.executionVisibility ?? WorkflowExecutionVisibility.unspecified;
24
- switch (level) {
25
- case WorkflowExecutionVisibility.organization: {
26
- const org = row.metadata?.org ?? "";
27
- return Promise.resolve(org === ""
28
- ? []
29
- : [
30
- {
31
- object,
32
- relation: "execution_viewer",
33
- subject: {
34
- form: "userset",
35
- object: { type: "organization", id: org },
36
- relation: "viewer",
37
- },
29
+ const org = row.metadata?.org ?? "";
30
+ if (org === "") {
31
+ return Promise.resolve([]);
32
+ }
33
+ return Promise.resolve([...executionAudienceShapes(level)].map((shape) => {
34
+ switch (shape) {
35
+ case "org-viewer":
36
+ return {
37
+ object,
38
+ relation: "execution_viewer",
39
+ subject: {
40
+ form: "userset",
41
+ object: { type: "organization", id: org },
42
+ relation: "viewer",
38
43
  },
39
- ]);
44
+ };
45
+ default: {
46
+ const exhaustive = shape;
47
+ throw new Error(`unknown execution audience: ${String(exhaustive)}`);
48
+ }
40
49
  }
41
- case WorkflowExecutionVisibility.private:
42
- case WorkflowExecutionVisibility.unspecified:
43
- return Promise.resolve([]);
44
- default: {
45
- const exhaustive = level;
46
- throw new Error(`unknown execution visibility: ${String(exhaustive)}`);
47
- }
48
- }
50
+ }));
49
51
  };
50
52
  //# sourceMappingURL=execution-viewer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution-viewer.js","sourceRoot":"","sources":["../../../src/authorization/model/execution-viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gEAAgE,CAAC;AAI7G,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;IAC9D,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,sBAAsB,CAAC,EAAE,CAAC;QAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,KAAK,GACT,GAAG,CAAC,IAAI,EAAE,mBAAmB,IAAI,2BAA2B,CAAC,WAAW,CAAC;IAC3E,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,2BAA2B,CAAC,YAAY,CAAC,CAAC,CAAC;YAC9C,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC;YACpC,OAAO,OAAO,CAAC,OAAO,CACpB,GAAG,KAAK,EAAE;gBACR,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC;oBACE;wBACE,MAAM;wBACN,QAAQ,EAAE,kBAAkB;wBAC5B,OAAO,EAAE;4BACP,IAAI,EAAE,SAAS;4BACf,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,EAAE;4BACzC,QAAQ,EAAE,QAAQ;yBACnB;qBACF;iBACF,CACN,CAAC;QACJ,CAAC;QACD,KAAK,2BAA2B,CAAC,OAAO,CAAC;QACzC,KAAK,2BAA2B,CAAC,WAAW;YAC1C,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC7B,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,UAAU,GAAU,KAAK,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,iCAAiC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"execution-viewer.js","sourceRoot":"","sources":["../../../src/authorization/model/execution-viewer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gEAAgE,CA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`, `invitation` or
20
20
  * `platform`, and a tuple that names one resolves over tuples alone, since
21
- * this edition stores no row of those kinds.
21
+ * open source stores no row of those kinds. An edition that serves them
22
+ * keeps their rows in its units' own stores and registers a reader for
23
+ * each (extensions/resource-row-reader.ts), which the derivation reads them
24
+ * through.
22
25
  *
23
26
  * `newModel` exists for tests that need a throwaway model (a cycle, a
24
27
  * chain past the depth bound).
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authorization/model/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAGtH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,KAAK;IACpB,yBAAyB;IACzB,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS,CAAC;IAC3D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;CACnD;AAED,wBAAgB,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,KAAK,CAe5E;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAC/B,QAAQ,EAAE,WAAW,CAAC,eAAe,EAAE,WAAW,CAAC,GAClD,aAAa,CAAC,eAAe,CAAC,CAoChC;AAED,iEAAiE;AACjE,eAAO,MAAM,YAAY,EAAE,KAE1B,CAAC;AAEF,sGAAsG;AACtG,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,GACpB,eAAe,GAAG,SAAS,CAE7B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authorization/model/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAGtH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAmB,eAAe,EAAE,MAAM,cAAc,CAAC;AAErE,MAAM,WAAW,KAAK;IACpB,yBAAyB;IACzB,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS,CAAC;IAC3D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAAC;CACnD;AAED,wBAAgB,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,KAAK,CAe5E;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAC/B,QAAQ,EAAE,WAAW,CAAC,eAAe,EAAE,WAAW,CAAC,GAClD,aAAa,CAAC,eAAe,CAAC,CAoChC;AAED,iEAAiE;AACjE,eAAO,MAAM,YAAY,EAAE,KAE1B,CAAC;AAEF,sGAAsG;AACtG,wBAAgB,cAAc,CAC5B,IAAI,EAAE,eAAe,GACpB,eAAe,GAAG,SAAS,CAE7B"}
@@ -18,7 +18,10 @@
18
18
  * evaluation (authorizer.ts, `kindServedByEdition`): open source refuses a
19
19
  * check that targets `team`, `identity_provider`, `invitation` or
20
20
  * `platform`, and a tuple that names one resolves over tuples alone, since
21
- * this edition stores no row of those kinds.
21
+ * open source stores no row of those kinds. An edition that serves them
22
+ * keeps their rows in its units' own stores and registers a reader for
23
+ * each (extensions/resource-row-reader.ts), which the derivation reads them
24
+ * through.
22
25
  *
23
26
  * `newModel` exists for tests that need a throwaway model (a cycle, a
24
27
  * chain past the depth bound).
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/authorization/model/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAEtH,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,aAAa,MAAM,iCAAiC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAUrD,MAAM,UAAU,QAAQ,CAAC,YAA4C;IACnE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoC,CAAC;IAC3D,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;IAClD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW,CAAC,IAAI,iCAAiC,CAAC,CAAC;QACxE,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAC1C,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO;QACL,YAAY;QACZ,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;QAClC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;KACnC,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,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* `and` exists for one shape: a relation that is true only while another
18
- * holds too (a team's member is a person granted the role AND still one
18
+ * holds too. Every direct grant on an organization-scoped type is bounded
19
+ * that way (`([identity_account] and affiliated from organization) or
20
+ * ...`), and a team's member is a person granted the role AND still one
19
21
  * of the organization's viewers, so leaving the organization ends every
20
- * team-derived grant with no cleanup). Operators nest to any depth, as
21
- * the DSL's parentheses allow; the evaluator recurses through them.
22
+ * grant with no cleanup. Operators nest to any depth, as the DSL's
23
+ * parentheses allow; the evaluator recurses through them.
22
24
  * `but not`, wildcards (`type:*`) and conditions have no form here: the
23
25
  * reader refuses them by name, and the day the model needs one is a
24
26
  * design act.
@@ -1 +1 @@
1
- {"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../../src/authorization/model/rewrite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAE3H,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAEhE,0DAA0D;AAC1D,MAAM,MAAM,WAAW;AACrB,oEAAoE;AAClE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACpD,sFAAsF;GACpF;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEN,MAAM,MAAM,OAAO;AACjB,gGAAgG;AAC9F;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,CA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c,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CAC1C,CAAC;AAMN;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,SAAS,KACd,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAEnC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,wFAAwF;IACxF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CACxD"}
@@ -1,4 +1,46 @@
1
+ /**
2
+ * The built-in organization directory — open source's driver for the
3
+ * organization-directory seam (extensions/organization-directory.ts),
4
+ * composed under the built-in posture. The cloud's directory answers
5
+ * `findMyOrganizations` with OpenFGA's list-objects for
6
+ * `organization#can_view`; this one answers the same question over the
7
+ * derived source: the candidates are the organizations the person's own
8
+ * IamPolicy rows name (on open source a person reaches an organization
9
+ * through a role row and nothing else — the derivation writes no
10
+ * organization tuple), and each candidate is kept when
11
+ * `can_view` holds for the person, evaluated by the same evaluator the
12
+ * Authorizer uses. An evaluation rather than a relation filter, so the
13
+ * answer stays right if the grant scope ever widens past the four roles,
14
+ * and stays equal to the cloud's today.
15
+ *
16
+ * `refusesEnumeration` is TRUE, the cloud's posture: `find` is
17
+ * skip-authorization by annotation, so under an enforcing server it would
18
+ * hand every member every organization row — the list that lies. The
19
+ * first-party clients list through `findMyOrganizations`. Trusted-local
20
+ * composes no directory and keeps enumerating (one caller, nothing to
21
+ * hide from).
22
+ *
23
+ * A caller who resolves to no account (an idp-shaped subject before
24
+ * provisioning) holds no rows and is answered `[]`, never a fault: the
25
+ * conformance sibling's readiness probe is this very RPC with a fresh
26
+ * subject. The `internal` class — the server acting as itself over the
27
+ * in-process transport — is answered `ALL_ORGANIZATIONS`: the Authorize
28
+ * step treats that class as the in-process authorization skip (pipeline/
29
+ * interceptors/auth.ts, ruling Q4), and a directory answer IS an
30
+ * authorization answer, so a server-internal hop sees what the permissive
31
+ * default showed it. `findMyOrganizations` is skip-authorization by
32
+ * annotation, which is why this driver meets that caller at all: a
33
+ * skip lane hands the directory the identity the interceptor stamped,
34
+ * and no Authorize arm ran before it. Every other caller gets the
35
+ * evaluated list.
36
+ * The controller loads each id it is handed and skips the ones whose row
37
+ * is gone (grants can outlive rows); the source has already loaded the
38
+ * row once for the evaluation — two primary-key reads per organization,
39
+ * a handful per person, and the contract's own read is the controller's.
40
+ */
41
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
1
42
  import type { IamPolicyStore } from "../domain/iampolicy/store.js";
43
+ import type { ResourceRowReader } from "../extensions/resource-row-reader.js";
2
44
  import type { OrganizationDirectory } from "../extensions/organization-directory.js";
3
45
  import type { Store } from "../store/interface.js";
4
46
  import type { Model } from "./model/index.js";
@@ -7,6 +49,8 @@ export interface BuiltInOrganizationDirectoryDeps {
7
49
  readonly store: Store;
8
50
  readonly policies: IamPolicyStore;
9
51
  readonly accounts: AccountsByCaller;
52
+ /** The readers of the kinds units keep themselves (`drivers.resourceRowReaders`), handed to every tuple source. */
53
+ readonly rowReaders?: ReadonlyMap<ApiResourceKind, ResourceRowReader>;
10
54
  readonly model?: Model;
11
55
  }
12
56
  export declare function newBuiltInOrganizationDirectory(deps: BuiltInOrganizationDirectoryDeps): OrganizationDirectory;
@@ -1 +1 @@
1
- {"version":3,"file":"organization-directory.d.ts","sourceRoot":"","sources":["../../src/authorization/organization-directory.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAGrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB;AAID,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,gCAAgC,GACrC,qBAAqB,CA6CvB"}
1
+ {"version":3,"file":"organization-directory.d.ts","sourceRoot":"","sources":["../../src/authorization/organization-directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAEtH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAGrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACpC,mHAAmH;IACnH,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB;AAID,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,gCAAgC,GACrC,qBAAqB,CA8CvB"}
@@ -59,6 +59,7 @@ export function newBuiltInOrganizationDirectory(deps) {
59
59
  store: deps.store,
60
60
  policies: deps.policies,
61
61
  accounts: deps.accounts,
62
+ rowReaders: deps.rowReaders,
62
63
  model,
63
64
  }, person);
64
65
  // The candidates come from the source's ONE read of the person's
@@ -1 +1 @@
1
- {"version":3,"file":"organization-directory.js","sourceRoot":"","sources":["../../src/authorization/organization-directory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAKtH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAS5C,MAAM,YAAY,GAAG,YAAY,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;AAEhE,MAAM,UAAU,+BAA+B,CAC7C,IAAsC;IAEtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,YAAY,CAAC;IACzC,OAAO;QACL,kBAAkB,EAAE,IAAI;QAExB,KAAK,CAAC,qBAAqB,CACzB,MAAsB;YAEtB,IAAI,MAAM,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;gBACtC,OAAO,iBAAiB,CAAC;YAC3B,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC1D,MAAM,MAAM,GAAG,qBAAqB,CAClC;gBACE,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,KAAK;aACN,EACD,MAAM,CACP,CAAC;YACF,iEAAiE;YACjE,kEAAkE;YAClE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;YACrC,KAAK,MAAM,KAAK,IAAI,MAAM,MAAM,CAAC,YAAY,EAAE,EAAE,CAAC;gBAChD,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;oBACjE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC;YACD,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;gBAC5B,IACE,MAAM,aAAa,CACjB,EAAE,KAAK,EAAE,MAAM,EAAE,EACjB,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,EAC1B,UAAU,EACV,MAAM,CACP,EACD,CAAC;oBACD,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"organization-directory.js","sourceRoot":"","sources":["../../src/authorization/organization-directory.ts"],"names":[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,CAAC;gBAChD,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;oBACjE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC;YACD,MAAM,OAAO,GAAa,EAAE,CAAC;YAC7B,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;gBAC5B,IACE,MAAM,aAAa,CACjB,EAAE,KAAK,EAAE,MAAM,EAAE,EACjB,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,EAC1B,UAAU,EACV,MAAM,CACP,EACD,CAAC;oBACD,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBACnB,CAAC;YACH,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -4,13 +4,17 @@
4
4
  * list scope when it lands), so "who is asking" cannot be answered two
5
5
  * ways.
6
6
  *
7
- * Two steps, split so the pure half is testable without a store:
7
+ * The steps, split so the pure half is testable without a store:
8
8
  *
9
9
  * `resolvePerson(accounts, caller)` — the I/O: the account the caller
10
10
  * stands for through `accountForCaller` (domain/identityaccount/
11
11
  * resolve.ts, the domain's one statement of that question — the two
12
12
  * reads whoAmI makes), then `personFor`.
13
13
  *
14
+ * `personOfAccount(accounts, id)` — the person an account id names
15
+ * when no caller stands for them (an invitation's creator), with the
16
+ * same alias rule.
17
+ *
14
18
  * `personFor(caller, account)` — the pure half: the account id the
15
19
  * IamPolicy rows name, and every string a creator stamp may carry for
16
20
  * the same human. A provisioned caller carries the account id and the
@@ -33,10 +37,19 @@
33
37
  */
34
38
  import type { IdentityAccount } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/api_pb";
35
39
  import type { AccountsByCaller } from "../domain/identityaccount/resolve.js";
40
+ import type { IdentityAccountStore } from "../domain/identityaccount/store.js";
36
41
  import type { CallerIdentity } from "../extensions/identity.js";
37
42
  import type { Person } from "./tuples.js";
38
43
  export type { AccountsByCaller } from "../domain/identityaccount/resolve.js";
39
44
  export declare function personFor(caller: CallerIdentity, account: IdentityAccount | undefined): Person;
45
+ /**
46
+ * The person an account id names when no caller stands for them: the
47
+ * creator of an invitation, asked whether they could still grant what it
48
+ * grants. The alias rule is `personFor`'s: the id itself, and the issuer
49
+ * subject when the account is found. An account that is gone is its id
50
+ * alone, and the rows that still name it are what the check reads.
51
+ */
52
+ export declare function personOfAccount(accounts: Pick<IdentityAccountStore, "findById">, accountId: string): Promise<Person>;
40
53
  /** The person a caller is, read through the account port; faults propagate as they are. */
41
54
  export declare function resolvePerson(accounts: AccountsByCaller, caller: CallerIdentity): Promise<Person>;
42
55
  //# sourceMappingURL=person.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../../src/authorization/person.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAGhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,wBAAgB,SAAS,CACvB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,eAAe,GAAG,SAAS,GACnC,MAAM,CAaR;AAED,2FAA2F;AAC3F,wBAAsB,aAAa,CACjC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC,CAEjB"}
1
+ {"version":3,"file":"person.d.ts","sourceRoot":"","sources":["../../src/authorization/person.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAGhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,wBAAgB,SAAS,CACvB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,eAAe,GAAG,SAAS,GACnC,MAAM,CAQR;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,EAChD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAcD,2FAA2F;AAC3F,wBAAsB,aAAa,CACjC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC,CAEjB"}
@@ -5,6 +5,22 @@ export function personFor(caller, account) {
5
5
  if (!isPersonStamp(accountId)) {
6
6
  throw new Error(`caller '${accountId}' names no person — the built-in authorizer evaluates people only`);
7
7
  }
8
+ return withAliases(accountId, account);
9
+ }
10
+ /**
11
+ * The person an account id names when no caller stands for them: the
12
+ * creator of an invitation, asked whether they could still grant what it
13
+ * grants. The alias rule is `personFor`'s: the id itself, and the issuer
14
+ * subject when the account is found. An account that is gone is its id
15
+ * alone, and the rows that still name it are what the check reads.
16
+ */
17
+ export async function personOfAccount(accounts, accountId) {
18
+ if (!isPersonStamp(accountId)) {
19
+ throw new Error(`account '${accountId}' names no person — the built-in authorizer evaluates people only`);
20
+ }
21
+ return withAliases(accountId, await accounts.findById(accountId));
22
+ }
23
+ function withAliases(accountId, account) {
8
24
  const aliases = new Set([accountId]);
9
25
  const subject = account?.spec?.idpId ?? "";
10
26
  if (subject !== "") {
@@ -1 +1 @@
1
- {"version":3,"file":"person.js","sourceRoot":"","sources":["../../src/authorization/person.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAMxE,MAAM,UAAU,SAAS,CACvB,MAAsB,EACtB,OAAoC;IAEpC,MAAM,SAAS,GAAG,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC;IAC7D,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,WAAW,SAAS,mEAAmE,CACxF,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,OAAO,EAAE,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC;IAC3C,IAAI,OAAO,KAAK,EAAE,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAA0B,EAC1B,MAAsB;IAEtB,OAAO,SAAS,CAAC,MAAM,EAAE,MAAM,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACrE,CAAC"}
1
+ {"version":3,"file":"person.js","sourceRoot":"","sources":["../../src/authorization/person.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAGlE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAMxE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-query
3
+ * engine (extensions/authorization-queries.ts, `check`) that the built-in
4
+ * posture can answer from its own evaluator: "is this policy effectively
5
+ * held". A unit composed on the built-in posture asks it through the
6
+ * services the composition hands it (extensions/registry.ts,
7
+ * `ComposedServices`), exactly where a composition with its own engine
8
+ * hands that engine's `check`, so the unit asks one question in every
9
+ * edition and the model answers it one way.
10
+ *
11
+ * What it answers, and why no more:
12
+ * - A policy whose principal is a person (`identity_account:<id>`): the
13
+ * person the id names, with `personFor`'s alias rule (person.ts), and
14
+ * the rows they and their teams hold — the same walk a point check
15
+ * makes for a caller.
16
+ * - A policy whose principal is any other object (`organization:<o>`):
17
+ * the structural question a grant to a team asks — does this resource
18
+ * belong to the team's organization — answered by the resource's own
19
+ * derived links (derived-tuples.ts).
20
+ * - Contextual policies are refused as a programming error. No caller
21
+ * asks with them, and the derived source has no notion of a tuple held
22
+ * only for the length of one check; answering without them would be a
23
+ * silent wrong answer, the failure a throw prevents.
24
+ * - A userset principal (`organization:<o>#member`) is refused the same
25
+ * way: the engine contract checks direct principals.
26
+ *
27
+ * The engine's list verbs are not answered here: they enumerate, which the
28
+ * built-in posture does not do, and the tuple-half RPCs that expose them
29
+ * keep refusing in open source without an engine. One source per check,
30
+ * like the Authorizer: its memo is the check's. Faults propagate; the
31
+ * caller's own error mapping decides the wire.
32
+ */
33
+ import type { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
34
+ import type { IamPolicyStore } from "../domain/iampolicy/store.js";
35
+ import type { IdentityAccountStore } from "../domain/identityaccount/store.js";
36
+ import type { AuthorizationQueryEngine } from "../extensions/authorization-queries.js";
37
+ import type { ResourceRowReader } from "../extensions/resource-row-reader.js";
38
+ import type { Store } from "../store/interface.js";
39
+ import type { Model } from "./model/index.js";
40
+ export interface BuiltInPolicyCheckDeps {
41
+ readonly store: Store;
42
+ /** The port the grant path writes through — the principal's rows are read from the same instance. */
43
+ readonly policies: IamPolicyStore;
44
+ /** The account port: a person principal's aliases, and identity_account objects. */
45
+ readonly accounts: Pick<IdentityAccountStore, "findById">;
46
+ /** The readers of the kinds units keep themselves (`drivers.resourceRowReaders`). */
47
+ readonly rowReaders?: ReadonlyMap<ApiResourceKind, ResourceRowReader>;
48
+ /** The declarations to evaluate; the built-in model unless a test says otherwise. */
49
+ readonly model?: Model;
50
+ }
51
+ export declare function newBuiltInPolicyCheck(deps: BuiltInPolicyCheckDeps): Pick<AuthorizationQueryEngine, "check">;
52
+ //# sourceMappingURL=policy-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-check.d.ts","sourceRoot":"","sources":["../../src/authorization/policy-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAE3H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAM9C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,qGAAqG;IACrG,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;IAC1D,qFAAqF;IACrF,QAAQ,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;IACtE,qFAAqF;IACrF,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;CACxB;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,GAC3B,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,CA2CzC"}
@@ -0,0 +1,35 @@
1
+ import { newDerivedTupleSource } from "./derived-tuples.js";
2
+ import { checkRelation } from "./evaluator.js";
3
+ import { builtInModel } from "./model/index.js";
4
+ import { personOfAccount } from "./person.js";
5
+ import { ACCOUNT_TYPE } from "./tuples.js";
6
+ export function newBuiltInPolicyCheck(deps) {
7
+ const model = deps.model ?? builtInModel;
8
+ return {
9
+ async check(policy, contextualPolicies) {
10
+ if (contextualPolicies.length > 0) {
11
+ throw new Error("the built-in policy check evaluates held policies only — contextual policies are not supported");
12
+ }
13
+ const principalRef = policy.principal;
14
+ const resource = policy.resource;
15
+ if (principalRef === undefined || resource === undefined) {
16
+ throw new Error("the built-in policy check needs a principal and a resource");
17
+ }
18
+ if (principalRef.relation !== "") {
19
+ throw new Error(`the built-in policy check takes a direct principal — '${principalRef.kind}:${principalRef.id}#${principalRef.relation}' is a userset`);
20
+ }
21
+ const principal = principalRef.kind === ACCOUNT_TYPE
22
+ ? await personOfAccount(deps.accounts, principalRef.id)
23
+ : { object: { type: principalRef.kind, id: principalRef.id } };
24
+ const source = newDerivedTupleSource({
25
+ store: deps.store,
26
+ policies: deps.policies,
27
+ accounts: deps.accounts,
28
+ rowReaders: deps.rowReaders,
29
+ model,
30
+ }, principal);
31
+ return checkRelation({ model, source }, { type: resource.kind, id: resource.id }, policy.relation, principal);
32
+ },
33
+ };
34
+ }
35
+ //# sourceMappingURL=policy-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-check.js","sourceRoot":"","sources":["../../src/authorization/policy-check.ts"],"names":[],"mappings":"AAuCA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAA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AAE,IAAI,CAAC,QAAQ;gBACvB,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,KAAK;aACN,EACD,SAAS,CACV,CAAC;YACF,OAAO,aAAa,CAClB,EAAE,KAAK,EAAE,MAAM,EAAE,EACjB,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,EACxC,MAAM,CAAC,QAAQ,EACf,SAAS,CACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -14,19 +14,31 @@
14
14
  * posture (the OSS OIDC issuer, or a unit's declaration). Open source
15
15
  * composes the built-in Authorizer, the organization directory and
16
16
  * the schedule fire caller — the cloud's model evaluated over derived
17
- * tuples — so the roles 2b records are enforced.
17
+ * tuples — so the roles 2b records are enforced. An edition above
18
+ * open source may run it too, once every kind it serves has rows the
19
+ * derivation can read (`kindsWithoutRows` below).
18
20
  * - `trusted-local`: no unit Authorizer and no authentication posture —
19
- * the laptop. The permissive default stays: one caller, nothing to
20
- * separate; the trusted-local identity carries the operator's EMAIL,
21
+ * the laptop. The permissive driver (trusted-local-authorizer.ts): one
22
+ * caller, nothing to separate, so every check is allowed except one
23
+ * that names an Organization the server does not hold, which is
24
+ * not-found as under the other two postures (stigmer#1163). The
25
+ * trusted-local identity carries the operator's EMAIL,
21
26
  * never an account id, and pre-2a rows are stamped `"system"`, so an
22
27
  * enforcing evaluator would refuse the laptop's own history. The roles
23
28
  * still exist (the lifecycle and the membership rules run) to feed the
24
- * Members page truthfully.
29
+ * Members page truthfully. Open source's edition only: a composition
30
+ * serving an edition above it refuses to boot here, since an edition
31
+ * of many organizations with no sign-in would act as the operator for
32
+ * every request that carries no credential.
25
33
  *
26
34
  * The type lives with the module that gives it meaning (the precedent:
27
35
  * `ConsoleSignInPosture` in transport/console/handler.ts); the
28
36
  * composition root computes the value once and hands it down.
29
37
  */
38
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
39
+ import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
40
+ import type { ResourceRowReader } from "../extensions/resource-row-reader.js";
41
+ import type { Model } from "./model/index.js";
30
42
  export type AuthorizationPosture = "trusted-local" | "built-in" | "unit-authorizer";
31
43
  export interface AuthorizationPostureInputs {
32
44
  /** A unit registered `authorizer` (ResolvedExtensions.authorizer !== undefined). */
@@ -35,4 +47,18 @@ export interface AuthorizationPostureInputs {
35
47
  readonly requireAuthentication: boolean;
36
48
  }
37
49
  export declare function authorizationPostureOf(inputs: AuthorizationPostureInputs): AuthorizationPosture;
50
+ /**
51
+ * The kinds an edition serves whose rows the built-in authorizer could not
52
+ * read: declared by the model with a row schema, served by the edition,
53
+ * not served by open source (whose kinds are its own store's), and not
54
+ * `identity_account` (read through the account port), with no reader
55
+ * registered for them. Empty means the built-in posture can answer every
56
+ * check the edition's lanes make. The composition root refuses a built-in
57
+ * posture that leaves any, rather than answer from rows that are not there.
58
+ */
59
+ export declare function kindsWithoutRows(inputs: {
60
+ readonly edition: ServerEdition;
61
+ readonly model: Model;
62
+ readonly readers: ReadonlyMap<ApiResourceKind, ResourceRowReader>;
63
+ }): ReadonlyArray<ApiResourceKind>;
38
64
  //# sourceMappingURL=posture.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"posture.d.ts","sourceRoot":"","sources":["../../src/authorization/posture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,MAAM,oBAAoB,GAC5B,eAAe,GACf,UAAU,GACV,iBAAiB,CAAC;AAEtB,MAAM,WAAW,0BAA0B;IACzC,oFAAoF;IACpF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,0FAA0F;IAC1F,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;CACzC;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,GACjC,oBAAoB,CAKtB"}
1
+ {"version":3,"file":"posture.d.ts","sourceRoot":"","sources":["../../src/authorization/posture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAEtF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,MAAM,oBAAoB,GAC5B,eAAe,GACf,UAAU,GACV,iBAAiB,CAAC;AAEtB,MAAM,WAAW,0BAA0B;IACzC,oFAAoF;IACpF,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,0FAA0F;IAC1F,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;CACzC;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,0BAA0B,GACjC,oBAAoB,CAKtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IACvC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC;CACnE,GAAG,aAAa,CAAC,eAAe,CAAC,CAWjC"}
@@ -1,7 +1,65 @@
1
+ /**
2
+ * The authorization posture — WHICH authorizer a composed server runs,
3
+ * named once so the composition root, the boot log and the tests speak
4
+ * one word for it. Three postures, decided by two facts the registry and
5
+ * the config already hold:
6
+ *
7
+ * - `unit-authorizer`: a unit registered its own Authorizer (the cloud
8
+ * composes OpenFGA). Nothing built in is installed — not the
9
+ * authorizer, not the directory, not the fire caller, and not the
10
+ * role lifecycle or the membership rules either (a composition with
11
+ * its own Authorizer has its own onboarding). The require-
12
+ * authentication posture does not change this.
13
+ * - `built-in`: no unit Authorizer AND the require-authentication
14
+ * posture (the OSS OIDC issuer, or a unit's declaration). Open source
15
+ * composes the built-in Authorizer, the organization directory and
16
+ * the schedule fire caller — the cloud's model evaluated over derived
17
+ * tuples — so the roles 2b records are enforced. An edition above
18
+ * open source may run it too, once every kind it serves has rows the
19
+ * derivation can read (`kindsWithoutRows` below).
20
+ * - `trusted-local`: no unit Authorizer and no authentication posture —
21
+ * the laptop. The permissive driver (trusted-local-authorizer.ts): one
22
+ * caller, nothing to separate, so every check is allowed except one
23
+ * that names an Organization the server does not hold, which is
24
+ * not-found as under the other two postures (stigmer#1163). The
25
+ * trusted-local identity carries the operator's EMAIL,
26
+ * never an account id, and pre-2a rows are stamped `"system"`, so an
27
+ * enforcing evaluator would refuse the laptop's own history. The roles
28
+ * still exist (the lifecycle and the membership rules run) to feed the
29
+ * Members page truthfully. Open source's edition only: a composition
30
+ * serving an edition above it refuses to boot here, since an edition
31
+ * of many organizations with no sign-in would act as the operator for
32
+ * every request that carries no credential.
33
+ *
34
+ * The type lives with the module that gives it meaning (the precedent:
35
+ * `ConsoleSignInPosture` in transport/console/handler.ts); the
36
+ * composition root computes the value once and hands it down.
37
+ */
38
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
39
+ import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
40
+ import { kindServedByEdition } from "../pipeline/apiresource-meta.js";
1
41
  export function authorizationPostureOf(inputs) {
2
42
  if (inputs.unitAuthorizer) {
3
43
  return "unit-authorizer";
4
44
  }
5
45
  return inputs.requireAuthentication ? "built-in" : "trusted-local";
6
46
  }
47
+ /**
48
+ * The kinds an edition serves whose rows the built-in authorizer could not
49
+ * read: declared by the model with a row schema, served by the edition,
50
+ * not served by open source (whose kinds are its own store's), and not
51
+ * `identity_account` (read through the account port), with no reader
52
+ * registered for them. Empty means the built-in posture can answer every
53
+ * check the edition's lanes make. The composition root refuses a built-in
54
+ * posture that leaves any, rather than answer from rows that are not there.
55
+ */
56
+ export function kindsWithoutRows(inputs) {
57
+ return inputs.model.declarations
58
+ .filter((declaration) => declaration.schema !== undefined &&
59
+ declaration.kind !== ApiResourceKind.identity_account &&
60
+ kindServedByEdition(declaration.kind, inputs.edition) &&
61
+ !kindServedByEdition(declaration.kind, ServerEdition.oss) &&
62
+ !inputs.readers.has(declaration.kind))
63
+ .map((declaration) => declaration.kind);
64
+ }
7
65
  //# sourceMappingURL=posture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"posture.js","sourceRoot":"","sources":["../../src/authorization/posture.ts"],"names":[],"mappings":"AAyCA,MAAM,UAAU,sBAAsB,CACpC,MAAkC;IAElC,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC;AACrE,CAAC"}
1
+ {"version":3,"file":"posture.js","sourceRoot":"","sources":["../../src/authorization/posture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAGtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAetE,MAAM,UAAU,sBAAsB,CACpC,MAAkC;IAElC,IAAI,MAAM,CAAC,cAAc,EAAE,CAAC;QAC1B,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,OAAO,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC;AACrE,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAIhC;IACC,OAAO,MAAM,CAAC,KAAK,CAAC,YAAY;SAC7B,MAAM,CACL,CAAC,WAAW,EAAE,EAAE,CACd,WAAW,CAAC,MAAM,KAAK,SAAS;QAChC,WAAW,CAAC,IAAI,KAAK,eAAe,CAAC,gBAAgB;QACrD,mBAAmB,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC;QACrD,CAAC,mBAAmB,CAAC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC;QACzD,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CACxC;SACA,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ResourceCreators } from "../domain/iampolicy/grant-path.js";
2
+ import type { Store } from "../store/interface.js";
3
+ export declare function newStoreResourceCreators(store: Store): ResourceCreators;
4
+ //# sourceMappingURL=resource-creators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-creators.d.ts","sourceRoot":"","sources":["../../src/authorization/resource-creators.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAInD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,gBAAgB,CAuBvE"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * The removal sweep's one read outside the policy rows: a stored
3
+ * resource's recorded creator (`ResourceCreators`,
4
+ * domain/iampolicy/grant-path.ts). When an account leaves an
5
+ * organization, the grant path keeps the rows that record the account as
6
+ * a resource's author, and only the resource's own row says who that is.
7
+ *
8
+ * The row is read through the generic store with the schema the built-in
9
+ * model binds to its kind, the same read the derived tuple source makes
10
+ * for a check (derived-tuples.ts `loadRow`), and the creator is the stamp
11
+ * that source derives an author's `owner` tuple from (`createdByOf`). A
12
+ * kind the model binds no schema to, or a row the store does not hold (a
13
+ * kind a composition keeps in its own table), has no recorded creator
14
+ * here, so no row of it is kept as authorship.
15
+ */
16
+ import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
17
+ import { kindByEnumName } from "../pipeline/apiresource-meta.js";
18
+ import { createdByOf } from "../pipeline/steps/authorization-facts.js";
19
+ import { ResourceNotFoundError } from "../store/interface.js";
20
+ import { builtInModel } from "./model/index.js";
21
+ export function newStoreResourceCreators(store) {
22
+ return {
23
+ async creatorOf(kindName, id) {
24
+ const kind = kindByEnumName(kindName);
25
+ const schema = builtInModel.byKind(kind)?.schema;
26
+ if (kind === ApiResourceKind.api_resource_kind_unknown ||
27
+ kind === ApiResourceKind.identity_account ||
28
+ schema === undefined ||
29
+ id === "") {
30
+ return undefined;
31
+ }
32
+ try {
33
+ return createdByOf(await store.getResource(kind, id, schema));
34
+ }
35
+ catch (error) {
36
+ if (error instanceof ResourceNotFoundError) {
37
+ return undefined;
38
+ }
39
+ throw error;
40
+ }
41
+ },
42
+ };
43
+ }
44
+ //# sourceMappingURL=resource-creators.js.map