@rustrak/client 0.12.3 → 0.13.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.cts CHANGED
@@ -256,6 +256,7 @@ interface ListProjectsOptions {
256
256
  page?: number;
257
257
  per_page?: number;
258
258
  order?: SortOrder;
259
+ stats_period?: string;
259
260
  }
260
261
  interface ListTransactionsOptions {
261
262
  page?: number;
@@ -566,6 +567,19 @@ type ProjectRole = z.infer<typeof projectRoleSchema>;
566
567
  type ProjectMember = z.infer<typeof projectMemberSchema>;
567
568
  type UpsertProjectMember = z.infer<typeof upsertProjectMemberSchema>;
568
569
 
570
+ declare const projectListStatsSchema: z.ZodObject<{
571
+ trend: z.ZodArray<z.ZodNumber>;
572
+ events: z.ZodObject<{
573
+ current: z.ZodNumber;
574
+ previous: z.ZodNullable<z.ZodNumber>;
575
+ }, z.core.$strip>;
576
+ new_issues: z.ZodObject<{
577
+ current: z.ZodNumber;
578
+ previous: z.ZodNullable<z.ZodNumber>;
579
+ }, z.core.$strip>;
580
+ open_issues: z.ZodNumber;
581
+ fatal_issues: z.ZodNumber;
582
+ }, z.core.$strip>;
569
583
  declare const projectSchema: z.ZodObject<{
570
584
  id: z.ZodNumber;
571
585
  name: z.ZodString;
@@ -577,17 +591,33 @@ declare const projectSchema: z.ZodObject<{
577
591
  created_at: z.ZodString;
578
592
  updated_at: z.ZodString;
579
593
  platform: z.ZodNullable<z.ZodString>;
594
+ stats: z.ZodOptional<z.ZodObject<{
595
+ trend: z.ZodArray<z.ZodNumber>;
596
+ events: z.ZodObject<{
597
+ current: z.ZodNumber;
598
+ previous: z.ZodNullable<z.ZodNumber>;
599
+ }, z.core.$strip>;
600
+ new_issues: z.ZodObject<{
601
+ current: z.ZodNumber;
602
+ previous: z.ZodNullable<z.ZodNumber>;
603
+ }, z.core.$strip>;
604
+ open_issues: z.ZodNumber;
605
+ fatal_issues: z.ZodNumber;
606
+ }, z.core.$strip>>;
580
607
  }, z.core.$strip>;
581
608
  declare const createProjectSchema: z.ZodObject<{
582
609
  name: z.ZodString;
583
610
  slug: z.ZodOptional<z.ZodString>;
611
+ platform: z.ZodOptional<z.ZodString>;
584
612
  }, z.core.$strip>;
585
613
  declare const updateProjectSchema: z.ZodObject<{
586
614
  name: z.ZodOptional<z.ZodString>;
587
615
  platform: z.ZodOptional<z.ZodString>;
616
+ slug: z.ZodOptional<z.ZodString>;
588
617
  }, z.core.$strip>;
589
618
 
590
619
  type Project = z.infer<typeof projectSchema>;
620
+ type ProjectListStats = z.infer<typeof projectListStatsSchema>;
591
621
  type CreateProject = z.infer<typeof createProjectSchema>;
592
622
  type UpdateProject = z.infer<typeof updateProjectSchema>;
593
623
 
@@ -1167,4 +1197,4 @@ declare class ValidationError extends RustrakError {
1167
1197
  getValidationDetails(): string;
1168
1198
  }
1169
1199
 
1170
- export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentTimeseriesOptions, type AgentTimeseriesPoint, 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, AuthenticationError, AuthorizationError, BadRequestError, type BulkDeleteIssues, type BulkUpdateIssues, type ChannelType, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type CreateUserReport, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, 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, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type StorageSummary, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, ValidationError };
1200
+ export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentTimeseriesOptions, type AgentTimeseriesPoint, 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, AuthenticationError, AuthorizationError, BadRequestError, type BulkDeleteIssues, type BulkUpdateIssues, type ChannelType, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type CreateUserReport, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, 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, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type StorageSummary, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, ValidationError };
package/dist/index.d.ts CHANGED
@@ -256,6 +256,7 @@ interface ListProjectsOptions {
256
256
  page?: number;
257
257
  per_page?: number;
258
258
  order?: SortOrder;
259
+ stats_period?: string;
259
260
  }
260
261
  interface ListTransactionsOptions {
261
262
  page?: number;
@@ -566,6 +567,19 @@ type ProjectRole = z.infer<typeof projectRoleSchema>;
566
567
  type ProjectMember = z.infer<typeof projectMemberSchema>;
567
568
  type UpsertProjectMember = z.infer<typeof upsertProjectMemberSchema>;
568
569
 
570
+ declare const projectListStatsSchema: z.ZodObject<{
571
+ trend: z.ZodArray<z.ZodNumber>;
572
+ events: z.ZodObject<{
573
+ current: z.ZodNumber;
574
+ previous: z.ZodNullable<z.ZodNumber>;
575
+ }, z.core.$strip>;
576
+ new_issues: z.ZodObject<{
577
+ current: z.ZodNumber;
578
+ previous: z.ZodNullable<z.ZodNumber>;
579
+ }, z.core.$strip>;
580
+ open_issues: z.ZodNumber;
581
+ fatal_issues: z.ZodNumber;
582
+ }, z.core.$strip>;
569
583
  declare const projectSchema: z.ZodObject<{
570
584
  id: z.ZodNumber;
571
585
  name: z.ZodString;
@@ -577,17 +591,33 @@ declare const projectSchema: z.ZodObject<{
577
591
  created_at: z.ZodString;
578
592
  updated_at: z.ZodString;
579
593
  platform: z.ZodNullable<z.ZodString>;
594
+ stats: z.ZodOptional<z.ZodObject<{
595
+ trend: z.ZodArray<z.ZodNumber>;
596
+ events: z.ZodObject<{
597
+ current: z.ZodNumber;
598
+ previous: z.ZodNullable<z.ZodNumber>;
599
+ }, z.core.$strip>;
600
+ new_issues: z.ZodObject<{
601
+ current: z.ZodNumber;
602
+ previous: z.ZodNullable<z.ZodNumber>;
603
+ }, z.core.$strip>;
604
+ open_issues: z.ZodNumber;
605
+ fatal_issues: z.ZodNumber;
606
+ }, z.core.$strip>>;
580
607
  }, z.core.$strip>;
581
608
  declare const createProjectSchema: z.ZodObject<{
582
609
  name: z.ZodString;
583
610
  slug: z.ZodOptional<z.ZodString>;
611
+ platform: z.ZodOptional<z.ZodString>;
584
612
  }, z.core.$strip>;
585
613
  declare const updateProjectSchema: z.ZodObject<{
586
614
  name: z.ZodOptional<z.ZodString>;
587
615
  platform: z.ZodOptional<z.ZodString>;
616
+ slug: z.ZodOptional<z.ZodString>;
588
617
  }, z.core.$strip>;
589
618
 
590
619
  type Project = z.infer<typeof projectSchema>;
620
+ type ProjectListStats = z.infer<typeof projectListStatsSchema>;
591
621
  type CreateProject = z.infer<typeof createProjectSchema>;
592
622
  type UpdateProject = z.infer<typeof updateProjectSchema>;
593
623
 
@@ -1167,4 +1197,4 @@ declare class ValidationError extends RustrakError {
1167
1197
  getValidationDetails(): string;
1168
1198
  }
1169
1199
 
1170
- export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentTimeseriesOptions, type AgentTimeseriesPoint, 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, AuthenticationError, AuthorizationError, BadRequestError, type BulkDeleteIssues, type BulkUpdateIssues, type ChannelType, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type CreateUserReport, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, 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, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type StorageSummary, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, ValidationError };
1200
+ export { type AcceptInvitation, type ActivityEntry, type AgentBreakdownOptions, type AgentDurationPoint, type AgentTimeseriesOptions, type AgentTimeseriesPoint, 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, AuthenticationError, AuthorizationError, BadRequestError, type BulkDeleteIssues, type BulkUpdateIssues, type ChannelType, type ChunkUploadCapability, type CleanupCounts, type CleanupOptions, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateComment, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type CreateUserReport, type Event, type EventDetail, type EventTimeseries, type EventTimeseriesPoint, 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, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectListStats, type ProjectMember, type ProjectRole, type ProjectStatsSummary, type ProjectStorage, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealthRow, type ReleaseHealthStatsOptions, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SessionSummary, type SessionTimeseries, type SessionTimeseriesPoint, type SortOrder, type SourceMapFile, type SourceMapGcResult, type SourceMapStorage, type Span, type StorageSummary, type TagSummary, type TagValueCount, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type TransactionStats, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, type UserReport, ValidationError };
package/dist/index.js CHANGED
@@ -357,6 +357,28 @@ var upsertProjectMemberSchema = z.object({
357
357
  user_id: z.number().int(),
358
358
  role: projectRoleSchema
359
359
  });
360
+ var metricDeltaSchema = z.object({
361
+ current: z.number().int(),
362
+ /**
363
+ * The same window immediately before this one. Null only for all-time
364
+ * requests, where a `0` would render as a misleading "+100%".
365
+ */
366
+ previous: z.number().int().nullable()
367
+ });
368
+ var projectListStatsSchema = z.object({
369
+ /**
370
+ * Distinct issues active in each bucket, oldest first. A shape, not a
371
+ * total: an issue firing all day appears in every bucket it touched.
372
+ */
373
+ trend: z.array(z.number().int()),
374
+ events: metricDeltaSchema,
375
+ /** Issues first seen in the window. Drives the "getting worse" signal. */
376
+ new_issues: metricDeltaSchema,
377
+ /** Unresolved issues right now, independent of the window. */
378
+ open_issues: z.number().int(),
379
+ /** The subset of `open_issues` at `fatal` level. */
380
+ fatal_issues: z.number().int()
381
+ });
360
382
  var projectSchema = z.object({
361
383
  id: z.number().int(),
362
384
  name: z.string(),
@@ -367,15 +389,31 @@ var projectSchema = z.object({
367
389
  digested_event_count: z.number().int(),
368
390
  created_at: dateTimeSchema,
369
391
  updated_at: dateTimeSchema,
370
- platform: z.string().nullable()
392
+ platform: z.string().nullable(),
393
+ stats: projectListStatsSchema.optional()
371
394
  });
372
395
  var createProjectSchema = z.object({
373
396
  name: z.string().min(1),
374
- slug: z.string().optional()
397
+ /**
398
+ * Slugified server-side. Supplying it means the user chose it, so a taken
399
+ * slug is a 409. Omitting it derives one from the name and silently
400
+ * de-duplicates, since nobody chose that value.
401
+ */
402
+ slug: z.string().min(1).optional(),
403
+ /**
404
+ * Validated server-side against SELECTABLE_PLATFORMS. Omitting it leaves the
405
+ * project eligible for platform auto-detection from its first event.
406
+ */
407
+ platform: z.string().min(1).optional()
375
408
  });
376
409
  var updateProjectSchema = z.object({
377
410
  name: z.string().min(1).optional(),
378
- platform: z.string().min(1).optional()
411
+ platform: z.string().min(1).optional(),
412
+ /**
413
+ * Slugified server-side. Unlike on create, a taken slug is a 409 rather than
414
+ * being silently de-duplicated.
415
+ */
416
+ slug: z.string().min(1).optional()
379
417
  });
380
418
  var releaseHealthRowSchema = z.object({
381
419
  release: z.string(),
@@ -437,15 +475,15 @@ var eventTimeseriesPointSchema = z.object({
437
475
  info: z.number().int()
438
476
  });
439
477
  var eventTimeseriesSchema = z.array(eventTimeseriesPointSchema);
440
- var metricDeltaSchema = z.object({
478
+ var metricDeltaSchema2 = z.object({
441
479
  current: z.number().int(),
442
480
  previous: z.number().int().nullable()
443
481
  });
444
482
  var projectStatsSummarySchema = z.object({
445
483
  /** Resolved window in hours, or `null` for all time. */
446
484
  period_hours: z.number().int().nullable(),
447
- events: metricDeltaSchema,
448
- new_issues: metricDeltaSchema,
485
+ events: metricDeltaSchema2,
486
+ new_issues: metricDeltaSchema2,
449
487
  /** Currently unresolved issues, independent of the window. */
450
488
  open_issues: z.number().int()
451
489
  });
@@ -1294,6 +1332,9 @@ var ProjectsResource = class extends BaseResource {
1294
1332
  if (options?.order) {
1295
1333
  searchParams.set("order", options.order);
1296
1334
  }
1335
+ if (options?.stats_period) {
1336
+ searchParams.set("stats_period", options.stats_period);
1337
+ }
1297
1338
  const query = searchParams.toString();
1298
1339
  const url = query ? `api/projects?${query}` : "api/projects";
1299
1340
  const data = await this.http.get(url).json();
@@ -1742,7 +1783,8 @@ function transformHttpError(error) {
1742
1783
  let errorMessage = `HTTP ${status} error`;
1743
1784
  const body = error.data;
1744
1785
  if (body) {
1745
- errorMessage = body.error || body.message || errorMessage;
1786
+ const nested = typeof body.error === "object" ? body.error?.message : body.error;
1787
+ errorMessage = nested || body.message || errorMessage;
1746
1788
  }
1747
1789
  switch (status) {
1748
1790
  case 400: