@nats-io/kv 3.0.0-26 → 3.0.0-28
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/lib/types.d.ts +23 -23
- package/package.json +4 -4
package/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Placement, Republish, StorageType, StreamInfo, StreamSource } from "@nats-io/jetstream";
|
|
2
2
|
import type { Payload, QueuedIterator } from "@nats-io/nats-core";
|
|
3
|
-
export
|
|
3
|
+
export type KvEntry = {
|
|
4
4
|
bucket: string;
|
|
5
5
|
key: string;
|
|
6
6
|
value: Uint8Array;
|
|
@@ -19,19 +19,19 @@ export interface KvEntry {
|
|
|
19
19
|
* may throw an exception if there's a conversion error
|
|
20
20
|
*/
|
|
21
21
|
string(): string;
|
|
22
|
-
}
|
|
23
|
-
export
|
|
22
|
+
};
|
|
23
|
+
export type KvWatchEntry = KvEntry & {
|
|
24
24
|
isUpdate: boolean;
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* Generic type for encoding and decoding values
|
|
28
28
|
* before they are stored or returned to the client.
|
|
29
29
|
*/
|
|
30
|
-
export
|
|
30
|
+
export type KvCodec<T> = {
|
|
31
31
|
encode(k: T): T;
|
|
32
32
|
decode(k: T): T;
|
|
33
|
-
}
|
|
34
|
-
export
|
|
33
|
+
};
|
|
34
|
+
export type KvCodecs = {
|
|
35
35
|
/**
|
|
36
36
|
* Codec for Keys in the KV
|
|
37
37
|
*/
|
|
@@ -40,8 +40,8 @@ export interface KvCodecs {
|
|
|
40
40
|
* Codec for Data in the KV
|
|
41
41
|
*/
|
|
42
42
|
value: KvCodec<Uint8Array>;
|
|
43
|
-
}
|
|
44
|
-
export
|
|
43
|
+
};
|
|
44
|
+
export type KvLimits = {
|
|
45
45
|
/**
|
|
46
46
|
* Sets the specified description on the stream of the KV.
|
|
47
47
|
*/
|
|
@@ -99,8 +99,8 @@ export interface KvLimits {
|
|
|
99
99
|
* servers 2.10.x and better.
|
|
100
100
|
*/
|
|
101
101
|
compression?: boolean;
|
|
102
|
-
}
|
|
103
|
-
export
|
|
102
|
+
};
|
|
103
|
+
export type KvStatus = KvLimits & {
|
|
104
104
|
/**
|
|
105
105
|
* The simple name for a Kv - this name is typically prefixed by `KV_`.
|
|
106
106
|
*/
|
|
@@ -123,8 +123,8 @@ export interface KvStatus extends KvLimits {
|
|
|
123
123
|
* 2.10.x and better.
|
|
124
124
|
*/
|
|
125
125
|
metadata?: Record<string, string>;
|
|
126
|
-
}
|
|
127
|
-
export
|
|
126
|
+
};
|
|
127
|
+
export type KvOptions = KvLimits & {
|
|
128
128
|
/**
|
|
129
129
|
* How long to wait in milliseconds for a response from the KV
|
|
130
130
|
*/
|
|
@@ -153,7 +153,7 @@ export interface KvOptions extends KvLimits {
|
|
|
153
153
|
* 2.10.x and better.
|
|
154
154
|
*/
|
|
155
155
|
metadata?: Record<string, string>;
|
|
156
|
-
}
|
|
156
|
+
};
|
|
157
157
|
export declare enum KvWatchInclude {
|
|
158
158
|
/**
|
|
159
159
|
* Include the last value for all the keys
|
|
@@ -195,7 +195,7 @@ export type KvWatchOptions = {
|
|
|
195
195
|
*/
|
|
196
196
|
resumeFromRevision?: number;
|
|
197
197
|
};
|
|
198
|
-
export
|
|
198
|
+
export type RoKV = {
|
|
199
199
|
/**
|
|
200
200
|
* Returns the KvEntry stored under the key if it exists or null if not.
|
|
201
201
|
* Note that the entry returned could be marked with a "DEL" or "PURGE"
|
|
@@ -230,8 +230,8 @@ export interface RoKV {
|
|
|
230
230
|
* @param filter - default is all keys
|
|
231
231
|
*/
|
|
232
232
|
keys(filter?: string | string[]): Promise<QueuedIterator<string>>;
|
|
233
|
-
}
|
|
234
|
-
export
|
|
233
|
+
};
|
|
234
|
+
export type KV = RoKV & {
|
|
235
235
|
/**
|
|
236
236
|
* Creates a new entry ensuring that the entry does not exist (or
|
|
237
237
|
* the current version is deleted or the key is purged)
|
|
@@ -280,19 +280,19 @@ export interface KV extends RoKV {
|
|
|
280
280
|
* effectively deletes all data stored under the KV.
|
|
281
281
|
*/
|
|
282
282
|
destroy(): Promise<boolean>;
|
|
283
|
-
}
|
|
284
|
-
export
|
|
283
|
+
};
|
|
284
|
+
export type KvPutOptions = {
|
|
285
285
|
/**
|
|
286
286
|
* If set the KV must be at the current sequence or the
|
|
287
287
|
* put will fail.
|
|
288
288
|
*/
|
|
289
289
|
previousSeq: number;
|
|
290
|
-
}
|
|
291
|
-
export
|
|
290
|
+
};
|
|
291
|
+
export type KvDeleteOptions = {
|
|
292
292
|
/**
|
|
293
293
|
* If set the KV must be at the current sequence or the
|
|
294
294
|
* put will fail.
|
|
295
295
|
*/
|
|
296
296
|
previousSeq: number;
|
|
297
|
-
}
|
|
297
|
+
};
|
|
298
298
|
export declare const kvPrefix = "KV_";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nats-io/kv",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-28",
|
|
4
4
|
"files": [
|
|
5
5
|
"lib/",
|
|
6
6
|
"LICENSE",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"description": "kv library - this library implements all the base functionality for NATS KV javascript clients",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nats-io/jetstream": "3.0.0-
|
|
38
|
-
"@nats-io/nats-core": "3.0.0-
|
|
37
|
+
"@nats-io/jetstream": "3.0.0-34",
|
|
38
|
+
"@nats-io/nats-core": "3.0.0-47"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^22.7.6",
|
|
@@ -43,4 +43,4 @@
|
|
|
43
43
|
"typedoc": "^0.26.10",
|
|
44
44
|
"typescript": "^5.6.3"
|
|
45
45
|
}
|
|
46
|
-
}
|
|
46
|
+
}
|