@rustrak/client 0.3.2 → 0.3.4

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
@@ -333,22 +333,26 @@ interface ListProjectsOptions {
333
333
  per_page?: number;
334
334
  order?: SortOrder;
335
335
  }
336
+ interface ListTransactionsOptions {
337
+ cursor?: string;
338
+ }
336
339
 
337
340
  declare const eventSchema: z.ZodObject<{
338
341
  id: z.ZodString;
339
342
  event_id: z.ZodString;
340
- issue_id: z.ZodString;
343
+ issue_id: z.ZodNullable<z.ZodString>;
341
344
  title: z.ZodString;
342
345
  timestamp: z.ZodString;
343
346
  level: z.ZodString;
344
347
  platform: z.ZodString;
345
348
  release: z.ZodString;
346
349
  environment: z.ZodString;
350
+ event_type: z.ZodString;
347
351
  }, z.core.$strip>;
348
352
  declare const eventDetailSchema: z.ZodObject<{
349
353
  id: z.ZodString;
350
354
  event_id: z.ZodString;
351
- issue_id: z.ZodString;
355
+ issue_id: z.ZodNullable<z.ZodString>;
352
356
  title: z.ZodString;
353
357
  timestamp: z.ZodString;
354
358
  ingested_at: z.ZodString;
@@ -359,6 +363,7 @@ declare const eventDetailSchema: z.ZodObject<{
359
363
  server_name: z.ZodString;
360
364
  sdk_name: z.ZodString;
361
365
  sdk_version: z.ZodString;
366
+ event_type: z.ZodString;
362
367
  data: z.ZodRecord<z.ZodString, z.ZodAny>;
363
368
  }, z.core.$strip>;
364
369
 
@@ -553,6 +558,35 @@ type AuthToken = z.infer<typeof authTokenSchema>;
553
558
  type AuthTokenCreated = z.infer<typeof authTokenCreatedSchema>;
554
559
  type CreateAuthToken = z.infer<typeof createAuthTokenSchema>;
555
560
 
561
+ declare const transactionSchema: z.ZodObject<{
562
+ id: z.ZodString;
563
+ event_id: z.ZodString;
564
+ transaction_name: z.ZodString;
565
+ timestamp: z.ZodString;
566
+ start_timestamp: z.ZodNullable<z.ZodString>;
567
+ duration_ms: z.ZodNullable<z.ZodNumber>;
568
+ platform: z.ZodString;
569
+ environment: z.ZodString;
570
+ release: z.ZodString;
571
+ ingested_at: z.ZodString;
572
+ }, z.core.$strip>;
573
+ declare const transactionDetailSchema: z.ZodObject<{
574
+ id: z.ZodString;
575
+ event_id: z.ZodString;
576
+ transaction_name: z.ZodString;
577
+ timestamp: z.ZodString;
578
+ start_timestamp: z.ZodNullable<z.ZodString>;
579
+ duration_ms: z.ZodNullable<z.ZodNumber>;
580
+ platform: z.ZodString;
581
+ environment: z.ZodString;
582
+ release: z.ZodString;
583
+ ingested_at: z.ZodString;
584
+ data: z.ZodRecord<z.ZodString, z.ZodAny>;
585
+ }, z.core.$strip>;
586
+
587
+ type Transaction = z.infer<typeof transactionSchema>;
588
+ type TransactionDetail = z.infer<typeof transactionDetailSchema>;
589
+
556
590
  declare class EventsResource extends BaseResource {
557
591
  list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
558
592
  get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
@@ -616,6 +650,11 @@ declare class TokensResource extends BaseResource {
616
650
  delete(id: number): Promise<void>;
617
651
  }
618
652
 
653
+ declare class TransactionsResource extends BaseResource {
654
+ list(projectId: number, options?: ListTransactionsOptions): Promise<PaginatedResponse<Transaction>>;
655
+ get(projectId: number, transactionId: string): Promise<TransactionDetail>;
656
+ }
657
+
619
658
  declare class RustrakClient {
620
659
  private readonly http;
621
660
  readonly auth: AuthResource;
@@ -630,6 +669,7 @@ declare class RustrakClient {
630
669
  readonly invitations: InvitationsResource;
631
670
  readonly members: MembersResource;
632
671
  readonly sessions: SessionsResource;
672
+ readonly transactions: TransactionsResource;
633
673
  readonly health: HealthResource;
634
674
  constructor(config: ClientConfig);
635
675
  }
@@ -674,4 +714,4 @@ declare class ValidationError extends RustrakError {
674
714
  getValidationDetails(): string;
675
715
  }
676
716
 
677
- export { type AcceptInvitation, 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 ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectMember, type ProjectRole, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealth, type ReleaseHealthRow, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SortOrder, type SourceMapFile, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, ValidationError };
717
+ export { type AcceptInvitation, 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 ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListTransactionsOptions, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectMember, type ProjectRole, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealth, type ReleaseHealthRow, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SortOrder, type SourceMapFile, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, ValidationError };
package/dist/index.d.ts CHANGED
@@ -333,22 +333,26 @@ interface ListProjectsOptions {
333
333
  per_page?: number;
334
334
  order?: SortOrder;
335
335
  }
336
+ interface ListTransactionsOptions {
337
+ cursor?: string;
338
+ }
336
339
 
337
340
  declare const eventSchema: z.ZodObject<{
338
341
  id: z.ZodString;
339
342
  event_id: z.ZodString;
340
- issue_id: z.ZodString;
343
+ issue_id: z.ZodNullable<z.ZodString>;
341
344
  title: z.ZodString;
342
345
  timestamp: z.ZodString;
343
346
  level: z.ZodString;
344
347
  platform: z.ZodString;
345
348
  release: z.ZodString;
346
349
  environment: z.ZodString;
350
+ event_type: z.ZodString;
347
351
  }, z.core.$strip>;
348
352
  declare const eventDetailSchema: z.ZodObject<{
349
353
  id: z.ZodString;
350
354
  event_id: z.ZodString;
351
- issue_id: z.ZodString;
355
+ issue_id: z.ZodNullable<z.ZodString>;
352
356
  title: z.ZodString;
353
357
  timestamp: z.ZodString;
354
358
  ingested_at: z.ZodString;
@@ -359,6 +363,7 @@ declare const eventDetailSchema: z.ZodObject<{
359
363
  server_name: z.ZodString;
360
364
  sdk_name: z.ZodString;
361
365
  sdk_version: z.ZodString;
366
+ event_type: z.ZodString;
362
367
  data: z.ZodRecord<z.ZodString, z.ZodAny>;
363
368
  }, z.core.$strip>;
364
369
 
@@ -553,6 +558,35 @@ type AuthToken = z.infer<typeof authTokenSchema>;
553
558
  type AuthTokenCreated = z.infer<typeof authTokenCreatedSchema>;
554
559
  type CreateAuthToken = z.infer<typeof createAuthTokenSchema>;
555
560
 
561
+ declare const transactionSchema: z.ZodObject<{
562
+ id: z.ZodString;
563
+ event_id: z.ZodString;
564
+ transaction_name: z.ZodString;
565
+ timestamp: z.ZodString;
566
+ start_timestamp: z.ZodNullable<z.ZodString>;
567
+ duration_ms: z.ZodNullable<z.ZodNumber>;
568
+ platform: z.ZodString;
569
+ environment: z.ZodString;
570
+ release: z.ZodString;
571
+ ingested_at: z.ZodString;
572
+ }, z.core.$strip>;
573
+ declare const transactionDetailSchema: z.ZodObject<{
574
+ id: z.ZodString;
575
+ event_id: z.ZodString;
576
+ transaction_name: z.ZodString;
577
+ timestamp: z.ZodString;
578
+ start_timestamp: z.ZodNullable<z.ZodString>;
579
+ duration_ms: z.ZodNullable<z.ZodNumber>;
580
+ platform: z.ZodString;
581
+ environment: z.ZodString;
582
+ release: z.ZodString;
583
+ ingested_at: z.ZodString;
584
+ data: z.ZodRecord<z.ZodString, z.ZodAny>;
585
+ }, z.core.$strip>;
586
+
587
+ type Transaction = z.infer<typeof transactionSchema>;
588
+ type TransactionDetail = z.infer<typeof transactionDetailSchema>;
589
+
556
590
  declare class EventsResource extends BaseResource {
557
591
  list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
558
592
  get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
@@ -616,6 +650,11 @@ declare class TokensResource extends BaseResource {
616
650
  delete(id: number): Promise<void>;
617
651
  }
618
652
 
653
+ declare class TransactionsResource extends BaseResource {
654
+ list(projectId: number, options?: ListTransactionsOptions): Promise<PaginatedResponse<Transaction>>;
655
+ get(projectId: number, transactionId: string): Promise<TransactionDetail>;
656
+ }
657
+
619
658
  declare class RustrakClient {
620
659
  private readonly http;
621
660
  readonly auth: AuthResource;
@@ -630,6 +669,7 @@ declare class RustrakClient {
630
669
  readonly invitations: InvitationsResource;
631
670
  readonly members: MembersResource;
632
671
  readonly sessions: SessionsResource;
672
+ readonly transactions: TransactionsResource;
633
673
  readonly health: HealthResource;
634
674
  constructor(config: ClientConfig);
635
675
  }
@@ -674,4 +714,4 @@ declare class ValidationError extends RustrakError {
674
714
  getValidationDetails(): string;
675
715
  }
676
716
 
677
- export { type AcceptInvitation, 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 ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectMember, type ProjectRole, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealth, type ReleaseHealthRow, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SortOrder, type SourceMapFile, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, ValidationError };
717
+ export { type AcceptInvitation, 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 ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateInvitation, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type GlobalRole, type Invitation, type InvitationInfo, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type ListTransactionsOptions, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProjectMember, type ProjectRole, type ProviderType, RateLimitError, type RegisterRequest, type ReleaseHealth, type ReleaseHealthRow, type RoutingOverride, RustrakClient, RustrakError, ServerError, type ServerVersion, type SortOrder, type SourceMapFile, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type Transaction, type TransactionDetail, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, ValidationError };
package/dist/index.js CHANGED
@@ -19,6 +19,10 @@ z.enum(["digest_order", "last_seen"]);
19
19
  z.enum(["open", "resolved", "muted", "all"]);
20
20
  var dateTimeSchema = z.string().datetime();
21
21
  var uuidSchema = z.string().uuid();
22
+ var eventIdSchema = z.string().regex(
23
+ /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/,
24
+ "Invalid event id"
25
+ );
22
26
  z.object({
23
27
  error: z.string(),
24
28
  message: z.string().optional()
@@ -487,19 +491,20 @@ var AuthResource = class extends BaseResource {
487
491
  };
488
492
  var eventSchema = z.object({
489
493
  id: uuidSchema,
490
- event_id: uuidSchema,
491
- issue_id: uuidSchema,
494
+ event_id: eventIdSchema,
495
+ issue_id: uuidSchema.nullable(),
492
496
  title: z.string(),
493
497
  timestamp: dateTimeSchema,
494
498
  level: z.string(),
495
499
  platform: z.string(),
496
500
  release: z.string(),
497
- environment: z.string()
501
+ environment: z.string(),
502
+ event_type: z.string()
498
503
  });
499
504
  var eventDetailSchema = z.object({
500
505
  id: uuidSchema,
501
- event_id: uuidSchema,
502
- issue_id: uuidSchema,
506
+ event_id: eventIdSchema,
507
+ issue_id: uuidSchema.nullable(),
503
508
  title: z.string(),
504
509
  timestamp: dateTimeSchema,
505
510
  ingested_at: dateTimeSchema,
@@ -510,6 +515,7 @@ var eventDetailSchema = z.object({
510
515
  server_name: z.string(),
511
516
  sdk_name: z.string(),
512
517
  sdk_version: z.string(),
518
+ event_type: z.string(),
513
519
  data: z.record(z.string(), z.any())
514
520
  // Full Sentry event JSON
515
521
  });
@@ -612,6 +618,32 @@ var authTokenCreatedSchema = z.object({
612
618
  var createAuthTokenSchema = z.object({
613
619
  description: z.string().optional()
614
620
  });
621
+ var transactionSchema = z.object({
622
+ id: uuidSchema,
623
+ event_id: eventIdSchema,
624
+ transaction_name: z.string(),
625
+ timestamp: dateTimeSchema,
626
+ start_timestamp: dateTimeSchema.nullable(),
627
+ duration_ms: z.number().nullable(),
628
+ platform: z.string(),
629
+ environment: z.string(),
630
+ release: z.string(),
631
+ ingested_at: dateTimeSchema
632
+ });
633
+ var transactionDetailSchema = z.object({
634
+ id: uuidSchema,
635
+ event_id: eventIdSchema,
636
+ transaction_name: z.string(),
637
+ timestamp: dateTimeSchema,
638
+ start_timestamp: dateTimeSchema.nullable(),
639
+ duration_ms: z.number().nullable(),
640
+ platform: z.string(),
641
+ environment: z.string(),
642
+ release: z.string(),
643
+ ingested_at: dateTimeSchema,
644
+ data: z.record(z.string(), z.any())
645
+ // Full Sentry transaction payload
646
+ });
615
647
 
616
648
  // src/resources/events.ts
617
649
  var EventsResource = class extends BaseResource {
@@ -939,6 +971,31 @@ var TokensResource = class extends BaseResource {
939
971
  await this.http.delete(`api/tokens/${id}`);
940
972
  }
941
973
  };
974
+
975
+ // src/resources/transactions.ts
976
+ var TransactionsResource = class extends BaseResource {
977
+ /**
978
+ * List transactions for a project with cursor-based pagination (newest first)
979
+ */
980
+ async list(projectId, options) {
981
+ const searchParams = {};
982
+ if (options?.cursor) {
983
+ searchParams.cursor = options.cursor;
984
+ }
985
+ const data = await this.http.get(`api/projects/${projectId}/transactions`, {
986
+ searchParams
987
+ }).json();
988
+ return this.validate(data, paginatedResponseSchema(transactionSchema));
989
+ }
990
+ /**
991
+ * Get a single transaction by ID with its full Sentry payload (spans,
992
+ * contexts.trace, measurements, tags) for the performance detail view.
993
+ */
994
+ async get(projectId, transactionId) {
995
+ const data = await this.http.get(`api/projects/${projectId}/transactions/${transactionId}`).json();
996
+ return this.validate(data, transactionDetailSchema);
997
+ }
998
+ };
942
999
  function transformHttpError(error) {
943
1000
  const { response } = error;
944
1001
  const status = response.status;
@@ -1054,6 +1111,10 @@ var RustrakClient = class {
1054
1111
  * Sessions API resource (release health)
1055
1112
  */
1056
1113
  sessions;
1114
+ /**
1115
+ * Transactions API resource (performance monitoring)
1116
+ */
1117
+ transactions;
1057
1118
  /**
1058
1119
  * Health API resource (version info)
1059
1120
  */
@@ -1077,6 +1138,7 @@ var RustrakClient = class {
1077
1138
  this.invitations = new InvitationsResource(this.http);
1078
1139
  this.members = new MembersResource(this.http);
1079
1140
  this.sessions = new SessionsResource(this.http);
1141
+ this.transactions = new TransactionsResource(this.http);
1080
1142
  this.health = new HealthResource(this.http);
1081
1143
  }
1082
1144
  };