@rustrak/client 0.3.5 → 0.3.6
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 +80 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +38 -1
- package/dist/index.d.ts +38 -1
- package/dist/index.js +80 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -336,6 +336,11 @@ interface ListProjectsOptions {
|
|
|
336
336
|
interface ListTransactionsOptions {
|
|
337
337
|
page?: number;
|
|
338
338
|
per_page?: number;
|
|
339
|
+
name?: string;
|
|
340
|
+
op?: string;
|
|
341
|
+
status?: string;
|
|
342
|
+
environment?: string;
|
|
343
|
+
release?: string;
|
|
339
344
|
}
|
|
340
345
|
|
|
341
346
|
declare const eventSchema: z.ZodObject<{
|
|
@@ -584,9 +589,35 @@ declare const transactionDetailSchema: z.ZodObject<{
|
|
|
584
589
|
ingested_at: z.ZodString;
|
|
585
590
|
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
586
591
|
}, z.core.$strip>;
|
|
592
|
+
declare const spanSchema: z.ZodObject<{
|
|
593
|
+
id: z.ZodString;
|
|
594
|
+
span_id: z.ZodNullable<z.ZodString>;
|
|
595
|
+
trace_id: z.ZodNullable<z.ZodString>;
|
|
596
|
+
parent_span_id: z.ZodNullable<z.ZodString>;
|
|
597
|
+
op: z.ZodNullable<z.ZodString>;
|
|
598
|
+
description: z.ZodNullable<z.ZodString>;
|
|
599
|
+
status: z.ZodNullable<z.ZodString>;
|
|
600
|
+
start_timestamp: z.ZodNullable<z.ZodString>;
|
|
601
|
+
timestamp: z.ZodNullable<z.ZodString>;
|
|
602
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
603
|
+
exclusive_time_ms: z.ZodNullable<z.ZodNumber>;
|
|
604
|
+
is_segment: z.ZodBoolean;
|
|
605
|
+
segment_id: z.ZodNullable<z.ZodString>;
|
|
606
|
+
}, z.core.$strip>;
|
|
607
|
+
declare const transactionStatsSchema: z.ZodObject<{
|
|
608
|
+
transaction_name: z.ZodString;
|
|
609
|
+
op: z.ZodNullable<z.ZodString>;
|
|
610
|
+
count: z.ZodNumber;
|
|
611
|
+
p50_ms: z.ZodNumber;
|
|
612
|
+
p95_ms: z.ZodNumber;
|
|
613
|
+
p99_ms: z.ZodNumber;
|
|
614
|
+
failure_rate: z.ZodNumber;
|
|
615
|
+
}, z.core.$strip>;
|
|
587
616
|
|
|
588
617
|
type Transaction = z.infer<typeof transactionSchema>;
|
|
589
618
|
type TransactionDetail = z.infer<typeof transactionDetailSchema>;
|
|
619
|
+
type Span = z.infer<typeof spanSchema>;
|
|
620
|
+
type TransactionStats = z.infer<typeof transactionStatsSchema>;
|
|
590
621
|
|
|
591
622
|
declare class EventsResource extends BaseResource {
|
|
592
623
|
list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
|
|
@@ -653,6 +684,12 @@ declare class TokensResource extends BaseResource {
|
|
|
653
684
|
|
|
654
685
|
declare class TransactionsResource extends BaseResource {
|
|
655
686
|
list(projectId: number, options?: ListTransactionsOptions): Promise<OffsetPaginatedResponse<Transaction>>;
|
|
687
|
+
getSpans(projectId: number, transactionId: string): Promise<Span[]>;
|
|
688
|
+
getStats(projectId: number, options?: {
|
|
689
|
+
page?: number;
|
|
690
|
+
per_page?: number;
|
|
691
|
+
}): Promise<OffsetPaginatedResponse<TransactionStats>>;
|
|
692
|
+
getStatForGroup(projectId: number, name: string, op?: string): Promise<TransactionStats>;
|
|
656
693
|
get(projectId: number, transactionId: string): Promise<TransactionDetail>;
|
|
657
694
|
}
|
|
658
695
|
|
|
@@ -715,4 +752,4 @@ declare class ValidationError extends RustrakError {
|
|
|
715
752
|
getValidationDetails(): string;
|
|
716
753
|
}
|
|
717
754
|
|
|
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 };
|
|
755
|
+
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 Span, 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, ValidationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -336,6 +336,11 @@ interface ListProjectsOptions {
|
|
|
336
336
|
interface ListTransactionsOptions {
|
|
337
337
|
page?: number;
|
|
338
338
|
per_page?: number;
|
|
339
|
+
name?: string;
|
|
340
|
+
op?: string;
|
|
341
|
+
status?: string;
|
|
342
|
+
environment?: string;
|
|
343
|
+
release?: string;
|
|
339
344
|
}
|
|
340
345
|
|
|
341
346
|
declare const eventSchema: z.ZodObject<{
|
|
@@ -584,9 +589,35 @@ declare const transactionDetailSchema: z.ZodObject<{
|
|
|
584
589
|
ingested_at: z.ZodString;
|
|
585
590
|
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
586
591
|
}, z.core.$strip>;
|
|
592
|
+
declare const spanSchema: z.ZodObject<{
|
|
593
|
+
id: z.ZodString;
|
|
594
|
+
span_id: z.ZodNullable<z.ZodString>;
|
|
595
|
+
trace_id: z.ZodNullable<z.ZodString>;
|
|
596
|
+
parent_span_id: z.ZodNullable<z.ZodString>;
|
|
597
|
+
op: z.ZodNullable<z.ZodString>;
|
|
598
|
+
description: z.ZodNullable<z.ZodString>;
|
|
599
|
+
status: z.ZodNullable<z.ZodString>;
|
|
600
|
+
start_timestamp: z.ZodNullable<z.ZodString>;
|
|
601
|
+
timestamp: z.ZodNullable<z.ZodString>;
|
|
602
|
+
duration_ms: z.ZodNullable<z.ZodNumber>;
|
|
603
|
+
exclusive_time_ms: z.ZodNullable<z.ZodNumber>;
|
|
604
|
+
is_segment: z.ZodBoolean;
|
|
605
|
+
segment_id: z.ZodNullable<z.ZodString>;
|
|
606
|
+
}, z.core.$strip>;
|
|
607
|
+
declare const transactionStatsSchema: z.ZodObject<{
|
|
608
|
+
transaction_name: z.ZodString;
|
|
609
|
+
op: z.ZodNullable<z.ZodString>;
|
|
610
|
+
count: z.ZodNumber;
|
|
611
|
+
p50_ms: z.ZodNumber;
|
|
612
|
+
p95_ms: z.ZodNumber;
|
|
613
|
+
p99_ms: z.ZodNumber;
|
|
614
|
+
failure_rate: z.ZodNumber;
|
|
615
|
+
}, z.core.$strip>;
|
|
587
616
|
|
|
588
617
|
type Transaction = z.infer<typeof transactionSchema>;
|
|
589
618
|
type TransactionDetail = z.infer<typeof transactionDetailSchema>;
|
|
619
|
+
type Span = z.infer<typeof spanSchema>;
|
|
620
|
+
type TransactionStats = z.infer<typeof transactionStatsSchema>;
|
|
590
621
|
|
|
591
622
|
declare class EventsResource extends BaseResource {
|
|
592
623
|
list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
|
|
@@ -653,6 +684,12 @@ declare class TokensResource extends BaseResource {
|
|
|
653
684
|
|
|
654
685
|
declare class TransactionsResource extends BaseResource {
|
|
655
686
|
list(projectId: number, options?: ListTransactionsOptions): Promise<OffsetPaginatedResponse<Transaction>>;
|
|
687
|
+
getSpans(projectId: number, transactionId: string): Promise<Span[]>;
|
|
688
|
+
getStats(projectId: number, options?: {
|
|
689
|
+
page?: number;
|
|
690
|
+
per_page?: number;
|
|
691
|
+
}): Promise<OffsetPaginatedResponse<TransactionStats>>;
|
|
692
|
+
getStatForGroup(projectId: number, name: string, op?: string): Promise<TransactionStats>;
|
|
656
693
|
get(projectId: number, transactionId: string): Promise<TransactionDetail>;
|
|
657
694
|
}
|
|
658
695
|
|
|
@@ -715,4 +752,4 @@ declare class ValidationError extends RustrakError {
|
|
|
715
752
|
getValidationDetails(): string;
|
|
716
753
|
}
|
|
717
754
|
|
|
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 };
|
|
755
|
+
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 Span, 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, ValidationError };
|
package/dist/index.js
CHANGED
|
@@ -644,6 +644,30 @@ var transactionDetailSchema = z.object({
|
|
|
644
644
|
data: z.record(z.string(), z.any())
|
|
645
645
|
// Full Sentry transaction payload
|
|
646
646
|
});
|
|
647
|
+
var spanSchema = z.object({
|
|
648
|
+
id: uuidSchema,
|
|
649
|
+
span_id: z.string().nullable(),
|
|
650
|
+
trace_id: z.string().nullable(),
|
|
651
|
+
parent_span_id: z.string().nullable(),
|
|
652
|
+
op: z.string().nullable(),
|
|
653
|
+
description: z.string().nullable(),
|
|
654
|
+
status: z.string().nullable(),
|
|
655
|
+
start_timestamp: dateTimeSchema.nullable(),
|
|
656
|
+
timestamp: dateTimeSchema.nullable(),
|
|
657
|
+
duration_ms: z.number().nullable(),
|
|
658
|
+
exclusive_time_ms: z.number().nullable(),
|
|
659
|
+
is_segment: z.boolean(),
|
|
660
|
+
segment_id: z.string().nullable()
|
|
661
|
+
});
|
|
662
|
+
var transactionStatsSchema = z.object({
|
|
663
|
+
transaction_name: z.string(),
|
|
664
|
+
op: z.string().nullable(),
|
|
665
|
+
count: z.number().int(),
|
|
666
|
+
p50_ms: z.number(),
|
|
667
|
+
p95_ms: z.number(),
|
|
668
|
+
p99_ms: z.number(),
|
|
669
|
+
failure_rate: z.number()
|
|
670
|
+
});
|
|
647
671
|
|
|
648
672
|
// src/resources/events.ts
|
|
649
673
|
var EventsResource = class extends BaseResource {
|
|
@@ -971,8 +995,6 @@ var TokensResource = class extends BaseResource {
|
|
|
971
995
|
await this.http.delete(`api/tokens/${id}`);
|
|
972
996
|
}
|
|
973
997
|
};
|
|
974
|
-
|
|
975
|
-
// src/resources/transactions.ts
|
|
976
998
|
var TransactionsResource = class extends BaseResource {
|
|
977
999
|
/**
|
|
978
1000
|
* List transactions for a project with offset-based pagination (newest first)
|
|
@@ -985,6 +1007,21 @@ var TransactionsResource = class extends BaseResource {
|
|
|
985
1007
|
if (options?.per_page) {
|
|
986
1008
|
searchParams.per_page = String(options.per_page);
|
|
987
1009
|
}
|
|
1010
|
+
if (options?.name) {
|
|
1011
|
+
searchParams.name = options.name;
|
|
1012
|
+
}
|
|
1013
|
+
if (options?.op) {
|
|
1014
|
+
searchParams.op = options.op;
|
|
1015
|
+
}
|
|
1016
|
+
if (options?.status) {
|
|
1017
|
+
searchParams.status = options.status;
|
|
1018
|
+
}
|
|
1019
|
+
if (options?.environment) {
|
|
1020
|
+
searchParams.environment = options.environment;
|
|
1021
|
+
}
|
|
1022
|
+
if (options?.release) {
|
|
1023
|
+
searchParams.release = options.release;
|
|
1024
|
+
}
|
|
988
1025
|
const data = await this.http.get(`api/projects/${projectId}/transactions`, {
|
|
989
1026
|
searchParams
|
|
990
1027
|
}).json();
|
|
@@ -993,6 +1030,47 @@ var TransactionsResource = class extends BaseResource {
|
|
|
993
1030
|
offsetPaginatedResponseSchema(transactionSchema)
|
|
994
1031
|
);
|
|
995
1032
|
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Get the indexed spans extracted from a transaction, in waterfall order.
|
|
1035
|
+
*/
|
|
1036
|
+
async getSpans(projectId, transactionId) {
|
|
1037
|
+
const data = await this.http.get(`api/projects/${projectId}/transactions/${transactionId}/spans`).json();
|
|
1038
|
+
return this.validate(data, z.array(spanSchema));
|
|
1039
|
+
}
|
|
1040
|
+
/**
|
|
1041
|
+
* Get aggregate performance stats (count, p50/p95/p99 latency, failure rate)
|
|
1042
|
+
* grouped by transaction name + op, most frequent first, with offset-based
|
|
1043
|
+
* pagination — same shape as the other list endpoints.
|
|
1044
|
+
*/
|
|
1045
|
+
async getStats(projectId, options) {
|
|
1046
|
+
const searchParams = {};
|
|
1047
|
+
if (options?.page) {
|
|
1048
|
+
searchParams.page = String(options.page);
|
|
1049
|
+
}
|
|
1050
|
+
if (options?.per_page) {
|
|
1051
|
+
searchParams.per_page = String(options.per_page);
|
|
1052
|
+
}
|
|
1053
|
+
const data = await this.http.get(`api/projects/${projectId}/transactions/stats`, { searchParams }).json();
|
|
1054
|
+
return this.validate(
|
|
1055
|
+
data,
|
|
1056
|
+
offsetPaginatedResponseSchema(transactionStatsSchema)
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Get aggregate stats for a single (transaction name, op) group — a direct
|
|
1061
|
+
* lookup that works regardless of how many groups the project has. Throws
|
|
1062
|
+
* NotFoundError when the group has no transactions.
|
|
1063
|
+
*/
|
|
1064
|
+
async getStatForGroup(projectId, name, op) {
|
|
1065
|
+
const searchParams = { name };
|
|
1066
|
+
if (op) {
|
|
1067
|
+
searchParams.op = op;
|
|
1068
|
+
}
|
|
1069
|
+
const data = await this.http.get(`api/projects/${projectId}/transactions/stats/group`, {
|
|
1070
|
+
searchParams
|
|
1071
|
+
}).json();
|
|
1072
|
+
return this.validate(data, transactionStatsSchema);
|
|
1073
|
+
}
|
|
996
1074
|
/**
|
|
997
1075
|
* Get a single transaction by ID with its full Sentry payload (spans,
|
|
998
1076
|
* contexts.trace, measurements, tags) for the performance detail view.
|