@superdurable/connector-amazon-s3 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 +54 -2
- package/dex-connector.json +168 -0
- package/dist/chunk-OCSVX3FX.js +269 -0
- package/dist/connection-DmewJaUl.d.ts +327 -0
- package/dist/index.d.ts +321 -0
- package/dist/index.js +726 -0
- package/dist/mock.d.ts +122 -0
- package/dist/mock.js +288 -0
- package/package.json +60 -4
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
|
+
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
+
import { e as Operations, d as Connection, L as ListObjectsInput, a as ListObjectsOutput, H as HeadObjectInput, b as ObjectMetadata, G as GetObjectTextInput, O as ObjectText, P as PutObjectInput, S as StoredObject, n as ObjectSummary } from './connection-DmewJaUl.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for ListObjectsInput in scripted cases. */
|
|
7
|
+
declare const emptyListObjectsInput: ListObjectsInput;
|
|
8
|
+
/** Go zero value for ObjectSummary in scripted cases. */
|
|
9
|
+
declare const emptyObjectSummary: ObjectSummary;
|
|
10
|
+
/** Go zero value for ListObjectsOutput in scripted cases. */
|
|
11
|
+
declare const emptyListObjectsOutput: ListObjectsOutput;
|
|
12
|
+
/** Go zero value for HeadObjectInput in scripted cases. */
|
|
13
|
+
declare const emptyHeadObjectInput: HeadObjectInput;
|
|
14
|
+
/** Go zero value for ObjectMetadata in scripted cases. */
|
|
15
|
+
declare const emptyObjectMetadata: ObjectMetadata;
|
|
16
|
+
/** Go zero value for GetObjectTextInput in scripted cases. */
|
|
17
|
+
declare const emptyGetObjectTextInput: GetObjectTextInput;
|
|
18
|
+
/** Go zero value for ObjectText in scripted cases. */
|
|
19
|
+
declare const emptyObjectText: ObjectText;
|
|
20
|
+
/** Go zero value for PutObjectInput in scripted cases. */
|
|
21
|
+
declare const emptyPutObjectInput: PutObjectInput;
|
|
22
|
+
/** Go zero value for StoredObject in scripted cases. */
|
|
23
|
+
declare const emptyStoredObject: StoredObject;
|
|
24
|
+
/** Script the found branch. */
|
|
25
|
+
declare function listObjectsFound(value: ListObjectsOutput, failure?: Failure): Case<ListObjectsOutput>;
|
|
26
|
+
/** Script the notFound branch. */
|
|
27
|
+
declare function listObjectsNotFound(value: ListObjectsOutput, failure?: Failure): Case<ListObjectsOutput>;
|
|
28
|
+
/** Script the providerRejected branch. */
|
|
29
|
+
declare function listObjectsProviderRejected(value: ListObjectsOutput, failure?: Failure): Case<ListObjectsOutput>;
|
|
30
|
+
/** Script the invalidResponse branch. */
|
|
31
|
+
declare function listObjectsInvalidResponse(value: ListObjectsOutput, failure?: Failure): Case<ListObjectsOutput>;
|
|
32
|
+
/** Script the defect branch. */
|
|
33
|
+
declare function listObjectsDefect(value: ListObjectsOutput, failure?: Failure): Case<ListObjectsOutput>;
|
|
34
|
+
/** Script a safe retry of listObjects. */
|
|
35
|
+
declare function listObjectsRetry(failure: Failure, retryAfterMs?: number): Case<ListObjectsOutput>;
|
|
36
|
+
/** Manifest scenario archivedReports for listObjects. */
|
|
37
|
+
declare function listObjectsArchivedReports(): Case<ListObjectsOutput>;
|
|
38
|
+
/** Default listObjects scenario. */
|
|
39
|
+
declare function listObjectsDefault(): Case<ListObjectsOutput>;
|
|
40
|
+
/** Manifest scenario noReports for listObjects. */
|
|
41
|
+
declare function listObjectsNoReports(): Case<ListObjectsOutput>;
|
|
42
|
+
/** Manifest scenario listDenied for listObjects. */
|
|
43
|
+
declare function listObjectsListDenied(): Case<ListObjectsOutput>;
|
|
44
|
+
/** Script the found branch. */
|
|
45
|
+
declare function headObjectFound(value: ObjectMetadata, failure?: Failure): Case<ObjectMetadata>;
|
|
46
|
+
/** Script the notFound branch. */
|
|
47
|
+
declare function headObjectNotFound(value: ObjectMetadata, failure?: Failure): Case<ObjectMetadata>;
|
|
48
|
+
/** Script the providerRejected branch. */
|
|
49
|
+
declare function headObjectProviderRejected(value: ObjectMetadata, failure?: Failure): Case<ObjectMetadata>;
|
|
50
|
+
/** Script the invalidResponse branch. */
|
|
51
|
+
declare function headObjectInvalidResponse(value: ObjectMetadata, failure?: Failure): Case<ObjectMetadata>;
|
|
52
|
+
/** Script the defect branch. */
|
|
53
|
+
declare function headObjectDefect(value: ObjectMetadata, failure?: Failure): Case<ObjectMetadata>;
|
|
54
|
+
/** Script a safe retry of headObject. */
|
|
55
|
+
declare function headObjectRetry(failure: Failure, retryAfterMs?: number): Case<ObjectMetadata>;
|
|
56
|
+
/** Manifest scenario archivedReportMetadata for headObject. */
|
|
57
|
+
declare function headObjectArchivedReportMetadata(): Case<ObjectMetadata>;
|
|
58
|
+
/** Default headObject scenario. */
|
|
59
|
+
declare function headObjectDefault(): Case<ObjectMetadata>;
|
|
60
|
+
/** Manifest scenario missingReportMetadata for headObject. */
|
|
61
|
+
declare function headObjectMissingReportMetadata(): Case<ObjectMetadata>;
|
|
62
|
+
/** Manifest scenario metadataDenied for headObject. */
|
|
63
|
+
declare function headObjectMetadataDenied(): Case<ObjectMetadata>;
|
|
64
|
+
/** Script the read branch. */
|
|
65
|
+
declare function getObjectTextRead(value: ObjectText, failure?: Failure): Case<ObjectText>;
|
|
66
|
+
/** Script the notFound branch. */
|
|
67
|
+
declare function getObjectTextNotFound(value: ObjectText, failure?: Failure): Case<ObjectText>;
|
|
68
|
+
/** Script the unsupportedContent branch. */
|
|
69
|
+
declare function getObjectTextUnsupportedContent(value: ObjectText, failure?: Failure): Case<ObjectText>;
|
|
70
|
+
/** Script the tooLarge branch. */
|
|
71
|
+
declare function getObjectTextTooLarge(value: ObjectText, failure?: Failure): Case<ObjectText>;
|
|
72
|
+
/** Script the providerRejected branch. */
|
|
73
|
+
declare function getObjectTextProviderRejected(value: ObjectText, failure?: Failure): Case<ObjectText>;
|
|
74
|
+
/** Script the invalidResponse branch. */
|
|
75
|
+
declare function getObjectTextInvalidResponse(value: ObjectText, failure?: Failure): Case<ObjectText>;
|
|
76
|
+
/** Script the defect branch. */
|
|
77
|
+
declare function getObjectTextDefect(value: ObjectText, failure?: Failure): Case<ObjectText>;
|
|
78
|
+
/** Script a safe retry of getObjectText. */
|
|
79
|
+
declare function getObjectTextRetry(failure: Failure, retryAfterMs?: number): Case<ObjectText>;
|
|
80
|
+
/** Manifest scenario archivedReportText for getObjectText. */
|
|
81
|
+
declare function getObjectTextArchivedReportText(): Case<ObjectText>;
|
|
82
|
+
/** Default getObjectText scenario. */
|
|
83
|
+
declare function getObjectTextDefault(): Case<ObjectText>;
|
|
84
|
+
/** Manifest scenario missingReportText for getObjectText. */
|
|
85
|
+
declare function getObjectTextMissingReportText(): Case<ObjectText>;
|
|
86
|
+
/** Manifest scenario binaryReport for getObjectText. */
|
|
87
|
+
declare function getObjectTextBinaryReport(): Case<ObjectText>;
|
|
88
|
+
/** Manifest scenario oversizedReport for getObjectText. */
|
|
89
|
+
declare function getObjectTextOversizedReport(): Case<ObjectText>;
|
|
90
|
+
/** Manifest scenario textReadDenied for getObjectText. */
|
|
91
|
+
declare function getObjectTextTextReadDenied(): Case<ObjectText>;
|
|
92
|
+
/** Script the stored branch. */
|
|
93
|
+
declare function putObjectStored(value: StoredObject, failure?: Failure): Case<StoredObject>;
|
|
94
|
+
/** Script the alreadyExists branch. */
|
|
95
|
+
declare function putObjectAlreadyExists(value: StoredObject, failure?: Failure): Case<StoredObject>;
|
|
96
|
+
/** Script the providerRejected branch. */
|
|
97
|
+
declare function putObjectProviderRejected(value: StoredObject, failure?: Failure): Case<StoredObject>;
|
|
98
|
+
/** Script the defect branch. */
|
|
99
|
+
declare function putObjectDefect(value: StoredObject, failure?: Failure): Case<StoredObject>;
|
|
100
|
+
/** Script a safe retry of putObject. */
|
|
101
|
+
declare function putObjectRetry(failure: Failure, retryAfterMs?: number): Case<StoredObject>;
|
|
102
|
+
/** Manifest scenario storedOpsReport for putObject. */
|
|
103
|
+
declare function putObjectStoredOpsReport(): Case<StoredObject>;
|
|
104
|
+
/** Default putObject scenario. */
|
|
105
|
+
declare function putObjectDefault(): Case<StoredObject>;
|
|
106
|
+
/** Manifest scenario reportAlreadyExists for putObject. */
|
|
107
|
+
declare function putObjectReportAlreadyExists(): Case<StoredObject>;
|
|
108
|
+
/** Manifest scenario storeDenied for putObject. */
|
|
109
|
+
declare function putObjectStoreDenied(): Case<StoredObject>;
|
|
110
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
111
|
+
declare class GeneratedMock implements Operations {
|
|
112
|
+
#private;
|
|
113
|
+
constructor(connectionName: string);
|
|
114
|
+
connection(): Connection;
|
|
115
|
+
listObjects(): MockQuery<ListObjectsInput, ListObjectsOutput>;
|
|
116
|
+
headObject(): MockQuery<HeadObjectInput, ObjectMetadata>;
|
|
117
|
+
getObjectText(): MockQuery<GetObjectTextInput, ObjectText>;
|
|
118
|
+
putObject(): MockMutation<PutObjectInput, StoredObject>;
|
|
119
|
+
assertNoFailures(): void;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export { GeneratedMock, emptyGetObjectTextInput, emptyHeadObjectInput, emptyListObjectsInput, emptyListObjectsOutput, emptyObjectMetadata, emptyObjectSummary, emptyObjectText, emptyPutObjectInput, emptyStoredObject, getObjectTextArchivedReportText, getObjectTextBinaryReport, getObjectTextDefault, getObjectTextDefect, getObjectTextInvalidResponse, getObjectTextMissingReportText, getObjectTextNotFound, getObjectTextOversizedReport, getObjectTextProviderRejected, getObjectTextRead, getObjectTextRetry, getObjectTextTextReadDenied, getObjectTextTooLarge, getObjectTextUnsupportedContent, headObjectArchivedReportMetadata, headObjectDefault, headObjectDefect, headObjectFound, headObjectInvalidResponse, headObjectMetadataDenied, headObjectMissingReportMetadata, headObjectNotFound, headObjectProviderRejected, headObjectRetry, listObjectsArchivedReports, listObjectsDefault, listObjectsDefect, listObjectsFound, listObjectsInvalidResponse, listObjectsListDenied, listObjectsNoReports, listObjectsNotFound, listObjectsProviderRejected, listObjectsRetry, putObjectAlreadyExists, putObjectDefault, putObjectDefect, putObjectProviderRejected, putObjectReportAlreadyExists, putObjectRetry, putObjectStoreDenied, putObjectStored, putObjectStoredOpsReport };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectorID,
|
|
3
|
+
GetObjectTextDefinition,
|
|
4
|
+
GetObjectTextInputSchema,
|
|
5
|
+
HeadObjectDefinition,
|
|
6
|
+
HeadObjectInputSchema,
|
|
7
|
+
ListObjectsDefinition,
|
|
8
|
+
ListObjectsInputSchema,
|
|
9
|
+
ListObjectsOutputSchema,
|
|
10
|
+
ObjectMetadataSchema,
|
|
11
|
+
ObjectSummarySchema,
|
|
12
|
+
ObjectTextSchema,
|
|
13
|
+
ProviderID,
|
|
14
|
+
PutObjectDefinition,
|
|
15
|
+
PutObjectInputSchema,
|
|
16
|
+
StoredObjectSchema,
|
|
17
|
+
newConnectionWithOperations
|
|
18
|
+
} from "./chunk-OCSVX3FX.js";
|
|
19
|
+
|
|
20
|
+
// src/generated/mock.ts
|
|
21
|
+
import { branchCase, retryCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
22
|
+
var emptyListObjectsInput = ListObjectsInputSchema.parse({});
|
|
23
|
+
var emptyObjectSummary = ObjectSummarySchema.parse({
|
|
24
|
+
"key": "",
|
|
25
|
+
"sizeBytes": 0
|
|
26
|
+
});
|
|
27
|
+
var emptyListObjectsOutput = ListObjectsOutputSchema.parse({
|
|
28
|
+
"bucket": "",
|
|
29
|
+
"isTruncated": false
|
|
30
|
+
});
|
|
31
|
+
var emptyHeadObjectInput = HeadObjectInputSchema.parse({
|
|
32
|
+
"key": ""
|
|
33
|
+
});
|
|
34
|
+
var emptyObjectMetadata = ObjectMetadataSchema.parse({
|
|
35
|
+
"bucket": "",
|
|
36
|
+
"key": "",
|
|
37
|
+
"sizeBytes": 0
|
|
38
|
+
});
|
|
39
|
+
var emptyGetObjectTextInput = GetObjectTextInputSchema.parse({
|
|
40
|
+
"key": ""
|
|
41
|
+
});
|
|
42
|
+
var emptyObjectText = ObjectTextSchema.parse({
|
|
43
|
+
"bucket": "",
|
|
44
|
+
"key": "",
|
|
45
|
+
"sizeBytes": 0
|
|
46
|
+
});
|
|
47
|
+
var emptyPutObjectInput = PutObjectInputSchema.parse({
|
|
48
|
+
"key": "",
|
|
49
|
+
"contentType": ""
|
|
50
|
+
});
|
|
51
|
+
var emptyStoredObject = StoredObjectSchema.parse({
|
|
52
|
+
"bucket": "",
|
|
53
|
+
"key": "",
|
|
54
|
+
"sizeBytes": 0
|
|
55
|
+
});
|
|
56
|
+
function listObjectsFound(value, failure) {
|
|
57
|
+
return branchCase("found", value, failure);
|
|
58
|
+
}
|
|
59
|
+
function listObjectsNotFound(value, failure) {
|
|
60
|
+
return branchCase("notFound", value, failure);
|
|
61
|
+
}
|
|
62
|
+
function listObjectsProviderRejected(value, failure) {
|
|
63
|
+
return branchCase("providerRejected", value, failure);
|
|
64
|
+
}
|
|
65
|
+
function listObjectsInvalidResponse(value, failure) {
|
|
66
|
+
return branchCase("invalidResponse", value, failure);
|
|
67
|
+
}
|
|
68
|
+
function listObjectsDefect(value, failure) {
|
|
69
|
+
return branchCase("defect", value, failure);
|
|
70
|
+
}
|
|
71
|
+
function listObjectsRetry(failure, retryAfterMs = 0) {
|
|
72
|
+
return retryCase(failure, retryAfterMs);
|
|
73
|
+
}
|
|
74
|
+
function listObjectsArchivedReports() {
|
|
75
|
+
const value = emptyListObjectsOutput;
|
|
76
|
+
return branchCase("found", value);
|
|
77
|
+
}
|
|
78
|
+
function listObjectsDefault() {
|
|
79
|
+
return listObjectsArchivedReports();
|
|
80
|
+
}
|
|
81
|
+
function listObjectsNoReports() {
|
|
82
|
+
const value = ListObjectsOutputSchema.parse({ "bucket": "acme-reports", "isTruncated": false, "prefix": "reports/missing/" });
|
|
83
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "listObjects", message: "No objects matched the prefix." });
|
|
84
|
+
}
|
|
85
|
+
function listObjectsListDenied() {
|
|
86
|
+
const value = emptyListObjectsOutput;
|
|
87
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "listObjects", message: "S3 denied the bucket listing." });
|
|
88
|
+
}
|
|
89
|
+
function headObjectFound(value, failure) {
|
|
90
|
+
return branchCase("found", value, failure);
|
|
91
|
+
}
|
|
92
|
+
function headObjectNotFound(value, failure) {
|
|
93
|
+
return branchCase("notFound", value, failure);
|
|
94
|
+
}
|
|
95
|
+
function headObjectProviderRejected(value, failure) {
|
|
96
|
+
return branchCase("providerRejected", value, failure);
|
|
97
|
+
}
|
|
98
|
+
function headObjectInvalidResponse(value, failure) {
|
|
99
|
+
return branchCase("invalidResponse", value, failure);
|
|
100
|
+
}
|
|
101
|
+
function headObjectDefect(value, failure) {
|
|
102
|
+
return branchCase("defect", value, failure);
|
|
103
|
+
}
|
|
104
|
+
function headObjectRetry(failure, retryAfterMs = 0) {
|
|
105
|
+
return retryCase(failure, retryAfterMs);
|
|
106
|
+
}
|
|
107
|
+
function headObjectArchivedReportMetadata() {
|
|
108
|
+
const value = ObjectMetadataSchema.parse({ "bucket": "acme-reports", "contentType": "text/markdown; charset=utf-8", "eTag": '"eccaf41434e0ed82b7154a7fd586cc58"', "key": "reports/ops-weekly.md", "lastModified": "2026-10-25T09:00:00Z", "metadata": { "dex-idempotency-key": "8a62f575-7f36-5370-af29-4aadf17e894c", "generator": "dex-s3-report-archive", "report-id": "ops-weekly" }, "sizeBytes": 72 });
|
|
109
|
+
return branchCase("found", value);
|
|
110
|
+
}
|
|
111
|
+
function headObjectDefault() {
|
|
112
|
+
return headObjectArchivedReportMetadata();
|
|
113
|
+
}
|
|
114
|
+
function headObjectMissingReportMetadata() {
|
|
115
|
+
const value = ObjectMetadataSchema.parse({ "bucket": "acme-reports", "key": "reports/missing.md", "sizeBytes": 0 });
|
|
116
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "headObject", message: "The object was not found." });
|
|
117
|
+
}
|
|
118
|
+
function headObjectMetadataDenied() {
|
|
119
|
+
const value = emptyObjectMetadata;
|
|
120
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "headObject", message: "S3 denied the metadata read." });
|
|
121
|
+
}
|
|
122
|
+
function getObjectTextRead(value, failure) {
|
|
123
|
+
return branchCase("read", value, failure);
|
|
124
|
+
}
|
|
125
|
+
function getObjectTextNotFound(value, failure) {
|
|
126
|
+
return branchCase("notFound", value, failure);
|
|
127
|
+
}
|
|
128
|
+
function getObjectTextUnsupportedContent(value, failure) {
|
|
129
|
+
return branchCase("unsupportedContent", value, failure);
|
|
130
|
+
}
|
|
131
|
+
function getObjectTextTooLarge(value, failure) {
|
|
132
|
+
return branchCase("tooLarge", value, failure);
|
|
133
|
+
}
|
|
134
|
+
function getObjectTextProviderRejected(value, failure) {
|
|
135
|
+
return branchCase("providerRejected", value, failure);
|
|
136
|
+
}
|
|
137
|
+
function getObjectTextInvalidResponse(value, failure) {
|
|
138
|
+
return branchCase("invalidResponse", value, failure);
|
|
139
|
+
}
|
|
140
|
+
function getObjectTextDefect(value, failure) {
|
|
141
|
+
return branchCase("defect", value, failure);
|
|
142
|
+
}
|
|
143
|
+
function getObjectTextRetry(failure, retryAfterMs = 0) {
|
|
144
|
+
return retryCase(failure, retryAfterMs);
|
|
145
|
+
}
|
|
146
|
+
function getObjectTextArchivedReportText() {
|
|
147
|
+
const value = ObjectTextSchema.parse({ "bucket": "acme-reports", "contentType": "text/markdown; charset=utf-8", "eTag": '"eccaf41434e0ed82b7154a7fd586cc58"', "key": "reports/ops-weekly.md", "lastModified": "2026-10-25T09:00:00Z", "sizeBytes": 72, "text": "# Ops weekly\n\nReport ID: ops-weekly\n\n- Refunds above 500 need approval.\n" });
|
|
148
|
+
return branchCase("read", value);
|
|
149
|
+
}
|
|
150
|
+
function getObjectTextDefault() {
|
|
151
|
+
return getObjectTextArchivedReportText();
|
|
152
|
+
}
|
|
153
|
+
function getObjectTextMissingReportText() {
|
|
154
|
+
const value = ObjectTextSchema.parse({ "bucket": "acme-reports", "key": "reports/missing.md", "sizeBytes": 0 });
|
|
155
|
+
return branchCase("notFound", value, { kind: "NOT_FOUND", provider: ConnectorID, operation: "getObjectText", message: "The object was not found." });
|
|
156
|
+
}
|
|
157
|
+
function getObjectTextBinaryReport() {
|
|
158
|
+
const value = ObjectTextSchema.parse({ "bucket": "acme-reports", "contentType": "application/pdf", "key": "reports/diagram.pdf", "sizeBytes": 2048 });
|
|
159
|
+
return branchCase("unsupportedContent", value, { kind: "VALIDATION", provider: ConnectorID, operation: "getObjectText", message: "The object is not UTF-8 text." });
|
|
160
|
+
}
|
|
161
|
+
function getObjectTextOversizedReport() {
|
|
162
|
+
const value = ObjectTextSchema.parse({ "bucket": "acme-reports", "contentType": "text/markdown", "key": "reports/archive-large.md", "sizeBytes": 5242880 });
|
|
163
|
+
return branchCase("tooLarge", value, { kind: "RESPONSE_TOO_LARGE", provider: ConnectorID, operation: "getObjectText", message: "The object exceeds maxTextBytes." });
|
|
164
|
+
}
|
|
165
|
+
function getObjectTextTextReadDenied() {
|
|
166
|
+
const value = emptyObjectText;
|
|
167
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "getObjectText", message: "S3 denied the object read." });
|
|
168
|
+
}
|
|
169
|
+
function putObjectStored(value, failure) {
|
|
170
|
+
return branchCase("stored", value, failure);
|
|
171
|
+
}
|
|
172
|
+
function putObjectAlreadyExists(value, failure) {
|
|
173
|
+
return branchCase("alreadyExists", value, failure);
|
|
174
|
+
}
|
|
175
|
+
function putObjectProviderRejected(value, failure) {
|
|
176
|
+
return branchCase("providerRejected", value, failure);
|
|
177
|
+
}
|
|
178
|
+
function putObjectDefect(value, failure) {
|
|
179
|
+
return branchCase("defect", value, failure);
|
|
180
|
+
}
|
|
181
|
+
function putObjectRetry(failure, retryAfterMs = 0) {
|
|
182
|
+
return retryCase(failure, retryAfterMs);
|
|
183
|
+
}
|
|
184
|
+
function putObjectStoredOpsReport() {
|
|
185
|
+
const value = StoredObjectSchema.parse({ "bucket": "acme-reports", "contentType": "text/markdown; charset=utf-8", "eTag": '"eccaf41434e0ed82b7154a7fd586cc58"', "key": "reports/ops-weekly.md", "sizeBytes": 72 });
|
|
186
|
+
return branchCase("stored", value);
|
|
187
|
+
}
|
|
188
|
+
function putObjectDefault() {
|
|
189
|
+
return putObjectStoredOpsReport();
|
|
190
|
+
}
|
|
191
|
+
function putObjectReportAlreadyExists() {
|
|
192
|
+
const value = StoredObjectSchema.parse({ "bucket": "acme-reports", "contentType": "text/markdown; charset=utf-8", "eTag": '"existing-report"', "key": "reports/ops-weekly.md", "lastModified": "2026-10-24T09:00:00Z", "sizeBytes": 43 });
|
|
193
|
+
return branchCase("alreadyExists", value, { kind: "CONFLICT", provider: ConnectorID, operation: "putObject", message: "Another object already occupies the key." });
|
|
194
|
+
}
|
|
195
|
+
function putObjectStoreDenied() {
|
|
196
|
+
const value = emptyStoredObject;
|
|
197
|
+
return branchCase("providerRejected", value, { kind: "AUTHORIZATION", provider: ConnectorID, operation: "putObject", message: "S3 denied the object write." });
|
|
198
|
+
}
|
|
199
|
+
var GeneratedMock = class {
|
|
200
|
+
#listObjects;
|
|
201
|
+
#headObject;
|
|
202
|
+
#getObjectText;
|
|
203
|
+
#putObject;
|
|
204
|
+
#connection;
|
|
205
|
+
constructor(connectionName) {
|
|
206
|
+
this.#listObjects = newQuery(ListObjectsDefinition).default(listObjectsDefault());
|
|
207
|
+
this.#headObject = newQuery(HeadObjectDefinition).default(headObjectDefault());
|
|
208
|
+
this.#getObjectText = newQuery(GetObjectTextDefinition).default(getObjectTextDefault());
|
|
209
|
+
this.#putObject = newMutation(PutObjectDefinition).default(putObjectDefault());
|
|
210
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
211
|
+
}
|
|
212
|
+
connection() {
|
|
213
|
+
return this.#connection;
|
|
214
|
+
}
|
|
215
|
+
listObjects() {
|
|
216
|
+
return this.#listObjects;
|
|
217
|
+
}
|
|
218
|
+
headObject() {
|
|
219
|
+
return this.#headObject;
|
|
220
|
+
}
|
|
221
|
+
getObjectText() {
|
|
222
|
+
return this.#getObjectText;
|
|
223
|
+
}
|
|
224
|
+
putObject() {
|
|
225
|
+
return this.#putObject;
|
|
226
|
+
}
|
|
227
|
+
assertNoFailures() {
|
|
228
|
+
this.#listObjects.assertNoFailures();
|
|
229
|
+
this.#headObject.assertNoFailures();
|
|
230
|
+
this.#getObjectText.assertNoFailures();
|
|
231
|
+
this.#putObject.assertNoFailures();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
export {
|
|
235
|
+
GeneratedMock,
|
|
236
|
+
emptyGetObjectTextInput,
|
|
237
|
+
emptyHeadObjectInput,
|
|
238
|
+
emptyListObjectsInput,
|
|
239
|
+
emptyListObjectsOutput,
|
|
240
|
+
emptyObjectMetadata,
|
|
241
|
+
emptyObjectSummary,
|
|
242
|
+
emptyObjectText,
|
|
243
|
+
emptyPutObjectInput,
|
|
244
|
+
emptyStoredObject,
|
|
245
|
+
getObjectTextArchivedReportText,
|
|
246
|
+
getObjectTextBinaryReport,
|
|
247
|
+
getObjectTextDefault,
|
|
248
|
+
getObjectTextDefect,
|
|
249
|
+
getObjectTextInvalidResponse,
|
|
250
|
+
getObjectTextMissingReportText,
|
|
251
|
+
getObjectTextNotFound,
|
|
252
|
+
getObjectTextOversizedReport,
|
|
253
|
+
getObjectTextProviderRejected,
|
|
254
|
+
getObjectTextRead,
|
|
255
|
+
getObjectTextRetry,
|
|
256
|
+
getObjectTextTextReadDenied,
|
|
257
|
+
getObjectTextTooLarge,
|
|
258
|
+
getObjectTextUnsupportedContent,
|
|
259
|
+
headObjectArchivedReportMetadata,
|
|
260
|
+
headObjectDefault,
|
|
261
|
+
headObjectDefect,
|
|
262
|
+
headObjectFound,
|
|
263
|
+
headObjectInvalidResponse,
|
|
264
|
+
headObjectMetadataDenied,
|
|
265
|
+
headObjectMissingReportMetadata,
|
|
266
|
+
headObjectNotFound,
|
|
267
|
+
headObjectProviderRejected,
|
|
268
|
+
headObjectRetry,
|
|
269
|
+
listObjectsArchivedReports,
|
|
270
|
+
listObjectsDefault,
|
|
271
|
+
listObjectsDefect,
|
|
272
|
+
listObjectsFound,
|
|
273
|
+
listObjectsInvalidResponse,
|
|
274
|
+
listObjectsListDenied,
|
|
275
|
+
listObjectsNoReports,
|
|
276
|
+
listObjectsNotFound,
|
|
277
|
+
listObjectsProviderRejected,
|
|
278
|
+
listObjectsRetry,
|
|
279
|
+
putObjectAlreadyExists,
|
|
280
|
+
putObjectDefault,
|
|
281
|
+
putObjectDefect,
|
|
282
|
+
putObjectProviderRejected,
|
|
283
|
+
putObjectReportAlreadyExists,
|
|
284
|
+
putObjectRetry,
|
|
285
|
+
putObjectStoreDenied,
|
|
286
|
+
putObjectStored,
|
|
287
|
+
putObjectStoredOpsReport
|
|
288
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-amazon-s3",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Amazon S3 object operations for Dex",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
8
|
+
"directory": "connectors/amazon/s3/typescript"
|
|
9
|
+
},
|
|
10
|
+
"type": "module",
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"registry": "https://registry.npmjs.org"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
17
|
+
},
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./mock": {
|
|
26
|
+
"types": "./dist/mock.d.ts",
|
|
27
|
+
"import": "./dist/mock.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"dex-connector.json",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"lint": "eslint src test examples",
|
|
39
|
+
"test": "npm run build && vitest run --exclude 'test/integration/**'",
|
|
40
|
+
"test:integration": "npm run build && vitest run test/integration/*.integration.test.ts",
|
|
41
|
+
"example:report-archive": "npm run build && tsx examples/report-archive/main.ts",
|
|
42
|
+
"example:report-archive:start": "npm run build && tsx examples/report-archive/start.ts",
|
|
43
|
+
"check": "npm test && npm run typecheck && npm run lint"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@superdurable/connectors-sdk": "0.1.0",
|
|
47
|
+
"@superdurable/dex": ">=1.28.0",
|
|
48
|
+
"fast-xml-parser": "^5.11.2",
|
|
49
|
+
"zod": "^4.1.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.0.0",
|
|
53
|
+
"@types/node": "^22.0.0",
|
|
54
|
+
"eslint": "^9.0.0",
|
|
55
|
+
"tsup": "^8.0.0",
|
|
56
|
+
"tsx": "^4.23.15",
|
|
57
|
+
"typescript": "^5.9.0",
|
|
58
|
+
"typescript-eslint": "^8.0.0",
|
|
59
|
+
"vitest": "^3.0.0",
|
|
60
|
+
"yaml": "^2.9.1"
|
|
61
|
+
}
|
|
62
|
+
}
|