@leavepulse/control-sdk 0.3.42 → 0.3.44

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/models.ts CHANGED
@@ -140,6 +140,7 @@ export type ManufacturerListResponse =
140
140
  components["schemas"]["ManufacturerListResponse"];
141
141
  export type MoveStorageNodeRequest =
142
142
  components["schemas"]["MoveStorageNodeRequest"];
143
+ export type NodeChartsResponse = components["schemas"]["NodeChartsResponse"];
143
144
  export type NodeDTO = components["schemas"]["NodeDTO"];
144
145
  export type OutletDTO = components["schemas"]["OutletDTO"];
145
146
  export type OutletListResponse = components["schemas"]["OutletListResponse"];
@@ -148,6 +149,7 @@ export type OwnershipEventDTO = components["schemas"]["OwnershipEventDTO"];
148
149
  export type OwnershipEventListResponse =
149
150
  components["schemas"]["OwnershipEventListResponse"];
150
151
  export type OwnershipInput = components["schemas"]["OwnershipInput"];
152
+ export type PanelDTO = components["schemas"]["PanelDTO"];
151
153
  export type PathHopDTO = components["schemas"]["PathHopDTO"];
152
154
  export type PduDTO = components["schemas"]["PduDTO"];
153
155
  export type PduListResponse = components["schemas"]["PduListResponse"];
@@ -175,6 +177,7 @@ export type RuleListResponse = components["schemas"]["RuleListResponse"];
175
177
  export type ScheduleDTO = components["schemas"]["ScheduleDTO"];
176
178
  export type ScheduleListResponse =
177
179
  components["schemas"]["ScheduleListResponse"];
180
+ export type SeriesDTO = components["schemas"]["SeriesDTO"];
178
181
  export type ServiceDefDTO = components["schemas"]["ServiceDefDTO"];
179
182
  export type ServiceEdgeDTO = components["schemas"]["ServiceEdgeDTO"];
180
183
  export type ServiceListResponse = components["schemas"]["ServiceListResponse"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leavepulse/control-sdk",
3
- "version": "0.3.42",
3
+ "version": "0.3.44",
4
4
  "description": "Generated resource SDK (@leavepulse/control-sdk).",
5
5
  "type": "module",
6
6
  "module": "index.ts",
@@ -37,6 +37,21 @@ export class ControlHost extends Resource<Data> {
37
37
  );
38
38
  }
39
39
 
40
+ /** control.hosts.charts */
41
+ async controlHostsCharts(params?: {
42
+ window?: string;
43
+ }): Promise<models.NodeChartsResponse> {
44
+ return fetchCachedOrThrow<models.NodeChartsResponse>(
45
+ this.ctx.transport,
46
+ this.ctx.etagStore,
47
+ {
48
+ method: "GET",
49
+ path: `/v1/control/hosts/${this.id}/charts`,
50
+ query: { window: params?.window },
51
+ },
52
+ );
53
+ }
54
+
40
55
  /** control.hosts.container_inspect */
41
56
  async controlHostsContainerInspect(
42
57
  container: string,
@@ -16,8 +16,14 @@ import type { Identified } from "./cache";
16
16
  /** Extract an instance id from a payload. Resources key on different fields:
17
17
  * most use `id`, some use a domain id (`user_id`). When `idPath` is given the
18
18
  * id lives at a nested path (`["summary", "id"]` for an envelope), so we walk it
19
- * directly. Otherwise: top-level `id`, then the first `*_id` field, so identity
20
- * mapping works regardless of the schema's id name. */
19
+ * directly. Otherwise: top-level `id`, then a `key` (resources addressed by
20
+ * name, like one env variable), then the first `*_id` field.
21
+ *
22
+ * `owner_id` and `owner` are excluded from that last guess: they identify what
23
+ * a resource BELONGS to, not the resource. Without that, one env variable —
24
+ * `{owner, owner_id, key}` — resolved its id to the owning service, so a write
25
+ * aimed at a variable addressed the owner's name instead and would have created
26
+ * a variable called after the service. */
21
27
  export function extractId(
22
28
  data: Record<string, unknown>,
23
29
  idPath?: readonly string[],
@@ -34,9 +40,12 @@ export function extractId(
34
40
  }
35
41
  const direct = data.id;
36
42
  if (typeof direct === "string" || typeof direct === "number") return direct;
37
- for (const [key, value] of Object.entries(data)) {
43
+ const named = data.key;
44
+ if (typeof named === "string" || typeof named === "number") return named;
45
+ for (const [field, value] of Object.entries(data)) {
46
+ if (field === "owner_id" || field === "owner") continue;
38
47
  if (
39
- key.endsWith("_id") &&
48
+ field.endsWith("_id") &&
40
49
  (typeof value === "string" || typeof value === "number")
41
50
  ) {
42
51
  return value;
package/types.ts CHANGED
@@ -1371,6 +1371,23 @@ export interface paths {
1371
1371
  patch: operations["control.hosts.rename"];
1372
1372
  trace?: never;
1373
1373
  };
1374
+ "/v1/control/hosts/{host_id}/charts": {
1375
+ parameters: {
1376
+ query?: never;
1377
+ header?: never;
1378
+ path?: never;
1379
+ cookie?: never;
1380
+ };
1381
+ /** Time series for a node (utilisation, saturation, errors) */
1382
+ get: operations["control.hosts.charts"];
1383
+ put?: never;
1384
+ post?: never;
1385
+ delete?: never;
1386
+ options?: never;
1387
+ head?: never;
1388
+ patch?: never;
1389
+ trace?: never;
1390
+ };
1374
1391
  "/v1/control/hosts/{host_id}/containers/{container}/action": {
1375
1392
  parameters: {
1376
1393
  query?: never;
@@ -2617,6 +2634,13 @@ export interface components {
2617
2634
  /** @default */
2618
2635
  parent_id?: string;
2619
2636
  };
2637
+ /** NodeChartsResponse */
2638
+ NodeChartsResponse: {
2639
+ panels: components["schemas"]["PanelDTO"][];
2640
+ /** @default */
2641
+ unavailable: string;
2642
+ window: string;
2643
+ };
2620
2644
  /** NodeDTO */
2621
2645
  NodeDTO: {
2622
2646
  /** @default 0 */
@@ -2681,6 +2705,11 @@ export interface components {
2681
2705
  /** @default */
2682
2706
  product: string;
2683
2707
  };
2708
+ /** PanelDTO */
2709
+ PanelDTO: {
2710
+ key: string;
2711
+ series: components["schemas"]["SeriesDTO"][];
2712
+ };
2684
2713
  /** PathHopDTO */
2685
2714
  PathHopDTO: {
2686
2715
  cable_asset_tag: string;
@@ -2895,6 +2924,11 @@ export interface components {
2895
2924
  ScheduleListResponse: {
2896
2925
  items: components["schemas"]["ScheduleDTO"][];
2897
2926
  };
2927
+ /** SeriesDTO */
2928
+ SeriesDTO: {
2929
+ label: string;
2930
+ points: number[][];
2931
+ };
2898
2932
  /** ServiceDefDTO */
2899
2933
  ServiceDefDTO: {
2900
2934
  /** @default false */
@@ -8261,6 +8295,48 @@ export interface operations {
8261
8295
  };
8262
8296
  };
8263
8297
  };
8298
+ "control.hosts.charts": {
8299
+ parameters: {
8300
+ query?: {
8301
+ window?: string;
8302
+ };
8303
+ header?: never;
8304
+ path: {
8305
+ host_id: string;
8306
+ };
8307
+ cookie?: never;
8308
+ };
8309
+ requestBody?: never;
8310
+ responses: {
8311
+ /** @description Request fulfilled, document follows */
8312
+ 200: {
8313
+ headers: {
8314
+ [name: string]: unknown;
8315
+ };
8316
+ content: {
8317
+ "application/json": components["schemas"]["NodeChartsResponse"];
8318
+ };
8319
+ };
8320
+ /** @description Bad request syntax or unsupported method */
8321
+ 400: {
8322
+ headers: {
8323
+ [name: string]: unknown;
8324
+ };
8325
+ content: {
8326
+ "application/json": {
8327
+ detail: string;
8328
+ extra?:
8329
+ | null
8330
+ | {
8331
+ [key: string]: unknown;
8332
+ }
8333
+ | unknown[];
8334
+ status_code: number;
8335
+ };
8336
+ };
8337
+ };
8338
+ };
8339
+ };
8264
8340
  "control.hosts.container_action": {
8265
8341
  parameters: {
8266
8342
  query?: never;