@superdurable/connector-amazon-s3 0.0.0-stage → 0.1.1

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 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,55 @@
1
- # Temporary Holding Version
1
+ # Amazon S3 TypeScript connector
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@superdurable/connector-amazon-s3` implements the Go connector's four S3 REST
4
+ operations: `listObjects`, `headObject`, `getObjectText`, and `putObject`. The
5
+ manifest generates the operation-specific Step factories, typed models,
6
+ connections, and mock cases. The provider client signs each request with AWS
7
+ Signature Version 4 and limits response bodies. Dex owns retries; a create-only
8
+ write that encounters an existing object reads its metadata and recognizes the
9
+ same Step's `dex-idempotency-key` marker.
10
+
11
+ ## Connection
12
+
13
+ Configure the static `amazon-s3-report-archive` connection in Dex Web
14
+ **Connections**. Follow the [connector authorization guide](../README.md#authentication)
15
+ for the provider-specific access key, secret, Region, endpoint, and bucket.
16
+ The access key ID, secret access key, and optional session token remain in the
17
+ private connection store and are resolved at each Invoke. Never put them in
18
+ Flow input, Attributes, Results, receipts, logs, or fixture output.
19
+
20
+ The [checked-in Worker](examples/report-archive/main.ts) loads its connection
21
+ with these lines:
22
+
23
+ ```ts
24
+ const project = await loadFromEnvironment();
25
+ const connection = newProjectConnection(project, ConnectionName);
26
+ await runReportArchiveWorker(new ReportArchiveFlow(connection), stop.signal);
27
+ ```
28
+
29
+ `newConnection` also binds a directly constructed `S3Client` for tests or
30
+ applications with their own secret provider. An omitted endpoint selects the
31
+ Amazon S3 Regional API; a custom loopback HTTP endpoint is intended only for
32
+ local tests. The default bucket is optional. Every operation except `putObject`
33
+ is a Query. `putObject` is a repeat-safe Mutation and returns `stored` or the
34
+ optional `alreadyExists` branch after create-only read-back. All non-happy
35
+ branches are optional and fail an example Flow when unwired.
36
+
37
+ ## Example and verification
38
+
39
+ The [report archive example](examples/report-archive/) uses all four Step
40
+ factories and its static connection name. From this package directory:
41
+
42
+ ```sh
43
+ npm ci
44
+ npm run check
45
+ DEX_FLOW_SERVICE_ADDRESS=127.0.0.1:21240 npm run test:integration
46
+ ```
47
+
48
+ Start `dexcli dev` at the address before the integration test. The test runs a
49
+ real Dex Worker and Client against a local S3 fixture, including a lost PUT
50
+ response, create-only read-back, and an unwired provider rejection. The
51
+ [Go-recorded conformance fixture](../../../../conformance/connectors/amazon/s3/scenarios.json)
52
+ checks the same provider request and output contracts in TypeScript. A unit
53
+ test compares a fixed SigV4 Authorization header to the official Go signer.
54
+ Live Amazon S3, Cloudflare R2, and MinIO authorization and object behavior
55
+ have not been verified for this TypeScript package.
@@ -0,0 +1,168 @@
1
+ {
2
+ "connectorId": "amazon-s3",
3
+ "releaseTag": "connectors/amazon/s3/go/v0.23.0",
4
+ "package": {
5
+ "ecosystem": "npm",
6
+ "name": "@superdurable/connector-amazon-s3",
7
+ "version": "0.1.1"
8
+ },
9
+ "factories": [
10
+ {
11
+ "name": "newListObjectsStep",
12
+ "kind": "query",
13
+ "operationId": "listObjects",
14
+ "fields": {
15
+ "stepType": "stepType",
16
+ "annotations": "annotations",
17
+ "connectionName": "connectionName",
18
+ "resultAttribute": "resultAttribute"
19
+ },
20
+ "branches": [
21
+ {
22
+ "id": "found",
23
+ "field": "found",
24
+ "optional": false
25
+ },
26
+ {
27
+ "id": "notFound",
28
+ "field": "notFound",
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": "newHeadObjectStep",
50
+ "kind": "query",
51
+ "operationId": "headObject",
52
+ "fields": {
53
+ "stepType": "stepType",
54
+ "annotations": "annotations",
55
+ "connectionName": "connectionName",
56
+ "resultAttribute": "resultAttribute"
57
+ },
58
+ "branches": [
59
+ {
60
+ "id": "found",
61
+ "field": "found",
62
+ "optional": false
63
+ },
64
+ {
65
+ "id": "notFound",
66
+ "field": "notFound",
67
+ "optional": true
68
+ },
69
+ {
70
+ "id": "providerRejected",
71
+ "field": "providerRejected",
72
+ "optional": true
73
+ },
74
+ {
75
+ "id": "invalidResponse",
76
+ "field": "invalidResponse",
77
+ "optional": true
78
+ },
79
+ {
80
+ "id": "defect",
81
+ "field": "defect",
82
+ "optional": true
83
+ }
84
+ ]
85
+ },
86
+ {
87
+ "name": "newGetObjectTextStep",
88
+ "kind": "query",
89
+ "operationId": "getObjectText",
90
+ "fields": {
91
+ "stepType": "stepType",
92
+ "annotations": "annotations",
93
+ "connectionName": "connectionName",
94
+ "resultAttribute": "resultAttribute"
95
+ },
96
+ "branches": [
97
+ {
98
+ "id": "read",
99
+ "field": "read",
100
+ "optional": false
101
+ },
102
+ {
103
+ "id": "notFound",
104
+ "field": "notFound",
105
+ "optional": true
106
+ },
107
+ {
108
+ "id": "unsupportedContent",
109
+ "field": "unsupportedContent",
110
+ "optional": true
111
+ },
112
+ {
113
+ "id": "tooLarge",
114
+ "field": "tooLarge",
115
+ "optional": true
116
+ },
117
+ {
118
+ "id": "providerRejected",
119
+ "field": "providerRejected",
120
+ "optional": true
121
+ },
122
+ {
123
+ "id": "invalidResponse",
124
+ "field": "invalidResponse",
125
+ "optional": true
126
+ },
127
+ {
128
+ "id": "defect",
129
+ "field": "defect",
130
+ "optional": true
131
+ }
132
+ ]
133
+ },
134
+ {
135
+ "name": "newPutObjectStep",
136
+ "kind": "mutation",
137
+ "operationId": "putObject",
138
+ "fields": {
139
+ "stepType": "stepType",
140
+ "annotations": "annotations",
141
+ "connectionName": "connectionName",
142
+ "resultAttribute": "resultAttribute"
143
+ },
144
+ "branches": [
145
+ {
146
+ "id": "stored",
147
+ "field": "stored",
148
+ "optional": false
149
+ },
150
+ {
151
+ "id": "alreadyExists",
152
+ "field": "alreadyExists",
153
+ "optional": true
154
+ },
155
+ {
156
+ "id": "providerRejected",
157
+ "field": "providerRejected",
158
+ "optional": true
159
+ },
160
+ {
161
+ "id": "defect",
162
+ "field": "defect",
163
+ "optional": true
164
+ }
165
+ ]
166
+ }
167
+ ]
168
+ }
@@ -0,0 +1,269 @@
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
+ "addressingStyle": z.string().optional(),
7
+ "defaultBucket": z.string().optional(),
8
+ "listPageSize": z.number().int().optional(),
9
+ "maxResponseBytes": z.number().int().optional(),
10
+ "maxTextBytes": z.number().int().optional(),
11
+ "maxUploadBytes": z.number().int().optional()
12
+ });
13
+ var ListObjectsInputSchema = z.strictObject({
14
+ "bucket": z.string().optional(),
15
+ "prefix": z.string().optional(),
16
+ "delimiter": z.string().optional(),
17
+ "startAfter": z.string().optional(),
18
+ "continuationToken": z.string().optional(),
19
+ "maxKeys": z.number().int().optional()
20
+ });
21
+ var ObjectSummarySchema = z.strictObject({
22
+ "key": z.string(),
23
+ "sizeBytes": z.number().int(),
24
+ "eTag": z.string().optional(),
25
+ "lastModified": z.iso.datetime({ offset: true }).optional(),
26
+ "storageClass": z.string().optional()
27
+ });
28
+ var ListObjectsOutputSchema = z.strictObject({
29
+ "bucket": z.string(),
30
+ "prefix": z.string().optional(),
31
+ "delimiter": z.string().optional(),
32
+ "objects": z.array(ObjectSummarySchema).optional(),
33
+ "commonPrefixes": z.array(z.string()).optional(),
34
+ "isTruncated": z.boolean(),
35
+ "nextContinuationToken": z.string().optional()
36
+ });
37
+ var HeadObjectInputSchema = z.strictObject({
38
+ "bucket": z.string().optional(),
39
+ "key": z.string()
40
+ });
41
+ var ObjectMetadataSchema = z.strictObject({
42
+ "bucket": z.string(),
43
+ "key": z.string(),
44
+ "sizeBytes": z.number().int(),
45
+ "eTag": z.string().optional(),
46
+ "contentType": z.string().optional(),
47
+ "contentEncoding": z.string().optional(),
48
+ "contentLanguage": z.string().optional(),
49
+ "contentDisposition": z.string().optional(),
50
+ "cacheControl": z.string().optional(),
51
+ "lastModified": z.iso.datetime({ offset: true }).optional(),
52
+ "versionId": z.string().optional(),
53
+ "storageClass": z.string().optional(),
54
+ "serverSideEncryption": z.string().optional(),
55
+ "metadata": z.record(z.string(), z.string()).optional(),
56
+ "missingMetadataCount": z.number().int().optional()
57
+ });
58
+ var GetObjectTextInputSchema = z.strictObject({
59
+ "bucket": z.string().optional(),
60
+ "key": z.string()
61
+ });
62
+ var ObjectTextSchema = z.strictObject({
63
+ "bucket": z.string(),
64
+ "key": z.string(),
65
+ "contentType": z.string().optional(),
66
+ "eTag": z.string().optional(),
67
+ "versionId": z.string().optional(),
68
+ "lastModified": z.iso.datetime({ offset: true }).optional(),
69
+ "sizeBytes": z.number().int(),
70
+ "text": z.string().optional()
71
+ });
72
+ var PutObjectInputSchema = z.strictObject({
73
+ "bucket": z.string().optional(),
74
+ "key": z.string(),
75
+ "contentType": z.string(),
76
+ "textContent": z.string().optional(),
77
+ "byteContent": z.base64().optional(),
78
+ "metadata": z.record(z.string(), z.string()).optional(),
79
+ "isCreateOnly": z.boolean().optional()
80
+ });
81
+ var StoredObjectSchema = z.strictObject({
82
+ "bucket": z.string(),
83
+ "key": z.string(),
84
+ "eTag": z.string().optional(),
85
+ "versionId": z.string().optional(),
86
+ "sizeBytes": z.number().int(),
87
+ "contentType": z.string().optional(),
88
+ "lastModified": z.iso.datetime({ offset: true }).optional(),
89
+ "isFromEarlierAttempt": z.boolean().optional()
90
+ });
91
+
92
+ // src/generated/definitions.ts
93
+ var ConnectorID = "amazon-s3";
94
+ var ProviderID = "amazon-s3";
95
+ var ListObjectsBranch = {
96
+ Found: "found",
97
+ NotFound: "notFound",
98
+ ProviderRejected: "providerRejected",
99
+ InvalidResponse: "invalidResponse",
100
+ Defect: "defect"
101
+ };
102
+ var ListObjectsBranchFound = ListObjectsBranch.Found;
103
+ var ListObjectsBranchNotFound = ListObjectsBranch.NotFound;
104
+ var ListObjectsBranchProviderRejected = ListObjectsBranch.ProviderRejected;
105
+ var ListObjectsBranchInvalidResponse = ListObjectsBranch.InvalidResponse;
106
+ var ListObjectsBranchDefect = ListObjectsBranch.Defect;
107
+ var ListObjectsDefinition = {
108
+ operation: { connectorId: ConnectorID, operationId: "listObjects" },
109
+ branches: [
110
+ { id: "found", description: "The page holds objects or common prefixes, or more pages remain." },
111
+ { id: "notFound", description: "No object matched the prefix and no further page remains.", optional: true },
112
+ { id: "providerRejected", description: "The store conclusively rejected the list, such as a missing bucket, a wrong Region, invalid credentials, or missing s3:ListBucket permission.", optional: true },
113
+ { id: "invalidResponse", description: "The store returned an invalid or oversized list page.", optional: true },
114
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
115
+ ],
116
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
117
+ };
118
+ var ListObjectsMetadata = { kind: "query", idempotency: "none", authorization: "required" };
119
+ var HeadObjectBranch = {
120
+ Found: "found",
121
+ NotFound: "notFound",
122
+ ProviderRejected: "providerRejected",
123
+ InvalidResponse: "invalidResponse",
124
+ Defect: "defect"
125
+ };
126
+ var HeadObjectBranchFound = HeadObjectBranch.Found;
127
+ var HeadObjectBranchNotFound = HeadObjectBranch.NotFound;
128
+ var HeadObjectBranchProviderRejected = HeadObjectBranch.ProviderRejected;
129
+ var HeadObjectBranchInvalidResponse = HeadObjectBranch.InvalidResponse;
130
+ var HeadObjectBranchDefect = HeadObjectBranch.Defect;
131
+ var HeadObjectDefinition = {
132
+ operation: { connectorId: ConnectorID, operationId: "headObject" },
133
+ branches: [
134
+ { id: "found", description: "The store returned the object's metadata." },
135
+ { id: "notFound", description: "The object, or its bucket, does not exist; a HEAD response cannot say which.", optional: true },
136
+ { id: "providerRejected", description: "The store conclusively rejected the read, such as a wrong Region, invalid credentials, or missing s3:GetObject permission.", optional: true },
137
+ { id: "invalidResponse", description: "The store returned metadata without a valid size or modification time.", optional: true },
138
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
139
+ ],
140
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
141
+ };
142
+ var HeadObjectMetadata = { kind: "query", idempotency: "none", authorization: "required" };
143
+ var GetObjectTextBranch = {
144
+ Read: "read",
145
+ NotFound: "notFound",
146
+ UnsupportedContent: "unsupportedContent",
147
+ TooLarge: "tooLarge",
148
+ ProviderRejected: "providerRejected",
149
+ InvalidResponse: "invalidResponse",
150
+ Defect: "defect"
151
+ };
152
+ var GetObjectTextBranchRead = GetObjectTextBranch.Read;
153
+ var GetObjectTextBranchNotFound = GetObjectTextBranch.NotFound;
154
+ var GetObjectTextBranchUnsupportedContent = GetObjectTextBranch.UnsupportedContent;
155
+ var GetObjectTextBranchTooLarge = GetObjectTextBranch.TooLarge;
156
+ var GetObjectTextBranchProviderRejected = GetObjectTextBranch.ProviderRejected;
157
+ var GetObjectTextBranchInvalidResponse = GetObjectTextBranch.InvalidResponse;
158
+ var GetObjectTextBranchDefect = GetObjectTextBranch.Defect;
159
+ var GetObjectTextDefinition = {
160
+ operation: { connectorId: ConnectorID, operationId: "getObjectText" },
161
+ branches: [
162
+ { id: "read", description: "The object's complete text was read within maxTextBytes." },
163
+ { id: "notFound", description: "The object does not exist.", optional: true },
164
+ { id: "unsupportedContent", description: "The object's content type is not text, its content is encoded such as gzip, or its bytes are not valid UTF-8 text.", optional: true },
165
+ { id: "tooLarge", description: "The object is larger than maxTextBytes.", optional: true },
166
+ { id: "providerRejected", description: "The store conclusively rejected the read, such as a missing bucket, a wrong Region, invalid credentials, or missing s3:GetObject permission.", optional: true },
167
+ { id: "invalidResponse", description: "The store returned a response without a valid size or with content that contains the connection's credentials.", optional: true },
168
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
169
+ ],
170
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
171
+ };
172
+ var GetObjectTextMetadata = { kind: "query", idempotency: "none", authorization: "required" };
173
+ var PutObjectBranch = {
174
+ Stored: "stored",
175
+ AlreadyExists: "alreadyExists",
176
+ ProviderRejected: "providerRejected",
177
+ Defect: "defect"
178
+ };
179
+ var PutObjectBranchStored = PutObjectBranch.Stored;
180
+ var PutObjectBranchAlreadyExists = PutObjectBranch.AlreadyExists;
181
+ var PutObjectBranchProviderRejected = PutObjectBranch.ProviderRejected;
182
+ var PutObjectBranchDefect = PutObjectBranch.Defect;
183
+ var PutObjectDefinition = {
184
+ operation: { connectorId: ConnectorID, operationId: "putObject" },
185
+ branches: [
186
+ { id: "stored", description: "The store holds the object this Step execution wrote." },
187
+ { id: "alreadyExists", description: "Create-only mode found an object at the key that this Step execution did not write; nothing was written.", optional: true },
188
+ { id: "providerRejected", description: "The store conclusively rejected the write, such as a missing bucket, a wrong Region, invalid credentials, missing s3:PutObject permission, or a store that does not support create-only writes.", optional: true },
189
+ { id: "defect", description: "Local input, connection configuration, or connector definition is invalid.", optional: true }
190
+ ],
191
+ stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
192
+ };
193
+ var PutObjectMetadata = { kind: "mutation", idempotency: "required", authorization: "required" };
194
+
195
+ // src/generated/connection.ts
196
+ import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
197
+ var Connection = class {
198
+ /** Stable provider and connection name. */
199
+ reference;
200
+ /** Bound provider operations. */
201
+ operations;
202
+ /** Validate a reference and bind operations. */
203
+ constructor(reference, operations) {
204
+ this.reference = ConnectionRefSchema.parse(reference);
205
+ if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
206
+ if (!operations) throw new TypeError("connector operations are required");
207
+ this.operations = operations;
208
+ }
209
+ };
210
+ function newConnection(client, reference) {
211
+ if (!client) throw new TypeError("connector client is required");
212
+ return new Connection(reference, client);
213
+ }
214
+ function newConnectionWithOperations(operations, reference) {
215
+ return new Connection(reference, operations);
216
+ }
217
+ var ConnectionNameProvider = "amazon-s3";
218
+
219
+ export {
220
+ ConfigSchema,
221
+ ListObjectsInputSchema,
222
+ ObjectSummarySchema,
223
+ ListObjectsOutputSchema,
224
+ HeadObjectInputSchema,
225
+ ObjectMetadataSchema,
226
+ GetObjectTextInputSchema,
227
+ ObjectTextSchema,
228
+ PutObjectInputSchema,
229
+ StoredObjectSchema,
230
+ ConnectorID,
231
+ ProviderID,
232
+ ListObjectsBranch,
233
+ ListObjectsBranchFound,
234
+ ListObjectsBranchNotFound,
235
+ ListObjectsBranchProviderRejected,
236
+ ListObjectsBranchInvalidResponse,
237
+ ListObjectsBranchDefect,
238
+ ListObjectsDefinition,
239
+ ListObjectsMetadata,
240
+ HeadObjectBranch,
241
+ HeadObjectBranchFound,
242
+ HeadObjectBranchNotFound,
243
+ HeadObjectBranchProviderRejected,
244
+ HeadObjectBranchInvalidResponse,
245
+ HeadObjectBranchDefect,
246
+ HeadObjectDefinition,
247
+ HeadObjectMetadata,
248
+ GetObjectTextBranch,
249
+ GetObjectTextBranchRead,
250
+ GetObjectTextBranchNotFound,
251
+ GetObjectTextBranchUnsupportedContent,
252
+ GetObjectTextBranchTooLarge,
253
+ GetObjectTextBranchProviderRejected,
254
+ GetObjectTextBranchInvalidResponse,
255
+ GetObjectTextBranchDefect,
256
+ GetObjectTextDefinition,
257
+ GetObjectTextMetadata,
258
+ PutObjectBranch,
259
+ PutObjectBranchStored,
260
+ PutObjectBranchAlreadyExists,
261
+ PutObjectBranchProviderRejected,
262
+ PutObjectBranchDefect,
263
+ PutObjectDefinition,
264
+ PutObjectMetadata,
265
+ Connection,
266
+ newConnection,
267
+ newConnectionWithOperations,
268
+ ConnectionNameProvider
269
+ };