@rustrak/client 0.12.1 → 0.12.3
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 +86 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -14
- package/dist/index.d.ts +52 -14
- package/dist/index.js +86 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -394,7 +394,6 @@ var releaseHealthRowSchema = zod.z.object({
|
|
|
394
394
|
crash_free_sessions_rate: zod.z.number().nullable(),
|
|
395
395
|
crash_free_users_rate: zod.z.number().nullable()
|
|
396
396
|
});
|
|
397
|
-
var releaseHealthSchema = zod.z.array(releaseHealthRowSchema);
|
|
398
397
|
var sessionSummarySchema = zod.z.object({
|
|
399
398
|
total: zod.z.number().int(),
|
|
400
399
|
errored: zod.z.number().int(),
|
|
@@ -435,6 +434,27 @@ var sourceMapFileSchema = zod.z.object({
|
|
|
435
434
|
var listSourceMapsResponseSchema = zod.z.object({
|
|
436
435
|
data: zod.z.array(sourceMapFileSchema)
|
|
437
436
|
});
|
|
437
|
+
var eventTimeseriesPointSchema = zod.z.object({
|
|
438
|
+
bucket: dateTimeSchema,
|
|
439
|
+
total: zod.z.number().int(),
|
|
440
|
+
fatal: zod.z.number().int(),
|
|
441
|
+
error: zod.z.number().int(),
|
|
442
|
+
warning: zod.z.number().int(),
|
|
443
|
+
info: zod.z.number().int()
|
|
444
|
+
});
|
|
445
|
+
var eventTimeseriesSchema = zod.z.array(eventTimeseriesPointSchema);
|
|
446
|
+
var metricDeltaSchema = zod.z.object({
|
|
447
|
+
current: zod.z.number().int(),
|
|
448
|
+
previous: zod.z.number().int().nullable()
|
|
449
|
+
});
|
|
450
|
+
var projectStatsSummarySchema = zod.z.object({
|
|
451
|
+
/** Resolved window in hours, or `null` for all time. */
|
|
452
|
+
period_hours: zod.z.number().int().nullable(),
|
|
453
|
+
events: metricDeltaSchema,
|
|
454
|
+
new_issues: metricDeltaSchema,
|
|
455
|
+
/** Currently unresolved issues, independent of the window. */
|
|
456
|
+
open_issues: zod.z.number().int()
|
|
457
|
+
});
|
|
438
458
|
var sourceMapStorageSchema = zod.z.object({
|
|
439
459
|
chunk_bytes: zod.z.number(),
|
|
440
460
|
source_file_bytes: zod.z.number(),
|
|
@@ -1339,22 +1359,30 @@ var ReleasesResource = class extends BaseResource {
|
|
|
1339
1359
|
// src/resources/sessions.ts
|
|
1340
1360
|
var SessionsResource = class extends BaseResource {
|
|
1341
1361
|
/**
|
|
1342
|
-
* Get per-release health stats for a project
|
|
1362
|
+
* Get per-release health stats for a project, one offset-based page of
|
|
1363
|
+
* (release, environment) rows at a time, ordered by session volume.
|
|
1343
1364
|
* @param projectId - Project ID
|
|
1344
|
-
* @param
|
|
1345
|
-
* @param release - Scope to a single release (all environments), computed
|
|
1346
|
-
* server-side. Omit to get every release in the project.
|
|
1365
|
+
* @param options - Time window, release scoping and pagination.
|
|
1347
1366
|
*/
|
|
1348
|
-
async stats(projectId,
|
|
1367
|
+
async stats(projectId, options) {
|
|
1349
1368
|
const searchParams = {};
|
|
1350
|
-
if (period) {
|
|
1351
|
-
searchParams.period = period;
|
|
1369
|
+
if (options?.period) {
|
|
1370
|
+
searchParams.period = options.period;
|
|
1352
1371
|
}
|
|
1353
|
-
if (release) {
|
|
1354
|
-
searchParams.release = release;
|
|
1372
|
+
if (options?.release) {
|
|
1373
|
+
searchParams.release = options.release;
|
|
1374
|
+
}
|
|
1375
|
+
if (options?.page) {
|
|
1376
|
+
searchParams.page = String(options.page);
|
|
1377
|
+
}
|
|
1378
|
+
if (options?.per_page) {
|
|
1379
|
+
searchParams.per_page = String(options.per_page);
|
|
1355
1380
|
}
|
|
1356
1381
|
const data = await this.http.get(`api/projects/${projectId}/sessions/stats`, { searchParams }).json();
|
|
1357
|
-
return this.validate(
|
|
1382
|
+
return this.validate(
|
|
1383
|
+
data,
|
|
1384
|
+
offsetPaginatedResponseSchema(releaseHealthRowSchema)
|
|
1385
|
+
);
|
|
1358
1386
|
}
|
|
1359
1387
|
/**
|
|
1360
1388
|
* Get project-wide session health, aggregated across all releases and environments.
|
|
@@ -1471,6 +1499,48 @@ var SpansResource = class extends BaseResource {
|
|
|
1471
1499
|
return this.validate(data, offsetPaginatedResponseSchema(spanSchema));
|
|
1472
1500
|
}
|
|
1473
1501
|
};
|
|
1502
|
+
|
|
1503
|
+
// src/resources/stats.ts
|
|
1504
|
+
var StatsResource = class extends BaseResource {
|
|
1505
|
+
/**
|
|
1506
|
+
* Get time-bucketed error-event volume for a project, split by severity.
|
|
1507
|
+
*
|
|
1508
|
+
* Buckets are zero-filled across the window, so a quiet hour comes back as a
|
|
1509
|
+
* point with `total: 0` rather than being absent. All-time requests (no
|
|
1510
|
+
* `period`) are sparse: there is no lower bound to fill from.
|
|
1511
|
+
*
|
|
1512
|
+
* @param projectId - Project ID
|
|
1513
|
+
* @param period - Time window (e.g. '24h', '7d'). Omit for all time.
|
|
1514
|
+
* @param interval - Bucket width in hours (default: 1, max: 24).
|
|
1515
|
+
*/
|
|
1516
|
+
async timeseries(projectId, period, interval) {
|
|
1517
|
+
const searchParams = {};
|
|
1518
|
+
if (period) {
|
|
1519
|
+
searchParams.period = period;
|
|
1520
|
+
}
|
|
1521
|
+
if (interval !== void 0) {
|
|
1522
|
+
searchParams.interval = interval.toString();
|
|
1523
|
+
}
|
|
1524
|
+
const data = await this.http.get(`api/projects/${projectId}/events/stats`, { searchParams }).json();
|
|
1525
|
+
return this.validate(data, eventTimeseriesSchema);
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Get project-wide counters for a window, each paired with the same counter
|
|
1529
|
+
* over the window immediately before it.
|
|
1530
|
+
*
|
|
1531
|
+
* @param projectId - Project ID
|
|
1532
|
+
* @param period - Time window (e.g. '24h', '7d'). Omit for all time, which
|
|
1533
|
+
* leaves every `previous` null.
|
|
1534
|
+
*/
|
|
1535
|
+
async summary(projectId, period) {
|
|
1536
|
+
const searchParams = {};
|
|
1537
|
+
if (period) {
|
|
1538
|
+
searchParams.period = period;
|
|
1539
|
+
}
|
|
1540
|
+
const data = await this.http.get(`api/projects/${projectId}/stats/summary`, { searchParams }).json();
|
|
1541
|
+
return this.validate(data, projectStatsSummarySchema);
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1474
1544
|
var StorageResource = class extends BaseResource {
|
|
1475
1545
|
/**
|
|
1476
1546
|
* Get the instance-wide storage summary: row counts per data category, the
|
|
@@ -1807,6 +1877,10 @@ var RustrakClient = class {
|
|
|
1807
1877
|
* AI Agent Monitoring dashboard API resource
|
|
1808
1878
|
*/
|
|
1809
1879
|
agents;
|
|
1880
|
+
/**
|
|
1881
|
+
* Stats API resource (project-wide overview aggregates)
|
|
1882
|
+
*/
|
|
1883
|
+
stats;
|
|
1810
1884
|
/**
|
|
1811
1885
|
* Storage API resource (usage + retention cleanup, admin only)
|
|
1812
1886
|
*/
|
|
@@ -1839,6 +1913,7 @@ var RustrakClient = class {
|
|
|
1839
1913
|
this.logs = new LogsResource(this.http);
|
|
1840
1914
|
this.spans = new SpansResource(this.http);
|
|
1841
1915
|
this.agents = new AgentsResource(this.http);
|
|
1916
|
+
this.stats = new StatsResource(this.http);
|
|
1842
1917
|
this.storage = new StorageResource(this.http);
|
|
1843
1918
|
this.health = new HealthResource(this.http);
|
|
1844
1919
|
}
|