@vercube/storage 0.0.22 → 0.0.24
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/README.md +10 -6
- package/dist/Drivers/MemoryStorage.d.mts +1 -1
- package/dist/Drivers/MemoryStorage.mjs +3 -1
- package/dist/Drivers/S3Storage.d.mts +56 -56
- package/dist/Drivers/S3Storage.mjs +4627 -5048
- package/dist/Storage-Cr72sGff.mjs +16 -0
- package/dist/event-streams-CEo-hsfG.mjs +179 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +18 -44
- package/dist/schema-DfAlCaU9.mjs +1176 -0
- package/package.json +4 -4
- package/dist/chunk-UoOzN6Vc.mjs +0 -40
- /package/dist/{Storage-DZ-jzAK_.d.mts → Storage-D-QyQ5of.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
<br>
|
|
4
4
|
<br>
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
# Vercube
|
|
7
|
+
|
|
8
|
+
Next generation HTTP framework
|
|
9
|
+
|
|
10
10
|
<a href="https://www.npmjs.com/package/@vercube/storage">
|
|
11
11
|
<img src="https://img.shields.io/npm/v/%40vercube%2Fstorage?style=for-the-badge&logo=npm&color=%23767eff" alt="npm"/>
|
|
12
12
|
</a>
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
<a href="https://github.com/vercube/vercube/blob/main/LICENSE" target="_blank">
|
|
17
17
|
<img src="https://img.shields.io/npm/l/%40vercube%2Fstorage?style=for-the-badge&color=%23767eff" alt="License"/>
|
|
18
18
|
</a>
|
|
19
|
+
<a href="https://codecov.io/gh/vercube/vercube" target="_blank">
|
|
20
|
+
<img src="https://img.shields.io/codecov/c/github/vercube/vercube?style=for-the-badge&color=%23767eff" alt="Coverage"/>
|
|
21
|
+
</a>
|
|
19
22
|
<br/>
|
|
20
23
|
<br/>
|
|
21
24
|
</div>
|
|
@@ -23,8 +26,9 @@
|
|
|
23
26
|
An ultra-efficient JavaScript server framework that runs anywhere - Node.js, Bun, or Deno - with unmatched flexibility and complete configurability for developers who refuse to sacrifice speed or control.
|
|
24
27
|
|
|
25
28
|
## <a name="module">Storage Module</a>
|
|
26
|
-
The Storage module provides a unified interface for managing file storage across different storage providers. It offers a flexible and provider-agnostic approach to handling file uploads, downloads, and management operations. The module supports various storage backends including local filesystem, Amazon S3, Google Cloud Storage, and Azure Blob Storage, all accessible through a consistent API. This abstraction allows developers to easily switch between storage providers without changing application code, while maintaining optimal performance and reliability.
|
|
27
29
|
|
|
30
|
+
The Storage module provides a unified interface for managing file storage across different storage providers. It offers a flexible and provider-agnostic approach to handling file uploads, downloads, and management operations. The module supports various storage backends including local filesystem, Amazon S3, Google Cloud Storage, and Azure Blob Storage, all accessible through a consistent API. This abstraction allows developers to easily switch between storage providers without changing application code, while maintaining optimal performance and reliability.
|
|
28
31
|
|
|
29
32
|
## <a name="documentation">📖 Documentation</a>
|
|
30
|
-
|
|
33
|
+
|
|
34
|
+
Comprehensive documentation is available at [vercube.dev](https://vercube.dev). There you'll find detailed module descriptions, project information, guides, and everything else you need to know about Vercube.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import "../Storage-Cr72sGff.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/Drivers/MemoryStorage.ts
|
|
2
4
|
/**
|
|
3
5
|
* In-memory storage implementation of the Storage interface
|
|
4
6
|
* Provides a simple key-value store that persists only for the duration of the application runtime
|
|
5
7
|
* Useful for testing, caching, and scenarios where temporary storage is needed
|
|
6
|
-
*
|
|
8
|
+
*
|
|
7
9
|
* @implements {Storage}
|
|
8
10
|
*/
|
|
9
11
|
var MemoryStorage = class {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Storage } from "../Storage-
|
|
1
|
+
import { Storage } from "../Storage-D-QyQ5of.mjs";
|
|
2
2
|
import { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
3
3
|
|
|
4
4
|
//#region src/Drivers/S3Storage.d.ts
|
|
@@ -6,81 +6,81 @@ interface S3BaseOptions extends S3ClientConfig {
|
|
|
6
6
|
bucket: string;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* S3 storage implementation of the Storage interface.
|
|
10
|
-
* Provides key-value operations backed by AWS S3.
|
|
11
|
-
*
|
|
12
|
-
* @implements {Storage}
|
|
13
|
-
*/
|
|
9
|
+
* S3 storage implementation of the Storage interface.
|
|
10
|
+
* Provides key-value operations backed by AWS S3.
|
|
11
|
+
*
|
|
12
|
+
* @implements {Storage}
|
|
13
|
+
*/
|
|
14
14
|
declare class S3Storage implements Storage<S3BaseOptions> {
|
|
15
15
|
private s3;
|
|
16
16
|
private bucket;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
* Initializes the S3 storage client.
|
|
19
|
+
*
|
|
20
|
+
* @param {S3BaseOptions} options - Configuration options for the S3 client.
|
|
21
|
+
* @returns {Promise<void>} A promise that resolves when initialization is complete.
|
|
22
|
+
*/
|
|
23
23
|
initialize(options: S3BaseOptions): Promise<void>;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
* Retrieves and parses a value from S3 storage by its key.
|
|
26
|
+
*
|
|
27
|
+
* @template T
|
|
28
|
+
* @param {string} key - The key whose value should be retrieved.
|
|
29
|
+
* @returns {Promise<T | undefined>} The stored value parsed as type T, or undefined if the key does not exist.
|
|
30
|
+
* @throws Will rethrow any S3 error except for missing key (`NoSuchKey`).
|
|
31
|
+
*/
|
|
32
32
|
getItem<T = unknown>(key: string): Promise<T>;
|
|
33
33
|
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
34
|
+
* Stores a value in S3 storage under the specified key.
|
|
35
|
+
*
|
|
36
|
+
* @template T
|
|
37
|
+
* @template U
|
|
38
|
+
* @param {string} key - The key under which to store the value.
|
|
39
|
+
* @param {T} value - The value to store (will be JSON serialized).
|
|
40
|
+
* @param {U} [options] - Additional options (currently unused).
|
|
41
|
+
* @returns {Promise<void>} A promise that resolves when the value has been stored.
|
|
42
|
+
*/
|
|
43
43
|
setItem<T = unknown, U = unknown>(key: string, value: T, options?: U): Promise<void>;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
* Removes an item from S3 storage by its key.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} key - The key of the item to delete.
|
|
48
|
+
* @returns {Promise<void>} A promise that resolves when the item has been deleted.
|
|
49
|
+
*/
|
|
50
50
|
deleteItem(key: string): Promise<void>;
|
|
51
51
|
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
* Checks if a key exists in S3 storage.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} key - The key to check.
|
|
55
|
+
* @returns {Promise<boolean>} True if the key exists, false otherwise.
|
|
56
|
+
* @throws Will rethrow any S3 error except for missing key (`NoSuchKey`).
|
|
57
|
+
*/
|
|
58
58
|
hasItem(key: string): Promise<boolean>;
|
|
59
59
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
* Retrieves a list of all keys stored in the S3 bucket.
|
|
61
|
+
*
|
|
62
|
+
* @returns {Promise<string[]>} An array of all stored keys.
|
|
63
|
+
*/
|
|
64
64
|
getKeys(): Promise<string[]>;
|
|
65
65
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
* Deletes all items from S3 storage.
|
|
67
|
+
*
|
|
68
|
+
* @returns {Promise<void>} A promise that resolves when all items have been deleted.
|
|
69
|
+
*/
|
|
70
70
|
clear(): Promise<void>;
|
|
71
71
|
/**
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
* Gets the total number of stored items.
|
|
73
|
+
*
|
|
74
|
+
* @returns {Promise<number>} The count of stored items.
|
|
75
|
+
*/
|
|
76
76
|
size(): Promise<number>;
|
|
77
77
|
/**
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
* Converts a Node.js readable stream into a UTF-8 string.
|
|
79
|
+
*
|
|
80
|
+
* @private
|
|
81
|
+
* @param {Readable} stream - The readable stream to convert.
|
|
82
|
+
* @returns {Promise<string>} The stream contents as a string.
|
|
83
|
+
*/
|
|
84
84
|
private streamToString;
|
|
85
85
|
}
|
|
86
86
|
//#endregion
|