lonnymq 0.0.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.
@@ -0,0 +1,304 @@
1
+ // Generated by dts-bundle-generator v9.5.1
2
+
3
+ export type DeferredGetResult<T> = {
4
+ resultType: "RESULT_NOT_SET";
5
+ } | {
6
+ resultType: "RESULT_SET";
7
+ value: T;
8
+ };
9
+ export declare class Deferred<T> {
10
+ private value;
11
+ private isSet;
12
+ constructor();
13
+ get(): DeferredGetResult<T>;
14
+ set(value: T): void;
15
+ }
16
+ export type DatabaseClientQueryResult = {
17
+ rows: Array<Record<string, unknown>>;
18
+ };
19
+ export interface DatabaseClient {
20
+ query(query: string): Promise<DatabaseClientQueryResult>;
21
+ }
22
+ export declare class ChannelPolicyClearCommand {
23
+ readonly schema: string;
24
+ readonly channelName: string;
25
+ readonly createdAt: Date;
26
+ constructor(params: {
27
+ schema: string;
28
+ channelName: string;
29
+ });
30
+ sortKeyGet(): string;
31
+ execute(databaseClient: DatabaseClient): Promise<void>;
32
+ }
33
+ export declare class ChannelPolicySetCommand {
34
+ readonly schema: string;
35
+ readonly channelName: string;
36
+ readonly maxSize: number | null;
37
+ readonly maxConcurrency: number | null;
38
+ readonly createdAt: Date;
39
+ constructor(params: {
40
+ schema: string;
41
+ channelName: string;
42
+ maxSize: number | null;
43
+ maxConcurrency: number | null;
44
+ });
45
+ sortKeyGet(): string;
46
+ execute(databaseClient: DatabaseClient): Promise<void>;
47
+ }
48
+ export type MessageCreateCommandResultMessageCreated = {
49
+ resultType: "MESSAGE_CREATED";
50
+ id: string;
51
+ };
52
+ export type MessageCreateCommandResultMessageDeduplicated = {
53
+ resultType: "MESSAGE_DEDUPLICATED";
54
+ id: string;
55
+ };
56
+ export type MessageCreateCommandResultMessageDropped = {
57
+ resultType: "MESSAGE_DROPPED";
58
+ };
59
+ export type MessageCreateCommandResult = MessageCreateCommandResultMessageCreated | MessageCreateCommandResultMessageDeduplicated | MessageCreateCommandResultMessageDropped;
60
+ export declare class MessageCreateCommand {
61
+ readonly schema: string;
62
+ readonly channelName: string;
63
+ readonly name: string | null;
64
+ readonly content: string;
65
+ readonly lockMs: number;
66
+ readonly delayMs: number;
67
+ readonly createdAt: Date;
68
+ constructor(params: {
69
+ schema: string;
70
+ channelName: string;
71
+ name?: string;
72
+ content: string;
73
+ lockMs?: number;
74
+ delayMs?: number;
75
+ priority?: boolean;
76
+ });
77
+ execute(databaseClient: DatabaseClient): Promise<MessageCreateCommandResult>;
78
+ }
79
+ export type MessageDequeueCommandResultMessageDequeued = {
80
+ resultType: "MESSAGE_DEQUEUED";
81
+ message: {
82
+ id: string;
83
+ channelName: string;
84
+ name: string | null;
85
+ content: string;
86
+ dequeueId: string;
87
+ state: string | null;
88
+ numAttempts: number;
89
+ lockMs: number;
90
+ };
91
+ };
92
+ export type MessageDequeueCommandResultMessageNotAvailable = {
93
+ resultType: "MESSAGE_NOT_AVAILABLE";
94
+ retryMs: number | null;
95
+ };
96
+ export type MessageDequeueCommandResult = MessageDequeueCommandResultMessageDequeued | MessageDequeueCommandResultMessageNotAvailable;
97
+ export declare class MessageDequeueCommand {
98
+ readonly schema: string;
99
+ constructor(params: {
100
+ schema: string;
101
+ });
102
+ execute(databaseClient: DatabaseClient): Promise<MessageDequeueCommandResult>;
103
+ }
104
+ export type MessageDeleteCommandResultMessageNotFound = {
105
+ resultType: "MESSAGE_NOT_FOUND";
106
+ };
107
+ export type MessageDeleteCommandResultStateInvalid = {
108
+ resultType: "STATE_INVALID";
109
+ };
110
+ export type MessageDeleteCommandResultMessageDeleted = {
111
+ resultType: "MESSAGE_DELETED";
112
+ };
113
+ export type MessageDeleteCommandResult = MessageDeleteCommandResultMessageNotFound | MessageDeleteCommandResultStateInvalid | MessageDeleteCommandResultMessageDeleted;
114
+ export declare class MessageDeleteCommand {
115
+ readonly schema: string;
116
+ readonly id: string;
117
+ readonly dequeueId: string;
118
+ constructor(params: {
119
+ schema: string;
120
+ id: string;
121
+ dequeueId: string;
122
+ });
123
+ execute(databaseClient: DatabaseClient): Promise<MessageDeleteCommandResult>;
124
+ }
125
+ export type MessageDeferCommandResultMessageNotFound = {
126
+ resultType: "MESSAGE_NOT_FOUND";
127
+ };
128
+ export type MessageDeferCommandResultStateInvalid = {
129
+ resultType: "STATE_INVALID";
130
+ };
131
+ export type MessageDeferCommandResultMessageDeferred = {
132
+ resultType: "MESSAGE_DEFERRED";
133
+ };
134
+ export type MessageDeferCommandResult = MessageDeferCommandResultMessageNotFound | MessageDeferCommandResultStateInvalid | MessageDeferCommandResultMessageDeferred;
135
+ export declare class MessageDeferCommand {
136
+ readonly schema: string;
137
+ readonly id: string;
138
+ readonly dequeueId: string;
139
+ readonly delayMs: number;
140
+ readonly state: string | null;
141
+ constructor(params: {
142
+ schema: string;
143
+ id: string;
144
+ dequeueId: string;
145
+ delayMs?: number;
146
+ state?: string | null;
147
+ priority?: boolean;
148
+ });
149
+ execute(databaseClient: DatabaseClient): Promise<MessageDeferCommandResult>;
150
+ }
151
+ export declare class QueueBatchChannelMessage {
152
+ private readonly schema;
153
+ private readonly channelName;
154
+ private readonly registerFn;
155
+ constructor(params: {
156
+ schema: string;
157
+ channelName: string;
158
+ registerFn: BatchedCommandRegisterFn;
159
+ });
160
+ create(params: {
161
+ name?: string;
162
+ lockMs?: number;
163
+ content: string;
164
+ delayMs?: number;
165
+ priority?: boolean;
166
+ }): Deferred<MessageCreateCommandResult>;
167
+ }
168
+ export declare class QueueBatchChannelPolicy {
169
+ private readonly schema;
170
+ private readonly channelName;
171
+ private readonly registerFn;
172
+ constructor(params: {
173
+ schema: string;
174
+ channelName: string;
175
+ registerFn: BatchedCommandRegisterFn;
176
+ });
177
+ set(params: {
178
+ maxConcurrency: number | null;
179
+ maxSize: number | null;
180
+ }): Deferred<void>;
181
+ clear(): Deferred<void>;
182
+ }
183
+ export declare class QueueBatchChannel {
184
+ readonly policy: QueueBatchChannelPolicy;
185
+ readonly message: QueueBatchChannelMessage;
186
+ constructor(params: {
187
+ schema: string;
188
+ registerFn: BatchedCommandRegisterFn;
189
+ channelName: string;
190
+ });
191
+ }
192
+ export type BatchedCommand = {
193
+ sortKey: string;
194
+ execute: (databaseClient: DatabaseClient) => Promise<void>;
195
+ };
196
+ export type BatchedCommandRegisterFn = (command: BatchedCommand) => void;
197
+ export declare class QueueBatch {
198
+ private readonly commands;
199
+ private readonly schema;
200
+ constructor(params: {
201
+ schema: string;
202
+ });
203
+ channel(channelName: string): QueueBatchChannel;
204
+ execute(params: {
205
+ databaseClient: DatabaseClient;
206
+ }): Promise<void>;
207
+ }
208
+ export declare class QueueChannelMessage {
209
+ private readonly schema;
210
+ private readonly channelName;
211
+ constructor(params: {
212
+ schema: string;
213
+ channelName: string;
214
+ });
215
+ create(params: {
216
+ databaseClient: DatabaseClient;
217
+ name?: string;
218
+ lockMs?: number;
219
+ content: string;
220
+ delayMs?: number;
221
+ priority?: boolean;
222
+ }): Promise<MessageCreateCommandResult>;
223
+ }
224
+ export declare class QueueChannelPolicy {
225
+ private readonly schema;
226
+ private readonly channelName;
227
+ constructor(params: {
228
+ schema: string;
229
+ channelName: string;
230
+ });
231
+ set(params: {
232
+ databaseClient: DatabaseClient;
233
+ maxConcurrency: number | null;
234
+ maxSize: number | null;
235
+ }): Promise<void>;
236
+ clear(params: {
237
+ databaseClient: DatabaseClient;
238
+ }): Promise<void>;
239
+ }
240
+ export declare class QueueChannel {
241
+ readonly policy: QueueChannelPolicy;
242
+ readonly message: QueueChannelMessage;
243
+ constructor(params: {
244
+ schema: string;
245
+ channelName: string;
246
+ });
247
+ }
248
+ export declare class QueueMessage {
249
+ private readonly schema;
250
+ readonly id: string;
251
+ readonly channelName: string;
252
+ readonly name: string | null;
253
+ readonly content: string;
254
+ readonly dequeueId: string;
255
+ readonly state: string | null;
256
+ readonly numAttempts: number;
257
+ readonly lockMs: number;
258
+ constructor(params: {
259
+ schema: string;
260
+ id: string;
261
+ dequeueId: string;
262
+ channelName: string;
263
+ name: string | null;
264
+ content: string;
265
+ state: string | null;
266
+ numAttempts: number;
267
+ lockMs: number;
268
+ });
269
+ defer(params: {
270
+ databaseClient: DatabaseClient;
271
+ delayMs?: number;
272
+ priority?: boolean;
273
+ state?: string;
274
+ }): Promise<MessageDeferCommandResult>;
275
+ delete(params: {
276
+ databaseClient: DatabaseClient;
277
+ }): Promise<MessageDeleteCommandResult>;
278
+ }
279
+ export type QueueMigration = {
280
+ name: string;
281
+ sql: string[];
282
+ };
283
+ export type MessageDequeueResult = {
284
+ resultType: "MESSAGE_NOT_AVAILABLE";
285
+ retryMs: number | null;
286
+ } | {
287
+ resultType: "MESSAGE_DEQUEUED";
288
+ message: QueueMessage;
289
+ };
290
+ export declare class Queue {
291
+ private readonly schema;
292
+ constructor(schema: string);
293
+ dequeue(params: {
294
+ databaseClient: DatabaseClient;
295
+ }): Promise<MessageDequeueResult>;
296
+ channel(channelName: string): QueueChannel;
297
+ batch(): QueueBatch;
298
+ migrations(params: {
299
+ useWake?: boolean;
300
+ }): QueueMigration[];
301
+ wakeChannel(): string;
302
+ }
303
+
304
+ export {};