@ferricstore/ferricstore 0.1.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 +200 -0
- package/README.md +250 -0
- package/dist/index.d.ts +1270 -0
- package/dist/index.js +5065 -0
- package/dist/index.js.map +1 -0
- package/docs/api/assets/hierarchy.js +1 -0
- package/docs/api/assets/highlight.css +99 -0
- package/docs/api/assets/icons.js +18 -0
- package/docs/api/assets/icons.svg +1 -0
- package/docs/api/assets/main.js +60 -0
- package/docs/api/assets/navigation.js +1 -0
- package/docs/api/assets/search.js +1 -0
- package/docs/api/assets/style.css +1633 -0
- package/docs/api/classes/BitmapStore.html +7 -0
- package/docs/api/classes/BloomFilterStore.html +9 -0
- package/docs/api/classes/CountMinSketchStore.html +8 -0
- package/docs/api/classes/CuckooFilterStore.html +10 -0
- package/docs/api/classes/FerricStoreClient.html +130 -0
- package/docs/api/classes/FerricStoreError.html +35 -0
- package/docs/api/classes/FlowAlreadyExistsError.html +35 -0
- package/docs/api/classes/FlowNotFoundError.html +35 -0
- package/docs/api/classes/FlowWrongStateError.html +35 -0
- package/docs/api/classes/GeoStore.html +8 -0
- package/docs/api/classes/HashStore.html +26 -0
- package/docs/api/classes/HyperLogLogStore.html +5 -0
- package/docs/api/classes/InvalidCommandError.html +35 -0
- package/docs/api/classes/JsonCodec.html +4 -0
- package/docs/api/classes/JsonStore.html +15 -0
- package/docs/api/classes/KeyValueStore.html +52 -0
- package/docs/api/classes/ListStore.html +22 -0
- package/docs/api/classes/LockHeldError.html +35 -0
- package/docs/api/classes/LockNotOwnedError.html +35 -0
- package/docs/api/classes/NativeAdapter.html +5 -0
- package/docs/api/classes/OverloadedError.html +37 -0
- package/docs/api/classes/Queue.html +9 -0
- package/docs/api/classes/QueueClient.html +4 -0
- package/docs/api/classes/QueueWorker.html +9 -0
- package/docs/api/classes/RawCodec.html +4 -0
- package/docs/api/classes/SetStore.html +19 -0
- package/docs/api/classes/SortedSetStore.html +19 -0
- package/docs/api/classes/StaleLeaseError.html +35 -0
- package/docs/api/classes/StreamStore.html +13 -0
- package/docs/api/classes/TDigestStore.html +16 -0
- package/docs/api/classes/TopKStore.html +8 -0
- package/docs/api/classes/Workflow.html +16 -0
- package/docs/api/classes/WorkflowClient.html +4 -0
- package/docs/api/classes/WorkflowContext.html +23 -0
- package/docs/api/classes/WorkflowFlowCommands.html +14 -0
- package/docs/api/classes/WorkflowWorker.html +6 -0
- package/docs/api/functions/classifyServerError.html +1 -0
- package/docs/api/functions/complete.html +1 -0
- package/docs/api/functions/fail.html +1 -0
- package/docs/api/functions/mapException.html +1 -0
- package/docs/api/functions/retry.html +1 -0
- package/docs/api/functions/transition.html +1 -0
- package/docs/api/hierarchy.html +1 -0
- package/docs/api/index.html +105 -0
- package/docs/api/interfaces/AutoBatchOptions.html +5 -0
- package/docs/api/interfaces/BackpressurePolicy.html +5 -0
- package/docs/api/interfaces/CancelOptions.html +8 -0
- package/docs/api/interfaces/ChildSpec.html +7 -0
- package/docs/api/interfaces/ClaimDueOptions.html +19 -0
- package/docs/api/interfaces/ClaimedItem.html +11 -0
- package/docs/api/interfaces/Codec.html +3 -0
- package/docs/api/interfaces/CommandExecutor.html +4 -0
- package/docs/api/interfaces/CompleteOptions.html +13 -0
- package/docs/api/interfaces/CompleteOutcome.html +9 -0
- package/docs/api/interfaces/CountMinMergeOptions.html +2 -0
- package/docs/api/interfaces/CreateItem.html +6 -0
- package/docs/api/interfaces/CreateManyOptions.html +15 -0
- package/docs/api/interfaces/CreateOptions.html +16 -0
- package/docs/api/interfaces/ExecutePipelineOptions.html +2 -0
- package/docs/api/interfaces/FailOptions.html +13 -0
- package/docs/api/interfaces/FailOutcome.html +9 -0
- package/docs/api/interfaces/FencedItem.html +5 -0
- package/docs/api/interfaces/FerricStoreClientOptions.html +4 -0
- package/docs/api/interfaces/FetchOrComputeResult.html +6 -0
- package/docs/api/interfaces/FlowRecord.html +20 -0
- package/docs/api/interfaces/GeoAddOptions.html +4 -0
- package/docs/api/interfaces/GeoMember.html +4 -0
- package/docs/api/interfaces/GetExOptions.html +6 -0
- package/docs/api/interfaces/JsonSetOptions.html +3 -0
- package/docs/api/interfaces/KeyInfo.html +7 -0
- package/docs/api/interfaces/MutateOptions.html +9 -0
- package/docs/api/interfaces/NamedValueMutation.html +5 -0
- package/docs/api/interfaces/NativeAdapterOptions.html +9 -0
- package/docs/api/interfaces/QueueOptions.html +4 -0
- package/docs/api/interfaces/QueueWorkerResult.html +5 -0
- package/docs/api/interfaces/RangeLimit.html +3 -0
- package/docs/api/interfaces/RateLimitResult.html +6 -0
- package/docs/api/interfaces/ReadOptions.html +10 -0
- package/docs/api/interfaces/ReclaimOptions.html +14 -0
- package/docs/api/interfaces/RetryOptions.html +13 -0
- package/docs/api/interfaces/RetryOutcome.html +9 -0
- package/docs/api/interfaces/RetryPolicy.html +7 -0
- package/docs/api/interfaces/ScanOptions.html +3 -0
- package/docs/api/interfaces/SetOptions.html +9 -0
- package/docs/api/interfaces/StateOptions.html +9 -0
- package/docs/api/interfaces/StateRegistration.html +11 -0
- package/docs/api/interfaces/StoreCommandClient.html +3 -0
- package/docs/api/interfaces/TDigestCreateOptions.html +2 -0
- package/docs/api/interfaces/TDigestMergeOptions.html +3 -0
- package/docs/api/interfaces/TopKReserveOptions.html +4 -0
- package/docs/api/interfaces/TransitionOptions.html +15 -0
- package/docs/api/interfaces/TransitionOutcome.html +10 -0
- package/docs/api/interfaces/ValueConfig.html +3 -0
- package/docs/api/interfaces/WorkerConfig.html +24 -0
- package/docs/api/interfaces/WorkflowOptions.html +5 -0
- package/docs/api/interfaces/WorkflowWorkerResult.html +5 -0
- package/docs/api/interfaces/XReadStream.html +3 -0
- package/docs/api/interfaces/ZAddMember.html +3 -0
- package/docs/api/interfaces/ZAddOptions.html +6 -0
- package/docs/api/media/design.md +59 -0
- package/docs/api/media/durable-queue.ts +24 -0
- package/docs/api/media/fanout.ts +38 -0
- package/docs/api/media/kv-store.ts +26 -0
- package/docs/api/media/order-workflow.ts +31 -0
- package/docs/api/media/signals.ts +47 -0
- package/docs/api/media/value-refs.ts +38 -0
- package/docs/api/modules.html +1 -0
- package/docs/api/types/BackoffKind.html +1 -0
- package/docs/api/types/Command.html +1 -0
- package/docs/api/types/CommandArgument.html +1 -0
- package/docs/api/types/ExceptionPolicy.html +1 -0
- package/docs/api/types/Outcome.html +1 -0
- package/docs/api/types/QueueBatchHandler.html +1 -0
- package/docs/api/types/QueueHandler.html +1 -0
- package/docs/api/types/WorkerProfile.html +1 -0
- package/docs/api/types/WorkflowHandler.html +1 -0
- package/docs/design.md +59 -0
- package/docs/python-parity.md +117 -0
- package/package.json +74 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1270 @@
|
|
|
1
|
+
import tls from 'node:tls';
|
|
2
|
+
|
|
3
|
+
interface Codec<T = unknown> {
|
|
4
|
+
encode(value: T | null | undefined): Buffer;
|
|
5
|
+
decode(value: Buffer | null | undefined): T | null;
|
|
6
|
+
}
|
|
7
|
+
declare class RawCodec implements Codec<Buffer | string | Uint8Array | null> {
|
|
8
|
+
encode(value: Buffer | string | Uint8Array | null | undefined): Buffer;
|
|
9
|
+
decode(value: Buffer | null | undefined): Buffer | null;
|
|
10
|
+
}
|
|
11
|
+
declare class JsonCodec<T = unknown> implements Codec<T> {
|
|
12
|
+
encode(value: T | null | undefined): Buffer;
|
|
13
|
+
decode(value: Buffer | null | undefined): T | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type CommandArgument = string | Buffer | number | boolean | null | undefined;
|
|
17
|
+
type Command = readonly CommandArgument[];
|
|
18
|
+
|
|
19
|
+
interface CommandExecutor {
|
|
20
|
+
executeCommand(...args: CommandArgument[]): Promise<unknown>;
|
|
21
|
+
executePipeline?(commands: readonly Command[], options?: ExecutePipelineOptions): Promise<unknown[]>;
|
|
22
|
+
close?(): Promise<void> | void;
|
|
23
|
+
}
|
|
24
|
+
interface ExecutePipelineOptions {
|
|
25
|
+
throwOnItemError?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface NativeAdapterOptions {
|
|
28
|
+
clientName?: string;
|
|
29
|
+
connectTimeoutMs?: number;
|
|
30
|
+
maxChunkBytes?: number;
|
|
31
|
+
protocolLanes?: number;
|
|
32
|
+
timeoutMs?: number;
|
|
33
|
+
username?: string;
|
|
34
|
+
password?: string;
|
|
35
|
+
tlsOptions?: tls.ConnectionOptions;
|
|
36
|
+
}
|
|
37
|
+
declare class NativeAdapter implements CommandExecutor {
|
|
38
|
+
private readonly socket;
|
|
39
|
+
private readonly pending;
|
|
40
|
+
private readonly chunks;
|
|
41
|
+
private readonly chunkBytes;
|
|
42
|
+
private buffer;
|
|
43
|
+
private closed;
|
|
44
|
+
private dataLane;
|
|
45
|
+
private readonly maxChunkBytes;
|
|
46
|
+
private requestId;
|
|
47
|
+
private readonly protocolLanes;
|
|
48
|
+
private readonly timeoutMs;
|
|
49
|
+
private constructor();
|
|
50
|
+
static fromUrl(url: string, options?: NativeAdapterOptions): Promise<NativeAdapter>;
|
|
51
|
+
executeCommand(...args: CommandArgument[]): Promise<unknown>;
|
|
52
|
+
executePipeline(commands: readonly Command[], options?: ExecutePipelineOptions): Promise<unknown[]>;
|
|
53
|
+
close(): Promise<void>;
|
|
54
|
+
private startup;
|
|
55
|
+
private auth;
|
|
56
|
+
private request;
|
|
57
|
+
private onData;
|
|
58
|
+
private handleFrame;
|
|
59
|
+
private failAll;
|
|
60
|
+
private cleanupChunksForRequest;
|
|
61
|
+
private nextRequestId;
|
|
62
|
+
private assignLane;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface StoreCommandClient {
|
|
66
|
+
readonly codec: Codec;
|
|
67
|
+
command(...args: CommandArgument[]): Promise<unknown>;
|
|
68
|
+
}
|
|
69
|
+
interface SetOptions {
|
|
70
|
+
ex?: number;
|
|
71
|
+
px?: number;
|
|
72
|
+
exat?: number;
|
|
73
|
+
pxat?: number;
|
|
74
|
+
nx?: boolean;
|
|
75
|
+
xx?: boolean;
|
|
76
|
+
get?: boolean;
|
|
77
|
+
keepTtl?: boolean;
|
|
78
|
+
}
|
|
79
|
+
interface GetExOptions {
|
|
80
|
+
ex?: number;
|
|
81
|
+
px?: number;
|
|
82
|
+
exat?: number;
|
|
83
|
+
pxat?: number;
|
|
84
|
+
persist?: boolean;
|
|
85
|
+
}
|
|
86
|
+
interface ScanOptions {
|
|
87
|
+
match?: string;
|
|
88
|
+
count?: number;
|
|
89
|
+
}
|
|
90
|
+
interface ZAddMember {
|
|
91
|
+
score: number;
|
|
92
|
+
member: unknown;
|
|
93
|
+
}
|
|
94
|
+
interface ZAddOptions {
|
|
95
|
+
nx?: boolean;
|
|
96
|
+
xx?: boolean;
|
|
97
|
+
gt?: boolean;
|
|
98
|
+
lt?: boolean;
|
|
99
|
+
ch?: boolean;
|
|
100
|
+
}
|
|
101
|
+
interface RangeLimit {
|
|
102
|
+
offset: number;
|
|
103
|
+
count: number;
|
|
104
|
+
}
|
|
105
|
+
interface XReadStream {
|
|
106
|
+
key: string;
|
|
107
|
+
id: string;
|
|
108
|
+
}
|
|
109
|
+
interface GeoMember {
|
|
110
|
+
longitude: number;
|
|
111
|
+
latitude: number;
|
|
112
|
+
member: unknown;
|
|
113
|
+
}
|
|
114
|
+
interface GeoAddOptions {
|
|
115
|
+
nx?: boolean;
|
|
116
|
+
xx?: boolean;
|
|
117
|
+
ch?: boolean;
|
|
118
|
+
}
|
|
119
|
+
declare class KeyValueStore {
|
|
120
|
+
private readonly client;
|
|
121
|
+
constructor(client: StoreCommandClient);
|
|
122
|
+
get<T = unknown>(key: string): Promise<T | null>;
|
|
123
|
+
set(key: string, value: unknown, options?: SetOptions): Promise<unknown>;
|
|
124
|
+
del(...keys: string[]): Promise<number>;
|
|
125
|
+
exists(...keys: string[]): Promise<number>;
|
|
126
|
+
mget<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
127
|
+
mset(entries: Record<string, unknown> | [string, unknown][]): Promise<boolean>;
|
|
128
|
+
msetnx(entries: Record<string, unknown> | [string, unknown][]): Promise<boolean>;
|
|
129
|
+
incr(key: string): Promise<number>;
|
|
130
|
+
decr(key: string): Promise<number>;
|
|
131
|
+
incrby(key: string, increment: number): Promise<number>;
|
|
132
|
+
decrby(key: string, decrement: number): Promise<number>;
|
|
133
|
+
incrbyfloat(key: string, increment: number): Promise<string>;
|
|
134
|
+
append(key: string, value: unknown): Promise<number>;
|
|
135
|
+
strlen(key: string): Promise<number>;
|
|
136
|
+
getset<T = unknown>(key: string, value: unknown): Promise<T | null>;
|
|
137
|
+
getdel<T = unknown>(key: string): Promise<T | null>;
|
|
138
|
+
getex<T = unknown>(key: string, options?: GetExOptions): Promise<T | null>;
|
|
139
|
+
setnx(key: string, value: unknown): Promise<boolean>;
|
|
140
|
+
setex(key: string, seconds: number, value: unknown): Promise<boolean>;
|
|
141
|
+
psetex(key: string, milliseconds: number, value: unknown): Promise<boolean>;
|
|
142
|
+
getrange(key: string, start: number, end: number): Promise<Buffer | string | unknown>;
|
|
143
|
+
setrange(key: string, offset: number, value: unknown): Promise<number>;
|
|
144
|
+
expire(key: string, seconds: number): Promise<boolean>;
|
|
145
|
+
pexpire(key: string, milliseconds: number): Promise<boolean>;
|
|
146
|
+
expireat(key: string, unixSeconds: number): Promise<boolean>;
|
|
147
|
+
pexpireat(key: string, unixMilliseconds: number): Promise<boolean>;
|
|
148
|
+
ttl(key: string): Promise<number>;
|
|
149
|
+
pttl(key: string): Promise<number>;
|
|
150
|
+
persist(key: string): Promise<boolean>;
|
|
151
|
+
expiretime(key: string): Promise<number>;
|
|
152
|
+
pexpiretime(key: string): Promise<number>;
|
|
153
|
+
type(key: string): Promise<string>;
|
|
154
|
+
unlink(...keys: string[]): Promise<number>;
|
|
155
|
+
rename(key: string, newKey: string): Promise<boolean>;
|
|
156
|
+
renamenx(key: string, newKey: string): Promise<boolean>;
|
|
157
|
+
copy(source: string, destination: string, options?: {
|
|
158
|
+
replace?: boolean;
|
|
159
|
+
}): Promise<boolean>;
|
|
160
|
+
randomkey(): Promise<string | null>;
|
|
161
|
+
keys(pattern: string): Promise<unknown[]>;
|
|
162
|
+
scan(cursor: string | number, options?: ScanOptions): Promise<unknown>;
|
|
163
|
+
dbsize(): Promise<number>;
|
|
164
|
+
flushdb(mode?: "ASYNC" | "SYNC"): Promise<boolean>;
|
|
165
|
+
flushall(mode?: "ASYNC" | "SYNC"): Promise<boolean>;
|
|
166
|
+
objectEncoding(key: string): Promise<string | null>;
|
|
167
|
+
objectHelp(): Promise<unknown[]>;
|
|
168
|
+
objectFreq(key: string): Promise<number>;
|
|
169
|
+
objectIdleTime(key: string): Promise<number>;
|
|
170
|
+
objectRefcount(key: string): Promise<number>;
|
|
171
|
+
wait(numReplicas: number, timeoutMs: number): Promise<number>;
|
|
172
|
+
waitAof(numLocal: number, numReplicas: number, timeoutMs: number): Promise<unknown[]>;
|
|
173
|
+
memoryUsage(key: string): Promise<number>;
|
|
174
|
+
}
|
|
175
|
+
declare class HashStore {
|
|
176
|
+
private readonly client;
|
|
177
|
+
constructor(client: StoreCommandClient);
|
|
178
|
+
hset(key: string, entries: Record<string, unknown> | [string, unknown][]): Promise<number>;
|
|
179
|
+
hget<T = unknown>(key: string, field: string): Promise<T | null>;
|
|
180
|
+
hdel(key: string, ...fields: string[]): Promise<number>;
|
|
181
|
+
hmget<T = unknown>(key: string, fields: string[]): Promise<(T | null)[]>;
|
|
182
|
+
hgetall(key: string): Promise<unknown>;
|
|
183
|
+
hexists(key: string, field: string): Promise<boolean>;
|
|
184
|
+
hkeys(key: string): Promise<unknown[]>;
|
|
185
|
+
hvals<T = unknown>(key: string): Promise<(T | null)[]>;
|
|
186
|
+
hlen(key: string): Promise<number>;
|
|
187
|
+
hincrby(key: string, field: string, increment: number): Promise<number>;
|
|
188
|
+
hincrbyfloat(key: string, field: string, increment: number): Promise<string>;
|
|
189
|
+
hsetnx(key: string, field: string, value: unknown): Promise<boolean>;
|
|
190
|
+
hstrlen(key: string, field: string): Promise<number>;
|
|
191
|
+
hrandfield(key: string, count?: number, withValues?: boolean): Promise<unknown>;
|
|
192
|
+
hscan(key: string, cursor: string | number, options?: ScanOptions): Promise<unknown>;
|
|
193
|
+
hexpire(key: string, seconds: number, fields: string[]): Promise<unknown[]>;
|
|
194
|
+
httl(key: string, fields: string[]): Promise<unknown[]>;
|
|
195
|
+
hpersist(key: string, fields: string[]): Promise<unknown[]>;
|
|
196
|
+
hpexpire(key: string, milliseconds: number, fields: string[]): Promise<unknown[]>;
|
|
197
|
+
hpttl(key: string, fields: string[]): Promise<unknown[]>;
|
|
198
|
+
hexpiretime(key: string, fields: string[]): Promise<unknown[]>;
|
|
199
|
+
hgetdel<T = unknown>(key: string, fields: string[]): Promise<(T | null)[]>;
|
|
200
|
+
hgetex<T = unknown>(key: string, fields: string[], options?: GetExOptions): Promise<(T | null)[]>;
|
|
201
|
+
hsetex(key: string, seconds: number, entries: Record<string, unknown> | [string, unknown][]): Promise<number>;
|
|
202
|
+
}
|
|
203
|
+
declare class ListStore {
|
|
204
|
+
private readonly client;
|
|
205
|
+
constructor(client: StoreCommandClient);
|
|
206
|
+
lpush(key: string, ...elements: unknown[]): Promise<number>;
|
|
207
|
+
rpush(key: string, ...elements: unknown[]): Promise<number>;
|
|
208
|
+
lpop<T = unknown>(key: string, count?: number): Promise<T | (T | null)[] | null>;
|
|
209
|
+
rpop<T = unknown>(key: string, count?: number): Promise<T | (T | null)[] | null>;
|
|
210
|
+
lrange<T = unknown>(key: string, start: number, stop: number): Promise<(T | null)[]>;
|
|
211
|
+
llen(key: string): Promise<number>;
|
|
212
|
+
lindex<T = unknown>(key: string, index: number): Promise<T | null>;
|
|
213
|
+
lset(key: string, index: number, element: unknown): Promise<boolean>;
|
|
214
|
+
lrem(key: string, count: number, element: unknown): Promise<number>;
|
|
215
|
+
ltrim(key: string, start: number, stop: number): Promise<boolean>;
|
|
216
|
+
lpos(key: string, element: unknown, options?: {
|
|
217
|
+
rank?: number;
|
|
218
|
+
count?: number;
|
|
219
|
+
maxlen?: number;
|
|
220
|
+
}): Promise<unknown>;
|
|
221
|
+
linsert(key: string, where: "BEFORE" | "AFTER", pivot: unknown, element: unknown): Promise<number>;
|
|
222
|
+
lmove(source: string, destination: string, from: "LEFT" | "RIGHT", to: "LEFT" | "RIGHT"): Promise<unknown>;
|
|
223
|
+
rpoplpush(source: string, destination: string): Promise<unknown>;
|
|
224
|
+
lpushx(key: string, ...elements: unknown[]): Promise<number>;
|
|
225
|
+
rpushx(key: string, ...elements: unknown[]): Promise<number>;
|
|
226
|
+
blpop(keys: string[], timeoutSeconds: number): Promise<unknown>;
|
|
227
|
+
brpop(keys: string[], timeoutSeconds: number): Promise<unknown>;
|
|
228
|
+
blmove(source: string, destination: string, from: "LEFT" | "RIGHT", to: "LEFT" | "RIGHT", timeoutSeconds: number): Promise<unknown>;
|
|
229
|
+
blmpop(timeoutSeconds: number, keys: string[], from: "LEFT" | "RIGHT", options?: {
|
|
230
|
+
count?: number;
|
|
231
|
+
}): Promise<unknown>;
|
|
232
|
+
}
|
|
233
|
+
declare class SetStore {
|
|
234
|
+
private readonly client;
|
|
235
|
+
constructor(client: StoreCommandClient);
|
|
236
|
+
sadd(key: string, ...members: unknown[]): Promise<number>;
|
|
237
|
+
srem(key: string, ...members: unknown[]): Promise<number>;
|
|
238
|
+
smembers<T = unknown>(key: string): Promise<(T | null)[]>;
|
|
239
|
+
sismember(key: string, member: unknown): Promise<boolean>;
|
|
240
|
+
smismember(key: string, members: unknown[]): Promise<unknown[]>;
|
|
241
|
+
scard(key: string): Promise<number>;
|
|
242
|
+
srandmember<T = unknown>(key: string, count?: number): Promise<T | (T | null)[] | null>;
|
|
243
|
+
spop<T = unknown>(key: string, count?: number): Promise<T | (T | null)[] | null>;
|
|
244
|
+
sdiff<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
245
|
+
sinter<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
246
|
+
sunion<T = unknown>(keys: string[]): Promise<(T | null)[]>;
|
|
247
|
+
sdiffstore(destination: string, keys: string[]): Promise<number>;
|
|
248
|
+
sinterstore(destination: string, keys: string[]): Promise<number>;
|
|
249
|
+
sunionstore(destination: string, keys: string[]): Promise<number>;
|
|
250
|
+
sintercard(keys: string[], limit?: number): Promise<number>;
|
|
251
|
+
smove(source: string, destination: string, member: unknown): Promise<boolean>;
|
|
252
|
+
sscan(key: string, cursor: string | number, options?: ScanOptions): Promise<unknown>;
|
|
253
|
+
}
|
|
254
|
+
declare class SortedSetStore {
|
|
255
|
+
private readonly client;
|
|
256
|
+
constructor(client: StoreCommandClient);
|
|
257
|
+
zadd(key: string, members: ZAddMember[], options?: ZAddOptions): Promise<number>;
|
|
258
|
+
zscore(key: string, member: unknown): Promise<string | null>;
|
|
259
|
+
zrank(key: string, member: unknown): Promise<number | null>;
|
|
260
|
+
zrevrank(key: string, member: unknown): Promise<number | null>;
|
|
261
|
+
zrange(key: string, start: number, stop: number, options?: {
|
|
262
|
+
withScores?: boolean;
|
|
263
|
+
}): Promise<unknown[]>;
|
|
264
|
+
zrevrange(key: string, start: number, stop: number, options?: {
|
|
265
|
+
withScores?: boolean;
|
|
266
|
+
}): Promise<unknown[]>;
|
|
267
|
+
zcard(key: string): Promise<number>;
|
|
268
|
+
zrem(key: string, ...members: unknown[]): Promise<number>;
|
|
269
|
+
zincrby(key: string, increment: number, member: unknown): Promise<string>;
|
|
270
|
+
zcount(key: string, min: string | number, max: string | number): Promise<number>;
|
|
271
|
+
zpopmin(key: string, count?: number): Promise<unknown[]>;
|
|
272
|
+
zpopmax(key: string, count?: number): Promise<unknown[]>;
|
|
273
|
+
zrandmember(key: string, count?: number, withScores?: boolean): Promise<unknown>;
|
|
274
|
+
zmscore(key: string, members: unknown[]): Promise<unknown[]>;
|
|
275
|
+
zrangebyscore(key: string, min: string | number, max: string | number, options?: {
|
|
276
|
+
withScores?: boolean;
|
|
277
|
+
limit?: RangeLimit;
|
|
278
|
+
}): Promise<unknown[]>;
|
|
279
|
+
zrevrangebyscore(key: string, max: string | number, min: string | number, options?: {
|
|
280
|
+
withScores?: boolean;
|
|
281
|
+
limit?: RangeLimit;
|
|
282
|
+
}): Promise<unknown[]>;
|
|
283
|
+
zscan(key: string, cursor: string | number, options?: ScanOptions): Promise<unknown>;
|
|
284
|
+
}
|
|
285
|
+
declare class StreamStore {
|
|
286
|
+
private readonly client;
|
|
287
|
+
constructor(client: StoreCommandClient);
|
|
288
|
+
xadd(key: string, id: string, fields: Record<string, unknown> | [string, unknown][]): Promise<unknown>;
|
|
289
|
+
xlen(key: string): Promise<number>;
|
|
290
|
+
xrange(key: string, start?: string, end?: string, count?: number): Promise<unknown[]>;
|
|
291
|
+
xrevrange(key: string, end?: string, start?: string, count?: number): Promise<unknown[]>;
|
|
292
|
+
xread(streams: XReadStream[], options?: {
|
|
293
|
+
count?: number;
|
|
294
|
+
blockMs?: number;
|
|
295
|
+
}): Promise<unknown>;
|
|
296
|
+
xtrim(key: string, strategy: "MAXLEN" | "MINID", threshold: string | number, approximate?: boolean): Promise<number>;
|
|
297
|
+
xdel(key: string, ...ids: string[]): Promise<number>;
|
|
298
|
+
xinfoStream(key: string): Promise<unknown>;
|
|
299
|
+
xgroupCreate(key: string, group: string, id: string, mkstream?: boolean): Promise<boolean>;
|
|
300
|
+
xreadgroup(group: string, consumer: string, streams: XReadStream[], options?: {
|
|
301
|
+
count?: number;
|
|
302
|
+
blockMs?: number;
|
|
303
|
+
noack?: boolean;
|
|
304
|
+
}): Promise<unknown>;
|
|
305
|
+
xack(key: string, group: string, ...ids: string[]): Promise<number>;
|
|
306
|
+
}
|
|
307
|
+
declare class BitmapStore {
|
|
308
|
+
private readonly client;
|
|
309
|
+
constructor(client: StoreCommandClient);
|
|
310
|
+
setbit(key: string, offset: number, value: 0 | 1): Promise<number>;
|
|
311
|
+
getbit(key: string, offset: number): Promise<number>;
|
|
312
|
+
bitcount(key: string, start?: number, end?: number, unit?: "BYTE" | "BIT"): Promise<number>;
|
|
313
|
+
bitpos(key: string, bit: 0 | 1, start?: number, end?: number, unit?: "BYTE" | "BIT"): Promise<number>;
|
|
314
|
+
bitop(operation: "AND" | "OR" | "XOR" | "NOT", destination: string, ...keys: string[]): Promise<number>;
|
|
315
|
+
}
|
|
316
|
+
declare class HyperLogLogStore {
|
|
317
|
+
private readonly client;
|
|
318
|
+
constructor(client: StoreCommandClient);
|
|
319
|
+
pfadd(key: string, ...elements: unknown[]): Promise<number>;
|
|
320
|
+
pfcount(...keys: string[]): Promise<number>;
|
|
321
|
+
pfmerge(destination: string, ...sources: string[]): Promise<boolean>;
|
|
322
|
+
}
|
|
323
|
+
declare class GeoStore {
|
|
324
|
+
private readonly client;
|
|
325
|
+
constructor(client: StoreCommandClient);
|
|
326
|
+
geoadd(key: string, members: GeoMember[], options?: GeoAddOptions): Promise<number>;
|
|
327
|
+
geopos(key: string, ...members: unknown[]): Promise<unknown[]>;
|
|
328
|
+
geodist(key: string, member1: unknown, member2: unknown, unit?: "m" | "km" | "mi" | "ft"): Promise<string | null>;
|
|
329
|
+
geohash(key: string, ...members: unknown[]): Promise<unknown[]>;
|
|
330
|
+
geosearch(key: string, args: CommandArgument[]): Promise<unknown[]>;
|
|
331
|
+
geosearchstore(destination: string, source: string, args: CommandArgument[]): Promise<number>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
interface TopKReserveOptions {
|
|
335
|
+
width?: number;
|
|
336
|
+
depth?: number;
|
|
337
|
+
decay?: number;
|
|
338
|
+
}
|
|
339
|
+
interface CountMinMergeOptions {
|
|
340
|
+
weights?: number[];
|
|
341
|
+
}
|
|
342
|
+
interface TDigestCreateOptions {
|
|
343
|
+
compression?: number;
|
|
344
|
+
}
|
|
345
|
+
interface TDigestMergeOptions extends TDigestCreateOptions {
|
|
346
|
+
override?: boolean;
|
|
347
|
+
}
|
|
348
|
+
interface JsonSetOptions {
|
|
349
|
+
nx?: boolean;
|
|
350
|
+
xx?: boolean;
|
|
351
|
+
}
|
|
352
|
+
declare class BloomFilterStore {
|
|
353
|
+
private readonly client;
|
|
354
|
+
constructor(client: StoreCommandClient);
|
|
355
|
+
reserve(key: string, errorRate: number, capacity: number): Promise<boolean>;
|
|
356
|
+
add(key: string, element: unknown): Promise<boolean>;
|
|
357
|
+
madd(key: string, ...elements: unknown[]): Promise<number[]>;
|
|
358
|
+
exists(key: string, element: unknown): Promise<boolean>;
|
|
359
|
+
mexists(key: string, ...elements: unknown[]): Promise<number[]>;
|
|
360
|
+
card(key: string): Promise<number>;
|
|
361
|
+
info(key: string): Promise<unknown[]>;
|
|
362
|
+
}
|
|
363
|
+
declare class CuckooFilterStore {
|
|
364
|
+
private readonly client;
|
|
365
|
+
constructor(client: StoreCommandClient);
|
|
366
|
+
reserve(key: string, capacity: number): Promise<boolean>;
|
|
367
|
+
add(key: string, element: unknown): Promise<boolean>;
|
|
368
|
+
addnx(key: string, element: unknown): Promise<boolean>;
|
|
369
|
+
del(key: string, element: unknown): Promise<boolean>;
|
|
370
|
+
exists(key: string, element: unknown): Promise<boolean>;
|
|
371
|
+
mexists(key: string, ...elements: unknown[]): Promise<number[]>;
|
|
372
|
+
count(key: string, element: unknown): Promise<number>;
|
|
373
|
+
info(key: string): Promise<unknown[]>;
|
|
374
|
+
}
|
|
375
|
+
declare class CountMinSketchStore {
|
|
376
|
+
private readonly client;
|
|
377
|
+
constructor(client: StoreCommandClient);
|
|
378
|
+
initByDim(key: string, width: number, depth: number): Promise<boolean>;
|
|
379
|
+
initByProb(key: string, error: number, probability: number): Promise<boolean>;
|
|
380
|
+
incrBy(key: string, entries: [unknown, number][]): Promise<number[]>;
|
|
381
|
+
query(key: string, ...items: unknown[]): Promise<number[]>;
|
|
382
|
+
merge(destination: string, sources: string[], options?: CountMinMergeOptions): Promise<boolean>;
|
|
383
|
+
info(key: string): Promise<unknown[]>;
|
|
384
|
+
}
|
|
385
|
+
declare class TopKStore {
|
|
386
|
+
private readonly client;
|
|
387
|
+
constructor(client: StoreCommandClient);
|
|
388
|
+
reserve(key: string, k: number, options?: TopKReserveOptions): Promise<boolean>;
|
|
389
|
+
add<T = unknown>(key: string, ...elements: unknown[]): Promise<(T | null)[]>;
|
|
390
|
+
incrBy<T = unknown>(key: string, entries: [unknown, number][]): Promise<(T | null)[]>;
|
|
391
|
+
query(key: string, ...elements: unknown[]): Promise<number[]>;
|
|
392
|
+
list<T = unknown>(key: string, options?: {
|
|
393
|
+
withCount?: boolean;
|
|
394
|
+
}): Promise<(T | number | null)[]>;
|
|
395
|
+
info(key: string): Promise<unknown[]>;
|
|
396
|
+
}
|
|
397
|
+
declare class TDigestStore {
|
|
398
|
+
private readonly client;
|
|
399
|
+
constructor(client: StoreCommandClient);
|
|
400
|
+
create(key: string, options?: TDigestCreateOptions): Promise<boolean>;
|
|
401
|
+
add(key: string, ...values: number[]): Promise<boolean>;
|
|
402
|
+
reset(key: string): Promise<boolean>;
|
|
403
|
+
quantile(key: string, ...quantiles: number[]): Promise<string[]>;
|
|
404
|
+
cdf(key: string, ...values: number[]): Promise<string[]>;
|
|
405
|
+
rank(key: string, ...values: number[]): Promise<number[]>;
|
|
406
|
+
revrank(key: string, ...values: number[]): Promise<number[]>;
|
|
407
|
+
byrank(key: string, ...ranks: number[]): Promise<string[]>;
|
|
408
|
+
byrevrank(key: string, ...ranks: number[]): Promise<string[]>;
|
|
409
|
+
trimmedMean(key: string, low: number, high: number): Promise<string>;
|
|
410
|
+
min(key: string): Promise<string>;
|
|
411
|
+
max(key: string): Promise<string>;
|
|
412
|
+
info(key: string): Promise<unknown[]>;
|
|
413
|
+
merge(destination: string, sources: string[], options?: TDigestMergeOptions): Promise<boolean>;
|
|
414
|
+
}
|
|
415
|
+
declare class JsonStore {
|
|
416
|
+
private readonly client;
|
|
417
|
+
constructor(client: StoreCommandClient);
|
|
418
|
+
set(key: string, path: string, value: unknown, options?: JsonSetOptions): Promise<boolean>;
|
|
419
|
+
get<T = unknown>(key: string, paths?: string | string[]): Promise<T | null>;
|
|
420
|
+
del(key: string, path?: string): Promise<number>;
|
|
421
|
+
numIncrBy(key: string, path: string, value: number): Promise<string>;
|
|
422
|
+
type(key: string, path?: string): Promise<string | null>;
|
|
423
|
+
strlen(key: string, path?: string): Promise<number | null>;
|
|
424
|
+
objKeys(key: string, path?: string): Promise<unknown[]>;
|
|
425
|
+
objLen(key: string, path?: string): Promise<number>;
|
|
426
|
+
arrAppend(key: string, path: string, ...values: unknown[]): Promise<number>;
|
|
427
|
+
arrLen(key: string, path?: string): Promise<number>;
|
|
428
|
+
toggle(key: string, path: string): Promise<number>;
|
|
429
|
+
clear(key: string, path?: string): Promise<number>;
|
|
430
|
+
mget<T = unknown>(keys: string[], path: string): Promise<(T | null)[]>;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
type ExceptionPolicy = "retry" | "fail" | "raise";
|
|
434
|
+
type BackoffKind = "fixed" | "linear" | "exponential";
|
|
435
|
+
type WorkerProfile = "latency" | "throughput";
|
|
436
|
+
interface RetryPolicy {
|
|
437
|
+
maxRetries?: number;
|
|
438
|
+
backoff?: BackoffKind | string;
|
|
439
|
+
baseMs?: number;
|
|
440
|
+
maxMs?: number;
|
|
441
|
+
jitterPct?: number;
|
|
442
|
+
exhaustedTo?: string;
|
|
443
|
+
}
|
|
444
|
+
interface BackpressurePolicy {
|
|
445
|
+
maxRetries?: number;
|
|
446
|
+
baseDelayMs?: number;
|
|
447
|
+
maxDelayMs?: number;
|
|
448
|
+
jitterPct?: number;
|
|
449
|
+
}
|
|
450
|
+
interface ValueConfig {
|
|
451
|
+
valueMaxBytes?: number;
|
|
452
|
+
localCache?: boolean;
|
|
453
|
+
}
|
|
454
|
+
interface WorkerConfig {
|
|
455
|
+
profile?: WorkerProfile;
|
|
456
|
+
workers?: number;
|
|
457
|
+
concurrency?: number;
|
|
458
|
+
batchSize?: number;
|
|
459
|
+
leaseMs?: number;
|
|
460
|
+
priority?: number;
|
|
461
|
+
nowMs?: number;
|
|
462
|
+
partitionKey?: string;
|
|
463
|
+
partitionKeys?: string[];
|
|
464
|
+
reclaimExpired?: boolean;
|
|
465
|
+
reclaimRatio?: number;
|
|
466
|
+
claimPayload?: boolean;
|
|
467
|
+
claimValues?: string[];
|
|
468
|
+
valueMaxBytes?: number;
|
|
469
|
+
blockMs?: number;
|
|
470
|
+
idleSleepMs?: number;
|
|
471
|
+
maxIdleSleepMs?: number;
|
|
472
|
+
exceptionPolicy?: ExceptionPolicy;
|
|
473
|
+
completeAsyncDepth?: number;
|
|
474
|
+
completeIndependent?: boolean;
|
|
475
|
+
claimDrainBatches?: number;
|
|
476
|
+
signal?: AbortSignal;
|
|
477
|
+
worker?: string;
|
|
478
|
+
}
|
|
479
|
+
interface ChildSpec {
|
|
480
|
+
id: string;
|
|
481
|
+
type: string;
|
|
482
|
+
payload?: unknown;
|
|
483
|
+
partitionKey?: string;
|
|
484
|
+
values?: Record<string, unknown>;
|
|
485
|
+
valueRefs?: Record<string, string>;
|
|
486
|
+
}
|
|
487
|
+
interface CreateItem {
|
|
488
|
+
id: string;
|
|
489
|
+
payload?: unknown;
|
|
490
|
+
partitionKey?: string;
|
|
491
|
+
values?: Record<string, unknown>;
|
|
492
|
+
valueRefs?: Record<string, string>;
|
|
493
|
+
}
|
|
494
|
+
declare const CLAIMED_ITEM_WIRE: unique symbol;
|
|
495
|
+
interface ClaimedItemWire {
|
|
496
|
+
id: Buffer;
|
|
497
|
+
partitionKey?: Buffer | null;
|
|
498
|
+
leaseToken: Buffer;
|
|
499
|
+
fencingToken: number;
|
|
500
|
+
}
|
|
501
|
+
interface ClaimedItem<TPayload = unknown> {
|
|
502
|
+
id: string;
|
|
503
|
+
leaseToken: Buffer;
|
|
504
|
+
fencingToken: number;
|
|
505
|
+
partitionKey?: string;
|
|
506
|
+
type: string;
|
|
507
|
+
state: string;
|
|
508
|
+
runState?: string;
|
|
509
|
+
payload?: TPayload | null;
|
|
510
|
+
attributes?: Record<string, unknown>;
|
|
511
|
+
[CLAIMED_ITEM_WIRE]?: ClaimedItemWire;
|
|
512
|
+
}
|
|
513
|
+
interface FencedItem {
|
|
514
|
+
id: string;
|
|
515
|
+
fencingToken: number;
|
|
516
|
+
leaseToken?: Buffer;
|
|
517
|
+
partitionKey?: string;
|
|
518
|
+
}
|
|
519
|
+
interface RateLimitResult {
|
|
520
|
+
status: string;
|
|
521
|
+
count: number;
|
|
522
|
+
remaining: number;
|
|
523
|
+
resetMs: number;
|
|
524
|
+
allowed: boolean;
|
|
525
|
+
}
|
|
526
|
+
interface KeyInfo {
|
|
527
|
+
type: string;
|
|
528
|
+
valueSize: number;
|
|
529
|
+
ttlMs: number;
|
|
530
|
+
hotCacheStatus: string;
|
|
531
|
+
lastWriteShard: number;
|
|
532
|
+
raw: Record<string, unknown>;
|
|
533
|
+
}
|
|
534
|
+
interface FetchOrComputeResult<T = unknown> {
|
|
535
|
+
status: "hit" | "compute" | string;
|
|
536
|
+
value?: T | null;
|
|
537
|
+
computeToken?: Buffer;
|
|
538
|
+
hit: boolean;
|
|
539
|
+
shouldCompute: boolean;
|
|
540
|
+
}
|
|
541
|
+
interface FlowRecord<TPayload = unknown> {
|
|
542
|
+
id: string;
|
|
543
|
+
type: string;
|
|
544
|
+
state: string;
|
|
545
|
+
partitionKey: string;
|
|
546
|
+
runState?: string;
|
|
547
|
+
payload?: TPayload | null;
|
|
548
|
+
leaseToken: Buffer;
|
|
549
|
+
fencingToken: number;
|
|
550
|
+
version: number;
|
|
551
|
+
parentFlowId?: string;
|
|
552
|
+
rootFlowId?: string;
|
|
553
|
+
correlationId?: string;
|
|
554
|
+
valueRefs?: Record<string, unknown>;
|
|
555
|
+
values?: Record<string, unknown>;
|
|
556
|
+
valueSizes?: Record<string, unknown>;
|
|
557
|
+
valueOmitted?: Record<string, unknown>;
|
|
558
|
+
valueMissing?: Record<string, unknown>;
|
|
559
|
+
attributes?: Record<string, unknown>;
|
|
560
|
+
raw?: unknown;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
interface AutoBatchOptions {
|
|
564
|
+
enabled?: boolean;
|
|
565
|
+
maxCommands?: number;
|
|
566
|
+
maxDelayMs?: number;
|
|
567
|
+
mode?: "safe" | "all";
|
|
568
|
+
}
|
|
569
|
+
interface FerricStoreClientOptions {
|
|
570
|
+
autoBatch?: boolean | AutoBatchOptions;
|
|
571
|
+
codec?: Codec;
|
|
572
|
+
backpressure?: BackpressurePolicy;
|
|
573
|
+
}
|
|
574
|
+
interface CreateOptions {
|
|
575
|
+
type: string;
|
|
576
|
+
state?: string;
|
|
577
|
+
payload?: unknown;
|
|
578
|
+
partitionKey?: string;
|
|
579
|
+
parentFlowId?: string;
|
|
580
|
+
rootFlowId?: string;
|
|
581
|
+
correlationId?: string;
|
|
582
|
+
runAtMs?: number;
|
|
583
|
+
nowMs?: number;
|
|
584
|
+
priority?: number;
|
|
585
|
+
idempotent?: boolean;
|
|
586
|
+
retentionTtlMs?: number;
|
|
587
|
+
values?: Record<string, unknown>;
|
|
588
|
+
valueRefs?: Record<string, string>;
|
|
589
|
+
returnRecord?: boolean;
|
|
590
|
+
}
|
|
591
|
+
interface CreateManyOptions extends Omit<CreateOptions, "payload" | "partitionKey" | "returnRecord"> {
|
|
592
|
+
partitionKey?: string;
|
|
593
|
+
independent?: boolean;
|
|
594
|
+
}
|
|
595
|
+
interface ClaimDueOptions {
|
|
596
|
+
state?: string;
|
|
597
|
+
states?: string[];
|
|
598
|
+
worker: string;
|
|
599
|
+
partitionKey?: string;
|
|
600
|
+
partitionKeys?: string[];
|
|
601
|
+
leaseMs?: number;
|
|
602
|
+
limit?: number;
|
|
603
|
+
priority?: number;
|
|
604
|
+
nowMs?: number;
|
|
605
|
+
blockMs?: number;
|
|
606
|
+
reclaimExpired?: boolean;
|
|
607
|
+
reclaimRatio?: number;
|
|
608
|
+
jobOnly?: boolean;
|
|
609
|
+
payload?: boolean;
|
|
610
|
+
payloadMaxBytes?: number;
|
|
611
|
+
values?: string[];
|
|
612
|
+
valueMaxBytes?: number;
|
|
613
|
+
includeState?: boolean;
|
|
614
|
+
}
|
|
615
|
+
interface ReclaimOptions extends Omit<ClaimDueOptions, "state" | "states" | "blockMs" | "reclaimExpired" | "reclaimRatio" | "includeState"> {
|
|
616
|
+
state?: "running";
|
|
617
|
+
}
|
|
618
|
+
interface MutateOptions {
|
|
619
|
+
partitionKey?: string;
|
|
620
|
+
payload?: unknown;
|
|
621
|
+
values?: Record<string, unknown>;
|
|
622
|
+
valueRefs?: Record<string, string>;
|
|
623
|
+
dropValues?: string[];
|
|
624
|
+
overrideValues?: string[];
|
|
625
|
+
nowMs?: number;
|
|
626
|
+
returnRecord?: boolean;
|
|
627
|
+
}
|
|
628
|
+
interface LeaseMutationOptions extends MutateOptions {
|
|
629
|
+
leaseToken: Buffer;
|
|
630
|
+
fencingToken: number;
|
|
631
|
+
}
|
|
632
|
+
interface TransitionOptions extends LeaseMutationOptions {
|
|
633
|
+
fromState: string;
|
|
634
|
+
toState: string;
|
|
635
|
+
runAtMs?: number;
|
|
636
|
+
priority?: number;
|
|
637
|
+
}
|
|
638
|
+
interface CompleteOptions extends LeaseMutationOptions {
|
|
639
|
+
result?: unknown;
|
|
640
|
+
ttlMs?: number;
|
|
641
|
+
}
|
|
642
|
+
interface RetryOptions extends LeaseMutationOptions {
|
|
643
|
+
error?: unknown;
|
|
644
|
+
runAtMs?: number;
|
|
645
|
+
}
|
|
646
|
+
interface FailOptions extends LeaseMutationOptions {
|
|
647
|
+
error?: unknown;
|
|
648
|
+
ttlMs?: number;
|
|
649
|
+
}
|
|
650
|
+
interface CancelOptions {
|
|
651
|
+
fencingToken: number;
|
|
652
|
+
leaseToken?: Buffer;
|
|
653
|
+
partitionKey?: string;
|
|
654
|
+
reason?: unknown;
|
|
655
|
+
ttlMs?: number;
|
|
656
|
+
nowMs?: number;
|
|
657
|
+
returnRecord?: boolean;
|
|
658
|
+
}
|
|
659
|
+
interface ReadOptions {
|
|
660
|
+
partitionKey?: string;
|
|
661
|
+
count?: number;
|
|
662
|
+
fromMs?: number;
|
|
663
|
+
toMs?: number;
|
|
664
|
+
rev?: boolean;
|
|
665
|
+
state?: string;
|
|
666
|
+
terminalOnly?: boolean;
|
|
667
|
+
includeCold?: boolean;
|
|
668
|
+
consistentProjection?: boolean;
|
|
669
|
+
}
|
|
670
|
+
declare class FerricStoreClient {
|
|
671
|
+
readonly executor: CommandExecutor;
|
|
672
|
+
readonly codec: Codec;
|
|
673
|
+
readonly backpressure: Required<BackpressurePolicy>;
|
|
674
|
+
readonly bitmap: BitmapStore;
|
|
675
|
+
readonly bloom: BloomFilterStore;
|
|
676
|
+
readonly cms: CountMinSketchStore;
|
|
677
|
+
readonly cuckoo: CuckooFilterStore;
|
|
678
|
+
readonly geo: GeoStore;
|
|
679
|
+
readonly hash: HashStore;
|
|
680
|
+
readonly hyperloglog: HyperLogLogStore;
|
|
681
|
+
readonly json: JsonStore;
|
|
682
|
+
readonly kv: KeyValueStore;
|
|
683
|
+
readonly lists: ListStore;
|
|
684
|
+
readonly sets: SetStore;
|
|
685
|
+
readonly stream: StreamStore;
|
|
686
|
+
readonly tdigest: TDigestStore;
|
|
687
|
+
readonly topk: TopKStore;
|
|
688
|
+
readonly zset: SortedSetStore;
|
|
689
|
+
constructor(executor: CommandExecutor, options?: FerricStoreClientOptions);
|
|
690
|
+
static fromUrl(url: string, options?: FerricStoreClientOptions & {
|
|
691
|
+
nativeOptions?: NativeAdapterOptions;
|
|
692
|
+
}): Promise<FerricStoreClient>;
|
|
693
|
+
command(...args: CommandArgument[]): Promise<unknown>;
|
|
694
|
+
pipeline(commands: readonly Command[]): Promise<unknown[]>;
|
|
695
|
+
close(): Promise<void>;
|
|
696
|
+
ping(message?: CommandArgument): Promise<unknown>;
|
|
697
|
+
echo(message: CommandArgument): Promise<unknown>;
|
|
698
|
+
serverInfo(section?: string): Promise<string>;
|
|
699
|
+
configGet(pattern: string): Promise<unknown>;
|
|
700
|
+
configSet(key: string, value: CommandArgument, options?: {
|
|
701
|
+
local?: boolean;
|
|
702
|
+
}): Promise<boolean>;
|
|
703
|
+
configGetLocal(key: string): Promise<unknown>;
|
|
704
|
+
configResetStat(): Promise<boolean>;
|
|
705
|
+
configRewrite(): Promise<boolean>;
|
|
706
|
+
slowlogGet(count?: number): Promise<unknown[]>;
|
|
707
|
+
slowlogLen(): Promise<number>;
|
|
708
|
+
slowlogReset(): Promise<boolean>;
|
|
709
|
+
commandMetadata(): Promise<unknown>;
|
|
710
|
+
commandCount(): Promise<number>;
|
|
711
|
+
commandList(): Promise<unknown[]>;
|
|
712
|
+
commandInfo(...names: string[]): Promise<unknown[]>;
|
|
713
|
+
commandDocs(...names: string[]): Promise<unknown>;
|
|
714
|
+
commandGetKeys(command: Command): Promise<unknown[]>;
|
|
715
|
+
clientId(): Promise<number>;
|
|
716
|
+
clientSetName(name: string): Promise<boolean>;
|
|
717
|
+
clientGetName(): Promise<string | null>;
|
|
718
|
+
clientInfo(): Promise<string>;
|
|
719
|
+
clientList(options?: {
|
|
720
|
+
type?: string;
|
|
721
|
+
}): Promise<string>;
|
|
722
|
+
clientTracking(mode: "ON" | "OFF", options?: {
|
|
723
|
+
redirect?: number;
|
|
724
|
+
prefixes?: string[];
|
|
725
|
+
bcast?: boolean;
|
|
726
|
+
optin?: boolean;
|
|
727
|
+
optout?: boolean;
|
|
728
|
+
noloop?: boolean;
|
|
729
|
+
}): Promise<boolean>;
|
|
730
|
+
clientCaching(mode: "YES" | "NO"): Promise<boolean>;
|
|
731
|
+
clientTrackingInfo(): Promise<unknown>;
|
|
732
|
+
clientGetRedir(): Promise<number>;
|
|
733
|
+
save(): Promise<boolean>;
|
|
734
|
+
bgsave(): Promise<boolean>;
|
|
735
|
+
lastsave(): Promise<number>;
|
|
736
|
+
lolwut(version?: number): Promise<string>;
|
|
737
|
+
moduleList(): Promise<unknown[]>;
|
|
738
|
+
publish(channel: string, message: CommandArgument): Promise<number>;
|
|
739
|
+
pubsubChannels(pattern?: string): Promise<unknown[]>;
|
|
740
|
+
pubsubNumSub(...channels: string[]): Promise<unknown[]>;
|
|
741
|
+
pubsubNumPat(): Promise<number>;
|
|
742
|
+
aclSetUser(username: string, rules: string[]): Promise<boolean>;
|
|
743
|
+
aclDelUser(...usernames: string[]): Promise<number>;
|
|
744
|
+
aclGetUser(username: string): Promise<unknown>;
|
|
745
|
+
aclList(): Promise<unknown[]>;
|
|
746
|
+
aclWhoami(): Promise<string>;
|
|
747
|
+
aclSave(): Promise<boolean>;
|
|
748
|
+
aclLoad(): Promise<boolean>;
|
|
749
|
+
auth(password: string, username?: string): Promise<boolean>;
|
|
750
|
+
cas(key: string, expected: unknown, value: unknown, options?: {
|
|
751
|
+
ex?: number;
|
|
752
|
+
}): Promise<boolean>;
|
|
753
|
+
lock(key: string, owner: string, ttlMs: number): Promise<boolean>;
|
|
754
|
+
unlock(key: string, owner: string): Promise<number>;
|
|
755
|
+
extendLock(key: string, owner: string, ttlMs: number): Promise<number>;
|
|
756
|
+
rateLimitAdd(key: string, options: {
|
|
757
|
+
windowMs: number;
|
|
758
|
+
max: number;
|
|
759
|
+
count?: number;
|
|
760
|
+
}): Promise<RateLimitResult>;
|
|
761
|
+
keyInfo(key: string): Promise<KeyInfo>;
|
|
762
|
+
fetchOrCompute<T = unknown>(key: string, options: {
|
|
763
|
+
ttlMs: number;
|
|
764
|
+
hint?: string;
|
|
765
|
+
}): Promise<FetchOrComputeResult<T>>;
|
|
766
|
+
fetchOrComputeResult(key: string, value: unknown, options: {
|
|
767
|
+
ttlMs: number;
|
|
768
|
+
}): Promise<boolean>;
|
|
769
|
+
fetchOrComputeError(key: string, message: string): Promise<boolean>;
|
|
770
|
+
clusterHealth(): Promise<Record<string, unknown>>;
|
|
771
|
+
clusterStats(): Promise<Record<string, unknown>>;
|
|
772
|
+
clusterKeyslot(key: string): Promise<number>;
|
|
773
|
+
clusterSlots(): Promise<unknown>;
|
|
774
|
+
clusterStatus(): Promise<Record<string, unknown>>;
|
|
775
|
+
clusterRole(): Promise<unknown>;
|
|
776
|
+
clusterJoin(node: string, options?: {
|
|
777
|
+
replace?: boolean;
|
|
778
|
+
}): Promise<boolean>;
|
|
779
|
+
clusterLeave(): Promise<boolean>;
|
|
780
|
+
clusterFailover(shardIndex: number, targetNode: string): Promise<boolean>;
|
|
781
|
+
clusterPromote(node: string): Promise<boolean>;
|
|
782
|
+
clusterDemote(node: string): Promise<boolean>;
|
|
783
|
+
ferricstoreConfig(...args: CommandArgument[]): Promise<unknown>;
|
|
784
|
+
ferricstoreHotness(...args: CommandArgument[]): Promise<Record<string, unknown>>;
|
|
785
|
+
ferricstoreMetrics(...args: CommandArgument[]): Promise<Record<string, unknown>>;
|
|
786
|
+
ferricstoreBlobgc(...args: CommandArgument[]): Promise<unknown>;
|
|
787
|
+
ferricstoreDoctor(...args: CommandArgument[]): Promise<unknown>;
|
|
788
|
+
create(id: string, options: CreateOptions): Promise<FlowRecord | Buffer | unknown>;
|
|
789
|
+
enqueue(id: string, options: Omit<CreateOptions, "state"> & {
|
|
790
|
+
state?: string;
|
|
791
|
+
}): Promise<FlowRecord | Buffer | unknown>;
|
|
792
|
+
enqueueMany(items: CreateItem[], options: CreateManyOptions): Promise<unknown[] | unknown>;
|
|
793
|
+
createMany(partitionKey: string | undefined, items: CreateItem[], options: CreateManyOptions): Promise<unknown[] | unknown>;
|
|
794
|
+
valuePut(value: unknown, options?: {
|
|
795
|
+
partitionKey?: string;
|
|
796
|
+
ownerFlowId?: string;
|
|
797
|
+
name?: string;
|
|
798
|
+
override?: boolean;
|
|
799
|
+
ttlMs?: number;
|
|
800
|
+
nowMs?: number;
|
|
801
|
+
}): Promise<unknown>;
|
|
802
|
+
valueMGet(refs: string[], options?: {
|
|
803
|
+
maxBytes?: number;
|
|
804
|
+
}): Promise<unknown[]>;
|
|
805
|
+
signal(id: string, options: {
|
|
806
|
+
signal: string;
|
|
807
|
+
partitionKey?: string;
|
|
808
|
+
idempotencyKey?: string;
|
|
809
|
+
ifState?: string | string[];
|
|
810
|
+
transitionTo?: string;
|
|
811
|
+
runAtMs?: number;
|
|
812
|
+
nowMs?: number;
|
|
813
|
+
priority?: number;
|
|
814
|
+
values?: Record<string, unknown>;
|
|
815
|
+
valueRefs?: Record<string, string>;
|
|
816
|
+
dropValues?: string[];
|
|
817
|
+
overrideValues?: string[];
|
|
818
|
+
}): Promise<unknown>;
|
|
819
|
+
flowSignal(id: string, options: Parameters<FerricStoreClient["signal"]>[1]): Promise<unknown>;
|
|
820
|
+
claimDue(type: string, options: ClaimDueOptions): Promise<(FlowRecord | ClaimedItem)[]>;
|
|
821
|
+
claimJobs(type: string, options: Omit<ClaimDueOptions, "jobOnly">): Promise<ClaimedItem[]>;
|
|
822
|
+
reclaim(type: string, options: ReclaimOptions): Promise<(FlowRecord | ClaimedItem)[]>;
|
|
823
|
+
extendLease(id: string, options: {
|
|
824
|
+
leaseToken: Buffer;
|
|
825
|
+
fencingToken: number;
|
|
826
|
+
leaseMs: number;
|
|
827
|
+
partitionKey?: string;
|
|
828
|
+
nowMs?: number;
|
|
829
|
+
}): Promise<FlowRecord>;
|
|
830
|
+
transition(id: string, options: TransitionOptions): Promise<FlowRecord | Buffer | unknown>;
|
|
831
|
+
complete(id: string, options: CompleteOptions): Promise<FlowRecord | Buffer | unknown>;
|
|
832
|
+
completeMany(partitionKey: string | undefined, items: ClaimedItem[], options?: {
|
|
833
|
+
result?: unknown;
|
|
834
|
+
payload?: unknown;
|
|
835
|
+
values?: Record<string, unknown>;
|
|
836
|
+
valueRefs?: Record<string, string>;
|
|
837
|
+
dropValues?: string[];
|
|
838
|
+
overrideValues?: string[];
|
|
839
|
+
ttlMs?: number;
|
|
840
|
+
nowMs?: number;
|
|
841
|
+
independent?: boolean;
|
|
842
|
+
returnOkOnSuccess?: boolean;
|
|
843
|
+
}): Promise<unknown[] | unknown>;
|
|
844
|
+
completeJobs(jobs: ClaimedItem[], options?: Parameters<FerricStoreClient["completeMany"]>[2]): Promise<unknown[] | unknown>;
|
|
845
|
+
transitionMany(partitionKey: string | undefined, options: {
|
|
846
|
+
fromState: string;
|
|
847
|
+
toState: string;
|
|
848
|
+
items: FencedItem[];
|
|
849
|
+
payload?: unknown;
|
|
850
|
+
values?: Record<string, unknown>;
|
|
851
|
+
valueRefs?: Record<string, string>;
|
|
852
|
+
dropValues?: string[];
|
|
853
|
+
overrideValues?: string[];
|
|
854
|
+
runAtMs?: number;
|
|
855
|
+
nowMs?: number;
|
|
856
|
+
priority?: number;
|
|
857
|
+
independent?: boolean;
|
|
858
|
+
}): Promise<unknown[] | unknown>;
|
|
859
|
+
retry(id: string, options: RetryOptions): Promise<FlowRecord | Buffer | unknown>;
|
|
860
|
+
retryMany(partitionKey: string | undefined, items: ClaimedItem[], options?: {
|
|
861
|
+
error?: unknown;
|
|
862
|
+
payload?: unknown;
|
|
863
|
+
values?: Record<string, unknown>;
|
|
864
|
+
valueRefs?: Record<string, string>;
|
|
865
|
+
dropValues?: string[];
|
|
866
|
+
overrideValues?: string[];
|
|
867
|
+
runAtMs?: number;
|
|
868
|
+
nowMs?: number;
|
|
869
|
+
independent?: boolean;
|
|
870
|
+
}): Promise<unknown[] | unknown>;
|
|
871
|
+
fail(id: string, options: FailOptions): Promise<FlowRecord | Buffer | unknown>;
|
|
872
|
+
failMany(partitionKey: string | undefined, items: ClaimedItem[], options?: {
|
|
873
|
+
error?: unknown;
|
|
874
|
+
payload?: unknown;
|
|
875
|
+
values?: Record<string, unknown>;
|
|
876
|
+
valueRefs?: Record<string, string>;
|
|
877
|
+
dropValues?: string[];
|
|
878
|
+
overrideValues?: string[];
|
|
879
|
+
ttlMs?: number;
|
|
880
|
+
nowMs?: number;
|
|
881
|
+
independent?: boolean;
|
|
882
|
+
}): Promise<unknown[] | unknown>;
|
|
883
|
+
cancel(id: string, options: CancelOptions): Promise<FlowRecord | Buffer | unknown>;
|
|
884
|
+
cancelMany(partitionKey: string | undefined, items: FencedItem[], options?: {
|
|
885
|
+
reason?: unknown;
|
|
886
|
+
ttlMs?: number;
|
|
887
|
+
nowMs?: number;
|
|
888
|
+
independent?: boolean;
|
|
889
|
+
}): Promise<unknown[] | unknown>;
|
|
890
|
+
rewind(id: string, options?: {
|
|
891
|
+
partitionKey?: string;
|
|
892
|
+
toEvent?: string;
|
|
893
|
+
expectState?: string;
|
|
894
|
+
nowMs?: number;
|
|
895
|
+
returnRecord?: boolean;
|
|
896
|
+
}): Promise<FlowRecord | Buffer | unknown>;
|
|
897
|
+
get<TPayload = unknown>(id: string, options?: {
|
|
898
|
+
partitionKey?: string;
|
|
899
|
+
full?: boolean;
|
|
900
|
+
}): Promise<FlowRecord<TPayload> | undefined>;
|
|
901
|
+
list(type: string, options?: ReadOptions): Promise<FlowRecord[]>;
|
|
902
|
+
terminals(type: string, options?: ReadOptions): Promise<FlowRecord[]>;
|
|
903
|
+
failures(type: string, options?: ReadOptions): Promise<FlowRecord[]>;
|
|
904
|
+
byParent(parentFlowId: string, options?: ReadOptions): Promise<FlowRecord[]>;
|
|
905
|
+
byRoot(rootFlowId: string, options?: ReadOptions): Promise<FlowRecord[]>;
|
|
906
|
+
byCorrelation(correlationId: string, options?: ReadOptions): Promise<FlowRecord[]>;
|
|
907
|
+
info(type: string): Promise<Record<string, unknown>>;
|
|
908
|
+
stuck(type: string, options?: {
|
|
909
|
+
partitionKey?: string;
|
|
910
|
+
count?: number;
|
|
911
|
+
olderThanMs?: number;
|
|
912
|
+
nowMs?: number;
|
|
913
|
+
}): Promise<FlowRecord[]>;
|
|
914
|
+
history(id: string, options?: {
|
|
915
|
+
partitionKey?: string;
|
|
916
|
+
count?: number;
|
|
917
|
+
fromEvent?: string;
|
|
918
|
+
rev?: boolean;
|
|
919
|
+
}): Promise<unknown[]>;
|
|
920
|
+
spawnChildren(parentId: string, children: ChildSpec[], options?: {
|
|
921
|
+
groupId?: string;
|
|
922
|
+
partitionKey?: string;
|
|
923
|
+
leaseToken?: Buffer;
|
|
924
|
+
fencingToken?: number;
|
|
925
|
+
wait?: string;
|
|
926
|
+
waitState?: string;
|
|
927
|
+
success?: string;
|
|
928
|
+
failure?: string;
|
|
929
|
+
fromState?: string;
|
|
930
|
+
nowMs?: number;
|
|
931
|
+
onChildFailed?: string;
|
|
932
|
+
onParentClosed?: string;
|
|
933
|
+
values?: Record<string, unknown>;
|
|
934
|
+
valueRefs?: Record<string, string>;
|
|
935
|
+
}): Promise<unknown>;
|
|
936
|
+
installPolicy(type: string, options?: {
|
|
937
|
+
state?: string;
|
|
938
|
+
retry?: RetryPolicy;
|
|
939
|
+
retentionTtlMs?: number;
|
|
940
|
+
}): Promise<unknown>;
|
|
941
|
+
policyGet(type: string, options?: {
|
|
942
|
+
state?: string;
|
|
943
|
+
}): Promise<Record<string, unknown>>;
|
|
944
|
+
retentionCleanup(): Promise<Record<string, unknown>>;
|
|
945
|
+
private executeProducerWrite;
|
|
946
|
+
private recordOrGet;
|
|
947
|
+
private records;
|
|
948
|
+
private recordsOrResponse;
|
|
949
|
+
private indexQuery;
|
|
950
|
+
private appendPartitionOptions;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
declare class FerricStoreError extends Error {
|
|
954
|
+
readonly code: string;
|
|
955
|
+
readonly raw: unknown;
|
|
956
|
+
constructor(message: string, options?: {
|
|
957
|
+
raw?: unknown;
|
|
958
|
+
cause?: unknown;
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
declare class FlowNotFoundError extends FerricStoreError {
|
|
962
|
+
readonly code = "flow_not_found";
|
|
963
|
+
}
|
|
964
|
+
declare class FlowWrongStateError extends FerricStoreError {
|
|
965
|
+
readonly code = "flow_wrong_state";
|
|
966
|
+
}
|
|
967
|
+
declare class StaleLeaseError extends FerricStoreError {
|
|
968
|
+
readonly code = "stale_lease";
|
|
969
|
+
}
|
|
970
|
+
declare class FlowAlreadyExistsError extends FerricStoreError {
|
|
971
|
+
readonly code = "flow_already_exists";
|
|
972
|
+
}
|
|
973
|
+
declare class LockHeldError extends FerricStoreError {
|
|
974
|
+
readonly code = "lock_held";
|
|
975
|
+
}
|
|
976
|
+
declare class LockNotOwnedError extends FerricStoreError {
|
|
977
|
+
readonly code = "lock_not_owned";
|
|
978
|
+
}
|
|
979
|
+
declare class InvalidCommandError extends FerricStoreError {
|
|
980
|
+
readonly code = "invalid_command";
|
|
981
|
+
}
|
|
982
|
+
declare class OverloadedError extends FerricStoreError {
|
|
983
|
+
readonly code = "overloaded";
|
|
984
|
+
readonly retryAfterMs: number | undefined;
|
|
985
|
+
readonly reason: string | undefined;
|
|
986
|
+
constructor(message: string, options?: {
|
|
987
|
+
raw?: unknown;
|
|
988
|
+
cause?: unknown;
|
|
989
|
+
retryAfterMs?: number;
|
|
990
|
+
reason?: string;
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
declare function classifyServerError(message: string, raw?: unknown, cause?: unknown): FerricStoreError;
|
|
994
|
+
declare function mapException(error: unknown): unknown;
|
|
995
|
+
|
|
996
|
+
type Outcome = TransitionOutcome | CompleteOutcome | RetryOutcome | FailOutcome;
|
|
997
|
+
interface NamedValueMutation {
|
|
998
|
+
values?: Record<string, unknown>;
|
|
999
|
+
valueRefs?: Record<string, string>;
|
|
1000
|
+
dropValues?: string[];
|
|
1001
|
+
overrideValues?: string[];
|
|
1002
|
+
}
|
|
1003
|
+
interface TransitionOutcome extends NamedValueMutation {
|
|
1004
|
+
readonly kind: "transition";
|
|
1005
|
+
readonly toState: string;
|
|
1006
|
+
readonly payload?: unknown;
|
|
1007
|
+
readonly priority?: number;
|
|
1008
|
+
readonly runAtMs?: number;
|
|
1009
|
+
}
|
|
1010
|
+
interface CompleteOutcome extends NamedValueMutation {
|
|
1011
|
+
readonly kind: "complete";
|
|
1012
|
+
readonly payload?: unknown;
|
|
1013
|
+
readonly result?: unknown;
|
|
1014
|
+
readonly ttlMs?: number;
|
|
1015
|
+
}
|
|
1016
|
+
interface RetryOutcome extends NamedValueMutation {
|
|
1017
|
+
readonly kind: "retry";
|
|
1018
|
+
readonly error?: unknown;
|
|
1019
|
+
readonly payload?: unknown;
|
|
1020
|
+
readonly runAtMs?: number;
|
|
1021
|
+
}
|
|
1022
|
+
interface FailOutcome extends NamedValueMutation {
|
|
1023
|
+
readonly kind: "fail";
|
|
1024
|
+
readonly error?: unknown;
|
|
1025
|
+
readonly payload?: unknown;
|
|
1026
|
+
readonly ttlMs?: number;
|
|
1027
|
+
}
|
|
1028
|
+
declare function transition(toState: string, options?: Omit<TransitionOutcome, "kind" | "toState">): TransitionOutcome;
|
|
1029
|
+
declare function complete(options?: Omit<CompleteOutcome, "kind">): CompleteOutcome;
|
|
1030
|
+
declare function retry(options?: Omit<RetryOutcome, "kind">): RetryOutcome;
|
|
1031
|
+
declare function fail(options?: Omit<FailOutcome, "kind">): FailOutcome;
|
|
1032
|
+
|
|
1033
|
+
type QueueJob = FlowRecord | ClaimedItem;
|
|
1034
|
+
type QueueHandler = (job: QueueJob) => Promise<unknown> | unknown;
|
|
1035
|
+
type QueueBatchHandler = (jobs: QueueJob[]) => Promise<unknown> | unknown;
|
|
1036
|
+
interface QueueOptions {
|
|
1037
|
+
type: string;
|
|
1038
|
+
state?: string;
|
|
1039
|
+
worker?: string;
|
|
1040
|
+
}
|
|
1041
|
+
interface QueueWorkerResult {
|
|
1042
|
+
claimed: number;
|
|
1043
|
+
completed: number;
|
|
1044
|
+
retried: number;
|
|
1045
|
+
failed: number;
|
|
1046
|
+
}
|
|
1047
|
+
declare class QueueClient {
|
|
1048
|
+
readonly flow: FerricStoreClient;
|
|
1049
|
+
constructor(flow: FerricStoreClient);
|
|
1050
|
+
queue(options: QueueOptions | string): Queue;
|
|
1051
|
+
}
|
|
1052
|
+
declare class Queue {
|
|
1053
|
+
readonly client: FerricStoreClient;
|
|
1054
|
+
readonly type: string;
|
|
1055
|
+
readonly state: string;
|
|
1056
|
+
readonly defaultWorker: string;
|
|
1057
|
+
constructor(client: FerricStoreClient, options: QueueOptions);
|
|
1058
|
+
enqueue(id: string, options?: {
|
|
1059
|
+
payload?: unknown;
|
|
1060
|
+
partitionKey?: string;
|
|
1061
|
+
runAtMs?: number;
|
|
1062
|
+
nowMs?: number;
|
|
1063
|
+
priority?: number;
|
|
1064
|
+
idempotent?: boolean;
|
|
1065
|
+
retentionTtlMs?: number;
|
|
1066
|
+
values?: Record<string, unknown>;
|
|
1067
|
+
valueRefs?: Record<string, string>;
|
|
1068
|
+
returnRecord?: boolean;
|
|
1069
|
+
}): Promise<FlowRecord | Buffer | unknown>;
|
|
1070
|
+
enqueueMany(items: CreateItem[], options?: {
|
|
1071
|
+
partitionKey?: string;
|
|
1072
|
+
runAtMs?: number;
|
|
1073
|
+
nowMs?: number;
|
|
1074
|
+
priority?: number;
|
|
1075
|
+
idempotent?: boolean;
|
|
1076
|
+
independent?: boolean;
|
|
1077
|
+
retentionTtlMs?: number;
|
|
1078
|
+
values?: Record<string, unknown>;
|
|
1079
|
+
valueRefs?: Record<string, string>;
|
|
1080
|
+
}): Promise<unknown[] | unknown>;
|
|
1081
|
+
worker(options?: WorkerConfig): QueueWorker;
|
|
1082
|
+
}
|
|
1083
|
+
declare class QueueWorker {
|
|
1084
|
+
readonly queue: Queue;
|
|
1085
|
+
readonly options: WorkerConfig;
|
|
1086
|
+
private readonly pendingCompletions;
|
|
1087
|
+
constructor(queue: Queue, options: WorkerConfig);
|
|
1088
|
+
runOnce(handler: QueueHandler): Promise<QueueWorkerResult>;
|
|
1089
|
+
runBatchOnce(handler: QueueBatchHandler): Promise<QueueWorkerResult>;
|
|
1090
|
+
runBatchOnceForPartitionKeys(handler: QueueBatchHandler, partitionKeys: readonly string[], options?: {
|
|
1091
|
+
readonly claimCredit?: number;
|
|
1092
|
+
}): Promise<QueueWorkerResult>;
|
|
1093
|
+
flush(): Promise<number>;
|
|
1094
|
+
private runBatchOnceWithClaim;
|
|
1095
|
+
run(handler: QueueHandler): Promise<void>;
|
|
1096
|
+
private claimJobs;
|
|
1097
|
+
private applyJob;
|
|
1098
|
+
private flushCompletions;
|
|
1099
|
+
private enqueueCompletion;
|
|
1100
|
+
private drainPendingCompletions;
|
|
1101
|
+
private applyOutcome;
|
|
1102
|
+
private applyException;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
type WorkflowHandler = (ctx: WorkflowContext) => Promise<Outcome | void | unknown> | Outcome | void | unknown;
|
|
1106
|
+
interface StateOptions {
|
|
1107
|
+
leaseMs?: number;
|
|
1108
|
+
claimPayload?: boolean;
|
|
1109
|
+
claimRecord?: boolean;
|
|
1110
|
+
claimValues?: string[];
|
|
1111
|
+
valueMaxBytes?: number;
|
|
1112
|
+
exceptionPolicy?: ExceptionPolicy;
|
|
1113
|
+
retryPolicy?: RetryPolicy;
|
|
1114
|
+
returnRecord?: boolean;
|
|
1115
|
+
}
|
|
1116
|
+
interface WorkflowOptions {
|
|
1117
|
+
type: string;
|
|
1118
|
+
initialState?: string;
|
|
1119
|
+
valueConfig?: ValueConfig;
|
|
1120
|
+
worker?: string;
|
|
1121
|
+
}
|
|
1122
|
+
interface WorkflowWorkerResult {
|
|
1123
|
+
claimed: number;
|
|
1124
|
+
applied: number;
|
|
1125
|
+
claimCalls: number;
|
|
1126
|
+
emptyClaims: number;
|
|
1127
|
+
}
|
|
1128
|
+
interface StateRegistration {
|
|
1129
|
+
claimValues?: string[];
|
|
1130
|
+
claimPayload: boolean;
|
|
1131
|
+
claimRecord: boolean;
|
|
1132
|
+
exceptionPolicy: ExceptionPolicy;
|
|
1133
|
+
handler: WorkflowHandler;
|
|
1134
|
+
leaseMs: number;
|
|
1135
|
+
name: string;
|
|
1136
|
+
returnRecord: boolean;
|
|
1137
|
+
retryPolicy?: RetryPolicy;
|
|
1138
|
+
valueMaxBytes?: number;
|
|
1139
|
+
}
|
|
1140
|
+
declare class WorkflowClient {
|
|
1141
|
+
readonly flow: FerricStoreClient;
|
|
1142
|
+
constructor(flow: FerricStoreClient);
|
|
1143
|
+
workflow(options: WorkflowOptions): Workflow;
|
|
1144
|
+
}
|
|
1145
|
+
declare class Workflow {
|
|
1146
|
+
readonly client: FerricStoreClient;
|
|
1147
|
+
readonly type: string;
|
|
1148
|
+
readonly initialState: string;
|
|
1149
|
+
readonly valueConfig: ValueConfig & {
|
|
1150
|
+
localCache: boolean;
|
|
1151
|
+
};
|
|
1152
|
+
readonly defaultWorker: string;
|
|
1153
|
+
private readonly states;
|
|
1154
|
+
constructor(client: FerricStoreClient, options: WorkflowOptions);
|
|
1155
|
+
state(name: string, handler: WorkflowHandler, options?: StateOptions): this;
|
|
1156
|
+
start(id: string, options?: {
|
|
1157
|
+
payload?: unknown;
|
|
1158
|
+
state?: string;
|
|
1159
|
+
partitionKey?: string;
|
|
1160
|
+
parentFlowId?: string;
|
|
1161
|
+
rootFlowId?: string;
|
|
1162
|
+
correlationId?: string;
|
|
1163
|
+
runAtMs?: number;
|
|
1164
|
+
nowMs?: number;
|
|
1165
|
+
priority?: number;
|
|
1166
|
+
idempotent?: boolean;
|
|
1167
|
+
retentionTtlMs?: number;
|
|
1168
|
+
values?: Record<string, unknown>;
|
|
1169
|
+
valueRefs?: Record<string, string>;
|
|
1170
|
+
returnRecord?: boolean;
|
|
1171
|
+
}): Promise<FlowRecord | Buffer | unknown>;
|
|
1172
|
+
startMany(items: {
|
|
1173
|
+
id: string;
|
|
1174
|
+
payload?: unknown;
|
|
1175
|
+
partitionKey?: string;
|
|
1176
|
+
values?: Record<string, unknown>;
|
|
1177
|
+
valueRefs?: Record<string, string>;
|
|
1178
|
+
}[], options?: {
|
|
1179
|
+
state?: string;
|
|
1180
|
+
partitionKey?: string;
|
|
1181
|
+
runAtMs?: number;
|
|
1182
|
+
nowMs?: number;
|
|
1183
|
+
priority?: number;
|
|
1184
|
+
idempotent?: boolean;
|
|
1185
|
+
independent?: boolean;
|
|
1186
|
+
retentionTtlMs?: number;
|
|
1187
|
+
values?: Record<string, unknown>;
|
|
1188
|
+
valueRefs?: Record<string, string>;
|
|
1189
|
+
}): Promise<unknown[] | unknown>;
|
|
1190
|
+
signal(id: string, options: Parameters<FerricStoreClient["signal"]>[1]): Promise<unknown>;
|
|
1191
|
+
get(id: string, options?: Parameters<FerricStoreClient["get"]>[1]): Promise<FlowRecord | undefined>;
|
|
1192
|
+
history(id: string, options?: Parameters<FerricStoreClient["history"]>[1]): Promise<unknown[]>;
|
|
1193
|
+
worker(options?: WorkerConfig & {
|
|
1194
|
+
states?: string[];
|
|
1195
|
+
}): WorkflowWorker;
|
|
1196
|
+
stateNames(): string[];
|
|
1197
|
+
stateRegistration(name: string): StateRegistration | undefined;
|
|
1198
|
+
}
|
|
1199
|
+
declare class WorkflowContext {
|
|
1200
|
+
readonly workflow: Workflow;
|
|
1201
|
+
readonly job: FlowRecord | ClaimedItem;
|
|
1202
|
+
readonly stateName: string;
|
|
1203
|
+
readonly flow: WorkflowFlowCommands;
|
|
1204
|
+
private readonly valueCache;
|
|
1205
|
+
constructor(workflow: Workflow, job: FlowRecord | ClaimedItem, stateName: string);
|
|
1206
|
+
get client(): FerricStoreClient;
|
|
1207
|
+
get id(): string;
|
|
1208
|
+
get type(): string;
|
|
1209
|
+
get state(): string;
|
|
1210
|
+
get logicalState(): string;
|
|
1211
|
+
get partitionKey(): string | undefined;
|
|
1212
|
+
get payload(): unknown;
|
|
1213
|
+
get values(): Record<string, unknown>;
|
|
1214
|
+
get valueRefs(): Record<string, unknown>;
|
|
1215
|
+
get leaseToken(): Buffer;
|
|
1216
|
+
get fencingToken(): number;
|
|
1217
|
+
get version(): number;
|
|
1218
|
+
get parentFlowId(): string | undefined;
|
|
1219
|
+
get rootFlowId(): string | undefined;
|
|
1220
|
+
get correlationId(): string | undefined;
|
|
1221
|
+
value(name: string, defaultValue?: unknown, options?: {
|
|
1222
|
+
localCache?: boolean;
|
|
1223
|
+
}): Promise<unknown>;
|
|
1224
|
+
valueMany(names: string[], options?: {
|
|
1225
|
+
localCache?: boolean;
|
|
1226
|
+
}): Promise<Record<string, unknown>>;
|
|
1227
|
+
private valueMaxBytes;
|
|
1228
|
+
}
|
|
1229
|
+
declare class WorkflowFlowCommands {
|
|
1230
|
+
private readonly ctx;
|
|
1231
|
+
constructor(ctx: WorkflowContext);
|
|
1232
|
+
get(id?: string, options?: {
|
|
1233
|
+
partitionKey?: string;
|
|
1234
|
+
full?: boolean;
|
|
1235
|
+
}): Promise<FlowRecord | undefined>;
|
|
1236
|
+
history(id?: string, options?: Parameters<FerricStoreClient["history"]>[1]): Promise<unknown[]>;
|
|
1237
|
+
create(id: string, options?: Omit<Parameters<FerricStoreClient["create"]>[1], "type"> & {
|
|
1238
|
+
type?: string;
|
|
1239
|
+
}): Promise<FlowRecord | Buffer | unknown>;
|
|
1240
|
+
transition(toState: string, options?: Partial<Omit<Parameters<FerricStoreClient["transition"]>[1], "toState" | "fromState" | "leaseToken" | "fencingToken">> & {
|
|
1241
|
+
fromState?: string;
|
|
1242
|
+
}): Promise<FlowRecord | Buffer | unknown>;
|
|
1243
|
+
complete(options?: Partial<Omit<Parameters<FerricStoreClient["complete"]>[1], "leaseToken" | "fencingToken">>): Promise<FlowRecord | Buffer | unknown>;
|
|
1244
|
+
retry(options?: Partial<Omit<Parameters<FerricStoreClient["retry"]>[1], "leaseToken" | "fencingToken">>): Promise<FlowRecord | Buffer | unknown>;
|
|
1245
|
+
fail(options?: Partial<Omit<Parameters<FerricStoreClient["fail"]>[1], "leaseToken" | "fencingToken">>): Promise<FlowRecord | Buffer | unknown>;
|
|
1246
|
+
signal(signal: string, options?: Omit<Parameters<FerricStoreClient["signal"]>[1], "signal">): Promise<unknown>;
|
|
1247
|
+
putValue(name: string, value: unknown, options?: Parameters<FerricStoreClient["valuePut"]>[1]): Promise<unknown>;
|
|
1248
|
+
value(name: string, defaultValue?: unknown, options?: {
|
|
1249
|
+
localCache?: boolean;
|
|
1250
|
+
}): Promise<unknown>;
|
|
1251
|
+
values(names: string[], options?: {
|
|
1252
|
+
localCache?: boolean;
|
|
1253
|
+
}): Promise<Record<string, unknown>>;
|
|
1254
|
+
spawnChildren(children: ChildSpec[], options?: Parameters<FerricStoreClient["spawnChildren"]>[2]): Promise<unknown>;
|
|
1255
|
+
}
|
|
1256
|
+
declare class WorkflowWorker {
|
|
1257
|
+
readonly workflow: Workflow;
|
|
1258
|
+
readonly options: WorkerConfig & {
|
|
1259
|
+
states?: string[];
|
|
1260
|
+
};
|
|
1261
|
+
constructor(workflow: Workflow, options: WorkerConfig & {
|
|
1262
|
+
states?: string[];
|
|
1263
|
+
});
|
|
1264
|
+
runOnce(): Promise<WorkflowWorkerResult>;
|
|
1265
|
+
run(): Promise<void>;
|
|
1266
|
+
private applyJob;
|
|
1267
|
+
private applyHandlerError;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
export { type AutoBatchOptions, type BackoffKind, type BackpressurePolicy, BitmapStore, BloomFilterStore, type CancelOptions, type ChildSpec, type ClaimDueOptions, type ClaimedItem, type Codec, type Command, type CommandArgument, type CommandExecutor, type CompleteOptions, type CompleteOutcome, type CountMinMergeOptions, CountMinSketchStore, type CreateItem, type CreateManyOptions, type CreateOptions, CuckooFilterStore, type ExceptionPolicy, type ExecutePipelineOptions, type FailOptions, type FailOutcome, type FencedItem, FerricStoreClient, type FerricStoreClientOptions, FerricStoreError, type FetchOrComputeResult, FlowAlreadyExistsError, FlowNotFoundError, type FlowRecord, FlowWrongStateError, type GeoAddOptions, type GeoMember, GeoStore, type GetExOptions, HashStore, HyperLogLogStore, InvalidCommandError, JsonCodec, type JsonSetOptions, JsonStore, type KeyInfo, KeyValueStore, ListStore, LockHeldError, LockNotOwnedError, type MutateOptions, type NamedValueMutation, NativeAdapter, type NativeAdapterOptions, type Outcome, OverloadedError, Queue, type QueueBatchHandler, QueueClient, type QueueHandler, type QueueOptions, QueueWorker, type QueueWorkerResult, type RangeLimit, type RateLimitResult, RawCodec, type ReadOptions, type ReclaimOptions, type RetryOptions, type RetryOutcome, type RetryPolicy, type ScanOptions, type SetOptions, SetStore, SortedSetStore, StaleLeaseError, type StateOptions, type StateRegistration, type StoreCommandClient, StreamStore, type TDigestCreateOptions, type TDigestMergeOptions, TDigestStore, type TopKReserveOptions, TopKStore, type TransitionOptions, type TransitionOutcome, type ValueConfig, type WorkerConfig, type WorkerProfile, Workflow, WorkflowClient, WorkflowContext, WorkflowFlowCommands, type WorkflowHandler, type WorkflowOptions, WorkflowWorker, type WorkflowWorkerResult, type XReadStream, type ZAddMember, type ZAddOptions, classifyServerError, complete, fail, mapException, retry, transition };
|