@rustrak/client 0.3.11 → 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 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(["digest_order", "last_seen"]);
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();
@@ -680,7 +684,8 @@ var projectSchema = zod.z.object({
680
684
  stored_event_count: zod.z.number().int(),
681
685
  digested_event_count: zod.z.number().int(),
682
686
  created_at: dateTimeSchema,
683
- updated_at: dateTimeSchema
687
+ updated_at: dateTimeSchema,
688
+ platform: zod.z.string().nullable()
684
689
  });
685
690
  var createProjectSchema = zod.z.object({
686
691
  name: zod.z.string().min(1),
@@ -701,6 +706,22 @@ var releaseHealthRowSchema = zod.z.object({
701
706
  crash_free_users_rate: zod.z.number().nullable()
702
707
  });
703
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);
704
725
  var chunkUploadCapabilitySchema = zod.z.object({
705
726
  url: zod.z.string(),
706
727
  chunkSize: zod.z.number().int(),
@@ -1184,6 +1205,26 @@ var ProjectsResource = class extends BaseResource {
1184
1205
  await this.http.delete(`api/projects/${id}`);
1185
1206
  }
1186
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
+ };
1187
1228
 
1188
1229
  // src/resources/sessions.ts
1189
1230
  var SessionsResource = class extends BaseResource {
@@ -1191,15 +1232,51 @@ var SessionsResource = class extends BaseResource {
1191
1232
  * Get per-release health stats for a project.
1192
1233
  * @param projectId - Project ID
1193
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.
1194
1237
  */
1195
- async stats(projectId, period) {
1238
+ async stats(projectId, period, release) {
1196
1239
  const searchParams = {};
1197
1240
  if (period) {
1198
1241
  searchParams.period = period;
1199
1242
  }
1243
+ if (release) {
1244
+ searchParams.release = release;
1245
+ }
1200
1246
  const data = await this.http.get(`api/projects/${projectId}/sessions/stats`, { searchParams }).json();
1201
1247
  return this.validate(data, releaseHealthSchema);
1202
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
+ }
1203
1280
  };
1204
1281
 
1205
1282
  // src/resources/sourcemaps.ts
@@ -1569,6 +1646,10 @@ var RustrakClient = class {
1569
1646
  * Sessions API resource (release health)
1570
1647
  */
1571
1648
  sessions;
1649
+ /**
1650
+ * Releases API resource (data scoped to a specific release)
1651
+ */
1652
+ releases;
1572
1653
  /**
1573
1654
  * Transactions API resource (performance monitoring)
1574
1655
  */
@@ -1604,6 +1685,7 @@ var RustrakClient = class {
1604
1685
  this.invitations = new InvitationsResource(this.http);
1605
1686
  this.members = new MembersResource(this.http);
1606
1687
  this.sessions = new SessionsResource(this.http);
1688
+ this.releases = new ReleasesResource(this.http);
1607
1689
  this.transactions = new TransactionsResource(this.http);
1608
1690
  this.logs = new LogsResource(this.http);
1609
1691
  this.storage = new StorageResource(this.http);