@ttoss/cloudformation 0.11.0 → 0.11.2

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/esm/index.js CHANGED
@@ -1,4 +1,9 @@
1
1
  /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
2
7
 
3
8
  // src/findAndReadCloudFormationTemplate.ts
4
9
  import * as fs2 from "fs";
@@ -14,143 +19,143 @@ var cloudFormationTypes = [{
14
19
  tag: "!Equals",
15
20
  options: {
16
21
  kind: "sequence",
17
- construct: data => {
22
+ construct: /* @__PURE__ */__name(data => {
18
23
  return {
19
24
  "Fn::Equals": data
20
25
  };
21
- }
26
+ }, "construct")
22
27
  }
23
28
  }, {
24
29
  tag: "!FindInMap",
25
30
  options: {
26
31
  kind: "sequence",
27
- construct: data => {
32
+ construct: /* @__PURE__ */__name(data => {
28
33
  return {
29
34
  "Fn::FindInMap": data
30
35
  };
31
- }
36
+ }, "construct")
32
37
  }
33
38
  }, {
34
39
  tag: "!GetAtt",
35
40
  options: {
36
41
  kind: "scalar",
37
- construct: data => {
42
+ construct: /* @__PURE__ */__name(data => {
38
43
  return {
39
44
  "Fn::GetAtt": data.split(".")
40
45
  };
41
- }
46
+ }, "construct")
42
47
  }
43
48
  }, {
44
49
  tag: "!GetAtt",
45
50
  options: {
46
51
  kind: "sequence",
47
- construct: data => {
52
+ construct: /* @__PURE__ */__name(data => {
48
53
  return {
49
54
  "Fn::GetAtt": data
50
55
  };
51
- }
56
+ }, "construct")
52
57
  }
53
58
  }, {
54
59
  tag: "!If",
55
60
  options: {
56
61
  kind: "sequence",
57
- construct: data => {
62
+ construct: /* @__PURE__ */__name(data => {
58
63
  return {
59
64
  "Fn::If": data
60
65
  };
61
- }
66
+ }, "construct")
62
67
  }
63
68
  }, {
64
69
  tag: "!ImportValue",
65
70
  options: {
66
71
  kind: "scalar",
67
- construct: data => {
72
+ construct: /* @__PURE__ */__name(data => {
68
73
  return {
69
74
  "Fn::ImportValue": data
70
75
  };
71
- }
76
+ }, "construct")
72
77
  }
73
78
  }, {
74
79
  tag: "!Join",
75
80
  options: {
76
81
  kind: "sequence",
77
- construct: data => {
82
+ construct: /* @__PURE__ */__name(data => {
78
83
  return {
79
84
  "Fn::Join": data
80
85
  };
81
- }
86
+ }, "construct")
82
87
  }
83
88
  }, {
84
89
  tag: "!Not",
85
90
  options: {
86
91
  kind: "sequence",
87
- construct: data => {
92
+ construct: /* @__PURE__ */__name(data => {
88
93
  return {
89
94
  "Fn::Not": data
90
95
  };
91
- }
96
+ }, "construct")
92
97
  }
93
98
  }, {
94
99
  tag: "!Ref",
95
100
  options: {
96
101
  kind: "scalar",
97
- construct: data => {
102
+ construct: /* @__PURE__ */__name(data => {
98
103
  return {
99
104
  Ref: data
100
105
  };
101
- }
106
+ }, "construct")
102
107
  }
103
108
  }, {
104
109
  tag: "!Sub",
105
110
  options: {
106
111
  kind: "scalar",
107
- construct: data => {
112
+ construct: /* @__PURE__ */__name(data => {
108
113
  return {
109
114
  "Fn::Sub": data
110
115
  };
111
- }
116
+ }, "construct")
112
117
  }
113
118
  }, {
114
119
  tag: "!Sub",
115
120
  options: {
116
121
  kind: "sequence",
117
- construct: data => {
122
+ construct: /* @__PURE__ */__name(data => {
118
123
  return {
119
124
  "Fn::Sub": data
120
125
  };
121
- }
126
+ }, "construct")
122
127
  }
123
128
  }];
124
- var getYamlTypes = tagAndTypeArr => {
129
+ var getYamlTypes = /* @__PURE__ */__name(tagAndTypeArr => {
125
130
  return tagAndTypeArr.map(({
126
131
  tag,
127
132
  options
128
133
  }) => {
129
134
  return new yaml.Type(tag, options);
130
135
  });
131
- };
132
- var getSchema = (tagAndTypeArr = []) => {
136
+ }, "getYamlTypes");
137
+ var getSchema = /* @__PURE__ */__name((tagAndTypeArr = []) => {
133
138
  return yaml.DEFAULT_SCHEMA.extend(getYamlTypes([...tagAndTypeArr, ...cloudFormationTypes]));
134
- };
135
- var loadCloudFormationTemplate = (template, tagAndTypeArr = []) => {
139
+ }, "getSchema");
140
+ var loadCloudFormationTemplate = /* @__PURE__ */__name((template, tagAndTypeArr = []) => {
136
141
  return yaml.load(template, {
137
142
  schema: getSchema(tagAndTypeArr)
138
143
  });
139
- };
144
+ }, "loadCloudFormationTemplate");
140
145
 
141
146
  // src/readCloudFormationYamlTemplate.ts
142
- var getTypes = () => {
147
+ var getTypes = /* @__PURE__ */__name(() => {
143
148
  return [{
144
149
  tag: `!SubString`,
145
150
  options: {
146
151
  kind: "scalar",
147
- construct: filePath => {
152
+ construct: /* @__PURE__ */__name(filePath => {
148
153
  return fs.readFileSync(path.resolve(process.cwd(), filePath)).toString();
149
- }
154
+ }, "construct")
150
155
  }
151
156
  }];
152
- };
153
- var readCloudFormationYamlTemplate = ({
157
+ }, "getTypes");
158
+ var readCloudFormationYamlTemplate = /* @__PURE__ */__name(({
154
159
  templatePath
155
160
  }) => {
156
161
  const template = fs.readFileSync(templatePath).toString();
@@ -159,14 +164,14 @@ var readCloudFormationYamlTemplate = ({
159
164
  throw new Error("Cannot parse CloudFormation template.");
160
165
  }
161
166
  return parsed;
162
- };
167
+ }, "readCloudFormationYamlTemplate");
163
168
 
164
169
  // src/findAndReadCloudFormationTemplate.ts
165
170
  import { readConfigFile } from "@ttoss/read-config-file";
166
171
  var defaultTemplatePaths = ["ts", "js", "yaml", "yml", "json"].map(extension => {
167
172
  return `./src/cloudformation.${extension}`;
168
173
  });
169
- var findAndReadCloudFormationTemplate = async ({
174
+ var findAndReadCloudFormationTemplate = /* @__PURE__ */__name(async ({
170
175
  templatePath: defaultTemplatePath,
171
176
  options = {}
172
177
  }) => {
@@ -190,5 +195,5 @@ var findAndReadCloudFormationTemplate = async ({
190
195
  configFilePath,
191
196
  options
192
197
  });
193
- };
198
+ }, "findAndReadCloudFormationTemplate");
194
199
  export { findAndReadCloudFormationTemplate };
package/dist/index.js CHANGED
@@ -7,6 +7,10 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
8
  var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __name = (target, value) => __defProp(target, "name", {
11
+ value,
12
+ configurable: true
13
+ });
10
14
  var __export = (target, all) => {
11
15
  for (var name in all) __defProp(target, name, {
12
16
  get: all[name],
@@ -56,143 +60,143 @@ var cloudFormationTypes = [{
56
60
  tag: "!Equals",
57
61
  options: {
58
62
  kind: "sequence",
59
- construct: data => {
63
+ construct: /* @__PURE__ */__name(data => {
60
64
  return {
61
65
  "Fn::Equals": data
62
66
  };
63
- }
67
+ }, "construct")
64
68
  }
65
69
  }, {
66
70
  tag: "!FindInMap",
67
71
  options: {
68
72
  kind: "sequence",
69
- construct: data => {
73
+ construct: /* @__PURE__ */__name(data => {
70
74
  return {
71
75
  "Fn::FindInMap": data
72
76
  };
73
- }
77
+ }, "construct")
74
78
  }
75
79
  }, {
76
80
  tag: "!GetAtt",
77
81
  options: {
78
82
  kind: "scalar",
79
- construct: data => {
83
+ construct: /* @__PURE__ */__name(data => {
80
84
  return {
81
85
  "Fn::GetAtt": data.split(".")
82
86
  };
83
- }
87
+ }, "construct")
84
88
  }
85
89
  }, {
86
90
  tag: "!GetAtt",
87
91
  options: {
88
92
  kind: "sequence",
89
- construct: data => {
93
+ construct: /* @__PURE__ */__name(data => {
90
94
  return {
91
95
  "Fn::GetAtt": data
92
96
  };
93
- }
97
+ }, "construct")
94
98
  }
95
99
  }, {
96
100
  tag: "!If",
97
101
  options: {
98
102
  kind: "sequence",
99
- construct: data => {
103
+ construct: /* @__PURE__ */__name(data => {
100
104
  return {
101
105
  "Fn::If": data
102
106
  };
103
- }
107
+ }, "construct")
104
108
  }
105
109
  }, {
106
110
  tag: "!ImportValue",
107
111
  options: {
108
112
  kind: "scalar",
109
- construct: data => {
113
+ construct: /* @__PURE__ */__name(data => {
110
114
  return {
111
115
  "Fn::ImportValue": data
112
116
  };
113
- }
117
+ }, "construct")
114
118
  }
115
119
  }, {
116
120
  tag: "!Join",
117
121
  options: {
118
122
  kind: "sequence",
119
- construct: data => {
123
+ construct: /* @__PURE__ */__name(data => {
120
124
  return {
121
125
  "Fn::Join": data
122
126
  };
123
- }
127
+ }, "construct")
124
128
  }
125
129
  }, {
126
130
  tag: "!Not",
127
131
  options: {
128
132
  kind: "sequence",
129
- construct: data => {
133
+ construct: /* @__PURE__ */__name(data => {
130
134
  return {
131
135
  "Fn::Not": data
132
136
  };
133
- }
137
+ }, "construct")
134
138
  }
135
139
  }, {
136
140
  tag: "!Ref",
137
141
  options: {
138
142
  kind: "scalar",
139
- construct: data => {
143
+ construct: /* @__PURE__ */__name(data => {
140
144
  return {
141
145
  Ref: data
142
146
  };
143
- }
147
+ }, "construct")
144
148
  }
145
149
  }, {
146
150
  tag: "!Sub",
147
151
  options: {
148
152
  kind: "scalar",
149
- construct: data => {
153
+ construct: /* @__PURE__ */__name(data => {
150
154
  return {
151
155
  "Fn::Sub": data
152
156
  };
153
- }
157
+ }, "construct")
154
158
  }
155
159
  }, {
156
160
  tag: "!Sub",
157
161
  options: {
158
162
  kind: "sequence",
159
- construct: data => {
163
+ construct: /* @__PURE__ */__name(data => {
160
164
  return {
161
165
  "Fn::Sub": data
162
166
  };
163
- }
167
+ }, "construct")
164
168
  }
165
169
  }];
166
- var getYamlTypes = tagAndTypeArr => {
170
+ var getYamlTypes = /* @__PURE__ */__name(tagAndTypeArr => {
167
171
  return tagAndTypeArr.map(({
168
172
  tag,
169
173
  options
170
174
  }) => {
171
175
  return new import_js_yaml.default.Type(tag, options);
172
176
  });
173
- };
174
- var getSchema = (tagAndTypeArr = []) => {
177
+ }, "getYamlTypes");
178
+ var getSchema = /* @__PURE__ */__name((tagAndTypeArr = []) => {
175
179
  return import_js_yaml.default.DEFAULT_SCHEMA.extend(getYamlTypes([...tagAndTypeArr, ...cloudFormationTypes]));
176
- };
177
- var loadCloudFormationTemplate = (template, tagAndTypeArr = []) => {
180
+ }, "getSchema");
181
+ var loadCloudFormationTemplate = /* @__PURE__ */__name((template, tagAndTypeArr = []) => {
178
182
  return import_js_yaml.default.load(template, {
179
183
  schema: getSchema(tagAndTypeArr)
180
184
  });
181
- };
185
+ }, "loadCloudFormationTemplate");
182
186
 
183
187
  // src/readCloudFormationYamlTemplate.ts
184
- var getTypes = () => {
188
+ var getTypes = /* @__PURE__ */__name(() => {
185
189
  return [{
186
190
  tag: `!SubString`,
187
191
  options: {
188
192
  kind: "scalar",
189
- construct: filePath => {
193
+ construct: /* @__PURE__ */__name(filePath => {
190
194
  return fs.readFileSync(path.resolve(process.cwd(), filePath)).toString();
191
- }
195
+ }, "construct")
192
196
  }
193
197
  }];
194
- };
195
- var readCloudFormationYamlTemplate = ({
198
+ }, "getTypes");
199
+ var readCloudFormationYamlTemplate = /* @__PURE__ */__name(({
196
200
  templatePath
197
201
  }) => {
198
202
  const template = fs.readFileSync(templatePath).toString();
@@ -201,14 +205,14 @@ var readCloudFormationYamlTemplate = ({
201
205
  throw new Error("Cannot parse CloudFormation template.");
202
206
  }
203
207
  return parsed;
204
- };
208
+ }, "readCloudFormationYamlTemplate");
205
209
 
206
210
  // src/findAndReadCloudFormationTemplate.ts
207
211
  var import_read_config_file = require("@ttoss/read-config-file");
208
212
  var defaultTemplatePaths = ["ts", "js", "yaml", "yml", "json"].map(extension => {
209
213
  return `./src/cloudformation.${extension}`;
210
214
  });
211
- var findAndReadCloudFormationTemplate = async ({
215
+ var findAndReadCloudFormationTemplate = /* @__PURE__ */__name(async ({
212
216
  templatePath: defaultTemplatePath,
213
217
  options = {}
214
218
  }) => {
@@ -232,7 +236,7 @@ var findAndReadCloudFormationTemplate = async ({
232
236
  configFilePath,
233
237
  options
234
238
  });
235
- };
239
+ }, "findAndReadCloudFormationTemplate");
236
240
  // Annotate the CommonJS export names for ESM import in node:
237
241
  0 && (module.exports = {
238
242
  findAndReadCloudFormationTemplate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/cloudformation",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "CloudFormation utils.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "dependencies": {
26
26
  "js-yaml": "^4.1.0",
27
- "@ttoss/read-config-file": "^2.0.12"
27
+ "@ttoss/read-config-file": "^2.0.14"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/jest": "^30.0.0",
@@ -32,8 +32,8 @@
32
32
  "@types/node": "^22.15.32",
33
33
  "jest": "^30.0.4",
34
34
  "tsup": "^8.5.0",
35
- "@ttoss/config": "^1.35.6",
36
- "@ttoss/test-utils": "^2.1.26"
35
+ "@ttoss/config": "^1.35.8",
36
+ "@ttoss/test-utils": "^2.1.28"
37
37
  },
38
38
  "keywords": [],
39
39
  "publishConfig": {