@astrale-os/kernel-core 0.9.0-beta.35 → 0.9.0-beta.37
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/authority/normalization/normalize.js +2 -1
- package/dist/graph/mutate/authoring/create.js +13 -5
- package/dist/graph/path/authoring/path.d.ts +6 -4
- package/dist/graph/path/authoring/path.js +14 -1
- package/dist/graph/query/authoring/builder.js +8 -3
- package/dist/schema/kernel/schema.d.ts +38 -38
- package/package.json +2 -2
|
@@ -89,7 +89,8 @@ function normalizeBoolean(op, input, path, locals, subjectBound) {
|
|
|
89
89
|
for (const expr of flattened) {
|
|
90
90
|
if (expr.op === identity)
|
|
91
91
|
continue;
|
|
92
|
-
|
|
92
|
+
// Admission and normalization own these detached subtrees; sorting does not lose that proof.
|
|
93
|
+
unique.set(portable.json.serializeAdmitted(expr), expr);
|
|
93
94
|
}
|
|
94
95
|
const predicates = [...unique.entries()]
|
|
95
96
|
.sort(([left], [right]) => compare(left, right))
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Path } from '../../path/index.js';
|
|
1
|
+
import { Path, PathError } from '../../path/index.js';
|
|
3
2
|
import { MutationLanguage } from '../language/index.js';
|
|
4
3
|
/** Lower rich TypeScript inputs into the one canonical public MutationAST representation. */
|
|
5
4
|
export function createMutationAST(input) {
|
|
@@ -69,6 +68,9 @@ function lowerOperation(operation) {
|
|
|
69
68
|
}
|
|
70
69
|
}
|
|
71
70
|
function lowerEndpoint(endpoint) {
|
|
71
|
+
if (typeof endpoint === 'object' && endpoint !== null && 'kind' in endpoint) {
|
|
72
|
+
return nodeTargetText(endpoint);
|
|
73
|
+
}
|
|
72
74
|
return typeof endpoint === 'object' && endpoint !== null && 'created' in endpoint
|
|
73
75
|
? endpoint
|
|
74
76
|
: nodeTargetText(endpoint);
|
|
@@ -84,9 +86,15 @@ function pathText(path) {
|
|
|
84
86
|
return nodeTargetText(path);
|
|
85
87
|
}
|
|
86
88
|
function nodeTargetText(target) {
|
|
87
|
-
|
|
88
|
-
return target.raw;
|
|
89
|
-
|
|
89
|
+
try {
|
|
90
|
+
return Path.target(target).raw;
|
|
91
|
+
}
|
|
92
|
+
catch (cause) {
|
|
93
|
+
// The Mutation codec owns invalid-input errors and their operation/precondition coordinates.
|
|
94
|
+
if (cause instanceof PathError)
|
|
95
|
+
return target;
|
|
96
|
+
throw cause;
|
|
97
|
+
}
|
|
90
98
|
}
|
|
91
99
|
function mutationProps(input) {
|
|
92
100
|
return input;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DefinitionRef, Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
2
|
import { type ClassKey as ClassKeyValue } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
3
|
import type { NodeId } from '../../node/identity/index.js';
|
|
4
4
|
import type { DomainAnchor as PathDomainAnchor, DomainProjection as PathDomainProjection, IdAnchor as PathIdAnchor, MethodStep as PathMethodStep, NodePath, PathAST, PathAnchor, PathDiagnostic, PathDiagnosticCode, PathStep, ProjectionKind as PathProjectionKind, ProjectionStep as PathProjectionStep, TraversalStep as PathTraversalStep } from '../language/index.js';
|
|
@@ -11,6 +11,8 @@ export declare class Path {
|
|
|
11
11
|
private constructor();
|
|
12
12
|
/** Retain an admitted rich Path or parse its canonical serialized form. */
|
|
13
13
|
static from(input: PathLike): Path;
|
|
14
|
+
/** Normalize an exact graph target without resolving its installed Node identity. */
|
|
15
|
+
static target(input: NodeTarget): Path;
|
|
14
16
|
static parse(input: string): Path;
|
|
15
17
|
static fromAST(ast: Path.AST): Path;
|
|
16
18
|
static id(id: NodeId): Path.Id;
|
|
@@ -27,8 +29,8 @@ export declare class Path {
|
|
|
27
29
|
}
|
|
28
30
|
/** Rich or already-admitted serialized Path accepted at in-process authoring boundaries. */
|
|
29
31
|
export type PathLike = Path | NodePath;
|
|
30
|
-
/** Exact existing Node
|
|
31
|
-
export type NodeTarget = NodeId | PathLike;
|
|
32
|
+
/** Exact existing Node; DefinitionRefs address their projected graph nodes, not Class extents. */
|
|
33
|
+
export type NodeTarget = NodeId | PathLike | DefinitionRef;
|
|
32
34
|
/** Runtime-established proof that a Path addresses one callable Node. */
|
|
33
35
|
export type CallablePath = Path & {
|
|
34
36
|
readonly [CALLABLE_PATH]: true;
|
|
@@ -46,7 +48,7 @@ export declare namespace Path {
|
|
|
46
48
|
type ProjectionKind = PathProjectionKind;
|
|
47
49
|
type DomainProjection = PathDomainProjection;
|
|
48
50
|
/** Structured coordinate accepted for a graph-projected Definition or Core object. */
|
|
49
|
-
type ProjectionRef = DefinitionRef
|
|
51
|
+
type ProjectionRef = DefinitionRef;
|
|
50
52
|
interface TraversalOptions {
|
|
51
53
|
readonly slug?: EdgeSlugValue;
|
|
52
54
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ClassKey } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
1
|
+
import { ClassKey, isDefinitionRef, } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
2
|
import { EdgeSlug } from '../../edge/slug/index.js';
|
|
3
|
+
import { isNodeId } from '../../node/identity/index.js';
|
|
3
4
|
import { normalizePathAST, parsePathAST, pathError, serializePathAST } from '../language/index.js';
|
|
4
5
|
/** Immutable rich value for one admitted NodePath. */
|
|
5
6
|
export class Path {
|
|
@@ -10,6 +11,18 @@ export class Path {
|
|
|
10
11
|
static from(input) {
|
|
11
12
|
return input instanceof Path ? input : Path.parse(input);
|
|
12
13
|
}
|
|
14
|
+
/** Normalize an exact graph target without resolving its installed Node identity. */
|
|
15
|
+
static target(input) {
|
|
16
|
+
if (input instanceof Path)
|
|
17
|
+
return input;
|
|
18
|
+
if (isNodeId(input))
|
|
19
|
+
return Path.id(input);
|
|
20
|
+
if (typeof input === 'string')
|
|
21
|
+
return Path.parse(input);
|
|
22
|
+
if (isDefinitionRef(input))
|
|
23
|
+
return Path.project(input);
|
|
24
|
+
throw pathError(input, 'PATH_INVALID_PROJECTION', 'Node target requires an ID, Path, or DefinitionRef.');
|
|
25
|
+
}
|
|
13
26
|
static parse(input) {
|
|
14
27
|
return createPath(parsePathAST(input));
|
|
15
28
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ClassKey, PropertyKey, } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
2
|
import * as portable from '@astrale-os/kernel-dsl/value';
|
|
3
|
-
import { isNodeId } from '../../node/index.js';
|
|
4
3
|
import { Path } from '../../path/index.js';
|
|
5
4
|
import { QueryAST as QueryASTBoundary, QueryASTDecodeError } from '../language/index.js';
|
|
6
5
|
function from(input) {
|
|
@@ -373,9 +372,15 @@ function lowerNodeSource(input, index) {
|
|
|
373
372
|
if (ClassKey.is(input)) {
|
|
374
373
|
return Object.freeze({ kind: 'class', class: ClassKey.ref(input) });
|
|
375
374
|
}
|
|
376
|
-
if (input instanceof Path ||
|
|
375
|
+
if (input instanceof Path ||
|
|
376
|
+
typeof input === 'string' ||
|
|
377
|
+
(isRecord(input) &&
|
|
378
|
+
(input.kind === 'core' ||
|
|
379
|
+
input.kind === 'function' ||
|
|
380
|
+
input.kind === 'policy' ||
|
|
381
|
+
input.kind === 'view'))) {
|
|
377
382
|
try {
|
|
378
|
-
const target =
|
|
383
|
+
const target = Path.target(input);
|
|
379
384
|
return Object.freeze({ kind: 'path', path: target.raw });
|
|
380
385
|
}
|
|
381
386
|
catch (cause) {
|
|
@@ -5625,6 +5625,16 @@ export declare const AuthorityRelations: Readonly<{
|
|
|
5625
5625
|
}>;
|
|
5626
5626
|
/** Exact authorized Kernel Functions for which pristine Root receives direct can_use authority. */
|
|
5627
5627
|
export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5628
|
+
kind: "bundle" | "inspect";
|
|
5629
|
+
origin: string;
|
|
5630
|
+
}, {
|
|
5631
|
+
readonly mode: 'binary';
|
|
5632
|
+
}, "authenticated", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>> & {
|
|
5633
|
+
readonly ref: import("@astrale-os/kernel-dsl/v1").FunctionRef<"introspect"> & {
|
|
5634
|
+
readonly origin: "kernel.astrale.ai";
|
|
5635
|
+
};
|
|
5636
|
+
readonly key: "kernel.astrale.ai:function.introspect";
|
|
5637
|
+
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5628
5638
|
operation: string;
|
|
5629
5639
|
domains: ({
|
|
5630
5640
|
artifact: {
|
|
@@ -5649,16 +5659,6 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
|
|
|
5649
5659
|
readonly origin: "kernel.astrale.ai";
|
|
5650
5660
|
};
|
|
5651
5661
|
readonly key: "kernel.astrale.ai:function.install";
|
|
5652
|
-
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5653
|
-
kind: "bundle" | "inspect";
|
|
5654
|
-
origin: string;
|
|
5655
|
-
}, {
|
|
5656
|
-
readonly mode: 'binary';
|
|
5657
|
-
}, "authenticated", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>> & {
|
|
5658
|
-
readonly ref: import("@astrale-os/kernel-dsl/v1").FunctionRef<"introspect"> & {
|
|
5659
|
-
readonly origin: "kernel.astrale.ai";
|
|
5660
|
-
};
|
|
5661
|
-
readonly key: "kernel.astrale.ai:function.introspect";
|
|
5662
5662
|
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedFunction<{
|
|
5663
5663
|
invocation?: {
|
|
5664
5664
|
source: string;
|
|
@@ -6466,14 +6466,30 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
|
|
|
6466
6466
|
};
|
|
6467
6467
|
readonly key: "kernel.astrale.ai:function.uninstall";
|
|
6468
6468
|
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
grant?: unknown;
|
|
6469
|
+
iss: string;
|
|
6470
|
+
sub: string;
|
|
6472
6471
|
}, {
|
|
6473
6472
|
readonly mode: 'value';
|
|
6474
|
-
readonly value:
|
|
6475
|
-
|
|
6476
|
-
|
|
6473
|
+
readonly value: {
|
|
6474
|
+
id: string;
|
|
6475
|
+
iss: string;
|
|
6476
|
+
sub: string;
|
|
6477
|
+
frozen: boolean;
|
|
6478
|
+
requiredClaims: ({
|
|
6479
|
+
claim: string;
|
|
6480
|
+
op: "contains";
|
|
6481
|
+
value: unknown;
|
|
6482
|
+
} | {
|
|
6483
|
+
claim: string;
|
|
6484
|
+
op: "eq";
|
|
6485
|
+
value: unknown;
|
|
6486
|
+
} | {
|
|
6487
|
+
claim: string;
|
|
6488
|
+
op: "exists";
|
|
6489
|
+
})[];
|
|
6490
|
+
} | null;
|
|
6491
|
+
}, true, "default", "authorized", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>, "kernel.astrale.ai:class.Identity.method.whois"> & {
|
|
6492
|
+
readonly name: "whois";
|
|
6477
6493
|
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
|
|
6478
6494
|
target: string;
|
|
6479
6495
|
}, {
|
|
@@ -6509,30 +6525,14 @@ export declare const KernelRootFunctions: readonly ((import("@astrale-os/kernel-
|
|
|
6509
6525
|
}, true, "sealed", "authorized", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>, "kernel.astrale.ai:class.View.method.resolve"> & {
|
|
6510
6526
|
readonly name: "resolve";
|
|
6511
6527
|
}) | (import("@astrale-os/kernel-dsl/v1").ResolvedMethod<{
|
|
6512
|
-
|
|
6513
|
-
|
|
6528
|
+
audience?: string | undefined;
|
|
6529
|
+
ttlSeconds: number;
|
|
6530
|
+
grant?: unknown;
|
|
6514
6531
|
}, {
|
|
6515
6532
|
readonly mode: 'value';
|
|
6516
|
-
readonly value:
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
sub: string;
|
|
6520
|
-
frozen: boolean;
|
|
6521
|
-
requiredClaims: ({
|
|
6522
|
-
claim: string;
|
|
6523
|
-
op: "contains";
|
|
6524
|
-
value: unknown;
|
|
6525
|
-
} | {
|
|
6526
|
-
claim: string;
|
|
6527
|
-
op: "eq";
|
|
6528
|
-
value: unknown;
|
|
6529
|
-
} | {
|
|
6530
|
-
claim: string;
|
|
6531
|
-
op: "exists";
|
|
6532
|
-
})[];
|
|
6533
|
-
} | null;
|
|
6534
|
-
}, true, "default", "authorized", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>, "kernel.astrale.ai:class.Identity.method.whois"> & {
|
|
6535
|
-
readonly name: "whois";
|
|
6533
|
+
readonly value: string;
|
|
6534
|
+
}, true, "default", "authenticated", import("@astrale-os/kernel-dsl/v1").PolicyCheckExpression<import("@astrale-os/kernel-dsl/v1").PolicyRef, import("@astrale-os/kernel-dsl/v1/language").PolicyCheckObject>, "kernel.astrale.ai:class.Identity.method.mint"> & {
|
|
6535
|
+
readonly name: "mint";
|
|
6536
6536
|
}))[];
|
|
6537
6537
|
export { AuthorityOperationOrder, AuthorityOperations, operationOf } from '../authority/index.js';
|
|
6538
6538
|
export type { AuthorityOperation, AuthorityRelation } from '../authority/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/kernel-core",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
3
|
+
"version": "0.9.0-beta.37",
|
|
4
4
|
"description": "Astrale Kernel Core - Types, Invariants, and Pure Logic",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"access": "public"
|
|
161
161
|
},
|
|
162
162
|
"dependencies": {
|
|
163
|
-
"@astrale-os/kernel-dsl": "0.2.0-beta.
|
|
163
|
+
"@astrale-os/kernel-dsl": "0.2.0-beta.28",
|
|
164
164
|
"@noble/hashes": "2.3.0",
|
|
165
165
|
"@types/json-schema": "^7.0.15",
|
|
166
166
|
"dequal": "2.0.3"
|