@friggframework/devtools 2.0.0--canary.657.798cee9.0 → 2.0.0--canary.657.f16d20b.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.
|
@@ -13,12 +13,19 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
const { InfrastructureBuilder, ValidationResult } = require('../shared/base-builder');
|
|
16
|
+
const { ResourceOwnership } = require('../shared/types/resource-ownership');
|
|
16
17
|
const {
|
|
17
18
|
isScopedEnvironmentActive,
|
|
18
19
|
getIntegrationFunctionNames,
|
|
19
20
|
getAdminFunctionNames,
|
|
20
21
|
} = require('../shared/function-environments');
|
|
21
22
|
|
|
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
|
+
|
|
22
29
|
const declaresRateLimit = (integration) =>
|
|
23
30
|
Object.values(integration?.Definition?.modules ?? {}).some((module) =>
|
|
24
31
|
Boolean(module?.definition?.API?.rateLimit)
|
|
@@ -113,7 +120,11 @@ class SchedulerBuilder extends InfrastructureBuilder {
|
|
|
113
120
|
if (Array.isArray(appDefinition.integrations)) {
|
|
114
121
|
appDefinition.integrations.forEach((integration) => {
|
|
115
122
|
const integrationName = integration?.Definition?.name;
|
|
116
|
-
if (
|
|
123
|
+
if (
|
|
124
|
+
integration.ownership?.queue === ResourceOwnership.EXTERNAL
|
|
125
|
+
) {
|
|
126
|
+
queueArns.push(queueArnFromUrl(integration.queue.url));
|
|
127
|
+
} else if (integrationName) {
|
|
117
128
|
const capitalizedName =
|
|
118
129
|
integrationName.charAt(0).toUpperCase() +
|
|
119
130
|
integrationName.slice(1);
|
|
@@ -170,4 +170,48 @@ describe('SchedulerBuilder', () => {
|
|
|
170
170
|
expect(result.functionEnvironments).toBeUndefined();
|
|
171
171
|
});
|
|
172
172
|
});
|
|
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
|
+
});
|
|
173
217
|
});
|
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.
|
|
4
|
+
"version": "2.0.0--canary.657.f16d20b.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.
|
|
30
|
-
"@friggframework/schemas": "2.0.0--canary.657.
|
|
31
|
-
"@friggframework/test": "2.0.0--canary.657.
|
|
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",
|
|
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.
|
|
60
|
-
"@friggframework/prettier-config": "2.0.0--canary.657.
|
|
59
|
+
"@friggframework/eslint-config": "2.0.0--canary.657.f16d20b.0",
|
|
60
|
+
"@friggframework/prettier-config": "2.0.0--canary.657.f16d20b.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": "
|
|
92
|
+
"gitHead": "f16d20b91d76dd1c98f7e0dc91eb4026bafba2a3"
|
|
93
93
|
}
|