@vates/types 1.25.1 → 1.27.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.
@@ -1,7 +1,64 @@
1
1
  import { WrappedXenApiRecord, XenApiHost, XenApiHostWrapped, XenApiNetwork, XenApiNetworkWrapped, XenApiRecord, XenApiSr, XenApiTask, XenApiVbd, XenApiVdi, XenApiVif, XenApiVm, XenApiVmWrapped, XenApiVtpm } from '../xen-api.mjs';
2
- import type { BOND_MODE, OPAQUE_REF_NULL, SUPPORTED_VDI_FORMAT, VBD_MODE, VBD_TYPE, VDI_TYPE, VIF_LOCKING_MODE } from '../common.mjs';
2
+ import type { BOND_MODE, OPAQUE_REF_NULL, SUPPORTED_VDI_FORMAT, VBD_MODE, VBD_TYPE, VDI_TYPE, VIF_LOCKING_MODE, VM_OPERATIONS } from '../common.mjs';
3
3
  import type { PassThrough, Readable } from 'node:stream';
4
4
  import type { XapiXoRecord, XoGpuGroup, XoHost, XoNetwork, XoPif, XoSr, XoUser, XoVdi, XoVgpuType, XoVm, XoVmTemplate, XoVif, XoVmSnapshot } from '../xo.mjs';
5
+ /**
6
+ * Properties accepted by {@link Xapi.editVm}.
7
+ *
8
+ * Field names match the canonical (camelCase) properties defined by the
9
+ * underlying `_editVm` (via `makeEditObject`). `_editVm` still resolves the
10
+ * snake_case and legacy aliases, but the canonical names are used here.
11
+ */
12
+ export interface EditVmProps {
13
+ affinityHost?: string | null;
14
+ autoPoweron?: boolean;
15
+ blockedOperations?: Partial<Record<VM_OPERATIONS, boolean | string | null>>;
16
+ coresPerSocket?: number | string | null;
17
+ cpuCap?: number | null;
18
+ cpuMask?: number[];
19
+ cpuWeight?: number | null;
20
+ cpus?: number;
21
+ cpusStaticMax?: number | string;
22
+ /**
23
+ * Update VM creation metadata stored under `other_config.xo:*`. The object is
24
+ * merged with the existing data.
25
+ */
26
+ creation?: {
27
+ user?: string;
28
+ };
29
+ expNestedHvm?: boolean;
30
+ hasVendorDevice?: boolean;
31
+ highAvailability?: 'best-effort' | 'restart' | '';
32
+ hvmBootFirmware?: string | null;
33
+ memory?: number | string;
34
+ memoryMax?: number | string;
35
+ memoryMin?: number | string;
36
+ memoryStaticMax?: number | string;
37
+ nameDescription?: string;
38
+ nameLabel?: string;
39
+ nestedVirt?: boolean;
40
+ nicType?: string | null;
41
+ notes?: string | null;
42
+ PV_args?: string;
43
+ secureBoot?: boolean;
44
+ startDelay?: number;
45
+ suspendSr?: string | null;
46
+ tags?: string[];
47
+ uefiMode?: 'setup' | 'user';
48
+ vga?: 'std' | 'cirrus';
49
+ videoram?: 1 | 2 | 4 | 8 | 16;
50
+ viridian?: boolean;
51
+ virtualizationMode?: 'pv' | 'hvm';
52
+ xenStoreData?: Record<string, string | null>;
53
+ }
54
+ /** Properties accepted by {@link Xapi.editVif}. */
55
+ export interface EditVifProps {
56
+ ipv4Allowed?: string[];
57
+ ipv6Allowed?: string[];
58
+ lockingMode?: VIF_LOCKING_MODE;
59
+ rateLimit?: number | null;
60
+ txChecksumming?: boolean;
61
+ }
5
62
  export type XcpPatches = {
6
63
  changelog?: {
7
64
  author: string;
@@ -31,6 +88,21 @@ export type XsPatches = {
31
88
  uuid?: string;
32
89
  };
33
90
  export interface Xapi {
91
+ status: string;
92
+ pool?: {
93
+ uuid: string;
94
+ };
95
+ sessionId: string;
96
+ _auth: {
97
+ user: string;
98
+ password: string;
99
+ };
100
+ _url: {
101
+ protocol: string;
102
+ hostname: string;
103
+ hostnameRaw: string;
104
+ port?: string;
105
+ };
34
106
  call: <ReturnType>(...args: unknown[]) => Promise<ReturnType>;
35
107
  callAsync: <ReturnType>(...args: unknown[]) => Promise<ReturnType>;
36
108
  barrier<T extends XenApiRecord>(ref: T['$ref']): Promise<Extract<WrappedXenApiRecord, {
@@ -71,6 +143,7 @@ export interface Xapi {
71
143
  sr?: XoSr['id'];
72
144
  bypassAssert?: boolean;
73
145
  }): Promise<void>;
146
+ joinPool(masterAddress: string, masterUsername: string, masterPassword: string, force?: boolean): Promise<void>;
74
147
  listMissingPatches(host: XoHost['id']): Promise<XcpPatches[] | XsPatches[]>;
75
148
  pool_emergencyShutdown(): Promise<void>;
76
149
  resumeVm(id: XoVm['id']): Promise<void>;
@@ -105,6 +178,8 @@ export interface Xapi {
105
178
  xenstore_data?: Record<string, string>;
106
179
  }): Promise<XenApiVdi['$ref']>;
107
180
  SR_reclaimSpace(ref: XenApiSr['$ref']): Promise<void>;
181
+ editVm(id: XoVm['id'], props: EditVmProps, checkLimits?: (limits: Record<string, number>, vm: XenApiVmWrapped) => Promise<void>): Promise<void>;
182
+ editVif(id: XoVif['id'], props: EditVifProps): Promise<void>;
108
183
  startVm(id: XoVm['id'], opts?: {
109
184
  bypassMacAddressesCheck?: boolean;
110
185
  force?: boolean;
@@ -119,7 +194,7 @@ export interface Xapi {
119
194
  }): Promise<void>;
120
195
  VM_export(vmRef: XenApiVm['$ref'], opts?: {
121
196
  cancelToken?: unknown;
122
- compress?: boolean;
197
+ compress?: boolean | 'zstd' | 'gzip';
123
198
  useSnapshot?: boolean;
124
199
  }): ReturnType<Xapi['getResource']>;
125
200
  VM_import(stream: Readable, srRef?: XenApiSr['$ref'], onVmCreation?: null | ((vm: XenApiVm) => unknown)): Promise<XenApiVm['$ref']>;
@@ -115,6 +115,7 @@ export interface XenApiPool {
115
115
  ha_host_failures_to_tolerate: number;
116
116
  ha_overcommitted: boolean;
117
117
  ha_plan_exists_for: number;
118
+ ha_reboot_vm_on_internal_shutdown?: boolean;
118
119
  ha_statefiles: string[];
119
120
  health_check_config: Record<string, string>;
120
121
  igmp_snooping_enabled?: boolean;
package/dist/xo-app.d.mts CHANGED
@@ -1,19 +1,8 @@
1
1
  import { EventEmitter } from 'node:stream';
2
- import type { AnyXoBackupJob, AnyXoJob, AnyXoLog, XapiXoRecord, XoAuthenticationToken, XoBackupRepository, XoConfigBackupArchive, XoGroup, XoHost, XoPool, XoPoolBackupArchive, XoProxy, XoSchedule, XoServer, XoTask, XoUser, XoVm, XoVmBackupArchive } from './xo.mjs';
2
+ import type { AnyXoJob, AnyXoLog, XapiXoRecord, XoAuthenticationToken, XoBackupRepository, XoConfigBackupArchive, XoGroup, XoHost, XoPool, XoPoolBackupArchive, XoProxy, XoSchedule, XoServer, XoTask, XoUser, XoVif, XoVm, XoVmBackupArchive } from './xo.mjs';
3
3
  import { VatesTask } from './lib/vates-task.mjs';
4
4
  import { Xapi, XapiHostStats, XapiPoolStats, XapiStatsGranularity, XapiVmStats, XenApiGpuGroupWrapped, XenApiHostWrapped, XenApiMessageWrapped, XenApiNetworkWrapped, XenApiPbdWrapped, XenApiPciWrapped, XenApiPgpuWrapped, XenApiPifWrapped, XenApiPoolWrapped, XenApiSmWrapped, XenApiSrWrapped, XenApiVbdWrapped, XenApiVdiWrapped, XenApiVgpuTypeWrapped, XenApiVgpuWrapped, XenApiVifWrapped, XenApiVmWrapped, XenApiVtpmWrapped, XoAclBasePrivilege, XoAclRole, XoGroupRole, XoUserRole } from './index.mjs';
5
- export type XapiConnection = Xapi & {
6
- status: string;
7
- pool?: {
8
- uuid: string;
9
- };
10
- sessionId: string;
11
- _url?: {
12
- protocol: string;
13
- hostname: string;
14
- port?: string;
15
- };
16
- };
5
+ type FeatureCode = 'BACKUP.DELTA' | 'BACKUP.DELTA_REPLICATION' | 'BACKUP.FULL' | 'BACKUP.HEALTHCHECK' | 'BACKUP.METADATA' | 'BACKUP.MIRROR' | 'BACKUP.WITH_RAM' | 'BACKUP.SMART_BACKUP' | 'BACKUP.S3' | 'DOCKER' | 'EXPORT.XVA' | 'LIST_MISSING_PATCHES' | 'POOL_EMERGENCY_SHUTDOWN' | 'RBAC' | 'ROLLING_POOL_UPDATE' | 'ROLLING_POOL_REBOOT' | 'WARM_MIGRATION' | 'PLUGIN.OPENMETRICS';
17
6
  type XapiRecordByXapiXoRecord = {
18
7
  gpuGroup: XenApiGpuGroupWrapped;
19
8
  host: XenApiHostWrapped;
@@ -124,6 +113,7 @@ export type XoApp = {
124
113
  user?: XoUser;
125
114
  permission?: XoUser['permission'] | 'none' | null;
126
115
  };
116
+ allocIpAddresses(vifId: XoVif['id'], addAddresses?: string[], removeAddresses?: string[]): Promise<void>;
127
117
  addAclV2GroupRole(groupId: XoGroup['id'], roleId: XoAclRole['id']): Promise<XoGroupRole>;
128
118
  addAclV2UserRole(userId: XoUser['id'], roleId: XoAclRole['id']): Promise<XoUserRole>;
129
119
  addUserToGroup: (userId: XoUser['id'], groupId: XoGroup['id']) => Promise<void>;
@@ -145,7 +135,7 @@ export type XoApp = {
145
135
  expiration: number;
146
136
  user: XoUser;
147
137
  }>;
148
- checkFeatureAuthorization(featureCode: string): Promise<void>;
138
+ checkFeatureAuthorization(featureCode: FeatureCode): Promise<void>;
149
139
  connectXenServer(id: XoServer['id']): Promise<void>;
150
140
  createAclV2Privilege(privilege: Omit<XoAclBasePrivilege, 'id'>, options?: {
151
141
  force?: boolean;
@@ -167,6 +157,12 @@ export type XoApp = {
167
157
  expiresIn?: string | number;
168
158
  userId: XoUser['id'];
169
159
  }): Promise<XoAuthenticationToken>;
160
+ createRemote(params: {
161
+ name: string;
162
+ options?: string;
163
+ proxy?: XoProxy['id'];
164
+ url: string;
165
+ }): Promise<XoBackupRepository>;
170
166
  createUser(params: {
171
167
  name?: string;
172
168
  password?: string;
@@ -187,6 +183,7 @@ export type XoApp = {
187
183
  providerGroup?: string;
188
184
  }): Promise<XoGroup>;
189
185
  disconnectXenServer(id: XoServer['id']): Promise<void>;
186
+ findEnabledScheduleSequenceFromSchedule(id: XoSchedule['id']): Promise<XoSchedule | undefined>;
190
187
  getAclV2Privilege(id: XoAclBasePrivilege['id']): Promise<XoAclBasePrivilege>;
191
188
  getAclV2Privileges(): Promise<XoAclBasePrivilege[]>;
192
189
  getAclV2RolePrivileges(roleId: XoAclRole['id']): Promise<XoAclBasePrivilege[]>;
@@ -196,13 +193,14 @@ export type XoApp = {
196
193
  getAclV2UserPrivileges(userId: XoUser['id']): Promise<XoAclBasePrivilege[]>;
197
194
  getAllGroups(): Promise<XoGroup[]>;
198
195
  getAllProxies(): Promise<XoProxy[]>;
199
- getAllJobs<T extends AnyXoBackupJob['type']>(type: T): Promise<Extract<AnyXoBackupJob, {
196
+ getAllJobs<T extends AnyXoJob['type']>(type: T): Promise<Extract<AnyXoJob, {
200
197
  type: T;
201
198
  }>[]>;
202
199
  getAllJobs(type?: string): Promise<AnyXoJob[]>;
203
200
  getProxy(id: XoProxy['id']): Promise<XoProxy>;
204
201
  getRemote(id: XoBackupRepository['id']): Promise<XoBackupRepository>;
205
202
  getAllRemotes(): Promise<XoBackupRepository[]>;
203
+ removeRemote(id: XoBackupRepository['id']): Promise<void>;
206
204
  getAllRemotesInfo(): Promise<Record<XoBackupRepository['id'], {
207
205
  size?: number;
208
206
  used?: number;
@@ -269,6 +267,8 @@ export type XoApp = {
269
267
  rebootVm?: boolean;
270
268
  parentTask?: VatesTask;
271
269
  }): Promise<void>;
270
+ setVmResourceSet(vmId: XoVm['id'], resourceSetId: string | null, force?: boolean): Promise<void>;
271
+ shareVmResourceSet(vmId: XoVm['id']): Promise<void>;
272
272
  removeUserFromGroup(userId: XoUser['id'], id: XoGroup['id']): Promise<void>;
273
273
  runJob(job: AnyXoJob, schedule: XoSchedule): void;
274
274
  runWithApiContext: (user: XoUser | undefined, fn: () => void) => Promise<unknown>;
@@ -295,7 +295,14 @@ export type XoApp = {
295
295
  updateGroup(id: XoGroup['id'], updates: {
296
296
  name?: string;
297
297
  }): void;
298
- getAllXapis(): Record<string, XapiConnection>;
298
+ updateRemote(id: XoBackupRepository['id'], params: {
299
+ enabled?: boolean;
300
+ name?: string;
301
+ options?: string | null;
302
+ proxy?: XoProxy['id'] | null;
303
+ url?: string;
304
+ }): Promise<XoBackupRepository>;
305
+ getAllXapis(): Record<string, Xapi>;
299
306
  getObjects(opts?: {
300
307
  filter?: Record<string, unknown>;
301
308
  limit?: number;
package/dist/xo.d.mts CHANGED
@@ -400,6 +400,7 @@ export type XoPool = BaseXapiXo & {
400
400
  current_operations: Record<string, POOL_ALLOWED_OPERATIONS>;
401
401
  default_SR?: XoSr['id'];
402
402
  HA_enabled: boolean;
403
+ haRebootVmOnInternalShutdown: boolean;
403
404
  haSrs: XoSr['id'][];
404
405
  id: Branded<'pool'>;
405
406
  master: XoHost['id'];
@@ -541,6 +542,18 @@ export type XoMirrorBackupJob = BaseXoJob & {
541
542
  };
542
543
  export type XoJob = BaseXoJob & {
543
544
  type: 'call';
545
+ method: string;
546
+ paramsVector?: {
547
+ type: string;
548
+ items: {
549
+ type?: string;
550
+ values?: {
551
+ schedules?: XoSchedule['id'][];
552
+ [key: string]: unknown;
553
+ }[];
554
+ [key: string]: unknown;
555
+ }[];
556
+ };
544
557
  };
545
558
  export type XoSchedule = {
546
559
  cron: string;
@@ -773,7 +786,7 @@ export type XoVtpm = BaseXapiXo & {
773
786
  type: 'VTPM';
774
787
  };
775
788
  export type XapiXoRecord = XoAlarm | XoGpuGroup | XoHost | XoMessage | XoNetwork | XoPbd | XoPci | XoPgpu | XoPif | XoPool | XoSr | XoVbd | XoVdi | XoVdiSnapshot | XoVdiUnmanaged | XoVgpu | XoVgpuType | XoVif | XoVm | XoVmController | XoVmSnapshot | XoVmTemplate | XoVtpm | XoSm;
776
- export type NonXapiXoRecord<TActionsByResource extends XoAclSupportedActionsByResource = never, TResource extends string = never> = AnyXoBackupArchive | AnyXoJob | AnyXoLog | XoGroup | XoProxy | XoGroup | XoProxy | XoJob | XoBackupRepository | XoSchedule | XoServer | XoTask | XoUser | XoAclRole | XoAclPrivilege<TActionsByResource, TResource>;
789
+ export type NonXapiXoRecord<TActionsByResource extends XoAclSupportedActionsByResource = never, TResource extends string = never> = AnyXoBackupArchive | AnyXoJob | AnyXoLog | XoGroup | XoProxy | XoJob | XoBackupRepository | XoSchedule | XoServer | XoTask | XoUser | XoAclRole | XoAclPrivilege<TActionsByResource, TResource>;
777
790
  export type XoRecord<TActionsByResource extends XoAclSupportedActionsByResource = never, TResource extends string = never> = XapiXoRecord | NonXapiXoRecord<TActionsByResource, TResource>;
778
791
  export type AnyXoVm = XoVm | XoVmSnapshot | XoVmTemplate | XoVmController;
779
792
  export type AnyXoVdi = XoVdi | XoVdiSnapshot | XoVdiUnmanaged;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vates/types",
3
3
  "private": false,
4
- "version": "1.25.1",
4
+ "version": "1.27.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "exports": {
7
7
  ".": {
@@ -32,7 +32,7 @@
32
32
  "devDependencies": {
33
33
  "@eslint/js": "^9.19.0",
34
34
  "typescript": "~5.6.3",
35
- "typescript-eslint": "^8.23.0"
35
+ "typescript-eslint": "^8.61.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsc",