@rustrak/client 0.3.4 → 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 +90 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -3
- package/dist/index.d.ts +41 -3
- package/dist/index.js +90 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -334,7 +334,13 @@ interface ListProjectsOptions {
|
|
|
334
334
|
order?: SortOrder;
|
|
335
335
|
}
|
|
336
336
|
interface ListTransactionsOptions {
|
|
337
|
-
|
|
337
|
+
page?: number;
|
|
338
|
+
per_page?: number;
|
|
339
|
+
name?: string;
|
|
340
|
+
op?: string;
|
|
341
|
+
status?: string;
|
|
342
|
+
environment?: string;
|
|
343
|
+
release?: string;
|
|
338
344
|
}
|
|
339
345
|
|
|
340
346
|
declare const eventSchema: z.ZodObject<{
|
|
@@ -583,9 +589,35 @@ declare const transactionDetailSchema: z.ZodObject<{
|
|
|
583
589
|
ingested_at: z.ZodString;
|
|
584
590
|
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
585
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>;
|
|
586
616
|
|
|
587
617
|
type Transaction = z.infer<typeof transactionSchema>;
|
|
588
618
|
type TransactionDetail = z.infer<typeof transactionDetailSchema>;
|
|
619
|
+
type Span = z.infer<typeof spanSchema>;
|
|
620
|
+
type TransactionStats = z.infer<typeof transactionStatsSchema>;
|
|
589
621
|
|
|
590
622
|
declare class EventsResource extends BaseResource {
|
|
591
623
|
list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
|
|
@@ -651,7 +683,13 @@ declare class TokensResource extends BaseResource {
|
|
|
651
683
|
}
|
|
652
684
|
|
|
653
685
|
declare class TransactionsResource extends BaseResource {
|
|
654
|
-
list(projectId: number, options?: ListTransactionsOptions): Promise<
|
|
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>;
|
|
655
693
|
get(projectId: number, transactionId: string): Promise<TransactionDetail>;
|
|
656
694
|
}
|
|
657
695
|
|
|
@@ -714,4 +752,4 @@ declare class ValidationError extends RustrakError {
|
|
|
714
752
|
getValidationDetails(): string;
|
|
715
753
|
}
|
|
716
754
|
|
|
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 };
|
|
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
|
@@ -334,7 +334,13 @@ interface ListProjectsOptions {
|
|
|
334
334
|
order?: SortOrder;
|
|
335
335
|
}
|
|
336
336
|
interface ListTransactionsOptions {
|
|
337
|
-
|
|
337
|
+
page?: number;
|
|
338
|
+
per_page?: number;
|
|
339
|
+
name?: string;
|
|
340
|
+
op?: string;
|
|
341
|
+
status?: string;
|
|
342
|
+
environment?: string;
|
|
343
|
+
release?: string;
|
|
338
344
|
}
|
|
339
345
|
|
|
340
346
|
declare const eventSchema: z.ZodObject<{
|
|
@@ -583,9 +589,35 @@ declare const transactionDetailSchema: z.ZodObject<{
|
|
|
583
589
|
ingested_at: z.ZodString;
|
|
584
590
|
data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
585
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>;
|
|
586
616
|
|
|
587
617
|
type Transaction = z.infer<typeof transactionSchema>;
|
|
588
618
|
type TransactionDetail = z.infer<typeof transactionDetailSchema>;
|
|
619
|
+
type Span = z.infer<typeof spanSchema>;
|
|
620
|
+
type TransactionStats = z.infer<typeof transactionStatsSchema>;
|
|
589
621
|
|
|
590
622
|
declare class EventsResource extends BaseResource {
|
|
591
623
|
list(projectId: number, issueId: string, options?: ListEventsOptions): Promise<PaginatedResponse<Event>>;
|
|
@@ -651,7 +683,13 @@ declare class TokensResource extends BaseResource {
|
|
|
651
683
|
}
|
|
652
684
|
|
|
653
685
|
declare class TransactionsResource extends BaseResource {
|
|
654
|
-
list(projectId: number, options?: ListTransactionsOptions): Promise<
|
|
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>;
|
|
655
693
|
get(projectId: number, transactionId: string): Promise<TransactionDetail>;
|
|
656
694
|
}
|
|
657
695
|
|
|
@@ -714,4 +752,4 @@ declare class ValidationError extends RustrakError {
|
|
|
714
752
|
getValidationDetails(): string;
|
|
715
753
|
}
|
|
716
754
|
|
|
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 };
|
|
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,21 +995,81 @@ 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
|
-
* List transactions for a project with
|
|
1000
|
+
* List transactions for a project with offset-based pagination (newest first)
|
|
979
1001
|
*/
|
|
980
1002
|
async list(projectId, options) {
|
|
981
1003
|
const searchParams = {};
|
|
982
|
-
if (options?.
|
|
983
|
-
searchParams.
|
|
1004
|
+
if (options?.page) {
|
|
1005
|
+
searchParams.page = String(options.page);
|
|
1006
|
+
}
|
|
1007
|
+
if (options?.per_page) {
|
|
1008
|
+
searchParams.per_page = String(options.per_page);
|
|
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;
|
|
984
1024
|
}
|
|
985
1025
|
const data = await this.http.get(`api/projects/${projectId}/transactions`, {
|
|
986
1026
|
searchParams
|
|
987
1027
|
}).json();
|
|
988
|
-
return this.validate(
|
|
1028
|
+
return this.validate(
|
|
1029
|
+
data,
|
|
1030
|
+
offsetPaginatedResponseSchema(transactionSchema)
|
|
1031
|
+
);
|
|
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);
|
|
989
1073
|
}
|
|
990
1074
|
/**
|
|
991
1075
|
* Get a single transaction by ID with its full Sentry payload (spans,
|