@friggframework/devtools 2.0.0--canary.652.60de836.0 → 2.0.0--canary.653.af34bd7.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.
@@ -32,6 +32,10 @@ const {
32
32
  const {
33
33
  nestedNodeModulesExcludes,
34
34
  } = require('../shared/utilities/nested-node-modules');
35
+ const {
36
+ INTEGRATION_QUEUE_MAX_RECEIVE_COUNT,
37
+ QUEUE_MAX_RECEIVE_COUNT_ENV,
38
+ } = require('@friggframework/core/queues/queue-delivery');
35
39
 
36
40
  class IntegrationBuilder extends InfrastructureBuilder {
37
41
  constructor() {
@@ -569,7 +573,7 @@ class IntegrationBuilder extends InfrastructureBuilder {
569
573
  MessageRetentionPeriod: 345600, // 4 days (SQS default)
570
574
  VisibilityTimeout: 1800,
571
575
  RedrivePolicy: {
572
- maxReceiveCount: 3,
576
+ maxReceiveCount: INTEGRATION_QUEUE_MAX_RECEIVE_COUNT,
573
577
  deadLetterTargetArn: {
574
578
  'Fn::GetAtt': ['InternalErrorQueue', 'Arn'],
575
579
  },
@@ -577,6 +581,14 @@ class IntegrationBuilder extends InfrastructureBuilder {
577
581
  },
578
582
  };
579
583
 
584
+ const queueWorker = result.functions[`${integrationName}QueueWorker`];
585
+ queueWorker.environment = {
586
+ ...queueWorker.environment,
587
+ [QUEUE_MAX_RECEIVE_COUNT_ENV]: String(
588
+ INTEGRATION_QUEUE_MAX_RECEIVE_COUNT
589
+ ),
590
+ };
591
+
580
592
  // Add queue URL to environment
581
593
  this.setQueueUrlEnvironment(
582
594
  integrationName,
@@ -4,6 +4,10 @@
4
4
  * Tests integration-specific Lambda functions and SQS queues
5
5
  */
6
6
 
7
+ const {
8
+ INTEGRATION_QUEUE_MAX_RECEIVE_COUNT,
9
+ QUEUE_MAX_RECEIVE_COUNT_ENV,
10
+ } = require('@friggframework/core/queues/queue-delivery');
7
11
  const { IntegrationBuilder } = require('./integration-builder');
8
12
  const { ValidationResult } = require('../shared/base-builder');
9
13
 
@@ -207,6 +211,54 @@ describe('IntegrationBuilder', () => {
207
211
  });
208
212
  });
209
213
 
214
+ it('takes the redrive max receive count from the core runtime contract', async () => {
215
+ const result = await integrationBuilder.build(
216
+ { integrations: [{ Definition: { name: 'test' } }] },
217
+ {}
218
+ );
219
+
220
+ expect(
221
+ result.resources.TestQueue.Properties.RedrivePolicy
222
+ .maxReceiveCount
223
+ ).toBe(INTEGRATION_QUEUE_MAX_RECEIVE_COUNT);
224
+ });
225
+
226
+ it('tells the queue worker the max receive count of the queue it owns', async () => {
227
+ const result = await integrationBuilder.build(
228
+ { integrations: [{ Definition: { name: 'test' } }] },
229
+ {}
230
+ );
231
+
232
+ expect(
233
+ result.functions.testQueueWorker.environment[
234
+ QUEUE_MAX_RECEIVE_COUNT_ENV
235
+ ]
236
+ ).toBe('3');
237
+ });
238
+
239
+ it('leaves the max receive count unset for an external queue', async () => {
240
+ const result = await integrationBuilder.build(
241
+ {
242
+ integrations: [
243
+ {
244
+ Definition: { name: 'test' },
245
+ ownership: { queue: 'external' },
246
+ queue: {
247
+ url: 'https://sqs.us-east-1.amazonaws.com/123456789012/test-queue',
248
+ },
249
+ },
250
+ ],
251
+ },
252
+ {}
253
+ );
254
+
255
+ expect(
256
+ result.functions.testQueueWorker.environment?.[
257
+ QUEUE_MAX_RECEIVE_COUNT_ENV
258
+ ]
259
+ ).toBeUndefined();
260
+ });
261
+
210
262
  it('should create queue worker function', async () => {
211
263
  const appDefinition = {
212
264
  integrations: [
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.652.60de836.0",
4
+ "version": "2.0.0--canary.653.af34bd7.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -26,9 +26,9 @@
26
26
  "@babel/eslint-parser": "^7.18.9",
27
27
  "@babel/parser": "^7.25.3",
28
28
  "@babel/traverse": "^7.25.3",
29
- "@friggframework/core": "2.0.0--canary.652.60de836.0",
30
- "@friggframework/schemas": "2.0.0--canary.652.60de836.0",
31
- "@friggframework/test": "2.0.0--canary.652.60de836.0",
29
+ "@friggframework/core": "2.0.0--canary.653.af34bd7.0",
30
+ "@friggframework/schemas": "2.0.0--canary.653.af34bd7.0",
31
+ "@friggframework/test": "2.0.0--canary.653.af34bd7.0",
32
32
  "@hapi/boom": "^10.0.1",
33
33
  "@inquirer/prompts": "^5.3.8",
34
34
  "axios": "^1.18.0",
@@ -56,8 +56,8 @@
56
56
  "validate-npm-package-name": "^5.0.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@friggframework/eslint-config": "2.0.0--canary.652.60de836.0",
60
- "@friggframework/prettier-config": "2.0.0--canary.652.60de836.0",
59
+ "@friggframework/eslint-config": "2.0.0--canary.653.af34bd7.0",
60
+ "@friggframework/prettier-config": "2.0.0--canary.653.af34bd7.0",
61
61
  "aws-sdk-client-mock": "^4.1.0",
62
62
  "aws-sdk-client-mock-jest": "^4.1.0",
63
63
  "jest": "^30.1.3",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "60de83654af65d71fc331c7dbfee727c4f2534ff"
92
+ "gitHead": "af34bd7c677948dcd9f4a7a8dc0a59b038c35c48"
93
93
  }