@friggframework/devtools 2.0.0--canary.667.f74cf3b.0 → 2.0.0--canary.710.7cfcf12.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.
- package/frigg-cli/README.md +77 -30
- package/frigg-cli/__tests__/unit/commands/deploy.test.js +30 -24
- package/frigg-cli/__tests__/unit/commands/doctor.test.js +10 -6
- package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +18 -0
- package/frigg-cli/__tests__/unit/commands/init.test.js +688 -0
- package/frigg-cli/__tests__/unit/commands/install.test.js +601 -341
- package/frigg-cli/__tests__/unit/commands/ui.test.js +31 -30
- package/frigg-cli/__tests__/unit/dependencies.test.js +6 -2
- package/frigg-cli/generate-command/index.js +1 -0
- package/frigg-cli/generate-iam-command.js +1 -0
- package/frigg-cli/index.js +9 -4
- package/frigg-cli/init-command/backend-first-handler.js +397 -554
- package/frigg-cli/init-command/deployment-modes.js +7 -0
- package/frigg-cli/init-command/index.js +82 -35
- package/frigg-cli/init-command/safe-path.js +58 -0
- package/frigg-cli/init-command/scaffold-dependencies.js +202 -0
- package/frigg-cli/install-command/app-definition.js +174 -0
- package/frigg-cli/install-command/commit-changes.js +40 -8
- package/frigg-cli/install-command/environment-variables.js +15 -0
- package/frigg-cli/install-command/index.js +96 -21
- package/frigg-cli/install-command/install-package.js +77 -4
- package/frigg-cli/install-command/integration-file.js +20 -11
- package/frigg-cli/install-command/resolve-module.js +69 -0
- package/frigg-cli/install-command/template.js +102 -75
- package/frigg-cli/install-command/validate-package.js +36 -4
- package/frigg-cli/package.json +1 -1
- package/frigg-cli/templates/backend/README.md +267 -0
- package/frigg-cli/templates/backend/env.example +20 -0
- package/frigg-cli/templates/backend/gitignore +10 -0
- package/frigg-cli/templates/backend/index.js +114 -0
- package/frigg-cli/templates/backend/infrastructure.js +20 -0
- package/frigg-cli/test/init-command.test.js +9 -2
- package/infrastructure/__tests__/postgres-config.test.js +241 -835
- package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +148 -0
- package/infrastructure/__tests__/template-generation.test.js +36 -8
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +21 -1
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +6 -2
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +30 -0
- package/infrastructure/domains/database/aurora-builder.js +13 -2
- package/infrastructure/domains/database/aurora-builder.test.js +22 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +12 -8
- package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +19 -7
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +12 -8
- package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +17 -18
- package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +12 -2
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +8 -1
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +4 -2
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +10 -0
- package/infrastructure/domains/networking/vpc-builder.js +18 -8
- package/infrastructure/domains/networking/vpc-builder.test.js +26 -12
- package/infrastructure/domains/security/iam-generator.js +112 -5
- package/infrastructure/domains/security/iam-generator.test.js +94 -0
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +36 -6
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +7 -21
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +22 -13
- package/infrastructure/infrastructure-composer.test.js +268 -794
- package/infrastructure/scripts/build-prisma-layer.test.js +28 -7
- package/infrastructure/scripts/build-time-discovery.test.js +18 -3
- package/package.json +10 -8
- package/frigg-cli/index.test.js +0 -158
- package/infrastructure/__tests__/management-api-gateway-routes.test.js +0 -281
- package/infrastructure/integration.test.js +0 -381
|
@@ -286,11 +286,6 @@ function createBaseDefinition(
|
|
|
286
286
|
...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
|
|
287
287
|
skipEsbuild: true, // Handlers in node_modules don't need bundling
|
|
288
288
|
package: skipEsbuildPackageConfig,
|
|
289
|
-
// Every path prefix the core integration router
|
|
290
|
-
// (createIntegrationRouter) registers must be routed here;
|
|
291
|
-
// HTTP API has no implicit catch-all, so an unlisted prefix
|
|
292
|
-
// 404s at the gateway before Express sees it. Guarded by
|
|
293
|
-
// __tests__/management-api-gateway-routes.test.js.
|
|
294
289
|
events: [
|
|
295
290
|
{ httpApi: { path: '/api/integrations', method: 'ANY' } },
|
|
296
291
|
{
|
|
@@ -300,20 +295,6 @@ function createBaseDefinition(
|
|
|
300
295
|
},
|
|
301
296
|
},
|
|
302
297
|
{ httpApi: { path: '/api/authorize', method: 'ANY' } },
|
|
303
|
-
{ httpApi: { path: '/api/entity', method: 'ANY' } },
|
|
304
|
-
{
|
|
305
|
-
httpApi: {
|
|
306
|
-
path: '/api/entity/{proxy+}',
|
|
307
|
-
method: 'ANY',
|
|
308
|
-
},
|
|
309
|
-
},
|
|
310
|
-
{ httpApi: { path: '/api/entities', method: 'ANY' } },
|
|
311
|
-
{
|
|
312
|
-
httpApi: {
|
|
313
|
-
path: '/api/entities/{proxy+}',
|
|
314
|
-
method: 'ANY',
|
|
315
|
-
},
|
|
316
|
-
},
|
|
317
298
|
],
|
|
318
299
|
},
|
|
319
300
|
user: {
|
|
@@ -402,12 +383,18 @@ function createBaseDefinition(
|
|
|
402
383
|
},
|
|
403
384
|
},
|
|
404
385
|
},
|
|
386
|
+
// The functions above use `httpApi` events, so osls creates
|
|
387
|
+
// an HTTP API (API Gateway v2, logical ID HttpApi) with only
|
|
388
|
+
// the `$default` stage. HTTP APIs publish `5xx`, not the REST
|
|
389
|
+
// API metric `5XXError`, and the ApiId dimension identifies
|
|
390
|
+
// this API (a Stage dimension would have to be `$default`).
|
|
391
|
+
// https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-metrics.html
|
|
405
392
|
ApiGatewayAlarm5xx: {
|
|
406
393
|
Type: 'AWS::CloudWatch::Alarm',
|
|
407
394
|
Properties: {
|
|
408
395
|
AlarmDescription: 'API Gateway 5xx Errors',
|
|
409
396
|
Namespace: 'AWS/ApiGateway',
|
|
410
|
-
MetricName: '
|
|
397
|
+
MetricName: '5xx',
|
|
411
398
|
Statistic: 'Sum',
|
|
412
399
|
Threshold: 0,
|
|
413
400
|
ComparisonOperator: 'GreaterThanThreshold',
|
|
@@ -416,7 +403,6 @@ function createBaseDefinition(
|
|
|
416
403
|
AlarmActions: [{ Ref: 'InternalErrorBridgeTopic' }],
|
|
417
404
|
Dimensions: [
|
|
418
405
|
{ Name: 'ApiId', Value: { Ref: 'HttpApi' } },
|
|
419
|
-
{ Name: 'Stage', Value: '${self:provider.stage}' },
|
|
420
406
|
],
|
|
421
407
|
},
|
|
422
408
|
},
|
|
@@ -94,19 +94,7 @@ 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(
|
|
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
|
-
]);
|
|
97
|
+
expect(result.functions.auth.events).toHaveLength(3);
|
|
110
98
|
});
|
|
111
99
|
|
|
112
100
|
it('should NOT include legacy dbMigrate function', () => {
|
|
@@ -133,6 +121,27 @@ describe('Base Definition Factory', () => {
|
|
|
133
121
|
expect(result.resources.Resources.ApiGatewayAlarm5xx).toBeDefined();
|
|
134
122
|
});
|
|
135
123
|
|
|
124
|
+
it('alarms on the HTTP API 5xx metric of the API osls creates', () => {
|
|
125
|
+
// The Frigg functions use `httpApi` events, so osls creates an
|
|
126
|
+
// API Gateway v2 HTTP API (logical ID HttpApi) with only the
|
|
127
|
+
// `$default` stage. HTTP APIs publish `5xx` (REST APIs publish
|
|
128
|
+
// `5XXError`) with the ApiId dimension; a Stage dimension set to
|
|
129
|
+
// the deploy stage name would never match `$default`.
|
|
130
|
+
const result = createBaseDefinition({}, {}, {});
|
|
131
|
+
const usesHttpApi = Object.values(result.functions).some((fn) =>
|
|
132
|
+
(fn.events || []).some((event) => event.httpApi)
|
|
133
|
+
);
|
|
134
|
+
expect(usesHttpApi).toBe(true);
|
|
135
|
+
|
|
136
|
+
const alarm = result.resources.Resources.ApiGatewayAlarm5xx;
|
|
137
|
+
expect(alarm.Properties).toMatchObject({
|
|
138
|
+
Namespace: 'AWS/ApiGateway',
|
|
139
|
+
MetricName: '5xx',
|
|
140
|
+
Dimensions: [{ Name: 'ApiId', Value: { Ref: 'HttpApi' } }],
|
|
141
|
+
AlarmActions: [{ Ref: 'InternalErrorBridgeTopic' }],
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
136
145
|
it('should include base IAM permissions', () => {
|
|
137
146
|
const result = createBaseDefinition({}, {}, {});
|
|
138
147
|
|