@rustrak/client 0.12.3 → 0.13.0
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 +49 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +49 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -363,6 +363,28 @@ var upsertProjectMemberSchema = zod.z.object({
|
|
|
363
363
|
user_id: zod.z.number().int(),
|
|
364
364
|
role: projectRoleSchema
|
|
365
365
|
});
|
|
366
|
+
var metricDeltaSchema = zod.z.object({
|
|
367
|
+
current: zod.z.number().int(),
|
|
368
|
+
/**
|
|
369
|
+
* The same window immediately before this one. Null only for all-time
|
|
370
|
+
* requests, where a `0` would render as a misleading "+100%".
|
|
371
|
+
*/
|
|
372
|
+
previous: zod.z.number().int().nullable()
|
|
373
|
+
});
|
|
374
|
+
var projectListStatsSchema = zod.z.object({
|
|
375
|
+
/**
|
|
376
|
+
* Distinct issues active in each bucket, oldest first. A shape, not a
|
|
377
|
+
* total: an issue firing all day appears in every bucket it touched.
|
|
378
|
+
*/
|
|
379
|
+
trend: zod.z.array(zod.z.number().int()),
|
|
380
|
+
events: metricDeltaSchema,
|
|
381
|
+
/** Issues first seen in the window. Drives the "getting worse" signal. */
|
|
382
|
+
new_issues: metricDeltaSchema,
|
|
383
|
+
/** Unresolved issues right now, independent of the window. */
|
|
384
|
+
open_issues: zod.z.number().int(),
|
|
385
|
+
/** The subset of `open_issues` at `fatal` level. */
|
|
386
|
+
fatal_issues: zod.z.number().int()
|
|
387
|
+
});
|
|
366
388
|
var projectSchema = zod.z.object({
|
|
367
389
|
id: zod.z.number().int(),
|
|
368
390
|
name: zod.z.string(),
|
|
@@ -373,15 +395,31 @@ var projectSchema = zod.z.object({
|
|
|
373
395
|
digested_event_count: zod.z.number().int(),
|
|
374
396
|
created_at: dateTimeSchema,
|
|
375
397
|
updated_at: dateTimeSchema,
|
|
376
|
-
platform: zod.z.string().nullable()
|
|
398
|
+
platform: zod.z.string().nullable(),
|
|
399
|
+
stats: projectListStatsSchema.optional()
|
|
377
400
|
});
|
|
378
401
|
var createProjectSchema = zod.z.object({
|
|
379
402
|
name: zod.z.string().min(1),
|
|
380
|
-
|
|
403
|
+
/**
|
|
404
|
+
* Slugified server-side. Supplying it means the user chose it, so a taken
|
|
405
|
+
* slug is a 409. Omitting it derives one from the name and silently
|
|
406
|
+
* de-duplicates, since nobody chose that value.
|
|
407
|
+
*/
|
|
408
|
+
slug: zod.z.string().min(1).optional(),
|
|
409
|
+
/**
|
|
410
|
+
* Validated server-side against SELECTABLE_PLATFORMS. Omitting it leaves the
|
|
411
|
+
* project eligible for platform auto-detection from its first event.
|
|
412
|
+
*/
|
|
413
|
+
platform: zod.z.string().min(1).optional()
|
|
381
414
|
});
|
|
382
415
|
var updateProjectSchema = zod.z.object({
|
|
383
416
|
name: zod.z.string().min(1).optional(),
|
|
384
|
-
platform: zod.z.string().min(1).optional()
|
|
417
|
+
platform: zod.z.string().min(1).optional(),
|
|
418
|
+
/**
|
|
419
|
+
* Slugified server-side. Unlike on create, a taken slug is a 409 rather than
|
|
420
|
+
* being silently de-duplicated.
|
|
421
|
+
*/
|
|
422
|
+
slug: zod.z.string().min(1).optional()
|
|
385
423
|
});
|
|
386
424
|
var releaseHealthRowSchema = zod.z.object({
|
|
387
425
|
release: zod.z.string(),
|
|
@@ -443,15 +481,15 @@ var eventTimeseriesPointSchema = zod.z.object({
|
|
|
443
481
|
info: zod.z.number().int()
|
|
444
482
|
});
|
|
445
483
|
var eventTimeseriesSchema = zod.z.array(eventTimeseriesPointSchema);
|
|
446
|
-
var
|
|
484
|
+
var metricDeltaSchema2 = zod.z.object({
|
|
447
485
|
current: zod.z.number().int(),
|
|
448
486
|
previous: zod.z.number().int().nullable()
|
|
449
487
|
});
|
|
450
488
|
var projectStatsSummarySchema = zod.z.object({
|
|
451
489
|
/** Resolved window in hours, or `null` for all time. */
|
|
452
490
|
period_hours: zod.z.number().int().nullable(),
|
|
453
|
-
events:
|
|
454
|
-
new_issues:
|
|
491
|
+
events: metricDeltaSchema2,
|
|
492
|
+
new_issues: metricDeltaSchema2,
|
|
455
493
|
/** Currently unresolved issues, independent of the window. */
|
|
456
494
|
open_issues: zod.z.number().int()
|
|
457
495
|
});
|
|
@@ -1300,6 +1338,9 @@ var ProjectsResource = class extends BaseResource {
|
|
|
1300
1338
|
if (options?.order) {
|
|
1301
1339
|
searchParams.set("order", options.order);
|
|
1302
1340
|
}
|
|
1341
|
+
if (options?.stats_period) {
|
|
1342
|
+
searchParams.set("stats_period", options.stats_period);
|
|
1343
|
+
}
|
|
1303
1344
|
const query = searchParams.toString();
|
|
1304
1345
|
const url = query ? `api/projects?${query}` : "api/projects";
|
|
1305
1346
|
const data = await this.http.get(url).json();
|
|
@@ -1748,7 +1789,8 @@ function transformHttpError(error) {
|
|
|
1748
1789
|
let errorMessage = `HTTP ${status} error`;
|
|
1749
1790
|
const body = error.data;
|
|
1750
1791
|
if (body) {
|
|
1751
|
-
|
|
1792
|
+
const nested = typeof body.error === "object" ? body.error?.message : body.error;
|
|
1793
|
+
errorMessage = nested || body.message || errorMessage;
|
|
1752
1794
|
}
|
|
1753
1795
|
switch (status) {
|
|
1754
1796
|
case 400:
|