@astrale-os/kernel-dsl 1.0.0-beta.11 → 1.0.0-beta.13
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/v1/addressing/definition-ref.js +21 -37
- package/dist/v1/addressing/ordering.d.ts +2 -0
- package/dist/v1/addressing/ordering.js +4 -0
- package/dist/v1/addressing/patterns.d.ts +0 -1
- package/dist/v1/addressing/patterns.js +0 -5
- package/dist/v1/builder/callable/authoring.d.ts +1 -1
- package/dist/v1/builder/class/authoring.d.ts +6 -256
- package/dist/v1/builder/class/authoring.js +5 -28
- package/dist/v1/builder/class/handle.d.ts +27 -0
- package/dist/v1/builder/class/handle.js +1 -0
- package/dist/v1/builder/class/input.d.ts +129 -0
- package/dist/v1/builder/class/projection.d.ts +129 -0
- package/dist/v1/builder/class/projection.js +1 -0
- package/dist/v1/builder/core/authoring.d.ts +1 -1
- package/dist/v1/builder/index.d.ts +3 -1
- package/dist/v1/builder/lowering/class.d.ts +1 -1
- package/dist/v1/builder/lowering/schema/context.d.ts +2 -1
- package/dist/v1/builder/lowering/schema/context.js +2 -4
- package/dist/v1/builder/lowering/value/path.d.ts +1 -1
- package/dist/v1/builder/lowering/value/path.js +2 -4
- package/dist/v1/builder/lowering/value/zod.js +1 -3
- package/dist/v1/builder/policy/authoring.d.ts +1 -1
- package/dist/v1/builder/schema/define.d.ts +0 -1
- package/dist/v1/builder/schema/diagnostic.d.ts +2 -1
- package/dist/v1/builder/schema/diagnostic.js +5 -10
- package/dist/v1/builder/schema/input.d.ts +1 -1
- package/dist/v1/builder/schema/projection/class.d.ts +2 -1
- package/dist/v1/builder/schema/projection/core-input.d.ts +2 -1
- package/dist/v1/builder/schema/projection/identity.d.ts +2 -1
- package/dist/v1/builder/schema/projection/property.d.ts +1 -1
- package/dist/v1/builder/schema/projection.d.ts +1 -1
- package/dist/v1/builder/value/full-match.d.ts +0 -1
- package/dist/v1/builder/value/full-match.js +0 -1
- package/dist/v1/builder/value/path-metadata.d.ts +1 -1
- package/dist/v1/builder/value/path.d.ts +1 -1
- package/dist/v1/bundle/codec.js +2 -4
- package/dist/v1/bundle/diagnostic.js +3 -7
- package/dist/v1/bundle/structure.js +2 -4
- package/dist/v1/compiled/admission/diagnostic.d.ts +1 -1
- package/dist/v1/compiled/admission/diagnostic.js +1 -3
- package/dist/v1/compiled/admission/revision.d.ts +9 -1
- package/dist/v1/compiled/admission/revision.js +6 -3
- package/dist/v1/compiled/admission/semantics/class.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/class.js +4 -8
- package/dist/v1/compiled/admission/semantics/core.d.ts +1 -24
- package/dist/v1/compiled/admission/semantics/core.js +54 -34
- package/dist/v1/compiled/admission/semantics/edge.d.ts +2 -4
- package/dist/v1/compiled/admission/semantics/edge.js +6 -65
- package/dist/v1/compiled/admission/semantics/policy/callable.js +0 -2
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +5 -20
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +8 -21
- package/dist/v1/compiled/admission/semantics/policy/parity.js +13 -22
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +4 -1
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +4 -16
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +2 -24
- package/dist/v1/compiled/admission/semantics/policy/typing.js +19 -201
- package/dist/v1/compiled/compiler/compile.js +6 -8
- package/dist/v1/compiled/diagnostic.js +2 -3
- package/dist/v1/compiled/loader/load.d.ts +3 -2
- package/dist/v1/compiled/loader/load.js +10 -44
- package/dist/v1/domain/create.js +3 -5
- package/dist/v1/domain/namespace/member-collection.js +4 -6
- package/dist/v1/domain/validation/create.d.ts +0 -1
- package/dist/v1/domain/validation/create.js +0 -35
- package/dist/v1/language/class/inheritance.d.ts +18 -0
- package/dist/v1/language/class/inheritance.js +73 -0
- package/dist/v1/language/class/property-values.js +2 -4
- package/dist/v1/language/core/facts.d.ts +72 -0
- package/dist/v1/language/core/facts.js +95 -0
- package/dist/v1/language/index.d.ts +1 -0
- package/dist/v1/language/index.js +1 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +8 -0
- package/dist/v1/language/policy/analysis/branches.js +2 -1
- package/dist/v1/language/policy/analysis/budgets.d.ts +13 -1
- package/dist/v1/language/policy/analysis/budgets.js +104 -0
- package/dist/v1/language/policy/analysis/typing.d.ts +48 -0
- package/dist/v1/language/policy/analysis/typing.js +338 -0
- package/dist/v1/language/validation/diagnostic.d.ts +15 -1
- package/dist/v1/language/validation/diagnostic.js +21 -0
- package/dist/v1/language/value/compile/fields.js +4 -8
- package/dist/v1/language/value/inclusion/arrays.d.ts +3 -0
- package/dist/v1/language/value/inclusion/arrays.js +85 -0
- package/dist/v1/language/value/inclusion/assertions.d.ts +18 -0
- package/dist/v1/language/value/inclusion/assertions.js +29 -0
- package/dist/v1/language/value/inclusion/combinators.d.ts +3 -0
- package/dist/v1/language/value/inclusion/combinators.js +67 -0
- package/dist/v1/language/value/inclusion/equivalence.d.ts +4 -0
- package/dist/v1/language/value/inclusion/equivalence.js +74 -0
- package/dist/v1/language/value/inclusion/evidence.d.ts +34 -0
- package/dist/v1/language/value/inclusion/evidence.js +138 -0
- package/dist/v1/language/value/inclusion/includes.d.ts +17 -0
- package/dist/v1/language/value/inclusion/includes.js +25 -719
- package/dist/v1/language/value/inclusion/keywords.d.ts +5 -0
- package/dist/v1/language/value/inclusion/keywords.js +31 -0
- package/dist/v1/language/value/inclusion/kinds.d.ts +17 -0
- package/dist/v1/language/value/inclusion/kinds.js +57 -0
- package/dist/v1/language/value/inclusion/location.d.ts +24 -0
- package/dist/v1/language/value/inclusion/location.js +63 -0
- package/dist/v1/language/value/inclusion/numbers.d.ts +3 -0
- package/dist/v1/language/value/inclusion/numbers.js +41 -0
- package/dist/v1/language/value/inclusion/objects.d.ts +3 -0
- package/dist/v1/language/value/inclusion/objects.js +190 -0
- package/dist/v1/language/value/inclusion/strings.d.ts +3 -0
- package/dist/v1/language/value/inclusion/strings.js +29 -0
- package/dist/v1/language/value/inclusion/types.d.ts +3 -0
- package/dist/v1/language/value/inclusion/types.js +11 -0
- package/dist/v1/language/value/ordering.d.ts +9 -0
- package/dist/v1/language/value/ordering.js +72 -9
- package/dist/v1/language/value/profile/rules.js +5 -7
- package/dist/v1/language/value/profile/validate.js +1 -10
- package/dist/v1/language/value/reference/recursion.js +2 -22
- package/dist/v1/language/value/syntax/pointer.d.ts +2 -0
- package/dist/v1/language/value/syntax/pointer.js +5 -2
- package/dist/v1/language/value/syntax/walk.d.ts +2 -0
- package/dist/v1/language/value/syntax/walk.js +19 -20
- package/dist/v1/schema/compatibility/diff.js +2 -4
- package/dist/v1/schema/compatibility/meaning/footprint.js +16 -50
- package/dist/v1/schema/compatibility/structure/requirements.js +26 -58
- package/dist/v1/schema/compatibility/walk.d.ts +17 -0
- package/dist/v1/schema/compatibility/walk.js +41 -0
- package/dist/v1/schema/diagnostic.js +3 -11
- package/dist/v1/schema/resolution/context.js +3 -5
- package/dist/v1/schema/validation/callable.js +3 -5
- package/dist/v1/schema/validation/class.js +10 -52
- package/dist/v1/schema/validation/core.js +65 -199
- package/dist/v1/schema/validation/domain.js +1 -10
- package/dist/v1/schema/validation/domain.structure.js +2 -4
- package/dist/v1/schema/validation/policy/budgets.js +5 -112
- package/dist/v1/schema/validation/policy/context.d.ts +5 -3
- package/dist/v1/schema/validation/policy/context.js +5 -3
- package/dist/v1/schema/validation/policy/objects.d.ts +1 -1
- package/dist/v1/schema/validation/policy/objects.js +6 -14
- package/dist/v1/schema/validation/policy/references.js +5 -6
- package/dist/v1/schema/validation/policy/typing.d.ts +3 -18
- package/dist/v1/schema/validation/policy/typing.js +22 -356
- package/dist/v1/schema/validation/policy/uses.d.ts +1 -1
- package/dist/v1/schema/validation/policy/uses.js +9 -22
- package/dist/v1/schema/validation/policy/validate.js +3 -2
- package/dist/v1/schema/validation/value-api.d.ts +9 -0
- package/dist/v1/schema/validation/value-api.js +23 -1
- package/dist/v1/schema/validation/value.js +5 -7
- package/dist/v1/schema/validation/view.js +4 -8
- package/dist/value/canonical.d.ts +3 -2
- package/dist/value/canonical.js +30 -6
- package/dist/value/decode.d.ts +7 -0
- package/dist/value/decode.js +159 -9
- package/dist/value/index.d.ts +1 -1
- package/dist/value/json.d.ts +1 -1
- package/dist/value/json.js +1 -1
- package/dist/value/types.d.ts +6 -0
- package/dist/value/unicode.d.ts +2 -1
- package/dist/value/unicode.js +2 -0
- package/package.json +1 -1
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +0 -5
- package/dist/v1/compiled/admission/semantics/cardinality.js +0 -128
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +0 -8
- package/dist/v1/compiled/admission/semantics/policy/equality.js +0 -27
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +0 -9
- package/dist/v1/compiled/admission/semantics/policy/measure.js +0 -81
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +0 -10
- package/dist/v1/compiled/admission/semantics/policy/variants.js +0 -65
- package/dist/v1/language/class/index.d.ts +0 -8
- package/dist/v1/language/class/index.js +0 -1
- package/dist/v1/language/core/index.d.ts +0 -2
- package/dist/v1/language/value/index.d.ts +0 -11
- package/dist/v1/language/value/index.js +0 -8
- /package/dist/v1/{language/core/index.js → builder/class/input.js} +0 -0
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { policyObjectOrigin, policyVariableClass } from '../../../../language/index.js';
|
|
2
|
-
import { BRANCH_OVERFLOW } from '../../../../language/policy/analysis/budgets.js';
|
|
3
|
-
import {} from '../../../../language/policy/model/policy.js';
|
|
4
|
-
/** Measure expanded Policy branches, depth and referenced Domains. */
|
|
5
|
-
export function measureCompiledPolicy(origin, name, normalized, visiting) {
|
|
6
|
-
if (visiting.has(name))
|
|
7
|
-
return undefined;
|
|
8
|
-
const expression = normalized.get(name);
|
|
9
|
-
if (expression === undefined)
|
|
10
|
-
return undefined;
|
|
11
|
-
if ('match' in expression)
|
|
12
|
-
return measureCompiledPattern(expression.match, origin);
|
|
13
|
-
const nested = new Set(visiting);
|
|
14
|
-
nested.add(name);
|
|
15
|
-
const refs = 'allOf' in expression ? expression.allOf : expression.anyOf;
|
|
16
|
-
const children = refs.map((ref) => ref.origin === origin ? measureCompiledPolicy(origin, ref.name, normalized, nested) : undefined);
|
|
17
|
-
if (children.some((value) => value === undefined))
|
|
18
|
-
return undefined;
|
|
19
|
-
return combineCompiledMeasures('allOf' in expression ? 'allOf' : 'anyOf', children);
|
|
20
|
-
}
|
|
21
|
-
function measureCompiledPattern(pattern, origin) {
|
|
22
|
-
if ('sameNode' in pattern)
|
|
23
|
-
return {
|
|
24
|
-
depth: 1,
|
|
25
|
-
edgeCounts: [1],
|
|
26
|
-
domains: new Set([
|
|
27
|
-
origin,
|
|
28
|
-
...[pattern.sameNode.left, pattern.sameNode.right].flatMap((term) => term.kind === 'ref' ? [policyObjectOrigin(term.ref)] : []),
|
|
29
|
-
]),
|
|
30
|
-
};
|
|
31
|
-
if ('source' in pattern)
|
|
32
|
-
return {
|
|
33
|
-
depth: 1,
|
|
34
|
-
edgeCounts: [1],
|
|
35
|
-
domains: new Set([
|
|
36
|
-
origin,
|
|
37
|
-
pattern.class.origin,
|
|
38
|
-
...[pattern.source, pattern.target].flatMap((term) => term.kind === 'ref' ? [policyObjectOrigin(term.ref)] : []),
|
|
39
|
-
]),
|
|
40
|
-
};
|
|
41
|
-
if ('exists' in pattern) {
|
|
42
|
-
const child = measureCompiledPattern(pattern.exists.where, origin);
|
|
43
|
-
return {
|
|
44
|
-
depth: child.depth + 1,
|
|
45
|
-
edgeCounts: child.edgeCounts,
|
|
46
|
-
domains: new Set([
|
|
47
|
-
...child.domains,
|
|
48
|
-
...pattern.exists.nodes.flatMap((node) => {
|
|
49
|
-
const ref = policyVariableClass(node);
|
|
50
|
-
return ref === undefined ? [] : [ref.origin];
|
|
51
|
-
}),
|
|
52
|
-
]),
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return combineCompiledMeasures('allOf' in pattern ? 'allOf' : 'anyOf', ('allOf' in pattern ? pattern.allOf : pattern.anyOf).map((child) => measureCompiledPattern(child, origin)));
|
|
56
|
-
}
|
|
57
|
-
function combineCompiledMeasures(kind, children) {
|
|
58
|
-
const depth = 1 + Math.max(0, ...children.map((child) => child.depth));
|
|
59
|
-
const domains = new Set(children.flatMap((child) => [...child.domains]));
|
|
60
|
-
if (kind === 'anyOf')
|
|
61
|
-
return {
|
|
62
|
-
depth,
|
|
63
|
-
edgeCounts: children.flatMap((child) => child.edgeCounts).slice(0, BRANCH_OVERFLOW),
|
|
64
|
-
domains,
|
|
65
|
-
};
|
|
66
|
-
let edgeCounts = [0];
|
|
67
|
-
for (const child of children) {
|
|
68
|
-
const next = [];
|
|
69
|
-
for (const left of edgeCounts) {
|
|
70
|
-
for (const right of child.edgeCounts) {
|
|
71
|
-
next.push(left + right);
|
|
72
|
-
if (next.length >= BRANCH_OVERFLOW)
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
if (next.length >= BRANCH_OVERFLOW)
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
edgeCounts = next;
|
|
79
|
-
}
|
|
80
|
-
return { depth, edgeCounts, domains };
|
|
81
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CompiledPolicyTyping } from './typing.js';
|
|
2
|
-
import { type ClassRef } from '../../../../addressing/index.js';
|
|
3
|
-
import { type PatternEdgeUse } from '../../../../language/policy/analysis/branches.js';
|
|
4
|
-
/** One possible combination of endpoint constraints and term equalities. */
|
|
5
|
-
export interface CompiledEdgeVariant {
|
|
6
|
-
readonly constraints: readonly (readonly [string, readonly ClassRef[]])[];
|
|
7
|
-
readonly equalities: readonly (readonly [string, string])[];
|
|
8
|
-
}
|
|
9
|
-
/** Enumerate satisfiable endpoint variants for a branch’s Edge uses. */
|
|
10
|
-
export declare function compiledEdgeAlternatives(edges: readonly PatternEdgeUse[], typing: CompiledPolicyTyping): readonly (readonly CompiledEdgeVariant[])[];
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Key } from '../../../../addressing/index.js';
|
|
2
|
-
import { compareUnicode } from '../../../../addressing/ordering.js';
|
|
3
|
-
import {} from '../../../../language/class/model/edge.js';
|
|
4
|
-
import { termKey } from '../../../../language/policy/analysis/branches.js';
|
|
5
|
-
import { isCompiledEdge } from '../context.js';
|
|
6
|
-
/** Enumerate satisfiable endpoint variants for a branch’s Edge uses. */
|
|
7
|
-
export function compiledEdgeAlternatives(edges, typing) {
|
|
8
|
-
let result = [[]];
|
|
9
|
-
for (const edge of edges) {
|
|
10
|
-
const variants = compiledVariantsForEdge(edge, typing);
|
|
11
|
-
if (variants.length === 0)
|
|
12
|
-
return [];
|
|
13
|
-
result = result.flatMap((prefix) => variants.map((variant) => [...prefix, variant]));
|
|
14
|
-
}
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
function compiledVariantsForEdge(use, typing) {
|
|
18
|
-
const declaration = typing.context.classes.get(Key.of(use.pattern.class))?.value;
|
|
19
|
-
if (declaration === undefined || !isCompiledEdge(declaration))
|
|
20
|
-
return [];
|
|
21
|
-
const endpoints = declaration.orientation === 'directed'
|
|
22
|
-
? [declaration.endpoints.source, declaration.endpoints.target]
|
|
23
|
-
: declaration.endpoints;
|
|
24
|
-
const repeat = use.pattern.repeat ?? { min: 1, max: 1 };
|
|
25
|
-
const sourceKey = termKey(use.pattern.source, use.namespace);
|
|
26
|
-
const targetKey = termKey(use.pattern.target, use.namespace);
|
|
27
|
-
const variants = [];
|
|
28
|
-
for (let length = repeat.min; length <= repeat.max; length++) {
|
|
29
|
-
if (length === 0) {
|
|
30
|
-
variants.push({ constraints: [], equalities: [[sourceKey, targetKey]] });
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const orientationCount = declaration.orientation === 'undirected' ? 2 ** length : 1;
|
|
34
|
-
for (let mask = 0; mask < orientationCount; mask++) {
|
|
35
|
-
const reversed = Array.from({ length }, (_, index) => declaration.orientation === 'undirected' && (mask & (1 << index)) !== 0);
|
|
36
|
-
let valid = true;
|
|
37
|
-
for (let index = 0; index + 1 < length; index++) {
|
|
38
|
-
const incoming = reversed[index] ? endpoints[0] : endpoints[1];
|
|
39
|
-
const outgoing = reversed[index + 1] ? endpoints[1] : endpoints[0];
|
|
40
|
-
if (!typing.endpointsOverlap(incoming.accepts, outgoing.accepts))
|
|
41
|
-
valid = false;
|
|
42
|
-
}
|
|
43
|
-
if (!valid)
|
|
44
|
-
continue;
|
|
45
|
-
const first = reversed[0] ? endpoints[1] : endpoints[0];
|
|
46
|
-
const last = reversed[length - 1] ? endpoints[0] : endpoints[1];
|
|
47
|
-
variants.push({
|
|
48
|
-
constraints: [
|
|
49
|
-
[sourceKey, first.accepts],
|
|
50
|
-
[targetKey, last.accepts],
|
|
51
|
-
],
|
|
52
|
-
equalities: [],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return uniqueCompiledEdgeVariants(variants);
|
|
57
|
-
}
|
|
58
|
-
function uniqueCompiledEdgeVariants(values) {
|
|
59
|
-
const result = new Map();
|
|
60
|
-
for (const value of values) {
|
|
61
|
-
const key = `${value.constraints.map(([term, accepts]) => `${term}:${accepts.map(Key.of).sort(compareUnicode).join(',')}`).join('|')}=${value.equalities.map(([left, right]) => `${left}:${right}`).join('|')}`;
|
|
62
|
-
result.set(key, value);
|
|
63
|
-
}
|
|
64
|
-
return [...result.values()];
|
|
65
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type * from './model/class.js';
|
|
2
|
-
export type * from './model/data.js';
|
|
3
|
-
export type * from './model/edge.js';
|
|
4
|
-
export type * from './model/property.js';
|
|
5
|
-
export { PropertyValues } from './property-values.js';
|
|
6
|
-
export type { PropertyValuesOperations } from './property-values.js';
|
|
7
|
-
export type * from './facets.js';
|
|
8
|
-
export type * from './resolved.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { PropertyValues } from './property-values.js';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** Complete V1 inline value language. Named Type Definitions do not exist. */
|
|
2
|
-
export type { JsonSchema as ValueSchema, JsonSchemaObject as ValueSchemaObject, PathAnnotation, PropertyObjectSchema, ValueSchemaContext, } from './model/schema.js';
|
|
3
|
-
export { JSON_SCHEMA_DIALECT, VALUE_SCHEMA_DIALECT, VALUE_SCHEMA_VOCABULARY, } from './model/schema.js';
|
|
4
|
-
export { instant, isInstantValue } from './model/instant.js';
|
|
5
|
-
export { classifyOrdering, type OrderingKind } from './ordering.js';
|
|
6
|
-
export { canonicalizeValueSchema } from './profile/canonicalize.js';
|
|
7
|
-
export { validateValueSchema } from './profile/validate.js';
|
|
8
|
-
export { validateJsonInstance } from './evaluate/validate.js';
|
|
9
|
-
export { prepareValueSchema, type InstanceSchemaCompilation } from './evaluate/preparation.js';
|
|
10
|
-
export type { ValueProgram } from './compile/model.js';
|
|
11
|
-
export type { ValueSchemaRegistry, ValueSchemaDomainRegistry } from './reference/registry.js';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** Complete V1 inline value language. Named Type Definitions do not exist. */
|
|
2
|
-
export { JSON_SCHEMA_DIALECT, VALUE_SCHEMA_DIALECT, VALUE_SCHEMA_VOCABULARY, } from './model/schema.js';
|
|
3
|
-
export { instant, isInstantValue } from './model/instant.js';
|
|
4
|
-
export { classifyOrdering } from './ordering.js';
|
|
5
|
-
export { canonicalizeValueSchema } from './profile/canonicalize.js';
|
|
6
|
-
export { validateValueSchema } from './profile/validate.js';
|
|
7
|
-
export { validateJsonInstance } from './evaluate/validate.js';
|
|
8
|
-
export { prepareValueSchema } from './evaluate/preparation.js';
|
|
File without changes
|