@friggframework/devtools 2.0.0-next.45 → 2.0.0-next.47

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.
Files changed (212) hide show
  1. package/infrastructure/ARCHITECTURE.md +487 -0
  2. package/infrastructure/HEALTH.md +468 -0
  3. package/infrastructure/README.md +51 -0
  4. package/infrastructure/__tests__/postgres-config.test.js +914 -0
  5. package/infrastructure/__tests__/template-generation.test.js +687 -0
  6. package/infrastructure/create-frigg-infrastructure.js +1 -1
  7. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +630 -0
  8. package/infrastructure/{DEPLOYMENT-INSTRUCTIONS.md → docs/deployment-instructions.md} +3 -3
  9. package/infrastructure/{IAM-POLICY-TEMPLATES.md → docs/iam-policy-templates.md} +9 -10
  10. package/infrastructure/domains/database/aurora-builder.js +809 -0
  11. package/infrastructure/domains/database/aurora-builder.test.js +950 -0
  12. package/infrastructure/domains/database/aurora-discovery.js +87 -0
  13. package/infrastructure/domains/database/aurora-discovery.test.js +188 -0
  14. package/infrastructure/domains/database/aurora-resolver.js +210 -0
  15. package/infrastructure/domains/database/aurora-resolver.test.js +347 -0
  16. package/infrastructure/domains/database/migration-builder.js +695 -0
  17. package/infrastructure/domains/database/migration-builder.test.js +294 -0
  18. package/infrastructure/domains/database/migration-resolver.js +163 -0
  19. package/infrastructure/domains/database/migration-resolver.test.js +337 -0
  20. package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +164 -0
  21. package/infrastructure/domains/health/application/ports/IResourceDetector.js +129 -0
  22. package/infrastructure/domains/health/application/ports/IResourceImporter.js +142 -0
  23. package/infrastructure/domains/health/application/ports/IStackRepository.js +131 -0
  24. package/infrastructure/domains/health/application/ports/index.js +26 -0
  25. package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +679 -0
  26. package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +167 -0
  27. package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +1130 -0
  28. package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +221 -0
  29. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +152 -0
  30. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +343 -0
  31. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +535 -0
  32. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +376 -0
  33. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +213 -0
  34. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +441 -0
  35. package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +267 -0
  36. package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +324 -0
  37. package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +386 -0
  38. package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +1419 -0
  39. package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +391 -0
  40. package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +551 -0
  41. package/infrastructure/domains/health/domain/entities/issue.js +299 -0
  42. package/infrastructure/domains/health/domain/entities/issue.test.js +528 -0
  43. package/infrastructure/domains/health/domain/entities/property-mismatch.js +108 -0
  44. package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +275 -0
  45. package/infrastructure/domains/health/domain/entities/resource.js +159 -0
  46. package/infrastructure/domains/health/domain/entities/resource.test.js +432 -0
  47. package/infrastructure/domains/health/domain/entities/stack-health-report.js +306 -0
  48. package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +601 -0
  49. package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +380 -0
  50. package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +971 -0
  51. package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +1150 -0
  52. package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +672 -0
  53. package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +496 -0
  54. package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +419 -0
  55. package/infrastructure/domains/health/domain/services/health-score-calculator.js +248 -0
  56. package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +504 -0
  57. package/infrastructure/domains/health/domain/services/import-progress-monitor.js +195 -0
  58. package/infrastructure/domains/health/domain/services/import-template-generator.js +435 -0
  59. package/infrastructure/domains/health/domain/services/logical-id-mapper.js +345 -0
  60. package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +234 -0
  61. package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +431 -0
  62. package/infrastructure/domains/health/domain/services/property-mutability-config.js +382 -0
  63. package/infrastructure/domains/health/domain/services/template-parser.js +245 -0
  64. package/infrastructure/domains/health/domain/services/update-progress-monitor.js +192 -0
  65. package/infrastructure/domains/health/domain/value-objects/health-score.js +138 -0
  66. package/infrastructure/domains/health/domain/value-objects/health-score.test.js +267 -0
  67. package/infrastructure/domains/health/domain/value-objects/property-mutability.js +161 -0
  68. package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +198 -0
  69. package/infrastructure/domains/health/domain/value-objects/resource-state.js +167 -0
  70. package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +196 -0
  71. package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +192 -0
  72. package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +262 -0
  73. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +312 -0
  74. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +367 -0
  75. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +432 -0
  76. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +784 -0
  77. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +1133 -0
  78. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +565 -0
  79. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +554 -0
  80. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +318 -0
  81. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +398 -0
  82. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +777 -0
  83. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +580 -0
  84. package/infrastructure/domains/integration/integration-builder.js +397 -0
  85. package/infrastructure/domains/integration/integration-builder.test.js +593 -0
  86. package/infrastructure/domains/integration/integration-resolver.js +170 -0
  87. package/infrastructure/domains/integration/integration-resolver.test.js +369 -0
  88. package/infrastructure/domains/integration/websocket-builder.js +69 -0
  89. package/infrastructure/domains/integration/websocket-builder.test.js +195 -0
  90. package/infrastructure/domains/networking/vpc-builder.js +1829 -0
  91. package/infrastructure/domains/networking/vpc-builder.test.js +1262 -0
  92. package/infrastructure/domains/networking/vpc-discovery.js +177 -0
  93. package/infrastructure/domains/networking/vpc-discovery.test.js +350 -0
  94. package/infrastructure/domains/networking/vpc-resolver.js +324 -0
  95. package/infrastructure/domains/networking/vpc-resolver.test.js +501 -0
  96. package/infrastructure/domains/parameters/ssm-builder.js +79 -0
  97. package/infrastructure/domains/parameters/ssm-builder.test.js +189 -0
  98. package/infrastructure/domains/parameters/ssm-discovery.js +84 -0
  99. package/infrastructure/domains/parameters/ssm-discovery.test.js +210 -0
  100. package/infrastructure/{iam-generator.js → domains/security/iam-generator.js} +2 -2
  101. package/infrastructure/domains/security/kms-builder.js +366 -0
  102. package/infrastructure/domains/security/kms-builder.test.js +374 -0
  103. package/infrastructure/domains/security/kms-discovery.js +80 -0
  104. package/infrastructure/domains/security/kms-discovery.test.js +177 -0
  105. package/infrastructure/domains/security/kms-resolver.js +96 -0
  106. package/infrastructure/domains/security/kms-resolver.test.js +216 -0
  107. package/infrastructure/domains/shared/base-builder.js +112 -0
  108. package/infrastructure/domains/shared/base-resolver.js +186 -0
  109. package/infrastructure/domains/shared/base-resolver.test.js +305 -0
  110. package/infrastructure/domains/shared/builder-orchestrator.js +212 -0
  111. package/infrastructure/domains/shared/builder-orchestrator.test.js +213 -0
  112. package/infrastructure/domains/shared/cloudformation-discovery-v2.js +334 -0
  113. package/infrastructure/domains/shared/cloudformation-discovery.js +375 -0
  114. package/infrastructure/domains/shared/cloudformation-discovery.test.js +590 -0
  115. package/infrastructure/domains/shared/environment-builder.js +119 -0
  116. package/infrastructure/domains/shared/environment-builder.test.js +247 -0
  117. package/infrastructure/domains/shared/providers/aws-provider-adapter.js +544 -0
  118. package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +377 -0
  119. package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +93 -0
  120. package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +136 -0
  121. package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +82 -0
  122. package/infrastructure/domains/shared/providers/provider-factory.js +108 -0
  123. package/infrastructure/domains/shared/providers/provider-factory.test.js +170 -0
  124. package/infrastructure/domains/shared/resource-discovery.js +192 -0
  125. package/infrastructure/domains/shared/resource-discovery.test.js +552 -0
  126. package/infrastructure/domains/shared/types/app-definition.js +205 -0
  127. package/infrastructure/domains/shared/types/discovery-result.js +106 -0
  128. package/infrastructure/domains/shared/types/discovery-result.test.js +258 -0
  129. package/infrastructure/domains/shared/types/index.js +46 -0
  130. package/infrastructure/domains/shared/types/resource-ownership.js +108 -0
  131. package/infrastructure/domains/shared/types/resource-ownership.test.js +101 -0
  132. package/infrastructure/domains/shared/utilities/base-definition-factory.js +380 -0
  133. package/infrastructure/domains/shared/utilities/base-definition-factory.js.bak +338 -0
  134. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +248 -0
  135. package/infrastructure/domains/shared/utilities/handler-path-resolver.js +134 -0
  136. package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +268 -0
  137. package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +55 -0
  138. package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +138 -0
  139. package/infrastructure/{env-validator.js → domains/shared/validation/env-validator.js} +2 -1
  140. package/infrastructure/domains/shared/validation/env-validator.test.js +173 -0
  141. package/infrastructure/esbuild.config.js +53 -0
  142. package/infrastructure/infrastructure-composer.js +87 -0
  143. package/infrastructure/{serverless-template.test.js → infrastructure-composer.test.js} +115 -24
  144. package/infrastructure/scripts/build-prisma-layer.js +553 -0
  145. package/infrastructure/scripts/build-prisma-layer.test.js +102 -0
  146. package/infrastructure/{build-time-discovery.js → scripts/build-time-discovery.js} +80 -48
  147. package/infrastructure/{build-time-discovery.test.js → scripts/build-time-discovery.test.js} +5 -4
  148. package/layers/prisma/nodejs/package.json +8 -0
  149. package/management-ui/server/utils/cliIntegration.js +1 -1
  150. package/management-ui/server/utils/environment/awsParameterStore.js +29 -18
  151. package/package.json +11 -11
  152. package/frigg-cli/.eslintrc.js +0 -141
  153. package/frigg-cli/__tests__/unit/commands/build.test.js +0 -251
  154. package/frigg-cli/__tests__/unit/commands/db-setup.test.js +0 -548
  155. package/frigg-cli/__tests__/unit/commands/install.test.js +0 -400
  156. package/frigg-cli/__tests__/unit/commands/ui.test.js +0 -346
  157. package/frigg-cli/__tests__/unit/utils/database-validator.test.js +0 -366
  158. package/frigg-cli/__tests__/unit/utils/error-messages.test.js +0 -304
  159. package/frigg-cli/__tests__/unit/utils/prisma-runner.test.js +0 -486
  160. package/frigg-cli/__tests__/utils/mock-factory.js +0 -270
  161. package/frigg-cli/__tests__/utils/prisma-mock.js +0 -194
  162. package/frigg-cli/__tests__/utils/test-fixtures.js +0 -463
  163. package/frigg-cli/__tests__/utils/test-setup.js +0 -287
  164. package/frigg-cli/build-command/index.js +0 -65
  165. package/frigg-cli/db-setup-command/index.js +0 -193
  166. package/frigg-cli/deploy-command/index.js +0 -175
  167. package/frigg-cli/generate-command/__tests__/generate-command.test.js +0 -301
  168. package/frigg-cli/generate-command/azure-generator.js +0 -43
  169. package/frigg-cli/generate-command/gcp-generator.js +0 -47
  170. package/frigg-cli/generate-command/index.js +0 -332
  171. package/frigg-cli/generate-command/terraform-generator.js +0 -555
  172. package/frigg-cli/generate-iam-command.js +0 -118
  173. package/frigg-cli/index.js +0 -75
  174. package/frigg-cli/index.test.js +0 -158
  175. package/frigg-cli/init-command/backend-first-handler.js +0 -756
  176. package/frigg-cli/init-command/index.js +0 -93
  177. package/frigg-cli/init-command/template-handler.js +0 -143
  178. package/frigg-cli/install-command/backend-js.js +0 -33
  179. package/frigg-cli/install-command/commit-changes.js +0 -16
  180. package/frigg-cli/install-command/environment-variables.js +0 -127
  181. package/frigg-cli/install-command/environment-variables.test.js +0 -136
  182. package/frigg-cli/install-command/index.js +0 -54
  183. package/frigg-cli/install-command/install-package.js +0 -13
  184. package/frigg-cli/install-command/integration-file.js +0 -30
  185. package/frigg-cli/install-command/logger.js +0 -12
  186. package/frigg-cli/install-command/template.js +0 -90
  187. package/frigg-cli/install-command/validate-package.js +0 -75
  188. package/frigg-cli/jest.config.js +0 -124
  189. package/frigg-cli/package.json +0 -54
  190. package/frigg-cli/start-command/index.js +0 -149
  191. package/frigg-cli/start-command/start-command.test.js +0 -297
  192. package/frigg-cli/test/init-command.test.js +0 -180
  193. package/frigg-cli/test/npm-registry.test.js +0 -319
  194. package/frigg-cli/ui-command/index.js +0 -154
  195. package/frigg-cli/utils/app-resolver.js +0 -319
  196. package/frigg-cli/utils/backend-path.js +0 -25
  197. package/frigg-cli/utils/database-validator.js +0 -161
  198. package/frigg-cli/utils/error-messages.js +0 -257
  199. package/frigg-cli/utils/npm-registry.js +0 -167
  200. package/frigg-cli/utils/prisma-runner.js +0 -280
  201. package/frigg-cli/utils/process-manager.js +0 -199
  202. package/frigg-cli/utils/repo-detection.js +0 -405
  203. package/infrastructure/aws-discovery.js +0 -1176
  204. package/infrastructure/aws-discovery.test.js +0 -1220
  205. package/infrastructure/serverless-template.js +0 -2094
  206. /package/infrastructure/{WEBSOCKET-CONFIGURATION.md → docs/WEBSOCKET-CONFIGURATION.md} +0 -0
  207. /package/infrastructure/{GENERATE-IAM-DOCS.md → docs/generate-iam-command.md} +0 -0
  208. /package/infrastructure/{iam-generator.test.js → domains/security/iam-generator.test.js} +0 -0
  209. /package/infrastructure/{frigg-deployment-iam-stack.yaml → domains/security/templates/frigg-deployment-iam-stack.yaml} +0 -0
  210. /package/infrastructure/{iam-policy-basic.json → domains/security/templates/iam-policy-basic.json} +0 -0
  211. /package/infrastructure/{iam-policy-full.json → domains/security/templates/iam-policy-full.json} +0 -0
  212. /package/infrastructure/{run-discovery.js → scripts/run-discovery.js} +0 -0
@@ -1,5 +1,4 @@
1
1
  const fs = require('fs');
2
- const path = require('path');
3
2
  let AWSDiscovery;
4
3
 
5
4
  function loadAWSDiscovery() {
@@ -33,23 +32,28 @@ class BuildTimeDiscovery {
33
32
  async discoverAndCreateConfig(outputPath = './aws-discovery-config.json') {
34
33
  try {
35
34
  console.log('Starting AWS resource discovery for build...');
36
-
35
+
37
36
  const resources = await this.discovery.discoverResources();
38
-
37
+
39
38
  // Create configuration object
40
39
  const config = {
41
40
  awsDiscovery: resources,
42
41
  generatedAt: new Date().toISOString(),
43
- region: this.region
42
+ region: this.region,
44
43
  };
45
-
44
+
46
45
  // Write configuration to file
47
46
  fs.writeFileSync(outputPath, JSON.stringify(config, null, 2));
48
- console.log(`AWS discovery configuration written to: ${outputPath}`);
49
-
47
+ console.log(
48
+ `AWS discovery configuration written to: ${outputPath}`,
49
+ );
50
+
50
51
  return config;
51
52
  } catch (error) {
52
- console.error('Error during AWS resource discovery:', error.message);
53
+ console.error(
54
+ 'Error during AWS resource discovery:',
55
+ error.message,
56
+ );
53
57
  throw error;
54
58
  }
55
59
  }
@@ -62,22 +66,34 @@ class BuildTimeDiscovery {
62
66
  */
63
67
  replaceTemplateVariables(templateContent, discoveredResources) {
64
68
  let updatedContent = templateContent;
65
-
69
+
66
70
  // Replace AWS discovery placeholders
67
71
  const replacements = {
68
- '${self:custom.awsDiscovery.defaultVpcId}': discoveredResources.defaultVpcId,
69
- '${self:custom.awsDiscovery.defaultSecurityGroupId}': discoveredResources.defaultSecurityGroupId,
70
- '${self:custom.awsDiscovery.privateSubnetId1}': discoveredResources.privateSubnetId1,
71
- '${self:custom.awsDiscovery.privateSubnetId2}': discoveredResources.privateSubnetId2,
72
- '${self:custom.awsDiscovery.privateRouteTableId}': discoveredResources.privateRouteTableId,
73
- '${self:custom.awsDiscovery.defaultKmsKeyId}': discoveredResources.defaultKmsKeyId
72
+ '${self:custom.awsDiscovery.defaultVpcId}':
73
+ discoveredResources.defaultVpcId,
74
+ '${self:custom.awsDiscovery.defaultSecurityGroupId}':
75
+ discoveredResources.defaultSecurityGroupId,
76
+ '${self:custom.awsDiscovery.privateSubnetId1}':
77
+ discoveredResources.privateSubnetId1,
78
+ '${self:custom.awsDiscovery.privateSubnetId2}':
79
+ discoveredResources.privateSubnetId2,
80
+ '${self:custom.awsDiscovery.privateRouteTableId}':
81
+ discoveredResources.privateRouteTableId,
82
+ '${self:custom.awsDiscovery.defaultKmsKeyId}':
83
+ discoveredResources.defaultKmsKeyId,
74
84
  };
75
-
85
+
76
86
  for (const [placeholder, value] of Object.entries(replacements)) {
77
87
  // Use a more targeted replacement to avoid replacing similar strings
78
- updatedContent = updatedContent.replace(new RegExp(placeholder.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'g'), value);
88
+ updatedContent = updatedContent.replace(
89
+ new RegExp(
90
+ placeholder.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'),
91
+ 'g',
92
+ ),
93
+ value,
94
+ );
79
95
  }
80
-
96
+
81
97
  return updatedContent;
82
98
  }
83
99
 
@@ -91,25 +107,33 @@ class BuildTimeDiscovery {
91
107
  async processServerlessConfig(configPath, outputPath = null) {
92
108
  try {
93
109
  console.log(`Processing serverless configuration: ${configPath}`);
94
-
110
+
95
111
  // Read the current serverless configuration
96
112
  const configContent = fs.readFileSync(configPath, 'utf8');
97
-
113
+
98
114
  // Discover AWS resources
99
115
  const resources = await this.discovery.discoverResources();
100
-
116
+
101
117
  // Replace placeholders with discovered values
102
- const updatedContent = this.replaceTemplateVariables(configContent, resources);
103
-
118
+ const updatedContent = this.replaceTemplateVariables(
119
+ configContent,
120
+ resources,
121
+ );
122
+
104
123
  // Write to output file or overwrite original
105
124
  const finalPath = outputPath || configPath;
106
125
  fs.writeFileSync(finalPath, updatedContent);
107
-
108
- console.log(`Updated serverless configuration written to: ${finalPath}`);
109
-
126
+
127
+ console.log(
128
+ `Updated serverless configuration written to: ${finalPath}`,
129
+ );
130
+
110
131
  return resources;
111
132
  } catch (error) {
112
- console.error('Error processing serverless configuration:', error.message);
133
+ console.error(
134
+ 'Error processing serverless configuration:',
135
+ error.message,
136
+ );
113
137
  throw error;
114
138
  }
115
139
  }
@@ -121,7 +145,7 @@ class BuildTimeDiscovery {
121
145
  */
122
146
  generateCustomSection(discoveredResources) {
123
147
  return {
124
- awsDiscovery: discoveredResources
148
+ awsDiscovery: discoveredResources,
125
149
  };
126
150
  }
127
151
 
@@ -135,40 +159,48 @@ class BuildTimeDiscovery {
135
159
  async preBuildHook(appDefinition, region) {
136
160
  try {
137
161
  console.log('Running pre-build AWS discovery hook...');
138
-
162
+
139
163
  // Only run discovery if VPC, KMS, or SSM features are enabled
140
- const needsDiscovery = appDefinition.vpc?.enable ||
141
- appDefinition.encryption?.fieldLevelEncryptionMethod === 'kms' ||
142
- appDefinition.ssm?.enable;
143
-
164
+ const needsDiscovery =
165
+ appDefinition.vpc?.enable ||
166
+ appDefinition.encryption?.fieldLevelEncryptionMethod ===
167
+ 'kms' ||
168
+ appDefinition.ssm?.enable;
169
+
144
170
  if (!needsDiscovery) {
145
171
  console.log('No AWS discovery needed based on app definition');
146
172
  return null;
147
173
  }
148
-
174
+
149
175
  // Create discovery instance with specified region
150
176
  loadAWSDiscovery();
151
177
  const discovery = new AWSDiscovery(region);
152
178
  const resources = await discovery.discoverResources();
153
-
179
+
154
180
  // Create environment variables for serverless
155
181
  const envVars = {
156
182
  AWS_DISCOVERY_VPC_ID: resources.defaultVpcId,
157
- AWS_DISCOVERY_SECURITY_GROUP_ID: resources.defaultSecurityGroupId,
183
+ AWS_DISCOVERY_SECURITY_GROUP_ID:
184
+ resources.defaultSecurityGroupId,
158
185
  AWS_DISCOVERY_SUBNET_ID_1: resources.privateSubnetId1,
159
186
  AWS_DISCOVERY_SUBNET_ID_2: resources.privateSubnetId2,
160
187
  AWS_DISCOVERY_PUBLIC_SUBNET_ID: resources.publicSubnetId,
161
188
  AWS_DISCOVERY_ROUTE_TABLE_ID: resources.privateRouteTableId,
162
- AWS_DISCOVERY_KMS_KEY_ID: resources.defaultKmsKeyId // Keep consistent naming convention (even though it's an ARN)
189
+ AWS_DISCOVERY_KMS_KEY_ID: resources.defaultKmsKeyId, // Keep consistent naming convention (even though it's an ARN)
163
190
  };
164
-
191
+
165
192
  // Set environment variables for serverless to use
166
193
  Object.assign(process.env, envVars);
167
-
168
- console.log('AWS discovery completed and environment variables set');
194
+
195
+ console.log(
196
+ 'AWS discovery completed and environment variables set',
197
+ );
169
198
  return resources;
170
199
  } catch (error) {
171
- console.error('Error in pre-build AWS discovery hook:', error.message);
200
+ console.error(
201
+ 'Error in pre-build AWS discovery hook:',
202
+ error.message,
203
+ );
172
204
  throw error;
173
205
  }
174
206
  }
@@ -186,11 +218,11 @@ async function runBuildTimeDiscovery(options = {}) {
186
218
  const {
187
219
  region = process.env.AWS_REGION || 'us-east-1',
188
220
  outputPath = './aws-discovery-config.json',
189
- configPath = null
221
+ configPath = null,
190
222
  } = options;
191
-
223
+
192
224
  const discovery = new BuildTimeDiscovery(region);
193
-
225
+
194
226
  if (configPath) {
195
227
  // Process existing serverless configuration
196
228
  return await discovery.processServerlessConfig(configPath);
@@ -200,7 +232,7 @@ async function runBuildTimeDiscovery(options = {}) {
200
232
  }
201
233
  }
202
234
 
203
- module.exports = {
204
- BuildTimeDiscovery,
205
- runBuildTimeDiscovery
206
- };
235
+ module.exports = {
236
+ BuildTimeDiscovery,
237
+ runBuildTimeDiscovery,
238
+ };
@@ -5,7 +5,8 @@ const { AWSDiscovery } = require('./aws-discovery');
5
5
 
6
6
  // Mock dependencies
7
7
  jest.mock('fs');
8
- jest.mock('./aws-discovery');
8
+ // Mock will be updated when tests are rewritten for new provider architecture
9
+ // jest.mock('./aws-discovery');
9
10
 
10
11
  describe('BuildTimeDiscovery', () => {
11
12
  let buildTimeDiscovery;
@@ -14,7 +15,7 @@ describe('BuildTimeDiscovery', () => {
14
15
 
15
16
  beforeEach(() => {
16
17
  buildTimeDiscovery = new BuildTimeDiscovery('us-east-1');
17
-
18
+
18
19
  // Mock AWSDiscovery
19
20
  mockAWSDiscovery = {
20
21
  discoverResources: jest.fn(),
@@ -27,7 +28,7 @@ describe('BuildTimeDiscovery', () => {
27
28
 
28
29
  // Reset environment
29
30
  process.env = { ...originalEnv };
30
-
31
+
31
32
  jest.clearAllMocks();
32
33
  });
33
34
 
@@ -338,7 +339,7 @@ describe('BuildTimeDiscovery', () => {
338
339
  it('should process config file when configPath provided', async () => {
339
340
  const mockConfigContent = 'provider: aws';
340
341
  const mockResources = { defaultVpcId: 'vpc-12345678' };
341
-
342
+
342
343
  fs.readFileSync.mockReturnValue(mockConfigContent);
343
344
  mockAWSDiscovery.discoverResources.mockResolvedValue(mockResources);
344
345
 
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "prisma-lambda-layer",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "dependencies": {
6
+ "@prisma/client": "^6.16.3"
7
+ }
8
+ }
@@ -17,7 +17,7 @@ class FriggCLIIntegration {
17
17
  const possiblePaths = [
18
18
  path.resolve(process.cwd(), '../frigg-cli/index.js'),
19
19
  path.resolve(process.cwd(), '../../frigg-cli/index.js'),
20
- path.resolve(process.cwd(), 'packages/devtools/frigg-cli/index.js'),
20
+ path.resolve(process.cwd(), 'packages/frigg-cli/index.js'),
21
21
  'frigg' // Global installation
22
22
  ]
23
23
 
@@ -1,8 +1,15 @@
1
- import AWS from 'aws-sdk';
1
+ import {
2
+ SSMClient,
3
+ GetParametersByPathCommand,
4
+ PutParameterCommand,
5
+ DeleteParameterCommand,
6
+ DescribeParametersCommand,
7
+ GetParameterHistoryCommand,
8
+ } from '@aws-sdk/client-ssm';
2
9
 
3
10
  class AWSParameterStore {
4
11
  constructor(config = {}) {
5
- this.ssm = new AWS.SSM({
12
+ this.ssm = new SSMClient({
6
13
  region: config.region || process.env.AWS_REGION || 'us-east-1',
7
14
  ...config.awsConfig
8
15
  });
@@ -20,16 +27,16 @@ class AWSParameterStore {
20
27
 
21
28
  try {
22
29
  do {
23
- const params = {
30
+ const command = new GetParametersByPathCommand({
24
31
  Path: path,
25
32
  Recursive: true,
26
33
  WithDecryption: true,
27
34
  MaxResults: 10,
28
35
  NextToken: nextToken
29
- };
36
+ });
37
+
38
+ const response = await this.ssm.send(command);
30
39
 
31
- const response = await this.ssm.getParametersByPath(params).promise();
32
-
33
40
  for (const param of response.Parameters) {
34
41
  const key = this.extractKeyFromPath(param.Name, environment);
35
42
  parameters.push({
@@ -60,7 +67,7 @@ class AWSParameterStore {
60
67
  */
61
68
  async setParameter(environment, variable) {
62
69
  const parameterName = `${this.prefix}/${environment}/${variable.key}`;
63
-
70
+
64
71
  try {
65
72
  const params = {
66
73
  Name: parameterName,
@@ -89,8 +96,9 @@ class AWSParameterStore {
89
96
  params.KeyId = this.kmsKeyId;
90
97
  }
91
98
 
92
- const response = await this.ssm.putParameter(params).promise();
93
-
99
+ const command = new PutParameterCommand(params);
100
+ const response = await this.ssm.send(command);
101
+
94
102
  return {
95
103
  success: true,
96
104
  version: response.Version,
@@ -107,9 +115,10 @@ class AWSParameterStore {
107
115
  */
108
116
  async deleteParameter(environment, key) {
109
117
  const parameterName = `${this.prefix}/${environment}/${key}`;
110
-
118
+
111
119
  try {
112
- await this.ssm.deleteParameter({ Name: parameterName }).promise();
120
+ const command = new DeleteParameterCommand({ Name: parameterName });
121
+ await this.ssm.send(command);
113
122
  return { success: true };
114
123
  } catch (error) {
115
124
  if (error.code === 'ParameterNotFound') {
@@ -142,7 +151,7 @@ class AWSParameterStore {
142
151
  try {
143
152
  const existing = existingParams.find(p => p.key === variable.key);
144
153
  const result = await this.setParameter(environment, variable);
145
-
154
+
146
155
  if (existing) {
147
156
  results.updated.push({ key: variable.key, ...result });
148
157
  } else {
@@ -201,7 +210,8 @@ class AWSParameterStore {
201
210
  async validateAccess() {
202
211
  try {
203
212
  // Try to list parameters to check access
204
- await this.ssm.describeParameters({ MaxResults: 1 }).promise();
213
+ const command = new DescribeParametersCommand({ MaxResults: 1 });
214
+ await this.ssm.send(command);
205
215
  return { valid: true };
206
216
  } catch (error) {
207
217
  return {
@@ -221,12 +231,12 @@ class AWSParameterStore {
221
231
  content += `# Generated on ${new Date().toISOString()}\n\n`;
222
232
 
223
233
  const sorted = parameters.sort((a, b) => a.key.localeCompare(b.key));
224
-
234
+
225
235
  for (const param of sorted) {
226
236
  if (param.description) {
227
237
  content += `# ${param.description}\n`;
228
238
  }
229
-
239
+
230
240
  // Mask secret values in export
231
241
  const value = param.isSecret ? '**REDACTED**' : param.value;
232
242
  content += `${param.key}=${value}\n\n`;
@@ -240,13 +250,14 @@ class AWSParameterStore {
240
250
  */
241
251
  async getParameterHistory(environment, key, maxResults = 10) {
242
252
  const parameterName = `${this.prefix}/${environment}/${key}`;
243
-
253
+
244
254
  try {
245
- const response = await this.ssm.getParameterHistory({
255
+ const command = new GetParameterHistoryCommand({
246
256
  Name: parameterName,
247
257
  WithDecryption: false,
248
258
  MaxResults: maxResults
249
- }).promise();
259
+ });
260
+ const response = await this.ssm.send(command);
250
261
 
251
262
  return response.Parameters.map(p => ({
252
263
  version: p.Version,
package/package.json CHANGED
@@ -1,16 +1,19 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0-next.45",
4
+ "version": "2.0.0-next.47",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-ec2": "^3.835.0",
7
7
  "@aws-sdk/client-kms": "^3.835.0",
8
+ "@aws-sdk/client-rds": "^3.906.0",
9
+ "@aws-sdk/client-s3": "^3.917.0",
10
+ "@aws-sdk/client-secrets-manager": "^3.906.0",
8
11
  "@aws-sdk/client-sts": "^3.835.0",
9
12
  "@babel/eslint-parser": "^7.18.9",
10
13
  "@babel/parser": "^7.25.3",
11
14
  "@babel/traverse": "^7.25.3",
12
- "@friggframework/schemas": "2.0.0-next.45",
13
- "@friggframework/test": "2.0.0-next.45",
15
+ "@friggframework/schemas": "2.0.0-next.47",
16
+ "@friggframework/test": "2.0.0-next.47",
14
17
  "@hapi/boom": "^10.0.1",
15
18
  "@inquirer/prompts": "^5.3.8",
16
19
  "axios": "^1.7.2",
@@ -32,15 +35,15 @@
32
35
  "serverless-http": "^2.7.0"
33
36
  },
34
37
  "devDependencies": {
35
- "@friggframework/eslint-config": "2.0.0-next.45",
36
- "@friggframework/prettier-config": "2.0.0-next.45",
38
+ "@friggframework/eslint-config": "2.0.0-next.47",
39
+ "@friggframework/prettier-config": "2.0.0-next.47",
37
40
  "aws-sdk-client-mock": "^4.1.0",
38
41
  "aws-sdk-client-mock-jest": "^4.1.0",
39
42
  "jest": "^30.1.3",
43
+ "osls": "^3.40.1",
40
44
  "prettier": "^2.7.1",
41
- "serverless": "3.39.0",
42
45
  "serverless-dotenv-plugin": "^6.0.0",
43
- "serverless-jetpack": "^0.11.2",
46
+ "serverless-esbuild": "^1.54.3",
44
47
  "serverless-kms-grants": "^1.0.0",
45
48
  "serverless-offline": "^13.8.0",
46
49
  "serverless-offline-sqs": "^8.0.0",
@@ -50,9 +53,6 @@
50
53
  "lint:fix": "prettier --write --loglevel error . && eslint . --fix",
51
54
  "test": "jest --passWithNoTests # TODO"
52
55
  },
53
- "bin": {
54
- "frigg": "./frigg-cli/index.js"
55
- },
56
56
  "author": "",
57
57
  "license": "MIT",
58
58
  "main": "index.js",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "996a15bcdfaa4252b9891a33f1b1c84548d66bbc"
71
+ "gitHead": "7a7b05dc023f05a6b1c18075064e88f29156fee1"
72
72
  }
@@ -1,141 +0,0 @@
1
- module.exports = {
2
- env: {
3
- browser: false,
4
- es2021: true,
5
- node: true,
6
- jest: true
7
- },
8
- extends: [
9
- 'standard'
10
- ],
11
- parserOptions: {
12
- ecmaVersion: 'latest',
13
- sourceType: 'commonjs'
14
- },
15
- rules: {
16
- // Enforce consistent indentation
17
- 'indent': ['error', 2],
18
-
19
- // Enforce consistent spacing
20
- 'space-before-function-paren': ['error', 'never'],
21
- 'object-curly-spacing': ['error', 'always'],
22
-
23
- // Enforce semicolons for consistency
24
- 'semi': ['error', 'always'],
25
-
26
- // Allow console.log in CLI applications
27
- 'no-console': 'off',
28
-
29
- // Allow process.exit in CLI applications
30
- 'no-process-exit': 'off',
31
-
32
- // Enforce consistent quote usage
33
- 'quotes': ['error', 'single', { avoidEscape: true }],
34
-
35
- // Enforce consistent comma usage
36
- 'comma-dangle': ['error', 'never'],
37
-
38
- // Enforce consistent line endings
39
- 'eol-last': ['error', 'always'],
40
-
41
- // Enforce consistent spacing around operators
42
- 'space-infix-ops': 'error',
43
-
44
- // Enforce consistent spacing in object literals
45
- 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
46
-
47
- // Enforce consistent spacing in arrays
48
- 'array-bracket-spacing': ['error', 'never'],
49
-
50
- // Enforce consistent spacing in function calls
51
- 'func-call-spacing': ['error', 'never'],
52
-
53
- // Enforce consistent spacing around keywords
54
- 'keyword-spacing': ['error', { before: true, after: true }],
55
-
56
- // Enforce consistent line breaks
57
- 'max-len': ['error', {
58
- code: 120,
59
- ignoreUrls: true,
60
- ignoreStrings: true,
61
- ignoreTemplateLiterals: true
62
- }],
63
-
64
- // Enforce consistent naming conventions
65
- 'camelcase': ['error', { properties: 'never' }],
66
-
67
- // Enforce consistent error handling
68
- 'no-unused-vars': ['error', {
69
- vars: 'all',
70
- args: 'after-used',
71
- ignoreRestSiblings: true
72
- }],
73
-
74
- // Allow async without await for command handlers
75
- 'require-await': 'off',
76
-
77
- // Enforce consistent return statements
78
- 'consistent-return': 'error',
79
-
80
- // Enforce proper error handling
81
- 'handle-callback-err': 'error',
82
-
83
- // Disallow modifying variables that are declared using const
84
- 'no-const-assign': 'error',
85
-
86
- // Disallow duplicate imports
87
- 'no-duplicate-imports': 'error',
88
-
89
- // Disallow unnecessary escape characters
90
- 'no-useless-escape': 'error',
91
-
92
- // Enforce consistent use of template literals
93
- 'prefer-template': 'error',
94
-
95
- // Enforce consistent use of destructuring
96
- 'prefer-destructuring': ['error', {
97
- array: true,
98
- object: true
99
- }, {
100
- enforceForRenamedProperties: false
101
- }]
102
- },
103
- overrides: [
104
- {
105
- files: ['**/__tests__/**/*.js', '**/*.test.js', '**/*.spec.js'],
106
- env: {
107
- jest: true
108
- },
109
- rules: {
110
- // Allow longer lines in tests for readability
111
- 'max-len': ['error', { code: 150 }],
112
-
113
- // Allow anonymous functions in tests
114
- 'func-names': 'off',
115
-
116
- // Allow magic numbers in tests
117
- 'no-magic-numbers': 'off',
118
-
119
- // Allow nested describe/it blocks
120
- 'max-nested-callbacks': 'off',
121
-
122
- // Allow multiple expectations in tests
123
- 'jest/prefer-expect-assertions': 'off'
124
- }
125
- },
126
- {
127
- files: ['index.js'],
128
- rules: {
129
- // Allow shebang in main CLI file
130
- 'node/shebang': 'off'
131
- }
132
- }
133
- ],
134
- ignorePatterns: [
135
- 'node_modules/',
136
- 'coverage/',
137
- 'dist/',
138
- 'build/',
139
- '*.min.js'
140
- ]
141
- };