@stigmer/server 3.24.0 → 3.26.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 (341) hide show
  1. package/dist/authorization/authorizer.d.ts +10 -4
  2. package/dist/authorization/authorizer.d.ts.map +1 -1
  3. package/dist/authorization/authorizer.js +11 -4
  4. package/dist/authorization/authorizer.js.map +1 -1
  5. package/dist/authorization/model/index.d.ts +4 -4
  6. package/dist/authorization/model/index.d.ts.map +1 -1
  7. package/dist/authorization/model/index.js +2 -0
  8. package/dist/authorization/model/index.js.map +1 -1
  9. package/dist/authorization/model/oauth_app.d.ts.map +1 -1
  10. package/dist/authorization/model/oauth_app.js +3 -2
  11. package/dist/authorization/model/oauth_app.js.map +1 -1
  12. package/dist/authorization/model/platform_client.d.ts +2 -0
  13. package/dist/authorization/model/platform_client.d.ts.map +1 -0
  14. package/dist/authorization/model/platform_client.js +31 -0
  15. package/dist/authorization/model/platform_client.js.map +1 -0
  16. package/dist/boot/compose.d.ts.map +1 -1
  17. package/dist/boot/compose.js +99 -13
  18. package/dist/boot/compose.js.map +1 -1
  19. package/dist/boot/list-indexes.d.ts +3 -0
  20. package/dist/boot/list-indexes.d.ts.map +1 -0
  21. package/dist/boot/list-indexes.js +24 -0
  22. package/dist/boot/list-indexes.js.map +1 -0
  23. package/dist/boot/route-shadowing.d.ts +25 -0
  24. package/dist/boot/route-shadowing.d.ts.map +1 -0
  25. package/dist/boot/route-shadowing.js +17 -0
  26. package/dist/boot/route-shadowing.js.map +1 -0
  27. package/dist/domain/agentexecution/controller.d.ts.map +1 -1
  28. package/dist/domain/agentexecution/controller.js +6 -8
  29. package/dist/domain/agentexecution/controller.js.map +1 -1
  30. package/dist/domain/agentexecution/list-index.d.ts +2 -0
  31. package/dist/domain/agentexecution/list-index.d.ts.map +1 -0
  32. package/dist/domain/agentexecution/list-index.js +23 -0
  33. package/dist/domain/agentexecution/list-index.js.map +1 -0
  34. package/dist/domain/agentexecution/steps.d.ts +17 -33
  35. package/dist/domain/agentexecution/steps.d.ts.map +1 -1
  36. package/dist/domain/agentexecution/steps.js +94 -95
  37. package/dist/domain/agentexecution/steps.js.map +1 -1
  38. package/dist/domain/agentexecution/usage.d.ts.map +1 -1
  39. package/dist/domain/agentexecution/usage.js +37 -14
  40. package/dist/domain/agentexecution/usage.js.map +1 -1
  41. package/dist/domain/artifact/controller.d.ts.map +1 -1
  42. package/dist/domain/artifact/controller.js +27 -15
  43. package/dist/domain/artifact/controller.js.map +1 -1
  44. package/dist/domain/artifact/list-index.d.ts +2 -0
  45. package/dist/domain/artifact/list-index.d.ts.map +1 -0
  46. package/dist/domain/artifact/list-index.js +21 -0
  47. package/dist/domain/artifact/list-index.js.map +1 -0
  48. package/dist/domain/iampolicy/membership.d.ts +6 -1
  49. package/dist/domain/iampolicy/membership.d.ts.map +1 -1
  50. package/dist/domain/iampolicy/membership.js +8 -2
  51. package/dist/domain/iampolicy/membership.js.map +1 -1
  52. package/dist/domain/identityaccount/constants.d.ts +13 -0
  53. package/dist/domain/identityaccount/constants.d.ts.map +1 -1
  54. package/dist/domain/identityaccount/constants.js +17 -0
  55. package/dist/domain/identityaccount/constants.js.map +1 -1
  56. package/dist/domain/identityaccount/controller.d.ts +3 -1
  57. package/dist/domain/identityaccount/controller.d.ts.map +1 -1
  58. package/dist/domain/identityaccount/controller.js +15 -6
  59. package/dist/domain/identityaccount/controller.js.map +1 -1
  60. package/dist/domain/identityaccount/operator.d.ts.map +1 -1
  61. package/dist/domain/identityaccount/operator.js +1 -0
  62. package/dist/domain/identityaccount/operator.js.map +1 -1
  63. package/dist/domain/identityaccount/provisioning.d.ts +18 -0
  64. package/dist/domain/identityaccount/provisioning.d.ts.map +1 -1
  65. package/dist/domain/identityaccount/provisioning.js +1 -0
  66. package/dist/domain/identityaccount/provisioning.js.map +1 -1
  67. package/dist/domain/identityaccount/resource-store.js +9 -5
  68. package/dist/domain/identityaccount/resource-store.js.map +1 -1
  69. package/dist/domain/identityaccount/steps.d.ts +11 -2
  70. package/dist/domain/identityaccount/steps.d.ts.map +1 -1
  71. package/dist/domain/identityaccount/steps.js +42 -4
  72. package/dist/domain/identityaccount/steps.js.map +1 -1
  73. package/dist/domain/identityaccount/store-contract.d.ts.map +1 -1
  74. package/dist/domain/identityaccount/store-contract.js +33 -0
  75. package/dist/domain/identityaccount/store-contract.js.map +1 -1
  76. package/dist/domain/identityaccount/store.d.ts +7 -5
  77. package/dist/domain/identityaccount/store.d.ts.map +1 -1
  78. package/dist/domain/identityaccount/store.js.map +1 -1
  79. package/dist/domain/platform/controller.d.ts +10 -0
  80. package/dist/domain/platform/controller.d.ts.map +1 -1
  81. package/dist/domain/platform/controller.js +2 -1
  82. package/dist/domain/platform/controller.js.map +1 -1
  83. package/dist/domain/platformclient/constants.d.ts +60 -0
  84. package/dist/domain/platformclient/constants.d.ts.map +1 -0
  85. package/dist/domain/platformclient/constants.js +78 -0
  86. package/dist/domain/platformclient/constants.js.map +1 -0
  87. package/dist/domain/platformclient/controller.d.ts +59 -0
  88. package/dist/domain/platformclient/controller.d.ts.map +1 -0
  89. package/dist/domain/platformclient/controller.js +191 -0
  90. package/dist/domain/platformclient/controller.js.map +1 -0
  91. package/dist/domain/platformclient/credentials.d.ts +13 -0
  92. package/dist/domain/platformclient/credentials.d.ts.map +1 -0
  93. package/dist/domain/platformclient/credentials.js +56 -0
  94. package/dist/domain/platformclient/credentials.js.map +1 -0
  95. package/dist/domain/platformclient/mint.d.ts +23 -0
  96. package/dist/domain/platformclient/mint.d.ts.map +1 -0
  97. package/dist/domain/platformclient/mint.js +254 -0
  98. package/dist/domain/platformclient/mint.js.map +1 -0
  99. package/dist/domain/platformclient/origin-guard.d.ts +9 -0
  100. package/dist/domain/platformclient/origin-guard.d.ts.map +1 -0
  101. package/dist/domain/platformclient/origin-guard.js +81 -0
  102. package/dist/domain/platformclient/origin-guard.js.map +1 -0
  103. package/dist/domain/platformclient/resource-store.d.ts +4 -0
  104. package/dist/domain/platformclient/resource-store.d.ts.map +1 -0
  105. package/dist/domain/platformclient/resource-store.js +117 -0
  106. package/dist/domain/platformclient/resource-store.js.map +1 -0
  107. package/dist/domain/platformclient/steps.d.ts +51 -0
  108. package/dist/domain/platformclient/steps.d.ts.map +1 -0
  109. package/dist/domain/platformclient/steps.js +339 -0
  110. package/dist/domain/platformclient/steps.js.map +1 -0
  111. package/dist/domain/platformclient/store-contract.d.ts +8 -0
  112. package/dist/domain/platformclient/store-contract.d.ts.map +1 -0
  113. package/dist/domain/platformclient/store-contract.js +208 -0
  114. package/dist/domain/platformclient/store-contract.js.map +1 -0
  115. package/dist/domain/platformclient/store.d.ts +58 -0
  116. package/dist/domain/platformclient/store.d.ts.map +1 -0
  117. package/dist/domain/platformclient/store.js +13 -0
  118. package/dist/domain/platformclient/store.js.map +1 -0
  119. package/dist/domain/platformclient/system-managed.d.ts +18 -0
  120. package/dist/domain/platformclient/system-managed.d.ts.map +1 -0
  121. package/dist/domain/platformclient/system-managed.js +80 -0
  122. package/dist/domain/platformclient/system-managed.js.map +1 -0
  123. package/dist/domain/platformclient/token-controller.d.ts +11 -0
  124. package/dist/domain/platformclient/token-controller.d.ts.map +1 -0
  125. package/dist/domain/platformclient/token-controller.js +32 -0
  126. package/dist/domain/platformclient/token-controller.js.map +1 -0
  127. package/dist/domain/platformclient/verifier.d.ts +10 -0
  128. package/dist/domain/platformclient/verifier.d.ts.map +1 -0
  129. package/dist/domain/platformclient/verifier.js +76 -0
  130. package/dist/domain/platformclient/verifier.js.map +1 -0
  131. package/dist/domain/session/list-index.d.ts +4 -0
  132. package/dist/domain/session/list-index.d.ts.map +1 -0
  133. package/dist/domain/session/list-index.js +26 -0
  134. package/dist/domain/session/list-index.js.map +1 -0
  135. package/dist/domain/session/steps.d.ts +7 -8
  136. package/dist/domain/session/steps.d.ts.map +1 -1
  137. package/dist/domain/session/steps.js +76 -78
  138. package/dist/domain/session/steps.js.map +1 -1
  139. package/dist/domain/workflowexecution/controller.d.ts.map +1 -1
  140. package/dist/domain/workflowexecution/controller.js +53 -55
  141. package/dist/domain/workflowexecution/controller.js.map +1 -1
  142. package/dist/domain/workflowexecution/execution-filter.d.ts +4 -0
  143. package/dist/domain/workflowexecution/execution-filter.d.ts.map +1 -1
  144. package/dist/domain/workflowexecution/execution-filter.js +11 -5
  145. package/dist/domain/workflowexecution/execution-filter.js.map +1 -1
  146. package/dist/domain/workflowexecution/get-execution-summary.d.ts.map +1 -1
  147. package/dist/domain/workflowexecution/get-execution-summary.js +23 -17
  148. package/dist/domain/workflowexecution/get-execution-summary.js.map +1 -1
  149. package/dist/domain/workflowexecution/list-index.d.ts +2 -0
  150. package/dist/domain/workflowexecution/list-index.d.ts.map +1 -0
  151. package/dist/domain/workflowexecution/list-index.js +21 -0
  152. package/dist/domain/workflowexecution/list-index.js.map +1 -0
  153. package/dist/domain/workflowexecution/list-pending-approvals.d.ts.map +1 -1
  154. package/dist/domain/workflowexecution/list-pending-approvals.js +69 -32
  155. package/dist/domain/workflowexecution/list-pending-approvals.js.map +1 -1
  156. package/dist/domain/workflowexecution/queries.d.ts +30 -4
  157. package/dist/domain/workflowexecution/queries.d.ts.map +1 -1
  158. package/dist/domain/workflowexecution/queries.js +76 -22
  159. package/dist/domain/workflowexecution/queries.js.map +1 -1
  160. package/dist/encryption/key-manager.d.ts +20 -3
  161. package/dist/encryption/key-manager.d.ts.map +1 -1
  162. package/dist/encryption/key-manager.js +64 -42
  163. package/dist/encryption/key-manager.js.map +1 -1
  164. package/dist/extensions/caller-guards.d.ts +8 -3
  165. package/dist/extensions/caller-guards.d.ts.map +1 -1
  166. package/dist/extensions/drivers.d.ts +37 -0
  167. package/dist/extensions/drivers.d.ts.map +1 -1
  168. package/dist/extensions/guest-token-minting.d.ts +26 -0
  169. package/dist/extensions/guest-token-minting.d.ts.map +1 -0
  170. package/dist/extensions/guest-token-minting.js +2 -0
  171. package/dist/extensions/guest-token-minting.js.map +1 -0
  172. package/dist/extensions/identity.d.ts +6 -4
  173. package/dist/extensions/identity.d.ts.map +1 -1
  174. package/dist/extensions/identity.js.map +1 -1
  175. package/dist/extensions/list-read-scope.d.ts +9 -12
  176. package/dist/extensions/list-read-scope.d.ts.map +1 -1
  177. package/dist/extensions/list-read-scope.js.map +1 -1
  178. package/dist/extensions/registry.d.ts +30 -1
  179. package/dist/extensions/registry.d.ts.map +1 -1
  180. package/dist/extensions/registry.js +34 -1
  181. package/dist/extensions/registry.js.map +1 -1
  182. package/dist/index.d.ts +15 -2
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +6 -0
  185. package/dist/index.js.map +1 -1
  186. package/dist/pipeline/interceptors/auth.d.ts +14 -0
  187. package/dist/pipeline/interceptors/auth.d.ts.map +1 -1
  188. package/dist/pipeline/interceptors/auth.js +24 -0
  189. package/dist/pipeline/interceptors/auth.js.map +1 -1
  190. package/dist/pipeline/steps/build-update-state.d.ts +11 -1
  191. package/dist/pipeline/steps/build-update-state.d.ts.map +1 -1
  192. package/dist/pipeline/steps/build-update-state.js +5 -2
  193. package/dist/pipeline/steps/build-update-state.js.map +1 -1
  194. package/dist/pipeline/steps/list-page.d.ts +63 -0
  195. package/dist/pipeline/steps/list-page.d.ts.map +1 -0
  196. package/dist/pipeline/steps/list-page.js +187 -0
  197. package/dist/pipeline/steps/list-page.js.map +1 -0
  198. package/dist/platformtoken/envelope.d.ts +100 -0
  199. package/dist/platformtoken/envelope.d.ts.map +1 -0
  200. package/dist/platformtoken/envelope.js +184 -0
  201. package/dist/platformtoken/envelope.js.map +1 -0
  202. package/dist/platformtoken/key-ring.d.ts +85 -0
  203. package/dist/platformtoken/key-ring.d.ts.map +1 -0
  204. package/dist/platformtoken/key-ring.js +164 -0
  205. package/dist/platformtoken/key-ring.js.map +1 -0
  206. package/dist/query/activity/handler.d.ts +6 -7
  207. package/dist/query/activity/handler.d.ts.map +1 -1
  208. package/dist/query/activity/handler.js +42 -59
  209. package/dist/query/activity/handler.js.map +1 -1
  210. package/dist/store/interface.d.ts +29 -0
  211. package/dist/store/interface.d.ts.map +1 -1
  212. package/dist/store/interface.js.map +1 -1
  213. package/dist/store/list-index.d.ts +123 -0
  214. package/dist/store/list-index.d.ts.map +1 -0
  215. package/dist/store/list-index.js +277 -0
  216. package/dist/store/list-index.js.map +1 -0
  217. package/dist/store/logger.d.ts +3 -0
  218. package/dist/store/logger.d.ts.map +1 -1
  219. package/dist/store/logger.js +5 -1
  220. package/dist/store/logger.js.map +1 -1
  221. package/dist/store/postgres/migrations.d.ts +10 -6
  222. package/dist/store/postgres/migrations.d.ts.map +1 -1
  223. package/dist/store/postgres/migrations.js +64 -6
  224. package/dist/store/postgres/migrations.js.map +1 -1
  225. package/dist/store/postgres/store.d.ts +26 -5
  226. package/dist/store/postgres/store.d.ts.map +1 -1
  227. package/dist/store/postgres/store.js +377 -22
  228. package/dist/store/postgres/store.js.map +1 -1
  229. package/dist/store/sqlite/migrations.d.ts +11 -5
  230. package/dist/store/sqlite/migrations.d.ts.map +1 -1
  231. package/dist/store/sqlite/migrations.js +50 -4
  232. package/dist/store/sqlite/migrations.js.map +1 -1
  233. package/dist/store/sqlite/store.d.ts +18 -3
  234. package/dist/store/sqlite/store.d.ts.map +1 -1
  235. package/dist/store/sqlite/store.js +321 -15
  236. package/dist/store/sqlite/store.js.map +1 -1
  237. package/package.json +6 -6
  238. package/src/authorization/README.md +1 -1
  239. package/src/authorization/__tests__/authorizer.test.ts +6 -2
  240. package/src/authorization/__tests__/drivers.ts +6 -1
  241. package/src/authorization/__tests__/wire-permissions.test.ts +1 -0
  242. package/src/authorization/authorizer.ts +11 -4
  243. package/src/authorization/model/__tests__/registry.test.ts +8 -1
  244. package/src/authorization/model/index.ts +6 -4
  245. package/src/authorization/model/oauth_app.ts +3 -2
  246. package/src/authorization/model/platform_client.ts +43 -0
  247. package/src/boot/__tests__/auth-enabled-composition.test.ts +2 -1
  248. package/src/boot/__tests__/list-indexes.test.ts +65 -0
  249. package/src/boot/__tests__/route-shadowing.test.ts +67 -0
  250. package/src/boot/compose.ts +113 -18
  251. package/src/boot/list-indexes.ts +25 -0
  252. package/src/boot/route-shadowing.ts +47 -0
  253. package/src/domain/agentexecution/__tests__/agentexecution.test.ts +85 -3
  254. package/src/domain/agentexecution/controller.ts +8 -10
  255. package/src/domain/agentexecution/list-index.ts +24 -0
  256. package/src/domain/agentexecution/steps.ts +118 -115
  257. package/src/domain/agentexecution/usage.ts +38 -17
  258. package/src/domain/artifact/controller.ts +28 -18
  259. package/src/domain/artifact/list-index.ts +22 -0
  260. package/src/domain/iampolicy/__tests__/membership.test.ts +7 -0
  261. package/src/domain/iampolicy/membership.ts +8 -2
  262. package/src/domain/identityaccount/__tests__/platform-client-accounts.test.ts +124 -0
  263. package/src/domain/identityaccount/__tests__/resource-store.test.ts +1 -0
  264. package/src/domain/identityaccount/constants.ts +20 -0
  265. package/src/domain/identityaccount/controller.ts +16 -4
  266. package/src/domain/identityaccount/operator.ts +1 -0
  267. package/src/domain/identityaccount/provisioning.ts +17 -0
  268. package/src/domain/identityaccount/resource-store.ts +9 -5
  269. package/src/domain/identityaccount/steps.ts +58 -3
  270. package/src/domain/identityaccount/store-contract.ts +51 -0
  271. package/src/domain/identityaccount/store.ts +7 -5
  272. package/src/domain/platform/__tests__/platform.test.ts +7 -1
  273. package/src/domain/platform/controller.ts +12 -1
  274. package/src/domain/platformclient/__tests__/controller.test.ts +397 -0
  275. package/src/domain/platformclient/__tests__/credentials.test.ts +46 -0
  276. package/src/domain/platformclient/__tests__/mint.test.ts +415 -0
  277. package/src/domain/platformclient/__tests__/resource-store.test.ts +140 -0
  278. package/src/domain/platformclient/__tests__/system-managed.test.ts +101 -0
  279. package/src/domain/platformclient/__tests__/verifier-and-guard.test.ts +207 -0
  280. package/src/domain/platformclient/constants.ts +120 -0
  281. package/src/domain/platformclient/controller.ts +449 -0
  282. package/src/domain/platformclient/credentials.ts +68 -0
  283. package/src/domain/platformclient/mint.ts +412 -0
  284. package/src/domain/platformclient/origin-guard.ts +117 -0
  285. package/src/domain/platformclient/resource-store.ts +150 -0
  286. package/src/domain/platformclient/steps.ts +472 -0
  287. package/src/domain/platformclient/store-contract.ts +318 -0
  288. package/src/domain/platformclient/store.ts +63 -0
  289. package/src/domain/platformclient/system-managed.ts +115 -0
  290. package/src/domain/platformclient/token-controller.ts +49 -0
  291. package/src/domain/platformclient/verifier.ts +106 -0
  292. package/src/domain/session/list-index.ts +28 -0
  293. package/src/domain/session/steps.ts +108 -123
  294. package/src/domain/workflowexecution/__tests__/list-read-scope-summaries.test.ts +155 -99
  295. package/src/domain/workflowexecution/__tests__/workflowexecution.test.ts +193 -31
  296. package/src/domain/workflowexecution/controller.ts +54 -82
  297. package/src/domain/workflowexecution/execution-filter.ts +20 -7
  298. package/src/domain/workflowexecution/get-execution-summary.ts +31 -24
  299. package/src/domain/workflowexecution/list-index.ts +22 -0
  300. package/src/domain/workflowexecution/list-pending-approvals.ts +82 -25
  301. package/src/domain/workflowexecution/queries.ts +134 -23
  302. package/src/encryption/key-manager.ts +87 -44
  303. package/src/extensions/__tests__/extension-composition.test.ts +3 -2
  304. package/src/extensions/__tests__/platform-client-composed.test.ts +288 -0
  305. package/src/extensions/__tests__/registry.test.ts +4 -1
  306. package/src/extensions/__tests__/tier-truthfulness.test.ts +8 -0
  307. package/src/extensions/caller-guards.ts +8 -3
  308. package/src/extensions/drivers.ts +37 -0
  309. package/src/extensions/guest-token-minting.ts +32 -0
  310. package/src/extensions/identity.ts +6 -4
  311. package/src/extensions/list-read-scope.ts +9 -12
  312. package/src/extensions/registry.ts +77 -3
  313. package/src/index.ts +65 -1
  314. package/src/pipeline/interceptors/auth.ts +27 -0
  315. package/src/pipeline/steps/__tests__/list-page.test.ts +186 -0
  316. package/src/pipeline/steps/__tests__/references.test.ts +2 -0
  317. package/src/pipeline/steps/build-update-state.ts +5 -2
  318. package/src/pipeline/steps/list-page.ts +284 -0
  319. package/src/platformtoken/__tests__/envelope.test.ts +277 -0
  320. package/src/platformtoken/__tests__/key-ring.test.ts +205 -0
  321. package/src/platformtoken/envelope.ts +276 -0
  322. package/src/platformtoken/key-ring.ts +266 -0
  323. package/src/query/activity/handler.ts +57 -78
  324. package/src/runnerauth/__tests__/runner-subject-composed.test.ts +9 -3
  325. package/src/store/README.md +51 -32
  326. package/src/store/__tests__/list-index.measure.test.ts +293 -0
  327. package/src/store/__tests__/list-index.test.ts +328 -0
  328. package/src/store/__tests__/store-contract.ts +346 -3
  329. package/src/store/interface.ts +39 -0
  330. package/src/store/list-index.ts +465 -0
  331. package/src/store/logger.ts +8 -1
  332. package/src/store/postgres/__tests__/list-index-repair.test.ts +133 -0
  333. package/src/store/postgres/__tests__/migrations.test.ts +27 -19
  334. package/src/store/postgres/__tests__/store-contract.test.ts +50 -3
  335. package/src/store/postgres/migrations.ts +69 -7
  336. package/src/store/postgres/store.ts +485 -29
  337. package/src/store/sqlite/__tests__/migrations.test.ts +51 -7
  338. package/src/store/sqlite/__tests__/store-contract.test.ts +70 -16
  339. package/src/store/sqlite/__tests__/support.ts +12 -3
  340. package/src/store/sqlite/migrations.ts +57 -6
  341. package/src/store/sqlite/store.ts +462 -21
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/pipeline/interceptors/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAO3E,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,0DAA0D,CAAC;AAQrF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAC/C,8BAA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CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,EACvD,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5C,CAAC"}
@@ -1,4 +1,14 @@
1
- import type { DescMessage } from "@bufbuild/protobuf";
1
+ import type { DescMessage, Message } from "@bufbuild/protobuf";
2
2
  import type { PipelineStep } from "../pipeline.js";
3
+ import type { CallerIdentity } from "../../extensions/identity.js";
3
4
  export declare function newBuildUpdateStateStep<Desc extends DescMessage>(): PipelineStep<Desc>;
5
+ /**
6
+ * Go updateAuditFieldsReflect: spec_audit keeps the existing creation
7
+ * identity with a fresh update stamp; status_audit is fully current (the
8
+ * status was rebuilt); both carry event "updated". Exported for the one
9
+ * write that changes a stored resource outside this step — a
10
+ * PlatformClient secret rotation (domain/platformclient/steps.ts) — so an
11
+ * update's audit has one shape whichever step writes it.
12
+ */
13
+ export declare function updateAuditFields(schema: DescMessage, resource: Message, existing: Message, identity: CallerIdentity): void;
4
14
  //# sourceMappingURL=build-update-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build-update-state.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/build-update-state.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAyB,MAAM,oBAAoB,CAAC;AAW7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAanD,wBAAgB,uBAAuB,CACrC,IAAI,SAAS,WAAW,KACrB,YAAY,CAAC,IAAI,CAAC,CAiCtB"}
1
+ {"version":3,"file":"build-update-state.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/build-update-state.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAgB,MAAM,oBAAoB,CAAC;AAW7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAWnE,wBAAgB,uBAAuB,CACrC,IAAI,SAAS,WAAW,KACrB,YAAY,CAAC,IAAI,CAAC,CAiCtB;AAyCD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,cAAc,GACvB,IAAI,CAuBN"}
@@ -73,9 +73,12 @@ function copyStatusFromExisting(schema, merged, existing) {
73
73
  /**
74
74
  * Go updateAuditFieldsReflect: spec_audit keeps the existing creation
75
75
  * identity with a fresh update stamp; status_audit is fully current (the
76
- * status was rebuilt); both carry event "updated".
76
+ * status was rebuilt); both carry event "updated". Exported for the one
77
+ * write that changes a stored resource outside this step — a
78
+ * PlatformClient secret rotation (domain/platformclient/steps.ts) — so an
79
+ * update's audit has one shape whichever step writes it.
77
80
  */
78
- function updateAuditFields(schema, resource, existing, identity) {
81
+ export function updateAuditFields(schema, resource, existing, identity) {
79
82
  const now = timestampNow();
80
83
  const actor = auditActorFor(identity);
81
84
  const { createdBy, createdAt } = creationAuditOf(schema, existing, "spec_audit");
@@ -1 +1 @@
1
- {"version":3,"file":"build-update-state.js","sourceRoot":"","sources":["../../../src/pipeline/steps/build-update-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,0DAA0D,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,OAAO,EACL,aAAa,EACb,gBAAgB,E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AS,EAAE,SAAS,EAAE,GAAG,eAAe,CAC9C,MAAM,EACN,QAAQ,EACR,YAAY,CACb,CAAC;IAEF,eAAe,CACb,MAAM,EACN,QAAQ,EACR,MAAM,CAAC,sBAAsB,EAAE;QAC7B,SAAS,EAAE,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,CAAC;QAC7D,WAAW,EAAE,MAAM,CAAC,0BAA0B,EAAE;YAC9C,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,GAAG;YACd,KAAK,EAAE,SAAS;SACjB,CAAC;KACH,CAAC,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"build-update-state.js","sourceRoot":"","sources":["../../../src/pipeline/steps/build-update-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,0DAA0D,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE7E,MAAM,UAAU,uBAAuB;IAGrC,OAAO;QACL,IAAI,EAAE,kBAAkB;QACxB,OAAO,CAAC,GAAyB;YAC/B,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,C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AE,GAAG;YACd,SAAS,EAAE,KAAK;YAChB,SAAS,EAAE,GAAG;YACd,KAAK,EAAE,SAAS;SACjB,CAAC;KACH,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,63 @@
1
+ import type { Store } from "../../store/interface.js";
2
+ import type { ListIndexCursor, ListIndexDeclaration, ListIndexQuery } from "../../store/list-index.js";
3
+ /** The most entries one page returns, the contract's word on every paged request. */
4
+ export declare const LIST_PAGE_MAX_SIZE = 100;
5
+ /**
6
+ * The most rows one request examines for a page of `size`: five pages'
7
+ * worth, at least 100, at most 500. It bounds what one request asks of a
8
+ * composed read scope (on the hosted edition one authorization key per
9
+ * row, 50 per round trip) when the caller can see few of the rows.
10
+ */
11
+ export declare function examineBudgetOf(size: number): number;
12
+ /** The request fields every paged lane carries. */
13
+ export interface ListPageRequest {
14
+ readonly pageSize: number;
15
+ readonly pageToken: string;
16
+ }
17
+ export interface ListPageParams<T, K extends string> {
18
+ readonly store: Store;
19
+ readonly declaration: ListIndexDeclaration<K>;
20
+ /** The request's own predicates, pushed into the store's indexed read. */
21
+ readonly query: Omit<ListIndexQuery<K>, "after" | "limit">;
22
+ readonly request: ListPageRequest;
23
+ /**
24
+ * The request's other fields, as text: a token is valid only for the
25
+ * request it was issued to.
26
+ */
27
+ readonly fingerprint: string;
28
+ /** Decodes a row; undefined skips it (the lane logs, as it always has). */
29
+ readonly decode: (data: Uint8Array) => T | undefined;
30
+ /** The lane's per-row filter beyond the indexed predicates. */
31
+ readonly keep?: (row: T) => boolean;
32
+ /** The read scope, bound by the lane to its caller and kind. */
33
+ readonly scope: (rows: T[]) => Promise<T[]>;
34
+ /** The failure copy for a store fault. */
35
+ readonly failure: string;
36
+ }
37
+ export interface ListPage<T> {
38
+ readonly entries: T[];
39
+ /** "" when the list is complete. */
40
+ readonly nextPageToken: string;
41
+ }
42
+ /** Reads one page (or, at `page_size` 0, the whole list) through the list index. */
43
+ export declare function readListPage<T, K extends string>(params: ListPageParams<T, K>): Promise<ListPage<T>>;
44
+ /**
45
+ * The position a token carries: the list index's cursor, plus, for a lane
46
+ * whose entries are finer than rows (the approvals of one execution), the
47
+ * entry's position within its row.
48
+ */
49
+ export interface ListPageTokenCursor {
50
+ readonly cursor: ListIndexCursor;
51
+ readonly position?: number;
52
+ }
53
+ /** An opaque, versioned token for the position after `cursor`. */
54
+ export declare function encodeListPageToken(cursor: ListIndexCursor, fingerprint: string, position?: number): string;
55
+ /**
56
+ * The position a token carries, refused as `invalid page_token` (the copy
57
+ * every paged lane already answers with) when it is malformed, of a
58
+ * version this server never issued, or issued for another request.
59
+ */
60
+ export declare function decodeListPageToken(token: string, fingerprint: string): ListPageTokenCursor;
61
+ /** A request's other fields as the text its token is bound to. */
62
+ export declare function listPageFingerprint(fields: Readonly<Record<string, unknown>>): string;
63
+ //# sourceMappingURL=list-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-page.d.ts","sourceRoot":"","sources":["../../../src/pipeline/steps/list-page.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,cAAc,EAEf,MAAM,2BAA2B,CAAC;AAGnC,qFAAqF;AACrF,eAAO,MAAM,kBAAkB,MAAM,CAAC;AAEtC;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,mDAAmD;AACnD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM;IACjD,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC9C,0EAA0E;IAC1E,QAA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,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,GAClB,mBAAmB,CAmCrB;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,MAAM,CAIR"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * One page of a list lane read through the list index — the one
3
+ * implementation of the page loop every paged lane calls, so the rules
4
+ * below hold everywhere by construction:
5
+ *
6
+ * - The store narrows by the request's own predicates (organization, key,
7
+ * creation window) and orders newest first (store/list-index.ts). The
8
+ * lane's per-row filter runs on each batch, then the read scope, which
9
+ * stays the last per-row predicate (extensions/list-read-scope.ts);
10
+ * neither reorders, so a page is in the store's order.
11
+ * - `page_size` 0 reads every matching row and returns no token, the
12
+ * behaviour every list lane had before it paged; a positive size is
13
+ * capped at `LIST_PAGE_MAX_SIZE`.
14
+ * - A page fills batch by batch until it is full, the rows run out, or
15
+ * `examineBudgetOf(size)` rows have been examined. A caller who may see
16
+ * few of the organization's rows gets a short page, possibly empty, with
17
+ * a token (the timeline's cursor contract, agentchannel/v1
18
+ * conversation_io.proto), never an unbounded walk.
19
+ * - The token's cursor is the last row RETURNED when the page was cut,
20
+ * else the last row EXAMINED, so no row is skipped and no refused row is
21
+ * read twice. The token is opaque and versioned, carries a fingerprint
22
+ * of the request's other fields (a mismatch is refused), and carries no
23
+ * authority: every page re-runs the scope.
24
+ *
25
+ * Proven by __tests__/list-page.test.ts (the loop, the budget, the cut,
26
+ * the token) and end-to-end by the paging arms of the conformance suites.
27
+ */
28
+ import { createHash } from "node:crypto";
29
+ import { internalError, invalidArgumentError } from "../errors.js";
30
+ /** The most entries one page returns, the contract's word on every paged request. */
31
+ export const LIST_PAGE_MAX_SIZE = 100;
32
+ /**
33
+ * The most rows one request examines for a page of `size`: five pages'
34
+ * worth, at least 100, at most 500. It bounds what one request asks of a
35
+ * composed read scope (on the hosted edition one authorization key per
36
+ * row, 50 per round trip) when the caller can see few of the rows.
37
+ */
38
+ export function examineBudgetOf(size) {
39
+ return Math.min(500, Math.max(100, size * 5));
40
+ }
41
+ /** Reads one page (or, at `page_size` 0, the whole list) through the list index. */
42
+ export async function readListPage(params) {
43
+ const { request } = params;
44
+ if (request.pageSize < 0) {
45
+ throw invalidArgumentError("page_size must not be negative");
46
+ }
47
+ let after = request.pageToken === ""
48
+ ? undefined
49
+ : decodeListPageToken(request.pageToken, params.fingerprint).cursor;
50
+ if (request.pageSize === 0) {
51
+ const rows = await queryOrFail(params, after, undefined);
52
+ return {
53
+ entries: await admit(params, rows).then((a) => a.map((e) => e.row)),
54
+ nextPageToken: "",
55
+ };
56
+ }
57
+ const size = Math.min(request.pageSize, LIST_PAGE_MAX_SIZE);
58
+ const budget = examineBudgetOf(size);
59
+ const kept = [];
60
+ let examined = 0;
61
+ for (;;) {
62
+ // One row past the batch is read only to learn whether more follow,
63
+ // so a list that ends exactly on a page carries no token (and no
64
+ // empty page behind it); the next batch reads that row again.
65
+ const batchSize = Math.min(size, budget - examined);
66
+ const read = await queryOrFail(params, after, batchSize + 1);
67
+ const more = read.length > batchSize;
68
+ const rows = more ? read.slice(0, batchSize) : read;
69
+ examined += rows.length;
70
+ kept.push(...(await admit(params, rows)));
71
+ const last = rows[rows.length - 1];
72
+ if (last !== undefined) {
73
+ after = last.cursor;
74
+ }
75
+ if (kept.length >= size) {
76
+ const page = kept.slice(0, size);
77
+ const exhausted = !more && kept.length === size;
78
+ return {
79
+ entries: page.map((e) => e.row),
80
+ nextPageToken: exhausted
81
+ ? ""
82
+ : encodeListPageToken(page[page.length - 1].cursor, params.fingerprint),
83
+ };
84
+ }
85
+ if (!more) {
86
+ return { entries: kept.map((e) => e.row), nextPageToken: "" };
87
+ }
88
+ if (examined >= budget) {
89
+ return {
90
+ entries: kept.map((e) => e.row),
91
+ nextPageToken: encodeListPageToken(after, params.fingerprint),
92
+ };
93
+ }
94
+ }
95
+ }
96
+ async function queryOrFail(params, after, limit) {
97
+ try {
98
+ return await params.store.queryResources(params.declaration, {
99
+ ...params.query,
100
+ ...(after === undefined ? {} : { after }),
101
+ ...(limit === undefined ? {} : { limit }),
102
+ });
103
+ }
104
+ catch (error) {
105
+ throw internalError(error, params.failure);
106
+ }
107
+ }
108
+ /** A batch through the lane's filter and the scope, each row keeping its cursor. */
109
+ async function admit(params, rows) {
110
+ const decoded = [];
111
+ for (const row of rows) {
112
+ const value = params.decode(row.data);
113
+ if (value !== undefined &&
114
+ (params.keep === undefined || params.keep(value))) {
115
+ decoded.push({ row: value, cursor: row.cursor });
116
+ }
117
+ }
118
+ if (decoded.length === 0) {
119
+ return [];
120
+ }
121
+ const allowed = new Set(await params.scope(decoded.map((d) => d.row)));
122
+ return decoded.filter((d) => allowed.has(d.row));
123
+ }
124
+ // =============================================================================
125
+ // The token
126
+ // =============================================================================
127
+ const TOKEN_VERSION = 1;
128
+ function fingerprintHash(fingerprint) {
129
+ return createHash("sha256")
130
+ .update(fingerprint)
131
+ .digest("base64url")
132
+ .slice(0, 16);
133
+ }
134
+ /** An opaque, versioned token for the position after `cursor`. */
135
+ export function encodeListPageToken(cursor, fingerprint, position) {
136
+ const body = {
137
+ v: TOKEN_VERSION,
138
+ c: cursor.createdAt,
139
+ i: cursor.id,
140
+ f: fingerprintHash(fingerprint),
141
+ ...(position === undefined ? {} : { p: position }),
142
+ };
143
+ return Buffer.from(JSON.stringify(body)).toString("base64url");
144
+ }
145
+ /**
146
+ * The position a token carries, refused as `invalid page_token` (the copy
147
+ * every paged lane already answers with) when it is malformed, of a
148
+ * version this server never issued, or issued for another request.
149
+ */
150
+ export function decodeListPageToken(token, fingerprint) {
151
+ let body;
152
+ try {
153
+ const bytes = Buffer.from(token, "base64url");
154
+ if (bytes.toString("base64url") !== token) {
155
+ throw new Error("not canonical base64url");
156
+ }
157
+ body = JSON.parse(bytes.toString("utf8"));
158
+ }
159
+ catch {
160
+ throw invalidArgumentError("invalid page_token");
161
+ }
162
+ if (typeof body !== "object" ||
163
+ body === null ||
164
+ body.v !== TOKEN_VERSION ||
165
+ typeof body.c !== "string" ||
166
+ typeof body.i !== "string" ||
167
+ typeof body.f !== "string") {
168
+ throw invalidArgumentError("invalid page_token");
169
+ }
170
+ const parsed = body;
171
+ if (parsed.f !== fingerprintHash(fingerprint)) {
172
+ throw invalidArgumentError("page_token was issued for a different request");
173
+ }
174
+ if (parsed.p !== undefined &&
175
+ !(Number.isSafeInteger(parsed.p) && parsed.p >= 0)) {
176
+ throw invalidArgumentError("invalid page_token");
177
+ }
178
+ return {
179
+ cursor: { createdAt: parsed.c, id: parsed.i },
180
+ ...(parsed.p === undefined ? {} : { position: parsed.p }),
181
+ };
182
+ }
183
+ /** A request's other fields as the text its token is bound to. */
184
+ export function listPageFingerprint(fields) {
185
+ return JSON.stringify(fields, (_key, value) => typeof value === "bigint" ? value.toString() : value);
186
+ }
187
+ //# sourceMappingURL=list-page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-page.js","sourceRoot":"","sources":["../../../src/pipeline/steps/list-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASzC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEnE,qFAAqF;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC;AAmCD,oFAAoF;AACpF,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAA4B;IAE5B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IAC3B,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC,EAAE,CAA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CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAW,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,mBAAmB,CACjC,MAAyC;IAEzC,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,KAAc,EAAE,EAAE,CACrD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CACrD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The platform-token envelope: the RS256 JWT every token the server signs
3
+ * for itself rides — the PlatformClient user token in open source, and in
4
+ * the cloud its typed lanes (guest, schedule, channel, the sandbox family)
5
+ * as well. One envelope, byte-compatible with the tokens Stigmer Cloud has
6
+ * signed since the Java issuer, so a token minted before the cloud serves
7
+ * this code verifies after it.
8
+ *
9
+ * The envelope knows the issuer, the four claims it owns (`iss`, `iat`,
10
+ * `exp`, `jti`, plus `aud` when the ring carries an audience) and the
11
+ * signature. It does not know lanes: a lane's vocabulary (its claims, its
12
+ * `token_type`, the caller class it stamps) belongs to the verifier that
13
+ * claims it — open source verifies only the untyped PlatformClient lane
14
+ * (domain/platformclient/verifier.ts); the typed lanes stay the cloud's.
15
+ *
16
+ * A token's lifetime is the lane's to choose: the ring carries the default
17
+ * (the user token's), and a lane that lives longer or shorter — the cloud's
18
+ * sandbox tokens outlive a user token sixteen-fold — says so per token.
19
+ * Either way the envelope alone computes `exp` and hands the expiry back,
20
+ * so no lane re-derives it beside the claim it signed.
21
+ *
22
+ * Verification is the cloud verifier's, exactly (its verifiers/jwt.ts and
23
+ * platform-token.ts), because the tokens in the field were accepted by it:
24
+ * - A token that is not a three-part JWT with `iss: "stigmer"` is
25
+ * `foreign` — some other verifier's to judge, never refused here.
26
+ * - The signature is RS256 over every key in the ring; the header's
27
+ * `alg` and `kid` are never read to choose (so neither `alg: none` nor
28
+ * an HMAC-with-the-public-key forgery can pass, and a constant kid
29
+ * across a rotation still verifies).
30
+ * - Then `exp` (required, a number, strictly in the future; no leeway),
31
+ * then `aud` (tolerated when absent, refused when it names another
32
+ * audience), then `sub` (a non-empty string) — in that order, each with
33
+ * its pinned copy.
34
+ * The refusals are returned, not thrown: the envelope has no transport,
35
+ * and a verifier turns a refusal into the wire error with
36
+ * `platformTokenRefusalError`.
37
+ */
38
+ import { ConnectError } from "@connectrpc/connect";
39
+ import type { PlatformTokenKeyRing, SigningPlatformTokenKeyRing } from "./key-ring.js";
40
+ /** The `iss` of every platform token (the cloud's STIGMER_ISSUER). */
41
+ export declare const PLATFORM_TOKEN_ISSUER = "stigmer";
42
+ /** The claim a typed lane names itself by; absent on the PlatformClient user token. */
43
+ export declare const TOKEN_TYPE_CLAIM = "token_type";
44
+ /** A lane claim's value: the token carries JSON scalars only. */
45
+ export type PlatformTokenClaimValue = string | number | boolean;
46
+ export type PlatformTokenRefusal = "signature" | "expired" | "audience" | "subject";
47
+ /** Wire copy, byte-pinned: the cloud verifier's sentences since the Java issuer. */
48
+ export declare const PLATFORM_TOKEN_REFUSAL_MESSAGES: Readonly<Record<PlatformTokenRefusal, string>>;
49
+ /** A verified token: its subject, its lane discriminator, its payload. */
50
+ export interface VerifiedPlatformToken {
51
+ readonly subject: string;
52
+ /** The `token_type` claim when it is a non-empty string; undefined for the untyped lane. */
53
+ readonly tokenType: string | undefined;
54
+ readonly payload: Readonly<Record<string, unknown>>;
55
+ }
56
+ export type PlatformTokenVerification = {
57
+ readonly outcome: "foreign";
58
+ } | {
59
+ readonly outcome: "refused";
60
+ readonly refusal: PlatformTokenRefusal;
61
+ } | {
62
+ readonly outcome: "verified";
63
+ readonly token: VerifiedPlatformToken;
64
+ };
65
+ /** How one token is signed; every field defaults to the ring's answer. */
66
+ export interface PlatformTokenSigningOptions {
67
+ /** The signing instant (`iat`); defaults to the wall clock. */
68
+ readonly now?: Date;
69
+ /** This token's lifetime in whole seconds; defaults to the ring's `ttlSeconds`. */
70
+ readonly ttlSeconds?: number;
71
+ }
72
+ /** A signed token and the instant its `exp` claim names. */
73
+ export interface SignedPlatformToken {
74
+ readonly token: string;
75
+ readonly expiresAt: Date;
76
+ }
77
+ /**
78
+ * Signs `claims` inside the envelope: header `{alg, typ, kid}`, then `iss`,
79
+ * `iat`, `exp` (iat + the lifetime), `jti` and `aud` when the ring has one,
80
+ * then the lane's claims. Throws when a lane claim collides with an
81
+ * envelope claim, or when a lifetime is not a positive whole number of
82
+ * seconds — programming errors, never a request's.
83
+ */
84
+ export declare function signPlatformToken(ring: SigningPlatformTokenKeyRing, claims: Readonly<Record<string, PlatformTokenClaimValue>>, options?: PlatformTokenSigningOptions): SignedPlatformToken;
85
+ /** Verifies a bearer token against the ring (see the header for the order). */
86
+ export declare function verifyPlatformToken(ring: PlatformTokenKeyRing, token: string, now?: Date): PlatformTokenVerification;
87
+ /** The UNAUTHENTICATED error a verifier answers for a refused platform token. */
88
+ export declare function platformTokenRefusalError(refusal: PlatformTokenRefusal): ConnectError;
89
+ /**
90
+ * The payload of a platform token WITHOUT verifying it — for a caller
91
+ * guard reading the claims of a token the verifier chain already verified
92
+ * on this request (caller-guards.ts: guards decode `rawToken`). Undefined
93
+ * for anything that is not a platform token, an API key or an empty
94
+ * trusted-local token included. Never a substitute for
95
+ * `verifyPlatformToken`.
96
+ */
97
+ export declare function decodeVerifiedPlatformTokenPayload(token: string): Readonly<Record<string, unknown>> | undefined;
98
+ /** A payload claim when it is a non-empty string; undefined otherwise. */
99
+ export declare function stringClaim(payload: Readonly<Record<string, unknown>>, name: string): string | undefined;
100
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/platformtoken/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAQ,YAAY,EAAE,MAAM,qBAA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IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,2BAA2B,EACjC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,EACzD,OAAO,GAAE,2BAAgC,GACxC,mBAAmB,CA+BrB;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,oBAAoB,EAC1B,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,IAAiB,GACrB,yBAAyB,CAsC3B;AAED,iFAAiF;AACjF,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,oBAAoB,GAC5B,YAAY,CAKd;AAED;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,MAAM,GACZ,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAK/C;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CACzB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC1C,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAGpB"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * The platform-token envelope: the RS256 JWT every token the server signs
3
+ * for itself rides — the PlatformClient user token in open source, and in
4
+ * the cloud its typed lanes (guest, schedule, channel, the sandbox family)
5
+ * as well. One envelope, byte-compatible with the tokens Stigmer Cloud has
6
+ * signed since the Java issuer, so a token minted before the cloud serves
7
+ * this code verifies after it.
8
+ *
9
+ * The envelope knows the issuer, the four claims it owns (`iss`, `iat`,
10
+ * `exp`, `jti`, plus `aud` when the ring carries an audience) and the
11
+ * signature. It does not know lanes: a lane's vocabulary (its claims, its
12
+ * `token_type`, the caller class it stamps) belongs to the verifier that
13
+ * claims it — open source verifies only the untyped PlatformClient lane
14
+ * (domain/platformclient/verifier.ts); the typed lanes stay the cloud's.
15
+ *
16
+ * A token's lifetime is the lane's to choose: the ring carries the default
17
+ * (the user token's), and a lane that lives longer or shorter — the cloud's
18
+ * sandbox tokens outlive a user token sixteen-fold — says so per token.
19
+ * Either way the envelope alone computes `exp` and hands the expiry back,
20
+ * so no lane re-derives it beside the claim it signed.
21
+ *
22
+ * Verification is the cloud verifier's, exactly (its verifiers/jwt.ts and
23
+ * platform-token.ts), because the tokens in the field were accepted by it:
24
+ * - A token that is not a three-part JWT with `iss: "stigmer"` is
25
+ * `foreign` — some other verifier's to judge, never refused here.
26
+ * - The signature is RS256 over every key in the ring; the header's
27
+ * `alg` and `kid` are never read to choose (so neither `alg: none` nor
28
+ * an HMAC-with-the-public-key forgery can pass, and a constant kid
29
+ * across a rotation still verifies).
30
+ * - Then `exp` (required, a number, strictly in the future; no leeway),
31
+ * then `aud` (tolerated when absent, refused when it names another
32
+ * audience), then `sub` (a non-empty string) — in that order, each with
33
+ * its pinned copy.
34
+ * The refusals are returned, not thrown: the envelope has no transport,
35
+ * and a verifier turns a refusal into the wire error with
36
+ * `platformTokenRefusalError`.
37
+ */
38
+ import { Code, ConnectError } from "@connectrpc/connect";
39
+ import { randomUUID, sign, verify } from "node:crypto";
40
+ /** The `iss` of every platform token (the cloud's STIGMER_ISSUER). */
41
+ export const PLATFORM_TOKEN_ISSUER = "stigmer";
42
+ /** The claim a typed lane names itself by; absent on the PlatformClient user token. */
43
+ export const TOKEN_TYPE_CLAIM = "token_type";
44
+ /** The claims the envelope owns; a lane may not set them. */
45
+ const ENVELOPE_CLAIMS = new Set(["iss", "iat", "exp", "jti", "aud"]);
46
+ /** Wire copy, byte-pinned: the cloud verifier's sentences since the Java issuer. */
47
+ export const PLATFORM_TOKEN_REFUSAL_MESSAGES = {
48
+ signature: "platform token signature verification failed",
49
+ expired: "platform token is expired",
50
+ audience: "platform token was minted for another environment",
51
+ subject: "platform token carries no subject",
52
+ };
53
+ /**
54
+ * Signs `claims` inside the envelope: header `{alg, typ, kid}`, then `iss`,
55
+ * `iat`, `exp` (iat + the lifetime), `jti` and `aud` when the ring has one,
56
+ * then the lane's claims. Throws when a lane claim collides with an
57
+ * envelope claim, or when a lifetime is not a positive whole number of
58
+ * seconds — programming errors, never a request's.
59
+ */
60
+ export function signPlatformToken(ring, claims, options = {}) {
61
+ for (const name of Object.keys(claims)) {
62
+ if (ENVELOPE_CLAIMS.has(name)) {
63
+ throw new Error(`platform-token claim '${name}' belongs to the envelope and cannot be set by a lane`);
64
+ }
65
+ }
66
+ const ttlSeconds = options.ttlSeconds ?? ring.ttlSeconds;
67
+ if (!Number.isInteger(ttlSeconds) || ttlSeconds <= 0) {
68
+ throw new Error(`platform-token lifetime must be a positive integer number of seconds, got ${ttlSeconds}`);
69
+ }
70
+ const issuedAt = Math.floor((options.now ?? new Date()).getTime() / 1000);
71
+ const expiresAtSeconds = issuedAt + ttlSeconds;
72
+ const header = { alg: "RS256", typ: "JWT", kid: ring.signer.kid };
73
+ const payload = {
74
+ iss: PLATFORM_TOKEN_ISSUER,
75
+ iat: issuedAt,
76
+ exp: expiresAtSeconds,
77
+ jti: randomUUID(),
78
+ ...(ring.audience !== "" ? { aud: ring.audience } : {}),
79
+ ...claims,
80
+ };
81
+ const signingInput = `${base64UrlJson(header)}.${base64UrlJson(payload)}`;
82
+ const signature = sign("sha256", Buffer.from(signingInput), ring.signer.key);
83
+ return {
84
+ token: `${signingInput}.${signature.toString("base64url")}`,
85
+ expiresAt: new Date(expiresAtSeconds * 1000),
86
+ };
87
+ }
88
+ /** Verifies a bearer token against the ring (see the header for the order). */
89
+ export function verifyPlatformToken(ring, token, now = new Date()) {
90
+ const decoded = decode(token);
91
+ if (decoded === undefined || decoded.payload.iss !== PLATFORM_TOKEN_ISSUER) {
92
+ return { outcome: "foreign" };
93
+ }
94
+ const signingInput = Buffer.from(`${decoded.encodedHeader}.${decoded.encodedPayload}`);
95
+ const signatureValid = ring.verificationKeys.some((key) => verify("sha256", signingInput, key, decoded.signature));
96
+ if (!signatureValid) {
97
+ return { outcome: "refused", refusal: "signature" };
98
+ }
99
+ const exp = decoded.payload.exp;
100
+ if (typeof exp !== "number" || exp * 1000 <= now.getTime()) {
101
+ return { outcome: "refused", refusal: "expired" };
102
+ }
103
+ const aud = decoded.payload.aud;
104
+ if (ring.audience !== "" &&
105
+ aud !== undefined &&
106
+ !audienceMatches(aud, ring.audience)) {
107
+ return { outcome: "refused", refusal: "audience" };
108
+ }
109
+ const sub = decoded.payload.sub;
110
+ if (typeof sub !== "string" || sub === "") {
111
+ return { outcome: "refused", refusal: "subject" };
112
+ }
113
+ return {
114
+ outcome: "verified",
115
+ token: {
116
+ subject: sub,
117
+ tokenType: stringClaim(decoded.payload, TOKEN_TYPE_CLAIM),
118
+ payload: decoded.payload,
119
+ },
120
+ };
121
+ }
122
+ /** The UNAUTHENTICATED error a verifier answers for a refused platform token. */
123
+ export function platformTokenRefusalError(refusal) {
124
+ return new ConnectError(PLATFORM_TOKEN_REFUSAL_MESSAGES[refusal], Code.Unauthenticated);
125
+ }
126
+ /**
127
+ * The payload of a platform token WITHOUT verifying it — for a caller
128
+ * guard reading the claims of a token the verifier chain already verified
129
+ * on this request (caller-guards.ts: guards decode `rawToken`). Undefined
130
+ * for anything that is not a platform token, an API key or an empty
131
+ * trusted-local token included. Never a substitute for
132
+ * `verifyPlatformToken`.
133
+ */
134
+ export function decodeVerifiedPlatformTokenPayload(token) {
135
+ const decoded = decode(token);
136
+ return decoded !== undefined && decoded.payload.iss === PLATFORM_TOKEN_ISSUER
137
+ ? decoded.payload
138
+ : undefined;
139
+ }
140
+ /** A payload claim when it is a non-empty string; undefined otherwise. */
141
+ export function stringClaim(payload, name) {
142
+ const value = payload[name];
143
+ return typeof value === "string" && value !== "" ? value : undefined;
144
+ }
145
+ /** A three-part JWT whose header and payload are JSON objects; anything else is undefined. */
146
+ function decode(token) {
147
+ const parts = token.split(".");
148
+ if (parts.length !== 3) {
149
+ return undefined;
150
+ }
151
+ const [encodedHeader = "", encodedPayload = "", encodedSignature = ""] = parts;
152
+ const header = parseJsonObject(encodedHeader);
153
+ const payload = parseJsonObject(encodedPayload);
154
+ if (header === undefined || payload === undefined) {
155
+ return undefined;
156
+ }
157
+ return {
158
+ encodedHeader,
159
+ encodedPayload,
160
+ payload,
161
+ signature: Buffer.from(encodedSignature, "base64url"),
162
+ };
163
+ }
164
+ function parseJsonObject(segment) {
165
+ try {
166
+ const value = JSON.parse(Buffer.from(segment, "base64url").toString("utf8"));
167
+ return typeof value === "object" && value !== null && !Array.isArray(value)
168
+ ? value
169
+ : undefined;
170
+ }
171
+ catch {
172
+ return undefined;
173
+ }
174
+ }
175
+ function audienceMatches(aud, expected) {
176
+ if (typeof aud === "string") {
177
+ return aud === expected;
178
+ }
179
+ return Array.isArray(aud) && aud.includes(expected);
180
+ }
181
+ function base64UrlJson(value) {
182
+ return Buffer.from(JSON.stringify(value)).toString("base64url");
183
+ }
184
+ //# sourceMappingURL=envelope.js.map