@superdurable/connector-amazon-sqs 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +27 -2
- package/dex-connector.json +115 -0
- package/dist/chunk-JUNMI7YJ.js +192 -0
- package/dist/connection-DqOJtCt2.d.ts +242 -0
- package/dist/index.d.ts +236 -0
- package/dist/index.js +641 -0
- package/dist/sqsmock.d.ts +89 -0
- package/dist/sqsmock.js +210 -0
- package/package.json +57 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Super Durable
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Amazon SQS TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
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.
|
|
6
|
+
|
|
7
|
+
## Connection
|
|
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.
|
|
10
|
+
|
|
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
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const project = await loadFromEnvironment();
|
|
15
|
+
const flow = new QueueConsumerFlow(newProjectConnection(project, ConnectionName));
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
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
|
+
## Operation behavior
|
|
21
|
+
|
|
22
|
+
`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
|
+
|
|
24
|
+
`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
|
+
|
|
26
|
+
## Verification
|
|
27
|
+
|
|
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.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "amazon-sqs",
|
|
3
|
+
"releaseTag": "connectors/amazon/sqs/go/v0.3.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-amazon-sqs",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newReceiveMessagesStep",
|
|
12
|
+
"kind": "mutation",
|
|
13
|
+
"operationId": "receiveMessages",
|
|
14
|
+
"fields": {
|
|
15
|
+
"stepType": "stepType",
|
|
16
|
+
"annotations": "annotations",
|
|
17
|
+
"connectionName": "connectionName",
|
|
18
|
+
"resultAttribute": "resultAttribute"
|
|
19
|
+
},
|
|
20
|
+
"branches": [
|
|
21
|
+
{
|
|
22
|
+
"id": "received",
|
|
23
|
+
"field": "received",
|
|
24
|
+
"optional": false
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "empty",
|
|
28
|
+
"field": "empty",
|
|
29
|
+
"optional": true
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "providerRejected",
|
|
33
|
+
"field": "providerRejected",
|
|
34
|
+
"optional": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"id": "invalidResponse",
|
|
38
|
+
"field": "invalidResponse",
|
|
39
|
+
"optional": true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "defect",
|
|
43
|
+
"field": "defect",
|
|
44
|
+
"optional": true
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "newDeleteMessageStep",
|
|
50
|
+
"kind": "mutation",
|
|
51
|
+
"operationId": "deleteMessage",
|
|
52
|
+
"fields": {
|
|
53
|
+
"stepType": "stepType",
|
|
54
|
+
"annotations": "annotations",
|
|
55
|
+
"connectionName": "connectionName",
|
|
56
|
+
"resultAttribute": "resultAttribute"
|
|
57
|
+
},
|
|
58
|
+
"branches": [
|
|
59
|
+
{
|
|
60
|
+
"id": "deleted",
|
|
61
|
+
"field": "deleted",
|
|
62
|
+
"optional": false
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "receiptHandleInvalid",
|
|
66
|
+
"field": "receiptHandleInvalid",
|
|
67
|
+
"optional": true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "providerRejected",
|
|
71
|
+
"field": "providerRejected",
|
|
72
|
+
"optional": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"id": "defect",
|
|
76
|
+
"field": "defect",
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "newChangeMessageVisibilityStep",
|
|
83
|
+
"kind": "mutation",
|
|
84
|
+
"operationId": "changeMessageVisibility",
|
|
85
|
+
"fields": {
|
|
86
|
+
"stepType": "stepType",
|
|
87
|
+
"annotations": "annotations",
|
|
88
|
+
"connectionName": "connectionName",
|
|
89
|
+
"resultAttribute": "resultAttribute"
|
|
90
|
+
},
|
|
91
|
+
"branches": [
|
|
92
|
+
{
|
|
93
|
+
"id": "changed",
|
|
94
|
+
"field": "changed",
|
|
95
|
+
"optional": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"id": "receiptHandleInvalid",
|
|
99
|
+
"field": "receiptHandleInvalid",
|
|
100
|
+
"optional": true
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "providerRejected",
|
|
104
|
+
"field": "providerRejected",
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "defect",
|
|
109
|
+
"field": "defect",
|
|
110
|
+
"optional": true
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var ConfigSchema = z.object({
|
|
4
|
+
"region": z.string().optional(),
|
|
5
|
+
"endpoint": z.string().optional(),
|
|
6
|
+
"defaultQueueUrl": z.string().optional(),
|
|
7
|
+
"maxMessagesPerReceive": z.number().int().optional(),
|
|
8
|
+
"receiveWaitSeconds": z.number().int().optional(),
|
|
9
|
+
"maxResponseBytes": z.number().int().optional()
|
|
10
|
+
});
|
|
11
|
+
var ReceiveMessagesInputSchema = z.strictObject({
|
|
12
|
+
"queueUrl": z.string().optional(),
|
|
13
|
+
"maxMessages": z.number().int().optional(),
|
|
14
|
+
"waitTimeSeconds": z.number().int().optional(),
|
|
15
|
+
"visibilityTimeoutSeconds": z.number().int().optional()
|
|
16
|
+
});
|
|
17
|
+
var MessageAttributeValueSchema = z.strictObject({
|
|
18
|
+
"dataType": z.string(),
|
|
19
|
+
"stringValue": z.string().optional(),
|
|
20
|
+
"binaryValue": z.base64().optional()
|
|
21
|
+
});
|
|
22
|
+
var MessageSchema = z.strictObject({
|
|
23
|
+
"messageId": z.string(),
|
|
24
|
+
"receiptHandle": z.string(),
|
|
25
|
+
"body": z.string(),
|
|
26
|
+
"md5OfBody": z.string(),
|
|
27
|
+
"sentAt": z.iso.datetime({ offset: true }).optional(),
|
|
28
|
+
"firstReceivedAt": z.iso.datetime({ offset: true }).optional(),
|
|
29
|
+
"receiveCount": z.number().int(),
|
|
30
|
+
"messageGroupId": z.string().optional(),
|
|
31
|
+
"messageDeduplicationId": z.string().optional(),
|
|
32
|
+
"sequenceNumber": z.string().optional(),
|
|
33
|
+
"messageAttributes": z.record(z.string(), MessageAttributeValueSchema).optional()
|
|
34
|
+
});
|
|
35
|
+
var ReceivedMessagesSchema = z.strictObject({
|
|
36
|
+
"queueUrl": z.string(),
|
|
37
|
+
"isFifo": z.boolean().optional(),
|
|
38
|
+
"messages": z.array(MessageSchema).optional()
|
|
39
|
+
});
|
|
40
|
+
var DeleteMessageInputSchema = z.strictObject({
|
|
41
|
+
"queueUrl": z.string().optional(),
|
|
42
|
+
"receiptHandle": z.string(),
|
|
43
|
+
"messageId": z.string().optional()
|
|
44
|
+
});
|
|
45
|
+
var DeletedMessageSchema = z.strictObject({
|
|
46
|
+
"queueUrl": z.string(),
|
|
47
|
+
"messageId": z.string().optional()
|
|
48
|
+
});
|
|
49
|
+
var ChangeMessageVisibilityInputSchema = z.strictObject({
|
|
50
|
+
"queueUrl": z.string().optional(),
|
|
51
|
+
"receiptHandle": z.string(),
|
|
52
|
+
"messageId": z.string().optional(),
|
|
53
|
+
"visibilityTimeoutSeconds": z.number().int()
|
|
54
|
+
});
|
|
55
|
+
var ChangedMessageVisibilitySchema = z.strictObject({
|
|
56
|
+
"queueUrl": z.string(),
|
|
57
|
+
"messageId": z.string().optional(),
|
|
58
|
+
"visibilityTimeoutSeconds": z.number().int(),
|
|
59
|
+
"visibleAfter": z.iso.datetime({ offset: true })
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// src/generated/definitions.ts
|
|
63
|
+
var ConnectorID = "amazon-sqs";
|
|
64
|
+
var ProviderID = "amazon-sqs";
|
|
65
|
+
var ReceiveMessagesBranch = {
|
|
66
|
+
Received: "received",
|
|
67
|
+
Empty: "empty",
|
|
68
|
+
ProviderRejected: "providerRejected",
|
|
69
|
+
InvalidResponse: "invalidResponse",
|
|
70
|
+
Defect: "defect"
|
|
71
|
+
};
|
|
72
|
+
var ReceiveMessagesBranchReceived = ReceiveMessagesBranch.Received;
|
|
73
|
+
var ReceiveMessagesBranchEmpty = ReceiveMessagesBranch.Empty;
|
|
74
|
+
var ReceiveMessagesBranchProviderRejected = ReceiveMessagesBranch.ProviderRejected;
|
|
75
|
+
var ReceiveMessagesBranchInvalidResponse = ReceiveMessagesBranch.InvalidResponse;
|
|
76
|
+
var ReceiveMessagesBranchDefect = ReceiveMessagesBranch.Defect;
|
|
77
|
+
var ReceiveMessagesDefinition = {
|
|
78
|
+
operation: { connectorId: ConnectorID, operationId: "receiveMessages" },
|
|
79
|
+
branches: [
|
|
80
|
+
{ id: "received", description: "SQS returned at least one message." },
|
|
81
|
+
{ id: "empty", description: "No message arrived within the wait time.", optional: true },
|
|
82
|
+
{ id: "providerRejected", description: "SQS conclusively rejected the receive, such as a missing queue, a wrong Region, invalid credentials, missing sqs:ReceiveMessage or kms:Decrypt permission, or too many in-flight messages.", optional: true },
|
|
83
|
+
{ id: "invalidResponse", description: "SQS returned an invalid or oversized batch, or a message whose body does not match its MD5 digest; the batch's messages reappear when their visibility timeout ends.", optional: true },
|
|
84
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
85
|
+
],
|
|
86
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "sync", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 3e4, maximumAttempts: 5, totalDurationMs: 12e4 } }
|
|
87
|
+
};
|
|
88
|
+
var ReceiveMessagesMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
89
|
+
var DeleteMessageBranch = {
|
|
90
|
+
Deleted: "deleted",
|
|
91
|
+
ReceiptHandleInvalid: "receiptHandleInvalid",
|
|
92
|
+
ProviderRejected: "providerRejected",
|
|
93
|
+
Defect: "defect"
|
|
94
|
+
};
|
|
95
|
+
var DeleteMessageBranchDeleted = DeleteMessageBranch.Deleted;
|
|
96
|
+
var DeleteMessageBranchReceiptHandleInvalid = DeleteMessageBranch.ReceiptHandleInvalid;
|
|
97
|
+
var DeleteMessageBranchProviderRejected = DeleteMessageBranch.ProviderRejected;
|
|
98
|
+
var DeleteMessageBranchDefect = DeleteMessageBranch.Defect;
|
|
99
|
+
var DeleteMessageDefinition = {
|
|
100
|
+
operation: { connectorId: ConnectorID, operationId: "deleteMessage" },
|
|
101
|
+
branches: [
|
|
102
|
+
{ id: "deleted", description: "SQS accepted the deletion. Amazon SQS also accepts an outdated receipt handle from an earlier delivery without deleting the message, which is then delivered again." },
|
|
103
|
+
{ id: "receiptHandleInvalid", description: "SQS no longer accepts the receipt handle, such as an expired FIFO receipt handle or a malformed one, or, on a compatible server such as ElasticMQ, a handle whose message an earlier attempt already deleted; the message may be delivered again.", optional: true },
|
|
104
|
+
{ id: "providerRejected", description: "SQS conclusively rejected the deletion, such as a missing queue, a wrong Region, invalid credentials, or missing sqs:DeleteMessage permission.", optional: true },
|
|
105
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
106
|
+
],
|
|
107
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
108
|
+
};
|
|
109
|
+
var DeleteMessageMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
110
|
+
var ChangeMessageVisibilityBranch = {
|
|
111
|
+
Changed: "changed",
|
|
112
|
+
ReceiptHandleInvalid: "receiptHandleInvalid",
|
|
113
|
+
ProviderRejected: "providerRejected",
|
|
114
|
+
Defect: "defect"
|
|
115
|
+
};
|
|
116
|
+
var ChangeMessageVisibilityBranchChanged = ChangeMessageVisibilityBranch.Changed;
|
|
117
|
+
var ChangeMessageVisibilityBranchReceiptHandleInvalid = ChangeMessageVisibilityBranch.ReceiptHandleInvalid;
|
|
118
|
+
var ChangeMessageVisibilityBranchProviderRejected = ChangeMessageVisibilityBranch.ProviderRejected;
|
|
119
|
+
var ChangeMessageVisibilityBranchDefect = ChangeMessageVisibilityBranch.Defect;
|
|
120
|
+
var ChangeMessageVisibilityDefinition = {
|
|
121
|
+
operation: { connectorId: ConnectorID, operationId: "changeMessageVisibility" },
|
|
122
|
+
branches: [
|
|
123
|
+
{ id: "changed", description: "SQS set the message's visibility timeout." },
|
|
124
|
+
{ id: "receiptHandleInvalid", description: "SQS no longer accepts the receipt handle, because the message is no longer in flight, was deleted, or the handle is expired or malformed.", optional: true },
|
|
125
|
+
{ id: "providerRejected", description: "SQS conclusively rejected the change, such as a missing queue, a wrong Region, invalid credentials, missing sqs:ChangeMessageVisibility permission, or a timeout above the 12-hour limit.", optional: true },
|
|
126
|
+
{ id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
|
|
127
|
+
],
|
|
128
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async", executeRetry: { initialIntervalMs: 1e3, backoffCoefficient: 2, maximumIntervalMs: 3e4, maximumAttempts: 5, totalDurationMs: 12e4 } }
|
|
129
|
+
};
|
|
130
|
+
var ChangeMessageVisibilityMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
|
|
131
|
+
|
|
132
|
+
// src/generated/connection.ts
|
|
133
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
134
|
+
var Connection = class {
|
|
135
|
+
/** Stable provider and connection name. */
|
|
136
|
+
reference;
|
|
137
|
+
/** Bound provider operations. */
|
|
138
|
+
operations;
|
|
139
|
+
/** Validate a reference and bind operations. */
|
|
140
|
+
constructor(reference, operations) {
|
|
141
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
142
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
143
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
144
|
+
this.operations = operations;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
function newConnection(client, reference) {
|
|
148
|
+
if (!client) throw new TypeError("connector client is required");
|
|
149
|
+
return new Connection(reference, client);
|
|
150
|
+
}
|
|
151
|
+
function newConnectionWithOperations(operations, reference) {
|
|
152
|
+
return new Connection(reference, operations);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
ConfigSchema,
|
|
157
|
+
ReceiveMessagesInputSchema,
|
|
158
|
+
MessageAttributeValueSchema,
|
|
159
|
+
MessageSchema,
|
|
160
|
+
ReceivedMessagesSchema,
|
|
161
|
+
DeleteMessageInputSchema,
|
|
162
|
+
DeletedMessageSchema,
|
|
163
|
+
ChangeMessageVisibilityInputSchema,
|
|
164
|
+
ChangedMessageVisibilitySchema,
|
|
165
|
+
ConnectorID,
|
|
166
|
+
ProviderID,
|
|
167
|
+
ReceiveMessagesBranch,
|
|
168
|
+
ReceiveMessagesBranchReceived,
|
|
169
|
+
ReceiveMessagesBranchEmpty,
|
|
170
|
+
ReceiveMessagesBranchProviderRejected,
|
|
171
|
+
ReceiveMessagesBranchInvalidResponse,
|
|
172
|
+
ReceiveMessagesBranchDefect,
|
|
173
|
+
ReceiveMessagesDefinition,
|
|
174
|
+
ReceiveMessagesMetadata,
|
|
175
|
+
DeleteMessageBranch,
|
|
176
|
+
DeleteMessageBranchDeleted,
|
|
177
|
+
DeleteMessageBranchReceiptHandleInvalid,
|
|
178
|
+
DeleteMessageBranchProviderRejected,
|
|
179
|
+
DeleteMessageBranchDefect,
|
|
180
|
+
DeleteMessageDefinition,
|
|
181
|
+
DeleteMessageMetadata,
|
|
182
|
+
ChangeMessageVisibilityBranch,
|
|
183
|
+
ChangeMessageVisibilityBranchChanged,
|
|
184
|
+
ChangeMessageVisibilityBranchReceiptHandleInvalid,
|
|
185
|
+
ChangeMessageVisibilityBranchProviderRejected,
|
|
186
|
+
ChangeMessageVisibilityBranchDefect,
|
|
187
|
+
ChangeMessageVisibilityDefinition,
|
|
188
|
+
ChangeMessageVisibilityMetadata,
|
|
189
|
+
Connection,
|
|
190
|
+
newConnection,
|
|
191
|
+
newConnectionWithOperations
|
|
192
|
+
};
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { SecretString, CredentialProvider, Mutation, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** AWS Region of the queue, written as a Region code such as eu-west-1. Open https://console.aws.amazon.com/sqs/v3/home, choose the Region in the console's Region selector, and read it from the queue URL, which starts https://sqs.<region>.amazonaws.com. An SQS-compatible server such as ElasticMQ or LocalStack uses the Region it is configured with. Not secret. A Region that differs from the queue's selects providerRejected. Blank uses the displayed default. */
|
|
7
|
+
region?: string;
|
|
8
|
+
/** Base URL of an SQS-compatible API, for a queue server other than Amazon SQS, such as http://127.0.0.1:9324 for ElasticMQ or http://127.0.0.1:4566 for LocalStack on the Worker's own host. Use HTTPS except for a loopback host; a path is kept as a prefix. The access key is used to sign requests to whatever host this names. Blank uses the Amazon SQS Regional endpoint for region, such as https://sqs.eu-west-1.amazonaws.com. */
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
/** Queue an operation uses when its input leaves queueUrl blank, written as the full queue URL, such as https://sqs.eu-west-1.amazonaws.com/123456789012/orders or https://sqs.eu-west-1.amazonaws.com/123456789012/orders.fifo. Open https://console.aws.amazon.com/sqs/v3/home > Queues, choose the queue, and copy URL from its Details panel. ElasticMQ and LocalStack print the URL when they create a queue. Not secret. Blank means every operation input must name its queueUrl. */
|
|
11
|
+
defaultQueueUrl?: string;
|
|
12
|
+
/** Most messages receiveMessages asks for when its input leaves maxMessages at zero, as a whole number from 1 up to the Amazon SQS batch limit of 10. Every received message enters Dex Flow state and stays hidden from other consumers until it is deleted or its visibility timeout ends, so ask only for what one Flow processes. Blank uses the displayed default. */
|
|
13
|
+
maxMessagesPerReceive?: number;
|
|
14
|
+
/** Seconds receiveMessages waits for a message to arrive when its input leaves waitTimeSeconds unset, as a whole number from 1 to 20. This is SQS long polling: the call returns as soon as a message arrives and avoids the empty answers a short poll gets from a sampled subset of servers. To return at once, set waitTimeSeconds to 0 in the operation input instead. Blank uses the displayed default. */
|
|
15
|
+
receiveWaitSeconds?: number;
|
|
16
|
+
/** Maximum complete receiveMessages response in bytes, as a positive integer. A larger batch selects invalidResponse and its messages reappear on the queue when their visibility timeout ends, so lower maxMessagesPerReceive before raising this, because the batch is stored in Dex Flow state. Blank uses the displayed default. */
|
|
17
|
+
maxResponseBytes?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Runtime schema for manifest configuration. */
|
|
20
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
21
|
+
region: z.ZodOptional<z.ZodString>;
|
|
22
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
23
|
+
defaultQueueUrl: z.ZodOptional<z.ZodString>;
|
|
24
|
+
maxMessagesPerReceive: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
receiveWaitSeconds: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
/** Private connector credentials resolved by the host. */
|
|
29
|
+
interface Credentials {
|
|
30
|
+
/** Secret-stored access key ID that names the key pair. Open https://console.aws.amazon.com/iam > Users > the user > Security credentials > Access keys > Create access key; long-term IDs start with AKIA and temporary IDs with ASIA. ElasticMQ and LocalStack accept any non-blank value. Dex Web stores it as a secret because it identifies the account; blank means no request can be signed. */
|
|
31
|
+
accessKeyId: SecretString;
|
|
32
|
+
/** Secret access key paired with access_key_id, shown only once when the key is created, on the IAM Retrieve access keys page (choose Show or Download .csv file). It signs every request and never leaves the Worker; Dex keeps it out of Flow state, logs, and Results. ElasticMQ and LocalStack accept any non-blank value. Blank means no request can be signed. */
|
|
33
|
+
secretAccessKey: SecretString;
|
|
34
|
+
/** Secret session token, only for temporary AWS credentials whose access key ID starts with ASIA, such as the output of aws sts get-session-token or aws sts assume-role (https://docs.aws.amazon.com/STS/latest/APIReference/API_GetSessionToken.html). Temporary credentials expire, usually within hours, and this connector cannot renew them: replace all three values before they expire, or an expired token selects providerRejected. Blank means long-term credentials, which IAM user keys use. */
|
|
35
|
+
sessionToken?: SecretString;
|
|
36
|
+
}
|
|
37
|
+
/** Host-owned source of private connector credentials. */
|
|
38
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
39
|
+
/** ReceiveMessagesInput selects one queue and how long and how many messages to wait for. */
|
|
40
|
+
interface ReceiveMessagesInput {
|
|
41
|
+
/** QueueURL is the queue URL, such as https://sqs.eu-west-1.amazonaws.com/123456789012/orders; blank uses
|
|
42
|
+
* the connection's defaultQueueUrl. */
|
|
43
|
+
"queueUrl"?: string | undefined;
|
|
44
|
+
/** MaxMessages is the most messages to receive, from 1 to 10; zero uses the connection's maxMessagesPerReceive. */
|
|
45
|
+
"maxMessages"?: number | undefined;
|
|
46
|
+
/** WaitTimeSeconds is how long to wait for a message to arrive, from 0 to 20 seconds; nil uses the
|
|
47
|
+
* connection's receiveWaitSeconds, and 0 returns at once. */
|
|
48
|
+
"waitTimeSeconds"?: number | undefined;
|
|
49
|
+
/** VisibilityTimeoutSeconds hides each received message from other consumers for this many seconds, from 0
|
|
50
|
+
* to 43200; nil uses the queue's own visibility timeout. */
|
|
51
|
+
"visibilityTimeoutSeconds"?: number | undefined;
|
|
52
|
+
}
|
|
53
|
+
/** MessageAttributeValue is one custom message attribute. */
|
|
54
|
+
interface MessageAttributeValue {
|
|
55
|
+
/** DataType is String, Number, or Binary, optionally followed by a custom type such as Number.int. */
|
|
56
|
+
"dataType": string;
|
|
57
|
+
/** StringValue holds a String or Number value. */
|
|
58
|
+
"stringValue"?: string | undefined;
|
|
59
|
+
/** BinaryValue holds a Binary value, encoded as base64 in JSON. */
|
|
60
|
+
"binaryValue"?: string | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** Message is one received message. Pass ReceiptHandle to deleteMessage or changeMessageVisibility. */
|
|
63
|
+
interface Message {
|
|
64
|
+
/** MessageID is the ID SQS assigned when the message was sent; it stays the same on every delivery. */
|
|
65
|
+
"messageId": string;
|
|
66
|
+
/** ReceiptHandle identifies this delivery of the message. Each receive returns a new handle, and only the
|
|
67
|
+
* latest one is sure to delete the message or change its visibility. */
|
|
68
|
+
"receiptHandle": string;
|
|
69
|
+
/** Body is the message body text, verified against the MD5 digest SQS sent with it. */
|
|
70
|
+
"body": string;
|
|
71
|
+
/** MD5OfBody is the hex MD5 digest of Body. */
|
|
72
|
+
"md5OfBody": string;
|
|
73
|
+
/** SentAt is when SQS accepted the message. */
|
|
74
|
+
"sentAt"?: string | undefined;
|
|
75
|
+
/** FirstReceivedAt is when any consumer first received the message. */
|
|
76
|
+
"firstReceivedAt"?: string | undefined;
|
|
77
|
+
/** ReceiveCount is how many times the message has been received, including this delivery. A count above 1
|
|
78
|
+
* means an earlier delivery was not deleted, so processing must tolerate a repeat. */
|
|
79
|
+
"receiveCount": number;
|
|
80
|
+
/** MessageGroupID is the FIFO message group; empty for a standard queue. */
|
|
81
|
+
"messageGroupId"?: string | undefined;
|
|
82
|
+
/** MessageDeduplicationID is the FIFO deduplication ID; empty for a standard queue. */
|
|
83
|
+
"messageDeduplicationId"?: string | undefined;
|
|
84
|
+
/** SequenceNumber is the FIFO sequence number, a decimal string of up to 128 bits; empty for a standard queue. */
|
|
85
|
+
"sequenceNumber"?: string | undefined;
|
|
86
|
+
/** MessageAttributes are the sender's custom message attributes, keyed by name. */
|
|
87
|
+
"messageAttributes"?: {
|
|
88
|
+
[key: string]: MessageAttributeValue;
|
|
89
|
+
} | undefined;
|
|
90
|
+
}
|
|
91
|
+
/** ReceivedMessages is one batch of received messages, in the order SQS returned them. */
|
|
92
|
+
interface ReceivedMessages {
|
|
93
|
+
/** QueueURL is the queue the batch came from. */
|
|
94
|
+
"queueUrl": string;
|
|
95
|
+
/** IsFIFO reports a FIFO queue, whose messages carry MessageGroupID and SequenceNumber. */
|
|
96
|
+
"isFifo"?: boolean | undefined;
|
|
97
|
+
/** Messages lists the received messages; it is empty only on the empty branch. */
|
|
98
|
+
"messages"?: Array<Message> | undefined;
|
|
99
|
+
}
|
|
100
|
+
/** DeleteMessageInput acknowledges one received message. */
|
|
101
|
+
interface DeleteMessageInput {
|
|
102
|
+
/** QueueURL is the queue the message came from; blank uses the connection's defaultQueueUrl. */
|
|
103
|
+
"queueUrl"?: string | undefined;
|
|
104
|
+
/** ReceiptHandle is the handle of the message's latest delivery, from receiveMessages. */
|
|
105
|
+
"receiptHandle": string;
|
|
106
|
+
/** MessageID optionally names the message in the Result and receipt; it is not sent to SQS. */
|
|
107
|
+
"messageId"?: string | undefined;
|
|
108
|
+
}
|
|
109
|
+
/** DeletedMessage identifies the acknowledged message. */
|
|
110
|
+
interface DeletedMessage {
|
|
111
|
+
/** QueueURL is the message's queue. */
|
|
112
|
+
"queueUrl": string;
|
|
113
|
+
/** MessageID is the input MessageID. */
|
|
114
|
+
"messageId"?: string | undefined;
|
|
115
|
+
}
|
|
116
|
+
/** ChangeMessageVisibilityInput releases one received message or hides it for longer. */
|
|
117
|
+
interface ChangeMessageVisibilityInput {
|
|
118
|
+
/** QueueURL is the queue the message came from; blank uses the connection's defaultQueueUrl. */
|
|
119
|
+
"queueUrl"?: string | undefined;
|
|
120
|
+
/** ReceiptHandle is the handle of the message's latest delivery, from receiveMessages. */
|
|
121
|
+
"receiptHandle": string;
|
|
122
|
+
/** MessageID optionally names the message in the Result and receipt; it is not sent to SQS. */
|
|
123
|
+
"messageId"?: string | undefined;
|
|
124
|
+
/** VisibilityTimeoutSeconds hides the message for this many seconds from now, from 0 to 43200. Zero
|
|
125
|
+
* releases it to other consumers at once. SQS caps a message's total in-flight time at 12 hours from its
|
|
126
|
+
* first receive. */
|
|
127
|
+
"visibilityTimeoutSeconds": number;
|
|
128
|
+
}
|
|
129
|
+
/** ChangedMessageVisibility records the visibility timeout SQS accepted. */
|
|
130
|
+
interface ChangedMessageVisibility {
|
|
131
|
+
/** QueueURL is the message's queue. */
|
|
132
|
+
"queueUrl": string;
|
|
133
|
+
/** MessageID is the input MessageID. */
|
|
134
|
+
"messageId"?: string | undefined;
|
|
135
|
+
/** VisibilityTimeoutSeconds is the timeout SQS accepted. */
|
|
136
|
+
"visibilityTimeoutSeconds": number;
|
|
137
|
+
/** VisibleAfter is when the message becomes visible again, measured from the Worker clock when SQS answered. */
|
|
138
|
+
"visibleAfter": string;
|
|
139
|
+
}
|
|
140
|
+
/** Runtime validator for ReceiveMessagesInput. */
|
|
141
|
+
declare const ReceiveMessagesInputSchema: z.ZodObject<{
|
|
142
|
+
queueUrl: z.ZodOptional<z.ZodString>;
|
|
143
|
+
maxMessages: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
waitTimeSeconds: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
visibilityTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
/** Runtime validator for MessageAttributeValue. */
|
|
148
|
+
declare const MessageAttributeValueSchema: z.ZodObject<{
|
|
149
|
+
dataType: z.ZodString;
|
|
150
|
+
stringValue: z.ZodOptional<z.ZodString>;
|
|
151
|
+
binaryValue: z.ZodOptional<z.ZodBase64>;
|
|
152
|
+
}, z.core.$strict>;
|
|
153
|
+
/** Runtime validator for Message. */
|
|
154
|
+
declare const MessageSchema: z.ZodObject<{
|
|
155
|
+
messageId: z.ZodString;
|
|
156
|
+
receiptHandle: z.ZodString;
|
|
157
|
+
body: z.ZodString;
|
|
158
|
+
md5OfBody: z.ZodString;
|
|
159
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
160
|
+
firstReceivedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
161
|
+
receiveCount: z.ZodNumber;
|
|
162
|
+
messageGroupId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
messageDeduplicationId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
sequenceNumber: z.ZodOptional<z.ZodString>;
|
|
165
|
+
messageAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
166
|
+
dataType: z.ZodString;
|
|
167
|
+
stringValue: z.ZodOptional<z.ZodString>;
|
|
168
|
+
binaryValue: z.ZodOptional<z.ZodBase64>;
|
|
169
|
+
}, z.core.$strict>>>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
/** Runtime validator for ReceivedMessages. */
|
|
172
|
+
declare const ReceivedMessagesSchema: z.ZodObject<{
|
|
173
|
+
queueUrl: z.ZodString;
|
|
174
|
+
isFifo: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
messages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
176
|
+
messageId: z.ZodString;
|
|
177
|
+
receiptHandle: z.ZodString;
|
|
178
|
+
body: z.ZodString;
|
|
179
|
+
md5OfBody: z.ZodString;
|
|
180
|
+
sentAt: z.ZodOptional<z.ZodISODateTime>;
|
|
181
|
+
firstReceivedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
182
|
+
receiveCount: z.ZodNumber;
|
|
183
|
+
messageGroupId: z.ZodOptional<z.ZodString>;
|
|
184
|
+
messageDeduplicationId: z.ZodOptional<z.ZodString>;
|
|
185
|
+
sequenceNumber: z.ZodOptional<z.ZodString>;
|
|
186
|
+
messageAttributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
187
|
+
dataType: z.ZodString;
|
|
188
|
+
stringValue: z.ZodOptional<z.ZodString>;
|
|
189
|
+
binaryValue: z.ZodOptional<z.ZodBase64>;
|
|
190
|
+
}, z.core.$strict>>>;
|
|
191
|
+
}, z.core.$strict>>>;
|
|
192
|
+
}, z.core.$strict>;
|
|
193
|
+
/** Runtime validator for DeleteMessageInput. */
|
|
194
|
+
declare const DeleteMessageInputSchema: z.ZodObject<{
|
|
195
|
+
queueUrl: z.ZodOptional<z.ZodString>;
|
|
196
|
+
receiptHandle: z.ZodString;
|
|
197
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.core.$strict>;
|
|
199
|
+
/** Runtime validator for DeletedMessage. */
|
|
200
|
+
declare const DeletedMessageSchema: z.ZodObject<{
|
|
201
|
+
queueUrl: z.ZodString;
|
|
202
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strict>;
|
|
204
|
+
/** Runtime validator for ChangeMessageVisibilityInput. */
|
|
205
|
+
declare const ChangeMessageVisibilityInputSchema: z.ZodObject<{
|
|
206
|
+
queueUrl: z.ZodOptional<z.ZodString>;
|
|
207
|
+
receiptHandle: z.ZodString;
|
|
208
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
209
|
+
visibilityTimeoutSeconds: z.ZodNumber;
|
|
210
|
+
}, z.core.$strict>;
|
|
211
|
+
/** Runtime validator for ChangedMessageVisibility. */
|
|
212
|
+
declare const ChangedMessageVisibilitySchema: z.ZodObject<{
|
|
213
|
+
queueUrl: z.ZodString;
|
|
214
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
215
|
+
visibilityTimeoutSeconds: z.ZodNumber;
|
|
216
|
+
visibleAfter: z.ZodISODateTime;
|
|
217
|
+
}, z.core.$strict>;
|
|
218
|
+
|
|
219
|
+
/** Typed operations supplied by a client or mock. */
|
|
220
|
+
interface Operations {
|
|
221
|
+
/** Invoke receiveMessages through this connection. */
|
|
222
|
+
receiveMessages(): Mutation<ReceiveMessagesInput, ReceivedMessages>;
|
|
223
|
+
/** Invoke deleteMessage through this connection. */
|
|
224
|
+
deleteMessage(): Mutation<DeleteMessageInput, DeletedMessage>;
|
|
225
|
+
/** Invoke changeMessageVisibility through this connection. */
|
|
226
|
+
changeMessageVisibility(): Mutation<ChangeMessageVisibilityInput, ChangedMessageVisibility>;
|
|
227
|
+
}
|
|
228
|
+
/** Named connector connection kept outside Flow state. */
|
|
229
|
+
declare class Connection<BoundOperations = Operations> {
|
|
230
|
+
/** Stable provider and connection name. */
|
|
231
|
+
readonly reference: ConnectionRef;
|
|
232
|
+
/** Bound provider operations. */
|
|
233
|
+
readonly operations: BoundOperations;
|
|
234
|
+
/** Validate a reference and bind operations. */
|
|
235
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
236
|
+
}
|
|
237
|
+
/** Bind a client to a named connection. */
|
|
238
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
239
|
+
/** Bind scripted operations to a named connection. */
|
|
240
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
241
|
+
|
|
242
|
+
export { type ChangeMessageVisibilityInput as C, type DeleteMessageInput as D, type Message as M, type Operations as O, type ReceiveMessagesInput as R, type ChangedMessageVisibility as a, Connection as b, type DeletedMessage as c, type ReceivedMessages as d, type Config as e, type Credentials as f, ChangeMessageVisibilityInputSchema as g, ChangedMessageVisibilitySchema as h, ConfigSchema as i, type CredentialSource as j, DeleteMessageInputSchema as k, DeletedMessageSchema as l, type MessageAttributeValue as m, MessageAttributeValueSchema as n, MessageSchema as o, ReceiveMessagesInputSchema as p, ReceivedMessagesSchema as q, newConnection as r, newConnectionWithOperations as s };
|