@sixb/core 0.1.7 → 0.1.8

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 (612) hide show
  1. package/dist/actions/delegated-admission.d.ts +24 -0
  2. package/dist/actions/delegated-admission.d.ts.map +1 -0
  3. package/dist/actions/descriptor.d.ts +29 -0
  4. package/dist/actions/descriptor.d.ts.map +1 -0
  5. package/dist/actions/execution.d.ts +5 -5
  6. package/dist/actions/execution.d.ts.map +1 -1
  7. package/dist/actions/index.js +36 -30
  8. package/dist/actions/index.js.map +1 -1
  9. package/dist/actions/request.d.ts.map +1 -1
  10. package/dist/actions/run-authorization.d.ts +20 -0
  11. package/dist/actions/run-authorization.d.ts.map +1 -0
  12. package/dist/actions/run-dispatch.d.ts +3 -1
  13. package/dist/actions/run-dispatch.d.ts.map +1 -1
  14. package/dist/actions/worker.js +3 -3
  15. package/dist/actions/worker.js.map +1 -1
  16. package/dist/agents/adapters.d.ts +5 -122
  17. package/dist/agents/adapters.d.ts.map +1 -1
  18. package/dist/agents/authority.d.ts +1 -1
  19. package/dist/agents/authority.d.ts.map +1 -1
  20. package/dist/agents/context-resolution.d.ts.map +1 -1
  21. package/dist/agents/context.js +1 -1
  22. package/dist/agents/errors.d.ts +0 -9
  23. package/dist/agents/errors.d.ts.map +1 -1
  24. package/dist/agents/execution.d.ts.map +1 -1
  25. package/dist/agents/identity.d.ts +3 -0
  26. package/dist/agents/identity.d.ts.map +1 -0
  27. package/dist/agents/index.d.ts +3 -3
  28. package/dist/agents/index.d.ts.map +1 -1
  29. package/dist/agents/index.js +43 -43
  30. package/dist/agents/index.js.map +1 -1
  31. package/dist/agents/message.d.ts +4 -5
  32. package/dist/agents/message.d.ts.map +1 -1
  33. package/dist/agents/model-loop.d.ts +2 -0
  34. package/dist/agents/model-loop.d.ts.map +1 -1
  35. package/dist/agents/request.d.ts.map +1 -1
  36. package/dist/agents/tool-definition.d.ts +0 -1
  37. package/dist/agents/tool-definition.d.ts.map +1 -1
  38. package/dist/agents/validation.d.ts +0 -4
  39. package/dist/agents/validation.d.ts.map +1 -1
  40. package/dist/ai-usage/execution.d.ts.map +1 -1
  41. package/dist/auth/index.js +8 -5
  42. package/dist/auth/index.js.map +1 -1
  43. package/dist/authorization/decision.d.ts +10 -2
  44. package/dist/authorization/decision.d.ts.map +1 -1
  45. package/dist/authorization/grant-kinds.d.ts +2 -1
  46. package/dist/authorization/grant-kinds.d.ts.map +1 -1
  47. package/dist/authorization/index.d.ts +1 -1
  48. package/dist/authorization/index.d.ts.map +1 -1
  49. package/dist/authorization/index.js +7 -4
  50. package/dist/authorization/index.js.map +1 -1
  51. package/dist/bootstrap/discovery.d.ts +7 -1
  52. package/dist/bootstrap/discovery.d.ts.map +1 -1
  53. package/dist/bootstrap/index.js +46 -39
  54. package/dist/bootstrap/index.js.map +1 -1
  55. package/dist/bootstrap/ontology-type-manifest.d.ts.map +1 -1
  56. package/dist/chunk-19jp6g9d.js +131 -0
  57. package/dist/chunk-19jp6g9d.js.map +11 -0
  58. package/dist/{chunk-x0qhkqje.js → chunk-2dw777qw.js} +50 -5
  59. package/dist/{chunk-x0qhkqje.js.map → chunk-2dw777qw.js.map} +4 -3
  60. package/dist/chunk-359jm1jw.js +147 -0
  61. package/dist/chunk-359jm1jw.js.map +10 -0
  62. package/dist/{chunk-2b5qtban.js → chunk-3xep5cjx.js} +56 -21
  63. package/dist/chunk-3xep5cjx.js.map +15 -0
  64. package/dist/{chunk-qjycjdj6.js → chunk-3z1qec12.js} +6 -8
  65. package/dist/{chunk-qjycjdj6.js.map → chunk-3z1qec12.js.map} +2 -2
  66. package/dist/{chunk-5jcdmjam.js → chunk-4jjp5k14.js} +1 -1
  67. package/dist/{chunk-n2arzn6e.js → chunk-4qfkag59.js} +44 -221
  68. package/dist/chunk-4qfkag59.js.map +20 -0
  69. package/dist/{chunk-rre42skh.js → chunk-4sm0aznx.js} +515 -80
  70. package/dist/{chunk-rre42skh.js.map → chunk-4sm0aznx.js.map} +11 -7
  71. package/dist/chunk-4yqmp43v.js +159 -0
  72. package/dist/chunk-4yqmp43v.js.map +11 -0
  73. package/dist/{chunk-atmkaf60.js → chunk-5e3pq99w.js} +2 -6
  74. package/dist/{chunk-atmkaf60.js.map → chunk-5e3pq99w.js.map} +3 -3
  75. package/dist/{chunk-agsvg9ar.js → chunk-5ntny1qx.js} +1 -1
  76. package/dist/{chunk-z2sery1b.js → chunk-9nbmsvn5.js} +60 -20
  77. package/dist/chunk-9nbmsvn5.js.map +11 -0
  78. package/dist/{chunk-e4rvtvpw.js → chunk-aa2pen2v.js} +250 -78
  79. package/dist/chunk-aa2pen2v.js.map +34 -0
  80. package/dist/{chunk-64sr682n.js → chunk-ajnan18g.js} +11 -8
  81. package/dist/chunk-ajnan18g.js.map +12 -0
  82. package/dist/{chunk-9aehf39w.js → chunk-f26bck4t.js} +4 -4
  83. package/dist/{chunk-7ds9620f.js → chunk-fvt9rjsa.js} +23 -7
  84. package/dist/chunk-fvt9rjsa.js.map +10 -0
  85. package/dist/{chunk-kt81c11h.js → chunk-gbejpkex.js} +5 -5
  86. package/dist/{chunk-kt81c11h.js.map → chunk-gbejpkex.js.map} +1 -1
  87. package/dist/{chunk-vjjv9mrb.js → chunk-gzasd5b6.js} +5 -5
  88. package/dist/{chunk-vjjv9mrb.js.map → chunk-gzasd5b6.js.map} +3 -3
  89. package/dist/{chunk-d63tybny.js → chunk-h0k55pc7.js} +4 -4
  90. package/dist/{chunk-d63tybny.js.map → chunk-h0k55pc7.js.map} +1 -1
  91. package/dist/chunk-h5vqbfmd.js +1537 -0
  92. package/dist/chunk-h5vqbfmd.js.map +19 -0
  93. package/dist/{chunk-3kv70xwp.js → chunk-j1sbhm7p.js} +18 -2
  94. package/dist/chunk-j1sbhm7p.js.map +10 -0
  95. package/dist/{chunk-hdz94br2.js → chunk-k522z7v6.js} +10 -5
  96. package/dist/chunk-k522z7v6.js.map +10 -0
  97. package/dist/{chunk-wjgm6jjt.js → chunk-mth82m8t.js} +128 -94
  98. package/dist/chunk-mth82m8t.js.map +14 -0
  99. package/dist/{chunk-qv38twt8.js → chunk-mwsxn98e.js} +46 -25
  100. package/dist/{chunk-qv38twt8.js.map → chunk-mwsxn98e.js.map} +6 -6
  101. package/dist/chunk-n4khvw9n.js +111 -0
  102. package/dist/chunk-n4khvw9n.js.map +11 -0
  103. package/dist/{chunk-qjzp9xyb.js → chunk-nn0tekr1.js} +6 -8
  104. package/dist/chunk-nn0tekr1.js.map +12 -0
  105. package/dist/chunk-nx7k8tpr.js +436 -0
  106. package/dist/chunk-nx7k8tpr.js.map +12 -0
  107. package/dist/{chunk-08twe8m6.js → chunk-p1rzczbt.js} +1 -1
  108. package/dist/{chunk-37wk412q.js → chunk-p1x242ad.js} +587 -70
  109. package/dist/chunk-p1x242ad.js.map +25 -0
  110. package/dist/{chunk-tn7xcs2n.js → chunk-pc7ys28c.js} +68 -5
  111. package/dist/chunk-pc7ys28c.js.map +14 -0
  112. package/dist/{chunk-3fqt22c4.js → chunk-q0k9nc5a.js} +280 -88
  113. package/dist/chunk-q0k9nc5a.js.map +14 -0
  114. package/dist/chunk-r8jrnexe.js +403 -0
  115. package/dist/chunk-r8jrnexe.js.map +10 -0
  116. package/dist/{chunk-gbrpsx4m.js → chunk-rafagrwr.js} +30 -2
  117. package/dist/chunk-rafagrwr.js.map +11 -0
  118. package/dist/{chunk-xdpwpkha.js → chunk-rv2hkwwa.js} +1 -1
  119. package/dist/{chunk-6ed5bwnd.js → chunk-sbzzr4kx.js} +1203 -691
  120. package/dist/{chunk-6ed5bwnd.js.map → chunk-sbzzr4kx.js.map} +15 -9
  121. package/dist/{chunk-d2ndstdf.js → chunk-v1xppd0y.js} +13 -11
  122. package/dist/{chunk-d2ndstdf.js.map → chunk-v1xppd0y.js.map} +2 -2
  123. package/dist/chunk-v4en4jc2.js +252 -0
  124. package/dist/chunk-v4en4jc2.js.map +10 -0
  125. package/dist/{chunk-1kamz6j0.js → chunk-w1tvjszy.js} +1 -1
  126. package/dist/{chunk-rp1mvzb4.js → chunk-w9tg6yyb.js} +11 -6
  127. package/dist/{chunk-rp1mvzb4.js.map → chunk-w9tg6yyb.js.map} +3 -3
  128. package/dist/{chunk-4nxeacx7.js → chunk-wdage1eb.js} +1 -1
  129. package/dist/{chunk-ha58tjtt.js → chunk-wtf06et8.js} +9 -5
  130. package/dist/{chunk-ha58tjtt.js.map → chunk-wtf06et8.js.map} +3 -3
  131. package/dist/{chunk-h0knpbz5.js → chunk-xajtptbw.js} +782 -211
  132. package/dist/chunk-xajtptbw.js.map +40 -0
  133. package/dist/{chunk-xc7hq65b.js → chunk-yp8ee62z.js} +49 -2
  134. package/dist/chunk-yp8ee62z.js.map +11 -0
  135. package/dist/chunk-z4ccwbkz.js +139 -0
  136. package/dist/chunk-z4ccwbkz.js.map +10 -0
  137. package/dist/datasets/builders.d.ts +11 -2
  138. package/dist/datasets/builders.d.ts.map +1 -1
  139. package/dist/datasets/changes.d.ts +14 -4
  140. package/dist/datasets/changes.d.ts.map +1 -1
  141. package/dist/datasets/execution.d.ts +15 -1
  142. package/dist/datasets/execution.d.ts.map +1 -1
  143. package/dist/datasets/index.d.ts +1 -0
  144. package/dist/datasets/index.d.ts.map +1 -1
  145. package/dist/datasets/sequence.d.ts +7 -0
  146. package/dist/datasets/sequence.d.ts.map +1 -0
  147. package/dist/datasets/types.d.ts +1 -0
  148. package/dist/datasets/types.d.ts.map +1 -1
  149. package/dist/datasets/validation.d.ts.map +1 -1
  150. package/dist/datasets/write.d.ts +37 -0
  151. package/dist/datasets/write.d.ts.map +1 -0
  152. package/dist/datasets/write.js +17 -0
  153. package/dist/datasets/write.js.map +9 -0
  154. package/dist/events/execution.d.ts.map +1 -1
  155. package/dist/events/types/datasets.d.ts +2 -6
  156. package/dist/events/types/datasets.d.ts.map +1 -1
  157. package/dist/execution/agent.d.ts.map +1 -1
  158. package/dist/execution/agent.js +39 -32
  159. package/dist/execution/agent.js.map +1 -1
  160. package/dist/execution/authorization.d.ts +58 -20
  161. package/dist/execution/authorization.d.ts.map +1 -1
  162. package/dist/execution/authorized-object-reader.d.ts +69 -0
  163. package/dist/execution/authorized-object-reader.d.ts.map +1 -0
  164. package/dist/execution/durable.d.ts.map +1 -1
  165. package/dist/execution/index.d.ts +1 -1
  166. package/dist/execution/index.d.ts.map +1 -1
  167. package/dist/execution/primitive.js +39 -32
  168. package/dist/execution/primitive.js.map +2 -2
  169. package/dist/execution/request.d.ts +11 -0
  170. package/dist/execution/request.d.ts.map +1 -1
  171. package/dist/execution/request.js +76 -40
  172. package/dist/execution/request.js.map +3 -3
  173. package/dist/execution/scopes.d.ts +16 -0
  174. package/dist/execution/scopes.d.ts.map +1 -1
  175. package/dist/execution/types.d.ts +9 -0
  176. package/dist/execution/types.d.ts.map +1 -1
  177. package/dist/http/api-routes.d.ts +2 -0
  178. package/dist/http/api-routes.d.ts.map +1 -1
  179. package/dist/http/index.js +1 -1
  180. package/dist/index.d.ts +8 -5
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +92 -78
  183. package/dist/index.js.map +1 -1
  184. package/dist/lake-storage/definition-updates.d.ts.map +1 -1
  185. package/dist/lake-storage/errors.d.ts +5 -1
  186. package/dist/lake-storage/errors.d.ts.map +1 -1
  187. package/dist/lake-storage/in-memory.d.ts +1 -0
  188. package/dist/lake-storage/in-memory.d.ts.map +1 -1
  189. package/dist/lake-storage/index.d.ts +6 -1
  190. package/dist/lake-storage/index.d.ts.map +1 -1
  191. package/dist/lake-storage/index.js +24 -7
  192. package/dist/lake-storage/index.js.map +1 -1
  193. package/dist/lake-storage/merge-validation.d.ts.map +1 -1
  194. package/dist/lake-storage/merge.d.ts +13 -2
  195. package/dist/lake-storage/merge.d.ts.map +1 -1
  196. package/dist/lake-storage/source-ordering.d.ts +19 -0
  197. package/dist/lake-storage/source-ordering.d.ts.map +1 -0
  198. package/dist/lake-storage/sql-transforms.d.ts +2 -1
  199. package/dist/lake-storage/sql-transforms.d.ts.map +1 -1
  200. package/dist/lake-storage/types.d.ts +10 -5
  201. package/dist/lake-storage/types.d.ts.map +1 -1
  202. package/dist/lake-storage/version-inputs.d.ts +4 -0
  203. package/dist/lake-storage/version-inputs.d.ts.map +1 -0
  204. package/dist/materializer/index.js +25 -22
  205. package/dist/materializer/index.js.map +1 -1
  206. package/dist/objects/authorized-ontology-view.d.ts +25 -0
  207. package/dist/objects/authorized-ontology-view.d.ts.map +1 -0
  208. package/dist/objects/execution.d.ts +1 -1
  209. package/dist/objects/execution.d.ts.map +1 -1
  210. package/dist/objects/index.js +29 -26
  211. package/dist/objects/index.js.map +1 -1
  212. package/dist/objects/link/authorization.d.ts +2 -7
  213. package/dist/objects/link/authorization.d.ts.map +1 -1
  214. package/dist/objects/query/executor.d.ts +4 -2
  215. package/dist/objects/query/executor.d.ts.map +1 -1
  216. package/dist/objects/query/index.js +24 -21
  217. package/dist/objects/query/index.js.map +1 -1
  218. package/dist/objects/query/links.d.ts +22 -1
  219. package/dist/objects/query/links.d.ts.map +1 -1
  220. package/dist/objects/query/selected-read-admission.d.ts +27 -0
  221. package/dist/objects/query/selected-read-admission.d.ts.map +1 -0
  222. package/dist/objects/query/validate.d.ts +60 -2
  223. package/dist/objects/query/validate.d.ts.map +1 -1
  224. package/dist/objects/sdk/object-handle.d.ts.map +1 -1
  225. package/dist/objects/sdk/object-set.d.ts.map +1 -1
  226. package/dist/objects/sdk/runtime-query-executor.d.ts +2 -7
  227. package/dist/objects/sdk/runtime-query-executor.d.ts.map +1 -1
  228. package/dist/objects/sdk/telemetry-channel.d.ts.map +1 -1
  229. package/dist/objects/service/list-service.d.ts +2 -3
  230. package/dist/objects/service/list-service.d.ts.map +1 -1
  231. package/dist/objects/telemetry/history.d.ts +8 -6
  232. package/dist/objects/telemetry/history.d.ts.map +1 -1
  233. package/dist/objects/telemetry/index.d.ts +2 -2
  234. package/dist/objects/telemetry/index.d.ts.map +1 -1
  235. package/dist/objects/telemetry/workload.d.ts +11 -0
  236. package/dist/objects/telemetry/workload.d.ts.map +1 -0
  237. package/dist/ontology/index.d.ts +2 -1
  238. package/dist/ontology/index.d.ts.map +1 -1
  239. package/dist/ontology/index.js +13 -12
  240. package/dist/ontology/index.js.map +1 -1
  241. package/dist/ontology/inference/index.d.ts +2 -1
  242. package/dist/ontology/inference/index.d.ts.map +1 -1
  243. package/dist/ontology/internal.d.ts +0 -1
  244. package/dist/ontology/internal.d.ts.map +1 -1
  245. package/dist/ontology/internal.js +5 -10
  246. package/dist/ontology/internal.js.map +3 -3
  247. package/dist/ontology/json-schema.d.ts +10 -6
  248. package/dist/ontology/json-schema.d.ts.map +1 -1
  249. package/dist/ontology/link-path-selection.d.ts +35 -0
  250. package/dist/ontology/link-path-selection.d.ts.map +1 -0
  251. package/dist/ontology/refs.d.ts +2 -0
  252. package/dist/ontology/refs.d.ts.map +1 -1
  253. package/dist/ontology/tokens.d.ts +2 -1
  254. package/dist/ontology/tokens.d.ts.map +1 -1
  255. package/dist/pipelines/execution.d.ts.map +1 -1
  256. package/dist/pipelines/index.js +27 -24
  257. package/dist/pipelines/index.js.map +1 -1
  258. package/dist/pipelines/request.d.ts.map +1 -1
  259. package/dist/projections/execution.d.ts.map +1 -1
  260. package/dist/projections/internal.js +25 -22
  261. package/dist/projections/internal.js.map +1 -1
  262. package/dist/projections/run-dispatch.d.ts.map +1 -1
  263. package/dist/rules/execution.d.ts.map +1 -1
  264. package/dist/runtime/create.d.ts +4 -1
  265. package/dist/runtime/create.d.ts.map +1 -1
  266. package/dist/runtime/definitions.d.ts +2 -0
  267. package/dist/runtime/definitions.d.ts.map +1 -1
  268. package/dist/runtime/host.d.ts +2 -0
  269. package/dist/runtime/host.d.ts.map +1 -1
  270. package/dist/runtime/internal.d.ts +1 -0
  271. package/dist/runtime/internal.d.ts.map +1 -1
  272. package/dist/runtime/resolve-definitions.d.ts +2 -0
  273. package/dist/runtime/resolve-definitions.d.ts.map +1 -1
  274. package/dist/runtime/sixb.d.ts +4 -0
  275. package/dist/runtime/sixb.d.ts.map +1 -1
  276. package/dist/runtime/types.d.ts +3 -0
  277. package/dist/runtime/types.d.ts.map +1 -1
  278. package/dist/schedules/execution.d.ts +2 -1
  279. package/dist/schedules/execution.d.ts.map +1 -1
  280. package/dist/security/every.d.ts +4 -1
  281. package/dist/security/every.d.ts.map +1 -1
  282. package/dist/security/grants.d.ts +7 -2
  283. package/dist/security/grants.d.ts.map +1 -1
  284. package/dist/security/index.d.ts +1 -1
  285. package/dist/security/index.d.ts.map +1 -1
  286. package/dist/security/registry.d.ts +1 -0
  287. package/dist/security/registry.d.ts.map +1 -1
  288. package/dist/security/types.d.ts +7 -1
  289. package/dist/security/types.d.ts.map +1 -1
  290. package/dist/security/validation.d.ts +2 -0
  291. package/dist/security/validation.d.ts.map +1 -1
  292. package/dist/shares/access-plan.d.ts +22 -0
  293. package/dist/shares/access-plan.d.ts.map +1 -0
  294. package/dist/shares/builders.d.ts +14 -0
  295. package/dist/shares/builders.d.ts.map +1 -0
  296. package/dist/shares/compiler.d.ts +14 -0
  297. package/dist/shares/compiler.d.ts.map +1 -0
  298. package/dist/shares/errors.d.ts +4 -0
  299. package/dist/shares/errors.d.ts.map +1 -0
  300. package/dist/shares/execution.d.ts +57 -0
  301. package/dist/shares/execution.d.ts.map +1 -0
  302. package/dist/shares/index.d.ts +10 -0
  303. package/dist/shares/index.d.ts.map +1 -0
  304. package/dist/shares/internal.d.ts +3 -0
  305. package/dist/shares/internal.d.ts.map +1 -0
  306. package/dist/shares/internal.js +239 -0
  307. package/dist/shares/internal.js.map +10 -0
  308. package/dist/shares/intersection.d.ts +9 -0
  309. package/dist/shares/intersection.d.ts.map +1 -0
  310. package/dist/shares/session-protocol.d.ts +41 -0
  311. package/dist/shares/session-protocol.d.ts.map +1 -0
  312. package/dist/shares/types.d.ts +51 -0
  313. package/dist/shares/types.d.ts.map +1 -0
  314. package/dist/shares/validation.d.ts +11 -0
  315. package/dist/shares/validation.d.ts.map +1 -0
  316. package/dist/storage/action-runs/provider.js +2 -2
  317. package/dist/storage/agents/provider.js +2 -2
  318. package/dist/storage/executions/in-memory.d.ts +3 -0
  319. package/dist/storage/executions/in-memory.d.ts.map +1 -1
  320. package/dist/storage/executions/provider.d.ts +4 -1
  321. package/dist/storage/executions/provider.d.ts.map +1 -1
  322. package/dist/storage/executions/provider.js +23 -3
  323. package/dist/storage/executions/provider.js.map +3 -3
  324. package/dist/storage/executions/run-link.d.ts +7 -0
  325. package/dist/storage/executions/run-link.d.ts.map +1 -1
  326. package/dist/storage/executions/validation.d.ts +6 -0
  327. package/dist/storage/executions/validation.d.ts.map +1 -1
  328. package/dist/storage/in-memory/index.d.ts +8 -0
  329. package/dist/storage/in-memory/index.d.ts.map +1 -1
  330. package/dist/storage/index.d.ts +8 -2
  331. package/dist/storage/index.d.ts.map +1 -1
  332. package/dist/storage/index.js +65 -36
  333. package/dist/storage/index.js.map +1 -1
  334. package/dist/storage/objects/execution-limits.d.ts +25 -0
  335. package/dist/storage/objects/execution-limits.d.ts.map +1 -0
  336. package/dist/storage/objects/guard.d.ts +16 -0
  337. package/dist/storage/objects/guard.d.ts.map +1 -0
  338. package/dist/storage/objects/in-memory/index.d.ts +3 -0
  339. package/dist/storage/objects/in-memory/index.d.ts.map +1 -0
  340. package/dist/storage/objects/in-memory/keys.d.ts +10 -0
  341. package/dist/storage/objects/in-memory/keys.d.ts.map +1 -0
  342. package/dist/storage/objects/in-memory/query.d.ts +31 -0
  343. package/dist/storage/objects/in-memory/query.d.ts.map +1 -0
  344. package/dist/storage/objects/in-memory/read-scope.d.ts +18 -0
  345. package/dist/storage/objects/in-memory/read-scope.d.ts.map +1 -0
  346. package/dist/storage/objects/in-memory/read-source.d.ts +10 -0
  347. package/dist/storage/objects/in-memory/read-source.d.ts.map +1 -0
  348. package/dist/storage/objects/in-memory/selected-reader.d.ts +9 -0
  349. package/dist/storage/objects/in-memory/selected-reader.d.ts.map +1 -0
  350. package/dist/storage/objects/{in-memory.d.ts → in-memory/storage.d.ts} +13 -10
  351. package/dist/storage/objects/in-memory/storage.d.ts.map +1 -0
  352. package/dist/storage/objects/index.d.ts +4 -1
  353. package/dist/storage/objects/index.d.ts.map +1 -1
  354. package/dist/storage/objects/keys.d.ts +1 -1
  355. package/dist/storage/objects/keys.d.ts.map +1 -1
  356. package/dist/storage/objects/read-scope.d.ts +25 -0
  357. package/dist/storage/objects/read-scope.d.ts.map +1 -0
  358. package/dist/storage/objects/types.d.ts +114 -22
  359. package/dist/storage/objects/types.d.ts.map +1 -1
  360. package/dist/storage/operation-scope.d.ts +3 -0
  361. package/dist/storage/operation-scope.d.ts.map +1 -1
  362. package/dist/storage/operation-scope.js +4 -2
  363. package/dist/storage/operation-scope.js.map +1 -1
  364. package/dist/storage/pipeline-runs/provider.js +2 -2
  365. package/dist/storage/projection-runs/provider.js +2 -2
  366. package/dist/storage/share-grants/errors.d.ts +8 -0
  367. package/dist/storage/share-grants/errors.d.ts.map +1 -0
  368. package/dist/storage/share-grants/in-memory.d.ts +11 -0
  369. package/dist/storage/share-grants/in-memory.d.ts.map +1 -0
  370. package/dist/storage/share-grants/index.d.ts +5 -0
  371. package/dist/storage/share-grants/index.d.ts.map +1 -0
  372. package/dist/storage/share-grants/provider.d.ts +4 -0
  373. package/dist/storage/share-grants/provider.d.ts.map +1 -0
  374. package/dist/storage/share-grants/provider.js +24 -0
  375. package/dist/storage/share-grants/provider.js.map +9 -0
  376. package/dist/storage/share-grants/record.d.ts +11 -0
  377. package/dist/storage/share-grants/record.d.ts.map +1 -0
  378. package/dist/storage/share-grants/types.d.ts +97 -0
  379. package/dist/storage/share-grants/types.d.ts.map +1 -0
  380. package/dist/storage/share-sessions/errors.d.ts +8 -0
  381. package/dist/storage/share-sessions/errors.d.ts.map +1 -0
  382. package/dist/storage/share-sessions/in-memory.d.ts +14 -0
  383. package/dist/storage/share-sessions/in-memory.d.ts.map +1 -0
  384. package/dist/storage/share-sessions/index.d.ts +5 -0
  385. package/dist/storage/share-sessions/index.d.ts.map +1 -0
  386. package/dist/storage/share-sessions/provider.d.ts +3 -0
  387. package/dist/storage/share-sessions/provider.d.ts.map +1 -0
  388. package/dist/storage/share-sessions/provider.js +20 -0
  389. package/dist/storage/share-sessions/provider.js.map +9 -0
  390. package/dist/storage/share-sessions/record.d.ts +8 -0
  391. package/dist/storage/share-sessions/record.d.ts.map +1 -0
  392. package/dist/storage/share-sessions/types.d.ts +50 -0
  393. package/dist/storage/share-sessions/types.d.ts.map +1 -0
  394. package/dist/storage/sync-runs/provider.js +2 -2
  395. package/dist/storage/transaction.d.ts +2 -1
  396. package/dist/storage/transaction.d.ts.map +1 -1
  397. package/dist/storage/types.d.ts +8 -0
  398. package/dist/storage/types.d.ts.map +1 -1
  399. package/dist/storage/webhook-runs/provider.js +2 -2
  400. package/dist/storage/workflow-runs/provider.js +10 -7
  401. package/dist/storage/workflow-runs/provider.js.map +1 -1
  402. package/dist/syncs/execution.d.ts.map +1 -1
  403. package/dist/syncs/index.js +27 -24
  404. package/dist/syncs/index.js.map +1 -1
  405. package/dist/syncs/request.d.ts.map +1 -1
  406. package/dist/testing/dataset-sequence-contract.d.ts +4 -0
  407. package/dist/testing/dataset-sequence-contract.d.ts.map +1 -0
  408. package/dist/testing/effective-storage-contract.d.ts.map +1 -1
  409. package/dist/testing/execution-storage-contract.d.ts +4 -0
  410. package/dist/testing/execution-storage-contract.d.ts.map +1 -1
  411. package/dist/testing/index.d.ts +3 -0
  412. package/dist/testing/index.d.ts.map +1 -1
  413. package/dist/testing/index.js +2555 -908
  414. package/dist/testing/index.js.map +11 -7
  415. package/dist/testing/lake-merge-storage-contract.d.ts +1 -0
  416. package/dist/testing/lake-merge-storage-contract.d.ts.map +1 -1
  417. package/dist/testing/lake-storage-contract.d.ts.map +1 -1
  418. package/dist/testing/object-read-scope-contract.d.ts +22 -0
  419. package/dist/testing/object-read-scope-contract.d.ts.map +1 -0
  420. package/dist/testing/share-grant-storage-contract.d.ts +10 -0
  421. package/dist/testing/share-grant-storage-contract.d.ts.map +1 -0
  422. package/dist/testing/share-session-storage-contract.d.ts +9 -0
  423. package/dist/testing/share-session-storage-contract.d.ts.map +1 -0
  424. package/dist/webhooks/internal.js +24 -21
  425. package/dist/webhooks/internal.js.map +2 -2
  426. package/dist/workflows/execution.d.ts.map +1 -1
  427. package/dist/workflows/index.js +42 -35
  428. package/dist/workflows/index.js.map +1 -1
  429. package/dist/workflows/request.d.ts.map +1 -1
  430. package/package.json +25 -1
  431. package/src/actions/delegated-admission.ts +72 -0
  432. package/src/actions/descriptor.ts +58 -0
  433. package/src/actions/execution.ts +99 -24
  434. package/src/actions/request.ts +136 -19
  435. package/src/actions/run-authorization.ts +53 -0
  436. package/src/actions/run-dispatch.ts +8 -1
  437. package/src/agents/adapters.ts +30 -420
  438. package/src/agents/authority.ts +3 -4
  439. package/src/agents/context-resolution.ts +1 -4
  440. package/src/agents/errors.ts +0 -10
  441. package/src/agents/execution.ts +13 -5
  442. package/src/agents/identity.ts +4 -0
  443. package/src/agents/index.ts +1 -20
  444. package/src/agents/message.ts +4 -5
  445. package/src/agents/model-loop.ts +54 -6
  446. package/src/agents/request.ts +16 -3
  447. package/src/agents/tool-definition.ts +0 -19
  448. package/src/agents/validation.ts +6 -65
  449. package/src/ai-usage/execution.ts +4 -11
  450. package/src/authorization/decision.ts +29 -14
  451. package/src/authorization/grant-kinds.ts +10 -0
  452. package/src/authorization/index.ts +1 -0
  453. package/src/bootstrap/discovery.ts +3 -0
  454. package/src/bootstrap/ontology-type-manifest.ts +12 -6
  455. package/src/datasets/builders.ts +23 -2
  456. package/src/datasets/changes.ts +16 -4
  457. package/src/datasets/execution.ts +76 -5
  458. package/src/datasets/index.ts +1 -0
  459. package/src/datasets/sequence.ts +77 -0
  460. package/src/datasets/types.ts +1 -0
  461. package/src/datasets/validation.ts +26 -0
  462. package/src/datasets/write.ts +240 -0
  463. package/src/events/execution.ts +57 -7
  464. package/src/events/types/datasets.ts +2 -6
  465. package/src/execution/agent.ts +1 -4
  466. package/src/execution/authorization.ts +470 -90
  467. package/src/execution/authorized-object-reader.ts +695 -0
  468. package/src/execution/durable.ts +10 -2
  469. package/src/execution/index.ts +1 -0
  470. package/src/execution/request.ts +63 -13
  471. package/src/execution/scopes.ts +36 -6
  472. package/src/execution/types.ts +8 -0
  473. package/src/http/api-routes.ts +45 -0
  474. package/src/index.ts +36 -15
  475. package/src/lake-storage/definition-updates.ts +9 -0
  476. package/src/lake-storage/errors.ts +6 -1
  477. package/src/lake-storage/in-memory.ts +53 -17
  478. package/src/lake-storage/index.ts +10 -1
  479. package/src/lake-storage/merge-validation.ts +12 -2
  480. package/src/lake-storage/merge.ts +40 -2
  481. package/src/lake-storage/source-ordering.ts +95 -0
  482. package/src/lake-storage/sql-transforms.ts +2 -1
  483. package/src/lake-storage/types.ts +10 -5
  484. package/src/lake-storage/version-inputs.ts +14 -0
  485. package/src/objects/authorized-ontology-view.ts +512 -0
  486. package/src/objects/execution.ts +98 -143
  487. package/src/objects/link/authorization.ts +3 -2
  488. package/src/objects/query/executor.ts +45 -34
  489. package/src/objects/query/links.ts +84 -25
  490. package/src/objects/query/selected-read-admission.ts +310 -0
  491. package/src/objects/query/validate.ts +353 -36
  492. package/src/objects/sdk/object-handle.ts +2 -8
  493. package/src/objects/sdk/object-set.ts +10 -11
  494. package/src/objects/sdk/runtime-query-executor.ts +8 -28
  495. package/src/objects/sdk/telemetry-channel.ts +11 -7
  496. package/src/objects/service/list-service.ts +15 -29
  497. package/src/objects/telemetry/history.ts +297 -17
  498. package/src/objects/telemetry/index.ts +2 -2
  499. package/src/objects/telemetry/workload.ts +79 -0
  500. package/src/ontology/index.ts +7 -1
  501. package/src/ontology/inference/index.ts +4 -1
  502. package/src/ontology/internal.ts +0 -1
  503. package/src/ontology/json-schema.ts +13 -12
  504. package/src/ontology/link-path-selection.ts +193 -0
  505. package/src/ontology/refs.ts +19 -0
  506. package/src/ontology/tokens.ts +15 -8
  507. package/src/pipelines/execution.ts +30 -7
  508. package/src/pipelines/request.ts +5 -0
  509. package/src/projections/execution.ts +72 -11
  510. package/src/projections/run-dispatch.ts +6 -12
  511. package/src/rules/execution.ts +20 -8
  512. package/src/runtime/create.ts +5 -1
  513. package/src/runtime/definitions.ts +2 -0
  514. package/src/runtime/host.ts +25 -6
  515. package/src/runtime/internal.ts +1 -0
  516. package/src/runtime/resolve-definitions.ts +9 -0
  517. package/src/runtime/sixb.ts +23 -2
  518. package/src/runtime/types.ts +3 -0
  519. package/src/schedules/execution.ts +24 -2
  520. package/src/security/every.ts +4 -0
  521. package/src/security/grants.ts +45 -3
  522. package/src/security/index.ts +1 -0
  523. package/src/security/registry.ts +3 -0
  524. package/src/security/types.ts +8 -0
  525. package/src/security/validation.ts +3 -0
  526. package/src/shares/access-plan.ts +225 -0
  527. package/src/shares/builders.ts +381 -0
  528. package/src/shares/compiler.ts +359 -0
  529. package/src/shares/errors.ts +3 -0
  530. package/src/shares/execution.ts +394 -0
  531. package/src/shares/index.ts +28 -0
  532. package/src/shares/internal.ts +9 -0
  533. package/src/shares/intersection.ts +178 -0
  534. package/src/shares/session-protocol.ts +258 -0
  535. package/src/shares/types.ts +76 -0
  536. package/src/shares/validation.ts +40 -0
  537. package/src/storage/executions/in-memory.ts +9 -1
  538. package/src/storage/executions/provider.ts +30 -1
  539. package/src/storage/executions/run-link.ts +29 -0
  540. package/src/storage/executions/validation.ts +46 -1
  541. package/src/storage/in-memory/index.ts +21 -2
  542. package/src/storage/index.ts +51 -0
  543. package/src/storage/objects/execution-limits.ts +283 -0
  544. package/src/storage/objects/guard.ts +55 -0
  545. package/src/storage/objects/in-memory/index.ts +2 -0
  546. package/src/storage/objects/in-memory/keys.ts +46 -0
  547. package/src/storage/objects/in-memory/query.ts +754 -0
  548. package/src/storage/objects/in-memory/read-scope.ts +211 -0
  549. package/src/storage/objects/in-memory/read-source.ts +10 -0
  550. package/src/storage/objects/in-memory/selected-reader.ts +252 -0
  551. package/src/storage/objects/in-memory/storage.ts +589 -0
  552. package/src/storage/objects/index.ts +21 -0
  553. package/src/storage/objects/keys.ts +1 -1
  554. package/src/storage/objects/read-scope.ts +672 -0
  555. package/src/storage/objects/types.ts +123 -19
  556. package/src/storage/operation-scope.ts +16 -0
  557. package/src/storage/share-grants/errors.ts +14 -0
  558. package/src/storage/share-grants/in-memory.ts +107 -0
  559. package/src/storage/share-grants/index.ts +14 -0
  560. package/src/storage/share-grants/provider.ts +11 -0
  561. package/src/storage/share-grants/record.ts +347 -0
  562. package/src/storage/share-grants/types.ts +112 -0
  563. package/src/storage/share-sessions/errors.ts +14 -0
  564. package/src/storage/share-sessions/in-memory.ts +105 -0
  565. package/src/storage/share-sessions/index.ts +11 -0
  566. package/src/storage/share-sessions/provider.ts +9 -0
  567. package/src/storage/share-sessions/record.ts +176 -0
  568. package/src/storage/share-sessions/types.ts +57 -0
  569. package/src/storage/transaction.ts +14 -2
  570. package/src/storage/types.ts +27 -0
  571. package/src/syncs/execution.ts +25 -5
  572. package/src/syncs/request.ts +5 -0
  573. package/src/testing/dataset-sequence-contract.ts +373 -0
  574. package/src/testing/effective-storage-contract.ts +34 -0
  575. package/src/testing/execution-storage-contract.ts +79 -0
  576. package/src/testing/index.ts +16 -0
  577. package/src/testing/lake-merge-storage-contract.ts +3 -0
  578. package/src/testing/lake-storage-contract.ts +58 -0
  579. package/src/testing/object-read-scope-contract.ts +939 -0
  580. package/src/testing/share-grant-storage-contract.ts +325 -0
  581. package/src/testing/share-session-storage-contract.ts +235 -0
  582. package/src/workflows/execution.ts +53 -14
  583. package/src/workflows/request.ts +5 -0
  584. package/dist/chunk-2b5qtban.js.map +0 -14
  585. package/dist/chunk-37wk412q.js.map +0 -23
  586. package/dist/chunk-3fqt22c4.js.map +0 -14
  587. package/dist/chunk-3kv70xwp.js.map +0 -10
  588. package/dist/chunk-64sr682n.js.map +0 -12
  589. package/dist/chunk-7ds9620f.js.map +0 -10
  590. package/dist/chunk-dqn23610.js +0 -72
  591. package/dist/chunk-dqn23610.js.map +0 -11
  592. package/dist/chunk-e4rvtvpw.js.map +0 -34
  593. package/dist/chunk-gbrpsx4m.js.map +0 -11
  594. package/dist/chunk-h0knpbz5.js.map +0 -38
  595. package/dist/chunk-hdz94br2.js.map +0 -10
  596. package/dist/chunk-n2arzn6e.js.map +0 -20
  597. package/dist/chunk-qjzp9xyb.js.map +0 -12
  598. package/dist/chunk-tn7xcs2n.js.map +0 -13
  599. package/dist/chunk-wjgm6jjt.js.map +0 -13
  600. package/dist/chunk-xc7hq65b.js.map +0 -10
  601. package/dist/chunk-y35ma3mj.js +0 -551
  602. package/dist/chunk-y35ma3mj.js.map +0 -15
  603. package/dist/chunk-z2sery1b.js.map +0 -11
  604. package/dist/storage/objects/in-memory.d.ts.map +0 -1
  605. package/src/storage/objects/in-memory.ts +0 -1241
  606. /package/dist/{chunk-5jcdmjam.js.map → chunk-4jjp5k14.js.map} +0 -0
  607. /package/dist/{chunk-agsvg9ar.js.map → chunk-5ntny1qx.js.map} +0 -0
  608. /package/dist/{chunk-9aehf39w.js.map → chunk-f26bck4t.js.map} +0 -0
  609. /package/dist/{chunk-08twe8m6.js.map → chunk-p1rzczbt.js.map} +0 -0
  610. /package/dist/{chunk-xdpwpkha.js.map → chunk-rv2hkwwa.js.map} +0 -0
  611. /package/dist/{chunk-1kamz6j0.js.map → chunk-w1tvjszy.js.map} +0 -0
  612. /package/dist/{chunk-4nxeacx7.js.map → chunk-wdage1eb.js.map} +0 -0
@@ -1,17 +1,99 @@
1
1
  // @bun
2
+ import {
3
+ PipelineRunError,
4
+ assertPipelineRunExecution
5
+ } from "./chunk-4jjp5k14.js";
6
+ import {
7
+ ProjectionRunError,
8
+ advanceProjectionTelemetry,
9
+ assertGenericProgressDoesNotAdvanceTelemetry,
10
+ assertProjectionMissingTarget,
11
+ assertProjectionRunAttempt,
12
+ assertProjectionRunDurableExecution,
13
+ assertProjectionRunIdentityMatches,
14
+ assertProjectionRunListWindow,
15
+ assertProjectionRunNonEmpty,
16
+ assertProjectionRunQueueInput,
17
+ assertProjectionRunRunning,
18
+ assertProjectionRunStartInput,
19
+ canRequeueProjectionRunAfterEnqueueFailure,
20
+ createProjectionRunClaim,
21
+ createProjectionRunRecord,
22
+ failProjectionRunEnqueue,
23
+ finishProjectionRunRecord,
24
+ immutableDatasetVersionConflict,
25
+ mergeProjectionRunProgress,
26
+ planProjectionRunReclaim,
27
+ projectionRunNotFound,
28
+ projectionRunObjectTypesVisible,
29
+ publicProjectionRunRecord,
30
+ requireTelemetryProjectionRun,
31
+ staleProjectionRunExecution
32
+ } from "./chunk-rv2hkwwa.js";
33
+ import {
34
+ ShareGrantStorageError,
35
+ cloneShareGrantRecord,
36
+ normalizeGetShareGrantByIdInput,
37
+ normalizeListShareGrantsInput,
38
+ normalizeRevokeShareGrantInput,
39
+ normalizeShareGrantCreate,
40
+ parseShareGrantRecord
41
+ } from "./chunk-nx7k8tpr.js";
42
+ import {
43
+ ShareSessionStorageError,
44
+ cloneShareSessionRecord,
45
+ normalizeGetShareSessionByIdInput,
46
+ normalizeRenewShareSessionIfValidInput,
47
+ normalizeRevokeShareSessionInput,
48
+ normalizeShareSessionCreate,
49
+ parseShareSessionRecord
50
+ } from "./chunk-4yqmp43v.js";
2
51
  import {
3
52
  SyncRunError,
4
53
  assertSyncRunExecution
5
- } from "./chunk-4nxeacx7.js";
54
+ } from "./chunk-wdage1eb.js";
6
55
  import {
7
56
  WebhookRunError,
8
57
  assertWebhookRunExecution
9
- } from "./chunk-agsvg9ar.js";
58
+ } from "./chunk-5ntny1qx.js";
10
59
  import {
11
60
  WorkflowRunError,
12
61
  assertWorkflowAgentNodeRunExecution,
13
62
  assertWorkflowRunExecution
14
- } from "./chunk-qjzp9xyb.js";
63
+ } from "./chunk-nn0tekr1.js";
64
+ import {
65
+ InMemoryAiUsageStorage,
66
+ aiModelCallCostMatchesUsage,
67
+ buildAiAccountingOverview,
68
+ buildAiModelCallAccountingList,
69
+ buildAiModelCallGroups,
70
+ normalizeAiModelCallCostRecord
71
+ } from "./chunk-p03r0h5s.js";
72
+ import {
73
+ AiLimitOperationLock,
74
+ AiLimitStorageError,
75
+ aiLimitAccountingEntryAppliesToSubject,
76
+ aiLimitAmountKey,
77
+ aiLimitCalendarMonth,
78
+ aiLimitPolicyDimensionKey,
79
+ aiLimitQuantityFromAmount,
80
+ aiLimitReservationBuckets,
81
+ aiLimitReservationRequestKey,
82
+ aiLimitReservationRequestMatches,
83
+ aiLimitSubjectKey,
84
+ aiLimitSubjectsFromAccountingEntry,
85
+ aiModelCallReservationKey,
86
+ assertAiLimitAccountingMatchesReservation,
87
+ assertNonBlank,
88
+ cloneAiLimitPolicy,
89
+ cloneValidDate,
90
+ normalizeAiLimitAmount,
91
+ normalizeAiModelCallReservationIdentity,
92
+ normalizeCreateAiLimitPolicy,
93
+ normalizeReserveAiModelCall,
94
+ normalizeUpdateAiLimitPolicy,
95
+ resolveAiLimitActual
96
+ } from "./chunk-jecn6t54.js";
15
97
  import {
16
98
  CONNECTOR_CONNECTION_RUN_FAILURE_CODES,
17
99
  ConnectorConnectionStorageError
@@ -21,7 +103,7 @@ import {
21
103
  cloneExecutionRecord,
22
104
  normalizeExecutionRecord,
23
105
  validateExecutionRecordReferences
24
- } from "./chunk-gbrpsx4m.js";
106
+ } from "./chunk-rafagrwr.js";
25
107
  import {
26
108
  ProviderMaterializationTransactionLifecycle,
27
109
  appendScopeSnapshot,
@@ -54,49 +136,19 @@ import {
54
136
  import {
55
137
  createAgentOperationScope,
56
138
  createAuthOperationScope,
139
+ createObjectOperationScope,
57
140
  createOntologyOperationScope,
58
141
  createOperationScopedFacade,
59
142
  createStorageOperationScope,
60
143
  createWorkflowRunOperationScope
61
- } from "./chunk-xc7hq65b.js";
62
- import {
63
- PipelineRunError,
64
- assertPipelineRunExecution
65
- } from "./chunk-5jcdmjam.js";
66
- import {
67
- ProjectionRunError,
68
- advanceProjectionTelemetry,
69
- assertGenericProgressDoesNotAdvanceTelemetry,
70
- assertProjectionMissingTarget,
71
- assertProjectionRunAttempt,
72
- assertProjectionRunDurableExecution,
73
- assertProjectionRunIdentityMatches,
74
- assertProjectionRunListWindow,
75
- assertProjectionRunNonEmpty,
76
- assertProjectionRunQueueInput,
77
- assertProjectionRunRunning,
78
- assertProjectionRunStartInput,
79
- canRequeueProjectionRunAfterEnqueueFailure,
80
- createProjectionRunClaim,
81
- createProjectionRunRecord,
82
- failProjectionRunEnqueue,
83
- finishProjectionRunRecord,
84
- immutableDatasetVersionConflict,
85
- mergeProjectionRunProgress,
86
- planProjectionRunReclaim,
87
- projectionRunNotFound,
88
- projectionRunObjectTypesVisible,
89
- publicProjectionRunRecord,
90
- requireTelemetryProjectionRun,
91
- staleProjectionRunExecution
92
- } from "./chunk-xdpwpkha.js";
144
+ } from "./chunk-yp8ee62z.js";
93
145
  import {
94
146
  parseActionRunFailure
95
147
  } from "./chunk-ka3a2ft3.js";
96
148
  import {
97
149
  ActionRunError,
98
150
  assertActionRunExecution
99
- } from "./chunk-1kamz6j0.js";
151
+ } from "./chunk-w1tvjszy.js";
100
152
  import {
101
153
  AgentStorageError,
102
154
  agentContextCheckpointMatchesCreateInput,
@@ -109,40 +161,7 @@ import {
109
161
  assertCreateSubagentRunInput,
110
162
  assertSubagentRunResult,
111
163
  subagentRunMatchesCreateInput
112
- } from "./chunk-08twe8m6.js";
113
- import {
114
- InMemoryAiUsageStorage,
115
- aiModelCallCostMatchesUsage,
116
- buildAiAccountingOverview,
117
- buildAiModelCallAccountingList,
118
- buildAiModelCallGroups,
119
- normalizeAiModelCallCostRecord
120
- } from "./chunk-p03r0h5s.js";
121
- import {
122
- AiLimitOperationLock,
123
- AiLimitStorageError,
124
- aiLimitAccountingEntryAppliesToSubject,
125
- aiLimitAmountKey,
126
- aiLimitCalendarMonth,
127
- aiLimitPolicyDimensionKey,
128
- aiLimitQuantityFromAmount,
129
- aiLimitReservationBuckets,
130
- aiLimitReservationRequestKey,
131
- aiLimitReservationRequestMatches,
132
- aiLimitSubjectKey,
133
- aiLimitSubjectsFromAccountingEntry,
134
- aiModelCallReservationKey,
135
- assertAiLimitAccountingMatchesReservation,
136
- assertNonBlank,
137
- cloneAiLimitPolicy,
138
- cloneValidDate,
139
- normalizeAiLimitAmount,
140
- normalizeAiModelCallReservationIdentity,
141
- normalizeCreateAiLimitPolicy,
142
- normalizeReserveAiModelCall,
143
- normalizeUpdateAiLimitPolicy,
144
- resolveAiLimitActual
145
- } from "./chunk-jecn6t54.js";
164
+ } from "./chunk-p1rzczbt.js";
146
165
  import {
147
166
  assertPinnedDatasetWatermark
148
167
  } from "./chunk-9dzba0f2.js";
@@ -168,10 +187,19 @@ import {
168
187
  InMemoryAuthStorage,
169
188
  paginate,
170
189
  principalsEqual
171
- } from "./chunk-rre42skh.js";
190
+ } from "./chunk-4sm0aznx.js";
172
191
  import {
173
192
  normalizeRequesterGroupIds
174
193
  } from "./chunk-4a849fr1.js";
194
+ import {
195
+ ObjectReadLimitExceededError,
196
+ assertObjectReadFacetCount,
197
+ assertObjectReadOutputWithinLimit,
198
+ snapshotObjectReadExecutionLimits
199
+ } from "./chunk-p1x242ad.js";
200
+ import {
201
+ assertObjectReaderProject
202
+ } from "./chunk-r8jrnexe.js";
175
203
  import {
176
204
  compareDecimalValues
177
205
  } from "./chunk-04b07a9q.js";
@@ -2607,9 +2635,11 @@ class InMemoryExecutionStorage {
2607
2635
  auth;
2608
2636
  rows = new Map;
2609
2637
  runRootOperation;
2638
+ shareSessions;
2610
2639
  constructor(auth, input = {}) {
2611
2640
  this.auth = auth;
2612
2641
  this.runRootOperation = input.runRootOperation ?? runDirectly2;
2642
+ this.shareSessions = input.shareSessions;
2613
2643
  }
2614
2644
  snapshot() {
2615
2645
  return structuredClone(this.rows);
@@ -2632,7 +2662,8 @@ class InMemoryExecutionStorage {
2632
2662
  getExecution: async ({ projectId, id }) => {
2633
2663
  const existing = this.rows.get(executionKey(projectId, id));
2634
2664
  return existing ? cloneExecutionRecord(existing) : null;
2635
- }
2665
+ },
2666
+ getShareSession: async ({ projectId, id }) => await this.shareSessions?.getById({ projectId, id }) ?? null
2636
2667
  });
2637
2668
  this.rows.set(key2, cloneExecutionRecord(record));
2638
2669
  return cloneExecutionRecord(record);
@@ -2646,6 +2677,65 @@ class InMemoryExecutionStorage {
2646
2677
  }
2647
2678
  }
2648
2679
 
2680
+ // src/storage/objects/keys.ts
2681
+ function objectBatchKey(objectTypeId, primaryId) {
2682
+ return JSON.stringify([objectTypeId, primaryId]);
2683
+ }
2684
+ function linkBatchKey(objectTypeId, objectId, linkId) {
2685
+ return JSON.stringify([objectTypeId, objectId, linkId]);
2686
+ }
2687
+ function objectLinkCursor(link) {
2688
+ return [link.sourceTypeId, link.sourceId, link.linkId, link.targetTypeId, link.targetId];
2689
+ }
2690
+ function compareObjectLinkCursors(left, right) {
2691
+ for (let index = 0;index < left.length; index += 1) {
2692
+ if (left[index] < right[index])
2693
+ return -1;
2694
+ if (left[index] > right[index])
2695
+ return 1;
2696
+ }
2697
+ return 0;
2698
+ }
2699
+ function compareObjectLinks(left, right) {
2700
+ return compareObjectLinkCursors(objectLinkCursor(left), objectLinkCursor(right));
2701
+ }
2702
+
2703
+ // src/storage/objects/in-memory/keys.ts
2704
+ function objectRowKey(projectId, objectTypeId) {
2705
+ return JSON.stringify([projectId, objectTypeId]);
2706
+ }
2707
+ function objectRowProjectPrefix(projectId) {
2708
+ return `[${JSON.stringify(projectId)},`;
2709
+ }
2710
+ function compareStrings(left, right) {
2711
+ if (left < right)
2712
+ return -1;
2713
+ if (left > right)
2714
+ return 1;
2715
+ return 0;
2716
+ }
2717
+ function sourceLinkBucketKey(projectId, sourceTypeId, sourceId) {
2718
+ return JSON.stringify([projectId, sourceTypeId, sourceId]);
2719
+ }
2720
+ function linkRowKey(linkId, targetTypeId, targetId) {
2721
+ return JSON.stringify([linkId, targetTypeId, targetId]);
2722
+ }
2723
+ function fullLinkRowKey(row) {
2724
+ return JSON.stringify([
2725
+ row.sourceTypeId,
2726
+ row.sourceId,
2727
+ row.linkId,
2728
+ row.targetTypeId,
2729
+ row.targetId
2730
+ ]);
2731
+ }
2732
+ function rowIdentityKey(row) {
2733
+ return rowIdentityKeyParts(row.objectTypeId, row.primaryId);
2734
+ }
2735
+ function rowIdentityKeyParts(objectTypeId, primaryId) {
2736
+ return objectBatchKey(objectTypeId, primaryId);
2737
+ }
2738
+
2649
2739
  // src/objects/query/scalar-values.ts
2650
2740
  function compareQueryScalarValues(left, right, scalarKind) {
2651
2741
  if (left === undefined || right === undefined || left === null || right === null) {
@@ -2656,7 +2746,7 @@ function compareQueryScalarValues(left, right, scalarKind) {
2656
2746
  switch (scalarKind) {
2657
2747
  case "string":
2658
2748
  case "uuid":
2659
- return typeof left === "string" && typeof right === "string" ? compareStrings(left, right) : Number.NaN;
2749
+ return typeof left === "string" && typeof right === "string" ? compareStrings2(left, right) : Number.NaN;
2660
2750
  case "boolean":
2661
2751
  return typeof left === "boolean" && typeof right === "boolean" ? Number(left) - Number(right) : Number.NaN;
2662
2752
  case "integer":
@@ -2686,7 +2776,7 @@ function compareRuntimeValues(left, right) {
2686
2776
  if (typeof left === "number" && typeof right === "number")
2687
2777
  return left - right;
2688
2778
  if (typeof left === "string" && typeof right === "string")
2689
- return compareStrings(left, right);
2779
+ return compareStrings2(left, right);
2690
2780
  if (typeof left === "boolean" && typeof right === "boolean") {
2691
2781
  return Number(left) - Number(right);
2692
2782
  }
@@ -2719,7 +2809,7 @@ function dateTime(value) {
2719
2809
  }
2720
2810
  return null;
2721
2811
  }
2722
- function compareStrings(left, right) {
2812
+ function compareStrings2(left, right) {
2723
2813
  if (left < right)
2724
2814
  return -1;
2725
2815
  if (left > right)
@@ -2727,30 +2817,7 @@ function compareStrings(left, right) {
2727
2817
  return 0;
2728
2818
  }
2729
2819
 
2730
- // src/storage/objects/keys.ts
2731
- function objectBatchKey(objectTypeId, primaryId) {
2732
- return JSON.stringify([objectTypeId, primaryId]);
2733
- }
2734
- function linkBatchKey(objectTypeId, objectId, linkId) {
2735
- return JSON.stringify([objectTypeId, objectId, linkId]);
2736
- }
2737
- function objectLinkCursor(link) {
2738
- return [link.sourceTypeId, link.sourceId, link.linkId, link.targetTypeId, link.targetId];
2739
- }
2740
- function compareObjectLinkCursors(left, right) {
2741
- for (let index = 0;index < left.length; index += 1) {
2742
- if (left[index] < right[index])
2743
- return -1;
2744
- if (left[index] > right[index])
2745
- return 1;
2746
- }
2747
- return 0;
2748
- }
2749
- function compareObjectLinks(left, right) {
2750
- return compareObjectLinkCursors(objectLinkCursor(left), objectLinkCursor(right));
2751
- }
2752
-
2753
- // src/storage/objects/in-memory.ts
2820
+ // src/storage/objects/in-memory/query.ts
2754
2821
  var IN_MEMORY_OBJECT_QUERY_CAPABILITIES = {
2755
2822
  queryObjects: true,
2756
2823
  countObjects: true,
@@ -2811,40 +2878,762 @@ var IN_MEMORY_OBJECT_QUERY_CAPABILITIES = {
2811
2878
  stablePageTokens: true
2812
2879
  }
2813
2880
  };
2814
- function objectRowKey(projectId, objectTypeId) {
2815
- return JSON.stringify([projectId, objectTypeId]);
2816
- }
2817
- function objectRowProjectPrefix(projectId) {
2818
- return `[${JSON.stringify(projectId)},`;
2819
- }
2820
- function compareStrings2(left, right) {
2821
- if (left < right)
2822
- return -1;
2823
- if (left > right)
2824
- return 1;
2825
- return 0;
2826
- }
2881
+ var PAGE_TOKEN_PREFIX = "offset:";
2827
2882
  function assertLinkQueryLimit(limit) {
2828
2883
  if (!Number.isSafeInteger(limit) || limit <= 0) {
2829
2884
  throw new Error("Object link query limit must be a positive safe integer.");
2830
2885
  }
2831
2886
  }
2832
- function sourceLinkBucketKey(projectId, sourceTypeId, sourceId) {
2833
- return JSON.stringify([projectId, sourceTypeId, sourceId]);
2887
+ function evaluateObjectQuery(query, source) {
2888
+ switch (query.kind) {
2889
+ case "start":
2890
+ return evaluateStart(query.objectTypeId, source);
2891
+ case "refs":
2892
+ return evaluateRefs(query.refs, source);
2893
+ case "filter": {
2894
+ const input = evaluateObjectQuery(query.input, source);
2895
+ const entries = input.entries.filter((entry) => matchesPredicate(entry.row, query.predicate));
2896
+ return completeEvaluation(entries);
2897
+ }
2898
+ case "text": {
2899
+ const input = evaluateObjectQuery(query.input, source);
2900
+ const scoredEntries = input.entries.flatMap((entry) => {
2901
+ const score = textScore(entry.row, query.query, query.fields, query.fieldsByObjectType);
2902
+ return score > 0 ? [{ ...entry, score: entry.score + score }] : [];
2903
+ });
2904
+ return completeEvaluation(scoredEntries);
2905
+ }
2906
+ case "vector": {
2907
+ const input = evaluateObjectQuery(query.input, source);
2908
+ const scoredEntries = input.entries.flatMap((entry) => {
2909
+ const score = vectorSimilarity(entry.row.properties[query.propertyId], query.vector);
2910
+ return score === null ? [] : [{ ...entry, score: entry.score + score }];
2911
+ });
2912
+ scoredEntries.sort(compareEntriesByRelevance);
2913
+ const limit = Math.max(0, query.k);
2914
+ return {
2915
+ entries: scoredEntries.slice(0, limit),
2916
+ total: scoredEntries.length,
2917
+ hasMore: limit < scoredEntries.length
2918
+ };
2919
+ }
2920
+ case "traverse": {
2921
+ const input = evaluateObjectQuery(query.input, source);
2922
+ const entries = query.direction === "outgoing" ? traverseOutgoing(input.entries, query.linkId, source) : traverseIncoming(input.entries, query.linkId, query.sourceObjectTypeId, source);
2923
+ return completeEvaluation(entries);
2924
+ }
2925
+ case "set":
2926
+ return evaluateSet(query.op, query.inputs, source);
2927
+ case "sort": {
2928
+ const input = evaluateObjectQuery(query.input, source);
2929
+ return {
2930
+ ...input,
2931
+ entries: sortEntries(input.entries, query.fields)
2932
+ };
2933
+ }
2934
+ case "limit": {
2935
+ const input = evaluateObjectQuery(query.input, source);
2936
+ const limit = Math.max(0, query.limit);
2937
+ return {
2938
+ entries: input.entries.slice(0, limit),
2939
+ total: input.entries.length,
2940
+ hasMore: limit < input.entries.length
2941
+ };
2942
+ }
2943
+ case "page": {
2944
+ const input = evaluateObjectQuery(query.input, source);
2945
+ const offset = decodePageOffset(query.pageToken);
2946
+ const pageSize = Math.max(0, query.pageSize);
2947
+ const nextOffset = offset + pageSize;
2948
+ const hasMore = pageSize > 0 && nextOffset < input.entries.length;
2949
+ return {
2950
+ entries: input.entries.slice(offset, nextOffset),
2951
+ total: input.entries.length,
2952
+ hasMore,
2953
+ nextPageToken: hasMore ? encodePageOffset(nextOffset) : undefined
2954
+ };
2955
+ }
2956
+ case "project": {
2957
+ const input = evaluateObjectQuery(query.input, source);
2958
+ if (!query.properties)
2959
+ return input;
2960
+ const properties = query.properties;
2961
+ return {
2962
+ ...input,
2963
+ entries: input.entries.map((entry) => ({
2964
+ ...entry,
2965
+ row: projectRow(entry.row, properties)
2966
+ }))
2967
+ };
2968
+ }
2969
+ case "expand":
2970
+ throw new Error("[Sixb] In-memory object storage does not support 'expand' execution yet");
2971
+ }
2834
2972
  }
2835
- function linkRowKey(linkId, targetTypeId, targetId) {
2836
- return JSON.stringify([linkId, targetTypeId, targetId]);
2973
+ function evaluateStart(objectTypeId, source) {
2974
+ const rows = source.objectsOfType(objectTypeId);
2975
+ const entries = rows.map((row, index) => ({
2976
+ row,
2977
+ score: 0,
2978
+ order: index
2979
+ }));
2980
+ return completeEvaluation(entries);
2837
2981
  }
2838
- function fullLinkRowKey(row) {
2839
- return JSON.stringify([
2840
- row.sourceTypeId,
2841
- row.sourceId,
2842
- row.linkId,
2843
- row.targetTypeId,
2844
- row.targetId
2845
- ]);
2982
+ function evaluateRefs(refs, source) {
2983
+ const seen = new Set;
2984
+ const entries = refs.flatMap((ref) => {
2985
+ const key2 = JSON.stringify([ref.objectTypeId, ref.primaryId]);
2986
+ if (seen.has(key2))
2987
+ return [];
2988
+ seen.add(key2);
2989
+ const row = source.getObject(ref.objectTypeId, ref.primaryId);
2990
+ return row ? [row] : [];
2991
+ }).sort((left, right) => compareStrings(left.objectTypeId, right.objectTypeId) || compareStrings(left.primaryId, right.primaryId)).map((row, order) => ({ row, score: 0, order }));
2992
+ return completeEvaluation(entries);
2993
+ }
2994
+ function evaluateSet(op, inputs, source) {
2995
+ const evaluations = inputs.map((input) => evaluateObjectQuery(input, source));
2996
+ const first = evaluations[0];
2997
+ if (!first)
2998
+ return completeEvaluation([]);
2999
+ if (op === "union") {
3000
+ const entriesByKey = new Map;
3001
+ for (const evaluation of evaluations) {
3002
+ for (const entry of evaluation.entries) {
3003
+ upsertEntry(entriesByKey, entry);
3004
+ }
3005
+ }
3006
+ return completeEvaluation([...entriesByKey.values()]);
3007
+ }
3008
+ if (op === "intersect") {
3009
+ const otherKeySets = evaluations.slice(1).map((evaluation) => new Set(evaluation.entries.map((entry) => rowIdentityKey(entry.row))));
3010
+ const entries = first.entries.filter((entry) => {
3011
+ const key2 = rowIdentityKey(entry.row);
3012
+ return otherKeySets.every((keys) => keys.has(key2));
3013
+ });
3014
+ return completeEvaluation(entries);
3015
+ }
3016
+ const subtractKeys = new Set(evaluations.slice(1).flatMap((evaluation) => evaluation.entries.map((entry) => rowIdentityKey(entry.row))));
3017
+ return completeEvaluation(first.entries.filter((entry) => !subtractKeys.has(rowIdentityKey(entry.row))));
2846
3018
  }
2847
- var PAGE_TOKEN_PREFIX = "offset:";
3019
+ function traverseOutgoing(entries, linkId, source) {
3020
+ const resultsByKey = new Map;
3021
+ entries.forEach((entry, index) => {
3022
+ const links = [...source.outgoingLinks(entry.row.objectTypeId, entry.row.primaryId)];
3023
+ for (const link of links) {
3024
+ if (link.linkId !== linkId)
3025
+ continue;
3026
+ const target = source.getObject(link.targetTypeId, link.targetId);
3027
+ if (!target)
3028
+ continue;
3029
+ upsertEntry(resultsByKey, {
3030
+ row: target,
3031
+ score: entry.score,
3032
+ order: entry.order + index / 1e6
3033
+ });
3034
+ }
3035
+ });
3036
+ return [...resultsByKey.values()];
3037
+ }
3038
+ function traverseIncoming(entries, linkId, sourceObjectTypeId, source) {
3039
+ const inputEntriesByTarget = new Map(entries.map((entry) => [rowIdentityKey(entry.row), entry]));
3040
+ const resultsByKey = new Map;
3041
+ const links = [...source.allLinks()];
3042
+ for (const link of links) {
3043
+ if (link.projectId !== source.projectId || link.linkId !== linkId)
3044
+ continue;
3045
+ if (sourceObjectTypeId !== undefined && link.sourceTypeId !== sourceObjectTypeId)
3046
+ continue;
3047
+ const targetEntry = inputEntriesByTarget.get(rowIdentityKeyParts(link.targetTypeId, link.targetId));
3048
+ if (!targetEntry)
3049
+ continue;
3050
+ const row = source.getObject(link.sourceTypeId, link.sourceId);
3051
+ if (!row)
3052
+ continue;
3053
+ upsertEntry(resultsByKey, {
3054
+ row,
3055
+ score: targetEntry.score,
3056
+ order: targetEntry.order
3057
+ });
3058
+ }
3059
+ return [...resultsByKey.values()];
3060
+ }
3061
+ function completeEvaluation(entries) {
3062
+ return {
3063
+ entries,
3064
+ total: entries.length,
3065
+ hasMore: false
3066
+ };
3067
+ }
3068
+ function matchesPredicate(row, predicate) {
3069
+ switch (predicate.op) {
3070
+ case "and":
3071
+ return predicate.items.every((item) => matchesPredicate(row, item));
3072
+ case "or":
3073
+ return predicate.items.some((item) => matchesPredicate(row, item));
3074
+ case "not":
3075
+ return !matchesPredicate(row, predicate.item);
3076
+ case "eq":
3077
+ return queryScalarValuesEqual(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind);
3078
+ case "neq":
3079
+ return !queryScalarValuesEqual(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind);
3080
+ case "lt":
3081
+ return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) < 0;
3082
+ case "lte":
3083
+ return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) <= 0;
3084
+ case "gt":
3085
+ return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) > 0;
3086
+ case "gte":
3087
+ return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) >= 0;
3088
+ case "in":
3089
+ return predicate.values.some((value) => queryScalarValuesEqual(row.properties[predicate.propertyId], value, predicate.scalarKind));
3090
+ case "exists": {
3091
+ const exists = Object.hasOwn(row.properties, predicate.propertyId) && row.properties[predicate.propertyId] !== undefined;
3092
+ return predicate.value ? exists : !exists;
3093
+ }
3094
+ case "contains":
3095
+ return containsValue(row.properties[predicate.propertyId], predicate.value);
3096
+ }
3097
+ }
3098
+ function containsValue(actual, expected) {
3099
+ if (typeof actual === "string" && typeof expected === "string") {
3100
+ return actual.includes(expected);
3101
+ }
3102
+ if (Array.isArray(actual)) {
3103
+ return actual.some((item) => queryScalarValuesEqual(item, expected));
3104
+ }
3105
+ if (isPlainObject(actual) && typeof expected === "string") {
3106
+ return Object.hasOwn(actual, expected);
3107
+ }
3108
+ return false;
3109
+ }
3110
+ function textScore(row, query, fields, fieldsByObjectType) {
3111
+ const terms = tokenize(query);
3112
+ if (terms.length === 0)
3113
+ return 0;
3114
+ const scopedFields = fields ?? fieldsByObjectType?.[row.objectTypeId];
3115
+ const values = fields ? fields.flatMap((field) => collectTextValues(row.properties[field])) : scopedFields ? scopedFields.flatMap((field) => collectTextValues(row.properties[field])) : [row.primaryId, ...Object.values(row.properties).flatMap(collectTextValues)];
3116
+ const haystack = values.join(" ").toLowerCase();
3117
+ if (!terms.every((term) => haystack.includes(term)))
3118
+ return 0;
3119
+ const phrase = query.trim().toLowerCase();
3120
+ const phraseBoost = phrase.length > 0 && haystack.includes(phrase) ? terms.length : 0;
3121
+ return terms.reduce((score, term) => score + countOccurrences(haystack, term), phraseBoost);
3122
+ }
3123
+ function tokenize(query) {
3124
+ return query.trim().toLowerCase().split(/\s+/).filter((term) => term.length > 0);
3125
+ }
3126
+ function collectTextValues(value) {
3127
+ if (typeof value === "string")
3128
+ return [value];
3129
+ if (Array.isArray(value))
3130
+ return value.flatMap(collectTextValues);
3131
+ return [];
3132
+ }
3133
+ function countOccurrences(value, needle) {
3134
+ if (!needle)
3135
+ return 0;
3136
+ let count = 0;
3137
+ let index = value.indexOf(needle);
3138
+ while (index !== -1) {
3139
+ count += 1;
3140
+ index = value.indexOf(needle, index + needle.length);
3141
+ }
3142
+ return count;
3143
+ }
3144
+ function vectorSimilarity(actual, expected) {
3145
+ if (!Array.isArray(actual) || actual.length !== expected.length || actual.length === 0) {
3146
+ return null;
3147
+ }
3148
+ let dot = 0;
3149
+ let actualNorm = 0;
3150
+ let expectedNorm = 0;
3151
+ for (let index = 0;index < expected.length; index += 1) {
3152
+ const actualValue = actual[index];
3153
+ const expectedValue = expected[index];
3154
+ if (typeof actualValue !== "number" || typeof expectedValue !== "number" || !Number.isFinite(actualValue) || !Number.isFinite(expectedValue)) {
3155
+ return null;
3156
+ }
3157
+ dot += actualValue * expectedValue;
3158
+ actualNorm += actualValue * actualValue;
3159
+ expectedNorm += expectedValue * expectedValue;
3160
+ }
3161
+ if (actualNorm === 0 || expectedNorm === 0)
3162
+ return null;
3163
+ return dot / (Math.sqrt(actualNorm) * Math.sqrt(expectedNorm));
3164
+ }
3165
+ function sortEntries(entries, fields) {
3166
+ return [...entries].sort((left, right) => {
3167
+ for (const field of fields) {
3168
+ const comparison = compareSortField(left, right, field);
3169
+ if (comparison !== 0)
3170
+ return comparison;
3171
+ }
3172
+ return left.order - right.order || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row));
3173
+ });
3174
+ }
3175
+ function compareSortField(left, right, field) {
3176
+ if (field.kind === "relevance") {
3177
+ const direction = field.direction ?? "desc";
3178
+ const comparison2 = right.score - left.score;
3179
+ return direction === "desc" ? comparison2 : -comparison2;
3180
+ }
3181
+ const leftValue = left.row.properties[field.propertyId];
3182
+ const rightValue = right.row.properties[field.propertyId];
3183
+ const leftMissing = leftValue === undefined || leftValue === null;
3184
+ const rightMissing = rightValue === undefined || rightValue === null;
3185
+ if (leftMissing && rightMissing)
3186
+ return 0;
3187
+ if (leftMissing)
3188
+ return 1;
3189
+ if (rightMissing)
3190
+ return -1;
3191
+ const comparison = compareQueryScalarValues(leftValue, rightValue, field.scalarKind);
3192
+ if (Number.isNaN(comparison))
3193
+ return 0;
3194
+ return field.direction === "desc" ? -comparison : comparison;
3195
+ }
3196
+ function compareEntriesByRelevance(left, right) {
3197
+ return right.score - left.score || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row));
3198
+ }
3199
+ function projectRow(row, properties) {
3200
+ const projected = {};
3201
+ for (const propertyId of properties) {
3202
+ if (Object.hasOwn(row.properties, propertyId)) {
3203
+ projected[propertyId] = row.properties[propertyId];
3204
+ }
3205
+ }
3206
+ return {
3207
+ ...row,
3208
+ properties: projected
3209
+ };
3210
+ }
3211
+ function stripOuterRowShape(query) {
3212
+ switch (query.kind) {
3213
+ case "limit":
3214
+ case "page":
3215
+ case "project":
3216
+ case "sort":
3217
+ case "expand":
3218
+ return stripOuterRowShape(query.input);
3219
+ default:
3220
+ return query;
3221
+ }
3222
+ }
3223
+ function buildFacetResults(rows, facets) {
3224
+ return facets.map((facet) => ({
3225
+ propertyId: facet.propertyId,
3226
+ buckets: buildFacetBuckets(rows, facet)
3227
+ }));
3228
+ }
3229
+ function buildFacetBuckets(rows, facet) {
3230
+ const buckets = new Map;
3231
+ for (const row of rows) {
3232
+ if (!Object.hasOwn(row.properties, facet.propertyId))
3233
+ continue;
3234
+ const value = row.properties[facet.propertyId];
3235
+ if (value === undefined)
3236
+ continue;
3237
+ const key2 = facetValueKey(value);
3238
+ const existing = buckets.get(key2);
3239
+ if (existing) {
3240
+ existing.count += 1;
3241
+ } else {
3242
+ buckets.set(key2, { value, count: 1 });
3243
+ }
3244
+ }
3245
+ return [...buckets.values()].sort((left, right) => right.count - left.count || facetValueSortKey(left.value).localeCompare(facetValueSortKey(right.value))).slice(0, facet.limit);
3246
+ }
3247
+ function facetValueKey(value) {
3248
+ return JSON.stringify(value) ?? String(value);
3249
+ }
3250
+ function facetValueSortKey(value) {
3251
+ return JSON.stringify(value) ?? String(value);
3252
+ }
3253
+ async function queryLinksFrom(params, listLinks) {
3254
+ assertLinkQueryLimit(params.limit);
3255
+ if (params.objectRefs.length === 0 || params.endpointObjectTypeIds?.length === 0) {
3256
+ return { links: [], hasMore: false };
3257
+ }
3258
+ const allowedTypes = params.endpointObjectTypeIds ? new Set(params.endpointObjectTypeIds) : undefined;
3259
+ const deduped = new Map;
3260
+ for (const object of params.objectRefs) {
3261
+ const rows2 = await listLinks({
3262
+ projectId: params.projectId,
3263
+ objectTypeId: object.objectTypeId,
3264
+ objectId: object.primaryId,
3265
+ direction: params.direction,
3266
+ ...params.linkId === undefined ? {} : { linkId: params.linkId }
3267
+ });
3268
+ for (const row of rows2) {
3269
+ if (allowedTypes && (!allowedTypes.has(row.sourceTypeId) || !allowedTypes.has(row.targetTypeId))) {
3270
+ continue;
3271
+ }
3272
+ if (params.after && compareObjectLinkCursors(objectLinkCursor(row), params.after) <= 0) {
3273
+ continue;
3274
+ }
3275
+ deduped.set(fullLinkRowKey(row), row);
3276
+ }
3277
+ }
3278
+ const rows = [...deduped.values()].sort(compareObjectLinks).slice(0, params.limit + 1);
3279
+ return { links: rows.slice(0, params.limit), hasMore: rows.length > params.limit };
3280
+ }
3281
+ function collectLinksBatch(source, params, cloneRows) {
3282
+ const direction = params.direction ?? "outgoing";
3283
+ const orderedKeys = [
3284
+ ...new Set(params.items.map((item) => linkBatchKey(item.objectTypeId, item.objectId, item.linkId)))
3285
+ ];
3286
+ const requestedKeys = new Set(orderedKeys);
3287
+ const grouped = new Map;
3288
+ const append = (key2, row) => {
3289
+ const bucket = grouped.get(key2) ?? new Map;
3290
+ bucket.set(fullLinkRowKey(row), row);
3291
+ grouped.set(key2, bucket);
3292
+ };
3293
+ if (direction === "outgoing" || direction === "both") {
3294
+ for (const item of params.items) {
3295
+ const key2 = linkBatchKey(item.objectTypeId, item.objectId, item.linkId);
3296
+ for (const row of source.outgoing(item)) {
3297
+ if (row.projectId === params.projectId && row.linkId === item.linkId)
3298
+ append(key2, row);
3299
+ }
3300
+ }
3301
+ }
3302
+ if (direction === "incoming" || direction === "both") {
3303
+ for (const row of source.all()) {
3304
+ if (row.projectId !== params.projectId)
3305
+ continue;
3306
+ const key2 = linkBatchKey(row.targetTypeId, row.targetId, row.linkId);
3307
+ if (requestedKeys.has(key2))
3308
+ append(key2, row);
3309
+ }
3310
+ }
3311
+ return new Map(orderedKeys.flatMap((key2) => {
3312
+ const bucket = grouped.get(key2);
3313
+ if (!bucket)
3314
+ return [];
3315
+ return [
3316
+ [key2, [...bucket.values()].map((row) => cloneRows ? structuredClone(row) : row)]
3317
+ ];
3318
+ }));
3319
+ }
3320
+ function upsertEntry(entriesByKey, entry) {
3321
+ const key2 = rowIdentityKey(entry.row);
3322
+ const existing = entriesByKey.get(key2);
3323
+ if (!existing) {
3324
+ entriesByKey.set(key2, entry);
3325
+ return;
3326
+ }
3327
+ if (entry.score > existing.score) {
3328
+ entriesByKey.set(key2, {
3329
+ ...existing,
3330
+ score: entry.score
3331
+ });
3332
+ }
3333
+ }
3334
+ function encodePageOffset(offset) {
3335
+ return `${PAGE_TOKEN_PREFIX}${offset}`;
3336
+ }
3337
+ function decodePageOffset(token) {
3338
+ if (!token)
3339
+ return 0;
3340
+ if (!token.startsWith(PAGE_TOKEN_PREFIX)) {
3341
+ throw new Error("[Sixb] Invalid object query page token");
3342
+ }
3343
+ const offset = Number(token.slice(PAGE_TOKEN_PREFIX.length));
3344
+ if (!Number.isInteger(offset) || offset < 0) {
3345
+ throw new Error("[Sixb] Invalid object query page token");
3346
+ }
3347
+ return offset;
3348
+ }
3349
+ function isPlainObject(value) {
3350
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3351
+ }
3352
+
3353
+ // src/storage/objects/in-memory/read-scope.ts
3354
+ function prepareReadPlan(scope) {
3355
+ const selectionsByNode = new Map;
3356
+ for (const selection of scope.objects) {
3357
+ const byType = selectionsByNode.get(selection.nodeId) ?? new Map;
3358
+ byType.set(selection.objectTypeId, new Set(selection.propertyIds));
3359
+ selectionsByNode.set(selection.nodeId, byType);
3360
+ }
3361
+ const steps = [...scope.steps].sort((left, right) => left.parentNodeId - right.parentNodeId || left.nodeId - right.nodeId || left.sourceObjectTypeId.localeCompare(right.sourceObjectTypeId) || left.linkId.localeCompare(right.linkId) || left.targetObjectTypeId.localeCompare(right.targetObjectTypeId));
3362
+ return {
3363
+ roots: scope.roots,
3364
+ selectionsByNode,
3365
+ steps
3366
+ };
3367
+ }
3368
+ function resolveSelectedReadUniverse(source, plan, limits) {
3369
+ const reachableByNode = new Map;
3370
+ const rawObjects = new Map;
3371
+ const objectProperties = new Map;
3372
+ const authorizedLinks = new Map;
3373
+ let traversalFacts = 0;
3374
+ const consumeTraversalFact = () => {
3375
+ traversalFacts += 1;
3376
+ if (traversalFacts > limits.maxTraversalFacts) {
3377
+ throw new ObjectReadLimitExceededError("traversalFacts", limits.maxTraversalFacts);
3378
+ }
3379
+ };
3380
+ const addReachable = (nodeId, row) => {
3381
+ const selectedProperties = plan.selectionsByNode.get(nodeId)?.get(row.objectTypeId);
3382
+ if (!selectedProperties)
3383
+ return;
3384
+ const key2 = rowIdentityKey(row);
3385
+ const reachable = reachableByNode.get(nodeId) ?? new Map;
3386
+ reachable.set(key2, row);
3387
+ reachableByNode.set(nodeId, reachable);
3388
+ rawObjects.set(key2, row);
3389
+ unionInto(objectProperties, key2, selectedProperties);
3390
+ };
3391
+ for (const root of plan.roots) {
3392
+ const row = source.getObject(root.objectTypeId, root.primaryId);
3393
+ if (row) {
3394
+ consumeTraversalFact();
3395
+ addReachable(root.nodeId, row);
3396
+ }
3397
+ }
3398
+ for (const step of plan.steps) {
3399
+ const parents = reachableByNode.get(step.parentNodeId);
3400
+ if (!parents)
3401
+ continue;
3402
+ for (const parent of parents.values()) {
3403
+ if (parent.objectTypeId !== step.sourceObjectTypeId)
3404
+ continue;
3405
+ for (const link of source.outgoingLinks(parent.objectTypeId, parent.primaryId)) {
3406
+ if (link.linkId !== step.linkId || link.targetTypeId !== step.targetObjectTypeId) {
3407
+ continue;
3408
+ }
3409
+ const target = source.getObject(link.targetTypeId, link.targetId);
3410
+ if (!target)
3411
+ continue;
3412
+ consumeTraversalFact();
3413
+ addReachable(step.nodeId, target);
3414
+ const linkKey = fullLinkRowKey(link);
3415
+ const selected = authorizedLinks.get(linkKey);
3416
+ if (selected) {
3417
+ for (const propertyId of step.propertyIds)
3418
+ selected.propertyIds.add(propertyId);
3419
+ } else {
3420
+ authorizedLinks.set(linkKey, {
3421
+ row: link,
3422
+ propertyIds: new Set(step.propertyIds)
3423
+ });
3424
+ }
3425
+ }
3426
+ }
3427
+ }
3428
+ const objects = new Map;
3429
+ for (const [key2, propertyIds] of objectProperties) {
3430
+ const row = rawObjects.get(key2);
3431
+ if (row)
3432
+ objects.set(key2, redactObjectRow(row, propertyIds));
3433
+ }
3434
+ const links = new Map;
3435
+ for (const [key2, selected] of authorizedLinks) {
3436
+ if (!objects.has(rowIdentityKeyParts(selected.row.sourceTypeId, selected.row.sourceId)) || !objects.has(rowIdentityKeyParts(selected.row.targetTypeId, selected.row.targetId))) {
3437
+ continue;
3438
+ }
3439
+ links.set(key2, redactLinkRow(selected.row, selected.propertyIds));
3440
+ }
3441
+ return createReadUniverse(source.projectId, objects, links, objectProperties);
3442
+ }
3443
+ function createReadUniverse(projectId, objects, links, objectProperties) {
3444
+ const linksBySource = new Map;
3445
+ for (const link of links.values()) {
3446
+ const key2 = sourceLinkBucketKey(link.projectId, link.sourceTypeId, link.sourceId);
3447
+ const bucket = linksBySource.get(key2) ?? [];
3448
+ bucket.push(link);
3449
+ linksBySource.set(key2, bucket);
3450
+ }
3451
+ return {
3452
+ projectId,
3453
+ objects,
3454
+ links,
3455
+ linksBySource,
3456
+ objectProperties,
3457
+ objectsOfType: (objectTypeId) => [...objects.values()].filter((row) => row.objectTypeId === objectTypeId),
3458
+ getObject: (objectTypeId, primaryId) => objects.get(rowIdentityKeyParts(objectTypeId, primaryId)),
3459
+ outgoingLinks: (objectTypeId, primaryId) => linksBySource.get(sourceLinkBucketKey(projectId, objectTypeId, primaryId)) ?? [],
3460
+ allLinks: () => links.values()
3461
+ };
3462
+ }
3463
+ function unionInto(target, key2, values) {
3464
+ const union = target.get(key2) ?? new Set;
3465
+ for (const value of values)
3466
+ union.add(value);
3467
+ target.set(key2, union);
3468
+ }
3469
+ function redactObjectRow(row, propertyIds) {
3470
+ const clone2 = structuredClone(row);
3471
+ delete clone2.links;
3472
+ clone2.properties = redactProperties(clone2.properties, propertyIds);
3473
+ return clone2;
3474
+ }
3475
+ function redactLinkRow(row, propertyIds) {
3476
+ const clone2 = structuredClone(row);
3477
+ const properties = redactProperties(clone2.properties ?? {}, propertyIds);
3478
+ if (Object.keys(properties).length === 0) {
3479
+ delete clone2.properties;
3480
+ } else {
3481
+ clone2.properties = properties;
3482
+ }
3483
+ return clone2;
3484
+ }
3485
+ function redactProperties(properties, propertyIds) {
3486
+ return Object.fromEntries([...propertyIds].filter((propertyId) => Object.hasOwn(properties, propertyId)).map((propertyId) => [propertyId, properties[propertyId]]));
3487
+ }
3488
+
3489
+ // src/storage/objects/in-memory/selected-reader.ts
3490
+ function createInMemorySelectedReader(source, params, queryCapabilities) {
3491
+ const projectId = source.projectId;
3492
+ const plan = prepareReadPlan(params.scope);
3493
+ const limits = snapshotObjectReadExecutionLimits(params.limits);
3494
+ const assertProject = (actualProjectId) => assertObjectReaderProject(projectId, actualProjectId);
3495
+ const visible = (value) => {
3496
+ assertObjectReadOutputWithinLimit(value, limits);
3497
+ return value;
3498
+ };
3499
+ const visibleMap = (value) => {
3500
+ assertObjectReadOutputWithinLimit([...value.entries()], limits);
3501
+ return value;
3502
+ };
3503
+ const selectsObjectProperties = async (input) => {
3504
+ assertProject(input.projectId);
3505
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3506
+ return visible(input.items.map((item) => {
3507
+ const key2 = rowIdentityKeyParts(item.objectTypeId, item.primaryId);
3508
+ if (!universe.objects.has(key2))
3509
+ return false;
3510
+ return universe.objectProperties.get(key2)?.has(item.propertyId) ?? false;
3511
+ }));
3512
+ };
3513
+ return Object.freeze({
3514
+ queryCapabilities,
3515
+ queryObjects: async (input) => {
3516
+ assertProject(input.projectId);
3517
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3518
+ const result = evaluateObjectQuery(input.query, universe);
3519
+ return visible({
3520
+ objects: result.entries.map((entry) => structuredClone(entry.row)),
3521
+ hasMore: result.hasMore,
3522
+ nextPageToken: result.nextPageToken,
3523
+ ...input.includeTotal === false ? {} : { total: result.total }
3524
+ });
3525
+ },
3526
+ countObjects: async (input) => {
3527
+ assertProject(input.projectId);
3528
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3529
+ return visible({
3530
+ count: evaluateObjectQuery(stripOuterRowShape(input.query), universe).total
3531
+ });
3532
+ },
3533
+ existsObjects: async (input) => {
3534
+ assertProject(input.projectId);
3535
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3536
+ return visible({
3537
+ exists: evaluateObjectQuery(stripOuterRowShape(input.query), universe).total > 0
3538
+ });
3539
+ },
3540
+ facetObjects: async (input) => {
3541
+ assertProject(input.projectId);
3542
+ assertObjectReadFacetCount(input.facets.length);
3543
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3544
+ const result = evaluateObjectQuery(stripOuterRowShape(input.query), universe);
3545
+ return visible(structuredClone({
3546
+ facets: buildFacetResults(result.entries.map((entry) => entry.row), input.facets)
3547
+ }));
3548
+ },
3549
+ getByPrimaryId: async (input) => {
3550
+ assertProject(input.projectId);
3551
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3552
+ const row = universe.objects.get(rowIdentityKeyParts(input.objectTypeId, input.primaryId));
3553
+ return visible(row ? structuredClone(row) : null);
3554
+ },
3555
+ selectsObjectProperties,
3556
+ listLinks: async (input) => {
3557
+ assertProject(input.projectId);
3558
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3559
+ return visible(listUniverseLinks(universe, input).map((row) => structuredClone(row)));
3560
+ },
3561
+ getByPrimaryIdBatch: async (input) => {
3562
+ assertProject(input.projectId);
3563
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3564
+ const rows = new Map;
3565
+ for (const item of input.items) {
3566
+ const row = universe.objects.get(rowIdentityKeyParts(item.objectTypeId, item.primaryId));
3567
+ if (row) {
3568
+ rows.set(objectBatchKey(item.objectTypeId, item.primaryId), structuredClone(row));
3569
+ }
3570
+ }
3571
+ return visibleMap(rows);
3572
+ },
3573
+ listLinksBatch: async (input) => {
3574
+ assertProject(input.projectId);
3575
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3576
+ return visibleMap(collectLinksBatch({
3577
+ all: () => universe.links.values(),
3578
+ outgoing: (item) => universe.linksBySource.get(sourceLinkBucketKey(projectId, item.objectTypeId, item.objectId)) ?? []
3579
+ }, input, true));
3580
+ },
3581
+ queryLinks: async (input) => {
3582
+ assertProject(input.projectId);
3583
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3584
+ return visible(structuredClone(await queryLinksFrom(input, (item) => listUniverseLinks(universe, item))));
3585
+ },
3586
+ list: async (input) => {
3587
+ assertProject(input.projectId);
3588
+ const universe = resolveSelectedReadUniverse(source, plan, limits);
3589
+ return visible(listRows(input, [...universe.objects.values()]));
3590
+ }
3591
+ });
3592
+ }
3593
+ function listUniverseLinks(universe, params) {
3594
+ const direction = params.direction ?? "outgoing";
3595
+ const matches = (row) => !params.linkId || row.linkId === params.linkId;
3596
+ const rows = [];
3597
+ if (direction === "outgoing" || direction === "both") {
3598
+ const outgoing = universe.linksBySource.get(sourceLinkBucketKey(params.projectId, params.objectTypeId, params.objectId));
3599
+ if (outgoing)
3600
+ rows.push(...outgoing.filter(matches));
3601
+ }
3602
+ if (direction === "incoming" || direction === "both") {
3603
+ for (const row of universe.links.values()) {
3604
+ if (row.targetTypeId === params.objectTypeId && row.targetId === params.objectId && matches(row)) {
3605
+ rows.push(row);
3606
+ }
3607
+ }
3608
+ }
3609
+ if (direction !== "both")
3610
+ return rows;
3611
+ return [...new Map(rows.map((row) => [fullLinkRowKey(row), row])).values()];
3612
+ }
3613
+ function listRows(params, candidates) {
3614
+ const requestedTypes = params.objectTypeId === undefined ? undefined : new Set(typeof params.objectTypeId === "string" ? [params.objectTypeId] : params.objectTypeId);
3615
+ let rows = candidates.filter((row) => row.projectId === params.projectId && (!requestedTypes || requestedTypes.has(row.objectTypeId)));
3616
+ rows = rows.filter((row) => (!params.primaryIdPrefix || row.primaryId.startsWith(params.primaryIdPrefix)) && (!params.primaryIdSuffix || row.primaryId.endsWith(params.primaryIdSuffix)) && (!params.updatedAfter || row.updatedAt >= params.updatedAfter) && (!params.updatedBefore || row.updatedAt <= params.updatedBefore) && (!params.createdAfter || row.createdAt >= params.createdAfter) && (!params.createdBefore || row.createdAt <= params.createdBefore));
3617
+ const total = rows.length;
3618
+ const offset = params.offset ?? 0;
3619
+ const limit = params.limit ?? 50;
3620
+ if (limit === 0)
3621
+ return { objects: [], hasMore: offset < total, total };
3622
+ const orderBy = params.orderBy ?? "updatedAt";
3623
+ const order = params.order ?? "desc";
3624
+ rows.sort((left, right) => {
3625
+ const comparison = orderBy === "primaryId" ? left.primaryId.localeCompare(right.primaryId) : orderBy === "createdAt" ? left.createdAt.getTime() - right.createdAt.getTime() : left.updatedAt.getTime() - right.updatedAt.getTime();
3626
+ return order === "desc" ? -comparison : comparison;
3627
+ });
3628
+ const objects = rows.slice(offset, offset + limit).map((row) => structuredClone(row));
3629
+ return {
3630
+ objects,
3631
+ hasMore: offset + limit < total,
3632
+ total
3633
+ };
3634
+ }
3635
+
3636
+ // src/storage/objects/in-memory/storage.ts
2848
3637
  var materializerAdapters = new WeakMap;
2849
3638
  function getInMemoryObjectMaterializerAdapter(storage) {
2850
3639
  const adapter = materializerAdapters.get(storage);
@@ -2948,8 +3737,22 @@ class InMemoryObjectStorage {
2948
3737
  queryCapabilities() {
2949
3738
  return IN_MEMORY_OBJECT_QUERY_CAPABILITIES;
2950
3739
  }
3740
+ createSelectedReadScope(params) {
3741
+ return createInMemorySelectedReader(this.readSource(params.projectId), params, () => this.queryCapabilities());
3742
+ }
3743
+ readSource(projectId) {
3744
+ return {
3745
+ projectId,
3746
+ objectsOfType: (objectTypeId) => [
3747
+ ...this.rows.get(objectRowKey(projectId, objectTypeId))?.values() ?? []
3748
+ ],
3749
+ getObject: (objectTypeId, primaryId) => this.rows.get(objectRowKey(projectId, objectTypeId))?.get(primaryId),
3750
+ outgoingLinks: (objectTypeId, primaryId) => this.links.get(sourceLinkBucketKey(projectId, objectTypeId, primaryId))?.values() ?? [],
3751
+ allLinks: () => allLinkRows(this.links)
3752
+ };
3753
+ }
2951
3754
  async queryObjects(params) {
2952
- const result = this.evaluateObjectQuery(params.projectId, params.query);
3755
+ const result = evaluateObjectQuery(params.query, this.readSource(params.projectId));
2953
3756
  return {
2954
3757
  objects: result.entries.map((entry) => entry.row),
2955
3758
  hasMore: result.hasMore,
@@ -2959,203 +3762,29 @@ class InMemoryObjectStorage {
2959
3762
  }
2960
3763
  async countObjects(params) {
2961
3764
  return {
2962
- count: this.evaluateObjectQuery(params.projectId, stripOuterRowShape(params.query)).total
3765
+ count: evaluateObjectQuery(stripOuterRowShape(params.query), this.readSource(params.projectId)).total
2963
3766
  };
2964
3767
  }
2965
3768
  async existsObjects(params) {
2966
3769
  return {
2967
- exists: this.evaluateObjectQuery(params.projectId, stripOuterRowShape(params.query)).total > 0
3770
+ exists: evaluateObjectQuery(stripOuterRowShape(params.query), this.readSource(params.projectId)).total > 0
2968
3771
  };
2969
3772
  }
2970
3773
  async facetObjects(params) {
2971
- const result = this.evaluateObjectQuery(params.projectId, stripOuterRowShape(params.query));
3774
+ const result = evaluateObjectQuery(stripOuterRowShape(params.query), this.readSource(params.projectId));
2972
3775
  return {
2973
3776
  facets: buildFacetResults(result.entries.map((entry) => entry.row), params.facets)
2974
3777
  };
2975
3778
  }
2976
- evaluateObjectQuery(projectId, query) {
2977
- switch (query.kind) {
2978
- case "start":
2979
- return this.evaluateStart(projectId, query.objectTypeId);
2980
- case "refs":
2981
- return this.evaluateRefs(projectId, query.refs);
2982
- case "filter": {
2983
- const input = this.evaluateObjectQuery(projectId, query.input);
2984
- const entries = input.entries.filter((entry) => matchesPredicate(entry.row, query.predicate));
2985
- return completeEvaluation(entries);
2986
- }
2987
- case "text": {
2988
- const input = this.evaluateObjectQuery(projectId, query.input);
2989
- const scoredEntries = input.entries.flatMap((entry) => {
2990
- const score = textScore(entry.row, query.query, query.fields, query.fieldsByObjectType);
2991
- return score > 0 ? [{ ...entry, score: entry.score + score }] : [];
2992
- });
2993
- return completeEvaluation(scoredEntries);
2994
- }
2995
- case "vector": {
2996
- const input = this.evaluateObjectQuery(projectId, query.input);
2997
- const scoredEntries = input.entries.flatMap((entry) => {
2998
- const score = vectorSimilarity(entry.row.properties[query.propertyId], query.vector);
2999
- return score === null ? [] : [{ ...entry, score: entry.score + score }];
3000
- });
3001
- scoredEntries.sort(compareEntriesByRelevance);
3002
- const limit = Math.max(0, query.k);
3003
- return {
3004
- entries: scoredEntries.slice(0, limit),
3005
- total: scoredEntries.length,
3006
- hasMore: limit < scoredEntries.length
3007
- };
3008
- }
3009
- case "traverse": {
3010
- const input = this.evaluateObjectQuery(projectId, query.input);
3011
- const entries = query.direction === "outgoing" ? this.traverseOutgoing(projectId, input.entries, query.linkId) : this.traverseIncoming(projectId, input.entries, query.linkId, query.sourceObjectTypeId);
3012
- return completeEvaluation(entries);
3013
- }
3014
- case "set":
3015
- return this.evaluateSet(projectId, query.op, query.inputs);
3016
- case "sort": {
3017
- const input = this.evaluateObjectQuery(projectId, query.input);
3018
- return {
3019
- ...input,
3020
- entries: sortEntries(input.entries, query.fields)
3021
- };
3022
- }
3023
- case "limit": {
3024
- const input = this.evaluateObjectQuery(projectId, query.input);
3025
- const limit = Math.max(0, query.limit);
3026
- return {
3027
- entries: input.entries.slice(0, limit),
3028
- total: input.entries.length,
3029
- hasMore: limit < input.entries.length
3030
- };
3031
- }
3032
- case "page": {
3033
- const input = this.evaluateObjectQuery(projectId, query.input);
3034
- const offset = decodePageOffset(query.pageToken);
3035
- const pageSize = Math.max(0, query.pageSize);
3036
- const nextOffset = offset + pageSize;
3037
- const hasMore = pageSize > 0 && nextOffset < input.entries.length;
3038
- return {
3039
- entries: input.entries.slice(offset, nextOffset),
3040
- total: input.entries.length,
3041
- hasMore,
3042
- nextPageToken: hasMore ? encodePageOffset(nextOffset) : undefined
3043
- };
3044
- }
3045
- case "project": {
3046
- const input = this.evaluateObjectQuery(projectId, query.input);
3047
- if (!query.properties)
3048
- return input;
3049
- const properties = query.properties;
3050
- return {
3051
- ...input,
3052
- entries: input.entries.map((entry) => ({
3053
- ...entry,
3054
- row: projectRow(entry.row, properties)
3055
- }))
3056
- };
3057
- }
3058
- case "expand":
3059
- throw new Error("[Sixb] In-memory object storage does not support 'expand' execution yet");
3060
- }
3061
- }
3062
- evaluateStart(projectId, objectTypeId) {
3063
- const bucket = this.rows.get(objectRowKey(projectId, objectTypeId));
3064
- const entries = [...bucket?.values() ?? []].map((row, index) => ({
3065
- row,
3066
- score: 0,
3067
- order: index
3068
- }));
3069
- return completeEvaluation(entries);
3070
- }
3071
- evaluateRefs(projectId, refs) {
3072
- const seen = new Set;
3073
- const entries = refs.flatMap((ref) => {
3074
- const key2 = JSON.stringify([ref.objectTypeId, ref.primaryId]);
3075
- if (seen.has(key2))
3076
- return [];
3077
- seen.add(key2);
3078
- const row = this.rows.get(objectRowKey(projectId, ref.objectTypeId))?.get(ref.primaryId);
3079
- return row ? [row] : [];
3080
- }).sort((left, right) => compareStrings2(left.objectTypeId, right.objectTypeId) || compareStrings2(left.primaryId, right.primaryId)).map((row, order) => ({ row, score: 0, order }));
3081
- return completeEvaluation(entries);
3082
- }
3083
- evaluateSet(projectId, op, inputs) {
3084
- const evaluations = inputs.map((input) => this.evaluateObjectQuery(projectId, input));
3085
- const first = evaluations[0];
3086
- if (!first)
3087
- return completeEvaluation([]);
3088
- if (op === "union") {
3089
- const entriesByKey = new Map;
3090
- for (const evaluation of evaluations) {
3091
- for (const entry of evaluation.entries) {
3092
- upsertEntry(entriesByKey, entry);
3093
- }
3094
- }
3095
- return completeEvaluation([...entriesByKey.values()]);
3096
- }
3097
- if (op === "intersect") {
3098
- const otherKeySets = evaluations.slice(1).map((evaluation) => new Set(evaluation.entries.map((entry) => rowIdentityKey(entry.row))));
3099
- const entries = first.entries.filter((entry) => {
3100
- const key2 = rowIdentityKey(entry.row);
3101
- return otherKeySets.every((keys) => keys.has(key2));
3102
- });
3103
- return completeEvaluation(entries);
3104
- }
3105
- const subtractKeys = new Set(evaluations.slice(1).flatMap((evaluation) => evaluation.entries.map((entry) => rowIdentityKey(entry.row))));
3106
- return completeEvaluation(first.entries.filter((entry) => !subtractKeys.has(rowIdentityKey(entry.row))));
3107
- }
3108
- traverseOutgoing(projectId, entries, linkId) {
3109
- const resultsByKey = new Map;
3110
- entries.forEach((entry, index) => {
3111
- const bucket = this.links.get(sourceLinkBucketKey(projectId, entry.row.objectTypeId, entry.row.primaryId));
3112
- if (!bucket)
3113
- return;
3114
- for (const link of bucket.values()) {
3115
- if (link.linkId !== linkId)
3116
- continue;
3117
- const target = this.rows.get(objectRowKey(projectId, link.targetTypeId))?.get(link.targetId);
3118
- if (!target)
3119
- continue;
3120
- upsertEntry(resultsByKey, {
3121
- row: target,
3122
- score: entry.score,
3123
- order: entry.order + index / 1e6
3124
- });
3125
- }
3126
- });
3127
- return [...resultsByKey.values()];
3128
- }
3129
- traverseIncoming(projectId, entries, linkId, sourceObjectTypeId) {
3130
- const inputEntriesByTarget = new Map(entries.map((entry) => [rowIdentityKey(entry.row), entry]));
3131
- const resultsByKey = new Map;
3132
- for (const bucket of this.links.values()) {
3133
- for (const link of bucket.values()) {
3134
- if (link.projectId !== projectId || link.linkId !== linkId)
3135
- continue;
3136
- if (sourceObjectTypeId !== undefined && link.sourceTypeId !== sourceObjectTypeId)
3137
- continue;
3138
- const targetEntry = inputEntriesByTarget.get(rowIdentityKeyParts(link.targetTypeId, link.targetId));
3139
- if (!targetEntry)
3140
- continue;
3141
- const source = this.rows.get(objectRowKey(projectId, link.sourceTypeId))?.get(link.sourceId);
3142
- if (!source)
3143
- continue;
3144
- upsertEntry(resultsByKey, {
3145
- row: source,
3146
- score: targetEntry.score,
3147
- order: targetEntry.order
3148
- });
3149
- }
3150
- }
3151
- return [...resultsByKey.values()];
3152
- }
3153
3779
  async getByPrimaryId(params) {
3154
3780
  const bucket = this.rows.get(objectRowKey(params.projectId, params.objectTypeId));
3155
3781
  if (!bucket)
3156
3782
  return null;
3157
3783
  return bucket.get(params.primaryId) ?? null;
3158
3784
  }
3785
+ async selectsObjectProperties(params) {
3786
+ return params.items.map((item) => this.rows.get(objectRowKey(params.projectId, item.objectTypeId))?.has(item.primaryId) ?? false);
3787
+ }
3159
3788
  async listLinks(params) {
3160
3789
  const direction = params.direction ?? "outgoing";
3161
3790
  const matches = (row) => !params.linkId || row.linkId === params.linkId;
@@ -3180,401 +3809,140 @@ class InMemoryObjectStorage {
3180
3809
  }
3181
3810
  async getByPrimaryIdBatch(params) {
3182
3811
  const result = new Map;
3183
- for (const item of params.items) {
3184
- const row = await this.getByPrimaryId({
3185
- projectId: params.projectId,
3186
- objectTypeId: item.objectTypeId,
3187
- primaryId: item.primaryId
3188
- });
3189
- if (row) {
3190
- result.set(objectBatchKey(item.objectTypeId, item.primaryId), row);
3191
- }
3192
- }
3193
- return result;
3194
- }
3195
- async listLinksBatch(params) {
3196
- const result = new Map;
3197
- for (const item of params.items) {
3198
- const rows = await this.listLinks({
3199
- projectId: params.projectId,
3200
- objectTypeId: item.objectTypeId,
3201
- objectId: item.objectId,
3202
- linkId: item.linkId
3203
- });
3204
- if (rows.length > 0) {
3205
- result.set(linkBatchKey(item.objectTypeId, item.objectId, item.linkId), [...rows]);
3206
- }
3207
- }
3208
- return result;
3209
- }
3210
- async queryLinks(params) {
3211
- assertLinkQueryLimit(params.limit);
3212
- if (params.objectRefs.length === 0 || params.endpointObjectTypeIds?.length === 0) {
3213
- return { links: [], hasMore: false };
3214
- }
3215
- const allowedTypes = params.endpointObjectTypeIds ? new Set(params.endpointObjectTypeIds) : undefined;
3216
- const deduped = new Map;
3217
- for (const object of params.objectRefs) {
3218
- const rows2 = await this.listLinks({
3219
- projectId: params.projectId,
3220
- objectTypeId: object.objectTypeId,
3221
- objectId: object.primaryId,
3222
- direction: params.direction,
3223
- ...params.linkId === undefined ? {} : { linkId: params.linkId }
3224
- });
3225
- for (const row of rows2) {
3226
- if (allowedTypes && (!allowedTypes.has(row.sourceTypeId) || !allowedTypes.has(row.targetTypeId))) {
3227
- continue;
3228
- }
3229
- if (params.after && compareObjectLinkCursors(objectLinkCursor(row), params.after) <= 0) {
3230
- continue;
3231
- }
3232
- deduped.set(fullLinkRowKey(row), row);
3233
- }
3234
- }
3235
- const rows = [...deduped.values()].sort(compareObjectLinks).slice(0, params.limit + 1);
3236
- return { links: rows.slice(0, params.limit), hasMore: rows.length > params.limit };
3237
- }
3238
- async listIncidentLinksBatch(params) {
3239
- const deduped = new Map;
3240
- for (const item of params.items) {
3241
- const rows = await this.listLinks({
3242
- projectId: params.projectId,
3243
- objectTypeId: item.objectTypeId,
3244
- objectId: item.objectId,
3245
- direction: "both"
3246
- });
3247
- for (const row of rows) {
3248
- deduped.set(fullLinkRowKey(row), row);
3249
- }
3250
- }
3251
- return [...deduped.values()];
3252
- }
3253
- async listByPrimaryIdPage(params) {
3254
- assertReconciliationPageLimit(params.limit);
3255
- const bucket = this.rows.get(objectRowKey(params.projectId, params.objectTypeId));
3256
- const rows = [...bucket?.values() ?? []].filter((row) => !params.afterPrimaryId || compareStrings2(row.primaryId, params.afterPrimaryId) > 0).sort((left, right) => compareStrings2(left.primaryId, right.primaryId)).slice(0, params.limit + 1);
3257
- const hasMore = rows.length > params.limit;
3258
- const objects = rows.slice(0, params.limit).map((row) => structuredClone(row));
3259
- const last = objects.at(-1);
3260
- return {
3261
- objects,
3262
- ...hasMore && last ? { nextPrimaryId: last.primaryId } : {}
3263
- };
3264
- }
3265
- async list(params) {
3266
- let allRows = [];
3267
- if (params.objectTypeId) {
3268
- const typeIds = Array.isArray(params.objectTypeId) ? params.objectTypeId : [params.objectTypeId];
3269
- for (const typeId of typeIds) {
3270
- const bucket = this.rows.get(objectRowKey(params.projectId, typeId));
3271
- if (bucket) {
3272
- allRows.push(...bucket.values());
3273
- }
3274
- }
3275
- } else {
3276
- for (const [key2, bucket] of this.rows) {
3277
- if (key2.startsWith(objectRowProjectPrefix(params.projectId))) {
3278
- allRows.push(...bucket.values());
3279
- }
3280
- }
3281
- }
3282
- const {
3283
- primaryIdPrefix,
3284
- primaryIdSuffix,
3285
- updatedAfter,
3286
- updatedBefore,
3287
- createdAfter,
3288
- createdBefore
3289
- } = params;
3290
- if (primaryIdPrefix || primaryIdSuffix || updatedAfter || updatedBefore || createdAfter || createdBefore) {
3291
- allRows = allRows.filter((row) => (!primaryIdPrefix || row.primaryId.startsWith(primaryIdPrefix)) && (!primaryIdSuffix || row.primaryId.endsWith(primaryIdSuffix)) && (!updatedAfter || row.updatedAt >= updatedAfter) && (!updatedBefore || row.updatedAt <= updatedBefore) && (!createdAfter || row.createdAt >= createdAfter) && (!createdBefore || row.createdAt <= createdBefore));
3292
- }
3293
- const total = allRows.length;
3294
- const offset = params.offset ?? 0;
3295
- const limit = params.limit ?? 50;
3296
- if (limit === 0)
3297
- return { objects: [], hasMore: offset < total, total };
3298
- const orderBy = params.orderBy ?? "updatedAt";
3299
- const order = params.order ?? "desc";
3300
- allRows.sort((a, b) => {
3301
- let comparison = 0;
3302
- switch (orderBy) {
3303
- case "primaryId":
3304
- comparison = a.primaryId.localeCompare(b.primaryId);
3305
- break;
3306
- case "createdAt":
3307
- comparison = a.createdAt.getTime() - b.createdAt.getTime();
3308
- break;
3309
- default:
3310
- comparison = a.updatedAt.getTime() - b.updatedAt.getTime();
3311
- break;
3312
- }
3313
- return order === "desc" ? -comparison : comparison;
3314
- });
3315
- const objects = allRows.slice(offset, offset + limit);
3316
- const hasMore = offset + limit < total;
3317
- return { objects, hasMore, total };
3318
- }
3319
- deleteObjectRow(projectId, objectTypeId, primaryId) {
3320
- const bucket = this.rows.get(objectRowKey(projectId, objectTypeId));
3321
- bucket?.delete(primaryId);
3322
- }
3323
- deleteLinkRow(projectId, sourceTypeId, sourceId, linkId, targetTypeId, targetId) {
3324
- const bucket = this.links.get(sourceLinkBucketKey(projectId, sourceTypeId, sourceId));
3325
- bucket?.delete(linkRowKey(linkId, targetTypeId, targetId));
3326
- }
3327
- }
3328
- function assertReconciliationPageLimit(limit) {
3329
- if (!Number.isSafeInteger(limit) || limit <= 0) {
3330
- throw new Error("Object reconciliation page limit must be a positive safe integer.");
3331
- }
3332
- }
3333
- function cloneObjectBuckets(rows) {
3334
- const clone2 = new Map;
3335
- for (const [key2, bucket] of rows) {
3336
- clone2.set(key2, new Map([...bucket.entries()].map(([primaryId, row]) => [primaryId, structuredClone(row)])));
3337
- }
3338
- return clone2;
3339
- }
3340
- function cloneLinkBuckets(links) {
3341
- const clone2 = new Map;
3342
- for (const [key2, bucket] of links) {
3343
- clone2.set(key2, new Map([...bucket.entries()].map(([linkId, row]) => [linkId, structuredClone(row)])));
3344
- }
3345
- return clone2;
3346
- }
3347
- function completeEvaluation(entries) {
3348
- return {
3349
- entries,
3350
- total: entries.length,
3351
- hasMore: false
3352
- };
3353
- }
3354
- function matchesPredicate(row, predicate) {
3355
- switch (predicate.op) {
3356
- case "and":
3357
- return predicate.items.every((item) => matchesPredicate(row, item));
3358
- case "or":
3359
- return predicate.items.some((item) => matchesPredicate(row, item));
3360
- case "not":
3361
- return !matchesPredicate(row, predicate.item);
3362
- case "eq":
3363
- return queryScalarValuesEqual(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind);
3364
- case "neq":
3365
- return !queryScalarValuesEqual(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind);
3366
- case "lt":
3367
- return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) < 0;
3368
- case "lte":
3369
- return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) <= 0;
3370
- case "gt":
3371
- return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) > 0;
3372
- case "gte":
3373
- return compareQueryScalarValues(row.properties[predicate.propertyId], predicate.value, predicate.scalarKind) >= 0;
3374
- case "in":
3375
- return predicate.values.some((value) => queryScalarValuesEqual(row.properties[predicate.propertyId], value, predicate.scalarKind));
3376
- case "exists": {
3377
- const exists = Object.hasOwn(row.properties, predicate.propertyId) && row.properties[predicate.propertyId] !== undefined;
3378
- return predicate.value ? exists : !exists;
3379
- }
3380
- case "contains":
3381
- return containsValue(row.properties[predicate.propertyId], predicate.value);
3382
- }
3383
- }
3384
- function containsValue(actual, expected) {
3385
- if (typeof actual === "string" && typeof expected === "string") {
3386
- return actual.includes(expected);
3387
- }
3388
- if (Array.isArray(actual)) {
3389
- return actual.some((item) => queryScalarValuesEqual(item, expected));
3390
- }
3391
- if (isPlainObject(actual) && typeof expected === "string") {
3392
- return Object.hasOwn(actual, expected);
3393
- }
3394
- return false;
3395
- }
3396
- function textScore(row, query, fields, fieldsByObjectType) {
3397
- const terms = tokenize(query);
3398
- if (terms.length === 0)
3399
- return 0;
3400
- const scopedFields = fields ?? fieldsByObjectType?.[row.objectTypeId];
3401
- const values = fields ? fields.flatMap((field) => collectTextValues(row.properties[field])) : scopedFields ? scopedFields.flatMap((field) => collectTextValues(row.properties[field])) : [row.primaryId, ...Object.values(row.properties).flatMap(collectTextValues)];
3402
- const haystack = values.join(" ").toLowerCase();
3403
- if (!terms.every((term) => haystack.includes(term)))
3404
- return 0;
3405
- const phrase = query.trim().toLowerCase();
3406
- const phraseBoost = phrase.length > 0 && haystack.includes(phrase) ? terms.length : 0;
3407
- return terms.reduce((score, term) => score + countOccurrences(haystack, term), phraseBoost);
3408
- }
3409
- function tokenize(query) {
3410
- return query.trim().toLowerCase().split(/\s+/).filter((term) => term.length > 0);
3411
- }
3412
- function collectTextValues(value) {
3413
- if (typeof value === "string")
3414
- return [value];
3415
- if (Array.isArray(value))
3416
- return value.flatMap(collectTextValues);
3417
- return [];
3418
- }
3419
- function countOccurrences(value, needle) {
3420
- if (!needle)
3421
- return 0;
3422
- let count = 0;
3423
- let index = value.indexOf(needle);
3424
- while (index !== -1) {
3425
- count += 1;
3426
- index = value.indexOf(needle, index + needle.length);
3427
- }
3428
- return count;
3429
- }
3430
- function vectorSimilarity(actual, expected) {
3431
- if (!Array.isArray(actual) || actual.length !== expected.length || actual.length === 0) {
3432
- return null;
3433
- }
3434
- let dot = 0;
3435
- let actualNorm = 0;
3436
- let expectedNorm = 0;
3437
- for (let index = 0;index < expected.length; index += 1) {
3438
- const actualValue = actual[index];
3439
- const expectedValue = expected[index];
3440
- if (typeof actualValue !== "number" || typeof expectedValue !== "number" || !Number.isFinite(actualValue) || !Number.isFinite(expectedValue)) {
3441
- return null;
3442
- }
3443
- dot += actualValue * expectedValue;
3444
- actualNorm += actualValue * actualValue;
3445
- expectedNorm += expectedValue * expectedValue;
3446
- }
3447
- if (actualNorm === 0 || expectedNorm === 0)
3448
- return null;
3449
- return dot / (Math.sqrt(actualNorm) * Math.sqrt(expectedNorm));
3450
- }
3451
- function sortEntries(entries, fields) {
3452
- return [...entries].sort((left, right) => {
3453
- for (const field of fields) {
3454
- const comparison = compareSortField(left, right, field);
3455
- if (comparison !== 0)
3456
- return comparison;
3812
+ for (const item of params.items) {
3813
+ const row = await this.getByPrimaryId({
3814
+ projectId: params.projectId,
3815
+ objectTypeId: item.objectTypeId,
3816
+ primaryId: item.primaryId
3817
+ });
3818
+ if (row) {
3819
+ result.set(objectBatchKey(item.objectTypeId, item.primaryId), row);
3820
+ }
3457
3821
  }
3458
- return left.order - right.order || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row));
3459
- });
3460
- }
3461
- function compareSortField(left, right, field) {
3462
- if (field.kind === "relevance") {
3463
- const direction = field.direction ?? "desc";
3464
- const comparison2 = right.score - left.score;
3465
- return direction === "desc" ? comparison2 : -comparison2;
3822
+ return result;
3466
3823
  }
3467
- const leftValue = left.row.properties[field.propertyId];
3468
- const rightValue = right.row.properties[field.propertyId];
3469
- const leftMissing = leftValue === undefined || leftValue === null;
3470
- const rightMissing = rightValue === undefined || rightValue === null;
3471
- if (leftMissing && rightMissing)
3472
- return 0;
3473
- if (leftMissing)
3474
- return 1;
3475
- if (rightMissing)
3476
- return -1;
3477
- const comparison = compareQueryScalarValues(leftValue, rightValue, field.scalarKind);
3478
- if (Number.isNaN(comparison))
3479
- return 0;
3480
- return field.direction === "desc" ? -comparison : comparison;
3481
- }
3482
- function compareEntriesByRelevance(left, right) {
3483
- return right.score - left.score || rowIdentityKey(left.row).localeCompare(rowIdentityKey(right.row));
3484
- }
3485
- function projectRow(row, properties) {
3486
- const projected = {};
3487
- for (const propertyId of properties) {
3488
- if (Object.hasOwn(row.properties, propertyId)) {
3489
- projected[propertyId] = row.properties[propertyId];
3824
+ async listLinksBatch(params) {
3825
+ return collectLinksBatch({
3826
+ all: () => allLinkRows(this.links),
3827
+ outgoing: (item) => this.links.get(sourceLinkBucketKey(params.projectId, item.objectTypeId, item.objectId))?.values() ?? []
3828
+ }, params, false);
3829
+ }
3830
+ async queryLinks(params) {
3831
+ return queryLinksFrom(params, (input) => this.listLinks(input));
3832
+ }
3833
+ async listIncidentLinksBatch(params) {
3834
+ const deduped = new Map;
3835
+ for (const item of params.items) {
3836
+ const rows = await this.listLinks({
3837
+ projectId: params.projectId,
3838
+ objectTypeId: item.objectTypeId,
3839
+ objectId: item.objectId,
3840
+ direction: "both"
3841
+ });
3842
+ for (const row of rows) {
3843
+ deduped.set(fullLinkRowKey(row), row);
3844
+ }
3490
3845
  }
3846
+ return [...deduped.values()];
3491
3847
  }
3492
- return {
3493
- ...row,
3494
- properties: projected
3495
- };
3496
- }
3497
- function stripOuterRowShape(query) {
3498
- switch (query.kind) {
3499
- case "limit":
3500
- case "page":
3501
- case "project":
3502
- case "sort":
3503
- case "expand":
3504
- return stripOuterRowShape(query.input);
3505
- default:
3506
- return query;
3848
+ async listByPrimaryIdPage(params) {
3849
+ assertReconciliationPageLimit(params.limit);
3850
+ const bucket = this.rows.get(objectRowKey(params.projectId, params.objectTypeId));
3851
+ const rows = [...bucket?.values() ?? []].filter((row) => !params.afterPrimaryId || compareStrings(row.primaryId, params.afterPrimaryId) > 0).sort((left, right) => compareStrings(left.primaryId, right.primaryId)).slice(0, params.limit + 1);
3852
+ const hasMore = rows.length > params.limit;
3853
+ const objects = rows.slice(0, params.limit).map((row) => structuredClone(row));
3854
+ const last = objects.at(-1);
3855
+ return {
3856
+ objects,
3857
+ ...hasMore && last ? { nextPrimaryId: last.primaryId } : {}
3858
+ };
3507
3859
  }
3508
- }
3509
- function buildFacetResults(rows, facets) {
3510
- return facets.map((facet) => ({
3511
- propertyId: facet.propertyId,
3512
- buckets: buildFacetBuckets(rows, facet)
3513
- }));
3514
- }
3515
- function buildFacetBuckets(rows, facet) {
3516
- const buckets = new Map;
3517
- for (const row of rows) {
3518
- if (!Object.hasOwn(row.properties, facet.propertyId))
3519
- continue;
3520
- const value = row.properties[facet.propertyId];
3521
- if (value === undefined)
3522
- continue;
3523
- const key2 = facetValueKey(value);
3524
- const existing = buckets.get(key2);
3525
- if (existing) {
3526
- existing.count += 1;
3860
+ async list(params) {
3861
+ let allRows = [];
3862
+ if (params.objectTypeId) {
3863
+ const typeIds = Array.isArray(params.objectTypeId) ? params.objectTypeId : [params.objectTypeId];
3864
+ for (const typeId of typeIds) {
3865
+ const bucket = this.rows.get(objectRowKey(params.projectId, typeId));
3866
+ if (bucket) {
3867
+ allRows.push(...bucket.values());
3868
+ }
3869
+ }
3527
3870
  } else {
3528
- buckets.set(key2, { value, count: 1 });
3871
+ for (const [key2, bucket] of this.rows) {
3872
+ if (key2.startsWith(objectRowProjectPrefix(params.projectId))) {
3873
+ allRows.push(...bucket.values());
3874
+ }
3875
+ }
3876
+ }
3877
+ const {
3878
+ primaryIdPrefix,
3879
+ primaryIdSuffix,
3880
+ updatedAfter,
3881
+ updatedBefore,
3882
+ createdAfter,
3883
+ createdBefore
3884
+ } = params;
3885
+ if (primaryIdPrefix || primaryIdSuffix || updatedAfter || updatedBefore || createdAfter || createdBefore) {
3886
+ allRows = allRows.filter((row) => (!primaryIdPrefix || row.primaryId.startsWith(primaryIdPrefix)) && (!primaryIdSuffix || row.primaryId.endsWith(primaryIdSuffix)) && (!updatedAfter || row.updatedAt >= updatedAfter) && (!updatedBefore || row.updatedAt <= updatedBefore) && (!createdAfter || row.createdAt >= createdAfter) && (!createdBefore || row.createdAt <= createdBefore));
3529
3887
  }
3888
+ const total = allRows.length;
3889
+ const offset = params.offset ?? 0;
3890
+ const limit = params.limit ?? 50;
3891
+ if (limit === 0)
3892
+ return { objects: [], hasMore: offset < total, total };
3893
+ const orderBy = params.orderBy ?? "updatedAt";
3894
+ const order = params.order ?? "desc";
3895
+ allRows.sort((a, b) => {
3896
+ let comparison = 0;
3897
+ switch (orderBy) {
3898
+ case "primaryId":
3899
+ comparison = a.primaryId.localeCompare(b.primaryId);
3900
+ break;
3901
+ case "createdAt":
3902
+ comparison = a.createdAt.getTime() - b.createdAt.getTime();
3903
+ break;
3904
+ default:
3905
+ comparison = a.updatedAt.getTime() - b.updatedAt.getTime();
3906
+ break;
3907
+ }
3908
+ return order === "desc" ? -comparison : comparison;
3909
+ });
3910
+ const objects = allRows.slice(offset, offset + limit);
3911
+ const hasMore = offset + limit < total;
3912
+ return { objects, hasMore, total };
3530
3913
  }
3531
- return [...buckets.values()].sort((left, right) => right.count - left.count || facetValueSortKey(left.value).localeCompare(facetValueSortKey(right.value))).slice(0, facet.limit);
3532
- }
3533
- function facetValueKey(value) {
3534
- return JSON.stringify(value) ?? String(value);
3535
- }
3536
- function facetValueSortKey(value) {
3537
- return JSON.stringify(value) ?? String(value);
3538
- }
3539
- function rowIdentityKey(row) {
3540
- return rowIdentityKeyParts(row.objectTypeId, row.primaryId);
3541
- }
3542
- function rowIdentityKeyParts(objectTypeId, primaryId) {
3543
- return objectBatchKey(objectTypeId, primaryId);
3544
- }
3545
- function upsertEntry(entriesByKey, entry) {
3546
- const key2 = rowIdentityKey(entry.row);
3547
- const existing = entriesByKey.get(key2);
3548
- if (!existing) {
3549
- entriesByKey.set(key2, entry);
3550
- return;
3914
+ deleteObjectRow(projectId, objectTypeId, primaryId) {
3915
+ const bucket = this.rows.get(objectRowKey(projectId, objectTypeId));
3916
+ bucket?.delete(primaryId);
3551
3917
  }
3552
- if (entry.score > existing.score) {
3553
- entriesByKey.set(key2, {
3554
- ...existing,
3555
- score: entry.score
3556
- });
3918
+ deleteLinkRow(projectId, sourceTypeId, sourceId, linkId, targetTypeId, targetId) {
3919
+ const bucket = this.links.get(sourceLinkBucketKey(projectId, sourceTypeId, sourceId));
3920
+ bucket?.delete(linkRowKey(linkId, targetTypeId, targetId));
3557
3921
  }
3558
3922
  }
3559
- function encodePageOffset(offset) {
3560
- return `${PAGE_TOKEN_PREFIX}${offset}`;
3923
+ function assertReconciliationPageLimit(limit) {
3924
+ if (!Number.isSafeInteger(limit) || limit <= 0) {
3925
+ throw new Error("Object reconciliation page limit must be a positive safe integer.");
3926
+ }
3561
3927
  }
3562
- function decodePageOffset(token) {
3563
- if (!token)
3564
- return 0;
3565
- if (!token.startsWith(PAGE_TOKEN_PREFIX)) {
3566
- throw new Error("[Sixb] Invalid object query page token");
3928
+ function cloneObjectBuckets(rows) {
3929
+ const clone2 = new Map;
3930
+ for (const [key2, bucket] of rows) {
3931
+ clone2.set(key2, new Map([...bucket.entries()].map(([primaryId, row]) => [primaryId, structuredClone(row)])));
3567
3932
  }
3568
- const offset = Number(token.slice(PAGE_TOKEN_PREFIX.length));
3569
- if (!Number.isInteger(offset) || offset < 0) {
3570
- throw new Error("[Sixb] Invalid object query page token");
3933
+ return clone2;
3934
+ }
3935
+ function cloneLinkBuckets(links) {
3936
+ const clone2 = new Map;
3937
+ for (const [key2, bucket] of links) {
3938
+ clone2.set(key2, new Map([...bucket.entries()].map(([linkId, row]) => [linkId, structuredClone(row)])));
3571
3939
  }
3572
- return offset;
3940
+ return clone2;
3573
3941
  }
3574
- function isPlainObject(value) {
3575
- return typeof value === "object" && value !== null && !Array.isArray(value);
3942
+ function* allLinkRows(buckets) {
3943
+ for (const bucket of buckets.values())
3944
+ yield* bucket.values();
3576
3945
  }
3577
-
3578
3946
  // src/storage/ontology/in-memory/shared-state.ts
3579
3947
  function createInMemoryOntologyState() {
3580
3948
  return {
@@ -6319,6 +6687,129 @@ class InMemoryRulesStorage {
6319
6687
  }
6320
6688
  }
6321
6689
  }
6690
+ // src/storage/share-grants/in-memory.ts
6691
+ class InMemoryShareGrantStorage {
6692
+ rows = new Map;
6693
+ async create(input) {
6694
+ const record = normalizeShareGrantCreate(input);
6695
+ const key2 = rowKey(record.projectId, record.id);
6696
+ const duplicateTokenHash = [...this.rows.values()].some((current) => current.projectId === record.projectId && current.tokenHash === record.tokenHash);
6697
+ if (this.rows.has(key2) || duplicateTokenHash) {
6698
+ throw new ShareGrantStorageError("duplicate", `[Sixb] Share grant '${record.id}' conflicts with an existing record.`);
6699
+ }
6700
+ this.rows.set(key2, record);
6701
+ return cloneShareGrantRecord(record);
6702
+ }
6703
+ async getById(input) {
6704
+ const normalized = normalizeGetShareGrantByIdInput(input);
6705
+ const record = this.rows.get(rowKey(normalized.projectId, normalized.id));
6706
+ return record ? cloneShareGrantRecord(record) : null;
6707
+ }
6708
+ async list(input) {
6709
+ const normalized = normalizeListShareGrantsInput(input);
6710
+ const matching = [...this.rows.values()].filter((record) => record.projectId === normalized.projectId && (normalized.definitionId === undefined || record.definitionId === normalized.definitionId) && (normalized.target === undefined || record.target.objectTypeId === normalized.target.objectTypeId && record.target.primaryId === normalized.target.primaryId) && (normalized.includeRevoked || record.revokedAt === undefined) && (normalized.includeExpired || record.expiresAt.getTime() > normalized.now.getTime())).sort(compareShareGrants);
6711
+ const total = matching.length;
6712
+ const grants = matching.slice(normalized.offset, normalized.offset + normalized.limit).map(cloneShareGrantRecord);
6713
+ return {
6714
+ grants,
6715
+ total,
6716
+ hasMore: normalized.offset + grants.length < total
6717
+ };
6718
+ }
6719
+ async revoke(input) {
6720
+ const normalized = normalizeRevokeShareGrantInput(input);
6721
+ const key2 = rowKey(normalized.projectId, normalized.id);
6722
+ const current = this.rows.get(key2);
6723
+ if (!current)
6724
+ return null;
6725
+ if (current.revokedAt)
6726
+ return cloneShareGrantRecord(current);
6727
+ const revocation = normalizeRevokeShareGrantInput(normalized, current.createdAt);
6728
+ const updated = {
6729
+ ...current,
6730
+ revokedAt: new Date(revocation.revokedAt),
6731
+ revokedBy: { ...revocation.revokedBy }
6732
+ };
6733
+ this.rows.set(key2, updated);
6734
+ return cloneShareGrantRecord(updated);
6735
+ }
6736
+ snapshot() {
6737
+ return new Map([...this.rows].map(([key2, record]) => [key2, cloneShareGrantRecord(record)]));
6738
+ }
6739
+ restore(snapshot) {
6740
+ this.rows = new Map([...snapshot].map(([key2, record]) => [key2, parseShareGrantRecord(record)]));
6741
+ }
6742
+ }
6743
+ function compareShareGrants(left, right) {
6744
+ const created = right.createdAt.getTime() - left.createdAt.getTime();
6745
+ if (created !== 0)
6746
+ return created;
6747
+ return left.id === right.id ? 0 : left.id < right.id ? 1 : -1;
6748
+ }
6749
+ function rowKey(projectId, id) {
6750
+ return `${projectId}\x00${id}`;
6751
+ }
6752
+ // src/storage/share-sessions/in-memory.ts
6753
+ class InMemoryShareSessionStorage {
6754
+ grants;
6755
+ rows = new Map;
6756
+ constructor(grants) {
6757
+ this.grants = grants;
6758
+ }
6759
+ async create(input) {
6760
+ const record = normalizeShareSessionCreate(input);
6761
+ const grant = await this.grants.getById({ projectId: record.projectId, id: record.grantId });
6762
+ if (!grant) {
6763
+ throw new ShareSessionStorageError("invalid_input", `[Sixb] Share grant '${record.grantId}' does not exist in project '${record.projectId}'.`);
6764
+ }
6765
+ const key2 = rowKey2(record.projectId, record.id);
6766
+ const duplicateTokenHash = [...this.rows.values()].some((current) => current.projectId === record.projectId && current.tokenHash === record.tokenHash);
6767
+ if (this.rows.has(key2) || duplicateTokenHash) {
6768
+ throw new ShareSessionStorageError("duplicate", `[Sixb] Share session '${record.id}' conflicts with an existing record.`);
6769
+ }
6770
+ this.rows.set(key2, record);
6771
+ return cloneShareSessionRecord(record);
6772
+ }
6773
+ async getById(input) {
6774
+ const normalized = normalizeGetShareSessionByIdInput(input);
6775
+ const record = this.rows.get(rowKey2(normalized.projectId, normalized.id));
6776
+ return record ? cloneShareSessionRecord(record) : null;
6777
+ }
6778
+ async renewIfValid(input) {
6779
+ const normalized = normalizeRenewShareSessionIfValidInput(input);
6780
+ const key2 = rowKey2(normalized.projectId, normalized.id);
6781
+ const current = this.rows.get(key2);
6782
+ if (!current || current.grantId !== normalized.grantId || current.tokenHash !== normalized.tokenHash || current.revokedAt !== undefined || current.createdAt.getTime() > normalized.now.getTime() || current.expiresAt.getTime() <= normalized.now.getTime() || current.absoluteExpiresAt.getTime() <= normalized.now.getTime()) {
6783
+ return null;
6784
+ }
6785
+ const nextExpiry = Math.min(current.absoluteExpiresAt.getTime(), Math.max(current.expiresAt.getTime(), normalized.expiresAt.getTime()));
6786
+ const updated = { ...current, expiresAt: new Date(nextExpiry) };
6787
+ this.rows.set(key2, updated);
6788
+ return cloneShareSessionRecord(updated);
6789
+ }
6790
+ async revoke(input) {
6791
+ const normalized = normalizeRevokeShareSessionInput(input);
6792
+ const key2 = rowKey2(normalized.projectId, normalized.id);
6793
+ const current = this.rows.get(key2);
6794
+ if (!current)
6795
+ return null;
6796
+ if (current.revokedAt)
6797
+ return cloneShareSessionRecord(current);
6798
+ const revocation = normalizeRevokeShareSessionInput(normalized, current.createdAt);
6799
+ const updated = { ...current, revokedAt: new Date(revocation.revokedAt) };
6800
+ this.rows.set(key2, updated);
6801
+ return cloneShareSessionRecord(updated);
6802
+ }
6803
+ snapshot() {
6804
+ return new Map([...this.rows].map(([key2, record]) => [key2, cloneShareSessionRecord(record)]));
6805
+ }
6806
+ restore(snapshot) {
6807
+ this.rows = new Map([...snapshot].map(([key2, record]) => [key2, parseShareSessionRecord(record)]));
6808
+ }
6809
+ }
6810
+ function rowKey2(projectId, id) {
6811
+ return `${projectId}\x00${id}`;
6812
+ }
6322
6813
  // src/storage/sync-runs/idempotency.ts
6323
6814
  function canRequeueSyncRunAfterEnqueueFailure(existing, input) {
6324
6815
  return existing.status === "failed" && existing.error?.code === "queue.enqueue_failed" && existing.error.retryable && existing.executionId === input.executionId && existing.syncId === input.syncId && existing.datasetId === input.datasetId && existing.mode === input.mode && existing.expectedLatestVersionId === input.expectedLatestVersionId && existing.commitMessage === input.commitMessage;
@@ -6501,6 +6992,13 @@ class InMemorySyncRunStorage {
6501
6992
  // src/storage/transaction.ts
6502
6993
  function createTransactionStorageProxy(target, isActive) {
6503
6994
  const proxies = new WeakMap;
6995
+ const objectStorage = createObjectOperationScope(target.objects, {
6996
+ assertAvailable: () => assertTransactionActive(isActive),
6997
+ run: async (operation) => {
6998
+ assertTransactionActive(isActive);
6999
+ return operation();
7000
+ }
7001
+ });
6504
7002
  const wrap = (value) => {
6505
7003
  const existing = proxies.get(value);
6506
7004
  if (existing)
@@ -6508,7 +7006,7 @@ function createTransactionStorageProxy(target, isActive) {
6508
7006
  const proxy = new Proxy(value, {
6509
7007
  get(current, property, receiver) {
6510
7008
  assertTransactionActive(isActive);
6511
- const result = Reflect.get(current, property, receiver);
7009
+ const result = current === target && property === "objects" ? objectStorage : Reflect.get(current, property, receiver);
6512
7010
  if (typeof result === "function") {
6513
7011
  return (...args) => {
6514
7012
  assertTransactionActive(isActive);
@@ -7341,7 +7839,11 @@ class InMemoryStorage {
7341
7839
  timeseriesStorage = new InMemoryTimeseriesStorage;
7342
7840
  ontologyStorage;
7343
7841
  authStorage = new InMemoryAuthStorage;
7344
- executionStorage = new InMemoryExecutionStorage(this.authStorage);
7842
+ shareGrantStorage = new InMemoryShareGrantStorage;
7843
+ shareSessionStorage = new InMemoryShareSessionStorage(this.shareGrantStorage);
7844
+ executionStorage = new InMemoryExecutionStorage(this.authStorage, {
7845
+ shareSessions: this.shareSessionStorage
7846
+ });
7345
7847
  agentStorage = new InMemoryAgentStorage(this.executionStorage);
7346
7848
  aiUsageStorage = new InMemoryAiUsageStorage(this.executionStorage);
7347
7849
  aiCostStorage = new InMemoryAiCostStorage(this.aiUsageStorage, {
@@ -7397,12 +7899,14 @@ class InMemoryStorage {
7397
7899
  workflowInterventions;
7398
7900
  webhookRuns;
7399
7901
  rules;
7902
+ shareGrants;
7903
+ shareSessions;
7400
7904
  fileUploadSessions;
7401
7905
  connectorConnections;
7402
7906
  constructor(options = {}) {
7403
7907
  this.connectorConnectionStorage = new InMemoryConnectorConnectionStorage(options.connectorConnections);
7404
7908
  const scope = createStorageOperationScope((run) => this.withStorageOperation(run), () => this.assertRootOperationAvailable());
7405
- this.objects = createOperationScopedFacade(this.objectStorage, scope);
7909
+ this.objects = createObjectOperationScope(this.objectStorage, scope);
7406
7910
  this.timeseries = createOperationScopedFacade(this.timeseriesStorage, scope);
7407
7911
  this.auth = createAuthOperationScope(this.authStorage, scope);
7408
7912
  this.executions = createOperationScopedFacade(this.executionStorage, scope);
@@ -7418,6 +7922,8 @@ class InMemoryStorage {
7418
7922
  this.workflowInterventions = createOperationScopedFacade(this.workflowInterventionStorage, scope);
7419
7923
  this.webhookRuns = createOperationScopedFacade(this.webhookRunStorage, scope);
7420
7924
  this.rules = createOperationScopedFacade(this.rulesStorage, scope);
7925
+ this.shareGrants = createOperationScopedFacade(this.shareGrantStorage, scope);
7926
+ this.shareSessions = createOperationScopedFacade(this.shareSessionStorage, scope);
7421
7927
  this.fileUploadSessions = createOperationScopedFacade(this.fileUploadSessionStorage, scope);
7422
7928
  this.connectorConnections = createOperationScopedFacade(this.connectorConnectionStorage, scope);
7423
7929
  this.ontologyStorage = new InMemoryOntologyStorage(this.objectStorage, this.timeseriesStorage, {
@@ -7572,6 +8078,8 @@ class InMemoryStorage {
7572
8078
  workflowInterventions: this.workflowInterventionStorage,
7573
8079
  webhookRuns: this.webhookRunStorage,
7574
8080
  rules: this.rulesStorage,
8081
+ shareGrants: this.shareGrantStorage,
8082
+ shareSessions: this.shareSessionStorage,
7575
8083
  fileUploadSessions: this.fileUploadSessionStorage,
7576
8084
  connectorConnections: this.connectorConnectionStorage,
7577
8085
  ping: async () => {
@@ -7601,6 +8109,8 @@ class InMemoryStorage {
7601
8109
  workflowInterventions: this.workflowInterventionStorage.snapshot(),
7602
8110
  webhookRuns: this.webhookRunStorage.snapshot(),
7603
8111
  rules: this.rulesStorage.snapshot(),
8112
+ shareGrants: this.shareGrantStorage.snapshot(),
8113
+ shareSessions: this.shareSessionStorage.snapshot(),
7604
8114
  fileUploadSessions: this.fileUploadSessionStorage.snapshot(),
7605
8115
  connectorConnections: this.connectorConnectionStorage.snapshot()
7606
8116
  };
@@ -7623,6 +8133,8 @@ class InMemoryStorage {
7623
8133
  this.workflowInterventionStorage.restore(snapshot.workflowInterventions);
7624
8134
  this.webhookRunStorage.restore(snapshot.webhookRuns);
7625
8135
  this.rulesStorage.restore(snapshot.rules);
8136
+ this.shareGrantStorage.restore(snapshot.shareGrants);
8137
+ this.shareSessionStorage.restore(snapshot.shareSessions);
7626
8138
  this.fileUploadSessionStorage.restore(snapshot.fileUploadSessions);
7627
8139
  this.connectorConnectionStorage.restore(snapshot.connectorConnections);
7628
8140
  }
@@ -7836,6 +8348,6 @@ function assertAppliedPrefix(migrations, rows) {
7836
8348
  }
7837
8349
  return [...rows].sort((a, b) => a.version - b.version);
7838
8350
  }
7839
- export { actionSubjectsEqual, actionRunParamsEqual, actionRunPhaseRecordsEqual, finishActionRunPhase, canRequeueActionRunAfterEnqueueFailure, isTerminalActionRun, InMemoryActionRunStorage, AGENT_MESSAGE_CONTENT_VERSION, InMemoryAgentStorage, AiCostStorageError, InMemoryAiCostStorage, InMemoryAiLimitStorage, InMemoryConnectorConnectionStorage, ObjectNotFoundError, ObjectStorageError, StorageTransactionError, isStorageSerializationFailure, FileUploadSessionError, DEFAULT_FILE_UPLOAD_SESSION_TTL_MS, DEFAULT_FILE_UPLOAD_TERMINAL_SESSION_TTL_MS, createUploadExpiresAt, createFileUploadId, InMemoryFileUploadSessions, compareQueryScalarValues, queryScalarValuesEqual, objectBatchKey, linkBatchKey, objectLinkCursor, canRequeuePipelineRunAfterEnqueueFailure, PIPELINE_RUN_FAILURE_CODES, InMemoryPipelineRunStorage, InMemoryProjectionRunStorage, InMemoryRulesStorage, canRequeueSyncRunAfterEnqueueFailure, SYNC_RUN_FAILURE_CODES, InMemorySyncRunStorage, createTransactionStorageProxy, assertTransactionActive, throwNestedStorageTransaction, WEBHOOK_RUN_FAILURE_CODES, canRetryWebhookRun, InMemoryWebhookRunStorage, WorkflowInterventionError, InMemoryWorkflowInterventionStorage, WORKFLOW_RUN_FAILURE_CODES, InMemoryWorkflowRunStorage, InMemoryWorkflowNodeRunStorage, InMemoryWorkflowAgentNodeRunStorage, InMemoryStorage, isMigrationCapableStorage, migrateStorage, checkStorageSchema, step, defineMigrations, runMigrationSet, describeMigrationHistory };
8351
+ export { actionSubjectsEqual, actionRunParamsEqual, actionRunPhaseRecordsEqual, finishActionRunPhase, canRequeueActionRunAfterEnqueueFailure, isTerminalActionRun, InMemoryActionRunStorage, AGENT_MESSAGE_CONTENT_VERSION, InMemoryAgentStorage, AiCostStorageError, InMemoryAiCostStorage, InMemoryAiLimitStorage, InMemoryConnectorConnectionStorage, ObjectNotFoundError, ObjectStorageError, StorageTransactionError, isStorageSerializationFailure, FileUploadSessionError, DEFAULT_FILE_UPLOAD_SESSION_TTL_MS, DEFAULT_FILE_UPLOAD_TERMINAL_SESSION_TTL_MS, createUploadExpiresAt, createFileUploadId, InMemoryFileUploadSessions, objectBatchKey, linkBatchKey, objectLinkCursor, compareQueryScalarValues, queryScalarValuesEqual, canRequeuePipelineRunAfterEnqueueFailure, PIPELINE_RUN_FAILURE_CODES, InMemoryPipelineRunStorage, InMemoryProjectionRunStorage, InMemoryRulesStorage, InMemoryShareGrantStorage, InMemoryShareSessionStorage, canRequeueSyncRunAfterEnqueueFailure, SYNC_RUN_FAILURE_CODES, InMemorySyncRunStorage, createTransactionStorageProxy, assertTransactionActive, throwNestedStorageTransaction, WEBHOOK_RUN_FAILURE_CODES, canRetryWebhookRun, InMemoryWebhookRunStorage, WorkflowInterventionError, InMemoryWorkflowInterventionStorage, WORKFLOW_RUN_FAILURE_CODES, InMemoryWorkflowRunStorage, InMemoryWorkflowNodeRunStorage, InMemoryWorkflowAgentNodeRunStorage, InMemoryStorage, isMigrationCapableStorage, migrateStorage, checkStorageSchema, step, defineMigrations, runMigrationSet, describeMigrationHistory };
7840
8352
 
7841
- //# debugId=472382EF0F10AB3864756E2164756E21
8353
+ //# debugId=904203AAAA1BC24E64756E2164756E21