@telorun/analyzer 0.57.0 → 0.58.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/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +91 -9
- package/dist/cel-environment.d.ts.map +1 -1
- package/dist/cel-environment.js +6 -3
- package/dist/definition-registry.d.ts +5 -0
- package/dist/definition-registry.d.ts.map +1 -1
- package/dist/definition-registry.js +9 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/invocation-contract.d.ts +21 -13
- package/dist/invocation-contract.d.ts.map +1 -1
- package/dist/invocation-contract.js +43 -46
- package/dist/loaded-types.d.ts +13 -0
- package/dist/loaded-types.d.ts.map +1 -1
- package/dist/manifest-loader.d.ts +8 -1
- package/dist/manifest-loader.d.ts.map +1 -1
- package/dist/manifest-loader.js +33 -6
- package/dist/migrations/driver.d.ts +69 -0
- package/dist/migrations/driver.d.ts.map +1 -0
- package/dist/migrations/driver.js +200 -0
- package/dist/migrations/entries/index.d.ts +3 -0
- package/dist/migrations/entries/index.d.ts.map +1 -0
- package/dist/migrations/entries/index.js +9 -0
- package/dist/migrations/entries/normalize-value-types.json +48 -0
- package/dist/migrations/entries/ref-slot-scalar-type.json +20 -0
- package/dist/migrations/entry-data.d.ts +25 -0
- package/dist/migrations/entry-data.d.ts.map +1 -0
- package/dist/migrations/entry-data.js +171 -0
- package/dist/migrations/index.d.ts +22 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +19 -0
- package/dist/migrations/match.d.ts +162 -0
- package/dist/migrations/match.d.ts.map +1 -0
- package/dist/migrations/match.js +295 -0
- package/dist/migrations/patch.d.ts +68 -0
- package/dist/migrations/patch.d.ts.map +1 -0
- package/dist/migrations/patch.js +236 -0
- package/dist/migrations/provenance.d.ts +25 -0
- package/dist/migrations/provenance.d.ts.map +1 -0
- package/dist/migrations/provenance.js +118 -0
- package/dist/migrations/registry.d.ts +35 -0
- package/dist/migrations/registry.d.ts.map +1 -0
- package/dist/migrations/registry.js +35 -0
- package/dist/migrations/report.d.ts +28 -0
- package/dist/migrations/report.d.ts.map +1 -0
- package/dist/migrations/report.js +144 -0
- package/dist/migrations/types.d.ts +115 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +24 -0
- package/dist/migrations/yaml-edit.d.ts +21 -0
- package/dist/migrations/yaml-edit.d.ts.map +1 -0
- package/dist/migrations/yaml-edit.js +245 -0
- package/dist/parse-loaded-file.d.ts +8 -0
- package/dist/parse-loaded-file.d.ts.map +1 -1
- package/dist/parse-loaded-file.js +22 -13
- package/dist/resolve-schema-type-refs.d.ts +29 -12
- package/dist/resolve-schema-type-refs.d.ts.map +1 -1
- package/dist/resolve-schema-type-refs.js +89 -16
- package/dist/schema-compat.d.ts +35 -9
- package/dist/schema-compat.d.ts.map +1 -1
- package/dist/schema-compat.js +180 -64
- package/dist/schema-region.d.ts +33 -0
- package/dist/schema-region.d.ts.map +1 -0
- package/dist/schema-region.js +45 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +29 -3
- package/dist/validate-step-inputs.d.ts +8 -1
- package/dist/validate-step-inputs.d.ts.map +1 -1
- package/dist/validate-step-inputs.js +47 -2
- package/dist/validate-value-type-slots.d.ts +43 -0
- package/dist/validate-value-type-slots.d.ts.map +1 -0
- package/dist/validate-value-type-slots.js +142 -0
- package/dist/value-type-keyword.d.ts +60 -0
- package/dist/value-type-keyword.d.ts.map +1 -0
- package/dist/value-type-keyword.js +119 -0
- package/dist/yaml-source-edit.d.ts +56 -0
- package/dist/yaml-source-edit.d.ts.map +1 -0
- package/dist/yaml-source-edit.js +93 -0
- package/package.json +3 -3
- package/src/analyzer.ts +99 -6
- package/src/cel-environment.ts +6 -3
- package/src/definition-registry.ts +10 -0
- package/src/index.ts +26 -2
- package/src/invocation-contract.ts +43 -48
- package/src/loaded-types.ts +13 -0
- package/src/manifest-loader.ts +37 -6
- package/src/migrations/driver.ts +262 -0
- package/src/migrations/entries/index.ts +10 -0
- package/src/migrations/entries/normalize-value-types.json +48 -0
- package/src/migrations/entries/ref-slot-scalar-type.json +20 -0
- package/src/migrations/entry-data.ts +207 -0
- package/src/migrations/index.ts +22 -0
- package/src/migrations/match.ts +382 -0
- package/src/migrations/patch.ts +265 -0
- package/src/migrations/provenance.ts +167 -0
- package/src/migrations/registry.ts +40 -0
- package/src/migrations/report.ts +169 -0
- package/src/migrations/types.ts +144 -0
- package/src/migrations/yaml-edit.ts +260 -0
- package/src/parse-loaded-file.ts +31 -12
- package/src/resolve-schema-type-refs.ts +93 -16
- package/src/schema-compat.ts +212 -74
- package/src/schema-region.ts +46 -0
- package/src/types.ts +17 -0
- package/src/validate-cel-context.ts +36 -3
- package/src/validate-step-inputs.ts +56 -1
- package/src/validate-value-type-slots.ts +182 -0
- package/src/value-type-keyword.ts +135 -0
- package/src/yaml-source-edit.ts +106 -0
- package/dist/binary-slot.d.ts +0 -39
- package/dist/binary-slot.d.ts.map +0 -1
- package/dist/binary-slot.js +0 -58
- package/src/binary-slot.ts +0 -71
package/dist/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWzE,OAAO,EACL,aAAa,EAEb,KAAK,YAAY,EAElB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAA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AAE,kBAAkB,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAsB5F"}
|
package/dist/analyzer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { canonicalTypeSchemaId, OBSERVED_STATE_KEY } from "@telorun/sdk";
|
|
2
|
-
import { defaultRegistry, isRefSentinel, isTaggedSentinel, } from "@telorun/templating";
|
|
2
|
+
import { defaultRegistry, isRefSentinel, isTaggedSentinel, plainChainOf, } from "@telorun/templating";
|
|
3
3
|
import { AliasResolver, moduleScopedDefResolver, scopeResolverForModule, } from "./alias-resolver.js";
|
|
4
4
|
import { buildCelEnvironment, buildImportInputCelEnvironment, buildTypedCelEnvironment, } from "./cel-environment.js";
|
|
5
5
|
import { DefinitionRegistry } from "./definition-registry.js";
|
|
@@ -19,10 +19,11 @@ import { resolveSchemaRefKinds } from "./resolve-schema-ref-kinds.js";
|
|
|
19
19
|
import { runZoneAnalysis } from "./resolve-zone-requirements.js";
|
|
20
20
|
import { validateZoneSlotDeclarations } from "./validate-zone-slots.js";
|
|
21
21
|
import { validateDynamicSelectors, validateRefSlotDeclarations, } from "./validate-ref-slots.js";
|
|
22
|
+
import { validateValueTypeSlots, } from "./validate-value-type-slots.js";
|
|
22
23
|
import { resolveSchemaTypeRefs } from "./resolve-schema-type-refs.js";
|
|
23
24
|
import { validateSchemaTypeRefs } from "./validate-schema-type-refs.js";
|
|
24
25
|
import { rewriteSyntheticOrigins } from "./rewrite-synthetic-origins.js";
|
|
25
|
-
import { celTypeSatisfiesJsonSchema, substituteCelFields, validateAgainstSchema, } from "./schema-compat.js";
|
|
26
|
+
import { celTypeSatisfiesJsonSchema, checkSchemaCompatibility, navigateSchemaToExprPath, substituteCelFields, validateAgainstSchema, } from "./schema-compat.js";
|
|
26
27
|
import { collectValueSchemaIssues } from "./validate-value-schema.js";
|
|
27
28
|
import { DiagnosticSeverity } from "./types.js";
|
|
28
29
|
import { extractAccessChains, extractCelRegionScopes, getManifestItem, pathMatchesScope, resolveContextAnnotations, resolveTypeFieldToSchema, } from "./validate-cel-context.js";
|
|
@@ -983,6 +984,18 @@ export class StaticAnalyzer {
|
|
|
983
984
|
const refConstraintIssues = [];
|
|
984
985
|
const refSlotIssues = [];
|
|
985
986
|
const zoneSlotIssues = [];
|
|
987
|
+
// `x-telo-type` is checked on EVERY manifest, not only on definition docs: a
|
|
988
|
+
// schema fragment is written wherever a kind declares a schema-valued field,
|
|
989
|
+
// so an inline `inputType:` on an ordinary resource carries one just as a
|
|
990
|
+
// definition's `schema:` does. Same scoping as every other schema issue —
|
|
991
|
+
// the entry's own modules, since a dependency is not the consumer's to fix.
|
|
992
|
+
const valueTypeSlotIssues = [];
|
|
993
|
+
for (const m of manifests) {
|
|
994
|
+
const declaringModule = m.metadata?.module;
|
|
995
|
+
if (!declaringModule || rootModules.has(declaringModule)) {
|
|
996
|
+
valueTypeSlotIssues.push(...validateValueTypeSlots(m));
|
|
997
|
+
}
|
|
998
|
+
}
|
|
986
999
|
for (const m of manifests) {
|
|
987
1000
|
if (m.kind !== "Telo.Definition" && m.kind !== "Telo.Abstract")
|
|
988
1001
|
continue;
|
|
@@ -1117,6 +1130,26 @@ export class StaticAnalyzer {
|
|
|
1117
1130
|
// mid-migration, and this reports what leniency would silently absorb.
|
|
1118
1131
|
for (const issue of refSlotIssues)
|
|
1119
1132
|
diagnostics.push(refSlotIssueDiagnostic(issue));
|
|
1133
|
+
// The same split for `x-telo-type`. Its reader returns a slot with no
|
|
1134
|
+
// entry for a name it does not know, which is what an unrecognized brand
|
|
1135
|
+
// used to do SILENTLY — the slot simply lost its identity.
|
|
1136
|
+
for (const issue of valueTypeSlotIssues) {
|
|
1137
|
+
diagnostics.push({
|
|
1138
|
+
severity: DiagnosticSeverity.Error,
|
|
1139
|
+
code: issue.code,
|
|
1140
|
+
source: SOURCE,
|
|
1141
|
+
message: issue.message,
|
|
1142
|
+
data: {
|
|
1143
|
+
resource: {
|
|
1144
|
+
kind: issue.manifest.kind,
|
|
1145
|
+
name: issue.manifest.metadata?.name,
|
|
1146
|
+
},
|
|
1147
|
+
filePath: issue.manifest.metadata?.source,
|
|
1148
|
+
path: issue.path,
|
|
1149
|
+
...(issue.fix ? { fix: issue.fix } : {}),
|
|
1150
|
+
},
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1120
1153
|
// Same split for the two zone annotations. Unreadable ones fail in
|
|
1121
1154
|
// OPPOSITE directions — a dropped requirement is silently unenforced, a
|
|
1122
1155
|
// dropped provision invents failures — so neither can be left to
|
|
@@ -1371,6 +1404,11 @@ export class StaticAnalyzer {
|
|
|
1371
1404
|
// `collectCelValueSlots`.
|
|
1372
1405
|
const celReturnSlots = [];
|
|
1373
1406
|
const celTypeByPath = new Map();
|
|
1407
|
+
// The schema an expression RESOLVES TO, beside the CEL type it carries. Both
|
|
1408
|
+
// are needed and neither replaces the other: the CEL type answers "does this
|
|
1409
|
+
// fit the slot at all", the schema answers "do their type arguments agree",
|
|
1410
|
+
// which cel-js cannot express because it types by constructor identity.
|
|
1411
|
+
const celSourceSchemaByPath = new Map();
|
|
1374
1412
|
// Context-free typed environments, one per manifest. Reused across every
|
|
1375
1413
|
// expression in it — see the build site for why a matched context opts out.
|
|
1376
1414
|
const typedEnvByManifest = new Map();
|
|
@@ -1638,12 +1676,14 @@ export class StaticAnalyzer {
|
|
|
1638
1676
|
if (e.definition?.schema) {
|
|
1639
1677
|
const stepName = m.metadata?.name;
|
|
1640
1678
|
const stepFile = m.metadata?.source;
|
|
1641
|
-
for (const issue of collectStepInputIssues(m, e.definition.schema, allManifests, defs, aliases, { aliasesByModule, rootModules })) {
|
|
1679
|
+
for (const issue of collectStepInputIssues(m, e.definition.schema, allManifests, defs, aliases, { aliasesByModule, rootModules }, celStepContextSchema)) {
|
|
1642
1680
|
diagnostics.push({
|
|
1643
1681
|
severity: DiagnosticSeverity.Error,
|
|
1644
|
-
code: "CONTRACT_INPUTS_MISMATCH",
|
|
1682
|
+
code: issue.code ?? "CONTRACT_INPUTS_MISMATCH",
|
|
1645
1683
|
source: SOURCE,
|
|
1646
|
-
message:
|
|
1684
|
+
message: issue.code
|
|
1685
|
+
? `${m.kind}/${stepName}: inputs at '${issue.path}' flow into ${issue.targetLabel} with disagreeing type arguments: ${issue.message}`
|
|
1686
|
+
: `${m.kind}/${stepName}: inputs at '${issue.path}' do not satisfy ${issue.targetLabel}'s declared inputType: ${issue.message}`,
|
|
1647
1687
|
data: {
|
|
1648
1688
|
resource: { kind: m.kind, name: stepName ?? "" },
|
|
1649
1689
|
filePath: stepFile,
|
|
@@ -1895,6 +1935,30 @@ export class StaticAnalyzer {
|
|
|
1895
1935
|
celTypeByPath.set(m, (byPath = new Map()));
|
|
1896
1936
|
byPath.set(path, result.type);
|
|
1897
1937
|
}
|
|
1938
|
+
// The producer half of the type-argument check. A CEL type is a bare
|
|
1939
|
+
// name — cel-js types by constructor identity, so a byte stream and a
|
|
1940
|
+
// string stream are one CEL type and always will be — so the argument
|
|
1941
|
+
// comparison is a parallel pass over the SCHEMAS the analyzer already
|
|
1942
|
+
// walks. This is where the producer's schema is in hand: navigating
|
|
1943
|
+
// the expression's chain into its context schema is exactly "the
|
|
1944
|
+
// producer's outputType at the expression's tail".
|
|
1945
|
+
//
|
|
1946
|
+
// Only a PLAIN CHAIN is navigated — `steps.encode.result.output`, the
|
|
1947
|
+
// shape a wiring site actually takes. An expression that computes
|
|
1948
|
+
// rather than names has no schema to read off the context, so it
|
|
1949
|
+
// records nothing and no argument check fires: silence where the
|
|
1950
|
+
// analyzer knows least is the conservative direction, and the same one
|
|
1951
|
+
// `x-telo-step-context`'s pure-`value` typing takes.
|
|
1952
|
+
const chain = effectiveContext ? plainChainOf(`\${{${expr}}}`) : undefined;
|
|
1953
|
+
if (chain) {
|
|
1954
|
+
const produced = navigateSchemaToExprPath(effectiveContext, chain);
|
|
1955
|
+
if (produced) {
|
|
1956
|
+
let byPath = celSourceSchemaByPath.get(m);
|
|
1957
|
+
if (!byPath)
|
|
1958
|
+
celSourceSchemaByPath.set(m, (byPath = new Map()));
|
|
1959
|
+
byPath.set(path, produced);
|
|
1960
|
+
}
|
|
1961
|
+
}
|
|
1898
1962
|
// A non-deterministic call in a compile-eval field is baked once at
|
|
1899
1963
|
// load: `nowIso()` there freezes at boot. Sometimes that is the
|
|
1900
1964
|
// intent (a boot timestamp, a run id), so it warns rather than
|
|
@@ -1965,14 +2029,32 @@ export class StaticAnalyzer {
|
|
|
1965
2029
|
const type = celTypeByPath.get(slot.manifest)?.get(slot.path);
|
|
1966
2030
|
if (type === undefined)
|
|
1967
2031
|
continue;
|
|
1968
|
-
if (celTypeSatisfiesJsonSchema(type.split("<")[0], slot.schema))
|
|
2032
|
+
if (!celTypeSatisfiesJsonSchema(type.split("<")[0], slot.schema)) {
|
|
2033
|
+
const expected = slot.schema["x-telo-type"] ?? slot.schema.type ?? "unknown";
|
|
2034
|
+
diagnostics.push({
|
|
2035
|
+
severity: DiagnosticSeverity.Error,
|
|
2036
|
+
code: "CEL_TYPE_ERROR",
|
|
2037
|
+
source: SOURCE,
|
|
2038
|
+
message: `${slot.resource.kind}/${slot.resource.name}: CEL at '${slot.path}' returns '${type}' but the field expects '${expected}'.`,
|
|
2039
|
+
data: { resource: slot.resource, filePath: slot.filePath, path: slot.path },
|
|
2040
|
+
});
|
|
2041
|
+
continue;
|
|
2042
|
+
}
|
|
2043
|
+
// The type fits; do its ARGUMENTS agree? Covariant and gradual — an
|
|
2044
|
+
// omitted argument is *any* in both directions, so an unmigrated producer
|
|
2045
|
+
// or consumer is never reported, and only a definite conflict is.
|
|
2046
|
+
const produced = celSourceSchemaByPath.get(slot.manifest)?.get(slot.path);
|
|
2047
|
+
if (!produced)
|
|
2048
|
+
continue;
|
|
2049
|
+
const { compatible, issues } = checkSchemaCompatibility(produced, slot.schema, (ref) => defs.schemaForId(ref));
|
|
2050
|
+
if (compatible)
|
|
1969
2051
|
continue;
|
|
1970
|
-
const expected = slot.schema["x-telo-type"] ?? slot.schema.type ?? "unknown";
|
|
1971
2052
|
diagnostics.push({
|
|
1972
2053
|
severity: DiagnosticSeverity.Error,
|
|
1973
|
-
code: "
|
|
2054
|
+
code: "CEL_TYPE_ARGUMENT_MISMATCH",
|
|
1974
2055
|
source: SOURCE,
|
|
1975
|
-
message: `${slot.resource.kind}/${slot.resource.name}: CEL at '${slot.path}'
|
|
2056
|
+
message: `${slot.resource.kind}/${slot.resource.name}: CEL at '${slot.path}' produces a value ` +
|
|
2057
|
+
`whose type arguments disagree with the field's: ${issues.join("; ")}.`,
|
|
1976
2058
|
data: { resource: slot.resource, filePath: slot.filePath, path: slot.path },
|
|
1977
2059
|
});
|
|
1978
2060
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel-environment.d.ts","sourceRoot":"","sources":["../src/cel-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"cel-environment.d.ts","sourceRoot":"","sources":["../src/cel-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAarD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;uEASuE;AACvE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAI/C,kBAAkB,CAAC,EAAE,gBAAgB,GACpC,WAAW,CAsEb;AAuBD;;;;;;8DAM8D;AAC9D,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,gBAAgB,GAAG,SAAS,GAC3C,WAAW,CAwBb"}
|
package/dist/cel-environment.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsonSchemaToCelType, VALUE_BRAND_BASE } from "./schema-compat.js";
|
|
2
2
|
/** Transport protocol on a `ports` entry → the nominal CEL brand its resolved
|
|
3
|
-
* value carries. Mirrors the `protocol` enum in the Application schema
|
|
3
|
+
* value carries. Mirrors the `protocol` enum in the Application schema, and
|
|
4
|
+
* names the value types by their canonical `Telo.`-qualified names — the same
|
|
5
|
+
* spelling an author writes at `x-telo-type`, so a branded port and a branded
|
|
6
|
+
* field are comparable by name with nothing in between to translate. */
|
|
4
7
|
const PORT_PROTOCOL_BRAND = {
|
|
5
|
-
tcp: "TcpPort",
|
|
6
|
-
udp: "UdpPort",
|
|
8
|
+
tcp: "Telo.TcpPort",
|
|
9
|
+
udp: "Telo.UdpPort",
|
|
7
10
|
};
|
|
8
11
|
export { buildCelEnvironment } from "@telorun/templating";
|
|
9
12
|
/** Clone `baseEnv` and register typed variable declarations so that
|
|
@@ -55,6 +55,11 @@ export declare class DefinitionRegistry {
|
|
|
55
55
|
/** True when a schema is registered under `id` (a canonical `telo://` type id
|
|
56
56
|
* or a definition `$id`). Used to flag schema `$ref`s that resolve to nothing. */
|
|
57
57
|
hasSchemaId(id: string): boolean;
|
|
58
|
+
/** The schema registered under `id`, for a structural comparison that must see
|
|
59
|
+
* THROUGH a named shape. Declaring a shape once and referencing it is the
|
|
60
|
+
* sanctioned way to reuse one, so a comparator that cannot follow the
|
|
61
|
+
* reference judges two opaque nodes and learns nothing. */
|
|
62
|
+
schemaForId(id: string): Record<string, any> | undefined;
|
|
58
63
|
/** Validates data against a schema using this registry's AJV instance, which has all
|
|
59
64
|
* registered definition schemas loaded — enabling cross-module $ref resolution.
|
|
60
65
|
* A compile failure returns `[]` here; it is surfaced loudly (once,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GAAG,SAAS;IAShD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIrD;;;uCAGmC;IACnC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAWxD,gGAAgG;IAChG,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,GACvD,iBAAiB,GAAG,SAAS;IAOhC;;;;;;;;qFAQiF;IACjF,2BAA2B,CACzB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE,aAAa,EACtB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,GAC1C,iBAAiB,GAAG,SAAS;IAkChC,OAAO,CAAC,uBAAuB;IA+B/B;;qEAEiE;IACjE,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAgBxD,KAAK,IAAI,MAAM,EAAE;CAGlB"}
|
|
@@ -117,6 +117,15 @@ export class DefinitionRegistry {
|
|
|
117
117
|
hasSchemaId(id) {
|
|
118
118
|
return this.registeredSchemaIds.has(id) || this.ajv.getSchema(id) !== undefined;
|
|
119
119
|
}
|
|
120
|
+
/** The schema registered under `id`, for a structural comparison that must see
|
|
121
|
+
* THROUGH a named shape. Declaring a shape once and referencing it is the
|
|
122
|
+
* sanctioned way to reuse one, so a comparator that cannot follow the
|
|
123
|
+
* reference judges two opaque nodes and learns nothing. */
|
|
124
|
+
schemaForId(id) {
|
|
125
|
+
const compiled = this.ajv.getSchema(id);
|
|
126
|
+
const schema = compiled?.schema;
|
|
127
|
+
return schema && typeof schema === "object" ? schema : undefined;
|
|
128
|
+
}
|
|
120
129
|
/** Validates data against a schema using this registry's AJV instance, which has all
|
|
121
130
|
* registered definition schemas loaded — enabling cross-module $ref resolution.
|
|
122
131
|
* A compile failure returns `[]` here; it is surfaced loudly (once, on the
|
package/dist/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { moduleScopedDefResolver, scopeResolverForModule } from "./alias-resolve
|
|
|
13
13
|
export type { ModuleScopes } from "./alias-resolver.js";
|
|
14
14
|
export { ancestorChain, contractDeclarer, controllerBearingAncestor, effectiveAuthorSchema, effectiveContractField, effectiveStatusSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, mappingFieldFor, needsContractMapping, resolveParent, } from "./extends-resolution.js";
|
|
15
15
|
export type { ContractDirection, DefResolver } from "./extends-resolution.js";
|
|
16
|
-
export { defaultBearingPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema,
|
|
16
|
+
export { defaultBearingPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema, withLiveValuesSkipped, } from "./invocation-contract.js";
|
|
17
17
|
export type { ContractOrigin, ContractScope, ResolvedContract } from "./invocation-contract.js";
|
|
18
18
|
export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from "./redaction-path.js";
|
|
19
19
|
export type { RedactionSegment } from "./redaction-path.js";
|
|
@@ -23,7 +23,9 @@ export { buildReferenceFieldMap, isRefEntry, isScopeEntry } from "./reference-fi
|
|
|
23
23
|
export type { ReferenceFieldMap, RefFieldEntry } from "./reference-field-map.js";
|
|
24
24
|
export { hasDeclaredUse, isRefSlot, isRefUse, possibleUses, readRefSlot, REF_USES, refSlotAnnotation, rewriteRefSlotKinds, transfersControl, } from "./ref-slot.js";
|
|
25
25
|
export type { RefSlot, RefUse, RefUseCases } from "./ref-slot.js";
|
|
26
|
-
export {
|
|
26
|
+
export { ANNOTATION_KEYWORDS, registerTeloKeywords, valueTypeKeyword, } from "./value-type-keyword.js";
|
|
27
|
+
export { applyTextEdits, isPlainSafe, quoteStyleOf, renderFixReplacement, } from "./yaml-source-edit.js";
|
|
28
|
+
export type { QuoteStyle, TextEdit } from "./yaml-source-edit.js";
|
|
27
29
|
export { hasProvidesZone, hasRequiresZone, readProvidesZone, readRequiresZone, rewriteRequiresZoneKind, } from "./zone-slot.js";
|
|
28
30
|
export type { ProvidesZoneSlot, RequiresZoneSlot } from "./zone-slot.js";
|
|
29
31
|
export { deriveLibraryExportRequirements, projectZoneRequirements, runZoneAnalysis, zoneDocumentsSignature, } from "./resolve-zone-requirements.js";
|
|
@@ -33,6 +35,10 @@ export { validateZoneSlotDeclarations } from "./validate-zone-slots.js";
|
|
|
33
35
|
export type { ZoneSlotIssue } from "./validate-zone-slots.js";
|
|
34
36
|
export { validateDynamicSelectors, validateRefSlotDeclarations } from "./validate-ref-slots.js";
|
|
35
37
|
export type { RefSlotIssue } from "./validate-ref-slots.js";
|
|
38
|
+
export { validateValueTypeSlots } from "./validate-value-type-slots.js";
|
|
39
|
+
export type { ValueTypeSlotIssue } from "./validate-value-type-slots.js";
|
|
40
|
+
export { checkSchemaCompatibility } from "./schema-compat.js";
|
|
41
|
+
export type { CompatibilityResult } from "./schema-compat.js";
|
|
36
42
|
export { visitManifest } from "./manifest-visitor.js";
|
|
37
43
|
export type { CelSiteEvent, ManifestVisitor, RefSiteEvent, ResourceEnterEvent, ResourceExitEvent, ScopeBoundaryEvent, SchemaFromSiteEvent, VisitOptions, } from "./manifest-visitor.js";
|
|
38
44
|
export { Loader } from "./manifest-loader.js";
|
|
@@ -40,6 +46,8 @@ export { isModuleKind, MODULE_KINDS } from "./module-kinds.js";
|
|
|
40
46
|
export type { ModuleKind } from "./module-kinds.js";
|
|
41
47
|
export { parseLoadedFile } from "./parse-loaded-file.js";
|
|
42
48
|
export type { ParseOptions } from "./parse-loaded-file.js";
|
|
49
|
+
export { CORE_MIGRATIONS, migrateFileText, migrateManifests, NO_MIGRATIONS, parseMigrationEntry, remapMigratedPaths, } from "./migrations/index.js";
|
|
50
|
+
export type { FileMigrations, MigrationEntry, MigrationRewrite } from "./migrations/index.js";
|
|
43
51
|
export { desugarLoadedFile, inlineImportManifests } from "./inline-imports.js";
|
|
44
52
|
export type { SyntheticImport } from "./inline-imports.js";
|
|
45
53
|
export { compareModuleVersions, compareParsedModuleVersions, isNewerModuleVersion, isSameModuleVersion, newestModuleVersion, parseModuleVersion, } from "./module-version-order.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,YAAY,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,iCAAiC,EACjC,wBAAwB,EACxB,iBAAiB,EACjB,iCAAiC,EACjC,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,qBAA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C;AAChC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,YAAY,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,GACf,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1F,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,20 +7,24 @@ export { BINDINGS_ANNOTATION, bindingContextProperties, bindingDependencies, fin
|
|
|
7
7
|
export { applyObservedStateNode, buildObservedStateIndex, buildObservedStateResourcesSchema, collectRunReachableNames, observedStateRead, validateObservedStateDeclarations, OBSERVED_STATE_SCHEMA, } from "./validate-observed-state.js";
|
|
8
8
|
export { moduleScopedDefResolver, scopeResolverForModule } from "./alias-resolver.js";
|
|
9
9
|
export { ancestorChain, contractDeclarer, controllerBearingAncestor, effectiveAuthorSchema, effectiveContractField, effectiveStatusSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, mappingFieldFor, needsContractMapping, resolveParent, } from "./extends-resolution.js";
|
|
10
|
-
export { defaultBearingPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema,
|
|
10
|
+
export { defaultBearingPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema, withLiveValuesSkipped, } from "./invocation-contract.js";
|
|
11
11
|
export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from "./redaction-path.js";
|
|
12
12
|
export { buildCallGraph, projectToPairs, resourceId } from "./call-graph.js";
|
|
13
13
|
export { buildReferenceFieldMap, isRefEntry, isScopeEntry } from "./reference-field-map.js";
|
|
14
14
|
export { hasDeclaredUse, isRefSlot, isRefUse, possibleUses, readRefSlot, REF_USES, refSlotAnnotation, rewriteRefSlotKinds, transfersControl, } from "./ref-slot.js";
|
|
15
|
-
export {
|
|
15
|
+
export { ANNOTATION_KEYWORDS, registerTeloKeywords, valueTypeKeyword, } from "./value-type-keyword.js";
|
|
16
|
+
export { applyTextEdits, isPlainSafe, quoteStyleOf, renderFixReplacement, } from "./yaml-source-edit.js";
|
|
16
17
|
export { hasProvidesZone, hasRequiresZone, readProvidesZone, readRequiresZone, rewriteRequiresZoneKind, } from "./zone-slot.js";
|
|
17
18
|
export { deriveLibraryExportRequirements, projectZoneRequirements, runZoneAnalysis, zoneDocumentsSignature, } from "./resolve-zone-requirements.js";
|
|
18
19
|
export { validateZoneSlotDeclarations } from "./validate-zone-slots.js";
|
|
19
20
|
export { validateDynamicSelectors, validateRefSlotDeclarations } from "./validate-ref-slots.js";
|
|
21
|
+
export { validateValueTypeSlots } from "./validate-value-type-slots.js";
|
|
22
|
+
export { checkSchemaCompatibility } from "./schema-compat.js";
|
|
20
23
|
export { visitManifest } from "./manifest-visitor.js";
|
|
21
24
|
export { Loader } from "./manifest-loader.js";
|
|
22
25
|
export { isModuleKind, MODULE_KINDS } from "./module-kinds.js";
|
|
23
26
|
export { parseLoadedFile } from "./parse-loaded-file.js";
|
|
27
|
+
export { CORE_MIGRATIONS, migrateFileText, migrateManifests, NO_MIGRATIONS, parseMigrationEntry, remapMigratedPaths, } from "./migrations/index.js";
|
|
24
28
|
export { desugarLoadedFile, inlineImportManifests } from "./inline-imports.js";
|
|
25
29
|
export { compareModuleVersions, compareParsedModuleVersions, isNewerModuleVersion, isSameModuleVersion, newestModuleVersion, parseModuleVersion, } from "./module-version-order.js";
|
|
26
30
|
export { reconcileModuleVersions } from "./reconcile-module-versions.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ResourceDefinition } from "@telorun/sdk";
|
|
2
2
|
import { type ContractDirection, type DefResolver } from "./extends-resolution.js";
|
|
3
3
|
export type { ContractDirection };
|
|
4
4
|
/**
|
|
@@ -65,26 +65,34 @@ export declare function resolveContract(direction: ContractDirection, manifest:
|
|
|
65
65
|
* to needing to know whether one was declared. */
|
|
66
66
|
export declare function resolveContractSchema(direction: ContractDirection, manifest: Record<string, any> | undefined, definition: ResourceDefinition | undefined, scope: ContractScope): Record<string, any>;
|
|
67
67
|
/**
|
|
68
|
-
* A copy of `schema` with every `
|
|
69
|
-
*
|
|
68
|
+
* A copy of `schema` with every `live`-typed node left unconstrained, for
|
|
69
|
+
* validating a runtime value against.
|
|
70
70
|
*
|
|
71
|
-
*
|
|
72
|
-
* `inputType` and lists it in `required`, and `Record.Stream`, `Ai`, `Tar`
|
|
73
|
-
* `Console` do the same — so a one-directional skip would walk a live
|
|
74
|
-
* with AJV on the hottest path in the runtime. That is the same defect
|
|
75
|
-
* `stripCompiledValues` walking a live `ResourceInstance` in a ref slot: a
|
|
76
|
-
* object in a declared slot is not data to be traversed.
|
|
77
|
-
*
|
|
71
|
+
* Live values travel in BOTH directions — `Codec.Encoder` declares a stream on
|
|
72
|
+
* its `inputType` and lists it in `required`, and `Record.Stream`, `Ai`, `Tar`
|
|
73
|
+
* and `Console` do the same — so a one-directional skip would walk a live
|
|
74
|
+
* `Stream` with AJV on the hottest path in the runtime. That is the same defect
|
|
75
|
+
* as `stripCompiledValues` walking a live `ResourceInstance` in a ref slot: a
|
|
76
|
+
* live object in a declared slot is not data to be traversed.
|
|
77
|
+
*
|
|
78
|
+
* EXEMPTION IS A PROPERTY OF THE TYPE, not of a position. This used to neutralize
|
|
79
|
+
* only a key it found in a `properties` map, so an array-OF-streams element was
|
|
80
|
+
* reached and left constrained even though the walk descended into `items`.
|
|
81
|
+
* Reading the exemption off the declared value type makes an item, a union branch
|
|
82
|
+
* and a property the same case, and it is one rule instead of three.
|
|
83
|
+
*
|
|
84
|
+
* The exemption is from VALIDATION, never from TYPING: a live type's declared
|
|
85
|
+
* arguments still travel through every schema-typing walk the analyzer performs.
|
|
78
86
|
*
|
|
79
87
|
* Structural (returns a new object, never mutates), and shared so the analyzer
|
|
80
88
|
* and the kernel exempt the same set.
|
|
81
89
|
*/
|
|
82
|
-
export declare function
|
|
90
|
+
export declare function withLiveValuesSkipped(schema: Record<string, any>,
|
|
83
91
|
/** Resolves a `$ref` to the schema it names. Required to see through the
|
|
84
92
|
* reference form the runtime deliberately KEEPS intact for its validator: a
|
|
85
93
|
* contract written as `{ $ref: "telo:mod/Type" }` has none of its own
|
|
86
94
|
* properties, so a walk that cannot follow the reference exempts nothing and
|
|
87
|
-
* the
|
|
95
|
+
* the live value is traversed after all. */
|
|
88
96
|
resolveRef?: (ref: string) => Record<string, any> | undefined): Record<string, any>;
|
|
89
97
|
/** Every property path in `schema` that can receive a `default:` — the paths a
|
|
90
98
|
* defaults pass may write to, and therefore exactly how far the caller's inputs
|
|
@@ -93,7 +101,7 @@ resolveRef?: (ref: string) => Record<string, any> | undefined): Record<string, a
|
|
|
93
101
|
* default would mutate the structure the caller still holds. Bounded by the
|
|
94
102
|
* schema's defaults rather than by the size of the payload. */
|
|
95
103
|
export declare function defaultBearingPaths(schema: Record<string, any>,
|
|
96
|
-
/** See {@link
|
|
104
|
+
/** See {@link withLiveValuesSkipped} — a contract kept in `$ref` form
|
|
97
105
|
* declares its defaults behind the reference, and a walk that cannot follow
|
|
98
106
|
* it would report none, leaving the caller's data shared where a fill lands. */
|
|
99
107
|
resolveRef?: (ref: string) => Record<string, any> | undefined): string[][];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invocation-contract.d.ts","sourceRoot":"","sources":["../src/invocation-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"invocation-contract.d.ts","sourceRoot":"","sources":["../src/invocation-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC;;;;;;;;;;;;GAYG;AAEH;;oCAEoC;AACpC,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB;gFAC4E;IAC5E,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B;;kEAE8D;IAC9D,iBAAiB,EAAE,WAAW,CAAC;IAC/B;;;;;;;;;OASG;IACH,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;CAC9E;AAED;;uCAEuC;AACvC,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAGnD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACzC,UAAU,EAAE,kBAAkB,GAAG,SAAS,EAC1C,KAAK,EAAE,aAAa,GACnB,gBAAgB,GAAG,SAAS,CAa9B;AAED;;mDAEmD;AACnD,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACzC,UAAU,EAAE,kBAAkB,GAAG,SAAS,EAC1C,KAAK,EAAE,aAAa,GACnB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAErB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;AAC3B;;;;6CAI6C;AAC7C,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAC5D,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAErB;AAoFD;;;;;gEAKgE;AAChE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;AAC3B;;iFAEiF;AACjF,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAC5D,MAAM,EAAE,EAAE,CA+BZ"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isLiveSlot } from "@telorun/sdk";
|
|
1
2
|
import { contractDeclarer, effectiveContractField, } from "./extends-resolution.js";
|
|
2
3
|
import { resolveTypeFieldToSchema } from "./validate-cel-context.js";
|
|
3
4
|
/** The fallback for a target that declares no contract: anything goes. Not
|
|
@@ -42,30 +43,38 @@ export function resolveContractSchema(direction, manifest, definition, scope) {
|
|
|
42
43
|
return resolveContract(direction, manifest, definition, scope)?.schema ?? PERMISSIVE_CONTRACT;
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
|
-
* A copy of `schema` with every `
|
|
46
|
-
*
|
|
46
|
+
* A copy of `schema` with every `live`-typed node left unconstrained, for
|
|
47
|
+
* validating a runtime value against.
|
|
47
48
|
*
|
|
48
|
-
*
|
|
49
|
-
* `inputType` and lists it in `required`, and `Record.Stream`, `Ai`, `Tar`
|
|
50
|
-
* `Console` do the same — so a one-directional skip would walk a live
|
|
51
|
-
* with AJV on the hottest path in the runtime. That is the same defect
|
|
52
|
-
* `stripCompiledValues` walking a live `ResourceInstance` in a ref slot: a
|
|
53
|
-
* object in a declared slot is not data to be traversed.
|
|
54
|
-
*
|
|
49
|
+
* Live values travel in BOTH directions — `Codec.Encoder` declares a stream on
|
|
50
|
+
* its `inputType` and lists it in `required`, and `Record.Stream`, `Ai`, `Tar`
|
|
51
|
+
* and `Console` do the same — so a one-directional skip would walk a live
|
|
52
|
+
* `Stream` with AJV on the hottest path in the runtime. That is the same defect
|
|
53
|
+
* as `stripCompiledValues` walking a live `ResourceInstance` in a ref slot: a
|
|
54
|
+
* live object in a declared slot is not data to be traversed.
|
|
55
|
+
*
|
|
56
|
+
* EXEMPTION IS A PROPERTY OF THE TYPE, not of a position. This used to neutralize
|
|
57
|
+
* only a key it found in a `properties` map, so an array-OF-streams element was
|
|
58
|
+
* reached and left constrained even though the walk descended into `items`.
|
|
59
|
+
* Reading the exemption off the declared value type makes an item, a union branch
|
|
60
|
+
* and a property the same case, and it is one rule instead of three.
|
|
61
|
+
*
|
|
62
|
+
* The exemption is from VALIDATION, never from TYPING: a live type's declared
|
|
63
|
+
* arguments still travel through every schema-typing walk the analyzer performs.
|
|
55
64
|
*
|
|
56
65
|
* Structural (returns a new object, never mutates), and shared so the analyzer
|
|
57
66
|
* and the kernel exempt the same set.
|
|
58
67
|
*/
|
|
59
|
-
export function
|
|
68
|
+
export function withLiveValuesSkipped(schema,
|
|
60
69
|
/** Resolves a `$ref` to the schema it names. Required to see through the
|
|
61
70
|
* reference form the runtime deliberately KEEPS intact for its validator: a
|
|
62
71
|
* contract written as `{ $ref: "telo:mod/Type" }` has none of its own
|
|
63
72
|
* properties, so a walk that cannot follow the reference exempts nothing and
|
|
64
|
-
* the
|
|
73
|
+
* the live value is traversed after all. */
|
|
65
74
|
resolveRef) {
|
|
66
|
-
return
|
|
75
|
+
return stripLive(schema, [], resolveRef);
|
|
67
76
|
}
|
|
68
|
-
function
|
|
77
|
+
function stripLive(node,
|
|
69
78
|
// A PATH-scoped guard, not a global memo: a schema object reached twice from
|
|
70
79
|
// different parents must be stripped twice (a global `seen` would hand the
|
|
71
80
|
// second parent the unstripped original), while a cycle must still terminate.
|
|
@@ -73,7 +82,7 @@ path, resolveRef) {
|
|
|
73
82
|
if (Array.isArray(node)) {
|
|
74
83
|
let changed = false;
|
|
75
84
|
const items = node.map((item) => {
|
|
76
|
-
const next =
|
|
85
|
+
const next = stripLive(item, path, resolveRef);
|
|
77
86
|
if (next !== item)
|
|
78
87
|
changed = true;
|
|
79
88
|
return next;
|
|
@@ -85,6 +94,14 @@ path, resolveRef) {
|
|
|
85
94
|
let schema = node;
|
|
86
95
|
if (path.includes(schema))
|
|
87
96
|
return schema;
|
|
97
|
+
// The one rule. An empty schema leaves the node DECLARED but unconstrained,
|
|
98
|
+
// rather than deleted: deleting a property would force `additionalProperties:
|
|
99
|
+
// false` open, and a closed contract would stop rejecting unknown keys the
|
|
100
|
+
// moment it grew a stream — trading one exemption for a hole across the whole
|
|
101
|
+
// shape. `required` is untouched for the same reason: a live value IS present,
|
|
102
|
+
// it is only not walked.
|
|
103
|
+
if (isLiveSlot(schema))
|
|
104
|
+
return {};
|
|
88
105
|
// Follow a whole-document reference to SEE the annotations behind it, but
|
|
89
106
|
// return the original node when nothing behind it was stripped. Substituting
|
|
90
107
|
// the resolved target unconditionally would break schema identity — the
|
|
@@ -93,7 +110,7 @@ path, resolveRef) {
|
|
|
93
110
|
if (resolveRef && typeof schema.$ref === "string") {
|
|
94
111
|
const target = resolveRef(schema.$ref);
|
|
95
112
|
if (target && !path.includes(target)) {
|
|
96
|
-
const stripped =
|
|
113
|
+
const stripped = stripLive(target, [...path, schema], resolveRef);
|
|
97
114
|
if (stripped === target)
|
|
98
115
|
return node;
|
|
99
116
|
const { $ref: _ref, ...siblings } = schema;
|
|
@@ -101,44 +118,24 @@ path, resolveRef) {
|
|
|
101
118
|
}
|
|
102
119
|
}
|
|
103
120
|
const here = [...path, schema];
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
// is expressed before the branches are merged), so the marked set is read
|
|
109
|
-
// from the folded view while the removal is applied here.
|
|
110
|
-
const streamed = Object.keys(properties).filter((key) => properties[key]?.["x-telo-stream"]);
|
|
111
|
-
if (streamed.length > 0) {
|
|
112
|
-
const kept = {};
|
|
113
|
-
for (const [key, value] of Object.entries(properties)) {
|
|
114
|
-
if (!streamed.includes(key))
|
|
115
|
-
kept[key] = value;
|
|
116
|
-
}
|
|
117
|
-
// The key stays DECLARED but unconstrained, rather than being deleted.
|
|
118
|
-
// Deleting it would force `additionalProperties: false` open, and a closed
|
|
119
|
-
// contract would stop rejecting unknown keys the moment it grew a stream —
|
|
120
|
-
// trading one exemption for a hole across the whole shape.
|
|
121
|
-
for (const key of streamed)
|
|
122
|
-
kept[key] = {};
|
|
123
|
-
out = { ...schema, properties: kept };
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
// Recurse: a stream one level down (an item, a branch, a nested object) is as
|
|
127
|
-
// live as one at the root, and walking it with AJV is the same defect.
|
|
121
|
+
// Recurse: a live value one level down (a property, an item, a branch, a
|
|
122
|
+
// nested object) is as live as one at the root, and walking it with AJV is the
|
|
123
|
+
// same defect. Each is neutralized by the single rule above when the walk
|
|
124
|
+
// reaches it.
|
|
128
125
|
//
|
|
129
126
|
// `properties` and `$defs` are MAPS of schemas, not schemas — descending into
|
|
130
127
|
// them as if they were would visit nothing, since a map has none of the
|
|
131
128
|
// keywords this walk looks for.
|
|
132
|
-
let changed =
|
|
133
|
-
const result = { ...
|
|
129
|
+
let changed = false;
|
|
130
|
+
const result = { ...schema };
|
|
134
131
|
for (const key of ["properties", "$defs"]) {
|
|
135
|
-
const map =
|
|
132
|
+
const map = schema[key];
|
|
136
133
|
if (!map || typeof map !== "object")
|
|
137
134
|
continue;
|
|
138
135
|
let mapChanged = false;
|
|
139
136
|
const next = {};
|
|
140
137
|
for (const [name, child] of Object.entries(map)) {
|
|
141
|
-
const stripped =
|
|
138
|
+
const stripped = stripLive(child, here, resolveRef);
|
|
142
139
|
if (stripped !== child)
|
|
143
140
|
mapChanged = true;
|
|
144
141
|
next[name] = stripped;
|
|
@@ -149,10 +146,10 @@ path, resolveRef) {
|
|
|
149
146
|
}
|
|
150
147
|
}
|
|
151
148
|
for (const key of ["items", "allOf", "anyOf", "oneOf"]) {
|
|
152
|
-
const child =
|
|
149
|
+
const child = schema[key];
|
|
153
150
|
if (child === undefined)
|
|
154
151
|
continue;
|
|
155
|
-
const next =
|
|
152
|
+
const next = stripLive(child, here, resolveRef);
|
|
156
153
|
if (next !== child) {
|
|
157
154
|
result[key] = next;
|
|
158
155
|
changed = true;
|
|
@@ -167,7 +164,7 @@ path, resolveRef) {
|
|
|
167
164
|
* default would mutate the structure the caller still holds. Bounded by the
|
|
168
165
|
* schema's defaults rather than by the size of the payload. */
|
|
169
166
|
export function defaultBearingPaths(schema,
|
|
170
|
-
/** See {@link
|
|
167
|
+
/** See {@link withLiveValuesSkipped} — a contract kept in `$ref` form
|
|
171
168
|
* declares its defaults behind the reference, and a walk that cannot follow
|
|
172
169
|
* it would report none, leaving the caller's data shared where a fill lands. */
|
|
173
170
|
resolveRef) {
|
package/dist/loaded-types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ResourceManifest } from "@telorun/sdk";
|
|
2
2
|
import type { Document } from "yaml";
|
|
3
|
+
import type { FileMigrations } from "./migrations/driver.js";
|
|
3
4
|
import type { DocumentPosition } from "./position-metadata.js";
|
|
4
5
|
import type { AnalysisDiagnostic, Range } from "./types.js";
|
|
5
6
|
import type { AstDocument } from "./yaml-ast.js";
|
|
@@ -30,6 +31,12 @@ export interface LoadedFile {
|
|
|
30
31
|
positions: DocumentPosition[];
|
|
31
32
|
/** Document-level parse errors aggregated from `yaml.Document.errors`. */
|
|
32
33
|
parseErrors: ParseError[];
|
|
34
|
+
/** What the migration phase rewrote in this file, and the diagnostics for it.
|
|
35
|
+
* Empty unless the load opted into `migrate` AND a legacy spelling matched.
|
|
36
|
+
* `manifests` above are the POST-migration tree; `documents` / `astDocuments`
|
|
37
|
+
* / `positions` / `text` are always the author's file untouched, which is
|
|
38
|
+
* what the recorded `legacyPath` resolves against. */
|
|
39
|
+
migrations: FileMigrations;
|
|
33
40
|
}
|
|
34
41
|
export interface ParseError {
|
|
35
42
|
documentIndex: number;
|
|
@@ -88,6 +95,12 @@ export interface LoadedGraph {
|
|
|
88
95
|
* it independently re-resolves an import (the analyzer already sees repointed
|
|
89
96
|
* `importEdges`). Empty when no module identity appeared at two sources. */
|
|
90
97
|
overrides: Map<string, string>;
|
|
98
|
+
/** Deprecation diagnostics from the loader's migration phase, scoped to the
|
|
99
|
+
* ENTRY's own module (owner + its `include:` partials). A migration rewrites
|
|
100
|
+
* always — the runtime must read artifacts published years ago — but reports
|
|
101
|
+
* only here, because a published dependency is not the consumer's to fix.
|
|
102
|
+
* Empty unless the load opted into `migrate`. */
|
|
103
|
+
migrationDiagnostics: AnalysisDiagnostic[];
|
|
91
104
|
/** Diagnostics produced while reconciling module versions — one per import
|
|
92
105
|
* edge redirected to a different version (warning for a same-major hoist,
|
|
93
106
|
* error for a major mismatch). Surfaced alongside `analyze()` diagnostics by
|