runlater-js 0.6.0 → 0.8.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 CHANGED
@@ -14,6 +14,8 @@ interface SendOptions {
14
14
  on_failure_url?: string;
15
15
  on_recovery_url?: string;
16
16
  script?: string;
17
+ debounce?: string | number;
18
+ debounceKey?: string;
17
19
  }
18
20
  interface DelayOptions extends SendOptions {
19
21
  delay: string | number;
@@ -41,6 +43,7 @@ interface TaskResponse {
41
43
  execution_id: string;
42
44
  status: string;
43
45
  scheduled_for: string;
46
+ debounce_key?: string;
44
47
  }
45
48
  interface CronResponse {
46
49
  id: string;
@@ -222,6 +225,7 @@ interface Endpoint {
222
225
  inbound_url: string;
223
226
  forward_urls: string[];
224
227
  enabled: boolean;
228
+ paused: boolean;
225
229
  retry_attempts: number;
226
230
  use_queue: boolean;
227
231
  notify_on_failure: boolean | null;
@@ -414,6 +418,8 @@ declare class Endpoints {
414
418
  delete(id: string): Promise<void>;
415
419
  events(id: string, limit?: number): Promise<InboundEvent[]>;
416
420
  replay(endpointId: string, eventId: string): Promise<void>;
421
+ pause(id: string): Promise<Endpoint>;
422
+ resume(id: string): Promise<Endpoint>;
417
423
  }
418
424
 
419
425
  export { type BatchOptions, type BatchResponse, type CancelQueueResponse, type CreateEndpointOptions, type CreateMonitorOptions, type CronOptions, type CronResponse, type DelayOptions, type Endpoint, type Execution, type InboundEvent, type ListOptions, type ListResponse, type Monitor, type Ping, type PingResponse, Runlater, RunlaterError, type RunlaterOptions, type ScheduleOptions, type SendOptions, type SyncOptions, type SyncResponse, type Task, type TaskResponse, type TriggerResponse, type UpdateEndpointOptions, type UpdateMonitorOptions, type UpdateTaskOptions };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,8 @@ interface SendOptions {
14
14
  on_failure_url?: string;
15
15
  on_recovery_url?: string;
16
16
  script?: string;
17
+ debounce?: string | number;
18
+ debounceKey?: string;
17
19
  }
18
20
  interface DelayOptions extends SendOptions {
19
21
  delay: string | number;
@@ -41,6 +43,7 @@ interface TaskResponse {
41
43
  execution_id: string;
42
44
  status: string;
43
45
  scheduled_for: string;
46
+ debounce_key?: string;
44
47
  }
45
48
  interface CronResponse {
46
49
  id: string;
@@ -222,6 +225,7 @@ interface Endpoint {
222
225
  inbound_url: string;
223
226
  forward_urls: string[];
224
227
  enabled: boolean;
228
+ paused: boolean;
225
229
  retry_attempts: number;
226
230
  use_queue: boolean;
227
231
  notify_on_failure: boolean | null;
@@ -414,6 +418,8 @@ declare class Endpoints {
414
418
  delete(id: string): Promise<void>;
415
419
  events(id: string, limit?: number): Promise<InboundEvent[]>;
416
420
  replay(endpointId: string, eventId: string): Promise<void>;
421
+ pause(id: string): Promise<Endpoint>;
422
+ resume(id: string): Promise<Endpoint>;
417
423
  }
418
424
 
419
425
  export { type BatchOptions, type BatchResponse, type CancelQueueResponse, type CreateEndpointOptions, type CreateMonitorOptions, type CronOptions, type CronResponse, type DelayOptions, type Endpoint, type Execution, type InboundEvent, type ListOptions, type ListResponse, type Monitor, type Ping, type PingResponse, Runlater, RunlaterError, type RunlaterOptions, type ScheduleOptions, type SendOptions, type SyncOptions, type SyncResponse, type Task, type TaskResponse, type TriggerResponse, type UpdateEndpointOptions, type UpdateMonitorOptions, type UpdateTaskOptions };
package/dist/index.js CHANGED
@@ -211,7 +211,9 @@ var Runlater = class {
211
211
  retry_attempts: options.retries,
212
212
  queue: options.queue,
213
213
  callback_url: options.callback,
214
- script: options.script
214
+ script: options.script,
215
+ debounce: options.debounce != null ? formatDelay(options.debounce) : void 0,
216
+ debounce_key: options.debounceKey
215
217
  };
216
218
  }
217
219
  /** @internal */
@@ -427,6 +429,14 @@ var Endpoints = class {
427
429
  async replay(endpointId, eventId) {
428
430
  await this.client.request("POST", `/endpoints/${endpointId}/events/${eventId}/replay`);
429
431
  }
432
+ async pause(id) {
433
+ const res = await this.client.request("POST", `/endpoints/${id}/pause`);
434
+ return res.data;
435
+ }
436
+ async resume(id) {
437
+ const res = await this.client.request("POST", `/endpoints/${id}/resume`);
438
+ return res.data;
439
+ }
430
440
  };
431
441
  function formatDelay(delay) {
432
442
  if (typeof delay === "number") return `${delay}s`;
package/dist/index.mjs CHANGED
@@ -184,7 +184,9 @@ var Runlater = class {
184
184
  retry_attempts: options.retries,
185
185
  queue: options.queue,
186
186
  callback_url: options.callback,
187
- script: options.script
187
+ script: options.script,
188
+ debounce: options.debounce != null ? formatDelay(options.debounce) : void 0,
189
+ debounce_key: options.debounceKey
188
190
  };
189
191
  }
190
192
  /** @internal */
@@ -400,6 +402,14 @@ var Endpoints = class {
400
402
  async replay(endpointId, eventId) {
401
403
  await this.client.request("POST", `/endpoints/${endpointId}/events/${eventId}/replay`);
402
404
  }
405
+ async pause(id) {
406
+ const res = await this.client.request("POST", `/endpoints/${id}/pause`);
407
+ return res.data;
408
+ }
409
+ async resume(id) {
410
+ const res = await this.client.request("POST", `/endpoints/${id}/resume`);
411
+ return res.data;
412
+ }
403
413
  };
404
414
  function formatDelay(delay) {
405
415
  if (typeof delay === "number") return `${delay}s`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runlater-js",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Delayed tasks, cron jobs, and reliable webhooks. No infrastructure required.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",