@procedures/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/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/README.md +886 -2
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/module.d.ts +16 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +151 -0
- package/dist/module.js.map +1 -0
- package/dist/procedures/s3/delete.d.ts +26 -0
- package/dist/procedures/s3/delete.d.ts.map +1 -0
- package/dist/procedures/s3/delete.js +40 -0
- package/dist/procedures/s3/delete.js.map +1 -0
- package/dist/procedures/s3/download.d.ts +36 -0
- package/dist/procedures/s3/download.d.ts.map +1 -0
- package/dist/procedures/s3/download.js +143 -0
- package/dist/procedures/s3/download.js.map +1 -0
- package/dist/procedures/s3/index.d.ts +13 -0
- package/dist/procedures/s3/index.d.ts.map +1 -0
- package/dist/procedures/s3/index.js +13 -0
- package/dist/procedures/s3/index.js.map +1 -0
- package/dist/procedures/s3/list-all.d.ts +24 -0
- package/dist/procedures/s3/list-all.d.ts.map +1 -0
- package/dist/procedures/s3/list-all.js +57 -0
- package/dist/procedures/s3/list-all.js.map +1 -0
- package/dist/procedures/s3/list.d.ts +28 -0
- package/dist/procedures/s3/list.d.ts.map +1 -0
- package/dist/procedures/s3/list.js +56 -0
- package/dist/procedures/s3/list.js.map +1 -0
- package/dist/procedures/s3/multipart-abort.d.ts +21 -0
- package/dist/procedures/s3/multipart-abort.d.ts.map +1 -0
- package/dist/procedures/s3/multipart-abort.js +33 -0
- package/dist/procedures/s3/multipart-abort.js.map +1 -0
- package/dist/procedures/s3/multipart-complete.d.ts +26 -0
- package/dist/procedures/s3/multipart-complete.d.ts.map +1 -0
- package/dist/procedures/s3/multipart-complete.js +51 -0
- package/dist/procedures/s3/multipart-complete.js.map +1 -0
- package/dist/procedures/s3/multipart-init.d.ts +24 -0
- package/dist/procedures/s3/multipart-init.d.ts.map +1 -0
- package/dist/procedures/s3/multipart-init.js +42 -0
- package/dist/procedures/s3/multipart-init.js.map +1 -0
- package/dist/procedures/s3/multipart-upload.d.ts +24 -0
- package/dist/procedures/s3/multipart-upload.d.ts.map +1 -0
- package/dist/procedures/s3/multipart-upload.js +44 -0
- package/dist/procedures/s3/multipart-upload.js.map +1 -0
- package/dist/procedures/s3/upload.d.ts +30 -0
- package/dist/procedures/s3/upload.d.ts.map +1 -0
- package/dist/procedures/s3/upload.js +50 -0
- package/dist/procedures/s3/upload.js.map +1 -0
- package/dist/register.d.ts +8 -0
- package/dist/register.d.ts.map +1 -0
- package/dist/register.js +14 -0
- package/dist/register.js.map +1 -0
- package/dist/s3-client.d.ts +38 -0
- package/dist/s3-client.d.ts.map +1 -0
- package/dist/s3-client.js +83 -0
- package/dist/s3-client.js.map +1 -0
- package/dist/types.d.ts +198 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +197 -0
- package/dist/types.js.map +1 -0
- package/package.json +77 -3
- package/src/index.ts +73 -0
- package/src/module.ts +211 -0
- package/src/procedures/s3/delete.ts +45 -0
- package/src/procedures/s3/download.ts +155 -0
- package/src/procedures/s3/index.ts +13 -0
- package/src/procedures/s3/list-all.ts +63 -0
- package/src/procedures/s3/list.ts +63 -0
- package/src/procedures/s3/multipart-abort.ts +40 -0
- package/src/procedures/s3/multipart-complete.ts +58 -0
- package/src/procedures/s3/multipart-init.ts +50 -0
- package/src/procedures/s3/multipart-upload.ts +53 -0
- package/src/procedures/s3/upload.ts +56 -0
- package/src/register.ts +17 -0
- package/src/s3-client.ts +94 -0
- package/src/types.ts +425 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* client-s3 - AWS S3 procedures for the client ecosystem
|
|
3
|
+
*
|
|
4
|
+
* Provides upload, download, list, delete, and multipart upload operations.
|
|
5
|
+
* Credentials are loaded from environment variables (all optional — when the
|
|
6
|
+
* static keys are absent the AWS SDK default credential provider chain is used):
|
|
7
|
+
* - AWS_ACCESS_KEY_ID (optional; pair with AWS_SECRET_ACCESS_KEY)
|
|
8
|
+
* - AWS_SECRET_ACCESS_KEY (optional)
|
|
9
|
+
* - AWS_SESSION_TOKEN (optional, for STS/SSO temporary credentials)
|
|
10
|
+
* - AWS_REGION (optional, defaults to us-east-1)
|
|
11
|
+
* - S3_ENDPOINT (optional, for MinIO/LocalStack)
|
|
12
|
+
*/
|
|
13
|
+
import "./register.js";
|
|
14
|
+
export type { S3Config, S3UploadInput, S3UploadOutput, S3DownloadInput, S3DownloadOutput, S3ListInput, S3ListOutput, S3ListObject, S3ListAllInput, S3ListAllOutput, S3DeleteInput, S3DeleteOutput, S3MultipartInitInput, S3MultipartInitOutput, S3MultipartUploadInput, S3MultipartUploadOutput, S3MultipartCompleteInput, S3MultipartCompleteOutput, S3MultipartAbortInput, S3MultipartAbortOutput, } from "./types.js";
|
|
15
|
+
export { S3UploadInputSchema, S3DownloadInputSchema, S3ListInputSchema, S3ListAllInputSchema, S3DeleteInputSchema, S3MultipartInitInputSchema, S3MultipartUploadInputSchema, S3MultipartCompleteInputSchema, S3MultipartAbortInputSchema, } from "./types.js";
|
|
16
|
+
export { getS3Config, createS3Client, getS3Client, resetS3Client, } from "./s3-client.js";
|
|
17
|
+
export { s3Upload, s3Download, s3List, s3ListAll, s3Delete, s3MultipartInit, s3MultipartUpload, s3MultipartComplete, s3MultipartAbort, } from "./procedures/s3/index.js";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,eAAe,CAAC;AAGvB,YAAY,EACV,QAAQ,EACR,aAAa,EACb,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* client-s3 - AWS S3 procedures for the client ecosystem
|
|
3
|
+
*
|
|
4
|
+
* Provides upload, download, list, delete, and multipart upload operations.
|
|
5
|
+
* Credentials are loaded from environment variables (all optional — when the
|
|
6
|
+
* static keys are absent the AWS SDK default credential provider chain is used):
|
|
7
|
+
* - AWS_ACCESS_KEY_ID (optional; pair with AWS_SECRET_ACCESS_KEY)
|
|
8
|
+
* - AWS_SECRET_ACCESS_KEY (optional)
|
|
9
|
+
* - AWS_SESSION_TOKEN (optional, for STS/SSO temporary credentials)
|
|
10
|
+
* - AWS_REGION (optional, defaults to us-east-1)
|
|
11
|
+
* - S3_ENDPOINT (optional, for MinIO/LocalStack)
|
|
12
|
+
*/
|
|
13
|
+
// Importing the package registers its procedures, as in the other client packages (BUGS-2026-07 H18)
|
|
14
|
+
import "./register.js";
|
|
15
|
+
// Re-export schemas for external use
|
|
16
|
+
export { S3UploadInputSchema, S3DownloadInputSchema, S3ListInputSchema, S3ListAllInputSchema, S3DeleteInputSchema, S3MultipartInitInputSchema, S3MultipartUploadInputSchema, S3MultipartCompleteInputSchema, S3MultipartAbortInputSchema, } from "./types.js";
|
|
17
|
+
// Re-export S3 client utilities
|
|
18
|
+
export { getS3Config, createS3Client, getS3Client, resetS3Client, } from "./s3-client.js";
|
|
19
|
+
// Re-export procedure implementations for direct use
|
|
20
|
+
export { s3Upload, s3Download, s3List, s3ListAll, s3Delete, s3MultipartInit, s3MultipartUpload, s3MultipartComplete, s3MultipartAbort, } from "./procedures/s3/index.js";
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,qGAAqG;AACrG,OAAO,eAAe,CAAC;AA0BvB,qCAAqC;AACrC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,YAAY,CAAC;AAEpB,gCAAgC;AAChC,OAAO,EACL,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,qDAAqD;AACrD,OAAO,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC"}
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module (no side effects): the procedures of this package as data, for `createRegistry()`.
|
|
3
|
+
*
|
|
4
|
+
* Procedure Registration for S3 operations
|
|
5
|
+
*
|
|
6
|
+
* Provides s3.upload, s3.download, s3.list, s3.delete, and s3.multipart.* procedures.
|
|
7
|
+
* Credentials are loaded from environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
|
|
8
|
+
*/
|
|
9
|
+
import { type ProcedureModule } from "@procedures/client";
|
|
10
|
+
/**
|
|
11
|
+
* The module of this package, for `createRegistry()`: its procedures as data. Importing this
|
|
12
|
+
* file registers nothing. (`register.ts` registers the same procedures in the global registry.)
|
|
13
|
+
*/
|
|
14
|
+
export declare const s3Module: ProcedureModule;
|
|
15
|
+
export default s3Module;
|
|
16
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA6C,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAyLrG;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,eAUnB,CAAC;eAEU,QAAQ"}
|
package/dist/module.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module (no side effects): the procedures of this package as data, for `createRegistry()`.
|
|
3
|
+
*
|
|
4
|
+
* Procedure Registration for S3 operations
|
|
5
|
+
*
|
|
6
|
+
* Provides s3.upload, s3.download, s3.list, s3.delete, and s3.multipart.* procedures.
|
|
7
|
+
* Credentials are loaded from environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
|
|
8
|
+
*/
|
|
9
|
+
import { createProcedure, zodAdapter, defineModule } from "@procedures/client";
|
|
10
|
+
import { s3Upload, s3Download, s3List, s3ListAll, s3Delete, s3MultipartInit, s3MultipartUpload, s3MultipartComplete, s3MultipartAbort, } from "./procedures/s3/index.js";
|
|
11
|
+
import { S3UploadInputSchema, S3DownloadInputSchema, S3ListInputSchema, S3ListAllInputSchema, S3DeleteInputSchema, S3MultipartInitInputSchema, S3MultipartUploadInputSchema, S3MultipartCompleteInputSchema, S3MultipartAbortInputSchema, S3UploadOutputSchema, S3DownloadOutputSchema, S3ListOutputSchema, S3ListAllOutputSchema, S3DeleteOutputSchema, S3MultipartInitOutputSchema, S3MultipartUploadOutputSchema, S3MultipartCompleteOutputSchema, S3MultipartAbortOutputSchema, } from "./types.js";
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// Procedures
|
|
14
|
+
// =============================================================================
|
|
15
|
+
const s3UploadProcedure = createProcedure()
|
|
16
|
+
.path(["s3", "upload"])
|
|
17
|
+
.input(zodAdapter(S3UploadInputSchema))
|
|
18
|
+
.output(zodAdapter(S3UploadOutputSchema))
|
|
19
|
+
.meta({
|
|
20
|
+
description: "Upload content to S3 bucket",
|
|
21
|
+
shorts: { bucket: "b", key: "k" },
|
|
22
|
+
output: "json",
|
|
23
|
+
})
|
|
24
|
+
.handler(async (input) => {
|
|
25
|
+
return s3Upload(input);
|
|
26
|
+
})
|
|
27
|
+
.build();
|
|
28
|
+
const s3DownloadProcedure = createProcedure()
|
|
29
|
+
.path(["s3", "download"])
|
|
30
|
+
.input(zodAdapter(S3DownloadInputSchema))
|
|
31
|
+
.output(zodAdapter(S3DownloadOutputSchema))
|
|
32
|
+
.meta({
|
|
33
|
+
description: "Download content from S3 bucket",
|
|
34
|
+
shorts: { bucket: "b", key: "k", encoding: "e" },
|
|
35
|
+
output: "json",
|
|
36
|
+
})
|
|
37
|
+
.handler(async (input) => {
|
|
38
|
+
return s3Download(input);
|
|
39
|
+
})
|
|
40
|
+
.build();
|
|
41
|
+
const s3ListProcedure = createProcedure()
|
|
42
|
+
.path(["s3", "list"])
|
|
43
|
+
.input(zodAdapter(S3ListInputSchema))
|
|
44
|
+
.output(zodAdapter(S3ListOutputSchema))
|
|
45
|
+
.meta({
|
|
46
|
+
description: "List objects in S3 bucket",
|
|
47
|
+
shorts: { bucket: "b", prefix: "p", maxKeys: "n" },
|
|
48
|
+
output: "json",
|
|
49
|
+
})
|
|
50
|
+
.handler(async (input) => {
|
|
51
|
+
return s3List(input);
|
|
52
|
+
})
|
|
53
|
+
.build();
|
|
54
|
+
const s3ListAllProcedure = createProcedure()
|
|
55
|
+
.path(["s3", "listAll"])
|
|
56
|
+
.input(zodAdapter(S3ListAllInputSchema))
|
|
57
|
+
.output(zodAdapter(S3ListAllOutputSchema))
|
|
58
|
+
.meta({
|
|
59
|
+
description: "List ALL objects in S3 bucket, following continuation tokens (unbounded by 1000)",
|
|
60
|
+
shorts: { bucket: "b", prefix: "p", maxKeys: "n" },
|
|
61
|
+
output: "json",
|
|
62
|
+
})
|
|
63
|
+
.handler(async (input) => {
|
|
64
|
+
return s3ListAll(input);
|
|
65
|
+
})
|
|
66
|
+
.build();
|
|
67
|
+
const s3DeleteProcedure = createProcedure()
|
|
68
|
+
.path(["s3", "delete"])
|
|
69
|
+
.input(zodAdapter(S3DeleteInputSchema))
|
|
70
|
+
.output(zodAdapter(S3DeleteOutputSchema))
|
|
71
|
+
.meta({
|
|
72
|
+
description: "Delete object from S3 bucket",
|
|
73
|
+
shorts: { bucket: "b", key: "k" },
|
|
74
|
+
output: "json",
|
|
75
|
+
})
|
|
76
|
+
.handler(async (input) => {
|
|
77
|
+
return s3Delete(input);
|
|
78
|
+
})
|
|
79
|
+
.build();
|
|
80
|
+
const s3MultipartInitProcedure = createProcedure()
|
|
81
|
+
.path(["s3", "multipart", "init"])
|
|
82
|
+
.input(zodAdapter(S3MultipartInitInputSchema))
|
|
83
|
+
.output(zodAdapter(S3MultipartInitOutputSchema))
|
|
84
|
+
.meta({
|
|
85
|
+
description: "Initialize multipart upload for large files",
|
|
86
|
+
shorts: { bucket: "b", key: "k" },
|
|
87
|
+
output: "json",
|
|
88
|
+
})
|
|
89
|
+
.handler(async (input) => {
|
|
90
|
+
return s3MultipartInit(input);
|
|
91
|
+
})
|
|
92
|
+
.build();
|
|
93
|
+
const s3MultipartUploadProcedure = createProcedure()
|
|
94
|
+
.path(["s3", "multipart", "upload"])
|
|
95
|
+
.input(zodAdapter(S3MultipartUploadInputSchema))
|
|
96
|
+
.output(zodAdapter(S3MultipartUploadOutputSchema))
|
|
97
|
+
.meta({
|
|
98
|
+
description: "Upload a part in multipart upload",
|
|
99
|
+
shorts: { bucket: "b", key: "k", partNumber: "n" },
|
|
100
|
+
output: "json",
|
|
101
|
+
})
|
|
102
|
+
.handler(async (input) => {
|
|
103
|
+
return s3MultipartUpload(input);
|
|
104
|
+
})
|
|
105
|
+
.build();
|
|
106
|
+
const s3MultipartCompleteProcedure = createProcedure()
|
|
107
|
+
.path(["s3", "multipart", "complete"])
|
|
108
|
+
.input(zodAdapter(S3MultipartCompleteInputSchema))
|
|
109
|
+
.output(zodAdapter(S3MultipartCompleteOutputSchema))
|
|
110
|
+
.meta({
|
|
111
|
+
description: "Complete multipart upload by assembling parts",
|
|
112
|
+
shorts: { bucket: "b", key: "k" },
|
|
113
|
+
output: "json",
|
|
114
|
+
})
|
|
115
|
+
.handler(async (input) => {
|
|
116
|
+
return s3MultipartComplete(input);
|
|
117
|
+
})
|
|
118
|
+
.build();
|
|
119
|
+
const s3MultipartAbortProcedure = createProcedure()
|
|
120
|
+
.path(["s3", "multipart", "abort"])
|
|
121
|
+
.input(zodAdapter(S3MultipartAbortInputSchema))
|
|
122
|
+
.output(zodAdapter(S3MultipartAbortOutputSchema))
|
|
123
|
+
.meta({
|
|
124
|
+
description: "Abort multipart upload and clean up parts",
|
|
125
|
+
shorts: { bucket: "b", key: "k" },
|
|
126
|
+
output: "json",
|
|
127
|
+
})
|
|
128
|
+
.handler(async (input) => {
|
|
129
|
+
return s3MultipartAbort(input);
|
|
130
|
+
})
|
|
131
|
+
.build();
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// Registration
|
|
134
|
+
// =============================================================================
|
|
135
|
+
/**
|
|
136
|
+
* The module of this package, for `createRegistry()`: its procedures as data. Importing this
|
|
137
|
+
* file registers nothing. (`register.ts` registers the same procedures in the global registry.)
|
|
138
|
+
*/
|
|
139
|
+
export const s3Module = defineModule("@procedures/s3", [
|
|
140
|
+
s3UploadProcedure,
|
|
141
|
+
s3DownloadProcedure,
|
|
142
|
+
s3ListProcedure,
|
|
143
|
+
s3ListAllProcedure,
|
|
144
|
+
s3DeleteProcedure,
|
|
145
|
+
s3MultipartInitProcedure,
|
|
146
|
+
s3MultipartUploadProcedure,
|
|
147
|
+
s3MultipartCompleteProcedure,
|
|
148
|
+
s3MultipartAbortProcedure,
|
|
149
|
+
]);
|
|
150
|
+
export default s3Module;
|
|
151
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAwB,MAAM,oBAAoB,CAAC;AACrG,OAAO,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAQ,EACR,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,4BAA4B,EAC5B,8BAA8B,EAC9B,2BAA2B,EAmB3B,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,6BAA6B,EAC7B,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AAEpB,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,MAAM,iBAAiB,GAAG,eAAe,EAAE;KACxC,IAAI,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KACtB,KAAK,CAAC,UAAU,CAAgB,mBAAmB,CAAC,CAAC;KACrD,MAAM,CAAC,UAAU,CAAiB,oBAAoB,CAAC,CAAC;KACxD,IAAI,CAAC;IACJ,WAAW,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OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC,CAAC;KACD,KAAK,EAAE,CAAC;AAEX,MAAM,yBAAyB,GAAG,eAAe,EAAE;KAChD,IAAI,CAAC,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;KAClC,KAAK,CAAC,UAAU,CAAwB,2BAA2B,CAAC,CAAC;KACrE,MAAM,CAAC,UAAU,CAAyB,4BAA4B,CAAC,CAAC;KACxE,IAAI,CAAC;IACJ,WAAW,EAAE,2CAA2C;IACxD,MAAM,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;IACjC,MAAM,EAAE,MAAM;CACf,CAAC;KACD,OAAO,CAAC,KAAK,EAAE,KAA4B,EAAmC,EAAE;IAC/E,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC,CAAC;KACD,KAAK,EAAE,CAAC;AAEX,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAoB,YAAY,CAAC,gBAAgB,EAAE;IACpE,iBAAiB;IACjB,mBAAmB;IACnB,eAAe;IACf,kBAAkB;IAClB,iBAAiB;IACjB,wBAAwB;IACxB,0BAA0B;IAC1B,4BAA4B;IAC5B,yBAAyB;CAC1B,CAAC,CAAC;AAEL,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* s3.delete procedure
|
|
3
|
+
*
|
|
4
|
+
* Delete object from S3 bucket.
|
|
5
|
+
*/
|
|
6
|
+
import type { S3DeleteInput, S3DeleteOutput } from "../../types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Delete object from S3
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Delete an object
|
|
12
|
+
* await client.call(["s3", "delete"], {
|
|
13
|
+
* bucket: "my-bucket",
|
|
14
|
+
* key: "path/to/file.json",
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Delete specific version
|
|
19
|
+
* await client.call(["s3", "delete"], {
|
|
20
|
+
* bucket: "my-bucket",
|
|
21
|
+
* key: "path/to/file.json",
|
|
22
|
+
* versionId: "abc123",
|
|
23
|
+
* });
|
|
24
|
+
*/
|
|
25
|
+
export declare function s3Delete(input: S3DeleteInput): Promise<S3DeleteOutput>;
|
|
26
|
+
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/procedures/s3/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEpE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAgB5E"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* s3.delete procedure
|
|
3
|
+
*
|
|
4
|
+
* Delete object from S3 bucket.
|
|
5
|
+
*/
|
|
6
|
+
import { DeleteObjectCommand } from "@aws-sdk/client-s3";
|
|
7
|
+
import { getS3Client } from "../../s3-client.js";
|
|
8
|
+
/**
|
|
9
|
+
* Delete object from S3
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Delete an object
|
|
13
|
+
* await client.call(["s3", "delete"], {
|
|
14
|
+
* bucket: "my-bucket",
|
|
15
|
+
* key: "path/to/file.json",
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Delete specific version
|
|
20
|
+
* await client.call(["s3", "delete"], {
|
|
21
|
+
* bucket: "my-bucket",
|
|
22
|
+
* key: "path/to/file.json",
|
|
23
|
+
* versionId: "abc123",
|
|
24
|
+
* });
|
|
25
|
+
*/
|
|
26
|
+
export async function s3Delete(input) {
|
|
27
|
+
const client = getS3Client();
|
|
28
|
+
const command = new DeleteObjectCommand({
|
|
29
|
+
Bucket: input.bucket,
|
|
30
|
+
Key: input.key,
|
|
31
|
+
VersionId: input.versionId,
|
|
32
|
+
});
|
|
33
|
+
const response = await client.send(command);
|
|
34
|
+
return {
|
|
35
|
+
deleted: true,
|
|
36
|
+
deleteMarker: response.DeleteMarker,
|
|
37
|
+
versionId: response.VersionId,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/procedures/s3/delete.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,KAAoB;IACjD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAC;IAE7B,MAAM,OAAO,GAAG,IAAI,mBAAmB,CAAC;QACtC,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,SAAS,EAAE,KAAK,CAAC,SAAS;KAC3B,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE5C,OAAO;QACL,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,QAAQ,CAAC,YAAY;QACnC,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* s3.download procedure
|
|
3
|
+
*
|
|
4
|
+
* Download content from S3 bucket.
|
|
5
|
+
*/
|
|
6
|
+
import type { S3DownloadInput, S3DownloadOutput } from "../../types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Download content from S3
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Download text file
|
|
12
|
+
* const result = await client.call(["s3", "download"], {
|
|
13
|
+
* bucket: "my-bucket",
|
|
14
|
+
* key: "path/to/file.json",
|
|
15
|
+
* encoding: "utf8",
|
|
16
|
+
* });
|
|
17
|
+
* console.log(result.body); // JSON string
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Download binary as base64
|
|
21
|
+
* const result = await client.call(["s3", "download"], {
|
|
22
|
+
* bucket: "my-bucket",
|
|
23
|
+
* key: "path/to/image.png",
|
|
24
|
+
* });
|
|
25
|
+
* console.log(result.body); // base64 encoded
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Download a large object straight to a file
|
|
29
|
+
* await client.call(["s3", "download"], {
|
|
30
|
+
* bucket: "my-bucket",
|
|
31
|
+
* key: "backups/archive.tar.gz",
|
|
32
|
+
* destPath: "/tmp/archive.tar.gz",
|
|
33
|
+
* });
|
|
34
|
+
*/
|
|
35
|
+
export declare function s3Download(input: S3DownloadInput): Promise<S3DownloadOutput>;
|
|
36
|
+
//# sourceMappingURL=download.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../../src/procedures/s3/download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA6CxE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoElF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* s3.download procedure
|
|
3
|
+
*
|
|
4
|
+
* Download content from S3 bucket.
|
|
5
|
+
*/
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
import { createWriteStream } from "node:fs";
|
|
8
|
+
import { rename, rm } from "node:fs/promises";
|
|
9
|
+
import { Transform } from "node:stream";
|
|
10
|
+
import { pipeline } from "node:stream/promises";
|
|
11
|
+
import { GetObjectCommand } from "@aws-sdk/client-s3";
|
|
12
|
+
import { getS3Client } from "../../s3-client.js";
|
|
13
|
+
/** Largest object loaded into memory by default (the base64 body is a third larger again) */
|
|
14
|
+
const DEFAULT_MAX_BYTES = 64 * 1024 * 1024;
|
|
15
|
+
function tooLarge(bytes, maxBytes) {
|
|
16
|
+
return new Error(`Object is ${bytes} bytes, more than maxBytes (${maxBytes}). Use destPath to download it to a file.`);
|
|
17
|
+
}
|
|
18
|
+
/** A stream step that counts the bytes and fails past `maxBytes`. */
|
|
19
|
+
function byteLimit(maxBytes) {
|
|
20
|
+
let total = 0;
|
|
21
|
+
return new Transform({
|
|
22
|
+
transform(chunk, _encoding, callback) {
|
|
23
|
+
total += chunk.length;
|
|
24
|
+
if (total > maxBytes) {
|
|
25
|
+
callback(tooLarge(`more than ${maxBytes}`, maxBytes));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
callback(null, chunk);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Read a body into memory, counting the bytes. `Content-Length` can be missing or wrong, so the
|
|
34
|
+
* count is the limit (deep dive DATA-14).
|
|
35
|
+
*/
|
|
36
|
+
async function readLimited(body, maxBytes) {
|
|
37
|
+
const chunks = [];
|
|
38
|
+
let total = 0;
|
|
39
|
+
for await (const chunk of body) {
|
|
40
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
41
|
+
total += buffer.length;
|
|
42
|
+
if (total > maxBytes) {
|
|
43
|
+
body.destroy();
|
|
44
|
+
throw tooLarge(`more than ${maxBytes}`, maxBytes);
|
|
45
|
+
}
|
|
46
|
+
chunks.push(buffer);
|
|
47
|
+
}
|
|
48
|
+
return Buffer.concat(chunks);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Download content from S3
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Download text file
|
|
55
|
+
* const result = await client.call(["s3", "download"], {
|
|
56
|
+
* bucket: "my-bucket",
|
|
57
|
+
* key: "path/to/file.json",
|
|
58
|
+
* encoding: "utf8",
|
|
59
|
+
* });
|
|
60
|
+
* console.log(result.body); // JSON string
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Download binary as base64
|
|
64
|
+
* const result = await client.call(["s3", "download"], {
|
|
65
|
+
* bucket: "my-bucket",
|
|
66
|
+
* key: "path/to/image.png",
|
|
67
|
+
* });
|
|
68
|
+
* console.log(result.body); // base64 encoded
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Download a large object straight to a file
|
|
72
|
+
* await client.call(["s3", "download"], {
|
|
73
|
+
* bucket: "my-bucket",
|
|
74
|
+
* key: "backups/archive.tar.gz",
|
|
75
|
+
* destPath: "/tmp/archive.tar.gz",
|
|
76
|
+
* });
|
|
77
|
+
*/
|
|
78
|
+
export async function s3Download(input) {
|
|
79
|
+
const client = getS3Client();
|
|
80
|
+
const command = new GetObjectCommand({
|
|
81
|
+
Bucket: input.bucket,
|
|
82
|
+
Key: input.key,
|
|
83
|
+
VersionId: input.versionId,
|
|
84
|
+
});
|
|
85
|
+
const response = await client.send(command);
|
|
86
|
+
// To a file: stream the body, nothing is held in memory (BUGS-2026-07 M22)
|
|
87
|
+
if (input.destPath) {
|
|
88
|
+
if (!response.Body) {
|
|
89
|
+
throw new Error("Empty response body");
|
|
90
|
+
}
|
|
91
|
+
// Write a part file, then rename it. A failed transfer leaves the previous file
|
|
92
|
+
// (createWriteStream on destPath truncated it first: deep dive DATA-14).
|
|
93
|
+
const partPath = `${input.destPath}.${randomUUID().slice(0, 8)}.part`;
|
|
94
|
+
const source = response.Body;
|
|
95
|
+
try {
|
|
96
|
+
if (input.maxBytes !== undefined) {
|
|
97
|
+
await pipeline(source, byteLimit(input.maxBytes), createWriteStream(partPath));
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
await pipeline(source, createWriteStream(partPath));
|
|
101
|
+
}
|
|
102
|
+
await rename(partPath, input.destPath);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
await rm(partPath, { force: true });
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
body: "",
|
|
110
|
+
path: input.destPath,
|
|
111
|
+
contentLength: response.ContentLength ?? 0,
|
|
112
|
+
contentType: response.ContentType,
|
|
113
|
+
etag: response.ETag?.replace(/"/g, ""),
|
|
114
|
+
lastModified: response.LastModified?.toISOString(),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
// Into memory: refuse an object that is too large before reading it (BUGS-2026-07 M22)
|
|
118
|
+
const maxBytes = input.maxBytes ?? DEFAULT_MAX_BYTES;
|
|
119
|
+
if (response.ContentLength !== undefined && response.ContentLength > maxBytes) {
|
|
120
|
+
response.Body?.destroy?.();
|
|
121
|
+
throw tooLarge(response.ContentLength, maxBytes);
|
|
122
|
+
}
|
|
123
|
+
if (!response.Body) {
|
|
124
|
+
throw new Error("Empty response body");
|
|
125
|
+
}
|
|
126
|
+
const bodyBytes = await readLimited(response.Body, maxBytes);
|
|
127
|
+
// Convert to string based on encoding
|
|
128
|
+
let body;
|
|
129
|
+
if (input.encoding) {
|
|
130
|
+
body = bodyBytes.toString(input.encoding);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
body = bodyBytes.toString("base64");
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
body,
|
|
137
|
+
contentLength: bodyBytes.length,
|
|
138
|
+
contentType: response.ContentType,
|
|
139
|
+
etag: response.ETag?.replace(/"/g, ""),
|
|
140
|
+
lastModified: response.LastModified?.toISOString(),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=download.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"download.js","sourceRoot":"","sources":["../../../src/procedures/s3/download.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAiB,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD,6FAA6F;AAC7F,MAAM,iBAAiB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,SAAS,QAAQ,CAAC,KAAsB,EAAE,QAAgB;IACxD,OAAO,IAAI,KAAK,CACd,aAAa,KAAK,+BAA+B,QAAQ,2CAA2C,CACrG,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,SAAS,SAAS,CAAC,QAAgB;IACjC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,OAAO,IAAI,SAAS,CAAC;QACnB,SAAS,CAAC,KAAa,EAAE,SAAS,EAAE,QAAQ;YAC1C,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,KAAK,GAAG,QAAQ,EAAE,CAAC;gBACrB,QAAQ,CAAC,QAAQ,CAAC,aAAa,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;gBACtD,OAAO;YACT,CAAC;YACD,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACxB,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,WAAW,CAAC,IAAc,EAAE,QAAgB;IACzD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CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAgB,EAAE,QAAQ,CAAC,CAAC;IAEzE,sCAAsC;IACtC,IAAI,IAAY,CAAC;IACjB,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACnB,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,QAA0B,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,OAAO;QACL,IAAI;QACJ,aAAa,EAAE,SAAS,CAAC,MAAM;QAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;QACjC,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QACtC,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,WAAW,EAAE;KACnD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S3 Procedures Index
|
|
3
|
+
*/
|
|
4
|
+
export { s3Upload } from "./upload.js";
|
|
5
|
+
export { s3Download } from "./download.js";
|
|
6
|
+
export { s3List } from "./list.js";
|
|
7
|
+
export { s3ListAll } from "./list-all.js";
|
|
8
|
+
export { s3Delete } from "./delete.js";
|
|
9
|
+
export { s3MultipartInit } from "./multipart-init.js";
|
|
10
|
+
export { s3MultipartUpload } from "./multipart-upload.js";
|
|
11
|
+
export { s3MultipartComplete } from "./multipart-complete.js";
|
|
12
|
+
export { s3MultipartAbort } from "./multipart-abort.js";
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/procedures/s3/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S3 Procedures Index
|
|
3
|
+
*/
|
|
4
|
+
export { s3Upload } from "./upload.js";
|
|
5
|
+
export { s3Download } from "./download.js";
|
|
6
|
+
export { s3List } from "./list.js";
|
|
7
|
+
export { s3ListAll } from "./list-all.js";
|
|
8
|
+
export { s3Delete } from "./delete.js";
|
|
9
|
+
export { s3MultipartInit } from "./multipart-init.js";
|
|
10
|
+
export { s3MultipartUpload } from "./multipart-upload.js";
|
|
11
|
+
export { s3MultipartComplete } from "./multipart-complete.js";
|
|
12
|
+
export { s3MultipartAbort } from "./multipart-abort.js";
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/procedures/s3/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* s3.listAll procedure
|
|
3
|
+
*
|
|
4
|
+
* List ALL objects in an S3 bucket, transparently following the
|
|
5
|
+
* ListObjectsV2 continuation token so that buckets/prefixes with more than
|
|
6
|
+
* 1000 keys are fully reachable in a single call.
|
|
7
|
+
*/
|
|
8
|
+
import type { S3ListAllInput, S3ListAllOutput } from "../../types.js";
|
|
9
|
+
/**
|
|
10
|
+
* List every object under a bucket/prefix, following pagination automatically.
|
|
11
|
+
*
|
|
12
|
+
* Unlike `s3.list` (which returns at most one page — up to 1000 keys — and
|
|
13
|
+
* exposes `nextContinuationToken` for manual paging), `s3.listAll` loops until
|
|
14
|
+
* the result is no longer truncated and returns the aggregated contents.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { contents, keyCount } = await client.call(["s3", "listAll"], {
|
|
18
|
+
* bucket: "my-bucket",
|
|
19
|
+
* prefix: "snapshots/",
|
|
20
|
+
* });
|
|
21
|
+
* console.log(keyCount); // e.g. 4213, not clamped to 1000
|
|
22
|
+
*/
|
|
23
|
+
export declare function s3ListAll(input: S3ListAllInput): Promise<S3ListAllOutput>;
|
|
24
|
+
//# sourceMappingURL=list-all.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-all.d.ts","sourceRoot":"","sources":["../../../src/procedures/s3/list-all.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAgB,MAAM,gBAAgB,CAAC;AAEpF;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAqC/E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* s3.listAll procedure
|
|
3
|
+
*
|
|
4
|
+
* List ALL objects in an S3 bucket, transparently following the
|
|
5
|
+
* ListObjectsV2 continuation token so that buckets/prefixes with more than
|
|
6
|
+
* 1000 keys are fully reachable in a single call.
|
|
7
|
+
*/
|
|
8
|
+
import { s3List } from "./list.js";
|
|
9
|
+
/**
|
|
10
|
+
* List every object under a bucket/prefix, following pagination automatically.
|
|
11
|
+
*
|
|
12
|
+
* Unlike `s3.list` (which returns at most one page — up to 1000 keys — and
|
|
13
|
+
* exposes `nextContinuationToken` for manual paging), `s3.listAll` loops until
|
|
14
|
+
* the result is no longer truncated and returns the aggregated contents.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { contents, keyCount } = await client.call(["s3", "listAll"], {
|
|
18
|
+
* bucket: "my-bucket",
|
|
19
|
+
* prefix: "snapshots/",
|
|
20
|
+
* });
|
|
21
|
+
* console.log(keyCount); // e.g. 4213, not clamped to 1000
|
|
22
|
+
*/
|
|
23
|
+
export async function s3ListAll(input) {
|
|
24
|
+
const contents = [];
|
|
25
|
+
const commonPrefixes = [];
|
|
26
|
+
const seenPrefixes = new Set();
|
|
27
|
+
let continuationToken = undefined;
|
|
28
|
+
let pageCount = 0;
|
|
29
|
+
do {
|
|
30
|
+
const page = await s3List({
|
|
31
|
+
bucket: input.bucket,
|
|
32
|
+
prefix: input.prefix,
|
|
33
|
+
delimiter: input.delimiter,
|
|
34
|
+
maxKeys: input.maxKeys,
|
|
35
|
+
continuationToken,
|
|
36
|
+
});
|
|
37
|
+
pageCount += 1;
|
|
38
|
+
for (const object of page.contents) {
|
|
39
|
+
contents.push(object);
|
|
40
|
+
}
|
|
41
|
+
for (const prefix of page.commonPrefixes) {
|
|
42
|
+
if (!seenPrefixes.has(prefix)) {
|
|
43
|
+
seenPrefixes.add(prefix);
|
|
44
|
+
commonPrefixes.push(prefix);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Only continue while S3 reports more results AND hands back a token.
|
|
48
|
+
continuationToken = page.isTruncated ? page.nextContinuationToken : undefined;
|
|
49
|
+
} while (continuationToken);
|
|
50
|
+
return {
|
|
51
|
+
contents,
|
|
52
|
+
commonPrefixes,
|
|
53
|
+
keyCount: contents.length,
|
|
54
|
+
pageCount,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=list-all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-all.js","sourceRoot":"","sources":["../../../src/procedures/s3/list-all.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAGnC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAqB;IACnD,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,MAAM,cAAc,GAAa,EAAE,CAAC;IACpC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,IAAI,iBAAiB,GAAuB,SAAS,CAAC;IACtD,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,GAAG,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,iBAAiB;SAClB,CAAC,CAAC;QACH,SAAS,IAAI,CAAC,CAAC;QAEf,KAAK,MAAM,MAAM,IAAI,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