@astrale-os/shell-react 0.2.9 → 0.2.10-beta.2
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.
- package/dist/application/apps/app-host.d.ts +4 -15
- package/dist/application/apps/app-host.d.ts.map +1 -1
- package/dist/application/apps/app-host.js +1 -1
- package/dist/application/apps/apps.hook.d.ts +7 -4
- package/dist/application/apps/apps.hook.d.ts.map +1 -1
- package/dist/application/apps/apps.hook.js +10 -2
- package/dist/application/apps/domains.hook.d.ts +1 -1
- package/dist/application/apps/domains.hook.d.ts.map +1 -1
- package/dist/application/apps/domains.hook.js +1 -1
- package/dist/application/apps/open-app.hook.d.ts +2 -3
- package/dist/application/apps/open-app.hook.d.ts.map +1 -1
- package/dist/application/index.d.ts +2 -4
- package/dist/application/index.d.ts.map +1 -1
- package/dist/application/index.js +2 -3
- package/dist/application/spaces/space.hook.d.ts +2 -2
- package/dist/application/spaces/space.hook.d.ts.map +1 -1
- package/dist/application/spaces/space.hook.js +2 -2
- package/dist/application/spaces/spaces.hook.d.ts +2 -3
- package/dist/application/spaces/spaces.hook.d.ts.map +1 -1
- package/dist/application/spaces/spaces.hook.js +10 -3
- package/dist/auth/act-as.context.d.ts +15 -32
- package/dist/auth/act-as.context.d.ts.map +1 -1
- package/dist/auth/act-as.context.js +22 -66
- package/dist/auth/auth.hook.d.ts +1 -0
- package/dist/auth/auth.hook.d.ts.map +1 -1
- package/dist/auth/auth.hook.js +2 -22
- package/dist/auth/can.hook.d.ts +10 -38
- package/dist/auth/can.hook.d.ts.map +1 -1
- package/dist/auth/can.hook.js +35 -110
- package/dist/auth/index.d.ts +1 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/self.hook.d.ts +2 -2
- package/dist/auth/self.hook.d.ts.map +1 -1
- package/dist/auth/self.hook.js +0 -7
- package/dist/auth/session-kernel.d.ts +2 -3
- package/dist/auth/session-kernel.d.ts.map +1 -1
- package/dist/auth/session-kernel.js +4 -13
- package/dist/components/boundaries.d.ts +47 -0
- package/dist/components/boundaries.d.ts.map +1 -0
- package/dist/components/boundaries.js +55 -0
- package/dist/components/can.d.ts +11 -0
- package/dist/components/can.d.ts.map +1 -0
- package/dist/components/can.js +5 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/mount-domain-frontend.d.ts +22 -0
- package/dist/components/mount-domain-frontend.d.ts.map +1 -0
- package/dist/components/mount-domain-frontend.js +85 -0
- package/dist/components/view-app.d.ts +16 -0
- package/dist/components/view-app.d.ts.map +1 -0
- package/dist/components/view-app.js +16 -0
- package/dist/graph/call/call.hook.d.ts +8 -18
- package/dist/graph/call/call.hook.d.ts.map +1 -1
- package/dist/graph/call/call.hook.js +7 -13
- package/dist/graph/call/stream.hook.d.ts +12 -20
- package/dist/graph/call/stream.hook.d.ts.map +1 -1
- package/dist/graph/call/stream.hook.js +55 -111
- package/dist/graph/graph.context.d.ts +4 -3
- package/dist/graph/graph.context.d.ts.map +1 -1
- package/dist/graph/graph.context.js +2 -8
- package/dist/graph/guards.error.d.ts +7 -8
- package/dist/graph/guards.error.d.ts.map +1 -1
- package/dist/graph/guards.error.js +11 -7
- package/dist/graph/index.d.ts +8 -16
- package/dist/graph/index.d.ts.map +1 -1
- package/dist/graph/index.js +3 -7
- package/dist/graph/memory/read/envelope.d.ts +22 -54
- package/dist/graph/memory/read/envelope.d.ts.map +1 -1
- package/dist/graph/memory/read/envelope.js +26 -20
- package/dist/graph/memory/read/idle.d.ts +1 -15
- package/dist/graph/memory/read/idle.d.ts.map +1 -1
- package/dist/graph/memory/read/idle.js +4 -13
- package/dist/graph/query-definition.hook.d.ts +11 -0
- package/dist/graph/query-definition.hook.d.ts.map +1 -0
- package/dist/graph/query-definition.hook.js +205 -0
- package/dist/graph/resource.d.ts +34 -0
- package/dist/graph/resource.d.ts.map +1 -0
- package/dist/graph/resource.js +244 -0
- package/dist/graph/store.d.ts +25 -0
- package/dist/graph/store.d.ts.map +1 -0
- package/dist/graph/store.js +69 -0
- package/dist/host/actions.hook.d.ts +34 -0
- package/dist/host/actions.hook.d.ts.map +1 -0
- package/dist/host/actions.hook.js +125 -0
- package/dist/host/components.d.ts +15 -0
- package/dist/host/components.d.ts.map +1 -0
- package/dist/host/components.js +14 -0
- package/dist/host/index.d.ts +5 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +3 -0
- package/dist/index.d.ts +26 -37
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -31
- package/dist/intents/envelope.d.ts +7 -19
- package/dist/intents/envelope.d.ts.map +1 -1
- package/dist/intents/envelope.js +2 -3
- package/dist/intents/send-intent.hook.d.ts +5 -7
- package/dist/intents/send-intent.hook.d.ts.map +1 -1
- package/dist/intents/send-intent.hook.js +17 -75
- package/dist/navigation/adapters/adapter.d.ts +5 -0
- package/dist/navigation/adapters/adapter.d.ts.map +1 -1
- package/dist/navigation/adapters/memory.adapter.d.ts.map +1 -1
- package/dist/navigation/adapters/memory.adapter.js +4 -0
- package/dist/navigation/adapters/url.adapter.d.ts.map +1 -1
- package/dist/navigation/adapters/url.adapter.js +57 -10
- package/dist/navigation/codec.d.ts +60 -0
- package/dist/navigation/codec.d.ts.map +1 -0
- package/dist/navigation/codec.js +121 -0
- package/dist/navigation/history.d.ts +11 -9
- package/dist/navigation/history.d.ts.map +1 -1
- package/dist/navigation/history.js +6 -8
- package/dist/navigation/hooks/ancestors.hook.d.ts +5 -7
- package/dist/navigation/hooks/ancestors.hook.d.ts.map +1 -1
- package/dist/navigation/hooks/ancestors.hook.js +7 -51
- package/dist/navigation/hooks/location.hook.d.ts.map +1 -1
- package/dist/navigation/hooks/location.hook.js +4 -6
- package/dist/navigation/hooks/scope.hook.d.ts.map +1 -1
- package/dist/navigation/hooks/scope.hook.js +4 -6
- package/dist/navigation/index.d.ts +4 -2
- package/dist/navigation/index.d.ts.map +1 -1
- package/dist/navigation/index.js +2 -1
- package/dist/navigation/link.d.ts +12 -0
- package/dist/navigation/link.d.ts.map +1 -1
- package/dist/navigation/link.js +13 -2
- package/dist/navigation/location.d.ts +13 -40
- package/dist/navigation/location.d.ts.map +1 -1
- package/dist/navigation/location.js +14 -76
- package/dist/navigation/scope.context.d.ts +17 -26
- package/dist/navigation/scope.context.d.ts.map +1 -1
- package/dist/navigation/scope.context.js +140 -108
- package/dist/navigation/snapshot.d.ts +14 -19
- package/dist/navigation/snapshot.d.ts.map +1 -1
- package/dist/navigation/snapshot.js +48 -44
- package/dist/schema/action.hook.d.ts +44 -0
- package/dist/schema/action.hook.d.ts.map +1 -0
- package/dist/schema/action.hook.js +72 -0
- package/dist/schema/domain.hook.d.ts +12 -7
- package/dist/schema/domain.hook.d.ts.map +1 -1
- package/dist/schema/domain.hook.js +101 -4
- package/dist/schema/index.d.ts +9 -8
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +5 -7
- package/dist/schema/kernel.hook.d.ts +4 -9
- package/dist/schema/kernel.hook.d.ts.map +1 -1
- package/dist/schema/kernel.hook.js +4 -6
- package/dist/schema/mutation.hook.d.ts +9 -0
- package/dist/schema/mutation.hook.d.ts.map +1 -0
- package/dist/schema/mutation.hook.js +41 -0
- package/dist/schema/object.hook.d.ts +16 -0
- package/dist/schema/object.hook.d.ts.map +1 -0
- package/dist/schema/object.hook.js +46 -0
- package/dist/schema/relation.hook.d.ts +46 -0
- package/dist/schema/relation.hook.d.ts.map +1 -0
- package/dist/schema/relation.hook.js +136 -0
- package/dist/selection/live.d.ts +9 -17
- package/dist/selection/live.d.ts.map +1 -1
- package/dist/selection/live.js +65 -112
- package/dist/selection/scope.context.js +5 -4
- package/dist/session/boot/boot.d.ts +1 -13
- package/dist/session/boot/boot.d.ts.map +1 -1
- package/dist/session/boot/boot.js +9 -27
- package/dist/session/index.d.ts +1 -0
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/kernel-instance.hook.d.ts +1 -4
- package/dist/session/kernel-instance.hook.d.ts.map +1 -1
- package/dist/session/kernel-instance.hook.js +1 -5
- package/dist/session/provider.d.ts +9 -23
- package/dist/session/provider.d.ts.map +1 -1
- package/dist/session/provider.js +29 -75
- package/dist/session/session.context.d.ts +5 -0
- package/dist/session/session.context.d.ts.map +1 -1
- package/dist/window/adopt.d.ts +0 -1
- package/dist/window/adopt.d.ts.map +1 -1
- package/dist/window/hooks/target-node.hook.d.ts +10 -6
- package/dist/window/hooks/target-node.hook.d.ts.map +1 -1
- package/dist/window/hooks/target-node.hook.js +14 -72
- package/dist/window/hooks/views-for.hook.d.ts +4 -3
- package/dist/window/hooks/views-for.hook.d.ts.map +1 -1
- package/dist/window/hooks/views-for.hook.js +6 -22
- package/dist/window/hooks/windows.hook.d.ts.map +1 -1
- package/dist/window/hooks/windows.hook.js +3 -4
- package/dist/window/host.d.ts +9 -11
- package/dist/window/host.d.ts.map +1 -1
- package/dist/window/host.js +26 -62
- package/dist/window/hub.d.ts +2 -0
- package/dist/window/hub.d.ts.map +1 -1
- package/dist/window/hub.js +33 -0
- package/dist/window/index.d.ts +2 -2
- package/dist/window/index.d.ts.map +1 -1
- package/dist/window/index.js +2 -2
- package/dist/window/lifecycle/mount.d.ts +5 -44
- package/dist/window/lifecycle/mount.d.ts.map +1 -1
- package/dist/window/lifecycle/mount.js +14 -120
- package/dist/window/lifecycle/states.d.ts +0 -5
- package/dist/window/lifecycle/states.d.ts.map +1 -1
- package/package.json +9 -8
- package/src/application/apps/app-host.tsx +11 -15
- package/src/application/apps/apps.hook.ts +13 -6
- package/src/application/apps/domains.hook.ts +1 -1
- package/src/application/apps/open-app.hook.ts +3 -4
- package/src/application/index.ts +4 -6
- package/src/application/spaces/space.hook.ts +5 -6
- package/src/application/spaces/spaces.hook.ts +14 -9
- package/src/auth/act-as.context.tsx +37 -91
- package/src/auth/auth.hook.ts +2 -30
- package/src/auth/can.hook.ts +44 -135
- package/src/auth/index.ts +1 -0
- package/src/auth/self.hook.ts +2 -9
- package/src/auth/session-kernel.ts +6 -16
- package/src/components/boundaries.tsx +113 -0
- package/src/components/can.tsx +16 -0
- package/src/components/index.ts +14 -0
- package/src/components/mount-domain-frontend.tsx +158 -0
- package/src/components/view-app.tsx +49 -0
- package/src/graph/call/call.hook.ts +22 -27
- package/src/graph/call/stream.hook.ts +66 -143
- package/src/graph/graph.context.ts +6 -11
- package/src/graph/guards.error.ts +17 -55
- package/src/graph/index.ts +23 -17
- package/src/graph/memory/read/envelope.ts +40 -65
- package/src/graph/memory/read/idle.ts +5 -18
- package/src/graph/query-definition.hook.ts +270 -0
- package/src/graph/resource.ts +358 -0
- package/src/graph/store.ts +97 -0
- package/src/host/actions.hook.ts +165 -0
- package/src/host/components.tsx +29 -0
- package/src/host/index.ts +17 -0
- package/src/index.ts +136 -124
- package/src/intents/envelope.ts +7 -23
- package/src/intents/send-intent.hook.ts +24 -79
- package/src/navigation/adapters/adapter.ts +3 -0
- package/src/navigation/adapters/memory.adapter.ts +4 -0
- package/src/navigation/adapters/url.adapter.ts +48 -8
- package/src/navigation/codec.ts +190 -0
- package/src/navigation/history.ts +20 -11
- package/src/navigation/hooks/ancestors.hook.ts +10 -60
- package/src/navigation/hooks/location.hook.ts +4 -6
- package/src/navigation/hooks/scope.hook.ts +4 -6
- package/src/navigation/index.ts +18 -2
- package/src/navigation/link.tsx +27 -2
- package/src/navigation/location.ts +26 -93
- package/src/navigation/scope.context.tsx +151 -136
- package/src/navigation/snapshot.ts +69 -50
- package/src/schema/action.hook.ts +146 -0
- package/src/schema/domain.hook.ts +127 -11
- package/src/schema/index.ts +9 -30
- package/src/schema/kernel.hook.ts +6 -13
- package/src/schema/mutation.hook.ts +63 -0
- package/src/schema/object.hook.ts +85 -0
- package/src/schema/relation.hook.ts +253 -0
- package/src/selection/live.ts +75 -125
- package/src/selection/scope.context.tsx +4 -4
- package/src/session/boot/boot.ts +8 -33
- package/src/session/index.ts +1 -0
- package/src/session/kernel-instance.hook.ts +2 -11
- package/src/session/provider.tsx +34 -103
- package/src/session/session.context.ts +6 -0
- package/src/window/adopt.ts +0 -1
- package/src/window/hooks/target-node.hook.ts +20 -85
- package/src/window/hooks/views-for.hook.ts +12 -25
- package/src/window/hooks/windows.hook.ts +3 -4
- package/src/window/host.tsx +35 -77
- package/src/window/hub.ts +33 -0
- package/src/window/index.ts +3 -3
- package/src/window/lifecycle/mount.ts +15 -160
- package/src/window/lifecycle/states.ts +1 -5
- package/dist/application/roles.hook.d.ts +0 -7
- package/dist/application/roles.hook.d.ts.map +0 -1
- package/dist/application/roles.hook.js +0 -23
- package/dist/graph/memory/base.d.ts +0 -21
- package/dist/graph/memory/base.d.ts.map +0 -1
- package/dist/graph/memory/base.js +0 -33
- package/dist/graph/memory/read/read.d.ts +0 -9
- package/dist/graph/memory/read/read.d.ts.map +0 -1
- package/dist/graph/memory/read/read.js +0 -87
- package/dist/graph/memory/scope.d.ts +0 -7
- package/dist/graph/memory/scope.d.ts.map +0 -1
- package/dist/graph/memory/scope.js +0 -25
- package/dist/graph/mutate/move.hook.d.ts +0 -7
- package/dist/graph/mutate/move.hook.d.ts.map +0 -1
- package/dist/graph/mutate/move.hook.js +0 -49
- package/dist/graph/mutate/mutate.hook.d.ts +0 -17
- package/dist/graph/mutate/mutate.hook.d.ts.map +0 -1
- package/dist/graph/mutate/mutate.hook.js +0 -45
- package/dist/graph/query/children.hook.d.ts +0 -29
- package/dist/graph/query/children.hook.d.ts.map +0 -1
- package/dist/graph/query/children.hook.js +0 -64
- package/dist/graph/query/graph.hook.d.ts +0 -9
- package/dist/graph/query/graph.hook.d.ts.map +0 -1
- package/dist/graph/query/graph.hook.js +0 -5
- package/dist/graph/query/neighbors.hook.d.ts +0 -7
- package/dist/graph/query/neighbors.hook.d.ts.map +0 -1
- package/dist/graph/query/neighbors.hook.js +0 -104
- package/dist/graph/query/node.hook.d.ts +0 -14
- package/dist/graph/query/node.hook.d.ts.map +0 -1
- package/dist/graph/query/node.hook.js +0 -43
- package/dist/graph/query/query.hook.d.ts +0 -14
- package/dist/graph/query/query.hook.d.ts.map +0 -1
- package/dist/graph/query/query.hook.js +0 -23
- package/dist/schema/bind-read.d.ts +0 -37
- package/dist/schema/bind-read.d.ts.map +0 -1
- package/dist/schema/bind-read.js +0 -205
- package/dist/schema/binding.d.ts +0 -21
- package/dist/schema/binding.d.ts.map +0 -1
- package/dist/schema/binding.js +0 -99
- package/dist/schema/function.hook.d.ts +0 -9
- package/dist/schema/function.hook.d.ts.map +0 -1
- package/dist/schema/function.hook.js +0 -40
- package/dist/schema/method.hook.d.ts +0 -14
- package/dist/schema/method.hook.d.ts.map +0 -1
- package/dist/schema/method.hook.js +0 -49
- package/dist/schema/tag.d.ts +0 -11
- package/dist/schema/tag.d.ts.map +0 -1
- package/dist/schema/tag.js +0 -11
- package/dist/schema/types.d.ts +0 -73
- package/dist/schema/types.d.ts.map +0 -1
- package/dist/schema/types.js +0 -1
- package/dist/schema/write.d.ts +0 -16
- package/dist/schema/write.d.ts.map +0 -1
- package/dist/schema/write.js +0 -56
- package/src/application/roles.hook.ts +0 -41
- package/src/graph/memory/base.ts +0 -50
- package/src/graph/memory/read/read.ts +0 -103
- package/src/graph/memory/scope.ts +0 -29
- package/src/graph/mutate/move.hook.ts +0 -70
- package/src/graph/mutate/mutate.hook.ts +0 -69
- package/src/graph/query/children.hook.ts +0 -136
- package/src/graph/query/graph.hook.ts +0 -13
- package/src/graph/query/neighbors.hook.ts +0 -159
- package/src/graph/query/node.hook.ts +0 -83
- package/src/graph/query/query.hook.ts +0 -42
- package/src/schema/bind-read.ts +0 -319
- package/src/schema/binding.ts +0 -146
- package/src/schema/function.hook.ts +0 -68
- package/src/schema/method.hook.ts +0 -103
- package/src/schema/tag.ts +0 -19
- package/src/schema/types.ts +0 -150
- package/src/schema/write.ts +0 -96
|
@@ -1,28 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Call } from '@astrale-os/kernel-client';
|
|
2
|
+
import type { SessionRequestOptions } from '@astrale-os/kernel-client/session';
|
|
3
|
+
import type { Value } from '@astrale-os/sdk/value';
|
|
4
|
+
import type { KernelClient } from '@astrale-os/shell';
|
|
5
|
+
export type KernelStream = Awaited<ReturnType<KernelClient['stream']>>;
|
|
6
|
+
export type StreamItem = Value;
|
|
7
|
+
export type CallAuthor<A extends unknown[]> = Call | ((...args: A) => Call);
|
|
8
|
+
export interface StreamOptions<T = StreamItem> extends SessionRequestOptions {
|
|
9
|
+
readonly onChunk?: (chunk: T) => void;
|
|
5
10
|
}
|
|
6
|
-
export interface StreamHandle<T> {
|
|
7
|
-
|
|
8
|
-
start(params: unknown): Promise<void>;
|
|
9
|
-
/** Chunks accumulated in the current run; reset on the next `start`. */
|
|
11
|
+
export interface StreamHandle<A extends unknown[] = unknown[], T = StreamItem> {
|
|
12
|
+
start(...args: A): Promise<void>;
|
|
10
13
|
readonly chunks: readonly T[];
|
|
11
|
-
/** The most recent chunk, or null before the first. */
|
|
12
14
|
readonly last: T | null;
|
|
13
|
-
/** A run is in flight. */
|
|
14
15
|
readonly streaming: boolean;
|
|
15
|
-
/** Last run failure; retained until the next `start`. */
|
|
16
16
|
readonly error: unknown;
|
|
17
|
-
/** Close the stream (returns the iterator); a later `start` begins fresh. */
|
|
18
17
|
cancel(): void;
|
|
19
18
|
}
|
|
20
|
-
|
|
21
|
-
* Streaming domain-function dispatch. `start(params)` opens a run over
|
|
22
|
-
* `kernel.stream`; chunks accumulate on `chunks`; `cancel()` closes the iterator
|
|
23
|
-
* and a later `start` begins fresh. A superseding `start` (or unmount) closes the
|
|
24
|
-
* prior run and discards its late chunks/errors — only the current run drives
|
|
25
|
-
* state. Never live; the handle keeps one identity for the hook's lifetime.
|
|
26
|
-
*/
|
|
27
|
-
export declare function useStream<K extends StreamFns<FnMap>>(method: K | null, opts?: StreamOptions<FnMap[K]['result']>): StreamHandle<FnMap[K]['result']>;
|
|
19
|
+
export declare function useStream<A extends unknown[] = []>(author: CallAuthor<A> | null, options?: StreamOptions): StreamHandle<A, StreamItem>;
|
|
28
20
|
//# sourceMappingURL=stream.hook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.hook.d.ts","sourceRoot":"","sources":["../../../src/graph/call/stream.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"stream.hook.d.ts","sourceRoot":"","sources":["../../../src/graph/call/stream.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAC9E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAMrD,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;AACtE,MAAM,MAAM,UAAU,GAAG,KAAK,CAAA;AAC9B,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;AAE3E,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,UAAU,CAAE,SAAQ,qBAAqB;IAC1E,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;CACtC;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,GAAG,UAAU;IAC3E,KAAK,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAChC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAA;IAC7B,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,MAAM,IAAI,IAAI,CAAA;CACf;AAmCD,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,EAAE,EAChD,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,EAC5B,OAAO,CAAC,EAAE,aAAa,GACtB,YAAY,CAAC,CAAC,EAAE,UAAU,CAAC,CA4D7B"}
|
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useStream (API §7) — streaming domain-function dispatch over `kernel.stream`,
|
|
3
|
-
* an AsyncIterable driven by an explicit start/cancel handle. A superseding
|
|
4
|
-
* `start` (or unmount) closes the prior run and discards its late chunks/errors;
|
|
5
|
-
* never live. Dispatch is a graph operation (rule 2).
|
|
6
|
-
*/
|
|
7
1
|
import { useCallback, useEffect, useReducer, useRef } from 'react';
|
|
8
2
|
import { useSessionKernel } from '../../auth/session-kernel.js';
|
|
9
|
-
|
|
10
|
-
chunks: [],
|
|
11
|
-
last: null,
|
|
12
|
-
streaming: false,
|
|
13
|
-
error: undefined,
|
|
14
|
-
};
|
|
15
|
-
function streamReducer(state, event) {
|
|
3
|
+
function reducer(state, event) {
|
|
16
4
|
switch (event.type) {
|
|
17
5
|
case 'start':
|
|
18
6
|
return { chunks: [], last: null, streaming: true, error: undefined };
|
|
@@ -24,114 +12,70 @@ function streamReducer(state, event) {
|
|
|
24
12
|
error: undefined,
|
|
25
13
|
};
|
|
26
14
|
case 'end':
|
|
15
|
+
case 'cancel':
|
|
27
16
|
return { ...state, streaming: false };
|
|
28
17
|
case 'error':
|
|
29
|
-
// Chunks accumulated before the failure are preserved.
|
|
30
18
|
return { ...state, streaming: false, error: event.error };
|
|
31
|
-
case 'cancel':
|
|
32
|
-
return { ...state, streaming: false };
|
|
33
19
|
}
|
|
34
20
|
}
|
|
35
|
-
|
|
36
|
-
* Streaming domain-function dispatch. `start(params)` opens a run over
|
|
37
|
-
* `kernel.stream`; chunks accumulate on `chunks`; `cancel()` closes the iterator
|
|
38
|
-
* and a later `start` begins fresh. A superseding `start` (or unmount) closes the
|
|
39
|
-
* prior run and discards its late chunks/errors — only the current run drives
|
|
40
|
-
* state. Never live; the handle keeps one identity for the hook's lifetime.
|
|
41
|
-
*/
|
|
42
|
-
export function useStream(method, opts) {
|
|
21
|
+
export function useStream(author, options) {
|
|
43
22
|
const kernel = useSessionKernel();
|
|
44
|
-
// Latest-closure refs so the stable start/cancel dispatch the current inputs.
|
|
45
23
|
const kernelRef = useRef(kernel);
|
|
46
24
|
kernelRef.current = kernel;
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
const [snapshot, dispatch] = useReducer(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
run.controller.abort();
|
|
60
|
-
void run.iterator?.return?.(undefined);
|
|
61
|
-
currentRef.current = null;
|
|
62
|
-
}
|
|
63
|
-
}, []);
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
alive.current = true;
|
|
66
|
-
return () => {
|
|
67
|
-
alive.current = false;
|
|
68
|
-
stop();
|
|
69
|
-
};
|
|
70
|
-
}, [stop]);
|
|
25
|
+
const authorRef = useRef(author);
|
|
26
|
+
authorRef.current = author;
|
|
27
|
+
const optionsRef = useRef(options);
|
|
28
|
+
optionsRef.current = options;
|
|
29
|
+
const [snapshot, dispatch] = useReducer(reducer, {
|
|
30
|
+
chunks: [],
|
|
31
|
+
last: null,
|
|
32
|
+
streaming: false,
|
|
33
|
+
error: undefined,
|
|
34
|
+
});
|
|
35
|
+
const runId = useRef(0);
|
|
36
|
+
const controller = useRef(null);
|
|
71
37
|
const cancel = useCallback(() => {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
38
|
+
runId.current += 1;
|
|
39
|
+
controller.current?.abort();
|
|
40
|
+
controller.current = null;
|
|
41
|
+
dispatch({ type: 'cancel' });
|
|
42
|
+
}, []);
|
|
43
|
+
useEffect(() => cancel, [cancel]);
|
|
44
|
+
const start = useCallback(async (...args) => {
|
|
45
|
+
const current = authorRef.current;
|
|
46
|
+
if (current === null)
|
|
47
|
+
throw new Error('useStream: idle handle started');
|
|
48
|
+
cancel();
|
|
49
|
+
const id = ++runId.current;
|
|
50
|
+
const abort = new AbortController();
|
|
51
|
+
controller.current = abort;
|
|
85
52
|
dispatch({ type: 'start' });
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!current())
|
|
53
|
+
const call = typeof current === 'function' ? current(...args) : current;
|
|
54
|
+
try {
|
|
55
|
+
const { onChunk: _onChunk, ...requestOptions } = optionsRef.current ?? {};
|
|
56
|
+
const stream = await kernelRef.current.stream(call, {
|
|
57
|
+
...requestOptions,
|
|
58
|
+
signal: abort.signal,
|
|
59
|
+
});
|
|
60
|
+
for await (const chunk of stream) {
|
|
61
|
+
if (id !== runId.current)
|
|
96
62
|
return;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
for (;;) {
|
|
100
|
-
const next = await iterator.next();
|
|
101
|
-
if (!current())
|
|
102
|
-
return;
|
|
103
|
-
if (next.done === true)
|
|
104
|
-
break;
|
|
105
|
-
if (alive.current)
|
|
106
|
-
dispatch({ type: 'chunk', value: next.value });
|
|
107
|
-
optsRef.current?.onChunk?.(next.value);
|
|
108
|
-
}
|
|
109
|
-
if (current()) {
|
|
110
|
-
currentRef.current = null;
|
|
111
|
-
if (alive.current)
|
|
112
|
-
dispatch({ type: 'end' });
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
116
|
-
if (!current())
|
|
117
|
-
return; // a superseded/cancelled run's failure is discarded
|
|
118
|
-
currentRef.current = null;
|
|
119
|
-
if (alive.current)
|
|
120
|
-
dispatch({ type: 'error', error });
|
|
121
|
-
throw error;
|
|
63
|
+
dispatch({ type: 'chunk', value: chunk });
|
|
64
|
+
optionsRef.current?.onChunk?.(chunk);
|
|
122
65
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
66
|
+
if (id === runId.current)
|
|
67
|
+
dispatch({ type: 'end' });
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
if (id !== runId.current)
|
|
71
|
+
return;
|
|
72
|
+
dispatch({ type: 'error', error });
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
if (id === runId.current)
|
|
77
|
+
controller.current = null;
|
|
78
|
+
}
|
|
79
|
+
}, [cancel]);
|
|
80
|
+
return { start, cancel, ...snapshot };
|
|
137
81
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare const GraphContext: import("react").Context<
|
|
1
|
+
import type { GraphStore } from '@astrale-os/kernel-client/store';
|
|
2
|
+
/** Optional exact Client GraphStore supplied by an injected Shell adapter. */
|
|
3
|
+
export declare const GraphContext: import("react").Context<GraphStore | null>;
|
|
4
|
+
export type { GraphStore };
|
|
4
5
|
//# sourceMappingURL=graph.context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.context.d.ts","sourceRoot":"","sources":["../../src/graph/graph.context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"graph.context.d.ts","sourceRoot":"","sources":["../../src/graph/graph.context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAA;AAIjE,8EAA8E;AAC9E,eAAO,MAAM,YAAY,4CAAyC,CAAA;AAGlE,YAAY,EAAE,UAAU,EAAE,CAAA"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* GraphContext (ex MemoryContext) — the root of the graph plane. Seats the base
|
|
3
|
-
* (default-scope) memory the provider builds; the SAME handle the graph/schema/
|
|
4
|
-
* nav hooks read through `memory/scope.ts`, and selection's liveness source.
|
|
5
|
-
* Under `<ActAs>` the read hooks re-scope via `forScope`; selection reads the
|
|
6
|
-
* base scope here.
|
|
7
|
-
*/
|
|
8
1
|
import { createContext } from 'react';
|
|
2
|
+
/** Optional exact Client GraphStore supplied by an injected Shell adapter. */
|
|
9
3
|
export const GraphContext = createContext(null);
|
|
10
|
-
GraphContext.displayName = '
|
|
4
|
+
GraphContext.displayName = 'AstraleGraphStoreContext';
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export type { AuthReason, ClientErrorDetails, IdentityError, KernelErrorKind, TransportError, } from '@astrale-os/kernel-client';
|
|
1
|
+
export { ClientError, ProtocolError, ResponseError, StaleRouteError, TransportError, } from '@astrale-os/kernel-client';
|
|
2
|
+
export { NodeUnavailableError } from '@astrale-os/kernel-client/graph';
|
|
3
|
+
export { UnsupportedFeatureError } from './memory/read/envelope.js';
|
|
4
|
+
import { ClientError } from '@astrale-os/kernel-client';
|
|
5
|
+
import { NodeUnavailableError } from '@astrale-os/kernel-client/graph';
|
|
6
|
+
export declare function isClientError(error: unknown): error is ClientError;
|
|
7
|
+
export declare function isNodeUnavailableError(error: unknown): error is NodeUnavailableError;
|
|
9
8
|
//# sourceMappingURL=guards.error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.error.d.ts","sourceRoot":"","sources":["../../src/graph/guards.error.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"guards.error.d.ts","sourceRoot":"","sources":["../../src/graph/guards.error.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,GACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AAEnE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAEtE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,oBAAoB,CAEpF"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
export { ClientError, ProtocolError, ResponseError, StaleRouteError, TransportError, } from '@astrale-os/kernel-client';
|
|
2
|
+
export { NodeUnavailableError } from '@astrale-os/kernel-client/graph';
|
|
3
|
+
export { UnsupportedFeatureError } from './memory/read/envelope.js';
|
|
4
|
+
import { ClientError } from '@astrale-os/kernel-client';
|
|
5
|
+
import { NodeUnavailableError } from '@astrale-os/kernel-client/graph';
|
|
6
|
+
export function isClientError(error) {
|
|
7
|
+
return error instanceof ClientError;
|
|
8
|
+
}
|
|
9
|
+
export function isNodeUnavailableError(error) {
|
|
10
|
+
return error instanceof NodeUnavailableError;
|
|
11
|
+
}
|
package/dist/graph/index.d.ts
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export {
|
|
4
|
-
export type {
|
|
5
|
-
export { useQuery } from './query/query.hook.js';
|
|
6
|
-
export type { QueryResult } from './query/query.hook.js';
|
|
7
|
-
export { useGraph } from './query/graph.hook.js';
|
|
8
|
-
export { useMutate } from './mutate/mutate.hook.js';
|
|
9
|
-
export type { UseMutateOptions } from './mutate/mutate.hook.js';
|
|
10
|
-
export { useMove } from './mutate/move.hook.js';
|
|
11
|
-
export type { MoveAction } from './mutate/move.hook.js';
|
|
1
|
+
export { useGraphStore } from './store.js';
|
|
2
|
+
export { useQuery } from './query-definition.hook.js';
|
|
3
|
+
export type { QueryResourceOptions } from './query-definition.hook.js';
|
|
4
|
+
export type { GraphResource, GraphResourceState } from './resource.js';
|
|
12
5
|
export { useCall } from './call/call.hook.js';
|
|
13
|
-
export type { CallOptions } from './call/call.hook.js';
|
|
6
|
+
export type { CallOptions, CallResult } from './call/call.hook.js';
|
|
14
7
|
export { useStream } from './call/stream.hook.js';
|
|
15
|
-
export type { StreamHandle, StreamOptions } from './call/stream.hook.js';
|
|
8
|
+
export type { CallAuthor, KernelStream, StreamHandle, StreamItem, StreamOptions, } from './call/stream.hook.js';
|
|
16
9
|
export type { Action } from './action.js';
|
|
17
|
-
export type {
|
|
18
|
-
export
|
|
19
|
-
export type { ShapeInput } from '@astrale-os/kernel-client/store';
|
|
10
|
+
export type { GraphStore } from './graph.context.js';
|
|
11
|
+
export { ClientError, NodeUnavailableError, ProtocolError, ResponseError, StaleRouteError, TransportError, isClientError, isNodeUnavailableError, } from './guards.error.js';
|
|
20
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graph/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACtE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,EACb,sBAAsB,GACvB,MAAM,mBAAmB,CAAA"}
|
package/dist/graph/index.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export { useChildren } from './query/children.hook.js';
|
|
4
|
-
export { useQuery } from './query/query.hook.js';
|
|
5
|
-
export { useGraph } from './query/graph.hook.js';
|
|
6
|
-
export { useMutate } from './mutate/mutate.hook.js';
|
|
7
|
-
export { useMove } from './mutate/move.hook.js';
|
|
1
|
+
export { useGraphStore } from './store.js';
|
|
2
|
+
export { useQuery } from './query-definition.hook.js';
|
|
8
3
|
export { useCall } from './call/call.hook.js';
|
|
9
4
|
export { useStream } from './call/stream.hook.js';
|
|
5
|
+
export { ClientError, NodeUnavailableError, ProtocolError, ResponseError, StaleRouteError, TransportError, isClientError, isNodeUnavailableError, } from './guards.error.js';
|
|
@@ -1,71 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* extends (`ReadState` + `Windowed`), the `ReadOptions` accepted by every read,
|
|
4
|
-
* and the assembly of the unified `RawRead` projection over a memory shape
|
|
5
|
-
* (empty/idle/keep-previous builders). Dependency-light so every context can
|
|
6
|
-
* consume it without a cycle.
|
|
7
|
-
*/
|
|
8
|
-
import type { LiveResult } from '@astrale-os/kernel-client/store';
|
|
9
|
-
/** Base of every read hook's result — stale-while-revalidate + liveness + seq. */
|
|
1
|
+
import type { Node as KernelNode } from '@astrale-os/sdk/graph/node';
|
|
2
|
+
/** Common result state for Shell React reads. */
|
|
10
3
|
export interface ReadState {
|
|
11
|
-
/** A
|
|
4
|
+
/** A request is in flight. Last-good data may still be present. */
|
|
12
5
|
readonly pending: boolean;
|
|
13
|
-
/** Last
|
|
6
|
+
/** Last request failure. Cleared when the next request begins. */
|
|
14
7
|
readonly error: unknown;
|
|
15
|
-
/**
|
|
8
|
+
/** True only when an upstream subscription is active. */
|
|
16
9
|
readonly live: boolean;
|
|
17
|
-
/**
|
|
10
|
+
/** Reserved journal position. Direct Graph reads report zero. */
|
|
18
11
|
readonly seq: number;
|
|
19
|
-
/** Manual revalidate. Rarely needed; kept for tooling and non-live reads. */
|
|
20
12
|
refetch(): Promise<void>;
|
|
21
13
|
}
|
|
22
|
-
/** Windowed reads add a cursor-fold `more`. */
|
|
23
14
|
export interface Windowed {
|
|
24
15
|
readonly more: {
|
|
25
16
|
readonly has: boolean;
|
|
26
|
-
load(): Promise<void>;
|
|
27
17
|
readonly pending: boolean;
|
|
18
|
+
load(): Promise<void>;
|
|
28
19
|
};
|
|
29
20
|
}
|
|
30
|
-
/** Options
|
|
21
|
+
/** Options shared by point, Query, and neighbor reads. */
|
|
31
22
|
export interface ReadOptions {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
/** default false; show previous shape's data while a new one confirms. */
|
|
37
|
-
keepPrevious?: boolean;
|
|
38
|
-
/** Visibility permission on the underlying AST — a kernel permission bitmask. */
|
|
39
|
-
with?: number;
|
|
23
|
+
readonly signal?: AbortSignal;
|
|
24
|
+
readonly timeoutMs?: number;
|
|
25
|
+
/** Retain the previous successful value while the next request is pending. */
|
|
26
|
+
readonly keepPrevious?: boolean;
|
|
40
27
|
}
|
|
41
|
-
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
* the shell-react read envelope (`ReadState` + `Windowed`). Each hook narrows
|
|
50
|
-
* to the arms it exposes. The store's `LiveResult` is a structural superset, so
|
|
51
|
-
* the warm path returns it directly (stable ref).
|
|
52
|
-
*/
|
|
53
|
-
export interface RawRead extends ReadState, Windowed {
|
|
54
|
-
readonly nodes: readonly Node[];
|
|
55
|
-
readonly roots: readonly Node[];
|
|
56
|
-
readonly first: Node | null;
|
|
57
|
-
readonly children: readonly Node[];
|
|
58
|
-
gathered(alias: string): {
|
|
59
|
-
readonly nodes: readonly Node[];
|
|
60
|
-
readonly first: Node | null;
|
|
61
|
-
};
|
|
28
|
+
export type Node = KernelNode;
|
|
29
|
+
export declare const EMPTY_NODES: readonly Node[];
|
|
30
|
+
export declare const NO_MORE: Windowed['more'];
|
|
31
|
+
/** Stable failure for a retained hook whose required Kernel capability does not exist. */
|
|
32
|
+
export declare class UnsupportedFeatureError extends Error {
|
|
33
|
+
readonly code: 'SHELL_REACT_UNSUPPORTED';
|
|
34
|
+
readonly feature: string;
|
|
35
|
+
constructor(feature: string);
|
|
62
36
|
}
|
|
63
|
-
export declare
|
|
64
|
-
export declare function
|
|
65
|
-
/** The result for a null/undefined subject (§1.3) — settled, empty, no I/O. */
|
|
66
|
-
export declare const IDLE_READ: RawRead;
|
|
67
|
-
/** Cold shape with `suspend:false` (§1.4) — empty data, pending true. */
|
|
68
|
-
export declare const EMPTY_PENDING: RawRead;
|
|
69
|
-
/** Previous shape's data while a new one confirms (§1.5 `keepPrevious`). */
|
|
70
|
-
export declare function withPending(prev: LiveResult): RawRead;
|
|
37
|
+
export declare function idleReadState(): ReadState;
|
|
38
|
+
export declare function unsupportedReadState(feature: string): ReadState;
|
|
71
39
|
//# sourceMappingURL=envelope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../../../src/graph/memory/read/envelope.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../../../src/graph/memory/read/envelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAEpE,iDAAiD;AACjD,MAAM,WAAW,SAAS;IACxB,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,kEAAkE;IAClE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,iEAAiE;IACjE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE;QACb,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;QACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;QACzB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KACtB,CAAA;CACF;AAED,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAChC;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAA;AAE7B,eAAO,MAAM,WAAW,EAAE,SAAS,IAAI,EAAsB,CAAA;AAE7D,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,MAAM,CAInC,CAAA;AAEF,0FAA0F;AAC1F,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAG,yBAAyB,CAAS;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB,YAAY,OAAO,EAAE,MAAM,EAI1B;CACF;AAED,wBAAgB,aAAa,IAAI,SAAS,CAQzC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAS/D"}
|
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
export const
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export const EMPTY_NODES = Object.freeze([]);
|
|
2
|
+
export const NO_MORE = Object.freeze({
|
|
3
|
+
has: false,
|
|
4
|
+
pending: false,
|
|
5
|
+
load: () => Promise.resolve(),
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
export
|
|
7
|
+
/** Stable failure for a retained hook whose required Kernel capability does not exist. */
|
|
8
|
+
export class UnsupportedFeatureError extends Error {
|
|
9
|
+
code = 'SHELL_REACT_UNSUPPORTED';
|
|
10
|
+
feature;
|
|
11
|
+
constructor(feature) {
|
|
12
|
+
super(`${feature} is not supported by the current Kernel Graph contract.`);
|
|
13
|
+
this.name = 'UnsupportedFeatureError';
|
|
14
|
+
this.feature = feature;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export function idleReadState() {
|
|
8
18
|
return {
|
|
9
|
-
|
|
10
|
-
roots: EMPTY,
|
|
11
|
-
first: null,
|
|
12
|
-
children: EMPTY,
|
|
13
|
-
gathered: idleGathered,
|
|
14
|
-
pending,
|
|
19
|
+
pending: false,
|
|
15
20
|
error: undefined,
|
|
16
21
|
live: false,
|
|
17
22
|
seq: 0,
|
|
18
|
-
more: idleMore,
|
|
19
23
|
refetch: () => Promise.resolve(),
|
|
20
24
|
};
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
export function unsupportedReadState(feature) {
|
|
27
|
+
const error = new UnsupportedFeatureError(feature);
|
|
28
|
+
return {
|
|
29
|
+
pending: false,
|
|
30
|
+
error,
|
|
31
|
+
live: false,
|
|
32
|
+
seq: 0,
|
|
33
|
+
refetch: () => Promise.reject(error),
|
|
34
|
+
};
|
|
29
35
|
}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The idle-input rule (API §1.3). A read hook's `null | undefined` subject is
|
|
3
|
-
* inert: `isIdleInput` is the one gate every read branches on, and
|
|
4
|
-
* `idleReadState` is the settled, not-live, seq-0 envelope it returns.
|
|
5
|
-
*/
|
|
6
1
|
import type { ReadState } from './envelope.js';
|
|
7
|
-
|
|
8
|
-
* The chaining rule: every read hook accepts `null | undefined` for its subject
|
|
9
|
-
* and returns an *idle* result (empty data, no I/O). This predicate is the one
|
|
10
|
-
* gate — read hooks branch on it before touching the memory.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isIdleInput(subject: unknown): subject is null | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* The idle `ReadState` a read hook returns for a `null`/`undefined` subject:
|
|
15
|
-
* settled, not live, seq 0, `refetch` a resolved no-op.
|
|
16
|
-
*/
|
|
2
|
+
export declare function isIdleInput(value: unknown): value is null | undefined;
|
|
17
3
|
export declare function idleReadState(): ReadState;
|
|
18
4
|
//# sourceMappingURL=idle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"idle.d.ts","sourceRoot":"","sources":["../../../../src/graph/memory/read/idle.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"idle.d.ts","sourceRoot":"","sources":["../../../../src/graph/memory/read/idle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,GAAG,SAAS,CAErE;AAED,wBAAgB,aAAa,IAAI,SAAS,CAEzC"}
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* gate — read hooks branch on it before touching the memory.
|
|
5
|
-
*/
|
|
6
|
-
export function isIdleInput(subject) {
|
|
7
|
-
return subject === null || subject === undefined;
|
|
1
|
+
import { idleReadState as idle } from './envelope.js';
|
|
2
|
+
export function isIdleInput(value) {
|
|
3
|
+
return value === null || value === undefined;
|
|
8
4
|
}
|
|
9
|
-
/**
|
|
10
|
-
* The idle `ReadState` a read hook returns for a `null`/`undefined` subject:
|
|
11
|
-
* settled, not live, seq 0, `refetch` a resolved no-op.
|
|
12
|
-
*/
|
|
13
5
|
export function idleReadState() {
|
|
14
|
-
return
|
|
6
|
+
return idle();
|
|
15
7
|
}
|
|
16
|
-
const idleRefetch = () => Promise.resolve();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { QueryDefinition } from '@astrale-os/sdk/query';
|
|
2
|
+
import type { QueryAST } from '@astrale-os/sdk/query';
|
|
3
|
+
import type { GraphResource } from './resource.js';
|
|
4
|
+
export interface QueryResourceOptions {
|
|
5
|
+
readonly keepPrevious?: boolean;
|
|
6
|
+
readonly refreshInterval?: number;
|
|
7
|
+
readonly refreshWhen?: 'always' | 'visible';
|
|
8
|
+
}
|
|
9
|
+
/** Execute one named SDK Query definition exclusively through the current GraphStore. */
|
|
10
|
+
export declare function useQuery<Input, Output, Query extends QueryAST>(definition: QueryDefinition<Input, Output, Query> | null, input: Input, options?: QueryResourceOptions): GraphResource<Output>;
|
|
11
|
+
//# sourceMappingURL=query-definition.hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-definition.hook.d.ts","sourceRoot":"","sources":["../../src/graph/query-definition.hook.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAMrD,OAAO,KAAK,EAAE,aAAa,EAAsB,MAAM,eAAe,CAAA;AAMtE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAA;IAC/B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;IACjC,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAC5C;AAwID,yFAAyF;AACzF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAS,QAAQ,EAC5D,UAAU,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,IAAI,EACxD,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,oBAAyB,GACjC,aAAa,CAAC,MAAM,CAAC,CAyDvB"}
|