@friggframework/devtools 2.0.0-next.60 → 2.0.0-next.62

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 (305) hide show
  1. package/package.json +14 -7
  2. package/.eslintrc.json +0 -3
  3. package/CHANGELOG.md +0 -132
  4. package/infrastructure/ARCHITECTURE.md +0 -487
  5. package/infrastructure/CLAUDE.md +0 -481
  6. package/infrastructure/HEALTH.md +0 -468
  7. package/infrastructure/README.md +0 -522
  8. package/infrastructure/__tests__/fixtures/mock-aws-resources.js +0 -391
  9. package/infrastructure/__tests__/helpers/test-utils.js +0 -277
  10. package/infrastructure/__tests__/postgres-config.test.js +0 -914
  11. package/infrastructure/__tests__/template-generation.test.js +0 -687
  12. package/infrastructure/create-frigg-infrastructure.js +0 -147
  13. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +0 -630
  14. package/infrastructure/docs/PRE-DEPLOYMENT-HEALTH-CHECK-SPEC.md +0 -1317
  15. package/infrastructure/docs/WEBSOCKET-CONFIGURATION.md +0 -105
  16. package/infrastructure/docs/deployment-instructions.md +0 -268
  17. package/infrastructure/docs/generate-iam-command.md +0 -278
  18. package/infrastructure/docs/iam-policy-templates.md +0 -193
  19. package/infrastructure/domains/database/aurora-builder.js +0 -809
  20. package/infrastructure/domains/database/aurora-builder.test.js +0 -950
  21. package/infrastructure/domains/database/aurora-discovery.js +0 -87
  22. package/infrastructure/domains/database/aurora-discovery.test.js +0 -188
  23. package/infrastructure/domains/database/aurora-resolver.js +0 -210
  24. package/infrastructure/domains/database/aurora-resolver.test.js +0 -347
  25. package/infrastructure/domains/database/migration-builder.js +0 -701
  26. package/infrastructure/domains/database/migration-builder.test.js +0 -321
  27. package/infrastructure/domains/database/migration-resolver.js +0 -163
  28. package/infrastructure/domains/database/migration-resolver.test.js +0 -337
  29. package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +0 -164
  30. package/infrastructure/domains/health/application/ports/IResourceDetector.js +0 -129
  31. package/infrastructure/domains/health/application/ports/IResourceImporter.js +0 -142
  32. package/infrastructure/domains/health/application/ports/IStackRepository.js +0 -131
  33. package/infrastructure/domains/health/application/ports/index.js +0 -26
  34. package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +0 -679
  35. package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +0 -167
  36. package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +0 -1130
  37. package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +0 -221
  38. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +0 -152
  39. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +0 -343
  40. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +0 -535
  41. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +0 -376
  42. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +0 -213
  43. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +0 -441
  44. package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +0 -267
  45. package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +0 -324
  46. package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +0 -386
  47. package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +0 -1419
  48. package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +0 -391
  49. package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +0 -551
  50. package/infrastructure/domains/health/domain/entities/issue.js +0 -299
  51. package/infrastructure/domains/health/domain/entities/issue.test.js +0 -528
  52. package/infrastructure/domains/health/domain/entities/property-mismatch.js +0 -108
  53. package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +0 -275
  54. package/infrastructure/domains/health/domain/entities/resource.js +0 -159
  55. package/infrastructure/domains/health/domain/entities/resource.test.js +0 -432
  56. package/infrastructure/domains/health/domain/entities/stack-health-report.js +0 -306
  57. package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +0 -601
  58. package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +0 -380
  59. package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +0 -971
  60. package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +0 -1150
  61. package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +0 -672
  62. package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +0 -496
  63. package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +0 -419
  64. package/infrastructure/domains/health/domain/services/health-score-calculator.js +0 -248
  65. package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +0 -504
  66. package/infrastructure/domains/health/domain/services/import-progress-monitor.js +0 -195
  67. package/infrastructure/domains/health/domain/services/import-template-generator.js +0 -435
  68. package/infrastructure/domains/health/domain/services/logical-id-mapper.js +0 -345
  69. package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +0 -234
  70. package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +0 -431
  71. package/infrastructure/domains/health/domain/services/property-mutability-config.js +0 -382
  72. package/infrastructure/domains/health/domain/services/template-parser.js +0 -245
  73. package/infrastructure/domains/health/domain/services/update-progress-monitor.js +0 -192
  74. package/infrastructure/domains/health/domain/value-objects/health-score.js +0 -138
  75. package/infrastructure/domains/health/domain/value-objects/health-score.test.js +0 -267
  76. package/infrastructure/domains/health/domain/value-objects/property-mutability.js +0 -161
  77. package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +0 -198
  78. package/infrastructure/domains/health/domain/value-objects/resource-state.js +0 -167
  79. package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +0 -196
  80. package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +0 -192
  81. package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +0 -262
  82. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +0 -312
  83. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +0 -367
  84. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +0 -432
  85. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +0 -784
  86. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +0 -1133
  87. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +0 -565
  88. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +0 -554
  89. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +0 -318
  90. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +0 -398
  91. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +0 -777
  92. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +0 -580
  93. package/infrastructure/domains/integration/integration-builder.js +0 -404
  94. package/infrastructure/domains/integration/integration-builder.test.js +0 -690
  95. package/infrastructure/domains/integration/integration-resolver.js +0 -170
  96. package/infrastructure/domains/integration/integration-resolver.test.js +0 -369
  97. package/infrastructure/domains/integration/websocket-builder.js +0 -69
  98. package/infrastructure/domains/integration/websocket-builder.test.js +0 -195
  99. package/infrastructure/domains/networking/vpc-builder.js +0 -2051
  100. package/infrastructure/domains/networking/vpc-builder.test.js +0 -1960
  101. package/infrastructure/domains/networking/vpc-discovery.js +0 -177
  102. package/infrastructure/domains/networking/vpc-discovery.test.js +0 -350
  103. package/infrastructure/domains/networking/vpc-resolver.js +0 -505
  104. package/infrastructure/domains/networking/vpc-resolver.test.js +0 -801
  105. package/infrastructure/domains/parameters/ssm-builder.js +0 -79
  106. package/infrastructure/domains/parameters/ssm-builder.test.js +0 -189
  107. package/infrastructure/domains/parameters/ssm-discovery.js +0 -84
  108. package/infrastructure/domains/parameters/ssm-discovery.test.js +0 -210
  109. package/infrastructure/domains/security/iam-generator.js +0 -816
  110. package/infrastructure/domains/security/iam-generator.test.js +0 -204
  111. package/infrastructure/domains/security/kms-builder.js +0 -415
  112. package/infrastructure/domains/security/kms-builder.test.js +0 -392
  113. package/infrastructure/domains/security/kms-discovery.js +0 -80
  114. package/infrastructure/domains/security/kms-discovery.test.js +0 -177
  115. package/infrastructure/domains/security/kms-resolver.js +0 -96
  116. package/infrastructure/domains/security/kms-resolver.test.js +0 -216
  117. package/infrastructure/domains/security/templates/frigg-deployment-iam-stack.yaml +0 -401
  118. package/infrastructure/domains/security/templates/iam-policy-basic.json +0 -218
  119. package/infrastructure/domains/security/templates/iam-policy-full.json +0 -288
  120. package/infrastructure/domains/shared/base-builder.js +0 -112
  121. package/infrastructure/domains/shared/base-resolver.js +0 -186
  122. package/infrastructure/domains/shared/base-resolver.test.js +0 -305
  123. package/infrastructure/domains/shared/builder-orchestrator.js +0 -212
  124. package/infrastructure/domains/shared/builder-orchestrator.test.js +0 -213
  125. package/infrastructure/domains/shared/cloudformation-discovery-v2.js +0 -334
  126. package/infrastructure/domains/shared/cloudformation-discovery.js +0 -672
  127. package/infrastructure/domains/shared/cloudformation-discovery.test.js +0 -985
  128. package/infrastructure/domains/shared/environment-builder.js +0 -119
  129. package/infrastructure/domains/shared/environment-builder.test.js +0 -247
  130. package/infrastructure/domains/shared/providers/aws-provider-adapter.js +0 -579
  131. package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +0 -416
  132. package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +0 -93
  133. package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +0 -136
  134. package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +0 -82
  135. package/infrastructure/domains/shared/providers/provider-factory.js +0 -108
  136. package/infrastructure/domains/shared/providers/provider-factory.test.js +0 -170
  137. package/infrastructure/domains/shared/resource-discovery.enhanced.test.js +0 -306
  138. package/infrastructure/domains/shared/resource-discovery.js +0 -233
  139. package/infrastructure/domains/shared/resource-discovery.test.js +0 -588
  140. package/infrastructure/domains/shared/types/app-definition.js +0 -205
  141. package/infrastructure/domains/shared/types/discovery-result.js +0 -106
  142. package/infrastructure/domains/shared/types/discovery-result.test.js +0 -258
  143. package/infrastructure/domains/shared/types/index.js +0 -46
  144. package/infrastructure/domains/shared/types/resource-ownership.js +0 -108
  145. package/infrastructure/domains/shared/types/resource-ownership.test.js +0 -101
  146. package/infrastructure/domains/shared/utilities/base-definition-factory.js +0 -394
  147. package/infrastructure/domains/shared/utilities/base-definition-factory.js.bak +0 -338
  148. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +0 -291
  149. package/infrastructure/domains/shared/utilities/handler-path-resolver.js +0 -134
  150. package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +0 -268
  151. package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +0 -159
  152. package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +0 -444
  153. package/infrastructure/domains/shared/validation/env-validator.js +0 -78
  154. package/infrastructure/domains/shared/validation/env-validator.test.js +0 -173
  155. package/infrastructure/domains/shared/validation/plugin-validator.js +0 -187
  156. package/infrastructure/domains/shared/validation/plugin-validator.test.js +0 -323
  157. package/infrastructure/esbuild.config.js +0 -53
  158. package/infrastructure/index.js +0 -4
  159. package/infrastructure/infrastructure-composer.js +0 -117
  160. package/infrastructure/infrastructure-composer.test.js +0 -1895
  161. package/infrastructure/integration.test.js +0 -383
  162. package/infrastructure/scripts/build-prisma-layer.js +0 -701
  163. package/infrastructure/scripts/build-prisma-layer.test.js +0 -170
  164. package/infrastructure/scripts/build-time-discovery.js +0 -238
  165. package/infrastructure/scripts/build-time-discovery.test.js +0 -379
  166. package/infrastructure/scripts/run-discovery.js +0 -110
  167. package/infrastructure/scripts/verify-prisma-layer.js +0 -72
  168. package/layers/prisma/.build-complete +0 -3
  169. package/layers/prisma/nodejs/package.json +0 -8
  170. package/management-ui/.eslintrc.js +0 -22
  171. package/management-ui/components.json +0 -21
  172. package/management-ui/docs/phase2-integration-guide.md +0 -320
  173. package/management-ui/index.html +0 -13
  174. package/management-ui/package.json +0 -76
  175. package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +0 -302
  176. package/management-ui/postcss.config.js +0 -6
  177. package/management-ui/server/api/backend.js +0 -256
  178. package/management-ui/server/api/cli.js +0 -315
  179. package/management-ui/server/api/codegen.js +0 -663
  180. package/management-ui/server/api/connections.js +0 -857
  181. package/management-ui/server/api/discovery.js +0 -185
  182. package/management-ui/server/api/environment/index.js +0 -1
  183. package/management-ui/server/api/environment/router.js +0 -378
  184. package/management-ui/server/api/environment.js +0 -328
  185. package/management-ui/server/api/integrations.js +0 -876
  186. package/management-ui/server/api/logs.js +0 -248
  187. package/management-ui/server/api/monitoring.js +0 -282
  188. package/management-ui/server/api/open-ide.js +0 -31
  189. package/management-ui/server/api/project.js +0 -1029
  190. package/management-ui/server/api/users/sessions.js +0 -371
  191. package/management-ui/server/api/users/simulation.js +0 -254
  192. package/management-ui/server/api/users.js +0 -362
  193. package/management-ui/server/api-contract.md +0 -275
  194. package/management-ui/server/index.js +0 -873
  195. package/management-ui/server/middleware/errorHandler.js +0 -93
  196. package/management-ui/server/middleware/security.js +0 -32
  197. package/management-ui/server/processManager.js +0 -296
  198. package/management-ui/server/server.js +0 -346
  199. package/management-ui/server/services/aws-monitor.js +0 -413
  200. package/management-ui/server/services/npm-registry.js +0 -347
  201. package/management-ui/server/services/template-engine.js +0 -538
  202. package/management-ui/server/utils/cliIntegration.js +0 -220
  203. package/management-ui/server/utils/environment/auditLogger.js +0 -471
  204. package/management-ui/server/utils/environment/awsParameterStore.js +0 -275
  205. package/management-ui/server/utils/environment/encryption.js +0 -278
  206. package/management-ui/server/utils/environment/envFileManager.js +0 -286
  207. package/management-ui/server/utils/import-commonjs.js +0 -28
  208. package/management-ui/server/utils/response.js +0 -83
  209. package/management-ui/server/websocket/handler.js +0 -325
  210. package/management-ui/src/App.jsx +0 -25
  211. package/management-ui/src/assets/FriggLogo.svg +0 -1
  212. package/management-ui/src/components/AppRouter.jsx +0 -65
  213. package/management-ui/src/components/Button.jsx +0 -70
  214. package/management-ui/src/components/Card.jsx +0 -97
  215. package/management-ui/src/components/EnvironmentCompare.jsx +0 -400
  216. package/management-ui/src/components/EnvironmentEditor.jsx +0 -372
  217. package/management-ui/src/components/EnvironmentImportExport.jsx +0 -469
  218. package/management-ui/src/components/EnvironmentSchema.jsx +0 -491
  219. package/management-ui/src/components/EnvironmentSecurity.jsx +0 -463
  220. package/management-ui/src/components/ErrorBoundary.jsx +0 -73
  221. package/management-ui/src/components/IntegrationCard.jsx +0 -481
  222. package/management-ui/src/components/IntegrationCardEnhanced.jsx +0 -770
  223. package/management-ui/src/components/IntegrationExplorer.jsx +0 -379
  224. package/management-ui/src/components/IntegrationStatus.jsx +0 -336
  225. package/management-ui/src/components/Layout.jsx +0 -716
  226. package/management-ui/src/components/LoadingSpinner.jsx +0 -113
  227. package/management-ui/src/components/RepositoryPicker.jsx +0 -248
  228. package/management-ui/src/components/SessionMonitor.jsx +0 -350
  229. package/management-ui/src/components/StatusBadge.jsx +0 -208
  230. package/management-ui/src/components/UserContextSwitcher.jsx +0 -212
  231. package/management-ui/src/components/UserSimulation.jsx +0 -327
  232. package/management-ui/src/components/Welcome.jsx +0 -434
  233. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +0 -637
  234. package/management-ui/src/components/codegen/APIModuleSelector.jsx +0 -227
  235. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +0 -247
  236. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +0 -316
  237. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +0 -271
  238. package/management-ui/src/components/codegen/FormBuilder.jsx +0 -737
  239. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +0 -855
  240. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +0 -797
  241. package/management-ui/src/components/codegen/SchemaBuilder.jsx +0 -303
  242. package/management-ui/src/components/codegen/TemplateSelector.jsx +0 -586
  243. package/management-ui/src/components/codegen/index.js +0 -10
  244. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +0 -362
  245. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +0 -182
  246. package/management-ui/src/components/connections/ConnectionTester.jsx +0 -200
  247. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +0 -292
  248. package/management-ui/src/components/connections/OAuthFlow.jsx +0 -204
  249. package/management-ui/src/components/connections/index.js +0 -5
  250. package/management-ui/src/components/index.js +0 -21
  251. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +0 -222
  252. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +0 -169
  253. package/management-ui/src/components/monitoring/MetricsChart.jsx +0 -197
  254. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +0 -393
  255. package/management-ui/src/components/monitoring/SQSMetrics.jsx +0 -246
  256. package/management-ui/src/components/monitoring/index.js +0 -6
  257. package/management-ui/src/components/monitoring/monitoring.css +0 -218
  258. package/management-ui/src/components/theme-provider.jsx +0 -52
  259. package/management-ui/src/components/theme-toggle.jsx +0 -39
  260. package/management-ui/src/components/ui/badge.tsx +0 -36
  261. package/management-ui/src/components/ui/button.test.jsx +0 -56
  262. package/management-ui/src/components/ui/button.tsx +0 -57
  263. package/management-ui/src/components/ui/card.tsx +0 -76
  264. package/management-ui/src/components/ui/dropdown-menu.tsx +0 -199
  265. package/management-ui/src/components/ui/select.tsx +0 -157
  266. package/management-ui/src/components/ui/skeleton.jsx +0 -15
  267. package/management-ui/src/hooks/useFrigg.jsx +0 -387
  268. package/management-ui/src/hooks/useSocket.jsx +0 -58
  269. package/management-ui/src/index.css +0 -193
  270. package/management-ui/src/lib/utils.ts +0 -6
  271. package/management-ui/src/main.jsx +0 -10
  272. package/management-ui/src/pages/CodeGeneration.jsx +0 -14
  273. package/management-ui/src/pages/Connections.jsx +0 -252
  274. package/management-ui/src/pages/ConnectionsEnhanced.jsx +0 -633
  275. package/management-ui/src/pages/Dashboard.jsx +0 -311
  276. package/management-ui/src/pages/Environment.jsx +0 -314
  277. package/management-ui/src/pages/IntegrationConfigure.jsx +0 -669
  278. package/management-ui/src/pages/IntegrationDiscovery.jsx +0 -567
  279. package/management-ui/src/pages/IntegrationTest.jsx +0 -742
  280. package/management-ui/src/pages/Integrations.jsx +0 -253
  281. package/management-ui/src/pages/Monitoring.jsx +0 -17
  282. package/management-ui/src/pages/Simulation.jsx +0 -155
  283. package/management-ui/src/pages/Users.jsx +0 -492
  284. package/management-ui/src/services/api.js +0 -41
  285. package/management-ui/src/services/apiModuleService.js +0 -193
  286. package/management-ui/src/services/websocket-handlers.js +0 -120
  287. package/management-ui/src/test/api/project.test.js +0 -273
  288. package/management-ui/src/test/components/Welcome.test.jsx +0 -378
  289. package/management-ui/src/test/mocks/server.js +0 -178
  290. package/management-ui/src/test/setup.js +0 -61
  291. package/management-ui/src/test/utils/test-utils.jsx +0 -134
  292. package/management-ui/src/utils/repository.js +0 -98
  293. package/management-ui/src/utils/repository.test.js +0 -118
  294. package/management-ui/src/workflows/phase2-integration-workflows.js +0 -884
  295. package/management-ui/tailwind.config.js +0 -63
  296. package/management-ui/tsconfig.json +0 -37
  297. package/management-ui/tsconfig.node.json +0 -10
  298. package/management-ui/vite.config.js +0 -26
  299. package/management-ui/vitest.config.js +0 -38
  300. package/test/auther-definition-method-tester.js +0 -45
  301. package/test/index.js +0 -9
  302. package/test/integration-validator.js +0 -2
  303. package/test/mock-api-readme.md +0 -102
  304. package/test/mock-api.js +0 -284
  305. package/test/mock-integration.js +0 -78
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0-next.60",
4
+ "version": "2.0.0-next.62",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
8
+ "files": [
9
+ "frigg-cli/",
10
+ "migrations/",
11
+ "management-ui/dist/",
12
+ "index.js",
13
+ "README.md"
14
+ ],
8
15
  "dependencies": {
9
16
  "@aws-sdk/client-cloudformation": "^3.705.0",
10
17
  "@aws-sdk/client-ec2": "^3.835.0",
@@ -16,9 +23,9 @@
16
23
  "@babel/eslint-parser": "^7.18.9",
17
24
  "@babel/parser": "^7.25.3",
18
25
  "@babel/traverse": "^7.25.3",
19
- "@friggframework/core": "2.0.0-next.60",
20
- "@friggframework/schemas": "2.0.0-next.60",
21
- "@friggframework/test": "2.0.0-next.60",
26
+ "@friggframework/core": "2.0.0-next.62",
27
+ "@friggframework/schemas": "2.0.0-next.62",
28
+ "@friggframework/test": "2.0.0-next.62",
22
29
  "@hapi/boom": "^10.0.1",
23
30
  "@inquirer/prompts": "^5.3.8",
24
31
  "axios": "^1.7.2",
@@ -46,8 +53,8 @@
46
53
  "validate-npm-package-name": "^5.0.0"
47
54
  },
48
55
  "devDependencies": {
49
- "@friggframework/eslint-config": "2.0.0-next.60",
50
- "@friggframework/prettier-config": "2.0.0-next.60",
56
+ "@friggframework/eslint-config": "2.0.0-next.62",
57
+ "@friggframework/prettier-config": "2.0.0-next.62",
51
58
  "aws-sdk-client-mock": "^4.1.0",
52
59
  "aws-sdk-client-mock-jest": "^4.1.0",
53
60
  "jest": "^30.1.3",
@@ -79,5 +86,5 @@
79
86
  "publishConfig": {
80
87
  "access": "public"
81
88
  },
82
- "gitHead": "8fc85a629bedc7b17a9415ef8952dddb1daee1b5"
89
+ "gitHead": "adce695c05836d713b88b959f1eae62c0a7ce729"
83
90
  }
package/.eslintrc.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "@friggframework/eslint-config"
3
- }
package/CHANGELOG.md DELETED
@@ -1,132 +0,0 @@
1
- # v1.2.0 (Tue Aug 06 2024)
2
-
3
- #### 🚀 Enhancement
4
-
5
- - CLI for Frigg - Install command for now [#322](https://github.com/friggframework/frigg/pull/322) ([@seanspeaks](https://github.com/seanspeaks))
6
-
7
- #### 🐛 Bug Fix
8
-
9
- - Add READMEs that will need updating, but for version releasing [#324](https://github.com/friggframework/frigg/pull/324) ([@seanspeaks](https://github.com/seanspeaks))
10
- - Add READMEs that will need updating, but for version releasing ([@seanspeaks](https://github.com/seanspeaks))
11
- - small update to integration testing / tooling [#304](https://github.com/friggframework/frigg/pull/304) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
12
- - Added missing dependencies ([@seanspeaks](https://github.com/seanspeaks))
13
- - Added a missing dependency ([@seanspeaks](https://github.com/seanspeaks))
14
- - Updated to handle envs properly, also further refactoring, and better templating. ([@seanspeaks](https://github.com/seanspeaks))
15
- - WIP with help from Tabnine AI chat. ([@seanspeaks](https://github.com/seanspeaks))
16
- - Bump version to: v1.1.8 \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
17
- - use the factory methods for creating the mock integration so that everything is set up (mostly events and userActions) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
18
- - Bump version to: v1.1.5 \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
19
-
20
- #### Authors: 2
21
-
22
- - [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
23
- - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
24
-
25
- ---
26
-
27
- # v1.1.8 (Thu Jul 18 2024)
28
-
29
- #### 🐛 Bug Fix
30
-
31
- - Revert open to support commonjs [#319](https://github.com/friggframework/frigg/pull/319) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
32
- - Bump version to: v1.1.6 \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
33
-
34
- #### Authors: 2
35
-
36
- - [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
37
- - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
38
-
39
- ---
40
-
41
- # v1.1.7 (Mon Jul 15 2024)
42
-
43
- #### 🐛 Bug Fix
44
-
45
- - getAuthorizationRequirements() async [#318](https://github.com/friggframework/frigg/pull/318) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
46
- - await getAuthorizeRequirements() ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
47
- - Bump version to: v1.1.6 \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
48
-
49
- #### Authors: 2
50
-
51
- - [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
52
- - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
53
-
54
- ---
55
-
56
- # v1.1.6 (Fri Apr 26 2024)
57
-
58
- #### 🐛 Bug Fix
59
-
60
- - Small fix to validation errors and cleanup [#307](https://github.com/friggframework/frigg/pull/307) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
61
- - also cleanup devtools since all versions will bump ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
62
- - Bump version to: v1.1.5 \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
63
-
64
- #### Authors: 2
65
-
66
- - [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
67
- - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
68
-
69
- ---
70
-
71
- # v1.1.5 (Tue Apr 09 2024)
72
-
73
- #### 🐛 Bug Fix
74
-
75
- - update router to include options and refresh [#301](https://github.com/friggframework/frigg/pull/301) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
76
- - Bump version to: v1.1.4 \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
77
- - Bump version to: v1.1.3 \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
78
-
79
- #### Authors: 2
80
-
81
- - [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
82
- - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
83
-
84
- ---
85
-
86
- # v2.0.0 (Sat Mar 30 2024)
87
-
88
- #### 💥 Breaking Change
89
-
90
- - revert HEAD to a corrected v1-connectwise release [#283](https://github.com/friggframework/frigg/pull/283) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
91
-
92
- #### 🚀 Enhancement
93
-
94
- - Package redo [#294](https://github.com/friggframework/frigg/pull/294) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
95
-
96
- #### 🐛 Bug Fix
97
-
98
- - delete all node_modules and regenerate lock file to potentially address known bug ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
99
- - add back the direct dependency on eslint as this might be leading to a deploy issue ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
100
- - create test, eslint-config and prettier-config packages as base shared dependencies ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
101
- - slight fix to mock integration module instantiation [#290](https://github.com/friggframework/frigg/pull/290) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
102
- - slight fix to mock integration module instantiation ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
103
- - Publish ([@seanspeaks](https://github.com/seanspeaks))
104
- - Bump node and npm version for the whole repo (Fix CI) [#274](https://github.com/friggframework/frigg/pull/274) ([@seanspeaks](https://github.com/seanspeaks))
105
- - Revert main to last release [#284](https://github.com/friggframework/frigg/pull/284) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
106
- - Revert "set test environment STAGE to dev" ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
107
- - Add stage to test env [#282](https://github.com/friggframework/frigg/pull/282) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
108
- - set test environment STAGE to dev ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
109
- - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
110
-
111
- #### Authors: 2
112
-
113
- - [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
114
- - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
115
-
116
- ---
117
-
118
- # v1.1.0 (Wed Mar 20 2024)
119
-
120
- #### 🚀 Enhancement
121
-
122
-
123
- #### 🐛 Bug Fix
124
-
125
- - correct some bad automated edits, though they are not in relevant files ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
126
-
127
- #### Authors: 4
128
-
129
- - [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
130
- - Nicolas Leal ([@nicolasmelo1](https://github.com/nicolasmelo1))
131
- - nmilcoff ([@nmilcoff](https://github.com/nmilcoff))
132
- - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
@@ -1,487 +0,0 @@
1
- # Frigg Infrastructure Architecture
2
-
3
- This document describes the Domain-Driven Design (DDD) and Hexagonal Architecture patterns used in the Frigg infrastructure system.
4
-
5
- ## Architecture Overview
6
-
7
- The infrastructure system follows **Hexagonal Architecture** (Ports & Adapters) with **Domain-Driven Design** principles to create a clean, testable, and extensible codebase.
8
-
9
- ### Core Principles
10
-
11
- 1. **Domain-Driven Design**: Infrastructure organized by business domains (database, networking, security, etc.)
12
- 2. **Hexagonal Architecture**: Clear separation between core logic and external dependencies
13
- 3. **Dependency Injection**: All external dependencies injected through interfaces
14
- 4. **Testability**: Easy to mock and test in isolation
15
- 5. **Multi-Cloud Ready**: Provider abstraction layer for AWS, GCP, Azure support
16
-
17
- ## Directory Structure
18
-
19
- ```
20
- infrastructure/
21
- ├── infrastructure-composer.js (85 lines) - Main orchestrator
22
-
23
- ├── domains/
24
- │ ├── database/
25
- │ │ ├── aurora-builder.js # Aurora RDS infrastructure
26
- │ │ ├── aurora-resolver.js # Ownership decisions
27
- │ │ ├── migration-builder.js # Database migrations
28
- │ │ └── migration-resolver.js # Migration ownership
29
- │ │
30
- │ ├── integration/
31
- │ │ ├── integration-builder.js # Integration queues & functions
32
- │ │ ├── integration-resolver.js # Queue ownership decisions
33
- │ │ └── websocket-builder.js # WebSocket API Gateway
34
- │ │
35
- │ ├── networking/
36
- │ │ ├── vpc-builder.js # VPC infrastructure
37
- │ │ └── vpc-resolver.js # VPC ownership decisions
38
- │ │
39
- │ ├── security/
40
- │ │ ├── kms-builder.js # KMS encryption keys
41
- │ │ ├── kms-resolver.js # KMS ownership decisions
42
- │ │ └── iam-generator.js # IAM policy generation
43
- │ │
44
- │ ├── parameters/
45
- │ │ └── ssm-builder.js # SSM Parameter Store
46
- │ │
47
- │ └── shared/
48
- │ ├── base-builder.js # Abstract builder base class
49
- │ ├── base-resolver.js # Abstract resolver base class
50
- │ ├── builder-orchestrator.js # Builder execution coordination
51
- │ ├── resource-discovery.js # AWS resource discovery
52
- │ │
53
- │ ├── providers/ # Multi-cloud abstraction
54
- │ │ ├── cloud-provider-adapter.js
55
- │ │ ├── provider-factory.js
56
- │ │ ├── aws-provider-adapter.js
57
- │ │ ├── gcp-provider-adapter.stub.js
58
- │ │ └── azure-provider-adapter.stub.js
59
- │ │
60
- │ ├── types/ # Shared type definitions
61
- │ │ ├── discovery-result.js
62
- │ │ └── resource-ownership.js
63
- │ │
64
- │ └── utilities/
65
- │ ├── handler-path-resolver.js
66
- │ ├── base-definition-factory.js
67
- │ └── prisma-layer-manager.js
68
- ```
69
-
70
- ## Ownership-Based Architecture
71
-
72
- All infrastructure builders follow an **ownership-based pattern** that supports three modes:
73
-
74
- ### Resource Ownership Modes
75
-
76
- 1. **STACK** - Create resources in CloudFormation stack (default for new deployments)
77
- 2. **EXTERNAL** - Use existing resources outside the stack (user-provided IDs)
78
- 3. **AUTO** - Intelligent decision based on resource discovery
79
-
80
- ### Architecture Layers
81
-
82
- ```
83
- ┌─────────────────────────────────────────────────────────┐
84
- │ Builder (Orchestration) │
85
- │ - Calls resolver for ownership decisions │
86
- │ - Creates CloudFormation resources based on decisions │
87
- │ - Generates serverless template configuration │
88
- └────────────────┬────────────────────────────────────────┘
89
- │ calls
90
- ┌────────────────▼────────────────────────────────────────┐
91
- │ Resolver (Decision Making) │
92
- │ - Analyzes discovery results │
93
- │ - Applies user intent (ownership configuration) │
94
- │ - Returns ownership decisions for each resource │
95
- └────────────────┬────────────────────────────────────────┘
96
- │ uses
97
- ┌────────────────▼────────────────────────────────────────┐
98
- │ Discovery (Facts) │
99
- │ - Reports what exists in CloudFormation stack │
100
- │ - Reports what exists via AWS API │
101
- │ - No decisions, just facts │
102
- └─────────────────────────────────────────────────────────┘
103
- ```
104
-
105
- ### Example: Aurora Builder Flow
106
-
107
- ```javascript
108
- // 1. Builder calls resolver
109
- const resolver = new AuroraResourceResolver();
110
- const decisions = resolver.resolveAll(appDefinition, discovery);
111
-
112
- // 2. Resolver returns ownership decisions
113
- {
114
- cluster: {
115
- ownership: 'STACK',
116
- physicalId: null,
117
- reason: 'No existing cluster found - will create in stack'
118
- },
119
- securityGroup: {
120
- ownership: 'EXTERNAL',
121
- physicalId: 'sg-12345',
122
- reason: 'Using existing VPC security group'
123
- }
124
- }
125
-
126
- // 3. Builder creates resources based on decisions
127
- if (decisions.cluster.ownership === 'STACK') {
128
- createAuroraCluster(result);
129
- } else {
130
- useExternalCluster(decisions.cluster.physicalId, result);
131
- }
132
- ```
133
-
134
- ### CloudFormation Idempotency
135
-
136
- When resources exist in the stack, builders include them in the template for **idempotent deployments**:
137
-
138
- ```javascript
139
- // Resource exists in stack with ID: cluster-abc123
140
- decisions.cluster = {
141
- ownership: 'STACK',
142
- physicalId: 'cluster-abc123',
143
- reason: 'Found in stack - will include definition (idempotent)'
144
- };
145
-
146
- // Builder includes definition - CloudFormation won't recreate
147
- result.resources.AuroraCluster = {
148
- Type: 'AWS::RDS::DBCluster',
149
- Properties: { ... }
150
- };
151
- ```
152
-
153
- This ensures resources aren't deleted when removed from template.
154
-
155
- ## Completed Builders (Ownership-Based)
156
-
157
- | Builder | Resolver | CloudFormation Resources | Status |
158
- |---------|----------|--------------------------|--------|
159
- | **Aurora Builder** | AuroraResourceResolver | RDS Cluster, Security Groups | ✅ Complete |
160
- | **KMS Builder** | KmsResourceResolver | KMS Keys | ✅ Complete |
161
- | **Migration Builder** | MigrationResourceResolver | S3 Bucket, SQS Queue | ✅ Complete |
162
- | **Integration Builder** | IntegrationResourceResolver | SQS Queues (per-integration), InternalErrorQueue | ✅ Complete |
163
- | **VPC Builder** | VpcResourceResolver | VPC, Subnets, Security Groups | ✅ Complete |
164
-
165
- ## Builder Patterns
166
-
167
- ### Builder Responsibilities
168
-
169
- ```javascript
170
- class InfrastructureBuilder {
171
- // Determine if builder should execute
172
- shouldExecute(appDefinition): boolean
173
-
174
- // Validate app definition
175
- validate(appDefinition): ValidationResult
176
-
177
- // Build infrastructure
178
- async build(appDefinition, discovery): BuildResult
179
-
180
- // Declare dependencies on other builders
181
- getDependencies(): string[]
182
- }
183
- ```
184
-
185
- ### BuildResult Structure
186
-
187
- ```javascript
188
- {
189
- functions: {
190
- // Lambda function definitions (serverless template)
191
- myFunction: {
192
- handler: 'path/to/handler',
193
- events: [...]
194
- }
195
- },
196
- resources: {
197
- // CloudFormation resources
198
- MyResource: {
199
- Type: 'AWS::Service::Resource',
200
- Properties: { ... }
201
- }
202
- },
203
- environment: {
204
- // Environment variables for Lambda
205
- MY_VAR: { Ref: 'MyResource' }
206
- },
207
- iamStatements: [
208
- // IAM permissions
209
- { Effect: 'Allow', Action: [...], Resource: [...] }
210
- ],
211
- custom: {
212
- // Custom serverless.yml properties
213
- }
214
- }
215
- ```
216
-
217
- ## Resolver Patterns
218
-
219
- ### Resolver Responsibilities
220
-
221
- ```javascript
222
- class BaseResourceResolver {
223
- // Make ownership decisions for all resources
224
- resolveAll(appDefinition, discovery): Decisions
225
-
226
- // Helper: Find resource in CloudFormation stack
227
- findInStack(logicalId, discovery): Resource
228
-
229
- // Helper: Find external resource
230
- findExternal(resourceType, discovery): Resource
231
-
232
- // Helper: Check if resource is in stack
233
- isInStack(logicalId, discovery): boolean
234
-
235
- // Create decision objects
236
- createStackDecision(physicalId, reason): Decision
237
- createExternalDecision(physicalId, reason): Decision
238
- }
239
- ```
240
-
241
- ### Decision Structure
242
-
243
- ```javascript
244
- {
245
- ownership: 'STACK' | 'EXTERNAL',
246
- physicalId: 'resource-id' | null,
247
- reason: 'Human-readable explanation',
248
- metadata: {
249
- logicalId: 'CloudFormationLogicalId',
250
- resourceType: 'AWS::Service::Resource',
251
- userIntent: 'stack' | 'external' | 'auto',
252
- source: 'discovered' | 'new' | 'user-provided'
253
- }
254
- }
255
- ```
256
-
257
- ## Discovery System
258
-
259
- ### Discovery Result Structure
260
-
261
- ```javascript
262
- {
263
- // Resources in OUR CloudFormation stack
264
- stackManaged: [
265
- {
266
- logicalId: 'AuroraCluster',
267
- physicalId: 'cluster-abc123',
268
- resourceType: 'AWS::RDS::DBCluster'
269
- }
270
- ],
271
-
272
- // Resources outside our stack
273
- external: [
274
- {
275
- physicalId: 'vpc-xyz789',
276
- resourceType: 'AWS::EC2::VPC',
277
- source: 'aws-api'
278
- }
279
- ],
280
-
281
- // Stack metadata
282
- fromCloudFormation: true,
283
- stackName: 'my-app-prod',
284
- region: 'us-east-1'
285
- }
286
- ```
287
-
288
- ### Discovery Sources
289
-
290
- 1. **CloudFormation Stack** - Primary source for stack-managed resources
291
- 2. **AWS API Discovery** - Fallback for resources outside stack
292
- 3. **User Configuration** - Explicit resource IDs in app definition
293
-
294
- ## Multi-Cloud Provider Abstraction
295
-
296
- ### Provider Interface
297
-
298
- ```javascript
299
- class CloudProviderAdapter {
300
- async discoverVpc(config)
301
- async discoverKmsKeys(tags)
302
- async discoverRdsInstances(tags)
303
- async discoverSecurityGroups(vpcId)
304
- async describeStack(stackName)
305
- }
306
- ```
307
-
308
- ### Implemented Providers
309
-
310
- - **AWS** (✅ Complete) - Full implementation with lazy-loaded SDK
311
- - **GCP** (🔜 Stub) - Interface documented for future implementation
312
- - **Azure** (🔜 Stub) - Interface documented for future implementation
313
-
314
- ## Testing Strategy
315
-
316
- ### Builder Testing
317
-
318
- ```javascript
319
- describe('AuroraBuilder', () => {
320
- it('creates cluster when ownership=STACK', async () => {
321
- const builder = new AuroraBuilder();
322
- const result = await builder.build(appDef, discovery);
323
-
324
- expect(result.resources.AuroraCluster).toBeDefined();
325
- expect(result.resources.AuroraCluster.Type).toBe('AWS::RDS::DBCluster');
326
- });
327
- });
328
- ```
329
-
330
- ### Resolver Testing
331
-
332
- ```javascript
333
- describe('AuroraResourceResolver', () => {
334
- it('decides STACK when no cluster exists', () => {
335
- const resolver = new AuroraResourceResolver();
336
- const decisions = resolver.resolveAll(appDef, emptyDiscovery);
337
-
338
- expect(decisions.cluster.ownership).toBe('STACK');
339
- expect(decisions.cluster.physicalId).toBeNull();
340
- });
341
-
342
- it('decides EXTERNAL when user provides cluster ID', () => {
343
- const appDef = {
344
- database: {
345
- aurora: {
346
- ownership: { cluster: 'external' },
347
- external: { clusterId: 'cluster-123' }
348
- }
349
- }
350
- };
351
-
352
- const decisions = resolver.resolveAll(appDef, discovery);
353
-
354
- expect(decisions.cluster.ownership).toBe('EXTERNAL');
355
- expect(decisions.cluster.physicalId).toBe('cluster-123');
356
- });
357
- });
358
- ```
359
-
360
- ## Benefits of This Architecture
361
-
362
- ### 1. Separation of Concerns
363
- - **Discovery** reports facts (what exists)
364
- - **Resolvers** make decisions (ownership)
365
- - **Builders** create infrastructure (CloudFormation)
366
-
367
- ### 2. Testability
368
- - Mock resolvers for builder tests
369
- - Mock discovery for resolver tests
370
- - No need to mock AWS SDK directly
371
-
372
- ### 3. Flexibility
373
- - Support both stack-managed and external resources
374
- - Easy to add new ownership modes
375
- - User can override automatic decisions
376
-
377
- ### 4. Idempotency
378
- - Safe to deploy multiple times
379
- - Resources in stack aren't deleted
380
- - Changes only when definitions change
381
-
382
- ### 5. Multi-Cloud Ready
383
- - Provider abstraction layer
384
- - Same patterns across clouds
385
- - Easy to add new providers
386
-
387
- ## Usage Examples
388
-
389
- ### Example 1: New Deployment (AUTO mode)
390
-
391
- ```javascript
392
- const appDefinition = {
393
- name: 'my-app',
394
- database: { aurora: { enable: true } },
395
- encryption: { useDefaultKMSForFieldLevelEncryption: true }
396
- };
397
-
398
- // Discovery finds nothing
399
- const discovery = { stackManaged: [], external: [] };
400
-
401
- // Resolvers decide to create everything in stack
402
- // Builders create CloudFormation resources
403
- // Result: Complete new infrastructure
404
- ```
405
-
406
- ### Example 2: Use Existing VPC (EXTERNAL mode)
407
-
408
- ```javascript
409
- const appDefinition = {
410
- name: 'my-app',
411
- vpc: {
412
- enable: true,
413
- ownership: { vpc: 'external' },
414
- external: {
415
- vpcId: 'vpc-12345',
416
- securityGroupIds: ['sg-67890']
417
- }
418
- }
419
- };
420
-
421
- // Resolver uses external VPC
422
- // Builder references external VPC (no creation)
423
- // Result: Lambda functions in existing VPC
424
- ```
425
-
426
- ### Example 3: Update Existing Stack (AUTO mode)
427
-
428
- ```javascript
429
- // Discovery finds existing stack resources
430
- const discovery = {
431
- stackManaged: [
432
- { logicalId: 'AuroraCluster', physicalId: 'cluster-abc' },
433
- { logicalId: 'KmsKey', physicalId: 'key-xyz' }
434
- ]
435
- };
436
-
437
- // Resolvers decide to keep in stack
438
- // Builders include definitions (idempotent)
439
- // Result: Safe deployment, no resource deletion
440
- ```
441
-
442
- ## Architecture Metrics
443
-
444
- | Metric | Before Refactor | After Refactor | Improvement |
445
- |--------|-----------------|----------------|-------------|
446
- | **Main File Size** | 506 lines | 85 lines | 83% reduction |
447
- | **Largest File** | 1,700 lines | <200 lines | 88% reduction |
448
- | **Test Coverage** | Partial | Comprehensive | +350 tests |
449
- | **Domains** | None | 5 clear domains | Better organization |
450
- | **Testability** | Difficult | Easy | DI + mocks |
451
- | **Cloud Support** | AWS only | Multi-cloud ready | Future-proof |
452
-
453
- ## Key Design Decisions
454
-
455
- ### Why Ownership-Based?
456
-
457
- 1. **Flexibility** - Support both greenfield and brownfield deployments
458
- 2. **Safety** - Prevent accidental resource deletion
459
- 3. **User Control** - Let users choose stack vs. external
460
- 4. **Idempotency** - Safe repeated deployments
461
-
462
- ### Why Separate Resolvers?
463
-
464
- 1. **Single Responsibility** - Builders orchestrate, resolvers decide
465
- 2. **Testability** - Test decisions independently from creation
466
- 3. **Reusability** - Same resolver logic across builders
467
- 4. **Clarity** - Clear separation of concerns
468
-
469
- ### Why Hexagonal Architecture?
470
-
471
- 1. **Testability** - Easy to mock external dependencies
472
- 2. **Flexibility** - Swap implementations without changing core
473
- 3. **Multi-Cloud** - Provider abstraction natural fit
474
- 4. **Maintainability** - Clear boundaries and responsibilities
475
-
476
- ## Future Enhancements
477
-
478
- - [ ] GCP provider implementation
479
- - [ ] Azure provider implementation
480
- - [ ] Enhanced resource discovery (tags, filters)
481
- - [ ] Cost estimation before deployment
482
- - [ ] Dependency graph visualization
483
- - [ ] Automated rollback on failure
484
-
485
- ---
486
-
487
- **This architecture transformation took monolithic infrastructure code and created a clean, testable, extensible system following industry best practices for Domain-Driven Design and Hexagonal Architecture.**