@superdurable/connector-amazon-sqs 0.1.1 → 0.2.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.
package/README.md CHANGED
@@ -1,28 +1,31 @@
1
1
  # Amazon SQS TypeScript connector
2
2
 
3
- `@superdurable/connector-amazon-sqs` implements `receiveMessages`, `deleteMessage`, and `changeMessageVisibility` as Dex Mutations. The package includes generated operation models, Step factories, mock cases, and `dex-connector.json`; hand-written code signs the SQS JSON protocol with AWS Signature Version 4 and classifies provider outcomes. It has no Trigger.
3
+ `@superdurable/connector-amazon-sqs` implements all ten Amazon SQS operations, including sending messages and managing queues. The custom `newConnectionWithOperations` constructor in version 0.2.0 requires handlers for all ten operations. The package includes generated operation models, Step factories, mock cases, and `dex-connector.json`; hand-written code signs the SQS JSON protocol with AWS Signature Version 4 and classifies provider outcomes. It has no Trigger.
4
4
 
5
- Install the published package with `npm install @superdurable/connector-amazon-sqs@0.1.0`. Node.js 22 or 24 is required by the Connector SDK. For this checkout, run `npm ci` from this directory.
5
+ Install the published package with `npm install @superdurable/connector-amazon-sqs`. Node.js 22 or 24 is required by the Connector SDK. For this checkout, run `npm ci` from this directory.
6
6
 
7
7
  ## Connection
8
8
 
9
- Create an IAM access key in [AWS IAM](https://console.aws.amazon.com/iam) under **Users > your Dex user > Security credentials > Access keys > Create access key**. Restrict the user to `sqs:ReceiveMessage`, `sqs:DeleteMessage`, and `sqs:ChangeMessageVisibility` on the queue ARN. A customer managed KMS key also needs `kms:Decrypt`. Store the access key ID in `access_key_id` and its secret in `secret_access_key` in Dex Web **Connections**. Temporary credentials also need `session_token`; the connector does not renew them. Credentials are resolved before each operation and never placed in Flow input or Attributes.
9
+ Create an IAM access key in [AWS IAM](https://console.aws.amazon.com/iam) under **Users > your Dex user > Security credentials > Access keys > Create access key**. Restrict the user to `sqs:ReceiveMessage`, `sqs:DeleteMessage`, and `sqs:ChangeMessageVisibility` on the queue ARN. A customer managed KMS key also needs `kms:Decrypt`. For additional operations, grant the actions listed in the [connector guide](../README.md). Store the access key ID in `access_key_id` and its secret in `secret_access_key` in Dex Web **Connections**. Temporary credentials also need `session_token`; the connector does not renew them. Credentials are resolved before each operation and never placed in Flow input or Attributes.
10
10
 
11
11
  Set `region` to the Region of the queue URL shown in [SQS Queues](https://console.aws.amazon.com/sqs/v3/home). Set `defaultQueueUrl` to let operation inputs omit `queueUrl`. Leave `endpoint` blank for the Amazon Regional endpoint. For ElasticMQ or LocalStack, set their own loopback endpoint and Region. The [runnable queue consumer](examples/queue-consumer/README.md) binds the static `amazon-sqs-orders` connection:
12
12
 
13
13
  ```ts
14
14
  const project = await loadFromEnvironment();
15
- const flow = new QueueConsumerFlow(newProjectConnection(project, ConnectionName));
15
+ const connection = newProjectConnection(project, ConnectionName);
16
+ const flow = new QueueConsumerFlow(connection);
16
17
  ```
17
18
 
18
19
  This snippet comes from [main.ts](examples/queue-consumer/main.ts). The complete Flow in [flow.ts](examples/queue-consumer/flow.ts) receives one event, deletes a valid order event, and releases an invalid event with a zero visibility timeout. The queue should have a redrive policy and a visibility timeout longer than the Flow's processing time.
19
20
 
20
21
  ## Operation behavior
21
22
 
23
+ `sendMessage` uses the Dex call ID as the FIFO deduplication ID, verifies the returned body MD5, and caps possible sends after an unknown outcome. The queue operations list, create, resolve, read settings, update settings, and delete.
24
+
22
25
  `receiveMessages` requests at most ten messages. An omitted `waitTimeSeconds` uses the connection's long-poll default; zero returns immediately. An omitted `visibilityTimeoutSeconds` uses the queue's visibility setting. A FIFO queue sends the stable Dex Call ID as `ReceiveRequestAttemptId`, so a retry within SQS's deduplication window gets the same batch. Standard queues may return more messages after a lost response; these reappear when their visibility timeout ends. Received bodies are checked against the SQS MD5 digest. The `received` branch carries at least one message, `empty` carries none, and `providerRejected`, `invalidResponse`, and `defect` are optional.
23
26
 
24
27
  `deleteMessage` acknowledges a receipt handle. `changeMessageVisibility` sets its timeout from now, with zero releasing the message. Both accept a `messageId` for Results and receipts but do not send it to SQS. Their happy branches are `deleted` and `changed`; `receiptHandleInvalid`, `providerRejected`, and `defect` are optional. A repeated deletion is safe, though a compatible server may reject a handle already deleted. A repeated visibility change starts the timeout again. Transport, 429, and 5xx failures Retry through Dex; exhausted retries fail the Flow. None of these operations declares uncertainty.
25
28
 
26
29
  ## Verification
27
30
 
28
- From the repository root, run `GOWORK=off go run ./cmd/connectorctl generate --check connectors/amazon/sqs/connector.yaml` and `make test-connector-conformance CONNECTOR_DIRECTORY=connectors/amazon/sqs`. From this directory run `npm run check`. The 32 Go-recorded scenarios cover every branch, 429/503, before-send and after-send transport failures, FIFO deduplication, signed requests, and retry stability. With `dexcli dev` running, `npm run integration:queue-consumer` exercises the checked-in Flow through a real Dex Worker and Client. Provider replay and the scripted Dex integration test do not verify a live Amazon SQS account; live provider behavior remains unverified for this TypeScript package.
31
+ From the repository root, run `GOWORK=off go run ./cmd/connectorctl generate --check connectors/amazon/sqs/connector.yaml` and `make test-connector-conformance CONNECTOR_DIRECTORY=connectors/amazon/sqs`. From this directory run `npm run check`. Go-recorded scenarios cover every branch, 429/503, before-send and after-send transport failures, FIFO deduplication, signed requests, and retry stability. With `dexcli dev` running, `npm run integration:queue-consumer` exercises the consumer. Run `npm run test:integration` to verify sends and queue management through a real Dex Worker and Client. Provider replay and the scripted Dex integration test do not verify a live Amazon SQS account; live provider behavior remains unverified for this TypeScript package.
@@ -1,16 +1,75 @@
1
1
  {
2
2
  "connectorId": "amazon-sqs",
3
- "releaseTag": "connectors/amazon/sqs/go/v0.3.0",
3
+ "releaseTag": "connectors/amazon/sqs/go/v0.4.0",
4
4
  "package": {
5
5
  "ecosystem": "npm",
6
6
  "name": "@superdurable/connector-amazon-sqs",
7
- "version": "0.1.1"
7
+ "version": "0.2.0"
8
8
  },
9
9
  "factories": [
10
+ {
11
+ "name": "newSendMessageStep",
12
+ "kind": "mutation",
13
+ "operationId": "sendMessage",
14
+ "inputType": "SendMessageInput",
15
+ "description": "Send one UTF-8 message to a standard or FIFO queue; a standard queue may receive duplicates after an unknown outcome, so the connector caps possible sends at three.",
16
+ "fields": {
17
+ "stepType": "stepType",
18
+ "annotations": "annotations",
19
+ "connectionName": "connectionName",
20
+ "resultAttribute": "resultAttribute"
21
+ },
22
+ "branches": [
23
+ {
24
+ "id": "sent",
25
+ "field": "sent",
26
+ "optional": false
27
+ },
28
+ {
29
+ "id": "providerRejected",
30
+ "field": "providerRejected",
31
+ "optional": true
32
+ },
33
+ {
34
+ "id": "uncertain",
35
+ "field": "uncertain",
36
+ "optional": true
37
+ },
38
+ {
39
+ "id": "defect",
40
+ "field": "defect",
41
+ "optional": true
42
+ }
43
+ ],
44
+ "inputSchema": {
45
+ "additionalProperties": false,
46
+ "description": "SendMessageInput sends one UTF-8 message to a standard or FIFO queue.",
47
+ "properties": {
48
+ "body": {
49
+ "description": "Body is nonempty UTF-8 text, at most 256 KiB for the default SQS queue size limit.",
50
+ "type": "string"
51
+ },
52
+ "messageGroupId": {
53
+ "description": "MessageGroupID is required for FIFO queues and optional for standard fair queues.",
54
+ "type": "string"
55
+ },
56
+ "queueUrl": {
57
+ "description": "QueueURL is the full URL from SQS Console > Queues > selected queue; blank uses defaultQueueUrl.",
58
+ "type": "string"
59
+ }
60
+ },
61
+ "required": [
62
+ "body"
63
+ ],
64
+ "type": "object"
65
+ }
66
+ },
10
67
  {
11
68
  "name": "newReceiveMessagesStep",
12
69
  "kind": "mutation",
13
70
  "operationId": "receiveMessages",
71
+ "inputType": "ReceiveMessagesInput",
72
+ "description": "Long-poll one queue for up to ten messages with their bodies, receipt handles, receive counts, and message attributes, hiding each received message from other consumers for its visibility timeout.",
14
73
  "fields": {
15
74
  "stepType": "stepType",
16
75
  "annotations": "annotations",
@@ -43,12 +102,37 @@
43
102
  "field": "defect",
44
103
  "optional": true
45
104
  }
46
- ]
105
+ ],
106
+ "inputSchema": {
107
+ "additionalProperties": false,
108
+ "description": "ReceiveMessagesInput selects one queue and how long and how many messages to wait for.",
109
+ "properties": {
110
+ "maxMessages": {
111
+ "description": "MaxMessages is the most messages to receive, from 1 to 10; zero uses the connection's maxMessagesPerReceive.",
112
+ "type": "integer"
113
+ },
114
+ "queueUrl": {
115
+ "description": "QueueURL is the queue URL, such as https://sqs.eu-west-1.amazonaws.com/123456789012/orders; blank uses the connection's defaultQueueUrl.",
116
+ "type": "string"
117
+ },
118
+ "visibilityTimeoutSeconds": {
119
+ "description": "VisibilityTimeoutSeconds hides each received message from other consumers for this many seconds, from 0 to 43200; nil uses the queue's own visibility timeout.",
120
+ "type": "integer"
121
+ },
122
+ "waitTimeSeconds": {
123
+ "description": "WaitTimeSeconds is how long to wait for a message to arrive, from 0 to 20 seconds; nil uses the connection's receiveWaitSeconds, and 0 returns at once.",
124
+ "type": "integer"
125
+ }
126
+ },
127
+ "type": "object"
128
+ }
47
129
  },
48
130
  {
49
131
  "name": "newDeleteMessageStep",
50
132
  "kind": "mutation",
51
133
  "operationId": "deleteMessage",
134
+ "inputType": "DeleteMessageInput",
135
+ "description": "Acknowledge one received message by deleting it from its queue with the receipt handle of its latest delivery, so SQS does not deliver it again; repeating an attempt is safe.",
52
136
  "fields": {
53
137
  "stepType": "stepType",
54
138
  "annotations": "annotations",
@@ -76,12 +160,36 @@
76
160
  "field": "defect",
77
161
  "optional": true
78
162
  }
79
- ]
163
+ ],
164
+ "inputSchema": {
165
+ "additionalProperties": false,
166
+ "description": "DeleteMessageInput acknowledges one received message.",
167
+ "properties": {
168
+ "messageId": {
169
+ "description": "MessageID optionally names the message in the Result and receipt; it is not sent to SQS.",
170
+ "type": "string"
171
+ },
172
+ "queueUrl": {
173
+ "description": "QueueURL is the queue the message came from; blank uses the connection's defaultQueueUrl.",
174
+ "type": "string"
175
+ },
176
+ "receiptHandle": {
177
+ "description": "ReceiptHandle is the handle of the message's latest delivery, from receiveMessages.",
178
+ "type": "string"
179
+ }
180
+ },
181
+ "required": [
182
+ "receiptHandle"
183
+ ],
184
+ "type": "object"
185
+ }
80
186
  },
81
187
  {
82
188
  "name": "newChangeMessageVisibilityStep",
83
189
  "kind": "mutation",
84
190
  "operationId": "changeMessageVisibility",
191
+ "inputType": "ChangeMessageVisibilityInput",
192
+ "description": "Release one received message back to the queue at once with a zero timeout, or hide it for longer while the Flow keeps processing it, by setting its visibility timeout from now.",
85
193
  "fields": {
86
194
  "stepType": "stepType",
87
195
  "annotations": "annotations",
@@ -109,7 +217,343 @@
109
217
  "field": "defect",
110
218
  "optional": true
111
219
  }
112
- ]
220
+ ],
221
+ "inputSchema": {
222
+ "additionalProperties": false,
223
+ "description": "ChangeMessageVisibilityInput releases one received message or hides it for longer.",
224
+ "properties": {
225
+ "messageId": {
226
+ "description": "MessageID optionally names the message in the Result and receipt; it is not sent to SQS.",
227
+ "type": "string"
228
+ },
229
+ "queueUrl": {
230
+ "description": "QueueURL is the queue the message came from; blank uses the connection's defaultQueueUrl.",
231
+ "type": "string"
232
+ },
233
+ "receiptHandle": {
234
+ "description": "ReceiptHandle is the handle of the message's latest delivery, from receiveMessages.",
235
+ "type": "string"
236
+ },
237
+ "visibilityTimeoutSeconds": {
238
+ "description": "VisibilityTimeoutSeconds hides the message for this many seconds from now, from 0 to 43200. Zero releases it to other consumers at once. SQS caps a message's total in-flight time at 12 hours from its first receive.",
239
+ "type": "integer"
240
+ }
241
+ },
242
+ "required": [
243
+ "receiptHandle",
244
+ "visibilityTimeoutSeconds"
245
+ ],
246
+ "type": "object"
247
+ }
248
+ },
249
+ {
250
+ "name": "newListQueuesStep",
251
+ "kind": "query",
252
+ "operationId": "listQueues",
253
+ "inputType": "ListQueuesInput",
254
+ "description": "List queue URLs in the selected Region, with an optional name prefix and page token.",
255
+ "fields": {
256
+ "stepType": "stepType",
257
+ "annotations": "annotations",
258
+ "connectionName": "connectionName",
259
+ "resultAttribute": "resultAttribute"
260
+ },
261
+ "branches": [
262
+ {
263
+ "id": "page",
264
+ "field": "page",
265
+ "optional": false
266
+ },
267
+ {
268
+ "id": "providerRejected",
269
+ "field": "providerRejected",
270
+ "optional": true
271
+ },
272
+ {
273
+ "id": "invalidResponse",
274
+ "field": "invalidResponse",
275
+ "optional": true
276
+ },
277
+ {
278
+ "id": "defect",
279
+ "field": "defect",
280
+ "optional": true
281
+ }
282
+ ],
283
+ "inputSchema": {
284
+ "additionalProperties": false,
285
+ "description": "ListQueuesInput selects a bounded page of queue URLs in the connection Region.",
286
+ "properties": {
287
+ "maxResults": {
288
+ "description": "MaxResults is 1–1000; zero uses 100.",
289
+ "type": "integer"
290
+ },
291
+ "nextToken": {
292
+ "description": "NextToken selects the next page; blank starts at the beginning.",
293
+ "type": "string"
294
+ },
295
+ "queueNamePrefix": {
296
+ "description": "QueueNamePrefix optionally filters names by their first characters.",
297
+ "type": "string"
298
+ }
299
+ },
300
+ "type": "object"
301
+ }
302
+ },
303
+ {
304
+ "name": "newCreateQueueStep",
305
+ "kind": "mutation",
306
+ "operationId": "createQueue",
307
+ "inputType": "CreateQueueInput",
308
+ "description": "Create a standard or FIFO queue by name, or return its existing URL when attributes match.",
309
+ "fields": {
310
+ "stepType": "stepType",
311
+ "annotations": "annotations",
312
+ "connectionName": "connectionName",
313
+ "resultAttribute": "resultAttribute"
314
+ },
315
+ "branches": [
316
+ {
317
+ "id": "created",
318
+ "field": "created",
319
+ "optional": false
320
+ },
321
+ {
322
+ "id": "providerRejected",
323
+ "field": "providerRejected",
324
+ "optional": true
325
+ },
326
+ {
327
+ "id": "invalidResponse",
328
+ "field": "invalidResponse",
329
+ "optional": true
330
+ },
331
+ {
332
+ "id": "defect",
333
+ "field": "defect",
334
+ "optional": true
335
+ }
336
+ ],
337
+ "inputSchema": {
338
+ "additionalProperties": false,
339
+ "description": "CreateQueueInput defines a queue by name and bounded creation attributes.",
340
+ "properties": {
341
+ "attributes": {
342
+ "additionalProperties": {
343
+ "type": "string"
344
+ },
345
+ "description": "Attributes contains FifoQueue, VisibilityTimeout, ReceiveMessageWaitTimeSeconds, DelaySeconds, or MaximumMessageSize.",
346
+ "type": "object"
347
+ },
348
+ "queueName": {
349
+ "description": "QueueName is unique within the account and Region.",
350
+ "type": "string"
351
+ }
352
+ },
353
+ "required": [
354
+ "queueName"
355
+ ],
356
+ "type": "object"
357
+ }
358
+ },
359
+ {
360
+ "name": "newGetQueueURLStep",
361
+ "kind": "query",
362
+ "operationId": "getQueueURL",
363
+ "inputType": "QueueNameInput",
364
+ "description": "Resolve a queue name to its full URL in the selected Region.",
365
+ "fields": {
366
+ "stepType": "stepType",
367
+ "annotations": "annotations",
368
+ "connectionName": "connectionName",
369
+ "resultAttribute": "resultAttribute"
370
+ },
371
+ "branches": [
372
+ {
373
+ "id": "found",
374
+ "field": "found",
375
+ "optional": false
376
+ },
377
+ {
378
+ "id": "missing",
379
+ "field": "missing",
380
+ "optional": true
381
+ },
382
+ {
383
+ "id": "providerRejected",
384
+ "field": "providerRejected",
385
+ "optional": true
386
+ },
387
+ {
388
+ "id": "invalidResponse",
389
+ "field": "invalidResponse",
390
+ "optional": true
391
+ },
392
+ {
393
+ "id": "defect",
394
+ "field": "defect",
395
+ "optional": true
396
+ }
397
+ ],
398
+ "inputSchema": {
399
+ "additionalProperties": false,
400
+ "description": "QueueNameInput identifies one queue by name.",
401
+ "properties": {
402
+ "queueName": {
403
+ "description": "QueueName is a standard name or a name ending in .fifo.",
404
+ "type": "string"
405
+ }
406
+ },
407
+ "required": [
408
+ "queueName"
409
+ ],
410
+ "type": "object"
411
+ }
412
+ },
413
+ {
414
+ "name": "newGetQueueAttributesStep",
415
+ "kind": "query",
416
+ "operationId": "getQueueAttributes",
417
+ "inputType": "QueueURLInput",
418
+ "description": "Read all named settings and approximate counts for one queue.",
419
+ "fields": {
420
+ "stepType": "stepType",
421
+ "annotations": "annotations",
422
+ "connectionName": "connectionName",
423
+ "resultAttribute": "resultAttribute"
424
+ },
425
+ "branches": [
426
+ {
427
+ "id": "found",
428
+ "field": "found",
429
+ "optional": false
430
+ },
431
+ {
432
+ "id": "missing",
433
+ "field": "missing",
434
+ "optional": true
435
+ },
436
+ {
437
+ "id": "providerRejected",
438
+ "field": "providerRejected",
439
+ "optional": true
440
+ },
441
+ {
442
+ "id": "invalidResponse",
443
+ "field": "invalidResponse",
444
+ "optional": true
445
+ },
446
+ {
447
+ "id": "defect",
448
+ "field": "defect",
449
+ "optional": true
450
+ }
451
+ ],
452
+ "inputSchema": {
453
+ "additionalProperties": false,
454
+ "description": "QueueURLInput identifies an existing queue; blank uses the connection defaultQueueUrl.",
455
+ "properties": {
456
+ "queueUrl": {
457
+ "description": "QueueURL is the complete SQS queue URL.",
458
+ "type": "string"
459
+ }
460
+ },
461
+ "type": "object"
462
+ }
463
+ },
464
+ {
465
+ "name": "newSetQueueAttributeStep",
466
+ "kind": "mutation",
467
+ "operationId": "setQueueAttribute",
468
+ "inputType": "SetQueueAttributeInput",
469
+ "description": "Replace one bounded queue timing or size setting with an absolute value.",
470
+ "fields": {
471
+ "stepType": "stepType",
472
+ "annotations": "annotations",
473
+ "connectionName": "connectionName",
474
+ "resultAttribute": "resultAttribute"
475
+ },
476
+ "branches": [
477
+ {
478
+ "id": "updated",
479
+ "field": "updated",
480
+ "optional": false
481
+ },
482
+ {
483
+ "id": "providerRejected",
484
+ "field": "providerRejected",
485
+ "optional": true
486
+ },
487
+ {
488
+ "id": "defect",
489
+ "field": "defect",
490
+ "optional": true
491
+ }
492
+ ],
493
+ "inputSchema": {
494
+ "additionalProperties": false,
495
+ "description": "SetQueueAttributeInput replaces one bounded queue setting.",
496
+ "properties": {
497
+ "attributeName": {
498
+ "description": "AttributeName is VisibilityTimeout, ReceiveMessageWaitTimeSeconds, DelaySeconds, or MaximumMessageSize.",
499
+ "type": "string"
500
+ },
501
+ "attributeValue": {
502
+ "description": "AttributeValue is an integer as decimal text, in seconds or bytes according to AttributeName.",
503
+ "type": "string"
504
+ },
505
+ "queueUrl": {
506
+ "description": "QueueURL is the target queue; blank uses defaultQueueUrl.",
507
+ "type": "string"
508
+ }
509
+ },
510
+ "required": [
511
+ "attributeName",
512
+ "attributeValue"
513
+ ],
514
+ "type": "object"
515
+ }
516
+ },
517
+ {
518
+ "name": "newDeleteQueueStep",
519
+ "kind": "mutation",
520
+ "operationId": "deleteQueue",
521
+ "inputType": "QueueURLInput",
522
+ "description": "Delete one queue by URL; repeated deletion is accepted by SQS.",
523
+ "fields": {
524
+ "stepType": "stepType",
525
+ "annotations": "annotations",
526
+ "connectionName": "connectionName",
527
+ "resultAttribute": "resultAttribute"
528
+ },
529
+ "branches": [
530
+ {
531
+ "id": "deleted",
532
+ "field": "deleted",
533
+ "optional": false
534
+ },
535
+ {
536
+ "id": "providerRejected",
537
+ "field": "providerRejected",
538
+ "optional": true
539
+ },
540
+ {
541
+ "id": "defect",
542
+ "field": "defect",
543
+ "optional": true
544
+ }
545
+ ],
546
+ "inputSchema": {
547
+ "additionalProperties": false,
548
+ "description": "QueueURLInput identifies an existing queue; blank uses the connection defaultQueueUrl.",
549
+ "properties": {
550
+ "queueUrl": {
551
+ "description": "QueueURL is the complete SQS queue URL.",
552
+ "type": "string"
553
+ }
554
+ },
555
+ "type": "object"
556
+ }
113
557
  }
114
558
  ]
115
559
  }