lonnymq 0.0.19 → 0.0.21

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/dist/index.d.ts CHANGED
@@ -62,7 +62,7 @@ export declare class MessageCreateCommand {
62
62
  readonly createdAt: Date;
63
63
  constructor(params: {
64
64
  schema: string;
65
- channelName: string;
65
+ channelName?: string;
66
66
  content: Buffer;
67
67
  lockMs: number;
68
68
  delayMs?: number;
@@ -138,90 +138,7 @@ export declare class MessageDeferCommand {
138
138
  });
139
139
  execute(databaseClient: DatabaseClient): Promise<MessageDeferCommandResult>;
140
140
  }
141
- export type MessageHeartbeatCommandResultMessageNotFound = {
142
- resultType: "MESSAGE_NOT_FOUND";
143
- };
144
- export type MessageHeartbeatCommandResultStateInvalid = {
145
- resultType: "MESSAGE_STATE_INVALID";
146
- };
147
- export type MessageHeartbeatCommandResultMessageHeartbeated = {
148
- resultType: "MESSAGE_HEARTBEATED";
149
- };
150
- export type MessageHeartbeatCommandResult = MessageHeartbeatCommandResultMessageNotFound | MessageHeartbeatCommandResultStateInvalid | MessageHeartbeatCommandResultMessageHeartbeated;
151
- export declare class MessageHeartbeatCommand {
152
- private readonly schema;
153
- readonly id: string;
154
- readonly numAttempts: number;
155
- constructor(params: {
156
- schema: string;
157
- id: string;
158
- numAttempts: number;
159
- });
160
- execute(databaseClient: DatabaseClient): Promise<MessageHeartbeatCommandResult>;
161
- }
162
- export type QueueBatchChannelMessageCreateResult = {
163
- messageId: string;
164
- promise: Promise<void>;
165
- };
166
- export declare class QueueBatchChannelMessage {
167
- private readonly schema;
168
- private readonly channelName;
169
- private readonly registerFn;
170
- constructor(params: {
171
- schema: string;
172
- channelName: string;
173
- registerFn: BatchedCommandRegisterFn;
174
- });
175
- create(params: {
176
- name?: string;
177
- lockMs: number;
178
- content: Buffer;
179
- delayMs?: number;
180
- }): QueueBatchChannelMessageCreateResult;
181
- }
182
- export declare class QueueBatchChannelPolicy {
183
- private readonly schema;
184
- private readonly channelName;
185
- private readonly registerFn;
186
- constructor(params: {
187
- schema: string;
188
- channelName: string;
189
- registerFn: BatchedCommandRegisterFn;
190
- });
191
- set(params: {
192
- maxConcurrency?: number | null;
193
- releaseIntervalMs?: number | null;
194
- }): void;
195
- clear(): void;
196
- }
197
- export declare class QueueBatchChannel {
198
- readonly policy: QueueBatchChannelPolicy;
199
- readonly message: QueueBatchChannelMessage;
200
- constructor(params: {
201
- schema: string;
202
- registerFn: BatchedCommandRegisterFn;
203
- channelName: string;
204
- });
205
- }
206
- export type BatchedCommand = {
207
- sortKey: string;
208
- execute: (databaseClient: DatabaseClient) => Promise<void>;
209
- };
210
- export type BatchedCommandRegisterFn = (command: BatchedCommand) => void;
211
- export declare class QueueBatch<T> {
212
- private readonly commands;
213
- private readonly schema;
214
- private readonly adaptor;
215
- constructor(params: {
216
- schema: string;
217
- adaptor: DatabaseClientAdaptor<T>;
218
- });
219
- channel(channelName: string): QueueBatchChannel;
220
- execute(params: {
221
- databaseClient: T;
222
- }): Promise<void>;
223
- }
224
- export declare class QueueChannelMessage<T> {
141
+ export declare class QueueChannelMessageModule<T> {
225
142
  private readonly schema;
226
143
  private readonly channelName;
227
144
  private readonly adaptor;
@@ -232,13 +149,14 @@ export declare class QueueChannelMessage<T> {
232
149
  });
233
150
  create(params: {
234
151
  databaseClient: T;
235
- name?: string;
236
152
  lockMs: number;
237
153
  content: Buffer;
238
154
  delayMs?: number;
239
- }): Promise<void>;
155
+ }): Promise<{
156
+ messageId: string;
157
+ }>;
240
158
  }
241
- export declare class QueueChannelPolicy<T> {
159
+ export declare class QueueChannelPolicyModule<T> {
242
160
  private readonly schema;
243
161
  private readonly adaptor;
244
162
  private readonly channelName;
@@ -256,9 +174,9 @@ export declare class QueueChannelPolicy<T> {
256
174
  databaseClient: T;
257
175
  }): Promise<void>;
258
176
  }
259
- export declare class QueueChannel<T> {
260
- readonly policy: QueueChannelPolicy<T>;
261
- readonly message: QueueChannelMessage<T>;
177
+ export declare class QueueChannelModule<T> {
178
+ readonly policy: QueueChannelPolicyModule<T>;
179
+ readonly message: QueueChannelMessageModule<T>;
262
180
  constructor(params: {
263
181
  schema: string;
264
182
  adaptor: DatabaseClientAdaptor<T>;
@@ -292,9 +210,23 @@ export declare class QueueMessage<T> {
292
210
  delete(params: {
293
211
  databaseClient: T;
294
212
  }): Promise<MessageDeleteCommandResult>;
295
- heartbeat(params: {
213
+ }
214
+ export declare class QueueMessageModule<T> {
215
+ private readonly schema;
216
+ private readonly adaptor;
217
+ constructor(params: {
218
+ schema: string;
219
+ adaptor: DatabaseClientAdaptor<T>;
220
+ });
221
+ create(params: {
296
222
  databaseClient: T;
297
- }): Promise<MessageHeartbeatCommandResult>;
223
+ lockMs: number;
224
+ content: Buffer;
225
+ delayMs?: number;
226
+ }): Promise<{
227
+ messageId: string;
228
+ channelName: string;
229
+ }>;
298
230
  }
299
231
  export type MessageDequeueResult<T> = {
300
232
  resultType: "MESSAGE_NOT_AVAILABLE";
@@ -313,12 +245,12 @@ export type QueueParams<T> = T extends DatabaseClient ? {
313
245
  export declare class Queue<T = DatabaseClient> {
314
246
  private readonly schema;
315
247
  private readonly adaptor;
248
+ readonly message: QueueMessageModule<T>;
316
249
  constructor(params: QueueParams<T>);
317
250
  dequeue(params: {
318
251
  databaseClient: T;
319
252
  }): Promise<MessageDequeueResult<T>>;
320
- channel(channelName: string): QueueChannel<T>;
321
- batch(): QueueBatch<T>;
253
+ channel(channelName: string): QueueChannelModule<T>;
322
254
  migrations(params?: {
323
255
  eventChannel?: string;
324
256
  }): string[];