@astrale-os/shell-react 0.3.2-beta.9 → 0.4.0-beta.11
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/CHANGELOG.md +25 -0
- package/dist/index.d.ts +1 -1
- package/dist/schema/action.hook.d.ts +7 -4
- package/dist/schema/index.d.ts +1 -0
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/schema/action.hook.ts +11 -7
- package/src/schema/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.0-beta.11](https://github.com/astrale-os/shell/compare/shell-react-v0.4.0-beta.10...shell-react-v0.4.0-beta.11) (2026-09-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **react:** allow id-only action receivers ([#167](https://github.com/astrale-os/shell/issues/167)) ([7f75975](https://github.com/astrale-os/shell/commit/7f759753864033e9593bb70080fa8b8c5a5157c0))
|
|
9
|
+
|
|
10
|
+
## [0.4.0-beta.10](https://github.com/astrale-os/shell/compare/shell-react-v0.4.0-beta.9...shell-react-v0.4.0-beta.10) (2026-09-01)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **runtime:** admit current Shell prerelease producer ([#160](https://github.com/astrale-os/shell/issues/160)) ([eb4699b](https://github.com/astrale-os/shell/commit/eb4699b891ca1a0561cd841be5e12193cff2a342))
|
|
16
|
+
|
|
17
|
+
## [0.4.0-beta.9](https://github.com/astrale-os/shell/compare/shell-react-v0.3.2-beta.9...shell-react-v0.4.0-beta.9) (2026-09-01)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### ⚠ BREAKING CHANGES
|
|
21
|
+
|
|
22
|
+
* adopt unified Domain functions layer ([#157](https://github.com/astrale-os/shell/issues/157))
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* adopt unified Domain functions layer ([#157](https://github.com/astrale-os/shell/issues/157)) ([ae73910](https://github.com/astrale-os/shell/commit/ae739107da4b3827ff06f09a1bf86958135a2a5a))
|
|
27
|
+
|
|
3
28
|
## [0.3.2-beta.9](https://github.com/astrale-os/shell/compare/shell-react-v0.3.2-beta.8...shell-react-v0.3.2-beta.9) (2026-08-31)
|
|
4
29
|
|
|
5
30
|
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ 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
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';
|
|
9
|
+
export type { ActionReceiver, 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';
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type { BoundNodeFor } from '@astrale-os/sdk/client';
|
|
2
1
|
import type { SessionRequestOptions } from '@astrale-os/sdk/client/session';
|
|
2
|
+
import type { NodeId } from '@astrale-os/sdk/graph/node';
|
|
3
3
|
import type { QueryAST, QueryDefinition } from '@astrale-os/sdk/query';
|
|
4
4
|
import type { Domain } from '@astrale-os/sdk/schema';
|
|
5
|
-
import type { CallableInputOf, CallableResultOf,
|
|
5
|
+
import type { CallableInputOf, CallableResultOf, MethodInheritance, ResolvedFunction, ResolvedMethod } from '@astrale-os/sdk/schema';
|
|
6
6
|
type ExecutableInheritance = Exclude<MethodInheritance, 'abstract'>;
|
|
7
7
|
type InstanceMethod = ResolvedMethod<unknown, unknown, false, ExecutableInheritance>;
|
|
8
8
|
type StaticMethod = ResolvedMethod<unknown, unknown, true, ExecutableInheritance>;
|
|
9
9
|
type Callable = ResolvedFunction | InstanceMethod | StaticMethod;
|
|
10
|
-
|
|
10
|
+
/** Stable identity of an instance Method receiver; the Kernel resolves and authorizes its Class. */
|
|
11
|
+
export interface ActionReceiver {
|
|
12
|
+
readonly id: NodeId;
|
|
13
|
+
}
|
|
11
14
|
declare const QUERY_REFRESH: unique symbol;
|
|
12
15
|
export interface QueryRefresh {
|
|
13
16
|
readonly id: string;
|
|
@@ -27,7 +30,7 @@ export interface ActionOptions extends SessionRequestOptions {
|
|
|
27
30
|
readonly refresh?: ActionRefresh;
|
|
28
31
|
readonly onError?: (error: unknown) => void;
|
|
29
32
|
}
|
|
30
|
-
type ActionArgs<C extends Callable> = C extends InstanceMethod ? [receiver:
|
|
33
|
+
type ActionArgs<C extends Callable> = C extends InstanceMethod ? [receiver: ActionReceiver, input: CallableInputOf<C>] : [input: CallableInputOf<C>];
|
|
31
34
|
export interface DomainAction<Args extends unknown[], Result> {
|
|
32
35
|
run(...args: Args): Promise<Result>;
|
|
33
36
|
readonly pending: boolean;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { useDomain, useDomains, useDynamicDomain } from './domain.hook.js';
|
|
|
3
3
|
export { DomainProvider } from './domain.context.js';
|
|
4
4
|
export type { DomainProviderProps } from './domain.context.js';
|
|
5
5
|
export { queryRefresh, useAction } from './action.hook.js';
|
|
6
|
+
export type { ActionReceiver } from './action.hook.js';
|
|
6
7
|
export type { ActionOptions, ActionRefresh, DomainAction, QueryRefresh } from './action.hook.js';
|
|
7
8
|
export { useMutation } from './mutation.hook.js';
|
|
8
9
|
export type { MutationOptions } from './mutation.hook.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/shell-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-beta.11",
|
|
4
4
|
"description": "Astrale shell-react — the React face of the shell (provider, hooks, view components)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"registry": "https://registry.npmjs.org"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@astrale-os/shell": ">=0.
|
|
29
|
+
"@astrale-os/shell": ">=0.5.0-beta.11 <1.0.0",
|
|
30
30
|
"jose": "^6.2.8",
|
|
31
31
|
"zod": "4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@astrale-os/sdk": "0.5.0-beta.
|
|
34
|
+
"@astrale-os/sdk": "0.5.0-beta.101",
|
|
35
35
|
"@testing-library/dom": "^10.4.0",
|
|
36
36
|
"@testing-library/react": "^16.3.0",
|
|
37
37
|
"@types/node": "^26.2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"vitest": "4.1.10"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@astrale-os/sdk": ">=0.5.0-beta.
|
|
49
|
+
"@astrale-os/sdk": ">=0.5.0-beta.101 <1.0.0",
|
|
50
50
|
"react": ">=18",
|
|
51
51
|
"react-dom": ">=18"
|
|
52
52
|
},
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { BoundNodeFor } from '@astrale-os/sdk/client'
|
|
2
1
|
import type { SessionRequestOptions } from '@astrale-os/sdk/client/session'
|
|
3
2
|
import type { NodeId } from '@astrale-os/sdk/graph/node'
|
|
4
3
|
import type { QueryAST, QueryDefinition } from '@astrale-os/sdk/query'
|
|
@@ -6,7 +5,6 @@ import type { Domain } from '@astrale-os/sdk/schema'
|
|
|
6
5
|
import type {
|
|
7
6
|
CallableInputOf,
|
|
8
7
|
CallableResultOf,
|
|
9
|
-
MethodOwnerKeyOf,
|
|
10
8
|
MethodInheritance,
|
|
11
9
|
ResolvedFunction,
|
|
12
10
|
ResolvedMethod,
|
|
@@ -28,8 +26,11 @@ type ExecutableInheritance = Exclude<MethodInheritance, 'abstract'>
|
|
|
28
26
|
type InstanceMethod = ResolvedMethod<unknown, unknown, false, ExecutableInheritance>
|
|
29
27
|
type StaticMethod = ResolvedMethod<unknown, unknown, true, ExecutableInheritance>
|
|
30
28
|
type Callable = ResolvedFunction | InstanceMethod | StaticMethod
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
|
|
30
|
+
/** Stable identity of an instance Method receiver; the Kernel resolves and authorizes its Class. */
|
|
31
|
+
export interface ActionReceiver {
|
|
32
|
+
readonly id: NodeId
|
|
33
|
+
}
|
|
33
34
|
|
|
34
35
|
const QUERY_REFRESH = Symbol('shell-react.query-refresh')
|
|
35
36
|
|
|
@@ -76,7 +77,7 @@ export interface ActionOptions extends SessionRequestOptions {
|
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
type ActionArgs<C extends Callable> = C extends InstanceMethod
|
|
79
|
-
? [receiver:
|
|
80
|
+
? [receiver: ActionReceiver, input: CallableInputOf<C>]
|
|
80
81
|
: [input: CallableInputOf<C>]
|
|
81
82
|
|
|
82
83
|
export interface DomainAction<Args extends unknown[], Result> {
|
|
@@ -110,7 +111,10 @@ export function useAction<C extends Callable>(
|
|
|
110
111
|
try {
|
|
111
112
|
const result = isInstanceMethod(current)
|
|
112
113
|
? await kernel.session.invoke(
|
|
113
|
-
reference(
|
|
114
|
+
reference(
|
|
115
|
+
bindingRef.current.domain,
|
|
116
|
+
current,
|
|
117
|
+
)(receiverPath(args[0] as ActionReceiver)),
|
|
114
118
|
args[1] as never,
|
|
115
119
|
request,
|
|
116
120
|
)
|
|
@@ -161,7 +165,7 @@ function isInstanceMethod(callable: Callable): callable is InstanceMethod {
|
|
|
161
165
|
return 'owner' in callable && callable.static === false
|
|
162
166
|
}
|
|
163
167
|
|
|
164
|
-
function receiverPath(receiver:
|
|
168
|
+
function receiverPath(receiver: ActionReceiver): Path {
|
|
165
169
|
return Path.id(receiver.id)
|
|
166
170
|
}
|
|
167
171
|
|
package/src/schema/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { useDomain, useDomains, useDynamicDomain } from './domain.hook.js'
|
|
|
3
3
|
export { DomainProvider } from './domain.context.js'
|
|
4
4
|
export type { DomainProviderProps } from './domain.context.js'
|
|
5
5
|
export { queryRefresh, useAction } from './action.hook.js'
|
|
6
|
+
export type { ActionReceiver } from './action.hook.js'
|
|
6
7
|
export type { ActionOptions, ActionRefresh, DomainAction, QueryRefresh } from './action.hook.js'
|
|
7
8
|
export { useMutation } from './mutation.hook.js'
|
|
8
9
|
export type { MutationOptions } from './mutation.hook.js'
|