@catladder/cli 1.170.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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
package/package.json
CHANGED
|
@@ -12,9 +12,7 @@ export default async (choice?: Choice) => {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
await Promise.all([
|
|
15
|
-
config.pipelineType
|
|
16
|
-
? generatePipelineFiles(config, config.pipelineType, "local")
|
|
17
|
-
: undefined,
|
|
15
|
+
generatePipelineFiles(config, config.pipelineType ?? "gitlab", "local"),
|
|
18
16
|
writeDotEnvFiles(config, choice),
|
|
19
17
|
|
|
20
18
|
writeDTsFiles(config, choice),
|
|
@@ -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,
|
|
@@ -15,7 +15,7 @@ const getAllVariablesToPrint = async (config: Config, choice?: Choice) => {
|
|
|
15
15
|
|
|
16
16
|
if (currentComponent) {
|
|
17
17
|
// don't print vars if dotenv is enabled
|
|
18
|
-
if (config.components[currentComponent].dotEnv) {
|
|
18
|
+
if (config.components[currentComponent].dotEnv ?? true) {
|
|
19
19
|
return {};
|
|
20
20
|
}
|
|
21
21
|
return await getEnvVarsResolved(null, env, currentComponent);
|
|
@@ -26,7 +26,7 @@ const getAllVariablesToPrint = async (config: Config, choice?: Choice) => {
|
|
|
26
26
|
return await Object.keys(config.components).reduce(
|
|
27
27
|
async (acc, componentName) => {
|
|
28
28
|
// don't print vars if dotenv is enabled
|
|
29
|
-
if (config.components[componentName].dotEnv) {
|
|
29
|
+
if (config.components[componentName].dotEnv ?? true) {
|
|
30
30
|
return await acc;
|
|
31
31
|
}
|
|
32
32
|
const subappvars = await getEnvVarsResolved(null, env, componentName);
|
|
@@ -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) => {
|
|
@@ -18,7 +16,7 @@ export const writeDotEnvFiles = async (config: Config, choice?: Choice) => {
|
|
|
18
16
|
);
|
|
19
17
|
|
|
20
18
|
const componentsWithEnabledDotEnvWrite = Object.entries(config.components)
|
|
21
|
-
.filter(([, component]) => component?.dotEnv) // when set to true or "local"
|
|
19
|
+
.filter(([, component]) => component?.dotEnv ?? true) // when set to true or "local"
|
|
22
20
|
.map(([componentName]) => componentName);
|
|
23
21
|
|
|
24
22
|
const componentsToActuallyWriteDotEnvNow = currentComponent
|
|
@@ -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
|
}
|
|
@@ -15,7 +15,7 @@ export const writeDTsFiles = async (config: Config, choice?: Choice) => {
|
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
const componentsWithEnabledEnvDTsWrite = Object.entries(config.components)
|
|
18
|
-
.filter(([, component]) => component?.envDTs)
|
|
18
|
+
.filter(([, component]) => component?.envDTs ?? true)
|
|
19
19
|
.map(([componentName]) => componentName);
|
|
20
20
|
|
|
21
21
|
const componentsToActuallyWriteEnvDts = currentComponent
|
|
@@ -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
|
|
|
@@ -11,7 +11,6 @@ import commandGitlabCi from "./commandGitlabCi";
|
|
|
11
11
|
import commandSetup from "./commandSetup";
|
|
12
12
|
import commandRenewToken from "./commandRenewToken";
|
|
13
13
|
import commandListPods from "./commandListPods";
|
|
14
|
-
import commandMigrateHelm3 from "./commandMigrateHelm3";
|
|
15
14
|
import commandNamespace from "./commandNamespace";
|
|
16
15
|
import commandOpenCostDashboard from "./commandOpenCostDashboard";
|
|
17
16
|
import commandOpenDashboard from "./commandOpenDashboard";
|
|
@@ -19,11 +18,8 @@ import commandOpenEnv from "./commandOpenEnv";
|
|
|
19
18
|
import commandOpenGit from "./commandOpenGit";
|
|
20
19
|
import commandOpenLogs from "./commandOpenLogs";
|
|
21
20
|
import commandPauseProject from "./commandPauseProject";
|
|
22
|
-
import commandOpenGrafana from "./commandOpenGrafana";
|
|
23
21
|
import commandPortForward from "./commandPortForward";
|
|
24
22
|
import commandTriggerCronjob from "./commandTriggerCronjob";
|
|
25
|
-
|
|
26
|
-
import commandOpenGrafanaPod from "./commandOpenGrafanaPod";
|
|
27
23
|
import commandSecretsClearBackups from "./commandSecretsClearBackups";
|
|
28
24
|
import commandProjectRestoreDb from "./cloudSql/commandProjectRestoreDb";
|
|
29
25
|
import commandSecurityEvaluate from "./commandSecurityEvaluate";
|
|
@@ -45,8 +41,6 @@ export default async (vorpal: Vorpal) => {
|
|
|
45
41
|
|
|
46
42
|
commandOpenCostDashboard(vorpal);
|
|
47
43
|
|
|
48
|
-
commandOpenGrafana(vorpal);
|
|
49
|
-
commandOpenGrafanaPod(vorpal);
|
|
50
44
|
commandCloudSqlProxy(vorpal);
|
|
51
45
|
commandProjectRestoreDb(vorpal);
|
|
52
46
|
commandOpenGit(vorpal);
|
|
@@ -62,6 +56,6 @@ export default async (vorpal: Vorpal) => {
|
|
|
62
56
|
commandGitlabCi(vorpal);
|
|
63
57
|
|
|
64
58
|
commandGetMyTotalWorktime(vorpal);
|
|
65
|
-
|
|
59
|
+
|
|
66
60
|
commandSecurityEvaluate(vorpal);
|
|
67
61
|
};
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
Config,
|
|
3
|
+
EnvironmentEnvVars,
|
|
4
|
+
VariableValue,
|
|
5
|
+
} from "@catladder/pipeline";
|
|
2
6
|
import {
|
|
3
7
|
readConfig,
|
|
4
8
|
getAllEnvs,
|
|
@@ -151,21 +155,17 @@ export const getEnvVarsResolved = async (
|
|
|
151
155
|
if (!componentName) {
|
|
152
156
|
return {};
|
|
153
157
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} catch (e) {
|
|
166
|
-
// env is disabled
|
|
167
|
-
return {};
|
|
168
|
-
}
|
|
158
|
+
|
|
159
|
+
const envionment = await getEnvironment(env, componentName);
|
|
160
|
+
|
|
161
|
+
// in the pipeline the secrets alreadyy exists and bash will expand them
|
|
162
|
+
// but here we need to manually load them
|
|
163
|
+
return resolveSecrets(vorpal, [
|
|
164
|
+
{
|
|
165
|
+
envVars: envionment.envVars,
|
|
166
|
+
secretEnvVarKeys: envionment.secretEnvVarKeys,
|
|
167
|
+
},
|
|
168
|
+
]);
|
|
169
169
|
};
|
|
170
170
|
|
|
171
171
|
/**
|
|
@@ -177,14 +177,9 @@ export const getJobOnlyEnvVarsResolved = async (
|
|
|
177
177
|
env: string,
|
|
178
178
|
componentName: string,
|
|
179
179
|
) => {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
]);
|
|
186
|
-
} catch (e) {
|
|
187
|
-
// env is disabled
|
|
188
|
-
return {};
|
|
189
|
-
}
|
|
180
|
+
const envionment = await getEnvironment(env, componentName);
|
|
181
|
+
return resolveSecrets(vorpal, [
|
|
182
|
+
envionment.jobOnlyVars.build,
|
|
183
|
+
envionment.jobOnlyVars.deploy,
|
|
184
|
+
]);
|
|
190
185
|
};
|
|
@@ -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,6 +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>>;
|
|
4
|
-
export declare const translateLegacyFromComponents: (fromComponents: Record<string, Record<string, string>>) => {
|
|
5
|
-
[k: string]: string;
|
|
6
|
-
};
|
|
@@ -1,65 +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.translateLegacyFromComponents = 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
|
-
const translateLegacyFromComponents = (fromComponents) => {
|
|
57
|
-
return Object.fromEntries(Object.entries(fromComponents).flatMap(([componentName, variables]) => {
|
|
58
|
-
return Object.entries(variables).map(([ourName, otherName]) => [
|
|
59
|
-
ourName,
|
|
60
|
-
"${" + componentName + ":" + otherName + "}",
|
|
61
|
-
]);
|
|
62
|
-
}));
|
|
63
|
-
};
|
|
64
|
-
exports.translateLegacyFromComponents = translateLegacyFromComponents;
|
|
65
|
-
//# sourceMappingURL=resolveReferences.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveReferences.js","sourceRoot":"","sources":["../../../../../pipeline/src/context/resolveReferences.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { StringOrBashExpression } from "../../bash/BashExpression";
|
|
2
|
-
export declare const processSecretsAsFiles: <T extends {
|
|
3
|
-
env: {
|
|
4
|
-
secret: Record<string, StringOrBashExpression>;
|
|
5
|
-
};
|
|
6
|
-
} & {
|
|
7
|
-
cloudsql?: import("../types").DeployConfigKubernetesValuesCloudSQL;
|
|
8
|
-
mongodb?: import("../types").DeployConfigMongodb;
|
|
9
|
-
mailhog?: {
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
};
|
|
12
|
-
jobs?: Record<string, false | import("../types/base").AllowUnknownProps<{
|
|
13
|
-
command: string;
|
|
14
|
-
hook?: string;
|
|
15
|
-
}>>;
|
|
16
|
-
cronjobs?: Record<string, false | import("../types/base").AllowUnknownProps<{
|
|
17
|
-
schedule: string;
|
|
18
|
-
command: string;
|
|
19
|
-
concurrencyPolicy?: "Forbid" | "Allow" | "Replace";
|
|
20
|
-
}>>;
|
|
21
|
-
application?: false | import("../types/base").AllowUnknownProps<{
|
|
22
|
-
command?: string;
|
|
23
|
-
enabled?: boolean;
|
|
24
|
-
redirects?: import("../types").KubernetesRedirect[];
|
|
25
|
-
hostAliases?: string[];
|
|
26
|
-
replicas?: number;
|
|
27
|
-
autoscale?: import("../types").KubernetesAutoscale;
|
|
28
|
-
updateStrategy?: import("../types").KubernetesUpdateStrategy;
|
|
29
|
-
resources?: import("../types").KubernetesResourcesDef;
|
|
30
|
-
healthRoute?: string;
|
|
31
|
-
startupProbe?: {
|
|
32
|
-
httpGet?: {
|
|
33
|
-
path?: string;
|
|
34
|
-
port?: number;
|
|
35
|
-
httpHeaders?: {
|
|
36
|
-
name: string;
|
|
37
|
-
value: string;
|
|
38
|
-
}[];
|
|
39
|
-
failureThreshold?: number;
|
|
40
|
-
timeoutSeconds?: number;
|
|
41
|
-
periodSeconds?: number;
|
|
42
|
-
successThreshold?: number;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
readinessProbe?: {
|
|
46
|
-
httpGet?: {
|
|
47
|
-
path?: string;
|
|
48
|
-
port?: number;
|
|
49
|
-
httpHeaders?: {
|
|
50
|
-
name: string;
|
|
51
|
-
value: string;
|
|
52
|
-
}[];
|
|
53
|
-
failureThreshold?: number;
|
|
54
|
-
timeoutSeconds?: number;
|
|
55
|
-
periodSeconds?: number;
|
|
56
|
-
successThreshold?: number;
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
livenessProbe?: {
|
|
60
|
-
httpGet?: {
|
|
61
|
-
path?: string;
|
|
62
|
-
port?: number;
|
|
63
|
-
httpHeaders?: {
|
|
64
|
-
name: string;
|
|
65
|
-
value: string;
|
|
66
|
-
}[];
|
|
67
|
-
failureThreshold?: number;
|
|
68
|
-
timeoutSeconds?: number;
|
|
69
|
-
periodSeconds?: number;
|
|
70
|
-
successThreshold?: number;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
worker?: import("../types").KubernetesWorkerDef;
|
|
74
|
-
jobDefaults?: {
|
|
75
|
-
resources: import("../types").KubernetesResourcesDef;
|
|
76
|
-
};
|
|
77
|
-
}>;
|
|
78
|
-
secretsFromOtherComponent?: {
|
|
79
|
-
[envVar: string]: string;
|
|
80
|
-
};
|
|
81
|
-
mapServiceUrlToEnv?: {
|
|
82
|
-
[envVar: string]: string;
|
|
83
|
-
};
|
|
84
|
-
secretsAsFile?: string[];
|
|
85
|
-
} & Record<string, unknown>>(values: T) => T;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.processSecretsAsFiles = void 0;
|
|
4
|
-
const lodash_1 = require("lodash");
|
|
5
|
-
const processSecretsAsFiles = (values) => {
|
|
6
|
-
if (!values.secretsAsFile || values.secretsAsFile.length === 0) {
|
|
7
|
-
return values;
|
|
8
|
-
}
|
|
9
|
-
// the initial idea was that we "shadow" secrets that we mount as files,
|
|
10
|
-
// but there is a weird kubernetes issue with that (https://github.com/kubernetes/kubernetes/issues/46861),
|
|
11
|
-
// so instead we rename the secrets and append _content, so that inside kuberentes, we can use the original name to contain the path and name+_content as the actual content
|
|
12
|
-
return {
|
|
13
|
-
...values,
|
|
14
|
-
env: {
|
|
15
|
-
...values.env,
|
|
16
|
-
secret: {
|
|
17
|
-
...(0, lodash_1.omit)(values.env.secret, values.secretsAsFile),
|
|
18
|
-
...Object.fromEntries(values.secretsAsFile.map((key) => [
|
|
19
|
-
key + "_content",
|
|
20
|
-
values.env.secret[key],
|
|
21
|
-
])),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
exports.processSecretsAsFiles = processSecretsAsFiles;
|
|
27
|
-
//# sourceMappingURL=processSecretsAsFiles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"processSecretsAsFiles.js","sourceRoot":"","sources":["../../../../../../pipeline/src/deploy/kubernetes/processSecretsAsFiles.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAIvB,MAAM,qBAAqB,GAAG,CAOnC,MAAS,EACN,EAAE;IACL,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,wEAAwE;IACxE,4GAA4G;IAC5G,4KAA4K;IAC5K,OAAO;QACL,GAAG,MAAM;QACT,GAAG,EAAE;YACH,GAAG,MAAM,CAAC,GAAG;YACb,MAAM,EAAE;gBACN,GAAG,IAAA,aAAI,EAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC;gBAChD,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;oBAChC,GAAG,GAAG,UAAU;oBAChB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;iBACvB,CAAC,CACH;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,qBAAqB,yBA8BhC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
// we can't import the package.json directly, because the bundling process will inline it
|
|
5
|
-
// but the version is only set during deployement, when its already bundled
|
|
6
|
-
// instead we need to use require.main.path to get the path of the main module, which is actually the file in the bin
|
|
7
|
-
// this will point to the root package.json
|
|
8
|
-
let ownPkg = { version: "0.0.0" };
|
|
9
|
-
try {
|
|
10
|
-
const path = ((_a = require.main) === null || _a === void 0 ? void 0 : _a.path) + "/../package.json";
|
|
11
|
-
ownPkg = require(path);
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
// ignore, currently in the gitlab-includes, this doesn't work
|
|
15
|
-
}
|
|
16
|
-
exports.default = ownPkg;
|
|
17
|
-
//# sourceMappingURL=packageInfos.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packageInfos.js","sourceRoot":"","sources":["../../../../pipeline/src/packageInfos.ts"],"names":[],"mappings":";;;AAAA,yFAAyF;AACzF,2EAA2E;AAC3E,qHAAqH;AACrH,2CAA2C;AAC3C,IAAI,MAAM,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AAClC,IAAI,CAAC;IACH,MAAM,IAAI,GAAG,CAAA,MAAA,OAAO,CAAC,IAAI,0CAAE,IAAI,IAAG,kBAAkB,CAAC;IAErD,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,8DAA8D;AAChE,CAAC;AAED,kBAAe,MAAM,CAAC"}
|