@zizq-labs/zizq 0.3.2 → 0.4.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/client.d.ts CHANGED
@@ -309,6 +309,27 @@ export declare class Client {
309
309
  * ```
310
310
  */
311
311
  deleteAllJobs(options?: DeleteAllJobsOptions): Promise<number>;
312
+ /**
313
+ * Wipe *every* cron group and *every* job on the server.
314
+ *
315
+ * Equivalent to calling {@link deleteAllCrons} followed by
316
+ * {@link deleteAllJobs} (no filter), but in a single request. Useful
317
+ * primarily as a setup/teardown step in tests where you want a
318
+ * known-empty server between scenarios.
319
+ *
320
+ * **Destructive.** No filters, no escape hatch, no confirmation —
321
+ * the server-side operation simply returns once everything is gone.
322
+ *
323
+ * @example
324
+ * ```ts
325
+ * await client.reset();
326
+ * ```
327
+ */
328
+ reset(): Promise<void>;
329
+ /**
330
+ * Alias for {@link reset}.
331
+ */
332
+ eraseAllData(): Promise<void>;
312
333
  /**
313
334
  * Count jobs matching the given filters.
314
335
  *
@@ -522,6 +543,17 @@ export declare class Client {
522
543
  * @throws {NotFoundError} If the cron group is not found.
523
544
  */
524
545
  deleteCronGroup(name: string): Promise<void>;
546
+ /**
547
+ * Delete every cron group on the server in a single call.
548
+ *
549
+ * Returns the number of cron groups removed.
550
+ *
551
+ * **Destructive.** This deletes *every cron group on the server*. For
552
+ * granular deletes, use {@link deleteCronGroup} with a specific name.
553
+ *
554
+ * Requires a Pro license on the server.
555
+ */
556
+ deleteAllCrons(): Promise<number>;
525
557
  /**
526
558
  * Fetch a single cron entry within a group.
527
559
  *
package/dist/client.js CHANGED
@@ -367,6 +367,34 @@ export class Client {
367
367
  const data = await this.handleResponse(await this.request("DELETE", path));
368
368
  return data.deleted;
369
369
  }
370
+ /**
371
+ * Wipe *every* cron group and *every* job on the server.
372
+ *
373
+ * Equivalent to calling {@link deleteAllCrons} followed by
374
+ * {@link deleteAllJobs} (no filter), but in a single request. Useful
375
+ * primarily as a setup/teardown step in tests where you want a
376
+ * known-empty server between scenarios.
377
+ *
378
+ * **Destructive.** No filters, no escape hatch, no confirmation —
379
+ * the server-side operation simply returns once everything is gone.
380
+ *
381
+ * @example
382
+ * ```ts
383
+ * await client.reset();
384
+ * ```
385
+ */
386
+ async reset() {
387
+ const res = await this.request("POST", "/reset");
388
+ if (res.statusCode !== 204) {
389
+ await this.throwOnError(res);
390
+ }
391
+ }
392
+ /**
393
+ * Alias for {@link reset}.
394
+ */
395
+ async eraseAllData() {
396
+ return this.reset();
397
+ }
370
398
  /**
371
399
  * Count jobs matching the given filters.
372
400
  *
@@ -670,6 +698,20 @@ export class Client {
670
698
  await this.throwOnError(res);
671
699
  }
672
700
  }
701
+ /**
702
+ * Delete every cron group on the server in a single call.
703
+ *
704
+ * Returns the number of cron groups removed.
705
+ *
706
+ * **Destructive.** This deletes *every cron group on the server*. For
707
+ * granular deletes, use {@link deleteCronGroup} with a specific name.
708
+ *
709
+ * Requires a Pro license on the server.
710
+ */
711
+ async deleteAllCrons() {
712
+ const data = await this.handleResponse(await this.request("DELETE", "/crons"));
713
+ return data.deleted;
714
+ }
673
715
  /**
674
716
  * Fetch a single cron entry within a group.
675
717
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zizq-labs/zizq",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Node.js client for the Zizq job queue server",
5
5
  "homepage": "https://zizq.io",
6
6
  "repository": {