@ontemper/sdk 0.10.4 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -12
- package/dist/Contract/Manifest.d.ts +3 -2
- package/dist/Contract/Manifest.d.ts.map +1 -1
- package/dist/Contract/Manifest.js +2 -0
- package/dist/Contract/Manifest.js.map +1 -1
- package/dist/Contract/StaticGraph.d.ts +96 -0
- package/dist/Contract/StaticGraph.d.ts.map +1 -0
- package/dist/Contract/StaticGraph.js +92 -0
- package/dist/Contract/StaticGraph.js.map +1 -0
- package/dist/Contract/index.d.ts +1 -0
- package/dist/Contract/index.d.ts.map +1 -1
- package/dist/Contract/index.js +1 -0
- package/dist/Contract/index.js.map +1 -1
- package/dist/Manifest.d.ts +1 -1
- package/dist/Manifest.d.ts.map +1 -1
- package/dist/Manifest.js +17 -75
- package/dist/Manifest.js.map +1 -1
- package/dist/StaticGraph.d.ts +87 -0
- package/dist/StaticGraph.d.ts.map +1 -0
- package/dist/StaticGraph.js +237 -0
- package/dist/StaticGraph.js.map +1 -0
- package/dist/StaticGraphAnalyzer.d.ts +7 -0
- package/dist/StaticGraphAnalyzer.d.ts.map +1 -0
- package/dist/StaticGraphAnalyzer.js +162 -0
- package/dist/StaticGraphAnalyzer.js.map +1 -0
- package/dist/StaticGraphCalls.d.ts +15 -0
- package/dist/StaticGraphCalls.d.ts.map +1 -0
- package/dist/StaticGraphCalls.js +1028 -0
- package/dist/StaticGraphCalls.js.map +1 -0
- package/dist/StaticGraphDeclarations.d.ts +43 -0
- package/dist/StaticGraphDeclarations.d.ts.map +1 -0
- package/dist/StaticGraphDeclarations.js +443 -0
- package/dist/StaticGraphDeclarations.js.map +1 -0
- package/dist/StaticGraphProcess.d.ts +2 -0
- package/dist/StaticGraphProcess.d.ts.map +1 -0
- package/dist/StaticGraphProcess.js +55 -0
- package/dist/StaticGraphProcess.js.map +1 -0
- package/dist/StaticGraphProject.d.ts +65 -0
- package/dist/StaticGraphProject.d.ts.map +1 -0
- package/dist/StaticGraphProject.js +303 -0
- package/dist/StaticGraphProject.js.map +1 -0
- package/dist/StaticGraphProtocol.d.ts +82 -0
- package/dist/StaticGraphProtocol.d.ts.map +1 -0
- package/dist/StaticGraphProtocol.js +36 -0
- package/dist/StaticGraphProtocol.js.map +1 -0
- package/dist/StaticGraphRuntime.d.ts +25 -0
- package/dist/StaticGraphRuntime.d.ts.map +1 -0
- package/dist/StaticGraphRuntime.js +60 -0
- package/dist/StaticGraphRuntime.js.map +1 -0
- package/dist/StaticGraphValues.d.ts +243 -0
- package/dist/StaticGraphValues.d.ts.map +1 -0
- package/dist/StaticGraphValues.js +845 -0
- package/dist/StaticGraphValues.js.map +1 -0
- package/dist/StepCatalogRules.d.ts +33 -0
- package/dist/StepCatalogRules.d.ts.map +1 -0
- package/dist/StepCatalogRules.js +64 -0
- package/dist/StepCatalogRules.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +67 -9
- package/dist/cli.js.map +1 -1
- package/package.json +13 -4
package/dist/Manifest.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { Context, Option, Predicate, Schema } from 'effect';
|
|
2
2
|
import { HttpApi } from 'effect/http-api';
|
|
3
|
-
import { declaredRunBudgetSeconds, declaredTriggerConcurrency,
|
|
3
|
+
import { declaredRunBudgetSeconds, declaredTriggerConcurrency, concurrencyProblem, runBudgetProblem, TriggerMetadata, } from './Contract/Manifest.js';
|
|
4
4
|
import { declarationOf } from './Resource.js';
|
|
5
5
|
import { closeCatalog } from './StepCatalog.js';
|
|
6
|
+
import { catalogOf, compareText, resourceProblem } from './StepCatalogRules.js';
|
|
6
7
|
import { Trigger } from './Trigger.js';
|
|
7
8
|
const decodeTrigger = Schema.decodeUnknownSync(TriggerMetadata, { onExcessProperty: 'error' });
|
|
8
|
-
const isFlowStep = Schema.is(FlowStep);
|
|
9
|
-
const isStepKind = Schema.is(FlowStepKind);
|
|
10
9
|
const identityOf = (resource) => `${resource.kind}:${resource.kind === 'resourceType' ? resource.type : resource.key}`;
|
|
11
|
-
export const SDK_VERSION = '0.
|
|
10
|
+
export const SDK_VERSION = '0.12.0';
|
|
12
11
|
export const RUNTIME_API_VERSION = 1;
|
|
13
12
|
/** The route the SDK serves for platform probes; an API declaring `GET` on it collides with it on every request. */
|
|
14
13
|
export const HEALTHCHECK_PATH = '/healthcheck';
|
|
15
|
-
const compareText = (left, right) => (left < right ? -1 : left > right ? 1 : 0);
|
|
16
14
|
const compareEndpoints = (left, right) => compareText(left.group, right.group) ||
|
|
17
15
|
compareText(left.name, right.name) ||
|
|
18
16
|
compareText(left.method, right.method) ||
|
|
@@ -62,83 +60,27 @@ const assertOnePolicyPerPath = (endpoints) => {
|
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
};
|
|
65
|
-
const stepProblem = (problem) => `Workflow steps: ${problem}`;
|
|
66
63
|
/** The identity of one resource `step` names; it must be a declaration that an endpoint of the workflow holds. */
|
|
67
64
|
const resourceOf = (step, resource, declarations) => {
|
|
68
65
|
const declaration = Predicate.isNotNullish(resource) ? declarationOf(resource) : undefined;
|
|
69
|
-
if (declaration === undefined)
|
|
70
|
-
return {
|
|
71
|
-
problem: `step ${step.id} names a resource that Resource, Variable, or ResourceType did not declare. Declare it with one of them.`,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
66
|
+
if (declaration === undefined)
|
|
67
|
+
return { problem: resourceProblem.notADeclaration(step.id) };
|
|
74
68
|
const identity = identityOf(declaration.manifest);
|
|
75
69
|
const own = declarations.get(identity);
|
|
76
|
-
if (own === undefined)
|
|
77
|
-
return {
|
|
78
|
-
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
if (own !== declaration) {
|
|
82
|
-
return {
|
|
83
|
-
problem: `step ${step.id} names a second declaration of ${identity}. Declare it once and share that class.`,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
70
|
+
if (own === undefined)
|
|
71
|
+
return { problem: resourceProblem.noEndpoint(step.id, identity) };
|
|
72
|
+
if (own !== declaration)
|
|
73
|
+
return { problem: resourceProblem.secondDeclaration(step.id, identity) };
|
|
86
74
|
return { identity };
|
|
87
75
|
};
|
|
88
|
-
/**
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
identities.add(named.identity);
|
|
97
|
-
}
|
|
98
|
-
return [...identities].sort(compareText);
|
|
99
|
-
};
|
|
100
|
-
/** Why `step` cannot join a catalog that already holds `first` under its id, or `undefined`. */
|
|
101
|
-
const catalogProblem = (step, first) => {
|
|
102
|
-
const idProblem = stepIdProblem(step.id);
|
|
103
|
-
if (idProblem !== undefined)
|
|
104
|
-
return `${idProblem} Rename the step in Step.make.`;
|
|
105
|
-
if (first !== undefined && first !== step) {
|
|
106
|
-
return `step id ${step.id} repeats with another definition. Give each step its own id, or share one Step value.`;
|
|
107
|
-
}
|
|
108
|
-
if (!isStepKind(step.kind)) {
|
|
109
|
-
return `step ${step.id} has kind ${String(step.kind)}, which is not one of ${FlowStepKind.literals.join(', ')}. Use one of them.`;
|
|
110
|
-
}
|
|
111
|
-
return undefined;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* The manifest `steps` catalog (FLOW-2) of `declared`, in declaration order, and its problems. Of two values
|
|
115
|
-
* with one id the first stays; a value with an invalid id, kind, title, or summary is left out.
|
|
116
|
-
*/
|
|
117
|
-
const stepsOf = (declared, declarations) => {
|
|
118
|
-
const byId = new Map();
|
|
119
|
-
const steps = [];
|
|
120
|
-
const problems = [];
|
|
121
|
-
for (const step of declared) {
|
|
122
|
-
const first = byId.get(step.id);
|
|
123
|
-
const problem = catalogProblem(step, first);
|
|
124
|
-
if (first === undefined)
|
|
125
|
-
byId.set(step.id, step);
|
|
126
|
-
if (problem !== undefined)
|
|
127
|
-
problems.push(stepProblem(problem));
|
|
128
|
-
if (problem !== undefined || first === step)
|
|
129
|
-
continue;
|
|
130
|
-
const { id, title, kind, summary } = step;
|
|
131
|
-
const resources = stepResources(step, declarations, problems);
|
|
132
|
-
// Key order is the wire order; `summary` is left out, not `undefined`, when the step has none.
|
|
133
|
-
const entry = summary === undefined ? { id, title, kind, resources } : { id, title, kind, summary, resources };
|
|
134
|
-
// Checked so a title or summary that a cast let through never reaches the manifest the Flow pane reads.
|
|
135
|
-
if (isFlowStep(entry))
|
|
136
|
-
steps.push(entry);
|
|
137
|
-
else
|
|
138
|
-
problems.push(stepProblem(`step ${id} has a title or summary that is not a string. Give it text in Step.make.`));
|
|
139
|
-
}
|
|
140
|
-
return { steps, problems };
|
|
141
|
-
};
|
|
76
|
+
/** The manifest `steps` catalog (FLOW-2) of the declared `Step` values and its problems, by the shared catalog rules. */
|
|
77
|
+
const stepsOf = (declared, declarations) => catalogOf(declared, (step) => ({
|
|
78
|
+
id: step.id,
|
|
79
|
+
title: step.title,
|
|
80
|
+
kind: step.kind,
|
|
81
|
+
summary: step.summary,
|
|
82
|
+
resources: () => step.resources.map((resource) => resourceOf(step, resource, declarations)),
|
|
83
|
+
}));
|
|
142
84
|
/**
|
|
143
85
|
* Builds the manifest of `api`. A step problem never throws: the catalog keeps what is valid and
|
|
144
86
|
* `stepProblems` names the rest (FLOW-2). The first build closes the step catalog of the process.
|
package/dist/Manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Manifest.js","sourceRoot":"","sources":["../src/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAqB,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EACL,wBAAwB,EACxB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"Manifest.js","sourceRoot":"","sources":["../src/Manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO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CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACrG,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;KACtC,CAAC;AACJ,CAAC,CAAC;AAEF,oGAAoG;AACpG,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,GAAgC,EACT,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type BuiltWorkflowManifest, TriggerMetadata, type WorkflowSteps } from './Contract/Manifest.js';
|
|
2
|
+
import type { FlowStaticGraph } from './Contract/StaticGraph.js';
|
|
3
|
+
/** The bounds of one extraction (FLOW-10). Past one of them the graph is omitted whole, never cut. */
|
|
4
|
+
export interface FlowExtractionLimits {
|
|
5
|
+
/** Deadline of the analyzer process; the parent kills it then. */
|
|
6
|
+
readonly timeoutMs: number;
|
|
7
|
+
/** Named calls followed inside one another. */
|
|
8
|
+
readonly maxDepth: number;
|
|
9
|
+
/** Nodes of all endpoints together. */
|
|
10
|
+
readonly maxNodes: number;
|
|
11
|
+
/** Bytes of the serialized `staticGraph`. */
|
|
12
|
+
readonly maxGraphBytes: number;
|
|
13
|
+
/** The V8 heap of the analyzer process. */
|
|
14
|
+
readonly maxMemoryMb: number;
|
|
15
|
+
/** Expressions the analyzer walks. */
|
|
16
|
+
readonly maxWork: number;
|
|
17
|
+
readonly maxFiles: number;
|
|
18
|
+
readonly maxSourceBytes: number;
|
|
19
|
+
}
|
|
20
|
+
export declare const DEFAULT_FLOW_EXTRACTION_LIMITS: FlowExtractionLimits;
|
|
21
|
+
export interface FlowExtractionOptions {
|
|
22
|
+
/** The workflow project folder, which holds `tsconfig.json`. Defaults to the working directory. */
|
|
23
|
+
readonly project?: string | undefined;
|
|
24
|
+
/** The workflow entrypoint, relative to the project. Defaults to `src/index.ts`. */
|
|
25
|
+
readonly entrypoint?: string | undefined;
|
|
26
|
+
readonly limits?: Partial<FlowExtractionLimits> | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `ok`: every part was derived. `incomplete`: the endpoints were read, and the steps or their calls were not.
|
|
30
|
+
* `unavailable`: nothing was read. A part that was not derived is `null`, never an empty list.
|
|
31
|
+
*/
|
|
32
|
+
export type FlowExtractionStatus = 'ok' | 'incomplete' | 'unavailable';
|
|
33
|
+
/** One endpoint of the source; `trigger` is `null` when its annotation is not written as literals. */
|
|
34
|
+
export interface FlowExtractionEndpoint {
|
|
35
|
+
readonly group: string;
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly method: string;
|
|
38
|
+
readonly path: string;
|
|
39
|
+
readonly trigger: TriggerMetadata | null;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Why nothing was read. `source`: the analyzer ran, and the source or a budget stopped it, such as a syntax error.
|
|
43
|
+
* `runtime`: the analyzer gave no answer, such as a missing `node` or `typescript`, the deadline, or a crash.
|
|
44
|
+
*/
|
|
45
|
+
export type FlowExtractionFailureKind = 'runtime' | 'source';
|
|
46
|
+
/** The Flow of workflow source, read without running it. The bundle build stays the check that loads the code. */
|
|
47
|
+
export interface FlowExtraction {
|
|
48
|
+
readonly status: FlowExtractionStatus;
|
|
49
|
+
readonly sdkVersion: string;
|
|
50
|
+
readonly endpoints: ReadonlyArray<FlowExtractionEndpoint> | null;
|
|
51
|
+
/** The declared steps by the FLOW-2 catalog rules; `[]` only when the source declares none. */
|
|
52
|
+
readonly steps: WorkflowSteps | null;
|
|
53
|
+
/** The possible Step calls of each endpoint. A step it names can be absent from `steps` for a problem in `stepProblems`. */
|
|
54
|
+
readonly staticGraph: FlowStaticGraph | null;
|
|
55
|
+
/** The step problems that the source alone shows, worded as the build words them. */
|
|
56
|
+
readonly stepProblems: ReadonlyArray<string> | null;
|
|
57
|
+
readonly warnings: ReadonlyArray<string>;
|
|
58
|
+
/** Present only when `status` is `unavailable`; a reader branches on it, never on the text of `warnings`. */
|
|
59
|
+
readonly failureKind?: FlowExtractionFailureKind;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Reads the endpoints, the declared steps, their static problems, and the possible Step calls from workflow
|
|
63
|
+
* source. It never runs workflow code and never rejects: a timeout, a crash, or a bound gives a status and a warning.
|
|
64
|
+
*/
|
|
65
|
+
export declare const extractWorkflowFlow: (options?: FlowExtractionOptions) => Promise<FlowExtraction>;
|
|
66
|
+
/** What the build adds to a manifest: a graph, nothing for a workflow without steps, or nothing with a warning. */
|
|
67
|
+
export type ManifestStaticGraph = {
|
|
68
|
+
readonly state: 'derived';
|
|
69
|
+
readonly staticGraph: FlowStaticGraph;
|
|
70
|
+
} | {
|
|
71
|
+
readonly state: 'none';
|
|
72
|
+
} | {
|
|
73
|
+
readonly state: 'omitted';
|
|
74
|
+
readonly warning: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* What the build adds to `manifest`, given what the source of the same workflow gave. The loaded manifest
|
|
78
|
+
* decides: a graph that names other endpoints or a step outside its catalog is omitted with a warning.
|
|
79
|
+
*/
|
|
80
|
+
export declare const staticGraphFor: (manifest: BuiltWorkflowManifest, extraction: FlowExtraction) => ManifestStaticGraph;
|
|
81
|
+
/**
|
|
82
|
+
* The `staticGraph` that the build writes beside the `steps` of `manifest` (FLOW-10). A manifest without steps
|
|
83
|
+
* gets none, keeps its bytes, and starts no analyzer. A failed, bounded, or mismatched derivation gives a
|
|
84
|
+
* warning and no graph: it never fails the build, and it never changes `manifest`.
|
|
85
|
+
*/
|
|
86
|
+
export declare const deriveStaticGraph: (manifest: BuiltWorkflowManifest, options?: FlowExtractionOptions) => Promise<ManifestStaticGraph>;
|
|
87
|
+
//# sourceMappingURL=StaticGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticGraph.d.ts","sourceRoot":"","sources":["../src/StaticGraph.ts"],"names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AIG;AACH,eAAO,MAAM,iBAAiB,aAClB,qBAAqB,YACtB,qBAAqB,KAC7B,OAAO,CAAC,mBAAmB,CAG7B,CAAC"}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// Static Step call graph extraction (FLOW-10, FLOW-11). An analyzer process, which this module kills at a
|
|
2
|
+
// deadline, parses the TypeScript source of a workflow into an AST and resolves its calls with a static resolver:
|
|
3
|
+
// no type checker runs. This module loads no `typescript` and imports no workflow code; only that process loads the parser.
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import { resolve } from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { Option, Schema } from 'effect';
|
|
8
|
+
import { TriggerMetadata } from './Contract/Manifest.js';
|
|
9
|
+
import { SDK_VERSION } from './Manifest.js';
|
|
10
|
+
import { AnalyzerOutput, } from './StaticGraphProtocol.js';
|
|
11
|
+
import { analyzerRuntimes } from './StaticGraphRuntime.js';
|
|
12
|
+
import { catalogOf, resourceProblem } from './StepCatalogRules.js';
|
|
13
|
+
export const DEFAULT_FLOW_EXTRACTION_LIMITS = {
|
|
14
|
+
timeoutMs: 5_000,
|
|
15
|
+
maxDepth: 24,
|
|
16
|
+
maxNodes: 600,
|
|
17
|
+
maxGraphBytes: 256 * 1024,
|
|
18
|
+
maxMemoryMb: 512,
|
|
19
|
+
maxWork: 2_000_000,
|
|
20
|
+
maxFiles: 400,
|
|
21
|
+
maxSourceBytes: 4 * 1024 * 1024,
|
|
22
|
+
};
|
|
23
|
+
// The analyzer script beside this module: TypeScript source in the repository, compiled JavaScript in the package.
|
|
24
|
+
const ANALYZER = fileURLToPath(new URL(import.meta.url.endsWith('.ts') ? './StaticGraphProcess.ts' : './StaticGraphProcess.js', import.meta.url));
|
|
25
|
+
// The analyzer prints endpoints, steps, and a bounded graph; more output than this is a defect.
|
|
26
|
+
const MAX_OUTPUT_BYTES = 4 * 1024 * 1024;
|
|
27
|
+
const MAX_DIAGNOSTIC_BYTES = 8 * 1024;
|
|
28
|
+
// The error line of an uncaught exception in the analyzer's stderr, such as `Error: EACCES …`; a crash dump has none.
|
|
29
|
+
const errorLine = (stderr) => /^\w*Error: .*$/m.exec(stderr)?.[0].slice(0, 200) ?? '';
|
|
30
|
+
const decodeOutput = Schema.decodeUnknownOption(Schema.fromJsonString(AnalyzerOutput));
|
|
31
|
+
const decodeTrigger = Schema.decodeUnknownOption(TriggerMetadata);
|
|
32
|
+
const runAnalyzer = (runtime, args, limits) => {
|
|
33
|
+
const done = Promise.withResolvers();
|
|
34
|
+
const child = spawn(runtime.command, [`--max-old-space-size=${limits.maxMemoryMb}`, ANALYZER, ...args], {
|
|
35
|
+
cwd: runtime.cwd,
|
|
36
|
+
env: runtime.env,
|
|
37
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
38
|
+
});
|
|
39
|
+
const stdout = [];
|
|
40
|
+
let printed = 0;
|
|
41
|
+
let diagnostic = '';
|
|
42
|
+
let stopped;
|
|
43
|
+
const stop = (reason) => {
|
|
44
|
+
stopped ??= reason;
|
|
45
|
+
child.kill('SIGKILL');
|
|
46
|
+
};
|
|
47
|
+
// The deadline holds outside the analyzer, so a parse or a walk that never returns still ends.
|
|
48
|
+
const deadline = setTimeout(() => stop(`the analyzer did not finish in ${limits.timeoutMs} ms`), limits.timeoutMs);
|
|
49
|
+
child.stdout.on('data', (chunk) => {
|
|
50
|
+
printed += chunk.byteLength;
|
|
51
|
+
if (printed > MAX_OUTPUT_BYTES)
|
|
52
|
+
stop(`the analyzer printed more than ${MAX_OUTPUT_BYTES} bytes`);
|
|
53
|
+
else
|
|
54
|
+
stdout.push(chunk);
|
|
55
|
+
});
|
|
56
|
+
child.stderr.on('data', (chunk) => {
|
|
57
|
+
if (diagnostic.length < MAX_DIAGNOSTIC_BYTES)
|
|
58
|
+
diagnostic += chunk.toString('utf8');
|
|
59
|
+
});
|
|
60
|
+
child.once('error', (cause) => {
|
|
61
|
+
clearTimeout(deadline);
|
|
62
|
+
done.resolve(cause.code === 'ENOENT'
|
|
63
|
+
? { outcome: 'missing' }
|
|
64
|
+
: { outcome: 'failed', reason: `the analyzer did not start (${cause.message})` });
|
|
65
|
+
});
|
|
66
|
+
child.once('close', (code, signal) => {
|
|
67
|
+
clearTimeout(deadline);
|
|
68
|
+
if (stopped !== undefined) {
|
|
69
|
+
done.resolve({ outcome: 'failed', reason: stopped });
|
|
70
|
+
}
|
|
71
|
+
else if (code === 0) {
|
|
72
|
+
done.resolve({ outcome: 'printed', stdout: Buffer.concat(stdout).toString('utf8') });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// A heap past the memory limit ends the process with a signal; an uncaught exception ends it with a code.
|
|
76
|
+
const how = signal === null ? `exit code ${String(code)}` : `signal ${signal}`;
|
|
77
|
+
const detail = errorLine(diagnostic);
|
|
78
|
+
done.resolve({
|
|
79
|
+
outcome: 'failed',
|
|
80
|
+
reason: `the analyzer stopped with ${how}${detail === '' ? '' : ` (${detail})`}`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return done.promise;
|
|
85
|
+
};
|
|
86
|
+
const unavailable = (reason, failureKind) => ({
|
|
87
|
+
status: 'unavailable',
|
|
88
|
+
sdkVersion: SDK_VERSION,
|
|
89
|
+
endpoints: null,
|
|
90
|
+
steps: null,
|
|
91
|
+
staticGraph: null,
|
|
92
|
+
stepProblems: null,
|
|
93
|
+
warnings: [`The workflow source was not read: ${reason}.`],
|
|
94
|
+
failureKind,
|
|
95
|
+
});
|
|
96
|
+
const describeEndpoint = (endpoint) => `${endpoint.group}.${endpoint.name} (${endpoint.method} ${endpoint.path})`;
|
|
97
|
+
const endpointOf = (endpoint, warnings) => {
|
|
98
|
+
const { group, name, method, path } = endpoint;
|
|
99
|
+
const trigger = Option.getOrNull(decodeTrigger(endpoint.trigger));
|
|
100
|
+
if (trigger === null) {
|
|
101
|
+
warnings.push(`Endpoint ${describeEndpoint(endpoint)} has no Trigger annotation that the source writes as literals.`);
|
|
102
|
+
}
|
|
103
|
+
return { group, name, method, path, trigger };
|
|
104
|
+
};
|
|
105
|
+
const namedResource = (stepId, resource) => {
|
|
106
|
+
switch (resource.state) {
|
|
107
|
+
case 'declared':
|
|
108
|
+
return { identity: resource.identity };
|
|
109
|
+
case 'undeclared':
|
|
110
|
+
return { problem: resourceProblem.noEndpoint(stepId, resource.identity) };
|
|
111
|
+
case 'second':
|
|
112
|
+
return { problem: resourceProblem.secondDeclaration(stepId, resource.identity) };
|
|
113
|
+
case 'foreign':
|
|
114
|
+
return { problem: resourceProblem.notADeclaration(stepId) };
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
// The catalog and the step problems of the `Step.make` calls, by the rules the runtime build follows (FLOW-2).
|
|
118
|
+
const catalogOfSource = (steps) => catalogOf(steps, (step) => ({
|
|
119
|
+
id: step.id,
|
|
120
|
+
title: step.title,
|
|
121
|
+
kind: step.kind,
|
|
122
|
+
summary: step.summary,
|
|
123
|
+
resources: () => step.resources.map((resource) => namedResource(step.id, resource)),
|
|
124
|
+
}));
|
|
125
|
+
const toExtraction = (output, limits) => {
|
|
126
|
+
const [reason] = output.warnings;
|
|
127
|
+
if (output.endpoints === null) {
|
|
128
|
+
return unavailable(reason ?? 'the analyzer gave no reason', output.failureKind ?? 'runtime');
|
|
129
|
+
}
|
|
130
|
+
const warnings = [...output.warnings];
|
|
131
|
+
const endpoints = output.endpoints.map((endpoint) => endpointOf(endpoint, warnings));
|
|
132
|
+
const catalog = output.steps === null ? null : catalogOfSource(output.steps);
|
|
133
|
+
// The endpoints passed the contract schema when the output was decoded.
|
|
134
|
+
const graph = output.graph === null ? null : { version: 1, endpoints: output.graph };
|
|
135
|
+
const fits = graph === null || Buffer.byteLength(JSON.stringify(graph)) <= limits.maxGraphBytes;
|
|
136
|
+
if (!fits)
|
|
137
|
+
warnings.push(`The step calls were not derived: the graph is larger than ${limits.maxGraphBytes} bytes.`);
|
|
138
|
+
const staticGraph = fits ? graph : null;
|
|
139
|
+
return {
|
|
140
|
+
status: catalog === null || staticGraph === null ? 'incomplete' : 'ok',
|
|
141
|
+
sdkVersion: SDK_VERSION,
|
|
142
|
+
endpoints,
|
|
143
|
+
steps: catalog === null ? null : catalog.steps,
|
|
144
|
+
staticGraph,
|
|
145
|
+
stepProblems: catalog === null ? null : catalog.problems,
|
|
146
|
+
warnings,
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Reads the endpoints, the declared steps, their static problems, and the possible Step calls from workflow
|
|
151
|
+
* source. It never runs workflow code and never rejects: a timeout, a crash, or a bound gives a status and a warning.
|
|
152
|
+
*/
|
|
153
|
+
export const extractWorkflowFlow = async (options = {}) => {
|
|
154
|
+
const limits = { ...DEFAULT_FLOW_EXTRACTION_LIMITS, ...options.limits };
|
|
155
|
+
const project = resolve(options.project ?? process.cwd());
|
|
156
|
+
const args = [
|
|
157
|
+
project,
|
|
158
|
+
options.entrypoint ?? 'src/index.ts',
|
|
159
|
+
limits.maxDepth,
|
|
160
|
+
limits.maxNodes,
|
|
161
|
+
limits.maxWork,
|
|
162
|
+
limits.maxFiles,
|
|
163
|
+
limits.maxSourceBytes,
|
|
164
|
+
].map(String);
|
|
165
|
+
for (const runtime of analyzerRuntimes(project)) {
|
|
166
|
+
const run = await runAnalyzer(runtime, args, limits);
|
|
167
|
+
if (run.outcome === 'missing')
|
|
168
|
+
continue;
|
|
169
|
+
if (run.outcome === 'failed')
|
|
170
|
+
return unavailable(run.reason, 'runtime');
|
|
171
|
+
const output = decodeOutput(run.stdout);
|
|
172
|
+
return Option.isNone(output)
|
|
173
|
+
? unavailable('the analyzer printed no valid result', 'runtime')
|
|
174
|
+
: toExtraction(output.value, limits);
|
|
175
|
+
}
|
|
176
|
+
return unavailable('no node on PATH outside the project could start the analyzer', 'runtime');
|
|
177
|
+
};
|
|
178
|
+
const stepIdsOf = (nodes, ids) => {
|
|
179
|
+
for (const node of nodes) {
|
|
180
|
+
if (node.kind === 'step') {
|
|
181
|
+
ids.add(node.stepId);
|
|
182
|
+
stepIdsOf(node.body, ids);
|
|
183
|
+
}
|
|
184
|
+
else if (node.kind === 'loop')
|
|
185
|
+
stepIdsOf(node.body, ids);
|
|
186
|
+
else if (node.kind === 'branch')
|
|
187
|
+
for (const arm of node.arms)
|
|
188
|
+
stepIdsOf(arm.nodes, ids);
|
|
189
|
+
else if (node.kind === 'parallel')
|
|
190
|
+
for (const lane of node.lanes)
|
|
191
|
+
stepIdsOf(lane, ids);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const endpointIdentity = (endpoint) => JSON.stringify([endpoint.group, endpoint.name, endpoint.method, endpoint.path]);
|
|
195
|
+
// Why the graph of the source does not describe the built `manifest`, or `undefined`. The loaded bundle decides.
|
|
196
|
+
const mismatch = (manifest, steps, graph) => {
|
|
197
|
+
const built = manifest.endpoints.map(endpointIdentity).join('\n');
|
|
198
|
+
if (graph.endpoints.map(endpointIdentity).join('\n') !== built) {
|
|
199
|
+
return 'the endpoints in the source differ from the endpoints of the built workflow';
|
|
200
|
+
}
|
|
201
|
+
const called = new Set();
|
|
202
|
+
for (const endpoint of graph.endpoints)
|
|
203
|
+
stepIdsOf(endpoint.nodes, called);
|
|
204
|
+
const declared = new Set(steps.map((step) => step.id));
|
|
205
|
+
const unknown = [...called].find((id) => !declared.has(id));
|
|
206
|
+
return unknown === undefined
|
|
207
|
+
? undefined
|
|
208
|
+
: `the source calls step ${unknown}, which the built workflow does not declare`;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* What the build adds to `manifest`, given what the source of the same workflow gave. The loaded manifest
|
|
212
|
+
* decides: a graph that names other endpoints or a step outside its catalog is omitted with a warning.
|
|
213
|
+
*/
|
|
214
|
+
export const staticGraphFor = (manifest, extraction) => {
|
|
215
|
+
const steps = manifest.steps ?? [];
|
|
216
|
+
if (steps.length === 0)
|
|
217
|
+
return { state: 'none' };
|
|
218
|
+
const omitted = (reason) => ({
|
|
219
|
+
state: 'omitted',
|
|
220
|
+
warning: `Static step graph omitted from the workflow manifest: ${reason}`,
|
|
221
|
+
});
|
|
222
|
+
if (extraction.staticGraph === null)
|
|
223
|
+
return omitted(extraction.warnings.join(' ') || 'the analyzer gave no reason.');
|
|
224
|
+
const reason = mismatch(manifest, steps, extraction.staticGraph);
|
|
225
|
+
return reason === undefined ? { state: 'derived', staticGraph: extraction.staticGraph } : omitted(`${reason}.`);
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* The `staticGraph` that the build writes beside the `steps` of `manifest` (FLOW-10). A manifest without steps
|
|
229
|
+
* gets none, keeps its bytes, and starts no analyzer. A failed, bounded, or mismatched derivation gives a
|
|
230
|
+
* warning and no graph: it never fails the build, and it never changes `manifest`.
|
|
231
|
+
*/
|
|
232
|
+
export const deriveStaticGraph = async (manifest, options = {}) => {
|
|
233
|
+
if ((manifest.steps ?? []).length === 0)
|
|
234
|
+
return { state: 'none' };
|
|
235
|
+
return staticGraphFor(manifest, await extractWorkflowFlow(options));
|
|
236
|
+
};
|
|
237
|
+
//# sourceMappingURL=StaticGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticGraph.js","sourceRoot":"","sources":["../src/StaticGraph.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,kHAAkH;AAClH,4HAA4H;AAC5H,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAA8B,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAEzG,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EACL,cAAc,GAIf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAwB,gBAAgB,EAAE,MA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AC;AAClH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,QAA+B,EAC/B,OAAO,GAA0B,EAAE,EACL,EAAE;IAChC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAClE,OAAO,cAAc,CAAC,QAAQ,EAAE,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC;AACtE,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnalyzerLimits, AnalyzerOutput } from './StaticGraphProtocol.js';
|
|
2
|
+
/**
|
|
3
|
+
* Derives the endpoints, the declared steps, and the possible Step calls of a workflow from its source. A part
|
|
4
|
+
* that cannot be derived is `null` with a warning; the graph is `null` whenever the steps are.
|
|
5
|
+
*/
|
|
6
|
+
export declare const analyzeWorkflowSource: (root: string, entrypoint: string, limits: AnalyzerLimits) => AnalyzerOutput;
|
|
7
|
+
//# sourceMappingURL=StaticGraphAnalyzer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticGraphAnalyzer.d.ts","sourceRoot":"","sources":["../src/StaticGraphAnalyzer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,cAAc,EACd,cAAc,EACf,MAAM,0BAA0B,CAAC;AAsHlC;;;GAGG;AACH,eAAO,MAAM,qBAAqB,SAAU,MAAM,cAAc,MAAM,UAAU,cAAc,KAAG,cA0DhG,CAAC"}
|