runlater-js 0.12.0 → 0.13.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/dist/index.d.mts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +14 -5
- package/dist/index.mjs +14 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -359,6 +359,7 @@ interface MqMessage {
|
|
|
359
359
|
id: string;
|
|
360
360
|
body: unknown;
|
|
361
361
|
status: string;
|
|
362
|
+
run_at: string | null;
|
|
362
363
|
receipt_handle: string | null;
|
|
363
364
|
receive_count: number;
|
|
364
365
|
locked_until: string | null;
|
|
@@ -366,6 +367,12 @@ interface MqMessage {
|
|
|
366
367
|
completed_at: string | null;
|
|
367
368
|
inserted_at: string;
|
|
368
369
|
}
|
|
370
|
+
interface MqEnqueueOptions {
|
|
371
|
+
/** Delay before the message becomes available. Supports "30s", "5m", "2h", "1d" or seconds as number. Max 7 days. Mutually exclusive with run_at. */
|
|
372
|
+
delay?: string | number;
|
|
373
|
+
/** ISO 8601 datetime when the message becomes available. Must be future, max 7 days. Mutually exclusive with delay. */
|
|
374
|
+
run_at?: string;
|
|
375
|
+
}
|
|
369
376
|
interface MqStats {
|
|
370
377
|
available: number;
|
|
371
378
|
locked: number;
|
|
@@ -564,10 +571,12 @@ declare class MessageQueues {
|
|
|
564
571
|
delete(slug: string): Promise<void>;
|
|
565
572
|
/** Get queue statistics. */
|
|
566
573
|
stats(slug: string): Promise<MqStats>;
|
|
567
|
-
/** Enqueue a single message. */
|
|
568
|
-
enqueue(slug: string, body: unknown): Promise<MqMessage>;
|
|
569
|
-
/** Enqueue multiple messages at once. */
|
|
570
|
-
enqueueBatch(slug: string, messages:
|
|
574
|
+
/** Enqueue a single message. Optionally delay or schedule for a future time. */
|
|
575
|
+
enqueue(slug: string, body: unknown, options?: MqEnqueueOptions): Promise<MqMessage>;
|
|
576
|
+
/** Enqueue multiple messages at once. Each message can have its own delay/run_at. */
|
|
577
|
+
enqueueBatch(slug: string, messages: Array<{
|
|
578
|
+
body: unknown;
|
|
579
|
+
} & MqEnqueueOptions>): Promise<{
|
|
571
580
|
enqueued: number;
|
|
572
581
|
}>;
|
|
573
582
|
/** Receive messages from the queue. */
|
|
@@ -588,4 +597,4 @@ declare class MessageQueues {
|
|
|
588
597
|
resume(slug: string): Promise<MessageQueue>;
|
|
589
598
|
}
|
|
590
599
|
|
|
591
|
-
export { type BatchOptions, type BatchResponse, type BatchTask, type CancelLaneResponse, type CreateEndpointOptions, type CreateMessageQueueOptions, type CreateMonitorOptions, type CreateScheduleOptions, type CronOptions, type CronResponse, type DelayOptions, type Endpoint, type Execution, type InboundEvent, type ListOptions, type ListResponse, type MessageQueue, type Monitor, type MqBatchAckResponse, type MqListMessagesOptions, type MqMessage, type MqReceiveOptions, type MqStats, type Ping, type PingResponse, Runlater, RunlaterError, type RunlaterOptions, type Schedule, type ScheduleOptions, type SendOptions, type SyncOptions, type SyncResponse, type Task, type TaskResponse, type TriggerResponse, type UpdateEndpointOptions, type UpdateMessageQueueOptions, type UpdateMonitorOptions, type UpdateScheduleOptions, type UpdateTaskOptions };
|
|
600
|
+
export { type BatchOptions, type BatchResponse, type BatchTask, type CancelLaneResponse, type CreateEndpointOptions, type CreateMessageQueueOptions, type CreateMonitorOptions, type CreateScheduleOptions, type CronOptions, type CronResponse, type DelayOptions, type Endpoint, type Execution, type InboundEvent, type ListOptions, type ListResponse, type MessageQueue, type Monitor, type MqBatchAckResponse, type MqEnqueueOptions, type MqListMessagesOptions, type MqMessage, type MqReceiveOptions, type MqStats, type Ping, type PingResponse, Runlater, RunlaterError, type RunlaterOptions, type Schedule, type ScheduleOptions, type SendOptions, type SyncOptions, type SyncResponse, type Task, type TaskResponse, type TriggerResponse, type UpdateEndpointOptions, type UpdateMessageQueueOptions, type UpdateMonitorOptions, type UpdateScheduleOptions, type UpdateTaskOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -359,6 +359,7 @@ interface MqMessage {
|
|
|
359
359
|
id: string;
|
|
360
360
|
body: unknown;
|
|
361
361
|
status: string;
|
|
362
|
+
run_at: string | null;
|
|
362
363
|
receipt_handle: string | null;
|
|
363
364
|
receive_count: number;
|
|
364
365
|
locked_until: string | null;
|
|
@@ -366,6 +367,12 @@ interface MqMessage {
|
|
|
366
367
|
completed_at: string | null;
|
|
367
368
|
inserted_at: string;
|
|
368
369
|
}
|
|
370
|
+
interface MqEnqueueOptions {
|
|
371
|
+
/** Delay before the message becomes available. Supports "30s", "5m", "2h", "1d" or seconds as number. Max 7 days. Mutually exclusive with run_at. */
|
|
372
|
+
delay?: string | number;
|
|
373
|
+
/** ISO 8601 datetime when the message becomes available. Must be future, max 7 days. Mutually exclusive with delay. */
|
|
374
|
+
run_at?: string;
|
|
375
|
+
}
|
|
369
376
|
interface MqStats {
|
|
370
377
|
available: number;
|
|
371
378
|
locked: number;
|
|
@@ -564,10 +571,12 @@ declare class MessageQueues {
|
|
|
564
571
|
delete(slug: string): Promise<void>;
|
|
565
572
|
/** Get queue statistics. */
|
|
566
573
|
stats(slug: string): Promise<MqStats>;
|
|
567
|
-
/** Enqueue a single message. */
|
|
568
|
-
enqueue(slug: string, body: unknown): Promise<MqMessage>;
|
|
569
|
-
/** Enqueue multiple messages at once. */
|
|
570
|
-
enqueueBatch(slug: string, messages:
|
|
574
|
+
/** Enqueue a single message. Optionally delay or schedule for a future time. */
|
|
575
|
+
enqueue(slug: string, body: unknown, options?: MqEnqueueOptions): Promise<MqMessage>;
|
|
576
|
+
/** Enqueue multiple messages at once. Each message can have its own delay/run_at. */
|
|
577
|
+
enqueueBatch(slug: string, messages: Array<{
|
|
578
|
+
body: unknown;
|
|
579
|
+
} & MqEnqueueOptions>): Promise<{
|
|
571
580
|
enqueued: number;
|
|
572
581
|
}>;
|
|
573
582
|
/** Receive messages from the queue. */
|
|
@@ -588,4 +597,4 @@ declare class MessageQueues {
|
|
|
588
597
|
resume(slug: string): Promise<MessageQueue>;
|
|
589
598
|
}
|
|
590
599
|
|
|
591
|
-
export { type BatchOptions, type BatchResponse, type BatchTask, type CancelLaneResponse, type CreateEndpointOptions, type CreateMessageQueueOptions, type CreateMonitorOptions, type CreateScheduleOptions, type CronOptions, type CronResponse, type DelayOptions, type Endpoint, type Execution, type InboundEvent, type ListOptions, type ListResponse, type MessageQueue, type Monitor, type MqBatchAckResponse, type MqListMessagesOptions, type MqMessage, type MqReceiveOptions, type MqStats, type Ping, type PingResponse, Runlater, RunlaterError, type RunlaterOptions, type Schedule, type ScheduleOptions, type SendOptions, type SyncOptions, type SyncResponse, type Task, type TaskResponse, type TriggerResponse, type UpdateEndpointOptions, type UpdateMessageQueueOptions, type UpdateMonitorOptions, type UpdateScheduleOptions, type UpdateTaskOptions };
|
|
600
|
+
export { type BatchOptions, type BatchResponse, type BatchTask, type CancelLaneResponse, type CreateEndpointOptions, type CreateMessageQueueOptions, type CreateMonitorOptions, type CreateScheduleOptions, type CronOptions, type CronResponse, type DelayOptions, type Endpoint, type Execution, type InboundEvent, type ListOptions, type ListResponse, type MessageQueue, type Monitor, type MqBatchAckResponse, type MqEnqueueOptions, type MqListMessagesOptions, type MqMessage, type MqReceiveOptions, type MqStats, type Ping, type PingResponse, Runlater, RunlaterError, type RunlaterOptions, type Schedule, type ScheduleOptions, type SendOptions, type SyncOptions, type SyncResponse, type Task, type TaskResponse, type TriggerResponse, type UpdateEndpointOptions, type UpdateMessageQueueOptions, type UpdateMonitorOptions, type UpdateScheduleOptions, type UpdateTaskOptions };
|
package/dist/index.js
CHANGED
|
@@ -543,19 +543,28 @@ var MessageQueues = class {
|
|
|
543
543
|
const res = await this.client.request("GET", `/mq/${slug}/stats`);
|
|
544
544
|
return res.data;
|
|
545
545
|
}
|
|
546
|
-
/** Enqueue a single message. */
|
|
547
|
-
async enqueue(slug, body) {
|
|
546
|
+
/** Enqueue a single message. Optionally delay or schedule for a future time. */
|
|
547
|
+
async enqueue(slug, body, options) {
|
|
548
|
+
const payload = { body };
|
|
549
|
+
if (options?.delay != null) payload.delay = formatDelay(options.delay);
|
|
550
|
+
if (options?.run_at != null) payload.run_at = options.run_at;
|
|
548
551
|
const res = await this.client.request("POST", `/mq/${slug}/messages`, {
|
|
549
|
-
body:
|
|
552
|
+
body: payload
|
|
550
553
|
});
|
|
551
554
|
return res.data;
|
|
552
555
|
}
|
|
553
|
-
/** Enqueue multiple messages at once. */
|
|
556
|
+
/** Enqueue multiple messages at once. Each message can have its own delay/run_at. */
|
|
554
557
|
async enqueueBatch(slug, messages) {
|
|
558
|
+
const formatted = messages.map((m) => {
|
|
559
|
+
const msg = { body: m.body };
|
|
560
|
+
if (m.delay != null) msg.delay = formatDelay(m.delay);
|
|
561
|
+
if (m.run_at != null) msg.run_at = m.run_at;
|
|
562
|
+
return msg;
|
|
563
|
+
});
|
|
555
564
|
const res = await this.client.request(
|
|
556
565
|
"POST",
|
|
557
566
|
`/mq/${slug}/messages/batch`,
|
|
558
|
-
{ body: { messages } }
|
|
567
|
+
{ body: { messages: formatted } }
|
|
559
568
|
);
|
|
560
569
|
return res.data;
|
|
561
570
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -516,19 +516,28 @@ var MessageQueues = class {
|
|
|
516
516
|
const res = await this.client.request("GET", `/mq/${slug}/stats`);
|
|
517
517
|
return res.data;
|
|
518
518
|
}
|
|
519
|
-
/** Enqueue a single message. */
|
|
520
|
-
async enqueue(slug, body) {
|
|
519
|
+
/** Enqueue a single message. Optionally delay or schedule for a future time. */
|
|
520
|
+
async enqueue(slug, body, options) {
|
|
521
|
+
const payload = { body };
|
|
522
|
+
if (options?.delay != null) payload.delay = formatDelay(options.delay);
|
|
523
|
+
if (options?.run_at != null) payload.run_at = options.run_at;
|
|
521
524
|
const res = await this.client.request("POST", `/mq/${slug}/messages`, {
|
|
522
|
-
body:
|
|
525
|
+
body: payload
|
|
523
526
|
});
|
|
524
527
|
return res.data;
|
|
525
528
|
}
|
|
526
|
-
/** Enqueue multiple messages at once. */
|
|
529
|
+
/** Enqueue multiple messages at once. Each message can have its own delay/run_at. */
|
|
527
530
|
async enqueueBatch(slug, messages) {
|
|
531
|
+
const formatted = messages.map((m) => {
|
|
532
|
+
const msg = { body: m.body };
|
|
533
|
+
if (m.delay != null) msg.delay = formatDelay(m.delay);
|
|
534
|
+
if (m.run_at != null) msg.run_at = m.run_at;
|
|
535
|
+
return msg;
|
|
536
|
+
});
|
|
528
537
|
const res = await this.client.request(
|
|
529
538
|
"POST",
|
|
530
539
|
`/mq/${slug}/messages/batch`,
|
|
531
|
-
{ body: { messages } }
|
|
540
|
+
{ body: { messages: formatted } }
|
|
532
541
|
);
|
|
533
542
|
return res.data;
|
|
534
543
|
}
|
package/package.json
CHANGED