@vates/types 1.6.0 → 1.8.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/common.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { XoHost } from './xo.mjs';
1
2
  declare const __brand: unique symbol;
2
3
  export type Branded<TBrand extends string, TType = string> = TType & {
3
4
  [__brand]: TBrand;
@@ -528,65 +529,72 @@ type XapiStatsResponse<T> = {
528
529
  interval: number;
529
530
  stats: T;
530
531
  };
532
+ type StatValues = (number | null)[];
533
+ type RecordStatValues = Record<string, StatValues>;
531
534
  export type XapiStatsGranularity = 'seconds' | 'minutes' | 'hours' | 'days';
532
- export type XapiHostStats = XapiStatsResponse<{
533
- cpus?: Record<string, number[]>;
535
+ export type XapiHostStatsRaw = {
536
+ cpus?: RecordStatValues;
534
537
  ioThroughput?: {
535
- r: Record<string, number[]>;
536
- w: Record<string, number[]>;
538
+ r: RecordStatValues;
539
+ w: RecordStatValues;
537
540
  };
538
541
  iops?: {
539
- r: Record<string, number[]>;
540
- w: Record<string, number[]>;
542
+ r: RecordStatValues;
543
+ w: RecordStatValues;
541
544
  };
542
- iowait?: Record<string, number[]>;
545
+ iowait?: RecordStatValues;
543
546
  latency?: {
544
- r: Record<string, number[]>;
545
- w: Record<string, number[]>;
547
+ r: RecordStatValues;
548
+ w: RecordStatValues;
546
549
  };
547
- load?: number[];
548
- memory?: number[];
549
- memoryFree?: number[];
550
+ load?: StatValues;
551
+ memory?: StatValues;
552
+ memoryFree?: StatValues;
550
553
  pifs?: {
551
- rx: Record<string, number[]>;
552
- tx: Record<string, number[]>;
554
+ rx: RecordStatValues;
555
+ tx: RecordStatValues;
553
556
  };
554
- }>;
555
- export type XapiVmStats = XapiStatsResponse<{
556
- cpus?: Record<string, number[]>;
557
- cpuUsage?: number[];
558
- runstateFullrun?: number[];
559
- runstateFullContention?: number[];
560
- runstatePartialRun?: number[];
561
- runstatePartialContention?: number[];
562
- runstateConcurrencyHazard?: number[];
563
- runstateBlocked?: number[];
557
+ };
558
+ export type XapiHostStats = XapiStatsResponse<XapiHostStatsRaw>;
559
+ export type XapiVmStatsRaw = {
560
+ cpus?: RecordStatValues;
561
+ cpuUsage?: StatValues;
562
+ runstateFullrun?: StatValues;
563
+ runstateFullContention?: StatValues;
564
+ runstatePartialRun?: StatValues;
565
+ runstatePartialContention?: StatValues;
566
+ runstateConcurrencyHazard?: StatValues;
567
+ runstateBlocked?: StatValues;
564
568
  iops?: {
565
- r: Record<string, number[]>;
566
- w: Record<string, number[]>;
569
+ r: RecordStatValues;
570
+ w: RecordStatValues;
567
571
  };
568
- memory?: number[];
569
- memoryFree?: number[];
570
- memoryTarget?: number[];
572
+ memory?: StatValues;
573
+ memoryFree?: StatValues;
574
+ memoryTarget?: StatValues;
571
575
  vifs?: {
572
- rx: Record<string, number[]>;
573
- tx: Record<string, number[]>;
576
+ rx: RecordStatValues;
577
+ tx: RecordStatValues;
574
578
  };
575
579
  vifErrors?: {
576
- rx: Record<string, number[]>;
577
- tx: Record<string, number[]>;
580
+ rx: RecordStatValues;
581
+ tx: RecordStatValues;
578
582
  };
579
583
  xvds?: {
580
- w?: Record<string, number[]>;
581
- r?: Record<string, number[]>;
582
- total?: Record<string, number[]>;
584
+ w?: RecordStatValues;
585
+ r?: RecordStatValues;
586
+ total?: RecordStatValues;
583
587
  };
584
588
  vbdLatency?: {
585
- w: Record<string, number[]>;
586
- r: Record<string, number[]>;
589
+ w: RecordStatValues;
590
+ r: RecordStatValues;
587
591
  };
588
- vbdIowait?: Record<string, number[]>;
589
- vbdInflight?: Record<string, number[]>;
590
- vbdAvgquSz?: Record<string, number[]>;
592
+ vbdIowait?: RecordStatValues;
593
+ vbdInflight?: RecordStatValues;
594
+ vbdAvgquSz?: RecordStatValues;
595
+ };
596
+ export type XapiVmStats = XapiStatsResponse<XapiVmStatsRaw>;
597
+ export type XapiPoolStats = Record<XoHost['id'], XapiHostStats | {
598
+ error: Record<string, unknown>;
591
599
  }>;
592
600
  export {};
@@ -1,4 +1,4 @@
1
- import { WrappedXenApiRecord, XenApiNetworkWrapped, XenApiRecord, XenApiSr, XenApiVdi, XenApiVm, XenApiVmWrapped } from '../xen-api.mjs';
1
+ import { WrappedXenApiRecord, XenApiHost, XenApiNetworkWrapped, XenApiRecord, XenApiSr, XenApiTask, XenApiVdi, XenApiVm, XenApiVmWrapped } from '../xen-api.mjs';
2
2
  import type { Readable } from 'node:stream';
3
3
  import type { XoGpuGroup, XoVgpuType, XoHost, XoNetwork, XoPif, XoSr, XoUser, XoVdi, XoVm, XoVmTemplate } from '../xo.mjs';
4
4
  type XcpPatches = {
@@ -56,9 +56,9 @@ export interface Xapi {
56
56
  /**
57
57
  * if startOnly is true and the VM is not halted, throw VM_BAD_POWER_STATE
58
58
  * otherwise, unpause/resume the VM
59
- *
60
- * @default false
61
- */
59
+ *
60
+ * @default false
61
+ */
62
62
  startOnly?: boolean;
63
63
  }): Promise<void>;
64
64
  VM_import(stream: Readable, srRef?: XenApiSr['$ref'], onVmCreation?: null | ((vm: XenApiVm) => unknown)): Promise<XenApiVm['$ref']>;
@@ -117,5 +117,12 @@ export interface Xapi {
117
117
  bypassBlockedOperation?: boolean;
118
118
  forceDeleteDefaultTemplate?: boolean;
119
119
  }): Promise<void>;
120
+ getResource(pathname: string, params?: {
121
+ host?: XenApiHost;
122
+ query?: Record<string, unknown>;
123
+ task?: boolean | XenApiTask['$ref'];
124
+ }): Promise<{
125
+ body: Readable;
126
+ }>;
120
127
  }
121
128
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vates/types",
3
3
  "private": false,
4
- "version": "1.6.0",
4
+ "version": "1.8.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "exports": {
7
7
  ".": {