@friggframework/devtools 2.0.0-next.27 → 2.0.0-next.28

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.
@@ -413,14 +413,6 @@ const createVPCInfrastructure = (AppDefinition) => {
413
413
  };
414
414
 
415
415
  const composeServerlessDefinition = (AppDefinition) => {
416
- // Define CORS configuration to be used across all endpoints
417
- const corsConfig = {
418
- origin: '*',
419
- headers: '*',
420
- methods: ['ANY'],
421
- allowCredentials: false,
422
- };
423
-
424
416
  const definition = {
425
417
  frameworkVersion: '>=3.17.0',
426
418
  service: AppDefinition.name || 'create-frigg-app',
@@ -434,9 +426,9 @@ const composeServerlessDefinition = (AppDefinition) => {
434
426
  runtime: 'nodejs20.x',
435
427
  timeout: 30,
436
428
  region: 'us-east-1',
437
- stage: '${opt:stage}',
429
+ stage: '${opt:stage, "dev"}',
438
430
  environment: {
439
- STAGE: '${opt:stage}',
431
+ STAGE: '${opt:stage, "dev"}',
440
432
  AWS_NODEJS_CONNECTION_REUSE_ENABLED: 1,
441
433
  },
442
434
  iamRoleStatements: [
@@ -470,6 +462,17 @@ const composeServerlessDefinition = (AppDefinition) => {
470
462
  ],
471
463
  }
472
464
  ],
465
+ httpApi: {
466
+ payload: '2.0',
467
+ cors: {
468
+ allowedOrigins: ['*'],
469
+ allowedHeaders: ['*'],
470
+ allowedMethods: ['*'],
471
+ allowCredentials: false,
472
+ },
473
+ name: '${opt:stage, "dev"}-${self:service}',
474
+ disableDefaultEndpoint: false,
475
+ }
473
476
  },
474
477
  plugins: [
475
478
  'serverless-jetpack',
@@ -522,24 +525,21 @@ const composeServerlessDefinition = (AppDefinition) => {
522
525
  handler: 'node_modules/@friggframework/core/handlers/routers/auth.handler',
523
526
  events: [
524
527
  {
525
- http: {
528
+ httpApi: {
526
529
  path: '/api/integrations',
527
530
  method: 'ANY',
528
- cors: corsConfig,
529
531
  },
530
532
  },
531
533
  {
532
- http: {
534
+ httpApi: {
533
535
  path: '/api/integrations/{proxy+}',
534
536
  method: 'ANY',
535
- cors: corsConfig,
536
537
  },
537
538
  },
538
539
  {
539
- http: {
540
+ httpApi: {
540
541
  path: '/api/authorize',
541
542
  method: 'ANY',
542
- cors: corsConfig,
543
543
  },
544
544
  },
545
545
  ],
@@ -548,10 +548,9 @@ const composeServerlessDefinition = (AppDefinition) => {
548
548
  handler: 'node_modules/@friggframework/core/handlers/routers/user.handler',
549
549
  events: [
550
550
  {
551
- http: {
551
+ httpApi: {
552
552
  path: '/user/{proxy+}',
553
553
  method: 'ANY',
554
- cors: corsConfig,
555
554
  },
556
555
  },
557
556
  ],
@@ -560,17 +559,15 @@ const composeServerlessDefinition = (AppDefinition) => {
560
559
  handler: 'node_modules/@friggframework/core/handlers/routers/health.handler',
561
560
  events: [
562
561
  {
563
- http: {
562
+ httpApi: {
564
563
  path: '/health',
565
564
  method: 'GET',
566
- cors: corsConfig,
567
565
  },
568
566
  },
569
567
  {
570
- http: {
568
+ httpApi: {
571
569
  path: '/health/{proxy+}',
572
570
  method: 'GET',
573
- cors: corsConfig,
574
571
  },
575
572
  },
576
573
  ],
@@ -648,16 +645,12 @@ const composeServerlessDefinition = (AppDefinition) => {
648
645
  AlarmActions: [{ Ref: 'InternalErrorBridgeTopic' }],
649
646
  Dimensions: [
650
647
  {
651
- Name: 'ApiName',
652
- Value: {
653
- 'Fn::Join': [
654
- '-',
655
- [
656
- '${self:provider.stage}',
657
- '${self:service}',
658
- ],
659
- ],
660
- },
648
+ Name: 'ApiId',
649
+ Value: { Ref: 'HttpApi' },
650
+ },
651
+ {
652
+ Name: 'Stage',
653
+ Value: '${self:provider.stage}',
661
654
  },
662
655
  ],
663
656
  },
@@ -673,12 +666,12 @@ const composeServerlessDefinition = (AppDefinition) => {
673
666
  definition.custom.customDomain = {
674
667
  domainName: process.env.CUSTOM_DOMAIN,
675
668
  basePath: process.env.CUSTOM_BASE_PATH || '',
676
- stage: '${self:provider.stage}',
669
+ stage: '${opt:stage, "dev"}',
677
670
  createRoute53Record: process.env.CREATE_ROUTE53_RECORD !== 'false', // Default true
678
671
  certificateName: process.env.CERTIFICATE_NAME || process.env.CUSTOM_DOMAIN,
679
672
  endpointType: process.env.ENDPOINT_TYPE || 'edge', // edge, regional, or private
680
673
  securityPolicy: process.env.SECURITY_POLICY || 'tls_1_2',
681
- apiType: 'rest',
674
+ apiType: 'http',
682
675
  autoDomain: process.env.AUTO_DOMAIN === 'true', // Auto create domain if it doesn't exist
683
676
  };
684
677
 
@@ -686,18 +679,9 @@ const composeServerlessDefinition = (AppDefinition) => {
686
679
  definition.provider.environment.BASE_URL = `https://${process.env.CUSTOM_DOMAIN}`;
687
680
  } else {
688
681
  // Default BASE_URL using API Gateway generated URL
682
+ // For HTTP API, don't include stage as it uses $default behavior
689
683
  definition.provider.environment.BASE_URL = {
690
- 'Fn::Join': [
691
- '',
692
- [
693
- 'https://',
694
- { Ref: 'ApiGatewayRestApi' },
695
- '.execute-api.',
696
- { Ref: 'AWS::Region' },
697
- '.amazonaws.com/',
698
- '${self:provider.stage}',
699
- ],
700
- ],
684
+ 'Fn::GetAtt': ['HttpApi', 'ApiEndpoint']
701
685
  };
702
686
  }
703
687
 
@@ -717,12 +701,7 @@ const composeServerlessDefinition = (AppDefinition) => {
717
701
  'Fn::Join': [
718
702
  '',
719
703
  [
720
- 'https://',
721
- { Ref: 'ApiGatewayRestApi' },
722
- '.execute-api.',
723
- { Ref: 'AWS::Region' },
724
- '.amazonaws.com/',
725
- '${self:provider.stage}',
704
+ { 'Fn::GetAtt': ['HttpApi', 'ApiEndpoint'] },
726
705
  process.env.REDIRECT_PATH,
727
706
  ],
728
707
  ],
@@ -825,10 +804,9 @@ const composeServerlessDefinition = (AppDefinition) => {
825
804
  handler: `node_modules/@friggframework/core/handlers/routers/integration-defined-routers.handlers.${integrationName}.handler`,
826
805
  events: [
827
806
  {
828
- http: {
807
+ httpApi: {
829
808
  path: `/api/${integrationName}-integration/{proxy+}`,
830
809
  method: 'ANY',
831
- cors: corsConfig,
832
810
  },
833
811
  },
834
812
  ],
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0-next.27",
4
+ "version": "2.0.0-next.28",
5
5
  "dependencies": {
6
6
  "@babel/eslint-parser": "^7.18.9",
7
7
  "@babel/parser": "^7.25.3",
8
8
  "@babel/traverse": "^7.25.3",
9
- "@friggframework/test": "2.0.0-next.27",
9
+ "@friggframework/test": "2.0.0-next.28",
10
10
  "@hapi/boom": "^10.0.1",
11
11
  "@inquirer/prompts": "^5.3.8",
12
12
  "axios": "^1.7.2",
@@ -27,8 +27,8 @@
27
27
  "serverless-http": "^2.7.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@friggframework/eslint-config": "2.0.0-next.27",
31
- "@friggframework/prettier-config": "2.0.0-next.27",
30
+ "@friggframework/eslint-config": "2.0.0-next.28",
31
+ "@friggframework/prettier-config": "2.0.0-next.28",
32
32
  "prettier": "^2.7.1",
33
33
  "serverless": "3.39.0",
34
34
  "serverless-dotenv-plugin": "^6.0.0",
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "82dec739e8d482b55f995eecf088ef05f7931188"
63
+ "gitHead": "3c830c9e559a1ed9b8a2b2de885cd5984649e2fb"
64
64
  }