@friggframework/devtools 2.0.0-next.22 → 2.0.0-next.24
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.
|
@@ -7,7 +7,7 @@ const findNodeModulesPath = () => {
|
|
|
7
7
|
// Method 1: Try to find node_modules by traversing up from current directory
|
|
8
8
|
let currentDir = process.cwd();
|
|
9
9
|
let nodeModulesPath = null;
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
// Traverse up to 5 levels to find node_modules
|
|
12
12
|
for (let i = 0; i < 5; i++) {
|
|
13
13
|
const potentialPath = path.join(currentDir, 'node_modules');
|
|
@@ -24,7 +24,7 @@ const findNodeModulesPath = () => {
|
|
|
24
24
|
}
|
|
25
25
|
currentDir = parentDir;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
// Method 2: If method 1 fails, try using npm root command
|
|
29
29
|
if (!nodeModulesPath) {
|
|
30
30
|
try {
|
|
@@ -39,7 +39,7 @@ const findNodeModulesPath = () => {
|
|
|
39
39
|
console.error('Error executing npm root:', npmError);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
// Method 3: If all else fails, check for a package.json and assume node_modules is adjacent
|
|
44
44
|
if (!nodeModulesPath) {
|
|
45
45
|
currentDir = process.cwd();
|
|
@@ -62,11 +62,11 @@ const findNodeModulesPath = () => {
|
|
|
62
62
|
currentDir = parentDir;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
if (nodeModulesPath) {
|
|
67
67
|
return nodeModulesPath;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
|
|
70
70
|
console.warn('Could not find node_modules path, falling back to default');
|
|
71
71
|
return path.resolve(process.cwd(), '../node_modules');
|
|
72
72
|
} catch (error) {
|
|
@@ -80,7 +80,7 @@ const modifyHandlerPaths = (functions) => {
|
|
|
80
80
|
// Check if we're running in offline mode
|
|
81
81
|
const isOffline = process.argv.includes('offline');
|
|
82
82
|
console.log('isOffline', isOffline);
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
if (!isOffline) {
|
|
85
85
|
console.log('Not in offline mode, skipping handler path modification');
|
|
86
86
|
return functions;
|
|
@@ -88,7 +88,7 @@ const modifyHandlerPaths = (functions) => {
|
|
|
88
88
|
|
|
89
89
|
const nodeModulesPath = findNodeModulesPath();
|
|
90
90
|
const modifiedFunctions = { ...functions };
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
for (const functionName of Object.keys(modifiedFunctions)) {
|
|
93
93
|
console.log('functionName', functionName);
|
|
94
94
|
const functionDef = modifiedFunctions[functionName];
|
|
@@ -98,7 +98,7 @@ const modifyHandlerPaths = (functions) => {
|
|
|
98
98
|
console.log(`Updated handler for ${functionName}: ${functionDef.handler}`);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
return modifiedFunctions;
|
|
103
103
|
};
|
|
104
104
|
|
|
@@ -129,6 +129,28 @@ const composeServerlessDefinition = (AppDefinition) => {
|
|
|
129
129
|
Ref: 'InternalErrorBridgeTopic',
|
|
130
130
|
},
|
|
131
131
|
},
|
|
132
|
+
{
|
|
133
|
+
Effect: 'Allow',
|
|
134
|
+
Action: [
|
|
135
|
+
'sqs:SendMessage',
|
|
136
|
+
'sqs:SendMessageBatch',
|
|
137
|
+
'sqs:GetQueueUrl',
|
|
138
|
+
'sqs:GetQueueAttributes'
|
|
139
|
+
],
|
|
140
|
+
Resource: [
|
|
141
|
+
{
|
|
142
|
+
'Fn::GetAtt': ['InternalErrorQueue', 'Arn']
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
'Fn::Join': [
|
|
146
|
+
':',
|
|
147
|
+
[
|
|
148
|
+
'arn:aws:sqs:${self:provider.region}:*:${self:service}--${self:provider.stage}-*Queue'
|
|
149
|
+
]
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
],
|
|
153
|
+
}
|
|
132
154
|
],
|
|
133
155
|
},
|
|
134
156
|
plugins: [
|
|
@@ -307,6 +329,30 @@ const composeServerlessDefinition = (AppDefinition) => {
|
|
|
307
329
|
},
|
|
308
330
|
};
|
|
309
331
|
|
|
332
|
+
// KMS Configuration based on App Definition
|
|
333
|
+
if (AppDefinition.encryption?.useDefaultKMSForFieldLevelEncryption === true) {
|
|
334
|
+
// Add KMS IAM permissions
|
|
335
|
+
definition.provider.iamRoleStatements.push({
|
|
336
|
+
Effect: 'Allow',
|
|
337
|
+
Action: [
|
|
338
|
+
'kms:GenerateDataKey',
|
|
339
|
+
'kms:Decrypt'
|
|
340
|
+
],
|
|
341
|
+
Resource: ['${self:custom.kmsGrants.kmsKeyId}']
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
// Add KMS_KEY_ARN environment variable for Frigg Encrypt module
|
|
345
|
+
definition.provider.environment.KMS_KEY_ARN = '${self:custom.kmsGrants.kmsKeyId}';
|
|
346
|
+
|
|
347
|
+
// Add serverless-kms-grants plugin
|
|
348
|
+
definition.plugins.push('serverless-kms-grants');
|
|
349
|
+
|
|
350
|
+
// Configure KMS grants with default key
|
|
351
|
+
definition.custom.kmsGrants = {
|
|
352
|
+
kmsKeyId: '*'
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
310
356
|
// Add integration-specific functions and resources
|
|
311
357
|
for (const integration of AppDefinition.integrations) {
|
|
312
358
|
const integrationName = integration.Definition.name;
|
|
@@ -326,9 +372,8 @@ const composeServerlessDefinition = (AppDefinition) => {
|
|
|
326
372
|
};
|
|
327
373
|
|
|
328
374
|
// Add SQS Queue for the integration
|
|
329
|
-
const queueReference = `${
|
|
330
|
-
|
|
331
|
-
}Queue`;
|
|
375
|
+
const queueReference = `${integrationName.charAt(0).toUpperCase() + integrationName.slice(1)
|
|
376
|
+
}Queue`;
|
|
332
377
|
const queueName = `\${self:service}--\${self:provider.stage}-${queueReference}`;
|
|
333
378
|
definition.resources.Resources[queueReference] = {
|
|
334
379
|
Type: 'AWS::SQS::Queue',
|
|
@@ -376,7 +421,7 @@ const composeServerlessDefinition = (AppDefinition) => {
|
|
|
376
421
|
|
|
377
422
|
// Modify handler paths to point to the correct node_modules location
|
|
378
423
|
definition.functions = modifyHandlerPaths(definition.functions);
|
|
379
|
-
|
|
424
|
+
|
|
380
425
|
return definition;
|
|
381
426
|
};
|
|
382
427
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0-next.
|
|
4
|
+
"version": "2.0.0-next.24",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@babel/eslint-parser": "^7.18.9",
|
|
7
7
|
"@babel/parser": "^7.25.3",
|
|
8
8
|
"@babel/traverse": "^7.25.3",
|
|
9
|
-
"@friggframework/test": "2.0.0-next.
|
|
9
|
+
"@friggframework/test": "2.0.0-next.24",
|
|
10
10
|
"@hapi/boom": "^10.0.1",
|
|
11
11
|
"@inquirer/prompts": "^5.3.8",
|
|
12
12
|
"axios": "^1.7.2",
|
|
@@ -27,12 +27,13 @@
|
|
|
27
27
|
"serverless-http": "^2.7.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@friggframework/eslint-config": "2.0.0-next.
|
|
31
|
-
"@friggframework/prettier-config": "2.0.0-next.
|
|
30
|
+
"@friggframework/eslint-config": "2.0.0-next.24",
|
|
31
|
+
"@friggframework/prettier-config": "2.0.0-next.24",
|
|
32
32
|
"prettier": "^2.7.1",
|
|
33
33
|
"serverless": "3.39.0",
|
|
34
34
|
"serverless-dotenv-plugin": "^6.0.0",
|
|
35
35
|
"serverless-jetpack": "^0.11.2",
|
|
36
|
+
"serverless-kms-grants": "^1.0.0",
|
|
36
37
|
"serverless-offline": "^13.8.0",
|
|
37
38
|
"serverless-offline-sqs": "^8.0.0",
|
|
38
39
|
"serverless-plugin-monorepo": "^0.11.0"
|
|
@@ -59,5 +60,5 @@
|
|
|
59
60
|
"publishConfig": {
|
|
60
61
|
"access": "public"
|
|
61
62
|
},
|
|
62
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "b1a00897238f7734a67342a3f72f1e9b6504800f"
|
|
63
64
|
}
|