@friggframework/devtools 2.0.0--canary.390.38f021e.0 → 2.0.0--canary.393.f4a61c1.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.
@@ -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
 
@@ -329,6 +329,58 @@ const composeServerlessDefinition = (AppDefinition) => {
329
329
  },
330
330
  };
331
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
+
356
+ // VPC Configuration based on App Definition
357
+ if (AppDefinition.vpc?.enable === true) {
358
+ // Create VPC config from App Definition
359
+ const vpcConfig = {};
360
+ if (AppDefinition.vpc.securityGroupIds) {
361
+ vpcConfig.securityGroupIds = AppDefinition.vpc.securityGroupIds;
362
+ }
363
+ if (AppDefinition.vpc.subnetIds) {
364
+ vpcConfig.subnetIds = AppDefinition.vpc.subnetIds;
365
+ }
366
+
367
+ // Set VPC config directly (can be overridden by serverless.yml)
368
+ definition.provider.vpc = vpcConfig;
369
+
370
+ // Add VPC-related IAM permissions
371
+ definition.provider.iamRoleStatements.push({
372
+ Effect: 'Allow',
373
+ Action: [
374
+ 'ec2:CreateNetworkInterface',
375
+ 'ec2:DescribeNetworkInterfaces',
376
+ 'ec2:DeleteNetworkInterface',
377
+ 'ec2:AttachNetworkInterface',
378
+ 'ec2:DetachNetworkInterface'
379
+ ],
380
+ Resource: '*'
381
+ });
382
+ }
383
+
332
384
  // Add integration-specific functions and resources
333
385
  for (const integration of AppDefinition.integrations) {
334
386
  const integrationName = integration.Definition.name;
@@ -348,9 +400,8 @@ const composeServerlessDefinition = (AppDefinition) => {
348
400
  };
349
401
 
350
402
  // Add SQS Queue for the integration
351
- const queueReference = `${
352
- integrationName.charAt(0).toUpperCase() + integrationName.slice(1)
353
- }Queue`;
403
+ const queueReference = `${integrationName.charAt(0).toUpperCase() + integrationName.slice(1)
404
+ }Queue`;
354
405
  const queueName = `\${self:service}--\${self:provider.stage}-${queueReference}`;
355
406
  definition.resources.Resources[queueReference] = {
356
407
  Type: 'AWS::SQS::Queue',
@@ -398,7 +449,7 @@ const composeServerlessDefinition = (AppDefinition) => {
398
449
 
399
450
  // Modify handler paths to point to the correct node_modules location
400
451
  definition.functions = modifyHandlerPaths(definition.functions);
401
-
452
+
402
453
  return definition;
403
454
  };
404
455
 
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--canary.390.38f021e.0",
4
+ "version": "2.0.0--canary.393.f4a61c1.0",
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--canary.390.38f021e.0",
9
+ "@friggframework/test": "2.0.0--canary.393.f4a61c1.0",
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--canary.390.38f021e.0",
31
- "@friggframework/prettier-config": "2.0.0--canary.390.38f021e.0",
30
+ "@friggframework/eslint-config": "2.0.0--canary.393.f4a61c1.0",
31
+ "@friggframework/prettier-config": "2.0.0--canary.393.f4a61c1.0",
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": "38f021edb73d61139d7c9a8e54064a535dea4815"
63
+ "gitHead": "f4a61c18c52e1a80a0b1e5bb4aa3eb6faefbf953"
63
64
  }