@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.
- 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/astrale.d.ts +14 -0
- package/dist/components/astrale.d.ts.map +1 -0
- package/dist/components/astrale.js +12 -0
- 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 +6 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -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 +20 -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/astrale.tsx +40 -0
- package/src/components/boundaries.tsx +113 -0
- package/src/components/can.tsx +16 -0
- package/src/components/index.ts +13 -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 +131 -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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bind-read.d.ts","sourceRoot":"","sources":["../../src/schema/bind-read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,UAAU,EAAe,MAAM,iCAAiC,CAAA;AAC7F,OAAO,KAAK,EACV,UAAU,EAEV,UAAU,EACX,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,IAAI,EAAE,MAA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,EAAE,QAAQ,GAAG,OAAO,CAAA;CAAE,CAAA;AAkBxE;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EACpC,IAAI,CAAC,EAAE,YAAY,GAClB,UAAU,GAAG,IAAI,CA6BnB;AAID,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAC9D,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,YAAY,GAAG,IAAI,GAAG,SAAS,EACpC,IAAI,CAAC,EAAE,WAAW,GACjB,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAYvB;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAClE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,EAC1C,IAAI,EAAE,WAAW,GAAG;IAClB,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAA;CAC5B,GACA,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAkC3B;AAwBD,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASlD"}
|
package/dist/schema/bind-read.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { BindTypeMismatchError, normalizeRef, } from '@astrale-os/kernel-client';
|
|
2
|
-
import { shapeInputToAST, stableStringify, stripCursors } from '@astrale-os/kernel-client/store';
|
|
3
|
-
import { compileDomain } from '@astrale-os/kernel-core/domain';
|
|
4
|
-
/**
|
|
5
|
-
* Binder-over-memory composition (API §6, §1.7) — consumed by the `graph/query/`
|
|
6
|
-
* overloads. Binds wire `Node`s from the shared memory to stable `BoundNode`s
|
|
7
|
-
* (an unchanged wire node re-binds to the SAME instance), and composes those
|
|
8
|
-
* binders with a `useSyncExternalStore` read substrate (`useShape`) into the typed
|
|
9
|
-
* `useNode`/`useChildren` reads. A typed read and its untyped twin ride the SAME
|
|
10
|
-
* memory shape, so they are one cache entry, one liveness, one overlay.
|
|
11
|
-
*/
|
|
12
|
-
import { useCallback, useMemo, useRef, useSyncExternalStore } from 'react';
|
|
13
|
-
import { useSessionKernel } from '../auth/session-kernel.js';
|
|
14
|
-
import { idleReadState, isIdleInput } from '../graph/memory/read/idle.js';
|
|
15
|
-
import { useMemory } from '../graph/memory/scope.js';
|
|
16
|
-
import { bindingFor } from './binding.js';
|
|
17
|
-
import { schemaOf, tagSchema } from './tag.js';
|
|
18
|
-
/** Bind one wire node as `type`; stable while the wire node, binding, and type hold. */
|
|
19
|
-
export function useBoundNode(binding, type, wire) {
|
|
20
|
-
const ref = useRef(null);
|
|
21
|
-
const node = wire ?? null;
|
|
22
|
-
let entry = ref.current;
|
|
23
|
-
if (entry === null || entry.wire !== node || entry.binding !== binding || entry.type !== type) {
|
|
24
|
-
entry = {
|
|
25
|
-
wire: node,
|
|
26
|
-
binding,
|
|
27
|
-
type,
|
|
28
|
-
bound: node === null ? null : binding.bind(type, node),
|
|
29
|
-
};
|
|
30
|
-
ref.current = entry;
|
|
31
|
-
}
|
|
32
|
-
return entry.bound;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Bind many wire nodes as `type`; per-node identity + a stable array on no
|
|
36
|
-
* change. `skipMismatch` drops nodes whose class is not `type` (a mixed-class
|
|
37
|
-
* child set) instead of throwing.
|
|
38
|
-
*/
|
|
39
|
-
export function useBoundNodes(binding, type, wires, skipMismatch = false) {
|
|
40
|
-
const ref = useRef(null);
|
|
41
|
-
if (ref.current === null || ref.current.binding !== binding || ref.current.type !== type) {
|
|
42
|
-
ref.current = { binding, type, perNode: new WeakMap(), last: [] };
|
|
43
|
-
}
|
|
44
|
-
const cache = ref.current;
|
|
45
|
-
const next = [];
|
|
46
|
-
for (const w of wires) {
|
|
47
|
-
let b = cache.perNode.get(w);
|
|
48
|
-
if (b === undefined) {
|
|
49
|
-
try {
|
|
50
|
-
b = binding.bind(type, w);
|
|
51
|
-
}
|
|
52
|
-
catch (error) {
|
|
53
|
-
if (skipMismatch && error instanceof BindTypeMismatchError)
|
|
54
|
-
continue;
|
|
55
|
-
throw error;
|
|
56
|
-
}
|
|
57
|
-
cache.perNode.set(w, b);
|
|
58
|
-
}
|
|
59
|
-
next.push(b);
|
|
60
|
-
}
|
|
61
|
-
if (sameArray(cache.last, next))
|
|
62
|
-
return cache.last;
|
|
63
|
-
cache.last = next;
|
|
64
|
-
return next;
|
|
65
|
-
}
|
|
66
|
-
/** Bind many wire nodes classlessly (traversal endpoints); per-node + stable array. */
|
|
67
|
-
export function useBoundEndpoints(binding, wires) {
|
|
68
|
-
const ref = useRef(null);
|
|
69
|
-
if (ref.current === null || ref.current.binding !== binding) {
|
|
70
|
-
ref.current = { binding, perNode: new WeakMap(), last: [] };
|
|
71
|
-
}
|
|
72
|
-
const cache = ref.current;
|
|
73
|
-
const next = wires.map((w) => {
|
|
74
|
-
let b = cache.perNode.get(w);
|
|
75
|
-
if (b === undefined) {
|
|
76
|
-
b = binding.bindAny(w);
|
|
77
|
-
cache.perNode.set(w, b);
|
|
78
|
-
}
|
|
79
|
-
return b;
|
|
80
|
-
});
|
|
81
|
-
if (sameArray(cache.last, next))
|
|
82
|
-
return cache.last;
|
|
83
|
-
cache.last = next;
|
|
84
|
-
return next;
|
|
85
|
-
}
|
|
86
|
-
function sameArray(a, b) {
|
|
87
|
-
return a.length === b.length && a.every((x, i) => x === b[i]);
|
|
88
|
-
}
|
|
89
|
-
/** Store-facing options — render-time concerns (`suspend`/`keepPrevious`) stay here. */
|
|
90
|
-
function toStoreOptions(opts) {
|
|
91
|
-
if (opts === undefined)
|
|
92
|
-
return undefined;
|
|
93
|
-
const out = {};
|
|
94
|
-
if (opts.live !== undefined)
|
|
95
|
-
out.live = opts.live;
|
|
96
|
-
if (opts.window !== undefined)
|
|
97
|
-
out.window = opts.window;
|
|
98
|
-
if (opts.with !== undefined)
|
|
99
|
-
out.with = opts.with;
|
|
100
|
-
return out;
|
|
101
|
-
}
|
|
102
|
-
/** A stable string identity for a (shape, options) pair — the subscription key. */
|
|
103
|
-
function keyOf(shape, opts) {
|
|
104
|
-
const ast = stripCursors(shapeInputToAST(shape));
|
|
105
|
-
return `${stableStringify(ast)}|${opts?.live === false ? '0' : '1'}|${opts?.window ?? ''}|${opts?.with ?? ''}`;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Subscribe to a memory shape. `null` shape → idle (`null`, no I/O). A cold
|
|
109
|
-
* shape suspends unless `suspend: false`. The returned `LiveResult` is the
|
|
110
|
-
* unified read envelope — callers project `node`/`children`/`nodes`.
|
|
111
|
-
*/
|
|
112
|
-
export function useShape(shape, opts) {
|
|
113
|
-
const memory = useMemory();
|
|
114
|
-
const storeOpts = toStoreOptions(opts);
|
|
115
|
-
const key = isIdleInput(shape) ? null : keyOf(shape, opts);
|
|
116
|
-
const subscribe = useCallback((onChange) => {
|
|
117
|
-
if (isIdleInput(shape))
|
|
118
|
-
return () => { };
|
|
119
|
-
return memory.subscribe(shape, onChange, storeOpts);
|
|
120
|
-
},
|
|
121
|
-
// The shape's canonical identity is `key`; the captured `shape` is equivalent.
|
|
122
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
123
|
-
[memory, key]);
|
|
124
|
-
const getSnapshot = useCallback(() => (isIdleInput(shape) ? null : memory.getSnapshot(shape, storeOpts)),
|
|
125
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
126
|
-
[memory, key]);
|
|
127
|
-
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
128
|
-
if (!isIdleInput(shape) && opts?.suspend !== false && memory.peek(shape, storeOpts) === null) {
|
|
129
|
-
// Cold FAILURE (§1.4): a rejected fetch with no data throws to the boundary;
|
|
130
|
-
// re-throwing the promise would re-arm a fetch each retry (infinite loop).
|
|
131
|
-
if (snapshot !== null && snapshot.error !== undefined)
|
|
132
|
-
throw snapshot.error;
|
|
133
|
-
throw memory.promise(shape, storeOpts);
|
|
134
|
-
}
|
|
135
|
-
return snapshot;
|
|
136
|
-
}
|
|
137
|
-
// ── typed reads (schema-first useNode, BoundNode-first useChildren) ──────────────
|
|
138
|
-
export function useNode(schema, type, ref, opts) {
|
|
139
|
-
const binding = bindingFor(useSessionKernel(), schema, useMemory());
|
|
140
|
-
const shape = isIdleInput(ref) ? null : normalizeRef(ref);
|
|
141
|
-
const snap = useShape(shape, opts);
|
|
142
|
-
const wire = snap?.node ?? null;
|
|
143
|
-
const bound = useBoundNode(binding, type, wire);
|
|
144
|
-
if (bound !== null)
|
|
145
|
-
tagSchema(bound, schema);
|
|
146
|
-
const live = snap === null ? idleReadState() : readStateOf(snap);
|
|
147
|
-
return useMemo(() => ({ ...live, node: bound }), [bound, live.pending, live.error, live.live, live.seq]);
|
|
148
|
-
}
|
|
149
|
-
export function useChildren(parent, opts) {
|
|
150
|
-
const kernel = useSessionKernel();
|
|
151
|
-
const memory = useMemory();
|
|
152
|
-
const schema = isIdleInput(parent) ? null : requireSchema(parent);
|
|
153
|
-
const binding = schema === null ? null : bindingFor(kernel, schema, memory);
|
|
154
|
-
const parentRef = isIdleInput(parent) ? null : `@${parent.id}`;
|
|
155
|
-
const classRef = schema === null ? undefined : classRefFor(schema, opts.type);
|
|
156
|
-
const shape = parentRef === null
|
|
157
|
-
? null
|
|
158
|
-
: (q) => q.from(parentRef).children({
|
|
159
|
-
...(classRef !== undefined ? { classes: [classRef] } : {}),
|
|
160
|
-
...(opts.order !== undefined ? { order: opts.order } : {}),
|
|
161
|
-
...(opts.limit !== undefined ? { limit: opts.limit } : {}),
|
|
162
|
-
});
|
|
163
|
-
const snap = useShape(shape, opts);
|
|
164
|
-
const wires = snap?.children ?? EMPTY;
|
|
165
|
-
const bound = useBoundNodes((binding ?? UNBOUND), opts.type, binding === null ? EMPTY : wires, true);
|
|
166
|
-
if (schema !== null)
|
|
167
|
-
for (const b of bound)
|
|
168
|
-
tagSchema(b, schema);
|
|
169
|
-
const live = snap === null ? idleReadState() : readStateOf(snap);
|
|
170
|
-
const more = snap?.more ?? IDLE_MORE;
|
|
171
|
-
return useMemo(() => ({ ...live, more, children: bound }), [bound, more, live.pending, live.error, live.live, live.seq]);
|
|
172
|
-
}
|
|
173
|
-
// ── helpers ──────────────────────────────────────────────────────────────────
|
|
174
|
-
const EMPTY = Object.freeze([]);
|
|
175
|
-
const IDLE_MORE = { has: false, load: () => Promise.resolve(), pending: false };
|
|
176
|
-
const UNBOUND = {};
|
|
177
|
-
function readStateOf(snap) {
|
|
178
|
-
return {
|
|
179
|
-
pending: snap.pending,
|
|
180
|
-
error: snap.error,
|
|
181
|
-
live: snap.live,
|
|
182
|
-
seq: snap.seq,
|
|
183
|
-
refetch: snap.refetch,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
/** Recover the schema a BoundNode was bound under; a clear error if it is untagged. */
|
|
187
|
-
export function requireSchema(node) {
|
|
188
|
-
const schema = schemaOf(node);
|
|
189
|
-
if (schema === undefined) {
|
|
190
|
-
throw new Error('useChildren: the parent was not produced by a shell-react typed binding — ' +
|
|
191
|
-
'obtain it from useNode / useDomain(schema).bind() so its schema is known.');
|
|
192
|
-
}
|
|
193
|
-
return schema;
|
|
194
|
-
}
|
|
195
|
-
const compiledCache = new WeakMap();
|
|
196
|
-
/** The descent class ref for a type name (class or interface), or undefined. */
|
|
197
|
-
function classRefFor(schema, type) {
|
|
198
|
-
let compiled = compiledCache.get(schema);
|
|
199
|
-
if (compiled === undefined) {
|
|
200
|
-
compiled = compileDomain(schema);
|
|
201
|
-
compiledCache.set(schema, compiled);
|
|
202
|
-
}
|
|
203
|
-
const accessor = compiled.$;
|
|
204
|
-
return accessor.c(type)?.path?.class?.raw ?? accessor.i(type)?.path?.class?.raw;
|
|
205
|
-
}
|
package/dist/schema/binding.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* bindingFor(kernel, schema) — memoized `withSchema` handles (API §6). The
|
|
3
|
-
* `withSchema` handle is a *binding*, never a "view". Memoizes
|
|
4
|
-
* `createSchemaBoundView` per (session, schema) so a binding — and the BoundNodes
|
|
5
|
-
* it mints — keep referential identity across renders. Each binding is wrapped so
|
|
6
|
-
* every BoundNode it hands back is schema-tagged (the traversal hooks read it
|
|
7
|
-
* back) and its raw node recorded (the write capability's index).
|
|
8
|
-
*/
|
|
9
|
-
import type { FnMap, NodeRefInput, SchemaBoundView } from '@astrale-os/kernel-client';
|
|
10
|
-
import type { GraphMemory } from '@astrale-os/kernel-client/store';
|
|
11
|
-
import type { Schema } from '@astrale-os/kernel-dsl';
|
|
12
|
-
import type { SessionView } from '../auth/act-as.context.js';
|
|
13
|
-
/**
|
|
14
|
-
* Resolve (and memoize) the tagged schema-bound handle for `schema` on `kernel`.
|
|
15
|
-
* `kernel` is the EFFECTIVE dispatch kernel (root or `<ActAs>` — §4); the cache is
|
|
16
|
-
* keyed on it, so an acted-as subtree gets its own memoized bindings for free.
|
|
17
|
-
* `memory` is the SAME scoped memory the read hooks use (1:1 with `kernel`).
|
|
18
|
-
*/
|
|
19
|
-
export declare function bindingFor<S extends Schema>(kernel: SessionView, schema: S, memory: GraphMemory): SchemaBoundView<S, FnMap>;
|
|
20
|
-
export type { NodeRefInput };
|
|
21
|
-
//# sourceMappingURL=binding.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../src/schema/binding.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAElE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAIpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAQ5D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EACzC,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,WAAW,GAClB,eAAe,CAAC,CAAC,EAAE,KAAK,CAAC,CAa3B;AAmGD,YAAY,EAAE,YAAY,EAAE,CAAA"}
|
package/dist/schema/binding.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { createSchemaBoundView } from '@astrale-os/kernel-client';
|
|
2
|
-
import { tagSchema } from './tag.js';
|
|
3
|
-
import { recordNode, writableFor } from './write.js';
|
|
4
|
-
/** One tagged binding per (kernel, schema) — shared across the whole tree. */
|
|
5
|
-
const bindingCache = new WeakMap();
|
|
6
|
-
/**
|
|
7
|
-
* Resolve (and memoize) the tagged schema-bound handle for `schema` on `kernel`.
|
|
8
|
-
* `kernel` is the EFFECTIVE dispatch kernel (root or `<ActAs>` — §4); the cache is
|
|
9
|
-
* keyed on it, so an acted-as subtree gets its own memoized bindings for free.
|
|
10
|
-
* `memory` is the SAME scoped memory the read hooks use (1:1 with `kernel`).
|
|
11
|
-
*/
|
|
12
|
-
export function bindingFor(kernel, schema, memory) {
|
|
13
|
-
let bySchema = bindingCache.get(kernel);
|
|
14
|
-
if (bySchema === undefined) {
|
|
15
|
-
bySchema = new WeakMap();
|
|
16
|
-
bindingCache.set(kernel, bySchema);
|
|
17
|
-
}
|
|
18
|
-
const cached = bySchema.get(schema);
|
|
19
|
-
if (cached !== undefined)
|
|
20
|
-
return cached;
|
|
21
|
-
const { writable, nodeIndex } = writableFor(kernel, memory);
|
|
22
|
-
const binding = tagBinding(createSchemaBoundView(writable, schema), schema, nodeIndex);
|
|
23
|
-
bySchema.set(schema, binding);
|
|
24
|
-
return binding;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Wrap a binding so `bind`/`bindAny`/`as` outputs carry a schema tag, and every
|
|
28
|
-
* bound wire node is recorded with its class and path (the write cap's index); the
|
|
29
|
-
* class handles and every other member pass straight through.
|
|
30
|
-
*/
|
|
31
|
-
function tagBinding(binding, schema, nodeIndex) {
|
|
32
|
-
let taggedClasses;
|
|
33
|
-
const handler = {
|
|
34
|
-
get: (target, prop, receiver) => {
|
|
35
|
-
const value = Reflect.get(target, prop, receiver);
|
|
36
|
-
if (prop === 'node' || prop === 'create') {
|
|
37
|
-
return async (...args) => tagBoundResult(await value(...args), schema, nodeIndex);
|
|
38
|
-
}
|
|
39
|
-
if (prop === 'bind') {
|
|
40
|
-
return (type, node, opts) => {
|
|
41
|
-
recordNode(nodeIndex, node);
|
|
42
|
-
return tagSchema(value(type, node, opts), schema);
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
if (prop === 'bindAny') {
|
|
46
|
-
return (node) => {
|
|
47
|
-
recordNode(nodeIndex, node);
|
|
48
|
-
return tagSchema(value(node), schema);
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
if (prop === 'classes') {
|
|
52
|
-
taggedClasses ??= tagClassHandles(value, schema, nodeIndex);
|
|
53
|
-
return taggedClasses;
|
|
54
|
-
}
|
|
55
|
-
if (prop === 'as') {
|
|
56
|
-
const as = value;
|
|
57
|
-
return (credential) => tagBinding(as(credential), schema, nodeIndex);
|
|
58
|
-
}
|
|
59
|
-
if (prop === 'withSchema') {
|
|
60
|
-
return (next) => tagBinding(value(next), next, nodeIndex);
|
|
61
|
-
}
|
|
62
|
-
return value;
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
return new Proxy(binding, handler);
|
|
66
|
-
}
|
|
67
|
-
function tagClassHandles(classes, schema, nodeIndex) {
|
|
68
|
-
const handles = new Map();
|
|
69
|
-
return new Proxy(classes, {
|
|
70
|
-
get(target, prop, receiver) {
|
|
71
|
-
const cached = handles.get(prop);
|
|
72
|
-
if (cached !== undefined)
|
|
73
|
-
return cached;
|
|
74
|
-
const handle = Reflect.get(target, prop, receiver);
|
|
75
|
-
if (typeof handle !== 'function')
|
|
76
|
-
return handle;
|
|
77
|
-
const tagged = new Proxy(handle, {
|
|
78
|
-
get(handleTarget, member, handleReceiver) {
|
|
79
|
-
const value = Reflect.get(handleTarget, member, handleReceiver);
|
|
80
|
-
if (member !== 'get')
|
|
81
|
-
return value;
|
|
82
|
-
return async (...args) => tagBoundResult(await value(...args), schema, nodeIndex);
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
handles.set(prop, tagged);
|
|
86
|
-
return tagged;
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
function tagBoundResult(result, schema, nodeIndex) {
|
|
91
|
-
const nodes = Array.isArray(result) ? result : [result];
|
|
92
|
-
for (const node of nodes) {
|
|
93
|
-
if (node !== null && typeof node === 'object') {
|
|
94
|
-
recordNode(nodeIndex, node);
|
|
95
|
-
tagSchema(node, schema);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
return result;
|
|
99
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Schema } from '@astrale-os/kernel-dsl';
|
|
2
|
-
import type { Action } from '../graph/action.js';
|
|
3
|
-
import type { FunctionNames, FunctionParams, FunctionResult } from './types.js';
|
|
4
|
-
export interface FunctionOptions {
|
|
5
|
-
/** Extra failure channel; the action still rejects and records `.error`. */
|
|
6
|
-
onError?: (error: unknown) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function useFunction<S extends Schema, F extends FunctionNames<S>>(schema: S, fn: F, opts?: FunctionOptions): Action<[FunctionParams<S, F>], FunctionResult<S, F>>;
|
|
9
|
-
//# sourceMappingURL=function.hook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.hook.d.ts","sourceRoot":"","sources":["../../src/schema/function.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAWpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAK/E,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC;AAoBD,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,EACtE,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,CAAC,EACL,IAAI,CAAC,EAAE,eAAe,GACrB,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAuBtD"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { compileDomain } from '@astrale-os/kernel-core/domain';
|
|
2
|
-
/**
|
|
3
|
-
* `useFunction` (API §6) — `useMethod`'s sibling for a domain's top-level
|
|
4
|
-
* standalone functions (the `functions` map of `defineSchema`). Dispatched by the
|
|
5
|
-
* compiled FunctionPath from the compiled-domain accessor, never string-built.
|
|
6
|
-
* Dispatch is correct but not compile-time typed (see the note in schema/types.ts).
|
|
7
|
-
*/
|
|
8
|
-
import { useCallback, useMemo, useRef } from 'react';
|
|
9
|
-
import { useAction } from '../graph/action.js';
|
|
10
|
-
import { useDomain } from './domain.hook.js';
|
|
11
|
-
const compiledCache = new WeakMap();
|
|
12
|
-
/** The dispatch path for a standalone function, from the compiled accessor. */
|
|
13
|
-
function functionPathOf(schema, name) {
|
|
14
|
-
let compiled = compiledCache.get(schema);
|
|
15
|
-
if (compiled === undefined) {
|
|
16
|
-
compiled = compileDomain(schema);
|
|
17
|
-
compiledCache.set(schema, compiled);
|
|
18
|
-
}
|
|
19
|
-
const entry = compiled.$.f(name);
|
|
20
|
-
if (entry === undefined) {
|
|
21
|
-
throw new Error(`Unknown function '${name}' in schema '${schema.domain}'`);
|
|
22
|
-
}
|
|
23
|
-
return entry.path.domain.raw;
|
|
24
|
-
}
|
|
25
|
-
export function useFunction(schema, fn, opts) {
|
|
26
|
-
const binding = useDomain(schema);
|
|
27
|
-
const path = useMemo(() => functionPathOf(schema, String(fn)), [schema, fn]);
|
|
28
|
-
const onErrorRef = useRef(opts?.onError);
|
|
29
|
-
onErrorRef.current = opts?.onError;
|
|
30
|
-
const call = useCallback(async (params) => {
|
|
31
|
-
try {
|
|
32
|
-
return (await binding.raw.call(path, params));
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
onErrorRef.current?.(error);
|
|
36
|
-
throw error;
|
|
37
|
-
}
|
|
38
|
-
}, [binding, path]);
|
|
39
|
-
return useAction(call);
|
|
40
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { NodeRefInput, TypeNames } from '@astrale-os/kernel-client';
|
|
2
|
-
import type { Schema } from '@astrale-os/kernel-dsl';
|
|
3
|
-
import type { AutoMethodAction, BoundMethodAction, MethodNames } from './types.js';
|
|
4
|
-
export interface MethodOptions {
|
|
5
|
-
/** Bind the action to this node — dispatch as `action(params)`. */
|
|
6
|
-
on?: NodeRefInput;
|
|
7
|
-
/** Extra failure channel; the action still rejects and records `.error`. */
|
|
8
|
-
onError?: (error: unknown) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare function useMethod<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>>(schema: S, type: T, method: M, opts: MethodOptions & {
|
|
11
|
-
on: NodeRefInput;
|
|
12
|
-
}): BoundMethodAction<S, T, M>;
|
|
13
|
-
export declare function useMethod<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>>(schema: S, type: T, method: M, opts?: MethodOptions): AutoMethodAction<S, T, M>;
|
|
14
|
-
//# sourceMappingURL=method.hook.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"method.hook.d.ts","sourceRoot":"","sources":["../../src/schema/method.hook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAcpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAKlF,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,EAAE,CAAC,EAAE,YAAY,CAAA;IACjB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC;AAID,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAC7F,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,aAAa,GAAG;IAAE,EAAE,EAAE,YAAY,CAAA;CAAE,GACzC,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;AAC7B,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAC7F,MAAM,EAAE,CAAC,EACT,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,CAAC,EACT,IAAI,CAAC,EAAE,aAAa,GACnB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { resolveAllMethods } from '@astrale-os/kernel-dsl';
|
|
2
|
-
/**
|
|
3
|
-
* `useMethod` (API §6) — typed method dispatch with call state. Three forms,
|
|
4
|
-
* selected by the method's static-ness and whether `on` is given:
|
|
5
|
-
* static → action(params)
|
|
6
|
-
* instance + on → action(params) (bound to that node)
|
|
7
|
-
* instance, no on → action(ref, params)
|
|
8
|
-
* Params/result come from the method's Zod contracts.
|
|
9
|
-
*/
|
|
10
|
-
import { useCallback, useMemo, useRef } from 'react';
|
|
11
|
-
import { useAction } from '../graph/action.js';
|
|
12
|
-
import { useDomain } from './domain.hook.js';
|
|
13
|
-
export function useMethod(schema, type, method, opts) {
|
|
14
|
-
const binding = useDomain(schema);
|
|
15
|
-
const on = opts?.on;
|
|
16
|
-
const isStatic = useMemo(() => detectStatic(schema, type, String(method)), [schema, type, method]);
|
|
17
|
-
const onErrorRef = useRef(opts?.onError);
|
|
18
|
-
onErrorRef.current = opts?.onError;
|
|
19
|
-
const call = useCallback(async (...args) => {
|
|
20
|
-
const name = String(method);
|
|
21
|
-
try {
|
|
22
|
-
if (on !== undefined)
|
|
23
|
-
return await instance(binding, type, on, name, args[0]);
|
|
24
|
-
if (isStatic)
|
|
25
|
-
return await staticCall(binding, type, name, args[0]);
|
|
26
|
-
return await instance(binding, type, args[0], name, args[1]);
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
onErrorRef.current?.(error);
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
}, [binding, type, method, on, isStatic]);
|
|
33
|
-
return useAction(call);
|
|
34
|
-
}
|
|
35
|
-
function staticCall(binding, type, method, params) {
|
|
36
|
-
return binding.classes[type][method](params);
|
|
37
|
-
}
|
|
38
|
-
function instance(binding, type, ref, method, params) {
|
|
39
|
-
return binding.classes[type](ref)[method](params);
|
|
40
|
-
}
|
|
41
|
-
/** Read the method's `static` flag from the schema (own + inherited). */
|
|
42
|
-
function detectStatic(schema, type, method) {
|
|
43
|
-
const def = schema.classes[type] ??
|
|
44
|
-
schema.interfaces[type];
|
|
45
|
-
if (def === undefined)
|
|
46
|
-
return false;
|
|
47
|
-
const methods = resolveAllMethods(def);
|
|
48
|
-
return methods[method]?.config.static === true;
|
|
49
|
-
}
|
package/dist/schema/tag.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema-tagging of raw nodes (API §6, the bindAny bridge). A module-level tag
|
|
3
|
-
* records the schema each BoundNode was bound under, so the traversal hooks can
|
|
4
|
-
* recover it from the node alone (`useChildren`/`useOut`/`useIn` re-bind endpoints).
|
|
5
|
-
*/
|
|
6
|
-
import type { Schema } from '@astrale-os/kernel-dsl';
|
|
7
|
-
/** Record the schema a BoundNode was bound under; returns the node unchanged. */
|
|
8
|
-
export declare function tagSchema<N>(node: N, schema: Schema): N;
|
|
9
|
-
/** The schema a BoundNode was bound under, if it came from a shell-react binding. */
|
|
10
|
-
export declare function schemaOf(node: object): Schema | undefined;
|
|
11
|
-
//# sourceMappingURL=tag.d.ts.map
|
package/dist/schema/tag.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/schema/tag.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAIpD,iFAAiF;AACjF,wBAAgB,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,CAGvD;AAED,qFAAqF;AACrF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzD"}
|
package/dist/schema/tag.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const schemaOfNode = new WeakMap();
|
|
2
|
-
/** Record the schema a BoundNode was bound under; returns the node unchanged. */
|
|
3
|
-
export function tagSchema(node, schema) {
|
|
4
|
-
if (node !== null && typeof node === 'object')
|
|
5
|
-
schemaOfNode.set(node, schema);
|
|
6
|
-
return node;
|
|
7
|
-
}
|
|
8
|
-
/** The schema a BoundNode was bound under, if it came from a shell-react binding. */
|
|
9
|
-
export function schemaOf(node) {
|
|
10
|
-
return schemaOfNode.get(node);
|
|
11
|
-
}
|
package/dist/schema/types.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-level surface for the schema module (API §6): the read envelopes
|
|
3
|
-
* (`TypedNodeResult`/`TypedChildrenResult`/`EndpointResult`) and the method /
|
|
4
|
-
* function contract projections. Param inference mirrors the client's proxy
|
|
5
|
-
* types (Zod optionality preserved), re-derived here because it is not exported.
|
|
6
|
-
*/
|
|
7
|
-
import type { AnyBoundNode, BoundNode, DefOf, EdgeNames, EndpointsOf, NodeRefInput, TypeNames } from '@astrale-os/kernel-client';
|
|
8
|
-
import type { z } from '@astrale-os/kernel-core';
|
|
9
|
-
import type { AllMethods, ExtractMethodNames, ExtractMethodParams, ExtractMethodReturnValue, Schema } from '@astrale-os/kernel-dsl';
|
|
10
|
-
import type { Action } from '../graph/action.js';
|
|
11
|
-
import type { ReadState, Windowed } from '../graph/memory/read/envelope.js';
|
|
12
|
-
export interface TypedNodeResult<S extends Schema, T extends TypeNames<S>> extends ReadState {
|
|
13
|
-
readonly node: BoundNode<DefOf<S, T>, S> | null;
|
|
14
|
-
}
|
|
15
|
-
export interface TypedChildrenResult<S extends Schema, T extends TypeNames<S>> extends ReadState, Windowed {
|
|
16
|
-
readonly children: readonly BoundNode<DefOf<S, T>, S>[];
|
|
17
|
-
}
|
|
18
|
-
/** Cardinality decides the envelope key: single|null for `1`/`0..1`, array otherwise. */
|
|
19
|
-
export type EndpointResult<S extends Schema, E extends EdgeNames<S>, Side extends 'from' | 'to'> = EndpointsOf<S, E, Side> extends readonly unknown[] ? ReadState & {
|
|
20
|
-
readonly nodes: EndpointsOf<S, E, Side>;
|
|
21
|
-
} : ReadState & {
|
|
22
|
-
readonly node: EndpointsOf<S, E, Side>;
|
|
23
|
-
};
|
|
24
|
-
/** Untyped traversal fallback — mirrors the raw `neighbors` shorthand. */
|
|
25
|
-
export interface UntypedEndpointResult<S extends Schema> extends ReadState, Windowed {
|
|
26
|
-
readonly nodes: readonly AnyBoundNode<S>[];
|
|
27
|
-
}
|
|
28
|
-
/** Dispatchable method names on `type` (own + inherited). */
|
|
29
|
-
export type MethodNames<S extends Schema, T extends TypeNames<S>> = ExtractMethodNames<DefOf<S, T>>;
|
|
30
|
-
type OptionalKeys<P> = {
|
|
31
|
-
[K in keyof P]: P[K] extends z.ZodOptional<any> | z.ZodDefault<any> ? K : never;
|
|
32
|
-
}[keyof P];
|
|
33
|
-
type RequiredKeys<P> = Exclude<keyof P, OptionalKeys<P>>;
|
|
34
|
-
type InferParams<P> = {
|
|
35
|
-
[K in RequiredKeys<P>]: P[K] extends z.ZodType<infer T> ? T : never;
|
|
36
|
-
} & {
|
|
37
|
-
[K in OptionalKeys<P>]?: P[K] extends z.ZodType<infer T> ? T : never;
|
|
38
|
-
};
|
|
39
|
-
type Simplify<T> = {
|
|
40
|
-
[K in keyof T]: T[K];
|
|
41
|
-
};
|
|
42
|
-
/** Runtime params object for method `M` on `type`. */
|
|
43
|
-
export type MethodParams<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>> = Simplify<InferParams<ExtractMethodParams<DefOf<S, T>, M & string>>>;
|
|
44
|
-
/** Resolved return value of method `M` on `type`. */
|
|
45
|
-
export type MethodResult<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>> = ExtractMethodReturnValue<DefOf<S, T>, M & string>;
|
|
46
|
-
/** True when method `M` on `type` is static. */
|
|
47
|
-
export type MethodIsStatic<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>> = M extends keyof AllMethods<DefOf<S, T>> ? AllMethods<DefOf<S, T>>[M] extends {
|
|
48
|
-
config: {
|
|
49
|
-
static: true;
|
|
50
|
-
};
|
|
51
|
-
} ? true : false : false;
|
|
52
|
-
/** Action for a `on`-bound or static method: `action(params)`. */
|
|
53
|
-
export type BoundMethodAction<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>> = Action<[MethodParams<S, T, M>], MethodResult<S, T, M>>;
|
|
54
|
-
/** Action for an unbound instance method: `action(ref, params)`. */
|
|
55
|
-
export type TargetedMethodAction<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>> = Action<[ref: NodeRefInput, params: MethodParams<S, T, M>], MethodResult<S, T, M>>;
|
|
56
|
-
/** Static → `action(params)`; instance → `action(ref, params)` (no `on`). */
|
|
57
|
-
export type AutoMethodAction<S extends Schema, T extends TypeNames<S>, M extends MethodNames<S, T>> = MethodIsStatic<S, T, M> extends true ? BoundMethodAction<S, T, M> : TargetedMethodAction<S, T, M>;
|
|
58
|
-
/** Standalone top-level function names of the schema (widens to `string` today — see above). */
|
|
59
|
-
export type FunctionNames<S extends Schema> = keyof S['functions'] & string;
|
|
60
|
-
/** Input value of standalone function `F` (`unknown` for a widened `FuncDef` — see above). */
|
|
61
|
-
export type FunctionParams<S extends Schema, F extends FunctionNames<S>> = S['functions'][F] extends {
|
|
62
|
-
config: {
|
|
63
|
-
input: infer I;
|
|
64
|
-
};
|
|
65
|
-
} ? I extends z.ZodType ? z.infer<I> : never : never;
|
|
66
|
-
/** Output value of standalone function `F` (`unknown` for a widened `FuncDef` — see above). */
|
|
67
|
-
export type FunctionResult<S extends Schema, F extends FunctionNames<S>> = S['functions'][F] extends {
|
|
68
|
-
config: {
|
|
69
|
-
output: infer O;
|
|
70
|
-
};
|
|
71
|
-
} ? O extends z.ZodType ? z.infer<O> : never : never;
|
|
72
|
-
export {};
|
|
73
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,KAAK,EACL,SAAS,EACT,WAAW,EACX,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AAC,SAAS,aAAa,CAAC,CAAC,CAAC,IACxB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS;IAAE,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAA;CAAE,GACzD,CAAC,SAAS,CAAC,CAAC,OAAO,GACjB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GACV,KAAK,GACP,KAAK,CAAA"}
|
package/dist/schema/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/schema/write.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { GraphMemory } from '@astrale-os/kernel-client/store';
|
|
2
|
-
import type { Node } from '@astrale-os/kernel-core';
|
|
3
|
-
import type { SessionView } from '../auth/act-as.context.js';
|
|
4
|
-
/**
|
|
5
|
-
* One memory-backed writable kernel per (effective) session view, plus the
|
|
6
|
-
* bind-time `id → tree-path` index it consults. Shared across every schema binding
|
|
7
|
-
* over the same session so a node bound under any schema resolves for a write.
|
|
8
|
-
*/
|
|
9
|
-
export interface WritableKernel {
|
|
10
|
-
readonly writable: SessionView;
|
|
11
|
-
readonly nodeIndex: Map<string, Node>;
|
|
12
|
-
}
|
|
13
|
-
export declare function writableFor(kernel: SessionView, memory: GraphMemory): WritableKernel;
|
|
14
|
-
/** Record a bound node's raw value so the write cap retains its class and tree path. */
|
|
15
|
-
export declare function recordNode(nodeIndex: Map<string, Node>, node: unknown): void;
|
|
16
|
-
//# sourceMappingURL=write.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/schema/write.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAE5D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;CACtC;AAGD,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,GAAG,cAAc,CAQpF;AAqDD,wFAAwF;AACxF,wBAAgB,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAO5E"}
|