@astrale-os/kernel-core 0.9.0-beta.63 → 0.9.0-beta.65
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/admission/admission.d.ts +2 -2
- package/dist/auth/authority/admission/admission.js +10 -8
- package/dist/auth/authority/admission/index.d.ts +1 -1
- package/dist/auth/authority/admission/index.js +1 -1
- package/dist/auth/authority/index.d.ts +7 -3
- package/dist/auth/authority/index.js +4 -2
- package/dist/auth/authority/language/index.d.ts +2 -0
- package/dist/auth/authority/language/index.js +1 -0
- package/dist/auth/authority/language/predicate.d.ts +10 -5
- package/dist/auth/authority/language/predicate.js +1 -1
- package/dist/auth/authority/language/program.d.ts +21 -0
- package/dist/auth/authority/language/program.js +2 -0
- package/dist/auth/authority/normalization/index.d.ts +1 -1
- package/dist/auth/authority/normalization/index.js +1 -1
- package/dist/auth/authority/normalization/normalize.d.ts +1 -1
- package/dist/auth/authority/normalization/normalize.js +4 -5
- package/dist/auth/authority/ownership.optimization.js +2 -2
- package/dist/auth/authority/prepare-binder-body.d.ts +4 -0
- package/dist/auth/authority/prepare-binder-body.js +31 -0
- package/dist/auth/authority/program.d.ts +28 -0
- package/dist/auth/authority/program.js +191 -0
- package/dist/auth/authority/semantics/class-authority.d.ts +8 -0
- package/dist/auth/authority/semantics/class-authority.js +26 -0
- package/dist/auth/authority/semantics/composition.d.ts +39 -0
- package/dist/auth/authority/semantics/composition.js +112 -0
- package/dist/auth/authority/semantics/failure.d.ts +21 -0
- package/dist/auth/authority/semantics/failure.js +10 -0
- package/dist/auth/authority/semantics/index.d.ts +11 -0
- package/dist/auth/authority/semantics/index.js +5 -0
- package/dist/auth/authority/semantics/interpret.d.ts +35 -0
- package/dist/auth/authority/semantics/interpret.js +215 -0
- package/dist/auth/authority/semantics/snapshot.d.ts +34 -0
- package/dist/auth/authority/semantics/terms.d.ts +20 -0
- package/dist/auth/authority/semantics/terms.js +96 -0
- package/dist/auth/authority/semantics/vocabulary.d.ts +19 -0
- package/dist/auth/authority/semantics/vocabulary.js +1 -0
- package/dist/auth/context/context.d.ts +4 -3
- package/dist/auth/expression/authoring/builder.d.ts +2 -11
- package/dist/auth/expression/authoring/builder.js +1 -45
- package/dist/auth/expression/authoring/index.d.ts +1 -1
- package/dist/auth/expression/authoring/index.js +1 -1
- package/dist/auth/expression/index.d.ts +1 -2
- package/dist/auth/expression/index.js +1 -2
- package/dist/auth/expression/language/identity-expression.d.ts +2 -22
- package/dist/auth/grant/index.d.ts +1 -1
- package/dist/auth/grant/index.js +1 -1
- package/dist/auth/grant/resolved/admission.d.ts +4 -3
- package/dist/auth/grant/resolved/admission.js +23 -13
- package/dist/auth/grant/resolved/grant.d.ts +1 -1
- package/dist/auth/grant/resolved/index.d.ts +1 -1
- package/dist/auth/grant/resolved/index.js +1 -1
- package/dist/auth/grant/unresolved/admission.d.ts +4 -1
- package/dist/auth/grant/unresolved/admission.js +27 -67
- package/dist/auth/grant/unresolved/limits.d.ts +2 -4
- package/dist/auth/grant/unresolved/limits.js +1 -5
- package/dist/auth/index.d.ts +1 -1
- package/dist/graph/graph/graph.d.ts +1 -5
- package/dist/graph/graph/graph.js +3 -27
- package/dist/graph/graph/index.d.ts +1 -3
- package/dist/graph/graph/index.js +1 -2
- package/dist/graph/query/index.d.ts +2 -0
- package/dist/graph/query/index.js +1 -0
- package/dist/graph/query/order/index.d.ts +46 -0
- package/dist/graph/query/order/index.js +59 -0
- package/dist/graph/query/reference/evaluate.js +24 -50
- package/dist/graph/reconcile/planning/canonical.d.ts +6 -0
- package/dist/graph/reconcile/planning/canonical.js +28 -0
- package/dist/graph/reconcile/planning/model.d.ts +4 -0
- package/dist/graph/reconcile/planning/plan.js +2 -1
- package/dist/schema/authority/vocabulary.d.ts +3 -0
- package/dist/schema/authority/vocabulary.js +25 -0
- package/dist/schema/callables/function.d.ts +120 -90
- package/dist/schema/domain/domain.d.ts +120 -90
- package/dist/schema/identity/composition.d.ts +5 -0
- package/dist/schema/identity/composition.js +5 -0
- package/dist/schema/identity/identity.d.ts +8 -6
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.js +1 -0
- package/dist/schema/kernel/schema.d.ts +337 -276
- package/dist/schema/kernel/syscalls/contracts/delegate.d.ts +4 -1
- package/dist/schema/kernel/syscalls/contracts/delegate.js +4 -3
- package/dist/schema/kernel/syscalls/contracts/impersonate.d.ts +0 -1
- package/dist/schema/kernel/syscalls/contracts/legacy/delegate.d.ts +5 -0
- package/dist/schema/kernel/syscalls/contracts/legacy/delegate.js +25 -0
- package/dist/schema/kernel/syscalls/contracts/mint.d.ts +0 -1
- package/dist/schema/kernel/syscalls/contracts/mint.js +1 -2
- package/dist/schema/kernel/syscalls/declarations/delegate.d.ts +4 -1
- package/dist/schema/kernel/syscalls/declarations/impersonate.d.ts +0 -1
- package/dist/schema/kernel/syscalls/declarations/index.d.ts +35 -34
- package/dist/schema/kernel/syscalls/declarations/install.d.ts +8 -8
- package/dist/schema/kernel/syscalls/declarations/mint.d.ts +0 -1
- package/dist/schema/kernel/syscalls/declarations/mutate.d.ts +23 -23
- package/dist/schema/kernel/syscalls/descriptors/identity.d.ts +4 -3
- package/package.json +2 -2
- package/dist/auth/authority/prepare-grant-body.d.ts +0 -4
- package/dist/auth/authority/prepare-grant-body.js +0 -27
- package/dist/auth/expression/normalization/canonicalize.d.ts +0 -7
- package/dist/auth/expression/normalization/canonicalize.js +0 -102
- package/dist/auth/expression/normalization/index.d.ts +0 -2
- package/dist/auth/expression/normalization/index.js +0 -2
- package/dist/auth/expression/normalization/raise-denials.d.ts +0 -3
- package/dist/auth/expression/normalization/raise-denials.js +0 -59
- package/dist/graph/graph/navigation/error.d.ts +0 -12
- package/dist/graph/graph/navigation/error.js +0 -20
- package/dist/graph/graph/navigation/index.d.ts +0 -2
- package/dist/graph/graph/navigation/index.js +0 -1
- package/dist/graph/graph/navigation/model.d.ts +0 -15
- package/dist/schema/kernel/projection/path.d.ts +0 -2
- package/dist/schema/kernel/projection/path.js +0 -113
- /package/dist/{graph/graph/navigation/model.js → auth/authority/semantics/snapshot.js} +0 -0
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { ClassKey } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
-
import { GraphPathAmbiguousError } from '#graph/graph';
|
|
3
|
-
import { K } from '../index.js';
|
|
4
|
-
export const projectionPathWalker = Object.freeze({
|
|
5
|
-
walk: walkProjectionPath,
|
|
6
|
-
});
|
|
7
|
-
function walkProjectionPath(path, context) {
|
|
8
|
-
let candidates = anchorCandidates(path.ast, context);
|
|
9
|
-
for (const step of path.ast.steps)
|
|
10
|
-
candidates = applyStep(candidates, step, context);
|
|
11
|
-
if (candidates.length === 0)
|
|
12
|
-
return undefined;
|
|
13
|
-
if (candidates.length === 1)
|
|
14
|
-
return candidates[0];
|
|
15
|
-
throw new GraphPathAmbiguousError(path.raw, candidates.length);
|
|
16
|
-
}
|
|
17
|
-
function anchorCandidates(ast, context) {
|
|
18
|
-
if (ast.anchor.kind === 'id') {
|
|
19
|
-
const node = context.nodes.byId(ast.anchor.id);
|
|
20
|
-
return node === undefined ? [] : [node];
|
|
21
|
-
}
|
|
22
|
-
const domainClass = ClassKey.of(K.classes.Domain.ref);
|
|
23
|
-
const origin = ast.anchor.origin;
|
|
24
|
-
return context.nodes
|
|
25
|
-
.byClass(domainClass)
|
|
26
|
-
.filter((node) => node.props[K.classes.Domain.properties.origin.key] === origin);
|
|
27
|
-
}
|
|
28
|
-
function applyStep(current, step, context) {
|
|
29
|
-
switch (step.kind) {
|
|
30
|
-
case 'projection':
|
|
31
|
-
return domainMembers(current, `${step.projection.kind}.${step.projection.name}`, context);
|
|
32
|
-
case 'method':
|
|
33
|
-
return step.dispatch === 'static'
|
|
34
|
-
? directMethods(current, step.name, true, context)
|
|
35
|
-
: instanceMethods(current.filter((node) => node.class === step.class), step.name, context);
|
|
36
|
-
case 'traverse':
|
|
37
|
-
return traverse(current, step, context);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function domainMembers(domains, member, context) {
|
|
41
|
-
const domainIds = new Set(domains.map((node) => node.id));
|
|
42
|
-
return distinctNodes(edgesOf(K.classes.of_domain, context).flatMap((edge) => {
|
|
43
|
-
if (!domainIds.has(edge.target) ||
|
|
44
|
-
edge.props[K.classes.of_domain.properties.member.key] !== member) {
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
const node = context.nodes.byId(edge.source);
|
|
48
|
-
return node === undefined ? [] : [node];
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
function directMethods(owners, name, isStatic, context) {
|
|
52
|
-
const ownerIds = new Set(owners.map((node) => node.id));
|
|
53
|
-
return distinctNodes(edgesOf(K.classes.method_of, context).flatMap((edge) => {
|
|
54
|
-
if (!ownerIds.has(edge.target) ||
|
|
55
|
-
edge.props[K.classes.method_of.properties.name.key] !== name ||
|
|
56
|
-
edge.props[K.classes.method_of.properties.static.key] !== isStatic) {
|
|
57
|
-
return [];
|
|
58
|
-
}
|
|
59
|
-
const method = context.nodes.byId(edge.source);
|
|
60
|
-
return method === undefined ? [] : [method];
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
function instanceMethods(instances, name, context) {
|
|
64
|
-
return distinctNodes(instances.flatMap((instance) => {
|
|
65
|
-
const owner = resolveClassProjection(instance.class, context);
|
|
66
|
-
return owner.length === 0 ? [] : directMethods(owner, name, false, context);
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
function resolveClassProjection(key, context) {
|
|
70
|
-
const domainClass = ClassKey.of(K.classes.Domain.ref);
|
|
71
|
-
const domains = context.nodes
|
|
72
|
-
.byClass(domainClass)
|
|
73
|
-
.filter((node) => node.props[K.classes.Domain.properties.origin.key] === ClassKey.ref(key).origin);
|
|
74
|
-
return domainMembers(domains, `class.${ClassKey.ref(key).name}`, context);
|
|
75
|
-
}
|
|
76
|
-
function traverse(current, step, context) {
|
|
77
|
-
const currentIds = new Set(current.map((node) => node.id));
|
|
78
|
-
const edgeClass = step.class;
|
|
79
|
-
const orientation = context.orientation(edgeClass);
|
|
80
|
-
const candidates = context.edges.byClass(edgeClass);
|
|
81
|
-
return distinctNodes(candidates.flatMap((edge) => {
|
|
82
|
-
if (step.slug !== undefined && edge.slug !== step.slug)
|
|
83
|
-
return [];
|
|
84
|
-
const endpoint = traversedEndpoint(edge, currentIds, step.direction, orientation);
|
|
85
|
-
if (endpoint === undefined)
|
|
86
|
-
return [];
|
|
87
|
-
const node = context.nodes.byId(endpoint);
|
|
88
|
-
return node === undefined ? [] : [node];
|
|
89
|
-
}));
|
|
90
|
-
}
|
|
91
|
-
function traversedEndpoint(edge, current, direction, orientation) {
|
|
92
|
-
if (orientation === 'undirected') {
|
|
93
|
-
if (current.has(edge.source))
|
|
94
|
-
return edge.target;
|
|
95
|
-
if (current.has(edge.target))
|
|
96
|
-
return edge.source;
|
|
97
|
-
return undefined;
|
|
98
|
-
}
|
|
99
|
-
if (direction === 'out' && current.has(edge.source))
|
|
100
|
-
return edge.target;
|
|
101
|
-
if (direction === 'in' && current.has(edge.target))
|
|
102
|
-
return edge.source;
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
function edgesOf(relation, context) {
|
|
106
|
-
return context.edges.byClass(ClassKey.of(relation.ref));
|
|
107
|
-
}
|
|
108
|
-
function distinctNodes(nodes) {
|
|
109
|
-
const byId = new Map();
|
|
110
|
-
for (const node of nodes)
|
|
111
|
-
byId.set(node.id, node);
|
|
112
|
-
return [...byId.values()];
|
|
113
|
-
}
|
|
File without changes
|