@astrale-os/kernel-client 0.6.0-beta.51 → 0.6.0-beta.53

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.
@@ -1,13 +1,14 @@
1
- import type { Identity, Authentication, IdentityId, MintedCredential, ProvisionRequest, ProvisionResult } from '@astrale-os/kernel-core/auth';
1
+ import type { Identity, Authentication, IdentityId, MintedCredential, RegisterResult } 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';
5
5
  import type { PolicyDecisionInput } from './authorization.js';
6
6
  import type { DelegateOptions, MintOptions } from './credential.js';
7
7
  import type { WhoisInput } from './identity.js';
8
+ import type { RegisterRequest } from './register.js';
8
9
  export type AuthCall = (target: PathLike, input: Input, options?: RequestOptions) => Promise<Input>;
9
10
  export interface AuthApi {
10
- provision(input: ProvisionRequest, options?: RequestOptions): Promise<ProvisionResult>;
11
+ register(input: RegisterRequest, options?: RequestOptions): Promise<RegisterResult>;
11
12
  whoami(options?: RequestOptions): Promise<Identity & Authentication>;
12
13
  whois(input: WhoisInput, options?: RequestOptions): Promise<(Identity & Authentication) | null>;
13
14
  can(input: PolicyDecisionInput, options?: RequestOptions): Promise<boolean>;
package/dist/auth/auth.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { authorizationApi } from './authorization.js';
2
2
  import { credentialApi } from './credential.js';
3
3
  import { identityApi } from './identity.js';
4
- import { provisionApi } from './provision.js';
4
+ import { registerApi } from './register.js';
5
5
  /** Bind the current Core identity syscalls without recreating legacy grant-edge verbs. */
6
6
  export function createAuth(call) {
7
7
  if (typeof call !== 'function')
8
8
  throw new TypeError('Auth call capability is invalid.');
9
9
  return Object.freeze({
10
- ...provisionApi(call),
10
+ ...registerApi(call),
11
11
  ...identityApi(call),
12
12
  ...authorizationApi(call),
13
13
  ...credentialApi(call),
@@ -2,5 +2,5 @@ export { createAuth, type AuthApi, type AuthCall } from './auth.js';
2
2
  export { IDENTITY_CAN_PATH, type PolicyDecisionInput } from './authorization.js';
3
3
  export { IDENTITY_MINT_PATH, type DelegateOptions, type MintOptions } from './credential.js';
4
4
  export { IDENTITY_WHOAMI_PATH, IDENTITY_WHOIS_PATH, type WhoisInput } from './identity.js';
5
- export { IDENTITY_PROVISION_PATH } from './provision.js';
6
- export type { Identity, IdentityId, Subject, IssuerId, MintedCredential, ProvisionRequest, ProvisionResult, UnresolvedGrant, UnresolvedIdentityExpr, } from '@astrale-os/kernel-core/auth';
5
+ export { IDENTITY_REGISTER_PATH, type RegisterIdentity, type RegisterRequest } from './register.js';
6
+ export type { Identity, IdentityId, Subject, IssuerId, MintedCredential, RegisterResult, UnresolvedGrant, UnresolvedIdentityExpr, } from '@astrale-os/kernel-core/auth';
@@ -2,4 +2,4 @@ export { createAuth } from './auth.js';
2
2
  export { IDENTITY_CAN_PATH } from './authorization.js';
3
3
  export { IDENTITY_MINT_PATH } from './credential.js';
4
4
  export { IDENTITY_WHOAMI_PATH, IDENTITY_WHOIS_PATH } from './identity.js';
5
- export { IDENTITY_PROVISION_PATH } from './provision.js';
5
+ export { IDENTITY_REGISTER_PATH } from './register.js';
@@ -0,0 +1,24 @@
1
+ import type { IdentityId, JsonWebKey, RegisterResult } from '@astrale-os/kernel-core/auth';
2
+ import type { NodePath } from '@astrale-os/kernel-core/path';
3
+ import type { RequestOptions } from '../transport/index.js';
4
+ import type { AuthCall } from './auth.js';
5
+ export declare const IDENTITY_REGISTER_PATH: NodePath;
6
+ export type RegisterIdentity = {
7
+ readonly id: IdentityId;
8
+ readonly mode: 'external';
9
+ readonly credential: string;
10
+ readonly publicKey?: never;
11
+ } | {
12
+ readonly id: IdentityId;
13
+ readonly mode: 'self';
14
+ readonly publicKey: JsonWebKey;
15
+ readonly credential: string;
16
+ };
17
+ /** JSON-safe client request; binary credential inputs remain Runtime-internal. */
18
+ export interface RegisterRequest {
19
+ readonly idempotencyKey: string;
20
+ readonly identities: readonly [RegisterIdentity, ...RegisterIdentity[]];
21
+ }
22
+ export declare function registerApi(call: AuthCall): Readonly<{
23
+ register(input: RegisterRequest, options?: RequestOptions): Promise<RegisterResult>;
24
+ }>;
@@ -0,0 +1,10 @@
1
+ import { Path } from '@astrale-os/kernel-core/path';
2
+ import { register } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
3
+ export const IDENTITY_REGISTER_PATH = Path.project(register).raw;
4
+ export function registerApi(call) {
5
+ return Object.freeze({
6
+ async register(input, options) {
7
+ return (await call(IDENTITY_REGISTER_PATH, input, options));
8
+ },
9
+ });
10
+ }
@@ -13,6 +13,7 @@ export interface GraphQueryOptions extends RequestOptions {
13
13
  readonly expected?: readonly DomainDependency[];
14
14
  readonly page: QueryPageRequest;
15
15
  }
16
+ /** idempotencyKey selects a durable principal-scoped Kernel receipt, not an invocation cache entry. */
16
17
  export interface GraphMutationOptions extends RequestOptions {
17
18
  readonly expected?: readonly DomainDependency[];
18
19
  }
@@ -7,13 +7,15 @@ const KERNEL_MUTATE_PATH = Path.project(mutate).raw;
7
7
  export async function mutateGraph(call, input, options) {
8
8
  const ast = typeof input === 'function' ? MutationAST.build(input) : admitMutation(input);
9
9
  const expected = options?.expected;
10
+ const idempotencyKey = options?.idempotencyKey;
10
11
  const request = options === undefined
11
12
  ? undefined
12
- : (({ expected: _expected, ...rest }) => rest)(options);
13
+ : (({ expected: _expected, idempotencyKey: _key, ...rest }) => rest)(options);
13
14
  const capturedExpected = captureExpected(expected);
14
15
  const output = await call(invocation(KERNEL_MUTATE_PATH, Object.freeze({
15
16
  ast,
16
17
  ...(capturedExpected === undefined ? {} : { expected: capturedExpected }),
18
+ ...(idempotencyKey === undefined ? {} : { idempotencyKey }),
17
19
  })), request);
18
20
  return MutationResult.decode(output);
19
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-client",
3
- "version": "0.6.0-beta.51",
3
+ "version": "0.6.0-beta.53",
4
4
  "description": "Universal Client — protocol-first, transport-agnostic",
5
5
  "keywords": [
6
6
  "astrale",
@@ -65,14 +65,14 @@
65
65
  "access": "public"
66
66
  },
67
67
  "dependencies": {
68
- "@astrale-os/kernel-core": "0.9.0-beta.39",
68
+ "@astrale-os/kernel-core": "0.9.0-beta.41",
69
69
  "@astrale-os/kernel-dsl": "0.2.0-beta.30",
70
- "@astrale-os/kernel-protocol": "0.5.0-beta.42",
70
+ "@astrale-os/kernel-protocol": "0.5.0-beta.44",
71
71
  "@tanstack/pacer": "0.20.1",
72
72
  "msgpackr": "^2.0.5"
73
73
  },
74
74
  "devDependencies": {
75
- "@astrale-os/kernel-server": "0.5.0-beta.44",
75
+ "@astrale-os/kernel-server": "0.5.0-beta.46",
76
76
  "@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
77
77
  "@types/node": "^22.0.0",
78
78
  "typescript": "7.0.2",
@@ -1,8 +0,0 @@
1
- import type { ProvisionRequest, ProvisionResult } from '@astrale-os/kernel-core/auth';
2
- import type { NodePath } from '@astrale-os/kernel-core/path';
3
- import type { RequestOptions } from '../transport/index.js';
4
- import type { AuthCall } from './auth.js';
5
- export declare const IDENTITY_PROVISION_PATH: NodePath;
6
- export declare function provisionApi(call: AuthCall): Readonly<{
7
- provision(input: ProvisionRequest, options?: RequestOptions): Promise<ProvisionResult>;
8
- }>;
@@ -1,10 +0,0 @@
1
- import { Path } from '@astrale-os/kernel-core/path';
2
- import { provision } from '@astrale-os/kernel-core/schema/kernel/syscalls/references';
3
- export const IDENTITY_PROVISION_PATH = Path.project(provision).raw;
4
- export function provisionApi(call) {
5
- return Object.freeze({
6
- async provision(input, options) {
7
- return (await call(IDENTITY_PROVISION_PATH, input, options));
8
- },
9
- });
10
- }