@friggframework/devtools 2.0.0--canary.657.f16d20b.0 → 2.0.0--canary.658.e11f3b0.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.
@@ -10,8 +10,6 @@ const {
10
10
  } = require('@friggframework/core/queues/queue-delivery');
11
11
  const { IntegrationBuilder } = require('./integration-builder');
12
12
  const { ValidationResult } = require('../shared/base-builder');
13
- const { BuilderOrchestrator } = require('../shared/builder-orchestrator');
14
- const { SchedulerBuilder } = require('../scheduler/scheduler-builder');
15
13
 
16
14
  describe('IntegrationBuilder', () => {
17
15
  let integrationBuilder;
@@ -261,37 +259,6 @@ describe('IntegrationBuilder', () => {
261
259
  ).toBeUndefined();
262
260
  });
263
261
 
264
- it('adds no resource, function or env var when no module declares rateLimit', async () => {
265
- class Api {}
266
- const { merged } = await new BuilderOrchestrator([
267
- new IntegrationBuilder(),
268
- new SchedulerBuilder(),
269
- ]).buildAll({
270
- integrations: [
271
- {
272
- Definition: {
273
- name: 'test',
274
- modules: { crm: { definition: { API: Api } } },
275
- },
276
- },
277
- ],
278
- });
279
- const before = await integrationBuilder.build(
280
- { integrations: [{ Definition: { name: 'test' } }] },
281
- {}
282
- );
283
-
284
- expect(Object.keys(merged.resources)).toEqual(
285
- Object.keys(before.resources)
286
- );
287
- expect(Object.keys(merged.functions)).toEqual(
288
- Object.keys(before.functions)
289
- );
290
- expect(Object.keys(merged.environment)).toEqual(
291
- Object.keys(before.environment)
292
- );
293
- });
294
-
295
262
  it('should create queue worker function', async () => {
296
263
  const appDefinition = {
297
264
  integrations: [
@@ -13,24 +13,12 @@
13
13
  */
14
14
 
15
15
  const { InfrastructureBuilder, ValidationResult } = require('../shared/base-builder');
16
- const { ResourceOwnership } = require('../shared/types/resource-ownership');
17
16
  const {
18
17
  isScopedEnvironmentActive,
19
18
  getIntegrationFunctionNames,
20
19
  getAdminFunctionNames,
21
20
  } = require('../shared/function-environments');
22
21
 
23
- const queueArnFromUrl = (queueUrl) => {
24
- const { hostname, pathname } = new URL(queueUrl);
25
- const [accountId, queueName] = pathname.split('/').filter(Boolean);
26
- return `arn:aws:sqs:${hostname.split('.')[1]}:${accountId}:${queueName}`;
27
- };
28
-
29
- const declaresRateLimit = (integration) =>
30
- Object.values(integration?.Definition?.modules ?? {}).some((module) =>
31
- Boolean(module?.definition?.API?.rateLimit)
32
- );
33
-
34
22
  class SchedulerBuilder extends InfrastructureBuilder {
35
23
  constructor() {
36
24
  super();
@@ -49,8 +37,7 @@ class SchedulerBuilder extends InfrastructureBuilder {
49
37
  return appDefinition.integrations.some(
50
38
  (integration) =>
51
39
  integration?.Definition?.webhooks?.enabled === true ||
52
- integration?.Definition?.webhooks === true ||
53
- declaresRateLimit(integration)
40
+ integration?.Definition?.webhooks === true
54
41
  );
55
42
  }
56
43
 
@@ -120,11 +107,7 @@ class SchedulerBuilder extends InfrastructureBuilder {
120
107
  if (Array.isArray(appDefinition.integrations)) {
121
108
  appDefinition.integrations.forEach((integration) => {
122
109
  const integrationName = integration?.Definition?.name;
123
- if (
124
- integration.ownership?.queue === ResourceOwnership.EXTERNAL
125
- ) {
126
- queueArns.push(queueArnFromUrl(integration.queue.url));
127
- } else if (integrationName) {
110
+ if (integrationName) {
128
111
  const capitalizedName =
129
112
  integrationName.charAt(0).toUpperCase() +
130
113
  integrationName.slice(1);
@@ -38,61 +38,6 @@ describe('SchedulerBuilder', () => {
38
38
  ).toBe(true);
39
39
  });
40
40
 
41
- it('runs when any module declares a rate limit', () => {
42
- class Api {
43
- static rateLimit = { minRetryAfterMs: 1_000 };
44
- }
45
- expect(
46
- schedulerBuilder.shouldExecute({
47
- integrations: [
48
- { Definition: { name: 'a' } },
49
- {
50
- Definition: {
51
- name: 'b',
52
- modules: { crm: { definition: { API: Api } } },
53
- },
54
- },
55
- ],
56
- })
57
- ).toBe(true);
58
- });
59
-
60
- it('skips a module whose API declares no rate limit', () => {
61
- class Api {}
62
- expect(
63
- schedulerBuilder.shouldExecute({
64
- integrations: [
65
- {
66
- Definition: {
67
- name: 'a',
68
- modules: { crm: { definition: { API: Api } } },
69
- },
70
- },
71
- ],
72
- })
73
- ).toBe(false);
74
- });
75
-
76
- it.each([
77
- ['no modules', { name: 'a' }],
78
- ['an empty modules object', { name: 'a', modules: {} }],
79
- [
80
- 'a module with no definition',
81
- { name: 'a', modules: { crm: {} } },
82
- ],
83
- ['a null module', { name: 'a', modules: { crm: null } }],
84
- [
85
- 'a definition with no API',
86
- { name: 'a', modules: { crm: { definition: {} } } },
87
- ],
88
- ])('skips an integration with %s', (_label, Definition) => {
89
- expect(
90
- schedulerBuilder.shouldExecute({
91
- integrations: [{ Definition }],
92
- })
93
- ).toBe(false);
94
- });
95
-
96
41
  it('skips otherwise', () => {
97
42
  expect(
98
43
  schedulerBuilder.shouldExecute({
@@ -170,48 +115,4 @@ describe('SchedulerBuilder', () => {
170
115
  expect(result.functionEnvironments).toBeUndefined();
171
116
  });
172
117
  });
173
-
174
- describe('build() execution role', () => {
175
- const sendableQueues = (result) =>
176
- result.resources.SchedulerExecutionRole.Properties.Policies[0]
177
- .PolicyDocument.Statement[0].Resource;
178
-
179
- it('allows sending to a queue the stack creates', async () => {
180
- const result = await schedulerBuilder.build(
181
- {
182
- scheduler: { enable: true },
183
- integrations: [{ Definition: { name: 'hubspot' } }],
184
- },
185
- {}
186
- );
187
-
188
- expect(sendableQueues(result)).toEqual([
189
- { 'Fn::GetAtt': ['HubspotQueue', 'Arn'] },
190
- ]);
191
- });
192
-
193
- it('allows sending to an external queue by its ARN, not a resource the stack lacks', async () => {
194
- const result = await schedulerBuilder.build(
195
- {
196
- scheduler: { enable: true },
197
- integrations: [
198
- { Definition: { name: 'hubspot' } },
199
- {
200
- Definition: { name: 'salesforce' },
201
- ownership: { queue: 'external' },
202
- queue: {
203
- url: 'https://sqs.us-east-1.amazonaws.com/123456789012/acme-salesforce',
204
- },
205
- },
206
- ],
207
- },
208
- {}
209
- );
210
-
211
- expect(sendableQueues(result)).toEqual([
212
- { 'Fn::GetAtt': ['HubspotQueue', 'Arn'] },
213
- 'arn:aws:sqs:us-east-1:123456789012:acme-salesforce',
214
- ]);
215
- });
216
- });
217
118
  });
@@ -195,7 +195,6 @@ function createBaseDefinition(
195
195
  'sqs:SendMessageBatch',
196
196
  'sqs:GetQueueUrl',
197
197
  'sqs:GetQueueAttributes',
198
- 'sqs:ChangeMessageVisibility',
199
198
  ],
200
199
  Resource: [
201
200
  { 'Fn::GetAtt': ['InternalErrorQueue', 'Arn'] },
@@ -135,18 +135,6 @@ describe('Base Definition Factory', () => {
135
135
  expect(sqsPermission).toBeDefined();
136
136
  });
137
137
 
138
- it('should let a function extend the visibility timeout of a message on an integration queue', () => {
139
- const result = createBaseDefinition({}, {}, {});
140
-
141
- const sqsPermission = result.provider.iamRoleStatements.find(
142
- (stmt) => stmt.Action.includes('sqs:SendMessage')
143
- );
144
- expect(sqsPermission.Action).toContain(
145
- 'sqs:ChangeMessageVisibility'
146
- );
147
- expect(JSON.stringify(sqsPermission.Resource)).toContain('*Queue');
148
- });
149
-
150
138
  it('should include required plugins', () => {
151
139
  const result = createBaseDefinition({}, {}, {});
152
140
 
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.657.f16d20b.0",
4
+ "version": "2.0.0--canary.658.e11f3b0.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.657.f16d20b.0",
30
- "@friggframework/schemas": "2.0.0--canary.657.f16d20b.0",
31
- "@friggframework/test": "2.0.0--canary.657.f16d20b.0",
29
+ "@friggframework/core": "2.0.0--canary.658.e11f3b0.0",
30
+ "@friggframework/schemas": "2.0.0--canary.658.e11f3b0.0",
31
+ "@friggframework/test": "2.0.0--canary.658.e11f3b0.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.657.f16d20b.0",
60
- "@friggframework/prettier-config": "2.0.0--canary.657.f16d20b.0",
59
+ "@friggframework/eslint-config": "2.0.0--canary.658.e11f3b0.0",
60
+ "@friggframework/prettier-config": "2.0.0--canary.658.e11f3b0.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": "f16d20b91d76dd1c98f7e0dc91eb4026bafba2a3"
92
+ "gitHead": "e11f3b028efaf4d1f0afba0bf94022537a210356"
93
93
  }