@astrale-os/kernel-dsl 1.0.0-beta.14 → 1.0.0-beta.16
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/domain-dependency.d.ts +0 -6
- package/dist/v1/addressing/domain-dependency.js +1 -6
- package/dist/v1/builder/class/authoring.d.ts +43 -0
- package/dist/v1/builder/index.d.ts +1 -1
- package/dist/v1/builder/lowering/policy.js +1 -0
- package/dist/v1/builder/lowering/schema/context.d.ts +5 -0
- package/dist/v1/builder/lowering/schema/context.js +22 -0
- package/dist/v1/builder/policy/authoring.d.ts +84 -4
- package/dist/v1/builder/policy/authoring.js +41 -12
- package/dist/v1/builder/schema/projection/class.d.ts +116 -14
- package/dist/v1/bundle/codec.js +7 -7
- package/dist/v1/compiled/admission/accept.js +3 -3
- package/dist/v1/compiled/admission/closure.js +2 -2
- package/dist/v1/compiled/admission/semantics/core.js +3 -7
- package/dist/v1/compiled/admission/semantics/policy/parity.js +3 -10
- package/dist/v1/compiled/admission/semantics/policy/typing.js +2 -2
- package/dist/v1/language/.spec/schemas/draft-2020-12.schema.json +462 -0
- package/dist/v1/language/core/facts.d.ts +17 -4
- package/dist/v1/language/core/facts.js +26 -5
- package/dist/v1/language/limits.d.ts +64 -0
- package/dist/v1/language/limits.js +60 -0
- package/dist/v1/language/policy/analysis/budgets.d.ts +39 -18
- package/dist/v1/language/policy/analysis/budgets.js +30 -20
- package/dist/v1/language/policy/analysis/checks.js +3 -2
- package/dist/v1/language/policy/analysis/typing.d.ts +4 -2
- package/dist/v1/language/policy/analysis/typing.js +136 -14
- package/dist/v1/language/validation/rule.d.ts +9 -0
- package/dist/v1/language/validation/rule.js +9 -7
- package/dist/v1/language/value/ordering.d.ts +5 -0
- package/dist/v1/language/value/ordering.js +14 -0
- package/dist/v1/language/value/reference/closure.js +3 -4
- package/dist/v1/language/value/reference/registry.index.d.ts +2 -0
- package/dist/v1/language/value/reference/registry.index.js +31 -15
- package/dist/v1/language/value/regexp/ast.js +6 -7
- package/dist/v1/language/value/regexp/compile.d.ts +5 -11
- package/dist/v1/language/value/regexp/compile.js +14 -12
- package/dist/v1/language/value/regexp/syntax.js +3 -2
- package/dist/v1/schema/.spec/schemas/domain-schema.schema.json +30 -2
- package/dist/v1/schema/admission/accept.js +3 -14
- package/dist/v1/schema/admission/callable.d.ts +21 -0
- package/dist/v1/schema/admission/callable.js +96 -0
- package/dist/v1/schema/index.d.ts +7 -0
- package/dist/v1/schema/index.js +3 -0
- package/dist/v1/schema/normalization/domain.d.ts +2 -0
- package/dist/v1/schema/normalization/domain.js +1 -1
- package/dist/v1/schema/resolution/context.js +7 -7
- package/dist/v1/schema/resolution/domain.d.ts +5 -0
- package/dist/v1/schema/resolution/domain.js +1 -1
- package/dist/v1/schema/rule.d.ts +9 -0
- package/dist/v1/schema/rule.js +29 -4
- package/dist/v1/schema/validation/callable.d.ts +33 -3
- package/dist/v1/schema/validation/callable.js +49 -15
- package/dist/v1/schema/validation/class.d.ts +6 -2
- package/dist/v1/schema/validation/class.js +18 -22
- package/dist/v1/schema/validation/core.js +16 -10
- package/dist/v1/schema/validation/domain.js +3 -3
- package/dist/v1/schema/validation/domain.route.d.ts +6 -1
- package/dist/v1/schema/validation/domain.route.js +18 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +28 -26
- package/dist/v1/schema/validation/domain.structure.js +22 -6
- package/dist/v1/schema/validation/policy/budgets.d.ts +33 -2
- package/dist/v1/schema/validation/policy/budgets.js +89 -16
- package/dist/v1/schema/validation/policy/context.d.ts +1 -2
- package/dist/v1/schema/validation/policy/context.js +2 -7
- package/dist/v1/schema/validation/policy/references.js +2 -1
- package/dist/v1/schema/validation/policy/uses.d.ts +29 -0
- package/dist/v1/schema/validation/policy/uses.js +28 -48
- package/dist/v1/schema/validation/value-api.d.ts +2 -0
- package/dist/v1/schema/validation/value-api.js +2 -0
- package/dist/v1/schema/validation/value.d.ts +3 -0
- package/dist/v1/schema/validation/value.js +3 -9
- package/dist/v1/schema/validation/value.json-schema.d.ts +3 -3
- package/dist/v1/schema/validation/value.json-schema.js +22 -4
- package/package.json +2 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Key } from '../../../addressing/index.js';
|
|
2
2
|
import { isMethodExecutable } from '../../../language/callable/executable.js';
|
|
3
3
|
import { coveringEdgeUniqueTuples, coveringNodeUniqueTuples, edgeUniqueKeys, nodeUniqueKeys, } from '../../../language/class/unique.js';
|
|
4
|
-
import { checkCoreEdgeSet, checkHeldKeys, coreEndpointsSatisfy, } from '../../../language/core/facts.js';
|
|
4
|
+
import { checkCoreEdgeSet, checkHeldKeys, coreEndpointsSatisfy, DOMAIN_ENDPOINT_CLASS, } from '../../../language/core/facts.js';
|
|
5
5
|
import {} from '../../../language/core/model/core.js';
|
|
6
6
|
import { policyObjectOrigin, policyObjectKey, projectedMemberClass, } from '../../../language/index.js';
|
|
7
7
|
import { bindValueProgram } from '../../../language/value/compile/load.js';
|
|
@@ -123,7 +123,7 @@ function validateCoreProperties(values, analysis, path) {
|
|
|
123
123
|
}
|
|
124
124
|
function resolveCoreEndpoint(context, entry, ref, nodes, path) {
|
|
125
125
|
if (ref.kind === 'domain')
|
|
126
|
-
return { key: 'domain' };
|
|
126
|
+
return { key: 'domain', member: { class: DOMAIN_ENDPOINT_CLASS, pointer: path } };
|
|
127
127
|
const undeclared = () => fail(path, 'Core endpoint does not name a declared local Definition.');
|
|
128
128
|
if (policyObjectOrigin(ref) !== entry.origin)
|
|
129
129
|
return undeclared();
|
|
@@ -151,9 +151,5 @@ function declaresProjectedMember(context, entry, ref) {
|
|
|
151
151
|
return declarations.some((declaration) => declaration.ref.name === ref.name);
|
|
152
152
|
}
|
|
153
153
|
function endpointSatisfies(context, endpoint, accepts) {
|
|
154
|
-
|
|
155
|
-
return classSatisfiesAny(context, endpoint.value.class, accepts);
|
|
156
|
-
if ('member' in endpoint)
|
|
157
|
-
return classSatisfiesAny(context, endpoint.member.class, accepts);
|
|
158
|
-
return true;
|
|
154
|
+
return classSatisfiesAny(context, 'value' in endpoint ? endpoint.value.class : endpoint.member.class, accepts);
|
|
159
155
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {} from '../../../../addressing/index.js';
|
|
2
2
|
import { branchesOf, targetMode, isConnected, } from '../../../../language/policy/analysis/branches.js';
|
|
3
|
-
import {
|
|
3
|
+
import { exceededLimits, measureChecks, policyMeasurer, } from '../../../../language/policy/analysis/budgets.js';
|
|
4
4
|
import { neverAdmittedClasses, } from '../../../../language/policy/analysis/checks.js';
|
|
5
5
|
import {} from '../../../../language/policy/analysis/typing.js';
|
|
6
6
|
import { checksNameTheCaller, isClassRuleChecks, } from '../../../../language/policy/model/policy.js';
|
|
@@ -28,11 +28,7 @@ export function validatePolicyParity(context, entry, entryIndex, policies, origi
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
const measure = measurePolicy(name);
|
|
31
|
-
if (measure !== undefined &&
|
|
32
|
-
(measure.depth > MAX_PATTERN_DEPTH ||
|
|
33
|
-
measure.edgeCounts.length > MAX_BRANCHES ||
|
|
34
|
-
Math.max(0, ...measure.edgeCounts) > MAX_EDGES ||
|
|
35
|
-
measure.domains.size > MAX_DOMAINS)) {
|
|
31
|
+
if (measure !== undefined && exceededLimits(measure).length > 0) {
|
|
36
32
|
fail(path, 'Policy expansion exceeds the V1 depth, branch, Edge, or Domain budget.');
|
|
37
33
|
}
|
|
38
34
|
const branches = typing.expandedBranches(name, `$${name}`);
|
|
@@ -98,10 +94,7 @@ function validatePolicyChecks(context, typing, entry, expression, input, receive
|
|
|
98
94
|
if (!checksNameTheCaller(expression)) {
|
|
99
95
|
fail(path, `${SITE[site].checks} must check a Policy on every branch: sameNode alone names no caller.`);
|
|
100
96
|
}
|
|
101
|
-
|
|
102
|
-
if (measure.depth > MAX_CHECK_DEPTH ||
|
|
103
|
-
measure.branches > MAX_BRANCHES ||
|
|
104
|
-
measure.leaves > MAX_CHECK_LEAVES) {
|
|
97
|
+
if (exceededLimits(measureChecks(expression)).length > 0) {
|
|
105
98
|
fail(path, `${SITE[site].checks} exceed the V1 depth, branch, or leaf budget.`);
|
|
106
99
|
}
|
|
107
100
|
const leaves = new Map();
|
|
@@ -2,7 +2,7 @@ import { Key } from '../../../../addressing/index.js';
|
|
|
2
2
|
import { PolicyTyping } from '../../../../language/policy/analysis/typing.js';
|
|
3
3
|
import {} from '../../../../language/policy/model/policy.js';
|
|
4
4
|
import {} from '../../../model/schema.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isCompiledEdge } from '../context.js';
|
|
6
6
|
import { referenceContract } from './contracts.js';
|
|
7
7
|
/** Types one entry's Policies against the Node Classes of its own closure, as source admission. */
|
|
8
8
|
export function compiledPolicyTyping(context, entry, normalized, origins) {
|
|
@@ -14,7 +14,7 @@ export function compiledPolicyTyping(context, entry, normalized, origins) {
|
|
|
14
14
|
allNodeClasses: nodeClasses.map((value) => value.ref),
|
|
15
15
|
concreteNodeClasses: nodeClasses.filter((value) => !value.abstract).map((value) => value.ref),
|
|
16
16
|
isLocalPolicy: (ref) => ref.origin === entry.origin && ref.kind === 'policy',
|
|
17
|
-
|
|
17
|
+
resolveClass: (ref) => context.classes.get(Key.of(ref))?.value,
|
|
18
18
|
edgeDeclaration: (ref) => {
|
|
19
19
|
const value = context.classes.get(Key.of(ref))?.value;
|
|
20
20
|
return value !== undefined && isCompiledEdge(value) ? value : undefined;
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schemas.astrale.ai/dsl/v1/draft-2020-12",
|
|
4
|
+
"title": "JSON Schema Draft 2020-12",
|
|
5
|
+
"$comment": "The Draft 2020-12 meta-schemas the V1 value-schema dialect composes, each under its own $id, exactly as the validator of the dialect embeds them. With value-schema.schema.json, they resolve the dialect without a network fetch.",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"schema": {
|
|
8
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
9
|
+
"$id": "https://json-schema.org/draft/2020-12/schema",
|
|
10
|
+
"$vocabulary": {
|
|
11
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true,
|
|
12
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
|
|
13
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
|
|
14
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true,
|
|
15
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true,
|
|
16
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
|
|
17
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
18
|
+
},
|
|
19
|
+
"$dynamicAnchor": "meta",
|
|
20
|
+
"title": "Core and Validation specifications meta-schema",
|
|
21
|
+
"allOf": [
|
|
22
|
+
{
|
|
23
|
+
"$ref": "meta/core"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"$ref": "meta/applicator"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"$ref": "meta/unevaluated"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"$ref": "meta/validation"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"$ref": "meta/meta-data"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"$ref": "meta/format-annotation"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"$ref": "meta/content"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"type": [
|
|
45
|
+
"object",
|
|
46
|
+
"boolean"
|
|
47
|
+
],
|
|
48
|
+
"$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
|
|
49
|
+
"properties": {
|
|
50
|
+
"definitions": {
|
|
51
|
+
"$comment": "\"definitions\" has been replaced by \"$defs\".",
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": {
|
|
54
|
+
"$dynamicRef": "#meta"
|
|
55
|
+
},
|
|
56
|
+
"deprecated": true,
|
|
57
|
+
"default": {}
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.",
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": {
|
|
63
|
+
"anyOf": [
|
|
64
|
+
{
|
|
65
|
+
"$dynamicRef": "#meta"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"$ref": "meta/validation#/$defs/stringArray"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"deprecated": true,
|
|
73
|
+
"default": {}
|
|
74
|
+
},
|
|
75
|
+
"$recursiveAnchor": {
|
|
76
|
+
"$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".",
|
|
77
|
+
"$ref": "meta/core#/$defs/anchorString",
|
|
78
|
+
"deprecated": true
|
|
79
|
+
},
|
|
80
|
+
"$recursiveRef": {
|
|
81
|
+
"$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".",
|
|
82
|
+
"$ref": "meta/core#/$defs/uriReferenceString",
|
|
83
|
+
"deprecated": true
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"core": {
|
|
88
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
89
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/core",
|
|
90
|
+
"$vocabulary": {
|
|
91
|
+
"https://json-schema.org/draft/2020-12/vocab/core": true
|
|
92
|
+
},
|
|
93
|
+
"$dynamicAnchor": "meta",
|
|
94
|
+
"title": "Core vocabulary meta-schema",
|
|
95
|
+
"type": [
|
|
96
|
+
"object",
|
|
97
|
+
"boolean"
|
|
98
|
+
],
|
|
99
|
+
"properties": {
|
|
100
|
+
"$id": {
|
|
101
|
+
"$ref": "#/$defs/uriReferenceString",
|
|
102
|
+
"$comment": "Non-empty fragments not allowed.",
|
|
103
|
+
"pattern": "^[^#]*#?$"
|
|
104
|
+
},
|
|
105
|
+
"$schema": {
|
|
106
|
+
"$ref": "#/$defs/uriString"
|
|
107
|
+
},
|
|
108
|
+
"$ref": {
|
|
109
|
+
"$ref": "#/$defs/uriReferenceString"
|
|
110
|
+
},
|
|
111
|
+
"$anchor": {
|
|
112
|
+
"$ref": "#/$defs/anchorString"
|
|
113
|
+
},
|
|
114
|
+
"$dynamicRef": {
|
|
115
|
+
"$ref": "#/$defs/uriReferenceString"
|
|
116
|
+
},
|
|
117
|
+
"$dynamicAnchor": {
|
|
118
|
+
"$ref": "#/$defs/anchorString"
|
|
119
|
+
},
|
|
120
|
+
"$vocabulary": {
|
|
121
|
+
"type": "object",
|
|
122
|
+
"propertyNames": {
|
|
123
|
+
"$ref": "#/$defs/uriString"
|
|
124
|
+
},
|
|
125
|
+
"additionalProperties": {
|
|
126
|
+
"type": "boolean"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"$comment": {
|
|
130
|
+
"type": "string"
|
|
131
|
+
},
|
|
132
|
+
"$defs": {
|
|
133
|
+
"type": "object",
|
|
134
|
+
"additionalProperties": {
|
|
135
|
+
"$dynamicRef": "#meta"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"$defs": {
|
|
140
|
+
"anchorString": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"pattern": "^[A-Za-z_][-A-Za-z0-9._]*$"
|
|
143
|
+
},
|
|
144
|
+
"uriString": {
|
|
145
|
+
"type": "string",
|
|
146
|
+
"format": "uri"
|
|
147
|
+
},
|
|
148
|
+
"uriReferenceString": {
|
|
149
|
+
"type": "string",
|
|
150
|
+
"format": "uri-reference"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"applicator": {
|
|
155
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
156
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/applicator",
|
|
157
|
+
"$vocabulary": {
|
|
158
|
+
"https://json-schema.org/draft/2020-12/vocab/applicator": true
|
|
159
|
+
},
|
|
160
|
+
"$dynamicAnchor": "meta",
|
|
161
|
+
"title": "Applicator vocabulary meta-schema",
|
|
162
|
+
"type": [
|
|
163
|
+
"object",
|
|
164
|
+
"boolean"
|
|
165
|
+
],
|
|
166
|
+
"properties": {
|
|
167
|
+
"prefixItems": {
|
|
168
|
+
"$ref": "#/$defs/schemaArray"
|
|
169
|
+
},
|
|
170
|
+
"items": {
|
|
171
|
+
"$dynamicRef": "#meta"
|
|
172
|
+
},
|
|
173
|
+
"contains": {
|
|
174
|
+
"$dynamicRef": "#meta"
|
|
175
|
+
},
|
|
176
|
+
"additionalProperties": {
|
|
177
|
+
"$dynamicRef": "#meta"
|
|
178
|
+
},
|
|
179
|
+
"properties": {
|
|
180
|
+
"type": "object",
|
|
181
|
+
"additionalProperties": {
|
|
182
|
+
"$dynamicRef": "#meta"
|
|
183
|
+
},
|
|
184
|
+
"default": {}
|
|
185
|
+
},
|
|
186
|
+
"patternProperties": {
|
|
187
|
+
"type": "object",
|
|
188
|
+
"additionalProperties": {
|
|
189
|
+
"$dynamicRef": "#meta"
|
|
190
|
+
},
|
|
191
|
+
"propertyNames": {
|
|
192
|
+
"format": "regex"
|
|
193
|
+
},
|
|
194
|
+
"default": {}
|
|
195
|
+
},
|
|
196
|
+
"dependentSchemas": {
|
|
197
|
+
"type": "object",
|
|
198
|
+
"additionalProperties": {
|
|
199
|
+
"$dynamicRef": "#meta"
|
|
200
|
+
},
|
|
201
|
+
"default": {}
|
|
202
|
+
},
|
|
203
|
+
"propertyNames": {
|
|
204
|
+
"$dynamicRef": "#meta"
|
|
205
|
+
},
|
|
206
|
+
"if": {
|
|
207
|
+
"$dynamicRef": "#meta"
|
|
208
|
+
},
|
|
209
|
+
"then": {
|
|
210
|
+
"$dynamicRef": "#meta"
|
|
211
|
+
},
|
|
212
|
+
"else": {
|
|
213
|
+
"$dynamicRef": "#meta"
|
|
214
|
+
},
|
|
215
|
+
"allOf": {
|
|
216
|
+
"$ref": "#/$defs/schemaArray"
|
|
217
|
+
},
|
|
218
|
+
"anyOf": {
|
|
219
|
+
"$ref": "#/$defs/schemaArray"
|
|
220
|
+
},
|
|
221
|
+
"oneOf": {
|
|
222
|
+
"$ref": "#/$defs/schemaArray"
|
|
223
|
+
},
|
|
224
|
+
"not": {
|
|
225
|
+
"$dynamicRef": "#meta"
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
"$defs": {
|
|
229
|
+
"schemaArray": {
|
|
230
|
+
"type": "array",
|
|
231
|
+
"minItems": 1,
|
|
232
|
+
"items": {
|
|
233
|
+
"$dynamicRef": "#meta"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
"unevaluated": {
|
|
239
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
240
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/unevaluated",
|
|
241
|
+
"$vocabulary": {
|
|
242
|
+
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true
|
|
243
|
+
},
|
|
244
|
+
"$dynamicAnchor": "meta",
|
|
245
|
+
"title": "Unevaluated applicator vocabulary meta-schema",
|
|
246
|
+
"type": [
|
|
247
|
+
"object",
|
|
248
|
+
"boolean"
|
|
249
|
+
],
|
|
250
|
+
"properties": {
|
|
251
|
+
"unevaluatedItems": {
|
|
252
|
+
"$dynamicRef": "#meta"
|
|
253
|
+
},
|
|
254
|
+
"unevaluatedProperties": {
|
|
255
|
+
"$dynamicRef": "#meta"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"validation": {
|
|
260
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
261
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/validation",
|
|
262
|
+
"$vocabulary": {
|
|
263
|
+
"https://json-schema.org/draft/2020-12/vocab/validation": true
|
|
264
|
+
},
|
|
265
|
+
"$dynamicAnchor": "meta",
|
|
266
|
+
"title": "Validation vocabulary meta-schema",
|
|
267
|
+
"type": [
|
|
268
|
+
"object",
|
|
269
|
+
"boolean"
|
|
270
|
+
],
|
|
271
|
+
"properties": {
|
|
272
|
+
"type": {
|
|
273
|
+
"anyOf": [
|
|
274
|
+
{
|
|
275
|
+
"$ref": "#/$defs/simpleTypes"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"type": "array",
|
|
279
|
+
"items": {
|
|
280
|
+
"$ref": "#/$defs/simpleTypes"
|
|
281
|
+
},
|
|
282
|
+
"minItems": 1,
|
|
283
|
+
"uniqueItems": true
|
|
284
|
+
}
|
|
285
|
+
]
|
|
286
|
+
},
|
|
287
|
+
"const": true,
|
|
288
|
+
"enum": {
|
|
289
|
+
"type": "array",
|
|
290
|
+
"items": true
|
|
291
|
+
},
|
|
292
|
+
"multipleOf": {
|
|
293
|
+
"type": "number",
|
|
294
|
+
"exclusiveMinimum": 0
|
|
295
|
+
},
|
|
296
|
+
"maximum": {
|
|
297
|
+
"type": "number"
|
|
298
|
+
},
|
|
299
|
+
"exclusiveMaximum": {
|
|
300
|
+
"type": "number"
|
|
301
|
+
},
|
|
302
|
+
"minimum": {
|
|
303
|
+
"type": "number"
|
|
304
|
+
},
|
|
305
|
+
"exclusiveMinimum": {
|
|
306
|
+
"type": "number"
|
|
307
|
+
},
|
|
308
|
+
"maxLength": {
|
|
309
|
+
"$ref": "#/$defs/nonNegativeInteger"
|
|
310
|
+
},
|
|
311
|
+
"minLength": {
|
|
312
|
+
"$ref": "#/$defs/nonNegativeIntegerDefault0"
|
|
313
|
+
},
|
|
314
|
+
"pattern": {
|
|
315
|
+
"type": "string",
|
|
316
|
+
"format": "regex"
|
|
317
|
+
},
|
|
318
|
+
"maxItems": {
|
|
319
|
+
"$ref": "#/$defs/nonNegativeInteger"
|
|
320
|
+
},
|
|
321
|
+
"minItems": {
|
|
322
|
+
"$ref": "#/$defs/nonNegativeIntegerDefault0"
|
|
323
|
+
},
|
|
324
|
+
"uniqueItems": {
|
|
325
|
+
"type": "boolean",
|
|
326
|
+
"default": false
|
|
327
|
+
},
|
|
328
|
+
"maxContains": {
|
|
329
|
+
"$ref": "#/$defs/nonNegativeInteger"
|
|
330
|
+
},
|
|
331
|
+
"minContains": {
|
|
332
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
333
|
+
"default": 1
|
|
334
|
+
},
|
|
335
|
+
"maxProperties": {
|
|
336
|
+
"$ref": "#/$defs/nonNegativeInteger"
|
|
337
|
+
},
|
|
338
|
+
"minProperties": {
|
|
339
|
+
"$ref": "#/$defs/nonNegativeIntegerDefault0"
|
|
340
|
+
},
|
|
341
|
+
"required": {
|
|
342
|
+
"$ref": "#/$defs/stringArray"
|
|
343
|
+
},
|
|
344
|
+
"dependentRequired": {
|
|
345
|
+
"type": "object",
|
|
346
|
+
"additionalProperties": {
|
|
347
|
+
"$ref": "#/$defs/stringArray"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"$defs": {
|
|
352
|
+
"nonNegativeInteger": {
|
|
353
|
+
"type": "integer",
|
|
354
|
+
"minimum": 0
|
|
355
|
+
},
|
|
356
|
+
"nonNegativeIntegerDefault0": {
|
|
357
|
+
"$ref": "#/$defs/nonNegativeInteger",
|
|
358
|
+
"default": 0
|
|
359
|
+
},
|
|
360
|
+
"simpleTypes": {
|
|
361
|
+
"enum": [
|
|
362
|
+
"array",
|
|
363
|
+
"boolean",
|
|
364
|
+
"integer",
|
|
365
|
+
"null",
|
|
366
|
+
"number",
|
|
367
|
+
"object",
|
|
368
|
+
"string"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
"stringArray": {
|
|
372
|
+
"type": "array",
|
|
373
|
+
"items": {
|
|
374
|
+
"type": "string"
|
|
375
|
+
},
|
|
376
|
+
"uniqueItems": true,
|
|
377
|
+
"default": []
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
"meta-data": {
|
|
382
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
383
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/meta-data",
|
|
384
|
+
"$vocabulary": {
|
|
385
|
+
"https://json-schema.org/draft/2020-12/vocab/meta-data": true
|
|
386
|
+
},
|
|
387
|
+
"$dynamicAnchor": "meta",
|
|
388
|
+
"title": "Meta-data vocabulary meta-schema",
|
|
389
|
+
"type": [
|
|
390
|
+
"object",
|
|
391
|
+
"boolean"
|
|
392
|
+
],
|
|
393
|
+
"properties": {
|
|
394
|
+
"title": {
|
|
395
|
+
"type": "string"
|
|
396
|
+
},
|
|
397
|
+
"description": {
|
|
398
|
+
"type": "string"
|
|
399
|
+
},
|
|
400
|
+
"default": true,
|
|
401
|
+
"deprecated": {
|
|
402
|
+
"type": "boolean",
|
|
403
|
+
"default": false
|
|
404
|
+
},
|
|
405
|
+
"readOnly": {
|
|
406
|
+
"type": "boolean",
|
|
407
|
+
"default": false
|
|
408
|
+
},
|
|
409
|
+
"writeOnly": {
|
|
410
|
+
"type": "boolean",
|
|
411
|
+
"default": false
|
|
412
|
+
},
|
|
413
|
+
"examples": {
|
|
414
|
+
"type": "array",
|
|
415
|
+
"items": true
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
"format-annotation": {
|
|
420
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
421
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/format-annotation",
|
|
422
|
+
"$vocabulary": {
|
|
423
|
+
"https://json-schema.org/draft/2020-12/vocab/format-annotation": true
|
|
424
|
+
},
|
|
425
|
+
"$dynamicAnchor": "meta",
|
|
426
|
+
"title": "Format vocabulary meta-schema for annotation results",
|
|
427
|
+
"type": [
|
|
428
|
+
"object",
|
|
429
|
+
"boolean"
|
|
430
|
+
],
|
|
431
|
+
"properties": {
|
|
432
|
+
"format": {
|
|
433
|
+
"type": "string"
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
"content": {
|
|
438
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
439
|
+
"$id": "https://json-schema.org/draft/2020-12/meta/content",
|
|
440
|
+
"$vocabulary": {
|
|
441
|
+
"https://json-schema.org/draft/2020-12/vocab/content": true
|
|
442
|
+
},
|
|
443
|
+
"$dynamicAnchor": "meta",
|
|
444
|
+
"title": "Content vocabulary meta-schema",
|
|
445
|
+
"type": [
|
|
446
|
+
"object",
|
|
447
|
+
"boolean"
|
|
448
|
+
],
|
|
449
|
+
"properties": {
|
|
450
|
+
"contentEncoding": {
|
|
451
|
+
"type": "string"
|
|
452
|
+
},
|
|
453
|
+
"contentMediaType": {
|
|
454
|
+
"type": "string"
|
|
455
|
+
},
|
|
456
|
+
"contentSchema": {
|
|
457
|
+
"$dynamicRef": "#meta"
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { ClassRef } from '../../addressing/index.js';
|
|
2
2
|
import type { EdgeContract, EdgeCount, EdgeEndpointBase, IncidentEndpoint } from '../class/model/edge.js';
|
|
3
|
+
/**
|
|
4
|
+
* The Class of the owning Domain's Node: every Domain principal is a Node of the final Kernel
|
|
5
|
+
* `Domain` Class, so a Core Edge that names the Domain must accept that Class at that endpoint.
|
|
6
|
+
*/
|
|
7
|
+
export declare const DOMAIN_ENDPOINT_CLASS: ClassRef;
|
|
3
8
|
/** One endpoint of a Core Edge: a Core Node, a projected member or the owning Domain. */
|
|
4
9
|
export interface CoreFactEndpoint {
|
|
5
10
|
readonly key: string;
|
|
6
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Set on a projected member and on the owning Domain: the Kernel Class it is a Node of, and where
|
|
13
|
+
* a breach of its degree is reported.
|
|
14
|
+
*/
|
|
7
15
|
readonly member?: {
|
|
8
16
|
readonly class: ClassRef;
|
|
9
17
|
readonly pointer: string;
|
|
@@ -26,10 +34,12 @@ export interface CoreDegreeSubject {
|
|
|
26
34
|
}
|
|
27
35
|
export interface CoreEdgeSet<Edge> {
|
|
28
36
|
readonly edges: readonly CoreFactEdge<Edge>[];
|
|
29
|
-
/** The local
|
|
37
|
+
/** The local Edge Classes, in the order their slices are checked. */
|
|
30
38
|
readonly classes: readonly {
|
|
31
39
|
readonly key: string;
|
|
32
|
-
readonly contract: EdgeContract
|
|
40
|
+
readonly contract: EdgeContract & {
|
|
41
|
+
readonly abstract: boolean;
|
|
42
|
+
};
|
|
33
43
|
}[];
|
|
34
44
|
readonly nodes: readonly CoreDegreeSubject[];
|
|
35
45
|
readonly satisfies: (ref: ClassRef, accepts: readonly ClassRef[]) => boolean;
|
|
@@ -68,5 +78,8 @@ export declare function coreEndpointsSatisfy<Endpoint>(contract: EdgeContract, s
|
|
|
68
78
|
* DV-EDGE-UNIQUE); Activation checks them against stored data.
|
|
69
79
|
*/
|
|
70
80
|
export declare function checkHeldKeys<Fact>(facts: Iterable<Fact>, keys: (fact: Fact) => readonly string[], report: (fact: Fact, previous: Fact) => void): void;
|
|
71
|
-
/**
|
|
81
|
+
/**
|
|
82
|
+
* Check normalized Edge identity, noSelf, keys, and the acyclicity and Core degrees of each exact
|
|
83
|
+
* concrete Edge Class over its own Edges.
|
|
84
|
+
*/
|
|
72
85
|
export declare function checkCoreEdgeSet<Edge>(set: CoreEdgeSet<Edge>): void;
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { compareUnicode } from '../../addressing/ordering.js';
|
|
2
|
-
import { countBounds, hasDirectedCycle } from '../class/inheritance.js';
|
|
2
|
+
import { countBounds, hasDirectedCycle, KERNEL_ORIGIN } from '../class/inheritance.js';
|
|
3
|
+
/*
|
|
4
|
+
* The Core fact rules that authored and compiled admission share. Each admission resolves its own
|
|
5
|
+
* Core Nodes and Edges, then reports every issue under its own codes, messages and pointers.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The Class of the owning Domain's Node: every Domain principal is a Node of the final Kernel
|
|
9
|
+
* `Domain` Class, so a Core Edge that names the Domain must accept that Class at that endpoint.
|
|
10
|
+
*/
|
|
11
|
+
export const DOMAIN_ENDPOINT_CLASS = Object.freeze({
|
|
12
|
+
origin: KERNEL_ORIGIN,
|
|
13
|
+
kind: 'class',
|
|
14
|
+
name: 'Domain',
|
|
15
|
+
});
|
|
3
16
|
/** Whether the endpoints satisfy the contract: in order when directed, in either order when not. */
|
|
4
17
|
export function coreEndpointsSatisfy(contract, source, target, satisfies) {
|
|
5
18
|
if (contract.orientation === 'directed') {
|
|
@@ -27,7 +40,10 @@ export function checkHeldKeys(facts, keys, report) {
|
|
|
27
40
|
holders.set(key, fact);
|
|
28
41
|
}
|
|
29
42
|
}
|
|
30
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Check normalized Edge identity, noSelf, keys, and the acyclicity and Core degrees of each exact
|
|
45
|
+
* concrete Edge Class over its own Edges.
|
|
46
|
+
*/
|
|
31
47
|
export function checkCoreEdgeSet(set) {
|
|
32
48
|
const identities = new Map();
|
|
33
49
|
const slices = new Map(set.classes.map(({ key }) => [key, []]));
|
|
@@ -48,6 +64,10 @@ export function checkCoreEdgeSet(set) {
|
|
|
48
64
|
}
|
|
49
65
|
checkHeldKeys(set.edges, set.keys, (fact, previous) => set.report({ kind: 'key', edge: fact.edge, previous: previous.edge }));
|
|
50
66
|
for (const { key, contract } of set.classes) {
|
|
67
|
+
// No Edge is of an abstract Class exactly, so it bounds no degree and closes no cycle of its
|
|
68
|
+
// own: each concrete descendant carries the counts it refines, over its own Edges.
|
|
69
|
+
if (contract.abstract)
|
|
70
|
+
continue;
|
|
51
71
|
const slice = slices.get(key);
|
|
52
72
|
if (contract.constraints.acyclic === true && hasDirectedCycle(slice))
|
|
53
73
|
set.report({ kind: 'acyclic', class: key });
|
|
@@ -78,9 +98,10 @@ function checkDegrees(set, contract, slice) {
|
|
|
78
98
|
}
|
|
79
99
|
}
|
|
80
100
|
/**
|
|
81
|
-
* Every declared Core Node proves its own complete degree, so both bounds hold. A projected member
|
|
82
|
-
* is only named by the Edges that reach it: the Domain may also create
|
|
83
|
-
* Class against it, so a minimum is unprovable here and only the maximum
|
|
101
|
+
* Every declared Core Node proves its own complete degree, so both bounds hold. A projected member,
|
|
102
|
+
* and the owning Domain, is only named by the Edges that reach it: the Domain may also create
|
|
103
|
+
* ordinary Edges of the same Class against it, so a minimum is unprovable here and only the maximum
|
|
104
|
+
* is enforced.
|
|
84
105
|
*/
|
|
85
106
|
function degreeSubjects(nodes, slice) {
|
|
86
107
|
const subjects = new Map(nodes.map((node) => [node.key, { ...node, minimum: true }]));
|