@astrale-os/shell-react 0.3.1 → 0.3.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/dist/application/apps/app-host.d.ts +0 -1
  2. package/dist/application/apps/app-logo.d.ts +0 -1
  3. package/dist/application/apps/apps.hook.d.ts +0 -1
  4. package/dist/application/apps/open-app.hook.d.ts +0 -1
  5. package/dist/application/index.d.ts +0 -1
  6. package/dist/application/spaces/current-space.hook.d.ts +0 -1
  7. package/dist/application/spaces/current-space.store.d.ts +0 -1
  8. package/dist/application/spaces/space.hook.d.ts +0 -1
  9. package/dist/application/spaces/spaces.hook.d.ts +0 -1
  10. package/dist/application/user/user.hook.d.ts +0 -1
  11. package/dist/application/user/user.store.d.ts +0 -1
  12. package/dist/auth/act-as.context.d.ts +0 -1
  13. package/dist/auth/auth.hook.d.ts +0 -1
  14. package/dist/auth/can.hook.d.ts +0 -1
  15. package/dist/auth/index.d.ts +0 -1
  16. package/dist/auth/self.hook.d.ts +0 -1
  17. package/dist/auth/session-kernel.d.ts +0 -1
  18. package/dist/components/astrale.d.ts +0 -1
  19. package/dist/components/boundaries.d.ts +0 -1
  20. package/dist/components/can.d.ts +0 -1
  21. package/dist/components/index.d.ts +0 -1
  22. package/dist/graph/action.d.ts +0 -1
  23. package/dist/graph/async.d.ts +0 -1
  24. package/dist/graph/call/call.hook.d.ts +0 -1
  25. package/dist/graph/call/stream.hook.d.ts +0 -1
  26. package/dist/graph/graph.context.d.ts +0 -1
  27. package/dist/graph/guards.error.d.ts +0 -1
  28. package/dist/graph/index.d.ts +0 -1
  29. package/dist/graph/memory/read/envelope.d.ts +0 -1
  30. package/dist/graph/memory/read/idle.d.ts +0 -1
  31. package/dist/graph/query-definition.hook.d.ts +2 -2
  32. package/dist/graph/query-definition.hook.js +18 -4
  33. package/dist/graph/resource.d.ts +0 -1
  34. package/dist/graph/store.d.ts +0 -1
  35. package/dist/host/actions.hook.d.ts +0 -1
  36. package/dist/host/components.d.ts +0 -1
  37. package/dist/host/index.d.ts +0 -1
  38. package/dist/index.d.ts +2 -3
  39. package/dist/index.js +1 -1
  40. package/dist/intents/emit-intent.hook.d.ts +0 -1
  41. package/dist/intents/envelope.d.ts +0 -1
  42. package/dist/intents/index.d.ts +0 -1
  43. package/dist/intents/listen-intent.hook.d.ts +0 -1
  44. package/dist/intents/reply.d.ts +0 -1
  45. package/dist/intents/resolve-intent-target.d.ts +0 -1
  46. package/dist/intents/send-intent.hook.d.ts +0 -1
  47. package/dist/navigation/adapters/adapter.d.ts +0 -1
  48. package/dist/navigation/adapters/memory.adapter.d.ts +0 -1
  49. package/dist/navigation/adapters/url.adapter.d.ts +0 -1
  50. package/dist/navigation/codec.d.ts +0 -1
  51. package/dist/navigation/history.d.ts +0 -1
  52. package/dist/navigation/hooks/ancestors.hook.d.ts +0 -1
  53. package/dist/navigation/hooks/location.hook.d.ts +0 -1
  54. package/dist/navigation/hooks/navigate.hook.d.ts +0 -1
  55. package/dist/navigation/hooks/scope.hook.d.ts +0 -1
  56. package/dist/navigation/index.d.ts +0 -1
  57. package/dist/navigation/link.d.ts +0 -1
  58. package/dist/navigation/location.d.ts +0 -1
  59. package/dist/navigation/scope.context.d.ts +0 -1
  60. package/dist/navigation/snapshot.d.ts +0 -1
  61. package/dist/navigation/view-key.d.ts +0 -1
  62. package/dist/schema/action.hook.d.ts +4 -12
  63. package/dist/schema/action.hook.js +21 -5
  64. package/dist/schema/domain.context.d.ts +10 -0
  65. package/dist/schema/domain.context.js +17 -0
  66. package/dist/schema/domain.hook.d.ts +0 -1
  67. package/dist/schema/index.d.ts +2 -1
  68. package/dist/schema/index.js +1 -0
  69. package/dist/schema/kernel.hook.d.ts +0 -1
  70. package/dist/schema/mutation.hook.d.ts +2 -2
  71. package/dist/schema/mutation.hook.js +6 -3
  72. package/dist/schema/object.hook.d.ts +0 -1
  73. package/dist/schema/relation.hook.d.ts +0 -1
  74. package/dist/selection/index.d.ts +0 -1
  75. package/dist/selection/live.d.ts +0 -1
  76. package/dist/selection/scope.context.d.ts +0 -1
  77. package/dist/selection/selection.hook.d.ts +0 -1
  78. package/dist/session/boot/boot.d.ts +0 -1
  79. package/dist/session/boot/ownership.d.ts +0 -1
  80. package/dist/session/boot/status.d.ts +0 -1
  81. package/dist/session/connection/connection.hook.d.ts +0 -1
  82. package/dist/session/connection/connection.store.d.ts +0 -1
  83. package/dist/session/index.d.ts +0 -1
  84. package/dist/session/kernel-client.hook.d.ts +0 -1
  85. package/dist/session/kernel-instance.hook.d.ts +0 -1
  86. package/dist/session/provider.d.ts +0 -1
  87. package/dist/session/session.context.d.ts +0 -1
  88. package/dist/session/shell.hook.d.ts +0 -1
  89. package/dist/window/adopt.d.ts +0 -1
  90. package/dist/window/hooks/close-guard.hook.d.ts +0 -1
  91. package/dist/window/hooks/target-node.hook.d.ts +0 -1
  92. package/dist/window/hooks/views-for.hook.d.ts +0 -1
  93. package/dist/window/hooks/window.hook.d.ts +0 -1
  94. package/dist/window/hooks/windows.hook.d.ts +0 -1
  95. package/dist/window/host.d.ts +0 -1
  96. package/dist/window/hub.d.ts +0 -1
  97. package/dist/window/index.d.ts +0 -1
  98. package/dist/window/lifecycle/mount.d.ts +0 -1
  99. package/dist/window/lifecycle/states.d.ts +0 -1
  100. package/dist/window/placement.d.ts +0 -1
  101. package/dist/window/stage.d.ts +0 -1
  102. package/package.json +16 -18
  103. package/src/graph/query-definition.hook.ts +29 -10
  104. package/src/index.ts +2 -0
  105. package/src/schema/action.hook.ts +26 -15
  106. package/src/schema/domain.context.tsx +31 -0
  107. package/src/schema/index.ts +2 -0
  108. package/src/schema/mutation.hook.ts +9 -4
  109. package/dist/application/apps/app-host.d.ts.map +0 -1
  110. package/dist/application/apps/app-logo.d.ts.map +0 -1
  111. package/dist/application/apps/apps.hook.d.ts.map +0 -1
  112. package/dist/application/apps/open-app.hook.d.ts.map +0 -1
  113. package/dist/application/index.d.ts.map +0 -1
  114. package/dist/application/spaces/current-space.hook.d.ts.map +0 -1
  115. package/dist/application/spaces/current-space.store.d.ts.map +0 -1
  116. package/dist/application/spaces/space.hook.d.ts.map +0 -1
  117. package/dist/application/spaces/spaces.hook.d.ts.map +0 -1
  118. package/dist/application/user/user.hook.d.ts.map +0 -1
  119. package/dist/application/user/user.store.d.ts.map +0 -1
  120. package/dist/auth/act-as.context.d.ts.map +0 -1
  121. package/dist/auth/auth.hook.d.ts.map +0 -1
  122. package/dist/auth/can.hook.d.ts.map +0 -1
  123. package/dist/auth/index.d.ts.map +0 -1
  124. package/dist/auth/self.hook.d.ts.map +0 -1
  125. package/dist/auth/session-kernel.d.ts.map +0 -1
  126. package/dist/components/astrale.d.ts.map +0 -1
  127. package/dist/components/boundaries.d.ts.map +0 -1
  128. package/dist/components/can.d.ts.map +0 -1
  129. package/dist/components/index.d.ts.map +0 -1
  130. package/dist/graph/action.d.ts.map +0 -1
  131. package/dist/graph/async.d.ts.map +0 -1
  132. package/dist/graph/call/call.hook.d.ts.map +0 -1
  133. package/dist/graph/call/stream.hook.d.ts.map +0 -1
  134. package/dist/graph/graph.context.d.ts.map +0 -1
  135. package/dist/graph/guards.error.d.ts.map +0 -1
  136. package/dist/graph/index.d.ts.map +0 -1
  137. package/dist/graph/memory/read/envelope.d.ts.map +0 -1
  138. package/dist/graph/memory/read/idle.d.ts.map +0 -1
  139. package/dist/graph/query-definition.hook.d.ts.map +0 -1
  140. package/dist/graph/resource.d.ts.map +0 -1
  141. package/dist/graph/store.d.ts.map +0 -1
  142. package/dist/host/actions.hook.d.ts.map +0 -1
  143. package/dist/host/components.d.ts.map +0 -1
  144. package/dist/host/index.d.ts.map +0 -1
  145. package/dist/index.d.ts.map +0 -1
  146. package/dist/intents/emit-intent.hook.d.ts.map +0 -1
  147. package/dist/intents/envelope.d.ts.map +0 -1
  148. package/dist/intents/index.d.ts.map +0 -1
  149. package/dist/intents/listen-intent.hook.d.ts.map +0 -1
  150. package/dist/intents/reply.d.ts.map +0 -1
  151. package/dist/intents/resolve-intent-target.d.ts.map +0 -1
  152. package/dist/intents/send-intent.hook.d.ts.map +0 -1
  153. package/dist/navigation/adapters/adapter.d.ts.map +0 -1
  154. package/dist/navigation/adapters/memory.adapter.d.ts.map +0 -1
  155. package/dist/navigation/adapters/url.adapter.d.ts.map +0 -1
  156. package/dist/navigation/codec.d.ts.map +0 -1
  157. package/dist/navigation/history.d.ts.map +0 -1
  158. package/dist/navigation/hooks/ancestors.hook.d.ts.map +0 -1
  159. package/dist/navigation/hooks/location.hook.d.ts.map +0 -1
  160. package/dist/navigation/hooks/navigate.hook.d.ts.map +0 -1
  161. package/dist/navigation/hooks/scope.hook.d.ts.map +0 -1
  162. package/dist/navigation/index.d.ts.map +0 -1
  163. package/dist/navigation/link.d.ts.map +0 -1
  164. package/dist/navigation/location.d.ts.map +0 -1
  165. package/dist/navigation/scope.context.d.ts.map +0 -1
  166. package/dist/navigation/snapshot.d.ts.map +0 -1
  167. package/dist/navigation/view-key.d.ts.map +0 -1
  168. package/dist/schema/action.hook.d.ts.map +0 -1
  169. package/dist/schema/domain.hook.d.ts.map +0 -1
  170. package/dist/schema/index.d.ts.map +0 -1
  171. package/dist/schema/kernel.hook.d.ts.map +0 -1
  172. package/dist/schema/mutation.hook.d.ts.map +0 -1
  173. package/dist/schema/object.hook.d.ts.map +0 -1
  174. package/dist/schema/relation.hook.d.ts.map +0 -1
  175. package/dist/selection/index.d.ts.map +0 -1
  176. package/dist/selection/live.d.ts.map +0 -1
  177. package/dist/selection/scope.context.d.ts.map +0 -1
  178. package/dist/selection/selection.hook.d.ts.map +0 -1
  179. package/dist/session/boot/boot.d.ts.map +0 -1
  180. package/dist/session/boot/ownership.d.ts.map +0 -1
  181. package/dist/session/boot/status.d.ts.map +0 -1
  182. package/dist/session/connection/connection.hook.d.ts.map +0 -1
  183. package/dist/session/connection/connection.store.d.ts.map +0 -1
  184. package/dist/session/index.d.ts.map +0 -1
  185. package/dist/session/kernel-client.hook.d.ts.map +0 -1
  186. package/dist/session/kernel-instance.hook.d.ts.map +0 -1
  187. package/dist/session/provider.d.ts.map +0 -1
  188. package/dist/session/session.context.d.ts.map +0 -1
  189. package/dist/session/shell.hook.d.ts.map +0 -1
  190. package/dist/window/adopt.d.ts.map +0 -1
  191. package/dist/window/hooks/close-guard.hook.d.ts.map +0 -1
  192. package/dist/window/hooks/target-node.hook.d.ts.map +0 -1
  193. package/dist/window/hooks/views-for.hook.d.ts.map +0 -1
  194. package/dist/window/hooks/window.hook.d.ts.map +0 -1
  195. package/dist/window/hooks/windows.hook.d.ts.map +0 -1
  196. package/dist/window/host.d.ts.map +0 -1
  197. package/dist/window/hub.d.ts.map +0 -1
  198. package/dist/window/index.d.ts.map +0 -1
  199. package/dist/window/lifecycle/mount.d.ts.map +0 -1
  200. package/dist/window/lifecycle/states.d.ts.map +0 -1
  201. package/dist/window/placement.d.ts.map +0 -1
  202. package/dist/window/stage.d.ts.map +0 -1
@@ -20,4 +20,3 @@ export interface AppHostProps {
20
20
  }
21
21
  /** Resolve and mount an installed Domain through the ordinary Shell View lifecycle. */
22
22
  export declare const AppHost: import("react").ForwardRefExoticComponent<AppHostProps & import("react").RefAttributes<ViewHostHandle>>;
23
- //# sourceMappingURL=app-host.d.ts.map
@@ -16,4 +16,3 @@ export interface AppLogoProps {
16
16
  fallback?: ReactNode;
17
17
  }
18
18
  export declare function AppLogo({ logo, alt, className, style, fallback }: AppLogoProps): ReactElement;
19
- //# sourceMappingURL=app-logo.d.ts.map
@@ -5,4 +5,3 @@ export interface AppsResult extends ReadState {
5
5
  }
6
6
  /** Read the installed Domain applications available to the current Shell session. */
7
7
  export declare function useApps(): AppsResult;
8
- //# sourceMappingURL=apps.hook.d.ts.map
@@ -3,4 +3,3 @@ import type { App, ResolvedView } from '@astrale-os/shell';
3
3
  import type { Action } from '../../graph/action.js';
4
4
  /** Resolve one installed Domain's ordinary entry View. */
5
5
  export declare function useOpenApp(): Action<[App | Key.Origin], ResolvedView | null>;
6
- //# sourceMappingURL=open-app.hook.d.ts.map
@@ -13,4 +13,3 @@ export type { AppHostFallbackState, AppHostProps } from './apps/app-host.js';
13
13
  export { AppLogo } from './apps/app-logo.js';
14
14
  export type { AppLogoProps } from './apps/app-logo.js';
15
15
  export type { App, NodeTarget, ResolvedView, SpaceNode, UserNode } from '@astrale-os/shell';
16
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@ export interface CurrentSpaceResult extends ReadState {
4
4
  readonly space: SpaceNode | null;
5
5
  }
6
6
  export declare function useCurrentSpace(): CurrentSpaceResult;
7
- //# sourceMappingURL=current-space.hook.d.ts.map
@@ -29,4 +29,3 @@ export interface CurrentSpaceStore {
29
29
  }
30
30
  /** The one current-space store for a Shell (created on first touch). */
31
31
  export declare function currentSpaceStore(shell: Shell): CurrentSpaceStore;
32
- //# sourceMappingURL=current-space.store.d.ts.map
@@ -2,4 +2,3 @@ import type { NodeTarget } from '@astrale-os/shell';
2
2
  import type { CurrentSpaceResult } from './current-space.hook.js';
3
3
  export type SpaceResult = CurrentSpaceResult;
4
4
  export declare function useSpace(ref: NodeTarget | null | undefined): SpaceResult;
5
- //# sourceMappingURL=space.hook.d.ts.map
@@ -10,4 +10,3 @@ export interface SpacesResult extends ReadState {
10
10
  readonly switch: Action<[NodeTarget], void>;
11
11
  }
12
12
  export declare function useSpaces(): SpacesResult;
13
- //# sourceMappingURL=spaces.hook.d.ts.map
@@ -7,4 +7,3 @@
7
7
  */
8
8
  import type { UserNode } from '@astrale-os/shell';
9
9
  export declare function useUser(): UserNode;
10
- //# sourceMappingURL=user.hook.d.ts.map
@@ -32,4 +32,3 @@ export declare function isOsPlaneAvailable(shell: Shell): boolean;
32
32
  export declare function primeUser(shell: Shell): Promise<void>;
33
33
  /** Kick off `me()` lazily (a shell that was never primed) and cache a suspense cell. */
34
34
  export declare function loadUser(shell: Shell): UserEntry;
35
- //# sourceMappingURL=user.store.d.ts.map
@@ -20,4 +20,3 @@ export interface ActAsProps {
20
20
  }
21
21
  /** Bind a subtree to an explicitly supplied authenticated Kernel capability. */
22
22
  export declare function ActAs({ client, fallback, children }: ActAsProps): ReactElement | null;
23
- //# sourceMappingURL=act-as.context.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import type { AuthApi } from '@astrale-os/sdk/auth';
2
2
  /** The exact Client Auth capability for the effective subtree principal. */
3
3
  export declare function useAuth(): AuthApi;
4
- //# sourceMappingURL=auth.hook.d.ts.map
@@ -9,4 +9,3 @@ export type PolicyObject = NodeId | {
9
9
  * invoked callable remains the authorization enforcement point.
10
10
  */
11
11
  export declare function useCan(policy: PathLike | PolicyRef | null | undefined, object: PolicyObject | null | undefined): boolean | undefined;
12
- //# sourceMappingURL=can.hook.d.ts.map
@@ -4,4 +4,3 @@ export { useAuth } from './auth.hook.js';
4
4
  export { useCan } from './can.hook.js';
5
5
  export type { PolicyObject } from './can.hook.js';
6
6
  export { useSelf } from './self.hook.js';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { Identity } from '@astrale-os/sdk/auth';
2
2
  export declare function useSelf(): Identity;
3
- //# sourceMappingURL=self.hook.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { KernelClient } from '@astrale-os/shell';
2
2
  export declare function useSessionKernel(): KernelClient;
3
- //# sourceMappingURL=session-kernel.d.ts.map
@@ -11,4 +11,3 @@ export interface AstraleProps {
11
11
  }
12
12
  /** Complete Astrale runtime root without taking ownership of application routing. */
13
13
  export declare function Astrale(props: AstraleProps): ReactElement;
14
- //# sourceMappingURL=astrale.d.ts.map
@@ -44,4 +44,3 @@ export declare function CredentialBoundary(props: {
44
44
  readonly children: ReactNode;
45
45
  readonly fallback?: (credential: CredentialSnapshot) => ReactNode;
46
46
  }): ReactElement;
47
- //# sourceMappingURL=boundaries.d.ts.map
@@ -8,4 +8,3 @@ export declare function Can(props: {
8
8
  readonly children: ReactNode;
9
9
  readonly fallback?: ReactNode;
10
10
  }): ReactElement;
11
- //# sourceMappingURL=can.d.ts.map
@@ -3,4 +3,3 @@ export { ConnectionBoundary, CredentialBoundary, defaultViewError, defaultViewLo
3
3
  export type { ViewErrorBoundaryProps } from './boundaries.js';
4
4
  export { Astrale } from './astrale.js';
5
5
  export type { AstraleProps } from './astrale.js';
6
- //# sourceMappingURL=index.d.ts.map
@@ -19,4 +19,3 @@ export interface Action<A extends unknown[], R> {
19
19
  * fields are re-stamped each render, so reads stay current across settlements.
20
20
  */
21
21
  export declare function useAction<A extends unknown[], R>(fn: (...args: A) => Promise<R>): Action<A, R>;
22
- //# sourceMappingURL=action.d.ts.map
@@ -8,4 +8,3 @@ export interface AsyncResource<T> extends ReadState {
8
8
  * retained through a pending refetch or a failure (§1.1).
9
9
  */
10
10
  export declare function useAsyncResource<T>(load: (() => Promise<T>) | null, empty: T, deps: readonly unknown[]): AsyncResource<T>;
11
- //# sourceMappingURL=async.d.ts.map
@@ -8,4 +8,3 @@ export interface CallOptions extends SessionRequestOptions {
8
8
  export type CallResult = Value;
9
9
  export declare function useCall(call: Call | null, options?: CallOptions): Action<[], CallResult>;
10
10
  export declare function useCall<A extends unknown[]>(author: ((...args: A) => Call) | null, options?: CallOptions): Action<A, CallResult>;
11
- //# sourceMappingURL=call.hook.d.ts.map
@@ -17,4 +17,3 @@ export interface StreamHandle<A extends unknown[] = unknown[], T = StreamItem> {
17
17
  cancel(): void;
18
18
  }
19
19
  export declare function useStream<A extends unknown[] = []>(author: CallAuthor<A> | null, options?: StreamOptions): StreamHandle<A, StreamItem>;
20
- //# sourceMappingURL=stream.hook.d.ts.map
@@ -2,4 +2,3 @@ import type { GraphStore } from '@astrale-os/sdk/client/store';
2
2
  /** Optional exact Client GraphStore supplied by an injected Shell adapter. */
3
3
  export declare const GraphContext: import("react").Context<GraphStore | null>;
4
4
  export type { GraphStore };
5
- //# sourceMappingURL=graph.context.d.ts.map
@@ -5,4 +5,3 @@ import { ClientError } from '@astrale-os/sdk/client';
5
5
  import { NodeUnavailableError } from '@astrale-os/sdk/client';
6
6
  export declare function isClientError(error: unknown): error is ClientError;
7
7
  export declare function isNodeUnavailableError(error: unknown): error is NodeUnavailableError;
8
- //# sourceMappingURL=guards.error.d.ts.map
@@ -9,4 +9,3 @@ export type { CallAuthor, KernelStream, StreamHandle, StreamItem, StreamOptions,
9
9
  export type { Action } from './action.js';
10
10
  export type { GraphStore } from './graph.context.js';
11
11
  export { ClientError, NodeUnavailableError, ProtocolError, ResponseError, StaleRouteError, TransportError, isClientError, isNodeUnavailableError, } from './guards.error.js';
12
- //# sourceMappingURL=index.d.ts.map
@@ -36,4 +36,3 @@ export declare class UnsupportedFeatureError extends Error {
36
36
  }
37
37
  export declare function idleReadState(): ReadState;
38
38
  export declare function unsupportedReadState(feature: string): ReadState;
39
- //# sourceMappingURL=envelope.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import type { ReadState } from './envelope.js';
2
2
  export declare function isIdleInput(value: unknown): value is null | undefined;
3
3
  export declare function idleReadState(): ReadState;
4
- //# sourceMappingURL=idle.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import type { QueryDefinition } from '@astrale-os/sdk/query';
2
+ import type { Domain } from '@astrale-os/sdk/schema';
2
3
  import type { GraphResource } from './resource.js';
3
4
  export interface QueryResourceOptions {
4
5
  readonly keepPrevious?: boolean;
@@ -6,5 +7,4 @@ export interface QueryResourceOptions {
6
7
  readonly refreshWhen?: 'always' | 'visible';
7
8
  }
8
9
  /** Execute one named SDK Query definition exclusively through the current GraphStore. */
9
- export declare function useQuery<Input, Output>(definition: QueryDefinition<Input, Output> | null, input: Input, options?: QueryResourceOptions): GraphResource<Output>;
10
- //# sourceMappingURL=query-definition.hook.d.ts.map
10
+ export declare function useQuery<DomainValue extends Domain, Input, Output>(definition: QueryDefinition<DomainValue, Input, Output> | null, input: Input, options?: QueryResourceOptions): GraphResource<Output>;
@@ -1,9 +1,11 @@
1
1
  import { executeQuery } from '@astrale-os/sdk/query';
2
2
  import { useCallback, useEffect, useMemo, useRef, useSyncExternalStore } from 'react';
3
+ import { useExecutionDomain } from '../schema/domain.context.js';
3
4
  import { retainRefreshScheduler } from './resource.js';
4
5
  import { useGraphStore } from './store.js';
5
6
  class DefinitionObserver {
6
7
  store;
8
+ domain;
7
9
  definition;
8
10
  input;
9
11
  listeners = new Set();
@@ -14,8 +16,9 @@ class DefinitionObserver {
14
16
  pending = null;
15
17
  started = false;
16
18
  rerunQueued = false;
17
- constructor(store, definition, input) {
19
+ constructor(store, domain, definition, input) {
18
20
  this.store = store;
21
+ this.domain = domain;
19
22
  this.definition = definition;
20
23
  this.input = input;
21
24
  }
@@ -50,7 +53,7 @@ class DefinitionObserver {
50
53
  touched.push(Object.freeze({ ast, options }));
51
54
  return this.store.read(ast, { ...options, freshness });
52
55
  };
53
- const running = executeQuery({ query: execute }, this.definition, this.input)
56
+ const running = executeQuery({ query: execute }, this.domain, this.definition, this.input)
54
57
  .then((data) => {
55
58
  if (!this.started || generation !== this.generation)
56
59
  return;
@@ -114,14 +117,15 @@ class DefinitionObserver {
114
117
  /** Execute one named SDK Query definition exclusively through the current GraphStore. */
115
118
  export function useQuery(definition, input, options = {}) {
116
119
  const store = useGraphStore();
120
+ const domain = useExecutionDomain();
117
121
  const inputIdentity = stableIdentity(input);
118
- const observer = useMemo(() => (definition === null ? null : new DefinitionObserver(store, definition, input)), [store, definition, inputIdentity]);
122
+ const observer = useMemo(() => (definition === null ? null : new DefinitionObserver(store, domain, definition, input)), [store, domain, definition, inputIdentity]);
119
123
  const idle = useMemo(() => Object.freeze({ state: 'idle' }), []);
120
124
  const subscribe = useCallback((listener) => observer?.subscribe(listener) ?? (() => { }), [observer]);
121
125
  const snapshot = useCallback(() => observer?.getSnapshot() ?? idle, [observer, idle]);
122
126
  const current = useSyncExternalStore(subscribe, snapshot, snapshot);
123
127
  useEffect(() => observer?.start(), [observer]);
124
- const identity = definition === null ? 'idle' : `${definition.id}\u0000${inputIdentity}`;
128
+ const identity = definition === null ? 'idle' : `${definitionIdentity(definition)}\u0000${inputIdentity}`;
125
129
  useEffect(() => {
126
130
  if (observer === null || options.refreshInterval === undefined)
127
131
  return;
@@ -148,6 +152,16 @@ export function useQuery(definition, input, options = {}) {
148
152
  more: Object.freeze({ has: false, pending: false, load: () => Promise.resolve() }),
149
153
  }), [current, previous, observer]);
150
154
  }
155
+ const definitionIdentities = new WeakMap();
156
+ let nextDefinitionIdentity = 1;
157
+ function definitionIdentity(definition) {
158
+ const retained = definitionIdentities.get(definition);
159
+ if (retained !== undefined)
160
+ return retained;
161
+ const created = nextDefinitionIdentity++;
162
+ definitionIdentities.set(definition, created);
163
+ return created;
164
+ }
151
165
  function dedupeShapes(input) {
152
166
  const seen = new Set();
153
167
  return Object.freeze(input.filter(({ ast, options }) => {
@@ -31,4 +31,3 @@ export interface StoreResourceOptions<Output> {
31
31
  /** Adapt exact Store pages into a tear-free React resource without a parallel entity cache. */
32
32
  export declare function useStoreResource<Query extends QueryAST, Output>(query: Query | null, pageSize: number, project: (response: StoreQueryResponse<Query>) => Output, options?: StoreResourceOptions<Output>): GraphResource<Output>;
33
33
  export declare function retainRefreshScheduler(store: GraphStore, identity: string, refresh: () => Promise<void>, interval: number, when: 'always' | 'visible'): () => void;
34
- //# sourceMappingURL=resource.d.ts.map
@@ -22,4 +22,3 @@ export declare function retainStore(entry: StoreEntry): () => void;
22
22
  /** The exact caller/schema-scoped GraphStore for the current View subtree. */
23
23
  export declare function useGraphStore(): GraphStoreValue;
24
24
  export {};
25
- //# sourceMappingURL=store.d.ts.map
@@ -31,4 +31,3 @@ export interface RequestAccessApi {
31
31
  readonly supported: boolean;
32
32
  }
33
33
  export declare function useRequestAccess(): RequestAccessApi;
34
- //# sourceMappingURL=actions.hook.d.ts.map
@@ -12,4 +12,3 @@ export declare function NestedView(props: {
12
12
  export declare function RequestAccess(props: {
13
13
  readonly children: (request: RequestAccessApi) => ReactNode;
14
14
  }): ReactElement;
15
- //# sourceMappingURL=components.d.ts.map
@@ -2,4 +2,3 @@ export { useExternalOpen, useHostCapabilities, useHostDialog, useNotify, useOpen
2
2
  export type { ExternalOpenApi, HostDialogApi, NotifyApi, OpenViewApi, RequestAccessApi, } from './actions.hook.js';
3
3
  export { HostDialog, NestedView, Notify, RequestAccess } from './components.js';
4
4
  export { HostCapabilityUnavailableError } from './actions.hook.js';
5
- //# sourceMappingURL=index.d.ts.map
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export { ActAs, useAuth, useCan, useSelf } from './auth/index.js';
5
5
  export type { ActAsProps, PolicyObject } from './auth/index.js';
6
6
  export { ClientError, NodeUnavailableError, ProtocolError, ResponseError, StaleRouteError, TransportError, isClientError, isNodeUnavailableError, useCall, useGraphStore, useQuery, useStream, } from './graph/index.js';
7
7
  export type { CallOptions, GraphResource, GraphResourceState, GraphStore, QueryResourceOptions, StreamHandle, StreamOptions, } from './graph/index.js';
8
- export { RelationUnavailableError, queryRefresh, useAction, useDomain, useDomains, useDynamicDomain, useDynamicObject, useKernel, useMutation, useObject, useRelation, } from './schema/index.js';
9
- export type { ActionOptions, ActionRefresh, DomainAction, MutationOptions, QueryRefresh, RelationOptions, RelationResource, RelationUnavailable, RichReadOptions, } from './schema/index.js';
8
+ export { DomainProvider, RelationUnavailableError, queryRefresh, useAction, useDomain, useDomains, useDynamicDomain, useDynamicObject, useKernel, useMutation, useObject, useRelation, } from './schema/index.js';
9
+ export type { ActionOptions, ActionRefresh, DomainProviderProps, DomainAction, MutationOptions, QueryRefresh, RelationOptions, RelationResource, RelationUnavailable, RichReadOptions, } from './schema/index.js';
10
10
  export { Link, NavigationScope, NavScope, NodeLink, pathParam, ViewLink, defineNavigation, enumParam, location, memoryAdapter, urlAdapter, useAncestors, useLocation, useNavigate, useNavigation, useNavScope, } from './navigation/index.js';
11
11
  export type { LinkProps, LocationDefinition, MissingPolicy, NavAdapter, NavLocation, NavScopeHandle, NavScopeProps, NavSnapshot, NavTarget, NavigationDefinition, NavigationParam, NavigationParams, NavigationRoutes, NavigationTarget, NodeLinkProps, Navigate, SerializedLocation, ViewLinkProps, } from './navigation/index.js';
12
12
  export { SelectionScope, useSelection } from './selection/index.js';
@@ -29,4 +29,3 @@ export type { PathLike } from '@astrale-os/sdk/graph/path';
29
29
  export type { AuthApi, Identity, PolicyDecisionInput } from '@astrale-os/sdk/auth';
30
30
  export type { DomainBinding } from '@astrale-os/shell';
31
31
  export type { App, CloseResult, CredentialSnapshot, HostCapabilities, IntentRegistry, KernelClient, MountCredential, NodeTarget, Shell, ShellConfig, SpaceNode, UserNode, ViewLocation, ViewPresentation, ViewPresentationRequest, Window, } from '@astrale-os/shell';
32
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ export { ActAs, useAuth, useCan, useSelf } from './auth/index.js';
5
5
  // One Store path and named SDK definitions. Raw Query/Mutation builders are intentionally absent.
6
6
  export { ClientError, NodeUnavailableError, ProtocolError, ResponseError, StaleRouteError, TransportError, isClientError, isNodeUnavailableError, useCall, useGraphStore, useQuery, useStream, } from './graph/index.js';
7
7
  // Rich exact Domain bindings.
8
- export { RelationUnavailableError, queryRefresh, useAction, useDomain, useDomains, useDynamicDomain, useDynamicObject, useKernel, useMutation, useObject, useRelation, } from './schema/index.js';
8
+ export { DomainProvider, RelationUnavailableError, queryRefresh, useAction, useDomain, useDomains, useDynamicDomain, useDynamicObject, useKernel, useMutation, useObject, useRelation, } from './schema/index.js';
9
9
  // Typed navigation and selection.
10
10
  export { Link, NavigationScope, NavScope, NodeLink, pathParam, ViewLink, defineNavigation, enumParam, location, memoryAdapter, urlAdapter, useAncestors, useLocation, useNavigate, useNavigation, useNavScope, } from './navigation/index.js';
11
11
  export { SelectionScope, useSelection } from './selection/index.js';
@@ -14,4 +14,3 @@ export interface EmitIntent {
14
14
  * without retaining a pending request.
15
15
  */
16
16
  export declare function useEmitIntent(): EmitIntent;
17
- //# sourceMappingURL=emit-intent.hook.d.ts.map
@@ -18,4 +18,3 @@ export declare const NOOP: () => void;
18
18
  * relation that the generic union type cannot express.
19
19
  */
20
20
  export declare function intentMessage(name: string, payload: unknown, correlationId?: string): IntentMessage;
21
- //# sourceMappingURL=envelope.d.ts.map
@@ -5,4 +5,3 @@ export type { EmitIntent } from './emit-intent.hook.js';
5
5
  export { useSendIntent } from './send-intent.hook.js';
6
6
  export type { SendIntent } from './send-intent.hook.js';
7
7
  export type { IntentPayload, IntentReply } from './envelope.js';
8
- //# sourceMappingURL=index.d.ts.map
@@ -13,4 +13,3 @@ export interface IntentCtx<K extends keyof IntentRegistry> {
13
13
  * answers a correlated request once.
14
14
  */
15
15
  export declare function useIntent<K extends keyof IntentRegistry>(name: K, handler: (payload: IntentPayload<K>, ctx: IntentCtx<K>) => void | Promise<void>): void;
16
- //# sourceMappingURL=listen-intent.hook.d.ts.map
@@ -6,4 +6,3 @@
6
6
  import type { Shell } from '@astrale-os/shell';
7
7
  /** Deliver a reply to whichever channel the request arrived on. Best-effort. */
8
8
  export declare function sendReply(shell: Shell, sender: string, correlationId: string, result: unknown): void;
9
- //# sourceMappingURL=reply.d.ts.map
@@ -9,4 +9,3 @@ export type IntentTarget = {
9
9
  readonly reason: string;
10
10
  };
11
11
  export declare function resolveIntentTarget(shell: Shell, to: string | undefined): IntentTarget;
12
- //# sourceMappingURL=resolve-intent-target.d.ts.map
@@ -7,4 +7,3 @@ export interface SendIntent {
7
7
  }): Promise<IntentReply<K>>;
8
8
  }
9
9
  export declare function useSendIntent(): SendIntent;
10
- //# sourceMappingURL=send-intent.hook.d.ts.map
@@ -17,4 +17,3 @@ export interface NavAdapter {
17
17
  subscribe(onExternalChange: () => void): () => void;
18
18
  href?(loc: SerializedLocation): string;
19
19
  }
20
- //# sourceMappingURL=adapter.d.ts.map
@@ -6,4 +6,3 @@ import type { SerializedLocation } from '../history.js';
6
6
  import type { NavAdapter } from './adapter.js';
7
7
  /** In-memory adapter — the default scope backing (per-pane state, no URL). */
8
8
  export declare function memoryAdapter(initial?: SerializedLocation): NavAdapter;
9
- //# sourceMappingURL=memory.adapter.d.ts.map
@@ -3,4 +3,3 @@ import type { NavAdapter } from './adapter.js';
3
3
  export declare function urlAdapter(opts?: {
4
4
  param?: string;
5
5
  }): NavAdapter;
6
- //# sourceMappingURL=url.adapter.d.ts.map
@@ -57,4 +57,3 @@ export declare function useNavigation<Routes extends NavigationRoutes>(navigatio
57
57
  }>;
58
58
  export type NavigationTarget<Definition> = Definition extends NavigationDefinition<infer Routes> ? RouteTarget<Routes> : never;
59
59
  export {};
60
- //# sourceMappingURL=codec.d.ts.map
@@ -62,4 +62,3 @@ export declare function seedEntries(fromAdapter: SerializedLocation | null, rest
62
62
  entries: SerializedLocation[];
63
63
  cursor: number;
64
64
  };
65
- //# sourceMappingURL=history.d.ts.map
@@ -8,4 +8,3 @@ import type { ReadState } from '../../graph/memory/read/envelope.js';
8
8
  export declare function useAncestors(_node?: Node | PathLike): ReadState & {
9
9
  readonly chain: readonly Node[];
10
10
  };
11
- //# sourceMappingURL=ancestors.hook.d.ts.map
@@ -1,4 +1,3 @@
1
1
  import type { NavLocation } from '../location.js';
2
2
  /** The nearest scope's live location. Throws outside any {@link NavScope}. */
3
3
  export declare function useLocation(): NavLocation;
4
- //# sourceMappingURL=location.hook.d.ts.map
@@ -9,4 +9,3 @@ export declare function useNavigate(): Navigate;
9
9
  * only when navigation availability changes.
10
10
  */
11
11
  export declare function useNavigateHandle(ctx: NavCtx): Navigate;
12
- //# sourceMappingURL=navigate.hook.d.ts.map
@@ -9,4 +9,3 @@ export interface NavScopeHandle {
9
9
  }
10
10
  /** The nearest scope, for chrome/persistence (API §8.2). Throws outside a scope. */
11
11
  export declare function useNavScope(): NavScopeHandle;
12
- //# sourceMappingURL=scope.hook.d.ts.map
@@ -15,4 +15,3 @@ export type { NavAdapter } from './adapters/adapter.js';
15
15
  export type { NavLocation } from './location.js';
16
16
  export type { NavSnapshot, SerializedLocation } from './history.js';
17
17
  export type { NavTarget } from './snapshot.js';
18
- //# sourceMappingURL=index.d.ts.map
@@ -20,4 +20,3 @@ export type NodeLinkProps = Omit<LinkProps, 'to'> & {
20
20
  };
21
21
  /** Canonical node-only link; use ViewLink when a View/params contract exists. */
22
22
  export declare function NodeLink(props: NodeLinkProps): ReactElement;
23
- //# sourceMappingURL=link.d.ts.map
@@ -18,4 +18,3 @@ export interface NavLocation {
18
18
  export declare const IDLE_LOCATION: NavLocation;
19
19
  export declare function buildLocation(entry: SerializedLocation | null, result: PointResult | null): NavLocation;
20
20
  export type { Node, NodeId };
21
- //# sourceMappingURL=location.d.ts.map
@@ -52,4 +52,3 @@ export interface NavScopeProps {
52
52
  }
53
53
  export declare function NavScope(props: NavScopeProps): ReactElement;
54
54
  export {};
55
- //# sourceMappingURL=scope.context.d.ts.map
@@ -14,4 +14,3 @@ export type NavTarget = PathLike | Node | {
14
14
  export declare function serializeTarget(target: NavTarget): SerializedLocation;
15
15
  /** Drop restored entries that no longer resolve under the authenticated Graph capability. */
16
16
  export declare function revalidateAndPrune(history: NavHistory, store: GraphStore, shell: Shell): Promise<boolean>;
17
- //# sourceMappingURL=snapshot.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import type { Key } from '@astrale-os/sdk/schema';
2
2
  export declare function viewKey(input: string): Key.View;
3
- //# sourceMappingURL=view-key.d.ts.map
@@ -1,6 +1,7 @@
1
1
  import type { BoundNodeFor } from '@astrale-os/sdk/client';
2
2
  import type { SessionRequestOptions } from '@astrale-os/sdk/client/session';
3
- import type { QueryAST } from '@astrale-os/sdk/query';
3
+ import type { QueryAST, QueryDefinition } from '@astrale-os/sdk/query';
4
+ import type { Domain } from '@astrale-os/sdk/schema';
4
5
  import type { CallableInputOf, CallableResultOf, MethodOwnerKeyOf, MethodInheritance, ResolvedFunction, ResolvedMethod } from '@astrale-os/sdk/schema';
5
6
  type ExecutableInheritance = Exclude<MethodInheritance, 'abstract'>;
6
7
  type InstanceMethod = ResolvedMethod<unknown, unknown, false, ExecutableInheritance>;
@@ -10,23 +11,15 @@ type MethodReceiver<C extends InstanceMethod> = BoundNodeFor<MethodOwnerKeyOf<C>
10
11
  declare const QUERY_REFRESH: unique symbol;
11
12
  export interface QueryRefresh {
12
13
  readonly id: string;
13
- readonly [QUERY_REFRESH]: () => {
14
+ readonly [QUERY_REFRESH]: (domain: Domain) => {
14
15
  readonly ast: QueryAST;
15
16
  readonly page: Readonly<{
16
17
  readonly size: number;
17
18
  }>;
18
19
  };
19
20
  }
20
- type RefreshableQuery<Input, Query extends QueryAST> = {
21
- readonly id: string;
22
- readonly page: Readonly<{
23
- readonly size: number;
24
- }>;
25
- prepare?(input: Input): Input;
26
- build(input: Input): Query;
27
- };
28
21
  /** Pair one exact named Query definition with its admitted input for targeted invalidation. */
29
- export declare function queryRefresh<Input, Query extends QueryAST>(definition: RefreshableQuery<Input, Query>, input: Input): QueryRefresh;
22
+ export declare function queryRefresh<DomainValue extends Domain, Input, Output>(definition: QueryDefinition<DomainValue, Input, Output>, input: Input): QueryRefresh;
30
23
  export type ActionRefresh = 'all' | 'none' | {
31
24
  readonly queries: readonly QueryRefresh[];
32
25
  };
@@ -45,4 +38,3 @@ export interface DomainAction<Args extends unknown[], Result> {
45
38
  /** Invoke one schema-declared Function or Method and invalidate Store by explicit policy. */
46
39
  export declare function useAction<C extends Callable>(callable: C, options?: ActionOptions): DomainAction<ActionArgs<C>, CallableResultOf<C>>;
47
40
  export {};
48
- //# sourceMappingURL=action.hook.d.ts.map
@@ -1,18 +1,26 @@
1
1
  import { reference } from '@astrale-os/sdk/client/session';
2
2
  import { Path } from '@astrale-os/sdk/graph/path';
3
+ import { realizeQuery } from '@astrale-os/sdk/query';
3
4
  import { useCallback, useMemo, useRef } from 'react';
4
5
  import { useSessionKernel } from '../auth/session-kernel.js';
5
6
  import { useAction as useAsyncAction } from '../graph/action.js';
6
7
  import { useGraphStore } from '../graph/store.js';
7
8
  import { bindingFor } from './domain.hook.js';
8
9
  const QUERY_REFRESH = Symbol('shell-react.query-refresh');
10
+ const queryRefreshIdentities = new WeakMap();
11
+ let nextQueryRefreshIdentity = 0;
9
12
  /** Pair one exact named Query definition with its admitted input for targeted invalidation. */
10
13
  export function queryRefresh(definition, input) {
14
+ const id = queryRefreshIdentity(definition);
11
15
  return Object.freeze({
12
- id: definition.id,
13
- [QUERY_REFRESH]: () => {
14
- const prepared = definition.prepare?.(input) ?? input;
15
- return Object.freeze({ ast: definition.build(prepared), page: definition.page });
16
+ id,
17
+ [QUERY_REFRESH]: (domain) => {
18
+ const realized = realizeQuery(definition, domain);
19
+ if (realized.kind !== 'single') {
20
+ throw new TypeError('Targeted refresh requires a single Query recipe.');
21
+ }
22
+ const prepared = realized.prepare?.(input) ?? input;
23
+ return Object.freeze({ ast: realized.build(prepared), page: realized.page });
16
24
  },
17
25
  });
18
26
  }
@@ -40,7 +48,7 @@ export function useAction(callable, options = {}) {
40
48
  store.invalidate();
41
49
  else if (refresh !== 'none') {
42
50
  refresh.queries.forEach((query) => {
43
- const target = query[QUERY_REFRESH]();
51
+ const target = query[QUERY_REFRESH](bindingRef.current.domain);
44
52
  store.invalidate(target.ast, { page: target.page });
45
53
  });
46
54
  }
@@ -75,3 +83,11 @@ function isInstanceMethod(callable) {
75
83
  function receiverPath(receiver) {
76
84
  return Path.id(receiver.id);
77
85
  }
86
+ function queryRefreshIdentity(definition) {
87
+ const current = queryRefreshIdentities.get(definition);
88
+ if (current !== undefined)
89
+ return current;
90
+ const created = `query-${++nextQueryRefreshIdentity}`;
91
+ queryRefreshIdentities.set(definition, created);
92
+ return created;
93
+ }
@@ -0,0 +1,10 @@
1
+ import type { Domain } from '@astrale-os/sdk/schema';
2
+ import type { schema } from '@astrale-os/sdk/schema';
3
+ import type { ReactElement, ReactNode } from 'react';
4
+ export interface DomainProviderProps<Schema extends schema.DomainSchema> {
5
+ readonly schema: Schema;
6
+ readonly children: ReactNode;
7
+ }
8
+ /** Resolve one exact installed Domain for every projected recipe in the React subtree. */
9
+ export declare function DomainProvider<const Schema extends schema.DomainSchema>(props: DomainProviderProps<Schema>): ReactElement;
10
+ export declare function useExecutionDomain<DomainValue extends Domain>(): DomainValue;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext } from 'react';
3
+ import { useDomain } from './domain.hook.js';
4
+ const DomainContext = createContext(null);
5
+ DomainContext.displayName = 'AstraleDomainContext';
6
+ /** Resolve one exact installed Domain for every projected recipe in the React subtree. */
7
+ export function DomainProvider(props) {
8
+ const binding = useDomain(props.schema);
9
+ return _jsx(DomainContext.Provider, { value: binding.domain, children: props.children });
10
+ }
11
+ export function useExecutionDomain() {
12
+ const domain = useContext(DomainContext);
13
+ if (domain === null) {
14
+ throw new Error('Projected Query and Mutation hooks require a surrounding DomainProvider.');
15
+ }
16
+ return domain;
17
+ }
@@ -12,4 +12,3 @@ export declare function useDomains<const Schemas extends Readonly<Record<string,
12
12
  readonly [Name in keyof Schemas]: DomainBinding<Schemas[Name]>;
13
13
  };
14
14
  export declare function bindingFor(value: object): DomainBinding;
15
- //# sourceMappingURL=domain.hook.d.ts.map
@@ -1,5 +1,7 @@
1
1
  export { useKernel } from './kernel.hook.js';
2
2
  export { useDomain, useDomains, useDynamicDomain } from './domain.hook.js';
3
+ export { DomainProvider } from './domain.context.js';
4
+ export type { DomainProviderProps } from './domain.context.js';
3
5
  export { queryRefresh, useAction } from './action.hook.js';
4
6
  export type { ActionOptions, ActionRefresh, DomainAction, QueryRefresh } from './action.hook.js';
5
7
  export { useMutation } from './mutation.hook.js';
@@ -8,4 +10,3 @@ export { useDynamicObject, useObject } from './object.hook.js';
8
10
  export type { RichReadOptions } from './object.hook.js';
9
11
  export { RelationUnavailableError, useRelation } from './relation.hook.js';
10
12
  export type { RelationOptions, RelationResource, RelationUnavailable } from './relation.hook.js';
11
- //# sourceMappingURL=index.d.ts.map