@catladder/pipeline 1.75.4 → 1.76.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.
Files changed (112) hide show
  1. package/dist/build/base/createBuildJob.js +5 -27
  2. package/dist/build/base/writeBuildInfo.js +0 -3
  3. package/dist/build/custom/buildJob.js +3 -23
  4. package/dist/build/custom/index.js +3 -10
  5. package/dist/build/docker.js +5 -40
  6. package/dist/build/index.js +0 -8
  7. package/dist/build/node/buildJob.js +3 -25
  8. package/dist/build/node/cache.js +3 -21
  9. package/dist/build/node/index.js +3 -16
  10. package/dist/build/node/meteor.js +3 -20
  11. package/dist/build/node/testJob.js +5 -22
  12. package/dist/build/node/yarn.js +5 -18
  13. package/dist/build/rails/build.js +2 -8
  14. package/dist/build/rails/index.js +3 -11
  15. package/dist/build/rails/test.js +5 -18
  16. package/dist/build/types.d.ts +0 -9
  17. package/dist/build/types.js +0 -4
  18. package/dist/bundles/catladder-gitlab/index.js +1 -1
  19. package/dist/catladder-gitlab.js +6 -24
  20. package/dist/config/{configruedEnvs.test.d.ts → __tests__/configruedEnvs.test.d.ts} +0 -0
  21. package/dist/config/{configruedEnvs.test.js → __tests__/configruedEnvs.test.js} +10 -12
  22. package/dist/config/configruedEnvs.js +7 -22
  23. package/dist/config/index.js +0 -4
  24. package/dist/config/readConfig.js +2 -13
  25. package/dist/constants.js +1 -1
  26. package/dist/context/{resolveReferences.test.d.ts → __tests__/resolveReferences.test.d.ts} +0 -0
  27. package/dist/context/{resolveReferences.test.js → __tests__/resolveReferences.test.js} +52 -103
  28. package/dist/context/getEnvConfig.js +0 -8
  29. package/dist/context/getEnvType.js +0 -5
  30. package/dist/context/getEnvironment.js +13 -49
  31. package/dist/context/getEnvironmentContext.js +0 -5
  32. package/dist/context/getEnvironmentVariables.js +20 -83
  33. package/dist/context/getLabels.js +2 -13
  34. package/dist/context/index.js +13 -58
  35. package/dist/context/resolveReferences.js +36 -126
  36. package/dist/deploy/base.js +4 -19
  37. package/dist/deploy/cloudRun/deployJob.js +19 -61
  38. package/dist/deploy/cloudRun/index.js +17 -39
  39. package/dist/deploy/cloudRun/utils/database.js +11 -29
  40. package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +0 -4
  41. package/dist/deploy/cloudRun/utils/jobName.js +0 -2
  42. package/dist/deploy/custom/deployJob.js +3 -18
  43. package/dist/deploy/custom/index.js +0 -2
  44. package/dist/deploy/dockerTag/deployJob.js +0 -9
  45. package/dist/deploy/dockerTag/index.js +0 -2
  46. package/dist/deploy/index.js +0 -11
  47. package/dist/deploy/kubernetes/additionalSecretKeys.js +0 -9
  48. package/dist/deploy/kubernetes/cloudSql/index.js +0 -12
  49. package/dist/deploy/kubernetes/deployJob.js +3 -24
  50. package/dist/deploy/kubernetes/index.js +7 -17
  51. package/dist/deploy/kubernetes/kubeEnv.d.ts +0 -1
  52. package/dist/deploy/kubernetes/kubeEnv.js +5 -23
  53. package/dist/deploy/kubernetes/kubeValues.js +6 -24
  54. package/dist/deploy/kubernetes/mongodb.js +0 -24
  55. package/dist/deploy/kubernetes/processSecretsAsFiles.js +2 -10
  56. package/dist/deploy/types/base.d.ts +0 -1
  57. package/dist/deploy/types/custom.d.ts +0 -6
  58. package/dist/deploy/types/googleCloudRun.d.ts +4 -12
  59. package/dist/deploy/types/index.js +0 -10
  60. package/dist/deploy/types/kubernetes.d.ts +0 -28
  61. package/dist/deploy/utils.js +0 -11
  62. package/dist/index.js +0 -10
  63. package/dist/pipeline/commitInfo/getBuildId.d.ts +1 -0
  64. package/dist/pipeline/{createChildPipeline.test.js → commitInfo/getBuildId.js} +25 -84
  65. package/dist/pipeline/commitInfo/getCommitInfo.d.ts +2 -0
  66. package/dist/{build/tests/storybook.test.js → pipeline/commitInfo/getCommitInfo.js} +30 -104
  67. package/dist/pipeline/createChildPipeline.js +19 -76
  68. package/dist/pipeline/createJobs.js +35 -135
  69. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +1 -0
  70. package/dist/pipeline/gitlab/makeGitlabJob.js +13 -15
  71. package/dist/pipeline/index.js +0 -4
  72. package/dist/pipeline/packageManager.js +20 -173
  73. package/dist/pipeline/yarn/yarnUtils.d.ts +4 -0
  74. package/dist/pipeline/yarn/yarnUtils.js +193 -0
  75. package/dist/runner/index.js +0 -3
  76. package/dist/tsconfig.tsbuildinfo +1 -1
  77. package/dist/types/config.d.ts +0 -13
  78. package/dist/types/config.js +5 -15
  79. package/dist/types/context.d.ts +0 -2
  80. package/dist/types/environmentContext.d.ts +0 -1
  81. package/dist/types/gitlab-types.d.ts +0 -1
  82. package/dist/types/index.js +0 -6
  83. package/dist/types/jobs.d.ts +5 -15
  84. package/dist/utils/gitlab.js +3 -13
  85. package/dist/utils/index.js +5 -15
  86. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1765 -0
  87. package/examples/__snapshots__/custom-build-job.ts.snap +1174 -0
  88. package/examples/__snapshots__/custom-envs.ts.snap +261 -0
  89. package/examples/__snapshots__/wait-for-other-deploy.ts.snap +1626 -0
  90. package/examples/__utils__/helpers.ts +14 -0
  91. package/examples/{cloud-sql.ts → cloud-run-with-sql.ts} +12 -15
  92. package/examples/custom-build-job.ts +4 -1
  93. package/examples/custom-envs.ts +31 -0
  94. package/examples/wait-for-other-deploy.ts +36 -0
  95. package/package.json +2 -2
  96. package/src/config/{configruedEnvs.test.ts → __tests__/configruedEnvs.test.ts} +3 -3
  97. package/src/context/{resolveReferences.test.ts → __tests__/resolveReferences.test.ts} +3 -3
  98. package/src/deploy/cloudRun/index.ts +2 -1
  99. package/src/deploy/types/googleCloudRun.ts +5 -0
  100. package/src/pipeline/commitInfo/getBuildId.ts +6 -0
  101. package/src/pipeline/commitInfo/getCommitInfo.ts +12 -0
  102. package/src/pipeline/createChildPipeline.ts +6 -1
  103. package/src/pipeline/createJobs.ts +3 -10
  104. package/src/pipeline/gitlab/makeGitlabJob.ts +7 -1
  105. package/src/pipeline/packageManager.ts +4 -38
  106. package/src/pipeline/yarn/yarnUtils.ts +37 -0
  107. package/src/types/jobs.ts +2 -1
  108. package/tsconfig.json +1 -1
  109. package/dist/build/tests/storybook.test.d.ts +0 -1
  110. package/dist/pipeline/createChildPipeline.test.d.ts +0 -1
  111. package/src/build/tests/storybook.test.ts +0 -54
  112. package/src/pipeline/createChildPipeline.test.ts +0 -49
@@ -4,65 +4,47 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  var __rest = this && this.__rest || function (s, e) {
18
14
  var t = {};
19
-
20
15
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
21
-
22
16
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23
17
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
24
18
  }
25
19
  return t;
26
20
  };
27
-
28
21
  var _a;
29
-
30
22
  exports.__esModule = true;
31
-
32
23
  var fs_1 = require("fs");
33
-
34
24
  var js_yaml_1 = require("js-yaml");
35
-
36
25
  var config_1 = require("./config");
37
-
38
26
  var constants_1 = require("./constants");
39
-
40
27
  var pipeline_1 = require("./pipeline");
41
-
42
28
  var _b = process.env,
43
- CI_MERGE_REQUEST_ID = _b.CI_MERGE_REQUEST_ID,
44
- CI_COMMIT_TAG = _b.CI_COMMIT_TAG,
45
- CI_COMMIT_BRANCH = _b.CI_COMMIT_BRANCH,
46
- CI_DEFAULT_BRANCH = _b.CI_DEFAULT_BRANCH;
29
+ CI_MERGE_REQUEST_ID = _b.CI_MERGE_REQUEST_ID,
30
+ CI_COMMIT_TAG = _b.CI_COMMIT_TAG,
31
+ CI_COMMIT_BRANCH = _b.CI_COMMIT_BRANCH,
32
+ CI_DEFAULT_BRANCH = _b.CI_DEFAULT_BRANCH;
47
33
  var isDefaultBranch = Boolean(CI_DEFAULT_BRANCH) && CI_COMMIT_BRANCH === CI_DEFAULT_BRANCH;
48
34
  var isHotfixBranch = CI_COMMIT_BRANCH ? /^[0-9]+\.([0-9]+|x)\.x$/.test(CI_COMMIT_BRANCH) : false;
49
35
  var isMergeRequest = Boolean(CI_MERGE_REQUEST_ID);
50
36
  var isTaggedRelease = Boolean(CI_COMMIT_TAG);
51
37
  console.info("catladder version ".concat(constants_1.PIPELINE_IMAGE_TAG));
52
38
  var trigger = isMergeRequest || isHotfixBranch ? "mr" : isDefaultBranch ? "mainBranch" : isTaggedRelease ? "taggedRelease" : null;
53
-
54
39
  if (trigger) {
55
40
  var config = (_a = (0, config_1.readConfigSync)()) === null || _a === void 0 ? void 0 : _a.config;
56
-
57
41
  if (!config) {
58
42
  throw new Error("no catladder config found");
59
43
  }
60
-
61
44
  (0, pipeline_1.createChildPipeline)("gitlab", trigger, config).then(function (_a) {
62
45
  var jobs = _a.jobs,
63
- mainPipeline = __rest(_a, ["jobs"]); // need to spread out the jobs
64
-
65
-
46
+ mainPipeline = __rest(_a, ["jobs"]);
47
+ // need to spread out the jobs
66
48
  (0, fs_1.writeFileSync)("__pipeline.yml", (0, js_yaml_1.dump)(__assign(__assign({}, jobs), mainPipeline)), {
67
49
  encoding: "utf-8"
68
50
  });
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
-
5
- var _1 = require(".");
6
-
4
+ var __1 = require("..");
7
5
  describe("getAllEnvsByTrigger", function () {
8
6
  var cluster = {
9
7
  type: "gcloud",
@@ -69,43 +67,43 @@ describe("getAllEnvsByTrigger", function () {
69
67
  };
70
68
  describe("mainBranch", function () {
71
69
  it("always includes dev if not disabled", function () {
72
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "mainBranch");
70
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "mainBranch");
73
71
  expect(envs).toEqual(["dev"]);
74
72
  });
75
73
  it("returns additional dev environments", function () {
76
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "mainBranch");
74
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "mainBranch");
77
75
  expect(envs).toEqual(["dev", "dev2"]);
78
76
  });
79
77
  it("does not include disabled envs", function () {
80
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "mainBranch");
78
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "mainBranch");
81
79
  expect(envs).toEqual([]);
82
80
  });
83
81
  });
84
82
  describe("mr", function () {
85
83
  it("always includes review if not disabled", function () {
86
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "mr");
84
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "mr");
87
85
  expect(envs).toEqual(["review"]);
88
86
  });
89
87
  it("returns additional dev environments", function () {
90
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "mr");
88
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "mr");
91
89
  expect(envs).toEqual(["review", "review2"]);
92
90
  });
93
91
  it("does not include disabled envs", function () {
94
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "mr");
92
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "mr");
95
93
  expect(envs).toEqual([]);
96
94
  });
97
95
  });
98
96
  describe("taggedRelease", function () {
99
97
  it("always includes review if not disabled", function () {
100
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "taggedRelease");
98
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "taggedRelease");
101
99
  expect(envs).toEqual(["stage", "prod"]);
102
100
  });
103
101
  it("returns additional dev environments", function () {
104
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "taggedRelease");
102
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "taggedRelease");
105
103
  expect(envs).toEqual(["stage", "prod", "stage2", "prod2"]);
106
104
  });
107
105
  it("does not include disabled envs", function () {
108
- var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "taggedRelease");
106
+ var envs = (0, __1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "taggedRelease");
109
107
  expect(envs).toEqual([]);
110
108
  });
111
109
  });
@@ -4,10 +4,9 @@ var __read = this && this.__read || function (o, n) {
4
4
  var m = typeof Symbol === "function" && o[Symbol.iterator];
5
5
  if (!m) return o;
6
6
  var i = m.call(o),
7
- r,
8
- ar = [],
9
- e;
10
-
7
+ r,
8
+ ar = [],
9
+ e;
11
10
  try {
12
11
  while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
13
12
  } catch (error) {
@@ -21,10 +20,8 @@ var __read = this && this.__read || function (o, n) {
21
20
  if (e) throw e.error;
22
21
  }
23
22
  }
24
-
25
23
  return ar;
26
24
  };
27
-
28
25
  var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
29
26
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
30
27
  if (ar || !(i in from)) {
@@ -34,53 +31,41 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
34
31
  }
35
32
  return to.concat(ar || Array.prototype.slice.call(from));
36
33
  };
37
-
38
34
  exports.__esModule = true;
39
35
  exports.getAllEnvsByTrigger = exports.getAllEnvsInAllComponents = exports.getAllEnvs = void 0;
40
-
41
36
  var types_1 = require("../types");
42
-
43
37
  var getConfiguredAndDefaultEnvs = function (config, componentName, envTypes) {
44
38
  var _a, _b;
45
-
46
- var configuredEnvs = (_a = config.components[componentName].env) !== null && _a !== void 0 ? _a : {}; // the default envs have the same name as the env types
39
+ var configuredEnvs = (_a = config.components[componentName].env) !== null && _a !== void 0 ? _a : {};
40
+ // the default envs have the same name as the env types
47
41
  // these can be disabled with settimg them to `false`
48
42
  // this is the list of all not disabled envs. These are always returned
49
-
50
43
  var enabledDefaultEnvs = envTypes.filter(function (e) {
51
44
  return configuredEnvs[e] !== false;
52
45
  });
53
46
  var configuredCustomEnvs = Object.entries((_b = config.components[componentName].env) !== null && _b !== void 0 ? _b : {}).filter(function (_a) {
54
47
  var _b = __read(_a, 2),
55
- config = _b[1];
56
-
48
+ config = _b[1];
57
49
  return config && "type" in config && config.type && envTypes.includes(config.type);
58
50
  }).map(function (_a) {
59
51
  var _b = __read(_a, 1),
60
- envName = _b[0];
61
-
52
+ envName = _b[0];
62
53
  return envName;
63
54
  });
64
55
  return __spreadArray([], __read(new Set(__spreadArray(__spreadArray([], __read(enabledDefaultEnvs), false), __read(configuredCustomEnvs), false))), false);
65
56
  };
66
-
67
57
  var getAllEnvs = function (config, componentName) {
68
58
  return getConfiguredAndDefaultEnvs(config, componentName, types_1.DEFAULT_ENV_TYPES);
69
59
  };
70
-
71
60
  exports.getAllEnvs = getAllEnvs;
72
-
73
61
  var getAllEnvsInAllComponents = function (config) {
74
62
  return __spreadArray([], __read(new Set(Object.keys(config.components).flatMap(function (c) {
75
63
  return (0, exports.getAllEnvs)(config, c);
76
64
  }))), false);
77
65
  };
78
-
79
66
  exports.getAllEnvsInAllComponents = getAllEnvsInAllComponents;
80
-
81
67
  var getAllEnvsByTrigger = function (config, componentName, trigger) {
82
68
  var envTypesByTrigger = (0, types_1.getEnvTypesByTrigger)(trigger);
83
69
  return getConfiguredAndDefaultEnvs(config, componentName, envTypesByTrigger);
84
70
  };
85
-
86
71
  exports.getAllEnvsByTrigger = getAllEnvsByTrigger;
@@ -12,13 +12,9 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
12
12
  if (k2 === undefined) k2 = k;
13
13
  o[k2] = m[k];
14
14
  });
15
-
16
15
  var __exportStar = this && this.__exportStar || function (m, exports) {
17
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
17
  };
19
-
20
18
  exports.__esModule = true;
21
-
22
19
  __exportStar(require("./configruedEnvs"), exports);
23
-
24
20
  __exportStar(require("./readConfig"), exports);
@@ -2,28 +2,21 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.readConfigSync = void 0;
5
-
6
5
  var fs_1 = require("fs");
7
-
8
6
  var ts_node_1 = require("ts-node");
9
-
10
- var js_yaml_1 = require("js-yaml"); // allows us to load ts files
11
-
12
-
7
+ var js_yaml_1 = require("js-yaml");
8
+ // allows us to load ts files
13
9
  var fullPath = function (directory, ext) {
14
10
  return directory + "/catladder." + ext;
15
11
  };
16
-
17
12
  function requireUncached(module) {
18
13
  delete require.cache[require.resolve(module)];
19
14
  return require(module);
20
15
  }
21
-
22
16
  var readConfigSync = function (directory) {
23
17
  if (directory === void 0) {
24
18
  directory = process.cwd();
25
19
  }
26
-
27
20
  (0, ts_node_1.register)({
28
21
  cwd: directory,
29
22
  transpileOnly: true,
@@ -34,10 +27,8 @@ var readConfigSync = function (directory) {
34
27
  var found = ["ts", "js", "yml", "yaml"].find(function (extension) {
35
28
  return (0, fs_1.existsSync)(fullPath(directory, extension));
36
29
  });
37
-
38
30
  if (found) {
39
31
  var filePath = fullPath(directory, found);
40
-
41
32
  if (found === "ts" || found === "js") {
42
33
  return {
43
34
  path: filePath,
@@ -55,8 +46,6 @@ var readConfigSync = function (directory) {
55
46
  };
56
47
  }
57
48
  }
58
-
59
49
  return null;
60
50
  };
61
-
62
51
  exports.readConfigSync = readConfigSync;
package/dist/constants.js CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
5
- exports.PIPELINE_IMAGE_TAG = "v1-75-4-c5b18cfc" || "";
5
+ exports.PIPELINE_IMAGE_TAG = "v1-76-0-946dc6a7" || "";
6
6
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
@@ -6,7 +6,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
6
6
  resolve(value);
7
7
  });
8
8
  }
9
-
10
9
  return new (P || (P = Promise))(function (resolve, reject) {
11
10
  function fulfilled(value) {
12
11
  try {
@@ -15,7 +14,6 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
15
14
  reject(e);
16
15
  }
17
16
  }
18
-
19
17
  function rejected(value) {
20
18
  try {
21
19
  step(generator["throw"](value));
@@ -23,29 +21,26 @@ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, gene
23
21
  reject(e);
24
22
  }
25
23
  }
26
-
27
24
  function step(result) {
28
25
  result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
29
26
  }
30
-
31
27
  step((generator = generator.apply(thisArg, _arguments || [])).next());
32
28
  });
33
29
  };
34
-
35
30
  var __generator = this && this.__generator || function (thisArg, body) {
36
31
  var _ = {
37
- label: 0,
38
- sent: function () {
39
- if (t[0] & 1) throw t[1];
40
- return t[1];
32
+ label: 0,
33
+ sent: function () {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
41
39
  },
42
- trys: [],
43
- ops: []
44
- },
45
- f,
46
- y,
47
- t,
48
- g;
40
+ f,
41
+ y,
42
+ t,
43
+ g;
49
44
  return g = {
50
45
  next: verb(0),
51
46
  "throw": verb(1),
@@ -53,78 +48,59 @@ var __generator = this && this.__generator || function (thisArg, body) {
53
48
  }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
54
49
  return this;
55
50
  }), g;
56
-
57
51
  function verb(n) {
58
52
  return function (v) {
59
53
  return step([n, v]);
60
54
  };
61
55
  }
62
-
63
56
  function step(op) {
64
57
  if (f) throw new TypeError("Generator is already executing.");
65
-
66
58
  while (_) try {
67
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;
68
60
  if (y = 0, t) op = [op[0] & 2, t.value];
69
-
70
61
  switch (op[0]) {
71
62
  case 0:
72
63
  case 1:
73
64
  t = op;
74
65
  break;
75
-
76
66
  case 4:
77
67
  _.label++;
78
68
  return {
79
69
  value: op[1],
80
70
  done: false
81
71
  };
82
-
83
72
  case 5:
84
73
  _.label++;
85
74
  y = op[1];
86
75
  op = [0];
87
76
  continue;
88
-
89
77
  case 7:
90
78
  op = _.ops.pop();
91
-
92
79
  _.trys.pop();
93
-
94
80
  continue;
95
-
96
81
  default:
97
82
  if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
98
83
  _ = 0;
99
84
  continue;
100
85
  }
101
-
102
86
  if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
103
87
  _.label = op[1];
104
88
  break;
105
89
  }
106
-
107
90
  if (op[0] === 6 && _.label < t[1]) {
108
91
  _.label = t[1];
109
92
  t = op;
110
93
  break;
111
94
  }
112
-
113
95
  if (t && _.label < t[2]) {
114
96
  _.label = t[2];
115
-
116
97
  _.ops.push(op);
117
-
118
98
  break;
119
99
  }
120
-
121
100
  if (t[2]) _.ops.pop();
122
-
123
101
  _.trys.pop();
124
-
125
102
  continue;
126
103
  }
127
-
128
104
  op = body.call(thisArg, _);
129
105
  } catch (e) {
130
106
  op = [6, e];
@@ -132,7 +108,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
132
108
  } finally {
133
109
  f = t = 0;
134
110
  }
135
-
136
111
  if (op[0] & 5) throw op[1];
137
112
  return {
138
113
  value: op[0] ? op[1] : void 0,
@@ -140,11 +115,8 @@ var __generator = this && this.__generator || function (thisArg, body) {
140
115
  };
141
116
  }
142
117
  };
143
-
144
118
  exports.__esModule = true;
145
-
146
- var resolveReferences_1 = require("./resolveReferences");
147
-
119
+ var resolveReferences_1 = require("../resolveReferences");
148
120
  describe("resolveReferences", function () {
149
121
  it("replaces occurences of ${componentName:VARIABLE_NAME}", function () {
150
122
  return __awaiter(void 0, void 0, void 0, function () {
@@ -164,44 +136,49 @@ describe("resolveReferences", function () {
164
136
  FOO: "foo from frontend"
165
137
  }
166
138
  };
167
- return [4
168
- /*yield*/
169
- , (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
139
+ return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
170
140
  return __awaiter(void 0, void 0, void 0, function () {
171
141
  var _a;
172
-
173
142
  return __generator(this, function (_b) {
174
- return [2
175
- /*return*/
176
- , (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]];
143
+ return [2 /*return*/, (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]];
177
144
  });
178
145
  });
179
146
  })];
180
-
181
147
  case 1:
182
148
  result = _a.sent();
183
149
  expect(result).toEqual({
184
150
  a: "hello world",
185
151
  b: "a replaced value looks like this: 'foo from api', nice!"
186
152
  });
187
- return [2
188
- /*return*/
189
- ];
153
+ return [2 /*return*/];
190
154
  }
191
155
  });
192
156
  });
193
157
  });
158
+
194
159
  it("replaces self references with structure ${VARIABLE_NAME}", function () {
195
- var variables = {
196
- FOO: "hello world",
197
- BAR: "this: ${FOO}!"
198
- };
199
- var result = (0, resolveReferences_1.resolveReferences)(variables);
200
- expect(result).toEqual({
201
- FOO: "hello world",
202
- BAR: "this: hello world!"
160
+ return __awaiter(void 0, void 0, void 0, function () {
161
+ var variables, result;
162
+ return __generator(this, function (_a) {
163
+ switch (_a.label) {
164
+ case 0:
165
+ variables = {
166
+ FOO: "hello world",
167
+ BAR: "this: ${FOO}!"
168
+ };
169
+ return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(variables)];
170
+ case 1:
171
+ result = _a.sent();
172
+ expect(result).toEqual({
173
+ FOO: "hello world",
174
+ BAR: "this: hello world!"
175
+ });
176
+ return [2 /*return*/];
177
+ }
178
+ });
203
179
  });
204
180
  });
181
+
205
182
  it("replaces self references mixed with other vars", function () {
206
183
  return __awaiter(void 0, void 0, void 0, function () {
207
184
  var variables, otherVariables, result;
@@ -217,33 +194,26 @@ describe("resolveReferences", function () {
217
194
  FOO: "foo from api"
218
195
  }
219
196
  };
220
- return [4
221
- /*yield*/
222
- , (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
197
+ return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
223
198
  return __awaiter(void 0, void 0, void 0, function () {
224
199
  var _a;
225
-
226
200
  return __generator(this, function (_b) {
227
- return [2
228
- /*return*/
229
- , (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]];
201
+ return [2 /*return*/, (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]];
230
202
  });
231
203
  });
232
204
  })];
233
-
234
205
  case 1:
235
206
  result = _a.sent();
236
207
  expect(result).toEqual({
237
208
  FOO: "hello from foo from api",
238
209
  BAR: "this: hello from foo from api!"
239
210
  });
240
- return [2
241
- /*return*/
242
- ];
211
+ return [2 /*return*/];
243
212
  }
244
213
  });
245
214
  });
246
215
  });
216
+
247
217
  it("keeps variables as is if not found (when null is returned)", function () {
248
218
  return __awaiter(void 0, void 0, void 0, function () {
249
219
  var variables, otherVariables, result;
@@ -255,33 +225,26 @@ describe("resolveReferences", function () {
255
225
  b: "a not found value looks like this: '${api:FOO}'"
256
226
  };
257
227
  otherVariables = {};
258
- return [4
259
- /*yield*/
260
- , (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
228
+ return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
261
229
  return __awaiter(void 0, void 0, void 0, function () {
262
230
  var _a;
263
-
264
231
  return __generator(this, function (_b) {
265
- return [2
266
- /*return*/
267
- , (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]];
232
+ return [2 /*return*/, (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]];
268
233
  });
269
234
  });
270
235
  })];
271
-
272
236
  case 1:
273
237
  result = _a.sent();
274
238
  expect(result).toEqual({
275
239
  a: "hello world",
276
240
  b: "a not found value looks like this: '${api:FOO}'"
277
241
  });
278
- return [2
279
- /*return*/
280
- ];
242
+ return [2 /*return*/];
281
243
  }
282
244
  });
283
245
  });
284
246
  });
247
+
285
248
  it("replaces mulitple levels deep", function () {
286
249
  return __awaiter(void 0, void 0, void 0, function () {
287
250
  var variables, otherVariables, result;
@@ -299,32 +262,25 @@ describe("resolveReferences", function () {
299
262
  FOO: "hi, ${api:FOO}"
300
263
  }
301
264
  };
302
- return [4
303
- /*yield*/
304
- , (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
265
+ return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
305
266
  return __awaiter(void 0, void 0, void 0, function () {
306
267
  var _a, _b;
307
-
308
268
  return __generator(this, function (_c) {
309
- return [2
310
- /*return*/
311
- , (_b = (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) !== null && _b !== void 0 ? _b : ""];
269
+ return [2 /*return*/, (_b = (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) !== null && _b !== void 0 ? _b : ""];
312
270
  });
313
271
  });
314
272
  })];
315
-
316
273
  case 1:
317
274
  result = _a.sent();
318
275
  expect(result).toEqual({
319
276
  a: "value is hi, foo from api!"
320
277
  });
321
- return [2
322
- /*return*/
323
- ];
278
+ return [2 /*return*/];
324
279
  }
325
280
  });
326
281
  });
327
282
  });
283
+
328
284
  it("prevents endless loops", function () {
329
285
  return __awaiter(void 0, void 0, void 0, function () {
330
286
  var variables, otherVariables, result;
@@ -342,33 +298,26 @@ describe("resolveReferences", function () {
342
298
  FOO: "frontend ${api:FOO}"
343
299
  }
344
300
  };
345
- return [4
346
- /*yield*/
347
- , (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
301
+ return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
348
302
  return __awaiter(void 0, void 0, void 0, function () {
349
303
  var _a, _b;
350
-
351
304
  return __generator(this, function (_c) {
352
- return [2
353
- /*return*/
354
- , (_b = (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) !== null && _b !== void 0 ? _b : ""];
305
+ return [2 /*return*/, (_b = (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) !== null && _b !== void 0 ? _b : ""];
355
306
  });
356
307
  });
357
308
  })];
358
-
359
309
  case 1:
360
310
  result = _a.sent();
361
311
  expect(result).toEqual({
362
312
  a: "value is frontend api ${frontend:FOO}!"
363
313
  });
364
- return [2
365
- /*return*/
366
- ];
314
+ return [2 /*return*/];
367
315
  }
368
316
  });
369
317
  });
370
318
  });
371
319
  });
320
+
372
321
  describe("translateLegacyFromComponents", function () {
373
322
  it("translatetes the old `fromComponents` approach to ${componentName:variableName}", function () {
374
323
  var fromComponents = {