@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.
@@ -0,0 +1,236 @@
1
+ import { C as ChangeMessageVisibilityInput, a as ChangedMessageVisibility, b as Connection, D as DeleteMessageInput, c as DeletedMessage, R as ReceiveMessagesInput, d as ReceivedMessages, e as Config, f as Credentials, O as Operations } from './connection-DqOJtCt2.js';
2
+ export { g as ChangeMessageVisibilityInputSchema, h as ChangedMessageVisibilitySchema, i as ConfigSchema, j as CredentialSource, k as DeleteMessageInputSchema, l as DeletedMessageSchema, M as Message, m as MessageAttributeValue, n as MessageAttributeValueSchema, o as MessageSchema, p as ReceiveMessagesInputSchema, q as ReceivedMessagesSchema, r as newConnection, s as newConnectionWithOperations } from './connection-DqOJtCt2.js';
3
+ import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
4
+ import { MutationDefinition, MutationStepConfig, Mutation, MutationResult, MutationStep, Call, MutationAttempt, CredentialProvider, Receipt, Failure } from '@superdurable/connectors-sdk';
5
+ import { StepTarget } from '@superdurable/dex';
6
+ import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
7
+ import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
8
+ import 'zod';
9
+
10
+ /** Stable connector identity. */
11
+ declare const ConnectorID = "amazon-sqs";
12
+ /** Provider identity for named connections. */
13
+ declare const ProviderID = "amazon-sqs";
14
+ /** Branch IDs for receiveMessages. */
15
+ declare const ReceiveMessagesBranch: {
16
+ readonly Received: "received";
17
+ readonly Empty: "empty";
18
+ readonly ProviderRejected: "providerRejected";
19
+ readonly InvalidResponse: "invalidResponse";
20
+ readonly Defect: "defect";
21
+ };
22
+ /** SQS returned at least one message. */
23
+ declare const ReceiveMessagesBranchReceived: "received";
24
+ /** No message arrived within the wait time. */
25
+ declare const ReceiveMessagesBranchEmpty: "empty";
26
+ /** 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. */
27
+ declare const ReceiveMessagesBranchProviderRejected: "providerRejected";
28
+ /** 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. */
29
+ declare const ReceiveMessagesBranchInvalidResponse: "invalidResponse";
30
+ /** Local input, connection configuration, or connector definition is invalid. */
31
+ declare const ReceiveMessagesBranchDefect: "defect";
32
+ /** Manifest definition for receiveMessages. */
33
+ declare const ReceiveMessagesDefinition: MutationDefinition;
34
+ /** Manifest metadata for receiveMessages. */
35
+ declare const ReceiveMessagesMetadata: {
36
+ readonly kind: "mutation";
37
+ readonly idempotency: "required";
38
+ readonly authorization: "required";
39
+ };
40
+ /** Branch IDs for deleteMessage. */
41
+ declare const DeleteMessageBranch: {
42
+ readonly Deleted: "deleted";
43
+ readonly ReceiptHandleInvalid: "receiptHandleInvalid";
44
+ readonly ProviderRejected: "providerRejected";
45
+ readonly Defect: "defect";
46
+ };
47
+ /** 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. */
48
+ declare const DeleteMessageBranchDeleted: "deleted";
49
+ /** 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. */
50
+ declare const DeleteMessageBranchReceiptHandleInvalid: "receiptHandleInvalid";
51
+ /** SQS conclusively rejected the deletion, such as a missing queue, a wrong Region, invalid credentials, or missing sqs:DeleteMessage permission. */
52
+ declare const DeleteMessageBranchProviderRejected: "providerRejected";
53
+ /** Local input, connection configuration, or connector definition is invalid. */
54
+ declare const DeleteMessageBranchDefect: "defect";
55
+ /** Manifest definition for deleteMessage. */
56
+ declare const DeleteMessageDefinition: MutationDefinition;
57
+ /** Manifest metadata for deleteMessage. */
58
+ declare const DeleteMessageMetadata: {
59
+ readonly kind: "mutation";
60
+ readonly idempotency: "required";
61
+ readonly authorization: "required";
62
+ };
63
+ /** Branch IDs for changeMessageVisibility. */
64
+ declare const ChangeMessageVisibilityBranch: {
65
+ readonly Changed: "changed";
66
+ readonly ReceiptHandleInvalid: "receiptHandleInvalid";
67
+ readonly ProviderRejected: "providerRejected";
68
+ readonly Defect: "defect";
69
+ };
70
+ /** SQS set the message's visibility timeout. */
71
+ declare const ChangeMessageVisibilityBranchChanged: "changed";
72
+ /** SQS no longer accepts the receipt handle, because the message is no longer in flight, was deleted, or the handle is expired or malformed. */
73
+ declare const ChangeMessageVisibilityBranchReceiptHandleInvalid: "receiptHandleInvalid";
74
+ /** 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. */
75
+ declare const ChangeMessageVisibilityBranchProviderRejected: "providerRejected";
76
+ /** Local input, connection configuration, or connector definition is invalid. */
77
+ declare const ChangeMessageVisibilityBranchDefect: "defect";
78
+ /** Manifest definition for changeMessageVisibility. */
79
+ declare const ChangeMessageVisibilityDefinition: MutationDefinition;
80
+ /** Manifest metadata for changeMessageVisibility. */
81
+ declare const ChangeMessageVisibilityMetadata: {
82
+ readonly kind: "mutation";
83
+ readonly idempotency: "required";
84
+ readonly authorization: "required";
85
+ };
86
+
87
+ /** Configuration for the receiveMessages connector Step. */
88
+ interface ReceiveMessagesStepConfig<StepInput, OperationInput = ReceiveMessagesInput, OperationOutput = ReceivedMessages> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
89
+ /** Named connection supplying this operation. */
90
+ connection: Connection<{
91
+ receiveMessages(): Mutation<OperationInput, OperationOutput>;
92
+ }>;
93
+ /** Name matching the bound connection. */
94
+ connectionName: string;
95
+ /** SQS returned at least one message. */
96
+ received: StepTarget<MutationResult<OperationOutput>>;
97
+ /** No message arrived within the wait time. */
98
+ empty?: StepTarget<MutationResult<OperationOutput>>;
99
+ /** 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. */
100
+ providerRejected?: StepTarget<MutationResult<OperationOutput>>;
101
+ /** 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. */
102
+ invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
103
+ /** Local input, connection configuration, or connector definition is invalid. */
104
+ defect?: StepTarget<MutationResult<OperationOutput>>;
105
+ }
106
+ /** Build the receiveMessages Step from a named connection. */
107
+ declare function newReceiveMessagesStep<StepInput, OperationInput = ReceiveMessagesInput, OperationOutput = ReceivedMessages>(configuration: ReceiveMessagesStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
108
+ /** Configuration for the deleteMessage connector Step. */
109
+ interface DeleteMessageStepConfig<StepInput, OperationInput = DeleteMessageInput, OperationOutput = DeletedMessage> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
110
+ /** Named connection supplying this operation. */
111
+ connection: Connection<{
112
+ deleteMessage(): Mutation<OperationInput, OperationOutput>;
113
+ }>;
114
+ /** Name matching the bound connection. */
115
+ connectionName: string;
116
+ /** 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. */
117
+ deleted: StepTarget<MutationResult<OperationOutput>>;
118
+ /** 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. */
119
+ receiptHandleInvalid?: StepTarget<MutationResult<OperationOutput>>;
120
+ /** SQS conclusively rejected the deletion, such as a missing queue, a wrong Region, invalid credentials, or missing sqs:DeleteMessage permission. */
121
+ providerRejected?: StepTarget<MutationResult<OperationOutput>>;
122
+ /** Local input, connection configuration, or connector definition is invalid. */
123
+ defect?: StepTarget<MutationResult<OperationOutput>>;
124
+ }
125
+ /** Build the deleteMessage Step from a named connection. */
126
+ declare function newDeleteMessageStep<StepInput, OperationInput = DeleteMessageInput, OperationOutput = DeletedMessage>(configuration: DeleteMessageStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
127
+ /** Configuration for the changeMessageVisibility connector Step. */
128
+ interface ChangeMessageVisibilityStepConfig<StepInput, OperationInput = ChangeMessageVisibilityInput, OperationOutput = ChangedMessageVisibility> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
129
+ /** Named connection supplying this operation. */
130
+ connection: Connection<{
131
+ changeMessageVisibility(): Mutation<OperationInput, OperationOutput>;
132
+ }>;
133
+ /** Name matching the bound connection. */
134
+ connectionName: string;
135
+ /** SQS set the message's visibility timeout. */
136
+ changed: StepTarget<MutationResult<OperationOutput>>;
137
+ /** SQS no longer accepts the receipt handle, because the message is no longer in flight, was deleted, or the handle is expired or malformed. */
138
+ receiptHandleInvalid?: StepTarget<MutationResult<OperationOutput>>;
139
+ /** 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. */
140
+ providerRejected?: StepTarget<MutationResult<OperationOutput>>;
141
+ /** Local input, connection configuration, or connector definition is invalid. */
142
+ defect?: StepTarget<MutationResult<OperationOutput>>;
143
+ }
144
+ /** Build the changeMessageVisibility Step from a named connection. */
145
+ declare function newChangeMessageVisibilityStep<StepInput, OperationInput = ChangeMessageVisibilityInput, OperationOutput = ChangedMessageVisibility>(configuration: ChangeMessageVisibilityStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
146
+
147
+ /** Receive a verified message batch from a standard or FIFO queue. */
148
+ declare class ReceiveMessagesOperation implements Mutation<ReceiveMessagesInput, ReceivedMessages> {
149
+ private readonly client;
150
+ /** Bind one SQS client. */ constructor(client: SQSClient);
151
+ /** Return the manifest operation identity. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
152
+ /** Reuse the call ID for FIFO receive deduplication. */ idempotencyKey(callId: string): string;
153
+ /** Validate, sign, send, and classify one receive attempt. */
154
+ invoke(call: Call, input: ReceiveMessagesInput): Promise<MutationAttempt<ReceivedMessages>>;
155
+ }
156
+ /** Acknowledge one received SQS delivery by receipt handle. */
157
+ declare class DeleteMessageOperation implements Mutation<DeleteMessageInput, DeletedMessage> {
158
+ private readonly client;
159
+ /** Bind one SQS client. */ constructor(client: SQSClient);
160
+ /** Return the manifest operation identity. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
161
+ /** Stable mutation key for Dex retries. */ idempotencyKey(callId: string): string;
162
+ /** Validate, sign, send, and classify one delete attempt. */
163
+ invoke(call: Call, input: DeleteMessageInput): Promise<MutationAttempt<DeletedMessage>>;
164
+ }
165
+ /** Release or extend one received SQS delivery. */
166
+ declare class ChangeMessageVisibilityOperation implements Mutation<ChangeMessageVisibilityInput, ChangedMessageVisibility> {
167
+ private readonly client;
168
+ /** Bind one SQS client. */ constructor(client: SQSClient);
169
+ /** Return the manifest operation identity. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
170
+ /** Stable mutation key for Dex retries. */ idempotencyKey(callId: string): string;
171
+ /** Validate, sign, send, and classify one visibility attempt. */
172
+ invoke(call: Call, input: ChangeMessageVisibilityInput): Promise<MutationAttempt<ChangedMessageVisibility>>;
173
+ }
174
+
175
+ /** Validated queue identity used for SQS requests and receipts. */
176
+ interface QueueAddress {
177
+ /** Full queue URL sent in the SQS JSON request. */ url: string;
178
+ /** Whether the queue name ends in .fifo. */ isFIFO: boolean;
179
+ }
180
+ /** One bounded provider reply. */
181
+ interface SQSResponse {
182
+ /** HTTP response status. */ status: number;
183
+ /** Provider response headers. */ headers: ProviderResponse['headers'];
184
+ /** Complete retained response body, or empty when oversized. */ body: Uint8Array;
185
+ /** Whether the response exceeded the configured receive limit. */ isTooLarge: boolean;
186
+ }
187
+ /** Injectable request sender for deterministic provider tests. */
188
+ type SQSRequestSender = (request: ProviderRequest) => Promise<ProviderResponse>;
189
+ /** Constructor dependencies for deterministic tests. */
190
+ interface SQSClientOptions {
191
+ /** Substitute an HTTP sender for provider tests. */ send?: SQSRequestSender;
192
+ /** Supply a deterministic signing and receipt clock. */ now?: () => Date;
193
+ }
194
+ /** Immutable SQS JSON-protocol client that resolves private credentials per call. */
195
+ declare class SQSClient {
196
+ /** Validated SQS JSON-protocol endpoint. */ readonly endpoint: string;
197
+ /** Region used in every SigV4 credential scope. */ readonly region: string;
198
+ /** Queue selected when an operation leaves queueUrl blank. */ readonly defaultQueueUrl: string;
199
+ /** Default receive batch limit, from one through ten. */ readonly maxMessagesPerReceive: number;
200
+ /** Default receive long-poll duration in seconds. */ readonly receiveWaitSeconds: number;
201
+ /** Complete response bound in bytes. */ readonly maxResponseBytes: number;
202
+ /** Whether the endpoint was derived from the Region. */ readonly isAmazonEndpoint: boolean;
203
+ /** Clock used for signing and provider receipts. */ readonly now: () => Date;
204
+ private readonly credentials;
205
+ private readonly send;
206
+ /** Validate local settings and retain host-owned credentials. */
207
+ constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: SQSClientOptions);
208
+ /** Bind the receive mutation. */ receiveMessages(): ReceiveMessagesOperation;
209
+ /** Bind the delete mutation. */ deleteMessage(): DeleteMessageOperation;
210
+ /** Bind the visibility mutation. */ changeMessageVisibility(): ChangeMessageVisibilityOperation;
211
+ /** Select the input queue or the connection default and validate its identity. */
212
+ resolveQueue(inputQueueUrl: string | undefined): QueueAddress;
213
+ /** Resolve one current access key without retaining it in a result. */
214
+ resolveCredentials(call: Call): Promise<Credentials | undefined>;
215
+ /** Sign and send one JSON-protocol action with AWS Signature Version 4. */
216
+ exchange(call: Call, credentials: Credentials, action: string, requestBody: object): Promise<SQSResponse>;
217
+ /** Build one secret-safe receipt. */
218
+ receipt(call: Call, response: SQSResponse, objectId: string): Receipt;
219
+ }
220
+ /** Stable SQS system attributes requested by every receive. */
221
+ declare function receiveSystemAttributes(): string[];
222
+ /** Read one case-insensitive response header. */
223
+ declare function header(headers: ProviderResponse['headers'], name: string): string;
224
+ /** Classify one SQS error without copying provider message text into Flow state. */
225
+ declare function classifyResponse(operation: string, subject: string, response: SQSResponse, credentials: Credentials, now: Date): {
226
+ branch: 'retry' | 'receiptHandleInvalid' | 'providerRejected';
227
+ failure: Failure;
228
+ retryAfterMs: number;
229
+ };
230
+
231
+ /** Bind SQS operations and per-call credentials to a static project connection. */
232
+ declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: SQSClientOptions): Connection;
233
+ /** Bind scripted SQS operations to one static connection name. */
234
+ declare function newSQSConnectionWithOperations(operations: Operations, connectionName: string): Connection;
235
+
236
+ export { ChangeMessageVisibilityBranch, ChangeMessageVisibilityBranchChanged, ChangeMessageVisibilityBranchDefect, ChangeMessageVisibilityBranchProviderRejected, ChangeMessageVisibilityBranchReceiptHandleInvalid, ChangeMessageVisibilityDefinition, ChangeMessageVisibilityInput, ChangeMessageVisibilityMetadata, ChangeMessageVisibilityOperation, type ChangeMessageVisibilityStepConfig, ChangedMessageVisibility, Config, Connection, ConnectorID, Credentials, DeleteMessageBranch, DeleteMessageBranchDefect, DeleteMessageBranchDeleted, DeleteMessageBranchProviderRejected, DeleteMessageBranchReceiptHandleInvalid, DeleteMessageDefinition, DeleteMessageInput, DeleteMessageMetadata, DeleteMessageOperation, type DeleteMessageStepConfig, DeletedMessage, Operations, ProviderID, type QueueAddress, ReceiveMessagesBranch, ReceiveMessagesBranchDefect, ReceiveMessagesBranchEmpty, ReceiveMessagesBranchInvalidResponse, ReceiveMessagesBranchProviderRejected, ReceiveMessagesBranchReceived, ReceiveMessagesDefinition, ReceiveMessagesInput, ReceiveMessagesMetadata, ReceiveMessagesOperation, type ReceiveMessagesStepConfig, ReceivedMessages, SQSClient, type SQSClientOptions, type SQSRequestSender, type SQSResponse, classifyResponse, header, newChangeMessageVisibilityStep, newDeleteMessageStep, newProjectConnection, newReceiveMessagesStep, newSQSConnectionWithOperations, receiveSystemAttributes };