@rustrak/client 0.15.1 → 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()
@@ -741,6 +749,10 @@ var ssoLinkSchema = zod.z.object({
741
749
  var confirmSsoLinkRequestSchema = zod.z.object({
742
750
  password: zod.z.string().min(1)
743
751
  });
752
+ var changePasswordRequestSchema = zod.z.object({
753
+ current_password: zod.z.string().min(1),
754
+ new_password: zod.z.string().min(1)
755
+ });
744
756
 
745
757
  // src/errors.ts
746
758
  var FIELD_ERROR_CODES = [
@@ -1548,6 +1560,20 @@ var AuthResource = class extends BaseResource {
1548
1560
  userSchema
1549
1561
  );
1550
1562
  }
1563
+ /** Replaces the signed-in user's password, given the current one. */
1564
+ async changePassword(request) {
1565
+ const validatedInput = this.validateInput(
1566
+ request,
1567
+ changePasswordRequestSchema
1568
+ );
1569
+ if (!validatedInput.success) return validatedInput;
1570
+ return this.requestVoid(
1571
+ () => this.http.post("auth/me/password", {
1572
+ json: validatedInput.data,
1573
+ retry: 0
1574
+ })
1575
+ );
1576
+ }
1551
1577
  /**
1552
1578
  * Get the details of a pending invitation by its token (public endpoint)
1553
1579
  * Used by the accept-invitation page before the user has an account
@@ -2362,8 +2388,13 @@ var StorageResource = class extends BaseResource {
2362
2388
  );
2363
2389
  }
2364
2390
  /**
2365
- * Execute a cleanup: delete data older than `older_than_days` (optionally
2366
- * 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`.
2367
2398
  */
2368
2399
  async executeCleanup(options) {
2369
2400
  const validatedInput = this.validateInput(options, cleanupOptionsSchema);
@@ -2371,8 +2402,23 @@ var StorageResource = class extends BaseResource {
2371
2402
  return validatedInput;
2372
2403
  }
2373
2404
  return this.request(
2374
- () => this.http.post("api/storage/cleanup", { json: validatedInput.data }),
2375
- 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
2376
2422
  );
2377
2423
  }
2378
2424
  /**