@expo/steps 0.0.9 → 1.0.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 +100 -0
- package/dist_commonjs/BuildConfig.cjs +3 -3
- package/dist_commonjs/BuildConfig.js.map +1 -1
- package/dist_commonjs/BuildConfigParser.cjs +55 -42
- package/dist_commonjs/BuildConfigParser.d.ts +5 -1
- package/dist_commonjs/BuildConfigParser.js.map +1 -1
- package/dist_commonjs/BuildFunction.cjs +9 -3
- package/dist_commonjs/BuildFunction.js.map +1 -1
- package/dist_commonjs/BuildStep.cjs +32 -24
- package/dist_commonjs/BuildStep.d.ts +9 -3
- package/dist_commonjs/BuildStep.js.map +1 -1
- package/dist_commonjs/BuildStepContext.cjs +2 -2
- package/dist_commonjs/BuildStepContext.js.map +1 -1
- package/dist_commonjs/BuildStepInput.cjs +6 -6
- package/dist_commonjs/BuildStepInput.d.ts +3 -3
- package/dist_commonjs/BuildStepInput.js.map +1 -1
- package/dist_commonjs/BuildStepOutput.cjs +6 -6
- package/dist_commonjs/BuildStepOutput.d.ts +4 -4
- package/dist_commonjs/BuildStepOutput.js.map +1 -1
- package/dist_commonjs/BuildWorkflowValidator.cjs +16 -17
- package/dist_commonjs/BuildWorkflowValidator.js.map +1 -1
- package/dist_commonjs/errors.cjs +30 -0
- package/dist_commonjs/errors.d.ts +24 -0
- package/dist_commonjs/errors.js.map +1 -0
- package/dist_commonjs/index.cjs +27 -1
- package/dist_commonjs/index.d.ts +2 -0
- package/dist_commonjs/index.js.map +1 -1
- package/dist_commonjs/utils/template.cjs +2 -2
- package/dist_commonjs/utils/template.js.map +1 -1
- package/dist_esm/BuildConfig.js +1 -1
- package/dist_esm/BuildConfig.js.map +1 -1
- package/dist_esm/BuildConfigParser.d.ts +5 -1
- package/dist_esm/BuildConfigParser.js +54 -41
- package/dist_esm/BuildConfigParser.js.map +1 -1
- package/dist_esm/BuildFunction.js +9 -3
- package/dist_esm/BuildFunction.js.map +1 -1
- package/dist_esm/BuildStep.d.ts +9 -3
- package/dist_esm/BuildStep.js +31 -23
- package/dist_esm/BuildStep.js.map +1 -1
- package/dist_esm/BuildStepContext.js +1 -1
- package/dist_esm/BuildStepContext.js.map +1 -1
- package/dist_esm/BuildStepInput.d.ts +3 -3
- package/dist_esm/BuildStepInput.js +6 -6
- package/dist_esm/BuildStepInput.js.map +1 -1
- package/dist_esm/BuildStepOutput.d.ts +4 -4
- package/dist_esm/BuildStepOutput.js +6 -6
- package/dist_esm/BuildStepOutput.js.map +1 -1
- package/dist_esm/BuildWorkflowValidator.js +15 -16
- package/dist_esm/BuildWorkflowValidator.js.map +1 -1
- package/dist_esm/errors.d.ts +24 -0
- package/dist_esm/errors.js +23 -0
- package/dist_esm/errors.js.map +1 -0
- package/dist_esm/index.d.ts +2 -0
- package/dist_esm/index.js +2 -0
- package/dist_esm/index.js.map +1 -1
- package/dist_esm/utils/template.js +1 -1
- package/dist_esm/utils/template.js.map +1 -1
- package/package.json +4 -3
- package/dist_commonjs/errors/BuildConfigError.cjs +0 -8
- package/dist_commonjs/errors/BuildConfigError.d.ts +0 -3
- package/dist_commonjs/errors/BuildConfigError.js.map +0 -1
- package/dist_commonjs/errors/BuildInternalError.cjs +0 -7
- package/dist_commonjs/errors/BuildInternalError.d.ts +0 -2
- package/dist_commonjs/errors/BuildInternalError.js.map +0 -1
- package/dist_commonjs/errors/BuildStepRuntimeError.cjs +0 -8
- package/dist_commonjs/errors/BuildStepRuntimeError.d.ts +0 -3
- package/dist_commonjs/errors/BuildStepRuntimeError.js.map +0 -1
- package/dist_commonjs/errors/BuildWorkflowError.cjs +0 -13
- package/dist_commonjs/errors/BuildWorkflowError.d.ts +0 -10
- package/dist_commonjs/errors/BuildWorkflowError.js.map +0 -1
- package/dist_commonjs/errors/UserError.cjs +0 -14
- package/dist_commonjs/errors/UserError.d.ts +0 -9
- package/dist_commonjs/errors/UserError.js.map +0 -1
- package/dist_esm/errors/BuildConfigError.d.ts +0 -3
- package/dist_esm/errors/BuildConfigError.js +0 -4
- package/dist_esm/errors/BuildConfigError.js.map +0 -1
- package/dist_esm/errors/BuildInternalError.d.ts +0 -2
- package/dist_esm/errors/BuildInternalError.js +0 -3
- package/dist_esm/errors/BuildInternalError.js.map +0 -1
- package/dist_esm/errors/BuildStepRuntimeError.d.ts +0 -3
- package/dist_esm/errors/BuildStepRuntimeError.js +0 -4
- package/dist_esm/errors/BuildStepRuntimeError.js.map +0 -1
- package/dist_esm/errors/BuildWorkflowError.d.ts +0 -10
- package/dist_esm/errors/BuildWorkflowError.js +0 -9
- package/dist_esm/errors/BuildWorkflowError.js.map +0 -1
- package/dist_esm/errors/UserError.d.ts +0 -9
- package/dist_esm/errors/UserError.js +0 -10
- package/dist_esm/errors/UserError.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { BuildStepRuntimeError } from './errors
|
|
1
|
+
import { BuildStepRuntimeError } from './errors.js';
|
|
2
2
|
import { interpolateWithOutputs } from './utils/template.js';
|
|
3
3
|
export class BuildStepInput {
|
|
4
4
|
static createProvider(params) {
|
|
5
|
-
return (ctx,
|
|
5
|
+
return (ctx, stepDisplayName) => new BuildStepInput(ctx, { ...params, stepDisplayName });
|
|
6
6
|
}
|
|
7
|
-
constructor(ctx, { id,
|
|
7
|
+
constructor(ctx, { id, stepDisplayName, defaultValue, required = true, }) {
|
|
8
8
|
this.ctx = ctx;
|
|
9
9
|
this.id = id;
|
|
10
|
-
this.
|
|
10
|
+
this.stepDisplayName = stepDisplayName;
|
|
11
11
|
this.defaultValue = defaultValue;
|
|
12
12
|
this.required = required;
|
|
13
13
|
}
|
|
@@ -15,7 +15,7 @@ export class BuildStepInput {
|
|
|
15
15
|
var _a;
|
|
16
16
|
const rawValue = (_a = this._value) !== null && _a !== void 0 ? _a : this.defaultValue;
|
|
17
17
|
if (this.required && rawValue === undefined) {
|
|
18
|
-
throw new BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.
|
|
18
|
+
throw new BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" is required but it was not set.`);
|
|
19
19
|
}
|
|
20
20
|
if (rawValue === undefined) {
|
|
21
21
|
return rawValue;
|
|
@@ -26,7 +26,7 @@ export class BuildStepInput {
|
|
|
26
26
|
}
|
|
27
27
|
set(value) {
|
|
28
28
|
if (this.required && value === undefined) {
|
|
29
|
-
throw new BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.
|
|
29
|
+
throw new BuildStepRuntimeError(`Input parameter "${this.id}" for step "${this.stepDisplayName}" is required.`);
|
|
30
30
|
}
|
|
31
31
|
this._value = value;
|
|
32
32
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildStepInput.js","sourceRoot":"","sources":["../src/BuildStepInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BuildStepInput.js","sourceRoot":"","sources":["../src/BuildStepInput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAK7D,MAAM,OAAO,cAAc;IAQlB,MAAM,CAAC,cAAc,CAAC,MAI5B;QACC,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IAC3F,CAAC;IAED,YACmB,GAAqB,EACtC,EACE,EAAE,EACF,eAAe,EACf,YAAY,EACZ,QAAQ,GAAG,IAAI,GAMhB;QAXgB,QAAG,GAAH,GAAG,CAAkB;QAatC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK;;QACP,MAAM,QAAQ,GAAG,MAAA,IAAI,CAAC,MAAM,mCAAI,IAAI,CAAC,YAAY,CAAC;QAClD,IAAI,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC3C,MAAM,IAAI,qBAAqB,CAC7B,oBAAoB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,mCAAmC,CAClG,CAAC;SACH;QAED,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,OAAO,QAAQ,CAAC;SACjB;aAAM;YACL,OAAO,sBAAsB,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,WAAC,OAAA,MAAA,IAAI,CAAC,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAA,EAAA,CAAC,CAAC;SAC5F;IACH,CAAC;IAED,GAAG,CAAC,KAAyB;QAC3B,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE;YACxC,MAAM,IAAI,qBAAqB,CAC7B,oBAAoB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,gBAAgB,CAC/E,CAAC;SACH;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,yBAAyB,CAAC,MAAyB;IACjE,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO,EAAE,CAAC;KACX;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;QAClC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC;QACtB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAwB,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { BuildStepContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\nimport { interpolateWithOutputs } from './utils/template.js';\n\nexport type BuildStepInputById = Record<string, BuildStepInput>;\nexport type BuildStepInputProvider = (ctx: BuildStepContext, stepId: string) => BuildStepInput;\n\nexport class BuildStepInput {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly defaultValue?: string;\n public readonly required: boolean;\n\n private _value?: string;\n\n public static createProvider(params: {\n id: string;\n defaultValue?: string;\n required?: boolean;\n }): BuildStepInputProvider {\n return (ctx, stepDisplayName) => new BuildStepInput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n private readonly ctx: BuildStepContext,\n {\n id,\n stepDisplayName,\n defaultValue,\n required = true,\n }: {\n id: string;\n stepDisplayName: string;\n defaultValue?: string;\n required?: boolean;\n }\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.defaultValue = defaultValue;\n this.required = required;\n }\n\n get value(): string | undefined {\n const rawValue = this._value ?? this.defaultValue;\n if (this.required && rawValue === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n\n if (rawValue === undefined) {\n return rawValue;\n } else {\n return interpolateWithOutputs(rawValue, (path) => this.ctx.getStepOutputValue(path) ?? '');\n }\n }\n\n set(value: string | undefined): BuildStepInput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Input parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n this._value = value;\n return this;\n }\n}\n\nexport function makeBuildStepInputByIdMap(inputs?: BuildStepInput[]): BuildStepInputById {\n if (inputs === undefined) {\n return {};\n }\n return inputs.reduce((acc, input) => {\n acc[input.id] = input;\n return acc;\n }, {} as BuildStepInputById);\n}\n"]}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { BuildStepContext } from './BuildStepContext.js';
|
|
2
2
|
export type BuildStepOutputById = Record<string, BuildStepOutput>;
|
|
3
|
-
export type BuildStepOutputProvider = (ctx: BuildStepContext,
|
|
3
|
+
export type BuildStepOutputProvider = (ctx: BuildStepContext, stepDisplayName: string) => BuildStepOutput;
|
|
4
4
|
export declare class BuildStepOutput {
|
|
5
5
|
private readonly ctx;
|
|
6
6
|
readonly id: string;
|
|
7
|
-
readonly
|
|
7
|
+
readonly stepDisplayName: string;
|
|
8
8
|
readonly required: boolean;
|
|
9
9
|
private _value?;
|
|
10
10
|
static createProvider(params: {
|
|
11
11
|
id: string;
|
|
12
12
|
required?: boolean;
|
|
13
13
|
}): BuildStepOutputProvider;
|
|
14
|
-
constructor(ctx: BuildStepContext, { id,
|
|
14
|
+
constructor(ctx: BuildStepContext, { id, stepDisplayName, required, }: {
|
|
15
15
|
id: string;
|
|
16
|
-
|
|
16
|
+
stepDisplayName: string;
|
|
17
17
|
required?: boolean;
|
|
18
18
|
});
|
|
19
19
|
get value(): string | undefined;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { BuildStepRuntimeError } from './errors
|
|
1
|
+
import { BuildStepRuntimeError } from './errors.js';
|
|
2
2
|
export class BuildStepOutput {
|
|
3
3
|
static createProvider(params) {
|
|
4
|
-
return (ctx,
|
|
4
|
+
return (ctx, stepDisplayName) => new BuildStepOutput(ctx, { ...params, stepDisplayName });
|
|
5
5
|
}
|
|
6
6
|
constructor(
|
|
7
7
|
// @ts-expect-error ctx is not used in this class but let's keep it here for consistency
|
|
8
|
-
ctx, { id,
|
|
8
|
+
ctx, { id, stepDisplayName, required = true, }) {
|
|
9
9
|
this.ctx = ctx;
|
|
10
10
|
this.id = id;
|
|
11
|
-
this.
|
|
11
|
+
this.stepDisplayName = stepDisplayName;
|
|
12
12
|
this.required = required;
|
|
13
13
|
}
|
|
14
14
|
get value() {
|
|
15
15
|
if (this.required && this._value === undefined) {
|
|
16
|
-
throw new BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.
|
|
16
|
+
throw new BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.stepDisplayName}" is required but it was not set.`);
|
|
17
17
|
}
|
|
18
18
|
return this._value;
|
|
19
19
|
}
|
|
20
20
|
set(value) {
|
|
21
21
|
if (this.required && value === undefined) {
|
|
22
|
-
throw new BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.
|
|
22
|
+
throw new BuildStepRuntimeError(`Output parameter "${this.id}" for step "${this.stepDisplayName}" is required.`);
|
|
23
23
|
}
|
|
24
24
|
this._value = value;
|
|
25
25
|
return this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildStepOutput.js","sourceRoot":"","sources":["../src/BuildStepOutput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"BuildStepOutput.js","sourceRoot":"","sources":["../src/BuildStepOutput.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAQpD,MAAM,OAAO,eAAe;IAOnB,MAAM,CAAC,cAAc,CAAC,MAG5B;QACC,OAAO,CAAC,GAAG,EAAE,eAAe,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,GAAG,EAAE,EAAE,GAAG,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;IACE,wFAAwF;IACvE,GAAqB,EACtC,EACE,EAAE,EACF,eAAe,EACf,QAAQ,GAAG,IAAI,GAC6C;QAL7C,QAAG,GAAH,GAAG,CAAkB;QAOtC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE;YAC9C,MAAM,IAAI,qBAAqB,CAC7B,qBAAqB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,mCAAmC,CACnG,CAAC;SACH;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,GAAG,CAAC,KAAyB;QAC3B,IAAI,IAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE;YACxC,MAAM,IAAI,qBAAqB,CAC7B,qBAAqB,IAAI,CAAC,EAAE,eAAe,IAAI,CAAC,eAAe,gBAAgB,CAChF,CAAC;SACH;QACD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B,CAAC,OAA2B;IACpE,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,OAAO,EAAE,CAAC;KACX;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;QACpC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAyB,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { BuildStepContext } from './BuildStepContext.js';\nimport { BuildStepRuntimeError } from './errors.js';\n\nexport type BuildStepOutputById = Record<string, BuildStepOutput>;\nexport type BuildStepOutputProvider = (\n ctx: BuildStepContext,\n stepDisplayName: string\n) => BuildStepOutput;\n\nexport class BuildStepOutput {\n public readonly id: string;\n public readonly stepDisplayName: string;\n public readonly required: boolean;\n\n private _value?: string;\n\n public static createProvider(params: {\n id: string;\n required?: boolean;\n }): BuildStepOutputProvider {\n return (ctx, stepDisplayName) => new BuildStepOutput(ctx, { ...params, stepDisplayName });\n }\n\n constructor(\n // @ts-expect-error ctx is not used in this class but let's keep it here for consistency\n private readonly ctx: BuildStepContext,\n {\n id,\n stepDisplayName,\n required = true,\n }: { id: string; stepDisplayName: string; required?: boolean }\n ) {\n this.id = id;\n this.stepDisplayName = stepDisplayName;\n this.required = required;\n }\n\n get value(): string | undefined {\n if (this.required && this._value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required but it was not set.`\n );\n }\n return this._value;\n }\n\n set(value: string | undefined): BuildStepOutput {\n if (this.required && value === undefined) {\n throw new BuildStepRuntimeError(\n `Output parameter \"${this.id}\" for step \"${this.stepDisplayName}\" is required.`\n );\n }\n this._value = value;\n return this;\n }\n}\n\nexport function makeBuildStepOutputByIdMap(outputs?: BuildStepOutput[]): BuildStepOutputById {\n if (outputs === undefined) {\n return {};\n }\n return outputs.reduce((acc, output) => {\n acc[output.id] = output;\n return acc;\n }, {} as BuildStepOutputById);\n}\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BuildConfigError } from './errors
|
|
2
|
-
import { BuildWorkflowError } from './errors/BuildWorkflowError.js';
|
|
1
|
+
import { BuildConfigError, BuildWorkflowError } from './errors.js';
|
|
3
2
|
import { duplicates } from './utils/expodash/duplicates.js';
|
|
4
3
|
import { findOutputPaths } from './utils/template.js';
|
|
5
4
|
export class BuildWorkflowValidator {
|
|
@@ -11,7 +10,7 @@ export class BuildWorkflowValidator {
|
|
|
11
10
|
errors.push(...this.validateUniqueStepIds());
|
|
12
11
|
errors.push(...this.validateInputs());
|
|
13
12
|
if (errors.length !== 0) {
|
|
14
|
-
throw new BuildWorkflowError('Build workflow is invalid', errors);
|
|
13
|
+
throw new BuildWorkflowError('Build workflow is invalid.', errors);
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
validateUniqueStepIds() {
|
|
@@ -29,33 +28,33 @@ export class BuildWorkflowValidator {
|
|
|
29
28
|
var _a;
|
|
30
29
|
const errors = [];
|
|
31
30
|
const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));
|
|
32
|
-
const
|
|
33
|
-
for (const
|
|
34
|
-
for (const
|
|
35
|
-
if (
|
|
31
|
+
const visitedStepByStepId = {};
|
|
32
|
+
for (const currentStep of this.workflow.buildSteps) {
|
|
33
|
+
for (const currentStepInput of (_a = currentStep.inputs) !== null && _a !== void 0 ? _a : []) {
|
|
34
|
+
if (currentStepInput.defaultValue === undefined) {
|
|
36
35
|
continue;
|
|
37
36
|
}
|
|
38
|
-
const paths = findOutputPaths(
|
|
39
|
-
for (const { stepId, outputId } of paths) {
|
|
40
|
-
if (!(
|
|
41
|
-
if (allStepIds.has(
|
|
42
|
-
const error = new BuildConfigError(`Input parameter "${
|
|
37
|
+
const paths = findOutputPaths(currentStepInput.defaultValue);
|
|
38
|
+
for (const { stepId: referencedStepId, outputId: referencedStepOutputId } of paths) {
|
|
39
|
+
if (!(referencedStepId in visitedStepByStepId)) {
|
|
40
|
+
if (allStepIds.has(referencedStepId)) {
|
|
41
|
+
const error = new BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an output parameter from the future step "${referencedStepId}".`);
|
|
43
42
|
errors.push(error);
|
|
44
43
|
}
|
|
45
44
|
else {
|
|
46
|
-
const error = new BuildConfigError(`Input parameter "${
|
|
45
|
+
const error = new BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an output parameter from a non-existent step "${referencedStepId}".`);
|
|
47
46
|
errors.push(error);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
else {
|
|
51
|
-
if (!
|
|
52
|
-
const error = new BuildConfigError(`Input parameter "${
|
|
50
|
+
if (!visitedStepByStepId[referencedStepId].hasOutputParameter(referencedStepOutputId)) {
|
|
51
|
+
const error = new BuildConfigError(`Input parameter "${currentStepInput.id}" for step "${currentStep.displayName}" uses an expression that references an undefined output parameter "${referencedStepOutputId}" from step "${referencedStepId}".`);
|
|
53
52
|
errors.push(error);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
|
-
|
|
57
|
+
visitedStepByStepId[currentStep.id] = currentStep;
|
|
59
58
|
}
|
|
60
59
|
return errors;
|
|
61
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"BuildWorkflowValidator.js","sourceRoot":"","sources":["../src/BuildWorkflowValidator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,OAAO,sBAAsB;IACjC,YAA6B,QAAuB;QAAvB,aAAQ,GAAR,QAAQ,CAAe;IAAG,CAAC;IAEjD,QAAQ;QACb,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;QACtC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,IAAI,kBAAkB,CAAC,4BAA4B,EAAE,MAAM,CAAC,CAAC;SACpE;IACH,CAAC;IAEO,qBAAqB;QAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;QAC7D,MAAM,iBAAiB,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE;YAClC,OAAO,EAAE,CAAC;SACX;aAAM;YACL,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,wBAAwB,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC5E,CAAC;YACF,OAAO,CAAC,KAAK,CAAC,CAAC;SAChB;IACH,CAAC;IAEO,cAAc;;QACpB,MAAM,MAAM,GAAuB,EAAE,CAAC;QAEtC,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACtE,MAAM,mBAAmB,GAA8B,EAAE,CAAC;QAC1D,KAAK,MAAM,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE;YAClD,KAAK,MAAM,gBAAgB,IAAI,MAAA,WAAW,CAAC,MAAM,mCAAI,EAAE,EAAE;gBACvD,IAAI,gBAAgB,CAAC,YAAY,KAAK,SAAS,EAAE;oBAC/C,SAAS;iBACV;gBACD,MAAM,KAAK,GAAG,eAAe,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;gBAC7D,KAAK,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,sBAAsB,EAAE,IAAI,KAAK,EAAE;oBAClF,IAAI,CAAC,CAAC,gBAAgB,IAAI,mBAAmB,CAAC,EAAE;wBAC9C,IAAI,UAAU,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE;4BACpC,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,oBAAoB,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,WAAW,kFAAkF,gBAAgB,IAAI,CACpL,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;6BAAM;4BACL,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,oBAAoB,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,WAAW,sFAAsF,gBAAgB,IAAI,CACxL,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;qBACF;yBAAM;wBACL,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,EAAE;4BACrF,MAAM,KAAK,GAAG,IAAI,gBAAgB,CAChC,oBAAoB,gBAAgB,CAAC,EAAE,eAAe,WAAW,CAAC,WAAW,uEAAuE,sBAAsB,gBAAgB,gBAAgB,IAAI,CAC/M,CAAC;4BACF,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;yBACpB;qBACF;iBACF;aACF;YACD,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC;SACnD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import { BuildStep } from './BuildStep.js';\nimport { BuildWorkflow } from './BuildWorkflow.js';\nimport { BuildConfigError, BuildWorkflowError } from './errors.js';\nimport { duplicates } from './utils/expodash/duplicates.js';\nimport { findOutputPaths } from './utils/template.js';\n\nexport class BuildWorkflowValidator {\n constructor(private readonly workflow: BuildWorkflow) {}\n\n public validate(): void {\n const errors: BuildConfigError[] = [];\n errors.push(...this.validateUniqueStepIds());\n errors.push(...this.validateInputs());\n if (errors.length !== 0) {\n throw new BuildWorkflowError('Build workflow is invalid.', errors);\n }\n }\n\n private validateUniqueStepIds(): BuildConfigError[] {\n const stepIds = this.workflow.buildSteps.map(({ id }) => id);\n const duplicatedStepIds = duplicates(stepIds);\n if (duplicatedStepIds.length === 0) {\n return [];\n } else {\n const error = new BuildConfigError(\n `Duplicated step IDs: ${duplicatedStepIds.map((i) => `\"${i}\"`).join(', ')}`\n );\n return [error];\n }\n }\n\n private validateInputs(): BuildConfigError[] {\n const errors: BuildConfigError[] = [];\n\n const allStepIds = new Set(this.workflow.buildSteps.map((s) => s.id));\n const visitedStepByStepId: Record<string, BuildStep> = {};\n for (const currentStep of this.workflow.buildSteps) {\n for (const currentStepInput of currentStep.inputs ?? []) {\n if (currentStepInput.defaultValue === undefined) {\n continue;\n }\n const paths = findOutputPaths(currentStepInput.defaultValue);\n for (const { stepId: referencedStepId, outputId: referencedStepOutputId } of paths) {\n if (!(referencedStepId in visitedStepByStepId)) {\n if (allStepIds.has(referencedStepId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from the future step \"${referencedStepId}\".`\n );\n errors.push(error);\n } else {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an output parameter from a non-existent step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n } else {\n if (!visitedStepByStepId[referencedStepId].hasOutputParameter(referencedStepOutputId)) {\n const error = new BuildConfigError(\n `Input parameter \"${currentStepInput.id}\" for step \"${currentStep.displayName}\" uses an expression that references an undefined output parameter \"${referencedStepOutputId}\" from step \"${referencedStepId}\".`\n );\n errors.push(error);\n }\n }\n }\n }\n visitedStepByStepId[currentStep.id] = currentStep;\n }\n\n return errors;\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare abstract class UserError extends Error {
|
|
2
|
+
readonly message: string;
|
|
3
|
+
readonly cause?: Error;
|
|
4
|
+
readonly metadata: object;
|
|
5
|
+
constructor(message: string, extra?: {
|
|
6
|
+
metadata?: object;
|
|
7
|
+
cause?: Error;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
export declare class BuildConfigError extends UserError {
|
|
11
|
+
}
|
|
12
|
+
export declare class BuildInternalError extends Error {
|
|
13
|
+
}
|
|
14
|
+
export declare class BuildStepRuntimeError extends UserError {
|
|
15
|
+
}
|
|
16
|
+
export declare class BuildWorkflowError extends UserError {
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly errors: BuildConfigError[];
|
|
19
|
+
constructor(message: string, errors: BuildConfigError[], extra?: {
|
|
20
|
+
metadata?: object;
|
|
21
|
+
cause?: Error;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class UserError extends Error {
|
|
2
|
+
constructor(message, extra) {
|
|
3
|
+
var _a;
|
|
4
|
+
super(message);
|
|
5
|
+
this.message = message;
|
|
6
|
+
this.metadata = (_a = extra === null || extra === void 0 ? void 0 : extra.cause) !== null && _a !== void 0 ? _a : {};
|
|
7
|
+
this.cause = extra === null || extra === void 0 ? void 0 : extra.cause;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export class BuildConfigError extends UserError {
|
|
11
|
+
}
|
|
12
|
+
export class BuildInternalError extends Error {
|
|
13
|
+
}
|
|
14
|
+
export class BuildStepRuntimeError extends UserError {
|
|
15
|
+
}
|
|
16
|
+
export class BuildWorkflowError extends UserError {
|
|
17
|
+
constructor(message, errors, extra) {
|
|
18
|
+
super(message, extra);
|
|
19
|
+
this.message = message;
|
|
20
|
+
this.errors = errors;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAe,SAAU,SAAQ,KAAK;IAIpC,YAC2B,OAAe,EACxC,KAGC;;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QANU,YAAO,GAAP,OAAO,CAAQ;QAOxC,IAAI,CAAC,QAAQ,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,mCAAI,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;IAC5B,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,SAAS;CAAG;AAElD,MAAM,OAAO,kBAAmB,SAAQ,KAAK;CAAG;AAEhD,MAAM,OAAO,qBAAsB,SAAQ,SAAS;CAAG;AAEvD,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,YAC2B,OAAe,EACxB,MAA0B,EAC1C,KAGC;QAED,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAPG,YAAO,GAAP,OAAO,CAAQ;QACxB,WAAM,GAAN,MAAM,CAAoB;IAO5C,CAAC;CACF","sourcesContent":["abstract class UserError extends Error {\n public readonly cause?: Error;\n public readonly metadata: object;\n\n constructor(\n public override readonly message: string,\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message);\n this.metadata = extra?.cause ?? {};\n this.cause = extra?.cause;\n }\n}\n\nexport class BuildConfigError extends UserError {}\n\nexport class BuildInternalError extends Error {}\n\nexport class BuildStepRuntimeError extends UserError {}\n\nexport class BuildWorkflowError extends UserError {\n constructor(\n public override readonly message: string,\n public readonly errors: BuildConfigError[],\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message, extra);\n }\n}\n"]}
|
package/dist_esm/index.d.ts
CHANGED
|
@@ -3,3 +3,5 @@ export { BuildFunction } from './BuildFunction.js';
|
|
|
3
3
|
export { BuildStepInput } from './BuildStepInput.js';
|
|
4
4
|
export { BuildStepOutput } from './BuildStepOutput.js';
|
|
5
5
|
export { BuildStepContext } from './BuildStepContext.js';
|
|
6
|
+
export { BuildWorkflow } from './BuildWorkflow.js';
|
|
7
|
+
export * as errors from './errors.js';
|
package/dist_esm/index.js
CHANGED
|
@@ -3,4 +3,6 @@ export { BuildFunction } from './BuildFunction.js';
|
|
|
3
3
|
export { BuildStepInput } from './BuildStepInput.js';
|
|
4
4
|
export { BuildStepOutput } from './BuildStepOutput.js';
|
|
5
5
|
export { BuildStepContext } from './BuildStepContext.js';
|
|
6
|
+
export { BuildWorkflow } from './BuildWorkflow.js';
|
|
7
|
+
export * as errors from './errors.js';
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
package/dist_esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC","sourcesContent":["export { BuildConfigParser } from './BuildConfigParser.js';\nexport { BuildFunction } from './BuildFunction.js';\nexport { BuildStepInput } from './BuildStepInput.js';\nexport { BuildStepOutput } from './BuildStepOutput.js';\nexport { BuildStepContext } from './BuildStepContext.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC","sourcesContent":["export { BuildConfigParser } from './BuildConfigParser.js';\nexport { BuildFunction } from './BuildFunction.js';\nexport { BuildStepInput } from './BuildStepInput.js';\nexport { BuildStepOutput } from './BuildStepOutput.js';\nexport { BuildStepContext } from './BuildStepContext.js';\nexport { BuildWorkflow } from './BuildWorkflow.js';\nexport * as errors from './errors.js';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildConfigError } from '../errors
|
|
1
|
+
import { BuildConfigError } from '../errors.js';
|
|
2
2
|
import { nullthrows } from './nullthrows.js';
|
|
3
3
|
export const BUILD_STEP_INPUT_EXPRESSION_REGEXP = /\${\s*inputs\.([\S]+)\s*}/;
|
|
4
4
|
export const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = /\${\s*steps\.([\S]+)\s*}/;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/utils/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,kCAAkC,GAAG,2BAA2B,CAAC;AAC9E,MAAM,CAAC,MAAM,mCAAmC,GAAG,0BAA0B,CAAC;AAE9E,MAAM,UAAU,qBAAqB,CACnC,cAAsB,EACtB,MAA8B;IAE9B,OAAO,WAAW,CAAC,cAAc,EAAE,kCAAkC,EAAE,MAAM,CAAC,CAAC;AACjF,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,cAAsB,EACtB,EAA4B;IAE5B,OAAO,WAAW,CAAC,cAAc,EAAE,mCAAmC,EAAE,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAClB,cAAsB,EACtB,KAAa,EACb,QAA4D;IAE5D,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,cAAc,CAAC;KACvB;IACD,IAAI,MAAM,GAAG,cAAc,CAAC;IAC5B,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;QAC3B,MAAM,CAAC,EAAE,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC7E,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;KACvC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAOD,MAAM,UAAU,eAAe,CAAC,cAAsB;IACpD,MAAM,MAAM,GAAsB,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9F,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE;QAC3B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACxC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,MAAM,IAAI,gBAAgB,CACxB,gKAAgK,UAAU,GAAG,CAC9K,CAAC;KACH;IACD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC","sourcesContent":["import { BuildConfigError } from '../errors.js';\n\nimport { nullthrows } from './nullthrows.js';\n\nexport const BUILD_STEP_INPUT_EXPRESSION_REGEXP = /\\${\\s*inputs\\.([\\S]+)\\s*}/;\nexport const BUILD_STEP_OUTPUT_EXPRESSION_REGEXP = /\\${\\s*steps\\.([\\S]+)\\s*}/;\n\nexport function interpolateWithInputs(\n templateString: string,\n inputs: Record<string, string>\n): string {\n return interpolate(templateString, BUILD_STEP_INPUT_EXPRESSION_REGEXP, inputs);\n}\n\nexport function interpolateWithOutputs(\n templateString: string,\n fn: (path: string) => string\n): string {\n return interpolate(templateString, BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, fn);\n}\n\nfunction interpolate(\n templateString: string,\n regex: RegExp,\n varsOrFn: Record<string, string> | ((key: string) => string)\n): string {\n const matched = templateString.match(new RegExp(regex, 'g'));\n if (!matched) {\n return templateString;\n }\n let result = templateString;\n for (const match of matched) {\n const [, key] = nullthrows(match.match(regex));\n const value = typeof varsOrFn === 'function' ? varsOrFn(key) : varsOrFn[key];\n result = result.replace(match, value);\n }\n return result;\n}\n\ninterface BuildOutputPath {\n stepId: string;\n outputId: string;\n}\n\nexport function findOutputPaths(templateString: string): BuildOutputPath[] {\n const result: BuildOutputPath[] = [];\n const matches = templateString.matchAll(new RegExp(BUILD_STEP_OUTPUT_EXPRESSION_REGEXP, 'g'));\n for (const match of matches) {\n result.push(parseOutputPath(match[1]));\n }\n return result;\n}\n\nexport function parseOutputPath(outputPath: string): BuildOutputPath {\n const splits = outputPath.split('.');\n if (splits.length !== 2) {\n throw new BuildConfigError(\n `Step output path must consist of two components joined with a dot, where first is the step ID, and second is the output name, e.g. \"step3.output1\". Passed: \"${outputPath}\"`\n );\n }\n const [stepId, outputId] = splits;\n return { stepId, outputId };\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/steps",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0
|
|
4
|
+
"version": "1.0.0",
|
|
5
5
|
"main": "./dist_commonjs/index.cjs",
|
|
6
6
|
"types": "./dist_esm/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"node": ">=14.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@expo/logger": "0.0
|
|
49
|
+
"@expo/logger": "1.0.0",
|
|
50
50
|
"@expo/spawn-async": "^1.7.0",
|
|
51
51
|
"arg": "^5.0.2",
|
|
52
52
|
"joi": "^17.7.0",
|
|
@@ -57,5 +57,6 @@
|
|
|
57
57
|
"volta": {
|
|
58
58
|
"node": "18.13.0",
|
|
59
59
|
"yarn": "1.22.19"
|
|
60
|
-
}
|
|
60
|
+
},
|
|
61
|
+
"gitHead": "f60c98eaf97183f89796094c47df85b558c2979a"
|
|
61
62
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuildConfigError = void 0;
|
|
4
|
-
const UserError_js_1 = require("./UserError.cjs");
|
|
5
|
-
class BuildConfigError extends UserError_js_1.UserError {
|
|
6
|
-
}
|
|
7
|
-
exports.BuildConfigError = BuildConfigError;
|
|
8
|
-
//# sourceMappingURL=BuildConfigError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildConfigError.js","sourceRoot":"","sources":["../../src/errors/BuildConfigError.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAE3C,MAAa,gBAAiB,SAAQ,wBAAS;CAAG;AAAlD,4CAAkD","sourcesContent":["import { UserError } from './UserError.js';\n\nexport class BuildConfigError extends UserError {}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildInternalError.js","sourceRoot":"","sources":["../../src/errors/BuildInternalError.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAmB,SAAQ,KAAK;CAAG;AAAhD,gDAAgD","sourcesContent":["export class BuildInternalError extends Error {}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuildStepRuntimeError = void 0;
|
|
4
|
-
const UserError_js_1 = require("./UserError.cjs");
|
|
5
|
-
class BuildStepRuntimeError extends UserError_js_1.UserError {
|
|
6
|
-
}
|
|
7
|
-
exports.BuildStepRuntimeError = BuildStepRuntimeError;
|
|
8
|
-
//# sourceMappingURL=BuildStepRuntimeError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildStepRuntimeError.js","sourceRoot":"","sources":["../../src/errors/BuildStepRuntimeError.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAE3C,MAAa,qBAAsB,SAAQ,wBAAS;CAAG;AAAvD,sDAAuD","sourcesContent":["import { UserError } from './UserError.js';\n\nexport class BuildStepRuntimeError extends UserError {}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuildWorkflowError = void 0;
|
|
4
|
-
const UserError_js_1 = require("./UserError.cjs");
|
|
5
|
-
class BuildWorkflowError extends UserError_js_1.UserError {
|
|
6
|
-
constructor(message, errors, extra) {
|
|
7
|
-
super(message, extra);
|
|
8
|
-
this.message = message;
|
|
9
|
-
this.errors = errors;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.BuildWorkflowError = BuildWorkflowError;
|
|
13
|
-
//# sourceMappingURL=BuildWorkflowError.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BuildConfigError } from './BuildConfigError.js';
|
|
2
|
-
import { UserError } from './UserError.js';
|
|
3
|
-
export declare class BuildWorkflowError extends UserError {
|
|
4
|
-
readonly message: string;
|
|
5
|
-
readonly errors: BuildConfigError[];
|
|
6
|
-
constructor(message: string, errors: BuildConfigError[], extra?: {
|
|
7
|
-
metadata?: object;
|
|
8
|
-
cause?: Error;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildWorkflowError.js","sourceRoot":"","sources":["../../src/errors/BuildWorkflowError.ts"],"names":[],"mappings":";;;AACA,iDAA2C;AAE3C,MAAa,kBAAmB,SAAQ,wBAAS;IAC/C,YAC2B,OAAe,EACxB,MAA0B,EAC1C,KAGC;QAED,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAPG,YAAO,GAAP,OAAO,CAAQ;QACxB,WAAM,GAAN,MAAM,CAAoB;IAO5C,CAAC;CACF;AAXD,gDAWC","sourcesContent":["import { BuildConfigError } from './BuildConfigError.js';\nimport { UserError } from './UserError.js';\n\nexport class BuildWorkflowError extends UserError {\n constructor(\n public override readonly message: string,\n public readonly errors: BuildConfigError[],\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message, extra);\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserError = void 0;
|
|
4
|
-
class UserError extends Error {
|
|
5
|
-
constructor(message, extra) {
|
|
6
|
-
var _a;
|
|
7
|
-
super(message);
|
|
8
|
-
this.message = message;
|
|
9
|
-
this.metadata = (_a = extra === null || extra === void 0 ? void 0 : extra.cause) !== null && _a !== void 0 ? _a : {};
|
|
10
|
-
this.cause = extra === null || extra === void 0 ? void 0 : extra.cause;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.UserError = UserError;
|
|
14
|
-
//# sourceMappingURL=UserError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserError.js","sourceRoot":"","sources":["../../src/errors/UserError.ts"],"names":[],"mappings":";;;AAAA,MAAsB,SAAU,SAAQ,KAAK;IAI3C,YAC2B,OAAe,EACxC,KAGC;;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QANU,YAAO,GAAP,OAAO,CAAQ;QAOxC,IAAI,CAAC,QAAQ,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,mCAAI,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;IAC5B,CAAC;CACF;AAfD,8BAeC","sourcesContent":["export abstract class UserError extends Error {\n public readonly cause?: Error;\n public readonly metadata: object;\n\n constructor(\n public override readonly message: string,\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message);\n this.metadata = extra?.cause ?? {};\n this.cause = extra?.cause;\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildConfigError.js","sourceRoot":"","sources":["../../src/errors/BuildConfigError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,OAAO,gBAAiB,SAAQ,SAAS;CAAG","sourcesContent":["import { UserError } from './UserError.js';\n\nexport class BuildConfigError extends UserError {}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildInternalError.js","sourceRoot":"","sources":["../../src/errors/BuildInternalError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;CAAG","sourcesContent":["export class BuildInternalError extends Error {}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildStepRuntimeError.js","sourceRoot":"","sources":["../../src/errors/BuildStepRuntimeError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;CAAG","sourcesContent":["import { UserError } from './UserError.js';\n\nexport class BuildStepRuntimeError extends UserError {}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { BuildConfigError } from './BuildConfigError.js';
|
|
2
|
-
import { UserError } from './UserError.js';
|
|
3
|
-
export declare class BuildWorkflowError extends UserError {
|
|
4
|
-
readonly message: string;
|
|
5
|
-
readonly errors: BuildConfigError[];
|
|
6
|
-
constructor(message: string, errors: BuildConfigError[], extra?: {
|
|
7
|
-
metadata?: object;
|
|
8
|
-
cause?: Error;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { UserError } from './UserError.js';
|
|
2
|
-
export class BuildWorkflowError extends UserError {
|
|
3
|
-
constructor(message, errors, extra) {
|
|
4
|
-
super(message, extra);
|
|
5
|
-
this.message = message;
|
|
6
|
-
this.errors = errors;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=BuildWorkflowError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BuildWorkflowError.js","sourceRoot":"","sources":["../../src/errors/BuildWorkflowError.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,OAAO,kBAAmB,SAAQ,SAAS;IAC/C,YAC2B,OAAe,EACxB,MAA0B,EAC1C,KAGC;QAED,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAPG,YAAO,GAAP,OAAO,CAAQ;QACxB,WAAM,GAAN,MAAM,CAAoB;IAO5C,CAAC;CACF","sourcesContent":["import { BuildConfigError } from './BuildConfigError.js';\nimport { UserError } from './UserError.js';\n\nexport class BuildWorkflowError extends UserError {\n constructor(\n public override readonly message: string,\n public readonly errors: BuildConfigError[],\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message, extra);\n }\n}\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export class UserError extends Error {
|
|
2
|
-
constructor(message, extra) {
|
|
3
|
-
var _a;
|
|
4
|
-
super(message);
|
|
5
|
-
this.message = message;
|
|
6
|
-
this.metadata = (_a = extra === null || extra === void 0 ? void 0 : extra.cause) !== null && _a !== void 0 ? _a : {};
|
|
7
|
-
this.cause = extra === null || extra === void 0 ? void 0 : extra.cause;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=UserError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserError.js","sourceRoot":"","sources":["../../src/errors/UserError.ts"],"names":[],"mappings":"AAAA,MAAM,OAAgB,SAAU,SAAQ,KAAK;IAI3C,YAC2B,OAAe,EACxC,KAGC;;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QANU,YAAO,GAAP,OAAO,CAAQ;QAOxC,IAAI,CAAC,QAAQ,GAAG,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,mCAAI,EAAE,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC;IAC5B,CAAC;CACF","sourcesContent":["export abstract class UserError extends Error {\n public readonly cause?: Error;\n public readonly metadata: object;\n\n constructor(\n public override readonly message: string,\n extra?: {\n metadata?: object;\n cause?: Error;\n }\n ) {\n super(message);\n this.metadata = extra?.cause ?? {};\n this.cause = extra?.cause;\n }\n}\n"]}
|