@catladder/cli 0.0.0-main-4d1a3af5 → 0.0.0-main-0b5c90c3

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 (36) hide show
  1. package/dist/bundles/catenv/index.js +82 -49
  2. package/dist/bundles/cli/index.js +65 -31
  3. package/dist/cli/src/apps/catenv/catenv.js +5 -4
  4. package/dist/cli/src/apps/catenv/catenv.js.map +1 -1
  5. package/dist/cli/src/apps/catenv/printVariables.d.ts +2 -2
  6. package/dist/cli/src/apps/catenv/printVariables.js +2 -2
  7. package/dist/cli/src/apps/catenv/printVariables.js.map +1 -1
  8. package/dist/cli/src/apps/catenv/writeDotEnvFiles.d.ts +2 -2
  9. package/dist/cli/src/apps/catenv/writeDotEnvFiles.js +5 -6
  10. package/dist/cli/src/apps/catenv/writeDotEnvFiles.js.map +1 -1
  11. package/dist/cli/src/apps/catenv/writeEnvDTs.d.ts +2 -2
  12. package/dist/cli/src/apps/catenv/writeEnvDTs.js +5 -6
  13. package/dist/cli/src/apps/catenv/writeEnvDTs.js.map +1 -1
  14. package/dist/pipeline/src/catenv/index.d.ts +7 -0
  15. package/dist/pipeline/src/catenv/index.js +12 -0
  16. package/dist/pipeline/src/catenv/index.js.map +1 -0
  17. package/dist/pipeline/src/index.d.ts +1 -0
  18. package/dist/pipeline/src/index.js +1 -0
  19. package/dist/pipeline/src/index.js.map +1 -1
  20. package/dist/pipeline/src/pipeline/generatePipelineFiles.d.ts +2 -1
  21. package/dist/pipeline/src/pipeline/generatePipelineFiles.js +3 -4
  22. package/dist/pipeline/src/pipeline/generatePipelineFiles.js.map +1 -1
  23. package/dist/pipeline/src/types/config.d.ts +5 -0
  24. package/dist/pipeline/src/types/config.js.map +1 -1
  25. package/dist/pipeline/src/types/hooks.d.ts +26 -0
  26. package/dist/pipeline/src/types/hooks.js +3 -0
  27. package/dist/pipeline/src/types/hooks.js.map +1 -0
  28. package/dist/pipeline/src/utils/writeFiles.d.ts +12 -4
  29. package/dist/pipeline/src/utils/writeFiles.js +42 -27
  30. package/dist/pipeline/src/utils/writeFiles.js.map +1 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +1 -1
  33. package/src/apps/catenv/catenv.ts +11 -5
  34. package/src/apps/catenv/printVariables.ts +6 -3
  35. package/src/apps/catenv/writeDotEnvFiles.ts +21 -8
  36. package/src/apps/catenv/writeEnvDTs.ts +15 -6
@@ -18,11 +18,12 @@ exports["default"] = async (choice) => {
18
18
  if (!config) {
19
19
  return;
20
20
  }
21
+ const context = (0, pipeline_1.createCatenvContext)(config);
21
22
  await Promise.all([
22
- (0, pipeline_1.generatePipelineFiles)(config, (_a = config.pipelineType) !== null && _a !== void 0 ? _a : "gitlab"),
23
- (0, writeDotEnvFiles_1.writeDotEnvFiles)(config, choice),
24
- (0, writeEnvDTs_1.writeDTsFiles)(config, choice),
25
- (0, printVariables_1.printVariables)(config, choice),
23
+ (0, pipeline_1.generatePipelineFiles)(context, (_a = config.pipelineType) !== null && _a !== void 0 ? _a : "gitlab"),
24
+ (0, writeDotEnvFiles_1.writeDotEnvFiles)(context, choice),
25
+ (0, writeEnvDTs_1.writeDTsFiles)(context, choice),
26
+ (0, printVariables_1.printVariables)(context, choice),
26
27
  ]);
27
28
  };
28
29
  //# sourceMappingURL=catenv.js.map
@@ -72,8 +73,8 @@ const getAllVariablesToPrint = async (config, choice) => {
72
73
  }, Promise.resolve({}));
73
74
  }
74
75
  };
75
- const printVariables = async (config, choice) => {
76
- const variables = await getAllVariablesToPrint(config, choice);
76
+ const printVariables = async (context, choice) => {
77
+ const variables = await getAllVariablesToPrint(context.config, choice);
77
78
  console.log(makeExportKeyValuestring(variables));
78
79
  };
79
80
  exports.printVariables = printVariables;
@@ -134,14 +135,13 @@ exports.sanitizeEnvVarName = sanitizeEnvVarName;
134
135
 
135
136
  Object.defineProperty(exports, "__esModule", ({ value: true }));
136
137
  exports.writeDotEnvFiles = void 0;
137
- const pipeline_1 = __nccwpck_require__(603);
138
138
  const path_1 = __nccwpck_require__(1017);
139
139
  const getProjectConfig_1 = __nccwpck_require__(5264);
140
140
  const projects_1 = __nccwpck_require__(9011);
141
141
  const utils_1 = __nccwpck_require__(4560);
142
- const writeDotEnvFiles = async (config, choice) => {
143
- const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice);
144
- const componentsWithEnabledDotEnvWrite = Object.entries(config.components)
142
+ const writeDotEnvFiles = async (context, choice) => {
143
+ const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(context.config, choice);
144
+ const componentsWithEnabledDotEnvWrite = Object.entries(context.config.components)
145
145
  .filter(([, component]) => { var _a; return (_a = component === null || component === void 0 ? void 0 : component.dotEnv) !== null && _a !== void 0 ? _a : true; }) // when set to true or "local"
146
146
  .map(([componentName]) => componentName);
147
147
  const componentsToActuallyWriteDotEnvNow = currentComponent
@@ -153,9 +153,9 @@ const writeDotEnvFiles = async (config, choice) => {
153
153
  for (const componentName of componentsToActuallyWriteDotEnvNow) {
154
154
  const variables = await (0, getProjectConfig_1.getEnvVarsResolved)(null, env, componentName);
155
155
  delete variables["_ALL_ENV_VAR_KEYS"];
156
- const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
156
+ const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, context.config, componentName);
157
157
  const filePath = (0, path_1.join)(componentDir, ".env");
158
- await (0, pipeline_1.writeGeneratedFile)(filePath, (0, utils_1.makeKeyValueString)(variables), {
158
+ await context.fileWriter.writeGeneratedFile(filePath, (0, utils_1.makeKeyValueString)(variables), {
159
159
  commentChar: "#",
160
160
  });
161
161
  }
@@ -172,14 +172,13 @@ exports.writeDotEnvFiles = writeDotEnvFiles;
172
172
 
173
173
  Object.defineProperty(exports, "__esModule", ({ value: true }));
174
174
  exports.writeDTsFiles = void 0;
175
- const pipeline_1 = __nccwpck_require__(603);
176
175
  const path_1 = __nccwpck_require__(1017);
177
176
  const getProjectConfig_1 = __nccwpck_require__(5264);
178
177
  const projects_1 = __nccwpck_require__(9011);
179
178
  const utils_1 = __nccwpck_require__(4560);
180
- const writeDTsFiles = async (config, choice) => {
181
- const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice);
182
- const componentsWithEnabledEnvDTsWrite = Object.entries(config.components)
179
+ const writeDTsFiles = async (context, choice) => {
180
+ const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(context.config, choice);
181
+ const componentsWithEnabledEnvDTsWrite = Object.entries(context.config.components)
183
182
  .filter(([, component]) => { var _a; return (_a = component === null || component === void 0 ? void 0 : component.envDTs) !== null && _a !== void 0 ? _a : true; })
184
183
  .map(([componentName]) => componentName);
185
184
  const componentsToActuallyWriteEnvDts = currentComponent
@@ -191,9 +190,9 @@ const writeDTsFiles = async (config, choice) => {
191
190
  for (const componentName of componentsToActuallyWriteEnvDts) {
192
191
  const envNames = await getEnvsForDTs(env, componentName);
193
192
  const envDTsContent = createEnvDTsContent(envNames);
194
- const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
193
+ const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, context.config, componentName);
195
194
  const filePath = (0, path_1.join)(componentDir, "env.d.ts");
196
- await (0, pipeline_1.writeGeneratedFile)(filePath, envDTsContent, {
195
+ await context.fileWriter.writeGeneratedFile(filePath, envDTsContent, {
197
196
  commentChar: "//",
198
197
  });
199
198
  }
@@ -2696,6 +2695,25 @@ exports.isOfBuildType = isOfBuildType;
2696
2695
 
2697
2696
  /***/ }),
2698
2697
 
2698
+ /***/ 2155:
2699
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
2700
+
2701
+ "use strict";
2702
+
2703
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2704
+ exports.createCatenvContext = void 0;
2705
+ const writeFiles_1 = __nccwpck_require__(2228);
2706
+ const createCatenvContext = (config) => {
2707
+ return {
2708
+ config,
2709
+ fileWriter: writeFiles_1.FileWriter.create(config),
2710
+ };
2711
+ };
2712
+ exports.createCatenvContext = createCatenvContext;
2713
+ //# sourceMappingURL=index.js.map
2714
+
2715
+ /***/ }),
2716
+
2699
2717
  /***/ 9609:
2700
2718
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
2701
2719
 
@@ -5882,6 +5900,7 @@ __exportStar(__nccwpck_require__(8483), exports);
5882
5900
  __exportStar(__nccwpck_require__(2228), exports);
5883
5901
  __exportStar(__nccwpck_require__(1619), exports);
5884
5902
  __exportStar(__nccwpck_require__(2990), exports);
5903
+ __exportStar(__nccwpck_require__(2155), exports);
5885
5904
  //# sourceMappingURL=index.js.map
5886
5905
 
5887
5906
  /***/ }),
@@ -6617,16 +6636,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
6617
6636
  exports.getGitlabCompletePipeline = exports.generatePipelineFiles = void 0;
6618
6637
  const promises_1 = __nccwpck_require__(3292);
6619
6638
  const path_1 = __nccwpck_require__(1017);
6620
- const writeFiles_1 = __nccwpck_require__(2228);
6621
6639
  const createMainPipeline_1 = __nccwpck_require__(9192);
6622
6640
  const sortGitLabJobDefProps_1 = __nccwpck_require__(2361);
6623
6641
  const CATLADDER_GENERATED_FOLDER = ".catladder-generated";
6624
6642
  const GITLAB_GENERATED_FOLDER = CATLADDER_GENERATED_FOLDER + "/gitlab";
6625
- async function generatePipelineFiles(config, pipelineType) {
6643
+ async function generatePipelineFiles(context, pipelineType) {
6626
6644
  if (pipelineType !== "gitlab") {
6627
6645
  throw new Error("Pipeline type not supported");
6628
6646
  }
6629
- const includes = await getGitlabPipelineIncludes(config);
6647
+ const includes = await getGitlabPipelineIncludes(context.config);
6630
6648
  const mainFile = {
6631
6649
  path: ".gitlab-ci.yml",
6632
6650
  content: {
@@ -6639,7 +6657,7 @@ async function generatePipelineFiles(config, pipelineType) {
6639
6657
  // write files
6640
6658
  await Promise.all(files.map(async ({ path, content }) => {
6641
6659
  await (0, promises_1.mkdir)((0, path_1.dirname)(path), { recursive: true });
6642
- await (0, writeFiles_1.writeYamlfile)(path, content);
6660
+ await context.fileWriter.writeYamlfile(path, content);
6643
6661
  }));
6644
6662
  }
6645
6663
  exports.generatePipelineFiles = generatePipelineFiles;
@@ -7692,29 +7710,9 @@ exports.removeUndefined = removeUndefined;
7692
7710
  "use strict";
7693
7711
 
7694
7712
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7695
- exports.writeYamlfile = exports.yamlStringifyOptions = exports.writeGeneratedFile = exports.getAutoGeneratedHeader = void 0;
7713
+ exports.FileWriter = exports.yamlStringifyOptions = void 0;
7696
7714
  const promises_1 = __nccwpck_require__(3292);
7697
7715
  const yaml_1 = __nccwpck_require__(8033);
7698
- const getAutoGeneratedHeader = (commentChar) => {
7699
- return [
7700
- "-------------------------------------------------",
7701
- `🐱 🔨 This file is generated by catladder`,
7702
- `🚨 Do not edit this file manually 🚨`,
7703
- "-------------------------------------------------",
7704
- ]
7705
- .map((line) => `${commentChar} ${line}`)
7706
- .join("\n")
7707
- .concat("\n");
7708
- };
7709
- exports.getAutoGeneratedHeader = getAutoGeneratedHeader;
7710
- const writeGeneratedFile = async (path, content, { commentChar, }) => {
7711
- await (0, promises_1.writeFile)(path,
7712
- // need to spread out the jobs, forgot why
7713
- [(0, exports.getAutoGeneratedHeader)(commentChar), content].join("\n"), {
7714
- encoding: "utf-8",
7715
- });
7716
- };
7717
- exports.writeGeneratedFile = writeGeneratedFile;
7718
7716
  exports.yamlStringifyOptions = {
7719
7717
  // prevents colapsing long command statements into multiple lines
7720
7718
  lineWidth: 0,
@@ -7723,12 +7721,47 @@ exports.yamlStringifyOptions = {
7723
7721
  // Better readability when bash commands most often use double quotes
7724
7722
  singleQuote: true,
7725
7723
  };
7726
- const writeYamlfile = async (path, data) => {
7727
- await (0, exports.writeGeneratedFile)(path, (0, yaml_1.stringify)(data, exports.yamlStringifyOptions), {
7728
- commentChar: "#",
7729
- });
7730
- };
7731
- exports.writeYamlfile = writeYamlfile;
7724
+ class FileWriter {
7725
+ static create(config) {
7726
+ return new FileWriter(config);
7727
+ }
7728
+ constructor(config) {
7729
+ this.config = config;
7730
+ this.config = config;
7731
+ }
7732
+ async writeTheFile(path, content) {
7733
+ var _a, _b;
7734
+ const transformedContent = await ((_a = this.config.hooks) === null || _a === void 0 ? void 0 : _a.transformFileBeforeWrite({
7735
+ filename: path,
7736
+ content,
7737
+ extension: (_b = path.split(".").pop()) !== null && _b !== void 0 ? _b : "",
7738
+ path,
7739
+ }));
7740
+ await (0, promises_1.writeFile)(path, transformedContent !== null && transformedContent !== void 0 ? transformedContent : content, {
7741
+ encoding: "utf-8",
7742
+ });
7743
+ }
7744
+ async writeGeneratedFile(path, content, options) {
7745
+ await this.writeTheFile(path, [this.getAutoGeneratedHeader(options.commentChar), content].join("\n"));
7746
+ }
7747
+ writeYamlfile(path, data) {
7748
+ return this.writeGeneratedFile(path, (0, yaml_1.stringify)(data, exports.yamlStringifyOptions), {
7749
+ commentChar: "#",
7750
+ });
7751
+ }
7752
+ getAutoGeneratedHeader(commentChar) {
7753
+ return [
7754
+ "-------------------------------------------------",
7755
+ `🐱 🔨 This file is generated by catladder`,
7756
+ `🚨 Do not edit this file manually 🚨`,
7757
+ "-------------------------------------------------",
7758
+ ]
7759
+ .map((line) => `${commentChar} ${line}`)
7760
+ .join("\n")
7761
+ .concat("\n");
7762
+ }
7763
+ }
7764
+ exports.FileWriter = FileWriter;
7732
7765
  //# sourceMappingURL=writeFiles.js.map
7733
7766
 
7734
7767
  /***/ }),
@@ -5950,6 +5950,25 @@ exports.isOfBuildType = isOfBuildType;
5950
5950
 
5951
5951
  /***/ }),
5952
5952
 
5953
+ /***/ 32155:
5954
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
5955
+
5956
+ "use strict";
5957
+
5958
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
5959
+ exports.createCatenvContext = void 0;
5960
+ const writeFiles_1 = __nccwpck_require__(92228);
5961
+ const createCatenvContext = (config) => {
5962
+ return {
5963
+ config,
5964
+ fileWriter: writeFiles_1.FileWriter.create(config),
5965
+ };
5966
+ };
5967
+ exports.createCatenvContext = createCatenvContext;
5968
+ //# sourceMappingURL=index.js.map
5969
+
5970
+ /***/ }),
5971
+
5953
5972
  /***/ 45449:
5954
5973
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
5955
5974
 
@@ -9136,6 +9155,7 @@ __exportStar(__nccwpck_require__(68483), exports);
9136
9155
  __exportStar(__nccwpck_require__(92228), exports);
9137
9156
  __exportStar(__nccwpck_require__(51619), exports);
9138
9157
  __exportStar(__nccwpck_require__(22990), exports);
9158
+ __exportStar(__nccwpck_require__(32155), exports);
9139
9159
  //# sourceMappingURL=index.js.map
9140
9160
 
9141
9161
  /***/ }),
@@ -9871,16 +9891,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
9871
9891
  exports.getGitlabCompletePipeline = exports.generatePipelineFiles = void 0;
9872
9892
  const promises_1 = __nccwpck_require__(73292);
9873
9893
  const path_1 = __nccwpck_require__(71017);
9874
- const writeFiles_1 = __nccwpck_require__(92228);
9875
9894
  const createMainPipeline_1 = __nccwpck_require__(39192);
9876
9895
  const sortGitLabJobDefProps_1 = __nccwpck_require__(72361);
9877
9896
  const CATLADDER_GENERATED_FOLDER = ".catladder-generated";
9878
9897
  const GITLAB_GENERATED_FOLDER = CATLADDER_GENERATED_FOLDER + "/gitlab";
9879
- async function generatePipelineFiles(config, pipelineType) {
9898
+ async function generatePipelineFiles(context, pipelineType) {
9880
9899
  if (pipelineType !== "gitlab") {
9881
9900
  throw new Error("Pipeline type not supported");
9882
9901
  }
9883
- const includes = await getGitlabPipelineIncludes(config);
9902
+ const includes = await getGitlabPipelineIncludes(context.config);
9884
9903
  const mainFile = {
9885
9904
  path: ".gitlab-ci.yml",
9886
9905
  content: {
@@ -9893,7 +9912,7 @@ async function generatePipelineFiles(config, pipelineType) {
9893
9912
  // write files
9894
9913
  await Promise.all(files.map(async ({ path, content }) => {
9895
9914
  await (0, promises_1.mkdir)((0, path_1.dirname)(path), { recursive: true });
9896
- await (0, writeFiles_1.writeYamlfile)(path, content);
9915
+ await context.fileWriter.writeYamlfile(path, content);
9897
9916
  }));
9898
9917
  }
9899
9918
  exports.generatePipelineFiles = generatePipelineFiles;
@@ -10946,29 +10965,9 @@ exports.removeUndefined = removeUndefined;
10946
10965
  "use strict";
10947
10966
 
10948
10967
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10949
- exports.writeYamlfile = exports.yamlStringifyOptions = exports.writeGeneratedFile = exports.getAutoGeneratedHeader = void 0;
10968
+ exports.FileWriter = exports.yamlStringifyOptions = void 0;
10950
10969
  const promises_1 = __nccwpck_require__(73292);
10951
10970
  const yaml_1 = __nccwpck_require__(68033);
10952
- const getAutoGeneratedHeader = (commentChar) => {
10953
- return [
10954
- "-------------------------------------------------",
10955
- `🐱 🔨 This file is generated by catladder`,
10956
- `🚨 Do not edit this file manually 🚨`,
10957
- "-------------------------------------------------",
10958
- ]
10959
- .map((line) => `${commentChar} ${line}`)
10960
- .join("\n")
10961
- .concat("\n");
10962
- };
10963
- exports.getAutoGeneratedHeader = getAutoGeneratedHeader;
10964
- const writeGeneratedFile = async (path, content, { commentChar, }) => {
10965
- await (0, promises_1.writeFile)(path,
10966
- // need to spread out the jobs, forgot why
10967
- [(0, exports.getAutoGeneratedHeader)(commentChar), content].join("\n"), {
10968
- encoding: "utf-8",
10969
- });
10970
- };
10971
- exports.writeGeneratedFile = writeGeneratedFile;
10972
10971
  exports.yamlStringifyOptions = {
10973
10972
  // prevents colapsing long command statements into multiple lines
10974
10973
  lineWidth: 0,
@@ -10977,12 +10976,47 @@ exports.yamlStringifyOptions = {
10977
10976
  // Better readability when bash commands most often use double quotes
10978
10977
  singleQuote: true,
10979
10978
  };
10980
- const writeYamlfile = async (path, data) => {
10981
- await (0, exports.writeGeneratedFile)(path, (0, yaml_1.stringify)(data, exports.yamlStringifyOptions), {
10982
- commentChar: "#",
10983
- });
10984
- };
10985
- exports.writeYamlfile = writeYamlfile;
10979
+ class FileWriter {
10980
+ static create(config) {
10981
+ return new FileWriter(config);
10982
+ }
10983
+ constructor(config) {
10984
+ this.config = config;
10985
+ this.config = config;
10986
+ }
10987
+ async writeTheFile(path, content) {
10988
+ var _a, _b;
10989
+ const transformedContent = await ((_a = this.config.hooks) === null || _a === void 0 ? void 0 : _a.transformFileBeforeWrite({
10990
+ filename: path,
10991
+ content,
10992
+ extension: (_b = path.split(".").pop()) !== null && _b !== void 0 ? _b : "",
10993
+ path,
10994
+ }));
10995
+ await (0, promises_1.writeFile)(path, transformedContent !== null && transformedContent !== void 0 ? transformedContent : content, {
10996
+ encoding: "utf-8",
10997
+ });
10998
+ }
10999
+ async writeGeneratedFile(path, content, options) {
11000
+ await this.writeTheFile(path, [this.getAutoGeneratedHeader(options.commentChar), content].join("\n"));
11001
+ }
11002
+ writeYamlfile(path, data) {
11003
+ return this.writeGeneratedFile(path, (0, yaml_1.stringify)(data, exports.yamlStringifyOptions), {
11004
+ commentChar: "#",
11005
+ });
11006
+ }
11007
+ getAutoGeneratedHeader(commentChar) {
11008
+ return [
11009
+ "-------------------------------------------------",
11010
+ `🐱 🔨 This file is generated by catladder`,
11011
+ `🚨 Do not edit this file manually 🚨`,
11012
+ "-------------------------------------------------",
11013
+ ]
11014
+ .map((line) => `${commentChar} ${line}`)
11015
+ .join("\n")
11016
+ .concat("\n");
11017
+ }
11018
+ }
11019
+ exports.FileWriter = FileWriter;
10986
11020
  //# sourceMappingURL=writeFiles.js.map
10987
11021
 
10988
11022
  /***/ }),
@@ -11,11 +11,12 @@ exports.default = async (choice) => {
11
11
  if (!config) {
12
12
  return;
13
13
  }
14
+ const context = (0, pipeline_1.createCatenvContext)(config);
14
15
  await Promise.all([
15
- (0, pipeline_1.generatePipelineFiles)(config, (_a = config.pipelineType) !== null && _a !== void 0 ? _a : "gitlab"),
16
- (0, writeDotEnvFiles_1.writeDotEnvFiles)(config, choice),
17
- (0, writeEnvDTs_1.writeDTsFiles)(config, choice),
18
- (0, printVariables_1.printVariables)(config, choice),
16
+ (0, pipeline_1.generatePipelineFiles)(context, (_a = config.pipelineType) !== null && _a !== void 0 ? _a : "gitlab"),
17
+ (0, writeDotEnvFiles_1.writeDotEnvFiles)(context, choice),
18
+ (0, writeEnvDTs_1.writeDTsFiles)(context, choice),
19
+ (0, printVariables_1.printVariables)(context, choice),
19
20
  ]);
20
21
  };
21
22
  //# sourceMappingURL=catenv.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/catenv.ts"],"names":[],"mappings":";;AAAA,oEAAiE;AACjE,qDAAkD;AAElD,yDAAsD;AACtD,+CAA8C;AAC9C,kDAA4D;AAE5D,kBAAe,KAAK,EAAE,MAAe,EAAE,EAAE;;IACvC,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAgB,GAAE,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,gCAAqB,EAAC,MAAM,EAAE,MAAA,MAAM,CAAC,YAAY,mCAAI,QAAQ,CAAC;QAC9D,IAAA,mCAAgB,EAAC,MAAM,EAAE,MAAM,CAAC;QAEhC,IAAA,2BAAa,EAAC,MAAM,EAAE,MAAM,CAAC;QAE7B,IAAA,+BAAc,EAAC,MAAM,EAAE,MAAM,CAAC;KAC/B,CAAC,CAAC;AACL,CAAC,CAAC"}
1
+ {"version":3,"file":"catenv.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/catenv.ts"],"names":[],"mappings":";;AAAA,oEAAiE;AACjE,qDAAkD;AAElD,yDAAsD;AACtD,+CAA8C;AAC9C,kDAI6B;AAE7B,kBAAe,KAAK,EAAE,MAAe,EAAE,EAAE;;IACvC,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAgB,GAAE,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,8BAAmB,EAAC,MAAM,CAAC,CAAC;IAE5C,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,IAAA,gCAAqB,EAAC,OAAO,EAAE,MAAA,MAAM,CAAC,YAAY,mCAAI,QAAQ,CAAC;QAC/D,IAAA,mCAAgB,EAAC,OAAO,EAAE,MAAM,CAAC;QAEjC,IAAA,2BAAa,EAAC,OAAO,EAAE,MAAM,CAAC;QAE9B,IAAA,+BAAc,EAAC,OAAO,EAAE,MAAM,CAAC;KAChC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { Config } from "../../../../pipeline/src/index.js";
1
+ import type { CatenvContext } from "../../../../pipeline/src/index.js";
2
2
  import type { Choice } from "./types";
3
- export declare const printVariables: (config: Config, choice?: Choice) => Promise<void>;
3
+ export declare const printVariables: (context: CatenvContext, choice?: Choice) => Promise<void>;
@@ -37,8 +37,8 @@ const getAllVariablesToPrint = async (config, choice) => {
37
37
  }, Promise.resolve({}));
38
38
  }
39
39
  };
40
- const printVariables = async (config, choice) => {
41
- const variables = await getAllVariablesToPrint(config, choice);
40
+ const printVariables = async (context, choice) => {
41
+ const variables = await getAllVariablesToPrint(context.config, choice);
42
42
  console.log(makeExportKeyValuestring(variables));
43
43
  };
44
44
  exports.printVariables = printVariables;
@@ -1 +1 @@
1
- {"version":3,"file":"printVariables.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/printVariables.ts"],"names":[],"mappings":";;;AACA,oEAAmE;AAEnE,mCAIiB;AAEjB,MAAM,sBAAsB,GAAG,KAAK,EAAE,MAAc,EAAE,MAAe,EAAE,EAAE;;IACvE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,2CAAmC,EACzE,MAAM,EACN,MAAM,CACP,CAAC;IAEF,IAAI,gBAAgB,EAAE,CAAC;QACrB,wCAAwC;QACxC,IAAI,MAAA,MAAM,CAAC,UAAU,CAA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AM,IAAA,qCAAkB,EAAC,IAAI,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;YACtE,OAAO,UAAU,CAAC,mBAAmB,CAAC,CAAC;YACvC,OAAO;gBACL,GAAG,CAAC,MAAM,GAAG,CAAC;gBACd,GAAG,UAAU;gBACb,qCAAqC;gBACrC,GAAG,MAAM,CAAC,WAAW,CACnB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;oBAC/C,GAAG,IAAA,0BAAkB,EAAC,aAAa,CAAC,WAAW,EAAE,CAAC,IAAI,GAAG,EAAE;oBAC3D,KAAK;iBACN,CAAC,CACH;aACF,CAAC;QACJ,CAAC,EACD,OAAO,CAAC,OAAO,CAAC,EAA4B,CAAC,CAC9C,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEK,MAAM,cAAc,GAAG,KAAK,EACjC,OAAsB,EACtB,MAAe,EACf,EAAE;IACF,MAAM,SAAS,GAAG,MAAM,sBAAsB,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEvE,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAPW,QAAA,cAAc,kBAOzB;AAEF,MAAM,wBAAwB,GAAG,CAAC,SAAiC,EAAE,EAAE,CACrE,IAAA,0BAAkB,EAAC,SAAS,EAAE;IAC5B,SAAS,EAAE,SAAS;IACpB,aAAa,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE;CACvC,CAAC,CAAC"}
@@ -1,3 +1,3 @@
1
- import { type Config } from "../../../../pipeline/src/index.js";
2
1
  import type { Choice } from "./types";
3
- export declare const writeDotEnvFiles: (config: Config, choice?: Choice) => Promise<void>;
2
+ import type { CatenvContext } from "../../../../pipeline/src/index.js";
3
+ export declare const writeDotEnvFiles: (context: CatenvContext, choice?: Choice) => Promise<void>;
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeDotEnvFiles = void 0;
4
- const pipeline_1 = require("../../../../pipeline/src/index.js");
5
4
  const path_1 = require("path");
6
5
  const getProjectConfig_1 = require("../../config/getProjectConfig");
7
6
  const projects_1 = require("../../utils/projects");
8
7
  const utils_1 = require("./utils");
9
- const writeDotEnvFiles = async (config, choice) => {
10
- const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice);
11
- const componentsWithEnabledDotEnvWrite = Object.entries(config.components)
8
+ const writeDotEnvFiles = async (context, choice) => {
9
+ const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(context.config, choice);
10
+ const componentsWithEnabledDotEnvWrite = Object.entries(context.config.components)
12
11
  .filter(([, component]) => { var _a; return (_a = component === null || component === void 0 ? void 0 : component.dotEnv) !== null && _a !== void 0 ? _a : true; }) // when set to true or "local"
13
12
  .map(([componentName]) => componentName);
14
13
  const componentsToActuallyWriteDotEnvNow = currentComponent
@@ -20,9 +19,9 @@ const writeDotEnvFiles = async (config, choice) => {
20
19
  for (const componentName of componentsToActuallyWriteDotEnvNow) {
21
20
  const variables = await (0, getProjectConfig_1.getEnvVarsResolved)(null, env, componentName);
22
21
  delete variables["_ALL_ENV_VAR_KEYS"];
23
- const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
22
+ const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, context.config, componentName);
24
23
  const filePath = (0, path_1.join)(componentDir, ".env");
25
- await (0, pipeline_1.writeGeneratedFile)(filePath, (0, utils_1.makeKeyValueString)(variables), {
24
+ await context.fileWriter.writeGeneratedFile(filePath, (0, utils_1.makeKeyValueString)(variables), {
26
25
  commentChar: "#",
27
26
  });
28
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"writeDotEnvFiles.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/writeDotEnvFiles.ts"],"names":[],"mapp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CAAC;QACtC,MAAM,YAAY,GAAG,IAAA,4BAAoB,EACvC,OAAO,EACP,OAAO,CAAC,MAAM,EACd,aAAa,CACd,CAAC;QACF,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAE5C,MAAM,OAAO,CAAC,UAAU,CAAC,kBAAkB,CACzC,QAAQ,EACR,IAAA,0BAAkB,EAAC,SAAS,CAAC,EAC7B;YACE,WAAW,EAAE,GAAG;SACjB,CACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAxCW,QAAA,gBAAgB,oBAwC3B"}
@@ -1,3 +1,3 @@
1
- import { type Config } from "../../../../pipeline/src/index.js";
1
+ import type { CatenvContext } from "../../../../pipeline/src/index.js";
2
2
  import type { Choice } from "./types";
3
- export declare const writeDTsFiles: (config: Config, choice?: Choice) => Promise<void>;
3
+ export declare const writeDTsFiles: (context: CatenvContext, choice?: Choice) => Promise<void>;
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeDTsFiles = void 0;
4
- const pipeline_1 = require("../../../../pipeline/src/index.js");
5
4
  const path_1 = require("path");
6
5
  const getProjectConfig_1 = require("../../config/getProjectConfig");
7
6
  const projects_1 = require("../../utils/projects");
8
7
  const utils_1 = require("./utils");
9
- const writeDTsFiles = async (config, choice) => {
10
- const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(config, choice);
11
- const componentsWithEnabledEnvDTsWrite = Object.entries(config.components)
8
+ const writeDTsFiles = async (context, choice) => {
9
+ const { env, currentComponent } = await (0, utils_1.getCurrentComponentAndEnvFromChoice)(context.config, choice);
10
+ const componentsWithEnabledEnvDTsWrite = Object.entries(context.config.components)
12
11
  .filter(([, component]) => { var _a; return (_a = component === null || component === void 0 ? void 0 : component.envDTs) !== null && _a !== void 0 ? _a : true; })
13
12
  .map(([componentName]) => componentName);
14
13
  const componentsToActuallyWriteEnvDts = currentComponent
@@ -20,9 +19,9 @@ const writeDTsFiles = async (config, choice) => {
20
19
  for (const componentName of componentsToActuallyWriteEnvDts) {
21
20
  const envNames = await getEnvsForDTs(env, componentName);
22
21
  const envDTsContent = createEnvDTsContent(envNames);
23
- const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, config, componentName);
22
+ const componentDir = (0, utils_1.getComponentFullPath)(gitRoot, context.config, componentName);
24
23
  const filePath = (0, path_1.join)(componentDir, "env.d.ts");
25
- await (0, pipeline_1.writeGeneratedFile)(filePath, envDTsContent, {
24
+ await context.fileWriter.writeGeneratedFile(filePath, envDTsContent, {
26
25
  commentChar: "//",
27
26
  });
28
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"writeEnvDTs.js","sourceRoot":"","sources":["../../../../../src/apps/catenv/writeEnvDTs.ts"],"names":[],"mappings":";;;AAAA,kDAAsE;AACtE,+BAA4B;AAC5B,oEAA+D;AAC/D,mDAAkD;AAElD,mCAGiB;AAEV,MAAM,aAAa,GAAG,KAAK,EAAE,MAAc,EAAE,MAAe,EAAE,EAAE;IACrE,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,2CAAmC,EACzE,MAAM,EACN,MAAM,CACP,CAAC;IAEF,MAAM,gCAAgC,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;SACvE,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,WAAC,OAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,mCAAI,IAAI,CAAA,EAAA,CAAC;SACpD,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC;IAE3C,MAAM,+BAA+B,GAAG,gBAAgB;QACtD,CAAC,CAAC,gCAAgC,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YAC3D,CAAC,CAAC,CAAC,gBAAgB,CAAC;YACpB,CAAC,CAAC,EAAE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
@@ -0,0 +1,7 @@
1
+ import type { Config } from "../types";
2
+ import { FileWriter } from "../utils/writeFiles";
3
+ export type CatenvContext = {
4
+ config: Config;
5
+ fileWriter: FileWriter;
6
+ };
7
+ export declare const createCatenvContext: (config: Config) => CatenvContext;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCatenvContext = void 0;
4
+ const writeFiles_1 = require("../utils/writeFiles");
5
+ const createCatenvContext = (config) => {
6
+ return {
7
+ config,
8
+ fileWriter: writeFiles_1.FileWriter.create(config),
9
+ };
10
+ };
11
+ exports.createCatenvContext = createCatenvContext;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../pipeline/src/catenv/index.ts"],"names":[],"mappings":";;;AACA,oDAAiD;AAO1C,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAiB,EAAE;IACnE,OAAO;QACL,MAAM;QACN,UAAU,EAAE,uBAAU,CAAC,MAAM,CAAC,MAAM,CAAC;KACtC,CAAC;AACJ,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B"}
@@ -9,3 +9,4 @@ export * from "./deploy";
9
9
  export * from "./utils/writeFiles";
10
10
  export * from "./variables/VariableValue";
11
11
  export * from "./bash";
12
+ export * from "./catenv";
@@ -25,4 +25,5 @@ __exportStar(require("./deploy"), exports);
25
25
  __exportStar(require("./utils/writeFiles"), exports);
26
26
  __exportStar(require("./variables/VariableValue"), exports);
27
27
  __exportStar(require("./bash"), exports);
28
+ __exportStar(require("./catenv"), exports);
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,qDAAmC;AACnC,4DAA0C;AAC1C,yCAAuB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,qDAAmC;AACnC,4DAA0C;AAC1C,yCAAuB;AACvB,2CAAyB"}
@@ -1,5 +1,6 @@
1
1
  import type { Config, PipelineType } from "../types";
2
- export declare function generatePipelineFiles<T extends PipelineType>(config: Config, pipelineType: T): Promise<void>;
2
+ import type { CatenvContext } from "../catenv";
3
+ export declare function generatePipelineFiles<T extends PipelineType>(context: CatenvContext, pipelineType: T): Promise<void>;
3
4
  /**
4
5
  *
5
6
  * for testing purposes
@@ -3,16 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getGitlabCompletePipeline = exports.generatePipelineFiles = void 0;
4
4
  const promises_1 = require("fs/promises");
5
5
  const path_1 = require("path");
6
- const writeFiles_1 = require("../utils/writeFiles");
7
6
  const createMainPipeline_1 = require("./createMainPipeline");
8
7
  const sortGitLabJobDefProps_1 = require("./gitlab/sortGitLabJobDefProps");
9
8
  const CATLADDER_GENERATED_FOLDER = ".catladder-generated";
10
9
  const GITLAB_GENERATED_FOLDER = CATLADDER_GENERATED_FOLDER + "/gitlab";
11
- async function generatePipelineFiles(config, pipelineType) {
10
+ async function generatePipelineFiles(context, pipelineType) {
12
11
  if (pipelineType !== "gitlab") {
13
12
  throw new Error("Pipeline type not supported");
14
13
  }
15
- const includes = await getGitlabPipelineIncludes(config);
14
+ const includes = await getGitlabPipelineIncludes(context.config);
16
15
  const mainFile = {
17
16
  path: ".gitlab-ci.yml",
18
17
  content: {
@@ -25,7 +24,7 @@ async function generatePipelineFiles(config, pipelineType) {
25
24
  // write files
26
25
  await Promise.all(files.map(async ({ path, content }) => {
27
26
  await (0, promises_1.mkdir)((0, path_1.dirname)(path), { recursive: true });
28
- await (0, writeFiles_1.writeYamlfile)(path, content);
27
+ await context.fileWriter.writeYamlfile(path, content);
29
28
  }));
30
29
  }
31
30
  exports.generatePipelineFiles = generatePipelineFiles;
@@ -1 +1 @@
1
- {"version":3,"file":"generatePipelineFiles.js","sourceRoot":"","sources":["../../../../../pipeline/src/pipeline/generatePipelineFiles.ts"],"names":[],"mappings":";;;AAAA,0CAAwC;AACxC,+BAA+B;AAE/B,oDAAoD;AACpD,6DAA0D;AAC1D,0EAAuE;AAEvE,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAE1D,MAAM,uBAAuB,GAAG,0BAA0B,GAAG,SAAS,CAAC;AAMhE,KAAK,UAAU,qBAAqB,CACzC,MAAc,EACd,YAAe;IAEf,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAEzD,MAAM,QAAQ,GAAa;QACzB,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SACrC;KACF,CAAC;IAEF,MAAM,KAAK,GAAG,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC;IAEtC,4BAA4B;IAC5B,MAAM,IAAA,aAAE,EAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpE,cAAc;IACd,MAAM,OAAO,CAAC,GAAG,CACf,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,MAAM,IAAA,gBAAK,EAAC,IAA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AAK,GAAG,OAAO;YACrD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,GAAa;QAC5B,IAAI,EAAE,uBAAuB,GAAG,YAAY;QAC5C,OAAO,EAAE;YACP,KAAK;YACL,MAAM;YACN,SAAS;YACT,QAAQ;YACR,GAAG,YAAY;SAChB;KACF,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,WAAW,EAAE,GAAG,iBAAiB,CAAC,CAAC;IACrD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,yBAAyB,CAAC,MAAc;IAC5D,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC,MAAM,CAAC,CAAC;IAEzD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1C,OAAO;YACL,GAAG,GAAG;YACN,GAAG,OAAO,EAAE,qCAAqC;SAClD,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AATD,8DASC"}
1
+ {"version":3,"file":"generatePipelineFiles.js","sourceRoot":"","sources":["../../../../../pipeline/src/pipeline/generatePipelineFiles.ts"],"names":[],"mappings":";;;AAAA,0CAAwC;AACxC,+BAA+B;AAG/B,6DAA0D;AAC1D,0EAAuE;AAGvE,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAE1D,MAAM,uBAAuB,GAAG,0BAA0B,GAAG,SAAS,CAAC;AAMhE,KAAK,UAAU,qBAAqB,CACzC,OAAsB,EACtB,YAAe;IAEf,IAAI,YAAY,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjE,MAAM,QAAQ,GAAa;QACzB,IAAI,EAAE,gBAAgB;QACtB,OA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