@astrale-os/kernel-client 0.5.1 → 0.6.0-beta.10

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 (661) hide show
  1. package/dist/auth/auth.d.ts +18 -0
  2. package/dist/auth/auth.js +15 -0
  3. package/dist/auth/authorization.d.ts +13 -0
  4. package/dist/auth/authorization.js +17 -0
  5. package/dist/auth/credential.d.ts +19 -0
  6. package/dist/auth/credential.js +21 -0
  7. package/dist/auth/identity.d.ts +14 -0
  8. package/dist/auth/identity.js +15 -0
  9. package/dist/auth/index.d.ts +6 -16
  10. package/dist/auth/index.js +5 -10
  11. package/dist/auth/provision.d.ts +8 -0
  12. package/dist/auth/provision.js +10 -0
  13. package/dist/client/admission.d.ts +4 -0
  14. package/dist/client/admission.js +34 -0
  15. package/dist/client/client.d.ts +24 -109
  16. package/dist/client/client.js +80 -381
  17. package/dist/client/credential.d.ts +12 -0
  18. package/dist/client/credential.js +51 -0
  19. package/dist/client/index.d.ts +6 -0
  20. package/dist/client/index.js +4 -0
  21. package/dist/client/request.d.ts +26 -0
  22. package/dist/client/request.js +100 -0
  23. package/dist/client/result.d.ts +35 -0
  24. package/dist/client/result.js +28 -0
  25. package/dist/client/routing-control.d.ts +10 -0
  26. package/dist/client/routing-control.js +23 -0
  27. package/dist/errors/client-error.d.ts +3 -0
  28. package/dist/errors/client-error.js +8 -0
  29. package/dist/errors/index.d.ts +7 -6
  30. package/dist/errors/index.js +7 -4
  31. package/dist/errors/miss-error.d.ts +8 -0
  32. package/dist/errors/miss-error.js +10 -0
  33. package/dist/errors/protocol-error.d.ts +9 -0
  34. package/dist/errors/protocol-error.js +9 -0
  35. package/dist/errors/response-error.d.ts +11 -0
  36. package/dist/errors/response-error.js +16 -0
  37. package/dist/errors/session-error.d.ts +8 -20
  38. package/dist/errors/session-error.js +6 -22
  39. package/dist/errors/stale-route-error.d.ts +9 -0
  40. package/dist/errors/stale-route-error.js +12 -0
  41. package/dist/errors/transport-error.d.ts +30 -0
  42. package/dist/errors/transport-error.js +18 -0
  43. package/dist/graph/domain/binding.d.ts +22 -0
  44. package/dist/graph/domain/binding.js +123 -0
  45. package/dist/graph/domain/domain.typecheck.d.ts +1 -0
  46. package/dist/graph/domain/domain.typecheck.js +139 -0
  47. package/dist/graph/domain/index.d.ts +3 -0
  48. package/dist/graph/domain/index.js +1 -0
  49. package/dist/graph/domain/model.d.ts +18 -0
  50. package/dist/graph/domain/model.js +1 -0
  51. package/dist/graph/domain/page.d.ts +23 -0
  52. package/dist/graph/domain/page.js +42 -0
  53. package/dist/graph/domain/project.d.ts +8 -0
  54. package/dist/graph/domain/project.js +120 -0
  55. package/dist/graph/domain/provenance.d.ts +6 -0
  56. package/dist/graph/domain/provenance.js +11 -0
  57. package/dist/graph/errors.d.ts +8 -0
  58. package/dist/graph/errors.js +14 -0
  59. package/dist/graph/graph.d.ts +26 -0
  60. package/dist/graph/graph.js +18 -0
  61. package/dist/graph/index.d.ts +8 -26
  62. package/dist/graph/index.js +6 -21
  63. package/dist/graph/mutation.d.ts +5 -0
  64. package/dist/graph/mutation.js +17 -0
  65. package/dist/graph/page/index.d.ts +2 -0
  66. package/dist/graph/page/index.js +1 -0
  67. package/dist/graph/page/neighbors.d.ts +9 -0
  68. package/dist/graph/page/neighbors.js +34 -0
  69. package/dist/graph/page/page.d.ts +37 -0
  70. package/dist/graph/page/page.js +55 -0
  71. package/dist/graph/page-contract.d.ts +13 -0
  72. package/dist/graph/page-contract.js +1 -0
  73. package/dist/graph/provenance.d.ts +12 -0
  74. package/dist/graph/provenance.js +37 -0
  75. package/dist/graph/query.d.ts +4 -0
  76. package/dist/graph/query.js +69 -0
  77. package/dist/graph/read.d.ts +6 -0
  78. package/dist/graph/read.js +17 -0
  79. package/dist/index.d.ts +6 -25
  80. package/dist/index.js +6 -21
  81. package/dist/pacer/batcher/batcher.d.ts +7 -0
  82. package/dist/pacer/batcher/batcher.js +13 -0
  83. package/dist/pacer/batcher/defaults.d.ts +2 -0
  84. package/dist/pacer/batcher/defaults.js +2 -0
  85. package/dist/pacer/batcher/index.d.ts +1 -0
  86. package/dist/pacer/batcher/index.js +1 -0
  87. package/dist/pacer/index.d.ts +4 -10
  88. package/dist/pacer/index.js +4 -11
  89. package/dist/pacer/limiter/defaults.d.ts +2 -0
  90. package/dist/pacer/limiter/defaults.js +2 -0
  91. package/dist/pacer/limiter/index.d.ts +1 -0
  92. package/dist/pacer/limiter/index.js +1 -0
  93. package/dist/pacer/limiter/limiter.d.ts +7 -0
  94. package/dist/pacer/limiter/limiter.js +14 -0
  95. package/dist/pacer/queue/defaults.d.ts +1 -0
  96. package/dist/pacer/queue/defaults.js +1 -0
  97. package/dist/pacer/queue/index.d.ts +1 -0
  98. package/dist/pacer/queue/index.js +1 -0
  99. package/dist/pacer/queue/queue.d.ts +6 -0
  100. package/dist/pacer/queue/queue.js +12 -0
  101. package/dist/pacer/retry/defaults.d.ts +6 -0
  102. package/dist/pacer/retry/defaults.js +16 -0
  103. package/dist/pacer/retry/index.d.ts +1 -0
  104. package/dist/pacer/retry/index.js +1 -0
  105. package/dist/pacer/retry/retry.d.ts +9 -0
  106. package/dist/pacer/retry/retry.js +55 -0
  107. package/dist/pool/index.d.ts +2 -4
  108. package/dist/pool/index.js +0 -2
  109. package/dist/pool/pool.d.ts +19 -59
  110. package/dist/pool/pool.js +46 -64
  111. package/dist/pool/target.d.ts +15 -0
  112. package/dist/pool/target.js +49 -0
  113. package/dist/schema/admission.d.ts +12 -0
  114. package/dist/schema/admission.js +17 -0
  115. package/dist/schema/contracts.d.ts +12 -0
  116. package/dist/schema/contracts.js +1 -0
  117. package/dist/schema/index.d.ts +3 -16
  118. package/dist/schema/index.js +2 -12
  119. package/dist/schema/introspection.d.ts +5 -0
  120. package/dist/schema/introspection.js +15 -0
  121. package/dist/schema/operation.d.ts +5 -0
  122. package/dist/schema/operation.js +9 -0
  123. package/dist/schema/schema.d.ts +19 -0
  124. package/dist/schema/schema.js +43 -0
  125. package/dist/session/bound.d.ts +42 -9
  126. package/dist/session/bound.js +70 -37
  127. package/dist/session/context/control.d.ts +5 -0
  128. package/dist/session/context/control.js +17 -0
  129. package/dist/session/context/index.d.ts +4 -0
  130. package/dist/session/context/index.js +4 -0
  131. package/dist/session/context/limits.d.ts +7 -0
  132. package/dist/session/context/limits.js +18 -0
  133. package/dist/session/context/operation.d.ts +19 -0
  134. package/dist/session/context/operation.js +72 -0
  135. package/dist/session/context/policy.d.ts +11 -0
  136. package/dist/session/context/policy.js +69 -0
  137. package/dist/session/discovery/bundle.d.ts +17 -0
  138. package/dist/session/discovery/bundle.js +55 -0
  139. package/dist/session/discovery/discovery.d.ts +19 -0
  140. package/dist/session/discovery/discovery.js +55 -0
  141. package/dist/session/discovery/index.d.ts +20 -0
  142. package/dist/session/discovery/index.js +15 -0
  143. package/dist/session/discovery/publication.d.ts +23 -0
  144. package/dist/session/discovery/publication.js +123 -0
  145. package/dist/session/discovery/snapshot.d.ts +12 -0
  146. package/dist/session/discovery/snapshot.js +3 -0
  147. package/dist/session/discovery/transport.d.ts +6 -0
  148. package/dist/session/discovery/transport.js +13 -0
  149. package/dist/session/index.d.ts +10 -16
  150. package/dist/session/index.js +3 -9
  151. package/dist/session/reference.d.ts +36 -0
  152. package/dist/session/reference.js +74 -0
  153. package/dist/session/routing/auth.d.ts +18 -0
  154. package/dist/session/routing/auth.js +39 -0
  155. package/dist/session/routing/cache.d.ts +20 -0
  156. package/dist/session/routing/cache.js +115 -0
  157. package/dist/session/routing/dispatch.d.ts +34 -0
  158. package/dist/session/routing/dispatch.js +137 -0
  159. package/dist/session/routing/envelope.d.ts +13 -0
  160. package/dist/session/routing/envelope.js +35 -0
  161. package/dist/session/routing/expectation.d.ts +6 -0
  162. package/dist/session/routing/expectation.js +1 -0
  163. package/dist/session/routing/index.d.ts +6 -0
  164. package/dist/session/routing/index.js +5 -0
  165. package/dist/session/routing/request.d.ts +8 -0
  166. package/dist/session/routing/request.js +25 -0
  167. package/dist/session/session.d.ts +67 -0
  168. package/dist/session/session.js +257 -0
  169. package/dist/session/session.typecheck.d.ts +1 -0
  170. package/dist/session/session.typecheck.js +31 -0
  171. package/dist/session/views/catalog.d.ts +15 -0
  172. package/dist/session/views/catalog.js +70 -0
  173. package/dist/session/views/index.d.ts +2 -0
  174. package/dist/session/views/index.js +2 -0
  175. package/dist/session/views/resolve.d.ts +11 -0
  176. package/dist/session/views/resolve.js +13 -0
  177. package/dist/store/entity-index.d.ts +22 -0
  178. package/dist/store/entity-index.js +94 -0
  179. package/dist/store/index.d.ts +1 -26
  180. package/dist/store/index.js +1 -19
  181. package/dist/store/memory.d.ts +46 -97
  182. package/dist/store/memory.js +346 -763
  183. package/dist/store/mutation.d.ts +5 -0
  184. package/dist/store/mutation.js +34 -0
  185. package/dist/store/observe.d.ts +3 -0
  186. package/dist/store/observe.js +17 -0
  187. package/dist/store/optimistic.d.ts +12 -0
  188. package/dist/store/optimistic.js +43 -0
  189. package/dist/store/query-key.d.ts +5 -0
  190. package/dist/store/query-key.js +22 -0
  191. package/dist/store/shape.d.ts +25 -0
  192. package/dist/store/shape.js +29 -0
  193. package/dist/store/store.d.ts +68 -0
  194. package/dist/store/store.js +144 -0
  195. package/dist/store/store.typecheck.d.ts +1 -0
  196. package/dist/store/store.typecheck.js +40 -0
  197. package/dist/transport/auto/decision.d.ts +22 -0
  198. package/dist/transport/auto/decision.js +48 -0
  199. package/dist/transport/auto/fallback.d.ts +16 -0
  200. package/dist/transport/auto/fallback.js +75 -0
  201. package/dist/transport/auto/index.d.ts +2 -0
  202. package/dist/transport/auto/index.js +2 -0
  203. package/dist/transport/auto/transport.d.ts +37 -0
  204. package/dist/transport/auto/transport.js +140 -0
  205. package/dist/transport/auto/warning.d.ts +13 -0
  206. package/dist/transport/auto/warning.js +18 -0
  207. package/dist/transport/deadline.d.ts +11 -0
  208. package/dist/transport/deadline.js +39 -0
  209. package/dist/transport/failure.d.ts +7 -0
  210. package/dist/transport/failure.js +9 -0
  211. package/dist/transport/http/index.d.ts +1 -0
  212. package/dist/transport/http/index.js +1 -0
  213. package/dist/transport/http/response.d.ts +8 -0
  214. package/dist/transport/http/response.js +79 -0
  215. package/dist/transport/http/stream.d.ts +26 -0
  216. package/dist/transport/http/stream.js +214 -0
  217. package/dist/transport/http/transport.d.ts +32 -0
  218. package/dist/transport/http/transport.js +343 -0
  219. package/dist/transport/index.d.ts +2 -8
  220. package/dist/transport/index.js +1 -6
  221. package/dist/transport/transport.d.ts +34 -0
  222. package/dist/transport/transport.js +1 -0
  223. package/dist/transport/websocket/connection.d.ts +38 -0
  224. package/dist/transport/websocket/connection.js +284 -0
  225. package/dist/transport/websocket/exchange.d.ts +46 -0
  226. package/dist/transport/websocket/exchange.js +300 -0
  227. package/dist/transport/websocket/index.d.ts +1 -0
  228. package/dist/transport/websocket/index.js +1 -0
  229. package/dist/transport/websocket/transport.d.ts +46 -0
  230. package/dist/transport/websocket/transport.js +164 -0
  231. package/package.json +41 -35
  232. package/dist/auth/addressing.d.ts +0 -32
  233. package/dist/auth/addressing.d.ts.map +0 -1
  234. package/dist/auth/addressing.js +0 -36
  235. package/dist/auth/addressing.js.map +0 -1
  236. package/dist/auth/api.d.ts +0 -70
  237. package/dist/auth/api.d.ts.map +0 -1
  238. package/dist/auth/api.js +0 -36
  239. package/dist/auth/api.js.map +0 -1
  240. package/dist/auth/batch.d.ts +0 -18
  241. package/dist/auth/batch.d.ts.map +0 -1
  242. package/dist/auth/batch.js +0 -25
  243. package/dist/auth/batch.js.map +0 -1
  244. package/dist/auth/composition.d.ts +0 -27
  245. package/dist/auth/composition.d.ts.map +0 -1
  246. package/dist/auth/composition.js +0 -83
  247. package/dist/auth/composition.js.map +0 -1
  248. package/dist/auth/defaults.d.ts +0 -3
  249. package/dist/auth/defaults.d.ts.map +0 -1
  250. package/dist/auth/defaults.js +0 -3
  251. package/dist/auth/defaults.js.map +0 -1
  252. package/dist/auth/index.d.ts.map +0 -1
  253. package/dist/auth/index.js.map +0 -1
  254. package/dist/auth/minting.d.ts +0 -35
  255. package/dist/auth/minting.d.ts.map +0 -1
  256. package/dist/auth/minting.js +0 -31
  257. package/dist/auth/minting.js.map +0 -1
  258. package/dist/auth/permissions.d.ts +0 -55
  259. package/dist/auth/permissions.d.ts.map +0 -1
  260. package/dist/auth/permissions.js +0 -47
  261. package/dist/auth/permissions.js.map +0 -1
  262. package/dist/auth/principal.d.ts +0 -19
  263. package/dist/auth/principal.d.ts.map +0 -1
  264. package/dist/auth/principal.js +0 -46
  265. package/dist/auth/principal.js.map +0 -1
  266. package/dist/auth/shorthands.d.ts +0 -19
  267. package/dist/auth/shorthands.d.ts.map +0 -1
  268. package/dist/auth/shorthands.js +0 -27
  269. package/dist/auth/shorthands.js.map +0 -1
  270. package/dist/client/batch.d.ts +0 -26
  271. package/dist/client/batch.d.ts.map +0 -1
  272. package/dist/client/batch.js +0 -8
  273. package/dist/client/batch.js.map +0 -1
  274. package/dist/client/bound.d.ts +0 -27
  275. package/dist/client/bound.d.ts.map +0 -1
  276. package/dist/client/bound.js +0 -14
  277. package/dist/client/bound.js.map +0 -1
  278. package/dist/client/client.d.ts.map +0 -1
  279. package/dist/client/client.js.map +0 -1
  280. package/dist/client/config.d.ts +0 -112
  281. package/dist/client/config.d.ts.map +0 -1
  282. package/dist/client/config.js +0 -10
  283. package/dist/client/config.js.map +0 -1
  284. package/dist/client/fn-map.d.ts +0 -61
  285. package/dist/client/fn-map.d.ts.map +0 -1
  286. package/dist/client/fn-map.js +0 -2
  287. package/dist/client/fn-map.js.map +0 -1
  288. package/dist/client/freeze.d.ts +0 -32
  289. package/dist/client/freeze.d.ts.map +0 -1
  290. package/dist/client/freeze.js +0 -42
  291. package/dist/client/freeze.js.map +0 -1
  292. package/dist/client/hooks.d.ts +0 -49
  293. package/dist/client/hooks.d.ts.map +0 -1
  294. package/dist/client/hooks.js +0 -2
  295. package/dist/client/hooks.js.map +0 -1
  296. package/dist/errors/errors.d.ts +0 -156
  297. package/dist/errors/errors.d.ts.map +0 -1
  298. package/dist/errors/errors.js +0 -238
  299. package/dist/errors/errors.js.map +0 -1
  300. package/dist/errors/guards.d.ts +0 -39
  301. package/dist/errors/guards.d.ts.map +0 -1
  302. package/dist/errors/guards.js +0 -127
  303. package/dist/errors/guards.js.map +0 -1
  304. package/dist/errors/index.d.ts.map +0 -1
  305. package/dist/errors/index.js.map +0 -1
  306. package/dist/errors/session-error.d.ts.map +0 -1
  307. package/dist/errors/session-error.js.map +0 -1
  308. package/dist/graph/api.d.ts +0 -85
  309. package/dist/graph/api.d.ts.map +0 -1
  310. package/dist/graph/api.js +0 -66
  311. package/dist/graph/api.js.map +0 -1
  312. package/dist/graph/index.d.ts.map +0 -1
  313. package/dist/graph/index.js.map +0 -1
  314. package/dist/graph/mutate/builder.d.ts +0 -108
  315. package/dist/graph/mutate/builder.d.ts.map +0 -1
  316. package/dist/graph/mutate/builder.js +0 -127
  317. package/dist/graph/mutate/builder.js.map +0 -1
  318. package/dist/graph/mutate/index.d.ts +0 -5
  319. package/dist/graph/mutate/index.d.ts.map +0 -1
  320. package/dist/graph/mutate/index.js +0 -3
  321. package/dist/graph/mutate/index.js.map +0 -1
  322. package/dist/graph/mutate/shorthands.d.ts +0 -42
  323. package/dist/graph/mutate/shorthands.d.ts.map +0 -1
  324. package/dist/graph/mutate/shorthands.js +0 -65
  325. package/dist/graph/mutate/shorthands.js.map +0 -1
  326. package/dist/graph/named.d.ts +0 -38
  327. package/dist/graph/named.d.ts.map +0 -1
  328. package/dist/graph/named.js +0 -47
  329. package/dist/graph/named.js.map +0 -1
  330. package/dist/graph/query/builder.d.ts +0 -116
  331. package/dist/graph/query/builder.d.ts.map +0 -1
  332. package/dist/graph/query/builder.js +0 -136
  333. package/dist/graph/query/builder.js.map +0 -1
  334. package/dist/graph/query/edge-ref.d.ts +0 -13
  335. package/dist/graph/query/edge-ref.d.ts.map +0 -1
  336. package/dist/graph/query/edge-ref.js +0 -56
  337. package/dist/graph/query/edge-ref.js.map +0 -1
  338. package/dist/graph/query/edges.d.ts +0 -10
  339. package/dist/graph/query/edges.d.ts.map +0 -1
  340. package/dist/graph/query/edges.js +0 -11
  341. package/dist/graph/query/edges.js.map +0 -1
  342. package/dist/graph/query/errors.d.ts +0 -31
  343. package/dist/graph/query/errors.d.ts.map +0 -1
  344. package/dist/graph/query/errors.js +0 -28
  345. package/dist/graph/query/errors.js.map +0 -1
  346. package/dist/graph/query/filter.d.ts +0 -50
  347. package/dist/graph/query/filter.d.ts.map +0 -1
  348. package/dist/graph/query/filter.js +0 -32
  349. package/dist/graph/query/filter.js.map +0 -1
  350. package/dist/graph/query/index.d.ts +0 -12
  351. package/dist/graph/query/index.d.ts.map +0 -1
  352. package/dist/graph/query/index.js +0 -7
  353. package/dist/graph/query/index.js.map +0 -1
  354. package/dist/graph/query/lower.d.ts +0 -30
  355. package/dist/graph/query/lower.d.ts.map +0 -1
  356. package/dist/graph/query/lower.js +0 -171
  357. package/dist/graph/query/lower.js.map +0 -1
  358. package/dist/graph/query/shorthands.d.ts +0 -34
  359. package/dist/graph/query/shorthands.d.ts.map +0 -1
  360. package/dist/graph/query/shorthands.js +0 -71
  361. package/dist/graph/query/shorthands.js.map +0 -1
  362. package/dist/graph/query/traverse.d.ts +0 -59
  363. package/dist/graph/query/traverse.d.ts.map +0 -1
  364. package/dist/graph/query/traverse.js +0 -144
  365. package/dist/graph/query/traverse.js.map +0 -1
  366. package/dist/graph/reconcile/execute.d.ts +0 -8
  367. package/dist/graph/reconcile/execute.d.ts.map +0 -1
  368. package/dist/graph/reconcile/execute.js +0 -56
  369. package/dist/graph/reconcile/execute.js.map +0 -1
  370. package/dist/graph/reconcile/index.d.ts +0 -5
  371. package/dist/graph/reconcile/index.d.ts.map +0 -1
  372. package/dist/graph/reconcile/index.js +0 -3
  373. package/dist/graph/reconcile/index.js.map +0 -1
  374. package/dist/graph/reconcile/input.d.ts +0 -80
  375. package/dist/graph/reconcile/input.d.ts.map +0 -1
  376. package/dist/graph/reconcile/input.js +0 -5
  377. package/dist/graph/reconcile/input.js.map +0 -1
  378. package/dist/graph/reconcile/normalize.d.ts +0 -3
  379. package/dist/graph/reconcile/normalize.d.ts.map +0 -1
  380. package/dist/graph/reconcile/normalize.js +0 -144
  381. package/dist/graph/reconcile/normalize.js.map +0 -1
  382. package/dist/graph/reconcile/result.d.ts +0 -19
  383. package/dist/graph/reconcile/result.d.ts.map +0 -1
  384. package/dist/graph/reconcile/result.js +0 -95
  385. package/dist/graph/reconcile/result.js.map +0 -1
  386. package/dist/graph/reconcile/scope.d.ts +0 -6
  387. package/dist/graph/reconcile/scope.d.ts.map +0 -1
  388. package/dist/graph/reconcile/scope.js +0 -69
  389. package/dist/graph/reconcile/scope.js.map +0 -1
  390. package/dist/graph/result/envelope.d.ts +0 -37
  391. package/dist/graph/result/envelope.d.ts.map +0 -1
  392. package/dist/graph/result/envelope.js +0 -59
  393. package/dist/graph/result/envelope.js.map +0 -1
  394. package/dist/graph/result/index.d.ts +0 -6
  395. package/dist/graph/result/index.d.ts.map +0 -1
  396. package/dist/graph/result/index.js +0 -4
  397. package/dist/graph/result/index.js.map +0 -1
  398. package/dist/graph/result/next.d.ts +0 -16
  399. package/dist/graph/result/next.d.ts.map +0 -1
  400. package/dist/graph/result/next.js +0 -77
  401. package/dist/graph/result/next.js.map +0 -1
  402. package/dist/graph/result/paged.d.ts +0 -30
  403. package/dist/graph/result/paged.d.ts.map +0 -1
  404. package/dist/graph/result/paged.js +0 -41
  405. package/dist/graph/result/paged.js.map +0 -1
  406. package/dist/graph/wire.d.ts +0 -33
  407. package/dist/graph/wire.d.ts.map +0 -1
  408. package/dist/graph/wire.js +0 -16
  409. package/dist/graph/wire.js.map +0 -1
  410. package/dist/index.d.ts.map +0 -1
  411. package/dist/index.js.map +0 -1
  412. package/dist/pacer/batcher.d.ts +0 -11
  413. package/dist/pacer/batcher.d.ts.map +0 -1
  414. package/dist/pacer/batcher.js +0 -15
  415. package/dist/pacer/batcher.js.map +0 -1
  416. package/dist/pacer/defaults.d.ts +0 -18
  417. package/dist/pacer/defaults.d.ts.map +0 -1
  418. package/dist/pacer/defaults.js +0 -18
  419. package/dist/pacer/defaults.js.map +0 -1
  420. package/dist/pacer/index.d.ts.map +0 -1
  421. package/dist/pacer/index.js.map +0 -1
  422. package/dist/pacer/queue.d.ts +0 -11
  423. package/dist/pacer/queue.d.ts.map +0 -1
  424. package/dist/pacer/queue.js +0 -15
  425. package/dist/pacer/queue.js.map +0 -1
  426. package/dist/pacer/rate-limiter.d.ts +0 -11
  427. package/dist/pacer/rate-limiter.d.ts.map +0 -1
  428. package/dist/pacer/rate-limiter.js +0 -15
  429. package/dist/pacer/rate-limiter.js.map +0 -1
  430. package/dist/pacer/retry.d.ts +0 -14
  431. package/dist/pacer/retry.d.ts.map +0 -1
  432. package/dist/pacer/retry.js +0 -50
  433. package/dist/pacer/retry.js.map +0 -1
  434. package/dist/pool/errors.d.ts +0 -13
  435. package/dist/pool/errors.d.ts.map +0 -1
  436. package/dist/pool/errors.js +0 -16
  437. package/dist/pool/errors.js.map +0 -1
  438. package/dist/pool/index.d.ts.map +0 -1
  439. package/dist/pool/index.js.map +0 -1
  440. package/dist/pool/pool.d.ts.map +0 -1
  441. package/dist/pool/pool.js.map +0 -1
  442. package/dist/schema/bound/binder.d.ts +0 -49
  443. package/dist/schema/bound/binder.d.ts.map +0 -1
  444. package/dist/schema/bound/binder.js +0 -195
  445. package/dist/schema/bound/binder.js.map +0 -1
  446. package/dist/schema/bound/bound-node.d.ts +0 -105
  447. package/dist/schema/bound/bound-node.d.ts.map +0 -1
  448. package/dist/schema/bound/bound-node.js +0 -128
  449. package/dist/schema/bound/bound-node.js.map +0 -1
  450. package/dist/schema/bound/index.d.ts +0 -10
  451. package/dist/schema/bound/index.d.ts.map +0 -1
  452. package/dist/schema/bound/index.js +0 -5
  453. package/dist/schema/bound/index.js.map +0 -1
  454. package/dist/schema/bound/view.d.ts +0 -44
  455. package/dist/schema/bound/view.d.ts.map +0 -1
  456. package/dist/schema/bound/view.js +0 -117
  457. package/dist/schema/bound/view.js.map +0 -1
  458. package/dist/schema/bound/write-props.d.ts +0 -38
  459. package/dist/schema/bound/write-props.d.ts.map +0 -1
  460. package/dist/schema/bound/write-props.js +0 -2
  461. package/dist/schema/bound/write-props.js.map +0 -1
  462. package/dist/schema/call-args.d.ts +0 -6
  463. package/dist/schema/call-args.d.ts.map +0 -1
  464. package/dist/schema/call-args.js +0 -21
  465. package/dist/schema/call-args.js.map +0 -1
  466. package/dist/schema/class-proxy.d.ts +0 -11
  467. package/dist/schema/class-proxy.d.ts.map +0 -1
  468. package/dist/schema/class-proxy.js +0 -46
  469. package/dist/schema/class-proxy.js.map +0 -1
  470. package/dist/schema/extract.d.ts +0 -24
  471. package/dist/schema/extract.d.ts.map +0 -1
  472. package/dist/schema/extract.js +0 -45
  473. package/dist/schema/extract.js.map +0 -1
  474. package/dist/schema/from-entries.d.ts +0 -12
  475. package/dist/schema/from-entries.d.ts.map +0 -1
  476. package/dist/schema/from-entries.js +0 -39
  477. package/dist/schema/from-entries.js.map +0 -1
  478. package/dist/schema/index.d.ts.map +0 -1
  479. package/dist/schema/index.js.map +0 -1
  480. package/dist/schema/known-dispatch.d.ts +0 -6
  481. package/dist/schema/known-dispatch.d.ts.map +0 -1
  482. package/dist/schema/known-dispatch.js +0 -39
  483. package/dist/schema/known-dispatch.js.map +0 -1
  484. package/dist/schema/node-proxy.d.ts +0 -21
  485. package/dist/schema/node-proxy.d.ts.map +0 -1
  486. package/dist/schema/node-proxy.js +0 -75
  487. package/dist/schema/node-proxy.js.map +0 -1
  488. package/dist/schema/persistence.d.ts +0 -31
  489. package/dist/schema/persistence.d.ts.map +0 -1
  490. package/dist/schema/persistence.js +0 -2
  491. package/dist/schema/persistence.js.map +0 -1
  492. package/dist/schema/proxy-types.d.ts +0 -131
  493. package/dist/schema/proxy-types.d.ts.map +0 -1
  494. package/dist/schema/proxy-types.js +0 -2
  495. package/dist/schema/proxy-types.js.map +0 -1
  496. package/dist/schema/registry.d.ts +0 -50
  497. package/dist/schema/registry.d.ts.map +0 -1
  498. package/dist/schema/registry.js +0 -110
  499. package/dist/schema/registry.js.map +0 -1
  500. package/dist/schema/resolve.d.ts +0 -26
  501. package/dist/schema/resolve.d.ts.map +0 -1
  502. package/dist/schema/resolve.js +0 -27
  503. package/dist/schema/resolve.js.map +0 -1
  504. package/dist/schema/typed-client.d.ts +0 -10
  505. package/dist/schema/typed-client.d.ts.map +0 -1
  506. package/dist/schema/typed-client.js +0 -26
  507. package/dist/schema/typed-client.js.map +0 -1
  508. package/dist/schema/types.d.ts +0 -9
  509. package/dist/schema/types.d.ts.map +0 -1
  510. package/dist/schema/types.js +0 -2
  511. package/dist/schema/types.js.map +0 -1
  512. package/dist/session/bound.d.ts.map +0 -1
  513. package/dist/session/bound.js.map +0 -1
  514. package/dist/session/client-session.d.ts +0 -72
  515. package/dist/session/client-session.d.ts.map +0 -1
  516. package/dist/session/client-session.js +0 -673
  517. package/dist/session/client-session.js.map +0 -1
  518. package/dist/session/config.d.ts +0 -168
  519. package/dist/session/config.d.ts.map +0 -1
  520. package/dist/session/config.js +0 -2
  521. package/dist/session/config.js.map +0 -1
  522. package/dist/session/delegation/cache.d.ts +0 -139
  523. package/dist/session/delegation/cache.d.ts.map +0 -1
  524. package/dist/session/delegation/cache.js +0 -256
  525. package/dist/session/delegation/cache.js.map +0 -1
  526. package/dist/session/delegation/errors.d.ts +0 -44
  527. package/dist/session/delegation/errors.d.ts.map +0 -1
  528. package/dist/session/delegation/errors.js +0 -62
  529. package/dist/session/delegation/errors.js.map +0 -1
  530. package/dist/session/delegation/policy.d.ts +0 -183
  531. package/dist/session/delegation/policy.d.ts.map +0 -1
  532. package/dist/session/delegation/policy.js +0 -114
  533. package/dist/session/delegation/policy.js.map +0 -1
  534. package/dist/session/delegation/utils.d.ts +0 -4
  535. package/dist/session/delegation/utils.d.ts.map +0 -1
  536. package/dist/session/delegation/utils.js +0 -12
  537. package/dist/session/delegation/utils.js.map +0 -1
  538. package/dist/session/delegation-mint.d.ts +0 -13
  539. package/dist/session/delegation-mint.d.ts.map +0 -1
  540. package/dist/session/delegation-mint.js +0 -39
  541. package/dist/session/delegation-mint.js.map +0 -1
  542. package/dist/session/dispatch-routes.d.ts +0 -27
  543. package/dist/session/dispatch-routes.d.ts.map +0 -1
  544. package/dist/session/dispatch-routes.js +0 -77
  545. package/dist/session/dispatch-routes.js.map +0 -1
  546. package/dist/session/errors/index.d.ts +0 -6
  547. package/dist/session/errors/index.d.ts.map +0 -1
  548. package/dist/session/errors/index.js +0 -8
  549. package/dist/session/errors/index.js.map +0 -1
  550. package/dist/session/errors/session-errors.d.ts +0 -52
  551. package/dist/session/errors/session-errors.d.ts.map +0 -1
  552. package/dist/session/errors/session-errors.js +0 -70
  553. package/dist/session/errors/session-errors.js.map +0 -1
  554. package/dist/session/forward.d.ts +0 -15
  555. package/dist/session/forward.d.ts.map +0 -1
  556. package/dist/session/forward.js +0 -40
  557. package/dist/session/forward.js.map +0 -1
  558. package/dist/session/helpers.d.ts +0 -23
  559. package/dist/session/helpers.d.ts.map +0 -1
  560. package/dist/session/helpers.js +0 -56
  561. package/dist/session/helpers.js.map +0 -1
  562. package/dist/session/hooks.d.ts +0 -140
  563. package/dist/session/hooks.d.ts.map +0 -1
  564. package/dist/session/hooks.js +0 -2
  565. package/dist/session/hooks.js.map +0 -1
  566. package/dist/session/index.d.ts.map +0 -1
  567. package/dist/session/index.js.map +0 -1
  568. package/dist/session/redirect/errors.d.ts +0 -45
  569. package/dist/session/redirect/errors.d.ts.map +0 -1
  570. package/dist/session/redirect/errors.js +0 -52
  571. package/dist/session/redirect/errors.js.map +0 -1
  572. package/dist/session/redirect/policy.d.ts +0 -79
  573. package/dist/session/redirect/policy.d.ts.map +0 -1
  574. package/dist/session/redirect/policy.js +0 -69
  575. package/dist/session/redirect/policy.js.map +0 -1
  576. package/dist/session/types.d.ts +0 -54
  577. package/dist/session/types.d.ts.map +0 -1
  578. package/dist/session/types.js +0 -2
  579. package/dist/session/types.js.map +0 -1
  580. package/dist/store/canonicalize.d.ts +0 -44
  581. package/dist/store/canonicalize.d.ts.map +0 -1
  582. package/dist/store/canonicalize.js +0 -0
  583. package/dist/store/canonicalize.js.map +0 -1
  584. package/dist/store/entities.d.ts +0 -81
  585. package/dist/store/entities.d.ts.map +0 -1
  586. package/dist/store/entities.js +0 -202
  587. package/dist/store/entities.js.map +0 -1
  588. package/dist/store/index.d.ts.map +0 -1
  589. package/dist/store/index.js.map +0 -1
  590. package/dist/store/invalidate.d.ts +0 -66
  591. package/dist/store/invalidate.d.ts.map +0 -1
  592. package/dist/store/invalidate.js +0 -117
  593. package/dist/store/invalidate.js.map +0 -1
  594. package/dist/store/memory.d.ts.map +0 -1
  595. package/dist/store/memory.js.map +0 -1
  596. package/dist/store/overlay.d.ts +0 -118
  597. package/dist/store/overlay.d.ts.map +0 -1
  598. package/dist/store/overlay.js +0 -237
  599. package/dist/store/overlay.js.map +0 -1
  600. package/dist/store/schedule.d.ts +0 -31
  601. package/dist/store/schedule.d.ts.map +0 -1
  602. package/dist/store/schedule.js +0 -76
  603. package/dist/store/schedule.js.map +0 -1
  604. package/dist/store/shapes.d.ts +0 -92
  605. package/dist/store/shapes.d.ts.map +0 -1
  606. package/dist/store/shapes.js +0 -369
  607. package/dist/store/shapes.js.map +0 -1
  608. package/dist/store/types.d.ts +0 -168
  609. package/dist/store/types.d.ts.map +0 -1
  610. package/dist/store/types.js +0 -7
  611. package/dist/store/types.js.map +0 -1
  612. package/dist/transport/binary.d.ts +0 -15
  613. package/dist/transport/binary.d.ts.map +0 -1
  614. package/dist/transport/binary.js +0 -2
  615. package/dist/transport/binary.js.map +0 -1
  616. package/dist/transport/contract.d.ts +0 -58
  617. package/dist/transport/contract.d.ts.map +0 -1
  618. package/dist/transport/contract.js +0 -11
  619. package/dist/transport/contract.js.map +0 -1
  620. package/dist/transport/fetch.d.ts +0 -31
  621. package/dist/transport/fetch.d.ts.map +0 -1
  622. package/dist/transport/fetch.js +0 -78
  623. package/dist/transport/fetch.js.map +0 -1
  624. package/dist/transport/http-envelope.d.ts +0 -49
  625. package/dist/transport/http-envelope.d.ts.map +0 -1
  626. package/dist/transport/http-envelope.js +0 -418
  627. package/dist/transport/http-envelope.js.map +0 -1
  628. package/dist/transport/http-routed.d.ts +0 -61
  629. package/dist/transport/http-routed.d.ts.map +0 -1
  630. package/dist/transport/http-routed.js +0 -409
  631. package/dist/transport/http-routed.js.map +0 -1
  632. package/dist/transport/index.d.ts.map +0 -1
  633. package/dist/transport/index.js.map +0 -1
  634. package/dist/transport/request-id.d.ts +0 -9
  635. package/dist/transport/request-id.d.ts.map +0 -1
  636. package/dist/transport/request-id.js +0 -12
  637. package/dist/transport/request-id.js.map +0 -1
  638. package/dist/transport/ws-envelope.d.ts +0 -74
  639. package/dist/transport/ws-envelope.d.ts.map +0 -1
  640. package/dist/transport/ws-envelope.js +0 -567
  641. package/dist/transport/ws-envelope.js.map +0 -1
  642. package/dist/util/race-signal.d.ts +0 -12
  643. package/dist/util/race-signal.d.ts.map +0 -1
  644. package/dist/util/race-signal.js +0 -34
  645. package/dist/util/race-signal.js.map +0 -1
  646. package/dist/wire/controller.d.ts +0 -38
  647. package/dist/wire/controller.d.ts.map +0 -1
  648. package/dist/wire/controller.js +0 -38
  649. package/dist/wire/controller.js.map +0 -1
  650. package/dist/wire/index.d.ts +0 -7
  651. package/dist/wire/index.d.ts.map +0 -1
  652. package/dist/wire/index.js +0 -4
  653. package/dist/wire/index.js.map +0 -1
  654. package/dist/wire/meta.d.ts +0 -81
  655. package/dist/wire/meta.d.ts.map +0 -1
  656. package/dist/wire/meta.js +0 -44
  657. package/dist/wire/meta.js.map +0 -1
  658. package/dist/wire/sse.d.ts +0 -67
  659. package/dist/wire/sse.d.ts.map +0 -1
  660. package/dist/wire/sse.js +0 -170
  661. package/dist/wire/sse.js.map +0 -1
@@ -0,0 +1,37 @@
1
+ import type { GraphData } from '@astrale-os/kernel-core/graph/graph';
2
+ import type { Node, NodeCollection } from '@astrale-os/kernel-core/graph/node';
3
+ import type { NodeBinding, QueryAST, QueryGraphSelect, QueryNodeGraphResult, QueryResultFor } from '@astrale-os/kernel-core/graph/query';
4
+ import type { DomainDependency } from '@astrale-os/kernel-dsl/v1/schema';
5
+ import type { RequestOptions } from '../../transport/index.js';
6
+ import type { QueryPageRequest, QueryResponse } from '../page-contract.js';
7
+ export interface NodePage {
8
+ readonly nodes: NodeCollection;
9
+ readonly first: Node | null;
10
+ readonly graph: GraphData;
11
+ readonly cursor: string | null;
12
+ next(options?: {
13
+ readonly size?: number;
14
+ readonly signal?: AbortSignal;
15
+ readonly timeoutMs?: number;
16
+ }): Promise<NodePage | null>;
17
+ collect(options: {
18
+ readonly maximumPages: number;
19
+ readonly size?: number;
20
+ readonly signal?: AbortSignal;
21
+ readonly timeoutMs?: number;
22
+ }): Promise<{
23
+ readonly nodes: NodeCollection;
24
+ readonly cursor: string | null;
25
+ }>;
26
+ }
27
+ type PageBasis = Pick<RequestOptions, 'signal' | 'timeoutMs'> & {
28
+ readonly expected?: readonly DomainDependency[];
29
+ };
30
+ export interface PageQueryOptions extends RequestOptions {
31
+ readonly expected?: readonly DomainDependency[];
32
+ readonly page: QueryPageRequest;
33
+ }
34
+ export type PageQuery = <Query extends QueryAST>(ast: Query, options: PageQueryOptions) => Promise<QueryResponse<QueryResultFor<Query>>>;
35
+ type NodeGraphQueryAST = QueryAST<QueryGraphSelect<NodeBinding>>;
36
+ export declare function createNodePage(query: PageQuery, ast: NodeGraphQueryAST, response: QueryResponse<QueryNodeGraphResult>, basis: PageBasis, size: number): NodePage;
37
+ export {};
@@ -0,0 +1,55 @@
1
+ export function createNodePage(query, ast, response, basis, size) {
2
+ const { result } = response;
3
+ const nodes = result.graph.nodes;
4
+ const cursor = response.page.next ?? null;
5
+ const next = async (controls) => {
6
+ if (cursor === null)
7
+ return null;
8
+ const options = {
9
+ ...basis,
10
+ ...(controls?.signal === undefined ? {} : { signal: controls.signal }),
11
+ ...(controls?.timeoutMs === undefined ? {} : { timeoutMs: controls.timeoutMs }),
12
+ page: { size: controls?.size ?? size, after: cursor },
13
+ };
14
+ const continuation = await query(ast, options);
15
+ if (continuation.result.kind !== 'graph' || continuation.result.selection.kind !== 'node') {
16
+ throw new TypeError('Node page continuation returned a non-Node graph result.');
17
+ }
18
+ return createNodePage(query, ast, continuation, basis, controls?.size ?? size);
19
+ };
20
+ const page = {
21
+ nodes,
22
+ first: nodes[0] ?? null,
23
+ graph: result.graph,
24
+ cursor,
25
+ next,
26
+ async collect(options) {
27
+ requireMaximumPages(options.maximumPages);
28
+ const collected = [...nodes];
29
+ let current = page;
30
+ let pages = 1;
31
+ while (current.cursor !== null && pages < options.maximumPages) {
32
+ const continuation = await current.next({
33
+ ...(options.size === undefined ? {} : { size: options.size }),
34
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
35
+ ...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
36
+ });
37
+ if (continuation === null)
38
+ break;
39
+ collected.push(...continuation.nodes);
40
+ current = continuation;
41
+ pages += 1;
42
+ }
43
+ return Object.freeze({
44
+ nodes: Object.freeze(collected),
45
+ cursor: current.cursor,
46
+ });
47
+ },
48
+ };
49
+ return Object.freeze(page);
50
+ }
51
+ function requireMaximumPages(value) {
52
+ if (!Number.isSafeInteger(value) || value < 1) {
53
+ throw new TypeError('NodePage maximumPages must be a positive safe integer.');
54
+ }
55
+ }
@@ -0,0 +1,13 @@
1
+ import type { QueryResult } from '@astrale-os/kernel-core/graph/query';
2
+ /** Caller-selected bounds and continuation for one graph query page. */
3
+ export interface QueryPageRequest {
4
+ readonly size: number;
5
+ readonly after?: string;
6
+ }
7
+ /** Decoded graph result and its optional opaque continuation. */
8
+ export interface QueryResponse<Result extends QueryResult = QueryResult> {
9
+ readonly result: Result;
10
+ readonly page: {
11
+ readonly next?: string;
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { Edge } from '@astrale-os/kernel-core/graph/edge';
2
+ import type { Node } from '@astrale-os/kernel-core/graph/node';
3
+ import type { DomainDependency } from '@astrale-os/kernel-dsl/v1/schema';
4
+ import type { QueryResponse } from './page-contract.js';
5
+ export interface QueryProvenance {
6
+ readonly closure: readonly DomainDependency[];
7
+ readonly page: object;
8
+ }
9
+ /** Retain authenticated query provenance without adding serialized response metadata. */
10
+ export declare function retainQueryProvenance(response: QueryResponse, closure: readonly DomainDependency[]): QueryResponse;
11
+ export declare function provenanceOfGraphValue(value: Node | Edge): QueryProvenance | undefined;
12
+ export declare function provenanceOfResponse(value: QueryResponse): QueryProvenance | undefined;
@@ -0,0 +1,37 @@
1
+ const graphValues = new WeakMap();
2
+ const responses = new WeakMap();
3
+ /** Retain authenticated query provenance without adding serialized response metadata. */
4
+ export function retainQueryProvenance(response, closure) {
5
+ const provenance = Object.freeze({ closure, page: Object.freeze({}) });
6
+ responses.set(response, provenance);
7
+ const { result } = response;
8
+ if (result.kind === 'graph') {
9
+ for (const node of result.graph.nodes)
10
+ graphValues.set(node, provenance);
11
+ for (const edge of result.graph.edges)
12
+ graphValues.set(edge, provenance);
13
+ }
14
+ else if (result.kind === 'nodes') {
15
+ for (const item of result.nodes) {
16
+ if (item.kind === 'value')
17
+ graphValues.set(item.value, provenance);
18
+ }
19
+ }
20
+ else {
21
+ for (const item of result.edges) {
22
+ if (item.edge.kind === 'value')
23
+ graphValues.set(item.edge.value, provenance);
24
+ if (item.source.kind === 'value')
25
+ graphValues.set(item.source.value, provenance);
26
+ if (item.target.kind === 'value')
27
+ graphValues.set(item.target.value, provenance);
28
+ }
29
+ }
30
+ return response;
31
+ }
32
+ export function provenanceOfGraphValue(value) {
33
+ return graphValues.get(value);
34
+ }
35
+ export function provenanceOfResponse(value) {
36
+ return responses.get(value);
37
+ }
@@ -0,0 +1,4 @@
1
+ import type { QueryAST as QueryASTValue, QueryResultFor } from '@astrale-os/kernel-core/graph/query';
2
+ import type { GraphCall, GraphQueryOptions } from './graph.js';
3
+ import type { QueryResponse } from './page-contract.js';
4
+ export declare function queryGraph<Query extends QueryASTValue>(call: GraphCall, input: Query, options: GraphQueryOptions): Promise<QueryResponse<QueryResultFor<Query>>>;
@@ -0,0 +1,69 @@
1
+ import { QueryAST, QueryResult } from '@astrale-os/kernel-core/graph/query';
2
+ import { Path } from '@astrale-os/kernel-core/path';
3
+ import { query } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
4
+ import { call as invocation } from '../client/index.js';
5
+ import { retainQueryProvenance } from './provenance.js';
6
+ const KERNEL_QUERY_PATH = Path.project(query).raw;
7
+ export async function queryGraph(call, input, options) {
8
+ const ast = QueryAST.decode(input);
9
+ const { expected, page, ...request } = options;
10
+ const admittedPage = admitPage(page);
11
+ const capturedExpected = captureExpected(expected);
12
+ const output = await call(invocation(KERNEL_QUERY_PATH, Object.freeze({
13
+ ast,
14
+ ...(capturedExpected === undefined ? {} : { expected: capturedExpected }),
15
+ page: admittedPage,
16
+ })), request);
17
+ const response = decodeResponse(output);
18
+ return capturedExpected === undefined
19
+ ? response
20
+ : retainQueryProvenance(response, capturedExpected);
21
+ }
22
+ function captureExpected(input) {
23
+ if (input === undefined)
24
+ return undefined;
25
+ return Object.freeze(input.map(({ origin, revision }) => Object.freeze({ origin, revision })));
26
+ }
27
+ function admitPage(input) {
28
+ if (input === null || typeof input !== 'object' || Array.isArray(input)) {
29
+ throw new TypeError('Graph query page is invalid.');
30
+ }
31
+ if (!Number.isSafeInteger(input.size) || input.size < 1) {
32
+ throw new TypeError('Graph query page size must be a positive safe integer.');
33
+ }
34
+ if (input.after !== undefined && (typeof input.after !== 'string' || input.after.length === 0)) {
35
+ throw new TypeError('Graph query page continuation is invalid.');
36
+ }
37
+ return Object.freeze({
38
+ size: input.size,
39
+ ...(input.after === undefined ? {} : { after: input.after }),
40
+ });
41
+ }
42
+ function decodeResponse(input) {
43
+ if (input === null || typeof input !== 'object' || Array.isArray(input)) {
44
+ throw new TypeError('Graph query response is invalid.');
45
+ }
46
+ const value = input;
47
+ if (!hasExactKeys(value, ['result', 'page'])) {
48
+ throw new TypeError('Graph query response is invalid.');
49
+ }
50
+ const pageInput = value.page;
51
+ if (pageInput === null || typeof pageInput !== 'object' || Array.isArray(pageInput)) {
52
+ throw new TypeError('Graph query response page is invalid.');
53
+ }
54
+ const pageValue = pageInput;
55
+ if (!hasExactKeys(pageValue, pageValue.next === undefined ? [] : ['next'])) {
56
+ throw new TypeError('Graph query response page is invalid.');
57
+ }
58
+ if (pageValue.next !== undefined &&
59
+ (typeof pageValue.next !== 'string' || pageValue.next.length === 0)) {
60
+ throw new TypeError('Graph query response continuation is invalid.');
61
+ }
62
+ const result = QueryResult.decode(value.result);
63
+ const page = Object.freeze(pageValue.next === undefined ? {} : { next: pageValue.next });
64
+ return Object.freeze({ result, page });
65
+ }
66
+ function hasExactKeys(input, expected) {
67
+ const keys = Object.keys(input);
68
+ return keys.length === expected.length && keys.every((key) => expected.includes(key));
69
+ }
@@ -0,0 +1,6 @@
1
+ import type { Node } from '@astrale-os/kernel-core/graph/node';
2
+ import type { NodeTarget } from '@astrale-os/kernel-core/path';
3
+ import type { RequestOptions } from '../transport/index.js';
4
+ import type { GraphCall } from './graph.js';
5
+ export declare function getNode(call: GraphCall, path: NodeTarget, options?: RequestOptions): Promise<Node | null>;
6
+ export declare function requireNode(call: GraphCall, path: NodeTarget, options?: RequestOptions): Promise<Node>;
@@ -0,0 +1,17 @@
1
+ import { Query } from '@astrale-os/kernel-core/graph/query';
2
+ import { NodeUnavailableError } from './errors.js';
3
+ import { queryGraph } from './query.js';
4
+ export async function getNode(call, path, options) {
5
+ const ast = Query.from({ nodes: [path] }).select({ kind: 'graph' });
6
+ const response = await queryGraph(call, ast, { ...options, page: { size: 1 } });
7
+ const { result } = response;
8
+ if (result.kind !== 'graph')
9
+ throw new TypeError('Node read returned a projection result.');
10
+ return result.graph.nodes[0] ?? null;
11
+ }
12
+ export async function requireNode(call, path, options) {
13
+ const node = await getNode(call, path, options);
14
+ if (node === null)
15
+ throw new NodeUnavailableError(path);
16
+ return node;
17
+ }
package/dist/index.d.ts CHANGED
@@ -1,25 +1,6 @@
1
- export { KernelClient } from './client/client.js';
2
- export type { BoundClientView } from './client/bound.js';
3
- export type { CallOptions, ClientConfig, ClientLogger, Protocol, CallTransport, } from './client/config.js';
4
- export type { AfterReceiveCtx, AfterSignalCtx, BeforeSendCtx, ClientHooks, ErrorCtx, StreamFrameCtx, } from './client/hooks.js';
5
- export type { BinaryFns, CallFns, FnEntry, FnMap, SendBinaryResult, SendResult, SendStreamResult, SignalFns, StreamFns, } from './client/fn-map.js';
6
- export type { BatchResults, TypedBatchRequest } from './client/batch.js';
7
- export type { TransportName, WireMeta, WireProtocolMeta } from './wire/meta.js';
8
- export { RETRY_DEFAULTS, QUEUE_DEFAULTS, BATCH_DEFAULTS, RATE_LIMIT_DEFAULTS, kernelRetry, createQueue, createBatcher, createRateLimiter, } from './pacer/index.js';
9
- export type { KernelRetryOptions, KernelQueueOptions, KernelBatchOptions, KernelRateLimitOptions, } from './pacer/index.js';
10
- export { AuthBatchError, AuthenticationError, ConnectionError, DisconnectedError, InvalidTransportError, InvariantViolationError, KernelError, NodeUnavailableError, NotFoundError, PermissionDeniedError, TimeoutError, UnsupportedTransportError, ValidationError, WebOSError, mapServerError, withDetails, } from './errors/errors.js';
11
- export type { AuthBatchOutcome, AuthReason, ClientErrorDetails } from './errors/errors.js';
12
- export { classifyKernelError, isAuthBatchError, isAuthenticationError, isClientSessionError, isDelegationMintError, isDelegationPolicyError, isDelegationRefusedError, isHopLimitExceededError, isIdentityError, isInternalKernelError, isInvalidRequestError, isInvalidTransportError, isInvariantViolationError, isKernelError, isNodeUnavailableError, isNotFoundError, isParseError, isPermissionDeniedError, isPersistenceLoadFailedError, isPoolClosedError, isRedirectPolicyError, isRedirectRefusedError, isRegistryWriteFailedError, isSchemaOwnershipConflictError, isTransportError, isUnsupportedTransportError, isValidationError, isWebOSError, } from './errors/guards.js';
13
- export type { IdentityError, KernelErrorKind, TransportError } from './errors/guards.js';
14
- export { ClientSessionError } from './errors/session-error.js';
15
- export { SchemaRegistry } from './schema/registry.js';
16
- export { toFunctionSchemas } from './schema/from-entries.js';
17
- export type { FunctionSchema } from './schema/types.js';
18
- export type { ClassProxy, DefOf, InstanceDispatch, NodeProxy, ProxyCallOptions, StaticDispatch, TypeNames, } from './schema/proxy-types.js';
19
- export { BindTypeMismatchError, createBoundNode, createNodeBinder, createSchemaBoundView, defaultCaller, resolveNeighbors, normalizeRef, } from './schema/bound/index.js';
20
- export type { AnyBoundNode, BindCtx, BindOptions, BoundLinks, BoundNode, BoundNodeOperations, BoundPaged, BoundSnapshot, ClassHandle, EdgeNames, EndpointsOf, NodeBinder, NodeRefInput, SchemaBoundView, SchemaClasses, } from './schema/bound/index.js';
21
- export type { CreatableClassNames, CreateProps } from './schema/bound/index.js';
22
- export { DESCRIPTION_KEY, NAME_KEY, STATUS_KEY, descriptionOf, nameOf, statusOf, } from './graph/named.js';
23
- export type { NamedNodeLike } from './graph/named.js';
24
- export type { CredentialInput } from '@astrale-os/kernel-core';
25
- //# sourceMappingURL=index.d.ts.map
1
+ export { Client, call, type AuthenticatedClient, type Call, type ClientDispatchOptions, type ClientOptions, type Binary, type BinaryResponse, type Input, type RemoteCredential, type Result, type Stream, type StreamResult, type ValueResult, } from './client/index.js';
2
+ export * from './errors/index.js';
3
+ export { type RequestOptions, type MissControl, type StaleControl, type Transport, type TransportRequest, type TransportResult, } from './transport/index.js';
4
+ export { HttpTransport, type Fetch, type HttpTransportOptions } from './transport/http/index.js';
5
+ export { WebSocketTransport, type WebSocketConstructor, type WebSocketTransportOptions, } from './transport/websocket/index.js';
6
+ export { AutoTransport, formatClientWarning, type AutoTransportOptions, type ClientWarning, } from './transport/auto/index.js';
package/dist/index.js CHANGED
@@ -1,21 +1,6 @@
1
- // ─── Client ─────────────────────────────────────────────
2
- export { KernelClient } from './client/client.js';
3
- // ─── Pacer (retry / queue / batcher / rate-limiter) ────
4
- export { RETRY_DEFAULTS, QUEUE_DEFAULTS, BATCH_DEFAULTS, RATE_LIMIT_DEFAULTS, kernelRetry, createQueue, createBatcher, createRateLimiter, } from './pacer/index.js';
5
- // ─── Errors ─────────────────────────────────────────────
6
- export { AuthBatchError, AuthenticationError, ConnectionError, DisconnectedError, InvalidTransportError, InvariantViolationError, KernelError, NodeUnavailableError, NotFoundError, PermissionDeniedError, TimeoutError, UnsupportedTransportError, ValidationError, WebOSError, mapServerError, withDetails, } from './errors/errors.js';
7
- // ─── Error guards (typed narrowing for error-UX) ───────
8
- export { classifyKernelError, isAuthBatchError, isAuthenticationError, isClientSessionError, isDelegationMintError, isDelegationPolicyError, isDelegationRefusedError, isHopLimitExceededError, isIdentityError, isInternalKernelError, isInvalidRequestError, isInvalidTransportError, isInvariantViolationError, isKernelError, isNodeUnavailableError, isNotFoundError, isParseError, isPermissionDeniedError, isPersistenceLoadFailedError, isPoolClosedError, isRedirectPolicyError, isRedirectRefusedError, isRegistryWriteFailedError, isSchemaOwnershipConflictError, isTransportError, isUnsupportedTransportError, isValidationError, isWebOSError, } from './errors/guards.js';
9
- export { ClientSessionError } from './errors/session-error.js';
10
- // Auth control plane lives on the `./auth` subpath, session delegation on
11
- // `./session` — the root re-exports neither (parity with `./graph`).
12
- // ─── Schema ─────────────────────────────────────────────
13
- export { SchemaRegistry } from './schema/registry.js';
14
- export { toFunctionSchemas } from './schema/from-entries.js';
15
- // NOTE: SchemaTypedClient (legacy .static/.node surface) is intentionally omitted from primary root re-exports.
16
- // It remains available via deep import for migration compat but is deprecated in favor of .classes + direct BoundNode methods.
17
- // ─── Schema-bound surface (SchemaBoundView / BoundNode) ──
18
- export { BindTypeMismatchError, createBoundNode, createNodeBinder, createSchemaBoundView, defaultCaller, resolveNeighbors, normalizeRef, } from './schema/bound/index.js';
19
- // ─── Universal-prop helpers (blessed; single-sourced from K) ──
20
- export { DESCRIPTION_KEY, NAME_KEY, STATUS_KEY, descriptionOf, nameOf, statusOf, } from './graph/named.js';
21
- //# sourceMappingURL=index.js.map
1
+ export { Client, call, } from './client/index.js';
2
+ export * from './errors/index.js';
3
+ export {} from './transport/index.js';
4
+ export { HttpTransport } from './transport/http/index.js';
5
+ export { WebSocketTransport, } from './transport/websocket/index.js';
6
+ export { AutoTransport, formatClientWarning, } from './transport/auto/index.js';
@@ -0,0 +1,7 @@
1
+ import type { AsyncBatcherOptions } from '@tanstack/pacer';
2
+ import { AsyncBatcher } from '@tanstack/pacer';
3
+ export type BatchOptions<Value> = Omit<AsyncBatcherOptions<Value>, 'maxSize' | 'wait'> & {
4
+ readonly maxSize?: number;
5
+ readonly wait?: number;
6
+ };
7
+ export declare function createBatcher<Value>(consume: (values: Value[]) => Promise<unknown>, options?: BatchOptions<Value>): AsyncBatcher<Value>;
@@ -0,0 +1,13 @@
1
+ import { AsyncBatcher } from '@tanstack/pacer';
2
+ import { DEFAULT_BATCH_SIZE, DEFAULT_BATCH_WAIT_MS } from './defaults.js';
3
+ export function createBatcher(consume, options = {}) {
4
+ if (typeof consume !== 'function')
5
+ throw new TypeError('Batch consumer is invalid.');
6
+ if (options === null || typeof options !== 'object')
7
+ throw new TypeError('Batch options are invalid.');
8
+ return new AsyncBatcher(consume, {
9
+ ...options,
10
+ maxSize: options.maxSize ?? DEFAULT_BATCH_SIZE,
11
+ wait: options.wait ?? DEFAULT_BATCH_WAIT_MS,
12
+ });
13
+ }
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_BATCH_SIZE = 100;
2
+ export declare const DEFAULT_BATCH_WAIT_MS = 10;
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_BATCH_SIZE = 100;
2
+ export const DEFAULT_BATCH_WAIT_MS = 10;
@@ -0,0 +1 @@
1
+ export { createBatcher, type BatchOptions } from './batcher.js';
@@ -0,0 +1 @@
1
+ export { createBatcher } from './batcher.js';
@@ -1,10 +1,4 @@
1
- export { RETRY_DEFAULTS, QUEUE_DEFAULTS, BATCH_DEFAULTS, RATE_LIMIT_DEFAULTS } from './defaults.js';
2
- export { kernelRetry } from './retry.js';
3
- export type { KernelRetryOptions } from './retry.js';
4
- export { createQueue } from './queue.js';
5
- export type { KernelQueueOptions } from './queue.js';
6
- export { createBatcher } from './batcher.js';
7
- export type { KernelBatchOptions } from './batcher.js';
8
- export { createRateLimiter } from './rate-limiter.js';
9
- export type { KernelRateLimitOptions } from './rate-limiter.js';
10
- //# sourceMappingURL=index.d.ts.map
1
+ export { retry, type RetryOptions } from './retry/index.js';
2
+ export { createQueue, type QueueOptions } from './queue/index.js';
3
+ export { createBatcher, type BatchOptions } from './batcher/index.js';
4
+ export { createRateLimiter, type RateLimitOptions } from './limiter/index.js';
@@ -1,11 +1,4 @@
1
- // ─── Defaults ────────────────────────────────────────────
2
- export { RETRY_DEFAULTS, QUEUE_DEFAULTS, BATCH_DEFAULTS, RATE_LIMIT_DEFAULTS } from './defaults.js';
3
- // ─── Retry ───────────────────────────────────────────────
4
- export { kernelRetry } from './retry.js';
5
- // ─── Queue ───────────────────────────────────────────────
6
- export { createQueue } from './queue.js';
7
- // ─── Batcher ─────────────────────────────────────────────
8
- export { createBatcher } from './batcher.js';
9
- // ─── Rate Limiter ────────────────────────────────────────
10
- export { createRateLimiter } from './rate-limiter.js';
11
- //# sourceMappingURL=index.js.map
1
+ export { retry } from './retry/index.js';
2
+ export { createQueue } from './queue/index.js';
3
+ export { createBatcher } from './batcher/index.js';
4
+ export { createRateLimiter } from './limiter/index.js';
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_RATE_LIMIT = 10;
2
+ export declare const DEFAULT_RATE_WINDOW_MS = 1000;
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_RATE_LIMIT = 10;
2
+ export const DEFAULT_RATE_WINDOW_MS = 1_000;
@@ -0,0 +1 @@
1
+ export { createRateLimiter, type RateLimitOptions } from './limiter.js';
@@ -0,0 +1 @@
1
+ export { createRateLimiter } from './limiter.js';
@@ -0,0 +1,7 @@
1
+ import type { AnyAsyncFunction, AsyncRateLimiterOptions } from '@tanstack/pacer';
2
+ import { AsyncRateLimiter } from '@tanstack/pacer';
3
+ export type RateLimitOptions<Operation extends AnyAsyncFunction> = Omit<AsyncRateLimiterOptions<Operation>, 'limit' | 'window'> & {
4
+ readonly limit?: number;
5
+ readonly window?: number;
6
+ };
7
+ export declare function createRateLimiter<Operation extends AnyAsyncFunction>(operation: Operation, options?: RateLimitOptions<Operation>): AsyncRateLimiter<Operation>;
@@ -0,0 +1,14 @@
1
+ import { AsyncRateLimiter } from '@tanstack/pacer';
2
+ import { DEFAULT_RATE_LIMIT, DEFAULT_RATE_WINDOW_MS } from './defaults.js';
3
+ export function createRateLimiter(operation, options = {}) {
4
+ if (typeof operation !== 'function')
5
+ throw new TypeError('Rate-limited operation is invalid.');
6
+ if (options === null || typeof options !== 'object') {
7
+ throw new TypeError('Rate-limit options are invalid.');
8
+ }
9
+ return new AsyncRateLimiter(operation, {
10
+ ...options,
11
+ limit: options.limit ?? DEFAULT_RATE_LIMIT,
12
+ window: options.window ?? DEFAULT_RATE_WINDOW_MS,
13
+ });
14
+ }
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_QUEUE_CONCURRENCY = 4;
@@ -0,0 +1 @@
1
+ export const DEFAULT_QUEUE_CONCURRENCY = 4;
@@ -0,0 +1 @@
1
+ export { createQueue, type QueueOptions } from './queue.js';
@@ -0,0 +1 @@
1
+ export { createQueue } from './queue.js';
@@ -0,0 +1,6 @@
1
+ import type { AsyncQueuerOptions } from '@tanstack/pacer';
2
+ import { AsyncQueuer } from '@tanstack/pacer';
3
+ export type QueueOptions<Value> = Omit<AsyncQueuerOptions<Value>, 'concurrency'> & {
4
+ readonly concurrency?: number;
5
+ };
6
+ export declare function createQueue<Value>(consume: (value: Value) => Promise<unknown>, options?: QueueOptions<Value>): AsyncQueuer<Value>;
@@ -0,0 +1,12 @@
1
+ import { AsyncQueuer } from '@tanstack/pacer';
2
+ import { DEFAULT_QUEUE_CONCURRENCY } from './defaults.js';
3
+ export function createQueue(consume, options = {}) {
4
+ if (typeof consume !== 'function')
5
+ throw new TypeError('Queue consumer is invalid.');
6
+ if (options === null || typeof options !== 'object')
7
+ throw new TypeError('Queue options are invalid.');
8
+ return new AsyncQueuer(consume, {
9
+ ...options,
10
+ concurrency: options.concurrency ?? DEFAULT_QUEUE_CONCURRENCY,
11
+ });
12
+ }
@@ -0,0 +1,6 @@
1
+ export declare const DEFAULT_RETRY_ATTEMPTS = 3;
2
+ export declare const DEFAULT_RETRY_BASE_WAIT_MS = 250;
3
+ export declare const DEFAULT_RETRY_MAX_WAIT_MS = 5000;
4
+ export declare const DEFAULT_RETRY_JITTER = 0.2;
5
+ export declare function positive(input: number, label: string): number;
6
+ export declare function nonNegative(input: number, label: string): number;
@@ -0,0 +1,16 @@
1
+ export const DEFAULT_RETRY_ATTEMPTS = 3;
2
+ export const DEFAULT_RETRY_BASE_WAIT_MS = 250;
3
+ export const DEFAULT_RETRY_MAX_WAIT_MS = 5_000;
4
+ export const DEFAULT_RETRY_JITTER = 0.2;
5
+ export function positive(input, label) {
6
+ if (!Number.isSafeInteger(input) || input < 1) {
7
+ throw new TypeError(`${label} must be a positive safe integer.`);
8
+ }
9
+ return input;
10
+ }
11
+ export function nonNegative(input, label) {
12
+ if (!Number.isFinite(input) || input < 0) {
13
+ throw new TypeError(`${label} must be a finite non-negative number.`);
14
+ }
15
+ return input;
16
+ }
@@ -0,0 +1 @@
1
+ export { retry, type RetryOptions } from './retry.js';
@@ -0,0 +1 @@
1
+ export { retry } from './retry.js';
@@ -0,0 +1,9 @@
1
+ export interface RetryOptions {
2
+ readonly maxAttempts?: number;
3
+ readonly baseWait?: number;
4
+ readonly maxWait?: number;
5
+ readonly jitter?: number;
6
+ readonly shouldRetry?: (error: Error, attempt: number) => boolean;
7
+ }
8
+ /** Retry with bounded exponential backoff and never swallow the final failure. */
9
+ export declare function retry<Result>(operation: () => Promise<Result>, options?: RetryOptions): Promise<Result>;
@@ -0,0 +1,55 @@
1
+ import { AsyncRetryer } from '@tanstack/pacer';
2
+ import { DEFAULT_RETRY_ATTEMPTS, DEFAULT_RETRY_BASE_WAIT_MS, DEFAULT_RETRY_JITTER, DEFAULT_RETRY_MAX_WAIT_MS, nonNegative, positive, } from './defaults.js';
3
+ /** Retry with bounded exponential backoff and never swallow the final failure. */
4
+ export async function retry(operation, options = {}) {
5
+ if (typeof operation !== 'function')
6
+ throw new TypeError('Retry operation is invalid.');
7
+ if (options === null || typeof options !== 'object') {
8
+ throw new TypeError('Retry options are invalid.');
9
+ }
10
+ if (options.shouldRetry !== undefined && typeof options.shouldRetry !== 'function') {
11
+ throw new TypeError('Retry classifier is invalid.');
12
+ }
13
+ const attempts = positive(options.maxAttempts ?? DEFAULT_RETRY_ATTEMPTS, 'maxAttempts');
14
+ const baseWait = nonNegative(options.baseWait ?? DEFAULT_RETRY_BASE_WAIT_MS, 'baseWait');
15
+ const maxWait = nonNegative(options.maxWait ?? DEFAULT_RETRY_MAX_WAIT_MS, 'maxWait');
16
+ const jitter = options.jitter ?? DEFAULT_RETRY_JITTER;
17
+ if (!Number.isFinite(jitter) || jitter < 0 || jitter > 1) {
18
+ throw new TypeError('jitter must be between zero and one.');
19
+ }
20
+ let succeeded = false;
21
+ let failure;
22
+ const retryer = new AsyncRetryer(async () => {
23
+ try {
24
+ const result = await operation();
25
+ succeeded = true;
26
+ failure = undefined;
27
+ return result;
28
+ }
29
+ catch (error) {
30
+ succeeded = false;
31
+ failure = error;
32
+ throw error;
33
+ }
34
+ }, {
35
+ backoff: 'exponential',
36
+ baseWait,
37
+ maxWait,
38
+ jitter,
39
+ maxAttempts: (current) => {
40
+ const error = current.store.state.lastError;
41
+ const attempt = current.store.state.currentAttempt;
42
+ if (error !== undefined && options.shouldRetry?.(error, attempt) === false)
43
+ return attempt;
44
+ return attempts;
45
+ },
46
+ throwOnError: 'last',
47
+ });
48
+ const result = await retryer.execute();
49
+ if (!succeeded) {
50
+ if (failure !== undefined)
51
+ throw failure;
52
+ throw new Error('Retry ended without an operation result.');
53
+ }
54
+ return result;
55
+ }
@@ -1,4 +1,2 @@
1
- export type { ClientFactory, ClientPoolConfig } from './pool.js';
2
- export { ClientPool } from './pool.js';
3
- export { PoolClosedError } from './errors.js';
4
- //# sourceMappingURL=index.d.ts.map
1
+ export { ClientPool, type ClientFactory, type ClientPoolOptions } from './pool.js';
2
+ export type { ClientTarget } from './target.js';
@@ -1,3 +1 @@
1
1
  export { ClientPool } from './pool.js';
2
- export { PoolClosedError } from './errors.js';
3
- //# sourceMappingURL=index.js.map