@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { json } from '@astrale-os/kernel-dsl/value';
|
|
2
2
|
import { Key, PropertyKey } from '../../addressing/index.js';
|
|
3
3
|
import { definitionRefIndex } from '../../addressing/ordering.js';
|
|
4
|
-
import {
|
|
4
|
+
import { composeMethods } from '../../language/callable/composition.js';
|
|
5
5
|
import { canonicalizeValueSchema } from '../../language/value/profile/canonicalize.js';
|
|
6
6
|
import { diagnostic } from '../diagnostic.js';
|
|
7
7
|
const formatDefinitionRef = Key.of;
|
|
@@ -41,7 +41,7 @@ export function analyzeDefinitions(environment) {
|
|
|
41
41
|
declaration,
|
|
42
42
|
properties,
|
|
43
43
|
...(data === undefined ? {} : { data }),
|
|
44
|
-
methods,
|
|
44
|
+
...methods,
|
|
45
45
|
};
|
|
46
46
|
result.set(key, analysis);
|
|
47
47
|
visiting.delete(key);
|
|
@@ -62,8 +62,9 @@ function ownFields(owner, declaration) {
|
|
|
62
62
|
name,
|
|
63
63
|
schema: property.schema,
|
|
64
64
|
required: property.required,
|
|
65
|
-
visibility: property.visibility,
|
|
66
65
|
...(property.auto === undefined ? {} : { auto: property.auto }),
|
|
66
|
+
...(property.immutable === undefined ? {} : { immutable: property.immutable }),
|
|
67
|
+
...(property.state === undefined ? {} : { state: property.state }),
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
return result;
|
|
@@ -107,75 +108,39 @@ function mergeData(owner, declaration, parents, diagnostics) {
|
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
function mergeMethods(owner, declaration, parents, diagnostics) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const entries = inherited.get(name) ?? [];
|
|
116
|
-
if (!entries.some((entry) => entry.identity === method.identity))
|
|
117
|
-
entries.push(method);
|
|
118
|
-
inherited.set(name, entries);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
const result = new Map();
|
|
122
|
-
for (const [name, entries] of inherited) {
|
|
123
|
-
if (entries.length === 1)
|
|
124
|
-
result.set(name, entries[0]);
|
|
125
|
-
}
|
|
126
|
-
for (const [name, ownMethod] of Object.entries(declaration.methods)) {
|
|
127
|
-
const parentsForName = inherited.get(name) ?? [];
|
|
128
|
-
for (const parent of parentsForName) {
|
|
129
|
-
if (parent.declaration.inheritance === 'sealed') {
|
|
130
|
-
diagnostics.push(diagnostic('DV_METHOD_COMPOSITION', '', `Method ${name} cannot override sealed ${formatDefinitionRef(parent.owner)}.${name}.`));
|
|
131
|
-
}
|
|
132
|
-
if (!sameMethodSignature(ownMethod, parent.declaration)) {
|
|
133
|
-
diagnostics.push(diagnostic('DV_METHOD_COMPOSITION', '', `Method ${name} does not exactly preserve its inherited signature.`));
|
|
134
|
-
}
|
|
135
|
-
if (parent.declaration.inheritance !== 'abstract' &&
|
|
136
|
-
canonicalPolicy(parent.declaration.policy) !== canonicalPolicy(ownMethod.policy)) {
|
|
137
|
-
diagnostics.push(diagnostic('DV_METHOD_COMPOSITION', '', `Method ${name} changes an executable inherited Policy.`));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
result.set(name, {
|
|
141
|
-
identity: `${definitionRefIndex(owner)}\u0000method\u0000${name}`,
|
|
142
|
-
owner,
|
|
143
|
-
name,
|
|
144
|
-
declaration: ownMethod,
|
|
145
|
-
});
|
|
146
|
-
inherited.delete(name);
|
|
147
|
-
}
|
|
148
|
-
for (const [name, entries] of inherited) {
|
|
149
|
-
if (entries.length > 1) {
|
|
150
|
-
diagnostics.push(diagnostic('DV_METHOD_COMPOSITION', '', `Inherited method ${name} is ambiguous and has no local override.`));
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
if (declaration.kind === 'node' && !declaration.abstract) {
|
|
154
|
-
for (const [name, method] of result) {
|
|
155
|
-
if (method.declaration.inheritance === 'abstract') {
|
|
156
|
-
diagnostics.push(diagnostic('DV_METHOD_COMPOSITION', '', `Concrete Class ${owner.name} leaves method ${name} abstract.`));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return result;
|
|
111
|
+
const own = new Map(Object.entries('methods' in declaration ? declaration.methods : {}).map(([name, method]) => [
|
|
112
|
+
name,
|
|
113
|
+
{ key: `${Key.of(owner)}.method.${name}`, owner, name, declaration: method },
|
|
114
|
+
]));
|
|
115
|
+
return composeMethods(parents, own, declaration.abstract, (left, right) => sameMethodSignature(left.declaration, right.declaration), (message) => diagnostics.push(diagnostic('DV_METHOD_COMPOSITION', '', message, Key.of(owner))));
|
|
161
116
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
117
|
+
/** The exact signature required by abstract Method composition. */
|
|
118
|
+
export function sameMethodSignature(left, right) {
|
|
119
|
+
return json.serialize(methodSignature(left)) === json.serialize(methodSignature(right));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Shared canonical signature used by admission and compatibility explanations. The execution
|
|
123
|
+
* modifier appears only when durable, so absent and `durable: false` are the same signature.
|
|
124
|
+
*/
|
|
125
|
+
export function methodSignature(value) {
|
|
126
|
+
return {
|
|
127
|
+
input: canonicalizeValueSchema(value.input, 'callable-input'),
|
|
128
|
+
output: canonicalMethodOutput(value),
|
|
129
|
+
auth: value.auth,
|
|
130
|
+
static: value.static,
|
|
131
|
+
...(value.execution?.durable === true ? { execution: { durable: true } } : {}),
|
|
132
|
+
};
|
|
168
133
|
}
|
|
169
134
|
function canonicalMethodOutput(value) {
|
|
170
135
|
switch (value.output.mode) {
|
|
171
136
|
case 'value':
|
|
172
|
-
return
|
|
137
|
+
return {
|
|
138
|
+
mode: 'value',
|
|
139
|
+
schema: canonicalizeValueSchema(value.output.schema, 'callable-output'),
|
|
140
|
+
};
|
|
173
141
|
case 'stream':
|
|
174
|
-
return
|
|
142
|
+
return { mode: 'stream', item: canonicalizeValueSchema(value.output.item, 'callable-output') };
|
|
175
143
|
case 'binary':
|
|
176
|
-
return 'binary';
|
|
144
|
+
return { mode: 'binary' };
|
|
177
145
|
}
|
|
178
146
|
}
|
|
179
|
-
function canonicalPolicy(value) {
|
|
180
|
-
return json.serialize(value === undefined ? null : normalizePolicyChecks(value));
|
|
181
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Revision } from '../../addressing/index.js';
|
|
2
2
|
import { type DomainSchema, type DomainSchemaIR } from '../model/schema.js';
|
|
3
|
-
|
|
3
|
+
interface CanonicalDomainSchema {
|
|
4
4
|
readonly schema: DomainSchema;
|
|
5
5
|
readonly bytes: Uint8Array;
|
|
6
6
|
readonly revision: Revision;
|
|
@@ -9,3 +9,4 @@ export declare function canonicalDomainSchema(value: DomainSchema): CanonicalDom
|
|
|
9
9
|
/** Internal acceptance seam. The caller must establish whole-Domain validity first. */
|
|
10
10
|
export declare function canonicalDomainSchemaAfterValidation(value: DomainSchemaIR): CanonicalDomainSchema;
|
|
11
11
|
export declare function revisionOfDomainSchema(schema: DomainSchema): Revision;
|
|
12
|
+
export {};
|
|
@@ -2,6 +2,8 @@ import { json } from '@astrale-os/kernel-dsl/value';
|
|
|
2
2
|
import { asDomainSchema } from '../model/schema.js';
|
|
3
3
|
import { digestDomainSchemaBytes } from './domain.digest.js';
|
|
4
4
|
import { canonicalizeDomainSchema } from './domain.js';
|
|
5
|
+
// Only canonical schemas created here own a retained revision, never caller-owned input.
|
|
6
|
+
const revisions = new WeakMap();
|
|
5
7
|
export function canonicalDomainSchema(value) {
|
|
6
8
|
return canonicalDomainSchemaAfterValidation(value);
|
|
7
9
|
}
|
|
@@ -10,8 +12,9 @@ export function canonicalDomainSchemaAfterValidation(value) {
|
|
|
10
12
|
const schema = asDomainSchema(canonicalizeDomainSchema(value));
|
|
11
13
|
const bytes = json.encode(schema);
|
|
12
14
|
const revision = digestDomainSchemaBytes(bytes);
|
|
15
|
+
revisions.set(schema, revision);
|
|
13
16
|
return Object.freeze({ schema, bytes, revision });
|
|
14
17
|
}
|
|
15
18
|
export function revisionOfDomainSchema(schema) {
|
|
16
|
-
return canonicalDomainSchema(schema).revision;
|
|
19
|
+
return revisions.get(schema) ?? canonicalDomainSchema(schema).revision;
|
|
17
20
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { compare, compareMeaning, compareStructure } from './compare.js';
|
|
2
|
+
export { requiredBump } from './versioning/index.js';
|
|
3
|
+
export type { Analysis, Assessment, Bump, Comparison, ComparisonEntry, ComparisonEvidence, ComparisonRequest, ComparisonScope, Facet, Fingerprint, MeaningComparison, Observation, RequiredBump, SchemaIdentity, StructureComparison, Subject, Usage, VersionChange, } from './model.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Value } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { CallableExecution, CallableOutput, CallableInputContract, FunctionDefinition, MethodDefinition } from '../../../language/callable/model/callable.js';
|
|
3
|
+
import type { ResolvedFunction, ResolvedMethod } from '../../../language/callable/resolved.js';
|
|
4
|
+
import type { EffectiveMethod } from '../../analysis/class.js';
|
|
5
|
+
import type { Fingerprint } from '../model.js';
|
|
6
|
+
export declare function methodExistence(method: EffectiveMethod): Value;
|
|
7
|
+
/**
|
|
8
|
+
* A Method as a Policy object resolves it: its owner's own declaration and whether that Class can
|
|
9
|
+
* execute it. Dispatch and the signature are the caller's, not the Policy's.
|
|
10
|
+
*/
|
|
11
|
+
export declare function methodObject(method: EffectiveMethod, owner: {
|
|
12
|
+
readonly abstract: boolean;
|
|
13
|
+
}): Value;
|
|
14
|
+
export declare function methodSignature(method: EffectiveMethod): Value;
|
|
15
|
+
export declare function methodInheritance(method: EffectiveMethod): Value;
|
|
16
|
+
export declare function functionSignature(declaration: FunctionDefinition): Value;
|
|
17
|
+
export declare function functionExistence(): Value;
|
|
18
|
+
/**
|
|
19
|
+
* Fingerprint the contract a caller compiles against, independently of its Domain revision: the
|
|
20
|
+
* exact key, the owner, dispatch and abstractness of a Method, the semantic input and output
|
|
21
|
+
* contracts, and the durable execution modifier; authorization is excluded
|
|
22
|
+
* (DM-CALLABLE-FINGERPRINT). A static consumer pins this instead of a Domain revision, so a
|
|
23
|
+
* dependency release that leaves the callable contract untouched keeps every bound invocation
|
|
24
|
+
* valid.
|
|
25
|
+
*/
|
|
26
|
+
export declare function callableFingerprint(callable: ResolvedFunction | ResolvedMethod): Fingerprint;
|
|
27
|
+
type CallableSignature = {
|
|
28
|
+
readonly static?: boolean;
|
|
29
|
+
readonly abstract?: boolean;
|
|
30
|
+
readonly execution?: CallableExecution;
|
|
31
|
+
readonly input: CallableInputContract;
|
|
32
|
+
readonly output: CallableOutput;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The `always` fields of CALLABLE_FIELDS: dispatch shape, the execution modifier, and the semantic
|
|
36
|
+
* input and output.
|
|
37
|
+
*/
|
|
38
|
+
export declare function callableSignature(declaration: Pick<FunctionDefinition, 'input' | 'output' | 'execution'> | Pick<MethodDefinition, 'static' | 'abstract' | 'input' | 'output' | 'execution'>): CallableSignature;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { isMethodExecutable } from '../../../language/callable/executable.js';
|
|
2
|
+
import { isBinaryInput } from '../../../language/callable/model/callable.js';
|
|
3
|
+
import { methodSignature as inheritedSignature } from '../../analysis/class.js';
|
|
4
|
+
import { deepFreeze } from '../../canonical/freeze.js';
|
|
5
|
+
import { keyForDefinitionRef } from '../coordinate.js';
|
|
6
|
+
import { CALLABLE_FIELDS, fieldsOf } from '../fields.js';
|
|
7
|
+
import { fingerprintMeaning, semanticValueSchema } from './values.js';
|
|
8
|
+
export function methodExistence(method) {
|
|
9
|
+
return deepFreeze({
|
|
10
|
+
coordinate: 'method',
|
|
11
|
+
owner: keyForDefinitionRef(method.owner),
|
|
12
|
+
name: method.name,
|
|
13
|
+
static: method.declaration.static,
|
|
14
|
+
abstract: method.declaration.abstract,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A Method as a Policy object resolves it: its owner's own declaration and whether that Class can
|
|
19
|
+
* execute it. Dispatch and the signature are the caller's, not the Policy's.
|
|
20
|
+
*/
|
|
21
|
+
export function methodObject(method, owner) {
|
|
22
|
+
return deepFreeze({
|
|
23
|
+
coordinate: 'method',
|
|
24
|
+
owner: keyForDefinitionRef(method.owner),
|
|
25
|
+
name: method.name,
|
|
26
|
+
executable: isMethodExecutable(owner, method.declaration),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function methodSignature(method) {
|
|
30
|
+
return deepFreeze({
|
|
31
|
+
coordinate: 'method',
|
|
32
|
+
owner: keyForDefinitionRef(method.owner),
|
|
33
|
+
name: method.name,
|
|
34
|
+
...callableSignature(method.declaration),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function methodInheritance(method) {
|
|
38
|
+
return deepFreeze({
|
|
39
|
+
coordinate: 'method',
|
|
40
|
+
owner: keyForDefinitionRef(method.owner),
|
|
41
|
+
name: method.name,
|
|
42
|
+
abstract: method.declaration.abstract,
|
|
43
|
+
...inheritedSignature(method.declaration),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
export function functionSignature(declaration) {
|
|
47
|
+
return deepFreeze({
|
|
48
|
+
coordinate: 'function',
|
|
49
|
+
...callableSignature(declaration),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export function functionExistence() {
|
|
53
|
+
return Object.freeze({ coordinate: 'function' });
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Fingerprint the contract a caller compiles against, independently of its Domain revision: the
|
|
57
|
+
* exact key, the owner, dispatch and abstractness of a Method, the semantic input and output
|
|
58
|
+
* contracts, and the durable execution modifier; authorization is excluded
|
|
59
|
+
* (DM-CALLABLE-FINGERPRINT). A static consumer pins this instead of a Domain revision, so a
|
|
60
|
+
* dependency release that leaves the callable contract untouched keeps every bound invocation
|
|
61
|
+
* valid.
|
|
62
|
+
*/
|
|
63
|
+
export function callableFingerprint(callable) {
|
|
64
|
+
// This digest input travels in every bound invocation and is recomputed by the Kernel; its
|
|
65
|
+
// shape is frozen, `kind` included, so a Kernel upgrade never invalidates an unchanged pin.
|
|
66
|
+
return fingerprintMeaning('owner' in callable
|
|
67
|
+
? {
|
|
68
|
+
kind: 'method',
|
|
69
|
+
key: callable.key,
|
|
70
|
+
owner: callable.owner.key,
|
|
71
|
+
...callableSignature(callable),
|
|
72
|
+
}
|
|
73
|
+
: { kind: 'function', key: callable.key, ...callableSignature(callable) });
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The `always` fields of CALLABLE_FIELDS: dispatch shape, the execution modifier, and the semantic
|
|
77
|
+
* input and output.
|
|
78
|
+
*/
|
|
79
|
+
export function callableSignature(declaration) {
|
|
80
|
+
return {
|
|
81
|
+
...fieldsOf({ declaration, roles: CALLABLE_FIELDS }),
|
|
82
|
+
input: isBinaryInput(declaration.input)
|
|
83
|
+
? {
|
|
84
|
+
mode: 'binary',
|
|
85
|
+
metadata: semanticValueSchema(declaration.input.metadata),
|
|
86
|
+
maximumBytes: declaration.input.maximumBytes,
|
|
87
|
+
}
|
|
88
|
+
: semanticValueSchema(declaration.input),
|
|
89
|
+
output: semanticOutput(declaration.output),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function semanticOutput(output) {
|
|
93
|
+
switch (output.mode) {
|
|
94
|
+
case 'value':
|
|
95
|
+
return { mode: 'value', schema: semanticValueSchema(output.schema) };
|
|
96
|
+
case 'stream':
|
|
97
|
+
return { mode: 'stream', item: semanticValueSchema(output.item) };
|
|
98
|
+
case 'binary':
|
|
99
|
+
return { mode: 'binary' };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { Key as SemanticKey } from '../../../addressing/index.js';
|
|
3
|
+
import type { EffectiveField } from '../../analysis/class.js';
|
|
4
|
+
import type { Context } from '../context.js';
|
|
5
|
+
import type { ClassCoordinate } from '../coordinate.js';
|
|
6
|
+
import type { DependencyMeaningLevel } from '../fields.js';
|
|
7
|
+
import type { Report } from '../report.js';
|
|
8
|
+
import type { ComparisonContext, SubjectPair } from '../scope.js';
|
|
9
|
+
interface ClassRequirement {
|
|
10
|
+
readonly ancestors: readonly SemanticKey[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A reference needs the Class to exist with its kind, abstractness and orientation; inheritance
|
|
14
|
+
* additionally takes on the source ancestors, class policies, data contract and, for an Edge, the
|
|
15
|
+
* endpoint and constraint contracts. A target projected onto a source requirement keeps only the
|
|
16
|
+
* ancestors the source named, so a superset satisfies it while a removal changes it.
|
|
17
|
+
*/
|
|
18
|
+
export declare function classMeaning(context: Context, coordinate: ClassCoordinate, level: DependencyMeaningLevel, onto?: ClassRequirement): {
|
|
19
|
+
readonly meaning: JsonValue;
|
|
20
|
+
readonly requirement: ClassRequirement;
|
|
21
|
+
} | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* What a Policy pattern reads of an Edge it matches: its orientation and the Classes each endpoint
|
|
24
|
+
* accepts, without cardinalities or roles. Undirected endpoints form an unordered pair.
|
|
25
|
+
*/
|
|
26
|
+
export declare function edgeEndpoints(context: Context, coordinate: ClassCoordinate): JsonValue | undefined;
|
|
27
|
+
export declare function propertyMeaning(field: EffectiveField): JsonValue;
|
|
28
|
+
/**
|
|
29
|
+
* A Class a dependent references or inherits keeps every effective Property it had, whichever
|
|
30
|
+
* ancestor declares it. Each Property is compared on its owner, which still declares it when the
|
|
31
|
+
* Class stops extending that owner, and is not compared at all when another origin owns it: only the
|
|
32
|
+
* Class's own identity set shows those losses. Every loss is recorded, a Property its owner removed
|
|
33
|
+
* included, and only a loss is: a comparison that keeps every identity keeps its facts and evidence
|
|
34
|
+
* bytes, and an added ancestor or Property obliges nothing. The target is projected onto the source
|
|
35
|
+
* identities, as inherited ancestry is, so the differences name the lost Properties.
|
|
36
|
+
*/
|
|
37
|
+
export declare function compareLostProperties({ pair, report, }: {
|
|
38
|
+
readonly pair: SubjectPair;
|
|
39
|
+
readonly report: Report;
|
|
40
|
+
}): void;
|
|
41
|
+
/** Newly required data is an obligation even though it was absent from the source footprint. */
|
|
42
|
+
export declare function compareAddedProperties({ context, pair, report, }: {
|
|
43
|
+
readonly context: ComparisonContext;
|
|
44
|
+
readonly pair: SubjectPair;
|
|
45
|
+
readonly report: Report;
|
|
46
|
+
}): void;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { compareUnicode } from '../../../addressing/ordering.js';
|
|
2
|
+
import { isClassRuleChecks } from '../../../language/policy/model/policy.js';
|
|
3
|
+
import { deepFreeze } from '../../canonical/freeze.js';
|
|
4
|
+
import { effectiveDefinition } from '../context.js';
|
|
5
|
+
import { propertyCoordinate } from '../coordinate.js';
|
|
6
|
+
import { keyForDefinitionRef } from '../coordinate.js';
|
|
7
|
+
import { CLASS_FIELDS, PROPERTY_FIELDS, fieldsOf } from '../fields.js';
|
|
8
|
+
import { usageOf } from '../references.js';
|
|
9
|
+
import { semanticValueSchema } from './values.js';
|
|
10
|
+
/**
|
|
11
|
+
* A reference needs the Class to exist with its kind, abstractness and orientation; inheritance
|
|
12
|
+
* additionally takes on the source ancestors, class policies, data contract and, for an Edge, the
|
|
13
|
+
* endpoint and constraint contracts. A target projected onto a source requirement keeps only the
|
|
14
|
+
* ancestors the source named, so a superset satisfies it while a removal changes it.
|
|
15
|
+
*/
|
|
16
|
+
export function classMeaning(context, coordinate, level, onto) {
|
|
17
|
+
const owner = context.schemas.get(coordinate.ref.origin);
|
|
18
|
+
const declaration = owner?.classes[coordinate.ref.name];
|
|
19
|
+
const analysis = owner === undefined ? undefined : effectiveDefinition(context, owner, coordinate.ref);
|
|
20
|
+
if (owner === undefined || declaration === undefined || analysis === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
const ancestors = ancestorKeys(context, coordinate.ref);
|
|
23
|
+
const requirement = Object.freeze({
|
|
24
|
+
ancestors,
|
|
25
|
+
});
|
|
26
|
+
const meaning = {
|
|
27
|
+
coordinate: 'class',
|
|
28
|
+
level: level,
|
|
29
|
+
...fieldsOf({ declaration, roles: CLASS_FIELDS, level }),
|
|
30
|
+
...(level === 'inherit'
|
|
31
|
+
? {
|
|
32
|
+
extends: onto === undefined
|
|
33
|
+
? ancestors
|
|
34
|
+
: onto.ancestors.filter((ancestor) => ancestors.includes(ancestor)),
|
|
35
|
+
policies: Object.fromEntries(Object.entries(declaration.policies)
|
|
36
|
+
.filter(([, policy]) => policy !== undefined)
|
|
37
|
+
.map(([role, policy]) => [role, classPolicyMeaning(policy)])),
|
|
38
|
+
...(declaration.kind === 'node'
|
|
39
|
+
? {
|
|
40
|
+
data: analysis.data === undefined
|
|
41
|
+
? null
|
|
42
|
+
: {
|
|
43
|
+
owner: keyForDefinitionRef(analysis.data.owner),
|
|
44
|
+
declaration: analysis.data.declaration,
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
: { endpoints: declaration.endpoints, constraints: declaration.constraints }),
|
|
48
|
+
}
|
|
49
|
+
: {}),
|
|
50
|
+
};
|
|
51
|
+
return { meaning: deepFreeze(meaning), requirement };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A named Policy compares by its key; `false` or Policy checks by their value, as a callable's
|
|
55
|
+
* Policy does.
|
|
56
|
+
*/
|
|
57
|
+
function classPolicyMeaning(policy) {
|
|
58
|
+
if (policy === false)
|
|
59
|
+
return false;
|
|
60
|
+
return isClassRuleChecks(policy) ? policy : keyForDefinitionRef(policy);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* What a Policy pattern reads of an Edge it matches: its orientation and the Classes each endpoint
|
|
64
|
+
* accepts, without cardinalities or roles. Undirected endpoints form an unordered pair.
|
|
65
|
+
*/
|
|
66
|
+
export function edgeEndpoints(context, coordinate) {
|
|
67
|
+
const declaration = context.schemas.get(coordinate.ref.origin)?.classes[coordinate.ref.name];
|
|
68
|
+
if (declaration?.kind !== 'edge')
|
|
69
|
+
return undefined;
|
|
70
|
+
const accepts = ({ accepts: refs }) => refs.map(keyForDefinitionRef).sort(compareUnicode);
|
|
71
|
+
return deepFreeze(declaration.orientation === 'directed'
|
|
72
|
+
? {
|
|
73
|
+
coordinate: 'class',
|
|
74
|
+
orientation: 'directed',
|
|
75
|
+
source: accepts(declaration.endpoints.source),
|
|
76
|
+
target: accepts(declaration.endpoints.target),
|
|
77
|
+
}
|
|
78
|
+
: {
|
|
79
|
+
coordinate: 'class',
|
|
80
|
+
orientation: 'undirected',
|
|
81
|
+
endpoints: declaration.endpoints
|
|
82
|
+
.map(accepts)
|
|
83
|
+
.sort((left, right) => compareUnicode(left.join('\n'), right.join('\n'))),
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
export function propertyMeaning(field) {
|
|
87
|
+
return deepFreeze({
|
|
88
|
+
coordinate: 'property',
|
|
89
|
+
owner: keyForDefinitionRef(field.owner),
|
|
90
|
+
name: field.name,
|
|
91
|
+
...fieldsOf({ declaration: field, roles: PROPERTY_FIELDS }),
|
|
92
|
+
schema: semanticValueSchema(field.schema),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function ancestorKeys(context, ref) {
|
|
96
|
+
const seen = new Set();
|
|
97
|
+
const visit = (current) => {
|
|
98
|
+
const declaration = context.schemas.get(current.origin)?.classes[current.name];
|
|
99
|
+
if (declaration === undefined)
|
|
100
|
+
return;
|
|
101
|
+
for (const parent of declaration.extends) {
|
|
102
|
+
const key = keyForDefinitionRef(parent);
|
|
103
|
+
if (seen.has(key))
|
|
104
|
+
continue;
|
|
105
|
+
seen.add(key);
|
|
106
|
+
visit(parent);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
visit(ref);
|
|
110
|
+
return [...seen].sort(compareUnicode);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A Class a dependent references or inherits keeps every effective Property it had, whichever
|
|
114
|
+
* ancestor declares it. Each Property is compared on its owner, which still declares it when the
|
|
115
|
+
* Class stops extending that owner, and is not compared at all when another origin owns it: only the
|
|
116
|
+
* Class's own identity set shows those losses. Every loss is recorded, a Property its owner removed
|
|
117
|
+
* included, and only a loss is: a comparison that keeps every identity keeps its facts and evidence
|
|
118
|
+
* bytes, and an added ancestor or Property obliges nothing. The target is projected onto the source
|
|
119
|
+
* identities, as inherited ancestry is, so the differences name the lost Properties.
|
|
120
|
+
*/
|
|
121
|
+
export function compareLostProperties({ pair, report, }) {
|
|
122
|
+
if (pair.source?.kind !== 'class' || pair.target?.kind !== 'class')
|
|
123
|
+
return;
|
|
124
|
+
const kept = pair.target.analysis.properties;
|
|
125
|
+
const identities = [...pair.source.analysis.properties.keys()].sort(compareUnicode);
|
|
126
|
+
if (identities.every((identity) => kept.has(identity)))
|
|
127
|
+
return;
|
|
128
|
+
report.record({
|
|
129
|
+
pair,
|
|
130
|
+
facet: 'class.properties',
|
|
131
|
+
before: propertyIdentities(identities),
|
|
132
|
+
after: propertyIdentities(identities.filter((identity) => kept.has(identity))),
|
|
133
|
+
requirement: { kind: 'class.properties' },
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function propertyIdentities(identities) {
|
|
137
|
+
return deepFreeze({
|
|
138
|
+
coordinate: 'class',
|
|
139
|
+
properties: Object.fromEntries(identities.map((identity) => [identity, true])),
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
/** Newly required data is an obligation even though it was absent from the source footprint. */
|
|
143
|
+
export function compareAddedProperties({ context, pair, report, }) {
|
|
144
|
+
if (pair.source?.kind !== 'class' || pair.target?.kind !== 'class')
|
|
145
|
+
return;
|
|
146
|
+
for (const field of pair.target.analysis.properties.values()) {
|
|
147
|
+
if (pair.source.analysis.properties.has(field.identity) ||
|
|
148
|
+
!field.required ||
|
|
149
|
+
field.auto !== undefined)
|
|
150
|
+
continue;
|
|
151
|
+
const coordinate = propertyCoordinate(field.owner, field.name);
|
|
152
|
+
report.note({ coordinate, usage: usageOf(pair.source.schema, 'member', pair.coordinate.key) });
|
|
153
|
+
report.record({
|
|
154
|
+
pair: context.pair(coordinate),
|
|
155
|
+
facet: 'property.required',
|
|
156
|
+
after: propertyMeaning(field),
|
|
157
|
+
requirement: { kind: 'property.required', satisfied: false },
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Value } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { Facet } from '../model.js';
|
|
3
|
+
import type { ComparisonContext, SubjectPair } from '../scope.js';
|
|
4
|
+
/** Shared facet comparisons know declarations, never installation or an analysis mode. */
|
|
5
|
+
export declare function compareFacet({ context, pair, facet, }: {
|
|
6
|
+
readonly context: ComparisonContext;
|
|
7
|
+
readonly pair: SubjectPair;
|
|
8
|
+
readonly facet: Exclude<Facet, 'class.composition' | 'class.properties' | 'property.required'>;
|
|
9
|
+
}): {
|
|
10
|
+
readonly before?: Value;
|
|
11
|
+
readonly after?: Value;
|
|
12
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { methodInheritance, functionSignature, functionExistence, methodObject, methodSignature, methodExistence, } from './callables.js';
|
|
2
|
+
import { classMeaning, edgeEndpoints, propertyMeaning } from './classes.js';
|
|
3
|
+
import { memberMeaning } from './members.js';
|
|
4
|
+
/** Shared facet comparisons know declarations, never installation or an analysis mode. */
|
|
5
|
+
export function compareFacet({ context, pair, facet, }) {
|
|
6
|
+
if (facet === 'class.reference' || facet === 'class.inherit') {
|
|
7
|
+
if (pair.coordinate.kind !== 'class')
|
|
8
|
+
throw new TypeError('Class facet requires a Class coordinate.');
|
|
9
|
+
const level = facet === 'class.inherit' ? 'inherit' : 'reference';
|
|
10
|
+
const before = classMeaning(context.before, pair.coordinate, level);
|
|
11
|
+
const after = classMeaning(context.after, pair.coordinate, level, before?.requirement);
|
|
12
|
+
return { before: before?.meaning, after: after?.meaning };
|
|
13
|
+
}
|
|
14
|
+
if (facet === 'class.endpoints') {
|
|
15
|
+
if (pair.coordinate.kind !== 'class')
|
|
16
|
+
throw new TypeError('Class facet requires a Class coordinate.');
|
|
17
|
+
return {
|
|
18
|
+
before: edgeEndpoints(context.before, pair.coordinate),
|
|
19
|
+
after: edgeEndpoints(context.after, pair.coordinate),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const value = (subject) => {
|
|
23
|
+
if (subject === undefined)
|
|
24
|
+
return undefined;
|
|
25
|
+
switch (facet) {
|
|
26
|
+
case 'property':
|
|
27
|
+
return subject.kind === 'property' ? propertyMeaning(subject.field) : undefined;
|
|
28
|
+
case 'method.existence':
|
|
29
|
+
return subject.kind === 'method' ? methodExistence(subject.method) : undefined;
|
|
30
|
+
case 'method.object':
|
|
31
|
+
return subject.kind === 'method'
|
|
32
|
+
? methodObject(subject.method, subject.schema.classes[subject.method.owner.name])
|
|
33
|
+
: undefined;
|
|
34
|
+
case 'method.signature':
|
|
35
|
+
return subject.kind === 'method' ? methodSignature(subject.method) : undefined;
|
|
36
|
+
case 'method.inheritance':
|
|
37
|
+
return subject.kind === 'method' ? methodInheritance(subject.method) : undefined;
|
|
38
|
+
case 'function.existence':
|
|
39
|
+
return functionExistence();
|
|
40
|
+
case 'function.signature':
|
|
41
|
+
return subject.kind === 'member'
|
|
42
|
+
? functionSignature(subject.schema.functions[subject.coordinate.ref.name])
|
|
43
|
+
: undefined;
|
|
44
|
+
case 'policy':
|
|
45
|
+
case 'view':
|
|
46
|
+
case 'core':
|
|
47
|
+
return subject.kind === 'member'
|
|
48
|
+
? memberMeaning(subject.schema, subject.coordinate.ref)
|
|
49
|
+
: undefined;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return { before: value(pair.source), after: value(pair.target) };
|
|
53
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Value as JsonValue } from '@astrale-os/kernel-dsl/value';
|
|
2
|
+
import type { DomainSchema } from '../../model/schema.js';
|
|
3
|
+
import type { MemberRef } from '../coordinate.js';
|
|
4
|
+
export declare function memberMeaning(owner: DomainSchema, ref: MemberRef): JsonValue | undefined;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { deepFreeze } from '../../canonical/freeze.js';
|
|
2
|
+
import { CORE_FIELDS, POLICY_FIELDS, VIEW_FIELDS, fieldsOf } from '../fields.js';
|
|
3
|
+
import { functionSignature } from './callables.js';
|
|
4
|
+
export function memberMeaning(owner, ref) {
|
|
5
|
+
const meaning = memberMeaningOf(owner, ref);
|
|
6
|
+
return meaning === undefined ? undefined : deepFreeze(meaning);
|
|
7
|
+
}
|
|
8
|
+
function memberMeaningOf(owner, ref) {
|
|
9
|
+
if (ref.origin !== owner.origin)
|
|
10
|
+
return undefined;
|
|
11
|
+
switch (ref.kind) {
|
|
12
|
+
case 'function': {
|
|
13
|
+
const declaration = owner.functions[ref.name];
|
|
14
|
+
return declaration === undefined ? undefined : functionSignature(declaration);
|
|
15
|
+
}
|
|
16
|
+
case 'policy': {
|
|
17
|
+
const declaration = owner.policies[ref.name];
|
|
18
|
+
return declaration === undefined
|
|
19
|
+
? undefined
|
|
20
|
+
: {
|
|
21
|
+
coordinate: 'policy',
|
|
22
|
+
...fieldsOf({ declaration, roles: POLICY_FIELDS }),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
case 'view': {
|
|
26
|
+
const declaration = owner.views[ref.name];
|
|
27
|
+
return declaration === undefined
|
|
28
|
+
? undefined
|
|
29
|
+
: {
|
|
30
|
+
coordinate: 'view',
|
|
31
|
+
...fieldsOf({ declaration, roles: VIEW_FIELDS }),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
case 'core': {
|
|
35
|
+
const node = owner.core.nodes[ref.name];
|
|
36
|
+
return node === undefined
|
|
37
|
+
? undefined
|
|
38
|
+
: {
|
|
39
|
+
coordinate: 'core',
|
|
40
|
+
...fieldsOf({ declaration: node, roles: CORE_FIELDS }),
|
|
41
|
+
edges: incidentCoreEdges(owner, ref.name).map((edge) => fieldsOf({ declaration: edge, roles: CORE_FIELDS })),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function incidentCoreEdges(owner, name) {
|
|
47
|
+
return owner.core.edges.filter((edge) => (edge.source.kind === 'core' && edge.source.name === name) ||
|
|
48
|
+
(edge.target.kind === 'core' && edge.target.name === name));
|
|
49
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonSchema } from '../../../language/value/model/schema.js';
|
|
2
|
+
import type { Fingerprint } from '../model.js';
|
|
3
|
+
/** Drop annotation keywords wherever a schema keyword nests a schema; never inside data. */
|
|
4
|
+
export declare function semanticValueSchema(value: JsonSchema): JsonSchema;
|
|
5
|
+
export declare function fingerprintMeaning(value: unknown): Fingerprint;
|