@rustrak/client 0.15.2 → 0.16.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.cjs CHANGED
@@ -26,7 +26,7 @@ zod.z.enum([
26
26
  "last_seen",
27
27
  "event_count"
28
28
  ]);
29
- zod.z.enum(["open", "resolved", "muted", "all"]);
29
+ var issueFilterSchema = zod.z.enum(["open", "resolved", "muted", "all"]);
30
30
  var dateTimeSchema = zod.z.string().datetime();
31
31
  var uuidSchema = zod.z.string().uuid();
32
32
  var eventIdSchema = zod.z.string().regex(
@@ -387,9 +387,10 @@ var bulkUpdateIssuesSchema = zod.z.object({
387
387
  status: zod.z.union([issueStatusSchema, zod.z.literal("resolvedInNextRelease")]).optional(),
388
388
  priority: issuePrioritySchema.optional()
389
389
  });
390
- var bulkDeleteIssuesSchema = zod.z.object({
391
- ids: zod.z.array(uuidSchema)
392
- });
390
+ var bulkDeleteIssuesSchema = zod.z.union([
391
+ zod.z.strictObject({ ids: zod.z.array(uuidSchema) }),
392
+ zod.z.strictObject({ filter: issueFilterSchema })
393
+ ]);
393
394
  var logSchema = zod.z.object({
394
395
  id: uuidSchema,
395
396
  trace_id: zod.z.string().nullable(),
@@ -594,6 +595,13 @@ var cleanupCountsSchema = zod.z.object({
594
595
  logs: zod.z.number(),
595
596
  issues_removed: zod.z.number()
596
597
  });
598
+ var cleanupStatusSchema = zod.z.object({
599
+ state: zod.z.enum(["idle", "running", "completed", "failed"]),
600
+ removed: cleanupCountsSchema,
601
+ started_at: zod.z.string().nullable(),
602
+ finished_at: zod.z.string().nullable(),
603
+ error: zod.z.string().nullable()
604
+ });
597
605
  var sourceMapGcResultSchema = zod.z.object({
598
606
  files_removed: zod.z.number(),
599
607
  bytes_freed: zod.z.number()
@@ -2380,8 +2388,13 @@ var StorageResource = class extends BaseResource {
2380
2388
  );
2381
2389
  }
2382
2390
  /**
2383
- * Execute a cleanup: delete data older than `older_than_days` (optionally
2384
- * scoped to one project) and remove any issue left with zero events.
2391
+ * Start a cleanup: delete data older than `older_than_days` (optionally
2392
+ * scoped to one project) and remove the issues it leaves with zero events.
2393
+ *
2394
+ * Returns as soon as the server has started it, with the `running` status.
2395
+ * The deletion runs in the background; follow it with
2396
+ * {@link getCleanupStatus}. A second start while one is running fails with
2397
+ * a `conflict`.
2385
2398
  */
2386
2399
  async executeCleanup(options) {
2387
2400
  const validatedInput = this.validateInput(options, cleanupOptionsSchema);
@@ -2389,8 +2402,23 @@ var StorageResource = class extends BaseResource {
2389
2402
  return validatedInput;
2390
2403
  }
2391
2404
  return this.request(
2392
- () => this.http.post("api/storage/cleanup", { json: validatedInput.data }),
2393
- cleanupCountsSchema
2405
+ () => this.http.post("api/storage/cleanup", {
2406
+ json: validatedInput.data,
2407
+ // No retry: if the first attempt started the cleanup and only its
2408
+ // response was lost, a retry would be refused as a second run and
2409
+ // report a failure for a cleanup that is in fact running.
2410
+ retry: 0
2411
+ }),
2412
+ cleanupStatusSchema
2413
+ );
2414
+ }
2415
+ /**
2416
+ * The running cleanup's progress, or the outcome of the last one.
2417
+ */
2418
+ async getCleanupStatus() {
2419
+ return this.request(
2420
+ () => this.http.get("api/storage/cleanup/status"),
2421
+ cleanupStatusSchema
2394
2422
  );
2395
2423
  }
2396
2424
  /**