@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,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task-facing output API. Passed into `TaskContext` so tasks can read and write
|
|
3
|
+
* step outputs without holding a reference to the full `Store`.
|
|
4
|
+
*
|
|
5
|
+
* - `get(key)` — reads this step's own output.
|
|
6
|
+
* - `get(stepId, key)` — reads another step's output by its ID.
|
|
7
|
+
* - `set(key, value)` — writes a named output value under this step's namespace.
|
|
8
|
+
*/
|
|
9
|
+
export class TaskOutput {
|
|
10
|
+
stepId;
|
|
11
|
+
store;
|
|
12
|
+
constructor(stepId, store) {
|
|
13
|
+
this.stepId = stepId;
|
|
14
|
+
this.store = store;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Writes a named output value under this step's namespace,
|
|
18
|
+
* making it available to subsequent steps via `${{ steps.<id>.<key> }}`.
|
|
19
|
+
*
|
|
20
|
+
* @param key - The output key.
|
|
21
|
+
* @param value - The value to store.
|
|
22
|
+
*/
|
|
23
|
+
set(key, value) {
|
|
24
|
+
this.store.set(this.stepId, key, value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Reads an output value.
|
|
28
|
+
*
|
|
29
|
+
* @param keyOrStepId - The output key (own step) or step ID (other step).
|
|
30
|
+
* @param key - The output key when reading from another step.
|
|
31
|
+
*/
|
|
32
|
+
get(keyOrStepId, key) {
|
|
33
|
+
if (key === undefined) {
|
|
34
|
+
return this.store.get(this.stepId, keyOrStepId);
|
|
35
|
+
}
|
|
36
|
+
return this.store.get(keyOrStepId, key);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=task.output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.output.js","sourceRoot":"","sources":["../../src/core/task.output.ts"],"names":[],"mappings":"AAeA;;;;;;;GAOG;AACH,MAAM,OAAO,UAAU;IACe;IAAiC;IAArE,YAAoC,MAAc,EAAmB,KAAY;QAA7C,WAAM,GAAN,MAAM,CAAQ;QAAmB,UAAK,GAAL,KAAK,CAAO;IAAG,CAAC;IAErF;;;;;;OAMG;IACI,GAAG,CAAC,GAAW,EAAE,KAAc;QACpC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACI,GAAG,CAAC,WAAmB,EAAE,GAAY;QAC1C,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ParamValue, ParamDefinition, Params } from './task.param.schema.js';
|
|
2
|
+
export type { ParamValue, ParamDefinition, Params };
|
|
3
|
+
/**
|
|
4
|
+
* Validates and coerces raw key/value input against a param schema.
|
|
5
|
+
* Applies defaults, checks for missing required params, and coerces types —
|
|
6
|
+
* so string values from CLI flags are automatically parsed into the declared type.
|
|
7
|
+
*
|
|
8
|
+
* @param rawParams - Unvalidated input, typically from user CLI flags or flow config.
|
|
9
|
+
* @param paramDefinitions - The schema to validate against.
|
|
10
|
+
* @returns A fully resolved `Params` object containing only declared params.
|
|
11
|
+
* @throws If a required param is missing or a value cannot be coerced to the declared type.
|
|
12
|
+
*/
|
|
13
|
+
export declare function validateParams(rawParams: Record<string, unknown>, paramDefinitions: ParamDefinition[]): Params;
|
|
14
|
+
/**
|
|
15
|
+
* Parses an array of "key=value" CLI flag strings into a params object.
|
|
16
|
+
* Supports dotted notation for record params: "tokens.FOO=bar" becomes { tokens: { FOO: "bar" } }.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseCliParams(flags: string[]): Record<string, string | Record<string, string>>;
|
|
19
|
+
/**
|
|
20
|
+
* Builds an argv array for a passthrough sf CLI command from a resolved params object.
|
|
21
|
+
*
|
|
22
|
+
* Each param becomes `--key value` (string/number) or `--key` (boolean true).
|
|
23
|
+
* Keys present in `overrides` are skipped from the params scan and replaced with
|
|
24
|
+
* the provided value instead — pass `null` to omit a key entirely.
|
|
25
|
+
*
|
|
26
|
+
* @param params - The resolved params from the task context.
|
|
27
|
+
* @param overrides - Per-key replacements or nulls to skip.
|
|
28
|
+
* @returns A flat argv array ready to pass to `runCommand`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolvePassthroughArgs(params: Params, overrides?: Record<string, string | null>): string[];
|
|
@@ -0,0 +1,141 @@
|
|
|
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 { ExpectedError } from './error.js';
|
|
15
|
+
/**
|
|
16
|
+
* Validates and coerces raw key/value input against a param schema.
|
|
17
|
+
* Applies defaults, checks for missing required params, and coerces types —
|
|
18
|
+
* so string values from CLI flags are automatically parsed into the declared type.
|
|
19
|
+
*
|
|
20
|
+
* @param rawParams - Unvalidated input, typically from user CLI flags or flow config.
|
|
21
|
+
* @param paramDefinitions - The schema to validate against.
|
|
22
|
+
* @returns A fully resolved `Params` object containing only declared params.
|
|
23
|
+
* @throws If a required param is missing or a value cannot be coerced to the declared type.
|
|
24
|
+
*/
|
|
25
|
+
export function validateParams(rawParams, paramDefinitions) {
|
|
26
|
+
const resolved = {};
|
|
27
|
+
const missing = paramDefinitions.filter((d) => d.required && (rawParams[d.name] ?? d.default) === undefined);
|
|
28
|
+
if (missing.length) {
|
|
29
|
+
const list = missing.map((p) => ` ${p.name}`).join('\n');
|
|
30
|
+
throw new ExpectedError(`Missing required params:\n${list}`);
|
|
31
|
+
}
|
|
32
|
+
for (const definition of paramDefinitions) {
|
|
33
|
+
const val = rawParams[definition.name] ?? definition.default;
|
|
34
|
+
if (val !== undefined) {
|
|
35
|
+
if (!isParamValue(val)) {
|
|
36
|
+
throw new ExpectedError(`Param "${definition.name}" must be a string, number, boolean, or record`);
|
|
37
|
+
}
|
|
38
|
+
resolved[definition.name] = coerce(val, definition);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return resolved;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parses an array of "key=value" CLI flag strings into a params object.
|
|
45
|
+
* Supports dotted notation for record params: "tokens.FOO=bar" becomes { tokens: { FOO: "bar" } }.
|
|
46
|
+
*/
|
|
47
|
+
export function parseCliParams(flags) {
|
|
48
|
+
const result = {};
|
|
49
|
+
for (const flag of flags) {
|
|
50
|
+
const i = flag.indexOf('=');
|
|
51
|
+
const key = i === -1 ? flag : flag.slice(0, i);
|
|
52
|
+
const value = i === -1 ? 'true' : flag.slice(i + 1);
|
|
53
|
+
const dot = key.indexOf('.');
|
|
54
|
+
if (dot !== -1) {
|
|
55
|
+
const parent = key.slice(0, dot);
|
|
56
|
+
const child = key.slice(dot + 1);
|
|
57
|
+
const existing = result[parent];
|
|
58
|
+
const record = typeof existing === 'object' ? existing : {};
|
|
59
|
+
record[child] = value;
|
|
60
|
+
result[parent] = record;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
result[key] = value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Builds an argv array for a passthrough sf CLI command from a resolved params object.
|
|
70
|
+
*
|
|
71
|
+
* Each param becomes `--key value` (string/number) or `--key` (boolean true).
|
|
72
|
+
* Keys present in `overrides` are skipped from the params scan and replaced with
|
|
73
|
+
* the provided value instead — pass `null` to omit a key entirely.
|
|
74
|
+
*
|
|
75
|
+
* @param params - The resolved params from the task context.
|
|
76
|
+
* @param overrides - Per-key replacements or nulls to skip.
|
|
77
|
+
* @returns A flat argv array ready to pass to `runCommand`.
|
|
78
|
+
*/
|
|
79
|
+
export function resolvePassthroughArgs(params, overrides = {}) {
|
|
80
|
+
const merged = {};
|
|
81
|
+
for (const [key, value] of Object.entries(params)) {
|
|
82
|
+
if (typeof value !== 'object')
|
|
83
|
+
merged[key] = value;
|
|
84
|
+
}
|
|
85
|
+
for (const [flag, value] of Object.entries(overrides)) {
|
|
86
|
+
const key = flag.startsWith('--') ? flag.slice(2) : flag;
|
|
87
|
+
merged[key] = value;
|
|
88
|
+
}
|
|
89
|
+
const argv = [];
|
|
90
|
+
for (const [key, value] of Object.entries(merged)) {
|
|
91
|
+
if (value === null)
|
|
92
|
+
continue;
|
|
93
|
+
if (typeof value === 'boolean') {
|
|
94
|
+
if (value)
|
|
95
|
+
argv.push(`--${key}`);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
argv.push(`--${key}`, String(value));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return argv;
|
|
102
|
+
}
|
|
103
|
+
function isParamValue(val) {
|
|
104
|
+
if (typeof val === 'string' || typeof val === 'number' || typeof val === 'boolean')
|
|
105
|
+
return true;
|
|
106
|
+
if (val !== null && typeof val === 'object' && !Array.isArray(val))
|
|
107
|
+
return Object.values(val).every((v) => typeof v === 'string');
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Coerces a value to the type declared in the param definition.
|
|
112
|
+
* If the value is already the correct type it is returned as-is.
|
|
113
|
+
* String values are parsed when the definition expects a number or boolean.
|
|
114
|
+
*
|
|
115
|
+
* @throws If the string cannot be meaningfully parsed into the expected type.
|
|
116
|
+
*/
|
|
117
|
+
function coerce(val, definition) {
|
|
118
|
+
if (definition.type === 'record') {
|
|
119
|
+
if (typeof val !== 'object')
|
|
120
|
+
throw new ExpectedError(`Param "${definition.name}" expected a record (use dotted notation: ${definition.name}.KEY=value), got "${String(val)}"`);
|
|
121
|
+
return val;
|
|
122
|
+
}
|
|
123
|
+
if (typeof val === definition.type)
|
|
124
|
+
return val;
|
|
125
|
+
if (definition.type === 'number') {
|
|
126
|
+
const n = Number(val);
|
|
127
|
+
if (isNaN(n))
|
|
128
|
+
throw new ExpectedError(`Param "${definition.name}" expected a number, got "${String(val)}"`);
|
|
129
|
+
return n;
|
|
130
|
+
}
|
|
131
|
+
if (definition.type === 'boolean') {
|
|
132
|
+
if (val === 'true')
|
|
133
|
+
return true;
|
|
134
|
+
if (val === 'false')
|
|
135
|
+
return false;
|
|
136
|
+
throw new ExpectedError(`Param "${definition.name}" expected a boolean ("true" or "false"), got "${String(val)}"`);
|
|
137
|
+
}
|
|
138
|
+
// definition.type === 'string', val is number or boolean
|
|
139
|
+
return String(val);
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=task.param.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.param.js","sourceRoot":"","sources":["../../src/core/task.param.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAK3C;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,SAAkC,EAAE,gBAAmC;IACpG,MAAM,QAAQ,GAAW,EAAE,CAAC;IAE5B,MAAM,OAAO,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC;IAC7G,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1D,MAAM,IAAI,aAAa,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,MAAM,UAAU,IAAI,gBAAgB,EAAE,CAAC;QAC1C,MAAM,GAAG,GAAG,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,OAAO,CAAC;QAE7D,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;gBACvB,MAAM,IAAI,aAAa,CAAC,UAAU,UAAU,CAAC,IAAI,gDAAgD,CAAC,CAAC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I,aAAa,CAAC,UAAU,UAAU,CAAC,IAAI,kDAAkD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrH,CAAC;IAED,yDAAyD;IACzD,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Zod schema for a value that can be passed as a task or flow param. */
|
|
3
|
+
export declare const ParamValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
4
|
+
/** A scalar value that can be passed as a task or flow param. */
|
|
5
|
+
export type ParamValue = z.infer<typeof ParamValueSchema>;
|
|
6
|
+
/** A resolved, validated set of params, keyed by param name. */
|
|
7
|
+
export type Params = Record<string, ParamValue>;
|
|
8
|
+
/** Zod schema for a single param declaration, shared between task and flow definitions. */
|
|
9
|
+
export declare const ParamDefinitionSchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
type: z.ZodDefault<z.ZodEnum<{
|
|
12
|
+
string: "string";
|
|
13
|
+
number: "number";
|
|
14
|
+
boolean: "boolean";
|
|
15
|
+
record: "record";
|
|
16
|
+
}>>;
|
|
17
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
19
|
+
description: z.ZodOptional<z.ZodString>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
/** A single param declaration. */
|
|
22
|
+
export type ParamDefinition = z.infer<typeof ParamDefinitionSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { z } from 'zod';
|
|
15
|
+
/** Zod schema for a value that can be passed as a task or flow param. */
|
|
16
|
+
export const ParamValueSchema = z.union([z.string(), z.number(), z.boolean(), z.record(z.string(), z.string())]);
|
|
17
|
+
/** Zod schema for a single param declaration, shared between task and flow definitions. */
|
|
18
|
+
export const ParamDefinitionSchema = z.object({
|
|
19
|
+
name: z.string(),
|
|
20
|
+
type: z.enum(['string', 'number', 'boolean', 'record']).default('string'),
|
|
21
|
+
required: z.boolean().optional(),
|
|
22
|
+
default: z.union([z.string(), z.number(), z.boolean()]).optional(),
|
|
23
|
+
description: z.string().optional(),
|
|
24
|
+
});
|
|
25
|
+
/* c8 ignore stop */
|
|
26
|
+
//# sourceMappingURL=task.param.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.param.schema.js","sourceRoot":"","sources":["../../src/core/task.param.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yEAAyE;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AAQjH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;IACzE,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAIH,oBAAoB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Task } from './task.definition.schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves and loads tasks by name.
|
|
4
|
+
*
|
|
5
|
+
* On construction, scans both the built-in and consumer task directories and
|
|
6
|
+
* builds a name → path map. Consumer tasks shadow built-ins of the same name.
|
|
7
|
+
*/
|
|
8
|
+
export declare class TaskRegistry {
|
|
9
|
+
private readonly shipDir;
|
|
10
|
+
private readonly tasks;
|
|
11
|
+
/** @param shipDir - The ship directory for this project. Consumer tasks are loaded from `<shipDir>/tasks`. */
|
|
12
|
+
constructor(shipDir: string);
|
|
13
|
+
/** Lists all available task names. */
|
|
14
|
+
list(): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Resolves a task by name.
|
|
17
|
+
*
|
|
18
|
+
* @param taskName - The task name from the flow step, e.g. "org/create/scratch".
|
|
19
|
+
* @throws If the task cannot be found in either location.
|
|
20
|
+
*/
|
|
21
|
+
resolveTask(taskName: string): Promise<Task>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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 { resolve } from 'node:path';
|
|
15
|
+
import { pathToFileURL, fileURLToPath } from 'node:url';
|
|
16
|
+
import { listDir } from './file.js';
|
|
17
|
+
import { TaskSchema } from './task.definition.schema.js';
|
|
18
|
+
import { asError, ExpectedError, formatZodError } from './error.js';
|
|
19
|
+
import { normalizePath } from './file.js';
|
|
20
|
+
const builtinsDir = resolve(fileURLToPath(import.meta.url), '..', 'tasks');
|
|
21
|
+
async function loadFromPath(taskPath, name) {
|
|
22
|
+
let mod;
|
|
23
|
+
try {
|
|
24
|
+
mod = (await import(pathToFileURL(taskPath).href));
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
throw new ExpectedError(`Failed to load task at ${taskPath}: ${asError(err).message}`);
|
|
28
|
+
}
|
|
29
|
+
const result = TaskSchema.safeParse(mod.default);
|
|
30
|
+
if (!result.success)
|
|
31
|
+
throw new ExpectedError(`Invalid task at ${taskPath}: ${formatZodError(result.error)}`);
|
|
32
|
+
return { ...result.data, name };
|
|
33
|
+
}
|
|
34
|
+
function scanDir(dir) {
|
|
35
|
+
const names = new Set();
|
|
36
|
+
try {
|
|
37
|
+
for (const file of listDir(dir, { recursive: true })) {
|
|
38
|
+
if (/\.(mjs|js|ts)$/.test(file) && !file.endsWith('.d.ts')) {
|
|
39
|
+
names.add(file.replaceAll('\\', '/'));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
if (err.code !== 'ENOENT')
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
return names;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Resolves and loads tasks by name.
|
|
51
|
+
*
|
|
52
|
+
* On construction, scans both the built-in and consumer task directories and
|
|
53
|
+
* builds a name → path map. Consumer tasks shadow built-ins of the same name.
|
|
54
|
+
*/
|
|
55
|
+
export class TaskRegistry {
|
|
56
|
+
shipDir;
|
|
57
|
+
tasks;
|
|
58
|
+
/** @param shipDir - The ship directory for this project. Consumer tasks are loaded from `<shipDir>/tasks`. */
|
|
59
|
+
constructor(shipDir) {
|
|
60
|
+
this.shipDir = shipDir;
|
|
61
|
+
this.tasks = new Map();
|
|
62
|
+
for (const file of scanDir(builtinsDir))
|
|
63
|
+
this.tasks.set(normalizePath(file.replace(/(?:\/index)?\.(mjs|js|ts)$/, '')), resolve(builtinsDir, file));
|
|
64
|
+
for (const file of scanDir(resolve(shipDir, 'tasks')))
|
|
65
|
+
this.tasks.set(normalizePath(file.replace(/(?:\/index)?\.(mjs|js|ts)$/, '')), resolve(shipDir, 'tasks', file));
|
|
66
|
+
}
|
|
67
|
+
/** Lists all available task names. */
|
|
68
|
+
list() {
|
|
69
|
+
return [...this.tasks.keys()].sort();
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Resolves a task by name.
|
|
73
|
+
*
|
|
74
|
+
* @param taskName - The task name from the flow step, e.g. "org/create/scratch".
|
|
75
|
+
* @throws If the task cannot be found in either location.
|
|
76
|
+
*/
|
|
77
|
+
async resolveTask(taskName) {
|
|
78
|
+
const name = normalizePath(taskName);
|
|
79
|
+
const taskPath = this.tasks.get(name);
|
|
80
|
+
if (!taskPath)
|
|
81
|
+
throw new ExpectedError(`Unknown task "${taskName}". Looked in: ${resolve(this.shipDir, 'tasks', name)}`);
|
|
82
|
+
return loadFromPath(taskPath, name);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//#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,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IACnH,CAAC;IAED,sCAAsC;IAC/B,IAAI;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,WAAW,CAAC,QAAgB;QACvC,MAAM,IAAI,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,QAAQ;YACX,MAAM,IAAI,aAAa,CAAC,iBAAiB,QAAQ,iBAAiB,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5G,OAAO,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Task } from './task.definition.schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a UX-formatted string with the task name and, if present, its description.
|
|
4
|
+
*
|
|
5
|
+
* @param task - Object containing the task `name` and optional `description`.
|
|
6
|
+
* @returns Formatted string with colorized label and value pairs.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatTaskPreview(task: Pick<Task, 'name'> & {
|
|
9
|
+
description?: string;
|
|
10
|
+
}): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
/**
|
|
16
|
+
* Returns a UX-formatted string with the task name and, if present, its description.
|
|
17
|
+
*
|
|
18
|
+
* @param task - Object containing the task `name` and optional `description`.
|
|
19
|
+
* @returns Formatted string with colorized label and value pairs.
|
|
20
|
+
*/
|
|
21
|
+
export function formatTaskPreview(task) {
|
|
22
|
+
const header = `${StandardColors.info('Task:')} ${StandardColors.success(task.name)}`;
|
|
23
|
+
return task.description ? `${header}\n${StandardColors.info('Description:')} ${task.description}` : header;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=task.view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task.view.js","sourceRoot":"","sources":["../../src/core/task.view.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAmD;IACnF,MAAM,MAAM,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IACtF,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;AAC7G,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { TaskContext } from '../../../task.definition.schema.js';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
description: string;
|
|
4
|
+
params: ({
|
|
5
|
+
name: string;
|
|
6
|
+
type: "string";
|
|
7
|
+
required: false;
|
|
8
|
+
description: string;
|
|
9
|
+
default?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
name: string;
|
|
12
|
+
type: "number";
|
|
13
|
+
required: false;
|
|
14
|
+
default: number;
|
|
15
|
+
description: string;
|
|
16
|
+
} | {
|
|
17
|
+
name: string;
|
|
18
|
+
type: "number";
|
|
19
|
+
required: false;
|
|
20
|
+
description: string;
|
|
21
|
+
default?: undefined;
|
|
22
|
+
})[];
|
|
23
|
+
run({ flow, params }: TaskContext): Promise<void>;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { resolvePassthroughArgs } from '../../../task.param.js';
|
|
2
|
+
import { ExpectedError } from '../../../error.js';
|
|
3
|
+
// Default --wait value in minutes
|
|
4
|
+
const DEFAULT_WAIT_TIME = 15;
|
|
5
|
+
export default {
|
|
6
|
+
description: 'Runs Apex tests against the target org. Passthrough for `sf apex run test`.',
|
|
7
|
+
params: [
|
|
8
|
+
{
|
|
9
|
+
name: 'target-org',
|
|
10
|
+
type: 'string',
|
|
11
|
+
required: false,
|
|
12
|
+
description: 'Org alias or username to run tests against. Defaults to the SF CLI default target-org.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'test-level',
|
|
16
|
+
type: 'string',
|
|
17
|
+
required: false,
|
|
18
|
+
description: 'Apex test level. Defaults to "RunSpecifiedTests" when class-names is set, otherwise "RunLocalTests".',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'class-names',
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: false,
|
|
24
|
+
description: 'Comma-separated test class names. Required when test-level is "RunSpecifiedTests".',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'namespace',
|
|
28
|
+
type: 'string',
|
|
29
|
+
required: false,
|
|
30
|
+
description: 'Namespace prefix to prepend to each class name. Defaults to project.package.namespace from ship.yml.',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'wait',
|
|
34
|
+
type: 'number',
|
|
35
|
+
required: false,
|
|
36
|
+
default: DEFAULT_WAIT_TIME,
|
|
37
|
+
description: `Minutes to wait for the test run to complete. Defaults to ${DEFAULT_WAIT_TIME}`,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'min-coverage',
|
|
41
|
+
type: 'number',
|
|
42
|
+
required: false,
|
|
43
|
+
description: 'Minimum org-wide coverage percentage (0–100). Fails the step if not met.',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
async run({ flow, params }) {
|
|
47
|
+
const alias = flow.orgs.resolveAlias(params['target-org']);
|
|
48
|
+
const rawClassNames = params['class-names'];
|
|
49
|
+
const namespace = params['namespace'];
|
|
50
|
+
const classNames = rawClassNames && namespace
|
|
51
|
+
? rawClassNames
|
|
52
|
+
.split(',')
|
|
53
|
+
.map((c) => (c.includes('.') ? c.trim() : `${namespace}.${c.trim()}`))
|
|
54
|
+
.join(',')
|
|
55
|
+
: rawClassNames;
|
|
56
|
+
const effectiveTestLevel = params['test-level'] ?? (classNames ? 'RunSpecifiedTests' : 'RunLocalTests');
|
|
57
|
+
const wait = params['wait'] ?? DEFAULT_WAIT_TIME;
|
|
58
|
+
const argv = resolvePassthroughArgs(params, {
|
|
59
|
+
'--target-org': alias ?? null,
|
|
60
|
+
'--tests': classNames ?? null,
|
|
61
|
+
'--class-names': null,
|
|
62
|
+
'--namespace': null,
|
|
63
|
+
'--test-level': effectiveTestLevel ?? null,
|
|
64
|
+
'--wait': String(wait),
|
|
65
|
+
'--min-coverage': null,
|
|
66
|
+
'--code-coverage': params['min-coverage'] !== undefined ? 'true' : null,
|
|
67
|
+
});
|
|
68
|
+
flow.log('Running Apex tests...');
|
|
69
|
+
const result = (await flow.runCommand('apex:run:test', argv));
|
|
70
|
+
const { summary } = result;
|
|
71
|
+
if (!summary) {
|
|
72
|
+
throw new ExpectedError('Test run did not complete within the wait period. Increase the `wait` param or retrieve results manually with `sf apex get test`.');
|
|
73
|
+
}
|
|
74
|
+
flow.log(`Tests run: ${summary.testsRan} | Passed: ${summary.passing} | Failed: ${summary.failing}`);
|
|
75
|
+
const minCoverage = params['min-coverage'];
|
|
76
|
+
if (minCoverage !== undefined && summary.orgWideCoverage !== undefined) {
|
|
77
|
+
const pct = parseInt(summary.orgWideCoverage, 10);
|
|
78
|
+
if (pct < minCoverage) {
|
|
79
|
+
throw new ExpectedError(`Coverage ${pct}% is below the required minimum of ${minCoverage}%.`);
|
|
80
|
+
}
|
|
81
|
+
flow.log(`Org-wide coverage: ${summary.orgWideCoverage}`);
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.js","sourceRoot":"","sources":["../../../../../src/core/tasks/apex/run/test.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,kCAAkC;AAClC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAY7B,eAAe;IACb,WAAW,EAAE,6EAA6E;IAC1F,MAAM,EAAE;QACN;YACE,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,wFAAwF;SACtG;QACD;YACE,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EACT,sGAAsG;SACzG;QACD;YACE,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,oFAAoF;SAClG;QACD;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EACT,sGAAsG;SACzG;QACD;YACE,IAAI,EAAE,MAAM;YACZ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
4
|
+
params: {
|
|
5
|
+
name: string;
|
|
6
|
+
type: "string";
|
|
7
|
+
required: false;
|
|
8
|
+
description: string;
|
|
9
|
+
}[];
|
|
10
|
+
run({ flow, params }: TaskContext): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
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 { resolve } from 'node:path';
|
|
15
|
+
import { resolvePassthroughArgs } from '../../../task.param.js';
|
|
16
|
+
import { pathExists } from '../../../file.js';
|
|
17
|
+
/** Conventional plan file imported when neither `plan` nor `files` is given. */
|
|
18
|
+
const DEFAULT_PLAN = 'data/plan.json';
|
|
19
|
+
export default {
|
|
20
|
+
description: 'Imports records into an org from tree/plan files. Passthrough for `sf data import tree`.',
|
|
21
|
+
params: [
|
|
22
|
+
{
|
|
23
|
+
name: 'target-org',
|
|
24
|
+
type: 'string',
|
|
25
|
+
required: false,
|
|
26
|
+
description: 'Org alias or username to import records into. Defaults to the SF CLI default target-org.',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'plan',
|
|
30
|
+
type: 'string',
|
|
31
|
+
required: false,
|
|
32
|
+
description: 'Path to a plan file describing the ordered tree of records to import. Defaults to `.ship/data/plan.json` if present; otherwise the import is skipped.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'files',
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: false,
|
|
38
|
+
description: 'Comma-separated tree JSON files to import. Alternative to `plan`.',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
async run({ flow, params }) {
|
|
42
|
+
const overrides = {};
|
|
43
|
+
// Explicit plan/files win. Otherwise fall back to the conventional
|
|
44
|
+
// `.ship/data/plan.json`; if a project hasn't created one, there's nothing
|
|
45
|
+
// to import, so skip rather than fail.
|
|
46
|
+
if (!params['plan'] && !params['files']) {
|
|
47
|
+
const defaultPlan = resolve(flow.shipDir, DEFAULT_PLAN);
|
|
48
|
+
if (!pathExists(defaultPlan, 'file')) {
|
|
49
|
+
flow.log(`No plan or files configured and no ${DEFAULT_PLAN} found — skipping data import.`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
overrides['--plan'] = defaultPlan;
|
|
53
|
+
flow.log(`Importing records from ${defaultPlan}.`);
|
|
54
|
+
}
|
|
55
|
+
overrides['--target-org'] = flow.orgs.resolveAlias(params['target-org']) ?? null;
|
|
56
|
+
const argv = resolvePassthroughArgs(params, overrides);
|
|
57
|
+
await flow.runCommand('data:import:tree', argv);
|
|
58
|
+
flow.log('Imported records.');
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../../src/core/tasks/data/import/tree.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,gFAAgF;AAChF,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAEtC,eAAe;IACb,WAAW,EAAE,0FAA0F;IACvG,MAAM,EAAE;QACN;YACE,IAAI,EAAE,YAAY;Y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