@ttoss/cloudformation 0.12.12 → 0.13.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/README.md CHANGED
@@ -62,6 +62,42 @@ const template = createApiTemplate({
62
62
  });
63
63
  ```
64
64
 
65
+ When a producing stack exports a value and a consuming stack imports it with
66
+ `Fn::ImportValue`, CloudFormation protects that dependency by blocking deletion
67
+ of the producer export until imports are removed.
68
+
69
+ Producer stack output example:
70
+
71
+ ```typescript
72
+ const outputs = {
73
+ LambdaPostgresReadQueryFunctionArn: {
74
+ Value: { 'Fn::GetAtt': ['LambdaPostgresReadQueryFunction', 'Arn'] },
75
+ Export: {
76
+ Name: {
77
+ 'Fn::Sub': '${AWS::StackName}-LambdaPostgresReadQueryFunctionArn',
78
+ },
79
+ },
80
+ },
81
+ };
82
+ ```
83
+
84
+ Consumer stack usage with parameterized export name:
85
+
86
+ ```typescript
87
+ import { importValueFromParameter } from '@ttoss/cloudformation';
88
+
89
+ const resources = {
90
+ InvokePermission: {
91
+ Type: 'AWS::Lambda::Permission',
92
+ Properties: {
93
+ FunctionName: importValueFromParameter('ReadQueryFunctionArnExportName'),
94
+ Action: 'lambda:InvokeFunction',
95
+ Principal: 'apigateway.amazonaws.com',
96
+ },
97
+ },
98
+ };
99
+ ```
100
+
65
101
  ## Reading Templates
66
102
 
67
103
  ### `findAndReadCloudFormationTemplate`
package/dist/esm/index.js CHANGED
@@ -5,9 +5,19 @@ var __name = (target, value) => __defProp(target, "name", {
5
5
  configurable: true
6
6
  });
7
7
 
8
+ // src/CloudFormationTemplate.ts
9
+ var importValueFromParameter = /* @__PURE__ */__name(parameterName => {
10
+ return {
11
+ "Fn::ImportValue": {
12
+ "Fn::Sub": `\${${parameterName}}`
13
+ }
14
+ };
15
+ }, "importValueFromParameter");
16
+
8
17
  // src/findAndReadCloudFormationTemplate.ts
9
18
  import * as fs2 from "fs";
10
19
  import * as path2 from "path";
20
+ import { readConfigFile } from "@ttoss/read-config-file";
11
21
 
12
22
  // src/readCloudFormationYamlTemplate.ts
13
23
  import * as fs from "fs";
@@ -167,7 +177,6 @@ var readCloudFormationYamlTemplate = /* @__PURE__ */__name(({
167
177
  }, "readCloudFormationYamlTemplate");
168
178
 
169
179
  // src/findAndReadCloudFormationTemplate.ts
170
- import { readConfigFile } from "@ttoss/read-config-file";
171
180
  var defaultTemplatePaths = ["ts", "js", "yaml", "yml", "json"].map(extension => {
172
181
  return `./src/cloudformation.${extension}`;
173
182
  });
@@ -196,13 +205,4 @@ var findAndReadCloudFormationTemplate = /* @__PURE__ */__name(async ({
196
205
  options
197
206
  });
198
207
  }, "findAndReadCloudFormationTemplate");
199
-
200
- // src/CloudFormationTemplate.ts
201
- var importValueFromParameter = /* @__PURE__ */__name(parameterName => {
202
- return {
203
- "Fn::ImportValue": {
204
- "Fn::Sub": `\${${parameterName}}`
205
- }
206
- };
207
- }, "importValueFromParameter");
208
208
  export { findAndReadCloudFormationTemplate, importValueFromParameter };
package/dist/index.js CHANGED
@@ -47,9 +47,19 @@ __export(index_exports, {
47
47
  });
48
48
  module.exports = __toCommonJS(index_exports);
49
49
 
50
+ // src/CloudFormationTemplate.ts
51
+ var importValueFromParameter = /* @__PURE__ */__name(parameterName => {
52
+ return {
53
+ "Fn::ImportValue": {
54
+ "Fn::Sub": `\${${parameterName}}`
55
+ }
56
+ };
57
+ }, "importValueFromParameter");
58
+
50
59
  // src/findAndReadCloudFormationTemplate.ts
51
60
  var fs2 = __toESM(require("fs"), 1);
52
61
  var path2 = __toESM(require("path"), 1);
62
+ var import_read_config_file = require("@ttoss/read-config-file");
53
63
 
54
64
  // src/readCloudFormationYamlTemplate.ts
55
65
  var fs = __toESM(require("fs"), 1);
@@ -209,7 +219,6 @@ var readCloudFormationYamlTemplate = /* @__PURE__ */__name(({
209
219
  }, "readCloudFormationYamlTemplate");
210
220
 
211
221
  // src/findAndReadCloudFormationTemplate.ts
212
- var import_read_config_file = require("@ttoss/read-config-file");
213
222
  var defaultTemplatePaths = ["ts", "js", "yaml", "yml", "json"].map(extension => {
214
223
  return `./src/cloudformation.${extension}`;
215
224
  });
@@ -238,15 +247,6 @@ var findAndReadCloudFormationTemplate = /* @__PURE__ */__name(async ({
238
247
  options
239
248
  });
240
249
  }, "findAndReadCloudFormationTemplate");
241
-
242
- // src/CloudFormationTemplate.ts
243
- var importValueFromParameter = /* @__PURE__ */__name(parameterName => {
244
- return {
245
- "Fn::ImportValue": {
246
- "Fn::Sub": `\${${parameterName}}`
247
- }
248
- };
249
- }, "importValueFromParameter");
250
250
  // Annotate the CommonJS export names for ESM import in node:
251
251
  0 && (module.exports = {
252
252
  findAndReadCloudFormationTemplate,
package/package.json CHANGED
@@ -1,17 +1,18 @@
1
1
  {
2
2
  "name": "@ttoss/cloudformation",
3
- "version": "0.12.12",
3
+ "version": "0.13.0",
4
4
  "description": "CloudFormation utils.",
5
- "license": "MIT",
6
- "author": "ttoss",
7
- "contributors": [
8
- "Pedro Arantes <pedro@arantespp.com> (https://arantespp.com)"
9
- ],
5
+ "keywords": [],
10
6
  "repository": {
11
7
  "type": "git",
12
8
  "url": "https://github.com/ttoss/ttoss.git",
13
9
  "directory": "packages/cloudformation"
14
10
  },
11
+ "license": "MIT",
12
+ "author": "ttoss",
13
+ "contributors": [
14
+ "Pedro Arantes <pedro@arantespp.com> (https://arantespp.com)"
15
+ ],
15
16
  "type": "module",
16
17
  "exports": {
17
18
  ".": {
@@ -24,7 +25,7 @@
24
25
  ],
25
26
  "dependencies": {
26
27
  "js-yaml": "^4.1.1",
27
- "@ttoss/read-config-file": "^2.2.10"
28
+ "@ttoss/read-config-file": "^2.2.11"
28
29
  },
29
30
  "devDependencies": {
30
31
  "@types/jest": "^30.0.0",
@@ -32,10 +33,9 @@
32
33
  "@types/node": "^24.12.0",
33
34
  "jest": "^30.3.0",
34
35
  "tsup": "^8.5.1",
35
- "@ttoss/config": "^1.37.10",
36
- "@ttoss/test-utils": "^4.2.10"
36
+ "@ttoss/test-utils": "^4.2.11",
37
+ "@ttoss/config": "^1.37.11"
37
38
  },
38
- "keywords": [],
39
39
  "publishConfig": {
40
40
  "access": "public",
41
41
  "provenance": true