@friggframework/devtools 2.0.0--canary.606.7d3473f.0 → 2.0.0--canary.608.ba60ba6.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/frigg-cli/package.json +2 -2
- package/infrastructure/domains/integration/integration-builder.js +115 -0
- package/infrastructure/domains/integration/integration-builder.test.js +217 -100
- package/infrastructure/domains/security/iam-generator.js +14 -5
- package/infrastructure/domains/security/iam-generator.test.js +38 -19
- package/infrastructure/domains/security/templates/frigg-deployment-iam-stack.yaml +399 -384
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +105 -55
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +79 -27
- package/package.json +7 -7
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const {
|
|
2
|
+
generateIAMCloudFormation,
|
|
3
|
+
getFeatureSummary,
|
|
4
|
+
} = require('./iam-generator');
|
|
2
5
|
|
|
3
6
|
describe('IAM Generator', () => {
|
|
4
7
|
describe('getFeatureSummary', () => {
|
|
@@ -9,7 +12,7 @@ describe('IAM Generator', () => {
|
|
|
9
12
|
vpc: { enable: true },
|
|
10
13
|
encryption: { fieldLevelEncryptionMethod: 'kms' },
|
|
11
14
|
ssm: { enable: true },
|
|
12
|
-
websockets: { enable: true }
|
|
15
|
+
websockets: { enable: true },
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
const summary = getFeatureSummary(appDefinition);
|
|
@@ -25,7 +28,7 @@ describe('IAM Generator', () => {
|
|
|
25
28
|
|
|
26
29
|
it('should detect minimal features when disabled', () => {
|
|
27
30
|
const appDefinition = {
|
|
28
|
-
integrations: []
|
|
31
|
+
integrations: [],
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
const summary = getFeatureSummary(appDefinition);
|
|
@@ -48,13 +51,13 @@ describe('IAM Generator', () => {
|
|
|
48
51
|
vpc: { enable: false },
|
|
49
52
|
encryption: { fieldLevelEncryptionMethod: 'aes' },
|
|
50
53
|
ssm: { enable: false },
|
|
51
|
-
websockets: { enable: false }
|
|
54
|
+
websockets: { enable: false },
|
|
52
55
|
};
|
|
53
56
|
|
|
54
57
|
const summary = getFeatureSummary(appDefinition);
|
|
55
58
|
const yaml = generateIAMCloudFormation({
|
|
56
59
|
appName: summary.appName,
|
|
57
|
-
features: summary.features
|
|
60
|
+
features: summary.features,
|
|
58
61
|
});
|
|
59
62
|
|
|
60
63
|
expect(yaml).toContain('AWSTemplateFormatVersion');
|
|
@@ -67,13 +70,13 @@ describe('IAM Generator', () => {
|
|
|
67
70
|
const appDefinition = {
|
|
68
71
|
name: 'test-app',
|
|
69
72
|
integrations: [],
|
|
70
|
-
vpc: { enable: true }
|
|
73
|
+
vpc: { enable: true },
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
const summary = getFeatureSummary(appDefinition);
|
|
74
77
|
const yaml = generateIAMCloudFormation({
|
|
75
78
|
appName: summary.appName,
|
|
76
|
-
features: summary.features
|
|
79
|
+
features: summary.features,
|
|
77
80
|
});
|
|
78
81
|
|
|
79
82
|
expect(yaml).toContain('FriggVPCPolicy');
|
|
@@ -86,13 +89,13 @@ describe('IAM Generator', () => {
|
|
|
86
89
|
const appDefinition = {
|
|
87
90
|
name: 'test-app',
|
|
88
91
|
integrations: [],
|
|
89
|
-
encryption: { fieldLevelEncryptionMethod: 'kms' }
|
|
92
|
+
encryption: { fieldLevelEncryptionMethod: 'kms' },
|
|
90
93
|
};
|
|
91
94
|
|
|
92
95
|
const summary = getFeatureSummary(appDefinition);
|
|
93
96
|
const yaml = generateIAMCloudFormation({
|
|
94
97
|
appName: summary.appName,
|
|
95
|
-
features: summary.features
|
|
98
|
+
features: summary.features,
|
|
96
99
|
});
|
|
97
100
|
|
|
98
101
|
expect(yaml).toContain('FriggKMSPolicy');
|
|
@@ -106,13 +109,13 @@ describe('IAM Generator', () => {
|
|
|
106
109
|
const appDefinition = {
|
|
107
110
|
name: 'test-app',
|
|
108
111
|
integrations: [],
|
|
109
|
-
ssm: { enable: true }
|
|
112
|
+
ssm: { enable: true },
|
|
110
113
|
};
|
|
111
114
|
|
|
112
115
|
const summary = getFeatureSummary(appDefinition);
|
|
113
116
|
const yaml = generateIAMCloudFormation({
|
|
114
117
|
appName: summary.appName,
|
|
115
|
-
features: summary.features
|
|
118
|
+
features: summary.features,
|
|
116
119
|
});
|
|
117
120
|
|
|
118
121
|
expect(yaml).toContain('FriggSSMPolicy');
|
|
@@ -126,13 +129,13 @@ describe('IAM Generator', () => {
|
|
|
126
129
|
integrations: [],
|
|
127
130
|
vpc: { enable: true },
|
|
128
131
|
encryption: { fieldLevelEncryptionMethod: 'aes' },
|
|
129
|
-
ssm: { enable: true }
|
|
132
|
+
ssm: { enable: true },
|
|
130
133
|
};
|
|
131
134
|
|
|
132
135
|
const summary = getFeatureSummary(appDefinition);
|
|
133
136
|
const yaml = generateIAMCloudFormation({
|
|
134
137
|
appName: summary.appName,
|
|
135
|
-
features: summary.features
|
|
138
|
+
features: summary.features,
|
|
136
139
|
});
|
|
137
140
|
|
|
138
141
|
// Check parameter defaults match the enabled features
|
|
@@ -144,13 +147,13 @@ describe('IAM Generator', () => {
|
|
|
144
147
|
it('should include all core permissions', () => {
|
|
145
148
|
const appDefinition = {
|
|
146
149
|
name: 'test-app',
|
|
147
|
-
integrations: []
|
|
150
|
+
integrations: [],
|
|
148
151
|
};
|
|
149
152
|
|
|
150
153
|
const summary = getFeatureSummary(appDefinition);
|
|
151
154
|
const yaml = generateIAMCloudFormation({
|
|
152
155
|
appName: summary.appName,
|
|
153
|
-
features: summary.features
|
|
156
|
+
features: summary.features,
|
|
154
157
|
});
|
|
155
158
|
|
|
156
159
|
// Check for core permissions
|
|
@@ -170,28 +173,44 @@ describe('IAM Generator', () => {
|
|
|
170
173
|
it('should include internal-error-queue pattern in SQS resources', () => {
|
|
171
174
|
const appDefinition = {
|
|
172
175
|
name: 'test-app',
|
|
173
|
-
integrations: []
|
|
176
|
+
integrations: [],
|
|
174
177
|
};
|
|
175
178
|
|
|
176
179
|
const summary = getFeatureSummary(appDefinition);
|
|
177
180
|
const yaml = generateIAMCloudFormation({
|
|
178
181
|
appName: summary.appName,
|
|
179
|
-
features: summary.features
|
|
182
|
+
features: summary.features,
|
|
180
183
|
});
|
|
181
184
|
|
|
182
185
|
expect(yaml).toContain('internal-error-queue-*');
|
|
183
186
|
});
|
|
184
187
|
|
|
188
|
+
it('should include a case-sensitive *Frigg* SQS resource for the FIFO queue', () => {
|
|
189
|
+
const appDefinition = {
|
|
190
|
+
name: 'test-app',
|
|
191
|
+
integrations: [],
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
const summary = getFeatureSummary(appDefinition);
|
|
195
|
+
const yaml = generateIAMCloudFormation({
|
|
196
|
+
appName: summary.appName,
|
|
197
|
+
features: summary.features,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// The lowercase "*frigg*" glob would not match "...-FriggUserActionQueue.fifo".
|
|
201
|
+
expect(yaml).toContain(':*Frigg*');
|
|
202
|
+
});
|
|
203
|
+
|
|
185
204
|
it('should generate outputs section', () => {
|
|
186
205
|
const appDefinition = {
|
|
187
206
|
name: 'test-app',
|
|
188
|
-
integrations: []
|
|
207
|
+
integrations: [],
|
|
189
208
|
};
|
|
190
209
|
|
|
191
210
|
const summary = getFeatureSummary(appDefinition);
|
|
192
211
|
const yaml = generateIAMCloudFormation({
|
|
193
212
|
appName: summary.appName,
|
|
194
|
-
features: summary.features
|
|
213
|
+
features: summary.features,
|
|
195
214
|
});
|
|
196
215
|
|
|
197
216
|
expect(yaml).toContain('Outputs:');
|