@catladder/pipeline 3.30.0 → 3.30.1
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/dist/build/rails/index.js +2 -2
- package/dist/constants.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/automatic-releases.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-llama.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +1 -1
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +1 -1
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +1 -1
- package/examples/__snapshots__/custom-build-job.test.ts.snap +1 -1
- package/examples/__snapshots__/custom-deploy.test.ts.snap +1 -1
- package/examples/__snapshots__/custom-envs.test.ts.snap +1 -1
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +1 -1
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +1 -1
- package/examples/__snapshots__/git-submodule.test.ts.snap +1 -1
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +1 -1
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +1 -1
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +1 -1
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +1 -1
- package/examples/__snapshots__/local-dot-env.test.ts.snap +1 -1
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +1 -1
- package/examples/__snapshots__/modify-generated-files.test.ts.snap +1 -1
- package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +1 -1
- package/examples/__snapshots__/multiline-var.test.ts.snap +1 -1
- package/examples/__snapshots__/native-app.test.ts.snap +1 -1
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +1 -1
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +1 -1
- package/examples/__snapshots__/override-secrets.test.ts.snap +1 -1
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +1 -1
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +1 -1
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +1 -1
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +1 -1
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +1 -1
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +1 -1
- package/examples/automatic-releases.test.ts +1 -0
- package/examples/cloud-run-execute-script-on-deploy.test.ts +1 -0
- package/examples/cloud-run-health-check-defaults.test.ts +1 -0
- package/examples/cloud-run-health-check-only-startup.test.ts +1 -0
- package/examples/cloud-run-health-check.test.ts +1 -0
- package/examples/cloud-run-http2.test.ts +1 -0
- package/examples/cloud-run-llama.test.ts +1 -0
- package/examples/cloud-run-memory-limit.test.ts +1 -0
- package/examples/cloud-run-meteor-with-worker.test.ts +1 -0
- package/examples/cloud-run-nextjs.test.ts +1 -0
- package/examples/cloud-run-no-cpu-throttling.test.ts +1 -0
- package/examples/cloud-run-no-service.test.ts +1 -0
- package/examples/cloud-run-non-public.test.ts +1 -0
- package/examples/cloud-run-post-stop-job.test.ts +1 -0
- package/examples/cloud-run-service-custom-vpc-connector.test.ts +1 -0
- package/examples/cloud-run-service-custom-vpc.test.ts +1 -0
- package/examples/cloud-run-service-gen2.test.ts +1 -0
- package/examples/cloud-run-service-increase-timout.test.ts +1 -0
- package/examples/cloud-run-service-with-volumes.test.ts +1 -0
- package/examples/cloud-run-storybook.test.ts +1 -0
- package/examples/cloud-run-with-agents.test.ts +1 -0
- package/examples/cloud-run-with-gpu.test.ts +1 -0
- package/examples/cloud-run-with-ngnix.test.ts +1 -0
- package/examples/cloud-run-with-sql-legacy-jobs.test.ts +1 -0
- package/examples/cloud-run-with-sql-multiple-dbs.test.ts +1 -0
- package/examples/cloud-run-with-sql-reuse-db.test.ts +1 -0
- package/examples/cloud-run-with-sql.test.ts +1 -0
- package/examples/cloud-run-with-worker.test.ts +1 -0
- package/examples/custom-build-job-with-tests.test.ts +1 -0
- package/examples/custom-build-job.test.ts +1 -0
- package/examples/custom-deploy.test.ts +1 -0
- package/examples/custom-envs.test.ts +1 -0
- package/examples/custom-sbom-java.test.ts +1 -0
- package/examples/custom-verify-job.test.ts +1 -0
- package/examples/git-submodule.test.ts +1 -0
- package/examples/kubernetes-application-customization.test.ts +1 -0
- package/examples/kubernetes-with-cloud-sql.test.ts +1 -0
- package/examples/kubernetes-with-jobs.test.ts +1 -0
- package/examples/kubernetes-with-mongodb.test.ts +1 -0
- package/examples/local-dot-env.test.ts +1 -0
- package/examples/meteor-kubernetes.test.ts +1 -0
- package/examples/modify-generated-files.test.ts +1 -0
- package/examples/modify-generated-yaml.test.ts +1 -0
- package/examples/multiline-var.test.ts +1 -0
- package/examples/native-app.test.ts +1 -0
- package/examples/node-build-with-custom-image.test.ts +1 -0
- package/examples/node-build-with-docker-additions.test.ts +1 -0
- package/examples/override-secrets.test.ts +1 -0
- package/examples/rails-k8s-with-worker.test.ts +1 -0
- package/examples/referencing-other-vars.test.ts +1 -0
- package/examples/wait-for-other-deploy.test.ts +1 -0
- package/examples/workspace-api-www-turbo-cache.test.ts +1 -0
- package/examples/workspace-api-www.test.ts +1 -0
- package/package.json +1 -3
- package/scripts/generate-examples-test.ts +1 -0
- package/src/build/base/__tests__/__snapshots__/createArtifactsConfig.test.ts.snap +4 -4
- package/src/build/base/__tests__/createArtifactsConfig.test.ts +1 -0
- package/src/build/custom/__tests__/testJob.test.ts +1 -0
- package/src/build/rails/index.ts +1 -1
- package/src/config/__tests__/__snapshots__/getAllEnvs.test.ts.snap +4 -4
- package/src/config/__tests__/__snapshots__/getAllEnvsInAllComponents.test.ts.snap +2 -2
- package/src/config/__tests__/configruedEnvs.test.ts +1 -0
- package/src/config/__tests__/getAllEnvs.test.ts +1 -0
- package/src/config/__tests__/getAllEnvsInAllComponents.test.ts +1 -0
- package/src/pipeline/__tests__/__snapshots__/getPipelineStages.test.ts.snap +2 -2
- package/src/pipeline/__tests__/getPipelineStages.test.ts +1 -0
- package/src/variables/__tests__/resolveAllReferences.test.ts +1 -0
- package/src/variables/__tests__/resolveAllReferencesOnce.test.ts +1 -0
- package/src/variables/__tests__/resolveReferencesOnce.test.ts +1 -0
- package/src/variables/__tests__/variableValue.test.ts +1 -0
- package/tsconfig.json +2 -1
- package/dist/build/base/__tests__/createArtifactsConfig.test.d.ts +0 -1
- package/dist/build/base/__tests__/createArtifactsConfig.test.js +0 -42
- package/dist/build/custom/__tests__/testJob.test.d.ts +0 -1
- package/dist/build/custom/__tests__/testJob.test.js +0 -36
- package/dist/config/__tests__/configruedEnvs.test.d.ts +0 -1
- package/dist/config/__tests__/configruedEnvs.test.js +0 -112
- package/dist/config/__tests__/getAllEnvs.test.d.ts +0 -1
- package/dist/config/__tests__/getAllEnvs.test.js +0 -79
- package/dist/config/__tests__/getAllEnvsInAllComponents.test.d.ts +0 -1
- package/dist/config/__tests__/getAllEnvsInAllComponents.test.js +0 -73
- package/dist/pipeline/__tests__/getPipelineStages.test.d.ts +0 -1
- package/dist/pipeline/__tests__/getPipelineStages.test.js +0 -73
- package/dist/variables/__tests__/resolveAllReferences.test.d.ts +0 -1
- package/dist/variables/__tests__/resolveAllReferences.test.js +0 -218
- package/dist/variables/__tests__/resolveAllReferencesOnce.test.d.ts +0 -1
- package/dist/variables/__tests__/resolveAllReferencesOnce.test.js +0 -171
- package/dist/variables/__tests__/resolveReferencesOnce.test.d.ts +0 -1
- package/dist/variables/__tests__/resolveReferencesOnce.test.js +0 -199
- package/dist/variables/__tests__/variableValue.test.d.ts +0 -1
- package/dist/variables/__tests__/variableValue.test.js +0 -36
- /package/dist/build/rails/{test.d.ts → testJob.d.ts} +0 -0
- /package/dist/build/rails/{test.js → testJob.js} +0 -0
- /package/src/build/rails/{test.ts → testJob.ts} +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var getPipelineStages_1 = require("../getPipelineStages");
|
|
7
|
-
describe("getPipelineStages()", function () {
|
|
8
|
-
var cluster = {
|
|
9
|
-
type: "gcloud",
|
|
10
|
-
name: "mega-cluster",
|
|
11
|
-
projectId: "super-google-project",
|
|
12
|
-
region: "ch-blabla"
|
|
13
|
-
};
|
|
14
|
-
var SIMPLE_CONFIG1 = {
|
|
15
|
-
appName: "my-app",
|
|
16
|
-
customerName: "pan",
|
|
17
|
-
components: {
|
|
18
|
-
app1: {
|
|
19
|
-
dir: "dir1",
|
|
20
|
-
build: {
|
|
21
|
-
type: "node"
|
|
22
|
-
},
|
|
23
|
-
deploy: {
|
|
24
|
-
type: "kubernetes",
|
|
25
|
-
cluster: cluster
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
app2: {
|
|
29
|
-
dir: "dir2",
|
|
30
|
-
build: {
|
|
31
|
-
type: "node"
|
|
32
|
-
},
|
|
33
|
-
deploy: {
|
|
34
|
-
type: "kubernetes",
|
|
35
|
-
cluster: cluster
|
|
36
|
-
},
|
|
37
|
-
env: {
|
|
38
|
-
dev2: {
|
|
39
|
-
type: "dev"
|
|
40
|
-
},
|
|
41
|
-
review2: {
|
|
42
|
-
type: "review"
|
|
43
|
-
},
|
|
44
|
-
stage2: {
|
|
45
|
-
type: "stage"
|
|
46
|
-
},
|
|
47
|
-
prod2: {
|
|
48
|
-
type: "prod"
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
app3: {
|
|
53
|
-
dir: "dir2",
|
|
54
|
-
build: {
|
|
55
|
-
type: "node"
|
|
56
|
-
},
|
|
57
|
-
deploy: {
|
|
58
|
-
type: "kubernetes",
|
|
59
|
-
cluster: cluster
|
|
60
|
-
},
|
|
61
|
-
env: {
|
|
62
|
-
dev: false,
|
|
63
|
-
review: false,
|
|
64
|
-
stage: false,
|
|
65
|
-
prod: false
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
it("should return all envs for SIMPLE_CONFIG1", function () {
|
|
71
|
-
expect((0, getPipelineStages_1.getPipelineStages)(SIMPLE_CONFIG1)).toMatchSnapshot();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) {
|
|
5
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
-
resolve(value);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.next(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function rejected(value) {
|
|
18
|
-
try {
|
|
19
|
-
step(generator["throw"](value));
|
|
20
|
-
} catch (e) {
|
|
21
|
-
reject(e);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function step(result) {
|
|
25
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
-
}
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
-
var _ = {
|
|
32
|
-
label: 0,
|
|
33
|
-
sent: function () {
|
|
34
|
-
if (t[0] & 1) throw t[1];
|
|
35
|
-
return t[1];
|
|
36
|
-
},
|
|
37
|
-
trys: [],
|
|
38
|
-
ops: []
|
|
39
|
-
},
|
|
40
|
-
f,
|
|
41
|
-
y,
|
|
42
|
-
t,
|
|
43
|
-
g;
|
|
44
|
-
return g = {
|
|
45
|
-
next: verb(0),
|
|
46
|
-
"throw": verb(1),
|
|
47
|
-
"return": verb(2)
|
|
48
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
-
return this;
|
|
50
|
-
}), g;
|
|
51
|
-
function verb(n) {
|
|
52
|
-
return function (v) {
|
|
53
|
-
return step([n, v]);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function step(op) {
|
|
57
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
59
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
-
switch (op[0]) {
|
|
62
|
-
case 0:
|
|
63
|
-
case 1:
|
|
64
|
-
t = op;
|
|
65
|
-
break;
|
|
66
|
-
case 4:
|
|
67
|
-
_.label++;
|
|
68
|
-
return {
|
|
69
|
-
value: op[1],
|
|
70
|
-
done: false
|
|
71
|
-
};
|
|
72
|
-
case 5:
|
|
73
|
-
_.label++;
|
|
74
|
-
y = op[1];
|
|
75
|
-
op = [0];
|
|
76
|
-
continue;
|
|
77
|
-
case 7:
|
|
78
|
-
op = _.ops.pop();
|
|
79
|
-
_.trys.pop();
|
|
80
|
-
continue;
|
|
81
|
-
default:
|
|
82
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
-
_ = 0;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
-
_.label = op[1];
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
-
_.label = t[1];
|
|
92
|
-
t = op;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
if (t && _.label < t[2]) {
|
|
96
|
-
_.label = t[2];
|
|
97
|
-
_.ops.push(op);
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (t[2]) _.ops.pop();
|
|
101
|
-
_.trys.pop();
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
op = body.call(thisArg, _);
|
|
105
|
-
} catch (e) {
|
|
106
|
-
op = [6, e];
|
|
107
|
-
y = 0;
|
|
108
|
-
} finally {
|
|
109
|
-
f = t = 0;
|
|
110
|
-
}
|
|
111
|
-
if (op[0] & 5) throw op[1];
|
|
112
|
-
return {
|
|
113
|
-
value: op[0] ? op[1] : void 0,
|
|
114
|
-
done: true
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
Object.defineProperty(exports, "__esModule", {
|
|
119
|
-
value: true
|
|
120
|
-
});
|
|
121
|
-
var VariableValueContainingReferences_1 = require("../VariableValueContainingReferences");
|
|
122
|
-
var resolveAllReferences_1 = require("../resolveAllReferences");
|
|
123
|
-
describe("replaceAllReferences", function () {
|
|
124
|
-
it("should replace all references recursivly", function () {
|
|
125
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
-
var values, getEnvVars, result;
|
|
127
|
-
return __generator(this, function (_a) {
|
|
128
|
-
switch (_a.label) {
|
|
129
|
-
case 0:
|
|
130
|
-
values = {
|
|
131
|
-
myVar: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the 2nd component has ${component2:variable1} and self reference ${variable2}", {
|
|
132
|
-
componentName: "component1"
|
|
133
|
-
}),
|
|
134
|
-
myOtherVar: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the third component has ${component3:variable1}, isn't that cool?", {
|
|
135
|
-
componentName: "component1"
|
|
136
|
-
}),
|
|
137
|
-
myThirdVar: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("value from component3: ${component3:variable3}", {
|
|
138
|
-
componentName: "component1"
|
|
139
|
-
})
|
|
140
|
-
};
|
|
141
|
-
getEnvVars = function (componentName) {
|
|
142
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
143
|
-
return __generator(this, function (_a) {
|
|
144
|
-
return [2 /*return*/, {
|
|
145
|
-
variable1: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am variable1 from ".concat(componentName), {
|
|
146
|
-
componentName: componentName
|
|
147
|
-
}),
|
|
148
|
-
variable2: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("foo from ".concat(componentName), {
|
|
149
|
-
componentName: componentName
|
|
150
|
-
}),
|
|
151
|
-
variable3: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am referencing ${component1:variable1}", {
|
|
152
|
-
componentName: componentName
|
|
153
|
-
})
|
|
154
|
-
}];
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
return [4 /*yield*/, (0, resolveAllReferences_1.resolveAllReferences)(values, getEnvVars)];
|
|
159
|
-
case 1:
|
|
160
|
-
result = _a.sent();
|
|
161
|
-
expect(result).toEqual({
|
|
162
|
-
myVar: new VariableValueContainingReferences_1.VariableValueContainingReferences(["the 2nd component has ", "i am variable1 from component2", " and self reference ", "foo from component1"]),
|
|
163
|
-
myOtherVar: new VariableValueContainingReferences_1.VariableValueContainingReferences(["the third component has ", "i am variable1 from component3", ", isn't that cool?"]),
|
|
164
|
-
myThirdVar: new VariableValueContainingReferences_1.VariableValueContainingReferences(["value from component3: ", "i am referencing ", "i am variable1 from component1"])
|
|
165
|
-
});
|
|
166
|
-
return [2 /*return*/];
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
it("detects infinte loop", function () {
|
|
172
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
173
|
-
var values, getEnvVars;
|
|
174
|
-
return __generator(this, function (_a) {
|
|
175
|
-
switch (_a.label) {
|
|
176
|
-
case 0:
|
|
177
|
-
values = {
|
|
178
|
-
myVar: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am referencing ${component2:variable1}", {
|
|
179
|
-
componentName: "component1"
|
|
180
|
-
})
|
|
181
|
-
};
|
|
182
|
-
getEnvVars = function (componentName) {
|
|
183
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
184
|
-
return __generator(this, function (_a) {
|
|
185
|
-
if (componentName === "component2") {
|
|
186
|
-
return [2 /*return*/, {
|
|
187
|
-
variable1: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am referencing ${component3:variable1}", {
|
|
188
|
-
componentName: componentName
|
|
189
|
-
})
|
|
190
|
-
}];
|
|
191
|
-
} else if (componentName === "component3") {
|
|
192
|
-
return [2 /*return*/, {
|
|
193
|
-
variable1: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am referencing ${component1:variable1}", {
|
|
194
|
-
componentName: componentName
|
|
195
|
-
})
|
|
196
|
-
}];
|
|
197
|
-
} else {
|
|
198
|
-
return [2 /*return*/, {
|
|
199
|
-
variable1: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am referencing ${component2:variable1}", {
|
|
200
|
-
componentName: componentName
|
|
201
|
-
})
|
|
202
|
-
}];
|
|
203
|
-
}
|
|
204
|
-
return [2 /*return*/];
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
// expect to throw an error
|
|
209
|
-
return [4 /*yield*/, expect((0, resolveAllReferences_1.resolveAllReferences)(values, getEnvVars)).rejects.toThrow("Infinite loop detected in these variables: myVar (last reference: ${component1:variable1})")];
|
|
210
|
-
case 1:
|
|
211
|
-
// expect to throw an error
|
|
212
|
-
_a.sent();
|
|
213
|
-
return [2 /*return*/];
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) {
|
|
5
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
-
resolve(value);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.next(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function rejected(value) {
|
|
18
|
-
try {
|
|
19
|
-
step(generator["throw"](value));
|
|
20
|
-
} catch (e) {
|
|
21
|
-
reject(e);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function step(result) {
|
|
25
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
-
}
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
-
var _ = {
|
|
32
|
-
label: 0,
|
|
33
|
-
sent: function () {
|
|
34
|
-
if (t[0] & 1) throw t[1];
|
|
35
|
-
return t[1];
|
|
36
|
-
},
|
|
37
|
-
trys: [],
|
|
38
|
-
ops: []
|
|
39
|
-
},
|
|
40
|
-
f,
|
|
41
|
-
y,
|
|
42
|
-
t,
|
|
43
|
-
g;
|
|
44
|
-
return g = {
|
|
45
|
-
next: verb(0),
|
|
46
|
-
"throw": verb(1),
|
|
47
|
-
"return": verb(2)
|
|
48
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
-
return this;
|
|
50
|
-
}), g;
|
|
51
|
-
function verb(n) {
|
|
52
|
-
return function (v) {
|
|
53
|
-
return step([n, v]);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function step(op) {
|
|
57
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
59
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
-
switch (op[0]) {
|
|
62
|
-
case 0:
|
|
63
|
-
case 1:
|
|
64
|
-
t = op;
|
|
65
|
-
break;
|
|
66
|
-
case 4:
|
|
67
|
-
_.label++;
|
|
68
|
-
return {
|
|
69
|
-
value: op[1],
|
|
70
|
-
done: false
|
|
71
|
-
};
|
|
72
|
-
case 5:
|
|
73
|
-
_.label++;
|
|
74
|
-
y = op[1];
|
|
75
|
-
op = [0];
|
|
76
|
-
continue;
|
|
77
|
-
case 7:
|
|
78
|
-
op = _.ops.pop();
|
|
79
|
-
_.trys.pop();
|
|
80
|
-
continue;
|
|
81
|
-
default:
|
|
82
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
-
_ = 0;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
-
_.label = op[1];
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
-
_.label = t[1];
|
|
92
|
-
t = op;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
if (t && _.label < t[2]) {
|
|
96
|
-
_.label = t[2];
|
|
97
|
-
_.ops.push(op);
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (t[2]) _.ops.pop();
|
|
101
|
-
_.trys.pop();
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
op = body.call(thisArg, _);
|
|
105
|
-
} catch (e) {
|
|
106
|
-
op = [6, e];
|
|
107
|
-
y = 0;
|
|
108
|
-
} finally {
|
|
109
|
-
f = t = 0;
|
|
110
|
-
}
|
|
111
|
-
if (op[0] & 5) throw op[1];
|
|
112
|
-
return {
|
|
113
|
-
value: op[0] ? op[1] : void 0,
|
|
114
|
-
done: true
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
Object.defineProperty(exports, "__esModule", {
|
|
119
|
-
value: true
|
|
120
|
-
});
|
|
121
|
-
var VariableValueContainingReferences_1 = require("../VariableValueContainingReferences");
|
|
122
|
-
var resolveAllReferencesOnce_1 = require("../resolveAllReferencesOnce");
|
|
123
|
-
describe("resolveAllReferencesOnce", function () {
|
|
124
|
-
it("should replace all references", function () {
|
|
125
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
-
var values, getEnvVars, result;
|
|
127
|
-
return __generator(this, function (_a) {
|
|
128
|
-
switch (_a.label) {
|
|
129
|
-
case 0:
|
|
130
|
-
values = {
|
|
131
|
-
myVar: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the 2nd component has ${component2:variable1} and self reference ${variable2}", {
|
|
132
|
-
componentName: "component1"
|
|
133
|
-
}),
|
|
134
|
-
myOtherVar: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the third component has ${component3:variable1}, isn't that cool?", {
|
|
135
|
-
componentName: "component1"
|
|
136
|
-
}),
|
|
137
|
-
myThirdVar: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("value from component3: ${component3:variable3}", {
|
|
138
|
-
componentName: "component1"
|
|
139
|
-
})
|
|
140
|
-
};
|
|
141
|
-
getEnvVars = function (componentName) {
|
|
142
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
143
|
-
return __generator(this, function (_a) {
|
|
144
|
-
return [2 /*return*/, {
|
|
145
|
-
variable1: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am variable1 from ".concat(componentName), {
|
|
146
|
-
componentName: componentName
|
|
147
|
-
}),
|
|
148
|
-
variable2: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("foo from ".concat(componentName), {
|
|
149
|
-
componentName: componentName
|
|
150
|
-
}),
|
|
151
|
-
variable3: (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("i am referencing ${component1:variable1}", {
|
|
152
|
-
componentName: componentName
|
|
153
|
-
})
|
|
154
|
-
}];
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
return [4 /*yield*/, (0, resolveAllReferencesOnce_1.resolveAllReferencesOnce)(values, getEnvVars)];
|
|
159
|
-
case 1:
|
|
160
|
-
result = _a.sent();
|
|
161
|
-
expect(result).toEqual({
|
|
162
|
-
myVar: new VariableValueContainingReferences_1.VariableValueContainingReferences(["the 2nd component has ", "i am variable1 from component2", " and self reference ", "foo from component1"]),
|
|
163
|
-
myOtherVar: new VariableValueContainingReferences_1.VariableValueContainingReferences(["the third component has ", "i am variable1 from component3", ", isn't that cool?"]),
|
|
164
|
-
myThirdVar: new VariableValueContainingReferences_1.VariableValueContainingReferences(["value from component3: ", "i am referencing ", new VariableValueContainingReferences_1.VariableReference("component1", "variable1")])
|
|
165
|
-
});
|
|
166
|
-
return [2 /*return*/];
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) {
|
|
5
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
6
|
-
resolve(value);
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.next(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function rejected(value) {
|
|
18
|
-
try {
|
|
19
|
-
step(generator["throw"](value));
|
|
20
|
-
} catch (e) {
|
|
21
|
-
reject(e);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function step(result) {
|
|
25
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
26
|
-
}
|
|
27
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
var __generator = this && this.__generator || function (thisArg, body) {
|
|
31
|
-
var _ = {
|
|
32
|
-
label: 0,
|
|
33
|
-
sent: function () {
|
|
34
|
-
if (t[0] & 1) throw t[1];
|
|
35
|
-
return t[1];
|
|
36
|
-
},
|
|
37
|
-
trys: [],
|
|
38
|
-
ops: []
|
|
39
|
-
},
|
|
40
|
-
f,
|
|
41
|
-
y,
|
|
42
|
-
t,
|
|
43
|
-
g;
|
|
44
|
-
return g = {
|
|
45
|
-
next: verb(0),
|
|
46
|
-
"throw": verb(1),
|
|
47
|
-
"return": verb(2)
|
|
48
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
|
|
49
|
-
return this;
|
|
50
|
-
}), g;
|
|
51
|
-
function verb(n) {
|
|
52
|
-
return function (v) {
|
|
53
|
-
return step([n, v]);
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function step(op) {
|
|
57
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
58
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
59
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
60
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
61
|
-
switch (op[0]) {
|
|
62
|
-
case 0:
|
|
63
|
-
case 1:
|
|
64
|
-
t = op;
|
|
65
|
-
break;
|
|
66
|
-
case 4:
|
|
67
|
-
_.label++;
|
|
68
|
-
return {
|
|
69
|
-
value: op[1],
|
|
70
|
-
done: false
|
|
71
|
-
};
|
|
72
|
-
case 5:
|
|
73
|
-
_.label++;
|
|
74
|
-
y = op[1];
|
|
75
|
-
op = [0];
|
|
76
|
-
continue;
|
|
77
|
-
case 7:
|
|
78
|
-
op = _.ops.pop();
|
|
79
|
-
_.trys.pop();
|
|
80
|
-
continue;
|
|
81
|
-
default:
|
|
82
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
83
|
-
_ = 0;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
87
|
-
_.label = op[1];
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
91
|
-
_.label = t[1];
|
|
92
|
-
t = op;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
if (t && _.label < t[2]) {
|
|
96
|
-
_.label = t[2];
|
|
97
|
-
_.ops.push(op);
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (t[2]) _.ops.pop();
|
|
101
|
-
_.trys.pop();
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
op = body.call(thisArg, _);
|
|
105
|
-
} catch (e) {
|
|
106
|
-
op = [6, e];
|
|
107
|
-
y = 0;
|
|
108
|
-
} finally {
|
|
109
|
-
f = t = 0;
|
|
110
|
-
}
|
|
111
|
-
if (op[0] & 5) throw op[1];
|
|
112
|
-
return {
|
|
113
|
-
value: op[0] ? op[1] : void 0,
|
|
114
|
-
done: true
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
Object.defineProperty(exports, "__esModule", {
|
|
119
|
-
value: true
|
|
120
|
-
});
|
|
121
|
-
var VariableValueContainingReferences_1 = require("../VariableValueContainingReferences");
|
|
122
|
-
var resolveReferencesOnce_1 = require("../resolveReferencesOnce");
|
|
123
|
-
describe("resolveReferencesOnce", function () {
|
|
124
|
-
it("should replace a reference to another component", function () {
|
|
125
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
-
var value, result;
|
|
127
|
-
return __generator(this, function (_a) {
|
|
128
|
-
value = (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the other component has ${otherComponent:variableName}, isn't that cool?", {
|
|
129
|
-
componentName: "myComponent"
|
|
130
|
-
});
|
|
131
|
-
result = (0, resolveReferencesOnce_1.resolveReferencesOnce)(value, function (_a) {
|
|
132
|
-
var componentName = _a.componentName,
|
|
133
|
-
variableName = _a.variableName;
|
|
134
|
-
return (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("replaced ".concat(componentName, ":").concat(variableName), {
|
|
135
|
-
componentName: componentName
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
expect(result.parts).toEqual(["the other component has ", "replaced otherComponent:variableName", ", isn't that cool?"]);
|
|
139
|
-
return [2 /*return*/];
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
it("should keep references in replacement", function () {
|
|
144
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
145
|
-
var value, result;
|
|
146
|
-
return __generator(this, function (_a) {
|
|
147
|
-
value = (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the other component has ${otherComponent:variableName}, isn't that cool?", {
|
|
148
|
-
componentName: "myComponent"
|
|
149
|
-
});
|
|
150
|
-
result = (0, resolveReferencesOnce_1.resolveReferencesOnce)(value, function (_a) {
|
|
151
|
-
var componentName = _a.componentName,
|
|
152
|
-
variableName = _a.variableName;
|
|
153
|
-
return (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("replaced ".concat(componentName, ":").concat(variableName, ", contains reference to ${thirdComponent:x}"), {
|
|
154
|
-
componentName: componentName
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
expect(result.parts).toEqual(["the other component has ", "replaced otherComponent:variableName, contains reference to ", new VariableValueContainingReferences_1.VariableReference("thirdComponent", "x"), ", isn't that cool?"]);
|
|
158
|
-
return [2 /*return*/];
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
it("can be run multiple times", function () {
|
|
163
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
164
|
-
var value, replacer, result;
|
|
165
|
-
return __generator(this, function (_a) {
|
|
166
|
-
value = (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the other component has ${otherComponent:variableName}, isn't that cool?", {
|
|
167
|
-
componentName: "myComponent"
|
|
168
|
-
});
|
|
169
|
-
replacer = function (_a) {
|
|
170
|
-
var componentName = _a.componentName,
|
|
171
|
-
variableName = _a.variableName;
|
|
172
|
-
return (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)(componentName === "thirdComponent" ? "value from third component" : "replaced ".concat(componentName, ":").concat(variableName, ", contains reference to ${thirdComponent:x}"), {
|
|
173
|
-
componentName: componentName
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
|
-
result = (0, resolveReferencesOnce_1.resolveReferencesOnce)((0, resolveReferencesOnce_1.resolveReferencesOnce)(value, replacer), replacer);
|
|
177
|
-
expect(result.parts).toEqual(["the other component has ", "replaced otherComponent:variableName, contains reference to ", "value from third component", ", isn't that cool?"]);
|
|
178
|
-
return [2 /*return*/];
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
it("flags unresolveable", function () {
|
|
183
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
184
|
-
var value, result;
|
|
185
|
-
return __generator(this, function (_a) {
|
|
186
|
-
value = (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)("the other component has ${otherComponent:variableName}, isn't that cool?", {
|
|
187
|
-
componentName: "myComponent"
|
|
188
|
-
});
|
|
189
|
-
result = (0, resolveReferencesOnce_1.resolveReferencesOnce)(value, function (_a) {
|
|
190
|
-
var componentName = _a.componentName,
|
|
191
|
-
variableName = _a.variableName;
|
|
192
|
-
return null;
|
|
193
|
-
});
|
|
194
|
-
expect(result.parts).toEqual(["the other component has ", new VariableValueContainingReferences_1.UnresolvableReference(new VariableValueContainingReferences_1.VariableReference("otherComponent", "variableName")), ", isn't that cool?"]);
|
|
195
|
-
return [2 /*return*/];
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|