@sfship/plugin-ship 1.0.0-beta.2
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.txt +206 -0
- package/README.md +164 -0
- package/lib/commands/ship/flow/eject.d.ts +15 -0
- package/lib/commands/ship/flow/eject.js +55 -0
- package/lib/commands/ship/flow/eject.js.map +1 -0
- package/lib/commands/ship/flow/info.d.ts +15 -0
- package/lib/commands/ship/flow/info.js +86 -0
- package/lib/commands/ship/flow/info.js.map +1 -0
- package/lib/commands/ship/flow/list.d.ts +12 -0
- package/lib/commands/ship/flow/list.js +51 -0
- package/lib/commands/ship/flow/list.js.map +1 -0
- package/lib/commands/ship/flow/run.d.ts +16 -0
- package/lib/commands/ship/flow/run.js +90 -0
- package/lib/commands/ship/flow/run.js.map +1 -0
- package/lib/commands/ship/project/init.d.ts +13 -0
- package/lib/commands/ship/project/init.js +81 -0
- package/lib/commands/ship/project/init.js.map +1 -0
- package/lib/commands/ship/service/connect/github.d.ts +12 -0
- package/lib/commands/ship/service/connect/github.js +47 -0
- package/lib/commands/ship/service/connect/github.js.map +1 -0
- package/lib/commands/ship/service/delete.d.ts +13 -0
- package/lib/commands/ship/service/delete.js +44 -0
- package/lib/commands/ship/service/delete.js.map +1 -0
- package/lib/commands/ship/service/info.d.ts +13 -0
- package/lib/commands/ship/service/info.js +51 -0
- package/lib/commands/ship/service/info.js.map +1 -0
- package/lib/commands/ship/service/list.d.ts +9 -0
- package/lib/commands/ship/service/list.js +55 -0
- package/lib/commands/ship/service/list.js.map +1 -0
- package/lib/commands/ship/task/info.d.ts +15 -0
- package/lib/commands/ship/task/info.js +75 -0
- package/lib/commands/ship/task/info.js.map +1 -0
- package/lib/commands/ship/task/list.d.ts +12 -0
- package/lib/commands/ship/task/list.js +45 -0
- package/lib/commands/ship/task/list.js.map +1 -0
- package/lib/commands/ship/task/run.d.ts +16 -0
- package/lib/commands/ship/task/run.js +72 -0
- package/lib/commands/ship/task/run.js.map +1 -0
- package/lib/core/config.dependency.schema.d.ts +24 -0
- package/lib/core/config.dependency.schema.js +34 -0
- package/lib/core/config.dependency.schema.js.map +1 -0
- package/lib/core/config.loader.d.ts +23 -0
- package/lib/core/config.loader.js +62 -0
- package/lib/core/config.loader.js.map +1 -0
- package/lib/core/config.ship.schema.d.ts +174 -0
- package/lib/core/config.ship.schema.js +67 -0
- package/lib/core/config.ship.schema.js.map +1 -0
- package/lib/core/error.d.ts +29 -0
- package/lib/core/error.js +59 -0
- package/lib/core/error.js.map +1 -0
- package/lib/core/file.d.ts +34 -0
- package/lib/core/file.js +123 -0
- package/lib/core/file.js.map +1 -0
- package/lib/core/flow.context.d.ts +22 -0
- package/lib/core/flow.context.js +4 -0
- package/lib/core/flow.context.js.map +1 -0
- package/lib/core/flow.definition.schema.d.ts +60 -0
- package/lib/core/flow.definition.schema.js +56 -0
- package/lib/core/flow.definition.schema.js.map +1 -0
- package/lib/core/flow.interpolate.d.ts +21 -0
- package/lib/core/flow.interpolate.js +64 -0
- package/lib/core/flow.interpolate.js.map +1 -0
- package/lib/core/flow.registry.d.ts +32 -0
- package/lib/core/flow.registry.js +99 -0
- package/lib/core/flow.registry.js.map +1 -0
- package/lib/core/flow.renderer.d.ts +51 -0
- package/lib/core/flow.renderer.js +137 -0
- package/lib/core/flow.renderer.js.map +1 -0
- package/lib/core/flow.runner.d.ts +13 -0
- package/lib/core/flow.runner.js +133 -0
- package/lib/core/flow.runner.js.map +1 -0
- package/lib/core/flow.store.d.ts +24 -0
- package/lib/core/flow.store.js +57 -0
- package/lib/core/flow.store.js.map +1 -0
- package/lib/core/flow.view.d.ts +20 -0
- package/lib/core/flow.view.js +77 -0
- package/lib/core/flow.view.js.map +1 -0
- package/lib/core/flows/create/package.yml +18 -0
- package/lib/core/flows/dependencies/lock.yml +4 -0
- package/lib/core/flows/deploy/beta.yml +38 -0
- package/lib/core/flows/deploy/dev.yml +26 -0
- package/lib/core/flows/deploy/feature.yml +56 -0
- package/lib/core/flows/deploy/qa.yml +51 -0
- package/lib/core/flows/deploy/regression.yml +60 -0
- package/lib/core/flows/deploy/release.yml +38 -0
- package/lib/core/flows/release/beta.yml +25 -0
- package/lib/core/flows/release/production.yml +16 -0
- package/lib/core/org.registry.d.ts +45 -0
- package/lib/core/org.registry.js +76 -0
- package/lib/core/org.registry.js.map +1 -0
- package/lib/core/org.scratch.schema.d.ts +44 -0
- package/lib/core/org.scratch.schema.js +62 -0
- package/lib/core/org.scratch.schema.js.map +1 -0
- package/lib/core/package.dependencies.d.ts +45 -0
- package/lib/core/package.dependencies.js +158 -0
- package/lib/core/package.dependencies.js.map +1 -0
- package/lib/core/package.installer.d.ts +13 -0
- package/lib/core/package.installer.js +60 -0
- package/lib/core/package.installer.js.map +1 -0
- package/lib/core/package.metadata.d.ts +6 -0
- package/lib/core/package.metadata.js +33 -0
- package/lib/core/package.metadata.js.map +1 -0
- package/lib/core/package.namespace.d.ts +10 -0
- package/lib/core/package.namespace.js +40 -0
- package/lib/core/package.namespace.js.map +1 -0
- package/lib/core/package.version.d.ts +42 -0
- package/lib/core/package.version.js +60 -0
- package/lib/core/package.version.js.map +1 -0
- package/lib/core/project.init.d.ts +11 -0
- package/lib/core/project.init.js +121 -0
- package/lib/core/project.init.js.map +1 -0
- package/lib/core/service.d.ts +45 -0
- package/lib/core/service.github.d.ts +98 -0
- package/lib/core/service.github.js +270 -0
- package/lib/core/service.github.js.map +1 -0
- package/lib/core/service.js +91 -0
- package/lib/core/service.js.map +1 -0
- package/lib/core/sfdx-project.d.ts +25 -0
- package/lib/core/sfdx-project.js +39 -0
- package/lib/core/sfdx-project.js.map +1 -0
- package/lib/core/stdout.d.ts +1 -0
- package/lib/core/stdout.js +27 -0
- package/lib/core/stdout.js.map +1 -0
- package/lib/core/task.definition.schema.d.ts +69 -0
- package/lib/core/task.definition.schema.js +33 -0
- package/lib/core/task.definition.schema.js.map +1 -0
- package/lib/core/task.output.d.ts +29 -0
- package/lib/core/task.output.js +39 -0
- package/lib/core/task.output.js.map +1 -0
- package/lib/core/task.param.d.ts +30 -0
- package/lib/core/task.param.js +141 -0
- package/lib/core/task.param.js.map +1 -0
- package/lib/core/task.param.schema.d.ts +22 -0
- package/lib/core/task.param.schema.js +26 -0
- package/lib/core/task.param.schema.js.map +1 -0
- package/lib/core/task.registry.d.ts +22 -0
- package/lib/core/task.registry.js +85 -0
- package/lib/core/task.registry.js.map +1 -0
- package/lib/core/task.view.d.ts +10 -0
- package/lib/core/task.view.js +25 -0
- package/lib/core/task.view.js.map +1 -0
- package/lib/core/tasks/apex/run/test.d.ts +25 -0
- package/lib/core/tasks/apex/run/test.js +85 -0
- package/lib/core/tasks/apex/run/test.js.map +1 -0
- package/lib/core/tasks/data/import/tree.d.ts +12 -0
- package/lib/core/tasks/data/import/tree.js +61 -0
- package/lib/core/tasks/data/import/tree.js.map +1 -0
- package/lib/core/tasks/git/release/create.d.ts +42 -0
- package/lib/core/tasks/git/release/create.js +197 -0
- package/lib/core/tasks/git/release/create.js.map +1 -0
- package/lib/core/tasks/git/release/fetch.d.ts +24 -0
- package/lib/core/tasks/git/release/fetch.js +93 -0
- package/lib/core/tasks/git/release/fetch.js.map +1 -0
- package/lib/core/tasks/git/repo/info.d.ts +12 -0
- package/lib/core/tasks/git/repo/info.js +47 -0
- package/lib/core/tasks/git/repo/info.js.map +1 -0
- package/lib/core/tasks/metadata/deploy.d.ts +12 -0
- package/lib/core/tasks/metadata/deploy.js +39 -0
- package/lib/core/tasks/metadata/deploy.js.map +1 -0
- package/lib/core/tasks/org/assign/permsets.d.ts +12 -0
- package/lib/core/tasks/org/assign/permsets.js +54 -0
- package/lib/core/tasks/org/assign/permsets.js.map +1 -0
- package/lib/core/tasks/org/create/scratch.d.ts +36 -0
- package/lib/core/tasks/org/create/scratch.js +127 -0
- package/lib/core/tasks/org/create/scratch.js.map +1 -0
- package/lib/core/tasks/org/delete/scratch.d.ts +12 -0
- package/lib/core/tasks/org/delete/scratch.js +10 -0
- package/lib/core/tasks/org/delete/scratch.js.map +1 -0
- package/lib/core/tasks/package/create.d.ts +36 -0
- package/lib/core/tasks/package/create.js +93 -0
- package/lib/core/tasks/package/create.js.map +1 -0
- package/lib/core/tasks/package/dependencies/lock.d.ts +6 -0
- package/lib/core/tasks/package/dependencies/lock.js +35 -0
- package/lib/core/tasks/package/dependencies/lock.js.map +1 -0
- package/lib/core/tasks/package/dependencies/verify.d.ts +6 -0
- package/lib/core/tasks/package/dependencies/verify.js +44 -0
- package/lib/core/tasks/package/dependencies/verify.js.map +1 -0
- package/lib/core/tasks/package/install/dependencies.d.ts +22 -0
- package/lib/core/tasks/package/install/dependencies.js +43 -0
- package/lib/core/tasks/package/install/dependencies.js.map +1 -0
- package/lib/core/tasks/package/install/index.d.ts +25 -0
- package/lib/core/tasks/package/install/index.js +37 -0
- package/lib/core/tasks/package/install/index.js.map +1 -0
- package/lib/core/tasks/package/version/create.d.ts +36 -0
- package/lib/core/tasks/package/version/create.js +133 -0
- package/lib/core/tasks/package/version/create.js.map +1 -0
- package/lib/core/tasks/package/version/promote.d.ts +30 -0
- package/lib/core/tasks/package/version/promote.js +79 -0
- package/lib/core/tasks/package/version/promote.js.map +1 -0
- package/lib/core/tasks/package/version/resolve-latest.d.ts +24 -0
- package/lib/core/tasks/package/version/resolve-latest.js +78 -0
- package/lib/core/tasks/package/version/resolve-latest.js.map +1 -0
- package/lib/core/tasks/package/version/resolve-next.d.ts +24 -0
- package/lib/core/tasks/package/version/resolve-next.js +49 -0
- package/lib/core/tasks/package/version/resolve-next.js.map +1 -0
- package/lib/core/tasks/project/deploy/start.d.ts +22 -0
- package/lib/core/tasks/project/deploy/start.js +117 -0
- package/lib/core/tasks/project/deploy/start.js.map +1 -0
- package/lib/core/tasks/project/reset/tracking.d.ts +25 -0
- package/lib/core/tasks/project/reset/tracking.js +32 -0
- package/lib/core/tasks/project/reset/tracking.js.map +1 -0
- package/lib/core/tasks/util/file/exists.d.ts +24 -0
- package/lib/core/tasks/util/file/exists.js +53 -0
- package/lib/core/tasks/util/file/exists.js.map +1 -0
- package/lib/core/tasks/util/file/find.d.ts +30 -0
- package/lib/core/tasks/util/file/find.js +70 -0
- package/lib/core/tasks/util/file/find.js.map +1 -0
- package/lib/core/tasks/util/log.d.ts +13 -0
- package/lib/core/tasks/util/log.js +10 -0
- package/lib/core/tasks/util/log.js.map +1 -0
- package/lib/core/templates/README.md +35 -0
- package/lib/core/tree.d.ts +7 -0
- package/lib/core/tree.js +42 -0
- package/lib/core/tree.js.map +1 -0
- package/messages/service.connect.github.md +16 -0
- package/messages/ship.flow.eject.md +21 -0
- package/messages/ship.flow.info.md +21 -0
- package/messages/ship.flow.list.md +15 -0
- package/messages/ship.flow.run.md +23 -0
- package/messages/ship.project.init.md +23 -0
- package/messages/ship.service.delete.md +19 -0
- package/messages/ship.service.info.md +19 -0
- package/messages/ship.service.list.md +11 -0
- package/messages/ship.task.info.md +25 -0
- package/messages/ship.task.list.md +15 -0
- package/messages/ship.task.run.md +29 -0
- package/oclif.lock +10313 -0
- package/oclif.manifest.json +707 -0
- package/package.json +254 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
import { StandardColors } from '@salesforce/sf-plugins-core';
|
|
15
|
+
import { ExpectedError } from './error.js';
|
|
16
|
+
import { formatFlowPlan, formatStepHeading, formatFlowSummary } from './flow.view.js';
|
|
17
|
+
/**
|
|
18
|
+
* Renders a flow run as plain sequential output: a plan banner up front, a
|
|
19
|
+
* heading before each step, the step's own (and any subcommand's) output
|
|
20
|
+
* flowing untouched, and a result summary at the end.
|
|
21
|
+
*
|
|
22
|
+
* All formatting lives in the `flow.view` module so a flow looks the same
|
|
23
|
+
* whether it runs here or is inspected via `ship flow info`.
|
|
24
|
+
*/
|
|
25
|
+
export class FlowRenderer {
|
|
26
|
+
flowName;
|
|
27
|
+
mainSteps;
|
|
28
|
+
finallySteps;
|
|
29
|
+
write;
|
|
30
|
+
stepsById = new Map();
|
|
31
|
+
order = [];
|
|
32
|
+
completed = new Set();
|
|
33
|
+
failed = new Set();
|
|
34
|
+
skipped = new Set();
|
|
35
|
+
ignored = new Map();
|
|
36
|
+
currentStep = null;
|
|
37
|
+
constructor(flowName, mainSteps, finallySteps, ctx, out = process.stdout) {
|
|
38
|
+
this.flowName = flowName;
|
|
39
|
+
this.mainSteps = mainSteps;
|
|
40
|
+
this.finallySteps = finallySteps;
|
|
41
|
+
this.write = out.write.bind(out);
|
|
42
|
+
for (const [id, step] of [...mainSteps, ...finallySteps]) {
|
|
43
|
+
this.stepsById.set(id, step);
|
|
44
|
+
this.order.push(id);
|
|
45
|
+
}
|
|
46
|
+
// The renderer owns presentation, so it takes over the context logger to
|
|
47
|
+
// timestamp lines and prefix them with the step that emitted them.
|
|
48
|
+
// eslint-disable-next-line no-param-reassign
|
|
49
|
+
ctx.log = (message) => this.logLine(message);
|
|
50
|
+
}
|
|
51
|
+
/** The step currently executing, or null between steps. */
|
|
52
|
+
get activeStep() {
|
|
53
|
+
return this.currentStep;
|
|
54
|
+
}
|
|
55
|
+
get outcome() {
|
|
56
|
+
return { completed: this.completed, failed: this.failed, skipped: this.skipped, ignored: this.ignored };
|
|
57
|
+
}
|
|
58
|
+
static timestamp() {
|
|
59
|
+
const now = new Date();
|
|
60
|
+
const h = String(now.getHours()).padStart(2, '0');
|
|
61
|
+
const m = String(now.getMinutes()).padStart(2, '0');
|
|
62
|
+
const s = String(now.getSeconds()).padStart(2, '0');
|
|
63
|
+
return `${h}:${m}:${s}`;
|
|
64
|
+
}
|
|
65
|
+
/** Prints the plan banner at the start of the run. */
|
|
66
|
+
start() {
|
|
67
|
+
this.write(`${formatFlowPlan(this.flowName, this.mainSteps, this.finallySteps)}\n`);
|
|
68
|
+
}
|
|
69
|
+
/** Prints the heading for a step that is about to run. */
|
|
70
|
+
stepStart(stepId) {
|
|
71
|
+
this.currentStep = stepId;
|
|
72
|
+
const step = this.stepsById.get(stepId);
|
|
73
|
+
if (!step)
|
|
74
|
+
return;
|
|
75
|
+
const position = this.order.indexOf(stepId) + 1;
|
|
76
|
+
this.write(`${formatStepHeading(position, this.order.length, stepId, step)}\n`);
|
|
77
|
+
}
|
|
78
|
+
stepComplete(stepId) {
|
|
79
|
+
this.completed.add(stepId);
|
|
80
|
+
this.currentStep = null;
|
|
81
|
+
this.write(`${StandardColors.success('✓')} ${stepId}\n`);
|
|
82
|
+
}
|
|
83
|
+
stepFailed(stepId) {
|
|
84
|
+
this.failed.add(stepId);
|
|
85
|
+
this.currentStep = null;
|
|
86
|
+
// The error itself is reported once, with context, in flowFailed().
|
|
87
|
+
this.write(`${StandardColors.error('✗')} ${stepId}\n`);
|
|
88
|
+
}
|
|
89
|
+
stepSkipped(stepId) {
|
|
90
|
+
this.skipped.add(stepId);
|
|
91
|
+
this.write(`${StandardColors.info('—')} ${stepId} (skipped)\n`);
|
|
92
|
+
}
|
|
93
|
+
stepIgnored(stepId, err) {
|
|
94
|
+
this.ignored.set(stepId, err.message);
|
|
95
|
+
this.currentStep = null;
|
|
96
|
+
this.write(`${StandardColors.warning('⚠')} ${stepId} (ignored: ${err.message})\n`);
|
|
97
|
+
}
|
|
98
|
+
/** Reports a flow that could not start (e.g. invalid flow params). */
|
|
99
|
+
failedBeforeStart(err) {
|
|
100
|
+
this.write(`\n${StandardColors.error(`✗ Flow "${this.flowName}" could not start`)}\n\n`);
|
|
101
|
+
for (const line of err.message.split('\n'))
|
|
102
|
+
this.write(` ${line}\n`);
|
|
103
|
+
this.write('\n');
|
|
104
|
+
}
|
|
105
|
+
/** Reports a hard failure: prints the summary, then the error (and stack for unexpected errors). */
|
|
106
|
+
flowFailed(stepId, err) {
|
|
107
|
+
this.write(`${formatFlowSummary(this.mainSteps, this.finallySteps, this.outcome)}\n`);
|
|
108
|
+
this.write(`\n${StandardColors.error(`✗ Flow "${this.flowName}" failed at step "${stepId}"`)}\n\n`);
|
|
109
|
+
for (const line of err.message.split('\n'))
|
|
110
|
+
this.write(` ${line}\n`);
|
|
111
|
+
if (!(err instanceof ExpectedError) && err.stack) {
|
|
112
|
+
this.write('\n');
|
|
113
|
+
for (const line of err.stack.split('\n').slice(1))
|
|
114
|
+
this.write(` ${line.trim()}\n`);
|
|
115
|
+
}
|
|
116
|
+
this.write('\n');
|
|
117
|
+
}
|
|
118
|
+
/** Prints the summary and the success banner. */
|
|
119
|
+
success() {
|
|
120
|
+
this.write(`${formatFlowSummary(this.mainSteps, this.finallySteps, this.outcome)}\n`);
|
|
121
|
+
this.write(`\n${StandardColors.success(`✓ Flow "${this.flowName}" finished successfully!`)}\n\n`);
|
|
122
|
+
}
|
|
123
|
+
/** Handles a user interrupt (Ctrl+C): marks the active step failed and reports it. */
|
|
124
|
+
interrupt() {
|
|
125
|
+
const step = this.currentStep;
|
|
126
|
+
if (step)
|
|
127
|
+
this.failed.add(step);
|
|
128
|
+
this.currentStep = null;
|
|
129
|
+
this.flowFailed(step ?? '?', new ExpectedError('Interrupted by user.'));
|
|
130
|
+
}
|
|
131
|
+
logLine(message) {
|
|
132
|
+
const ts = StandardColors.info(FlowRenderer.timestamp());
|
|
133
|
+
const prefix = this.currentStep ? `${StandardColors.info(`[${this.currentStep}]`)} ` : '';
|
|
134
|
+
this.write(`${ts} ${prefix}${message}\n`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=flow.renderer.js.map
|
|
@@ -0,0 +1 @@
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IACnB,CAAC;IAED,iDAAiD;IAC1C,OAAO;QACZ,IAAI,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtF,IAAI,CAAC,KAAK,CAAC,KAAK,cAAc,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,QAAQ,0BAA0B,CAAC,MAAM,CAAC,CAAC;IACpG,CAAC;IAED,sFAAsF;IAC/E,SAAS;QACd,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;QAC9B,IAAI,IAAI;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,GAAG,EAAE,IAAI,aAAa,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC1E,CAAC;IAEO,OAAO,CAAC,OAAe;QAC7B,MAAM,EAAE,GAAG,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1F,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,MAAM,GAAG,OAAO,IAAI,CAAC,CAAC;IAC5C,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FlowContext } from './flow.context.js';
|
|
2
|
+
import { FlowDefinition } from './flow.definition.schema.js';
|
|
3
|
+
import { FlowRenderer } from './flow.renderer.js';
|
|
4
|
+
/**
|
|
5
|
+
* Handles an error that reaches the process while a flow owns the renderer.
|
|
6
|
+
*
|
|
7
|
+
* oclif converts Ctrl+C into an EEXIT error; we take over (the renderer is ours
|
|
8
|
+
* now) so an interrupt prints a clean failure instead of a raw stack, pass any
|
|
9
|
+
* other oclif exit code through unchanged, and route unexpected crashes back
|
|
10
|
+
* through the renderer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function handleUncaught(renderer: FlowRenderer, err: unknown): void;
|
|
13
|
+
export declare function runFlow(flowName: string, flow: FlowDefinition, context: FlowContext): Promise<void>;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { validateParams } from './task.param.js';
|
|
2
|
+
import { TaskRegistry } from './task.registry.js';
|
|
3
|
+
import { Store } from './flow.store.js';
|
|
4
|
+
import { FlowRenderer } from './flow.renderer.js';
|
|
5
|
+
import { asError, ExpectedError } from './error.js';
|
|
6
|
+
import { resolvePureToken } from './flow.interpolate.js';
|
|
7
|
+
function resolveConditionValue(condition, context) {
|
|
8
|
+
const resolved = resolvePureToken(condition.value, context);
|
|
9
|
+
return resolved !== undefined ? resolved : condition.value;
|
|
10
|
+
}
|
|
11
|
+
function rootMessage(err) {
|
|
12
|
+
if (err.message)
|
|
13
|
+
return err.message;
|
|
14
|
+
return err.cause instanceof Error ? rootMessage(err.cause) : err.toString();
|
|
15
|
+
}
|
|
16
|
+
function coerce(val) {
|
|
17
|
+
return typeof val === 'string' && Number.isFinite(Number(val)) ? Number(val) : val;
|
|
18
|
+
}
|
|
19
|
+
function evaluateIf(condition, context) {
|
|
20
|
+
const resolved = resolveConditionValue(condition, context);
|
|
21
|
+
return condition.equals !== undefined ? resolved === condition.equals : Boolean(coerce(resolved));
|
|
22
|
+
}
|
|
23
|
+
function evaluateIfNot(condition, context) {
|
|
24
|
+
const resolved = resolveConditionValue(condition, context);
|
|
25
|
+
return condition.equals !== undefined ? resolved !== condition.equals : !coerce(resolved);
|
|
26
|
+
}
|
|
27
|
+
async function runSteps(stepEntries, flowName, context, store, taskRunner, renderer, ignoreAllFailures = false) {
|
|
28
|
+
for (const [stepId, step] of stepEntries) {
|
|
29
|
+
const interpolationContext = {
|
|
30
|
+
params: context.params,
|
|
31
|
+
steps: store.getSteps(),
|
|
32
|
+
config: context.config,
|
|
33
|
+
flow: { hasFailures: context.hasFailures },
|
|
34
|
+
};
|
|
35
|
+
if (step.if && !evaluateIf(step.if, interpolationContext)) {
|
|
36
|
+
renderer.stepSkipped(stepId);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (step['if-not'] && !evaluateIfNot(step['if-not'], interpolationContext)) {
|
|
40
|
+
renderer.stepSkipped(stepId);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
renderer.stepStart(stepId);
|
|
44
|
+
try {
|
|
45
|
+
// eslint-disable-next-line no-await-in-loop
|
|
46
|
+
const task = await taskRunner.resolveTask(step.task);
|
|
47
|
+
const interpolated = store.resolveParams(step.params ?? {}, interpolationContext);
|
|
48
|
+
const params = validateParams(interpolated, task.params);
|
|
49
|
+
const output = store.getTaskOutput(stepId);
|
|
50
|
+
// eslint-disable-next-line no-await-in-loop
|
|
51
|
+
await task.run({ flow: context, params, output });
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
const error = asError(err);
|
|
55
|
+
if (step['ignore-failure'] ?? ignoreAllFailures) {
|
|
56
|
+
renderer.stepIgnored(stepId, error);
|
|
57
|
+
store.set(stepId, 'failed', true);
|
|
58
|
+
store.set(stepId, 'error', error.message);
|
|
59
|
+
// eslint-disable-next-line no-param-reassign
|
|
60
|
+
context.hasFailures = true;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
renderer.stepFailed(stepId);
|
|
64
|
+
store.set(stepId, 'failed', true);
|
|
65
|
+
store.set(stepId, 'error', error.message);
|
|
66
|
+
// eslint-disable-next-line no-param-reassign
|
|
67
|
+
context.hasFailures = true;
|
|
68
|
+
error.message =
|
|
69
|
+
error instanceof ExpectedError
|
|
70
|
+
? `${error.message}\n(step "${stepId}" in flow "${flowName}")`
|
|
71
|
+
: `Step "${stepId}" in flow "${flowName}" failed: ${rootMessage(error)}`;
|
|
72
|
+
return { stepId, error };
|
|
73
|
+
}
|
|
74
|
+
renderer.stepComplete(stepId);
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Handles an error that reaches the process while a flow owns the renderer.
|
|
80
|
+
*
|
|
81
|
+
* oclif converts Ctrl+C into an EEXIT error; we take over (the renderer is ours
|
|
82
|
+
* now) so an interrupt prints a clean failure instead of a raw stack, pass any
|
|
83
|
+
* other oclif exit code through unchanged, and route unexpected crashes back
|
|
84
|
+
* through the renderer.
|
|
85
|
+
*/
|
|
86
|
+
export function handleUncaught(renderer, err) {
|
|
87
|
+
const e = asError(err);
|
|
88
|
+
if (e.code === 'EEXIT') {
|
|
89
|
+
const exitCode = e.oclif?.exit ?? 1;
|
|
90
|
+
if (exitCode === 130) {
|
|
91
|
+
process.stdout.write = () => true;
|
|
92
|
+
process.stderr.write = () => true;
|
|
93
|
+
renderer.interrupt();
|
|
94
|
+
}
|
|
95
|
+
process.exit(exitCode);
|
|
96
|
+
}
|
|
97
|
+
renderer.flowFailed(renderer.activeStep ?? '?', e);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
export async function runFlow(flowName, flow, context) {
|
|
101
|
+
const mainSteps = Object.entries(flow.steps);
|
|
102
|
+
const finallySteps = Object.entries(flow.finally ?? {});
|
|
103
|
+
const renderer = new FlowRenderer(flowName, mainSteps, finallySteps, context);
|
|
104
|
+
if (flow.params?.length) {
|
|
105
|
+
try {
|
|
106
|
+
// eslint-disable-next-line no-param-reassign
|
|
107
|
+
context.params = validateParams(context.params, flow.params);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
renderer.failedBeforeStart(asError(err));
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Take over uncaught errors while we own the renderer (see handleUncaught).
|
|
115
|
+
const onUncaught = handleUncaught.bind(null, renderer);
|
|
116
|
+
process.once('uncaughtException', onUncaught);
|
|
117
|
+
try {
|
|
118
|
+
renderer.start();
|
|
119
|
+
const store = new Store(flow.steps);
|
|
120
|
+
const taskRunner = new TaskRegistry(context.shipDir);
|
|
121
|
+
const hardError = await runSteps(mainSteps, flowName, context, store, taskRunner, renderer);
|
|
122
|
+
await runSteps(finallySteps, flowName, context, store, taskRunner, renderer, true);
|
|
123
|
+
if (hardError) {
|
|
124
|
+
renderer.flowFailed(hardError.stepId, hardError.error);
|
|
125
|
+
throw new ExpectedError(hardError.error.message);
|
|
126
|
+
}
|
|
127
|
+
renderer.success();
|
|
128
|
+
}
|
|
129
|
+
finally {
|
|
130
|
+
process.removeListener('uncaughtException', onUncaught);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=flow.runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.runner.js","sourceRoot":"","sources":["../../src/core/flow.runner.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAKzD,SAAS,qBAAqB,CAAC,SAAwB,EAAE,OAAgC;IACvF,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5D,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC;AAC7D,CAAC;AAED,SAAS,WAAW,CAAC,GAAU;IAC7B,IAAI,GAAG,CAAC,O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UAAU,CAAC,CAAC;IAE9C,IAAI,CAAC;QACH,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEjB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,MAAM,UAAU,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAErD,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC5F,MAAM,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEnF,IAAI,SAAS,EAAE,CAAC;YACd,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;YACvD,MAAM,IAAI,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC;QACD,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,cAAc,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TaskOutput } from './task.output.js';
|
|
2
|
+
/**
|
|
3
|
+
* Holds all step outputs for a flow run and owns param interpolation.
|
|
4
|
+
* Internal to the flow runner — not exposed to tasks directly.
|
|
5
|
+
* Tasks interact with outputs only through `TaskOutput` instances.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Store {
|
|
8
|
+
private readonly data;
|
|
9
|
+
/** Initializes the store, registering a namespace for each step in the flow. */
|
|
10
|
+
constructor(steps?: Record<string, unknown>);
|
|
11
|
+
/** Returns the `TaskOutput` for a step. */
|
|
12
|
+
getTaskOutput(stepId: string): TaskOutput;
|
|
13
|
+
/** Writes a value into a step's namespace. Used by `TaskOutput.set`. */
|
|
14
|
+
set(stepId: string, key: string, value: unknown): void;
|
|
15
|
+
/** Reads a value from a step's namespace. Used by `TaskOutput.get`. */
|
|
16
|
+
get(stepId: string, key: string): unknown;
|
|
17
|
+
/** Returns all step outputs as a plain nested object, keyed by step ID. */
|
|
18
|
+
getSteps(): Record<string, Record<string, unknown>>;
|
|
19
|
+
/**
|
|
20
|
+
* Interpolates all `${{ path }}` tokens in a raw params object using the provided context.
|
|
21
|
+
* The caller is responsible for building the context (e.g. `{ params, steps }`).
|
|
22
|
+
*/
|
|
23
|
+
resolveParams(rawParams: Record<string, unknown>, context: Record<string, unknown>): Record<string, unknown>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
import { TaskOutput } from './task.output.js';
|
|
15
|
+
import { interpolate } from './flow.interpolate.js';
|
|
16
|
+
/**
|
|
17
|
+
* Holds all step outputs for a flow run and owns param interpolation.
|
|
18
|
+
* Internal to the flow runner — not exposed to tasks directly.
|
|
19
|
+
* Tasks interact with outputs only through `TaskOutput` instances.
|
|
20
|
+
*/
|
|
21
|
+
export class Store {
|
|
22
|
+
data = new Map();
|
|
23
|
+
/** Initializes the store, registering a namespace for each step in the flow. */
|
|
24
|
+
constructor(steps) {
|
|
25
|
+
for (const stepId of Object.keys(steps ?? {})) {
|
|
26
|
+
this.data.set(stepId, new Map());
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** Returns the `TaskOutput` for a step. */
|
|
30
|
+
getTaskOutput(stepId) {
|
|
31
|
+
if (!this.data.has(stepId)) {
|
|
32
|
+
this.data.set(stepId, new Map());
|
|
33
|
+
}
|
|
34
|
+
return new TaskOutput(stepId, this);
|
|
35
|
+
}
|
|
36
|
+
/** Writes a value into a step's namespace. Used by `TaskOutput.set`. */
|
|
37
|
+
set(stepId, key, value) {
|
|
38
|
+
this.data.get(stepId)?.set(key, value);
|
|
39
|
+
}
|
|
40
|
+
/** Reads a value from a step's namespace. Used by `TaskOutput.get`. */
|
|
41
|
+
get(stepId, key) {
|
|
42
|
+
return this.data.get(stepId)?.get(key);
|
|
43
|
+
}
|
|
44
|
+
/** Returns all step outputs as a plain nested object, keyed by step ID. */
|
|
45
|
+
getSteps() {
|
|
46
|
+
return Object.fromEntries([...this.data.keys()].map((id) => [id, Object.fromEntries(this.data.get(id))]));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Interpolates all `${{ path }}` tokens in a raw params object using the provided context.
|
|
50
|
+
* The caller is responsible for building the context (e.g. `{ params, steps }`).
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line class-methods-use-this
|
|
53
|
+
resolveParams(rawParams, context) {
|
|
54
|
+
return Object.fromEntries(Object.entries(rawParams).map(([k, v]) => [k, interpolate(v, context)]));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=flow.store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.store.js","sourceRoot":"","sources":["../../src/core/flow.store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;GAIG;AACH,MAAM,OAAO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AAa,CAAC,SAAkC,EAAE,OAAgC;QACvF,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACrG,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FlowStep } from './flow.definition.schema.js';
|
|
2
|
+
/** The terminal state of every step in a finished (or failed) flow. */
|
|
3
|
+
export type FlowOutcome = {
|
|
4
|
+
completed: ReadonlySet<string>;
|
|
5
|
+
failed: ReadonlySet<string>;
|
|
6
|
+
skipped: ReadonlySet<string>;
|
|
7
|
+
ignored: ReadonlyMap<string, string>;
|
|
8
|
+
};
|
|
9
|
+
type Steps = ReadonlyArray<readonly [string, FlowStep]>;
|
|
10
|
+
/**
|
|
11
|
+
* UX formatted flow name + description
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatFlowPreview(flowName: string, description?: string): string;
|
|
14
|
+
/** The plan banner printed once when a flow starts. */
|
|
15
|
+
export declare function formatFlowPlan(flowName: string, mainSteps: Steps, finallySteps: Steps): string;
|
|
16
|
+
/** The heading printed when a step begins. */
|
|
17
|
+
export declare function formatStepHeading(position: number, total: number, stepId: string, step: FlowStep): string;
|
|
18
|
+
/** The result summary printed when a flow ends, success or failure. */
|
|
19
|
+
export declare function formatFlowSummary(mainSteps: Steps, finallySteps: Steps, outcome: FlowOutcome): string;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
* you may not use this file except in compliance with the License.
|
|
4
|
+
* You may obtain a copy of the License at
|
|
5
|
+
*
|
|
6
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
*
|
|
8
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
* See the License for the specific language governing permissions and
|
|
12
|
+
* limitations under the License.
|
|
13
|
+
*/
|
|
14
|
+
import { StandardColors } from '@salesforce/sf-plugins-core';
|
|
15
|
+
function stepAnnotations(step) {
|
|
16
|
+
const tags = [];
|
|
17
|
+
if (step.if)
|
|
18
|
+
tags.push('if');
|
|
19
|
+
if (step['if-not'])
|
|
20
|
+
tags.push('if-not');
|
|
21
|
+
if (step['ignore-failure'])
|
|
22
|
+
tags.push('ignore-failure');
|
|
23
|
+
return tags.length ? ` ${StandardColors.info(`[${tags.join(', ')}]`)}` : '';
|
|
24
|
+
}
|
|
25
|
+
function planLines(steps, startIndex) {
|
|
26
|
+
return steps.map(([id, step], i) => ` ${String(startIndex + i + 1).padStart(2)}. ${id.padEnd(24)} ${StandardColors.info('→')} ${step.task}${stepAnnotations(step)}`);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* UX formatted flow name + description
|
|
30
|
+
*/
|
|
31
|
+
export function formatFlowPreview(flowName, description) {
|
|
32
|
+
const header = `${StandardColors.info('Flow:')} ${StandardColors.success(flowName)}`;
|
|
33
|
+
return description ? `${header}\n${StandardColors.info('Description:')} ${description}` : header;
|
|
34
|
+
}
|
|
35
|
+
/** The plan banner printed once when a flow starts. */
|
|
36
|
+
export function formatFlowPlan(flowName, mainSteps, finallySteps) {
|
|
37
|
+
const lines = [
|
|
38
|
+
`${StandardColors.info('Flow:')} ${StandardColors.success(flowName)}`,
|
|
39
|
+
'',
|
|
40
|
+
StandardColors.info('Steps'),
|
|
41
|
+
...planLines(mainSteps, 0),
|
|
42
|
+
];
|
|
43
|
+
if (finallySteps.length > 0) {
|
|
44
|
+
lines.push('', StandardColors.info('Finally'), ...planLines(finallySteps, mainSteps.length));
|
|
45
|
+
}
|
|
46
|
+
return lines.join('\n');
|
|
47
|
+
}
|
|
48
|
+
/** The heading printed when a step begins. */
|
|
49
|
+
export function formatStepHeading(position, total, stepId, step) {
|
|
50
|
+
return `\n${StandardColors.info(`→ Task [${position}/${total}]`)} ${StandardColors.success(stepId)} ${StandardColors.info('·')} ${step.task}`;
|
|
51
|
+
}
|
|
52
|
+
function outcomeLine(stepId, outcome) {
|
|
53
|
+
if (outcome.failed.has(stepId))
|
|
54
|
+
return ` ${StandardColors.error('✗')} ${stepId}`;
|
|
55
|
+
if (outcome.ignored.has(stepId)) {
|
|
56
|
+
return ` ${StandardColors.warning('⚠')} ${stepId} ${StandardColors.warning(`(ignored: ${outcome.ignored.get(stepId) ?? ''})`)}`;
|
|
57
|
+
}
|
|
58
|
+
if (outcome.completed.has(stepId))
|
|
59
|
+
return ` ${StandardColors.success('✓')} ${stepId}`;
|
|
60
|
+
if (outcome.skipped.has(stepId))
|
|
61
|
+
return ` ${StandardColors.info('—')} ${stepId} (skipped)`;
|
|
62
|
+
return ` ${StandardColors.info('○')} ${stepId} (not run)`;
|
|
63
|
+
}
|
|
64
|
+
/** The result summary printed when a flow ends, success or failure. */
|
|
65
|
+
export function formatFlowSummary(mainSteps, finallySteps, outcome) {
|
|
66
|
+
const all = [...mainSteps, ...finallySteps];
|
|
67
|
+
const counts = [
|
|
68
|
+
StandardColors.success(`${outcome.completed.size} passed`),
|
|
69
|
+
outcome.failed.size ? StandardColors.error(`${outcome.failed.size} failed`) : `${outcome.failed.size} failed`,
|
|
70
|
+
`${outcome.skipped.size} skipped`,
|
|
71
|
+
outcome.ignored.size
|
|
72
|
+
? StandardColors.warning(`${outcome.ignored.size} ignored`)
|
|
73
|
+
: `${outcome.ignored.size} ignored`,
|
|
74
|
+
].join(' · ');
|
|
75
|
+
return ['', StandardColors.info('Flow Summary'), ...all.map(([id]) => outcomeLine(id, outcome)), '', counts].join('\n');
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=flow.view.js.map
|
|
@@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C,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC;YAC3D,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,UAAU;KACtC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACd,OAAO,CAAC,EAAE,EAAE,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,IAAI,CAC/G,IAAI,CACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
description: Register the 2GP package on the Dev Hub and write its 0Ho into sfdx-project.json. Run once per project before any release or deploy/feature flow.
|
|
2
|
+
params:
|
|
3
|
+
- name: path
|
|
4
|
+
type: string
|
|
5
|
+
required: false
|
|
6
|
+
default: force-app
|
|
7
|
+
description: Path to the package source directory.
|
|
8
|
+
- name: target-dev-hub
|
|
9
|
+
type: string
|
|
10
|
+
required: false
|
|
11
|
+
description: Dev hub alias or username. Defaults to the SF CLI default target-dev-hub.
|
|
12
|
+
steps:
|
|
13
|
+
create-package:
|
|
14
|
+
task: package/create
|
|
15
|
+
params:
|
|
16
|
+
package-type: ${{ config.project.package.type }}
|
|
17
|
+
path: ${{ params.path }}
|
|
18
|
+
target-dev-hub: ${{ params.target-dev-hub }}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
description: Install the latest beta into a fresh scratch org and run Apex tests.
|
|
2
|
+
steps:
|
|
3
|
+
create-org:
|
|
4
|
+
task: org/create/scratch
|
|
5
|
+
params:
|
|
6
|
+
scratch-def: beta
|
|
7
|
+
duration: 1
|
|
8
|
+
no-namespace: true
|
|
9
|
+
find-beta:
|
|
10
|
+
task: git/release/fetch
|
|
11
|
+
params:
|
|
12
|
+
prerelease: true
|
|
13
|
+
update-dependencies:
|
|
14
|
+
task: package/install/dependencies
|
|
15
|
+
params:
|
|
16
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
17
|
+
install:
|
|
18
|
+
task: package/install
|
|
19
|
+
params:
|
|
20
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
21
|
+
version-id: ${{ steps.find-beta.version-id }}
|
|
22
|
+
assign-permsets:
|
|
23
|
+
task: org/assign/permsets
|
|
24
|
+
params:
|
|
25
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
26
|
+
find-test-classes:
|
|
27
|
+
task: util/file/find
|
|
28
|
+
params:
|
|
29
|
+
path: force-app/main/default/classes
|
|
30
|
+
pattern: ${{ config.project.package.testPattern }}
|
|
31
|
+
run-tests:
|
|
32
|
+
if:
|
|
33
|
+
value: ${{ steps.find-test-classes.count }}
|
|
34
|
+
task: apex/run/test
|
|
35
|
+
params:
|
|
36
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
37
|
+
class-names: ${{ steps.find-test-classes.files }}
|
|
38
|
+
namespace: ${{ config.project.package.namespace }}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
description: Set up a scratch org as a development environment for unmanaged metadata.
|
|
2
|
+
steps:
|
|
3
|
+
create-org:
|
|
4
|
+
task: org/create/scratch
|
|
5
|
+
params:
|
|
6
|
+
scratch-def: dev
|
|
7
|
+
duration: 30
|
|
8
|
+
update-dependencies:
|
|
9
|
+
task: package/install/dependencies
|
|
10
|
+
params:
|
|
11
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
12
|
+
deploy:
|
|
13
|
+
task: project/deploy/start
|
|
14
|
+
params:
|
|
15
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
16
|
+
assign-permsets:
|
|
17
|
+
task: org/assign/permsets
|
|
18
|
+
params:
|
|
19
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
20
|
+
load-data:
|
|
21
|
+
task: data/import/tree
|
|
22
|
+
if:
|
|
23
|
+
value: ${{ steps.create-org.created }}
|
|
24
|
+
equals: true
|
|
25
|
+
params:
|
|
26
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
description: Build a managed package version, install it, and run Apex tests against a fresh scratch org.
|
|
2
|
+
params:
|
|
3
|
+
- name: version-id
|
|
4
|
+
type: string
|
|
5
|
+
required: false
|
|
6
|
+
description: Existing 04t SubscriberPackageVersionId to install. If omitted, a new package version is built from the current commit.
|
|
7
|
+
- name: version-type
|
|
8
|
+
type: string
|
|
9
|
+
required: false
|
|
10
|
+
default: build
|
|
11
|
+
description: Which part of the version to bump relative to the latest released version. One of build, patch, minor, major.
|
|
12
|
+
steps:
|
|
13
|
+
create-org:
|
|
14
|
+
task: org/create/scratch
|
|
15
|
+
params:
|
|
16
|
+
scratch-def: feature
|
|
17
|
+
duration: 1
|
|
18
|
+
no-namespace: true
|
|
19
|
+
resolve-next:
|
|
20
|
+
if-not:
|
|
21
|
+
value: ${{ params.version-id }}
|
|
22
|
+
task: package/version/resolve-next
|
|
23
|
+
params:
|
|
24
|
+
version-type: ${{ params.version-type }}
|
|
25
|
+
create-version:
|
|
26
|
+
if-not:
|
|
27
|
+
value: ${{ params.version-id }}
|
|
28
|
+
task: package/version/create
|
|
29
|
+
params:
|
|
30
|
+
code-coverage: false
|
|
31
|
+
skip-validation: true
|
|
32
|
+
version-number: ${{ steps.resolve-next.version-number }}
|
|
33
|
+
update-dependencies:
|
|
34
|
+
task: package/install/dependencies
|
|
35
|
+
params:
|
|
36
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
37
|
+
install:
|
|
38
|
+
task: package/install
|
|
39
|
+
params:
|
|
40
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
41
|
+
# Only one of these resolves per run: create-version's output if it ran,
|
|
42
|
+
# otherwise the version-id param. Mixed-string concat handles the empty side.
|
|
43
|
+
version-id: ${{ steps.create-version.version-id }}${{ params.version-id }}
|
|
44
|
+
find-test-classes:
|
|
45
|
+
task: util/file/find
|
|
46
|
+
params:
|
|
47
|
+
path: force-app/main/default/classes
|
|
48
|
+
pattern: ${{ config.project.package.testPattern }}
|
|
49
|
+
run-tests:
|
|
50
|
+
if:
|
|
51
|
+
value: ${{ steps.find-test-classes.count }}
|
|
52
|
+
task: apex/run/test
|
|
53
|
+
params:
|
|
54
|
+
target-org: ${{ steps.create-org.target-org }}
|
|
55
|
+
class-names: ${{ steps.find-test-classes.files }}
|
|
56
|
+
namespace: ${{ config.project.package.namespace }}
|