@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,123 @@
1
+ import * as codecs from '@astrale-os/kernel-protocol/codecs';
2
+ import * as publicationCodec from '@astrale-os/kernel-protocol/publication/publication';
3
+ import { ClientError } from '../../errors/index.js';
4
+ import { allowEndpoint } from '../context/index.js';
5
+ import { runAcquisition } from './transport.js';
6
+ export class PublicationDiscovery {
7
+ options;
8
+ publication;
9
+ revision = 0;
10
+ constructor(options) {
11
+ this.options = options;
12
+ }
13
+ current() {
14
+ return this.publication;
15
+ }
16
+ async revalidate(operation) {
17
+ const revision = this.revision;
18
+ const previous = this.publication;
19
+ const discovered = await this.fetch(operation, previous);
20
+ if (revision !== this.revision)
21
+ return this.revalidate(operation);
22
+ const retained = previous?.etag === discovered.etag ? previous : discovered;
23
+ this.publication = retained;
24
+ return retained;
25
+ }
26
+ invalidate() {
27
+ this.revision += 1;
28
+ this.publication = undefined;
29
+ }
30
+ async fetch(operation, previous) {
31
+ const url = publicationCodec.url(this.options.kernel);
32
+ allowEndpoint(url, this.options.policy);
33
+ const response = await runAcquisition(operation, 'publication', 'unknown', 'Kernel Publication could not be retrieved.', (signal) => this.options.fetch(url, {
34
+ headers: {
35
+ accept: 'application/json',
36
+ ...(previous === undefined ? {} : { 'if-none-match': `"${previous.etag}"` }),
37
+ },
38
+ redirect: 'manual',
39
+ signal,
40
+ }));
41
+ requireExactResponse(response, url, 'Publication discovery');
42
+ if (response.status === 304) {
43
+ if (previous === undefined) {
44
+ throw new ClientError('Publication discovery returned an unexpected not-modified response.');
45
+ }
46
+ const etag = response.headers.get('etag');
47
+ if (etag !== null && etag !== `"${previous.etag}"`) {
48
+ throw new ClientError('Publication not-modified ETag differs from the cached snapshot.');
49
+ }
50
+ return previous;
51
+ }
52
+ if (!response.ok) {
53
+ throw new ClientError(`Publication discovery returned HTTP ${response.status}.`);
54
+ }
55
+ const body = await runAcquisition(operation, 'publication', 'receive', 'Kernel Publication response could not be read.', (signal) => boundedResponse(response, this.options.maximumBytes, signal));
56
+ const admitted = publicationCodec.accept(codecs.json.decode(body));
57
+ if (admitted.identity.issuer !== this.options.kernel) {
58
+ throw new ClientError('Publication issuer differs from the requested Kernel issuer.');
59
+ }
60
+ const etag = response.headers.get('etag');
61
+ if (etag !== null && etag !== `"${admitted.etag}"`) {
62
+ throw new ClientError('Publication response ETag differs from its canonical content.');
63
+ }
64
+ return admitted;
65
+ }
66
+ }
67
+ export async function boundedResponse(response, maximum, signal) {
68
+ const declared = response.headers.get('content-length');
69
+ if (declared !== null) {
70
+ const length = Number(declared);
71
+ if (!Number.isSafeInteger(length) || length < 0) {
72
+ throw new ClientError('Response Content-Length is invalid.');
73
+ }
74
+ if (length > maximum)
75
+ throw new ClientError('Response exceeds its byte limit.');
76
+ }
77
+ if (response.body === null)
78
+ return new Uint8Array();
79
+ const reader = response.body.getReader();
80
+ const chunks = [];
81
+ let total = 0;
82
+ const abort = () => void reader.cancel(signal.reason).catch(() => undefined);
83
+ if (signal.aborted)
84
+ abort();
85
+ else
86
+ signal.addEventListener('abort', abort, { once: true });
87
+ try {
88
+ while (true) {
89
+ if (signal.aborted)
90
+ throw signal.reason;
91
+ const next = await reader.read();
92
+ if (next.done)
93
+ break;
94
+ total += next.value.byteLength;
95
+ if (total > maximum) {
96
+ await reader.cancel('response exceeds byte limit').catch(() => undefined);
97
+ throw new ClientError('Response exceeds its byte limit.');
98
+ }
99
+ chunks.push(next.value);
100
+ }
101
+ }
102
+ finally {
103
+ signal.removeEventListener('abort', abort);
104
+ reader.releaseLock();
105
+ }
106
+ return join(chunks, total);
107
+ }
108
+ export function requireExactResponse(response, expected, label) {
109
+ if (response.redirected || response.url !== expected) {
110
+ throw new ClientError(`${label} did not return the exact requested URL.`);
111
+ }
112
+ }
113
+ function join(parts, length) {
114
+ if (parts.length === 1)
115
+ return new Uint8Array(parts[0]);
116
+ const output = new Uint8Array(length);
117
+ let offset = 0;
118
+ for (const part of parts) {
119
+ output.set(part, offset);
120
+ offset += part.byteLength;
121
+ }
122
+ return output;
123
+ }
@@ -0,0 +1,12 @@
1
+ import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
2
+ import type { bundle } from '@astrale-os/kernel-dsl/v1';
3
+ import type { publication } from '@astrale-os/kernel-protocol';
4
+ import type { ViewCatalog } from '../views/index.js';
5
+ /** Coherent public observation acquired through one Client Session at one Publication ETag. */
6
+ export interface SessionSnapshot {
7
+ readonly kernel: IssuerId;
8
+ readonly publication: publication.Publication;
9
+ readonly bundle: bundle.Bundle;
10
+ readonly views: ViewCatalog;
11
+ }
12
+ export declare function createSessionSnapshot(kernel: IssuerId, publication: publication.Publication, artifact: bundle.Bundle, views: ViewCatalog): SessionSnapshot;
@@ -0,0 +1,3 @@
1
+ export function createSessionSnapshot(kernel, publication, artifact, views) {
2
+ return Object.freeze({ kernel, publication, bundle: artifact, views });
3
+ }
@@ -0,0 +1,6 @@
1
+ import type { TransportPhase } from '../../errors/index.js';
2
+ import type { SessionOperation } from '../context/index.js';
3
+ type AcquisitionResource = 'publication' | 'bundle';
4
+ /** Normalize only unknown failures from one injected acquisition capability. */
5
+ export declare function runAcquisition<Result>(operation: SessionOperation, resource: AcquisitionResource, phase: Extract<TransportPhase, 'receive' | 'unknown'>, message: string, task: (signal: AbortSignal) => Result | PromiseLike<Result>): Promise<Result>;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ import { ClientError, TransportError } from '../../errors/index.js';
2
+ import { runSessionOperation } from '../context/index.js';
3
+ /** Normalize only unknown failures from one injected acquisition capability. */
4
+ export async function runAcquisition(operation, resource, phase, message, task) {
5
+ try {
6
+ return await runSessionOperation(operation, task);
7
+ }
8
+ catch (cause) {
9
+ if (cause instanceof ClientError)
10
+ throw cause;
11
+ throw TransportError.acquisition(message, { cause, phase, resource });
12
+ }
13
+ }
@@ -1,16 +1,10 @@
1
- export { ClientSession } from './client-session.js';
2
- export { delegationMintVia } from './delegation-mint.js';
3
- export type { IdentityInput, ClientSessionCallOptions, ClientSessionConfig } from './config.js';
4
- export { DispatchRouteCache, MemoryDispatchRouteStore } from './dispatch-routes.js';
5
- export type { DispatchRoute, DispatchRouteStore } from './dispatch-routes.js';
6
- export type { BoundClientSessionView, SchemaTypedClientSession } from './types.js';
7
- export type { AfterCallCtx, AfterSignalCtx, BeforeCallCtx, DelegationMintCtx, DelegationRefusedCtx, RedirectFollowCtx, RedirectRefusedCtx, ClientSessionErrorCtx, ClientSessionHooks, ClientSessionHop, } from './hooks.js';
8
- export type { RedirectDecision, RedirectHop, RedirectPolicy } from './redirect/policy.js';
9
- export { allowAllPolicy, allowlistPolicy, promptPolicy, strictPolicy } from './redirect/policy.js';
10
- export type { DelegationContext, DelegationDecision, DelegationPolicy, } from './delegation/policy.js';
11
- export { allowAllDelegations, allowlistDelegations, promptDelegations, scopedSelf, } from './delegation/policy.js';
12
- export { DelegationCache } from './delegation/cache.js';
13
- export type { DelegationCacheConfig, DelegationMintFn, DelegationMintResult, } from './delegation/cache.js';
14
- export type { SchemaPersistence } from '../schema/persistence.js';
15
- export { ClientSessionError, DelegationMintError, DelegationPolicyError, DelegationRefusedError, HopLimitExceededError, IdentityPickerError, PersistenceLoadFailedError, PoolClosedError, RedirectPolicyError, RedirectRefusedError, RegistryWriteFailedError, SchemaOwnershipConflictError, UnresolvedIdentityError, } from './errors/index.js';
16
- //# sourceMappingURL=index.d.ts.map
1
+ export type { SessionControlOptions, SessionPolicy } from './context/index.js';
2
+ export { bindSession, type BoundClientSession, type BoundSessionControls, type BoundSessionSource, } from './bound.js';
3
+ export type { ReadyInstallation } from '../schema/index.js';
4
+ export type { SessionSnapshot } from './discovery/index.js';
5
+ export type { Auth, SessionAuth, SessionEnvelopeTransport, SessionRequestOptions, } from './routing/index.js';
6
+ export { ClientSession, connect, type ClientSessionOptions, type ConnectOptions, } from './session.js';
7
+ export type { CallableReference, InputOfReference, InstanceCallableReference, OutputOfReference, } from './reference.js';
8
+ export { reference } from './reference.js';
9
+ export type { ResolvedView, ViewCatalog } from './views/index.js';
10
+ export type { DomainBinding } from '../graph/domain/index.js';
@@ -1,9 +1,3 @@
1
- export { ClientSession } from './client-session.js';
2
- export { delegationMintVia } from './delegation-mint.js';
3
- export { DispatchRouteCache, MemoryDispatchRouteStore } from './dispatch-routes.js';
4
- export { allowAllPolicy, allowlistPolicy, promptPolicy, strictPolicy } from './redirect/policy.js';
5
- export { allowAllDelegations, allowlistDelegations, promptDelegations, scopedSelf, } from './delegation/policy.js';
6
- export { DelegationCache } from './delegation/cache.js';
7
- // Every ClientSession-thrown error shape, one import surface.
8
- export { ClientSessionError, DelegationMintError, DelegationPolicyError, DelegationRefusedError, HopLimitExceededError, IdentityPickerError, PersistenceLoadFailedError, PoolClosedError, RedirectPolicyError, RedirectRefusedError, RegistryWriteFailedError, SchemaOwnershipConflictError, UnresolvedIdentityError, } from './errors/index.js';
9
- //# sourceMappingURL=index.js.map
1
+ export { bindSession, } from './bound.js';
2
+ export { ClientSession, connect, } from './session.js';
3
+ export { reference } from './reference.js';
@@ -0,0 +1,36 @@
1
+ import type { Path as PathValue, PathLike } from '@astrale-os/kernel-core/path';
2
+ import type { CallableInputOf, CallableOutputOf, CallableResultOf, Domain, MethodInheritance, ResolvedFunction, ResolvedMethod } from '@astrale-os/kernel-dsl/v1';
3
+ import type { Revision } from '@astrale-os/kernel-dsl/v1/addressing';
4
+ import { type Key as KeyType } from '@astrale-os/kernel-dsl/v1/addressing';
5
+ import type { Binary, Input, Result } from '../client/index.js';
6
+ declare const REFERENCE_INPUT: unique symbol;
7
+ declare const REFERENCE_OUTPUT: unique symbol;
8
+ export interface CallableReference<InputValue extends Input = Input, Output = unknown> {
9
+ readonly origin: KeyType.Origin;
10
+ readonly revision: Revision;
11
+ readonly callable: KeyType.Callable;
12
+ readonly target: PathValue;
13
+ readonly outputMode: Exclude<Result['kind'], 'redirect'>;
14
+ readonly [REFERENCE_INPUT]?: InputValue;
15
+ readonly [REFERENCE_OUTPUT]?: Output;
16
+ }
17
+ export interface InstanceCallableReference<InputValue extends Input = Input, Output = unknown> {
18
+ (receiver: PathLike): CallableReference<InputValue, Output>;
19
+ readonly origin: KeyType.Origin;
20
+ readonly revision: Revision;
21
+ readonly callable: KeyType.Callable;
22
+ readonly outputMode: Exclude<Result['kind'], 'redirect'>;
23
+ }
24
+ export type InputOfReference<Reference extends CallableReference> = Reference extends CallableReference<infer InputValue, unknown> ? InputValue : never;
25
+ export type OutputOfReference<Reference extends CallableReference> = Reference extends CallableReference<infer _Input, infer Output> ? Output : never;
26
+ type ReferenceInput<Callable> = unknown extends CallableInputOf<Callable> ? Input : Extract<CallableInputOf<Callable>, Input>;
27
+ type ReferenceOutput<Callable> = unknown extends CallableOutputOf<Callable> ? unknown : CallableResultOf<Callable, Binary>;
28
+ type ExecutableMethodInheritance = Exclude<MethodInheritance, 'abstract'>;
29
+ type ExecutableStaticMethod = ResolvedMethod<unknown, unknown, true, ExecutableMethodInheritance>;
30
+ type ExecutableInstanceMethod = ResolvedMethod<unknown, unknown, false, ExecutableMethodInheritance>;
31
+ /** Project one exact resolved Function or static Method into a typed Client reference. */
32
+ export declare function reference<const Callable extends ResolvedFunction | ExecutableStaticMethod>(domain: Pick<Domain, 'origin' | 'revision'>, callable: Callable): CallableReference<ReferenceInput<Callable>, ReferenceOutput<Callable>>;
33
+ /** Project one exact resolved instance Method into a receiver-bound typed Client reference. */
34
+ export declare function reference<const Callable extends ExecutableInstanceMethod>(domain: Pick<Domain, 'origin' | 'revision'>, callable: Callable): InstanceCallableReference<ReferenceInput<Callable>, ReferenceOutput<Callable>>;
35
+ export declare function admitReference(input: CallableReference): CallableReference;
36
+ export {};
@@ -0,0 +1,74 @@
1
+ import { Path } from '@astrale-os/kernel-core/path';
2
+ import { callableAddress, Key, patterns, } from '@astrale-os/kernel-dsl/v1/addressing';
3
+ export function reference(domain, callable) {
4
+ if ('owner' in callable && callable.inheritance === 'abstract')
5
+ invalid();
6
+ const common = Object.freeze({
7
+ origin: domain.origin,
8
+ revision: domain.revision,
9
+ callable: callable.key,
10
+ outputMode: callable.output.mode,
11
+ });
12
+ if ('owner' in callable && !callable.static) {
13
+ const bind = (receiver) => admitReference({
14
+ ...common,
15
+ target: Path.instanceMethod(Path.from(receiver), callable.name),
16
+ });
17
+ return Object.assign(bind, common);
18
+ }
19
+ const target = 'owner' in callable
20
+ ? Path.staticMethod(Path.project(callable.owner.ref), callable.name)
21
+ : Path.project(callable.ref);
22
+ return admitReference({ ...common, target });
23
+ }
24
+ export function admitReference(input) {
25
+ if (input === null || typeof input !== 'object')
26
+ invalid();
27
+ if (typeof input.origin !== 'string' ||
28
+ !patterns.origin.test(input.origin) ||
29
+ typeof input.revision !== 'string' ||
30
+ !patterns.revision.test(input.revision) ||
31
+ typeof input.callable !== 'string' ||
32
+ !Key.is(input.callable) ||
33
+ Key.origin(input.callable) !== input.origin ||
34
+ !['value', 'stream', 'binary'].includes(input.outputMode))
35
+ invalid();
36
+ const target = Path.from(input.target);
37
+ if (!matchesCallable(target, input.callable))
38
+ invalid();
39
+ return Object.freeze({
40
+ origin: input.origin,
41
+ revision: input.revision,
42
+ callable: input.callable,
43
+ target,
44
+ outputMode: input.outputMode,
45
+ });
46
+ }
47
+ function matchesCallable(target, callable) {
48
+ const coordinate = callableAddress(callable);
49
+ const { anchor, steps } = target.ast;
50
+ const last = steps.at(-1);
51
+ if (coordinate.kind === 'method') {
52
+ if (last?.kind !== 'method' || last.name !== coordinate.name)
53
+ return false;
54
+ if (last.dispatch === 'instance')
55
+ return true;
56
+ const owner = steps.at(-2);
57
+ return (anchor.kind === 'domain' &&
58
+ anchor.origin === Key.origin(callable) &&
59
+ steps.length === 2 &&
60
+ owner?.kind === 'projection' &&
61
+ owner.projection.kind === 'class' &&
62
+ owner.projection.name === coordinate.owner.name);
63
+ }
64
+ const projection = steps[0];
65
+ return (anchor.kind === 'domain' &&
66
+ anchor.origin === Key.origin(callable) &&
67
+ steps.length === 1 &&
68
+ projection?.kind === 'projection' &&
69
+ projection.projection.kind === 'function' &&
70
+ projection.projection.name === coordinate.name);
71
+ }
72
+ function invalid() {
73
+ throw new TypeError('Callable reference is invalid.');
74
+ }
@@ -0,0 +1,18 @@
1
+ import type * as invocation from '@astrale-os/kernel-protocol/invocation';
2
+ import type { SessionOperation } from '../context/index.js';
3
+ export interface Auth {
4
+ readonly credential?: string;
5
+ readonly delegate?: invocation.Delegate;
6
+ }
7
+ /** Resolve source-Kernel authority and the audience-free delegation choice for one Call. */
8
+ export interface SessionAuth {
9
+ /** Default TTL for authenticated Calls whose Auth omits a delegation override. */
10
+ readonly ttlSeconds: number;
11
+ resolve(call: invocation.Call, signal: AbortSignal): Auth | Promise<Auth>;
12
+ }
13
+ export interface EffectiveAuth {
14
+ readonly credential?: string;
15
+ readonly delegate?: invocation.Delegate;
16
+ }
17
+ export declare function admitSessionAuth(input: SessionAuth | undefined): SessionAuth | undefined;
18
+ export declare function resolveAuth(resolver: SessionAuth | undefined, call: invocation.Call, operation: SessionOperation): Promise<EffectiveAuth>;
@@ -0,0 +1,39 @@
1
+ import * as protocol from '@astrale-os/kernel-protocol/invocation';
2
+ import { ClientError } from '../../errors/index.js';
3
+ import { runSessionOperation } from '../context/index.js';
4
+ export function admitSessionAuth(input) {
5
+ if (input === undefined)
6
+ return undefined;
7
+ if (input === null || typeof input !== 'object' || typeof input.resolve !== 'function') {
8
+ throw new TypeError('Session auth resolver is invalid.');
9
+ }
10
+ if (!Number.isSafeInteger(input.ttlSeconds) || input.ttlSeconds < 1) {
11
+ throw new TypeError('Session auth ttlSeconds must be a positive safe integer.');
12
+ }
13
+ return Object.freeze({ ttlSeconds: input.ttlSeconds, resolve: input.resolve.bind(input) });
14
+ }
15
+ export async function resolveAuth(resolver, call, operation) {
16
+ if (resolver === undefined)
17
+ return Object.freeze({});
18
+ const input = await runSessionOperation(operation, (signal) => resolver.resolve(call, signal));
19
+ if (input === null || typeof input !== 'object' || Array.isArray(input)) {
20
+ throw new ClientError('Session auth resolver returned an invalid value.');
21
+ }
22
+ const fields = Reflect.ownKeys(input);
23
+ if (fields.some((field) => field !== 'credential' && field !== 'delegate')) {
24
+ throw new ClientError('Session auth resolver returned unsupported fields.');
25
+ }
26
+ const credential = input.credential;
27
+ if (credential !== undefined && (typeof credential !== 'string' || credential.length === 0)) {
28
+ throw new ClientError('Session auth resolver returned an invalid credential.');
29
+ }
30
+ if (credential === undefined && input.delegate !== undefined) {
31
+ throw new ClientError('Session delegation overrides require a source credential.');
32
+ }
33
+ if (credential === undefined)
34
+ return Object.freeze({});
35
+ const delegate = input.delegate === undefined
36
+ ? protocol.acceptDelegate({ ttlSeconds: resolver.ttlSeconds })
37
+ : protocol.acceptDelegate(input.delegate);
38
+ return Object.freeze({ credential, delegate });
39
+ }
@@ -0,0 +1,20 @@
1
+ import type { invocation } from '@astrale-os/kernel-protocol';
2
+ import type { EffectiveAuth } from './auth.js';
3
+ import type { SchemaExpectation } from './expectation.js';
4
+ export interface LearnedRoute {
5
+ readonly route: invocation.Route;
6
+ readonly credential?: string;
7
+ readonly expiresAt: number;
8
+ }
9
+ /** Confidential, process-local warm routing state owned by exactly one ClientSession. */
10
+ export declare class RouteCache {
11
+ private readonly maximumAgeMs;
12
+ private readonly maximumSize;
13
+ private readonly entries;
14
+ constructor(maximumAgeMs: number, maximumSize?: number);
15
+ key(source: string, call: invocation.Call, auth: EffectiveAuth, expected?: SchemaExpectation): Promise<string>;
16
+ get(key: string, now?: number): LearnedRoute | undefined;
17
+ learn(key: string, route: invocation.Route, credential: string | undefined, now?: number): LearnedRoute;
18
+ delete(key: string): void;
19
+ clear(): void;
20
+ }
@@ -0,0 +1,115 @@
1
+ import { DEFAULT_MAXIMUM_ROUTES } from '../context/index.js';
2
+ /** Confidential, process-local warm routing state owned by exactly one ClientSession. */
3
+ export class RouteCache {
4
+ maximumAgeMs;
5
+ maximumSize;
6
+ entries = new Map();
7
+ constructor(maximumAgeMs, maximumSize = DEFAULT_MAXIMUM_ROUTES) {
8
+ this.maximumAgeMs = maximumAgeMs;
9
+ this.maximumSize = maximumSize;
10
+ }
11
+ async key(source, call, auth, expected) {
12
+ const credential = auth.credential === undefined ? 'anonymous' : await digestText(auth.credential);
13
+ const delegate = auth.delegate === undefined ? 'anonymous' : await digestText(canonicalDelegate(auth.delegate));
14
+ return JSON.stringify([
15
+ source,
16
+ call.target,
17
+ credential,
18
+ delegate,
19
+ expected === undefined ? null : [expected.origin, expected.revision],
20
+ ]);
21
+ }
22
+ get(key, now = Date.now()) {
23
+ const entry = this.entries.get(key);
24
+ if (entry === undefined)
25
+ return undefined;
26
+ if (entry.expiresAt <= now) {
27
+ this.entries.delete(key);
28
+ return undefined;
29
+ }
30
+ this.entries.delete(key);
31
+ this.entries.set(key, entry);
32
+ return entry;
33
+ }
34
+ learn(key, route, credential, now = Date.now()) {
35
+ const credentialExpiry = credential === undefined ? undefined : jwtExpiry(credential);
36
+ const expiresAt = Math.min(now + this.maximumAgeMs, credentialExpiry ?? Number.POSITIVE_INFINITY);
37
+ const entry = Object.freeze({
38
+ route,
39
+ ...(credential === undefined ? {} : { credential }),
40
+ expiresAt,
41
+ });
42
+ // A carrier with no supported finite expiry may be used for this follow, but never warmed.
43
+ if (credential !== undefined && credentialExpiry === undefined)
44
+ return entry;
45
+ if (expiresAt <= now)
46
+ return entry;
47
+ this.entries.delete(key);
48
+ while (this.entries.size >= this.maximumSize) {
49
+ const oldest = this.entries.keys().next().value;
50
+ if (oldest === undefined)
51
+ break;
52
+ this.entries.delete(oldest);
53
+ }
54
+ this.entries.set(key, entry);
55
+ return entry;
56
+ }
57
+ delete(key) {
58
+ this.entries.delete(key);
59
+ }
60
+ clear() {
61
+ this.entries.clear();
62
+ }
63
+ }
64
+ function canonicalDelegate(input) {
65
+ return JSON.stringify({
66
+ ttlSeconds: input.ttlSeconds,
67
+ ...(input.attenuation === undefined ? {} : { attenuation: canonicalExpr(input.attenuation) }),
68
+ });
69
+ }
70
+ function canonicalExpr(input) {
71
+ if (input.kind === 'identity') {
72
+ return 'self' in input
73
+ ? { kind: 'identity', self: true }
74
+ : { kind: 'identity', credential: input.credential };
75
+ }
76
+ if (input.kind === 'exclude') {
77
+ return {
78
+ kind: 'exclude',
79
+ base: canonicalExpr(input.base),
80
+ excluded: input.excluded.map(canonicalExpr),
81
+ };
82
+ }
83
+ return { kind: input.kind, operands: input.operands.map(canonicalExpr) };
84
+ }
85
+ async function digestText(input) {
86
+ if (globalThis.crypto?.subtle === undefined) {
87
+ throw new TypeError('Session route caching requires Web Crypto SHA-256 support.');
88
+ }
89
+ const bytes = await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(input));
90
+ return [...new Uint8Array(bytes)].map((byte) => byte.toString(16).padStart(2, '0')).join('');
91
+ }
92
+ function jwtExpiry(input) {
93
+ const parts = input.split('.');
94
+ if (parts.length !== 3)
95
+ return undefined;
96
+ try {
97
+ const encoded = parts[1].replace(/-/gu, '+').replace(/_/gu, '/');
98
+ const padding = '='.repeat((4 - (encoded.length % 4)) % 4);
99
+ const json = decodeBase64(encoded + padding);
100
+ const payload = JSON.parse(json);
101
+ return typeof payload.exp === 'number' && Number.isSafeInteger(payload.exp) && payload.exp > 0
102
+ ? payload.exp * 1_000
103
+ : undefined;
104
+ }
105
+ catch {
106
+ return undefined;
107
+ }
108
+ }
109
+ function decodeBase64(input) {
110
+ if (typeof globalThis.atob === 'function') {
111
+ const binary = globalThis.atob(input);
112
+ return new TextDecoder().decode(Uint8Array.from(binary, (character) => character.charCodeAt(0)));
113
+ }
114
+ throw new TypeError('Session route caching requires base64 decoding support.');
115
+ }
@@ -0,0 +1,34 @@
1
+ import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
2
+ import type { Call, Result } from '../../client/index.js';
3
+ import type { SessionOperation, SessionPolicy } from '../context/index.js';
4
+ import type { SessionDiscovery } from '../discovery/index.js';
5
+ import type { SessionAuth } from './auth.js';
6
+ import type { RouteCache } from './cache.js';
7
+ import type { ClientPoolCapability } from './envelope.js';
8
+ import type { SchemaExpectation } from './expectation.js';
9
+ import type { SessionEnvelopeTransport, SessionRequestOptions } from './request.js';
10
+ export interface SessionDispatcherOptions {
11
+ readonly kernel: IssuerId;
12
+ readonly sourceEndpoint: string;
13
+ readonly pool: ClientPoolCapability;
14
+ readonly websocketAvailable: boolean;
15
+ readonly auth?: SessionAuth;
16
+ readonly cache: RouteCache;
17
+ readonly policy: Readonly<SessionPolicy>;
18
+ readonly envelopeTransport: SessionEnvelopeTransport;
19
+ readonly discovery: SessionDiscovery;
20
+ readonly requireOpen: () => void;
21
+ }
22
+ export declare class SessionDispatcher {
23
+ private readonly state;
24
+ constructor(state: SessionDispatcherOptions);
25
+ dispatch(input: Call, options: SessionRequestOptions, operation: SessionOperation, expected?: SchemaExpectation): Promise<Result>;
26
+ private dispatchSource;
27
+ private followSource;
28
+ private dispatchDestinationWithRecovery;
29
+ private dispatchDestination;
30
+ private sourceKernel;
31
+ }
32
+ export declare function requireResultKind<Kind extends 'value' | 'stream' | 'binary'>(expected: Kind, result: Result): Extract<Result, {
33
+ kind: Kind;
34
+ }>;