@xylabs/storage 5.0.83 → 5.0.86
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 +37 -40
- package/dist/neutral/KeyValueStore.d.ts +10 -0
- package/dist/neutral/KeyValueStore.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
18
20
|
## Reference
|
|
19
21
|
|
|
20
22
|
**@xylabs/storage**
|
|
@@ -23,8 +25,10 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
23
25
|
|
|
24
26
|
## Interfaces
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
| Interface | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [ReadonlyKeyValueStore](#interfaces/ReadonlyKeyValueStore) | A readonly storage device. |
|
|
31
|
+
| [KeyValueStore](#interfaces/KeyValueStore) | A read/write storage device. |
|
|
28
32
|
|
|
29
33
|
### interfaces
|
|
30
34
|
|
|
@@ -42,31 +46,26 @@ A read/write storage device.
|
|
|
42
46
|
|
|
43
47
|
## Type Parameters
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
`TValue`
|
|
48
|
-
|
|
49
|
-
### TKey
|
|
50
|
-
|
|
51
|
-
`TKey` = `string`
|
|
49
|
+
| Type Parameter | Default type |
|
|
50
|
+
| ------ | ------ |
|
|
51
|
+
| `TValue` | - |
|
|
52
|
+
| `TKey` | `string` |
|
|
52
53
|
|
|
53
54
|
## Methods
|
|
54
55
|
|
|
55
56
|
### get()
|
|
56
57
|
|
|
57
58
|
```ts
|
|
58
|
-
get(key): Promisable<TValue | undefined>;
|
|
59
|
+
get(key: TKey): Promisable<TValue | undefined>;
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
Returns a promise that resolves to the value for the given key.
|
|
62
63
|
|
|
63
64
|
### Parameters
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`TKey`
|
|
68
|
-
|
|
69
|
-
The key to get the value for.
|
|
66
|
+
| Parameter | Type | Description |
|
|
67
|
+
| ------ | ------ | ------ |
|
|
68
|
+
| `key` | `TKey` | The key to get the value for. |
|
|
70
69
|
|
|
71
70
|
### Returns
|
|
72
71
|
|
|
@@ -102,6 +101,8 @@ The keys an array of keys.
|
|
|
102
101
|
optional clear(): Promisable<void>;
|
|
103
102
|
```
|
|
104
103
|
|
|
104
|
+
Removes all entries from the store.
|
|
105
|
+
|
|
105
106
|
### Returns
|
|
106
107
|
|
|
107
108
|
`Promisable`\<`void`\>
|
|
@@ -111,14 +112,16 @@ optional clear(): Promisable<void>;
|
|
|
111
112
|
### delete()
|
|
112
113
|
|
|
113
114
|
```ts
|
|
114
|
-
delete(key): Promisable<void>;
|
|
115
|
+
delete(key: TKey): Promisable<void>;
|
|
115
116
|
```
|
|
116
117
|
|
|
117
|
-
|
|
118
|
+
Deletes the entry with the given key.
|
|
118
119
|
|
|
119
|
-
|
|
120
|
+
### Parameters
|
|
120
121
|
|
|
121
|
-
|
|
122
|
+
| Parameter | Type | Description |
|
|
123
|
+
| ------ | ------ | ------ |
|
|
124
|
+
| `key` | `TKey` | The key of the entry to delete |
|
|
122
125
|
|
|
123
126
|
### Returns
|
|
124
127
|
|
|
@@ -129,18 +132,17 @@ delete(key): Promisable<void>;
|
|
|
129
132
|
### set()
|
|
130
133
|
|
|
131
134
|
```ts
|
|
132
|
-
set(key, value): Promisable<void>;
|
|
135
|
+
set(key: TKey, value: TValue): Promisable<void>;
|
|
133
136
|
```
|
|
134
137
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
#### key
|
|
138
|
-
|
|
139
|
-
`TKey`
|
|
138
|
+
Sets a value for the given key, creating or updating the entry.
|
|
140
139
|
|
|
141
|
-
|
|
140
|
+
### Parameters
|
|
142
141
|
|
|
143
|
-
|
|
142
|
+
| Parameter | Type | Description |
|
|
143
|
+
| ------ | ------ | ------ |
|
|
144
|
+
| `key` | `TKey` | The key to set |
|
|
145
|
+
| `value` | `TValue` | The value to store |
|
|
144
146
|
|
|
145
147
|
### Returns
|
|
146
148
|
|
|
@@ -160,31 +162,26 @@ A readonly storage device.
|
|
|
160
162
|
|
|
161
163
|
## Type Parameters
|
|
162
164
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
`TValue`
|
|
166
|
-
|
|
167
|
-
### TKey
|
|
168
|
-
|
|
169
|
-
`TKey` = `string`
|
|
165
|
+
| Type Parameter | Default type |
|
|
166
|
+
| ------ | ------ |
|
|
167
|
+
| `TValue` | - |
|
|
168
|
+
| `TKey` | `string` |
|
|
170
169
|
|
|
171
170
|
## Methods
|
|
172
171
|
|
|
173
172
|
### get()
|
|
174
173
|
|
|
175
174
|
```ts
|
|
176
|
-
get(key): Promisable<TValue | undefined>;
|
|
175
|
+
get(key: TKey): Promisable<TValue | undefined>;
|
|
177
176
|
```
|
|
178
177
|
|
|
179
178
|
Returns a promise that resolves to the value for the given key.
|
|
180
179
|
|
|
181
180
|
### Parameters
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
`TKey`
|
|
186
|
-
|
|
187
|
-
The key to get the value for.
|
|
182
|
+
| Parameter | Type | Description |
|
|
183
|
+
| ------ | ------ | ------ |
|
|
184
|
+
| `key` | `TKey` | The key to get the value for. |
|
|
188
185
|
|
|
189
186
|
### Returns
|
|
190
187
|
|
|
@@ -17,8 +17,18 @@ export interface ReadonlyKeyValueStore<TValue, TKey = string> {
|
|
|
17
17
|
* A read/write storage device.
|
|
18
18
|
*/
|
|
19
19
|
export interface KeyValueStore<TValue, TKey = string> extends ReadonlyKeyValueStore<TValue, TKey> {
|
|
20
|
+
/** Removes all entries from the store. */
|
|
20
21
|
clear?(): Promisable<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Deletes the entry with the given key.
|
|
24
|
+
* @param key The key of the entry to delete
|
|
25
|
+
*/
|
|
21
26
|
delete(key: TKey): Promisable<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Sets a value for the given key, creating or updating the entry.
|
|
29
|
+
* @param key The key to set
|
|
30
|
+
* @param value The value to store
|
|
31
|
+
*/
|
|
22
32
|
set(key: TKey, value: TValue): Promisable<void>;
|
|
23
33
|
}
|
|
24
34
|
//# sourceMappingURL=KeyValueStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyValueStore.d.ts","sourceRoot":"","sources":["../../src/KeyValueStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM;IAC1D;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC9C;;OAEG;IACH,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAAE,SAAQ,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC;IAC/F,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;IAC1B,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;IACnC,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;CAChD"}
|
|
1
|
+
{"version":3,"file":"KeyValueStore.d.ts","sourceRoot":"","sources":["../../src/KeyValueStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM;IAC1D;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC9C;;OAEG;IACH,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC,CAAA;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,EAAE,IAAI,GAAG,MAAM,CAAE,SAAQ,qBAAqB,CAAC,MAAM,EAAE,IAAI,CAAC;IAC/F,0CAA0C;IAC1C,KAAK,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;IAC1B;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;IACnC;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;CAChD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/storage",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.86",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hex",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"!**/*.test.*"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@xylabs/promise": "~5.0.
|
|
45
|
+
"@xylabs/promise": "~5.0.86"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
49
|
-
"@xylabs/tsconfig": "~7.4.
|
|
48
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.16",
|
|
49
|
+
"@xylabs/tsconfig": "~7.4.16",
|
|
50
50
|
"typescript": "~5.9.3"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|