@catladder/cli 1.170.1 → 2.0.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/bundles/catenv/index.js +3 -3
- package/dist/bundles/cli/index.js +6 -6
- package/dist/cli/src/apps/catenv/catenv.js +2 -3
- package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
- package/dist/cli/src/apps/catenv/printVariables.js +4 -2
- 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 +2 -4
- package/dist/cli/src/apps/catenv/writeDotEnvFiles.js.map +1 -1
- package/dist/cli/src/apps/catenv/writeEnvDTs.js +1 -1
- package/dist/cli/src/apps/catenv/writeEnvDTs.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/apps/cli/commands/project/index.js +0 -6
- package/dist/cli/src/apps/cli/commands/project/index.js.map +1 -1
- package/dist/cli/src/config/getProjectConfig.js +14 -26
- 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 +32 -0
- package/dist/pipeline/src/bash/bashEscape.js +131 -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/createAppBuildJob.js +2 -3
- package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
- package/dist/pipeline/src/build/base/writeDotEnv.js +6 -4
- package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
- package/dist/pipeline/src/build/custom/testJob.js +10 -11
- package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
- package/dist/pipeline/src/build/docker.d.ts +3 -3
- package/dist/pipeline/src/build/node/buildJob.js +1 -1
- package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/pipeline/src/build/node/cache.d.ts +1 -3
- package/dist/pipeline/src/build/node/cache.js +1 -27
- package/dist/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/pipeline/src/build/node/testJob.js +10 -11
- package/dist/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/pipeline/src/build/rails/build.js +0 -1
- package/dist/pipeline/src/build/rails/build.js.map +1 -1
- package/dist/pipeline/src/build/rails/test.js +7 -8
- package/dist/pipeline/src/build/rails/test.js.map +1 -1
- package/dist/pipeline/src/build/types.d.ts +0 -10
- package/dist/pipeline/src/build/types.js.map +1 -1
- package/dist/pipeline/src/context/createComponentContext.js +0 -1
- package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
- package/dist/pipeline/src/context/getEnvConfig.js +2 -1
- package/dist/pipeline/src/context/getEnvConfig.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironment.js +0 -1
- package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +5 -6
- package/dist/pipeline/src/context/getEnvironmentVariables.js +31 -30
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/deploy/base/deploy.js +3 -4
- package/dist/pipeline/src/deploy/base/deploy.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/index.js +2 -2
- package/dist/pipeline/src/deploy/cloudRun/index.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 +3 -15
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/deployJob.js +0 -2
- package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/index.js +2 -2
- package/dist/pipeline/src/deploy/kubernetes/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 +3 -4
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +2 -3
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
- package/dist/pipeline/src/deploy/types/base.d.ts +0 -6
- package/dist/pipeline/src/deploy/types/kubernetes.d.ts +1 -34
- package/dist/pipeline/src/globalScriptFunctions/index.d.ts +14 -0
- package/dist/pipeline/src/globalScriptFunctions/index.js +32 -0
- package/dist/pipeline/src/globalScriptFunctions/index.js.map +1 -0
- 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/createGitlabJobs.js +2 -4
- package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.d.ts +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js +6 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabPipeline.js.map +1 -1
- package/dist/pipeline/src/pipeline/packageManager.js +7 -5
- package/dist/pipeline/src/pipeline/packageManager.js.map +1 -1
- package/dist/pipeline/src/runner/index.d.ts +1 -1
- package/dist/pipeline/src/runner/index.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +6 -9
- package/dist/pipeline/src/types/context.d.ts +2 -9
- package/dist/pipeline/src/types/context.js.map +1 -1
- package/dist/pipeline/src/types/gitlab-types.d.ts +1 -0
- package/dist/pipeline/src/types/jobs.d.ts +0 -8
- package/dist/pipeline/src/utils/gitlab.js +10 -2
- package/dist/pipeline/src/utils/gitlab.js.map +1 -1
- package/dist/pipeline/src/utils/writeFiles.js +1 -5
- package/dist/pipeline/src/utils/writeFiles.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/catenv.ts +1 -3
- package/src/apps/catenv/printVariables.ts +4 -4
- package/src/apps/catenv/types.ts +2 -2
- package/src/apps/catenv/utils.ts +8 -12
- package/src/apps/catenv/writeDotEnvFiles.ts +3 -6
- package/src/apps/catenv/writeEnvDTs.ts +1 -1
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +16 -10
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +5 -3
- package/src/apps/cli/commands/project/index.ts +1 -7
- package/src/config/getProjectConfig.ts +21 -26
- 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 -6
- package/dist/pipeline/src/context/resolveReferences.js +0 -65
- package/dist/pipeline/src/context/resolveReferences.js.map +0 -1
- package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.d.ts +0 -85
- package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js +0 -27
- package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js.map +0 -1
- package/dist/pipeline/src/packageInfos.d.ts +0 -4
- package/dist/pipeline/src/packageInfos.js +0 -17
- package/dist/pipeline/src/packageInfos.js.map +0 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
|
|
4
|
+
const BashExpression_1 = require("../bash/BashExpression");
|
|
5
|
+
const bashEscape_1 = require("../bash/bashEscape");
|
|
6
|
+
class UnresolvableReference {
|
|
7
|
+
constructor(reference) {
|
|
8
|
+
this.reference = reference;
|
|
9
|
+
}
|
|
10
|
+
toString() {
|
|
11
|
+
return `Unresolvable reference: ${this.reference.toString()}`;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.UnresolvableReference = UnresolvableReference;
|
|
15
|
+
class VariableReference {
|
|
16
|
+
constructor(componentName, variableName) {
|
|
17
|
+
this.componentName = componentName;
|
|
18
|
+
this.variableName = variableName;
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
return `\${${this.componentName}:${this.variableName}}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.VariableReference = VariableReference;
|
|
25
|
+
class VariableValueContainingReferences {
|
|
26
|
+
constructor(parts) {
|
|
27
|
+
this.parts = (Array.isArray(parts) ? parts : [parts]).flatMap((part) => part instanceof VariableValueContainingReferences
|
|
28
|
+
? part.parts
|
|
29
|
+
: part === ""
|
|
30
|
+
? []
|
|
31
|
+
: [part]);
|
|
32
|
+
}
|
|
33
|
+
toString(options = {
|
|
34
|
+
quotes: false,
|
|
35
|
+
}) {
|
|
36
|
+
return this.parts
|
|
37
|
+
.map((part) => {
|
|
38
|
+
if (typeof part === "string") {
|
|
39
|
+
return (0, bashEscape_1.escapeString)(part, options);
|
|
40
|
+
}
|
|
41
|
+
else if (part instanceof BashExpression_1.BashExpression) {
|
|
42
|
+
return (0, bashEscape_1.escapeBashExpression)(part, options);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return part.toString();
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
.join("");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.VariableValueContainingReferences = VariableValueContainingReferences;
|
|
52
|
+
// regex to resolve references in catladder variables
|
|
53
|
+
// those expressions have the pattern ${componentName:variableName}
|
|
54
|
+
const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
55
|
+
const createVariableValueContainingReferencesFromString = (value, options) => {
|
|
56
|
+
const parts = [];
|
|
57
|
+
let match;
|
|
58
|
+
let lastIndex = 0;
|
|
59
|
+
while ((match = REGEX.exec(value)) !== null) {
|
|
60
|
+
const [fullMatch, _, otherComponentName, variableName] = match;
|
|
61
|
+
parts.push(value.slice(lastIndex, match.index));
|
|
62
|
+
parts.push(new VariableReference(otherComponentName || options.componentName, variableName));
|
|
63
|
+
lastIndex = REGEX.lastIndex;
|
|
64
|
+
}
|
|
65
|
+
parts.push(value.slice(lastIndex));
|
|
66
|
+
return new VariableValueContainingReferences(parts);
|
|
67
|
+
};
|
|
68
|
+
exports.createVariableValueContainingReferencesFromString = createVariableValueContainingReferencesFromString;
|
|
69
|
+
//# sourceMappingURL=VariableValueContainingReferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VariableValueContainingReferences.js","sourceRoot":"","sources":["../../../../../pipeline/src/variables/VariableValueContainingReferences.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAExD,mDAAwE;AAExE,MAAa,qBAAqB;IAChC,YAAmB,SAA4B;QAA5B,cAAS,GAAT,SAAS,CAAmB;IAAG,CAAC;IAC5C,QAAQ;QACb,OAAO,2BAA2B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC;IAChE,CAAC;CACF;AALD,sDAKC;AACD,MAAa,iBAAiB;IAI5B,YAAY,aAAqB,EAAE,YAAoB;QACrD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAEM,QAAQ;QACb,OAAO,MAAM,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC;IAC1D,CAAC;CACF;AAZD,8CAYC;AASD,MAAa,iCAAiC;IAE5C,YACE,KAAwE;QAExE,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CACrE,IAAI,YAAY,iCAAiC;YAC/C,CAAC,CAAC,IAAI,CAAC,KAAK;YACZ,CAAC,CAAC,IAAI,KAAK,EAAE;gBACX,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,CAAC,IAAI,CAAC,CACb,CAAC;IACJ,CAAC;IAEM,QAAQ,CACb,UAAyB;QACvB,MAAM,EAAE,KAAK;KACd;QAED,OAAO,IAAI,CAAC,KAAK;aACd,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO,IAAA,yBAAY,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACrC,CAAC;iBAAM,IAAI,IAAI,YAAY,+BAAc,EAAE,CAAC;gBAC1C,OAAO,IAAA,iCAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;YACzB,CAAC;QACH,CAAC,CAAC;aACD,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC;CACF;AA/BD,8EA+BC;AAED,qDAAqD;AACrD,mEAAmE;AACnE,MAAM,KAAK,GAAG,4BAA4B,CAAC;AACpC,MAAM,iDAAiD,GAAG,CAC/D,KAAa,EACb,OAAkC,EAClC,EAAE;IACF,MAAM,KAAK,GAA6B,EAAE,CAAC;IAC3C,IAAI,KAAU,CAAC;IACf,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,kBAAkB,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC;QAE/D,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,KAAK,CAAC,IAAI,CACR,IAAI,iBAAiB,CACnB,kBAAkB,IAAI,OAAO,CAAC,aAAa,EAC3C,YAAY,CACb,CACF,CAAC;QACF,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;IAC9B,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACnC,OAAO,IAAI,iCAAiC,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC,CAAC;AArBW,QAAA,iDAAiD,qDAqB5D"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { VariableValue } from "./VariableValue";
|
|
2
|
+
import type { VariableValueContainingReferences } from "./VariableValueContainingReferences";
|
|
3
|
+
export declare const resolveAllReferences: (values: Record<string, VariableValueContainingReferences>, getEnvVars: (componentName: string) => Promise<Record<string, VariableValue | null | undefined>>) => Promise<Record<string, VariableValueContainingReferences>>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveAllReferences = void 0;
|
|
4
|
+
const VariableValueContainingReferences_1 = require("./VariableValueContainingReferences");
|
|
5
|
+
const resolveAllReferencesOnce_1 = require("./resolveAllReferencesOnce");
|
|
6
|
+
const resolveAllReferences = async (values, getEnvVars) => {
|
|
7
|
+
// replace until there aren't any references left
|
|
8
|
+
let result = values;
|
|
9
|
+
let i = 0;
|
|
10
|
+
while (Object.values(result).some((value) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference))) {
|
|
11
|
+
const replaced = await (0, resolveAllReferencesOnce_1.resolveAllReferencesOnce)(result, getEnvVars);
|
|
12
|
+
result = replaced;
|
|
13
|
+
i++;
|
|
14
|
+
if (i > 1000) {
|
|
15
|
+
const unresolved = Object.entries(result).filter(([key, value]) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
16
|
+
throw new Error("Infinite loop detected in these variables: " +
|
|
17
|
+
unresolved
|
|
18
|
+
.map(([key, value]) => `${key} (last reference: ${value.parts.find((part) => part instanceof VariableValueContainingReferences_1.VariableReference)})`)
|
|
19
|
+
.join(", "));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
};
|
|
24
|
+
exports.resolveAllReferences = resolveAllReferences;
|
|
25
|
+
//# sourceMappingURL=resolveAllReferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAllReferences.js","sourceRoot":"","sources":["../../../../../pipeline/src/variables/resolveAllReferences.ts"],"names":[],"mappings":";;;AAEA,2FAAwE;AACxE,yEAAkG;AAE3F,MAAM,oBAAoB,GAAG,KAAK,EACvC,MAAyD,EACzD,UAE8D,EAC9D,EAAE;IACF,iDAAiD;IACjD,IAAI,MAAM,GAAG,MAAM,CAAC;IAEpB,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,OACE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CACnC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,qDAAiB,CAAC,CAC9D,EACD,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,IAAA,mDAAwB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAEpE,MAAM,GAAG,QAAQ,CAAC;QAClB,CAAC,EAAE,CAAC;QACJ,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;YACb,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAChE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,qDAAiB,CAAC,CAC9D,CAAC;YAEF,MAAM,IAAI,KAAK,CACb,6CAA6C;gBAC3C,UAAU;qBACP,GAAG,CACF,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CACf,GAAG,GAAG,qBAAqB,KAAK,CAAC,KAAK,CAAC,IAAI,CACzC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,qDAAiB,CAC5C,GAAG,CACP;qBACA,IAAI,CAAC,IAAI,CAAC,CAChB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAxCW,QAAA,oBAAoB,wBAwC/B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { VariableValue } from "./VariableValue";
|
|
2
|
+
import type { VariableValueContainingReferences } from "./VariableValueContainingReferences";
|
|
3
|
+
export declare const resolveAllReferencesOnce: (values: Record<string, VariableValueContainingReferences>, getEnvVars: (componentName: string) => Promise<Record<string, VariableValue | undefined | null>>) => Promise<{
|
|
4
|
+
[k: string]: VariableValueContainingReferences;
|
|
5
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveAllReferencesOnce = void 0;
|
|
4
|
+
const VariableValueContainingReferences_1 = require("./VariableValueContainingReferences");
|
|
5
|
+
const resolveReferencesOnce_1 = require("./resolveReferencesOnce");
|
|
6
|
+
const resolveAllReferencesOnce = async (values, getEnvVars) => {
|
|
7
|
+
const allReferences = Object.values(values).flatMap((value) => value === null || value === void 0 ? void 0 : value.parts.filter((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
8
|
+
const allComponentsUnique = Array.from(new Set(allReferences.map((reference) => reference.componentName)));
|
|
9
|
+
const allEnvVarsInComponents = Object.fromEntries(await Promise.all(allComponentsUnique.map(async (componentName) => [
|
|
10
|
+
componentName,
|
|
11
|
+
await getEnvVars(componentName),
|
|
12
|
+
])));
|
|
13
|
+
return Object.fromEntries(Object.entries(values).map(([key, value]) => [
|
|
14
|
+
key,
|
|
15
|
+
value !== null && value !== undefined
|
|
16
|
+
? (0, resolveReferencesOnce_1.resolveReferencesOnce)(value, ({ componentName, variableName }) => {
|
|
17
|
+
return allEnvVarsInComponents[componentName][variableName];
|
|
18
|
+
})
|
|
19
|
+
: value,
|
|
20
|
+
]));
|
|
21
|
+
};
|
|
22
|
+
exports.resolveAllReferencesOnce = resolveAllReferencesOnce;
|
|
23
|
+
//# sourceMappingURL=resolveAllReferencesOnce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAllReferencesOnce.js","sourceRoot":"","sources":["../../../../../pipeline/src/variables/resolveAllReferencesOnce.ts"],"names":[],"mappings":";;;AAEA,2FAAwE;AACxE,mEAAgE;AAEzD,MAAM,wBAAwB,GAAG,KAAK,EAC3C,MAAyD,EACzD,UAE8D,EAC9D,EAAE;IACF,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CACjD,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,CAAC,MAAM,CACjB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,qDAAiB,CACrB,CAC3B,CAAC;IAEF,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,CACpC,IAAI,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CACnE,CAAC;IAEF,MAAM,sBAAsB,GAAG,MAAM,CAAC,WAAW,CAC/C,MAAM,OAAO,CAAC,GAAG,CACf,mBAAmB,CAAC,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,CAAC;QAC/C,aAAa;QACb,MAAM,UAAU,CAAC,aAAa,CAAC;KAChC,CAEA,CACF,CACF,CAAC;IAEF,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAC3C,GAAG;QACH,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;YACnC,CAAC,CAAC,IAAA,6CAAqB,EAAC,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,EAAE;gBAC/D,OAAO,sBAAsB,CAAC,aAAa,CAAC,CAAC,YAAY,CAAC,CAAC;YAC7D,CAAC,CAAC;YACJ,CAAC,CAAC,KAAK;KACV,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,wBAAwB,4BAsCnC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { VariableValue } from "./VariableValue";
|
|
2
|
+
import { VariableValueContainingReferences } from "./VariableValueContainingReferences";
|
|
3
|
+
type Resolver = (args: {
|
|
4
|
+
componentName: string;
|
|
5
|
+
variableName: string;
|
|
6
|
+
}) => VariableValue | null | undefined;
|
|
7
|
+
export declare const resolveReferencesOnce: (value: VariableValueContainingReferences, resolver: Resolver) => VariableValueContainingReferences;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveReferencesOnce = void 0;
|
|
4
|
+
const VariableValueContainingReferences_1 = require("./VariableValueContainingReferences");
|
|
5
|
+
const resolveReferencesOnce = (value, resolver) => {
|
|
6
|
+
const replacedParts = value.parts.map((part) => {
|
|
7
|
+
if (part instanceof VariableValueContainingReferences_1.VariableReference) {
|
|
8
|
+
const result = resolver({
|
|
9
|
+
componentName: part.componentName,
|
|
10
|
+
variableName: part.variableName,
|
|
11
|
+
});
|
|
12
|
+
return result !== null && result !== void 0 ? result : new VariableValueContainingReferences_1.UnresolvableReference(part);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return part;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return new VariableValueContainingReferences_1.VariableValueContainingReferences(replacedParts);
|
|
19
|
+
};
|
|
20
|
+
exports.resolveReferencesOnce = resolveReferencesOnce;
|
|
21
|
+
//# sourceMappingURL=resolveReferencesOnce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveReferencesOnce.js","sourceRoot":"","sources":["../../../../../pipeline/src/variables/resolveReferencesOnce.ts"],"names":[],"mappings":";;;AACA,2FAI6C;AAMtC,MAAM,qBAAqB,GAAG,CACnC,KAAwC,EACxC,QAAkB,EAClB,EAAE;IACF,MAAM,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC7C,IAAI,IAAI,YAAY,qDAAiB,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,QAAQ,CAAC;gBACtB,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,YAAY,EAAE,IAAI,CAAC,YAAY;aAChC,CAAC,CAAC;YACH,OAAO,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,IAAI,yDAAqB,CAAC,IAAI,CAAC,CAAC;QACnD,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,qEAAiC,CAAC,aAAa,CAAC,CAAC;AAC9D,CAAC,CAAC;AAjBW,QAAA,qBAAqB,yBAiBhC"}
|