@friggframework/core 2.0.0--canary.531.5ea5dab.0 → 2.0.0--canary.531.6010724.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,34 @@
13
13
  * scheduledAt: new Date(Date.now() + 6 * 24 * 60 * 60 * 1000), // 6 days
14
14
  * event: 'REFRESH_WEBHOOK',
15
15
  * payload: { integrationId: 'abc123' },
16
- * queueArn: process.env.ZOHO_QUEUE_ARN,
16
+ * queueUrl: process.env.ZOHO_QUEUE_URL,
17
17
  * });
18
18
  */
19
19
 
20
20
  const { createSchedulerAdapter } = require('../../infrastructure/scheduler');
21
21
 
22
+ /**
23
+ * Derive SQS ARN from SQS URL
24
+ *
25
+ * SQS URL format: https://sqs.{region}.amazonaws.com/{account-id}/{queue-name}
26
+ * SQS ARN format: arn:aws:sqs:{region}:{account-id}:{queue-name}
27
+ *
28
+ * @param {string} queueUrl - SQS queue URL
29
+ * @returns {string} SQS queue ARN
30
+ */
31
+ function deriveArnFromQueueUrl(queueUrl) {
32
+ try {
33
+ const url = new URL(queueUrl);
34
+ const region = url.hostname.split('.')[1];
35
+ const pathParts = url.pathname.split('/').filter(Boolean);
36
+ const accountId = pathParts[0];
37
+ const queueName = pathParts[1];
38
+ return `arn:aws:sqs:${region}:${accountId}:${queueName}`;
39
+ } catch (error) {
40
+ throw new Error(`Invalid SQS queue URL: ${queueUrl}`);
41
+ }
42
+ }
43
+
22
44
  const ERROR_CODE_MAP = {
23
45
  SCHEDULER_NOT_CONFIGURED: 503,
24
46
  INVALID_JOB_DATA: 400,
@@ -73,10 +95,10 @@ function createSchedulerCommands({ integrationName }) {
73
95
  * @param {Date} params.scheduledAt - When to execute the job
74
96
  * @param {string} params.event - Event name to trigger
75
97
  * @param {Object} params.payload - Additional payload data
76
- * @param {string} params.queueArn - Target SQS queue ARN
98
+ * @param {string} params.queueUrl - Target SQS queue URL (ARN is derived internally)
77
99
  * @returns {Promise<{jobArn: string, scheduledAt: string} | {error: number, reason: string}>}
78
100
  */
79
- async scheduleJob({ jobId, scheduledAt, event, payload, queueArn }) {
101
+ async scheduleJob({ jobId, scheduledAt, event, payload, queueUrl }) {
80
102
  try {
81
103
  if (!jobId) {
82
104
  const error = new Error('jobId is required');
@@ -96,12 +118,15 @@ function createSchedulerCommands({ integrationName }) {
96
118
  throw error;
97
119
  }
98
120
 
99
- if (!queueArn) {
100
- const error = new Error('queueArn is required');
121
+ if (!queueUrl) {
122
+ const error = new Error('queueUrl is required');
101
123
  error.code = 'INVALID_JOB_DATA';
102
124
  throw error;
103
125
  }
104
126
 
127
+ // Derive ARN from URL
128
+ const queueArn = deriveArnFromQueueUrl(queueUrl);
129
+
105
130
  const adapter = getSchedulerAdapter();
106
131
  if (!adapter) {
107
132
  console.warn(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.531.5ea5dab.0",
4
+ "version": "2.0.0--canary.531.6010724.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -38,9 +38,9 @@
38
38
  }
39
39
  },
40
40
  "devDependencies": {
41
- "@friggframework/eslint-config": "2.0.0--canary.531.5ea5dab.0",
42
- "@friggframework/prettier-config": "2.0.0--canary.531.5ea5dab.0",
43
- "@friggframework/test": "2.0.0--canary.531.5ea5dab.0",
41
+ "@friggframework/eslint-config": "2.0.0--canary.531.6010724.0",
42
+ "@friggframework/prettier-config": "2.0.0--canary.531.6010724.0",
43
+ "@friggframework/test": "2.0.0--canary.531.6010724.0",
44
44
  "@prisma/client": "^6.17.0",
45
45
  "@types/lodash": "4.17.15",
46
46
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -80,5 +80,5 @@
80
80
  "publishConfig": {
81
81
  "access": "public"
82
82
  },
83
- "gitHead": "5ea5dabaae4cbfd82a68377cfb0d516d93a88bb9"
83
+ "gitHead": "60107247dd96cf3cb94cea4b6ef7851ed6c88ea0"
84
84
  }