@friggframework/devtools 2.0.0--canary.608.4bec88a.0 → 2.0.0--canary.610.ca077d5.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.
@@ -196,10 +196,6 @@ class IntegrationBuilder extends InfrastructureBuilder {
196
196
  );
197
197
  }
198
198
 
199
- // App-level FIFO queue for dispatch:'queue' events — one per app,
200
- // independent of per-integration queue ownership.
201
- this.createUserActionQueue(result, functionPackageConfig, usePrismaLayer);
202
-
203
199
  for (const integration of appDefinition.integrations) {
204
200
  const integrationName = integration.Definition.name;
205
201
  const queueDecision = decisions.integrations[integrationName].queue;
@@ -476,109 +472,6 @@ class IntegrationBuilder extends InfrastructureBuilder {
476
472
  console.log(' ✓ Created InternalErrorQueue resource');
477
473
  }
478
474
 
479
- /**
480
- * Create the app-level FIFO queue + FIFO DLQ + worker used by integration
481
- * events declared with `dispatch: 'queue'`.
482
- *
483
- * A single queue serves every integration: `MessageGroupId = integrationId`
484
- * (set by the producer) serializes events per integration while letting
485
- * distinct integrations process in parallel. Always created, like the
486
- * InternalErrorQueue — idle cost is ~$0.
487
- */
488
- createUserActionQueue(result, functionPackageConfig, usePrismaLayer = true) {
489
- const queueName =
490
- '${self:service}-${self:provider.stage}-FriggUserActionQueue.fifo';
491
- const dlqName =
492
- '${self:service}-${self:provider.stage}-FriggUserActionDLQ.fifo';
493
-
494
- result.custom.FriggUserActionQueue = queueName;
495
- result.custom.FriggUserActionDLQ = dlqName;
496
-
497
- // A FIFO source queue can only redrive to a FIFO DLQ.
498
- result.resources.FriggUserActionDLQ = {
499
- Type: 'AWS::SQS::Queue',
500
- Properties: {
501
- QueueName: '${self:custom.FriggUserActionDLQ}',
502
- FifoQueue: true,
503
- MessageRetentionPeriod: 1209600, // 14 days
504
- },
505
- };
506
-
507
- // ContentBasedDeduplication is intentionally OMITTED. The producer
508
- // supplies a unique MessageDeduplicationId per send, so two distinct
509
- // requests with identical bodies both run — content-based dedup would
510
- // hash the body and silently drop the second within the 5-min window.
511
- result.resources.FriggUserActionQueue = {
512
- Type: 'AWS::SQS::Queue',
513
- Properties: {
514
- QueueName: '${self:custom.FriggUserActionQueue}',
515
- FifoQueue: true,
516
- MessageRetentionPeriod: 345600, // 4 days
517
- VisibilityTimeout: 1800, // >= worker timeout (900s)
518
- RedrivePolicy: {
519
- maxReceiveCount: 2,
520
- deadLetterTargetArn: {
521
- 'Fn::GetAtt': ['FriggUserActionDLQ', 'Arn'],
522
- },
523
- },
524
- },
525
- };
526
-
527
- // Expose the queue URL to ALL Lambdas — both the HTTP handlers that
528
- // produce events and the worker that consumes them.
529
- result.environment.USER_ACTION_QUEUE_URL = {
530
- Ref: 'FriggUserActionQueue',
531
- };
532
-
533
- // Any message in the FIFO DLQ is a failed eventual event.
534
- result.resources.FriggUserActionDLQAlarm = {
535
- Type: 'AWS::CloudWatch::Alarm',
536
- Properties: {
537
- AlarmDescription:
538
- 'Messages in FriggUserActionDLQ — eventual (queued) integration event failures',
539
- Namespace: 'AWS/SQS',
540
- MetricName: 'ApproximateNumberOfMessagesVisible',
541
- Statistic: 'Maximum',
542
- Threshold: 0,
543
- ComparisonOperator: 'GreaterThanThreshold',
544
- EvaluationPeriods: 1,
545
- Period: 300,
546
- AlarmActions: [{ Ref: 'InternalErrorBridgeTopic' }],
547
- Dimensions: [
548
- {
549
- Name: 'QueueName',
550
- Value: {
551
- 'Fn::GetAtt': ['FriggUserActionDLQ', 'QueueName'],
552
- },
553
- },
554
- ],
555
- },
556
- };
557
-
558
- // Single app-level worker. NO reservedConcurrency: FIFO already
559
- // serializes per MessageGroupId; capping at 1 would serialize across
560
- // ALL integrations and kill cross-integration parallelism.
561
- result.functions.userActionQueueWorker = {
562
- handler:
563
- 'node_modules/@friggframework/core/handlers/workers/user-action-worker.userActionQueueWorker',
564
- skipEsbuild: true,
565
- package: functionPackageConfig,
566
- ...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
567
- timeout: 900,
568
- events: [
569
- {
570
- sqs: {
571
- arn: { 'Fn::GetAtt': ['FriggUserActionQueue', 'Arn'] },
572
- batchSize: 1,
573
- functionResponseType: 'ReportBatchItemFailures',
574
- },
575
- },
576
- ],
577
- };
578
-
579
- console.log(' ✓ Created FriggUserActionQueue (.fifo) + DLQ + worker');
580
- }
581
-
582
475
  /**
583
476
  * Use external InternalErrorQueue
584
477
  */
@@ -751,12 +751,9 @@ describe('IntegrationBuilder', () => {
751
751
 
752
752
  const functionKeys = Object.keys(result.functions);
753
753
 
754
- // Expected order: dlqProcessor + userActionQueueWorker (both
755
- // app-level, created before the integration loop), then webhook,
756
- // integration, queueWorker.
754
+ // Expected order: dlqProcessor (from InternalErrorQueue), webhook, integration, queueWorker
757
755
  expect(functionKeys).toEqual([
758
756
  'dlqProcessor',
759
- 'userActionQueueWorker',
760
757
  'testWebhook',
761
758
  'test',
762
759
  'testQueueWorker',
@@ -938,122 +935,5 @@ describe('IntegrationBuilder', () => {
938
935
  );
939
936
  });
940
937
  });
941
-
942
- describe('User-Action FIFO queue', () => {
943
- const appDefinition = {
944
- integrations: [{ Definition: { name: 'test' } }],
945
- };
946
-
947
- it('creates a FIFO queue without ContentBasedDeduplication', async () => {
948
- const result = await integrationBuilder.build(appDefinition, {});
949
-
950
- const q = result.resources.FriggUserActionQueue;
951
- expect(q).toBeDefined();
952
- expect(q.Type).toBe('AWS::SQS::Queue');
953
- expect(q.Properties.FifoQueue).toBe(true);
954
- expect(q.Properties.ContentBasedDeduplication).toBeUndefined();
955
- expect(q.Properties.VisibilityTimeout).toBe(1800);
956
- expect(q.Properties.MessageRetentionPeriod).toBe(345600);
957
- });
958
-
959
- it('redrives to the FIFO DLQ with maxReceiveCount 2', async () => {
960
- const result = await integrationBuilder.build(appDefinition, {});
961
-
962
- expect(
963
- result.resources.FriggUserActionQueue.Properties.RedrivePolicy
964
- ).toEqual({
965
- maxReceiveCount: 2,
966
- deadLetterTargetArn: {
967
- 'Fn::GetAtt': ['FriggUserActionDLQ', 'Arn'],
968
- },
969
- });
970
- });
971
-
972
- it('creates a FIFO DLQ with 14-day retention', async () => {
973
- const result = await integrationBuilder.build(appDefinition, {});
974
-
975
- const dlq = result.resources.FriggUserActionDLQ;
976
- expect(dlq).toBeDefined();
977
- expect(dlq.Properties.FifoQueue).toBe(true);
978
- expect(dlq.Properties.MessageRetentionPeriod).toBe(1209600);
979
- });
980
-
981
- it('creates the worker bound to the FIFO queue ARN with no reservedConcurrency', async () => {
982
- const result = await integrationBuilder.build(appDefinition, {});
983
-
984
- const worker = result.functions.userActionQueueWorker;
985
- expect(worker).toBeDefined();
986
- expect(worker.handler).toBe(
987
- 'node_modules/@friggframework/core/handlers/workers/user-action-worker.userActionQueueWorker'
988
- );
989
- expect(worker.timeout).toBe(900);
990
- expect(worker.reservedConcurrency).toBeUndefined();
991
- expect(worker.events).toEqual([
992
- {
993
- sqs: {
994
- arn: { 'Fn::GetAtt': ['FriggUserActionQueue', 'Arn'] },
995
- batchSize: 1,
996
- functionResponseType: 'ReportBatchItemFailures',
997
- },
998
- },
999
- ]);
1000
- });
1001
-
1002
- it('exposes USER_ACTION_QUEUE_URL to all Lambdas', async () => {
1003
- const result = await integrationBuilder.build(appDefinition, {});
1004
-
1005
- expect(result.environment.USER_ACTION_QUEUE_URL).toEqual({
1006
- Ref: 'FriggUserActionQueue',
1007
- });
1008
- });
1009
-
1010
- it('alarms on the FIFO DLQ via the InternalErrorBridgeTopic', async () => {
1011
- const result = await integrationBuilder.build(appDefinition, {});
1012
-
1013
- const alarm = result.resources.FriggUserActionDLQAlarm;
1014
- expect(alarm).toBeDefined();
1015
- expect(alarm.Properties.AlarmActions).toEqual([
1016
- { Ref: 'InternalErrorBridgeTopic' },
1017
- ]);
1018
- });
1019
-
1020
- it('creates exactly one FIFO queue + worker regardless of integration count', async () => {
1021
- const result = await integrationBuilder.build(
1022
- {
1023
- integrations: [
1024
- { Definition: { name: 'hubspot' } },
1025
- { Definition: { name: 'salesforce' } },
1026
- { Definition: { name: 'slack' } },
1027
- ],
1028
- },
1029
- {}
1030
- );
1031
-
1032
- const fifoQueues = Object.keys(result.resources).filter(
1033
- (k) => k === 'FriggUserActionQueue'
1034
- );
1035
- expect(fifoQueues).toHaveLength(1);
1036
- expect(result.functions.userActionQueueWorker).toBeDefined();
1037
- });
1038
-
1039
- it('does not make per-integration queues FIFO', async () => {
1040
- const result = await integrationBuilder.build(appDefinition, {});
1041
-
1042
- expect(
1043
- result.resources.TestQueue.Properties.FifoQueue
1044
- ).toBeUndefined();
1045
- });
1046
-
1047
- it('omits the Prisma layer on the worker when usePrismaLambdaLayer=false', async () => {
1048
- const result = await integrationBuilder.build(
1049
- { usePrismaLambdaLayer: false, integrations: [{ Definition: { name: 'test' } }] },
1050
- {}
1051
- );
1052
-
1053
- expect(
1054
- result.functions.userActionQueueWorker.layers
1055
- ).toBeUndefined();
1056
- });
1057
- });
1058
938
  });
1059
939
 
@@ -426,10 +426,6 @@ function generateIAMCloudFormation(options = {}) {
426
426
  ],
427
427
  Resource: [
428
428
  { 'Fn::Sub': 'arn:aws:sqs:*:${AWS::AccountId}:*frigg*' },
429
- // IAM wildcard matching is case-sensitive; the app-level FIFO
430
- // queue is named "...-FriggUserActionQueue.fifo", which the
431
- // lowercase "*frigg*" glob would not match.
432
- { 'Fn::Sub': 'arn:aws:sqs:*:${AWS::AccountId}:*Frigg*' },
433
429
  {
434
430
  'Fn::Sub':
435
431
  'arn:aws:sqs:*:${AWS::AccountId}:internal-error-queue-*',
@@ -182,22 +182,6 @@ describe('IAM Generator', () => {
182
182
  expect(yaml).toContain('internal-error-queue-*');
183
183
  });
184
184
 
185
- it('should include a case-sensitive *Frigg* SQS resource for the FIFO queue', () => {
186
- const appDefinition = {
187
- name: 'test-app',
188
- integrations: [],
189
- };
190
-
191
- const summary = getFeatureSummary(appDefinition);
192
- const yaml = generateIAMCloudFormation({
193
- appName: summary.appName,
194
- features: summary.features,
195
- });
196
-
197
- // The lowercase "*frigg*" glob would not match "...-FriggUserActionQueue.fifo".
198
- expect(yaml).toContain(':*Frigg*');
199
- });
200
-
201
185
  it('should generate outputs section', () => {
202
186
  const appDefinition = {
203
187
  name: 'test-app',
@@ -205,9 +205,6 @@ Resources:
205
205
  - 'sqs:UntagQueue'
206
206
  Resource:
207
207
  - !Sub 'arn:aws:sqs:*:${AWS::AccountId}:*frigg*'
208
- # Case-sensitive glob: the app-level FIFO queue is named
209
- # "...-FriggUserActionQueue.fifo" which "*frigg*" would not match.
210
- - !Sub 'arn:aws:sqs:*:${AWS::AccountId}:*Frigg*'
211
208
  - !Sub 'arn:aws:sqs:*:${AWS::AccountId}:internal-error-queue-*'
212
209
 
213
210
  # SNS permissions
@@ -196,10 +196,6 @@ function createBaseDefinition(
196
196
  ],
197
197
  Resource: [
198
198
  { 'Fn::GetAtt': ['InternalErrorQueue', 'Arn'] },
199
- // Explicit ARN: the per-integration glob below ends in
200
- // "-*Queue" and does NOT match the ".fifo" suffix, so the
201
- // app-level FIFO queue must be listed directly.
202
- { 'Fn::GetAtt': ['FriggUserActionQueue', 'Arn'] },
203
199
  {
204
200
  'Fn::Join': [
205
201
  ':',
@@ -133,12 +133,6 @@ describe('Base Definition Factory', () => {
133
133
  stmt => stmt.Action.includes('sqs:SendMessage')
134
134
  );
135
135
  expect(sqsPermission).toBeDefined();
136
-
137
- // The per-integration glob ends in "-*Queue" and won't match the
138
- // ".fifo" app-level queue, so its ARN must be listed explicitly.
139
- expect(sqsPermission.Resource).toContainEqual({
140
- 'Fn::GetAtt': ['FriggUserActionQueue', 'Arn'],
141
- });
142
136
  });
143
137
 
144
138
  it('should include required plugins', () => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.608.4bec88a.0",
4
+ "version": "2.0.0--canary.610.ca077d5.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -25,9 +25,9 @@
25
25
  "@babel/eslint-parser": "^7.18.9",
26
26
  "@babel/parser": "^7.25.3",
27
27
  "@babel/traverse": "^7.25.3",
28
- "@friggframework/core": "2.0.0--canary.608.4bec88a.0",
29
- "@friggframework/schemas": "2.0.0--canary.608.4bec88a.0",
30
- "@friggframework/test": "2.0.0--canary.608.4bec88a.0",
28
+ "@friggframework/core": "2.0.0--canary.610.ca077d5.0",
29
+ "@friggframework/schemas": "2.0.0--canary.610.ca077d5.0",
30
+ "@friggframework/test": "2.0.0--canary.610.ca077d5.0",
31
31
  "@hapi/boom": "^10.0.1",
32
32
  "@inquirer/prompts": "^5.3.8",
33
33
  "axios": "^1.18.0",
@@ -55,8 +55,8 @@
55
55
  "validate-npm-package-name": "^5.0.0"
56
56
  },
57
57
  "devDependencies": {
58
- "@friggframework/eslint-config": "2.0.0--canary.608.4bec88a.0",
59
- "@friggframework/prettier-config": "2.0.0--canary.608.4bec88a.0",
58
+ "@friggframework/eslint-config": "2.0.0--canary.610.ca077d5.0",
59
+ "@friggframework/prettier-config": "2.0.0--canary.610.ca077d5.0",
60
60
  "aws-sdk-client-mock": "^4.1.0",
61
61
  "aws-sdk-client-mock-jest": "^4.1.0",
62
62
  "jest": "^30.1.3",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "4bec88a53c1c12df8f84aac9b2eeb6b23ba04c05"
91
+ "gitHead": "ca077d5f47ea8b69880c3adeebbdbd3a6ac5abb5"
92
92
  }