@rustrak/client 0.3.3 → 0.3.5

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,27 @@ interface ListProjectsOptions {
333
333
  per_page?: number;
334
334
  order?: SortOrder;
335
335
  }
336
+ interface ListTransactionsOptions {
337
+ page?: number;
338
+ per_page?: number;
339
+ }
336
340
 
337
341
  declare const eventSchema: z.ZodObject<{
338
342
  id: z.ZodString;
339
343
  event_id: z.ZodString;
340
- issue_id: z.ZodString;
344
+ issue_id: z.ZodNullable<z.ZodString>;
341
345
  title: z.ZodString;
342
346
  timestamp: z.ZodString;
343
347
  level: z.ZodString;
344
348
  platform: z.ZodString;
345
349
  release: z.ZodString;
346
350
  environment: z.ZodString;
351
+ event_type: z.ZodString;
347
352
  }, z.core.$strip>;
348
353
  declare const eventDetailSchema: z.ZodObject<{
349
354
  id: z.ZodString;
350
355
  event_id: z.ZodString;
351
- issue_id: z.ZodString;
356
+ issue_id: z.ZodNullable<z.ZodString>;
352
357
  title: z.ZodString;
353
358
  timestamp: z.ZodString;
354
359
  ingested_at: z.ZodString;
@@ -359,6 +364,7 @@ declare const eventDetailSchema: z.ZodObject<{
359
364
  server_name: z.ZodString;
360
365
  sdk_name: z.ZodString;
361
366
  sdk_version: z.ZodString;
367
+ event_type: z.ZodString;
362
368
  data: z.ZodRecord<z.ZodString, z.ZodAny>;
363
369
  }, z.core.$strip>;
364
370
 
@@ -553,6 +559,35 @@ type AuthToken = z.infer<typeof authTokenSchema>;
553
559
  type AuthTokenCreated = z.infer<typeof authTokenCreatedSchema>;
554
560
  type CreateAuthToken = z.infer<typeof createAuthTokenSchema>;
555
561
 
562
+ declare const transactionSchema: z.ZodObject<{
563
+ id: z.ZodString;
564
+ event_id: z.ZodString;
565
+ transaction_name: z.ZodString;
566
+ timestamp: z.ZodString;
567
+ start_timestamp: z.ZodNullable<z.ZodString>;
568
+ duration_ms: z.ZodNullable<z.ZodNumber>;
569
+ platform: z.ZodString;
570
+ environment: z.ZodString;
571
+ release: z.ZodString;
572
+ ingested_at: z.ZodString;
573
+ }, z.core.$strip>;
574
+ declare const transactionDetailSchema: z.ZodObject<{
575
+ id: z.ZodString;
576
+ event_id: z.ZodString;
577
+ transaction_name: z.ZodString;
578
+ timestamp: z.ZodString;
579
+ start_timestamp: z.ZodNullable<z.ZodString>;
580
+ duration_ms: z.ZodNullable<z.ZodNumber>;
581
+ platform: z.ZodString;
582
+ environment: z.ZodString;
583
+ release: z.ZodString;
584
+ ingested_at: z.ZodString;
585
+ data: z.ZodRecord<z.ZodString, z.ZodAny>;
586
+ }, z.core.$strip>;
587
+
588
+ type Transaction = z.infer<typeof transactionSchema>;
589
+ type TransactionDetail = z.infer<typeof transactionDetailSchema>;
590
+
556
591
  declare class EventsResource extends BaseResource {
557
592
  list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
558
593
  get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
@@ -616,6 +651,11 @@ declare class TokensResource extends BaseResource {
616
651
  delete(id: number): Promise<void>;
617
652
  }
618
653
 
654
+ declare class TransactionsResource extends BaseResource {
655
+ list(projectId: number, options?: ListTransactionsOptions): Promise<OffsetPaginatedResponse<Transaction>>;
656
+ get(projectId: number, transactionId: string): Promise<TransactionDetail>;
657
+ }
658
+
619
659
  declare class RustrakClient {
620
660
  private readonly http;
621
661
  readonly auth: AuthResource;
@@ -630,6 +670,7 @@ declare class RustrakClient {
630
670
  readonly invitations: InvitationsResource;
631
671
  readonly members: MembersResource;
632
672
  readonly sessions: SessionsResource;
673
+ readonly transactions: TransactionsResource;
633
674
  readonly health: HealthResource;
634
675
  constructor(config: ClientConfig);
635
676
  }
@@ -674,4 +715,4 @@ declare class ValidationError extends RustrakError {
674
715
  getValidationDetails(): string;
675
716
  }
676
717
 
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 };
718
+ 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,27 @@ interface ListProjectsOptions {
333
333
  per_page?: number;
334
334
  order?: SortOrder;
335
335
  }
336
+ interface ListTransactionsOptions {
337
+ page?: number;
338
+ per_page?: number;
339
+ }
336
340
 
337
341
  declare const eventSchema: z.ZodObject<{
338
342
  id: z.ZodString;
339
343
  event_id: z.ZodString;
340
- issue_id: z.ZodString;
344
+ issue_id: z.ZodNullable<z.ZodString>;
341
345
  title: z.ZodString;
342
346
  timestamp: z.ZodString;
343
347
  level: z.ZodString;
344
348
  platform: z.ZodString;
345
349
  release: z.ZodString;
346
350
  environment: z.ZodString;
351
+ event_type: z.ZodString;
347
352
  }, z.core.$strip>;
348
353
  declare const eventDetailSchema: z.ZodObject<{
349
354
  id: z.ZodString;
350
355
  event_id: z.ZodString;
351
- issue_id: z.ZodString;
356
+ issue_id: z.ZodNullable<z.ZodString>;
352
357
  title: z.ZodString;
353
358
  timestamp: z.ZodString;
354
359
  ingested_at: z.ZodString;
@@ -359,6 +364,7 @@ declare const eventDetailSchema: z.ZodObject<{
359
364
  server_name: z.ZodString;
360
365
  sdk_name: z.ZodString;
361
366
  sdk_version: z.ZodString;
367
+ event_type: z.ZodString;
362
368
  data: z.ZodRecord<z.ZodString, z.ZodAny>;
363
369
  }, z.core.$strip>;
364
370
 
@@ -553,6 +559,35 @@ type AuthToken = z.infer<typeof authTokenSchema>;
553
559
  type AuthTokenCreated = z.infer<typeof authTokenCreatedSchema>;
554
560
  type CreateAuthToken = z.infer<typeof createAuthTokenSchema>;
555
561
 
562
+ declare const transactionSchema: z.ZodObject<{
563
+ id: z.ZodString;
564
+ event_id: z.ZodString;
565
+ transaction_name: z.ZodString;
566
+ timestamp: z.ZodString;
567
+ start_timestamp: z.ZodNullable<z.ZodString>;
568
+ duration_ms: z.ZodNullable<z.ZodNumber>;
569
+ platform: z.ZodString;
570
+ environment: z.ZodString;
571
+ release: z.ZodString;
572
+ ingested_at: z.ZodString;
573
+ }, z.core.$strip>;
574
+ declare const transactionDetailSchema: z.ZodObject<{
575
+ id: z.ZodString;
576
+ event_id: z.ZodString;
577
+ transaction_name: z.ZodString;
578
+ timestamp: z.ZodString;
579
+ start_timestamp: z.ZodNullable<z.ZodString>;
580
+ duration_ms: z.ZodNullable<z.ZodNumber>;
581
+ platform: z.ZodString;
582
+ environment: z.ZodString;
583
+ release: z.ZodString;
584
+ ingested_at: z.ZodString;
585
+ data: z.ZodRecord<z.ZodString, z.ZodAny>;
586
+ }, z.core.$strip>;
587
+
588
+ type Transaction = z.infer<typeof transactionSchema>;
589
+ type TransactionDetail = z.infer<typeof transactionDetailSchema>;
590
+
556
591
  declare class EventsResource extends BaseResource {
557
592
  list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
558
593
  get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
@@ -616,6 +651,11 @@ declare class TokensResource extends BaseResource {
616
651
  delete(id: number): Promise<void>;
617
652
  }
618
653
 
654
+ declare class TransactionsResource extends BaseResource {
655
+ list(projectId: number, options?: ListTransactionsOptions): Promise<OffsetPaginatedResponse<Transaction>>;
656
+ get(projectId: number, transactionId: string): Promise<TransactionDetail>;
657
+ }
658
+
619
659
  declare class RustrakClient {
620
660
  private readonly http;
621
661
  readonly auth: AuthResource;
@@ -630,6 +670,7 @@ declare class RustrakClient {
630
670
  readonly invitations: InvitationsResource;
631
671
  readonly members: MembersResource;
632
672
  readonly sessions: SessionsResource;
673
+ readonly transactions: TransactionsResource;
633
674
  readonly health: HealthResource;
634
675
  constructor(config: ClientConfig);
635
676
  }
@@ -674,4 +715,4 @@ declare class ValidationError extends RustrakError {
674
715
  getValidationDetails(): string;
675
716
  }
676
717
 
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 };
718
+ 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,37 @@ 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 offset-based pagination (newest first)
979
+ */
980
+ async list(projectId, options) {
981
+ const searchParams = {};
982
+ if (options?.page) {
983
+ searchParams.page = String(options.page);
984
+ }
985
+ if (options?.per_page) {
986
+ searchParams.per_page = String(options.per_page);
987
+ }
988
+ const data = await this.http.get(`api/projects/${projectId}/transactions`, {
989
+ searchParams
990
+ }).json();
991
+ return this.validate(
992
+ data,
993
+ offsetPaginatedResponseSchema(transactionSchema)
994
+ );
995
+ }
996
+ /**
997
+ * Get a single transaction by ID with its full Sentry payload (spans,
998
+ * contexts.trace, measurements, tags) for the performance detail view.
999
+ */
1000
+ async get(projectId, transactionId) {
1001
+ const data = await this.http.get(`api/projects/${projectId}/transactions/${transactionId}`).json();
1002
+ return this.validate(data, transactionDetailSchema);
1003
+ }
1004
+ };
942
1005
  function transformHttpError(error) {
943
1006
  const { response } = error;
944
1007
  const status = response.status;
@@ -1054,6 +1117,10 @@ var RustrakClient = class {
1054
1117
  * Sessions API resource (release health)
1055
1118
  */
1056
1119
  sessions;
1120
+ /**
1121
+ * Transactions API resource (performance monitoring)
1122
+ */
1123
+ transactions;
1057
1124
  /**
1058
1125
  * Health API resource (version info)
1059
1126
  */
@@ -1077,6 +1144,7 @@ var RustrakClient = class {
1077
1144
  this.invitations = new InvitationsResource(this.http);
1078
1145
  this.members = new MembersResource(this.http);
1079
1146
  this.sessions = new SessionsResource(this.http);
1147
+ this.transactions = new TransactionsResource(this.http);
1080
1148
  this.health = new HealthResource(this.http);
1081
1149
  }
1082
1150
  };