@friggframework/devtools 2.0.0--canary.702.d5e6de1.0 → 2.0.0--canary.666.abcf913.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.
Files changed (74) hide show
  1. package/README.md +0 -1
  2. package/frigg-cli/README.md +80 -41
  3. package/frigg-cli/__tests__/unit/commands/deploy.test.js +30 -24
  4. package/frigg-cli/__tests__/unit/commands/doctor.test.js +10 -6
  5. package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +18 -0
  6. package/frigg-cli/__tests__/unit/commands/init.test.js +688 -0
  7. package/frigg-cli/__tests__/unit/commands/install.test.js +601 -341
  8. package/frigg-cli/__tests__/unit/commands/ui.test.js +31 -30
  9. package/frigg-cli/__tests__/unit/dependencies.test.js +6 -2
  10. package/frigg-cli/generate-command/index.js +1 -0
  11. package/frigg-cli/generate-iam-command.js +1 -0
  12. package/frigg-cli/index.js +12 -13
  13. package/frigg-cli/init-command/backend-first-handler.js +377 -512
  14. package/frigg-cli/init-command/deployment-modes.js +7 -0
  15. package/frigg-cli/init-command/index.js +82 -35
  16. package/frigg-cli/init-command/safe-path.js +58 -0
  17. package/frigg-cli/init-command/scaffold-dependencies.js +202 -0
  18. package/frigg-cli/install-command/app-definition.js +174 -0
  19. package/frigg-cli/install-command/commit-changes.js +40 -8
  20. package/frigg-cli/install-command/environment-variables.js +15 -0
  21. package/frigg-cli/install-command/index.js +96 -21
  22. package/frigg-cli/install-command/install-package.js +77 -4
  23. package/frigg-cli/install-command/integration-file.js +20 -11
  24. package/frigg-cli/install-command/resolve-module.js +69 -0
  25. package/frigg-cli/install-command/template.js +102 -75
  26. package/frigg-cli/install-command/validate-package.js +36 -4
  27. package/frigg-cli/package.json +1 -1
  28. package/frigg-cli/templates/backend/README.md +267 -0
  29. package/frigg-cli/templates/backend/env.example +20 -0
  30. package/frigg-cli/templates/backend/gitignore +10 -0
  31. package/frigg-cli/templates/backend/index.js +114 -0
  32. package/frigg-cli/templates/backend/infrastructure.js +20 -0
  33. package/frigg-cli/test/init-command.test.js +9 -2
  34. package/frigg-cli/validate-command/__tests__/validate-app-definition.test.js +123 -6
  35. package/frigg-cli/validate-command/__tests__/validate-command.test.js +21 -0
  36. package/frigg-cli/validate-command/checks/config.js +50 -14
  37. package/frigg-cli/validate-command/format-report.js +2 -4
  38. package/frigg-cli/validate-command/index.js +4 -48
  39. package/frigg-cli/validate-command/load-app-definition.js +17 -5
  40. package/infrastructure/__tests__/management-api-gateway-routes.test.js +281 -0
  41. package/infrastructure/__tests__/postgres-config.test.js +241 -835
  42. package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +148 -0
  43. package/infrastructure/__tests__/template-generation.test.js +36 -8
  44. package/infrastructure/app-definition-schema-contract.test.js +22 -0
  45. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +21 -1
  46. package/infrastructure/domains/database/aurora-builder.js +13 -2
  47. package/infrastructure/domains/database/aurora-builder.test.js +22 -0
  48. package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +12 -8
  49. package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +19 -7
  50. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +12 -8
  51. package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +17 -18
  52. package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +12 -2
  53. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +8 -1
  54. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +4 -2
  55. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +10 -0
  56. package/infrastructure/domains/networking/vpc-builder.js +18 -8
  57. package/infrastructure/domains/networking/vpc-builder.test.js +26 -12
  58. package/infrastructure/domains/security/iam-generator.js +112 -5
  59. package/infrastructure/domains/security/iam-generator.test.js +94 -0
  60. package/infrastructure/domains/shared/cloudformation-discovery.test.js +36 -6
  61. package/infrastructure/domains/shared/utilities/base-definition-factory.js +26 -2
  62. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +34 -1
  63. package/infrastructure/infrastructure-composer.test.js +268 -794
  64. package/infrastructure/scripts/build-prisma-layer.test.js +28 -7
  65. package/infrastructure/scripts/build-time-discovery.test.js +18 -3
  66. package/package.json +10 -8
  67. package/frigg-cli/index.test.js +0 -158
  68. package/frigg-cli/validate-command/__tests__/validate-module-command.test.js +0 -119
  69. package/frigg-cli/validate-command/fixtures/bad-module/index.js +0 -18
  70. package/frigg-cli/validate-command/fixtures/fathom-module/definition.js +0 -76
  71. package/frigg-cli/validate-command/fixtures/fathom-module/index.js +0 -6
  72. package/frigg-cli/validate-command/load-module-definition.js +0 -64
  73. package/frigg-cli/validate-command/validate-module-definition.js +0 -46
  74. package/infrastructure/integration.test.js +0 -381
@@ -94,7 +94,19 @@ describe('Base Definition Factory', () => {
94
94
 
95
95
  expect(result.functions.auth.handler).toBe('node_modules/@friggframework/core/handlers/routers/auth.handler');
96
96
  expect(result.functions.auth.layers).toEqual([{ Ref: 'PrismaLambdaLayer' }]);
97
- expect(result.functions.auth.events).toHaveLength(3);
97
+ expect(
98
+ result.functions.auth.events.map(
99
+ (e) => `${e.httpApi.method} ${e.httpApi.path}`
100
+ )
101
+ ).toEqual([
102
+ 'ANY /api/integrations',
103
+ 'ANY /api/integrations/{proxy+}',
104
+ 'ANY /api/authorize',
105
+ 'ANY /api/entity',
106
+ 'ANY /api/entity/{proxy+}',
107
+ 'ANY /api/entities',
108
+ 'ANY /api/entities/{proxy+}',
109
+ ]);
98
110
  });
99
111
 
100
112
  it('should NOT include legacy dbMigrate function', () => {
@@ -121,6 +133,27 @@ describe('Base Definition Factory', () => {
121
133
  expect(result.resources.Resources.ApiGatewayAlarm5xx).toBeDefined();
122
134
  });
123
135
 
136
+ it('alarms on the HTTP API 5xx metric of the API osls creates', () => {
137
+ // The Frigg functions use `httpApi` events, so osls creates an
138
+ // API Gateway v2 HTTP API (logical ID HttpApi) with only the
139
+ // `$default` stage. HTTP APIs publish `5xx` (REST APIs publish
140
+ // `5XXError`) with the ApiId dimension; a Stage dimension set to
141
+ // the deploy stage name would never match `$default`.
142
+ const result = createBaseDefinition({}, {}, {});
143
+ const usesHttpApi = Object.values(result.functions).some((fn) =>
144
+ (fn.events || []).some((event) => event.httpApi)
145
+ );
146
+ expect(usesHttpApi).toBe(true);
147
+
148
+ const alarm = result.resources.Resources.ApiGatewayAlarm5xx;
149
+ expect(alarm.Properties).toMatchObject({
150
+ Namespace: 'AWS/ApiGateway',
151
+ MetricName: '5xx',
152
+ Dimensions: [{ Name: 'ApiId', Value: { Ref: 'HttpApi' } }],
153
+ AlarmActions: [{ Ref: 'InternalErrorBridgeTopic' }],
154
+ });
155
+ });
156
+
124
157
  it('should include base IAM permissions', () => {
125
158
  const result = createBaseDefinition({}, {}, {});
126
159