@vercube/storage 0.0.35 → 0.0.36
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.
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import { Container } from "@vercube/di";
|
|
2
|
+
import "@vercube/logger";
|
|
3
|
+
import "node:events";
|
|
4
|
+
import "node:fs";
|
|
5
|
+
import "node:stream";
|
|
6
|
+
import "node:http";
|
|
7
|
+
import "node:https";
|
|
8
|
+
import "node:net";
|
|
9
|
+
import "node:http2";
|
|
10
|
+
|
|
11
|
+
//#region ../../node_modules/.pnpm/c12@3.3.3_magicast@0.5.1/node_modules/c12/dist/index.d.mts
|
|
12
|
+
declare global {
|
|
13
|
+
var __c12_dotenv_vars__: Map<Record<string, any>, Set<string>>;
|
|
14
|
+
} //#endregion
|
|
15
|
+
//#region src/types.d.ts
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region ../core/src/Types/CommonTypes.d.ts
|
|
18
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
19
|
+
//#endregion
|
|
1
20
|
//#region src/Service/Storage.d.ts
|
|
2
21
|
/**
|
|
3
22
|
* Abstract base class for storage implementations
|
|
@@ -23,52 +42,52 @@ declare abstract class Storage<InitOptions = undefined> {
|
|
|
23
42
|
* Retrieves a value from storage by its key
|
|
24
43
|
* @template T - The type of the stored value
|
|
25
44
|
* @param {string} key - The key to retrieve the value for
|
|
26
|
-
* @returns {
|
|
45
|
+
* @returns {MaybePromise<T | null>} A promise that resolves with the stored value
|
|
27
46
|
*/
|
|
28
|
-
abstract getItem<T = unknown>(key: string): T |
|
|
47
|
+
abstract getItem<T = unknown>(key: string): MaybePromise<T | null>;
|
|
29
48
|
/**
|
|
30
49
|
* Retrieves multiple items from storage by their keys
|
|
31
50
|
* @template T - The type of the stored value
|
|
32
51
|
* @param {string[]} keys - The keys to retrieve the values for
|
|
33
|
-
* @returns {
|
|
52
|
+
* @returns {MaybePromise<T[]>} A promise that resolves with the stored values or empty array if not found
|
|
34
53
|
*/
|
|
35
|
-
abstract getItems<T = unknown>(keys: string[]):
|
|
54
|
+
abstract getItems<T = unknown>(keys: string[]): MaybePromise<T[]>;
|
|
36
55
|
/**
|
|
37
56
|
* Stores a value in storage with the specified key
|
|
38
57
|
* @template T - The type of the value to store
|
|
39
58
|
* @template U - The type of the optional options object
|
|
40
59
|
* @param {string} key - The key under which to store the value
|
|
41
60
|
* @param {T} value - The value to store
|
|
42
|
-
* @returns {
|
|
61
|
+
* @returns {MaybePromise<void>} A promise that resolves when the value is stored
|
|
43
62
|
*/
|
|
44
|
-
abstract setItem<T = unknown, U = unknown>(key: string, value: T, options?: U):
|
|
63
|
+
abstract setItem<T = unknown, U = unknown>(key: string, value: T, options?: U): MaybePromise<void>;
|
|
45
64
|
/**
|
|
46
65
|
* Removes a value from storage by its key
|
|
47
66
|
* @param {string} key - The key of the value to delete
|
|
48
|
-
* @returns {
|
|
67
|
+
* @returns {MaybePromise<void>} A promise that resolves when the value is deleted
|
|
49
68
|
*/
|
|
50
|
-
abstract deleteItem(key: string):
|
|
69
|
+
abstract deleteItem(key: string): MaybePromise<void>;
|
|
51
70
|
/**
|
|
52
71
|
* Checks if a value exists in storage for the given key
|
|
53
72
|
* @param {string} key - The key to check
|
|
54
|
-
* @returns {
|
|
73
|
+
* @returns {MaybePromise<boolean>} A promise that resolves to true if the key exists, false otherwise
|
|
55
74
|
*/
|
|
56
|
-
abstract hasItem(key: string):
|
|
75
|
+
abstract hasItem(key: string): MaybePromise<boolean>;
|
|
57
76
|
/**
|
|
58
77
|
* Retrieves all keys currently stored in storage
|
|
59
|
-
* @returns {
|
|
78
|
+
* @returns {MaybePromise<string[]>} A promise that resolves with an array of all stored keys
|
|
60
79
|
*/
|
|
61
|
-
abstract getKeys():
|
|
80
|
+
abstract getKeys(): MaybePromise<string[]>;
|
|
62
81
|
/**
|
|
63
82
|
* Removes all stored values from storage
|
|
64
83
|
* @returns {Promise<void>} A promise that resolves when all values are cleared
|
|
65
84
|
*/
|
|
66
|
-
abstract clear():
|
|
85
|
+
abstract clear(): MaybePromise<void>;
|
|
67
86
|
/**
|
|
68
87
|
* Gets the number of key-value pairs stored in storage
|
|
69
88
|
* @returns {Promise<number>} A promise that resolves with the number of stored items
|
|
70
89
|
*/
|
|
71
|
-
abstract size():
|
|
90
|
+
abstract size(): MaybePromise<number>;
|
|
72
91
|
}
|
|
73
92
|
//#endregion
|
|
74
93
|
export { Storage as t };
|
package/dist/index.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercube/storage",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "Storage module for Vercube framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@vercube/
|
|
28
|
-
"@vercube/
|
|
27
|
+
"@vercube/di": "0.0.36",
|
|
28
|
+
"@vercube/logger": "0.0.36"
|
|
29
29
|
},
|
|
30
30
|
"optionalDependencies": {
|
|
31
31
|
"@aws-sdk/client-s3": "3.975.0"
|