@beehexa/hexasync-template-validate 2608.7.4
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/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/validate/buildValidationModel.d.ts +31 -0
- package/dist/validate/buildValidationModel.d.ts.map +1 -0
- package/dist/validate/buildValidationModel.js +68 -0
- package/dist/validate/buildValidationModel.js.map +1 -0
- package/dist/validate/context.d.ts +97 -0
- package/dist/validate/context.d.ts.map +1 -0
- package/dist/validate/context.js +90 -0
- package/dist/validate/context.js.map +1 -0
- package/dist/validate/contextFromGraph.d.ts +60 -0
- package/dist/validate/contextFromGraph.d.ts.map +1 -0
- package/dist/validate/contextFromGraph.js +77 -0
- package/dist/validate/contextFromGraph.js.map +1 -0
- package/dist/validate/harvestPullerTaskIds.d.ts +60 -0
- package/dist/validate/harvestPullerTaskIds.d.ts.map +1 -0
- package/dist/validate/harvestPullerTaskIds.js +115 -0
- package/dist/validate/harvestPullerTaskIds.js.map +1 -0
- package/dist/validate/model.d.ts +14 -0
- package/dist/validate/model.d.ts.map +1 -0
- package/dist/validate/model.js +92 -0
- package/dist/validate/model.js.map +1 -0
- package/dist/validate/registry.d.ts +20 -0
- package/dist/validate/registry.d.ts.map +1 -0
- package/dist/validate/registry.js +58 -0
- package/dist/validate/registry.js.map +1 -0
- package/dist/validate/rule.d.ts +18 -0
- package/dist/validate/rule.d.ts.map +1 -0
- package/dist/validate/rule.js +2 -0
- package/dist/validate/rule.js.map +1 -0
- package/dist/validate/ruleCatalog.d.ts +22 -0
- package/dist/validate/ruleCatalog.d.ts.map +1 -0
- package/dist/validate/ruleCatalog.js +263 -0
- package/dist/validate/ruleCatalog.js.map +1 -0
- package/dist/validate/rules/dependencyIntegrity.d.ts +60 -0
- package/dist/validate/rules/dependencyIntegrity.d.ts.map +1 -0
- package/dist/validate/rules/dependencyIntegrity.js +296 -0
- package/dist/validate/rules/dependencyIntegrity.js.map +1 -0
- package/dist/validate/rules/duplicates.d.ts +23 -0
- package/dist/validate/rules/duplicates.d.ts.map +1 -0
- package/dist/validate/rules/duplicates.js +321 -0
- package/dist/validate/rules/duplicates.js.map +1 -0
- package/dist/validate/rules/flow.d.ts +41 -0
- package/dist/validate/rules/flow.d.ts.map +1 -0
- package/dist/validate/rules/flow.js +559 -0
- package/dist/validate/rules/flow.js.map +1 -0
- package/dist/validate/rules/overwriteLoss.d.ts +23 -0
- package/dist/validate/rules/overwriteLoss.d.ts.map +1 -0
- package/dist/validate/rules/overwriteLoss.js +40 -0
- package/dist/validate/rules/overwriteLoss.js.map +1 -0
- package/dist/validate/rules/pullerKind.d.ts +3 -0
- package/dist/validate/rules/pullerKind.d.ts.map +1 -0
- package/dist/validate/rules/pullerKind.js +83 -0
- package/dist/validate/rules/pullerKind.js.map +1 -0
- package/dist/validate/rules/reference.d.ts +44 -0
- package/dist/validate/rules/reference.d.ts.map +1 -0
- package/dist/validate/rules/reference.js +370 -0
- package/dist/validate/rules/reference.js.map +1 -0
- package/dist/validate/rules/referenceKind.d.ts +25 -0
- package/dist/validate/rules/referenceKind.d.ts.map +1 -0
- package/dist/validate/rules/referenceKind.js +230 -0
- package/dist/validate/rules/referenceKind.js.map +1 -0
- package/dist/validate/rules/retiredType.d.ts +142 -0
- package/dist/validate/rules/retiredType.d.ts.map +1 -0
- package/dist/validate/rules/retiredType.js +228 -0
- package/dist/validate/rules/retiredType.js.map +1 -0
- package/dist/validate/rules/tables.d.ts +8 -0
- package/dist/validate/rules/tables.d.ts.map +1 -0
- package/dist/validate/rules/tables.js +116 -0
- package/dist/validate/rules/tables.js.map +1 -0
- package/dist/validate/rules/variableDrift.d.ts +63 -0
- package/dist/validate/rules/variableDrift.d.ts.map +1 -0
- package/dist/validate/rules/variableDrift.js +132 -0
- package/dist/validate/rules/variableDrift.js.map +1 -0
- package/dist/validate/rules/variables.d.ts +12 -0
- package/dist/validate/rules/variables.d.ts.map +1 -0
- package/dist/validate/rules/variables.js +207 -0
- package/dist/validate/rules/variables.js.map +1 -0
- package/dist/validate/sourceLocator.d.ts +32 -0
- package/dist/validate/sourceLocator.d.ts.map +1 -0
- package/dist/validate/sourceLocator.js +166 -0
- package/dist/validate/sourceLocator.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overwriteLoss.js","sourceRoot":"","sources":["../../../src/validate/rules/overwriteLoss.ts"],"names":[],"mappings":"AAwBA,MAAM,CAAC,MAAM,iBAAiB,GAAmB;IAC/C,EAAE,EAAE,KAAK;IACT,MAAM,EAAE,KAAK;IACb,GAAG,CAAC,GAAsB;QACxB,MAAM,MAAM,GAAsB,EAAE,CAAC;QAErC,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,UAAU,IAAI,EAAE,EAAE,CAAC;YAC1C,8FAA8F;YAC9F,yDAAyD;YACzD,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa;gBAAE,SAAS;YAE1D,MAAM,OAAO,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;iBACpE,MAAM,CACL,CAAC,IAAI,EAAmC,EAAE,CACxC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CACrC;iBACA,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;iBACxC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,IAAI,CAAC;iBAC/C,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAEnC,MAAM,CAAC,IAAI,CAAC;gBACV,MAAM,EAAE,OAAO;gBACf,MAAM,EAAE,KAAK;gBACb,0FAA0F;gBAC1F,6FAA6F;gBAC7F,uDAAuD;gBACvD,QAAQ,EAAE,MAAM;gBAChB,SAAS,EAAE,MAAM,CAAC,SAAS;gBAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;gBACnB,OAAO,EACL,iCAAiC,MAAM,CAAC,SAAS,oBAAoB;oBACrE,GAAG,OAAO,CAAC,MAAM,4BAA4B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACnE,GAAG,EACD,yFAAyF;oBACzF,2FAA2F;oBAC3F,4FAA4F;oBAC5F,oFAAoF;gBACtF,UAAU,EAAE,MAAM,CAAC,UAAU;gBAC7B,WAAW,EAAE,MAAM,CAAC,SAAS;aAC9B,CAAC,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pullerKind.d.ts","sourceRoot":"","sources":["../../../src/validate/rules/pullerKind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAmCjD,eAAO,MAAM,cAAc,EAAE,cAoD5B,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { isNewKindPuller } from '../harvestPullerTaskIds.js';
|
|
2
|
+
/**
|
|
3
|
+
* Puller-kind rule (PLK family) — Generic Workflow Engine, Story 1.7.
|
|
4
|
+
* - PLK-1 (LOW): a LEGACY (old-kind) puller (pullSteps/responseFilters) — nudge migration to the new-kind shape.
|
|
5
|
+
* - PLK-2 (HIGH): a NEW-KIND puller (has non-empty `steps`) that ALSO carries a legacy field
|
|
6
|
+
* (responseFilters/beforePullSteps/pullSteps/afterPullSteps). The authoring intellisense `oneOf` forbids this
|
|
7
|
+
* in-editor; this is the compose-time backstop (post-merge, where the editor's schema no longer applies).
|
|
8
|
+
* Advisory + pure (no fs, never throws fatally).
|
|
9
|
+
*/
|
|
10
|
+
function arr(cnf, key) {
|
|
11
|
+
const v = cnf?.[key];
|
|
12
|
+
return Array.isArray(v) ? v : [];
|
|
13
|
+
}
|
|
14
|
+
const LEGACY_FIELDS = [
|
|
15
|
+
'responseFilters',
|
|
16
|
+
'beforePullSteps',
|
|
17
|
+
'pullSteps',
|
|
18
|
+
'afterPullSteps',
|
|
19
|
+
];
|
|
20
|
+
/** A field is "present" when it's a non-empty array/object or any non-null scalar. */
|
|
21
|
+
function has(p, field) {
|
|
22
|
+
const v = p?.[field];
|
|
23
|
+
if (v == null)
|
|
24
|
+
return false;
|
|
25
|
+
if (Array.isArray(v))
|
|
26
|
+
return v.length > 0;
|
|
27
|
+
if (typeof v === 'object')
|
|
28
|
+
return Object.keys(v).length > 0;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
export const pullerKindRule = {
|
|
32
|
+
id: 'PLK',
|
|
33
|
+
family: 'PLK',
|
|
34
|
+
run(ctx) {
|
|
35
|
+
const cnf = ctx.tokenForm;
|
|
36
|
+
if (!cnf || typeof cnf !== 'object')
|
|
37
|
+
return [];
|
|
38
|
+
const issues = [];
|
|
39
|
+
for (const p of arr(cnf, 'pullers')) {
|
|
40
|
+
const pid = p && typeof p === 'object' ? (p.id ?? p.name) : undefined;
|
|
41
|
+
const idOrKey = pid != null ? String(pid) : undefined;
|
|
42
|
+
if (isNewKindPuller(p)) {
|
|
43
|
+
const offending = LEGACY_FIELDS.filter((f) => has(p, f));
|
|
44
|
+
if (offending.length > 0) {
|
|
45
|
+
issues.push({
|
|
46
|
+
ruleId: 'PLK-2',
|
|
47
|
+
family: 'PLK',
|
|
48
|
+
severity: 'high',
|
|
49
|
+
parentKey: 'pullers',
|
|
50
|
+
idOrKey,
|
|
51
|
+
message: `new-kind puller (has 'steps') also declares legacy field(s): ${offending.join(', ')}`,
|
|
52
|
+
why: 'the new-kind and old-kind puller shapes are mutually exclusive — legacy fields are ignored/ambiguous on the steps path',
|
|
53
|
+
locateValue: offending[0],
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else if (has(p, 'pullSteps') || has(p, 'responseFilters')) {
|
|
58
|
+
// The legacy fields this puller ACTUALLY declares, so the finding names what is there.
|
|
59
|
+
//
|
|
60
|
+
// `locateValue` was hardcoded to `pullSteps`, which a consumer uses to narrow the highlight to
|
|
61
|
+
// the offending line. On a puller declaring only `responseFilters` that value is nowhere in the
|
|
62
|
+
// component, nothing narrows, and the whole puller gets underlined — reported from a real
|
|
63
|
+
// session, where a one-property nudge underlined dozens of lines.
|
|
64
|
+
const declared = LEGACY_FIELDS.filter((field) => has(p, field));
|
|
65
|
+
issues.push({
|
|
66
|
+
ruleId: 'PLK-1',
|
|
67
|
+
family: 'PLK',
|
|
68
|
+
severity: 'low',
|
|
69
|
+
parentKey: 'pullers',
|
|
70
|
+
idOrKey,
|
|
71
|
+
message: `legacy (old-kind) puller — uses ${declared.join(', ')}`,
|
|
72
|
+
why: 'prefer the new-kind puller (steps + _inputs/_outputs/__this + SAVE_TASK_DATA); see the Worker > Puller Workflow guide',
|
|
73
|
+
// The FIRST field actually present, in the declared order. One finding per puller rather than
|
|
74
|
+
// one per field: "this puller is legacy" is a single fact, and four LOW warnings on one
|
|
75
|
+
// component would be four reminders of the same thing.
|
|
76
|
+
locateValue: declared[0] ?? 'pullSteps',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return issues;
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=pullerKind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pullerKind.js","sourceRoot":"","sources":["../../../src/validate/rules/pullerKind.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7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CAAC,EAAE;oBACjE,GAAG,EAAE,uHAAuH;oBAC5H,8FAA8F;oBAC9F,wFAAwF;oBACxF,uDAAuD;oBACvD,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,WAAW;iBACxC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ValidationRule } from '../rule.js';
|
|
2
|
+
/** Reference index: the set of existing ids/keys per collection, resolved to VALUES.
|
|
3
|
+
* NOTE: connections are intentionally NOT indexed — connection existence is not statically
|
|
4
|
+
* decidable (see the connection-analysis note on `referenceRule`), so the connection-edge
|
|
5
|
+
* checks (former REF-8/10/11/12) are deferred to a v2 connection-analysis family. */
|
|
6
|
+
export interface ReferenceIndex {
|
|
7
|
+
pullers: Set<string>;
|
|
8
|
+
pushers: Set<string>;
|
|
9
|
+
tables: Set<string>;
|
|
10
|
+
objects: Set<string>;
|
|
11
|
+
metricGroups: Set<string>;
|
|
12
|
+
}
|
|
13
|
+
/** Resolve a token-form string to the value it composes to, replacing every declared
|
|
14
|
+
* `**Name**` variable with its value. Two DIFFERENT token names that resolve to the SAME
|
|
15
|
+
* value (a value-alias, common in real profiles) must compare equal — otherwise REF flags
|
|
16
|
+
* a reference that resolves perfectly at runtime as dangling. Identity when no variables
|
|
17
|
+
* are declared (keeps synthetic token-form fixtures/tests unchanged). */
|
|
18
|
+
export type TokenResolver = (v: string) => string;
|
|
19
|
+
export declare function makeTokenResolver(variables: Record<string, unknown> | undefined | null): TokenResolver;
|
|
20
|
+
export declare function collectIds(cnf: any, resolve?: TokenResolver): ReferenceIndex;
|
|
21
|
+
/** A Scriban expression is a dynamic edge — cannot be statically resolved, never dangling. */
|
|
22
|
+
export declare function isDynamic(v: unknown): boolean;
|
|
23
|
+
/** An unset reference (null/undefined/empty/whitespace-only) is not a dangling reference. */
|
|
24
|
+
export declare function isRefEmpty(v: unknown): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Reference-integrity rule (REF family). For every profile-LOCAL reference edge the schema
|
|
27
|
+
* defines, verifies the target id/key exists in the composed profile. Reads the TOKEN-form
|
|
28
|
+
* (so messages carry the author's original `**token**` for source attribution) but compares
|
|
29
|
+
* RESOLVED values via makeTokenResolver, so a reference and its target that use different
|
|
30
|
+
* tokens resolving to the same value are NOT flagged. Skips dynamic `{{…}}`, unset, and
|
|
31
|
+
* non-primitive references, and references whose resolved value still holds a `**token**`
|
|
32
|
+
* (an undeclared variable — VAR-1 owns that).
|
|
33
|
+
*
|
|
34
|
+
* DEFERRED — connection analysis (v2). The connection-edge checks (former REF-8 webhook
|
|
35
|
+
* connectionId, REF-10 object fromConnectionId, REF-11 metricGroup connectionId, REF-12 step
|
|
36
|
+
* connectorId) are intentionally NOT implemented: connection existence is not statically
|
|
37
|
+
* decidable. The worker (core.api BaseStepExecutor.SetStep) parses a connectionId as a raw
|
|
38
|
+
* GUID and only consults the profile's connectors[]/connections[] for metadata — platform
|
|
39
|
+
* and self connections legitimately resolve OUTSIDE the profile, so a connection referenced
|
|
40
|
+
* but not declared is not a runtime failure. Flagging it produced 100+ false CRITICALs on
|
|
41
|
+
* shipped templates. A future connection-analysis family needs cross-profile/platform data.
|
|
42
|
+
*/
|
|
43
|
+
export declare const referenceRule: ValidationRule;
|
|
44
|
+
//# sourceMappingURL=reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../src/validate/rules/reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAWjD;;;sFAGsF;AACtF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrB,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED;;;;0EAI0E;AAC1E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAElD,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,GACpD,aAAa,CAaf;AAoDD,wBAAgB,UAAU,CACxB,GAAG,EAAE,GAAG,EACR,OAAO,GAAE,aAAwB,GAChC,cAAc,CAQhB;AAED,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAE7C;AAED,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAE9C;AAmED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,aAAa,EAAE,cA4T3B,CAAC"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { harvestPullerTaskIds, NEW_KIND_PHASES, } from '../harvestPullerTaskIds.js';
|
|
2
|
+
export function makeTokenResolver(variables) {
|
|
3
|
+
const vars = variables ?? {};
|
|
4
|
+
// Longest key first so a shorter key is never applied inside a longer one.
|
|
5
|
+
const keys = Object.keys(vars).sort((a, b) => b.length - a.length);
|
|
6
|
+
return (v) => {
|
|
7
|
+
// Fast path: the whole value is exactly one declared token (the common id case).
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(vars, v))
|
|
9
|
+
return String(vars[v]);
|
|
10
|
+
if (keys.length === 0)
|
|
11
|
+
return v;
|
|
12
|
+
let out = v;
|
|
13
|
+
for (const k of keys)
|
|
14
|
+
if (out.includes(k))
|
|
15
|
+
out = out.split(k).join(String(vars[k]));
|
|
16
|
+
return out;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function arr(cnf, key) {
|
|
20
|
+
const v = cnf?.[key];
|
|
21
|
+
return Array.isArray(v) ? v : [];
|
|
22
|
+
}
|
|
23
|
+
function idSet(items, field, resolve) {
|
|
24
|
+
const s = new Set();
|
|
25
|
+
for (const it of items) {
|
|
26
|
+
if (it && typeof it === 'object' && it[field] != null) {
|
|
27
|
+
const v = resolve(String(it[field]));
|
|
28
|
+
if (v !== '')
|
|
29
|
+
s.add(v); // an empty-string id is not a valid reference target
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return s;
|
|
33
|
+
}
|
|
34
|
+
/** Depth-first walk of the metricGroups tree (`children[]`), guarded against cycles —
|
|
35
|
+
* YAML anchors/aliases can produce self-referential object graphs, and an unguarded
|
|
36
|
+
* recursion would stack-overflow (the registry then silently swallows the throw,
|
|
37
|
+
* dropping ALL reference checks). Calls `visit` once per group. */
|
|
38
|
+
function walkMetricGroups(cnf, visit) {
|
|
39
|
+
const seen = new WeakSet();
|
|
40
|
+
const walk = (g) => {
|
|
41
|
+
if (!g || typeof g !== 'object' || seen.has(g))
|
|
42
|
+
return;
|
|
43
|
+
seen.add(g);
|
|
44
|
+
visit(g);
|
|
45
|
+
for (const c of Array.isArray(g.children) ? g.children : [])
|
|
46
|
+
walk(c);
|
|
47
|
+
};
|
|
48
|
+
// Metric groups live BOTH at the top level and (in real profiles) per-object under
|
|
49
|
+
// objects[].metricGroups — a metric's `groups[]` reference either, so collect both.
|
|
50
|
+
for (const g of arr(cnf, 'metricGroups'))
|
|
51
|
+
walk(g);
|
|
52
|
+
for (const o of arr(cnf, 'objects')) {
|
|
53
|
+
if (o && typeof o === 'object')
|
|
54
|
+
for (const g of arr(o, 'metricGroups'))
|
|
55
|
+
walk(g);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/** metricGroups form a tree via `children[]`; collect every group key (resolved). */
|
|
59
|
+
function collectMetricGroupKeys(cnf, resolve) {
|
|
60
|
+
const s = new Set();
|
|
61
|
+
walkMetricGroups(cnf, (g) => {
|
|
62
|
+
if (g.key != null && String(g.key) !== '')
|
|
63
|
+
s.add(resolve(String(g.key)));
|
|
64
|
+
});
|
|
65
|
+
return s;
|
|
66
|
+
}
|
|
67
|
+
export function collectIds(cnf, resolve = (v) => v) {
|
|
68
|
+
return {
|
|
69
|
+
pullers: idSet(arr(cnf, 'pullers'), 'id', resolve),
|
|
70
|
+
pushers: idSet(arr(cnf, 'pushers'), 'id', resolve),
|
|
71
|
+
tables: idSet(arr(cnf, 'tables'), 'id', resolve),
|
|
72
|
+
objects: idSet(arr(cnf, 'objects'), 'id', resolve),
|
|
73
|
+
metricGroups: collectMetricGroupKeys(cnf, resolve),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** A Scriban expression is a dynamic edge — cannot be statically resolved, never dangling. */
|
|
77
|
+
export function isDynamic(v) {
|
|
78
|
+
return typeof v === 'string' && /\{\{[\s\S]*\}\}/.test(v);
|
|
79
|
+
}
|
|
80
|
+
/** An unset reference (null/undefined/empty/whitespace-only) is not a dangling reference. */
|
|
81
|
+
export function isRefEmpty(v) {
|
|
82
|
+
return v == null || (typeof v === 'string' && v.trim() === '');
|
|
83
|
+
}
|
|
84
|
+
/** A residual `**token**` in a RESOLVED value means a variable never resolved — that is a
|
|
85
|
+
* VAR-1 finding (CRITICAL, "unresolved token"), which owns the root cause. REF must not
|
|
86
|
+
* double-report the same defect as a dangling reference, so a reference whose resolved
|
|
87
|
+
* value still carries a token is skipped here. */
|
|
88
|
+
const RESIDUAL_TOKEN = /\*\*[A-Za-z0-9_]+\*\*/;
|
|
89
|
+
/** DIRECT_INDEX (and other data-insertion) steps write rows straight into one or more target
|
|
90
|
+
* tasks via `data.objectIds` / `data.objectId`. A task populated this way is fed even though
|
|
91
|
+
* its objectAssociation declares no puller — or declares a since-removed one — so REF-1 must
|
|
92
|
+
* NOT flag such a task's missing puller. A step is a data writer when its displayType/type is
|
|
93
|
+
* DIRECT_INDEX, or (honouring the broader "inserts data into the task" intent, future-proofed
|
|
94
|
+
* against new displayType names) when it carries a `data.dataPath` alongside object targets. */
|
|
95
|
+
function isDataWriteStep(s) {
|
|
96
|
+
const kind = String(s?.displayType ?? s?.type ?? '').toUpperCase();
|
|
97
|
+
if (kind === 'DIRECT_INDEX')
|
|
98
|
+
return true;
|
|
99
|
+
const d = s?.data;
|
|
100
|
+
return !!(d &&
|
|
101
|
+
typeof d === 'object' &&
|
|
102
|
+
d.dataPath != null &&
|
|
103
|
+
(d.objectId != null || Array.isArray(d.objectIds)));
|
|
104
|
+
}
|
|
105
|
+
/** Resolved ids of every task/object that a data-insertion step writes into, across all
|
|
106
|
+
* pullers, pushers, and webhook targets. A task in this set is fed by another component's
|
|
107
|
+
* step, so it legitimately needs no puller of its own — used to suppress REF-1. */
|
|
108
|
+
function collectDataWriteTargets(cnf, resolve) {
|
|
109
|
+
const targets = new Set();
|
|
110
|
+
const scan = (steps) => {
|
|
111
|
+
if (!Array.isArray(steps))
|
|
112
|
+
return;
|
|
113
|
+
for (const s of steps) {
|
|
114
|
+
if (!s || typeof s !== 'object' || !isDataWriteStep(s))
|
|
115
|
+
continue;
|
|
116
|
+
const d = s.data;
|
|
117
|
+
if (!d || typeof d !== 'object')
|
|
118
|
+
continue;
|
|
119
|
+
const ids = [];
|
|
120
|
+
if (d.objectId != null)
|
|
121
|
+
ids.push(d.objectId);
|
|
122
|
+
if (Array.isArray(d.objectIds))
|
|
123
|
+
ids.push(...d.objectIds);
|
|
124
|
+
for (const oid of ids) {
|
|
125
|
+
if (isRefEmpty(oid) || isDynamic(oid))
|
|
126
|
+
continue;
|
|
127
|
+
if (typeof oid !== 'string' && typeof oid !== 'number')
|
|
128
|
+
continue;
|
|
129
|
+
const r = resolve(String(oid));
|
|
130
|
+
if (r !== '' && !RESIDUAL_TOKEN.test(r))
|
|
131
|
+
targets.add(r);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
for (const p of arr(cnf, 'pullers'))
|
|
136
|
+
for (const ph of ['beforePullSteps', 'pullSteps', 'afterPullSteps'])
|
|
137
|
+
scan(p?.[ph]);
|
|
138
|
+
for (const p of arr(cnf, 'pushers'))
|
|
139
|
+
for (const ph of ['beforePushSteps', 'pushSteps', 'afterPushSteps'])
|
|
140
|
+
scan(p?.[ph]);
|
|
141
|
+
for (const w of arr(cnf, 'webhooks')) {
|
|
142
|
+
const tmap = w?.targets && typeof w.targets === 'object' && !Array.isArray(w.targets)
|
|
143
|
+
? w.targets
|
|
144
|
+
: {};
|
|
145
|
+
for (const t of Object.values(tmap))
|
|
146
|
+
scan(t?.pullSteps);
|
|
147
|
+
}
|
|
148
|
+
return targets;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Reference-integrity rule (REF family). For every profile-LOCAL reference edge the schema
|
|
152
|
+
* defines, verifies the target id/key exists in the composed profile. Reads the TOKEN-form
|
|
153
|
+
* (so messages carry the author's original `**token**` for source attribution) but compares
|
|
154
|
+
* RESOLVED values via makeTokenResolver, so a reference and its target that use different
|
|
155
|
+
* tokens resolving to the same value are NOT flagged. Skips dynamic `{{…}}`, unset, and
|
|
156
|
+
* non-primitive references, and references whose resolved value still holds a `**token**`
|
|
157
|
+
* (an undeclared variable — VAR-1 owns that).
|
|
158
|
+
*
|
|
159
|
+
* DEFERRED — connection analysis (v2). The connection-edge checks (former REF-8 webhook
|
|
160
|
+
* connectionId, REF-10 object fromConnectionId, REF-11 metricGroup connectionId, REF-12 step
|
|
161
|
+
* connectorId) are intentionally NOT implemented: connection existence is not statically
|
|
162
|
+
* decidable. The worker (core.api BaseStepExecutor.SetStep) parses a connectionId as a raw
|
|
163
|
+
* GUID and only consults the profile's connectors[]/connections[] for metadata — platform
|
|
164
|
+
* and self connections legitimately resolve OUTSIDE the profile, so a connection referenced
|
|
165
|
+
* but not declared is not a runtime failure. Flagging it produced 100+ false CRITICALs on
|
|
166
|
+
* shipped templates. A future connection-analysis family needs cross-profile/platform data.
|
|
167
|
+
*/
|
|
168
|
+
export const referenceRule = {
|
|
169
|
+
id: 'REF',
|
|
170
|
+
family: 'REF',
|
|
171
|
+
run(ctx) {
|
|
172
|
+
const cnf = ctx.tokenForm;
|
|
173
|
+
if (!cnf || typeof cnf !== 'object')
|
|
174
|
+
return [];
|
|
175
|
+
// Compare RESOLVED values, not raw tokens: a reference and its target may use two
|
|
176
|
+
// different variable tokens that resolve to the same value (a value-alias). The index
|
|
177
|
+
// and every checked reference are resolved through the same variable pool so aliases
|
|
178
|
+
// match; messages still show the author's original token.
|
|
179
|
+
const resolve = makeTokenResolver(ctx.variables);
|
|
180
|
+
const idx = collectIds(cnf, resolve);
|
|
181
|
+
// Combined puller↔task resolver (Story 7.1): a new-kind puller OWNS the tasks it feeds
|
|
182
|
+
// via static SAVE_TASK_DATA / UPDATE_TASK_DATA_STATUS `data.taskId` steps. Harvest that
|
|
183
|
+
// edge and UNION it into the DIRECT_INDEX / data-insertion write-target set so a task
|
|
184
|
+
// fed only by a steps-based puller is not false-flagged by REF-1 (and a stale, migrated
|
|
185
|
+
// objectAssociation.puller pointing at it is suppressed the same way).
|
|
186
|
+
const harvest = harvestPullerTaskIds(cnf, resolve);
|
|
187
|
+
// Tasks fed by a DIRECT_INDEX / data-insertion step elsewhere need no puller — REF-1 skips them.
|
|
188
|
+
const writeTargets = collectDataWriteTargets(cnf, resolve);
|
|
189
|
+
for (const t of harvest.taskIds)
|
|
190
|
+
writeTargets.add(t);
|
|
191
|
+
const issues = [];
|
|
192
|
+
const push = (ruleId, severity, parentKey, idOrKey, message, why) => issues.push({
|
|
193
|
+
ruleId,
|
|
194
|
+
family: 'REF',
|
|
195
|
+
severity,
|
|
196
|
+
parentKey,
|
|
197
|
+
idOrKey,
|
|
198
|
+
message,
|
|
199
|
+
why,
|
|
200
|
+
});
|
|
201
|
+
const checkVal = (val, set, mk) => {
|
|
202
|
+
if (isRefEmpty(val) || isDynamic(val))
|
|
203
|
+
return;
|
|
204
|
+
// A non-primitive reference is a schema/type error, not a dangling id — skip it
|
|
205
|
+
// (avoids a "[object Object]" false positive; schema/enum checks own that case).
|
|
206
|
+
if (typeof val !== 'string' && typeof val !== 'number')
|
|
207
|
+
return;
|
|
208
|
+
const resolved = resolve(String(val));
|
|
209
|
+
if (RESIDUAL_TOKEN.test(resolved))
|
|
210
|
+
return; // undeclared variable — VAR-1 owns it
|
|
211
|
+
if (!set.has(resolved))
|
|
212
|
+
mk();
|
|
213
|
+
};
|
|
214
|
+
// REF-7 — objects: metric group references.
|
|
215
|
+
// (REF-10 object `fromConnectionId` deferred — see the connection-analysis note below.)
|
|
216
|
+
for (const o of arr(cnf, 'objects')) {
|
|
217
|
+
if (!o || typeof o !== 'object')
|
|
218
|
+
continue;
|
|
219
|
+
const oid = o.id != null ? String(o.id) : undefined;
|
|
220
|
+
for (const m of arr(o, 'metrics')) {
|
|
221
|
+
for (const g of Array.isArray(m?.groups) ? m.groups : []) {
|
|
222
|
+
checkVal(g, idx.metricGroups, () => push('REF-7', 'medium', 'objects', oid, `metric "${m?.id}" references missing metric group "${g}"`, 'the metric is ungrouped'));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// REF-1 / REF-2 / REF-3 — objectAssociations (map keyed by task id).
|
|
227
|
+
// NOTE: puller.resultKey is intentionally NOT validated — it is a responseFilter
|
|
228
|
+
// extraction key, not an object id (see review of Story 1.2).
|
|
229
|
+
const assoc = cnf.objectAssociations &&
|
|
230
|
+
typeof cnf.objectAssociations === 'object' &&
|
|
231
|
+
!Array.isArray(cnf.objectAssociations)
|
|
232
|
+
? cnf.objectAssociations
|
|
233
|
+
: {};
|
|
234
|
+
for (const [tid, a] of Object.entries(assoc)) {
|
|
235
|
+
if (!a || typeof a !== 'object')
|
|
236
|
+
continue;
|
|
237
|
+
const puller = a.puller;
|
|
238
|
+
if (puller && typeof puller === 'object') {
|
|
239
|
+
// Suppress when the task's data is inserted by a DIRECT_INDEX / data-insertion step
|
|
240
|
+
// in another puller or pusher — it is fed without a puller of its own, so a missing
|
|
241
|
+
// (or absent) association puller is expected, not a defect.
|
|
242
|
+
if (!writeTargets.has(resolve(String(tid)))) {
|
|
243
|
+
checkVal(puller.id, idx.pullers, () => push('REF-1', 'high', 'objectAssociations', tid, `association puller.id references missing puller "${puller.id}"`, 'the object never pulls'));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
const pusher = a.pusher;
|
|
247
|
+
if (pusher && typeof pusher === 'object') {
|
|
248
|
+
checkVal(pusher.id, idx.pushers, () => push('REF-2', 'high', 'objectAssociations', tid, `association pusher.id references missing pusher "${pusher.id}"`, 'the object never pushes'));
|
|
249
|
+
}
|
|
250
|
+
const table = a.table;
|
|
251
|
+
if (table && typeof table === 'object') {
|
|
252
|
+
checkVal(table.id, idx.tables, () => push('REF-3', 'medium', 'objectAssociations', tid, `association table.id references missing table "${table.id}"`, 'the object has no backing table'));
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// REF-16 (Story 7.2) — a new-kind puller's static SAVE_TASK_DATA /
|
|
256
|
+
// UPDATE_TASK_DATA_STATUS `data.taskId` must name a task that exists (an object id, or
|
|
257
|
+
// a declared objectAssociation task key). A missing target means the puller writes into
|
|
258
|
+
// a task that is never created — silently wrong at runtime.
|
|
259
|
+
const taskExists = new Set(idx.objects);
|
|
260
|
+
for (const tid of Object.keys(assoc)) {
|
|
261
|
+
if (isRefEmpty(tid) || isDynamic(tid))
|
|
262
|
+
continue;
|
|
263
|
+
const r = resolve(String(tid));
|
|
264
|
+
if (r !== '' && !RESIDUAL_TOKEN.test(r))
|
|
265
|
+
taskExists.add(r);
|
|
266
|
+
}
|
|
267
|
+
for (const ref of harvest.refs) {
|
|
268
|
+
if (!taskExists.has(ref.taskId)) {
|
|
269
|
+
push('REF-16', 'high', 'pullers', ref.pullerId, `step "${ref.stepKey ?? '(step)'}" (${ref.phase}) ${ref.stepType} taskId references missing task "${ref.rawTaskId}"`, 'the puller writes into a task that does not exist');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// REF-5 — transformations / validations map keyed by object id.
|
|
273
|
+
for (const mapKey of ['transformations', 'validations']) {
|
|
274
|
+
const m = cnf[mapKey];
|
|
275
|
+
if (!m || typeof m !== 'object' || Array.isArray(m))
|
|
276
|
+
continue;
|
|
277
|
+
for (const tid of Object.keys(m)) {
|
|
278
|
+
if (isRefEmpty(tid) || isDynamic(tid))
|
|
279
|
+
continue;
|
|
280
|
+
const resolvedTid = resolve(String(tid));
|
|
281
|
+
if (RESIDUAL_TOKEN.test(resolvedTid))
|
|
282
|
+
continue; // undeclared var — VAR-1 owns it
|
|
283
|
+
if (!idx.objects.has(resolvedTid)) {
|
|
284
|
+
push('REF-5', 'high', mapKey, tid, `${mapKey} keyed to missing object "${tid}"`, `the ${mapKey} are silently not applied`);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// REF-6 — dependencies.
|
|
289
|
+
for (const d of arr(cnf, 'dependencies')) {
|
|
290
|
+
if (!d || typeof d !== 'object')
|
|
291
|
+
continue;
|
|
292
|
+
const did = d.id != null ? String(d.id) : undefined;
|
|
293
|
+
checkVal(d.objectId, idx.objects, () => push('REF-6', 'medium', 'dependencies', did, `dependency objectId references missing object "${d.objectId}"`, 'the dependency is silently ignored'));
|
|
294
|
+
checkVal(d.dependedOn, idx.objects, () => push('REF-6', 'medium', 'dependencies', did, `dependency dependedOn references missing object "${d.dependedOn}"`, 'the dependency is silently ignored'));
|
|
295
|
+
}
|
|
296
|
+
// (REF-11 metricGroup `connectionId` deferred — see the connection-analysis note below.)
|
|
297
|
+
// Steps: REF-13 object refs. Shared across pullers/pushers/targets.
|
|
298
|
+
// (REF-12 step `connectorId` deferred — see the connection-analysis note below.)
|
|
299
|
+
const checkSteps = (steps, parentKey, ownerId, label) => {
|
|
300
|
+
if (!Array.isArray(steps))
|
|
301
|
+
return;
|
|
302
|
+
for (const s of steps) {
|
|
303
|
+
if (!s || typeof s !== 'object')
|
|
304
|
+
continue;
|
|
305
|
+
const key = s.key != null ? String(s.key) : '(step)';
|
|
306
|
+
const objRefs = [];
|
|
307
|
+
if (s.data && typeof s.data === 'object') {
|
|
308
|
+
if (s.data.objectId != null)
|
|
309
|
+
objRefs.push(s.data.objectId);
|
|
310
|
+
if (Array.isArray(s.data.objectIds))
|
|
311
|
+
objRefs.push(...s.data.objectIds);
|
|
312
|
+
}
|
|
313
|
+
if (s.arguments &&
|
|
314
|
+
typeof s.arguments === 'object' &&
|
|
315
|
+
s.arguments.object_id != null) {
|
|
316
|
+
objRefs.push(s.arguments.object_id);
|
|
317
|
+
}
|
|
318
|
+
for (const oid of objRefs) {
|
|
319
|
+
checkVal(oid, idx.objects, () => push('REF-13', 'high', parentKey, ownerId, `step "${key}" (${label}) references missing object "${oid}"`, 'the step no-ops or errors'));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
for (const p of arr(cnf, 'pullers')) {
|
|
324
|
+
const pid = p?.id != null ? String(p.id) : undefined;
|
|
325
|
+
for (const ph of ['beforePullSteps', 'pullSteps', 'afterPullSteps'])
|
|
326
|
+
checkSteps(p?.[ph], 'pullers', pid, ph);
|
|
327
|
+
// Story 7.6 — also walk the new-kind puller phases (inert for old-kind pullers,
|
|
328
|
+
// whose new arrays are absent) so their steps get object-reference validation too.
|
|
329
|
+
for (const ph of NEW_KIND_PHASES)
|
|
330
|
+
checkSteps(p?.[ph], 'pullers', pid, ph);
|
|
331
|
+
}
|
|
332
|
+
for (const p of arr(cnf, 'pushers')) {
|
|
333
|
+
const pid = p?.id != null ? String(p.id) : undefined;
|
|
334
|
+
for (const ph of ['beforePushSteps', 'pushSteps', 'afterPushSteps'])
|
|
335
|
+
checkSteps(p?.[ph], 'pushers', pid, ph);
|
|
336
|
+
}
|
|
337
|
+
// REF-9 — webhooks: target objectIds, target steps.
|
|
338
|
+
// (REF-8 webhook `connectionId` deferred — see the connection-analysis note below.)
|
|
339
|
+
for (const w of arr(cnf, 'webhooks')) {
|
|
340
|
+
if (!w || typeof w !== 'object')
|
|
341
|
+
continue;
|
|
342
|
+
const wid = w.id != null ? String(w.id) : undefined;
|
|
343
|
+
const targets = w.targets && typeof w.targets === 'object' && !Array.isArray(w.targets)
|
|
344
|
+
? w.targets
|
|
345
|
+
: {};
|
|
346
|
+
for (const [tk, t] of Object.entries(targets)) {
|
|
347
|
+
for (const oid of Array.isArray(t?.objectIds) ? t.objectIds : []) {
|
|
348
|
+
checkVal(oid, idx.objects, () => push('REF-9', 'critical', 'webhooks', wid, `target "${tk}" objectIds references missing object "${oid}"`, 'the webhook is silently dead'));
|
|
349
|
+
}
|
|
350
|
+
checkSteps(t?.pullSteps, 'webhooks', wid, `target ${tk}`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// REF-15 — startupTasks scheduler target (only when it targets an object/task).
|
|
354
|
+
const isObjectLike = (t) => t == null || ['TASK', 'OBJECT'].includes(String(t).toUpperCase());
|
|
355
|
+
for (const st of arr(cnf, 'startupTasks')) {
|
|
356
|
+
if (!st || typeof st !== 'object')
|
|
357
|
+
continue;
|
|
358
|
+
const k = st.key != null ? String(st.key) : undefined;
|
|
359
|
+
// metadata.entityType defaults to TASK; only validate entityId when object-like.
|
|
360
|
+
if (isObjectLike(st.metadata?.entityType)) {
|
|
361
|
+
checkVal(st.metadata?.entityId, idx.objects, () => push('REF-15', 'medium', 'startupTasks', k, `startupTask entityId references missing object "${st.metadata?.entityId}"`, 'the scheduler targets nothing'));
|
|
362
|
+
}
|
|
363
|
+
if (isObjectLike(st.targetType) && st.targetType != null) {
|
|
364
|
+
checkVal(st.targetId, idx.objects, () => push('REF-15', 'medium', 'startupTasks', k, `startupTask targetId references missing object "${st.targetId}"`, 'the scheduler targets nothing'));
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return issues;
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
//# sourceMappingURL=reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference.js","sourceRoot":"","sources":["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AAI,YAAY,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;gBACzD,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,CACtC,IAAI,CACF,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,CAAC,EACD,mDAAmD,EAAE,CAAC,QAAQ,GAAG,EACjE,+BAA+B,CAChC,CACF,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REF-K — a reference that names nothing, or names the wrong kind of thing.
|
|
3
|
+
*
|
|
4
|
+
* Phase 2 Story 1.2 (FR-54, FR-56). The existing `referenceRule` checks specific STRUCTURES the
|
|
5
|
+
* corpus uses — objectAssociations, dependencies, metric groups. This one is general: it walks the
|
|
6
|
+
* composed document, asks the measured registry which properties are references, and checks each
|
|
7
|
+
* against what the project actually contains.
|
|
8
|
+
*
|
|
9
|
+
* Three things it deliberately does NOT do, each because doing it would put an error on correct YAML:
|
|
10
|
+
*
|
|
11
|
+
* - **It never reports where the registry DECLINES.** `entityId` beside `entityType: SELF` references
|
|
12
|
+
* nothing; a raw runtime UUID in `targetId` is not a component reference. "Not a reference" and "a
|
|
13
|
+
* reference that is broken" are different answers, and collapsing them is how a rule cries wolf on
|
|
14
|
+
* every correct file. The registry already draws that line — see the measurement note on it.
|
|
15
|
+
* - **It never reports a right-kind-wrong-instance reference.** Story 1.2's last AC says these are
|
|
16
|
+
* undetectable and the PRD's statement should stand rather than be papered over with a heuristic.
|
|
17
|
+
* A reference that resolves to a real component of the correct collection is accepted, full stop.
|
|
18
|
+
* - **It compares in TOKEN form, resolved through the pool.** Two different token names resolving to
|
|
19
|
+
* the same value is an ordinary corpus pattern, and comparing raw token text would flag references
|
|
20
|
+
* that resolve perfectly at runtime. `makeTokenResolver` is the existing answer to this and is
|
|
21
|
+
* reused rather than re-derived.
|
|
22
|
+
*/
|
|
23
|
+
import type { ValidationRule } from '../rule.js';
|
|
24
|
+
export declare const referenceKindRule: ValidationRule;
|
|
25
|
+
//# sourceMappingURL=referenceKind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"referenceKind.d.ts","sourceRoot":"","sources":["../../../src/validate/rules/referenceKind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAwLjD,eAAO,MAAM,iBAAiB,EAAE,cAsF/B,CAAC"}
|