@rustrak/client 0.15.2 → 0.16.1

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.cts CHANGED
@@ -634,9 +634,16 @@ declare const bulkUpdateIssuesSchema: z.ZodObject<{
634
634
  high: "high";
635
635
  }>>;
636
636
  }, z.core.$strip>;
637
- declare const bulkDeleteIssuesSchema: z.ZodObject<{
637
+ declare const bulkDeleteIssuesSchema: z.ZodUnion<readonly [z.ZodObject<{
638
638
  ids: z.ZodArray<z.ZodString>;
639
- }, z.core.$strip>;
639
+ }, z.core.$strict>, z.ZodObject<{
640
+ filter: z.ZodEnum<{
641
+ open: "open";
642
+ resolved: "resolved";
643
+ muted: "muted";
644
+ all: "all";
645
+ }>;
646
+ }, z.core.$strict>]>;
640
647
 
641
648
  type Issue = z.infer<typeof issueSchema>;
642
649
  type IssueStatus = z.infer<typeof issueStatusSchema>;
@@ -916,6 +923,24 @@ declare const cleanupCountsSchema: z.ZodObject<{
916
923
  logs: z.ZodNumber;
917
924
  issues_removed: z.ZodNumber;
918
925
  }, z.core.$strip>;
926
+ declare const cleanupStatusSchema: z.ZodObject<{
927
+ state: z.ZodEnum<{
928
+ failed: "failed";
929
+ idle: "idle";
930
+ running: "running";
931
+ completed: "completed";
932
+ }>;
933
+ removed: z.ZodObject<{
934
+ events: z.ZodNumber;
935
+ transactions: z.ZodNumber;
936
+ spans: z.ZodNumber;
937
+ logs: z.ZodNumber;
938
+ issues_removed: z.ZodNumber;
939
+ }, z.core.$strip>;
940
+ started_at: z.ZodNullable<z.ZodString>;
941
+ finished_at: z.ZodNullable<z.ZodString>;
942
+ error: z.ZodNullable<z.ZodString>;
943
+ }, z.core.$strip>;
919
944
  declare const sourceMapGcResultSchema: z.ZodObject<{
920
945
  files_removed: z.ZodNumber;
921
946
  bytes_freed: z.ZodNumber;
@@ -932,6 +957,7 @@ type SourceMapStorage = z.infer<typeof sourceMapStorageSchema>;
932
957
  type StorageSummary = z.infer<typeof storageSummarySchema>;
933
958
  type ProjectStorage = z.infer<typeof projectStorageSchema>;
934
959
  type CleanupCounts = z.infer<typeof cleanupCountsSchema>;
960
+ type CleanupStatus = z.infer<typeof cleanupStatusSchema>;
935
961
  type SourceMapGcResult = z.infer<typeof sourceMapGcResultSchema>;
936
962
  type CleanupOptions = z.infer<typeof cleanupOptionsSchema>;
937
963
 
@@ -1334,7 +1360,8 @@ declare class StorageResource extends BaseResource {
1334
1360
  getSummary(): Promise<Result<StorageSummary, RustrakError>>;
1335
1361
  getProjects(): Promise<Result<ProjectStorage[], RustrakError>>;
1336
1362
  previewCleanup(options: CleanupOptions): Promise<Result<CleanupCounts, RustrakError>>;
1337
- executeCleanup(options: CleanupOptions): Promise<Result<CleanupCounts, RustrakError>>;
1363
+ executeCleanup(options: CleanupOptions): Promise<Result<CleanupStatus, RustrakError>>;
1364
+ getCleanupStatus(): Promise<Result<CleanupStatus, RustrakError>>;
1338
1365
  previewGcSourceMaps(): Promise<Result<SourceMapGcResult, RustrakError>>;
1339
1366
  gcSourceMaps(): Promise<Result<SourceMapGcResult, RustrakError>>;
1340
1367
  }
@@ -1388,4 +1415,4 @@ declare class RustrakClient {
1388
1415
  constructor(config: ClientConfig);
1389
1416
  }
1390
1417
 
1391
- export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentModelRow, type AgentSummary, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentToolRow, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChangePasswordRequest, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type PreviewTemplateResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RateLimits, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type SpanDetail, type SsoConfig, type SsoLink, type SsoStart, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
1418
+ export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentModelRow, type AgentSummary, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentToolRow, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChangePasswordRequest, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type CleanupStatus, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type PreviewTemplateResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RateLimits, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type SpanDetail, type SsoConfig, type SsoLink, type SsoStart, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
package/dist/index.d.ts CHANGED
@@ -634,9 +634,16 @@ declare const bulkUpdateIssuesSchema: z.ZodObject<{
634
634
  high: "high";
635
635
  }>>;
636
636
  }, z.core.$strip>;
637
- declare const bulkDeleteIssuesSchema: z.ZodObject<{
637
+ declare const bulkDeleteIssuesSchema: z.ZodUnion<readonly [z.ZodObject<{
638
638
  ids: z.ZodArray<z.ZodString>;
639
- }, z.core.$strip>;
639
+ }, z.core.$strict>, z.ZodObject<{
640
+ filter: z.ZodEnum<{
641
+ open: "open";
642
+ resolved: "resolved";
643
+ muted: "muted";
644
+ all: "all";
645
+ }>;
646
+ }, z.core.$strict>]>;
640
647
 
641
648
  type Issue = z.infer<typeof issueSchema>;
642
649
  type IssueStatus = z.infer<typeof issueStatusSchema>;
@@ -916,6 +923,24 @@ declare const cleanupCountsSchema: z.ZodObject<{
916
923
  logs: z.ZodNumber;
917
924
  issues_removed: z.ZodNumber;
918
925
  }, z.core.$strip>;
926
+ declare const cleanupStatusSchema: z.ZodObject<{
927
+ state: z.ZodEnum<{
928
+ failed: "failed";
929
+ idle: "idle";
930
+ running: "running";
931
+ completed: "completed";
932
+ }>;
933
+ removed: z.ZodObject<{
934
+ events: z.ZodNumber;
935
+ transactions: z.ZodNumber;
936
+ spans: z.ZodNumber;
937
+ logs: z.ZodNumber;
938
+ issues_removed: z.ZodNumber;
939
+ }, z.core.$strip>;
940
+ started_at: z.ZodNullable<z.ZodString>;
941
+ finished_at: z.ZodNullable<z.ZodString>;
942
+ error: z.ZodNullable<z.ZodString>;
943
+ }, z.core.$strip>;
919
944
  declare const sourceMapGcResultSchema: z.ZodObject<{
920
945
  files_removed: z.ZodNumber;
921
946
  bytes_freed: z.ZodNumber;
@@ -932,6 +957,7 @@ type SourceMapStorage = z.infer<typeof sourceMapStorageSchema>;
932
957
  type StorageSummary = z.infer<typeof storageSummarySchema>;
933
958
  type ProjectStorage = z.infer<typeof projectStorageSchema>;
934
959
  type CleanupCounts = z.infer<typeof cleanupCountsSchema>;
960
+ type CleanupStatus = z.infer<typeof cleanupStatusSchema>;
935
961
  type SourceMapGcResult = z.infer<typeof sourceMapGcResultSchema>;
936
962
  type CleanupOptions = z.infer<typeof cleanupOptionsSchema>;
937
963
 
@@ -1334,7 +1360,8 @@ declare class StorageResource extends BaseResource {
1334
1360
  getSummary(): Promise<Result<StorageSummary, RustrakError>>;
1335
1361
  getProjects(): Promise<Result<ProjectStorage[], RustrakError>>;
1336
1362
  previewCleanup(options: CleanupOptions): Promise<Result<CleanupCounts, RustrakError>>;
1337
- executeCleanup(options: CleanupOptions): Promise<Result<CleanupCounts, RustrakError>>;
1363
+ executeCleanup(options: CleanupOptions): Promise<Result<CleanupStatus, RustrakError>>;
1364
+ getCleanupStatus(): Promise<Result<CleanupStatus, RustrakError>>;
1338
1365
  previewGcSourceMaps(): Promise<Result<SourceMapGcResult, RustrakError>>;
1339
1366
  gcSourceMaps(): Promise<Result<SourceMapGcResult, RustrakError>>;
1340
1367
  }
@@ -1388,4 +1415,4 @@ declare class RustrakClient {
1388
1415
  constructor(config: ClientConfig);
1389
1416
  }
1390
1417
 
1391
- export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentModelRow, type AgentSummary, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentToolRow, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChangePasswordRequest, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type PreviewTemplateResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RateLimits, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type SpanDetail, type SsoConfig, type SsoLink, type SsoStart, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
1418
+ export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentModelRow, type AgentSummary, type AgentTimeseriesOptions, type AgentTimeseriesPoint, type AgentToolRow, type AgentTraceSummary, type AgentTracesOptions, type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, type BulkDeleteIssues, type BulkUpdateIssues, type ChangePasswordRequest, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type CleanupStatus, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateProject, type CreateUserReport, Err, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, FIELD_ERROR_CODES, type FieldError, type FieldErrorCode, type GenAiBreakdownRow, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueAggregates, type IssueFilter, type IssueHash, type IssuePriority, type IssueSort, type IssueStats, type IssueStatsWindow, type IssueStatus, type IssueTagValue, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListLogsOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListSpansOptions, type ListTransactionsOptions, type Log, type LoginRequest, type LoginResult, type MetricDelta, NETWORK_ERROR_MESSAGE, type OffsetPaginatedResponse, Ok, type PaginatedResponse, type PreviewTemplateResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, type RateLimits, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type Result, type RoutingOverride, RustrakClient, type RustrakError, type RustrakErrorKind, SERVER_ERROR_MESSAGE, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type SpanDetail, type SsoConfig, type SsoLink, type SsoStart, type StorageSummary, TIMEOUT_ERROR_MESSAGE, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, isRetryable, mapResult, unwrap, unwrapOr };
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ z.enum([
20
20
  "last_seen",
21
21
  "event_count"
22
22
  ]);
23
- z.enum(["open", "resolved", "muted", "all"]);
23
+ var issueFilterSchema = z.enum(["open", "resolved", "muted", "all"]);
24
24
  var dateTimeSchema = z.string().datetime();
25
25
  var uuidSchema = z.string().uuid();
26
26
  var eventIdSchema = z.string().regex(
@@ -381,9 +381,10 @@ var bulkUpdateIssuesSchema = z.object({
381
381
  status: z.union([issueStatusSchema, z.literal("resolvedInNextRelease")]).optional(),
382
382
  priority: issuePrioritySchema.optional()
383
383
  });
384
- var bulkDeleteIssuesSchema = z.object({
385
- ids: z.array(uuidSchema)
386
- });
384
+ var bulkDeleteIssuesSchema = z.union([
385
+ z.strictObject({ ids: z.array(uuidSchema) }),
386
+ z.strictObject({ filter: issueFilterSchema })
387
+ ]);
387
388
  var logSchema = z.object({
388
389
  id: uuidSchema,
389
390
  trace_id: z.string().nullable(),
@@ -588,6 +589,13 @@ var cleanupCountsSchema = z.object({
588
589
  logs: z.number(),
589
590
  issues_removed: z.number()
590
591
  });
592
+ var cleanupStatusSchema = z.object({
593
+ state: z.enum(["idle", "running", "completed", "failed"]),
594
+ removed: cleanupCountsSchema,
595
+ started_at: z.string().nullable(),
596
+ finished_at: z.string().nullable(),
597
+ error: z.string().nullable()
598
+ });
591
599
  var sourceMapGcResultSchema = z.object({
592
600
  files_removed: z.number(),
593
601
  bytes_freed: z.number()
@@ -2374,8 +2382,13 @@ var StorageResource = class extends BaseResource {
2374
2382
  );
2375
2383
  }
2376
2384
  /**
2377
- * Execute a cleanup: delete data older than `older_than_days` (optionally
2378
- * scoped to one project) and remove any issue left with zero events.
2385
+ * Start a cleanup: delete data older than `older_than_days` (optionally
2386
+ * scoped to one project) and remove the issues it leaves with zero events.
2387
+ *
2388
+ * Returns as soon as the server has started it, with the `running` status.
2389
+ * The deletion runs in the background; follow it with
2390
+ * {@link getCleanupStatus}. A second start while one is running fails with
2391
+ * a `conflict`.
2379
2392
  */
2380
2393
  async executeCleanup(options) {
2381
2394
  const validatedInput = this.validateInput(options, cleanupOptionsSchema);
@@ -2383,8 +2396,23 @@ var StorageResource = class extends BaseResource {
2383
2396
  return validatedInput;
2384
2397
  }
2385
2398
  return this.request(
2386
- () => this.http.post("api/storage/cleanup", { json: validatedInput.data }),
2387
- cleanupCountsSchema
2399
+ () => this.http.post("api/storage/cleanup", {
2400
+ json: validatedInput.data,
2401
+ // No retry: if the first attempt started the cleanup and only its
2402
+ // response was lost, a retry would be refused as a second run and
2403
+ // report a failure for a cleanup that is in fact running.
2404
+ retry: 0
2405
+ }),
2406
+ cleanupStatusSchema
2407
+ );
2408
+ }
2409
+ /**
2410
+ * The running cleanup's progress, or the outcome of the last one.
2411
+ */
2412
+ async getCleanupStatus() {
2413
+ return this.request(
2414
+ () => this.http.get("api/storage/cleanup/status"),
2415
+ cleanupStatusSchema
2388
2416
  );
2389
2417
  }
2390
2418
  /**