@rustrak/client 0.3.10 → 0.3.12
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 +321 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +221 -2
- package/dist/index.d.ts +221 -2
- package/dist/index.js +321 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -21,7 +21,11 @@ var offsetPaginatedResponseSchema = (itemSchema) => zod.z.object({
|
|
|
21
21
|
total_pages: zod.z.number().int()
|
|
22
22
|
});
|
|
23
23
|
zod.z.enum(["asc", "desc"]);
|
|
24
|
-
zod.z.enum([
|
|
24
|
+
zod.z.enum([
|
|
25
|
+
"digest_order",
|
|
26
|
+
"last_seen",
|
|
27
|
+
"event_count"
|
|
28
|
+
]);
|
|
25
29
|
zod.z.enum(["open", "resolved", "muted", "all"]);
|
|
26
30
|
var dateTimeSchema = zod.z.string().datetime();
|
|
27
31
|
var uuidSchema = zod.z.string().uuid();
|
|
@@ -525,24 +529,129 @@ var eventDetailSchema = zod.z.object({
|
|
|
525
529
|
data: zod.z.record(zod.z.string(), zod.z.any())
|
|
526
530
|
// Full Sentry event JSON
|
|
527
531
|
});
|
|
532
|
+
var issueStatusSchema = zod.z.enum(["unresolved", "resolved", "ignored"]);
|
|
533
|
+
var issuePrioritySchema = zod.z.enum(["low", "medium", "high"]);
|
|
528
534
|
var issueSchema = zod.z.object({
|
|
529
535
|
id: uuidSchema,
|
|
530
536
|
project_id: zod.z.number().int(),
|
|
531
537
|
short_id: zod.z.string(),
|
|
532
538
|
title: zod.z.string(),
|
|
533
539
|
value: zod.z.string(),
|
|
540
|
+
culprit: zod.z.string(),
|
|
541
|
+
logger: zod.z.string(),
|
|
534
542
|
first_seen: dateTimeSchema,
|
|
535
543
|
last_seen: dateTimeSchema,
|
|
536
544
|
event_count: zod.z.number().int(),
|
|
537
545
|
level: zod.z.string().nullable(),
|
|
538
546
|
platform: zod.z.string().nullable(),
|
|
547
|
+
// Status model (#165)
|
|
548
|
+
status: issueStatusSchema,
|
|
549
|
+
substatus: zod.z.string().nullable(),
|
|
550
|
+
priority: issuePrioritySchema.nullable(),
|
|
551
|
+
assigned_to: zod.z.number().int().nullable(),
|
|
552
|
+
assignee_type: zod.z.string().nullable(),
|
|
553
|
+
issue_type: zod.z.string(),
|
|
554
|
+
issue_category: zod.z.string(),
|
|
555
|
+
first_release: zod.z.string(),
|
|
556
|
+
last_release: zod.z.string(),
|
|
557
|
+
status_details: zod.z.record(zod.z.string(), zod.z.unknown()),
|
|
558
|
+
// Aggregate enrichment — only the single-issue GET populates this; the list
|
|
559
|
+
// and PATCH endpoints return the lean response, so default to 0 when absent.
|
|
560
|
+
user_report_count: zod.z.number().int().optional().default(0),
|
|
561
|
+
// Per-user fields — only present when the request carries a user session.
|
|
562
|
+
is_bookmarked: zod.z.boolean().optional(),
|
|
563
|
+
is_subscribed: zod.z.boolean().optional(),
|
|
564
|
+
has_seen: zod.z.boolean().optional(),
|
|
565
|
+
// Bulk list stats — only the list endpoint populates these (computed once
|
|
566
|
+
// per page); the single-issue GET and PATCH responses omit them.
|
|
567
|
+
user_count: zod.z.number().int().optional(),
|
|
568
|
+
trend: zod.z.array(zod.z.number().int()).optional(),
|
|
569
|
+
// Deprecated, derived from `status`; kept for backward compatibility.
|
|
539
570
|
is_resolved: zod.z.boolean(),
|
|
540
571
|
is_muted: zod.z.boolean()
|
|
541
572
|
});
|
|
542
573
|
var updateIssueStateSchema = zod.z.object({
|
|
574
|
+
status: zod.z.union([issueStatusSchema, zod.z.literal("resolvedInNextRelease")]).optional(),
|
|
575
|
+
substatus: zod.z.string().optional(),
|
|
576
|
+
priority: issuePrioritySchema.optional(),
|
|
577
|
+
assigned_to: zod.z.number().int().nullable().optional(),
|
|
578
|
+
assignee_type: zod.z.string().nullable().optional(),
|
|
543
579
|
is_resolved: zod.z.boolean().optional(),
|
|
544
580
|
is_muted: zod.z.boolean().optional()
|
|
545
581
|
});
|
|
582
|
+
var issueHashSchema = zod.z.object({
|
|
583
|
+
id: zod.z.number().int(),
|
|
584
|
+
project_id: zod.z.number().int(),
|
|
585
|
+
issue_id: uuidSchema,
|
|
586
|
+
grouping_key: zod.z.string(),
|
|
587
|
+
grouping_key_hash: zod.z.string(),
|
|
588
|
+
created_at: dateTimeSchema
|
|
589
|
+
});
|
|
590
|
+
var tagValueCountSchema = zod.z.object({
|
|
591
|
+
value: zod.z.string(),
|
|
592
|
+
count: zod.z.number().int()
|
|
593
|
+
});
|
|
594
|
+
var issueTagValueSchema = zod.z.object({
|
|
595
|
+
key: zod.z.string(),
|
|
596
|
+
name: zod.z.string(),
|
|
597
|
+
value: zod.z.string(),
|
|
598
|
+
count: zod.z.number().int(),
|
|
599
|
+
first_seen: dateTimeSchema,
|
|
600
|
+
last_seen: dateTimeSchema
|
|
601
|
+
});
|
|
602
|
+
var tagSummarySchema = zod.z.object({
|
|
603
|
+
key: zod.z.string(),
|
|
604
|
+
total_values: zod.z.number().int(),
|
|
605
|
+
top_values: zod.z.array(tagValueCountSchema)
|
|
606
|
+
});
|
|
607
|
+
var issueAggregatesSchema = zod.z.object({
|
|
608
|
+
user_count: zod.z.number().int(),
|
|
609
|
+
tags: zod.z.array(tagSummarySchema)
|
|
610
|
+
});
|
|
611
|
+
zod.z.enum(["24h", "30d"]);
|
|
612
|
+
var issueStatsSchema = zod.z.object({
|
|
613
|
+
data: zod.z.array(zod.z.tuple([zod.z.number(), zod.z.number()]))
|
|
614
|
+
});
|
|
615
|
+
var activityEntrySchema = zod.z.object({
|
|
616
|
+
id: uuidSchema,
|
|
617
|
+
issue_id: uuidSchema,
|
|
618
|
+
user_id: zod.z.number().int().nullable(),
|
|
619
|
+
type: zod.z.string(),
|
|
620
|
+
data: zod.z.string(),
|
|
621
|
+
created_at: dateTimeSchema
|
|
622
|
+
});
|
|
623
|
+
var userReportSchema = zod.z.object({
|
|
624
|
+
id: uuidSchema,
|
|
625
|
+
project_id: zod.z.number().int(),
|
|
626
|
+
issue_id: uuidSchema.nullable(),
|
|
627
|
+
event_id: uuidSchema.nullable(),
|
|
628
|
+
name: zod.z.string(),
|
|
629
|
+
// Server stores '' for anonymous reports (column DEFAULT '' / unwrap_or_default),
|
|
630
|
+
// matching real Sentry's own save_userreport(report.get("email", "")) — accept it.
|
|
631
|
+
email: zod.z.union([zod.z.email(), zod.z.literal("")]),
|
|
632
|
+
comments: zod.z.string(),
|
|
633
|
+
created_at: dateTimeSchema
|
|
634
|
+
});
|
|
635
|
+
var createCommentSchema = zod.z.object({
|
|
636
|
+
text: zod.z.string()
|
|
637
|
+
});
|
|
638
|
+
var createUserReportSchema = zod.z.object({
|
|
639
|
+
name: zod.z.string().optional(),
|
|
640
|
+
email: zod.z.email().optional(),
|
|
641
|
+
comments: zod.z.string().optional(),
|
|
642
|
+
event_id: uuidSchema.optional()
|
|
643
|
+
});
|
|
644
|
+
var bulkUpdateIssuesSchema = zod.z.object({
|
|
645
|
+
ids: zod.z.array(uuidSchema),
|
|
646
|
+
status: zod.z.union([issueStatusSchema, zod.z.literal("resolvedInNextRelease")]).optional(),
|
|
647
|
+
priority: issuePrioritySchema.optional()
|
|
648
|
+
});
|
|
649
|
+
var bulkDeleteIssuesSchema = zod.z.object({
|
|
650
|
+
ids: zod.z.array(uuidSchema)
|
|
651
|
+
});
|
|
652
|
+
var createDeploySchema = zod.z.object({
|
|
653
|
+
version: zod.z.string()
|
|
654
|
+
});
|
|
546
655
|
var logSchema = zod.z.object({
|
|
547
656
|
id: uuidSchema,
|
|
548
657
|
trace_id: zod.z.string().nullable(),
|
|
@@ -575,7 +684,8 @@ var projectSchema = zod.z.object({
|
|
|
575
684
|
stored_event_count: zod.z.number().int(),
|
|
576
685
|
digested_event_count: zod.z.number().int(),
|
|
577
686
|
created_at: dateTimeSchema,
|
|
578
|
-
updated_at: dateTimeSchema
|
|
687
|
+
updated_at: dateTimeSchema,
|
|
688
|
+
platform: zod.z.string().nullable()
|
|
579
689
|
});
|
|
580
690
|
var createProjectSchema = zod.z.object({
|
|
581
691
|
name: zod.z.string().min(1),
|
|
@@ -596,6 +706,22 @@ var releaseHealthRowSchema = zod.z.object({
|
|
|
596
706
|
crash_free_users_rate: zod.z.number().nullable()
|
|
597
707
|
});
|
|
598
708
|
var releaseHealthSchema = zod.z.array(releaseHealthRowSchema);
|
|
709
|
+
var sessionSummarySchema = zod.z.object({
|
|
710
|
+
total: zod.z.number().int(),
|
|
711
|
+
errored: zod.z.number().int(),
|
|
712
|
+
crashed: zod.z.number().int(),
|
|
713
|
+
abnormal: zod.z.number().int(),
|
|
714
|
+
crash_free_sessions_rate: zod.z.number().nullable(),
|
|
715
|
+
crash_free_users_rate: zod.z.number().nullable(),
|
|
716
|
+
active_releases: zod.z.number().int()
|
|
717
|
+
});
|
|
718
|
+
var sessionTimeseriesPointSchema = zod.z.object({
|
|
719
|
+
bucket: dateTimeSchema,
|
|
720
|
+
total: zod.z.number().int(),
|
|
721
|
+
crashed: zod.z.number().int(),
|
|
722
|
+
crash_free_sessions_rate: zod.z.number().nullable()
|
|
723
|
+
});
|
|
724
|
+
var sessionTimeseriesSchema = zod.z.array(sessionTimeseriesPointSchema);
|
|
599
725
|
var chunkUploadCapabilitySchema = zod.z.object({
|
|
600
726
|
url: zod.z.string(),
|
|
601
727
|
chunkSize: zod.z.number().int(),
|
|
@@ -793,8 +919,6 @@ var InvitationsResource = class extends BaseResource {
|
|
|
793
919
|
await this.http.delete(`api/invitations/${token}`);
|
|
794
920
|
}
|
|
795
921
|
};
|
|
796
|
-
|
|
797
|
-
// src/resources/issues.ts
|
|
798
922
|
var IssuesResource = class extends BaseResource {
|
|
799
923
|
/**
|
|
800
924
|
* List issues for a project with offset-based pagination
|
|
@@ -816,6 +940,9 @@ var IssuesResource = class extends BaseResource {
|
|
|
816
940
|
if (options?.filter) {
|
|
817
941
|
searchParams.filter = options.filter;
|
|
818
942
|
}
|
|
943
|
+
if (options?.q) {
|
|
944
|
+
searchParams.q = options.q;
|
|
945
|
+
}
|
|
819
946
|
const data = await this.http.get(`api/projects/${projectId}/issues`, { searchParams }).json();
|
|
820
947
|
return this.validate(data, offsetPaginatedResponseSchema(issueSchema));
|
|
821
948
|
}
|
|
@@ -827,7 +954,7 @@ var IssuesResource = class extends BaseResource {
|
|
|
827
954
|
return this.validate(data, issueSchema);
|
|
828
955
|
}
|
|
829
956
|
/**
|
|
830
|
-
* Update issue state (
|
|
957
|
+
* Update issue state (status, substatus, priority, assignment, …)
|
|
831
958
|
*/
|
|
832
959
|
async updateState(projectId, issueId, input) {
|
|
833
960
|
const validatedInput = this.validate(input, updateIssueStateSchema);
|
|
@@ -836,12 +963,139 @@ var IssuesResource = class extends BaseResource {
|
|
|
836
963
|
}).json();
|
|
837
964
|
return this.validate(data, issueSchema);
|
|
838
965
|
}
|
|
966
|
+
/**
|
|
967
|
+
* Resolve an issue in the next release (suppresses regression until a deploy).
|
|
968
|
+
*/
|
|
969
|
+
async resolveInNextRelease(projectId, issueId) {
|
|
970
|
+
return this.updateState(projectId, issueId, {
|
|
971
|
+
status: "resolvedInNextRelease"
|
|
972
|
+
});
|
|
973
|
+
}
|
|
839
974
|
/**
|
|
840
975
|
* Delete an issue
|
|
841
976
|
*/
|
|
842
977
|
async delete(projectId, issueId) {
|
|
843
978
|
await this.http.delete(`api/projects/${projectId}/issues/${issueId}`);
|
|
844
979
|
}
|
|
980
|
+
/**
|
|
981
|
+
* Bulk-mutate issues (status and/or priority).
|
|
982
|
+
*/
|
|
983
|
+
async bulkUpdate(projectId, input) {
|
|
984
|
+
const validatedInput = this.validate(input, bulkUpdateIssuesSchema);
|
|
985
|
+
const data = await this.http.put(`api/projects/${projectId}/issues`, { json: validatedInput }).json();
|
|
986
|
+
return this.validate(data, zod.z.object({ updated: zod.z.number().int() }));
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Bulk-delete issues.
|
|
990
|
+
*/
|
|
991
|
+
async bulkDelete(projectId, input) {
|
|
992
|
+
const validatedInput = this.validate(input, bulkDeleteIssuesSchema);
|
|
993
|
+
const data = await this.http.delete(`api/projects/${projectId}/issues`, { json: validatedInput }).json();
|
|
994
|
+
return this.validate(data, zod.z.object({ deleted: zod.z.number().int() }));
|
|
995
|
+
}
|
|
996
|
+
/**
|
|
997
|
+
* List the grouping hashes that map to an issue.
|
|
998
|
+
*/
|
|
999
|
+
async getHashes(projectId, issueId) {
|
|
1000
|
+
const data = await this.http.get(`api/projects/${projectId}/issues/${issueId}/hashes`).json();
|
|
1001
|
+
return this.validate(data, zod.z.array(issueHashSchema));
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* List the distinct values (with counts) for a tag key across the issue.
|
|
1005
|
+
* Returns a bare list, one entry per value (Sentry-compatible shape).
|
|
1006
|
+
*/
|
|
1007
|
+
async getTagValues(projectId, issueId, key) {
|
|
1008
|
+
const data = await this.http.get(
|
|
1009
|
+
`api/projects/${projectId}/issues/${issueId}/tags/${encodeURIComponent(key)}`
|
|
1010
|
+
).json();
|
|
1011
|
+
return this.validate(data, zod.z.array(issueTagValueSchema));
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Fetch per-issue aggregates (unique user count + top tags).
|
|
1015
|
+
*/
|
|
1016
|
+
async getAggregates(projectId, issueId) {
|
|
1017
|
+
const data = await this.http.get(`api/projects/${projectId}/issues/${issueId}/aggregates`).json();
|
|
1018
|
+
return this.validate(data, issueAggregatesSchema);
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Fetch a zero-filled event-count timeseries (24h or 30d).
|
|
1022
|
+
*/
|
|
1023
|
+
async getStats(projectId, issueId, window = "24h") {
|
|
1024
|
+
const data = await this.http.get(`api/projects/${projectId}/issues/${issueId}/stats`, {
|
|
1025
|
+
searchParams: { window }
|
|
1026
|
+
}).json();
|
|
1027
|
+
return this.validate(data, issueStatsSchema);
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* List an issue's activity log (status changes, comments/notes, …).
|
|
1031
|
+
*/
|
|
1032
|
+
async getActivity(projectId, issueId) {
|
|
1033
|
+
const data = await this.http.get(`api/projects/${projectId}/issues/${issueId}/activity`).json();
|
|
1034
|
+
return this.validate(data, zod.z.array(activityEntrySchema));
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Add a comment (note) to an issue.
|
|
1038
|
+
*/
|
|
1039
|
+
async addComment(projectId, issueId, input) {
|
|
1040
|
+
const validatedInput = this.validate(input, createCommentSchema);
|
|
1041
|
+
const data = await this.http.post(`api/projects/${projectId}/issues/${issueId}/comments`, {
|
|
1042
|
+
json: validatedInput
|
|
1043
|
+
}).json();
|
|
1044
|
+
return this.validate(data, activityEntrySchema);
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Set or clear the current user's bookmark on an issue.
|
|
1048
|
+
*/
|
|
1049
|
+
async setBookmark(projectId, issueId, enabled) {
|
|
1050
|
+
const data = await this.http.put(`api/projects/${projectId}/issues/${issueId}/bookmark`, {
|
|
1051
|
+
json: { enabled }
|
|
1052
|
+
}).json();
|
|
1053
|
+
return this.validate(data, zod.z.object({ is_bookmarked: zod.z.boolean() }));
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Set or clear the current user's subscription to an issue.
|
|
1057
|
+
*/
|
|
1058
|
+
async setSubscription(projectId, issueId, enabled) {
|
|
1059
|
+
const data = await this.http.put(`api/projects/${projectId}/issues/${issueId}/subscription`, {
|
|
1060
|
+
json: { enabled }
|
|
1061
|
+
}).json();
|
|
1062
|
+
return this.validate(data, zod.z.object({ is_subscribed: zod.z.boolean() }));
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Mark the issue as seen by the current user.
|
|
1066
|
+
*/
|
|
1067
|
+
async markSeen(projectId, issueId) {
|
|
1068
|
+
const data = await this.http.post(`api/projects/${projectId}/issues/${issueId}/seen`).json();
|
|
1069
|
+
return this.validate(data, zod.z.object({ has_seen: zod.z.boolean() }));
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* List user feedback reports for an issue.
|
|
1073
|
+
*/
|
|
1074
|
+
async listUserReports(projectId, issueId) {
|
|
1075
|
+
const data = await this.http.get(`api/projects/${projectId}/issues/${issueId}/user-reports`).json();
|
|
1076
|
+
return this.validate(data, zod.z.array(userReportSchema));
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Attach a user feedback report to an issue.
|
|
1080
|
+
*/
|
|
1081
|
+
async createUserReport(projectId, issueId, input) {
|
|
1082
|
+
const validatedInput = this.validate(input, createUserReportSchema);
|
|
1083
|
+
const data = await this.http.post(`api/projects/${projectId}/issues/${issueId}/user-reports`, {
|
|
1084
|
+
json: validatedInput
|
|
1085
|
+
}).json();
|
|
1086
|
+
return this.validate(data, userReportSchema);
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Record a deploy of a release, finalizing resolve-in-next-release issues.
|
|
1090
|
+
*/
|
|
1091
|
+
async createDeploy(projectId, input) {
|
|
1092
|
+
const validatedInput = this.validate(input, createDeploySchema);
|
|
1093
|
+
const data = await this.http.post(`api/projects/${projectId}/deploys`, { json: validatedInput }).json();
|
|
1094
|
+
return this.validate(
|
|
1095
|
+
data,
|
|
1096
|
+
zod.z.object({ version: zod.z.string(), finalized: zod.z.number().int() })
|
|
1097
|
+
);
|
|
1098
|
+
}
|
|
845
1099
|
};
|
|
846
1100
|
|
|
847
1101
|
// src/resources/logs.ts
|
|
@@ -951,6 +1205,26 @@ var ProjectsResource = class extends BaseResource {
|
|
|
951
1205
|
await this.http.delete(`api/projects/${id}`);
|
|
952
1206
|
}
|
|
953
1207
|
};
|
|
1208
|
+
var ReleasesResource = class extends BaseResource {
|
|
1209
|
+
/**
|
|
1210
|
+
* Get issues first seen in a given release, most recently introduced first.
|
|
1211
|
+
*
|
|
1212
|
+
* @param projectId - Project ID
|
|
1213
|
+
* @param release - Release version
|
|
1214
|
+
* @param limit - Max issues to return (default: 10, max: 50)
|
|
1215
|
+
*/
|
|
1216
|
+
async newIssues(projectId, release, limit) {
|
|
1217
|
+
const searchParams = {};
|
|
1218
|
+
if (limit !== void 0) {
|
|
1219
|
+
searchParams.limit = limit.toString();
|
|
1220
|
+
}
|
|
1221
|
+
const data = await this.http.get(
|
|
1222
|
+
`api/projects/${projectId}/releases/${encodeURIComponent(release)}/new-issues`,
|
|
1223
|
+
{ searchParams }
|
|
1224
|
+
).json();
|
|
1225
|
+
return this.validate(data, zod.z.array(issueSchema));
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
954
1228
|
|
|
955
1229
|
// src/resources/sessions.ts
|
|
956
1230
|
var SessionsResource = class extends BaseResource {
|
|
@@ -958,15 +1232,51 @@ var SessionsResource = class extends BaseResource {
|
|
|
958
1232
|
* Get per-release health stats for a project.
|
|
959
1233
|
* @param projectId - Project ID
|
|
960
1234
|
* @param period - Time window (e.g. '24h', '7d'). Defaults to '24h'.
|
|
1235
|
+
* @param release - Scope to a single release (all environments), computed
|
|
1236
|
+
* server-side. Omit to get every release in the project.
|
|
961
1237
|
*/
|
|
962
|
-
async stats(projectId, period) {
|
|
1238
|
+
async stats(projectId, period, release) {
|
|
963
1239
|
const searchParams = {};
|
|
964
1240
|
if (period) {
|
|
965
1241
|
searchParams.period = period;
|
|
966
1242
|
}
|
|
1243
|
+
if (release) {
|
|
1244
|
+
searchParams.release = release;
|
|
1245
|
+
}
|
|
967
1246
|
const data = await this.http.get(`api/projects/${projectId}/sessions/stats`, { searchParams }).json();
|
|
968
1247
|
return this.validate(data, releaseHealthSchema);
|
|
969
1248
|
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Get project-wide session health, aggregated across all releases and environments.
|
|
1251
|
+
* @param projectId - Project ID
|
|
1252
|
+
* @param period - Time window (e.g. '24h', '7d'). Defaults to '24h'.
|
|
1253
|
+
*/
|
|
1254
|
+
async summary(projectId, period) {
|
|
1255
|
+
const searchParams = {};
|
|
1256
|
+
if (period) {
|
|
1257
|
+
searchParams.period = period;
|
|
1258
|
+
}
|
|
1259
|
+
const data = await this.http.get(`api/projects/${projectId}/sessions/summary`, { searchParams }).json();
|
|
1260
|
+
return this.validate(data, sessionSummarySchema);
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Get a time-bucketed session trend for a project, aggregated across all
|
|
1264
|
+
* releases and environments.
|
|
1265
|
+
* @param projectId - Project ID
|
|
1266
|
+
* @param period - Time window (e.g. '24h', '7d'). Defaults to '24h'.
|
|
1267
|
+
* @param interval - Bucket width in hours (default: 1, max: 24).
|
|
1268
|
+
*/
|
|
1269
|
+
async timeseries(projectId, period, interval) {
|
|
1270
|
+
const searchParams = {};
|
|
1271
|
+
if (period) {
|
|
1272
|
+
searchParams.period = period;
|
|
1273
|
+
}
|
|
1274
|
+
if (interval !== void 0) {
|
|
1275
|
+
searchParams.interval = interval.toString();
|
|
1276
|
+
}
|
|
1277
|
+
const data = await this.http.get(`api/projects/${projectId}/sessions/timeseries`, { searchParams }).json();
|
|
1278
|
+
return this.validate(data, sessionTimeseriesSchema);
|
|
1279
|
+
}
|
|
970
1280
|
};
|
|
971
1281
|
|
|
972
1282
|
// src/resources/sourcemaps.ts
|
|
@@ -1336,6 +1646,10 @@ var RustrakClient = class {
|
|
|
1336
1646
|
* Sessions API resource (release health)
|
|
1337
1647
|
*/
|
|
1338
1648
|
sessions;
|
|
1649
|
+
/**
|
|
1650
|
+
* Releases API resource (data scoped to a specific release)
|
|
1651
|
+
*/
|
|
1652
|
+
releases;
|
|
1339
1653
|
/**
|
|
1340
1654
|
* Transactions API resource (performance monitoring)
|
|
1341
1655
|
*/
|
|
@@ -1371,6 +1685,7 @@ var RustrakClient = class {
|
|
|
1371
1685
|
this.invitations = new InvitationsResource(this.http);
|
|
1372
1686
|
this.members = new MembersResource(this.http);
|
|
1373
1687
|
this.sessions = new SessionsResource(this.http);
|
|
1688
|
+
this.releases = new ReleasesResource(this.http);
|
|
1374
1689
|
this.transactions = new TransactionsResource(this.http);
|
|
1375
1690
|
this.logs = new LogsResource(this.http);
|
|
1376
1691
|
this.storage = new StorageResource(this.http);
|