@astrale-os/kernel-dsl 0.2.0-beta.8 → 0.2.0
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/class-key.js +5 -4
- package/dist/v1/addressing/method-key.js +3 -2
- package/dist/v1/addressing/patterns.d.ts +0 -5
- package/dist/v1/addressing/patterns.js +5 -5
- package/dist/v1/builder/callable/authoring.d.ts +87 -41
- package/dist/v1/builder/callable/authoring.js +29 -14
- package/dist/v1/builder/class/authoring.d.ts +311 -36
- package/dist/v1/builder/class/authoring.js +3 -4
- package/dist/v1/builder/class/property.d.ts +16 -8
- package/dist/v1/builder/class/property.js +21 -5
- package/dist/v1/builder/core/authoring.d.ts +28 -13
- package/dist/v1/builder/core/authoring.js +22 -2
- package/dist/v1/builder/index.d.ts +9 -8
- package/dist/v1/builder/index.js +2 -2
- package/dist/v1/builder/lowering/callable.d.ts +3 -1
- package/dist/v1/builder/lowering/callable.js +43 -51
- package/dist/v1/builder/lowering/class.d.ts +7 -0
- package/dist/v1/builder/lowering/class.js +79 -29
- package/dist/v1/builder/lowering/core.d.ts +3 -2
- package/dist/v1/builder/lowering/core.js +9 -6
- package/dist/v1/builder/lowering/policy.d.ts +8 -1
- package/dist/v1/builder/lowering/policy.js +35 -0
- package/dist/v1/builder/lowering/schema/capture.js +9 -4
- package/dist/v1/builder/lowering/schema/compile.d.ts +2 -2
- package/dist/v1/builder/lowering/schema/compile.js +15 -2
- package/dist/v1/builder/lowering/schema/context.d.ts +11 -8
- package/dist/v1/builder/lowering/schema/context.js +59 -29
- package/dist/v1/builder/lowering/schema/ownership.d.ts +3 -3
- package/dist/v1/builder/lowering/schema/ownership.js +2 -1
- package/dist/v1/builder/lowering/value/compile.js +14 -4
- package/dist/v1/builder/lowering/value/zod.d.ts +7 -6
- package/dist/v1/builder/lowering/value/zod.js +16 -7
- package/dist/v1/builder/lowering/view.d.ts +4 -3
- package/dist/v1/builder/lowering/view.js +2 -14
- package/dist/v1/builder/policy/authoring.d.ts +23 -6
- package/dist/v1/builder/policy/authoring.js +35 -8
- package/dist/v1/builder/schema/define.d.ts +8 -5
- package/dist/v1/builder/schema/diagnostic.d.ts +1 -1
- package/dist/v1/builder/schema/handle.d.ts +2 -1
- package/dist/v1/builder/schema/input.d.ts +9 -1
- package/dist/v1/builder/schema/projection/callable.d.ts +51 -0
- package/dist/v1/builder/schema/projection/callable.js +1 -0
- package/dist/v1/builder/schema/projection/class.d.ts +89 -0
- package/dist/v1/builder/schema/projection/class.js +1 -0
- package/dist/v1/builder/schema/projection/core-input.d.ts +32 -0
- package/dist/v1/builder/schema/projection/core-input.js +1 -0
- package/dist/v1/builder/schema/projection/domain.d.ts +59 -0
- package/dist/v1/builder/schema/projection/domain.js +1 -0
- package/dist/v1/builder/schema/projection/identity.d.ts +39 -0
- package/dist/v1/builder/schema/projection/identity.js +1 -0
- package/dist/v1/builder/schema/projection/model.d.ts +59 -0
- package/dist/v1/builder/schema/projection/model.js +1 -0
- package/dist/v1/builder/schema/projection/property.d.ts +32 -0
- package/dist/v1/builder/schema/projection/property.js +1 -0
- package/dist/v1/builder/schema/projection/resolved-class.d.ts +76 -0
- package/dist/v1/builder/schema/projection/resolved-class.js +1 -0
- package/dist/v1/builder/schema/projection.d.ts +4 -258
- package/dist/v1/builder/value/full-match.js +6 -3
- package/dist/v1/builder/value/path.d.ts +2 -2
- package/dist/v1/builder/value/path.js +2 -2
- package/dist/v1/builder/view/authoring.d.ts +6 -14
- package/dist/v1/builder/view/authoring.js +13 -5
- package/dist/v1/bundle/structure.d.ts +2 -1
- package/dist/v1/compiled/admission/accept.d.ts +1 -1
- package/dist/v1/compiled/admission/accept.js +11 -814
- package/dist/v1/compiled/admission/closure.d.ts +3 -0
- package/dist/v1/compiled/admission/closure.js +173 -0
- package/dist/v1/compiled/admission/diagnostic.d.ts +7 -0
- package/dist/v1/compiled/admission/diagnostic.js +13 -0
- package/dist/v1/compiled/admission/revision.js +9 -1
- package/dist/v1/compiled/admission/semantics/cardinality.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/cardinality.js +113 -0
- package/dist/v1/compiled/admission/semantics/class.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/class.js +125 -0
- package/dist/v1/compiled/admission/semantics/context.d.ts +60 -0
- package/dist/v1/compiled/admission/semantics/context.js +81 -0
- package/dist/v1/compiled/admission/semantics/core.d.ts +35 -0
- package/dist/v1/compiled/admission/semantics/core.js +123 -0
- package/dist/v1/compiled/admission/semantics/edge.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/edge.js +89 -0
- package/dist/v1/compiled/admission/semantics/policy/admit.d.ts +4 -0
- package/dist/v1/compiled/admission/semantics/policy/admit.js +63 -0
- package/dist/v1/compiled/admission/semantics/policy/callable.d.ts +5 -0
- package/dist/v1/compiled/admission/semantics/policy/callable.js +72 -0
- package/dist/v1/compiled/admission/semantics/policy/contracts.d.ts +24 -0
- package/dist/v1/compiled/admission/semantics/policy/contracts.js +45 -0
- package/dist/v1/compiled/admission/semantics/policy/equality.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/policy/equality.js +27 -0
- package/dist/v1/compiled/admission/semantics/policy/measure.d.ts +9 -0
- package/dist/v1/compiled/admission/semantics/policy/measure.js +81 -0
- package/dist/v1/compiled/admission/semantics/policy/parity.d.ts +4 -0
- package/dist/v1/compiled/admission/semantics/policy/parity.js +139 -0
- package/dist/v1/compiled/admission/semantics/policy/pattern.d.ts +8 -0
- package/dist/v1/compiled/admission/semantics/policy/pattern.js +78 -0
- package/dist/v1/compiled/admission/semantics/policy/typing.d.ts +28 -0
- package/dist/v1/compiled/admission/semantics/policy/typing.js +206 -0
- package/dist/v1/compiled/admission/semantics/policy/variants.d.ts +10 -0
- package/dist/v1/compiled/admission/semantics/policy/variants.js +65 -0
- package/dist/v1/compiled/admission/semantics.d.ts +1 -1
- package/dist/v1/compiled/admission/semantics.js +8 -1078
- package/dist/v1/compiled/admission/wire/callable.d.ts +6 -0
- package/dist/v1/compiled/admission/wire/callable.js +90 -0
- package/dist/v1/compiled/admission/wire/class.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/class.js +133 -0
- package/dist/v1/compiled/admission/wire/core.d.ts +5 -0
- package/dist/v1/compiled/admission/wire/core.js +32 -0
- package/dist/v1/compiled/admission/wire/dependency.d.ts +14 -0
- package/dist/v1/compiled/admission/wire/dependency.js +43 -0
- package/dist/v1/compiled/admission/wire/entry.d.ts +5 -0
- package/dist/v1/compiled/admission/wire/entry.js +100 -0
- package/dist/v1/compiled/admission/wire/pattern.d.ts +12 -0
- package/dist/v1/compiled/admission/wire/pattern.js +111 -0
- package/dist/v1/compiled/admission/wire/policy.d.ts +10 -0
- package/dist/v1/compiled/admission/wire/policy.js +189 -0
- package/dist/v1/compiled/admission/wire/program.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/program.js +52 -0
- package/dist/v1/compiled/admission/wire/property.d.ts +4 -0
- package/dist/v1/compiled/admission/wire/property.js +74 -0
- package/dist/v1/compiled/admission/wire/reference.d.ts +8 -0
- package/dist/v1/compiled/admission/wire/reference.js +33 -0
- package/dist/v1/compiled/admission/wire/value.d.ts +29 -0
- package/dist/v1/compiled/admission/wire/value.js +98 -0
- package/dist/v1/compiled/admission/wire/view.d.ts +3 -0
- package/dist/v1/compiled/admission/wire/view.js +17 -0
- package/dist/v1/compiled/compiler/compile.js +43 -11
- package/dist/v1/compiled/generated.d.ts +10 -0
- package/dist/v1/compiled/generated.js +15 -0
- package/dist/v1/compiled/loader/load.d.ts +5 -0
- package/dist/v1/compiled/loader/load.js +18 -4
- package/dist/v1/compiled/model/schema.d.ts +16 -7
- package/dist/v1/domain/create.js +18 -28
- package/dist/v1/domain/model/domain.d.ts +0 -1
- package/dist/v1/domain/model/input.d.ts +3 -0
- package/dist/v1/domain/projection/classes.js +13 -41
- package/dist/v1/domain/validation/create.d.ts +2 -0
- package/dist/v1/domain/validation/create.js +12 -0
- package/dist/v1/index.d.ts +5 -2
- package/dist/v1/index.js +3 -1
- package/dist/v1/language/callable/composition.d.ts +27 -0
- package/dist/v1/language/callable/composition.js +52 -0
- package/dist/v1/language/callable/executable.d.ts +6 -0
- package/dist/v1/language/callable/executable.js +4 -0
- package/dist/v1/language/callable/model/callable.d.ts +34 -9
- package/dist/v1/language/callable/model/callable.js +3 -1
- package/dist/v1/language/callable/resolved.d.ts +23 -8
- package/dist/v1/language/class/facets.d.ts +5 -2
- package/dist/v1/language/class/inheritance.d.ts +12 -0
- package/dist/v1/language/class/inheritance.js +25 -0
- package/dist/v1/language/class/lifetime.d.ts +17 -0
- package/dist/v1/language/class/lifetime.js +26 -0
- package/dist/v1/language/class/model/class.d.ts +8 -4
- package/dist/v1/language/class/model/property.d.ts +4 -2
- package/dist/v1/language/class/property-values.js +5 -2
- package/dist/v1/language/class/resolved.d.ts +25 -15
- package/dist/v1/language/core/model/core.d.ts +7 -1
- package/dist/v1/language/core/resolved.d.ts +6 -2
- package/dist/v1/language/definition/metadata.d.ts +8 -0
- package/dist/v1/language/definition/metadata.js +12 -0
- package/dist/v1/language/index.d.ts +9 -0
- package/dist/v1/language/index.js +6 -0
- package/dist/v1/language/policy/analysis/branches.d.ts +4 -3
- package/dist/v1/language/policy/analysis/branches.js +54 -12
- package/dist/v1/language/policy/analysis/budgets.js +1 -1
- package/dist/v1/language/policy/analysis/checks.d.ts +28 -0
- package/dist/v1/language/policy/analysis/checks.js +80 -0
- package/dist/v1/language/policy/index.d.ts +1 -0
- package/dist/v1/language/policy/index.js +1 -0
- package/dist/v1/language/policy/model/policy.d.ts +71 -5
- package/dist/v1/language/policy/model/policy.js +52 -1
- package/dist/v1/language/policy/normalization/normalize.d.ts +12 -1
- package/dist/v1/language/policy/normalization/normalize.js +178 -44
- package/dist/v1/language/state/index.d.ts +3 -0
- package/dist/v1/language/state/index.js +1 -0
- package/dist/v1/language/state/machine.d.ts +28 -0
- package/dist/v1/language/state/machine.js +40 -0
- package/dist/v1/language/state/topology.d.ts +14 -0
- package/dist/v1/language/state/topology.js +69 -0
- package/dist/v1/language/value/compile/fields.d.ts +1 -1
- package/dist/v1/language/value/compile/load.d.ts +4 -2
- package/dist/v1/language/value/compile/load.js +22 -1
- package/dist/v1/language/value/compile/model.d.ts +16 -1
- package/dist/v1/language/value/evaluate/assertions.d.ts +2 -0
- package/dist/v1/language/value/evaluate/assertions.js +13 -0
- package/dist/v1/language/value/evaluate/evaluator.js +111 -28
- package/dist/v1/language/value/evaluate/preparation.d.ts +10 -1
- package/dist/v1/language/value/evaluate/preparation.js +17 -26
- package/dist/v1/language/value/evaluate/program.js +1 -1
- package/dist/v1/language/value/evaluate/validate.d.ts +6 -2
- package/dist/v1/language/value/evaluate/validate.js +18 -11
- package/dist/v1/language/value/inclusion/includes.d.ts +9 -0
- package/dist/v1/language/value/inclusion/includes.js +777 -0
- package/dist/v1/language/value/model/blob.d.ts +31 -0
- package/dist/v1/language/value/model/blob.js +90 -0
- package/dist/v1/language/value/model/instant.d.ts +0 -2
- package/dist/v1/language/value/model/instant.js +1 -1
- package/dist/v1/language/value/model/schema.d.ts +2 -1
- package/dist/v1/language/value/model/schema.js +1 -5
- package/dist/v1/language/value/ordering.d.ts +2 -0
- package/dist/v1/language/value/ordering.js +4 -8
- package/dist/v1/language/value/profile/json.validate.js +1 -1
- package/dist/v1/language/value/profile/rules.js +48 -12
- package/dist/v1/language/value/reference/registry.d.ts +2 -1
- package/dist/v1/language/value/regexp/ast.js +3 -64
- package/dist/v1/language/value/regexp/compile.d.ts +32 -3
- package/dist/v1/language/value/regexp/compile.js +117 -21
- package/dist/v1/language/value/regexp/matcher.d.ts +6 -3
- package/dist/v1/language/value/regexp/matcher.js +185 -28
- package/dist/v1/language/value/regexp/syntax.d.ts +12 -1
- package/dist/v1/language/value/regexp/syntax.js +14 -2
- package/dist/v1/language/value/regexp/unicode.d.ts +32 -0
- package/dist/v1/language/value/regexp/unicode.js +139 -0
- package/dist/v1/language/value/syntax/full-match.js +8 -5
- package/dist/v1/language/value/syntax/node-path/validate.js +4 -6
- package/dist/v1/language/view/model/view.d.ts +2 -4
- package/dist/v1/language/view/resolved.d.ts +2 -2
- package/dist/v1/schema/analysis/class.d.ts +36 -6
- package/dist/v1/schema/analysis/class.js +31 -66
- package/dist/v1/schema/canonical/revision.d.ts +2 -1
- package/dist/v1/schema/canonical/revision.js +4 -1
- package/dist/v1/schema/compatibility/api.d.ts +3 -0
- package/dist/v1/schema/compatibility/api.js +2 -0
- package/dist/v1/schema/compatibility/comparators/callables.d.ts +39 -0
- package/dist/v1/schema/compatibility/comparators/callables.js +101 -0
- package/dist/v1/schema/compatibility/comparators/classes.d.ts +47 -0
- package/dist/v1/schema/compatibility/comparators/classes.js +160 -0
- package/dist/v1/schema/compatibility/comparators/index.d.ts +12 -0
- package/dist/v1/schema/compatibility/comparators/index.js +53 -0
- package/dist/v1/schema/compatibility/comparators/members.d.ts +4 -0
- package/dist/v1/schema/compatibility/comparators/members.js +49 -0
- package/dist/v1/schema/compatibility/comparators/values.d.ts +5 -0
- package/dist/v1/schema/compatibility/comparators/values.js +37 -0
- package/dist/v1/schema/compatibility/compare.d.ts +5 -0
- package/dist/v1/schema/compatibility/compare.js +23 -0
- package/dist/v1/schema/compatibility/context.d.ts +19 -0
- package/dist/v1/schema/compatibility/context.js +49 -0
- package/dist/v1/schema/compatibility/coordinate.d.ts +40 -0
- package/dist/v1/schema/compatibility/coordinate.js +38 -0
- package/dist/v1/schema/compatibility/diff.d.ts +12 -0
- package/dist/v1/schema/compatibility/diff.js +39 -0
- package/dist/v1/schema/compatibility/evidence.d.ts +16 -0
- package/dist/v1/schema/compatibility/evidence.js +62 -0
- package/dist/v1/schema/compatibility/fields.d.ts +194 -0
- package/dist/v1/schema/compatibility/fields.js +94 -0
- package/dist/v1/schema/compatibility/index.d.ts +6 -0
- package/dist/v1/schema/compatibility/index.js +3 -0
- package/dist/v1/schema/compatibility/meaning/footprint.d.ts +7 -0
- package/dist/v1/schema/compatibility/meaning/footprint.js +59 -0
- package/dist/v1/schema/compatibility/meaning/index.d.ts +3 -0
- package/dist/v1/schema/compatibility/meaning/index.js +16 -0
- package/dist/v1/schema/compatibility/model.d.ts +131 -0
- package/dist/v1/schema/compatibility/model.js +1 -0
- package/dist/v1/schema/compatibility/references.d.ts +38 -0
- package/dist/v1/schema/compatibility/references.js +149 -0
- package/dist/v1/schema/compatibility/report.d.ts +27 -0
- package/dist/v1/schema/compatibility/report.js +100 -0
- package/dist/v1/schema/compatibility/scope.d.ts +36 -0
- package/dist/v1/schema/compatibility/scope.js +110 -0
- package/dist/v1/schema/compatibility/structure/index.d.ts +3 -0
- package/dist/v1/schema/compatibility/structure/index.js +40 -0
- package/dist/v1/schema/compatibility/structure/inheritance.d.ts +7 -0
- package/dist/v1/schema/compatibility/structure/inheritance.js +68 -0
- package/dist/v1/schema/compatibility/structure/requirements.d.ts +7 -0
- package/dist/v1/schema/compatibility/structure/requirements.js +97 -0
- package/dist/v1/schema/compatibility/subjects.d.ts +39 -0
- package/dist/v1/schema/compatibility/subjects.js +143 -0
- package/dist/v1/schema/compatibility/versioning/index.d.ts +8 -0
- package/dist/v1/schema/compatibility/versioning/index.js +50 -0
- package/dist/v1/schema/compatibility/versioning/members.d.ts +12 -0
- package/dist/v1/schema/compatibility/versioning/members.js +47 -0
- package/dist/v1/schema/compatibility/versioning/surface.d.ts +11 -0
- package/dist/v1/schema/compatibility/versioning/surface.js +61 -0
- package/dist/v1/schema/diagnostic.d.ts +1 -1
- package/dist/v1/schema/fingerprint.d.ts +2 -0
- package/dist/v1/schema/fingerprint.js +1 -0
- package/dist/v1/schema/index.d.ts +4 -3
- package/dist/v1/schema/index.js +2 -1
- package/dist/v1/schema/model/schema.d.ts +8 -11
- package/dist/v1/schema/normalization/domain.js +57 -13
- package/dist/v1/schema/resolution/definition.index.d.ts +1 -2
- package/dist/v1/schema/resolution/definition.index.js +0 -3
- package/dist/v1/schema/resolution/domain.d.ts +4 -1
- package/dist/v1/schema/resolution/domain.js +26 -18
- package/dist/v1/schema/resolution/origins.d.ts +28 -5
- package/dist/v1/schema/resolution/origins.js +68 -31
- package/dist/v1/schema/validation/callable.d.ts +4 -0
- package/dist/v1/schema/validation/callable.js +39 -0
- package/dist/v1/schema/validation/class.d.ts +10 -0
- package/dist/v1/schema/validation/class.js +79 -60
- package/dist/v1/schema/validation/core.js +83 -55
- package/dist/v1/schema/validation/domain.d.ts +2 -1
- package/dist/v1/schema/validation/domain.js +2 -0
- package/dist/v1/schema/validation/domain.structure.d.ts +0 -2
- package/dist/v1/schema/validation/domain.structure.js +214 -171
- package/dist/v1/schema/validation/policy/budgets.js +36 -6
- package/dist/v1/schema/validation/policy/context.js +5 -16
- package/dist/v1/schema/validation/policy/objects.d.ts +4 -0
- package/dist/v1/schema/validation/policy/objects.js +71 -0
- package/dist/v1/schema/validation/policy/references.js +16 -4
- package/dist/v1/schema/validation/policy/typing.d.ts +2 -0
- package/dist/v1/schema/validation/policy/typing.js +55 -7
- package/dist/v1/schema/validation/policy/uses.js +73 -99
- package/dist/v1/schema/validation/value-api.d.ts +2 -0
- package/dist/v1/schema/validation/value-api.js +1 -0
- package/dist/v1/schema/validation/value.js +7 -1
- package/dist/v1/schema/validation/view.js +14 -9
- package/dist/value/accept.d.ts +9 -0
- package/dist/value/accept.js +106 -7
- package/dist/value/canonical.d.ts +3 -0
- package/dist/value/canonical.js +22 -6
- package/dist/value/immutable.optimization.d.ts +15 -0
- package/dist/value/immutable.optimization.js +34 -0
- package/dist/value/index.d.ts +1 -1
- package/dist/value/index.js +1 -1
- package/dist/value/json.d.ts +1 -1
- package/dist/value/json.js +1 -1
- package/dist/value/limits.d.ts +1 -1
- package/dist/value/unicode.d.ts +4 -1
- package/dist/value/unicode.js +28 -0
- package/package.json +20 -5
- package/dist/v1/schema/compatibility/meaning.d.ts +0 -29
- package/dist/v1/schema/compatibility/meaning.js +0 -605
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import { isValueObject as isJsonObject } from '../../../language/value/model/object.js';
|
|
3
|
+
import { SCHEMA_ARRAY_KEYWORDS, SCHEMA_MAP_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, } from '../../../language/value/syntax/keywords.js';
|
|
4
|
+
import { digestDomainSchemaBytes } from '../../canonical/domain.digest.js';
|
|
5
|
+
import { ANNOTATION_KEYWORDS } from '../fields.js';
|
|
6
|
+
/** Drop annotation keywords wherever a schema keyword nests a schema; never inside data. */
|
|
7
|
+
export function semanticValueSchema(value) {
|
|
8
|
+
if (typeof value === 'boolean')
|
|
9
|
+
return value;
|
|
10
|
+
const semantic = {};
|
|
11
|
+
for (const [keyword, entry] of Object.entries(value)) {
|
|
12
|
+
if (ANNOTATION_KEYWORDS.includes(keyword))
|
|
13
|
+
continue;
|
|
14
|
+
if (SCHEMA_SINGLE_KEYWORDS.has(keyword) && isJsonSchema(entry)) {
|
|
15
|
+
semantic[keyword] = semanticValueSchema(entry);
|
|
16
|
+
}
|
|
17
|
+
else if (SCHEMA_ARRAY_KEYWORDS.has(keyword) && Array.isArray(entry)) {
|
|
18
|
+
semantic[keyword] = entry.map((item) => isJsonSchema(item) ? semanticValueSchema(item) : item);
|
|
19
|
+
}
|
|
20
|
+
else if (SCHEMA_MAP_KEYWORDS.has(keyword) && isJsonObject(entry)) {
|
|
21
|
+
semantic[keyword] = Object.fromEntries(Object.entries(entry).map(([name, item]) => [
|
|
22
|
+
name,
|
|
23
|
+
isJsonSchema(item) ? semanticValueSchema(item) : item,
|
|
24
|
+
]));
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
semantic[keyword] = entry;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return semantic;
|
|
31
|
+
}
|
|
32
|
+
export function fingerprintMeaning(value) {
|
|
33
|
+
return digestDomainSchemaBytes(json.encode(value));
|
|
34
|
+
}
|
|
35
|
+
function isJsonSchema(value) {
|
|
36
|
+
return typeof value === 'boolean' || isJsonObject(value);
|
|
37
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Comparison, ComparisonRequest, MeaningComparison, StructureComparison } from './model.js';
|
|
2
|
+
/** Complete facts and independent conclusions, resolved against the same exact contexts. */
|
|
3
|
+
export declare function compare(request: ComparisonRequest): Comparison;
|
|
4
|
+
export declare function compareStructure(request: ComparisonRequest): StructureComparison;
|
|
5
|
+
export declare function compareMeaning(request: ComparisonRequest): MeaningComparison;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { analyzeMeaning } from './meaning/index.js';
|
|
2
|
+
import { mergeEntries } from './report.js';
|
|
3
|
+
import { prepare } from './scope.js';
|
|
4
|
+
import { analyzeStructure } from './structure/index.js';
|
|
5
|
+
/** Complete facts and independent conclusions, resolved against the same exact contexts. */
|
|
6
|
+
export function compare(request) {
|
|
7
|
+
const context = prepare(request);
|
|
8
|
+
const structure = analyzeStructure(context);
|
|
9
|
+
const meaning = analyzeMeaning(context);
|
|
10
|
+
return Object.freeze({
|
|
11
|
+
scope: context.scope,
|
|
12
|
+
entries: mergeEntries(structure.entries, meaning.entries),
|
|
13
|
+
structure,
|
|
14
|
+
meaning,
|
|
15
|
+
evidence: Object.freeze({ structure: structure.evidence, meaning: meaning.evidence }),
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export function compareStructure(request) {
|
|
19
|
+
return analyzeStructure(prepare(request));
|
|
20
|
+
}
|
|
21
|
+
export function compareMeaning(request) {
|
|
22
|
+
return analyzeMeaning(prepare(request));
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ClassRef, DefinitionRef, Key as SemanticKey } from '../../addressing/index.js';
|
|
2
|
+
import type { DefinitionAnalysis, EffectiveMethod } from '../analysis/class.js';
|
|
3
|
+
import type { DomainSchema } from '../model/schema.js';
|
|
4
|
+
import { SchemaError } from '../diagnostic.js';
|
|
5
|
+
/** One accepted root with its exact closure and a memoized Definition analysis per owner. */
|
|
6
|
+
export interface Context {
|
|
7
|
+
readonly schemas: ReadonlyMap<string, DomainSchema>;
|
|
8
|
+
analysis(owner: DomainSchema): ReadonlyMap<string, DefinitionAnalysis>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Every owner passed acceptance against the closure it retains, which is the only way a schema
|
|
12
|
+
* gets one, so its analysis is derived without validating it again.
|
|
13
|
+
*/
|
|
14
|
+
export declare function contextOf(root: DomainSchema): Context;
|
|
15
|
+
export declare function effectiveDefinition(context: Context, owner: DomainSchema, ref: ClassRef): DefinitionAnalysis | undefined;
|
|
16
|
+
/** Effective Methods are keyed by name; a coordinate names one by its exact Method Key. */
|
|
17
|
+
export declare function effectiveMethod(analysis: DefinitionAnalysis, key: SemanticKey): EffectiveMethod | undefined;
|
|
18
|
+
export declare function requireOwner(context: Context, ref: DefinitionRef, key: SemanticKey): DomainSchema;
|
|
19
|
+
export declare function contextInvalid(message: string, key: SemanticKey): SchemaError;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MethodKey } from '../../addressing/index.js';
|
|
2
|
+
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
3
|
+
import { analyzeDefinitions } from '../analysis/class.js';
|
|
4
|
+
import { SchemaError, diagnostic } from '../diagnostic.js';
|
|
5
|
+
import { knownDomainClosure, lookupForDomainClosure } from '../resolution/closure.js';
|
|
6
|
+
import { buildDomainResolutionContext } from '../resolution/context.js';
|
|
7
|
+
/**
|
|
8
|
+
* Every owner passed acceptance against the closure it retains, which is the only way a schema
|
|
9
|
+
* gets one, so its analysis is derived without validating it again.
|
|
10
|
+
*/
|
|
11
|
+
export function contextOf(root) {
|
|
12
|
+
const schemas = new Map([
|
|
13
|
+
[root.origin, root],
|
|
14
|
+
...(knownDomainClosure(root) ?? []).map(({ schema }) => [schema.origin, schema]),
|
|
15
|
+
]);
|
|
16
|
+
const analyses = new Map();
|
|
17
|
+
return {
|
|
18
|
+
schemas,
|
|
19
|
+
analysis(owner) {
|
|
20
|
+
let definitions = analyses.get(owner);
|
|
21
|
+
if (definitions === undefined) {
|
|
22
|
+
definitions = analyzeDefinitions(buildDomainResolutionContext(owner, lookupForDomainClosure(owner))).definitions;
|
|
23
|
+
analyses.set(owner, definitions);
|
|
24
|
+
}
|
|
25
|
+
return definitions;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function effectiveDefinition(context, owner, ref) {
|
|
30
|
+
return context.analysis(owner).get(definitionRefIndex(ref));
|
|
31
|
+
}
|
|
32
|
+
/** Effective Methods are keyed by name; a coordinate names one by its exact Method Key. */
|
|
33
|
+
export function effectiveMethod(analysis, key) {
|
|
34
|
+
for (const method of analysis.methods.values()) {
|
|
35
|
+
if (MethodKey.of(method.owner, method.name) === key)
|
|
36
|
+
return method;
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
export function requireOwner(context, ref, key) {
|
|
41
|
+
const owner = context.schemas.get(ref.origin);
|
|
42
|
+
if (owner === undefined) {
|
|
43
|
+
throw contextInvalid(`Retained acceptance context cannot resolve ${key}.`, key);
|
|
44
|
+
}
|
|
45
|
+
return owner;
|
|
46
|
+
}
|
|
47
|
+
export function contextInvalid(message, key) {
|
|
48
|
+
return new SchemaError([diagnostic('DM_DEPENDENCY_CONTEXT_INVALID', '', message, key)]);
|
|
49
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ClassRef, Definition, DefinitionRef, Key as SemanticKey, PropertyKey as SemanticPropertyKey } from '../../addressing/index.js';
|
|
2
|
+
export type MemberRef = DefinitionRef<Exclude<Definition.Kind, 'class'>>;
|
|
3
|
+
export type ClassCoordinate = Readonly<{
|
|
4
|
+
kind: 'class';
|
|
5
|
+
key: SemanticKey;
|
|
6
|
+
ref: ClassRef;
|
|
7
|
+
}>;
|
|
8
|
+
export type MemberCoordinate = Readonly<{
|
|
9
|
+
kind: 'member';
|
|
10
|
+
key: SemanticKey;
|
|
11
|
+
ref: MemberRef;
|
|
12
|
+
}>;
|
|
13
|
+
export type PropertyCoordinate = Readonly<{
|
|
14
|
+
kind: 'property';
|
|
15
|
+
key: SemanticPropertyKey;
|
|
16
|
+
owner: ClassRef;
|
|
17
|
+
name: string;
|
|
18
|
+
}>;
|
|
19
|
+
export type MethodCoordinate = Readonly<{
|
|
20
|
+
kind: 'method';
|
|
21
|
+
key: SemanticKey;
|
|
22
|
+
owner: ClassRef;
|
|
23
|
+
name: string;
|
|
24
|
+
}>;
|
|
25
|
+
/** One exact semantic location, independent of how a dependent uses it. */
|
|
26
|
+
export type Coordinate = ClassCoordinate | MemberCoordinate | PropertyCoordinate | MethodCoordinate;
|
|
27
|
+
export declare function classCoordinate(ref: ClassRef): ClassCoordinate;
|
|
28
|
+
export declare function memberCoordinate(ref: MemberRef): MemberCoordinate;
|
|
29
|
+
export declare function propertyCoordinate(owner: ClassRef, name: string): PropertyCoordinate;
|
|
30
|
+
export declare function methodCoordinate(owner: ClassRef, name: string): MethodCoordinate;
|
|
31
|
+
export declare function keyForDefinitionRef(ref: DefinitionRef): SemanticKey;
|
|
32
|
+
interface ParsedKeyReference {
|
|
33
|
+
readonly kind: Definition.Kind;
|
|
34
|
+
readonly name: string;
|
|
35
|
+
readonly member?: 'property' | 'method';
|
|
36
|
+
readonly ownerName?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Interpret one canonical V1 Key as a Definition or a Class member location. */
|
|
39
|
+
export declare function keyReference(key: SemanticKey): ParsedKeyReference;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Key, MethodKey, PropertyKey } from '../../addressing/index.js';
|
|
2
|
+
import { SchemaError, diagnostic } from '../diagnostic.js';
|
|
3
|
+
export function classCoordinate(ref) {
|
|
4
|
+
return Object.freeze({ kind: 'class', key: keyForDefinitionRef(ref), ref });
|
|
5
|
+
}
|
|
6
|
+
export function memberCoordinate(ref) {
|
|
7
|
+
return Object.freeze({ kind: 'member', key: keyForDefinitionRef(ref), ref });
|
|
8
|
+
}
|
|
9
|
+
export function propertyCoordinate(owner, name) {
|
|
10
|
+
return Object.freeze({ kind: 'property', key: PropertyKey.of(owner, name), owner, name });
|
|
11
|
+
}
|
|
12
|
+
export function methodCoordinate(owner, name) {
|
|
13
|
+
return Object.freeze({ kind: 'method', key: MethodKey.of(owner, name), owner, name });
|
|
14
|
+
}
|
|
15
|
+
export function keyForDefinitionRef(ref) {
|
|
16
|
+
return ref.kind === 'core'
|
|
17
|
+
? Key.of(ref)
|
|
18
|
+
: Key.of(ref);
|
|
19
|
+
}
|
|
20
|
+
/** Interpret one canonical V1 Key as a Definition or a Class member location. */
|
|
21
|
+
export function keyReference(key) {
|
|
22
|
+
const semantic = key.slice(key.indexOf(':') + 1);
|
|
23
|
+
const parts = semantic.split('.');
|
|
24
|
+
if (parts[0] === 'core' && parts.length === 2) {
|
|
25
|
+
return { kind: 'core', name: parts[1] };
|
|
26
|
+
}
|
|
27
|
+
if (parts.length === 2) {
|
|
28
|
+
return { kind: parts[0], name: parts[1] };
|
|
29
|
+
}
|
|
30
|
+
if (parts.length === 4 &&
|
|
31
|
+
parts[0] === 'class' &&
|
|
32
|
+
(parts[2] === 'property' || parts[2] === 'method')) {
|
|
33
|
+
return { kind: 'class', name: parts[3], member: parts[2], ownerName: parts[1] };
|
|
34
|
+
}
|
|
35
|
+
throw new SchemaError([
|
|
36
|
+
diagnostic('DM_MEMBER_ROOT_INVALID', '/roots', `Key ${key} has no supported V1 shape.`, key),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
/**
|
|
3
|
+
* One exact place where two meanings differ, addressed by JSON Pointer into the meaning value.
|
|
4
|
+
* An absent side is omitted: `before` only means removed, `after` only means added.
|
|
5
|
+
*/
|
|
6
|
+
export interface MeaningDifference {
|
|
7
|
+
readonly path: string;
|
|
8
|
+
readonly before?: JsonValue;
|
|
9
|
+
readonly after?: JsonValue;
|
|
10
|
+
}
|
|
11
|
+
/** Structural differences between two portable values, leaf by leaf, in JSON Pointer order. */
|
|
12
|
+
export declare function differences(before: JsonValue, after: JsonValue): readonly MeaningDifference[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { compareUnicode } from '../../addressing/ordering.js';
|
|
2
|
+
import { isValueObject as isJsonObject } from '../../language/value/model/object.js';
|
|
3
|
+
/** Structural differences between two portable values, leaf by leaf, in JSON Pointer order. */
|
|
4
|
+
export function differences(before, after) {
|
|
5
|
+
const found = [];
|
|
6
|
+
collect(before, after, '', found);
|
|
7
|
+
return Object.freeze(found.sort((left, right) => compareUnicode(left.path, right.path)));
|
|
8
|
+
}
|
|
9
|
+
function collect(before, after, path, found) {
|
|
10
|
+
if (Array.isArray(before) && Array.isArray(after)) {
|
|
11
|
+
const length = Math.max(before.length, after.length);
|
|
12
|
+
for (let index = 0; index < length; index += 1) {
|
|
13
|
+
collect(before[index], after[index], `${path}/${index}`, found);
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (isJsonObject(before) && isJsonObject(after)) {
|
|
18
|
+
const keys = [...new Set([...Object.keys(before), ...Object.keys(after)])].sort(compareUnicode);
|
|
19
|
+
for (const key of keys) {
|
|
20
|
+
collect(before[key], after[key], `${path}/${escape(key)}`, found);
|
|
21
|
+
}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (before === undefined && after === undefined)
|
|
25
|
+
return;
|
|
26
|
+
if (before !== undefined &&
|
|
27
|
+
after !== undefined &&
|
|
28
|
+
JSON.stringify(before) === JSON.stringify(after)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
found.push(Object.freeze({
|
|
32
|
+
path,
|
|
33
|
+
...(before === undefined ? {} : { before }),
|
|
34
|
+
...(after === undefined ? {} : { after }),
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
function escape(segment) {
|
|
38
|
+
return segment.replaceAll('~', '~0').replaceAll('/', '~1');
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Analysis, ComparisonEvidence } from './model.js';
|
|
2
|
+
/**
|
|
3
|
+
* Only semantic facts and decisions are durable; provenance and diagnostic prose are not. Each
|
|
4
|
+
* analysis names the oldest requirement policy that yields its facts: a version applies exactly when
|
|
5
|
+
* a fact it introduced is recorded, so a comparison without one keeps the earlier version's bytes.
|
|
6
|
+
*/
|
|
7
|
+
export declare function evidenceOf({ kind, version, scope, entries, assessments, }: Omit<Analysis, 'evidence'> & {
|
|
8
|
+
readonly kind: ComparisonEvidence['kind'];
|
|
9
|
+
readonly version: ComparisonEvidence['version'];
|
|
10
|
+
}): ComparisonEvidence;
|
|
11
|
+
/**
|
|
12
|
+
* Whether a referenced or inherited Class lost an effective Property. The fact is recorded only on a
|
|
13
|
+
* loss, so the evidence version that introduced it applies exactly when it is present
|
|
14
|
+
* (DM-CLASS-PROPERTIES).
|
|
15
|
+
*/
|
|
16
|
+
export declare function losesProperties({ entries }: Pick<Analysis, 'entries'>): boolean;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { compareUnicode } from '../../addressing/ordering.js';
|
|
2
|
+
import { fingerprintMeaning } from './comparators/values.js';
|
|
3
|
+
/**
|
|
4
|
+
* Only semantic facts and decisions are durable; provenance and diagnostic prose are not. Each
|
|
5
|
+
* analysis names the oldest requirement policy that yields its facts: a version applies exactly when
|
|
6
|
+
* a fact it introduced is recorded, so a comparison without one keeps the earlier version's bytes.
|
|
7
|
+
*/
|
|
8
|
+
export function evidenceOf({ kind, version, scope, entries, assessments, }) {
|
|
9
|
+
return Object.freeze({
|
|
10
|
+
kind,
|
|
11
|
+
version,
|
|
12
|
+
fingerprint: fingerprintMeaning({
|
|
13
|
+
kind,
|
|
14
|
+
version,
|
|
15
|
+
scope: {
|
|
16
|
+
kind: scope.kind,
|
|
17
|
+
source: [scope.source.origin, scope.source.revision],
|
|
18
|
+
target: [scope.target.origin, scope.target.revision],
|
|
19
|
+
dependent: scope.dependent === undefined ? null : [scope.dependent.origin, scope.dependent.revision],
|
|
20
|
+
roots: scope.roots,
|
|
21
|
+
},
|
|
22
|
+
observations: entries.flatMap((entry) => [...entry.observations]
|
|
23
|
+
.sort((a, b) => compareUnicode(evidenceFacet(a.facet), evidenceFacet(b.facet)))
|
|
24
|
+
.map((observation) => [
|
|
25
|
+
entry.subject.key,
|
|
26
|
+
evidenceFacet(observation.facet),
|
|
27
|
+
observation.before === undefined ? null : fingerprintMeaning(observation.before),
|
|
28
|
+
observation.after === undefined ? null : fingerprintMeaning(observation.after),
|
|
29
|
+
])),
|
|
30
|
+
assessments: [...assessments]
|
|
31
|
+
.sort((a, b) => compareUnicode(`${a.subject.key}#${evidenceFacet(a.observation.facet)}`, `${b.subject.key}#${evidenceFacet(b.observation.facet)}`) ||
|
|
32
|
+
compareUnicode(evidenceFacet(a.requirement.kind), evidenceFacet(b.requirement.kind)))
|
|
33
|
+
.map((assessment) => [
|
|
34
|
+
assessment.subject.key,
|
|
35
|
+
evidenceFacet(assessment.observation.facet),
|
|
36
|
+
evidenceFacet(assessment.requirement.kind),
|
|
37
|
+
assessment.satisfied,
|
|
38
|
+
]),
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Whether a referenced or inherited Class lost an effective Property. The fact is recorded only on a
|
|
44
|
+
* loss, so the evidence version that introduced it applies exactly when it is present
|
|
45
|
+
* (DM-CLASS-PROPERTIES).
|
|
46
|
+
*/
|
|
47
|
+
export function losesProperties({ entries }) {
|
|
48
|
+
return entries.some(({ observations }) => observations.some(({ facet }) => facet === 'class.properties'));
|
|
49
|
+
}
|
|
50
|
+
/** Version-1 evidence keeps its original tags independently of public facet names. */
|
|
51
|
+
function evidenceFacet(facet) {
|
|
52
|
+
switch (facet) {
|
|
53
|
+
case 'method.signature':
|
|
54
|
+
return 'method.contract';
|
|
55
|
+
case 'function.signature':
|
|
56
|
+
return 'function.contract';
|
|
57
|
+
case 'method.inheritance':
|
|
58
|
+
return 'method.signature';
|
|
59
|
+
default:
|
|
60
|
+
return facet;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How strongly a dependent relies on a dependency Class. `inherit` covers `extends` and Core
|
|
3
|
+
* instantiation, which take on the Class creation contract; `reference` covers every other site,
|
|
4
|
+
* which only names the Class and reads its surface.
|
|
5
|
+
*/
|
|
6
|
+
export type DependencyMeaningLevel = 'reference' | 'inherit';
|
|
7
|
+
/**
|
|
8
|
+
* Where one declaration field counts for a dependent:
|
|
9
|
+
* - `always`: at every usage level;
|
|
10
|
+
* - `inherit`: only when the dependent inherits or instantiates the Class;
|
|
11
|
+
* - `members`: as separate Property and Method coordinates with their own meaning;
|
|
12
|
+
* - `excluded`: never, for the stated reason.
|
|
13
|
+
*
|
|
14
|
+
* Every field of every declaration kind is classified below. A field added to the DSL does not
|
|
15
|
+
* compile until it is classified, so meaning can only be narrowed by an explicit decision.
|
|
16
|
+
*/
|
|
17
|
+
export type FieldRole = 'always' | 'inherit' | 'members' | {
|
|
18
|
+
readonly excluded: 'identity' | 'annotation' | 'authorization' | 'presentation';
|
|
19
|
+
};
|
|
20
|
+
/** The coordinate Key already names the declaration; its `ref` is never repeated in the meaning. */
|
|
21
|
+
export declare const CLASS_FIELDS: Readonly<{
|
|
22
|
+
ref: Readonly<{
|
|
23
|
+
excluded: 'identity';
|
|
24
|
+
}>;
|
|
25
|
+
kind: "always";
|
|
26
|
+
abstract: "always";
|
|
27
|
+
orientation: "always";
|
|
28
|
+
extends: "inherit";
|
|
29
|
+
policies: "inherit";
|
|
30
|
+
data: "inherit";
|
|
31
|
+
endpoints: "inherit";
|
|
32
|
+
constraints: "inherit";
|
|
33
|
+
properties: "members";
|
|
34
|
+
methods: "members";
|
|
35
|
+
description: Readonly<{
|
|
36
|
+
excluded: 'annotation';
|
|
37
|
+
}>;
|
|
38
|
+
icon: Readonly<{
|
|
39
|
+
excluded: 'presentation';
|
|
40
|
+
}>;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const PROPERTY_FIELDS: Readonly<{
|
|
43
|
+
schema: "always";
|
|
44
|
+
required: "always";
|
|
45
|
+
auto: "always";
|
|
46
|
+
immutable: "always";
|
|
47
|
+
state: "always";
|
|
48
|
+
description: Readonly<{
|
|
49
|
+
excluded: 'annotation';
|
|
50
|
+
}>;
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* The auth level and Policy check are decided by the Runtime at invocation, never compiled against.
|
|
54
|
+
* The execution modifier decides what an invocation returns; an accepted Schema carries it only
|
|
55
|
+
* when durable, so ordinary callables keep their meaning unchanged.
|
|
56
|
+
*/
|
|
57
|
+
export declare const CALLABLE_FIELDS: Readonly<{
|
|
58
|
+
ref: Readonly<{
|
|
59
|
+
excluded: 'identity';
|
|
60
|
+
}>;
|
|
61
|
+
input: "always";
|
|
62
|
+
output: "always";
|
|
63
|
+
static: "always";
|
|
64
|
+
abstract: "always";
|
|
65
|
+
execution: "always";
|
|
66
|
+
auth: Readonly<{
|
|
67
|
+
excluded: 'authorization';
|
|
68
|
+
}>;
|
|
69
|
+
policy: Readonly<{
|
|
70
|
+
excluded: 'authorization';
|
|
71
|
+
}>;
|
|
72
|
+
description: Readonly<{
|
|
73
|
+
excluded: 'annotation';
|
|
74
|
+
}>;
|
|
75
|
+
}>;
|
|
76
|
+
export declare const POLICY_FIELDS: Readonly<{
|
|
77
|
+
ref: Readonly<{
|
|
78
|
+
excluded: 'identity';
|
|
79
|
+
}>;
|
|
80
|
+
expression: "always";
|
|
81
|
+
description: Readonly<{
|
|
82
|
+
excluded: 'annotation';
|
|
83
|
+
}>;
|
|
84
|
+
}>;
|
|
85
|
+
export declare const VIEW_FIELDS: Readonly<{
|
|
86
|
+
ref: Readonly<{
|
|
87
|
+
excluded: 'identity';
|
|
88
|
+
}>;
|
|
89
|
+
target: "always";
|
|
90
|
+
description: Readonly<{
|
|
91
|
+
excluded: 'annotation';
|
|
92
|
+
}>;
|
|
93
|
+
}>;
|
|
94
|
+
export declare const CORE_FIELDS: Readonly<{
|
|
95
|
+
ref: Readonly<{
|
|
96
|
+
excluded: 'identity';
|
|
97
|
+
}>;
|
|
98
|
+
class: "always";
|
|
99
|
+
properties: "always";
|
|
100
|
+
source: "always";
|
|
101
|
+
target: "always";
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* JSON Schema keywords that annotate a value schema without constraining its values. Every other
|
|
105
|
+
* keyword, `x-astrale-path` included, is semantic; arbitrary JSON data is never inspected as schema.
|
|
106
|
+
* A frozen, Unicode-ordered list like the role tables: printable, and immutable at runtime.
|
|
107
|
+
*/
|
|
108
|
+
export declare const ANNOTATION_KEYWORDS: readonly string[];
|
|
109
|
+
/** The complete classification, one table per declaration kind. */
|
|
110
|
+
export declare const FIELD_ROLES: Readonly<{
|
|
111
|
+
class: Readonly<{
|
|
112
|
+
ref: Readonly<{
|
|
113
|
+
excluded: 'identity';
|
|
114
|
+
}>;
|
|
115
|
+
kind: "always";
|
|
116
|
+
abstract: "always";
|
|
117
|
+
orientation: "always";
|
|
118
|
+
extends: "inherit";
|
|
119
|
+
policies: "inherit";
|
|
120
|
+
data: "inherit";
|
|
121
|
+
endpoints: "inherit";
|
|
122
|
+
constraints: "inherit";
|
|
123
|
+
properties: "members";
|
|
124
|
+
methods: "members";
|
|
125
|
+
description: Readonly<{
|
|
126
|
+
excluded: 'annotation';
|
|
127
|
+
}>;
|
|
128
|
+
icon: Readonly<{
|
|
129
|
+
excluded: 'presentation';
|
|
130
|
+
}>;
|
|
131
|
+
}>;
|
|
132
|
+
property: Readonly<{
|
|
133
|
+
schema: "always";
|
|
134
|
+
required: "always";
|
|
135
|
+
auto: "always";
|
|
136
|
+
immutable: "always";
|
|
137
|
+
state: "always";
|
|
138
|
+
description: Readonly<{
|
|
139
|
+
excluded: 'annotation';
|
|
140
|
+
}>;
|
|
141
|
+
}>;
|
|
142
|
+
callable: Readonly<{
|
|
143
|
+
ref: Readonly<{
|
|
144
|
+
excluded: 'identity';
|
|
145
|
+
}>;
|
|
146
|
+
input: "always";
|
|
147
|
+
output: "always";
|
|
148
|
+
static: "always";
|
|
149
|
+
abstract: "always";
|
|
150
|
+
execution: "always";
|
|
151
|
+
auth: Readonly<{
|
|
152
|
+
excluded: 'authorization';
|
|
153
|
+
}>;
|
|
154
|
+
policy: Readonly<{
|
|
155
|
+
excluded: 'authorization';
|
|
156
|
+
}>;
|
|
157
|
+
description: Readonly<{
|
|
158
|
+
excluded: 'annotation';
|
|
159
|
+
}>;
|
|
160
|
+
}>;
|
|
161
|
+
policy: Readonly<{
|
|
162
|
+
ref: Readonly<{
|
|
163
|
+
excluded: 'identity';
|
|
164
|
+
}>;
|
|
165
|
+
expression: "always";
|
|
166
|
+
description: Readonly<{
|
|
167
|
+
excluded: 'annotation';
|
|
168
|
+
}>;
|
|
169
|
+
}>;
|
|
170
|
+
view: Readonly<{
|
|
171
|
+
ref: Readonly<{
|
|
172
|
+
excluded: 'identity';
|
|
173
|
+
}>;
|
|
174
|
+
target: "always";
|
|
175
|
+
description: Readonly<{
|
|
176
|
+
excluded: 'annotation';
|
|
177
|
+
}>;
|
|
178
|
+
}>;
|
|
179
|
+
core: Readonly<{
|
|
180
|
+
ref: Readonly<{
|
|
181
|
+
excluded: 'identity';
|
|
182
|
+
}>;
|
|
183
|
+
class: "always";
|
|
184
|
+
properties: "always";
|
|
185
|
+
source: "always";
|
|
186
|
+
target: "always";
|
|
187
|
+
}>;
|
|
188
|
+
}>;
|
|
189
|
+
/** Classification drives projection; special semantic normalization stays with each comparator. */
|
|
190
|
+
export declare function fieldsOf({ declaration, roles, level, }: {
|
|
191
|
+
readonly declaration: object;
|
|
192
|
+
readonly roles: Readonly<Record<string, FieldRole>>;
|
|
193
|
+
readonly level?: DependencyMeaningLevel;
|
|
194
|
+
}): Readonly<Record<string, unknown>>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const IDENTITY = Object.freeze({ excluded: 'identity' });
|
|
2
|
+
const ANNOTATION = Object.freeze({ excluded: 'annotation' });
|
|
3
|
+
const AUTHORIZATION = Object.freeze({ excluded: 'authorization' });
|
|
4
|
+
const PRESENTATION = Object.freeze({ excluded: 'presentation' });
|
|
5
|
+
/** The coordinate Key already names the declaration; its `ref` is never repeated in the meaning. */
|
|
6
|
+
export const CLASS_FIELDS = Object.freeze({
|
|
7
|
+
ref: IDENTITY,
|
|
8
|
+
kind: 'always',
|
|
9
|
+
abstract: 'always',
|
|
10
|
+
orientation: 'always',
|
|
11
|
+
extends: 'inherit',
|
|
12
|
+
policies: 'inherit',
|
|
13
|
+
data: 'inherit',
|
|
14
|
+
endpoints: 'inherit',
|
|
15
|
+
constraints: 'inherit',
|
|
16
|
+
properties: 'members',
|
|
17
|
+
methods: 'members',
|
|
18
|
+
description: ANNOTATION,
|
|
19
|
+
icon: PRESENTATION,
|
|
20
|
+
});
|
|
21
|
+
export const PROPERTY_FIELDS = Object.freeze({
|
|
22
|
+
schema: 'always',
|
|
23
|
+
required: 'always',
|
|
24
|
+
auto: 'always',
|
|
25
|
+
immutable: 'always',
|
|
26
|
+
state: 'always',
|
|
27
|
+
description: ANNOTATION,
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* The auth level and Policy check are decided by the Runtime at invocation, never compiled against.
|
|
31
|
+
* The execution modifier decides what an invocation returns; an accepted Schema carries it only
|
|
32
|
+
* when durable, so ordinary callables keep their meaning unchanged.
|
|
33
|
+
*/
|
|
34
|
+
export const CALLABLE_FIELDS = Object.freeze({
|
|
35
|
+
ref: IDENTITY,
|
|
36
|
+
input: 'always',
|
|
37
|
+
output: 'always',
|
|
38
|
+
static: 'always',
|
|
39
|
+
abstract: 'always',
|
|
40
|
+
execution: 'always',
|
|
41
|
+
auth: AUTHORIZATION,
|
|
42
|
+
policy: AUTHORIZATION,
|
|
43
|
+
description: ANNOTATION,
|
|
44
|
+
});
|
|
45
|
+
export const POLICY_FIELDS = Object.freeze({
|
|
46
|
+
ref: IDENTITY,
|
|
47
|
+
expression: 'always',
|
|
48
|
+
description: ANNOTATION,
|
|
49
|
+
});
|
|
50
|
+
export const VIEW_FIELDS = Object.freeze({
|
|
51
|
+
ref: IDENTITY,
|
|
52
|
+
target: 'always',
|
|
53
|
+
description: ANNOTATION,
|
|
54
|
+
});
|
|
55
|
+
export const CORE_FIELDS = Object.freeze({
|
|
56
|
+
ref: IDENTITY,
|
|
57
|
+
class: 'always',
|
|
58
|
+
properties: 'always',
|
|
59
|
+
source: 'always',
|
|
60
|
+
target: 'always',
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* JSON Schema keywords that annotate a value schema without constraining its values. Every other
|
|
64
|
+
* keyword, `x-astrale-path` included, is semantic; arbitrary JSON data is never inspected as schema.
|
|
65
|
+
* A frozen, Unicode-ordered list like the role tables: printable, and immutable at runtime.
|
|
66
|
+
*/
|
|
67
|
+
export const ANNOTATION_KEYWORDS = Object.freeze([
|
|
68
|
+
'$comment',
|
|
69
|
+
'contentEncoding',
|
|
70
|
+
'contentMediaType',
|
|
71
|
+
'contentSchema',
|
|
72
|
+
'default',
|
|
73
|
+
'deprecated',
|
|
74
|
+
'description',
|
|
75
|
+
'examples',
|
|
76
|
+
'format',
|
|
77
|
+
'readOnly',
|
|
78
|
+
'title',
|
|
79
|
+
'writeOnly',
|
|
80
|
+
]);
|
|
81
|
+
/** The complete classification, one table per declaration kind. */
|
|
82
|
+
export const FIELD_ROLES = Object.freeze({
|
|
83
|
+
class: CLASS_FIELDS,
|
|
84
|
+
property: PROPERTY_FIELDS,
|
|
85
|
+
callable: CALLABLE_FIELDS,
|
|
86
|
+
policy: POLICY_FIELDS,
|
|
87
|
+
view: VIEW_FIELDS,
|
|
88
|
+
core: CORE_FIELDS,
|
|
89
|
+
});
|
|
90
|
+
/** Classification drives projection; special semantic normalization stays with each comparator. */
|
|
91
|
+
export function fieldsOf({ declaration, roles, level = 'reference', }) {
|
|
92
|
+
return Object.fromEntries(Object.entries(declaration).filter(([name, value]) => value !== undefined &&
|
|
93
|
+
(roles[name] === 'always' || (level === 'inherit' && roles[name] === 'inherit'))));
|
|
94
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from './api.js';
|
|
2
|
+
export type { MeaningDifference } from './diff.js';
|
|
3
|
+
export { ANNOTATION_KEYWORDS, FIELD_ROLES } from './fields.js';
|
|
4
|
+
export type { FieldRole } from './fields.js';
|
|
5
|
+
export { callableFingerprint } from './comparators/callables.js';
|
|
6
|
+
export type { Fingerprint as MeaningFingerprint } from './model.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Report } from '../report.js';
|
|
2
|
+
import type { ComparisonContext } from '../scope.js';
|
|
3
|
+
/** Meaning follows complete callable contracts through the exact authored reference closure. */
|
|
4
|
+
export declare function compareFootprint({ context, report, }: {
|
|
5
|
+
readonly context: ComparisonContext;
|
|
6
|
+
readonly report: Report;
|
|
7
|
+
}): void;
|