@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
|
@@ -128,7 +128,22 @@ export interface MemberKind {
|
|
|
128
128
|
graph?: KindGraph;
|
|
129
129
|
/** The fields a member entry of this kind may set, with their defaults (#3151); unset, the kind declares none. */
|
|
130
130
|
fields?: Record<string, KindField>;
|
|
131
|
+
/**
|
|
132
|
+
* The link reader chant runs over a member's own files (#3932), by name, from
|
|
133
|
+
* {@link KIND_LINK_READERS}. It derives the member's links offline, from
|
|
134
|
+
* files it parses as data; unset, the member's links are only those its
|
|
135
|
+
* entry states.
|
|
136
|
+
*/
|
|
137
|
+
reader?: KindLinkReaderName;
|
|
131
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* The link readers chant ships (#3932). A kind names one in its kinds file as
|
|
141
|
+
* `reader`. The readers are chant's own code, not the package's: a kinds file
|
|
142
|
+
* stays data, and chant never imports the package that supplies it. Closed:
|
|
143
|
+
* a kind naming another reader is kept without one, and the load reports it.
|
|
144
|
+
*/
|
|
145
|
+
export declare const KIND_LINK_READERS: readonly ["dbt-project"];
|
|
146
|
+
export type KindLinkReaderName = (typeof KIND_LINK_READERS)[number];
|
|
132
147
|
export interface KindRegistry {
|
|
133
148
|
get(name: string): MemberKind | undefined;
|
|
134
149
|
/** Every member kind's name, sorted, for "unknown kind" messages. */
|
|
@@ -1 +1 @@
|
|
|
1
|
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a,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAsBlI;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,WAAW,CA4B7F;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAcxE;AAID,6EAA6E;AAC7E,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAyCnD,sGAAsG;AACtG,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,uIAAuI;IACvI,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IACrF,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,YAAY,CAsCrH"}
|
package/dist/workspace/kinds.js
CHANGED
|
@@ -26,6 +26,13 @@ import { loadAjv2020 } from "./ajv2020.js";
|
|
|
26
26
|
export const KINDS_SCHEMA_ID = schema.$id;
|
|
27
27
|
/** The subpath a package publishes its kinds at. */
|
|
28
28
|
export const KINDS_SUBPATH = "./workspace-kinds";
|
|
29
|
+
/**
|
|
30
|
+
* The link readers chant ships (#3932). A kind names one in its kinds file as
|
|
31
|
+
* `reader`. The readers are chant's own code, not the package's: a kinds file
|
|
32
|
+
* stays data, and chant never imports the package that supplies it. Closed:
|
|
33
|
+
* a kind naming another reader is kept without one, and the load reports it.
|
|
34
|
+
*/
|
|
35
|
+
export const KIND_LINK_READERS = ["dbt-project"];
|
|
29
36
|
/** The group kind (ws-051). An entry of this kind is a group, not a member. */
|
|
30
37
|
export const EXAMPLES_KIND = "examples";
|
|
31
38
|
/** The data member kind that holds design artifacts (#2549, ws-062). */
|
|
@@ -274,7 +281,11 @@ export function parseKindData(text, source) {
|
|
|
274
281
|
source,
|
|
275
282
|
...(k.graph ? { graph: { lexicon: k.graph.lexicon, config: structuredClone(k.graph.config) } } : {}),
|
|
276
283
|
...(k.fields ? { fields: structuredClone(k.fields) } : {}),
|
|
284
|
+
...(k.reader && KIND_LINK_READERS.includes(k.reader) ? { reader: k.reader } : {}),
|
|
277
285
|
});
|
|
286
|
+
if (k.reader && !KIND_LINK_READERS.includes(k.reader)) {
|
|
287
|
+
problems.push(`${source}: kind ${k.name} names link reader ${k.reader}, which this chant does not have (it has ${KIND_LINK_READERS.join(", ")}); the kind is kept, and its members' links are only those their entries state`);
|
|
288
|
+
}
|
|
278
289
|
for (const problem of fieldDefaultProblems(k.fields ?? {}))
|
|
279
290
|
problems.push(`${source}: kind ${k.name} ${problem}`);
|
|
280
291
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The outputs a member's lexicons report about their own declarations
|
|
3
|
+
* (#3931), read offline for `chant workspace check`.
|
|
4
|
+
*
|
|
5
|
+
* A sql member exposes each table and each column as a workspace output
|
|
6
|
+
* (`public.orders`, `public.orders.customer_id`) without anyone writing
|
|
7
|
+
* `output(...)`. The names are the lexicon's to give, so the lexicon answers
|
|
8
|
+
* through its `workspaceOutputs` hook, the way a CI lexicon answers
|
|
9
|
+
* `graphEdges` (#3910).
|
|
10
|
+
*
|
|
11
|
+
* The check never runs member code. The member's source files are folded
|
|
12
|
+
* with `foldProject` under `sandbox`, which evaluates the fold subset and
|
|
13
|
+
* imports nothing from the project: a sql `table` template becomes the real
|
|
14
|
+
* entity because the tag is the lexicon's own function, called with the
|
|
15
|
+
* folded parts. A file that does not fold is not run either. It is handed to
|
|
16
|
+
* the hook as unread, and when it is one of that lexicon's files (it uses the
|
|
17
|
+
* lexicon's tags), the hook records a gap: the member's outputs are then
|
|
18
|
+
* incomplete, and a link to a name not in them is unresolved rather than
|
|
19
|
+
* missing.
|
|
20
|
+
*
|
|
21
|
+
* Folding is asynchronous and the checks are not, so the outputs are
|
|
22
|
+
* gathered before the checks run, only for the members some declared link
|
|
23
|
+
* targets, and only for the kinds whose outputs are read from source.
|
|
24
|
+
*
|
|
25
|
+
* Under `--at` the revision's files are not on disk to fold, so a member
|
|
26
|
+
* whose lexicons report outputs gets a gap instead.
|
|
27
|
+
*/
|
|
28
|
+
import { type Declarable } from "../declarable.js";
|
|
29
|
+
import type { LexiconUnreadSource, LexiconWorkspaceOutput } from "../graph-ir.js";
|
|
30
|
+
import type { BuildRootContext, BuildRootContribution, IntrinsicDef } from "../lexicon.js";
|
|
31
|
+
import type { Declaration, ResolvedGroup } from "./declaration.js";
|
|
32
|
+
import type { KindRegistry } from "./kinds.js";
|
|
33
|
+
import type { WorkspaceTree } from "./tree.js";
|
|
34
|
+
/** What one member's lexicons report: its outputs, and why the list may be incomplete. */
|
|
35
|
+
export interface MemberLexiconOutputs {
|
|
36
|
+
outputs: Pick<LexiconWorkspaceOutput, "name" | "previously">[];
|
|
37
|
+
gaps: string[];
|
|
38
|
+
}
|
|
39
|
+
/** The part of a lexicon plugin this reader uses. */
|
|
40
|
+
export interface OutputsPlugin {
|
|
41
|
+
name?: string;
|
|
42
|
+
intrinsics?: () => IntrinsicDef[];
|
|
43
|
+
buildRoots?: (ctx: BuildRootContext) => Promise<BuildRootContribution>;
|
|
44
|
+
workspaceOutputs?: (entities: ReadonlyMap<string, Declarable>, unread?: readonly LexiconUnreadSource[]) => {
|
|
45
|
+
outputs: LexiconWorkspaceOutput[];
|
|
46
|
+
gaps?: string[];
|
|
47
|
+
} | undefined;
|
|
48
|
+
}
|
|
49
|
+
/** Loads a lexicon plugin by name; `loadPlugin` from the CLI unless a test swaps it. */
|
|
50
|
+
export type OutputsPluginLoader = (name: string) => Promise<OutputsPlugin>;
|
|
51
|
+
export interface GatherLexiconOutputsOptions {
|
|
52
|
+
/** Read under `--at`: the member's files are a revision's, not on disk, so nothing is folded. */
|
|
53
|
+
atRevision?: boolean;
|
|
54
|
+
load?: OutputsPluginLoader;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The lexicon outputs of every member a declared link, or a link a kind's
|
|
58
|
+
* reader found (#3932), targets, keyed by
|
|
59
|
+
* member name. A member whose lexicons report nothing is left out.
|
|
60
|
+
* `tree` is the working tree under `root`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function gatherLexiconOutputs(root: string, declaration: Declaration, tree: WorkspaceTree, groups: readonly ResolvedGroup[], kinds: KindRegistry, options?: GatherLexiconOutputsOptions): Promise<Map<string, MemberLexiconOutputs>>;
|
|
63
|
+
//# sourceMappingURL=lexicon-outputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexicon-outputs.d.ts","sourceRoot":"","sources":["../../src/workspace/lexicon-outputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,KAAK,EAAE,aAAa,EAAE,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+
* (#3931), read offline for `chant workspace check`.
|
|
4
|
+
*
|
|
5
|
+
* A sql member exposes each table and each column as a workspace output
|
|
6
|
+
* (`public.orders`, `public.orders.customer_id`) without anyone writing
|
|
7
|
+
* `output(...)`. The names are the lexicon's to give, so the lexicon answers
|
|
8
|
+
* through its `workspaceOutputs` hook, the way a CI lexicon answers
|
|
9
|
+
* `graphEdges` (#3910).
|
|
10
|
+
*
|
|
11
|
+
* The check never runs member code. The member's source files are folded
|
|
12
|
+
* with `foldProject` under `sandbox`, which evaluates the fold subset and
|
|
13
|
+
* imports nothing from the project: a sql `table` template becomes the real
|
|
14
|
+
* entity because the tag is the lexicon's own function, called with the
|
|
15
|
+
* folded parts. A file that does not fold is not run either. It is handed to
|
|
16
|
+
* the hook as unread, and when it is one of that lexicon's files (it uses the
|
|
17
|
+
* lexicon's tags), the hook records a gap: the member's outputs are then
|
|
18
|
+
* incomplete, and a link to a name not in them is unresolved rather than
|
|
19
|
+
* missing.
|
|
20
|
+
*
|
|
21
|
+
* Folding is asynchronous and the checks are not, so the outputs are
|
|
22
|
+
* gathered before the checks run, only for the members some declared link
|
|
23
|
+
* targets, and only for the kinds whose outputs are read from source.
|
|
24
|
+
*
|
|
25
|
+
* Under `--at` the revision's files are not on disk to fold, so a member
|
|
26
|
+
* whose lexicons report outputs gets a gap instead.
|
|
27
|
+
*/
|
|
28
|
+
import { join, posix } from "node:path";
|
|
29
|
+
import { isDeclarable } from "../declarable.js";
|
|
30
|
+
import { kindHandles } from "./links.js";
|
|
31
|
+
import { readKindLinks } from "./kind-link-readers.js";
|
|
32
|
+
import { memberExcludes, sourceFiles } from "./member-handles.js";
|
|
33
|
+
import { memberDirOnDisk } from "./lexicon-symbols.js";
|
|
34
|
+
const firstLine = (err) => (err instanceof Error ? err.message : String(err)).split("\n")[0];
|
|
35
|
+
const memberDir = (dir) => (dir === "." ? "" : dir);
|
|
36
|
+
/** The `sourceDir` a member's config sets, read without running it. */
|
|
37
|
+
function staticSourceDir(read) {
|
|
38
|
+
const value = read.status === "read" ? read.fields.sourceDir : undefined;
|
|
39
|
+
if (typeof value !== "string")
|
|
40
|
+
return undefined;
|
|
41
|
+
const dir = posix.normalize(value.replace(/\\/g, "/")).replace(/\/+$/, "");
|
|
42
|
+
return dir === "." || dir === "" ? undefined : dir;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Only the files under the member's `sourceDir`, when its config sets one, as
|
|
46
|
+
* a build reads them (#3941). Without one, every source file of the member.
|
|
47
|
+
*/
|
|
48
|
+
function withinSourceDir(files, member, sourceDir) {
|
|
49
|
+
if (!sourceDir)
|
|
50
|
+
return files;
|
|
51
|
+
const prefix = `${member ? `${member}/` : ""}${sourceDir}/`;
|
|
52
|
+
return files.filter((f) => f.startsWith(prefix));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A folded file's exports, less the entities of lexicons the member doesn't
|
|
56
|
+
* declare (#3941). An Op is a `chant` entity, and several files exporting
|
|
57
|
+
* `op` would otherwise collide and leave the whole member unread, though no
|
|
58
|
+
* hook reads Ops. Values that are not entities (a composite) are kept.
|
|
59
|
+
*/
|
|
60
|
+
function ownExports(exports, lexicons) {
|
|
61
|
+
const own = new Set(lexicons);
|
|
62
|
+
const out = {};
|
|
63
|
+
for (const [name, value] of exports) {
|
|
64
|
+
if (isDeclarable(value) && !own.has(value.lexicon))
|
|
65
|
+
continue;
|
|
66
|
+
out[name] = value;
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The lexicon names a member's config declares, read without running it.
|
|
72
|
+
* Unlike the intent walk, a config that can't be read statically is not
|
|
73
|
+
* loaded: the check runs no member code, so it is a gap.
|
|
74
|
+
*/
|
|
75
|
+
async function staticMemberLexicons(dir) {
|
|
76
|
+
const { readLexiconDeclarationsStatically } = await import("../config-static.js");
|
|
77
|
+
const read = readLexiconDeclarationsStatically(dir);
|
|
78
|
+
if (read.status === "no-config")
|
|
79
|
+
return [];
|
|
80
|
+
if (read.status !== "read")
|
|
81
|
+
throw new Error(read.reason);
|
|
82
|
+
const { lexiconNames, registerLexiconDeclarations } = await import("../lexicon-module.js");
|
|
83
|
+
const { dirname } = await import("node:path");
|
|
84
|
+
registerLexiconDeclarations(read.entries, dirname(read.configPath));
|
|
85
|
+
return lexiconNames(read.entries);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The lexicon outputs of every member a declared link, or a link a kind's
|
|
89
|
+
* reader found (#3932), targets, keyed by
|
|
90
|
+
* member name. A member whose lexicons report nothing is left out.
|
|
91
|
+
* `tree` is the working tree under `root`.
|
|
92
|
+
*/
|
|
93
|
+
export async function gatherLexiconOutputs(root, declaration, tree, groups, kinds, options = {}) {
|
|
94
|
+
const out = new Map();
|
|
95
|
+
const targets = new Set(declaration.members.flatMap((m) => m.links.filter((l) => l.member !== m.name).map((l) => l.member)));
|
|
96
|
+
// Links a kind's reader finds in a member's files target members too (#3932). One that names no
|
|
97
|
+
// producer may be any other member's, so every other member is read.
|
|
98
|
+
for (const [consumer, read] of readKindLinks(declaration, tree, kinds)) {
|
|
99
|
+
for (const link of read.links) {
|
|
100
|
+
if (link.member !== null)
|
|
101
|
+
targets.add(link.member);
|
|
102
|
+
else
|
|
103
|
+
for (const m of declaration.members)
|
|
104
|
+
if (m.name !== consumer)
|
|
105
|
+
targets.add(m.name);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const m of declaration.members) {
|
|
109
|
+
if (!targets.has(m.name))
|
|
110
|
+
continue;
|
|
111
|
+
const kind = kinds.get(m.kind);
|
|
112
|
+
if (!kind || kindHandles(m, kind) || tree.stat(memberDir(m.dir)) !== "dir")
|
|
113
|
+
continue;
|
|
114
|
+
const read = await readMemberLexiconOutputs(root, declaration, tree, groups, m, options);
|
|
115
|
+
if (read)
|
|
116
|
+
out.set(m.name, read);
|
|
117
|
+
}
|
|
118
|
+
return out;
|
|
119
|
+
}
|
|
120
|
+
/** The lexicons the files import, by the package name chant gives a lexicon. */
|
|
121
|
+
function importedLexicons(tree, files) {
|
|
122
|
+
const names = new Set();
|
|
123
|
+
for (const file of files) {
|
|
124
|
+
let text;
|
|
125
|
+
try {
|
|
126
|
+
text = tree.read(file);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
for (const m of text.matchAll(/from\s+["']@intentius\/chant-lexicon-([a-z0-9-]+)(?:\/[^"']*)?["']/g))
|
|
132
|
+
names.add(m[1]);
|
|
133
|
+
}
|
|
134
|
+
return [...names].sort();
|
|
135
|
+
}
|
|
136
|
+
async function readMemberLexiconOutputs(root, declaration, tree, groups, m, options) {
|
|
137
|
+
const dir = memberDirOnDisk(root, m.dir);
|
|
138
|
+
const { readConfigFieldsStatically } = await import("../config-static.js");
|
|
139
|
+
const files = withinSourceDir(sourceFiles(tree, memberDir(m.dir), memberExcludes(declaration, groups, m)), memberDir(m.dir), staticSourceDir(readConfigFieldsStatically(dir, ["sourceDir"])));
|
|
140
|
+
let names;
|
|
141
|
+
try {
|
|
142
|
+
names = await staticMemberLexicons(dir);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
// A config that can't be read statically is not run. The lexicons the
|
|
146
|
+
// source imports stand in for the ones it names.
|
|
147
|
+
names = importedLexicons(tree, files);
|
|
148
|
+
}
|
|
149
|
+
if (names.length === 0)
|
|
150
|
+
return undefined;
|
|
151
|
+
const load = options.load ?? (await import("../cli/plugins.js")).loadPlugin;
|
|
152
|
+
const plugins = [];
|
|
153
|
+
const gaps = [];
|
|
154
|
+
for (const name of names) {
|
|
155
|
+
try {
|
|
156
|
+
plugins.push({ name, plugin: await load(name) });
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
gaps.push(`lexicon "${name}" could not be loaded, so the outputs it reads were not (${firstLine(err)})`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const reporting = plugins.filter((p) => typeof p.plugin.workspaceOutputs === "function");
|
|
163
|
+
if (reporting.length === 0)
|
|
164
|
+
return gaps.length ? { outputs: [], gaps } : undefined;
|
|
165
|
+
if (options.atRevision) {
|
|
166
|
+
return { outputs: [], gaps: [`the outputs of lexicon ${reporting.map((p) => p.name).join(", ")} are read from the working tree's files, not a revision's`] };
|
|
167
|
+
}
|
|
168
|
+
// Fold the member's source, never run it.
|
|
169
|
+
const abs = (file) => join(root, ...file.split("/"));
|
|
170
|
+
const intrinsics = plugins.flatMap((p) => {
|
|
171
|
+
try {
|
|
172
|
+
return p.plugin.intrinsics?.() ?? [];
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
let entities = new Map();
|
|
179
|
+
const unread = [];
|
|
180
|
+
try {
|
|
181
|
+
const { foldProject } = await import("../discovery/fold-import.js");
|
|
182
|
+
const { collectEntities } = await import("../discovery/collect.js");
|
|
183
|
+
const verdicts = await foldProject(files.map(abs), intrinsics, { lexicons: names, sandbox: true });
|
|
184
|
+
const folded = [];
|
|
185
|
+
for (const file of files) {
|
|
186
|
+
const v = verdicts.get(abs(file));
|
|
187
|
+
if (v?.verdict === "fold" && v.exports) {
|
|
188
|
+
folded.push({ file: abs(file), exports: ownExports(v.exports, names) });
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
let text = "";
|
|
192
|
+
try {
|
|
193
|
+
text = tree.read(file);
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
// An unreadable file is still unread; the hook decides whether it matters.
|
|
197
|
+
}
|
|
198
|
+
const reason = v?.reason ?? (v?.taintedBy ? `it imports ${v.taintedBy.from}, which does not fold` : "it does not fold");
|
|
199
|
+
unread.push({ file, text, reason });
|
|
200
|
+
}
|
|
201
|
+
entities = collectEntities(folded, dir);
|
|
202
|
+
}
|
|
203
|
+
catch (err) {
|
|
204
|
+
return { outputs: [], gaps: [...gaps, `${m.dir}: its source could not be folded, so its lexicons' outputs were not read (${firstLine(err)})`] };
|
|
205
|
+
}
|
|
206
|
+
// A reporting lexicon's own build roots (the sql lexicon's `.sql` files) join
|
|
207
|
+
// the folded entities, as they join a build's. Only these lexicons' hooks
|
|
208
|
+
// run: they read files, and start nothing.
|
|
209
|
+
for (const { name, plugin } of reporting) {
|
|
210
|
+
if (typeof plugin.buildRoots !== "function")
|
|
211
|
+
continue;
|
|
212
|
+
const read = readConfigFieldsStatically(dir, [name, "sourceDir"]);
|
|
213
|
+
const config = read.status === "read" ? read.fields : {};
|
|
214
|
+
const sourceDir = typeof config.sourceDir === "string" ? join(dir, config.sourceDir) : undefined;
|
|
215
|
+
try {
|
|
216
|
+
const contributed = await plugin.buildRoots({ projectRoot: dir, config, entities, ...(sourceDir ? { sourceDir } : {}) });
|
|
217
|
+
for (const [key, entity] of contributed.entities)
|
|
218
|
+
if (!entities.has(key))
|
|
219
|
+
entities.set(key, entity);
|
|
220
|
+
}
|
|
221
|
+
catch (err) {
|
|
222
|
+
gaps.push(`lexicon "${name}" could not read the member's other source files, so their declarations were not read (${firstLine(err)})`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const outputs = [];
|
|
226
|
+
for (const { name, plugin } of reporting) {
|
|
227
|
+
try {
|
|
228
|
+
const report = plugin.workspaceOutputs(entities, unread);
|
|
229
|
+
if (!report)
|
|
230
|
+
continue;
|
|
231
|
+
for (const o of report.outputs)
|
|
232
|
+
outputs.push({ name: o.name, ...(o.previously?.length ? { previously: o.previously } : {}) });
|
|
233
|
+
for (const g of report.gaps ?? [])
|
|
234
|
+
gaps.push(g);
|
|
235
|
+
}
|
|
236
|
+
catch (err) {
|
|
237
|
+
gaps.push(`lexicon "${name}" workspaceOutputs threw, so its outputs were not read (${firstLine(err)})`);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return { outputs, gaps };
|
|
241
|
+
}
|
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
* that parameter give way to the declared one, which is how an inferred edge
|
|
16
16
|
* is promoted.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* A member whose kind has a link reader (#3932, `./kind-link-readers.ts`) also
|
|
19
|
+
* states links in its own files, such as a dbt project's sources. Those rows
|
|
20
|
+
* have origin `kind-reader` and carry the file and line that state them.
|
|
21
|
+
*
|
|
22
|
+
* Every row says how it was found (`declared`, `kind-reader` or `inferred:joinKey`), where it
|
|
19
23
|
* resolved (`source`, or `live` for the rows of `check --live`, #2549) and its status. A link that
|
|
20
24
|
* can't be resolved is kept, with the reason.
|
|
21
25
|
*
|
|
@@ -29,6 +33,7 @@ import { type JoinLabel } from "../join-key.js";
|
|
|
29
33
|
import type { Declaration, LinkDeclaration, Member } from "./declaration.js";
|
|
30
34
|
import type { KindRegistry, MemberKind } from "./kinds.js";
|
|
31
35
|
import type { MemberCollector } from "./compose-graph.js";
|
|
36
|
+
import type { KindLinkRead } from "./kind-link-readers.js";
|
|
32
37
|
/**
|
|
33
38
|
* The link kinds chant knows. Closed: a link of any other kind fails closed.
|
|
34
39
|
* `output` reads a named output of the producer. `telemetry` (#2558, D22)
|
|
@@ -41,13 +46,19 @@ export declare const DEFAULT_LINK_KIND = "output";
|
|
|
41
46
|
export declare const TELEMETRY_LINK_KIND = "telemetry";
|
|
42
47
|
/** The OTLP protocols a telemetry link may state, as `OTEL_EXPORTER_OTLP_PROTOCOL` names them. */
|
|
43
48
|
export declare const TELEMETRY_PROTOCOLS: readonly ["grpc", "http/protobuf", "http/json"];
|
|
44
|
-
/**
|
|
45
|
-
|
|
49
|
+
/**
|
|
50
|
+
* How a row was found: written down in the declaration, read from the
|
|
51
|
+
* member's own files by its kind's link reader (#3932), or inferred by the
|
|
52
|
+
* named rule.
|
|
53
|
+
*/
|
|
54
|
+
export type LinkOrigin = "declared" | "kind-reader" | "inferred:joinKey";
|
|
46
55
|
/** One output or parameter of a member, as a join sees it. */
|
|
47
56
|
export interface JoinHandle {
|
|
48
57
|
name: string;
|
|
49
58
|
/** The node that holds it, when the reader knows one (a graph IR id). */
|
|
50
59
|
node?: string;
|
|
60
|
+
/** Names it had before, from a rename hint in the producer's source (#3931). */
|
|
61
|
+
previously?: readonly string[];
|
|
51
62
|
}
|
|
52
63
|
/** What a member offers links, and what it reads. */
|
|
53
64
|
export interface MemberHandles {
|
|
@@ -72,6 +83,10 @@ interface RowBase {
|
|
|
72
83
|
resolves: "source" | "live";
|
|
73
84
|
/** Why the row is not `resolved`, or null. */
|
|
74
85
|
reason: string | null;
|
|
86
|
+
/** A `kind-reader` row (#3932): the reader, and the file (from the workspace root) and line that state the link. */
|
|
87
|
+
reader?: string;
|
|
88
|
+
file?: string;
|
|
89
|
+
line?: number;
|
|
75
90
|
}
|
|
76
91
|
/** A declared link, or an inferred join with one producer. */
|
|
77
92
|
export interface LinkRow extends RowBase {
|
|
@@ -102,7 +117,11 @@ export interface TelemetryTargets {
|
|
|
102
117
|
collectors: ReadonlyMap<string, MemberCollector>;
|
|
103
118
|
composed: ReadonlySet<string>;
|
|
104
119
|
}
|
|
105
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* A parameter that joins outputs of two or more producers (or two outputs of
|
|
122
|
+
* one). For a `kind-reader` row whose file names no producer, `input` is the
|
|
123
|
+
* output it reads, and the candidates are the members that could produce it.
|
|
124
|
+
*/
|
|
106
125
|
export interface AmbiguousRow extends RowBase {
|
|
107
126
|
status: "ambiguous";
|
|
108
127
|
input: string;
|
|
@@ -132,9 +151,11 @@ export declare function linkTargetProblem(declaration: Declaration, consumer: Me
|
|
|
132
151
|
* Resolve every declared link and infer the joins nobody wrote down.
|
|
133
152
|
* `handles` holds one entry per member whose handles were read; a member
|
|
134
153
|
* missing from it is unresolved. Declared rows come first, in declaration
|
|
135
|
-
* order;
|
|
154
|
+
* order; then the rows each member's kind reader found (`readLinks`, #3932),
|
|
155
|
+
* in member and file order; inferred and ambiguous rows follow, sorted by
|
|
156
|
+
* consumer and parameter.
|
|
136
157
|
*/
|
|
137
|
-
export declare function resolveLinks(declaration: Declaration, handles: ReadonlyMap<string, MemberHandles>, telemetry?: TelemetryTargets): LinkTableRow[];
|
|
158
|
+
export declare function resolveLinks(declaration: Declaration, handles: ReadonlyMap<string, MemberHandles>, telemetry?: TelemetryTargets, readLinks?: ReadonlyMap<string, KindLinkRead>): LinkTableRow[];
|
|
138
159
|
/**
|
|
139
160
|
* The handles of a member whose kind lists its outputs, or exposes none.
|
|
140
161
|
* Undefined for a kind whose outputs are read from the member (`chant`).
|
|
@@ -150,6 +171,7 @@ export interface ComposedHandles {
|
|
|
150
171
|
member: string;
|
|
151
172
|
name: string;
|
|
152
173
|
node?: string;
|
|
174
|
+
previously?: readonly string[];
|
|
153
175
|
}[];
|
|
154
176
|
imports: readonly {
|
|
155
177
|
member: string;
|
|
@@ -171,6 +193,6 @@ export declare function irMemberHandles(graph: ComposedHandles): Map<string, Mem
|
|
|
171
193
|
* With `kinds`, a member that isn't composed but whose kind lists its outputs
|
|
172
194
|
* (`other`, kinds from a package) is a link target too.
|
|
173
195
|
*/
|
|
174
|
-
export declare function graphLinks(declaration: Declaration, graph: ComposedHandles, kinds?: KindRegistry): LinkTableRow[];
|
|
196
|
+
export declare function graphLinks(declaration: Declaration, graph: ComposedHandles, kinds?: KindRegistry, readLinks?: ReadonlyMap<string, KindLinkRead>): LinkTableRow[];
|
|
175
197
|
export {};
|
|
176
198
|
//# sourceMappingURL=links.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../src/workspace/links.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../src/workspace/links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC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