@intentius/chant 0.124.22 → 0.124.24
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/audit/rules-doc.js +1 -1
- package/dist/ci-jobs.d.ts +41 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +48 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +14 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +9 -0
- package/dist/cli/handlers/emulator.d.ts +13 -2
- package/dist/cli/handlers/emulator.d.ts.map +1 -1
- package/dist/cli/handlers/emulator.js +63 -3
- package/dist/cli/handlers/graph.js +24 -1
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +7 -1
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +5 -4
- package/dist/cli/handlers/run.d.ts +4 -3
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +73 -9
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +17 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +31 -0
- package/dist/cli/registry.d.ts +12 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +45 -6
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +97 -22
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +25 -10
- package/dist/graph-detail.d.ts.map +1 -1
- package/dist/graph-detail.js +24 -2
- package/dist/graph-ir.d.ts +43 -0
- package/dist/graph-ir.d.ts.map +1 -1
- package/dist/graph-ir.js +27 -0
- package/dist/lexicon.d.ts +25 -1
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +62 -6
- package/dist/lifecycle/no-record.d.ts +59 -0
- package/dist/lifecycle/no-record.d.ts.map +1 -0
- package/dist/lifecycle/no-record.js +88 -0
- package/dist/op/activities/shell.d.ts.map +1 -1
- package/dist/op/activities/shell.js +30 -9
- package/dist/op/emulator-lifecycle.d.ts +23 -0
- package/dist/op/emulator-lifecycle.d.ts.map +1 -1
- package/dist/op/emulator-lifecycle.js +39 -2
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +3 -0
- package/dist/op/index.d.ts +1 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/local-executor.d.ts +10 -0
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +7 -2
- package/dist/op/op-waves-notify.d.ts +2 -0
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-notify.js +9 -3
- package/dist/op/op-waves-run.d.ts +8 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +36 -11
- package/dist/op/op-waves.d.ts +85 -1
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +153 -1
- package/dist/op/runtimes/local.d.ts.map +1 -1
- package/dist/op/runtimes/local.js +6 -0
- package/dist/op/step-console.d.ts +65 -0
- package/dist/op/step-console.d.ts.map +1 -0
- package/dist/op/step-console.js +140 -0
- package/dist/point-decision.d.ts.map +1 -1
- package/dist/point-decision.js +3 -0
- package/dist/wave-runtime.mjs +240 -224
- package/dist/workspace/checks/links.d.ts +5 -0
- package/dist/workspace/checks/links.d.ts.map +1 -1
- package/dist/workspace/checks/links.js +54 -8
- package/dist/workspace/checks.d.ts +4 -1
- package/dist/workspace/checks.d.ts.map +1 -1
- package/dist/workspace/checks.js +6 -2
- package/dist/workspace/compose-graph.d.ts +26 -4
- package/dist/workspace/compose-graph.d.ts.map +1 -1
- package/dist/workspace/compose-graph.js +21 -7
- package/dist/workspace/dbt-project-reader.d.ts +36 -0
- package/dist/workspace/dbt-project-reader.d.ts.map +1 -0
- package/dist/workspace/dbt-project-reader.js +290 -0
- package/dist/workspace/graph-cli.d.ts.map +1 -1
- package/dist/workspace/graph-cli.js +3 -1
- package/dist/workspace/graph.schema.json +109 -4
- package/dist/workspace/intent.js +7 -2
- package/dist/workspace/kind-link-readers.d.ts +84 -0
- package/dist/workspace/kind-link-readers.d.ts.map +1 -0
- package/dist/workspace/kind-link-readers.js +53 -0
- package/dist/workspace/kinds.d.ts +15 -0
- package/dist/workspace/kinds.d.ts.map +1 -1
- package/dist/workspace/kinds.js +11 -0
- package/dist/workspace/lexicon-outputs.d.ts +63 -0
- package/dist/workspace/lexicon-outputs.d.ts.map +1 -0
- package/dist/workspace/lexicon-outputs.js +241 -0
- package/dist/workspace/links.d.ts +29 -7
- package/dist/workspace/links.d.ts.map +1 -1
- package/dist/workspace/links.js +109 -34
- package/dist/workspace/member-handles.d.ts +18 -1
- package/dist/workspace/member-handles.d.ts.map +1 -1
- package/dist/workspace/member-handles.js +31 -14
- package/dist/workspace/nested-graph.d.ts +1 -1
- package/dist/workspace/nested-graph.d.ts.map +1 -1
- package/dist/workspace/nested-graph.js +5 -1
- package/dist/workspace/records-checkout.d.ts +11 -1
- package/dist/workspace/records-checkout.d.ts.map +1 -1
- package/dist/workspace/records-checkout.js +38 -2
- package/dist/workspace/runs.d.ts.map +1 -1
- package/dist/workspace/runs.js +4 -2
- package/dist/workspace/status.d.ts.map +1 -1
- package/dist/workspace/status.js +3 -2
- package/dist/workspace/workspace-kinds.schema.json +5 -0
- package/package.json +1 -1
- package/src/audit/rules-doc.ts +1 -1
- package/src/ci-jobs.ts +58 -1
- package/src/cli/commands/build.ts +18 -0
- package/src/cli/handlers/approve.ts +9 -0
- package/src/cli/handlers/emulator.test.ts +61 -1
- package/src/cli/handlers/emulator.ts +65 -4
- package/src/cli/handlers/graph.ts +22 -1
- package/src/cli/handlers/promote.test.ts +7 -0
- package/src/cli/handlers/promote.ts +7 -1
- package/src/cli/handlers/run-no-record.e2e.test.ts +87 -0
- package/src/cli/handlers/run-wave.ts +5 -4
- package/src/cli/handlers/run.test.ts +126 -0
- package/src/cli/handlers/run.ts +69 -9
- package/src/cli/main.test.ts +24 -0
- package/src/cli/main.ts +17 -4
- package/src/cli/parse-args.ts +21 -0
- package/src/cli/registry.ts +12 -0
- package/src/components/cli-support.test.ts +75 -0
- package/src/components/cli-support.ts +130 -25
- package/src/components/driver.test.ts +28 -0
- package/src/components/driver.ts +23 -10
- package/src/components/generate-disabled.test.ts +56 -0
- package/src/graph-ci-edges.test.ts +50 -0
- package/src/graph-detail.ts +21 -2
- package/src/graph-ir.test.ts +23 -1
- package/src/graph-ir.ts +65 -0
- package/src/lexicon.ts +26 -1
- package/src/lifecycle/git.ts +61 -6
- package/src/lifecycle/no-record.test.ts +175 -0
- package/src/lifecycle/no-record.ts +108 -0
- package/src/op/activities/shell.ts +28 -6
- package/src/op/emulator-lifecycle.test.ts +24 -1
- package/src/op/emulator-lifecycle.ts +58 -2
- package/src/op/gate.ts +3 -0
- package/src/op/index.ts +1 -1
- package/src/op/local-executor.ts +20 -3
- package/src/op/op-waves-jobs.test.ts +213 -0
- package/src/op/op-waves-notify.ts +11 -5
- package/src/op/op-waves-run.ts +42 -11
- package/src/op/op-waves.ts +202 -2
- package/src/op/runtimes/local.ts +6 -0
- package/src/op/step-console.test.ts +150 -0
- package/src/op/step-console.ts +155 -0
- package/src/point-decision-bundle.test.ts +1 -0
- package/src/point-decision.ts +3 -0
- package/src/wave-loop-golden.test.ts +3 -0
- package/src/workspace/checks/links.ts +57 -8
- package/src/workspace/checks.e2e.test.ts +1 -1
- package/src/workspace/checks.ts +9 -2
- package/src/workspace/compose-graph.test.ts +55 -0
- package/src/workspace/compose-graph.ts +33 -9
- package/src/workspace/dbt-kind.e2e.test.ts +95 -0
- package/src/workspace/dbt-kind.test.ts +283 -0
- package/src/workspace/dbt-project-reader.ts +291 -0
- package/src/workspace/graph-cli.ts +3 -1
- package/src/workspace/graph-contract.test.ts +26 -1
- package/src/workspace/graph.schema.json +109 -4
- package/src/workspace/intent.ts +7 -2
- package/src/workspace/kind-link-readers.ts +109 -0
- package/src/workspace/kinds.ts +21 -1
- package/src/workspace/lexicon-outputs.ts +272 -0
- package/src/workspace/links.test.ts +22 -0
- package/src/workspace/links.ts +129 -34
- package/src/workspace/member-handles.ts +28 -8
- package/src/workspace/nested-graph.test.ts +14 -0
- package/src/workspace/nested-graph.ts +7 -2
- package/src/workspace/records-checkout.ts +36 -2
- package/src/workspace/records-uncommitted.test.ts +5 -1
- package/src/workspace/runs.ts +4 -2
- package/src/workspace/status.ts +3 -2
- package/src/workspace/workspace-kinds.schema.json +5 -0
|
@@ -17,6 +17,11 @@
|
|
|
17
17
|
* | WSP096 | a consumer states the same link twice |
|
|
18
18
|
* | WSP097 | an entry lists `outputs` for a kind that doesn't take them from the entry |
|
|
19
19
|
* | WSP098 | a link states a `protocol` and its kind is not `telemetry` (#2558) |
|
|
20
|
+
* | WSP099 | a kind's link reader could not read part of a member's files without guessing (#3932) |
|
|
21
|
+
*
|
|
22
|
+
* Links a kind's reader finds in a member's own files (#3932), such as a dbt
|
|
23
|
+
* project's sources, are checked by WSP093 to WSP095 like declared ones, and
|
|
24
|
+
* their findings name the member's file and line instead of the declaration.
|
|
20
25
|
*/
|
|
21
26
|
import type { WorkspaceCheck, WorkspaceCheckContext } from "../checks.js";
|
|
22
27
|
import { type LinkTableRow } from "../links.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../src/workspace/checks/links.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../src/workspace/checks/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB,EAAuB,MAAM,WAAW,CAAC;AAI5F,OAAO,EAAwH,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAenK,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,GAAG,EAAE,qBAAqB,GAAG,YAAY,EAAE,CAOpE;AAoBD,eAAO,MAAM,WAAW,EAAE,SAAS,cAAc,EAmLhD,CAAC"}
|
|
@@ -17,23 +17,48 @@
|
|
|
17
17
|
* | WSP096 | a consumer states the same link twice |
|
|
18
18
|
* | WSP097 | an entry lists `outputs` for a kind that doesn't take them from the entry |
|
|
19
19
|
* | WSP098 | a link states a `protocol` and its kind is not `telemetry` (#2558) |
|
|
20
|
+
* | WSP099 | a kind's link reader could not read part of a member's files without guessing (#3932) |
|
|
21
|
+
*
|
|
22
|
+
* Links a kind's reader finds in a member's own files (#3932), such as a dbt
|
|
23
|
+
* project's sources, are checked by WSP093 to WSP095 like declared ones, and
|
|
24
|
+
* their findings name the member's file and line instead of the declaration.
|
|
20
25
|
*/
|
|
21
26
|
import { sourceMemberHandles } from "../member-handles.js";
|
|
27
|
+
import { readKindLinks } from "../kind-link-readers.js";
|
|
22
28
|
import { DEFAULT_LINK_KIND, LINK_KINDS, TELEMETRY_LINK_KIND, linkTargetProblem, resolveLinks } from "../links.js";
|
|
23
29
|
const tables = new WeakMap();
|
|
30
|
+
const reads = new WeakMap();
|
|
31
|
+
/** What each member's kind reader found (#3932), read once per check run. */
|
|
32
|
+
function kindReads(ctx) {
|
|
33
|
+
let read = reads.get(ctx);
|
|
34
|
+
if (!read) {
|
|
35
|
+
read = readKindLinks(ctx.declaration, ctx.tree, ctx.kinds);
|
|
36
|
+
reads.set(ctx, read);
|
|
37
|
+
}
|
|
38
|
+
return read;
|
|
39
|
+
}
|
|
24
40
|
/** The link rows for a check run, resolved once and shared by every link check. */
|
|
25
41
|
export function linkTable(ctx) {
|
|
26
42
|
let rows = tables.get(ctx);
|
|
27
43
|
if (!rows) {
|
|
28
|
-
rows = resolveLinks(ctx.declaration, sourceMemberHandles(ctx.declaration, ctx.tree, ctx.groups, ctx.kinds));
|
|
44
|
+
rows = resolveLinks(ctx.declaration, sourceMemberHandles(ctx.declaration, ctx.tree, ctx.groups, ctx.kinds, ctx.facts?.lexiconOutputs), undefined, kindReads(ctx));
|
|
29
45
|
tables.set(ctx, rows);
|
|
30
46
|
}
|
|
31
47
|
return rows;
|
|
32
48
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
/** The declared links, and the links a kind's reader found: the rows a member states. */
|
|
50
|
+
const statedRows = (ctx) => linkTable(ctx).filter((r) => r.status !== "ambiguous" && r.origin !== "inferred:joinKey");
|
|
51
|
+
/** A finding at a declared link's field in the declaration, or at the file and line a reader's link came from. */
|
|
52
|
+
function linkFinding(check, ctx, row, field, message) {
|
|
53
|
+
const base = { checkId: check.id, severity: check.severity, message, entity: row.consumer };
|
|
54
|
+
if (row.origin === "kind-reader" && row.file !== undefined) {
|
|
55
|
+
const member = ctx.declaration.members.find((m) => m.name === row.consumer);
|
|
56
|
+
return { ...base, pointer: member?.pointer ?? "", treeFile: row.file, line: row.line ?? 1, column: 1 };
|
|
57
|
+
}
|
|
58
|
+
return { ...base, pointer: `${row.pointer}/${field}` };
|
|
36
59
|
}
|
|
60
|
+
/** Where a reader's link came from, for its message; empty for a declared link. */
|
|
61
|
+
const statedAt = (row) => (row.origin === "kind-reader" ? ` (read by ${row.reader} from ${row.file}:${row.line})` : "");
|
|
37
62
|
const describeLink = (row) => `${row.consumer}'s link to ${row.producer} output ${row.output}`;
|
|
38
63
|
export const LINK_CHECKS = [
|
|
39
64
|
{
|
|
@@ -74,9 +99,9 @@ export const LINK_CHECKS = [
|
|
|
74
99
|
severity: "error",
|
|
75
100
|
configurable: true,
|
|
76
101
|
check(ctx) {
|
|
77
|
-
return
|
|
102
|
+
return statedRows(ctx)
|
|
78
103
|
.filter((r) => r.status === "missing")
|
|
79
|
-
.map((r) => linkFinding(this, r, "output", `${describeLink(r)} does not resolve: ${r.reason}`));
|
|
104
|
+
.map((r) => linkFinding(this, ctx, r, "output", `${describeLink(r)}${statedAt(r)} does not resolve: ${r.reason}`));
|
|
80
105
|
},
|
|
81
106
|
},
|
|
82
107
|
{
|
|
@@ -86,9 +111,9 @@ export const LINK_CHECKS = [
|
|
|
86
111
|
severity: "info",
|
|
87
112
|
configurable: true,
|
|
88
113
|
check(ctx) {
|
|
89
|
-
return
|
|
114
|
+
return statedRows(ctx)
|
|
90
115
|
.filter((r) => r.status === "unresolved")
|
|
91
|
-
.map((r) => linkFinding(this, r, "output", `${describeLink(r)} is kept unresolved: ${r.reason}`));
|
|
116
|
+
.map((r) => linkFinding(this, ctx, r, "output", `${describeLink(r)}${statedAt(r)} is kept unresolved: ${r.reason}`));
|
|
92
117
|
},
|
|
93
118
|
},
|
|
94
119
|
{
|
|
@@ -102,6 +127,10 @@ export const LINK_CHECKS = [
|
|
|
102
127
|
return linkTable(ctx)
|
|
103
128
|
.filter((r) => r.status === "ambiguous")
|
|
104
129
|
.map((r) => {
|
|
130
|
+
if (r.origin === "kind-reader") {
|
|
131
|
+
const choices = r.candidates.map((c) => c.producer).join(", ");
|
|
132
|
+
return linkFinding(this, ctx, r, "", `${r.consumer}'s link to ${r.input} (read by ${r.reader}) has no single producer: ${r.reason}${choices ? `. Candidates: ${choices}` : ""}`);
|
|
133
|
+
}
|
|
105
134
|
const choices = r.candidates.map((c) => `${c.producer} output ${c.output} (${c.label})`).join(", ");
|
|
106
135
|
const first = r.candidates[0];
|
|
107
136
|
return {
|
|
@@ -188,4 +217,21 @@ export const LINK_CHECKS = [
|
|
|
188
217
|
})));
|
|
189
218
|
},
|
|
190
219
|
},
|
|
220
|
+
{
|
|
221
|
+
id: "WSP099",
|
|
222
|
+
name: "kind-reader-gap",
|
|
223
|
+
description: "A kind's link reader read every link in a member's files that it could read without guessing (#3932). A value it would have to render, such as a Jinja template in a dbt source, is reported here with its file and line, and the links it would state are not checked.",
|
|
224
|
+
severity: "info",
|
|
225
|
+
configurable: true,
|
|
226
|
+
check(ctx) {
|
|
227
|
+
const out = [];
|
|
228
|
+
for (const [member, read] of kindReads(ctx)) {
|
|
229
|
+
const pointer = ctx.declaration.members.find((m) => m.name === member)?.pointer ?? "";
|
|
230
|
+
for (const gap of read.gaps) {
|
|
231
|
+
out.push({ checkId: this.id, severity: this.severity, message: `${member} (read by ${read.reader}): ${gap.message}`, entity: member, pointer, treeFile: gap.file, line: gap.line, column: 1 });
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return out;
|
|
235
|
+
},
|
|
236
|
+
},
|
|
191
237
|
];
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* | WSP001 to WSP011 | the declaration and member kinds (this file) |
|
|
25
25
|
* | WSP071, WSP072 | member ledgers |
|
|
26
26
|
* | WSP081 to WSP083 | recorded pipelines |
|
|
27
|
-
* | WSP091 to
|
|
27
|
+
* | WSP091 to WSP099 | member links (#2539, #2558), and those a kind's reader finds in a member's files (#3932) |
|
|
28
28
|
* | WSP101 to WSP106 | generated files |
|
|
29
29
|
* | WSP111 to WSP114 | records read with `--kind` (#2549) |
|
|
30
30
|
* | WSP115 | the record kinds the declaration names (#2680) |
|
|
@@ -52,6 +52,7 @@ import { type LiveLinkFacts } from "./checks/live.js";
|
|
|
52
52
|
import { type RecordFacts } from "./checks/records.js";
|
|
53
53
|
import { type DeclaredKind } from "./declared-kinds.js";
|
|
54
54
|
import { type ResolvedBoxIntent } from "./box-intent.js";
|
|
55
|
+
import { type MemberLexiconOutputs } from "./lexicon-outputs.js";
|
|
55
56
|
/**
|
|
56
57
|
* What the checks beyond the declaration read, gathered from the checkout
|
|
57
58
|
* before any check runs. A field left out was not gathered, and the checks
|
|
@@ -72,6 +73,8 @@ export interface WorkspaceFacts {
|
|
|
72
73
|
live?: LiveLinkFacts;
|
|
73
74
|
/** The decision record each box's intent names, read from the working tree (#2850). */
|
|
74
75
|
boxIntents?: readonly ResolvedBoxIntent[];
|
|
76
|
+
/** The outputs linked members' lexicons report about their declarations, read by folding their source (#3931). */
|
|
77
|
+
lexiconOutputs?: ReadonlyMap<string, MemberLexiconOutputs>;
|
|
75
78
|
}
|
|
76
79
|
/** What every declaration check reads. */
|
|
77
80
|
export interface WorkspaceCheckContext {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../src/workspace/checks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAsD,KAAK,WAAW,EAAkC,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACzJ,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,EAAiE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACjI,OAAO,EAA6D,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpH,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEjE,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAA0C,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACrG,OAAO,EAAoC,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAwC,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAoC,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGnE,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAqB,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"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,EAAE,CAAC,mBAAmB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAA;CAAE,CAkB7F;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sHAAsH;IACtH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;;;;OAKG;IACH,IAAI,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;KAAE,CAAC;CAC3D;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,GAAE;IAAE,aAAa,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,cAAc,CAAC,CASrJ;AAUD;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAiB,EAC5C,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,sBAAsB,CAAC,CAqEjC"}
|
package/dist/workspace/checks.js
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* | WSP001 to WSP011 | the declaration and member kinds (this file) |
|
|
25
25
|
* | WSP071, WSP072 | member ledgers |
|
|
26
26
|
* | WSP081 to WSP083 | recorded pipelines |
|
|
27
|
-
* | WSP091 to
|
|
27
|
+
* | WSP091 to WSP099 | member links (#2539, #2558), and those a kind's reader finds in a member's files (#3932) |
|
|
28
28
|
* | WSP101 to WSP106 | generated files |
|
|
29
29
|
* | WSP111 to WSP114 | records read with `--kind` (#2549) |
|
|
30
30
|
* | WSP115 | the record kinds the declaration names (#2680) |
|
|
@@ -54,6 +54,7 @@ import { BOX_CHECKS } from "./checks/boxes.js";
|
|
|
54
54
|
import { DIAGRAM_CHECKS } from "./checks/diagrams.js";
|
|
55
55
|
import { loadDeclaredKinds } from "./declared-kinds.js";
|
|
56
56
|
import { resolveBoxIntents } from "./box-intent.js";
|
|
57
|
+
import { gatherLexiconOutputs } from "./lexicon-outputs.js";
|
|
57
58
|
const HELP = "https://intentius.io/chant/cli/workspace-check/#declaration-checks";
|
|
58
59
|
const memberDir = (dir) => (dir === "." ? "" : dir);
|
|
59
60
|
function entryFinding(check, entry, field, message) {
|
|
@@ -256,7 +257,7 @@ export const WORKSPACE_CHECKS = [
|
|
|
256
257
|
...LEDGER_CHECKS,
|
|
257
258
|
// Recorded pipelines (#2542).
|
|
258
259
|
...PIPELINE_CHECKS,
|
|
259
|
-
// Member links (#2539, #2558), WSP091 to
|
|
260
|
+
// Member links (#2539, #2558, #3932), WSP091 to WSP099.
|
|
260
261
|
...LINK_CHECKS,
|
|
261
262
|
// Generated files (#2541).
|
|
262
263
|
...GENERATED_CHECKS,
|
|
@@ -388,7 +389,10 @@ export async function runDeclarationChecks(root, display = (f) => f, options = {
|
|
|
388
389
|
const declaredKinds = options.gather === false ? undefined : await loadDeclaredKinds(declaration, tree, root, { load: !options.tree, acceptance: !options.tree });
|
|
389
390
|
// A box's intent is read from the working tree's records, so not under --at (#2850).
|
|
390
391
|
const boxIntents = declaredKinds && !options.tree ? await resolveBoxIntents(declaration, root, declaredKinds) : undefined;
|
|
392
|
+
// A linked member's lexicons name its tables and columns as outputs (#3931); reading them folds its source, never runs it.
|
|
393
|
+
const lexiconOutputs = options.gather === false ? undefined : await gatherLexiconOutputs(root, declaration, options.tree ? workingTree(root) : tree, groups, registry, { atRevision: options.tree !== undefined });
|
|
391
394
|
const facts = {
|
|
395
|
+
...(lexiconOutputs && lexiconOutputs.size > 0 ? { lexiconOutputs } : {}),
|
|
392
396
|
...gathered,
|
|
393
397
|
...(options.records ? { records: options.records } : {}),
|
|
394
398
|
...(declaredKinds ? { declaredKinds } : {}),
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
* `runtimeOwner` and export and import nodes are rewritten the same way.
|
|
12
12
|
* - `groups.byMember` maps each member to its node ids. `byLexicon` and
|
|
13
13
|
* `byComposite` keep their keys (a lexicon or composite type is the same
|
|
14
|
-
* thing in every member) and merge the ids. `byStack`, `byContainer
|
|
15
|
-
* `byWave` name things inside one member, so their keys
|
|
14
|
+
* thing in every member) and merge the ids. `byStack`, `byContainer`,
|
|
15
|
+
* `byWave` and `byPipeline` name things inside one member, so their keys
|
|
16
|
+
* are prefixed too.
|
|
17
|
+
* - Edges keep their `kind` and `crossPipeline` (#3910). A member's dangling
|
|
18
|
+
* references (`ir.dangling`) land on the top-level `dangling` list with
|
|
19
|
+
* `from` prefixed and a `member` field, like edges (#3922).
|
|
16
20
|
* - `links` holds the member links (#2524 D6, #2539): the declared links and
|
|
17
21
|
* the joins inferred from members' `imports` and `exports` with the core
|
|
18
22
|
* `joinKey()`, labelled `exact` or `folded` (`./links.ts`). A declared link
|
|
@@ -32,8 +36,9 @@ import type { FactoryView, ListingView } from "./box-factory.js";
|
|
|
32
36
|
import type { Declaration } from "./declaration.js";
|
|
33
37
|
import type { KindRegistry } from "./kinds.js";
|
|
34
38
|
import { type LinkTableRow } from "./links.js";
|
|
39
|
+
import type { KindLinkRead } from "./kind-link-readers.js";
|
|
35
40
|
import type { RecordLinkRow } from "./record-assets.js";
|
|
36
|
-
import { type GraphIR, type IRExport, type IRGroups, type IRImport, type IREdge, type IRNode } from "../graph-ir.js";
|
|
41
|
+
import { type GraphIR, type IRExport, type IRDanglingRef, type IRGroups, type IRImport, type IREdge, type IRNode } from "../graph-ir.js";
|
|
37
42
|
/** The version of the composed document `chant workspace graph` writes. */
|
|
38
43
|
export declare const WORKSPACE_GRAPH_VERSION = 1;
|
|
39
44
|
/**
|
|
@@ -144,6 +149,11 @@ export type ComposedNode = IRNode & {
|
|
|
144
149
|
export type ComposedEdge = IREdge & {
|
|
145
150
|
member: string;
|
|
146
151
|
};
|
|
152
|
+
/** A member's dangling reference (#3910, #3922): `from` is prefixed like a node id. `nested` as on {@link ComposedNode}. */
|
|
153
|
+
export type ComposedDangling = IRDanglingRef & {
|
|
154
|
+
member: string;
|
|
155
|
+
nested?: string;
|
|
156
|
+
};
|
|
147
157
|
export interface WorkspaceGraph {
|
|
148
158
|
version: number;
|
|
149
159
|
workspace: {
|
|
@@ -163,6 +173,12 @@ export interface WorkspaceGraph {
|
|
|
163
173
|
member: string;
|
|
164
174
|
})[];
|
|
165
175
|
derivedAttrs?: Record<string, string[]>;
|
|
176
|
+
/**
|
|
177
|
+
* The members' dangling CI references (#3910, #3922): each `ir.dangling`
|
|
178
|
+
* entry with `from` prefixed by its member and a `member` field, sorted by
|
|
179
|
+
* `from`, `path` and `value`. Absent when no member has one.
|
|
180
|
+
*/
|
|
181
|
+
dangling?: ComposedDangling[];
|
|
166
182
|
/**
|
|
167
183
|
* Member links (#2524 D6, #2539), declared and inferred, then the links of
|
|
168
184
|
* the records read with `--kind` (#2549). Empty when no declaration is given.
|
|
@@ -201,11 +217,16 @@ export interface ComposeInput {
|
|
|
201
217
|
/** Present for a member whose IR was read. */
|
|
202
218
|
ir?: GraphIR;
|
|
203
219
|
}
|
|
220
|
+
/** The groups whose keys name something inside one member, so are prefixed with it. */
|
|
221
|
+
export declare const SCOPED_GROUPS: readonly ["byStack", "byContainer", "byWave", "byPipeline"];
|
|
222
|
+
/** The order the composed `dangling` list is sorted in. */
|
|
223
|
+
export declare const danglingKey: (d: IRDanglingRef) => string;
|
|
204
224
|
/**
|
|
205
225
|
* Compose the members' IRs into the workspace document. Members keep the
|
|
206
226
|
* order they are given in. With `links`, the `links` section is filled from
|
|
207
227
|
* the declaration; `kinds` lets a member that isn't composed but whose kind
|
|
208
|
-
* lists its outputs (`other`, kinds from a package) be a link target
|
|
228
|
+
* lists its outputs (`other`, kinds from a package) be a link target, and
|
|
229
|
+
* `read` holds the links each member's kind reader found in its files (#3932).
|
|
209
230
|
*/
|
|
210
231
|
export declare function composeWorkspaceGraph(workspace: {
|
|
211
232
|
name: string;
|
|
@@ -213,5 +234,6 @@ export declare function composeWorkspaceGraph(workspace: {
|
|
|
213
234
|
}, inputs: ComposeInput[], links?: {
|
|
214
235
|
declaration: Declaration;
|
|
215
236
|
kinds?: KindRegistry;
|
|
237
|
+
read?: ReadonlyMap<string, KindLinkRead>;
|
|
216
238
|
}): WorkspaceGraph;
|
|
217
239
|
//# sourceMappingURL=compose-graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-graph.d.ts","sourceRoot":"","sources":["../../src/workspace/compose-graph.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"compose-graph.d.ts","sourceRoot":"","sources":["../../src/workspace/compose-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAoB,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,KAAK,QAAQ,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAExJ,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,uBAAuB,gJAe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OAAO,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,uEAAuE;IACvE,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAwB/G;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,cAAc,CAAC;IACvB,8CAA8C;IAC9C,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAsDD,uFAAuF;AACvF,eAAO,MAAM,aAAa,YAAI,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAU,CAAC;AAGzF,2DAA2D;AAC3D,eAAO,MAAM,WAAW,MAAO,aAAa,KAAG,MAAoD,CAAC;AAYpG;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACzC,MAAM,EAAE,YAAY,EAAE,EACtB,KAAK,CAAC,EAAE;IAAE,WAAW,EAAE,WAAW,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;CAAE,GACnG,cAAc,CA0EhB"}
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
* `runtimeOwner` and export and import nodes are rewritten the same way.
|
|
12
12
|
* - `groups.byMember` maps each member to its node ids. `byLexicon` and
|
|
13
13
|
* `byComposite` keep their keys (a lexicon or composite type is the same
|
|
14
|
-
* thing in every member) and merge the ids. `byStack`, `byContainer
|
|
15
|
-
* `byWave` name things inside one member, so their keys
|
|
14
|
+
* thing in every member) and merge the ids. `byStack`, `byContainer`,
|
|
15
|
+
* `byWave` and `byPipeline` name things inside one member, so their keys
|
|
16
|
+
* are prefixed too.
|
|
17
|
+
* - Edges keep their `kind` and `crossPipeline` (#3910). A member's dangling
|
|
18
|
+
* references (`ir.dangling`) land on the top-level `dangling` list with
|
|
19
|
+
* `from` prefixed and a `member` field, like edges (#3922).
|
|
16
20
|
* - `links` holds the member links (#2524 D6, #2539): the declared links and
|
|
17
21
|
* the joins inferred from members' `imports` and `exports` with the core
|
|
18
22
|
* `joinKey()`, labelled `exact` or `folded` (`./links.ts`). A declared link
|
|
@@ -132,6 +136,10 @@ function prefixRefs(value, member) {
|
|
|
132
136
|
}
|
|
133
137
|
return out;
|
|
134
138
|
}
|
|
139
|
+
/** The groups whose keys name something inside one member, so are prefixed with it. */
|
|
140
|
+
export const SCOPED_GROUPS = ["byStack", "byContainer", "byWave", "byPipeline"];
|
|
141
|
+
/** The order the composed `dangling` list is sorted in. */
|
|
142
|
+
export const danglingKey = (d) => `${d.from}\u0000${d.path}\u0000${d.value}`;
|
|
135
143
|
function mergeInto(target, key, ids) {
|
|
136
144
|
(target[key] ?? (target[key] = [])).push(...ids);
|
|
137
145
|
}
|
|
@@ -145,7 +153,8 @@ function sorted(rec) {
|
|
|
145
153
|
* Compose the members' IRs into the workspace document. Members keep the
|
|
146
154
|
* order they are given in. With `links`, the `links` section is filled from
|
|
147
155
|
* the declaration; `kinds` lets a member that isn't composed but whose kind
|
|
148
|
-
* lists its outputs (`other`, kinds from a package) be a link target
|
|
156
|
+
* lists its outputs (`other`, kinds from a package) be a link target, and
|
|
157
|
+
* `read` holds the links each member's kind reader found in its files (#3932).
|
|
149
158
|
*/
|
|
150
159
|
export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
151
160
|
const nodes = [];
|
|
@@ -154,7 +163,8 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
154
163
|
const imports = [];
|
|
155
164
|
const byMember = {};
|
|
156
165
|
const shared = { byLexicon: {}, byComposite: {} };
|
|
157
|
-
const scoped = { byStack: {}, byContainer: {}, byWave: {} };
|
|
166
|
+
const scoped = { byStack: {}, byContainer: {}, byWave: {}, byPipeline: {} };
|
|
167
|
+
const dangling = [];
|
|
158
168
|
const derivedAttrs = {};
|
|
159
169
|
const collectors = [];
|
|
160
170
|
for (const { member, ir } of inputs) {
|
|
@@ -178,10 +188,12 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
178
188
|
for (const [k, v] of Object.entries(ir.groups[key] ?? {}))
|
|
179
189
|
mergeInto(shared[key], k, v.map((id) => prefix(m, id)));
|
|
180
190
|
}
|
|
181
|
-
for (const key of
|
|
191
|
+
for (const key of SCOPED_GROUPS) {
|
|
182
192
|
for (const [k, v] of Object.entries(ir.groups[key] ?? {}))
|
|
183
193
|
mergeInto(scoped[key], prefix(m, k), v.map((id) => prefix(m, id)));
|
|
184
194
|
}
|
|
195
|
+
for (const d of ir.dangling ?? [])
|
|
196
|
+
dangling.push({ ...d, from: prefix(m, d.from), member: m });
|
|
185
197
|
for (const e of ir.exports ?? [])
|
|
186
198
|
exports.push({ ...e, ...(e.node ? { node: prefix(m, e.node) } : {}), member: m });
|
|
187
199
|
for (const i of ir.imports ?? [])
|
|
@@ -210,7 +222,7 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
210
222
|
for (const key of ["byLexicon", "byComposite"])
|
|
211
223
|
if (Object.keys(shared[key]).length)
|
|
212
224
|
groups[key] = sorted(shared[key]);
|
|
213
|
-
for (const key of
|
|
225
|
+
for (const key of SCOPED_GROUPS)
|
|
214
226
|
if (Object.keys(scoped[key]).length)
|
|
215
227
|
groups[key] = sorted(scoped[key]);
|
|
216
228
|
const doc = {
|
|
@@ -223,11 +235,13 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
223
235
|
exports,
|
|
224
236
|
imports,
|
|
225
237
|
links: links
|
|
226
|
-
? graphLinks(links.declaration, { composed: inputs.filter((i) => i.ir).map((i) => i.member.name), collectors, exports, imports }, links.kinds)
|
|
238
|
+
? graphLinks(links.declaration, { composed: inputs.filter((i) => i.ir).map((i) => i.member.name), collectors, exports, imports }, links.kinds, links.read)
|
|
227
239
|
: [],
|
|
228
240
|
collectors,
|
|
229
241
|
records: [],
|
|
230
242
|
};
|
|
243
|
+
if (dangling.length)
|
|
244
|
+
doc.dangling = dangling.sort((a, b) => danglingKey(a).localeCompare(danglingKey(b)));
|
|
231
245
|
if (Object.keys(derivedAttrs).length) {
|
|
232
246
|
doc.derivedAttrs = Object.fromEntries(Object.keys(derivedAttrs).sort().map((k) => [k, [...derivedAttrs[k]].sort()]));
|
|
233
247
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `dbt-project` link reader (#3932): a dbt project's sources, as links to
|
|
3
|
+
* the tables and columns a sql member exposes (#3931).
|
|
4
|
+
*
|
|
5
|
+
* The reader parses YAML and nothing else. It never runs dbt, never renders
|
|
6
|
+
* Jinja and never reads `profiles.yml` or a target, so the links it derives
|
|
7
|
+
* are the same in every environment.
|
|
8
|
+
*
|
|
9
|
+
* - The project is `dbt_project.yml`. Sources are read from every `.yml` and
|
|
10
|
+
* `.yaml` file under its `model-paths` (`source-paths` in older projects;
|
|
11
|
+
* `models` when it names neither), as dbt reads them.
|
|
12
|
+
* - Each enabled source table links to `<schema>.<table>`, and each of its
|
|
13
|
+
* `columns` to `<schema>.<table>.<column>`. The schema is the source's
|
|
14
|
+
* `schema`, or the source's `name` when it sets none, which is dbt's own
|
|
15
|
+
* fallback. The table is its `identifier`, or its `name`. `database` is not
|
|
16
|
+
* part of the name: a Postgres output has none, and dbt-clickhouse reads a
|
|
17
|
+
* source's `schema` as the ClickHouse database.
|
|
18
|
+
* - Case follows the member's `dialect` field. For `postgres`, an unquoted
|
|
19
|
+
* name folds to lowercase and a quoted one keeps its case. dbt quotes a
|
|
20
|
+
* source's schema and identifier on Postgres unless `quoting:` (in
|
|
21
|
+
* `dbt_project.yml`, on the source, or on the table) turns it off, and a
|
|
22
|
+
* column is quoted only with `quote: true`. For `clickhouse`, names are
|
|
23
|
+
* kept as written.
|
|
24
|
+
* - A value that is a Jinja template (`{{ ... }}` or `{% ... %}`) is not
|
|
25
|
+
* resolved: the reader records a gap and leaves that source, table or
|
|
26
|
+
* column out, rather than guess what a target would render.
|
|
27
|
+
* - The producer is the member the `sqlMember` field names. Unset, each link
|
|
28
|
+
* leaves the producer to `resolveLinks`, which picks the one member that
|
|
29
|
+
* exposes the table.
|
|
30
|
+
*/
|
|
31
|
+
import type { KindLinkRead, KindReaderInput } from "./kind-link-readers.js";
|
|
32
|
+
export declare const DBT_PROJECT_FILE = "dbt_project.yml";
|
|
33
|
+
/** The dialects whose naming the reader follows; the member's `dialect` field picks one. */
|
|
34
|
+
export declare const DBT_DIALECTS: readonly ["postgres", "clickhouse"];
|
|
35
|
+
export declare function readDbtProject(input: KindReaderInput): KindLinkRead;
|
|
36
|
+
//# sourceMappingURL=dbt-project-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dbt-project-reader.d.ts","sourceRoot":"","sources":["../../src/workspace/dbt-project-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,KAAK,EAAE,YAAY,EAA6B,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGpG,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAGlD,4FAA4F;AAC5F,eAAO,MAAM,YAAY,YAAI,UAAU,EAAE,YAAY,CAAU,CAAC;AAWhE,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,YAAY,CAqJnE"}
|