@friggframework/devtools 2.0.0--canary.398.ad248a6.0 → 2.0.0--canary.398.4f043c8.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.
|
@@ -500,7 +500,7 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
500
500
|
name: AppDefinition.provider || 'aws',
|
|
501
501
|
runtime: 'nodejs20.x',
|
|
502
502
|
timeout: 30,
|
|
503
|
-
region: 'us-east-1',
|
|
503
|
+
region: process.env.AWS_REGION || 'us-east-1',
|
|
504
504
|
stage: '${opt:stage}',
|
|
505
505
|
environment: {
|
|
506
506
|
STAGE: '${opt:stage}',
|
|
@@ -563,7 +563,7 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
563
563
|
autoCreate: false,
|
|
564
564
|
apiVersion: '2012-11-05',
|
|
565
565
|
endpoint: 'http://localhost:4566',
|
|
566
|
-
region: 'us-east-1',
|
|
566
|
+
region: process.env.AWS_REGION || 'us-east-1',
|
|
567
567
|
accessKeyId: 'root',
|
|
568
568
|
secretAccessKey: 'root',
|
|
569
569
|
skipCacheInvalidation: false,
|
|
@@ -906,11 +906,15 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
906
906
|
}
|
|
907
907
|
|
|
908
908
|
// Add integration-specific functions and resources
|
|
909
|
-
|
|
910
|
-
const
|
|
909
|
+
if (AppDefinition.integrations && Array.isArray(AppDefinition.integrations)) {
|
|
910
|
+
for (const integration of AppDefinition.integrations) {
|
|
911
|
+
if (!integration || !integration.Definition || !integration.Definition.name) {
|
|
912
|
+
throw new Error('Invalid integration: missing Definition or name');
|
|
913
|
+
}
|
|
914
|
+
const integrationName = integration.Definition.name;
|
|
911
915
|
|
|
912
|
-
|
|
913
|
-
|
|
916
|
+
// Add function for the integration
|
|
917
|
+
definition.functions[integrationName] = {
|
|
914
918
|
handler: `node_modules/@friggframework/core/handlers/routers/integration-defined-routers.handlers.${integrationName}.handler`,
|
|
915
919
|
events: [
|
|
916
920
|
{
|
|
@@ -923,11 +927,11 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
923
927
|
],
|
|
924
928
|
};
|
|
925
929
|
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
930
|
+
// Add SQS Queue for the integration
|
|
931
|
+
const queueReference = `${integrationName.charAt(0).toUpperCase() + integrationName.slice(1)
|
|
932
|
+
}Queue`;
|
|
933
|
+
const queueName = `\${self:service}--\${self:provider.stage}-${queueReference}`;
|
|
934
|
+
definition.resources.Resources[queueReference] = {
|
|
931
935
|
Type: 'AWS::SQS::Queue',
|
|
932
936
|
Properties: {
|
|
933
937
|
QueueName: `\${self:custom.${queueReference}}`,
|
|
@@ -942,9 +946,9 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
942
946
|
},
|
|
943
947
|
};
|
|
944
948
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
949
|
+
// Add Queue Worker for the integration
|
|
950
|
+
const queueWorkerName = `${integrationName}QueueWorker`;
|
|
951
|
+
definition.functions[queueWorkerName] = {
|
|
948
952
|
handler: `node_modules/@friggframework/core/handlers/workers/integration-defined-workers.handlers.${integrationName}.queueWorker`,
|
|
949
953
|
reservedConcurrency: 5,
|
|
950
954
|
events: [
|
|
@@ -960,15 +964,43 @@ const composeServerlessDefinition = async (AppDefinition) => {
|
|
|
960
964
|
timeout: 600,
|
|
961
965
|
};
|
|
962
966
|
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
967
|
+
// Add Queue URL for the integration to the ENVironment variables
|
|
968
|
+
definition.provider.environment = {
|
|
969
|
+
...definition.provider.environment,
|
|
970
|
+
[`${integrationName.toUpperCase()}_QUEUE_URL`]: {
|
|
971
|
+
Ref: queueReference,
|
|
972
|
+
},
|
|
973
|
+
};
|
|
970
974
|
|
|
971
|
-
|
|
975
|
+
definition.custom[queueReference] = queueName;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// Discovery has already run successfully at this point if needed
|
|
980
|
+
// The discoveredResources object contains all the necessary AWS resources
|
|
981
|
+
|
|
982
|
+
// Add websocket function if enabled
|
|
983
|
+
if (AppDefinition.websockets?.enable === true) {
|
|
984
|
+
definition.functions.defaultWebsocket = {
|
|
985
|
+
handler: 'node_modules/@friggframework/core/handlers/routers/websocket.handler',
|
|
986
|
+
events: [
|
|
987
|
+
{
|
|
988
|
+
websocket: {
|
|
989
|
+
route: '$connect',
|
|
990
|
+
},
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
websocket: {
|
|
994
|
+
route: '$default',
|
|
995
|
+
},
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
websocket: {
|
|
999
|
+
route: '$disconnect',
|
|
1000
|
+
},
|
|
1001
|
+
},
|
|
1002
|
+
],
|
|
1003
|
+
};
|
|
972
1004
|
}
|
|
973
1005
|
|
|
974
1006
|
// Discovery has already run successfully at this point if needed
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
const { composeServerlessDefinition } = require('./serverless-template');
|
|
2
2
|
|
|
3
|
-
// Mock
|
|
4
|
-
jest.mock('./
|
|
5
|
-
const originalModule = jest.requireActual('./serverless-template');
|
|
3
|
+
// Mock AWS Discovery to prevent actual AWS calls
|
|
4
|
+
jest.mock('./aws-discovery', () => {
|
|
6
5
|
return {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
AWSDiscovery: jest.fn().mockImplementation(() => {
|
|
7
|
+
return {
|
|
8
|
+
discoverResources: jest.fn().mockResolvedValue({
|
|
9
|
+
defaultVpcId: 'vpc-123456',
|
|
10
|
+
defaultSecurityGroupId: 'sg-123456',
|
|
11
|
+
privateSubnetId1: 'subnet-123456',
|
|
12
|
+
privateSubnetId2: 'subnet-789012',
|
|
13
|
+
publicSubnetId: 'subnet-public',
|
|
14
|
+
defaultRouteTableId: 'rtb-123456',
|
|
15
|
+
defaultKmsKeyId: 'arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012'
|
|
16
|
+
})
|
|
17
|
+
};
|
|
18
|
+
})
|
|
9
19
|
};
|
|
10
20
|
});
|
|
11
21
|
|
|
@@ -20,21 +30,26 @@ describe('composeServerlessDefinition', () => {
|
|
|
20
30
|
};
|
|
21
31
|
|
|
22
32
|
// Mock process.argv to avoid offline mode during tests
|
|
23
|
-
|
|
33
|
+
process.argv = ['node', 'test'];
|
|
34
|
+
|
|
35
|
+
// Clear AWS_REGION for tests
|
|
36
|
+
delete process.env.AWS_REGION;
|
|
24
37
|
});
|
|
25
38
|
|
|
26
39
|
afterEach(() => {
|
|
27
40
|
jest.restoreAllMocks();
|
|
41
|
+
// Restore env
|
|
42
|
+
delete process.env.AWS_REGION;
|
|
28
43
|
});
|
|
29
44
|
|
|
30
45
|
describe('Basic Configuration', () => {
|
|
31
|
-
it('should create basic serverless definition with minimal app definition', () => {
|
|
46
|
+
it('should create basic serverless definition with minimal app definition', async () => {
|
|
32
47
|
const appDefinition = {
|
|
33
48
|
name: 'test-app',
|
|
34
49
|
integrations: []
|
|
35
50
|
};
|
|
36
51
|
|
|
37
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
52
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
38
53
|
|
|
39
54
|
expect(result.service).toBe('test-app');
|
|
40
55
|
expect(result.provider.name).toBe('aws');
|
|
@@ -44,36 +59,64 @@ describe('composeServerlessDefinition', () => {
|
|
|
44
59
|
expect(result.frameworkVersion).toBe('>=3.17.0');
|
|
45
60
|
});
|
|
46
61
|
|
|
47
|
-
it('should use default service name when name not provided', () => {
|
|
62
|
+
it('should use default service name when name not provided', async () => {
|
|
48
63
|
const appDefinition = {
|
|
49
64
|
integrations: []
|
|
50
65
|
};
|
|
51
66
|
|
|
52
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
67
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
53
68
|
|
|
54
69
|
expect(result.service).toBe('create-frigg-app');
|
|
55
70
|
});
|
|
56
71
|
|
|
57
|
-
it('should use custom provider when specified', () => {
|
|
72
|
+
it('should use custom provider when specified', async () => {
|
|
58
73
|
const appDefinition = {
|
|
59
74
|
provider: 'custom-provider',
|
|
60
75
|
integrations: []
|
|
61
76
|
};
|
|
62
77
|
|
|
63
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
78
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
64
79
|
|
|
65
80
|
expect(result.provider.name).toBe('custom-provider');
|
|
66
81
|
});
|
|
82
|
+
|
|
83
|
+
it('should use AWS_REGION environment variable when set', async () => {
|
|
84
|
+
process.env.AWS_REGION = 'eu-west-1';
|
|
85
|
+
|
|
86
|
+
const appDefinition = {
|
|
87
|
+
name: 'test-app',
|
|
88
|
+
integrations: []
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
92
|
+
|
|
93
|
+
expect(result.provider.region).toBe('eu-west-1');
|
|
94
|
+
expect(result.custom['serverless-offline-sqs'].region).toBe('eu-west-1');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('should default to us-east-1 when AWS_REGION is not set', async () => {
|
|
98
|
+
delete process.env.AWS_REGION;
|
|
99
|
+
|
|
100
|
+
const appDefinition = {
|
|
101
|
+
name: 'test-app',
|
|
102
|
+
integrations: []
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
106
|
+
|
|
107
|
+
expect(result.provider.region).toBe('us-east-1');
|
|
108
|
+
expect(result.custom['serverless-offline-sqs'].region).toBe('us-east-1');
|
|
109
|
+
});
|
|
67
110
|
});
|
|
68
111
|
|
|
69
112
|
describe('VPC Configuration', () => {
|
|
70
|
-
it('should add VPC configuration when vpc.enable is true', () => {
|
|
113
|
+
it('should add VPC configuration when vpc.enable is true', async () => {
|
|
71
114
|
const appDefinition = {
|
|
72
115
|
vpc: { enable: true },
|
|
73
116
|
integrations: []
|
|
74
117
|
};
|
|
75
118
|
|
|
76
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
119
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
77
120
|
|
|
78
121
|
expect(result.provider.vpc).toBe('${self:custom.vpc.${self:provider.stage}}');
|
|
79
122
|
expect(result.custom.vpc).toEqual({
|
|
@@ -87,13 +130,13 @@ describe('composeServerlessDefinition', () => {
|
|
|
87
130
|
});
|
|
88
131
|
});
|
|
89
132
|
|
|
90
|
-
it('should add VPC endpoint for S3 when VPC is enabled', () => {
|
|
133
|
+
it('should add VPC endpoint for S3 when VPC is enabled', async () => {
|
|
91
134
|
const appDefinition = {
|
|
92
135
|
vpc: { enable: true },
|
|
93
136
|
integrations: []
|
|
94
137
|
};
|
|
95
138
|
|
|
96
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
139
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
97
140
|
|
|
98
141
|
expect(result.resources.Resources.VPCEndpointS3).toEqual({
|
|
99
142
|
Type: 'AWS::EC2::VPCEndpoint',
|
|
@@ -106,25 +149,25 @@ describe('composeServerlessDefinition', () => {
|
|
|
106
149
|
});
|
|
107
150
|
});
|
|
108
151
|
|
|
109
|
-
it('should not add VPC configuration when vpc.enable is false', () => {
|
|
152
|
+
it('should not add VPC configuration when vpc.enable is false', async () => {
|
|
110
153
|
const appDefinition = {
|
|
111
154
|
vpc: { enable: false },
|
|
112
155
|
integrations: []
|
|
113
156
|
};
|
|
114
157
|
|
|
115
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
158
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
116
159
|
|
|
117
160
|
expect(result.provider.vpc).toBeUndefined();
|
|
118
161
|
expect(result.custom.vpc).toBeUndefined();
|
|
119
162
|
expect(result.resources.Resources.VPCEndpointS3).toBeUndefined();
|
|
120
163
|
});
|
|
121
164
|
|
|
122
|
-
it('should not add VPC configuration when vpc is not defined', () => {
|
|
165
|
+
it('should not add VPC configuration when vpc is not defined', async () => {
|
|
123
166
|
const appDefinition = {
|
|
124
167
|
integrations: []
|
|
125
168
|
};
|
|
126
169
|
|
|
127
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
170
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
128
171
|
|
|
129
172
|
expect(result.provider.vpc).toBeUndefined();
|
|
130
173
|
expect(result.custom.vpc).toBeUndefined();
|
|
@@ -132,13 +175,13 @@ describe('composeServerlessDefinition', () => {
|
|
|
132
175
|
});
|
|
133
176
|
|
|
134
177
|
describe('KMS Configuration', () => {
|
|
135
|
-
it('should add KMS configuration when encryption is enabled', () => {
|
|
178
|
+
it('should add KMS configuration when encryption is enabled', async () => {
|
|
136
179
|
const appDefinition = {
|
|
137
180
|
encryption: { useDefaultKMSForFieldLevelEncryption: true },
|
|
138
181
|
integrations: []
|
|
139
182
|
};
|
|
140
183
|
|
|
141
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
184
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
142
185
|
|
|
143
186
|
// Check IAM permissions
|
|
144
187
|
const kmsPermission = result.provider.iamRoleStatements.find(
|
|
@@ -165,13 +208,13 @@ describe('composeServerlessDefinition', () => {
|
|
|
165
208
|
});
|
|
166
209
|
});
|
|
167
210
|
|
|
168
|
-
it('should not add KMS configuration when encryption is disabled', () => {
|
|
211
|
+
it('should not add KMS configuration when encryption is disabled', async () => {
|
|
169
212
|
const appDefinition = {
|
|
170
213
|
encryption: { useDefaultKMSForFieldLevelEncryption: false },
|
|
171
214
|
integrations: []
|
|
172
215
|
};
|
|
173
216
|
|
|
174
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
217
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
175
218
|
|
|
176
219
|
const kmsPermission = result.provider.iamRoleStatements.find(
|
|
177
220
|
statement => statement.Action && statement.Action.includes('kms:GenerateDataKey')
|
|
@@ -182,12 +225,12 @@ describe('composeServerlessDefinition', () => {
|
|
|
182
225
|
expect(result.custom.kmsGrants).toBeUndefined();
|
|
183
226
|
});
|
|
184
227
|
|
|
185
|
-
it('should not add KMS configuration when encryption is not defined', () => {
|
|
228
|
+
it('should not add KMS configuration when encryption is not defined', async () => {
|
|
186
229
|
const appDefinition = {
|
|
187
230
|
integrations: []
|
|
188
231
|
};
|
|
189
232
|
|
|
190
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
233
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
191
234
|
|
|
192
235
|
const kmsPermission = result.provider.iamRoleStatements.find(
|
|
193
236
|
statement => statement.Action && statement.Action.includes('kms:GenerateDataKey')
|
|
@@ -198,13 +241,13 @@ describe('composeServerlessDefinition', () => {
|
|
|
198
241
|
});
|
|
199
242
|
|
|
200
243
|
describe('SSM Configuration', () => {
|
|
201
|
-
it('should add SSM configuration when ssm.enable is true', () => {
|
|
244
|
+
it('should add SSM configuration when ssm.enable is true', async () => {
|
|
202
245
|
const appDefinition = {
|
|
203
246
|
ssm: { enable: true },
|
|
204
247
|
integrations: []
|
|
205
248
|
};
|
|
206
249
|
|
|
207
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
250
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
208
251
|
|
|
209
252
|
// Check lambda layers
|
|
210
253
|
expect(result.provider.layers).toEqual([
|
|
@@ -231,16 +274,16 @@ describe('composeServerlessDefinition', () => {
|
|
|
231
274
|
expect(result.provider.environment.SSM_PARAMETER_PREFIX).toBe('/${self:service}/${self:provider.stage}');
|
|
232
275
|
});
|
|
233
276
|
|
|
234
|
-
it('should not add SSM configuration when ssm.enable is false', () => {
|
|
277
|
+
it('should not add SSM configuration when ssm.enable is false', async () => {
|
|
235
278
|
const appDefinition = {
|
|
236
279
|
ssm: { enable: false },
|
|
237
280
|
integrations: []
|
|
238
281
|
};
|
|
239
282
|
|
|
240
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
283
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
241
284
|
|
|
242
285
|
expect(result.provider.layers).toBeUndefined();
|
|
243
|
-
|
|
286
|
+
|
|
244
287
|
const ssmPermission = result.provider.iamRoleStatements.find(
|
|
245
288
|
statement => statement.Action && statement.Action.includes('ssm:GetParameter')
|
|
246
289
|
);
|
|
@@ -248,12 +291,12 @@ describe('composeServerlessDefinition', () => {
|
|
|
248
291
|
expect(result.provider.environment.SSM_PARAMETER_PREFIX).toBeUndefined();
|
|
249
292
|
});
|
|
250
293
|
|
|
251
|
-
it('should not add SSM configuration when ssm is not defined', () => {
|
|
294
|
+
it('should not add SSM configuration when ssm is not defined', async () => {
|
|
252
295
|
const appDefinition = {
|
|
253
296
|
integrations: []
|
|
254
297
|
};
|
|
255
298
|
|
|
256
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
299
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
257
300
|
|
|
258
301
|
expect(result.provider.layers).toBeUndefined();
|
|
259
302
|
expect(result.provider.environment.SSM_PARAMETER_PREFIX).toBeUndefined();
|
|
@@ -261,12 +304,12 @@ describe('composeServerlessDefinition', () => {
|
|
|
261
304
|
});
|
|
262
305
|
|
|
263
306
|
describe('Integration Configuration', () => {
|
|
264
|
-
it('should add integration-specific resources and functions', () => {
|
|
307
|
+
it('should add integration-specific resources and functions', async () => {
|
|
265
308
|
const appDefinition = {
|
|
266
309
|
integrations: [mockIntegration]
|
|
267
310
|
};
|
|
268
311
|
|
|
269
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
312
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
270
313
|
|
|
271
314
|
// Check integration function
|
|
272
315
|
expect(result.functions.testIntegration).toEqual({
|
|
@@ -320,7 +363,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
320
363
|
expect(result.custom.TestIntegrationQueue).toBe('${self:service}--${self:provider.stage}-TestIntegrationQueue');
|
|
321
364
|
});
|
|
322
365
|
|
|
323
|
-
it('should handle multiple integrations', () => {
|
|
366
|
+
it('should handle multiple integrations', async () => {
|
|
324
367
|
const secondIntegration = {
|
|
325
368
|
Definition: {
|
|
326
369
|
name: 'secondIntegration'
|
|
@@ -331,7 +374,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
331
374
|
integrations: [mockIntegration, secondIntegration]
|
|
332
375
|
};
|
|
333
376
|
|
|
334
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
377
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
335
378
|
|
|
336
379
|
expect(result.functions.testIntegration).toBeDefined();
|
|
337
380
|
expect(result.functions.secondIntegration).toBeDefined();
|
|
@@ -343,7 +386,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
343
386
|
});
|
|
344
387
|
|
|
345
388
|
describe('Combined Configurations', () => {
|
|
346
|
-
it('should combine VPC, KMS, and SSM configurations', () => {
|
|
389
|
+
it('should combine VPC, KMS, and SSM configurations', async () => {
|
|
347
390
|
const appDefinition = {
|
|
348
391
|
vpc: { enable: true },
|
|
349
392
|
encryption: { useDefaultKMSForFieldLevelEncryption: true },
|
|
@@ -351,7 +394,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
351
394
|
integrations: [mockIntegration]
|
|
352
395
|
};
|
|
353
396
|
|
|
354
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
397
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
355
398
|
|
|
356
399
|
// VPC
|
|
357
400
|
expect(result.provider.vpc).toBeDefined();
|
|
@@ -382,14 +425,14 @@ describe('composeServerlessDefinition', () => {
|
|
|
382
425
|
]);
|
|
383
426
|
});
|
|
384
427
|
|
|
385
|
-
it('should handle partial configuration combinations', () => {
|
|
428
|
+
it('should handle partial configuration combinations', async () => {
|
|
386
429
|
const appDefinition = {
|
|
387
430
|
vpc: { enable: true },
|
|
388
431
|
encryption: { useDefaultKMSForFieldLevelEncryption: true },
|
|
389
432
|
integrations: []
|
|
390
433
|
};
|
|
391
434
|
|
|
392
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
435
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
393
436
|
|
|
394
437
|
// VPC and KMS should be present
|
|
395
438
|
expect(result.provider.vpc).toBeDefined();
|
|
@@ -402,12 +445,12 @@ describe('composeServerlessDefinition', () => {
|
|
|
402
445
|
});
|
|
403
446
|
|
|
404
447
|
describe('Default Resources', () => {
|
|
405
|
-
it('should always include default resources', () => {
|
|
448
|
+
it('should always include default resources', async () => {
|
|
406
449
|
const appDefinition = {
|
|
407
450
|
integrations: []
|
|
408
451
|
};
|
|
409
452
|
|
|
410
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
453
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
411
454
|
|
|
412
455
|
// Check default resources are always present
|
|
413
456
|
expect(result.resources.Resources.InternalErrorQueue).toBeDefined();
|
|
@@ -426,12 +469,12 @@ describe('composeServerlessDefinition', () => {
|
|
|
426
469
|
expect(result.plugins).toContain('@friggframework/serverless-plugin');
|
|
427
470
|
});
|
|
428
471
|
|
|
429
|
-
it('should always include default IAM permissions', () => {
|
|
472
|
+
it('should always include default IAM permissions', async () => {
|
|
430
473
|
const appDefinition = {
|
|
431
474
|
integrations: []
|
|
432
475
|
};
|
|
433
476
|
|
|
434
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
477
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
435
478
|
|
|
436
479
|
// Check SNS publish permission
|
|
437
480
|
const snsPermission = result.provider.iamRoleStatements.find(
|
|
@@ -446,12 +489,12 @@ describe('composeServerlessDefinition', () => {
|
|
|
446
489
|
expect(sqsPermission).toBeDefined();
|
|
447
490
|
});
|
|
448
491
|
|
|
449
|
-
it('should include default environment variables', () => {
|
|
492
|
+
it('should include default environment variables', async () => {
|
|
450
493
|
const appDefinition = {
|
|
451
494
|
integrations: []
|
|
452
495
|
};
|
|
453
496
|
|
|
454
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
497
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
455
498
|
|
|
456
499
|
expect(result.provider.environment.STAGE).toBe('${opt:stage}');
|
|
457
500
|
expect(result.provider.environment.AWS_NODEJS_CONNECTION_REUSE_ENABLED).toBe(1);
|
|
@@ -459,32 +502,32 @@ describe('composeServerlessDefinition', () => {
|
|
|
459
502
|
});
|
|
460
503
|
|
|
461
504
|
describe('Edge Cases', () => {
|
|
462
|
-
it('should handle empty app definition', () => {
|
|
505
|
+
it('should handle empty app definition', async () => {
|
|
463
506
|
const appDefinition = {};
|
|
464
507
|
|
|
465
|
-
expect(
|
|
466
|
-
const result = composeServerlessDefinition(appDefinition);
|
|
508
|
+
await expect(composeServerlessDefinition(appDefinition)).resolves.not.toThrow();
|
|
509
|
+
const result = await composeServerlessDefinition(appDefinition);
|
|
467
510
|
expect(result.service).toBe('create-frigg-app');
|
|
468
511
|
});
|
|
469
512
|
|
|
470
|
-
it('should handle null/undefined integrations', () => {
|
|
513
|
+
it('should handle null/undefined integrations', async () => {
|
|
471
514
|
const appDefinition = {
|
|
472
515
|
integrations: null
|
|
473
516
|
};
|
|
474
517
|
|
|
475
|
-
expect(
|
|
518
|
+
await expect(composeServerlessDefinition(appDefinition)).rejects.toThrow();
|
|
476
519
|
});
|
|
477
520
|
|
|
478
|
-
it('should handle integration with missing Definition', () => {
|
|
521
|
+
it('should handle integration with missing Definition', async () => {
|
|
479
522
|
const invalidIntegration = {};
|
|
480
523
|
const appDefinition = {
|
|
481
524
|
integrations: [invalidIntegration]
|
|
482
525
|
};
|
|
483
526
|
|
|
484
|
-
expect(
|
|
527
|
+
await expect(composeServerlessDefinition(appDefinition)).rejects.toThrow();
|
|
485
528
|
});
|
|
486
529
|
|
|
487
|
-
it('should handle integration with missing name', () => {
|
|
530
|
+
it('should handle integration with missing name', async () => {
|
|
488
531
|
const invalidIntegration = {
|
|
489
532
|
Definition: {}
|
|
490
533
|
};
|
|
@@ -492,7 +535,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
492
535
|
integrations: [invalidIntegration]
|
|
493
536
|
};
|
|
494
537
|
|
|
495
|
-
expect(
|
|
538
|
+
await expect(composeServerlessDefinition(appDefinition)).rejects.toThrow();
|
|
496
539
|
});
|
|
497
540
|
});
|
|
498
541
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.398.
|
|
4
|
+
"version": "2.0.0--canary.398.4f043c8.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-ec2": "^3.835.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.835.0",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"@babel/eslint-parser": "^7.18.9",
|
|
10
10
|
"@babel/parser": "^7.25.3",
|
|
11
11
|
"@babel/traverse": "^7.25.3",
|
|
12
|
-
"@friggframework/test": "2.0.0--canary.398.
|
|
12
|
+
"@friggframework/test": "2.0.0--canary.398.4f043c8.0",
|
|
13
13
|
"@hapi/boom": "^10.0.1",
|
|
14
14
|
"@inquirer/prompts": "^5.3.8",
|
|
15
15
|
"axios": "^1.7.2",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"serverless-http": "^2.7.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@friggframework/eslint-config": "2.0.0--canary.398.
|
|
35
|
-
"@friggframework/prettier-config": "2.0.0--canary.398.
|
|
34
|
+
"@friggframework/eslint-config": "2.0.0--canary.398.4f043c8.0",
|
|
35
|
+
"@friggframework/prettier-config": "2.0.0--canary.398.4f043c8.0",
|
|
36
36
|
"prettier": "^2.7.1",
|
|
37
37
|
"serverless": "3.39.0",
|
|
38
38
|
"serverless-dotenv-plugin": "^6.0.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "4f043c83c9c0bddc961bdaf31a25dc18aba0668c"
|
|
68
68
|
}
|