@belvador/api 0.4.0 → 0.6.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/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { OPERATIONS, type OperationId, type OperationMeta, type OperationParams } from "./operations.gen.js";
2
- export declare const CLIENT_VERSION = "0.4.0";
2
+ export declare const CLIENT_VERSION = "0.6.0";
3
3
  export declare const DEFAULT_BASE_URL = "https://api.belvador.dev";
4
4
  /** Personal (`blv_pat_`), service (`blv_svc_`) or OAuth access (`blv_oat_`) token. */
5
5
  export declare const TOKEN_PATTERN: RegExp;
package/dist/client.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BelvadorApiError, errorFrom } from "./errors.js";
2
2
  import { nodeErrorWord, nodeReadRequest, nodeRefusal, nodeWindowMissing, NODE_REFUSAL_STATUS, reshapeNodeAnswer, } from "./node-wire.gen.js";
3
3
  import { OPERATIONS } from "./operations.gen.js";
4
- export const CLIENT_VERSION = "0.4.0";
4
+ export const CLIENT_VERSION = "0.6.0";
5
5
  export const DEFAULT_BASE_URL = "https://api.belvador.dev";
6
6
  /** Personal (`blv_pat_`), service (`blv_svc_`) or OAuth access (`blv_oat_`) token. */
7
7
  export const TOKEN_PATTERN = /^blv_(pat|svc|oat)_[A-Za-z0-9_-]{20,200}$/;
@@ -166,6 +166,22 @@ export declare const OPERATIONS: {
166
166
  readonly node: null;
167
167
  readonly defaults: {};
168
168
  };
169
+ readonly "deployments.create": {
170
+ readonly method: "POST";
171
+ readonly path: "/v1/projects/{project}/deployments";
172
+ readonly pathParams: readonly ["project"];
173
+ readonly scope: "releases:write";
174
+ readonly kind: "node";
175
+ readonly sensitivity: "normal";
176
+ readonly idempotency: "none";
177
+ readonly ifMatch: false;
178
+ readonly paged: false;
179
+ readonly status: 200;
180
+ readonly node: {
181
+ readonly path: "w/releases/deployments";
182
+ };
183
+ readonly defaults: {};
184
+ };
169
185
  readonly "destinations.create": {
170
186
  readonly method: "POST";
171
187
  readonly path: "/v1/destinations";
@@ -525,6 +541,22 @@ export declare const OPERATIONS: {
525
541
  };
526
542
  readonly defaults: {};
527
543
  };
544
+ readonly "issues.fix_status": {
545
+ readonly method: "GET";
546
+ readonly path: "/v1/issues/{issue_id}/fix-status";
547
+ readonly pathParams: readonly ["issue_id"];
548
+ readonly scope: "releases:read";
549
+ readonly kind: "node";
550
+ readonly sensitivity: "normal";
551
+ readonly idempotency: "none";
552
+ readonly ifMatch: false;
553
+ readonly paged: false;
554
+ readonly status: 200;
555
+ readonly node: {
556
+ readonly path: "q/issues/{issue_id}/fix-status";
557
+ };
558
+ readonly defaults: {};
559
+ };
528
560
  readonly "issues.get": {
529
561
  readonly method: "GET";
530
562
  readonly path: "/v1/issues/{issue_id}";
@@ -772,6 +804,56 @@ export declare const OPERATIONS: {
772
804
  readonly node: null;
773
805
  readonly defaults: {};
774
806
  };
807
+ readonly "metrics.names": {
808
+ readonly method: "GET";
809
+ readonly path: "/v1/metrics/names";
810
+ readonly pathParams: readonly [];
811
+ readonly scope: "metrics:read";
812
+ readonly kind: "node";
813
+ readonly sensitivity: "normal";
814
+ readonly idempotency: "none";
815
+ readonly ifMatch: false;
816
+ readonly paged: false;
817
+ readonly status: 200;
818
+ readonly node: {
819
+ readonly path: "q/metrics/names";
820
+ };
821
+ readonly defaults: {};
822
+ };
823
+ readonly "metrics.query": {
824
+ readonly method: "GET";
825
+ readonly path: "/v1/metrics/query";
826
+ readonly pathParams: readonly [];
827
+ readonly scope: "metrics:read";
828
+ readonly kind: "node";
829
+ readonly sensitivity: "normal";
830
+ readonly idempotency: "none";
831
+ readonly ifMatch: false;
832
+ readonly paged: false;
833
+ readonly status: 200;
834
+ readonly node: {
835
+ readonly path: "q/metrics/query";
836
+ readonly window: true;
837
+ };
838
+ readonly defaults: {};
839
+ };
840
+ readonly "metrics.series": {
841
+ readonly method: "GET";
842
+ readonly path: "/v1/metrics/series";
843
+ readonly pathParams: readonly [];
844
+ readonly scope: "metrics:read";
845
+ readonly kind: "node";
846
+ readonly sensitivity: "normal";
847
+ readonly idempotency: "none";
848
+ readonly ifMatch: false;
849
+ readonly paged: true;
850
+ readonly status: 200;
851
+ readonly node: {
852
+ readonly path: "q/metrics/series";
853
+ readonly list: "series";
854
+ };
855
+ readonly defaults: {};
856
+ };
775
857
  readonly "monitors.backtest": {
776
858
  readonly method: "POST";
777
859
  readonly path: "/v1/monitors/backtest";
@@ -1441,6 +1523,38 @@ export declare const OPERATIONS: {
1441
1523
  readonly node: null;
1442
1524
  readonly defaults: {};
1443
1525
  };
1526
+ readonly "releases.health": {
1527
+ readonly method: "GET";
1528
+ readonly path: "/v1/projects/{project}/releases/{version}/health";
1529
+ readonly pathParams: readonly ["project", "version"];
1530
+ readonly scope: "releases:read";
1531
+ readonly kind: "node";
1532
+ readonly sensitivity: "normal";
1533
+ readonly idempotency: "none";
1534
+ readonly ifMatch: false;
1535
+ readonly paged: false;
1536
+ readonly status: 200;
1537
+ readonly node: {
1538
+ readonly path: "q/releases/health";
1539
+ };
1540
+ readonly defaults: {};
1541
+ };
1542
+ readonly "releases.list": {
1543
+ readonly method: "GET";
1544
+ readonly path: "/v1/projects/{project}/releases";
1545
+ readonly pathParams: readonly ["project"];
1546
+ readonly scope: "releases:read";
1547
+ readonly kind: "node";
1548
+ readonly sensitivity: "normal";
1549
+ readonly idempotency: "none";
1550
+ readonly ifMatch: false;
1551
+ readonly paged: false;
1552
+ readonly status: 200;
1553
+ readonly node: {
1554
+ readonly path: "q/releases";
1555
+ };
1556
+ readonly defaults: {};
1557
+ };
1444
1558
  readonly "service_principals.create": {
1445
1559
  readonly method: "POST";
1446
1560
  readonly path: "/v1/service-accounts";
@@ -1920,7 +2034,7 @@ export interface OperationParams {
1920
2034
  is_enabled: boolean;
1921
2035
  notify_all: boolean;
1922
2036
  destination_ids: Array<string>;
1923
- monitor_kinds?: Array<"missed" | "failed" | "timeout" | "unknown" | "count" | "assertion" | "deadline" | "stalled">;
2037
+ monitor_kinds?: Array<"missed" | "failed" | "timeout" | "unknown" | "count" | "assertion" | "deadline" | "stalled" | "metric">;
1924
2038
  slo_severities?: Array<"page" | "ticket">;
1925
2039
  policy_id?: string | null;
1926
2040
  };
@@ -1962,6 +2076,17 @@ export interface OperationParams {
1962
2076
  note?: string;
1963
2077
  }>;
1964
2078
  };
2079
+ /** Record that a release was deployed to an environment (a deploy marker for CI without sentry-cli). Answers the marker and `created`; the same `deploy_id` again changes nothing (`created: false`). */
2080
+ "deployments.create": {
2081
+ project: number;
2082
+ version: string;
2083
+ environment: string;
2084
+ name?: string;
2085
+ url?: string;
2086
+ started_at?: string;
2087
+ finished_at?: string;
2088
+ deploy_id?: string;
2089
+ };
1965
2090
  /** Start adding a Telegram, Slack, email, webhook, PagerDuty or incident.io destination; a person enters its secrets. */
1966
2091
  "destinations.create": {
1967
2092
  provider: "telegram" | "slack" | "email" | "webhook" | "pagerduty" | "incident_io";
@@ -2067,7 +2192,7 @@ export interface OperationParams {
2067
2192
  "ingest_keys.create": {
2068
2193
  project_id: number;
2069
2194
  name: string;
2070
- scopes: Array<"traces" | "logs" | "errors" | "monitors">;
2195
+ scopes: Array<"traces" | "logs" | "metrics" | "errors" | "monitors">;
2071
2196
  environments: Array<string>;
2072
2197
  expires_at: string | null;
2073
2198
  };
@@ -2095,6 +2220,7 @@ export interface OperationParams {
2095
2220
  action: {
2096
2221
  action: "resolve";
2097
2222
  in_next_release?: boolean;
2223
+ in_release?: string;
2098
2224
  } | {
2099
2225
  action: "unresolve";
2100
2226
  } | {
@@ -2114,6 +2240,10 @@ export interface OperationParams {
2114
2240
  priority: "low" | "medium" | "high";
2115
2241
  };
2116
2242
  };
2243
+ /** Whether a resolved issue is fixed in each environment it occurred in: fixed (a deploy of the target release and 24 h of its signals without the error), unverified, not fixed (with the event that broke it) or unknown; null while unresolved. */
2244
+ "issues.fix_status": {
2245
+ issue_id: number;
2246
+ };
2117
2247
  /** One issue with its 24 h and 30 d counts. */
2118
2248
  "issues.get": {
2119
2249
  issue_id: number;
@@ -2148,6 +2278,7 @@ export interface OperationParams {
2148
2278
  } & ((Record<string, unknown>) & ({
2149
2279
  action: "resolve";
2150
2280
  in_next_release?: boolean;
2281
+ in_release?: string;
2151
2282
  } | {
2152
2283
  action: "unresolve";
2153
2284
  } | {
@@ -2278,6 +2409,32 @@ export interface OperationParams {
2278
2409
  "members.remove": {
2279
2410
  user_id: string;
2280
2411
  };
2412
+ /** The metric catalog of one project (name, type, kind, unit, series count, last seen) and the node's series and name caps with the metrics it is dropping points for. */
2413
+ "metrics.names": {
2414
+ project: number;
2415
+ environment?: string;
2416
+ q?: string;
2417
+ };
2418
+ /** One metric aggregated per step (avg, sum, min, max, count, rate, p50–p99) in a window of at most 7 days, optionally grouped by up to two attributes (≤ 50 groups, ≤ 10,000 points), with exemplar trace ids. */
2419
+ "metrics.query": {
2420
+ project: number;
2421
+ name: string;
2422
+ aggregation: "avg" | "sum" | "min" | "max" | "count" | "rate" | "p50" | "p90" | "p95" | "p99";
2423
+ start?: string;
2424
+ end?: string;
2425
+ step?: number;
2426
+ attrs?: string;
2427
+ group_by?: string;
2428
+ environment?: string;
2429
+ };
2430
+ /** The time series of one metric (attributes, service, environment, first and last seen), 100 per page. */
2431
+ "metrics.series": {
2432
+ project?: number;
2433
+ name?: string;
2434
+ environment?: string;
2435
+ attrs?: string;
2436
+ cursor?: string;
2437
+ };
2281
2438
  /** How often count/assertion settings would have alerted over the last 30 days of stored data (same rule as the live evaluator). */
2282
2439
  "monitors.backtest": {
2283
2440
  project: number;
@@ -2398,6 +2555,26 @@ export interface OperationParams {
2398
2555
  environments: Array<string>;
2399
2556
  severity: "critical" | "high" | "medium" | "low";
2400
2557
  recovery_threshold: number;
2558
+ } | {
2559
+ type: "metric";
2560
+ metric_query: {
2561
+ name: string;
2562
+ aggregation: "avg" | "sum" | "min" | "max" | "count" | "rate" | "p50" | "p90" | "p95" | "p99";
2563
+ filter: Array<{
2564
+ k: string;
2565
+ op: "=" | "!=" | "exists";
2566
+ v?: string;
2567
+ }>;
2568
+ group_by: Array<string>;
2569
+ };
2570
+ window_minutes: number;
2571
+ comparator: "lt" | "gt" | "outside";
2572
+ threshold: number;
2573
+ threshold_high: number | null;
2574
+ missing_data: "alert" | "keep" | "resolve" | "treat_as_zero";
2575
+ environments: Array<string>;
2576
+ severity: "critical" | "high" | "medium" | "low";
2577
+ recovery_threshold: number;
2401
2578
  };
2402
2579
  }));
2403
2580
  /** Delete a monitor; `confirm_slug` must repeat its slug. */
@@ -2418,7 +2595,7 @@ export interface OperationParams {
2418
2595
  limit?: number;
2419
2596
  cursor?: string;
2420
2597
  project_id?: number;
2421
- type?: "job" | "count" | "assertion" | "deadline" | "progress";
2598
+ type?: "job" | "count" | "assertion" | "deadline" | "progress" | "metric";
2422
2599
  };
2423
2600
  /** Occurrences of a deadline monitor (pending, on time, late, missed, failed, cancelled), newest due first. */
2424
2601
  "monitors.occurrences": {
@@ -2517,6 +2694,26 @@ export interface OperationParams {
2517
2694
  environments: Array<string>;
2518
2695
  severity: "critical" | "high" | "medium" | "low";
2519
2696
  recovery_threshold: number;
2697
+ } | {
2698
+ type: "metric";
2699
+ metric_query: {
2700
+ name: string;
2701
+ aggregation: "avg" | "sum" | "min" | "max" | "count" | "rate" | "p50" | "p90" | "p95" | "p99";
2702
+ filter: Array<{
2703
+ k: string;
2704
+ op: "=" | "!=" | "exists";
2705
+ v?: string;
2706
+ }>;
2707
+ group_by: Array<string>;
2708
+ };
2709
+ window_minutes: number;
2710
+ comparator: "lt" | "gt" | "outside";
2711
+ threshold: number;
2712
+ threshold_high: number | null;
2713
+ missing_data: "alert" | "keep" | "resolve" | "treat_as_zero";
2714
+ environments: Array<string>;
2715
+ severity: "critical" | "high" | "medium" | "low";
2716
+ recovery_threshold: number;
2520
2717
  };
2521
2718
  }));
2522
2719
  /** Start a backup now (at most once per 10 minutes). */
@@ -2716,6 +2913,18 @@ export interface OperationParams {
2716
2913
  primary_environment: string;
2717
2914
  allow_code_monitors: boolean;
2718
2915
  };
2916
+ /** One release in one environment against the previous one (or `compare`): new, regressed and increased issues in its first 24 hours (≤ 50 each, with hourly sparklines) and its deploy markers. */
2917
+ "releases.health": {
2918
+ project: number;
2919
+ version: string;
2920
+ environment?: string;
2921
+ compare?: string;
2922
+ };
2923
+ /** Releases of one project in one environment, newest first by deploy order (else version order): first and last deploy, events, issues, and the counts of new, regressed and increased issues in each release's first 24 hours. */
2924
+ "releases.list": {
2925
+ project: number;
2926
+ environment?: string;
2927
+ };
2719
2928
  /** Create a service account. */
2720
2929
  "service_principals.create": {
2721
2930
  name: string;
@@ -142,6 +142,20 @@ export const OPERATIONS = {
142
142
  node: null,
143
143
  defaults: {},
144
144
  },
145
+ "deployments.create": {
146
+ method: "POST",
147
+ path: "/v1/projects/{project}/deployments",
148
+ pathParams: ["project"],
149
+ scope: "releases:write",
150
+ kind: "node",
151
+ sensitivity: "normal",
152
+ idempotency: "none",
153
+ ifMatch: false,
154
+ paged: false,
155
+ status: 200,
156
+ node: { path: "w/releases/deployments" },
157
+ defaults: {},
158
+ },
145
159
  "destinations.create": {
146
160
  method: "POST",
147
161
  path: "/v1/destinations",
@@ -492,6 +506,20 @@ export const OPERATIONS = {
492
506
  node: { path: "w/issues/bulk" },
493
507
  defaults: {},
494
508
  },
509
+ "issues.fix_status": {
510
+ method: "GET",
511
+ path: "/v1/issues/{issue_id}/fix-status",
512
+ pathParams: ["issue_id"],
513
+ scope: "releases:read",
514
+ kind: "node",
515
+ sensitivity: "normal",
516
+ idempotency: "none",
517
+ ifMatch: false,
518
+ paged: false,
519
+ status: 200,
520
+ node: { path: "q/issues/{issue_id}/fix-status" },
521
+ defaults: {},
522
+ },
495
523
  "issues.get": {
496
524
  method: "GET",
497
525
  path: "/v1/issues/{issue_id}",
@@ -716,6 +744,48 @@ export const OPERATIONS = {
716
744
  node: null,
717
745
  defaults: {},
718
746
  },
747
+ "metrics.names": {
748
+ method: "GET",
749
+ path: "/v1/metrics/names",
750
+ pathParams: [],
751
+ scope: "metrics:read",
752
+ kind: "node",
753
+ sensitivity: "normal",
754
+ idempotency: "none",
755
+ ifMatch: false,
756
+ paged: false,
757
+ status: 200,
758
+ node: { path: "q/metrics/names" },
759
+ defaults: {},
760
+ },
761
+ "metrics.query": {
762
+ method: "GET",
763
+ path: "/v1/metrics/query",
764
+ pathParams: [],
765
+ scope: "metrics:read",
766
+ kind: "node",
767
+ sensitivity: "normal",
768
+ idempotency: "none",
769
+ ifMatch: false,
770
+ paged: false,
771
+ status: 200,
772
+ node: { path: "q/metrics/query", window: true },
773
+ defaults: {},
774
+ },
775
+ "metrics.series": {
776
+ method: "GET",
777
+ path: "/v1/metrics/series",
778
+ pathParams: [],
779
+ scope: "metrics:read",
780
+ kind: "node",
781
+ sensitivity: "normal",
782
+ idempotency: "none",
783
+ ifMatch: false,
784
+ paged: true,
785
+ status: 200,
786
+ node: { path: "q/metrics/series", list: "series" },
787
+ defaults: {},
788
+ },
719
789
  "monitors.backtest": {
720
790
  method: "POST",
721
791
  path: "/v1/monitors/backtest",
@@ -1374,6 +1444,34 @@ export const OPERATIONS = {
1374
1444
  node: null,
1375
1445
  defaults: {},
1376
1446
  },
1447
+ "releases.health": {
1448
+ method: "GET",
1449
+ path: "/v1/projects/{project}/releases/{version}/health",
1450
+ pathParams: ["project", "version"],
1451
+ scope: "releases:read",
1452
+ kind: "node",
1453
+ sensitivity: "normal",
1454
+ idempotency: "none",
1455
+ ifMatch: false,
1456
+ paged: false,
1457
+ status: 200,
1458
+ node: { path: "q/releases/health" },
1459
+ defaults: {},
1460
+ },
1461
+ "releases.list": {
1462
+ method: "GET",
1463
+ path: "/v1/projects/{project}/releases",
1464
+ pathParams: ["project"],
1465
+ scope: "releases:read",
1466
+ kind: "node",
1467
+ sensitivity: "normal",
1468
+ idempotency: "none",
1469
+ ifMatch: false,
1470
+ paged: false,
1471
+ status: 200,
1472
+ node: { path: "q/releases" },
1473
+ defaults: {},
1474
+ },
1377
1475
  "service_principals.create": {
1378
1476
  method: "POST",
1379
1477
  path: "/v1/service-accounts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belvador/api",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Typed client for the Belvador API (api.belvador.dev, OpenAPI 3.1): every operation by operationId, problem+json errors, retries, and node reads straight from the edge with short-lived tickets.",
5
5
  "license": "MIT",
6
6
  "author": "Belvador (https://belvador.dev)",