@astrale-os/kernel-client 0.6.0-beta.22 → 0.6.0-beta.23
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/auth/auth.d.ts +3 -3
- package/dist/auth/identity.d.ts +6 -8
- package/dist/session/bound.d.ts +5 -1
- package/dist/session/bound.js +17 -0
- package/package.json +4 -4
package/dist/auth/auth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Identity, IdentityId, MintedCredential, ProvisionRequest, ProvisionResult } from '@astrale-os/kernel-core/auth';
|
|
1
|
+
import type { Identity, Authentication, IdentityId, MintedCredential, ProvisionRequest, ProvisionResult } from '@astrale-os/kernel-core/auth';
|
|
2
2
|
import type { PathLike } from '@astrale-os/kernel-core/path';
|
|
3
3
|
import type { Input } from '../client/index.js';
|
|
4
4
|
import type { RequestOptions } from '../transport/index.js';
|
|
@@ -8,8 +8,8 @@ import type { WhoisInput } from './identity.js';
|
|
|
8
8
|
export type AuthCall = (target: PathLike, input: Input, options?: RequestOptions) => Promise<Input>;
|
|
9
9
|
export interface AuthApi {
|
|
10
10
|
provision(input: ProvisionRequest, options?: RequestOptions): Promise<ProvisionResult>;
|
|
11
|
-
whoami(options?: RequestOptions): Promise<Identity>;
|
|
12
|
-
whois(input: WhoisInput, options?: RequestOptions): Promise<Identity | null>;
|
|
11
|
+
whoami(options?: RequestOptions): Promise<Identity & Authentication>;
|
|
12
|
+
whois(input: WhoisInput, options?: RequestOptions): Promise<(Identity & Authentication) | null>;
|
|
13
13
|
can(input: PolicyDecisionInput, options?: RequestOptions): Promise<boolean>;
|
|
14
14
|
mint(input: MintOptions, options?: RequestOptions): Promise<MintedCredential>;
|
|
15
15
|
delegate(identity: IdentityId, input: DelegateOptions, options?: RequestOptions): Promise<MintedCredential>;
|
package/dist/auth/identity.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Authentication, Identity } from '@astrale-os/kernel-core/auth';
|
|
2
2
|
import type { NodePath } from '@astrale-os/kernel-core/path';
|
|
3
3
|
import type { RequestOptions } from '../transport/index.js';
|
|
4
4
|
import type { AuthCall } from './auth.js';
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export type WhoisInput = Authentication;
|
|
6
|
+
export interface IdentityApi {
|
|
7
|
+
whoami(options?: RequestOptions): Promise<Identity & Authentication>;
|
|
8
|
+
whois(input: WhoisInput, options?: RequestOptions): Promise<(Identity & Authentication) | null>;
|
|
8
9
|
}
|
|
9
10
|
export declare const IDENTITY_WHOAMI_PATH: NodePath;
|
|
10
11
|
export declare const IDENTITY_WHOIS_PATH: NodePath;
|
|
11
|
-
export declare function identityApi(call: AuthCall):
|
|
12
|
-
whoami(options?: RequestOptions): Promise<Identity>;
|
|
13
|
-
whois(input: WhoisInput, options?: RequestOptions): Promise<Identity | null>;
|
|
14
|
-
}>;
|
|
12
|
+
export declare function identityApi(call: AuthCall): IdentityApi;
|
package/dist/session/bound.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { IssuerId } from '@astrale-os/kernel-core/auth';
|
|
2
|
+
import type { SchemaApi } from '../schema/index.js';
|
|
2
3
|
import type { SessionControlOptions } from './context/index.js';
|
|
3
4
|
import type { CallableReference, InputOfReference, OutputOfReference } from './reference.js';
|
|
4
5
|
import type { SessionRequestOptions } from './routing/index.js';
|
|
6
|
+
import type { ClientSession } from './session.js';
|
|
5
7
|
import type { ViewCatalog } from './views/index.js';
|
|
6
8
|
import { type AuthApi } from '../auth/index.js';
|
|
7
9
|
import { type Binary, type Call, type Input, type Result, type Stream } from '../client/index.js';
|
|
@@ -9,12 +11,13 @@ import { type GraphApi } from '../graph/index.js';
|
|
|
9
11
|
/** Exact live Session surface captured by one credential-bound Kernel view. */
|
|
10
12
|
export interface BoundSessionSource {
|
|
11
13
|
readonly kernel: IssuerId;
|
|
14
|
+
readonly schema: SchemaApi;
|
|
12
15
|
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
13
16
|
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
14
17
|
invoke<const Reference extends CallableReference>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
|
15
18
|
stream(call: Call, options?: SessionRequestOptions): Promise<Stream>;
|
|
16
19
|
binary(call: Call, options?: SessionRequestOptions): Promise<Binary>;
|
|
17
|
-
viewsFor(target: Parameters<
|
|
20
|
+
viewsFor(target: Parameters<ClientSession['viewsFor']>[0], options?: SessionControlOptions): Promise<ViewCatalog>;
|
|
18
21
|
}
|
|
19
22
|
export interface BoundSessionControls {
|
|
20
23
|
readonly signal: AbortSignal;
|
|
@@ -30,6 +33,7 @@ export interface BoundSessionControls {
|
|
|
30
33
|
export interface BoundClientSession extends GraphApi {
|
|
31
34
|
readonly kernel: IssuerId;
|
|
32
35
|
readonly auth: AuthApi;
|
|
36
|
+
readonly schema: SchemaApi;
|
|
33
37
|
dispatch(call: Call, options?: SessionRequestOptions): Promise<Result>;
|
|
34
38
|
call(call: Call, options?: SessionRequestOptions): Promise<Input>;
|
|
35
39
|
invoke<const Reference extends CallableReference>(reference: Reference, input: InputOfReference<Reference>, options?: SessionRequestOptions): Promise<OutputOfReference<Reference>>;
|
package/dist/session/bound.js
CHANGED
|
@@ -12,18 +12,25 @@ export function bindSession(source, controls) {
|
|
|
12
12
|
const streamSource = capture(source, 'stream');
|
|
13
13
|
const binarySource = capture(source, 'binary');
|
|
14
14
|
const viewsForSource = capture(source, 'viewsFor');
|
|
15
|
+
const schemaSource = captureSchema(source.schema);
|
|
15
16
|
const dispatch = (input, options) => dispatchSource(input, requestOptions(options, admittedControls));
|
|
16
17
|
const call = (input, options) => callSource(input, requestOptions(options, admittedControls));
|
|
17
18
|
const invoke = (reference, input, options) => invokeSource(reference, input, requestOptions(options, admittedControls));
|
|
18
19
|
const stream = (input, options) => streamSource(input, requestOptions(options, admittedControls));
|
|
19
20
|
const binary = (input, options) => binarySource(input, requestOptions(options, admittedControls));
|
|
20
21
|
const viewsFor = (target, options) => viewsForSource(target, controlOptions(options, admittedControls));
|
|
22
|
+
const install = (request, options) => schemaSource.install(request, controlOptions(options, admittedControls));
|
|
23
|
+
const uninstall = (request, options) => schemaSource.uninstall(request, controlOptions(options, admittedControls));
|
|
24
|
+
const inspect = (origin, options) => schemaSource.inspect(origin, controlOptions(options, admittedControls));
|
|
25
|
+
const bundle = (origin, options) => schemaSource.bundle(origin, controlOptions(options, admittedControls));
|
|
26
|
+
const schema = Object.freeze({ install, uninstall, inspect, bundle });
|
|
21
27
|
const graph = createGraph(call);
|
|
22
28
|
const auth = createAuth((target, input, options) => call(createCall(target, input), options));
|
|
23
29
|
return Object.freeze({
|
|
24
30
|
...graph,
|
|
25
31
|
kernel: source.kernel,
|
|
26
32
|
auth,
|
|
33
|
+
schema,
|
|
27
34
|
dispatch,
|
|
28
35
|
call,
|
|
29
36
|
invoke,
|
|
@@ -67,6 +74,16 @@ function capture(source, key) {
|
|
|
67
74
|
invalid();
|
|
68
75
|
return value.bind(source);
|
|
69
76
|
}
|
|
77
|
+
function captureSchema(input) {
|
|
78
|
+
if (input === null || typeof input !== 'object')
|
|
79
|
+
invalid();
|
|
80
|
+
return Object.freeze({
|
|
81
|
+
install: capture(input, 'install'),
|
|
82
|
+
uninstall: capture(input, 'uninstall'),
|
|
83
|
+
inspect: capture(input, 'inspect'),
|
|
84
|
+
bundle: capture(input, 'bundle'),
|
|
85
|
+
});
|
|
86
|
+
}
|
|
70
87
|
function invalid() {
|
|
71
88
|
throw new TypeError('Bound ClientSession source is invalid.');
|
|
72
89
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-client",
|
|
3
|
-
"version": "0.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.23",
|
|
4
4
|
"description": "Universal Client — protocol-first, transport-agnostic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -67,16 +67,16 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@tanstack/pacer": "0.20.1",
|
|
69
69
|
"msgpackr": "^2.0.5",
|
|
70
|
-
"@astrale-os/kernel-core": "0.9.0-beta.17",
|
|
71
70
|
"@astrale-os/kernel-dsl": "0.2.0-beta.14",
|
|
72
|
-
"@astrale-os/kernel-
|
|
71
|
+
"@astrale-os/kernel-core": "0.9.0-beta.18",
|
|
72
|
+
"@astrale-os/kernel-protocol": "0.5.0-beta.18"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
76
76
|
"@types/node": "^22.0.0",
|
|
77
77
|
"typescript": "7.0.2",
|
|
78
78
|
"vitest": "^4.1.10",
|
|
79
|
-
"@astrale-os/kernel-server": "0.5.0-beta.
|
|
79
|
+
"@astrale-os/kernel-server": "0.5.0-beta.19"
|
|
80
80
|
},
|
|
81
81
|
"scripts": {
|
|
82
82
|
"build": "tsc",
|