@mark1russell7/workflow 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +16 -2
- package/build/index.d.ts +409 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +1451 -0
- package/build/index.js.map +1 -0
- package/package.json +44 -3
- package/src/check.ts +430 -0
- package/src/edit.ts +267 -0
- package/src/index.ts +21 -0
- package/src/language.ts +225 -0
- package/src/sample.ts +64 -0
- package/src/world.ts +158 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mark Russell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @mark1russell7/workflow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A workflow as a document of coeval: triggers, jobs, steps that call procedures, the data between the steps, conditions, matrices and references to secrets.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { SAMPLE_WORKFLOW, checkWorkflow, workflowGraph, workflowMachine } from "@mark1russell7/workflow";
|
|
7
|
+
|
|
8
|
+
const issues = checkWorkflow(SAMPLE_WORKFLOW); // [] for a good workflow
|
|
9
|
+
const graph = workflowGraph(SAMPLE_WORKFLOW); // the nodes, the edges and the layers of the jobs
|
|
10
|
+
const machine = workflowMachine(); // the kernel machine of the language
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- `checkWorkflow` gives each problem with its JSON path. It takes a grant check of the workspaces and a catalog of procedures as options.
|
|
14
|
+
- `workflowGraph` gives the triggers, the jobs and the steps, with the edges of the needs and of the data.
|
|
15
|
+
- `workflowMachine` gives the machine for `check`, `prepare` and `run` of the kernel. A call of a procedure is one effect, with the path of the procedure as its kind.
|
|
16
|
+
|
|
17
|
+
The design is in [`docs/WORKFLOW.md`](https://github.com/mark1russell7/coeval/blob/main/docs/WORKFLOW.md).
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
import { FormulaProfile, Key as Key$1, Language, Machine, WorldPart } from "@mark1russell7/coeval";
|
|
2
|
+
/** The name of the format of a workflow document. */
|
|
3
|
+
export declare const WORKFLOW_FORMAT = "workflow/1";
|
|
4
|
+
/**
|
|
5
|
+
* The world of the workflow language. The formula kit of the kernel gives the expressions: `lit`, `ref`, `if`,
|
|
6
|
+
* `and`, `or` and the operations. This world adds the structure, the calls, the text templates and the secrets.
|
|
7
|
+
*/
|
|
8
|
+
export declare const WORKFLOW_WORLD: WorldPart;
|
|
9
|
+
/** The version of the workflow language. */
|
|
10
|
+
export declare const WORKFLOW_VERSION = "0.1.0";
|
|
11
|
+
/** A reference to a secret. It holds the name of the secret, not its value. */
|
|
12
|
+
interface SecretRef {
|
|
13
|
+
readonly secret: string;
|
|
14
|
+
}
|
|
15
|
+
/** This function tells if a value is a reference to a secret. */
|
|
16
|
+
export declare function isSecretRef(value: unknown): value is SecretRef;
|
|
17
|
+
/** This function gives the combinations of the axes of a matrix, without the excluded ones, with the included ones. */
|
|
18
|
+
export declare function expandMatrix(axes: Readonly<Record<string, unknown>>, include?: readonly unknown[], exclude?: readonly unknown[]): Record<string, unknown>[];
|
|
19
|
+
/** The workflow language: the kinds of `WORKFLOW_WORLD` and their code, on the formula kit of the kernel. */
|
|
20
|
+
export declare const WORKFLOW_LANGUAGE: Language;
|
|
21
|
+
/** The formula profile of the expressions of a workflow: the operations of the kernel and the text operations. */
|
|
22
|
+
export declare const WORKFLOW_OPS: FormulaProfile;
|
|
23
|
+
/**
|
|
24
|
+
* This function gives the machine of the workflow language: the formula kit with the operations of a workflow, and
|
|
25
|
+
* the kinds of the workflow world. An add-on composes its own language after it.
|
|
26
|
+
*
|
|
27
|
+
* @param more - The languages of add-ons, in order.
|
|
28
|
+
* @returns The machine.
|
|
29
|
+
*/
|
|
30
|
+
export declare function workflowMachine(...more: readonly Language[]): Machine;
|
|
31
|
+
/**
|
|
32
|
+
* This function gives the machine of the workflow language with another formula profile. An add-on gives the
|
|
33
|
+
* operations of its host here, for example `WORKFLOW_OPS` with more operations.
|
|
34
|
+
*
|
|
35
|
+
* @param profile - The formula profile of the expressions.
|
|
36
|
+
* @param more - The languages of add-ons, in order.
|
|
37
|
+
* @returns The machine.
|
|
38
|
+
*/
|
|
39
|
+
export declare function workflowMachineWith(profile: FormulaProfile, ...more: readonly Language[]): Machine;
|
|
40
|
+
/** One problem of a workflow, at the JSON path of its value. */
|
|
41
|
+
interface WorkflowIssue {
|
|
42
|
+
readonly level: "error" | "warning";
|
|
43
|
+
/** A stable code, for example `needs-unknown`. A kernel issue keeps its code, for example `#NAME?`. */
|
|
44
|
+
readonly code: string;
|
|
45
|
+
/** The keys from the root JSON value of the document to the value with the problem. */
|
|
46
|
+
readonly at: readonly Key$1[];
|
|
47
|
+
readonly message: string;
|
|
48
|
+
}
|
|
49
|
+
/** The answer of a grant check: `ok`, and the words of the reason. */
|
|
50
|
+
interface AccessAnswer {
|
|
51
|
+
readonly ok: boolean;
|
|
52
|
+
readonly why: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The grant check of the workspaces: can the workspace `from` read or write the workspace `target`? The host binds its
|
|
56
|
+
* model of the workspaces. A workflow runs with the grants of its own workspace only.
|
|
57
|
+
*/
|
|
58
|
+
type Access = (from: string, access: "read" | "write", target: string) => AccessAnswer;
|
|
59
|
+
/** The facts of one procedure for a check. */
|
|
60
|
+
interface ProcedureInfo {
|
|
61
|
+
/** The inputs that name a workspace, by the access of the call to that workspace. */
|
|
62
|
+
readonly workspaces?: {
|
|
63
|
+
readonly read?: readonly string[];
|
|
64
|
+
readonly write?: readonly string[];
|
|
65
|
+
};
|
|
66
|
+
/** The names of the inputs that the procedure needs. */
|
|
67
|
+
readonly required?: readonly string[];
|
|
68
|
+
}
|
|
69
|
+
/** The options of `checkWorkflow`. */
|
|
70
|
+
interface WorkflowCheckOptions {
|
|
71
|
+
/** The machine. The default is `workflowMachine()`. An add-on gives the machine with its language. */
|
|
72
|
+
readonly machine?: Machine;
|
|
73
|
+
/** The grant check. Without it, the check finds no grant problem. */
|
|
74
|
+
readonly access?: Access;
|
|
75
|
+
/** The procedures that a step can call, by the path with dots, for example `git.clone`. Without it, each path is known. */
|
|
76
|
+
readonly procedures?: Readonly<Record<string, ProcedureInfo>>;
|
|
77
|
+
/** The names that the host binds, for example the contexts of a host. A reference to such a name is always valid. */
|
|
78
|
+
readonly hostNames?: readonly string[];
|
|
79
|
+
/** The namespaces of calls, besides `procedure`. An input of such a call can hold a secret. */
|
|
80
|
+
readonly callNamespaces?: readonly string[];
|
|
81
|
+
/** With `true`, a secret needs no declaration: the host gives the secrets of the workspace. The default is `false`. */
|
|
82
|
+
readonly openSecrets?: boolean;
|
|
83
|
+
}
|
|
84
|
+
/** The names that an expression at a position can read, besides the root `event` and the names of the host. */
|
|
85
|
+
interface WorkflowScope {
|
|
86
|
+
/** The names, for example `inputs` and `steps`. */
|
|
87
|
+
readonly names: ReadonlySet<string>;
|
|
88
|
+
/** The ids of the steps that the position can read: the earlier steps of the job. */
|
|
89
|
+
readonly steps?: ReadonlySet<string>;
|
|
90
|
+
/** The ids of the jobs that the position can read: the needs of the job. */
|
|
91
|
+
readonly needs?: ReadonlySet<string>;
|
|
92
|
+
/** The axes of the matrix of the job. `any` is a computed matrix. */
|
|
93
|
+
readonly matrix?: ReadonlySet<string> | "any" | undefined;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* This function gives the scope of an expression at a JSON path of a workflow document: the names that it can read.
|
|
97
|
+
* The check uses the same rules. A builder uses it to offer only the values that a position can read.
|
|
98
|
+
*
|
|
99
|
+
* @param doc - The workflow document.
|
|
100
|
+
* @param at - The JSON path of the expression, for example `["value", "jobs", "build", "value", "steps", 1, "value", "do"]`.
|
|
101
|
+
* @returns The scope, or `undefined` when the path is not in a workflow.
|
|
102
|
+
*/
|
|
103
|
+
export declare function scopeAt(doc: unknown, at: readonly Key$1[]): WorkflowScope | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* This function tells if a document is the test of the presence of a secret: `eq` or `ne` of a secret and the empty
|
|
106
|
+
* text. The test reads one bit, not the value. The host answers it.
|
|
107
|
+
*
|
|
108
|
+
* @param doc - The document.
|
|
109
|
+
* @returns `true` for a presence test.
|
|
110
|
+
*/
|
|
111
|
+
export declare function isPresenceTest(doc: unknown): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* This function checks a workflow document. It gives each problem with its JSON path, and it does not throw.
|
|
114
|
+
*
|
|
115
|
+
* - The kernel checks the kinds, the shapes and the operations (`check`).
|
|
116
|
+
* - The workflow rules check the ids, the needs of the jobs and their cycles, and each reference of each expression.
|
|
117
|
+
* - They also check the secrets, the cron lines and the grants of the workspace.
|
|
118
|
+
*
|
|
119
|
+
* @param doc - The document `{ type: "workflow", value }`.
|
|
120
|
+
* @param options - The machine, the grant check and the procedures.
|
|
121
|
+
* @returns The problems. An empty list means a good workflow.
|
|
122
|
+
*/
|
|
123
|
+
export declare function checkWorkflow(doc: unknown, options?: WorkflowCheckOptions): readonly WorkflowIssue[];
|
|
124
|
+
/** One node of the graph of a workflow. */
|
|
125
|
+
interface WorkflowNode {
|
|
126
|
+
readonly id: string;
|
|
127
|
+
readonly kind: "trigger" | "job" | "step";
|
|
128
|
+
/** The job of a step. */
|
|
129
|
+
readonly job?: string;
|
|
130
|
+
readonly label: string;
|
|
131
|
+
/** The JSON path of the node in the document. */
|
|
132
|
+
readonly at: readonly Key$1[];
|
|
133
|
+
}
|
|
134
|
+
/** One edge of the graph of a workflow. `needs` orders two jobs, `data` carries a value, `start` joins a trigger to a job. */
|
|
135
|
+
interface WorkflowEdge {
|
|
136
|
+
readonly from: string;
|
|
137
|
+
readonly to: string;
|
|
138
|
+
readonly kind: "needs" | "data" | "start" | "next";
|
|
139
|
+
}
|
|
140
|
+
/** The graph of a workflow: its nodes, its edges, and the layers of its jobs in the order of their needs. */
|
|
141
|
+
interface WorkflowGraph {
|
|
142
|
+
readonly nodes: readonly WorkflowNode[];
|
|
143
|
+
readonly edges: readonly WorkflowEdge[];
|
|
144
|
+
readonly layers: readonly (readonly string[])[];
|
|
145
|
+
}
|
|
146
|
+
/** This function gives the text of the path of a call, for example `git.clone`, or an empty text. */
|
|
147
|
+
export declare function callPath(doc: unknown): string;
|
|
148
|
+
/**
|
|
149
|
+
* This function gives the graph of a workflow from its document. The data edges come from the references of the
|
|
150
|
+
* expressions. Thus the graph shows each value that moves from a step or a job to another.
|
|
151
|
+
*
|
|
152
|
+
* @param doc - The workflow document.
|
|
153
|
+
* @returns The nodes, the edges, and the layers of the jobs.
|
|
154
|
+
*/
|
|
155
|
+
export declare function workflowGraph(doc: unknown): WorkflowGraph;
|
|
156
|
+
/**
|
|
157
|
+
* A sample workflow: a build on two versions of a runtime, then a release with a secret. The tests and the site use it.
|
|
158
|
+
*/
|
|
159
|
+
export declare const SAMPLE_WORKFLOW: {
|
|
160
|
+
readonly type: "workflow";
|
|
161
|
+
readonly value: {
|
|
162
|
+
readonly name: "Build and release";
|
|
163
|
+
readonly summary: "It builds the package on two versions, and it releases it when a person asks.";
|
|
164
|
+
readonly workspace: "technical";
|
|
165
|
+
readonly triggers: readonly [{
|
|
166
|
+
readonly type: readonly ["trigger", "event"];
|
|
167
|
+
readonly value: {
|
|
168
|
+
readonly event: "push";
|
|
169
|
+
};
|
|
170
|
+
}, {
|
|
171
|
+
readonly type: readonly ["trigger", "manual"];
|
|
172
|
+
readonly value: {
|
|
173
|
+
readonly summary: "Release now";
|
|
174
|
+
};
|
|
175
|
+
}];
|
|
176
|
+
readonly inputs: {
|
|
177
|
+
readonly channel: {
|
|
178
|
+
readonly type: "choice";
|
|
179
|
+
readonly options: readonly ["latest", "next"];
|
|
180
|
+
readonly default: "latest";
|
|
181
|
+
readonly description: "The channel of the release.";
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
readonly secrets: {
|
|
185
|
+
readonly REGISTRY_TOKEN: {
|
|
186
|
+
readonly description: "The token of the registry.";
|
|
187
|
+
readonly required: true;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
readonly jobs: {
|
|
191
|
+
readonly build: {
|
|
192
|
+
readonly type: "job";
|
|
193
|
+
readonly value: {
|
|
194
|
+
readonly name: "Build";
|
|
195
|
+
readonly matrix: {
|
|
196
|
+
readonly type: "matrix";
|
|
197
|
+
readonly value: {
|
|
198
|
+
readonly axes: {
|
|
199
|
+
readonly version: {
|
|
200
|
+
readonly type: "list";
|
|
201
|
+
readonly value: readonly [20, 22];
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
readonly steps: readonly [{
|
|
207
|
+
readonly type: "step";
|
|
208
|
+
readonly value: {
|
|
209
|
+
readonly id: "source";
|
|
210
|
+
readonly name: "Get the source";
|
|
211
|
+
readonly do: {
|
|
212
|
+
readonly type: readonly ["procedure", "git", "clone"];
|
|
213
|
+
readonly value: {
|
|
214
|
+
readonly branch: "main";
|
|
215
|
+
};
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
}, {
|
|
219
|
+
readonly type: "step";
|
|
220
|
+
readonly value: {
|
|
221
|
+
readonly id: "test";
|
|
222
|
+
readonly name: "Test";
|
|
223
|
+
readonly do: {
|
|
224
|
+
readonly type: readonly ["procedure", "pnpm", "test"];
|
|
225
|
+
readonly value: {
|
|
226
|
+
readonly cwd: {
|
|
227
|
+
readonly type: "ref";
|
|
228
|
+
readonly value: readonly ["names", "steps", "source", "folder"];
|
|
229
|
+
};
|
|
230
|
+
readonly version: {
|
|
231
|
+
readonly type: "ref";
|
|
232
|
+
readonly value: readonly ["names", "matrix", "version"];
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
}];
|
|
238
|
+
readonly outputs: {
|
|
239
|
+
readonly folder: {
|
|
240
|
+
readonly type: "ref";
|
|
241
|
+
readonly value: readonly ["names", "steps", "source", "folder"];
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
readonly release: {
|
|
247
|
+
readonly type: "job";
|
|
248
|
+
readonly value: {
|
|
249
|
+
readonly name: "Release";
|
|
250
|
+
readonly needs: readonly ["build"];
|
|
251
|
+
readonly if: {
|
|
252
|
+
readonly type: readonly ["ops", "eq"];
|
|
253
|
+
readonly value: readonly [{
|
|
254
|
+
readonly type: "ref";
|
|
255
|
+
readonly value: readonly ["event", "name"];
|
|
256
|
+
}, "manual"];
|
|
257
|
+
};
|
|
258
|
+
readonly steps: readonly [{
|
|
259
|
+
readonly type: "step";
|
|
260
|
+
readonly value: {
|
|
261
|
+
readonly id: "publish";
|
|
262
|
+
readonly name: "Publish";
|
|
263
|
+
readonly do: {
|
|
264
|
+
readonly type: readonly ["procedure", "npm", "publish"];
|
|
265
|
+
readonly value: {
|
|
266
|
+
readonly cwd: {
|
|
267
|
+
readonly type: "ref";
|
|
268
|
+
readonly value: readonly ["names", "needs", "build", "outputs", "folder"];
|
|
269
|
+
};
|
|
270
|
+
readonly tag: {
|
|
271
|
+
readonly type: "ref";
|
|
272
|
+
readonly value: readonly ["names", "inputs", "channel"];
|
|
273
|
+
};
|
|
274
|
+
readonly token: {
|
|
275
|
+
readonly type: "secret";
|
|
276
|
+
readonly value: "REGISTRY_TOKEN";
|
|
277
|
+
};
|
|
278
|
+
readonly note: {
|
|
279
|
+
readonly type: "template";
|
|
280
|
+
readonly value: readonly ["Release on the channel ", {
|
|
281
|
+
readonly type: "ref";
|
|
282
|
+
readonly value: readonly ["names", "inputs", "channel"];
|
|
283
|
+
}];
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
}];
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
/**
|
|
295
|
+
* The edits of a workflow document. Each edit gives a new document and keeps the original. A builder uses them on
|
|
296
|
+
* each click, then it checks the new document. The edits name no host: a host gives its own step documents.
|
|
297
|
+
*/
|
|
298
|
+
type Key = string | number;
|
|
299
|
+
/** The result of an edit that can refuse: the new document, or the reason of the refusal. */
|
|
300
|
+
type EditResult = {
|
|
301
|
+
readonly ok: true;
|
|
302
|
+
readonly doc: unknown;
|
|
303
|
+
} | {
|
|
304
|
+
readonly ok: false;
|
|
305
|
+
readonly why: string;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* This function reads the value at a JSON path. The path goes through records and lists, also through the `value` of
|
|
309
|
+
* an envelope, as the paths of the problems of `checkWorkflow` do.
|
|
310
|
+
*
|
|
311
|
+
* @param doc - The document.
|
|
312
|
+
* @param at - The JSON path.
|
|
313
|
+
* @returns The value, or `undefined`.
|
|
314
|
+
*/
|
|
315
|
+
export declare function getIn(doc: unknown, at: readonly Key[]): unknown;
|
|
316
|
+
/**
|
|
317
|
+
* This function gives a copy of a document with a new value at a JSON path. The value `undefined` removes the key, or
|
|
318
|
+
* the item of a list. A missing record on the path becomes an empty record.
|
|
319
|
+
*
|
|
320
|
+
* @param doc - The document.
|
|
321
|
+
* @param at - The JSON path.
|
|
322
|
+
* @param value - The new value.
|
|
323
|
+
* @returns The new document.
|
|
324
|
+
*/
|
|
325
|
+
export declare function setIn(doc: unknown, at: readonly Key[], value: unknown): unknown;
|
|
326
|
+
/** This function gives a new id from a base that no key of a record has: `base`, `base-2`, `base-3` and on. */
|
|
327
|
+
export declare function freeId(taken: Iterable<string>, base: string): string;
|
|
328
|
+
/**
|
|
329
|
+
* This function adds a job with the given steps.
|
|
330
|
+
*
|
|
331
|
+
* @param doc - The workflow document.
|
|
332
|
+
* @param base - The base of the id of the job.
|
|
333
|
+
* @param steps - The step documents of the job.
|
|
334
|
+
* @returns The new document and the id of the job.
|
|
335
|
+
*/
|
|
336
|
+
export declare function addJob(doc: unknown, base: string, steps: readonly unknown[]): {
|
|
337
|
+
readonly doc: unknown;
|
|
338
|
+
readonly id: string;
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* This function removes a job, and removes it from the needs of the other jobs. A reference to its outputs stays, and
|
|
342
|
+
* the check finds it.
|
|
343
|
+
*
|
|
344
|
+
* @param doc - The workflow document.
|
|
345
|
+
* @param id - The id of the job.
|
|
346
|
+
* @returns The new document.
|
|
347
|
+
*/
|
|
348
|
+
export declare function removeJob(doc: unknown, id: string): unknown;
|
|
349
|
+
/**
|
|
350
|
+
* This function gives a job a new id. The needs of the other jobs and each reference to the job change with it. The
|
|
351
|
+
* order of the jobs stays.
|
|
352
|
+
*
|
|
353
|
+
* @param doc - The workflow document.
|
|
354
|
+
* @param from - The id of the job.
|
|
355
|
+
* @param to - The new id.
|
|
356
|
+
* @returns The new document, or the reason of a refusal.
|
|
357
|
+
*/
|
|
358
|
+
export declare function renameJob(doc: unknown, from: string, to: string): EditResult;
|
|
359
|
+
/**
|
|
360
|
+
* This function adds a need to a job, or removes it. A need that makes a cycle is refused.
|
|
361
|
+
*
|
|
362
|
+
* @param doc - The workflow document.
|
|
363
|
+
* @param job - The id of the job.
|
|
364
|
+
* @param need - The id of the job that it needs.
|
|
365
|
+
* @param on - `true` to add the need, `false` to remove it.
|
|
366
|
+
* @returns The new document, or the reason of a refusal.
|
|
367
|
+
*/
|
|
368
|
+
export declare function setNeed(doc: unknown, job: string, need: string, on: boolean): EditResult;
|
|
369
|
+
/**
|
|
370
|
+
* This function adds a step to a job.
|
|
371
|
+
*
|
|
372
|
+
* @param doc - The workflow document.
|
|
373
|
+
* @param job - The id of the job.
|
|
374
|
+
* @param step - The step document.
|
|
375
|
+
* @param index - The place of the new step. The default is the end.
|
|
376
|
+
* @returns The new document.
|
|
377
|
+
*/
|
|
378
|
+
export declare function addStep(doc: unknown, job: string, step: unknown, index?: number): unknown;
|
|
379
|
+
/**
|
|
380
|
+
* This function moves a step of a job to another place in the job.
|
|
381
|
+
*
|
|
382
|
+
* @param doc - The workflow document.
|
|
383
|
+
* @param job - The id of the job.
|
|
384
|
+
* @param from - The place of the step.
|
|
385
|
+
* @param to - The new place.
|
|
386
|
+
* @returns The new document.
|
|
387
|
+
*/
|
|
388
|
+
export declare function moveStep(doc: unknown, job: string, from: number, to: number): unknown;
|
|
389
|
+
/** A value that an expression can read at a position: the reference document and its text. */
|
|
390
|
+
interface RefChoice {
|
|
391
|
+
/** The group of the value, for example `inputs` or `needs`. */
|
|
392
|
+
readonly group: string;
|
|
393
|
+
/** The text of the value, for example `needs.build.outputs.folder`. */
|
|
394
|
+
readonly label: string;
|
|
395
|
+
readonly doc: unknown;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* This function gives the values that an expression at a JSON path can read. These are the inputs, the env
|
|
399
|
+
* values, the matrix axes, the outputs of the needed jobs and the known reads of the earlier steps. The list follows
|
|
400
|
+
* the scope of `scopeAt`, thus each choice passes the check.
|
|
401
|
+
*
|
|
402
|
+
* @param doc - The workflow document.
|
|
403
|
+
* @param at - The JSON path of the expression.
|
|
404
|
+
* @param host - More choices of the host, for example its contexts.
|
|
405
|
+
* @returns The choices, in groups.
|
|
406
|
+
*/
|
|
407
|
+
export declare function refChoices(doc: unknown, at: readonly Key[], host?: readonly RefChoice[]): RefChoice[];
|
|
408
|
+
export type { Access, AccessAnswer, EditResult, ProcedureInfo, RefChoice, SecretRef, WorkflowCheckOptions, WorkflowEdge, WorkflowGraph, WorkflowIssue, WorkflowNode, WorkflowScope };
|
|
409
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["Key"],"sources":["../src/world.ts","../src/language.ts","../src/check.ts","../src/sample.ts","../src/edit.ts"],"mappings":";;qBAGa;;;;;qBAsIA,gBAAgB;;qBCtHhB;;UAGI;WACN;;;wBAIK,YAAY,iBAAiB,SAAS;;wBAqFtC,aAAa,MAAM,SAAS,0BAA0B,8BAAkC,+BAAmC;;qBA+E9H,mBAAmB;;qBAQnB,cAAc;;;;;;;;wBASX,mBAAmB,eAAe,aAAa;;;;;;;;;wBAY/C,oBAAoB,SAAS,mBAAmB,eAAe,aAAa;;UCxN3E;WACN;;WAEA;;WAEA,aAAaA;WACb;;;UAIM;WACN;WACA;;;;;;KAOC,UAAU,cAAc,0BAA0B,mBAAmB;;UAGhE;;WAEN;aAAwB;aAAmC;;;WAE3D;;;UAIM;;WAEN,UAAU;;WAEV,SAAS;;WAET,aAAa,SAAS,eAAe;;WAErC;;WAEA;;WAEA;;;UAWM;;WAEN,OAAO;;WAEP,QAAQ;;WAER,QAAQ;;WAER,SAAS;;;;;;;;;;wBAmDJ,QAAQ,cAAc,aAAaA,UAAQ;;;;;;;;wBAmC3C,eAAe;;;;;;;;;;;;wBA2Cf,cAAc,cAAc,UAAS,gCAAqC;;UAuJzE;WACN;WACA;;WAEA;WACA;;WAEA,aAAaA;;;UAIP;WACN;WACA;WACA;;;UAIM;WACN,gBAAgB;WAChB,gBAAgB;WAChB;;;wBAQK,SAAS;;;;;;;;wBAWT,cAAc,eAAe;;;;qBC9XhC;WACX;WACA;aACE;aACA;aACA;aACA;eACI;eAA4B;iBAAS;;;eACrC;eAA6B;iBAAS;;;aAE1C;eAAU;iBAAW;iBAAgB;iBAA6B;iBAAmB;;;aACrF;eAAW;iBAAkB;iBAA2C;;;aACxE;eACE;iBACE;iBACA;mBACE;mBACA;qBAAU;qBAAgB;uBAAS;yBAAQ;2BAAW;2BAAc;;;;;mBACpE;qBACI;qBAAc;uBAAS;uBAAc;uBAAwB;yBAAM;yBAAqC;2BAAS;;;;;qBAEjH;qBACA;uBACE;uBACA;uBACA;yBAAM;yBAAqC;2BAAS;6BAAO;6BAAa;;2BAAiD;6BAAW;6BAAa;;;;;;mBAIvJ;qBAAW;uBAAU;uBAAa;;;;;eAGtC;iBACE;iBACA;mBACE;mBACA;mBACA;qBAAM;qBAAqB;uBAAU;uBAAa;;;mBAClD;qBAEI;qBACA;uBACE;uBACA;uBACA;yBACE;yBACA;2BACE;6BAAO;6BAAa;;2BACpB;6BAAO;6BAAa;;2BACpB;6BAAS;6BAAgB;;2BACzB;6BAAQ;6BAAkB;+BAAqC;+BAAa;;;;;;;;;;;;;;;;KC7C3F;;KAIO;WAAwB;WAAmB;;WAA4B;WAAoB;;;;;;;;;;wBAavF,MAAM,cAAc,aAAa;;;;;;;;;;wBAmBjC,MAAM,cAAc,aAAa,OAAO;;wBAqBxC,OAAO,OAAO,kBAAkB;;;;;;;;;wBAchC,OAAO,cAAc,cAAc;WAAuC;WAAuB;;;;;;;;;;wBA0BjG,UAAU,cAAc;;;;;;;;;;wBAkBxB,UAAU,cAAc,cAAc,aAAa;;;;;;;;;;wBAsCnD,QAAQ,cAAc,aAAa,cAAc,cAAc;;;;;;;;;;wBAmB/D,QAAQ,cAAc,aAAa,eAAe;;;;;;;;;;wBAelD,SAAS,cAAc,aAAa,cAAc;;UASjD;;WAEN;;WAEA;WACA;;;;;;;;;;;;wBAkCK,WAAW,cAAc,aAAa,OAAO,gBAAe,cAAmB"}
|