@statewalker/webrun-files-s3 0.5.0 → 0.9.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 +1 -1
- package/README.md +81 -148
- package/dist/cjs/index.cjs +171 -432
- package/dist/esm/index.js +160 -421
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/s3-files-api.d.ts +22 -53
- package/dist/s3-files-api.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/index.ts +1 -2
- package/src/s3-files-api.ts +253 -176
- package/dist/s3-file-handle.d.ts +0 -75
- package/dist/s3-file-handle.d.ts.map +0 -1
- package/src/s3-file-handle.ts +0 -491
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* webrun-files-s3 - S3-backed
|
|
2
|
+
* webrun-files-s3 - S3-backed FilesApi implementation
|
|
3
3
|
*/
|
|
4
4
|
export { S3FilesApi, type S3FilesApiOptions } from "./s3-files-api.js";
|
|
5
|
-
export { S3FileHandle, type S3FileHandleOptions } from "./s3-file-handle.js";
|
|
6
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/s3-files-api.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* S3 implementation of
|
|
2
|
+
* S3 implementation of FilesApi
|
|
3
3
|
*
|
|
4
4
|
* Provides a filesystem-like interface over S3 object storage.
|
|
5
|
-
* Supports all IFilesApi methods including the optional move, copy, and mkdir.
|
|
6
5
|
*/
|
|
7
6
|
import type { S3Client } from "@aws-sdk/client-s3";
|
|
8
|
-
import type {
|
|
7
|
+
import type { FileInfo, FileStats, FilesApi, ListOptions, ReadOptions } from "@statewalker/webrun-files";
|
|
9
8
|
export interface S3FilesApiOptions {
|
|
10
9
|
/**
|
|
11
10
|
* Pre-configured S3Client instance.
|
|
12
|
-
* Allows full control over credentials, region, endpoint.
|
|
13
11
|
*/
|
|
14
12
|
client: S3Client;
|
|
15
13
|
/**
|
|
@@ -18,67 +16,38 @@ export interface S3FilesApiOptions {
|
|
|
18
16
|
bucket: string;
|
|
19
17
|
/**
|
|
20
18
|
* Optional key prefix (acts as root directory).
|
|
21
|
-
* All paths will be relative to this prefix.
|
|
22
19
|
* @example "projects/my-app/data"
|
|
23
20
|
*/
|
|
24
21
|
prefix?: string;
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* Part size for multipart uploads in bytes.
|
|
24
|
+
* S3 requires minimum 5MB for all parts except the last.
|
|
25
|
+
* @default 5242880 (5MB)
|
|
28
26
|
*/
|
|
29
27
|
multipartPartSize?: number;
|
|
30
28
|
}
|
|
31
|
-
|
|
29
|
+
/**
|
|
30
|
+
* S3 filesystem implementation of FilesApi.
|
|
31
|
+
*
|
|
32
|
+
* Provides a filesystem-like interface over S3 object storage.
|
|
33
|
+
* Works with AWS S3 and S3-compatible services.
|
|
34
|
+
*/
|
|
35
|
+
export declare class S3FilesApi implements FilesApi {
|
|
32
36
|
private client;
|
|
33
37
|
private bucket;
|
|
34
38
|
private prefix;
|
|
35
|
-
private
|
|
39
|
+
private partSize;
|
|
36
40
|
constructor(options: S3FilesApiOptions);
|
|
37
|
-
/**
|
|
38
|
-
* Converts a virtual path to an S3 key.
|
|
39
|
-
* @example resolveKey("/docs/file.txt") => "prefix/docs/file.txt"
|
|
40
|
-
*/
|
|
41
41
|
private resolveKey;
|
|
42
|
-
/**
|
|
43
|
-
* Converts an S3 key back to a virtual path.
|
|
44
|
-
*/
|
|
45
42
|
private keyToPath;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*/
|
|
56
|
-
stats(file: FileRef): Promise<FileInfo | undefined>;
|
|
57
|
-
/**
|
|
58
|
-
* Deletes an object or all objects under a prefix (directory).
|
|
59
|
-
*/
|
|
60
|
-
remove(file: FileRef): Promise<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* Opens an S3 object for random access.
|
|
63
|
-
* Creates the object if it doesn't exist.
|
|
64
|
-
*/
|
|
65
|
-
open(file: FileRef): Promise<FileHandle>;
|
|
66
|
-
/**
|
|
67
|
-
* Moves an object using Copy + Delete.
|
|
68
|
-
*/
|
|
69
|
-
move(source: FileRef, target: FileRef): Promise<boolean>;
|
|
70
|
-
/**
|
|
71
|
-
* Copies an object or directory using S3 CopyObject.
|
|
72
|
-
*/
|
|
73
|
-
copy(source: FileRef, target: FileRef, options?: CopyOptions): Promise<boolean>;
|
|
74
|
-
/**
|
|
75
|
-
* Creates a directory marker in S3.
|
|
76
|
-
*
|
|
77
|
-
* S3 doesn't have real directories, but some tools expect
|
|
78
|
-
* a zero-byte object with trailing slash as a directory marker.
|
|
79
|
-
* However, for our purposes we don't actually need to create markers
|
|
80
|
-
* since directories are implied by files within them.
|
|
81
|
-
*/
|
|
82
|
-
mkdir(file: FileRef): Promise<void>;
|
|
43
|
+
read(path: string, options?: ReadOptions): AsyncIterable<Uint8Array>;
|
|
44
|
+
write(path: string, content: Iterable<Uint8Array> | AsyncIterable<Uint8Array>): Promise<void>;
|
|
45
|
+
mkdir(path: string): Promise<void>;
|
|
46
|
+
list(path: string, options?: ListOptions): AsyncIterable<FileInfo>;
|
|
47
|
+
stats(path: string): Promise<FileStats | undefined>;
|
|
48
|
+
exists(path: string): Promise<boolean>;
|
|
49
|
+
remove(path: string): Promise<boolean>;
|
|
50
|
+
move(source: string, target: string): Promise<boolean>;
|
|
51
|
+
copy(source: string, target: string): Promise<boolean>;
|
|
83
52
|
}
|
|
84
53
|
//# sourceMappingURL=s3-files-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-files-api.d.ts","sourceRoot":"","sources":["../src/s3-files-api.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"s3-files-api.d.ts","sourceRoot":"","sources":["../src/s3-files-api.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAanD,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,2BAA2B,CAAC;AASnC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,QAAQ,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;;;GAKG;AACH,qBAAa,UAAW,YAAW,QAAQ;IACzC,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;IAEzB,YAAY,OAAO,EAAE,iBAAiB,EAKrC;IAED,OAAO,CAAC,UAAU;IAUlB,OAAO,CAAC,SAAS;IAWV,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,UAAU,CAAC,CA6C1E;IAEK,KAAK,CACT,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,GACxD,OAAO,CAAC,IAAI,CAAC,CAkHf;IAEK,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYvC;IAEM,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,CAAC,QAAQ,CAAC,CAiExE;IAEK,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CA+CxD;IAEK,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG3C;IAEK,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkE3C;IAEK,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAI3D;IAEK,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAwD3D;CACF"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statewalker/webrun-files-s3",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "S3-backed
|
|
6
|
+
"description": "S3-backed FilesApi implementation for webrun-files",
|
|
7
7
|
"homepage": "https://github.com/statewalker/webrun-files",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Mikhail Kotelnikov",
|
|
@@ -29,21 +29,20 @@
|
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@statewalker/webrun-files": "0.
|
|
32
|
+
"@statewalker/webrun-files": "0.9.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@aws-sdk/client-s3": "^3.
|
|
35
|
+
"@aws-sdk/client-s3": "^3.1032.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@aws-sdk/client-s3": "^3.
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"@statewalker/webrun-files-tests": "1.0.0"
|
|
38
|
+
"@aws-sdk/client-s3": "^3.1110.0",
|
|
39
|
+
"@types/node": "^26.2.0",
|
|
40
|
+
"rimraf": "^6.1.3",
|
|
41
|
+
"rolldown": "^1.2.4",
|
|
42
|
+
"testcontainers": "^12.1.0",
|
|
43
|
+
"typescript": "^7.0.2",
|
|
44
|
+
"vitest": "^4.1.10",
|
|
45
|
+
"@statewalker/webrun-files-tests": "2.0.0"
|
|
47
46
|
},
|
|
48
47
|
"sideEffects": false,
|
|
49
48
|
"publishConfig": {
|
|
@@ -51,7 +50,8 @@
|
|
|
51
50
|
},
|
|
52
51
|
"scripts": {
|
|
53
52
|
"build": "rimraf dist && rolldown -c && tsc --emitDeclarationOnly --declaration",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
53
|
+
"lint": "biome lint src tests",
|
|
54
|
+
"test": "vitest run --passWithNoTests",
|
|
55
|
+
"test:integration": "vitest run --config vitest.integration.config.ts"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* webrun-files-s3 - S3-backed
|
|
2
|
+
* webrun-files-s3 - S3-backed FilesApi implementation
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
export { S3FilesApi, type S3FilesApiOptions } from "./s3-files-api.js";
|
|
6
|
-
export { S3FileHandle, type S3FileHandleOptions } from "./s3-file-handle.js";
|