@catladder/cli 0.0.0-next-5f70052e → 0.0.0-next-32b3a548
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/bundles/catenv/index.js +424 -181
- package/dist/bundles/cli/index.js +437 -187
- package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
- package/dist/cli/src/apps/catenv/types.d.ts +0 -1
- package/dist/cli/src/apps/catenv/utils.d.ts +2 -5
- package/dist/cli/src/apps/catenv/utils.js +4 -9
- package/dist/cli/src/apps/catenv/utils.js.map +1 -1
- package/dist/cli/src/apps/catenv/writeDotEnvFiles.js +1 -3
- package/dist/cli/src/apps/catenv/writeDotEnvFiles.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +12 -12
- package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +6 -6
- package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.js.map +1 -1
- package/dist/pipeline/src/bash/BashExpression.d.ts +0 -5
- package/dist/pipeline/src/bash/BashExpression.js +1 -15
- package/dist/pipeline/src/bash/BashExpression.js.map +1 -1
- package/dist/pipeline/src/bash/bashEscape.d.ts +30 -0
- package/dist/pipeline/src/bash/bashEscape.js +129 -0
- package/dist/pipeline/src/bash/bashEscape.js.map +1 -0
- package/dist/pipeline/src/bash/bashYaml.js +26 -2
- package/dist/pipeline/src/bash/bashYaml.js.map +1 -1
- package/dist/pipeline/src/bash/getInjectVarsScript.js +6 -2
- package/dist/pipeline/src/bash/getInjectVarsScript.js.map +1 -1
- package/dist/pipeline/src/bash/index.d.ts +2 -0
- package/dist/pipeline/src/bash/index.js +19 -0
- package/dist/pipeline/src/bash/index.js.map +1 -0
- package/dist/pipeline/src/build/base/writeDotEnv.js +4 -3
- package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
- package/dist/pipeline/src/build/docker.d.ts +3 -3
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +3 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.js +23 -12
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +2 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.d.ts +3 -3
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/pipeline/src/globalScriptFunctions/index.d.ts +6 -2
- package/dist/pipeline/src/globalScriptFunctions/index.js +17 -10
- package/dist/pipeline/src/globalScriptFunctions/index.js.map +1 -1
- package/dist/pipeline/src/index.d.ts +2 -0
- package/dist/pipeline/src/index.js +2 -0
- package/dist/pipeline/src/index.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js +2 -25
- package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/pipeline/src/types/context.d.ts +2 -1
- package/dist/pipeline/src/types/context.js.map +1 -1
- package/dist/pipeline/src/utils/gitlab.js +9 -2
- package/dist/pipeline/src/utils/gitlab.js.map +1 -1
- package/dist/pipeline/src/variables/VariableValue.d.ts +3 -0
- package/dist/pipeline/src/variables/VariableValue.js +3 -0
- package/dist/pipeline/src/variables/VariableValue.js.map +1 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.d.ts +24 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js +69 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js.map +1 -0
- package/dist/pipeline/src/variables/resolveAllReferences.d.ts +3 -0
- package/dist/pipeline/src/variables/resolveAllReferences.js +25 -0
- package/dist/pipeline/src/variables/resolveAllReferences.js.map +1 -0
- package/dist/pipeline/src/variables/resolveAllReferencesOnce.d.ts +5 -0
- package/dist/pipeline/src/variables/resolveAllReferencesOnce.js +23 -0
- package/dist/pipeline/src/variables/resolveAllReferencesOnce.js.map +1 -0
- package/dist/pipeline/src/variables/resolveReferencesOnce.d.ts +8 -0
- package/dist/pipeline/src/variables/resolveReferencesOnce.js +21 -0
- package/dist/pipeline/src/variables/resolveReferencesOnce.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catenv/printVariables.ts +2 -2
- package/src/apps/catenv/types.ts +2 -2
- package/src/apps/catenv/utils.ts +8 -12
- package/src/apps/catenv/writeDotEnvFiles.ts +2 -5
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +16 -10
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +5 -3
- package/src/config/getProjectConfig.ts +5 -1
- package/dist/pipeline/src/bash/replaceAsync.d.ts +0 -2
- package/dist/pipeline/src/bash/replaceAsync.js +0 -37
- package/dist/pipeline/src/bash/replaceAsync.js.map +0 -1
- package/dist/pipeline/src/context/resolveReferences.d.ts +0 -3
- package/dist/pipeline/src/context/resolveReferences.js +0 -56
- package/dist/pipeline/src/context/resolveReferences.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from "@catladder/pipeline";
|
|
2
2
|
import { getEnvVarsResolved } from "../../config/getProjectConfig";
|
|
3
|
-
import type { Choice
|
|
3
|
+
import type { Choice } from "./types";
|
|
4
4
|
import {
|
|
5
5
|
getCurrentComponentAndEnvFromChoice,
|
|
6
6
|
makeKeyValueString,
|
|
@@ -54,5 +54,5 @@ export const printVariables = async (config: Config, choice?: Choice) => {
|
|
|
54
54
|
console.log(makeExportKeyValuestring(variables));
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
const makeExportKeyValuestring = (variables:
|
|
57
|
+
const makeExportKeyValuestring = (variables: Record<string, string>) =>
|
|
58
58
|
makeKeyValueString(variables, "export ");
|
package/src/apps/catenv/types.ts
CHANGED
package/src/apps/catenv/utils.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Config } from "@catladder/pipeline";
|
|
2
2
|
import { join } from "path";
|
|
3
3
|
import { getGitRoot } from "../../utils/projects";
|
|
4
|
-
import type { Choice
|
|
4
|
+
import type { Choice } from "./types";
|
|
5
|
+
import { escapeForDotEnv } from "@catladder/pipeline";
|
|
5
6
|
export const getComponentFullPath = (
|
|
6
7
|
gitRoot: string,
|
|
7
8
|
config: Config,
|
|
@@ -31,19 +32,14 @@ export const getCurrentComponentAndEnvFromChoice = async (
|
|
|
31
32
|
};
|
|
32
33
|
};
|
|
33
34
|
|
|
34
|
-
export const makeKeyValueString = (
|
|
35
|
+
export const makeKeyValueString = (
|
|
36
|
+
variables: Record<string, string>,
|
|
37
|
+
keyPrefix = "",
|
|
38
|
+
) =>
|
|
35
39
|
Object.entries(variables)
|
|
36
|
-
|
|
40
|
+
// quotes are important, otherwise line breaks don't work properly
|
|
41
|
+
.map(([key, value]) => `${keyPrefix}${key}=${escapeForDotEnv(value)}`)
|
|
37
42
|
.join("\n");
|
|
38
43
|
|
|
39
|
-
export const sanitizeMultiLine = (variables: Variables) => {
|
|
40
|
-
return Object.fromEntries(
|
|
41
|
-
Object.entries(variables).map(([key, value]) => [
|
|
42
|
-
key,
|
|
43
|
-
value.replaceAll("\n", "\\n"),
|
|
44
|
-
]),
|
|
45
|
-
);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
44
|
export const sanitizeEnvVarName = (name: string) =>
|
|
49
45
|
name.replace(/[\s\-.]+/g, "_");
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { writeGeneratedFile, type Config } from "@catladder/pipeline";
|
|
2
|
-
import { writeFile } from "fs-extra";
|
|
3
2
|
import { join } from "path";
|
|
4
3
|
import { getEnvVarsResolved } from "../../config/getProjectConfig";
|
|
5
4
|
import { getGitRoot } from "../../utils/projects";
|
|
@@ -8,7 +7,6 @@ import {
|
|
|
8
7
|
getComponentFullPath,
|
|
9
8
|
getCurrentComponentAndEnvFromChoice,
|
|
10
9
|
makeKeyValueString,
|
|
11
|
-
sanitizeMultiLine,
|
|
12
10
|
} from "./utils";
|
|
13
11
|
|
|
14
12
|
export const writeDotEnvFiles = async (config: Config, choice?: Choice) => {
|
|
@@ -33,9 +31,8 @@ export const writeDotEnvFiles = async (config: Config, choice?: Choice) => {
|
|
|
33
31
|
delete variables["_ALL_ENV_VAR_KEYS"];
|
|
34
32
|
const componentDir = getComponentFullPath(gitRoot, config, componentName);
|
|
35
33
|
const filePath = join(componentDir, ".env");
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
await writeGeneratedFile(filePath, makeKeyValueString(variablesSanitized), {
|
|
34
|
+
|
|
35
|
+
await writeGeneratedFile(filePath, makeKeyValueString(variables), {
|
|
39
36
|
commentChar: "#",
|
|
40
37
|
});
|
|
41
38
|
}
|
|
@@ -65,7 +65,9 @@ export default async (vorpal: Vorpal) =>
|
|
|
65
65
|
hosts: [],
|
|
66
66
|
});
|
|
67
67
|
|
|
68
|
-
const parsersResult = parser.parse(
|
|
68
|
+
const parsersResult = parser.parse(
|
|
69
|
+
sourceEnvVars.DATABASE_URL.toString(),
|
|
70
|
+
);
|
|
69
71
|
sourcePort = parsersResult.hosts?.[0]?.port;
|
|
70
72
|
sourceUsername = parsersResult.username;
|
|
71
73
|
sourcePassword = parsersResult.password;
|
|
@@ -73,13 +75,14 @@ export default async (vorpal: Vorpal) =>
|
|
|
73
75
|
} else {
|
|
74
76
|
sourcePort = 54399;
|
|
75
77
|
sourceProxy = await startCloudSqlProxyInBackground({
|
|
76
|
-
instanceName:
|
|
78
|
+
instanceName:
|
|
79
|
+
sourceEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME.toString(),
|
|
77
80
|
localPort: sourcePort,
|
|
78
81
|
});
|
|
79
82
|
|
|
80
|
-
sourceUsername = sourceEnvVars.DB_USER;
|
|
81
|
-
sourcePassword = sourceEnvVars.DB_PASSWORD;
|
|
82
|
-
sourceDbName = sourceEnvVars.DB_NAME;
|
|
83
|
+
sourceUsername = sourceEnvVars.DB_USER.toString();
|
|
84
|
+
sourcePassword = sourceEnvVars.DB_PASSWORD.toString();
|
|
85
|
+
sourceDbName = sourceEnvVars.DB_NAME?.toString();
|
|
83
86
|
}
|
|
84
87
|
|
|
85
88
|
const { targetEnvAndComponent } = await this.prompt({
|
|
@@ -109,7 +112,9 @@ export default async (vorpal: Vorpal) =>
|
|
|
109
112
|
hosts: [],
|
|
110
113
|
});
|
|
111
114
|
|
|
112
|
-
const parsersResult = parser.parse(
|
|
115
|
+
const parsersResult = parser.parse(
|
|
116
|
+
targetEnvVars.DATABASE_URL.toString(),
|
|
117
|
+
);
|
|
113
118
|
|
|
114
119
|
targetPort = parsersResult.hosts?.[0]?.port;
|
|
115
120
|
targetUsername = parsersResult.username;
|
|
@@ -118,13 +123,14 @@ export default async (vorpal: Vorpal) =>
|
|
|
118
123
|
} else {
|
|
119
124
|
targetPort = 54499;
|
|
120
125
|
targetProxy = await startCloudSqlProxyInBackground({
|
|
121
|
-
instanceName:
|
|
126
|
+
instanceName:
|
|
127
|
+
targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME.toString(),
|
|
122
128
|
localPort: targetPort,
|
|
123
129
|
});
|
|
124
130
|
|
|
125
|
-
targetUsername = targetEnvVars.DB_USER;
|
|
126
|
-
targetPassword = targetEnvVars.DB_PASSWORD;
|
|
127
|
-
targetDbName = targetEnvVars.DB_NAME;
|
|
131
|
+
targetUsername = targetEnvVars.DB_USER.toString();
|
|
132
|
+
targetPassword = targetEnvVars.DB_PASSWORD.toString();
|
|
133
|
+
targetDbName = targetEnvVars.DB_NAME.toString();
|
|
128
134
|
}
|
|
129
135
|
|
|
130
136
|
const { shouldContinue } = await this.prompt({
|
|
@@ -87,7 +87,9 @@ const getProxyInfoForKubernetes = async (
|
|
|
87
87
|
// bit hacky, would be nicer if we would also declare this through env vars
|
|
88
88
|
const cloudSqlValues = createKubernetesCloudsqlBaseValues(context);
|
|
89
89
|
|
|
90
|
-
const DB_PASSWORD =
|
|
90
|
+
const DB_PASSWORD = (
|
|
91
|
+
envVars?.DB_PASSWORD || envVars?.POSTGRESQL_PASSWORD
|
|
92
|
+
)?.toString();
|
|
91
93
|
|
|
92
94
|
const DB_NAME = cloudSqlValues.cloudsql.fullDbName.toString();
|
|
93
95
|
|
|
@@ -114,8 +116,8 @@ const getProxyInfoForCloudRun = async (
|
|
|
114
116
|
|
|
115
117
|
const envVars = await getEnvVarsResolved(vorpal, context.env, context.name);
|
|
116
118
|
|
|
117
|
-
const DB_PASSWORD = envVars?.DB_PASSWORD;
|
|
118
|
-
const DB_USER = envVars?.DB_USER;
|
|
119
|
+
const DB_PASSWORD = envVars?.DB_PASSWORD?.toString();
|
|
120
|
+
const DB_USER = envVars?.DB_USER?.toString();
|
|
119
121
|
|
|
120
122
|
const DB_NAME = context.environment.envVars.DB_NAME.toString();
|
|
121
123
|
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const BashExpression_1 = require("./BashExpression");
|
|
4
|
-
// from https://github.com/dsblv/string-replace-async/blob/main/index.js
|
|
5
|
-
// and adjusted a bit
|
|
6
|
-
async function replaceAsync(string, searchValue, replacer) {
|
|
7
|
-
const wasBashExpression = string instanceof BashExpression_1.BashExpression;
|
|
8
|
-
try {
|
|
9
|
-
// 1. Run fake pass of `replace`, collect values from `replacer` calls
|
|
10
|
-
// 2. Resolve them with `Promise.all`
|
|
11
|
-
// 3. Run `replace` with resolved values
|
|
12
|
-
const values = [];
|
|
13
|
-
String.prototype.replace.call(string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string), searchValue, function (...args) {
|
|
14
|
-
// eslint-disable-next-line prefer-spread
|
|
15
|
-
const result = replacer.apply(undefined, args);
|
|
16
|
-
values.push(result);
|
|
17
|
-
return "";
|
|
18
|
-
});
|
|
19
|
-
const resolvedValues = await Promise.all(values);
|
|
20
|
-
const containsBashExpression = resolvedValues.some((value) => value instanceof BashExpression_1.BashExpression);
|
|
21
|
-
const result = (string instanceof BashExpression_1.BashExpression ? string : (0, BashExpression_1.bashEscape)(string)).replace(searchValue, function () {
|
|
22
|
-
var _a, _b;
|
|
23
|
-
return (_b = (_a = resolvedValues.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
|
|
24
|
-
});
|
|
25
|
-
if (wasBashExpression || containsBashExpression) {
|
|
26
|
-
return new BashExpression_1.BashExpression(result);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
return Promise.reject(error);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.default = replaceAsync;
|
|
37
|
-
//# sourceMappingURL=replaceAsync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"replaceAsync.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/replaceAsync.ts"],"names":[],"mappings":";;AAAA,qDAA8D;AAE9D,wEAAwE;AACxE,qBAAqB;AACN,KAAK,UAAU,YAAY,CACxC,MAA+B,EAC/B,WAAgB,EAChB,QAGqC;IAErC,MAAM,iBAAiB,GAAG,MAAM,YAAY,+BAAc,CAAC;IAE3D,IAAI,CAAC;QACH,sEAAsE;QACtE,qCAAqC;QACrC,wCAAwC;QACxC,MAAM,MAAM,GAA4C,EAAE,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAC3B,MAAM,YAAY,+BAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,2BAAU,EAAC,MAAM,CAAC,EAC9D,WAAW,EACX,UAAU,GAAG,IAAI;YACf,yCAAyC;YACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAC/C,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC,CACF,CAAC;QACF,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEjD,MAAM,sBAAsB,GAAG,cAAc,CAAC,IAAI,CAChD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,YAAY,+BAAc,CAC3C,CAAC;QACF,MAAM,MAAM,GAAG,CACb,MAAM,YAAY,+BAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,2BAAU,EAAC,MAAM,CAAC,CAC/D,CAAC,OAAO,CAAC,WAAW,EAAE;;YACrB,OAAO,MAAA,MAAA,cAAc,CAAC,KAAK,EAAE,0CAAE,QAAQ,EAAE,mCAAI,EAAE,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,IAAI,iBAAiB,IAAI,sBAAsB,EAAE,CAAC;YAChD,OAAO,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;QACpC,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;AACH,CAAC;AA5CD,+BA4CC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { BashExpression } from "../bash/BashExpression";
|
|
2
|
-
import type { UnspecifiedEnvVars } from "..";
|
|
3
|
-
export declare const resolveReferences: (vars: Record<string, string | BashExpression | undefined | null>, getOtherVariables?: (componentName: string, alreadyVisited: Record<string, Record<string, boolean>>) => Promise<UnspecifiedEnvVars>, alreadyVisitedBase?: Record<string, Record<string, boolean>>) => Promise<Record<string, BashExpression>>;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.resolveReferences = void 0;
|
|
7
|
-
const lodash_1 = require("lodash");
|
|
8
|
-
const replaceAsync_1 = __importDefault(require("../bash/replaceAsync"));
|
|
9
|
-
// regex to resolve references in catladder variables
|
|
10
|
-
// those expressions have the pattern ${componentName:variableName}
|
|
11
|
-
const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
12
|
-
const resolveReferences = async (vars, getOtherVariables, alreadyVisitedBase = {}) => {
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
* replace referenced variables with their values in a value string
|
|
16
|
-
*/
|
|
17
|
-
const replaceSingleValue = async (value, alreadyVisited = alreadyVisitedBase) => {
|
|
18
|
-
if (REGEX.test(value.toString())) {
|
|
19
|
-
// we consider variables that got references in it BashExpressions, because the replacement may be one
|
|
20
|
-
return await (0, replaceAsync_1.default)(value, REGEX, async (match, _, componentName, variableName) => {
|
|
21
|
-
var _a, _b;
|
|
22
|
-
if ((_a = alreadyVisited[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) {
|
|
23
|
-
return match; // prevent endless loop
|
|
24
|
-
}
|
|
25
|
-
const newAlreadyVisited = (0, lodash_1.merge)({}, alreadyVisited, {
|
|
26
|
-
[componentName]: {
|
|
27
|
-
[variableName]: true,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
const result = componentName
|
|
31
|
-
? (_b = (await (getOtherVariables === null || getOtherVariables === void 0 ? void 0 : getOtherVariables(componentName, newAlreadyVisited).then((r) => r === null || r === void 0 ? void 0 : r[variableName])))) !== null && _b !== void 0 ? _b : null
|
|
32
|
-
: vars[variableName]; // is self reference
|
|
33
|
-
const replaced = result !== null && result !== undefined
|
|
34
|
-
? await replaceSingleValue(result, newAlreadyVisited)
|
|
35
|
-
: match;
|
|
36
|
-
return replaced;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
return Object.fromEntries(await Promise.all(Object.entries(vars).map(async ([key, value]) => {
|
|
44
|
-
if (value === null || value === undefined) {
|
|
45
|
-
return [key, null];
|
|
46
|
-
}
|
|
47
|
-
return [
|
|
48
|
-
key,
|
|
49
|
-
value !== null && value !== undefined
|
|
50
|
-
? await replaceSingleValue(value)
|
|
51
|
-
: null,
|
|
52
|
-
];
|
|
53
|
-
})));
|
|
54
|
-
};
|
|
55
|
-
exports.resolveReferences = resolveReferences;
|
|
56
|
-
//# sourceMappingURL=resolveReferences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveReferences.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/resolveReferences.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA+B;AAG/B,wEAAgD;AAGhD,qDAAqD;AACrD,mEAAmE;AACnE,MAAM,KAAK,GAAG,4BAA4B,CAAC;AAEpC,MAAM,iBAAiB,GAAG,KAAK,EACpC,IAAgE,EAChE,iBAGgC,EAChC,qBAA8D,EAAE,EAChE,EAAE;IACF;;;OAGG;IACH,MAAM,kBAAkB,GAAG,KAAK,EAC9B,KAA8B,EAC9B,iBAGI,kBAAkB,EACY,EAAE;QACpC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;YACjC,uGAAuG;YAEvG,OAAO,MAAM,IAAA,sBAAY,EACvB,KAAK,EACL,KAAK,EACL,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE;;gBAC9C,IAAI,MAAA,cAAc,CAAC,aAAa,CAAC,0CAAG,YAAY,CAAC,EAAE,CAAC;oBAClD,OAAO,KAAK,CAAC,CAAC,uBAAuB;gBACvC,CAAC;gBACD,MAAM,iBAAiB,GAAG,IAAA,cAAK,EAAC,EAAE,EAAE,cAAc,EAAE;oBAClD,CAAC,aAAa,CAAC,EAAE;wBACf,CAAC,YAAY,CAAC,EAAE,IAAI;qBACrB;iBACF,CAAC,CAAC;gBACH,MAAM,MAAM,GAAG,aAAa;oBAC1B,CAAC,CAAC,MAAA,CAAC,MAAM,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAG,aAAa,EAAE,iBAAiB,EAAE,IAAI,CAC/D,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAG,YAAY,CAAC,CACzB,CAAA,CAAC,mCAAI,IAAI;oBACZ,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,oBAAoB;gBAE5C,MAAM,QAAQ,GACZ,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,SAAS;oBACrC,CAAC,CAAC,MAAM,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,CAAC;oBACrD,CAAC,CAAC,KAAK,CAAC;gBAEZ,OAAO,QAAQ,CAAC;YAClB,CAAC,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAC1C,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrB,CAAC;QAED,OAAO;YACL,GAAG;YACH,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;gBACnC,CAAC,CAAC,MAAM,kBAAkB,CAAC,KAAK,CAAC;gBACjC,CAAC,CAAC,IAAI;SACT,CAAC;IACJ,CAAC,CAAC,CACH,CACgC,CAAC;AACtC,CAAC,CAAC;AArEW,QAAA,iBAAiB,qBAqE5B"}
|