@astrale-os/kernel-dsl 1.0.0-beta.27 → 1.0.0-beta.28
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/ordering.d.ts +2 -2
- package/dist/v1/addressing/ordering.js +2 -4
- package/dist/v1/builder/index.d.ts +2 -0
- package/dist/v1/builder/index.js +1 -0
- package/dist/v1/builder/schema/rule.d.ts +316 -0
- package/dist/v1/builder/schema/rule.js +192 -0
- package/dist/v1/bundle/index.d.ts +2 -0
- package/dist/v1/bundle/index.js +1 -0
- package/dist/v1/bundle/rule.d.ts +14 -0
- package/dist/v1/bundle/rule.js +41 -0
- package/dist/v1/compiled/admission/diagnostic.d.ts +14 -0
- package/dist/v1/compiled/admission/diagnostic.js +6 -0
- package/dist/v1/compiled/admission/semantics/policy/callable.js +2 -3
- package/dist/v1/compiled/admission/semantics/policy/parity.js +8 -13
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +3 -5
- package/dist/v1/compiled/admission/wire/policy.js +16 -11
- package/dist/v1/compiled/index.d.ts +2 -0
- package/dist/v1/compiled/index.js +1 -0
- package/dist/v1/compiled/rule.d.ts +49 -0
- package/dist/v1/compiled/rule.js +169 -0
- package/dist/v1/language/callable/admission.js +2 -1
- package/dist/v1/language/policy/analysis/branches.js +6 -7
- package/dist/v1/language/policy/analysis/budgets.js +8 -6
- package/dist/v1/language/policy/analysis/checks.js +5 -4
- package/dist/v1/language/policy/analysis/composition.js +2 -2
- package/dist/v1/language/policy/analysis/typing.js +3 -2
- package/dist/v1/language/policy/model/policy.d.ts +22 -0
- package/dist/v1/language/policy/model/policy.js +28 -4
- package/dist/v1/language/policy/normalization/normalize.js +33 -56
- package/dist/v1/language/value/evaluate/assertions.d.ts +2 -2
- package/dist/v1/language/value/evaluate/assertions.js +4 -34
- package/dist/v1/language/value/evaluate/evaluator.js +10 -15
- package/dist/v1/language/value/evaluate/validity.optimization.js +9 -14
- package/dist/v1/language/value/files.js +2 -1
- package/dist/v1/language/value/ordering.js +1 -3
- package/dist/v1/language/value/profile/canonicalize.js +1 -3
- package/dist/v1/language/value/syntax/walk.d.ts +2 -0
- package/dist/v1/language/value/syntax/walk.js +4 -0
- package/dist/v1/schema/compatibility/api.d.ts +2 -0
- package/dist/v1/schema/compatibility/api.js +1 -0
- package/dist/v1/schema/compatibility/rule.d.ts +13 -0
- package/dist/v1/schema/compatibility/rule.js +23 -0
- package/dist/v1/schema/enforcement/changes.d.ts +590 -0
- package/dist/v1/schema/enforcement/changes.js +566 -0
- package/dist/v1/schema/enforcement/derived.d.ts +236 -0
- package/dist/v1/schema/enforcement/derived.js +243 -0
- package/dist/v1/schema/enforcement/dispose.d.ts +308 -0
- package/dist/v1/schema/enforcement/dispose.js +275 -0
- package/dist/v1/schema/enforcement/facts.d.ts +89 -0
- package/dist/v1/schema/enforcement/facts.js +70 -0
- package/dist/v1/schema/enforcement/fields.d.ts +65 -0
- package/dist/v1/schema/enforcement/fields.js +36 -0
- package/dist/v1/schema/enforcement/index.d.ts +39 -0
- package/dist/v1/schema/enforcement/index.js +10 -0
- package/dist/v1/schema/enforcement/install.d.ts +1634 -0
- package/dist/v1/schema/enforcement/install.js +1223 -0
- package/dist/v1/schema/enforcement/lifecycle.d.ts +87 -0
- package/dist/v1/schema/enforcement/lifecycle.js +91 -0
- package/dist/v1/schema/enforcement/model.d.ts +253 -0
- package/dist/v1/schema/enforcement/model.js +1 -0
- package/dist/v1/schema/enforcement/obligations.d.ts +248 -0
- package/dist/v1/schema/enforcement/obligations.js +240 -0
- package/dist/v1/schema/enforcement/write.d.ts +1314 -0
- package/dist/v1/schema/enforcement/write.js +1017 -0
- package/dist/v1/schema/index.d.ts +1 -0
- package/dist/v1/schema/index.js +1 -0
- package/dist/v1/schema/resolution/origins.js +4 -7
- package/dist/v1/schema/rule.d.ts +4 -5
- package/dist/v1/schema/rule.js +19 -13
- package/dist/v1/schema/validation/policy/references.js +5 -11
- package/dist/v1/schema/validation/policy/uses.js +3 -8
- package/dist/value/canonical.d.ts +16 -1
- package/dist/value/canonical.js +90 -33
- package/dist/value/index.d.ts +2 -0
- package/dist/value/index.js +1 -0
- package/dist/value/rule.d.ts +12 -0
- package/dist/value/rule.js +50 -0
- package/package.json +5 -1
|
@@ -3,10 +3,10 @@ import { branchesOf, targetMode, isConnected, } from '../../../../language/polic
|
|
|
3
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
|
-
import { CLASS_OPERATIONS, checksNameTheCaller, isClassRuleChecks, } from '../../../../language/policy/model/policy.js';
|
|
6
|
+
import { CLASS_OPERATIONS, checksNameTheCaller, isClassRuleChecks, PolicyComposition, } from '../../../../language/policy/model/policy.js';
|
|
7
7
|
import { normalizePolicyExpression } from '../../../../language/policy/normalization/normalize.js';
|
|
8
8
|
import {} from '../../../model/schema.js';
|
|
9
|
-
import { fail } from '../../diagnostic.js';
|
|
9
|
+
import { fail, POLICY_CHECK_SITE } from '../../diagnostic.js';
|
|
10
10
|
import { isCompiledEdge, } from '../context.js';
|
|
11
11
|
import { callableObjectContracts } from './contracts.js';
|
|
12
12
|
import { compiledPolicyTyping } from './typing.js';
|
|
@@ -84,17 +84,13 @@ export function validatePolicyParity(context, entry, entryIndex, policies, origi
|
|
|
84
84
|
function declarationIndex(entry, kind, name) {
|
|
85
85
|
return entry.definitions[kind].findIndex(({ ref }) => ref.name === name);
|
|
86
86
|
}
|
|
87
|
-
/** How a refusal names the checks of each site and the contract of their objects. */
|
|
88
|
-
const SITE = {
|
|
89
|
-
callable: { checks: 'Callable Policy checks', objects: 'the callable object contract' },
|
|
90
|
-
class: { checks: 'Class rule checks', objects: 'the Class rule object contract' },
|
|
91
|
-
};
|
|
92
87
|
function validatePolicyChecks(context, typing, entry, expression, input, receiver, path, site, edge) {
|
|
88
|
+
const label = POLICY_CHECK_SITE[site];
|
|
93
89
|
if (!checksNameTheCaller(expression)) {
|
|
94
|
-
fail(path, `${
|
|
90
|
+
fail(path, `${label.name} checks must check a Policy on every branch: sameNode alone names no caller.`);
|
|
95
91
|
}
|
|
96
92
|
if (exceededLimits(measureChecks(expression)).length > 0) {
|
|
97
|
-
fail(path, `${
|
|
93
|
+
fail(path, `${label.name} checks exceed the V1 depth, branch, or leaf budget.`);
|
|
98
94
|
}
|
|
99
95
|
const leaves = new Map();
|
|
100
96
|
const visit = (value, pointer) => {
|
|
@@ -106,8 +102,7 @@ function validatePolicyChecks(context, typing, entry, expression, input, receive
|
|
|
106
102
|
return;
|
|
107
103
|
}
|
|
108
104
|
if (!('check' in value)) {
|
|
109
|
-
|
|
110
|
-
children.forEach((child, index) => visit(child, `${pointer}/${index}`));
|
|
105
|
+
PolicyComposition.of(value).operands.forEach((child, index) => visit(child, `${pointer}/${index}`));
|
|
111
106
|
return;
|
|
112
107
|
}
|
|
113
108
|
if (edge !== undefined && value.object.kind === 'self') {
|
|
@@ -123,13 +118,13 @@ function validatePolicyChecks(context, typing, entry, expression, input, receive
|
|
|
123
118
|
return;
|
|
124
119
|
const classes = typing.checkLeafClasses(value.check.name, contracts);
|
|
125
120
|
if (classes === undefined) {
|
|
126
|
-
fail(pointer, `Named Policy is incompatible with ${
|
|
121
|
+
fail(pointer, `Named Policy is incompatible with ${label.objects}.`);
|
|
127
122
|
}
|
|
128
123
|
leaves.set(value, classes);
|
|
129
124
|
};
|
|
130
125
|
visit(expression, path);
|
|
131
126
|
const [never] = neverAdmittedClasses(expression, leaves);
|
|
132
127
|
if (never !== undefined) {
|
|
133
|
-
fail(path, `${
|
|
128
|
+
fail(path, `${label.name} checks can never admit ${never[0]} of Class ${never[1]}.`);
|
|
134
129
|
}
|
|
135
130
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Key } from '../../../../addressing/index.js';
|
|
2
2
|
import { isMethodExecutable } from '../../../../language/callable/executable.js';
|
|
3
3
|
import { policyVariableClass } from '../../../../language/index.js';
|
|
4
|
-
import {} from '../../../../language/policy/model/policy.js';
|
|
4
|
+
import { PolicyComposition, } from '../../../../language/policy/model/policy.js';
|
|
5
5
|
import {} from '../../../model/schema.js';
|
|
6
6
|
import { fail } from '../../diagnostic.js';
|
|
7
7
|
import {} from '../context.js';
|
|
@@ -14,8 +14,7 @@ export function validatePolicyExpression(context, entry, expression, path, local
|
|
|
14
14
|
validatePattern(context, expression.match, `${path}/match`, new Set(), new Set());
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
for (const [index, ref] of values.entries()) {
|
|
17
|
+
for (const [index, ref] of PolicyComposition.of(expression).operands.entries()) {
|
|
19
18
|
if (ref.origin !== entry.origin || ref.kind !== 'policy' || !local.has(ref.name))
|
|
20
19
|
fail(`${path}/${index}`, 'Named Policy composition must reference a local Policy.');
|
|
21
20
|
}
|
|
@@ -48,8 +47,7 @@ function validatePattern(context, expression, path, scope, declared) {
|
|
|
48
47
|
validatePattern(context, expression.exists.where, `${path}/exists/where`, nested, declared);
|
|
49
48
|
return;
|
|
50
49
|
}
|
|
51
|
-
|
|
52
|
-
values.forEach((value, index) => validatePattern(context, value, `${path}/${index}`, scope, declared));
|
|
50
|
+
PolicyComposition.of(expression).operands.forEach((value, index) => validatePattern(context, value, `${path}/${index}`, scope, declared));
|
|
53
51
|
}
|
|
54
52
|
function validatePolicyTerm(context, term, path, scope) {
|
|
55
53
|
if (term.kind === 'ref' && term.ref.kind === 'method')
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { equal } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { Key } from '../../../addressing/index.js';
|
|
3
|
+
import { limits } from '../../../language/limits.js';
|
|
3
4
|
import { normalizeClassRule } from '../../../language/policy/normalization/normalize.js';
|
|
4
|
-
import { invalid, pointer } from '../diagnostic.js';
|
|
5
|
+
import { invalid, pointer, POLICY_CHECK_SITE } from '../diagnostic.js';
|
|
5
6
|
import { definitionRef, policyObjectRef } from './reference.js';
|
|
6
7
|
import { object, exact, description, array, unique, boundedInteger, integer, memberName, } from './value.js';
|
|
8
|
+
/**
|
|
9
|
+
* The nesting a decoder follows before refusing: a structural guard for the recursion, far above
|
|
10
|
+
* the depths `limits.policy` admits, which the semantic checks enforce.
|
|
11
|
+
*/
|
|
12
|
+
const WIRE_DEPTH = 64;
|
|
7
13
|
/** Decode a named Policy and its expression grammar. */
|
|
8
14
|
export function compiledPolicy(input, path) {
|
|
9
15
|
const value = object(input, 'Policy', path);
|
|
@@ -14,7 +20,7 @@ export function compiledPolicy(input, path) {
|
|
|
14
20
|
return value;
|
|
15
21
|
}
|
|
16
22
|
function policyExpression(input, depth, path) {
|
|
17
|
-
if (depth >
|
|
23
|
+
if (depth > WIRE_DEPTH)
|
|
18
24
|
invalid('Policy expression depth', undefined, path);
|
|
19
25
|
const value = object(input, 'Policy expression', path);
|
|
20
26
|
if (Object.hasOwn(value, 'match')) {
|
|
@@ -31,7 +37,7 @@ function policyExpression(input, depth, path) {
|
|
|
31
37
|
unique(refs.map(Key.of), `Policy ${member}`, memberPath);
|
|
32
38
|
}
|
|
33
39
|
function policyPattern(input, depth, path) {
|
|
34
|
-
if (depth >
|
|
40
|
+
if (depth > WIRE_DEPTH)
|
|
35
41
|
invalid('Policy pattern depth', undefined, path);
|
|
36
42
|
const value = object(input, 'Policy pattern', path);
|
|
37
43
|
if (Object.hasOwn(value, 'sameNode')) {
|
|
@@ -49,7 +55,7 @@ function policyPattern(input, depth, path) {
|
|
|
49
55
|
exact(exists, ['nodes', 'where'], 'Policy exists', existsPath);
|
|
50
56
|
const nodesPath = `${existsPath}/nodes`;
|
|
51
57
|
const nodes = array(exists.nodes, 'Policy variables', nodesPath);
|
|
52
|
-
if (nodes.length < 1 || nodes.length >
|
|
58
|
+
if (nodes.length < 1 || nodes.length > limits.policy.variablesPerExists)
|
|
53
59
|
invalid('Policy variables', undefined, nodesPath);
|
|
54
60
|
for (const [index, node] of nodes.entries()) {
|
|
55
61
|
const variablePath = `${nodesPath}/${index}`;
|
|
@@ -97,8 +103,9 @@ function policyPattern(input, depth, path) {
|
|
|
97
103
|
const repeatPath = `${path}/repeat`;
|
|
98
104
|
const repeat = object(value.repeat, 'Policy repeat', repeatPath);
|
|
99
105
|
exact(repeat, ['min', 'max'], 'Policy repeat', repeatPath);
|
|
100
|
-
const
|
|
101
|
-
const
|
|
106
|
+
const { repetition } = limits.policy;
|
|
107
|
+
const minimum = boundedInteger(repeat.min, 0, repetition, 'Policy repeat minimum', `${repeatPath}/min`);
|
|
108
|
+
const maximum = boundedInteger(repeat.max, 0, repetition, 'Policy repeat maximum', `${repeatPath}/max`);
|
|
102
109
|
if (minimum > maximum)
|
|
103
110
|
invalid('Policy repeat order', undefined, repeatPath);
|
|
104
111
|
}
|
|
@@ -141,12 +148,10 @@ export function classRuleChecks(input, path, site) {
|
|
|
141
148
|
invalid('Class rule spelling', undefined, path);
|
|
142
149
|
}
|
|
143
150
|
}
|
|
144
|
-
/** What a site calls its checks in a refusal. */
|
|
145
|
-
const SITE = { callable: 'Callable Policy', class: 'Class rule', create: 'Create rule' };
|
|
146
151
|
/** Check the recursive Policy check wire grammar of one use site. */
|
|
147
152
|
function policyCheck(input, depth, path, site = 'callable') {
|
|
148
|
-
const name =
|
|
149
|
-
if (depth >
|
|
153
|
+
const { name } = POLICY_CHECK_SITE[site];
|
|
154
|
+
if (depth > WIRE_DEPTH)
|
|
150
155
|
invalid(`${name} depth`, undefined, path);
|
|
151
156
|
const value = object(input, name, path);
|
|
152
157
|
if (Object.hasOwn(value, 'sameNode')) {
|
|
@@ -174,7 +179,7 @@ function policyCheck(input, depth, path, site = 'callable') {
|
|
|
174
179
|
policyCheck(expression, depth + 1, `${memberPath}/${index}`, site);
|
|
175
180
|
}
|
|
176
181
|
function policyCheckObject(input, objectPath, site) {
|
|
177
|
-
const name =
|
|
182
|
+
const { name } = POLICY_CHECK_SITE[site];
|
|
178
183
|
const target = object(input, `${name} object`, objectPath);
|
|
179
184
|
if (target.kind === 'self' && site !== 'create')
|
|
180
185
|
exact(target, ['kind'], `${name} self`, objectPath);
|
|
@@ -2,6 +2,8 @@ export { acceptCompiledSchema as accept } from './admission/accept.js';
|
|
|
2
2
|
export { compile } from './compiler/compile.js';
|
|
3
3
|
export { decode, encode } from './codec/json.js';
|
|
4
4
|
export { load } from './loader/load.js';
|
|
5
|
+
export { COMPILED_RULES as RULES, READMITTED_RULES, READMITTED_VALUE_RULES } from './rule.js';
|
|
6
|
+
export type { CompiledRule as Rule, ReadmittedRule } from './rule.js';
|
|
5
7
|
export { CompiledSchemaError as Error } from './diagnostic.js';
|
|
6
8
|
export type { CompiledDiagnostic as Diagnostic, CompiledDiagnosticCode as DiagnosticCode, } from './diagnostic.js';
|
|
7
9
|
export type * from './model/schema.js';
|
|
@@ -2,4 +2,5 @@ export { acceptCompiledSchema as accept } from './admission/accept.js';
|
|
|
2
2
|
export { compile } from './compiler/compile.js';
|
|
3
3
|
export { decode, encode } from './codec/json.js';
|
|
4
4
|
export { load } from './loader/load.js';
|
|
5
|
+
export { COMPILED_RULES as RULES, READMITTED_RULES, READMITTED_VALUE_RULES } from './rule.js';
|
|
5
6
|
export { CompiledSchemaError as Error } from './diagnostic.js';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { BoundaryErrorCode } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { LimitKey } from '../language/limits.js';
|
|
3
|
+
import type { DiagnosticCode as ValueDiagnosticCode } from '../language/validation/diagnostic.js';
|
|
4
|
+
import type { SchemaDiagnosticCode } from '../schema/diagnostic.js';
|
|
5
|
+
import type { CompiledDiagnosticCode } from './diagnostic.js';
|
|
6
|
+
/** The rule one diagnostic code of a compiled Schema reports. */
|
|
7
|
+
export interface CompiledRule {
|
|
8
|
+
/** The positions its diagnostics point at, as the positions of `schema.Rule`. */
|
|
9
|
+
readonly positions: readonly [string, ...string[]];
|
|
10
|
+
/** The rule, in one plain sentence. */
|
|
11
|
+
readonly statement: string;
|
|
12
|
+
/** The limits of `schema.limits` the rule enforces, by key, where it enforces some. */
|
|
13
|
+
readonly limits?: readonly [LimitKey, ...LimitKey[]];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Every diagnostic code of a compiled Schema with the rule it reports, frozen. A code added here
|
|
17
|
+
* does not compile until it is described.
|
|
18
|
+
*/
|
|
19
|
+
export declare const COMPILED_RULES: Readonly<Record<CompiledDiagnosticCode, CompiledRule>>;
|
|
20
|
+
/** How admission of a compiled Schema holds one rule of the language. */
|
|
21
|
+
export type ReadmittedRule = {
|
|
22
|
+
/** A compiled Schema breaking the rule is refused, under one of these codes. */
|
|
23
|
+
readonly kind: 'refused';
|
|
24
|
+
readonly answers: readonly [CompiledDiagnosticCode, ...CompiledDiagnosticCode[]];
|
|
25
|
+
/** The part of the rule a compiled Schema may break and still load. */
|
|
26
|
+
readonly except?: string;
|
|
27
|
+
} | {
|
|
28
|
+
/** The portable value boundary refuses it before admission: `COMPILED_STRUCTURE_INVALID`, caused by one of these. */
|
|
29
|
+
readonly kind: 'portable';
|
|
30
|
+
readonly answers: readonly [BoundaryErrorCode, ...BoundaryErrorCode[]];
|
|
31
|
+
} | {
|
|
32
|
+
/** A compiled Schema has no position for what the rule reads. */
|
|
33
|
+
readonly kind: 'unsayable';
|
|
34
|
+
readonly because: string;
|
|
35
|
+
} | {
|
|
36
|
+
/** A compiled Schema breaking the rule loads, for the reason given. */
|
|
37
|
+
readonly kind: 'unapplied';
|
|
38
|
+
readonly because: string;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Every rule of a source with how admission of a compiled Schema holds it, frozen. A rule added to
|
|
42
|
+
* the language does not compile until it is placed here.
|
|
43
|
+
*/
|
|
44
|
+
export declare const READMITTED_RULES: Readonly<Record<SchemaDiagnosticCode, ReadmittedRule>>;
|
|
45
|
+
/**
|
|
46
|
+
* Every rule of a value schema with how admission of a compiled Schema holds it, frozen. A rule added
|
|
47
|
+
* to the value language does not compile until it is placed here.
|
|
48
|
+
*/
|
|
49
|
+
export declare const READMITTED_VALUE_RULES: Readonly<Record<Extract<ValueDiagnosticCode, `VS_${string}`>, ReadmittedRule>>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { deepFreeze } from '../language/freeze.js';
|
|
2
|
+
import { limits } from '../language/limits.js';
|
|
3
|
+
/**
|
|
4
|
+
* Every diagnostic code of a compiled Schema with the rule it reports, frozen. A code added here
|
|
5
|
+
* does not compile until it is described.
|
|
6
|
+
*/
|
|
7
|
+
export const COMPILED_RULES = deepFreeze({
|
|
8
|
+
COMPILED_STRUCTURE_INVALID: {
|
|
9
|
+
positions: ['{/path*}'],
|
|
10
|
+
statement: `A compiled Schema is a portable value, has its format and version and exactly the fields of its wire shape, holds each origin once in its closure, spells each Class rule in its normal form, and its root and every pin name a revision of that closure. It holds at most ${limits.closure.members} members and items. An entry past the limits of the canonical encoder has no revision, so it is refused here.`,
|
|
11
|
+
limits: ['closure.members'],
|
|
12
|
+
},
|
|
13
|
+
COMPILED_CANONICAL_MISMATCH: {
|
|
14
|
+
positions: ['/closure/{index}/revision', '/closure/{index}{/path*}/execution/durable'],
|
|
15
|
+
statement: 'A compiled Schema holds the canonical form of what it says: an entry the revision of its own content, a Callable no execution unless durable. What a revision leaves out stands outside this rule: the graph and machines of a value program, the pattern table of an entry, the ordering of a Property and the input fields of a Callable are derived from what the revision covers, so a document saying otherwise loads and answers as that part says.',
|
|
16
|
+
},
|
|
17
|
+
COMPILED_DEPENDENCY_LIMITS: {
|
|
18
|
+
positions: ['/closure', '/closure/{index}/dependencies'],
|
|
19
|
+
statement: `A compiled Schema has a closure of at most ${limits.dependency.closure} Domains, each with at most ${limits.dependency.direct} direct dependencies, at most ${limits.dependency.depth} deep.`,
|
|
20
|
+
limits: ['dependency.closure', 'dependency.direct', 'dependency.depth'],
|
|
21
|
+
},
|
|
22
|
+
COMPILED_SOURCE_INVALID: {
|
|
23
|
+
positions: ['/closure/{index}{/path*}'],
|
|
24
|
+
statement: 'A compiled entry holds the rules of the language `READMITTED_RULES` places under this code: admission applies them to it again.',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
const WIRE = { kind: 'refused', answers: ['COMPILED_STRUCTURE_INVALID'] };
|
|
28
|
+
const SOURCE = { kind: 'refused', answers: ['COMPILED_SOURCE_INVALID'] };
|
|
29
|
+
const WIRE_OR_SOURCE = {
|
|
30
|
+
kind: 'refused',
|
|
31
|
+
answers: ['COMPILED_STRUCTURE_INVALID', 'COMPILED_SOURCE_INVALID'],
|
|
32
|
+
};
|
|
33
|
+
const PORTABLE = {
|
|
34
|
+
kind: 'portable',
|
|
35
|
+
answers: [
|
|
36
|
+
'VALUE_TYPE',
|
|
37
|
+
'VALUE_NUMBER',
|
|
38
|
+
'VALUE_STRING',
|
|
39
|
+
'VALUE_ARRAY',
|
|
40
|
+
'VALUE_OBJECT',
|
|
41
|
+
'VALUE_CYCLE',
|
|
42
|
+
'VALUE_LIMIT',
|
|
43
|
+
'VALUE_REFLECTION',
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Every rule of a source with how admission of a compiled Schema holds it, frozen. A rule added to
|
|
48
|
+
* the language does not compile until it is placed here.
|
|
49
|
+
*/
|
|
50
|
+
export const READMITTED_RULES = deepFreeze({
|
|
51
|
+
UNSUPPORTED_DOCUMENT_FORMAT: WIRE,
|
|
52
|
+
UNSUPPORTED_DSL_VERSION: WIRE,
|
|
53
|
+
DV_JSON_VALUE: PORTABLE,
|
|
54
|
+
STRUCTURE_BINARY_INPUT: WIRE,
|
|
55
|
+
STRUCTURE_CALLABLE_POLICY_AUTH: WIRE,
|
|
56
|
+
STRUCTURE_DEPENDENCY_ALIAS: WIRE,
|
|
57
|
+
STRUCTURE_DOMAIN_NAME: WIRE,
|
|
58
|
+
STRUCTURE_DUPLICATE_ITEM: WIRE,
|
|
59
|
+
STRUCTURE_EDGE_BLOB: {
|
|
60
|
+
kind: 'unapplied',
|
|
61
|
+
because: 'Admission does not read the value kind of an Edge Property.',
|
|
62
|
+
},
|
|
63
|
+
STRUCTURE_EDGE_ORIENTATION: WIRE,
|
|
64
|
+
STRUCTURE_FORMAT: WIRE,
|
|
65
|
+
STRUCTURE_KEY: WIRE,
|
|
66
|
+
STRUCTURE_MAXIMUM: WIRE,
|
|
67
|
+
STRUCTURE_MINIMUM: WIRE,
|
|
68
|
+
STRUCTURE_PROPERTY_KEY: WIRE_OR_SOURCE,
|
|
69
|
+
STRUCTURE_PROTO_KEY: WIRE,
|
|
70
|
+
STRUCTURE_REQUIRED: WIRE,
|
|
71
|
+
STRUCTURE_STATE_TRANSITIONS: SOURCE,
|
|
72
|
+
STRUCTURE_TYPE: WIRE,
|
|
73
|
+
STRUCTURE_UNION: WIRE,
|
|
74
|
+
STRUCTURE_UNKNOWN_FIELD: WIRE_OR_SOURCE,
|
|
75
|
+
STRUCTURE_VALUE: WIRE,
|
|
76
|
+
DV_ACCEPTANCE_CONTEXT: {
|
|
77
|
+
kind: 'unsayable',
|
|
78
|
+
because: 'A compiled Schema carries its closure, so no acceptance in this process precedes it.',
|
|
79
|
+
},
|
|
80
|
+
DV_CALLABLE_ADMISSION: SOURCE,
|
|
81
|
+
DV_CALLABLE_AUTH: SOURCE,
|
|
82
|
+
DV_CALLABLE_IO: SOURCE,
|
|
83
|
+
DV_CLASS_ABSTRACT: SOURCE,
|
|
84
|
+
DV_CLASS_ACYCLIC: SOURCE,
|
|
85
|
+
DV_CLASS_INHERITANCE: SOURCE,
|
|
86
|
+
DV_CLASS_KIND: SOURCE,
|
|
87
|
+
DV_CORE_EDGE_CLASS: SOURCE,
|
|
88
|
+
DV_CORE_EDGE_CONSTRAINTS: SOURCE,
|
|
89
|
+
DV_CORE_EDGE_KEY: SOURCE,
|
|
90
|
+
DV_CORE_EDGE_PROPERTIES: SOURCE,
|
|
91
|
+
DV_CORE_EDGE_UNIQUE: SOURCE,
|
|
92
|
+
DV_CORE_NODE_CLASS: SOURCE,
|
|
93
|
+
DV_CORE_NODE_PROPERTIES: SOURCE,
|
|
94
|
+
DV_CORE_NODE_UNIQUE: SOURCE,
|
|
95
|
+
DV_CORE_REF: SOURCE,
|
|
96
|
+
DV_DATA_COMPOSITION: SOURCE,
|
|
97
|
+
DV_DEPENDENCY_ACYCLIC: WIRE,
|
|
98
|
+
DV_DEPENDENCY_DIRECT: SOURCE,
|
|
99
|
+
DV_DEPENDENCY_EXACT: WIRE,
|
|
100
|
+
DV_DEPENDENCY_LIMITS: { kind: 'refused', answers: ['COMPILED_DEPENDENCY_LIMITS'] },
|
|
101
|
+
DV_DEPENDENCY_REVISION_COHERENCE: WIRE,
|
|
102
|
+
DV_DEPENDENCY_UNIQUE: WIRE,
|
|
103
|
+
DV_DOMAIN_ICON: WIRE,
|
|
104
|
+
DV_EDGE_ACCEPTS: SOURCE,
|
|
105
|
+
DV_EDGE_CLASS_COMPOSITION: SOURCE,
|
|
106
|
+
DV_EDGE_FOREIGN_MINIMUM: {
|
|
107
|
+
kind: 'unapplied',
|
|
108
|
+
because: 'Admission reads an Edge count only against the Core facts of its entry.',
|
|
109
|
+
},
|
|
110
|
+
DV_EDGE_LIFETIME: {
|
|
111
|
+
kind: 'unapplied',
|
|
112
|
+
because: 'Admission reads `onDelete` only as a value of its position.',
|
|
113
|
+
},
|
|
114
|
+
DV_EDGE_ROLE: WIRE,
|
|
115
|
+
DV_EDGE_UNIQUE: SOURCE,
|
|
116
|
+
DV_ENTRYPOINT: WIRE,
|
|
117
|
+
DV_INHERITANCE_LIMITS: SOURCE,
|
|
118
|
+
DV_METHOD_ABSTRACT: SOURCE,
|
|
119
|
+
DV_METHOD_COMPOSITION: SOURCE,
|
|
120
|
+
DV_NODE_UNIQUE: SOURCE,
|
|
121
|
+
DV_PROPERTY_AUTO: SOURCE,
|
|
122
|
+
DV_PROPERTY_IMMUTABLE: SOURCE,
|
|
123
|
+
DV_PROPERTY_STATE: SOURCE,
|
|
124
|
+
DV_REF_RESOLVES: WIRE_OR_SOURCE,
|
|
125
|
+
DV_VALUE_SCHEMA: {
|
|
126
|
+
kind: 'refused',
|
|
127
|
+
answers: ['COMPILED_STRUCTURE_INVALID', 'COMPILED_SOURCE_INVALID'],
|
|
128
|
+
except: 'Every rule of a value schema but its pattern sources, its numbers and what deriving its graph reads, as `READMITTED_VALUE_RULES` places each.',
|
|
129
|
+
},
|
|
130
|
+
PL_BUDGET: SOURCE,
|
|
131
|
+
PL_COMPOSITION: SOURCE,
|
|
132
|
+
PL_CONNECTIVITY: SOURCE,
|
|
133
|
+
PL_REF: SOURCE,
|
|
134
|
+
PL_REPEAT: WIRE,
|
|
135
|
+
PL_TARGET: SOURCE,
|
|
136
|
+
PL_TYPING: SOURCE,
|
|
137
|
+
PL_USE: SOURCE,
|
|
138
|
+
PL_VARIABLE_SCOPE: SOURCE,
|
|
139
|
+
});
|
|
140
|
+
const VALUE_INDICES = {
|
|
141
|
+
kind: 'unapplied',
|
|
142
|
+
because: 'Admission derives the graph, the machines and the ordering of a value program from its root schema, which it evaluates as it stands.',
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Every rule of a value schema with how admission of a compiled Schema holds it, frozen. A rule added
|
|
146
|
+
* to the value language does not compile until it is placed here.
|
|
147
|
+
*/
|
|
148
|
+
export const READMITTED_VALUE_RULES = deepFreeze({
|
|
149
|
+
VS_DIALECT: VALUE_INDICES,
|
|
150
|
+
VS_DYNAMIC_FORBIDDEN: VALUE_INDICES,
|
|
151
|
+
VS_KEYWORD_CLOSED: VALUE_INDICES,
|
|
152
|
+
VS_META_SCHEMA: {
|
|
153
|
+
kind: 'refused',
|
|
154
|
+
answers: ['COMPILED_SOURCE_INVALID'],
|
|
155
|
+
except: 'Every other form of a keyword: its graph derives all the same.',
|
|
156
|
+
},
|
|
157
|
+
VS_NUMBER_DOMAIN: PORTABLE,
|
|
158
|
+
VS_PATH_EXTENSION: VALUE_INDICES,
|
|
159
|
+
VS_RECURSION_PRODUCTIVE: SOURCE,
|
|
160
|
+
VS_REFERENCE_FORM: SOURCE,
|
|
161
|
+
VS_REFERENCE_RESOLUTION: SOURCE,
|
|
162
|
+
VS_REGEX_PORTABLE: SOURCE,
|
|
163
|
+
VS_RESOURCE_ID: VALUE_INDICES,
|
|
164
|
+
VS_VALUE_KIND: VALUE_INDICES,
|
|
165
|
+
VS_VALUE_KIND_JSON: {
|
|
166
|
+
kind: 'unapplied',
|
|
167
|
+
because: 'It warns the author of a source, and a compiled Schema has no author to warn.',
|
|
168
|
+
},
|
|
169
|
+
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { compareUnicode } from '../../addressing/ordering.js';
|
|
2
|
+
import { PolicyComposition } from '../policy/model/policy.js';
|
|
2
3
|
/**
|
|
3
4
|
* The language ceiling of a declared admission age, in seconds. Raising it later widens the
|
|
4
5
|
* language; lowering it would refuse accepted Schemas.
|
|
@@ -37,7 +38,7 @@ function collectInputFields(expression, fields) {
|
|
|
37
38
|
}
|
|
38
39
|
return;
|
|
39
40
|
}
|
|
40
|
-
for (const child of
|
|
41
|
+
for (const child of PolicyComposition.of(expression).operands) {
|
|
41
42
|
collectInputFields(child, fields);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { definitionRefIndex } from '../../../addressing/ordering.js';
|
|
2
|
-
import { policyObjectKey, policyVariableSelector } from '../model/policy.js';
|
|
2
|
+
import { PolicyComposition, policyObjectKey, policyVariableSelector } from '../model/policy.js';
|
|
3
3
|
import { BRANCH_OVERFLOW } from './budgets.js';
|
|
4
4
|
export function branchesOf(pattern, namespace) {
|
|
5
5
|
const variables = collectVariableClasses(pattern, namespace);
|
|
@@ -103,8 +103,9 @@ function branchesForNode(pattern, namespace, variables) {
|
|
|
103
103
|
requiredVariables: new Set([...branch.requiredVariables, ...direct]),
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
106
|
+
const { operator, operands } = PolicyComposition.of(pattern);
|
|
107
|
+
const children = operands.map((child) => branchesForNode(child, namespace, variables));
|
|
108
|
+
return operator === 'allOf' ? branchProduct(children) : capBranches(children.flat());
|
|
108
109
|
}
|
|
109
110
|
function emptyBranch() {
|
|
110
111
|
return {
|
|
@@ -135,10 +136,8 @@ function collectVariableClasses(pattern, namespace) {
|
|
|
135
136
|
}
|
|
136
137
|
visit(node.exists.where);
|
|
137
138
|
}
|
|
138
|
-
else if (
|
|
139
|
-
node.
|
|
140
|
-
else if ('anyOf' in node)
|
|
141
|
-
node.anyOf.forEach(visit);
|
|
139
|
+
else if (PolicyComposition.is(node))
|
|
140
|
+
PolicyComposition.of(node).operands.forEach(visit);
|
|
142
141
|
};
|
|
143
142
|
visit(pattern);
|
|
144
143
|
return result;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { limits } from '../../limits.js';
|
|
2
2
|
import { runSuspended } from '../../suspended.js';
|
|
3
|
-
import { policyObjectOrigin, policyVariableClass } from '../model/policy.js';
|
|
3
|
+
import { PolicyComposition, policyObjectOrigin, policyVariableClass } from '../model/policy.js';
|
|
4
4
|
/**
|
|
5
5
|
* Where a count of Policy branches stops: one past its limit. Each branch count is exact up to its
|
|
6
6
|
* limit plus one and reads as that once it is over, so expansion stays bounded.
|
|
@@ -41,7 +41,7 @@ export function policyMeasurer(origin, normalized, isLocal) {
|
|
|
41
41
|
function* measureDeclaration(declaration) {
|
|
42
42
|
if ('match' in declaration)
|
|
43
43
|
return measurePattern(declaration.match, origin);
|
|
44
|
-
const
|
|
44
|
+
const { operator, operands: refs } = PolicyComposition.of(declaration);
|
|
45
45
|
const children = [];
|
|
46
46
|
for (const ref of refs) {
|
|
47
47
|
if (!isLocal(ref))
|
|
@@ -52,7 +52,7 @@ export function policyMeasurer(origin, normalized, isLocal) {
|
|
|
52
52
|
}
|
|
53
53
|
if (children.length !== refs.length || children.length === 0)
|
|
54
54
|
return undefined;
|
|
55
|
-
return combineMeasures(
|
|
55
|
+
return combineMeasures(operator, children);
|
|
56
56
|
}
|
|
57
57
|
return (name) => {
|
|
58
58
|
const measure = runSuspended(measurePolicy(name));
|
|
@@ -100,7 +100,8 @@ function measurePattern(pattern, origin) {
|
|
|
100
100
|
]),
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
const { operator, operands } = PolicyComposition.of(pattern);
|
|
104
|
+
return combineMeasures(operator, operands.map((child) => measurePattern(child, origin)));
|
|
104
105
|
}
|
|
105
106
|
function combineMeasures(kind, children) {
|
|
106
107
|
const depth = 1 + Math.max(0, ...children.map((child) => child.depth));
|
|
@@ -131,8 +132,9 @@ function combineMeasures(kind, children) {
|
|
|
131
132
|
export function measureChecks(expression) {
|
|
132
133
|
if ('check' in expression || 'sameNode' in expression)
|
|
133
134
|
return { checkDepth: 1, checkBranches: 1, checkLeaves: 1 };
|
|
134
|
-
const
|
|
135
|
-
const
|
|
135
|
+
const { operator, operands } = PolicyComposition.of(expression);
|
|
136
|
+
const children = operands.map(measureChecks);
|
|
137
|
+
const checkBranches = operator === 'allOf'
|
|
136
138
|
? children.reduce((value, child) => Math.min(CHECK_BRANCH_OVERFLOW, value * child.checkBranches), 1)
|
|
137
139
|
: children.reduce((value, child) => Math.min(CHECK_BRANCH_OVERFLOW, value + child.checkBranches), 0);
|
|
138
140
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { limits } from '../../limits.js';
|
|
2
|
-
import { policyObjectKey } from '../model/policy.js';
|
|
2
|
+
import { PolicyComposition, policyObjectKey } from '../model/policy.js';
|
|
3
3
|
import { measureChecks } from './budgets.js';
|
|
4
4
|
/** Names a callable check object. Every leaf over one object sees the same Node at runtime. */
|
|
5
5
|
function checkObjectName(object) {
|
|
@@ -73,9 +73,10 @@ export function neverAdmittedClasses(expression, leaves) {
|
|
|
73
73
|
function disjunctiveForm(expression) {
|
|
74
74
|
if ('check' in expression || 'sameNode' in expression)
|
|
75
75
|
return [[expression]];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const { operator, operands } = PolicyComposition.of(expression);
|
|
77
|
+
if (operator === 'anyOf')
|
|
78
|
+
return operands.flatMap(disjunctiveForm);
|
|
79
|
+
return operands
|
|
79
80
|
.map(disjunctiveForm)
|
|
80
81
|
.reduce((left, right) => left.flatMap((prefix) => right.map((suffix) => [...prefix, ...suffix])), [[]]);
|
|
81
82
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { cycleEdges } from '../../cycle.js';
|
|
2
|
+
import { PolicyComposition } from '../model/policy.js';
|
|
2
3
|
/** Each edge closing a cycle among the named Policies of `origin`, walking from `names` in order. */
|
|
3
4
|
export function compositionCycles(names, expressionOf, origin) {
|
|
4
5
|
return cycleEdges(names, (name) => {
|
|
5
6
|
const expression = expressionOf(name);
|
|
6
7
|
if (expression === undefined || 'match' in expression)
|
|
7
8
|
return [];
|
|
8
|
-
|
|
9
|
-
return refs.flatMap((ref) => (ref.origin === origin ? [ref.name] : []));
|
|
9
|
+
return PolicyComposition.of(expression).operands.flatMap((ref) => ref.origin === origin ? [ref.name] : []);
|
|
10
10
|
});
|
|
11
11
|
}
|
|
@@ -2,6 +2,7 @@ import { Key } from '../../../addressing/index.js';
|
|
|
2
2
|
import { definitionRefIndex } from '../../../addressing/ordering.js';
|
|
3
3
|
import { classSatisfies, isGraphRoot } from '../../class/inheritance.js';
|
|
4
4
|
import { limits } from '../../limits.js';
|
|
5
|
+
import { PolicyComposition } from '../model/policy.js';
|
|
5
6
|
import { branchesOf, branchProduct, capBranches, targetMode, termKey, UnionFind, } from './branches.js';
|
|
6
7
|
import { admittedCheckClasses } from './checks.js';
|
|
7
8
|
export class PolicyTyping {
|
|
@@ -94,7 +95,7 @@ export class PolicyTyping {
|
|
|
94
95
|
return branchesOf(declaration.match, namespace);
|
|
95
96
|
const nested = new Set(visiting);
|
|
96
97
|
nested.add(name);
|
|
97
|
-
const
|
|
98
|
+
const { operator, operands: refs } = PolicyComposition.of(declaration);
|
|
98
99
|
const children = [];
|
|
99
100
|
for (const [index, ref] of refs.entries()) {
|
|
100
101
|
if (!this.scope.isLocalPolicy(ref))
|
|
@@ -104,7 +105,7 @@ export class PolicyTyping {
|
|
|
104
105
|
return undefined;
|
|
105
106
|
children.push(expanded);
|
|
106
107
|
}
|
|
107
|
-
return 'allOf'
|
|
108
|
+
return operator === 'allOf' ? branchProduct(children) : capBranches(children.flat());
|
|
108
109
|
}
|
|
109
110
|
#constraintsAreSatisfiable(branch, variants, use) {
|
|
110
111
|
const terms = new Set(use.kind === 'object' ? ['subject', 'object'] : ['subject', 'source', 'target']);
|
|
@@ -73,6 +73,28 @@ export type PolicyPatternExpression = PolicyEdgePattern | PolicySameNode<PolicyP
|
|
|
73
73
|
} | {
|
|
74
74
|
readonly anyOf: readonly [PolicyPatternExpression, ...PolicyPatternExpression[]];
|
|
75
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* A composition of a Pattern, a named Policy or Policy checks, read through its operator: `allOf`
|
|
78
|
+
* holds where every operand holds, `anyOf` where one does. It is stored under the one key its
|
|
79
|
+
* operator names; every reader takes the operator and the operands from here.
|
|
80
|
+
*/
|
|
81
|
+
export declare namespace PolicyComposition {
|
|
82
|
+
type Operator = 'allOf' | 'anyOf';
|
|
83
|
+
type Operands<Operand> = readonly [Operand, ...Operand[]];
|
|
84
|
+
/** The stored form: the operands under the key their operator names. */
|
|
85
|
+
type Stored<Operand> = {
|
|
86
|
+
readonly allOf: Operands<Operand>;
|
|
87
|
+
} | {
|
|
88
|
+
readonly anyOf: Operands<Operand>;
|
|
89
|
+
};
|
|
90
|
+
function is<Value extends object>(value: Value): value is Extract<Value, Stored<unknown>>;
|
|
91
|
+
function of<Operand>(composition: Stored<Operand>): {
|
|
92
|
+
readonly operator: Operator;
|
|
93
|
+
readonly operands: Operands<Operand>;
|
|
94
|
+
};
|
|
95
|
+
/** Store `operands` under the key `operator` names. */
|
|
96
|
+
function from<Operand>(operator: Operator, operands: Operands<Operand>): Stored<Operand>;
|
|
97
|
+
}
|
|
76
98
|
export type PolicyExpression = {
|
|
77
99
|
readonly match: PolicyPatternExpression;
|
|
78
100
|
} | {
|
|
@@ -7,6 +7,29 @@ export function policyVariableClass(variable) {
|
|
|
7
7
|
const selector = policyVariableSelector(variable);
|
|
8
8
|
return selector.kind === 'any' ? undefined : selector.class;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* A composition of a Pattern, a named Policy or Policy checks, read through its operator: `allOf`
|
|
12
|
+
* holds where every operand holds, `anyOf` where one does. It is stored under the one key its
|
|
13
|
+
* operator names; every reader takes the operator and the operands from here.
|
|
14
|
+
*/
|
|
15
|
+
export var PolicyComposition;
|
|
16
|
+
(function (PolicyComposition) {
|
|
17
|
+
function is(value) {
|
|
18
|
+
return 'allOf' in value || 'anyOf' in value;
|
|
19
|
+
}
|
|
20
|
+
PolicyComposition.is = is;
|
|
21
|
+
function of(composition) {
|
|
22
|
+
return 'allOf' in composition
|
|
23
|
+
? { operator: 'allOf', operands: composition.allOf }
|
|
24
|
+
: { operator: 'anyOf', operands: composition.anyOf };
|
|
25
|
+
}
|
|
26
|
+
PolicyComposition.of = of;
|
|
27
|
+
/** Store `operands` under the key `operator` names. */
|
|
28
|
+
function from(operator, operands) {
|
|
29
|
+
return operator === 'allOf' ? { allOf: operands } : { anyOf: operands };
|
|
30
|
+
}
|
|
31
|
+
PolicyComposition.from = from;
|
|
32
|
+
})(PolicyComposition || (PolicyComposition = {}));
|
|
10
33
|
/** Exact projected identity, including Class-owned Method declarations. */
|
|
11
34
|
export function policyObjectKey(ref) {
|
|
12
35
|
return ref.kind === 'method'
|
|
@@ -49,7 +72,7 @@ export function isClassObservation(operation) {
|
|
|
49
72
|
}
|
|
50
73
|
export function isClassRuleChecks(value) {
|
|
51
74
|
return (typeof value === 'object' &&
|
|
52
|
-
('check' in value || 'sameNode' in value ||
|
|
75
|
+
('check' in value || 'sameNode' in value || PolicyComposition.is(value)));
|
|
53
76
|
}
|
|
54
77
|
/**
|
|
55
78
|
* Whether every way Policy checks can hold passes through a check, so that the caller decides each
|
|
@@ -60,7 +83,8 @@ export function checksNameTheCaller(value) {
|
|
|
60
83
|
return true;
|
|
61
84
|
if ('sameNode' in value)
|
|
62
85
|
return false;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
86
|
+
const { operator, operands } = PolicyComposition.of(value);
|
|
87
|
+
return operator === 'allOf'
|
|
88
|
+
? operands.some(checksNameTheCaller)
|
|
89
|
+
: operands.every(checksNameTheCaller);
|
|
66
90
|
}
|