@astrale-os/shell-react 0.2.9 → 0.2.10-beta.3

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 (335) hide show
  1. package/dist/application/apps/app-host.d.ts +4 -15
  2. package/dist/application/apps/app-host.d.ts.map +1 -1
  3. package/dist/application/apps/app-host.js +1 -1
  4. package/dist/application/apps/apps.hook.d.ts +7 -4
  5. package/dist/application/apps/apps.hook.d.ts.map +1 -1
  6. package/dist/application/apps/apps.hook.js +10 -2
  7. package/dist/application/apps/domains.hook.d.ts +1 -1
  8. package/dist/application/apps/domains.hook.d.ts.map +1 -1
  9. package/dist/application/apps/domains.hook.js +1 -1
  10. package/dist/application/apps/open-app.hook.d.ts +2 -3
  11. package/dist/application/apps/open-app.hook.d.ts.map +1 -1
  12. package/dist/application/index.d.ts +2 -4
  13. package/dist/application/index.d.ts.map +1 -1
  14. package/dist/application/index.js +2 -3
  15. package/dist/application/spaces/space.hook.d.ts +2 -2
  16. package/dist/application/spaces/space.hook.d.ts.map +1 -1
  17. package/dist/application/spaces/space.hook.js +2 -2
  18. package/dist/application/spaces/spaces.hook.d.ts +2 -3
  19. package/dist/application/spaces/spaces.hook.d.ts.map +1 -1
  20. package/dist/application/spaces/spaces.hook.js +10 -3
  21. package/dist/auth/act-as.context.d.ts +15 -32
  22. package/dist/auth/act-as.context.d.ts.map +1 -1
  23. package/dist/auth/act-as.context.js +22 -66
  24. package/dist/auth/auth.hook.d.ts +1 -0
  25. package/dist/auth/auth.hook.d.ts.map +1 -1
  26. package/dist/auth/auth.hook.js +2 -22
  27. package/dist/auth/can.hook.d.ts +10 -38
  28. package/dist/auth/can.hook.d.ts.map +1 -1
  29. package/dist/auth/can.hook.js +35 -110
  30. package/dist/auth/index.d.ts +1 -0
  31. package/dist/auth/index.d.ts.map +1 -1
  32. package/dist/auth/self.hook.d.ts +2 -2
  33. package/dist/auth/self.hook.d.ts.map +1 -1
  34. package/dist/auth/self.hook.js +0 -7
  35. package/dist/auth/session-kernel.d.ts +2 -3
  36. package/dist/auth/session-kernel.d.ts.map +1 -1
  37. package/dist/auth/session-kernel.js +4 -13
  38. package/dist/components/astrale.d.ts +14 -0
  39. package/dist/components/astrale.d.ts.map +1 -0
  40. package/dist/components/astrale.js +12 -0
  41. package/dist/components/boundaries.d.ts +47 -0
  42. package/dist/components/boundaries.d.ts.map +1 -0
  43. package/dist/components/boundaries.js +55 -0
  44. package/dist/components/can.d.ts +11 -0
  45. package/dist/components/can.d.ts.map +1 -0
  46. package/dist/components/can.js +5 -0
  47. package/dist/components/index.d.ts +6 -0
  48. package/dist/components/index.d.ts.map +1 -0
  49. package/dist/components/index.js +3 -0
  50. package/dist/graph/call/call.hook.d.ts +8 -18
  51. package/dist/graph/call/call.hook.d.ts.map +1 -1
  52. package/dist/graph/call/call.hook.js +7 -13
  53. package/dist/graph/call/stream.hook.d.ts +12 -20
  54. package/dist/graph/call/stream.hook.d.ts.map +1 -1
  55. package/dist/graph/call/stream.hook.js +55 -111
  56. package/dist/graph/graph.context.d.ts +4 -3
  57. package/dist/graph/graph.context.d.ts.map +1 -1
  58. package/dist/graph/graph.context.js +2 -8
  59. package/dist/graph/guards.error.d.ts +7 -8
  60. package/dist/graph/guards.error.d.ts.map +1 -1
  61. package/dist/graph/guards.error.js +11 -7
  62. package/dist/graph/index.d.ts +8 -16
  63. package/dist/graph/index.d.ts.map +1 -1
  64. package/dist/graph/index.js +3 -7
  65. package/dist/graph/memory/read/envelope.d.ts +22 -54
  66. package/dist/graph/memory/read/envelope.d.ts.map +1 -1
  67. package/dist/graph/memory/read/envelope.js +26 -20
  68. package/dist/graph/memory/read/idle.d.ts +1 -15
  69. package/dist/graph/memory/read/idle.d.ts.map +1 -1
  70. package/dist/graph/memory/read/idle.js +4 -13
  71. package/dist/graph/query-definition.hook.d.ts +11 -0
  72. package/dist/graph/query-definition.hook.d.ts.map +1 -0
  73. package/dist/graph/query-definition.hook.js +205 -0
  74. package/dist/graph/resource.d.ts +34 -0
  75. package/dist/graph/resource.d.ts.map +1 -0
  76. package/dist/graph/resource.js +244 -0
  77. package/dist/graph/store.d.ts +25 -0
  78. package/dist/graph/store.d.ts.map +1 -0
  79. package/dist/graph/store.js +69 -0
  80. package/dist/host/actions.hook.d.ts +34 -0
  81. package/dist/host/actions.hook.d.ts.map +1 -0
  82. package/dist/host/actions.hook.js +125 -0
  83. package/dist/host/components.d.ts +15 -0
  84. package/dist/host/components.d.ts.map +1 -0
  85. package/dist/host/components.js +14 -0
  86. package/dist/host/index.d.ts +5 -0
  87. package/dist/host/index.d.ts.map +1 -0
  88. package/dist/host/index.js +3 -0
  89. package/dist/index.d.ts +26 -37
  90. package/dist/index.d.ts.map +1 -1
  91. package/dist/index.js +20 -31
  92. package/dist/intents/envelope.d.ts +7 -19
  93. package/dist/intents/envelope.d.ts.map +1 -1
  94. package/dist/intents/envelope.js +2 -3
  95. package/dist/intents/send-intent.hook.d.ts +5 -7
  96. package/dist/intents/send-intent.hook.d.ts.map +1 -1
  97. package/dist/intents/send-intent.hook.js +17 -75
  98. package/dist/navigation/adapters/adapter.d.ts +5 -0
  99. package/dist/navigation/adapters/adapter.d.ts.map +1 -1
  100. package/dist/navigation/adapters/memory.adapter.d.ts.map +1 -1
  101. package/dist/navigation/adapters/memory.adapter.js +4 -0
  102. package/dist/navigation/adapters/url.adapter.d.ts.map +1 -1
  103. package/dist/navigation/adapters/url.adapter.js +57 -10
  104. package/dist/navigation/codec.d.ts +60 -0
  105. package/dist/navigation/codec.d.ts.map +1 -0
  106. package/dist/navigation/codec.js +121 -0
  107. package/dist/navigation/history.d.ts +11 -9
  108. package/dist/navigation/history.d.ts.map +1 -1
  109. package/dist/navigation/history.js +6 -8
  110. package/dist/navigation/hooks/ancestors.hook.d.ts +5 -7
  111. package/dist/navigation/hooks/ancestors.hook.d.ts.map +1 -1
  112. package/dist/navigation/hooks/ancestors.hook.js +7 -51
  113. package/dist/navigation/hooks/location.hook.d.ts.map +1 -1
  114. package/dist/navigation/hooks/location.hook.js +4 -6
  115. package/dist/navigation/hooks/scope.hook.d.ts.map +1 -1
  116. package/dist/navigation/hooks/scope.hook.js +4 -6
  117. package/dist/navigation/index.d.ts +4 -2
  118. package/dist/navigation/index.d.ts.map +1 -1
  119. package/dist/navigation/index.js +2 -1
  120. package/dist/navigation/link.d.ts +12 -0
  121. package/dist/navigation/link.d.ts.map +1 -1
  122. package/dist/navigation/link.js +13 -2
  123. package/dist/navigation/location.d.ts +13 -40
  124. package/dist/navigation/location.d.ts.map +1 -1
  125. package/dist/navigation/location.js +14 -76
  126. package/dist/navigation/scope.context.d.ts +17 -26
  127. package/dist/navigation/scope.context.d.ts.map +1 -1
  128. package/dist/navigation/scope.context.js +140 -108
  129. package/dist/navigation/snapshot.d.ts +14 -19
  130. package/dist/navigation/snapshot.d.ts.map +1 -1
  131. package/dist/navigation/snapshot.js +48 -44
  132. package/dist/schema/action.hook.d.ts +44 -0
  133. package/dist/schema/action.hook.d.ts.map +1 -0
  134. package/dist/schema/action.hook.js +72 -0
  135. package/dist/schema/domain.hook.d.ts +12 -7
  136. package/dist/schema/domain.hook.d.ts.map +1 -1
  137. package/dist/schema/domain.hook.js +101 -4
  138. package/dist/schema/index.d.ts +9 -8
  139. package/dist/schema/index.d.ts.map +1 -1
  140. package/dist/schema/index.js +5 -7
  141. package/dist/schema/kernel.hook.d.ts +4 -9
  142. package/dist/schema/kernel.hook.d.ts.map +1 -1
  143. package/dist/schema/kernel.hook.js +4 -6
  144. package/dist/schema/mutation.hook.d.ts +9 -0
  145. package/dist/schema/mutation.hook.d.ts.map +1 -0
  146. package/dist/schema/mutation.hook.js +41 -0
  147. package/dist/schema/object.hook.d.ts +16 -0
  148. package/dist/schema/object.hook.d.ts.map +1 -0
  149. package/dist/schema/object.hook.js +46 -0
  150. package/dist/schema/relation.hook.d.ts +46 -0
  151. package/dist/schema/relation.hook.d.ts.map +1 -0
  152. package/dist/schema/relation.hook.js +136 -0
  153. package/dist/selection/live.d.ts +9 -17
  154. package/dist/selection/live.d.ts.map +1 -1
  155. package/dist/selection/live.js +65 -112
  156. package/dist/selection/scope.context.js +5 -4
  157. package/dist/session/boot/boot.d.ts +1 -13
  158. package/dist/session/boot/boot.d.ts.map +1 -1
  159. package/dist/session/boot/boot.js +9 -27
  160. package/dist/session/index.d.ts +1 -0
  161. package/dist/session/index.d.ts.map +1 -1
  162. package/dist/session/kernel-instance.hook.d.ts +1 -4
  163. package/dist/session/kernel-instance.hook.d.ts.map +1 -1
  164. package/dist/session/kernel-instance.hook.js +1 -5
  165. package/dist/session/provider.d.ts +9 -23
  166. package/dist/session/provider.d.ts.map +1 -1
  167. package/dist/session/provider.js +29 -75
  168. package/dist/session/session.context.d.ts +5 -0
  169. package/dist/session/session.context.d.ts.map +1 -1
  170. package/dist/window/adopt.d.ts +0 -1
  171. package/dist/window/adopt.d.ts.map +1 -1
  172. package/dist/window/hooks/target-node.hook.d.ts +10 -6
  173. package/dist/window/hooks/target-node.hook.d.ts.map +1 -1
  174. package/dist/window/hooks/target-node.hook.js +14 -72
  175. package/dist/window/hooks/views-for.hook.d.ts +4 -3
  176. package/dist/window/hooks/views-for.hook.d.ts.map +1 -1
  177. package/dist/window/hooks/views-for.hook.js +6 -22
  178. package/dist/window/hooks/windows.hook.d.ts.map +1 -1
  179. package/dist/window/hooks/windows.hook.js +3 -4
  180. package/dist/window/host.d.ts +9 -11
  181. package/dist/window/host.d.ts.map +1 -1
  182. package/dist/window/host.js +26 -62
  183. package/dist/window/hub.d.ts +2 -0
  184. package/dist/window/hub.d.ts.map +1 -1
  185. package/dist/window/hub.js +33 -0
  186. package/dist/window/index.d.ts +2 -2
  187. package/dist/window/index.d.ts.map +1 -1
  188. package/dist/window/index.js +2 -2
  189. package/dist/window/lifecycle/mount.d.ts +5 -44
  190. package/dist/window/lifecycle/mount.d.ts.map +1 -1
  191. package/dist/window/lifecycle/mount.js +14 -120
  192. package/dist/window/lifecycle/states.d.ts +0 -5
  193. package/dist/window/lifecycle/states.d.ts.map +1 -1
  194. package/package.json +20 -8
  195. package/src/application/apps/app-host.tsx +11 -15
  196. package/src/application/apps/apps.hook.ts +13 -6
  197. package/src/application/apps/domains.hook.ts +1 -1
  198. package/src/application/apps/open-app.hook.ts +3 -4
  199. package/src/application/index.ts +4 -6
  200. package/src/application/spaces/space.hook.ts +5 -6
  201. package/src/application/spaces/spaces.hook.ts +14 -9
  202. package/src/auth/act-as.context.tsx +37 -91
  203. package/src/auth/auth.hook.ts +2 -30
  204. package/src/auth/can.hook.ts +44 -135
  205. package/src/auth/index.ts +1 -0
  206. package/src/auth/self.hook.ts +2 -9
  207. package/src/auth/session-kernel.ts +6 -16
  208. package/src/components/astrale.tsx +40 -0
  209. package/src/components/boundaries.tsx +113 -0
  210. package/src/components/can.tsx +16 -0
  211. package/src/components/index.ts +13 -0
  212. package/src/graph/call/call.hook.ts +22 -27
  213. package/src/graph/call/stream.hook.ts +66 -143
  214. package/src/graph/graph.context.ts +6 -11
  215. package/src/graph/guards.error.ts +17 -55
  216. package/src/graph/index.ts +23 -17
  217. package/src/graph/memory/read/envelope.ts +40 -65
  218. package/src/graph/memory/read/idle.ts +5 -18
  219. package/src/graph/query-definition.hook.ts +270 -0
  220. package/src/graph/resource.ts +358 -0
  221. package/src/graph/store.ts +97 -0
  222. package/src/host/actions.hook.ts +165 -0
  223. package/src/host/components.tsx +29 -0
  224. package/src/host/index.ts +17 -0
  225. package/src/index.ts +131 -124
  226. package/src/intents/envelope.ts +7 -23
  227. package/src/intents/send-intent.hook.ts +24 -79
  228. package/src/navigation/adapters/adapter.ts +3 -0
  229. package/src/navigation/adapters/memory.adapter.ts +4 -0
  230. package/src/navigation/adapters/url.adapter.ts +48 -8
  231. package/src/navigation/codec.ts +190 -0
  232. package/src/navigation/history.ts +20 -11
  233. package/src/navigation/hooks/ancestors.hook.ts +10 -60
  234. package/src/navigation/hooks/location.hook.ts +4 -6
  235. package/src/navigation/hooks/scope.hook.ts +4 -6
  236. package/src/navigation/index.ts +18 -2
  237. package/src/navigation/link.tsx +27 -2
  238. package/src/navigation/location.ts +26 -93
  239. package/src/navigation/scope.context.tsx +151 -136
  240. package/src/navigation/snapshot.ts +69 -50
  241. package/src/schema/action.hook.ts +146 -0
  242. package/src/schema/domain.hook.ts +127 -11
  243. package/src/schema/index.ts +9 -30
  244. package/src/schema/kernel.hook.ts +6 -13
  245. package/src/schema/mutation.hook.ts +63 -0
  246. package/src/schema/object.hook.ts +85 -0
  247. package/src/schema/relation.hook.ts +253 -0
  248. package/src/selection/live.ts +75 -125
  249. package/src/selection/scope.context.tsx +4 -4
  250. package/src/session/boot/boot.ts +8 -33
  251. package/src/session/index.ts +1 -0
  252. package/src/session/kernel-instance.hook.ts +2 -11
  253. package/src/session/provider.tsx +34 -103
  254. package/src/session/session.context.ts +6 -0
  255. package/src/window/adopt.ts +0 -1
  256. package/src/window/hooks/target-node.hook.ts +20 -85
  257. package/src/window/hooks/views-for.hook.ts +12 -25
  258. package/src/window/hooks/windows.hook.ts +3 -4
  259. package/src/window/host.tsx +35 -77
  260. package/src/window/hub.ts +33 -0
  261. package/src/window/index.ts +3 -3
  262. package/src/window/lifecycle/mount.ts +15 -160
  263. package/src/window/lifecycle/states.ts +1 -5
  264. package/dist/application/roles.hook.d.ts +0 -7
  265. package/dist/application/roles.hook.d.ts.map +0 -1
  266. package/dist/application/roles.hook.js +0 -23
  267. package/dist/graph/memory/base.d.ts +0 -21
  268. package/dist/graph/memory/base.d.ts.map +0 -1
  269. package/dist/graph/memory/base.js +0 -33
  270. package/dist/graph/memory/read/read.d.ts +0 -9
  271. package/dist/graph/memory/read/read.d.ts.map +0 -1
  272. package/dist/graph/memory/read/read.js +0 -87
  273. package/dist/graph/memory/scope.d.ts +0 -7
  274. package/dist/graph/memory/scope.d.ts.map +0 -1
  275. package/dist/graph/memory/scope.js +0 -25
  276. package/dist/graph/mutate/move.hook.d.ts +0 -7
  277. package/dist/graph/mutate/move.hook.d.ts.map +0 -1
  278. package/dist/graph/mutate/move.hook.js +0 -49
  279. package/dist/graph/mutate/mutate.hook.d.ts +0 -17
  280. package/dist/graph/mutate/mutate.hook.d.ts.map +0 -1
  281. package/dist/graph/mutate/mutate.hook.js +0 -45
  282. package/dist/graph/query/children.hook.d.ts +0 -29
  283. package/dist/graph/query/children.hook.d.ts.map +0 -1
  284. package/dist/graph/query/children.hook.js +0 -64
  285. package/dist/graph/query/graph.hook.d.ts +0 -9
  286. package/dist/graph/query/graph.hook.d.ts.map +0 -1
  287. package/dist/graph/query/graph.hook.js +0 -5
  288. package/dist/graph/query/neighbors.hook.d.ts +0 -7
  289. package/dist/graph/query/neighbors.hook.d.ts.map +0 -1
  290. package/dist/graph/query/neighbors.hook.js +0 -104
  291. package/dist/graph/query/node.hook.d.ts +0 -14
  292. package/dist/graph/query/node.hook.d.ts.map +0 -1
  293. package/dist/graph/query/node.hook.js +0 -43
  294. package/dist/graph/query/query.hook.d.ts +0 -14
  295. package/dist/graph/query/query.hook.d.ts.map +0 -1
  296. package/dist/graph/query/query.hook.js +0 -23
  297. package/dist/schema/bind-read.d.ts +0 -37
  298. package/dist/schema/bind-read.d.ts.map +0 -1
  299. package/dist/schema/bind-read.js +0 -205
  300. package/dist/schema/binding.d.ts +0 -21
  301. package/dist/schema/binding.d.ts.map +0 -1
  302. package/dist/schema/binding.js +0 -99
  303. package/dist/schema/function.hook.d.ts +0 -9
  304. package/dist/schema/function.hook.d.ts.map +0 -1
  305. package/dist/schema/function.hook.js +0 -40
  306. package/dist/schema/method.hook.d.ts +0 -14
  307. package/dist/schema/method.hook.d.ts.map +0 -1
  308. package/dist/schema/method.hook.js +0 -49
  309. package/dist/schema/tag.d.ts +0 -11
  310. package/dist/schema/tag.d.ts.map +0 -1
  311. package/dist/schema/tag.js +0 -11
  312. package/dist/schema/types.d.ts +0 -73
  313. package/dist/schema/types.d.ts.map +0 -1
  314. package/dist/schema/types.js +0 -1
  315. package/dist/schema/write.d.ts +0 -16
  316. package/dist/schema/write.d.ts.map +0 -1
  317. package/dist/schema/write.js +0 -56
  318. package/src/application/roles.hook.ts +0 -41
  319. package/src/graph/memory/base.ts +0 -50
  320. package/src/graph/memory/read/read.ts +0 -103
  321. package/src/graph/memory/scope.ts +0 -29
  322. package/src/graph/mutate/move.hook.ts +0 -70
  323. package/src/graph/mutate/mutate.hook.ts +0 -69
  324. package/src/graph/query/children.hook.ts +0 -136
  325. package/src/graph/query/graph.hook.ts +0 -13
  326. package/src/graph/query/neighbors.hook.ts +0 -159
  327. package/src/graph/query/node.hook.ts +0 -83
  328. package/src/graph/query/query.hook.ts +0 -42
  329. package/src/schema/bind-read.ts +0 -319
  330. package/src/schema/binding.ts +0 -146
  331. package/src/schema/function.hook.ts +0 -68
  332. package/src/schema/method.hook.ts +0 -103
  333. package/src/schema/tag.ts +0 -19
  334. package/src/schema/types.ts +0 -150
  335. package/src/schema/write.ts +0 -96
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/navigation/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AASlE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAEjD,sEAAsE;AACtE,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,QAAQ,GACR,IAAI,GACJ,YAAY,GACZ;IAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA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2) — the `NavTarget` input space, the
3
- * `serializeTarget` normalization into the id-anchored stored form, and the
4
- * restore-time `revalidateAndPrune` that drops dead entries against the memory.
5
- */
6
- import { normalizeRef } from '@astrale-os/kernel-client';
7
- function isRecord(x) {
8
- return typeof x === 'object' && x !== null;
1
+ import { Path } from '@astrale-os/sdk/graph/path';
2
+ import { Query } from '@astrale-os/sdk/query';
3
+ import { Key as admitKey } from '@astrale-os/sdk/schema';
4
+ function isNode(value) {
5
+ return typeof value === 'object' && value !== null && 'id' in value && 'class' in value;
9
6
  }
10
- /** Normalize any {@link NavTarget} to its stored, id-anchored serialization. */
7
+ function nodePath(value) {
8
+ return isNode(value) ? Path.id(value.id).raw : Path.from(value).raw;
9
+ }
10
+ function isComposite(value) {
11
+ return typeof value === 'object' && value !== null && 'node' in value;
12
+ }
13
+ /** Normalize every target to canonical astrale-node-path-v1 text. */
11
14
  export function serializeTarget(target) {
12
- if (typeof target === 'string')
13
- return { node: normalizeRef(target) };
14
- if (isRecord(target) && 'node' in target) {
15
- const t = target;
16
- return {
17
- node: normalizeRef(t.node),
18
- ...(t.view !== undefined ? { view: normalizeRef(t.view) } : {}),
19
- ...(t.params !== undefined ? { params: { ...t.params } } : {}),
20
- };
21
- }
22
- // A Node / BoundNode carries `id` (id-anchored, so rename/move survive) and `path`;
23
- // anything else is a typed `Path` value → its raw address.
24
- if (isRecord(target) && 'id' in target && 'path' in target) {
25
- return { node: normalizeRef(target.id) };
26
- }
27
- return { node: normalizeRef(target) };
15
+ if (!isComposite(target))
16
+ return { node: nodePath(target) };
17
+ return {
18
+ node: nodePath(target.node),
19
+ ...(target.view === undefined ? {} : { view: viewKey(target.view) }),
20
+ ...(target.params === undefined ? {} : { params: { ...target.params } }),
21
+ };
22
+ }
23
+ function viewKey(input) {
24
+ const key = admitKey(input);
25
+ if (!admitKey.ref(key).startsWith('view.'))
26
+ throw new TypeError(`Invalid View key '${input}'.`);
27
+ return key;
28
28
  }
29
- /**
30
- * Revalidate a restored stack against the memory and drop dead entries (API §8.2).
31
- * Each entry is point-read one-shot; a null/failed read is a dead anchor. The
32
- * cursor re-lands on the surviving current entry, else the nearest survivor
33
- * before it.
34
- */
35
- export async function revalidateAndPrune(history, memory) {
29
+ /** Drop restored entries that no longer resolve under the authenticated Graph capability. */
30
+ export async function revalidateAndPrune(history, store, shell) {
36
31
  const { entries, cursor } = history.snapshot();
37
- const alive = await Promise.all(entries.map((e) => resolves(memory, e.node)));
32
+ const alive = await Promise.all(entries.map((entry) => resolves(store, shell, entry)));
38
33
  if (alive.every(Boolean))
39
- return;
34
+ return false;
40
35
  const survivors = [];
41
36
  let newCursor = -1;
42
37
  let fallback = -1;
43
- entries.forEach((entry, i) => {
44
- if (!alive[i])
38
+ entries.forEach((entry, index) => {
39
+ if (!alive[index])
45
40
  return;
46
41
  survivors.push(entry);
47
- const idx = survivors.length - 1;
48
- if (i === cursor)
49
- newCursor = idx;
50
- else if (i < cursor)
51
- fallback = idx;
42
+ const next = survivors.length - 1;
43
+ if (index === cursor)
44
+ newCursor = next;
45
+ else if (index < cursor)
46
+ fallback = next;
52
47
  });
53
48
  if (newCursor === -1)
54
49
  newCursor = fallback !== -1 ? fallback : survivors.length > 0 ? 0 : -1;
55
50
  history.reset(survivors, newCursor);
51
+ return true;
56
52
  }
57
- async function resolves(memory, ref) {
53
+ async function resolves(store, shell, entry) {
58
54
  try {
59
- const result = await memory.query(ref, { live: false });
60
- return result.node !== null;
55
+ const query = Query.from({ kind: 'node', paths: [entry.node] }).select({ kind: 'graph' });
56
+ const response = await store.read(query, { page: { size: 1 } });
57
+ if (response.result.kind !== 'graph' ||
58
+ response.result.selection.kind !== 'node' ||
59
+ response.result.selection.ids.length === 0)
60
+ return false;
61
+ if (entry.view === undefined)
62
+ return true;
63
+ const routes = await shell.views.resolve(entry.node);
64
+ return routes.some((candidate) => candidate.route.key === entry.view);
61
65
  }
62
66
  catch {
63
67
  return false;
@@ -0,0 +1,44 @@
1
+ import type { InputOf, InstanceMethod, OutputOf, ReceiverOf, RemoteCallableOf } from '@astrale-os/sdk/domain';
2
+ import type { QueryAST } from '@astrale-os/sdk/query';
3
+ import type { schema } from '@astrale-os/sdk/schema';
4
+ import type { DomainInvokeOptions } from '@astrale-os/shell';
5
+ type Callable = RemoteCallableOf<schema.DomainSchema> | InstanceMethod;
6
+ declare const QUERY_REFRESH: unique symbol;
7
+ export interface QueryRefresh {
8
+ readonly id: string;
9
+ readonly [QUERY_REFRESH]: () => {
10
+ readonly ast: QueryAST;
11
+ readonly page: Readonly<{
12
+ readonly size: number;
13
+ }>;
14
+ };
15
+ }
16
+ type RefreshableQuery<Input, Query extends QueryAST> = {
17
+ readonly id: string;
18
+ readonly page: Readonly<{
19
+ readonly size: number;
20
+ }>;
21
+ prepare?(input: Input): Input;
22
+ build(input: Input): Query;
23
+ };
24
+ /** Pair one exact named Query definition with its admitted input for targeted invalidation. */
25
+ export declare function queryRefresh<Input, Query extends QueryAST>(definition: RefreshableQuery<Input, Query>, input: Input): QueryRefresh;
26
+ export type ActionRefresh = 'all' | 'none' | {
27
+ readonly queries: readonly QueryRefresh[];
28
+ };
29
+ export interface ActionOptions extends DomainInvokeOptions {
30
+ readonly refresh?: ActionRefresh;
31
+ readonly onError?: (error: unknown) => void;
32
+ }
33
+ type ActionArgs<C extends Callable> = C extends InstanceMethod ? [receiver: ReceiverOf<C>, input: InputOf<C>] : [input: InputOf<C>];
34
+ export interface DomainAction<Args extends unknown[], Result> {
35
+ run(...args: Args): Promise<Result>;
36
+ readonly pending: boolean;
37
+ readonly error: unknown;
38
+ readonly result: Result | undefined;
39
+ reset(): void;
40
+ }
41
+ /** Invoke one schema-declared Function or Method and invalidate Store by explicit policy. */
42
+ export declare function useAction<C extends Callable>(callable: C, options?: ActionOptions): DomainAction<ActionArgs<C>, OutputOf<C>>;
43
+ export {};
44
+ //# sourceMappingURL=action.hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.hook.d.ts","sourceRoot":"","sources":["../../src/schema/action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AAM,aAAa,GACrB,KAAK,GACL,MAAM,GACN;IACE,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;CAC1C,CAAA;AAEL,MAAM,WAAW,aAAc,SAAQ,mBAAmB;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAA;IAChC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAC5C;AAED,KAAK,UAAU,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,SAAS,cAAc,GAC1D,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAC5C,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AAEvB,MAAM,WAAW,YAAY,CAAC,IAAI,SAAS,OAAO,EAAE,EAAE,MAAM;IAC1D,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IACnC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,KAAK,IAAI,IAAI,CAAA;CACd;AAED,6FAA6F;AAC7F,wBAAgB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAC1C,QAAQ,EAAE,CAAC,EACX,OAAO,GAAE,aAAkB,GAC1B,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAyC1C"}
@@ -0,0 +1,72 @@
1
+ import { Path } from '@astrale-os/sdk/graph/path';
2
+ import { useCallback, useMemo, useRef } from 'react';
3
+ import { useAction as useAsyncAction } from '../graph/action.js';
4
+ import { useGraphStore } from '../graph/store.js';
5
+ import { bindingFor } from './domain.hook.js';
6
+ const QUERY_REFRESH = Symbol('shell-react.query-refresh');
7
+ /** Pair one exact named Query definition with its admitted input for targeted invalidation. */
8
+ export function queryRefresh(definition, input) {
9
+ return Object.freeze({
10
+ id: definition.id,
11
+ [QUERY_REFRESH]: () => {
12
+ const prepared = definition.prepare?.(input) ?? input;
13
+ return Object.freeze({ ast: definition.build(prepared), page: definition.page });
14
+ },
15
+ });
16
+ }
17
+ /** Invoke one schema-declared Function or Method and invalidate Store by explicit policy. */
18
+ export function useAction(callable, options = {}) {
19
+ const binding = bindingFor(callable);
20
+ const store = useGraphStore();
21
+ const callableRef = useRef(callable);
22
+ callableRef.current = callable;
23
+ const bindingRef = useRef(binding);
24
+ bindingRef.current = binding;
25
+ const optionsRef = useRef(options);
26
+ optionsRef.current = options;
27
+ const invoke = useCallback(async (...args) => {
28
+ const current = callableRef.current;
29
+ const policy = optionsRef.current;
30
+ const { refresh: _refresh, onError: _onError, ...request } = policy;
31
+ try {
32
+ const invokeExact = bindingRef.current.$.invoke;
33
+ const result = 'on' in current
34
+ ? await invokeExact(current, receiverPath(args[0]), args[1], request)
35
+ : await invokeExact(current, args[0], request);
36
+ const refresh = policy.refresh ?? 'all';
37
+ if (refresh === 'all')
38
+ store.invalidate();
39
+ else if (refresh !== 'none') {
40
+ refresh.queries.forEach((query) => {
41
+ const target = query[QUERY_REFRESH]();
42
+ store.invalidate(target.ast, { page: target.page });
43
+ });
44
+ }
45
+ return result;
46
+ }
47
+ catch (error) {
48
+ policy.onError?.(error);
49
+ throw error;
50
+ }
51
+ }, [store]);
52
+ const action = useAsyncAction(invoke);
53
+ return useMemo(() => projectAction(action), [action]);
54
+ }
55
+ function projectAction(action) {
56
+ return {
57
+ run: (...args) => action(...args),
58
+ get pending() {
59
+ return action.pending;
60
+ },
61
+ get error() {
62
+ return action.error;
63
+ },
64
+ get result() {
65
+ return action.result;
66
+ },
67
+ reset: action.reset,
68
+ };
69
+ }
70
+ function receiverPath(receiver) {
71
+ return Path.id(receiver.id).raw;
72
+ }
@@ -1,10 +1,15 @@
1
+ import type { DomainBinding } from '@astrale-os/shell';
2
+ import { schema } from '@astrale-os/sdk/schema';
1
3
  /**
2
- * useDomain(schema) (API §6) — the typed domain binding, `kernel.withSchema(schema)`,
3
- * memoized per (effective session, schema). The BoundNodes it mints ride the
4
- * shared scoped memory, so typed writes are optimistic and revalidate (§6).
4
+ * Resolve an exact verified DomainBinding. The first render suspends while Session snapshot and schema
5
+ * revision checks complete; later renders return the retained binding synchronously.
5
6
  */
6
- import type { FnMap, SchemaBoundView } from '@astrale-os/kernel-client';
7
- import type { Schema } from '@astrale-os/kernel-dsl';
8
- /** The typed domain binding — `kernel.withSchema(schema)`, memoized per (session, schema). */
9
- export declare function useDomain<S extends Schema>(schema: S): SchemaBoundView<S, FnMap>;
7
+ export declare function useDomain<const S extends schema.DomainSchema>(schema: S): DomainBinding<S>;
8
+ /** Dynamic verified root binding used by tools that intentionally do not carry a schema witness. */
9
+ export declare function useDynamicDomain(): DomainBinding;
10
+ /** Bind several exact installed schemas behind one Suspense boundary and stable named result. */
11
+ export declare function useDomains<const Schemas extends Readonly<Record<string, schema.DomainSchema>>>(schemas: Schemas): {
12
+ readonly [Name in keyof Schemas]: DomainBinding<Schemas[Name]>;
13
+ };
14
+ export declare function bindingFor(value: object): DomainBinding;
10
15
  //# sourceMappingURL=domain.hook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"domain.hook.d.ts","sourceRoot":"","sources":["../../src/schema/domain.hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAMpD,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,KAAK,CAAC,CAEhF"}
1
+ {"version":3,"file":"domain.hook.d.ts","sourceRoot":"","sources":["../../src/schema/domain.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,mBAAmB,CAAA;AAEpE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAiB/C;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAe1F;AAED,oGAAoG;AACpG,wBAAgB,gBAAgB,IAAI,aAAa,CAUhD;AAED,iGAAiG;AACjG,wBAAgB,UAAU,CAAC,KAAK,CAAC,OAAO,SAAS,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,EAC5F,OAAO,EAAE,OAAO,GACf;IAAE,QAAQ,EAAE,IAAI,IAAI,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;CAAE,CAwBpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAMvD"}
@@ -1,7 +1,104 @@
1
+ import { schema } from '@astrale-os/sdk/schema';
1
2
  import { useSessionKernel } from '../auth/session-kernel.js';
2
- import { useMemory } from '../graph/memory/scope.js';
3
- import { bindingFor } from './binding.js';
4
- /** The typed domain binding — `kernel.withSchema(schema)`, memoized per (session, schema). */
3
+ const typed = new WeakMap();
4
+ const dynamic = new WeakMap();
5
+ const aggregates = new WeakMap();
6
+ const bindingByValue = new WeakMap();
7
+ /**
8
+ * Resolve an exact verified DomainBinding. The first render suspends while Session snapshot and schema
9
+ * revision checks complete; later renders return the retained binding synchronously.
10
+ */
5
11
  export function useDomain(schema) {
6
- return bindingFor(useSessionKernel(), schema, useMemory());
12
+ const kernel = useSessionKernel();
13
+ let bySchema = typed.get(kernel);
14
+ if (bySchema === undefined) {
15
+ bySchema = new WeakMap();
16
+ typed.set(kernel, bySchema);
17
+ }
18
+ let resource = bySchema.get(schema);
19
+ if (resource === undefined) {
20
+ resource = createResource(kernel.domain(schema));
21
+ bySchema.set(schema, resource);
22
+ }
23
+ const binding = read(resource);
24
+ registerBinding(binding);
25
+ return binding;
26
+ }
27
+ /** Dynamic verified root binding used by tools that intentionally do not carry a schema witness. */
28
+ export function useDynamicDomain() {
29
+ const kernel = useSessionKernel();
30
+ let resource = dynamic.get(kernel);
31
+ if (resource === undefined) {
32
+ resource = createResource(kernel.domain());
33
+ dynamic.set(kernel, resource);
34
+ }
35
+ const binding = read(resource);
36
+ registerBinding(binding);
37
+ return binding;
38
+ }
39
+ /** Bind several exact installed schemas behind one Suspense boundary and stable named result. */
40
+ export function useDomains(schemas) {
41
+ const kernel = useSessionKernel();
42
+ const names = Object.keys(schemas).sort();
43
+ if (names.length === 0)
44
+ return Object.freeze({});
45
+ const key = names
46
+ .map((name) => `${name}\u0000${schemas[name].origin}\u0000${schema.revision(schemas[name])}`)
47
+ .join('\u0001');
48
+ let bySet = aggregates.get(kernel);
49
+ if (bySet === undefined) {
50
+ bySet = new Map();
51
+ aggregates.set(kernel, bySet);
52
+ }
53
+ let resource = bySet.get(key);
54
+ if (resource === undefined) {
55
+ resource = createResource(Promise.all(names.map(async (name) => [name, await kernel.domain(schemas[name])])).then((entries) => Object.freeze(Object.fromEntries(entries))));
56
+ bySet.set(key, resource);
57
+ }
58
+ const values = read(resource);
59
+ Object.values(values).forEach(registerBinding);
60
+ return values;
61
+ }
62
+ export function bindingFor(value) {
63
+ const binding = bindingByValue.get(value);
64
+ if (binding === undefined) {
65
+ throw new Error('The definition is not owned by a Domain bound in this React runtime.');
66
+ }
67
+ return binding;
68
+ }
69
+ function registerBinding(binding) {
70
+ const seen = new WeakSet();
71
+ const visit = (value, depth) => {
72
+ if (depth > 4 || value === null || typeof value !== 'object' || seen.has(value))
73
+ return;
74
+ seen.add(value);
75
+ bindingByValue.set(value, binding);
76
+ for (const [key, child] of Object.entries(value)) {
77
+ if (key === 'schema' || key === 'publication' || key === 'session')
78
+ continue;
79
+ visit(child, depth + 1);
80
+ }
81
+ };
82
+ visit(binding, 0);
83
+ }
84
+ function createResource(promise) {
85
+ const cell = {
86
+ status: 'pending',
87
+ promise: Promise.resolve(),
88
+ };
89
+ cell.promise = promise.then((value) => {
90
+ cell.status = 'ready';
91
+ cell.value = value;
92
+ }, (error) => {
93
+ cell.status = 'failed';
94
+ cell.error = error;
95
+ });
96
+ return cell;
97
+ }
98
+ function read(resource) {
99
+ if (resource.status === 'pending')
100
+ throw resource.promise;
101
+ if (resource.status === 'failed')
102
+ throw resource.error;
103
+ return resource.value;
7
104
  }
@@ -1,10 +1,11 @@
1
1
  export { useKernel } from './kernel.hook.js';
2
- export { useDomain } from './domain.hook.js';
3
- export { useNode, useChildren, useBoundNode, useBoundNodes, useBoundEndpoints, } from './bind-read.js';
4
- export { useOut, useIn } from '../graph/query/neighbors.hook.js';
5
- export { useMethod } from './method.hook.js';
6
- export type { MethodOptions } from './method.hook.js';
7
- export { useFunction } from './function.hook.js';
8
- export type { FunctionOptions } from './function.hook.js';
9
- export type { AutoMethodAction, BoundMethodAction, EndpointResult, FunctionNames, FunctionParams, FunctionResult, MethodIsStatic, MethodNames, MethodParams, MethodResult, TargetedMethodAction, TypedChildrenResult, TypedNodeResult, } from './types.js';
2
+ export { useDomain, useDomains, useDynamicDomain } from './domain.hook.js';
3
+ export { queryRefresh, useAction } from './action.hook.js';
4
+ export type { ActionOptions, ActionRefresh, DomainAction, QueryRefresh } from './action.hook.js';
5
+ export { useMutation } from './mutation.hook.js';
6
+ export type { MutationOptions } from './mutation.hook.js';
7
+ export { useDynamicObject, useObject } from './object.hook.js';
8
+ export type { RichReadOptions } from './object.hook.js';
9
+ export { RelationUnavailableError, useRelation } from './relation.hook.js';
10
+ export type { RelationOptions, RelationResource, RelationUnavailable } from './relation.hook.js';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index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M,kBAAkB,CAAA;AACvD,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC1E,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA"}
@@ -1,8 +1,6 @@
1
- // schema — the typing substrate (API §6). Typed kernel/domain bindings, typed
2
- // reads, method/function dispatch. See SHELL_REACT_API.md.
3
1
  export { useKernel } from './kernel.hook.js';
4
- export { useDomain } from './domain.hook.js';
5
- export { useNode, useChildren, useBoundNode, useBoundNodes, useBoundEndpoints, } from './bind-read.js';
6
- export { useOut, useIn } from '../graph/query/neighbors.hook.js';
7
- export { useMethod } from './method.hook.js';
8
- export { useFunction } from './function.hook.js';
2
+ export { useDomain, useDomains, useDynamicDomain } from './domain.hook.js';
3
+ export { queryRefresh, useAction } from './action.hook.js';
4
+ export { useMutation } from './mutation.hook.js';
5
+ export { useDynamicObject, useObject } from './object.hook.js';
6
+ export { RelationUnavailableError, useRelation } from './relation.hook.js';
@@ -1,10 +1,5 @@
1
- /**
2
- * useKernel (API §6) — the typed kernel, `kernel.withSchema(KernelSchema)`,
3
- * memoized per (effective) session. The kernel's own schema baked in; dispatch
4
- * and reads run as the subtree's principal over its scoped memory (§4).
5
- */
6
- import type { FnMap, SchemaBoundView } from '@astrale-os/kernel-client';
7
- import { KernelSchema } from '@astrale-os/kernel-core';
8
- /** The typed kernel — `kernel.withSchema(KernelSchema)`, memoized (§4-scoped). */
9
- export declare function useKernel(): SchemaBoundView<typeof KernelSchema, FnMap>;
1
+ import type { DomainBinding } from '@astrale-os/shell';
2
+ import { KernelSchema } from '@astrale-os/sdk/schema/kernel';
3
+ /** The verified, exactly typed Kernel Domain binding. */
4
+ export declare function useKernel(): DomainBinding<typeof KernelSchema>;
10
5
  //# sourceMappingURL=kernel.hook.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kernel.hook.d.ts","sourceRoot":"","sources":["../../src/schema/kernel.hook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAEvE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAMtD,kFAAkF;AAClF,wBAAgB,SAAS,IAAI,eAAe,CAAC,OAAO,YAAY,EAAE,KAAK,CAAC,CAEvE"}
1
+ {"version":3,"file":"kernel.hook.d.ts","sourceRoot":"","sources":["../../src/schema/kernel.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAI5D,yDAAyD;AACzD,wBAAgB,SAAS,IAAI,aAAa,CAAC,OAAO,YAAY,CAAC,CAE9D"}
@@ -1,8 +1,6 @@
1
- import { KernelSchema } from '@astrale-os/kernel-core';
2
- import { useSessionKernel } from '../auth/session-kernel.js';
3
- import { useMemory } from '../graph/memory/scope.js';
4
- import { bindingFor } from './binding.js';
5
- /** The typed kernel — `kernel.withSchema(KernelSchema)`, memoized (§4-scoped). */
1
+ import { KernelSchema } from '@astrale-os/sdk/schema/kernel';
2
+ import { useDomain } from './domain.hook.js';
3
+ /** The verified, exactly typed Kernel Domain binding. */
6
4
  export function useKernel() {
7
- return bindingFor(useSessionKernel(), KernelSchema, useMemory());
5
+ return useDomain(KernelSchema);
8
6
  }
@@ -0,0 +1,9 @@
1
+ import type { MutationDefinition } from '@astrale-os/sdk/mutation';
2
+ import type { DomainAction } from './action.hook.js';
3
+ export interface MutationOptions {
4
+ readonly optimistic?: boolean;
5
+ readonly onError?: (error: unknown) => void;
6
+ }
7
+ /** Execute one named SDK Mutation definition through GraphStore optimism/invalidation. */
8
+ export declare function useMutation<Input, Output>(definition: MutationDefinition<Input, Output>, options?: MutationOptions): DomainAction<[Input], Output>;
9
+ //# sourceMappingURL=mutation.hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutation.hook.d.ts","sourceRoot":"","sources":["../../src/schema/mutation.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAMlE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAKpD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAC5C;AAED,0FAA0F;AAC1F,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EACvC,UAAU,EAAE,kBAAkB,CAAC,KAAK,EAAE,MAAM,CAAC,EAC7C,OAAO,GAAE,eAAoB,GAC5B,YAAY,CAAC,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAwB/B"}
@@ -0,0 +1,41 @@
1
+ import { bindMutations } from '@astrale-os/sdk/mutation';
2
+ import { useCallback, useMemo, useRef } from 'react';
3
+ import { useAction as useAsyncAction } from '../graph/action.js';
4
+ import { useGraphStore } from '../graph/store.js';
5
+ /** Execute one named SDK Mutation definition through GraphStore optimism/invalidation. */
6
+ export function useMutation(definition, options = {}) {
7
+ const store = useGraphStore();
8
+ const definitionRef = useRef(definition);
9
+ definitionRef.current = definition;
10
+ const optionsRef = useRef(options);
11
+ optionsRef.current = options;
12
+ const run = useCallback(async (input) => {
13
+ const execute = bindMutations((ast) => store.mutate(ast, {
14
+ optimistic: optionsRef.current.optimistic ?? true,
15
+ }));
16
+ try {
17
+ return await execute(definitionRef.current, input);
18
+ }
19
+ catch (error) {
20
+ optionsRef.current.onError?.(error);
21
+ throw error;
22
+ }
23
+ }, [store]);
24
+ const action = useAsyncAction(run);
25
+ return useMemo(() => project(action), [action]);
26
+ }
27
+ function project(action) {
28
+ return {
29
+ run: (input) => action(input),
30
+ get pending() {
31
+ return action.pending;
32
+ },
33
+ get error() {
34
+ return action.error;
35
+ },
36
+ get result() {
37
+ return action.result;
38
+ },
39
+ reset: action.reset,
40
+ };
41
+ }
@@ -0,0 +1,16 @@
1
+ import type { BoundInstanceOf, Definition } from '@astrale-os/sdk/domain';
2
+ import type { Node } from '@astrale-os/sdk/graph/node';
3
+ import type { PathLike } from '@astrale-os/sdk/graph/path';
4
+ import type { GraphResource } from '../graph/resource.js';
5
+ export interface RichReadOptions {
6
+ readonly pageSize?: number;
7
+ }
8
+ type ObjectDefinition = Pick<Definition<'class' | 'interface'>, 'kind' | 'origin' | 'name' | 'key' | 'schemaRef' | 'definition'> & {
9
+ readonly family: 'node';
10
+ };
11
+ /** Read and bind one exact rich object definition exclusively through GraphStore. */
12
+ export declare function useObject<RichDefinition extends ObjectDefinition>(definition: RichDefinition, target: PathLike | null | undefined, options?: RichReadOptions): GraphResource<BoundInstanceOf<RichDefinition> | null>;
13
+ /** Explicitly untyped point read for inspectors; it never impersonates `useObject`. */
14
+ export declare function useDynamicObject(target: PathLike | null | undefined, options?: RichReadOptions): GraphResource<Node | null>;
15
+ export {};
16
+ //# sourceMappingURL=object.hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"object.hook.d.ts","sourceRoot":"","sources":["../../src/schema/object.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAM1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAKzD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,KAAK,gBAAgB,GAAG,IAAI,CAC1B,UAAU,CAAC,OAAO,GAAG,WAAW,CAAC,EACjC,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,GAAG,YAAY,CAChE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE/B,qFAAqF;AACrF,wBAAgB,SAAS,CAAC,cAAc,SAAS,gBAAgB,EAC/D,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,GAAE,eAAoB,GAC5B,aAAa,CAAC,eAAe,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CA8BvD;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,EACnC,OAAO,GAAE,eAAoB,GAC5B,aAAa,CAAC,IAAI,GAAG,IAAI,CAAC,CAoB5B"}
@@ -0,0 +1,46 @@
1
+ import { Path } from '@astrale-os/sdk/graph/path';
2
+ import { Query } from '@astrale-os/sdk/query';
3
+ import { useCallback, useMemo } from 'react';
4
+ import { useStoreResource } from '../graph/resource.js';
5
+ import { bindingFor } from './domain.hook.js';
6
+ /** Read and bind one exact rich object definition exclusively through GraphStore. */
7
+ export function useObject(definition, target, options = {}) {
8
+ const binding = bindingFor(definition);
9
+ const path = target === null || target === undefined ? null : Path.from(target);
10
+ const query = useMemo(() => path === null
11
+ ? null
12
+ : Query.from({ kind: 'node', paths: [path], binding: 'object' })
13
+ .filter({ satisfies: definition.schemaRef })
14
+ .select({ kind: 'graph' }), [definition, path?.raw]);
15
+ const project = useCallback((response) => {
16
+ const result = response.result;
17
+ if (result.kind !== 'graph' || result.selection.kind !== 'node')
18
+ return null;
19
+ const id = result.selection.ids[0];
20
+ const node = id === undefined
21
+ ? undefined
22
+ : result.graph.nodes.find((candidate) => candidate.id === id);
23
+ const bind = binding.$.bind;
24
+ return node === undefined ? null : bind(definition, node);
25
+ }, [binding, definition]);
26
+ return useStoreResource(query, options.pageSize ?? 1, project);
27
+ }
28
+ /** Explicitly untyped point read for inspectors; it never impersonates `useObject`. */
29
+ export function useDynamicObject(target, options = {}) {
30
+ const path = target === null || target === undefined ? null : Path.from(target);
31
+ const query = useMemo(() => path === null
32
+ ? null
33
+ : Query.from({ kind: 'node', paths: [path], binding: 'dynamic_object' }).select({
34
+ kind: 'graph',
35
+ }), [path?.raw]);
36
+ const project = useCallback((response) => {
37
+ const result = response.result;
38
+ if (result.kind !== 'graph' || result.selection.kind !== 'node')
39
+ return null;
40
+ const id = result.selection.ids[0];
41
+ return id === undefined
42
+ ? null
43
+ : (result.graph.nodes.find((candidate) => candidate.id === id) ?? null);
44
+ }, []);
45
+ return useStoreResource(query, options.pageSize ?? 1, project);
46
+ }