@vates/types 1.11.0 → 1.12.1

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
@@ -524,6 +524,12 @@ export declare const BACKUP_TYPE: {
524
524
  readonly mirror: "mirrorBackup";
525
525
  };
526
526
  export type BACKUP_TYPE = (typeof BACKUP_TYPE)[keyof typeof BACKUP_TYPE];
527
+ export declare const SUPPORTED_VDI_FORMAT: {
528
+ readonly raw: "raw";
529
+ readonly vhd: "vhd";
530
+ readonly qcow2: "qcow2";
531
+ };
532
+ export type SUPPORTED_VDI_FORMAT = (typeof SUPPORTED_VDI_FORMAT)[keyof typeof SUPPORTED_VDI_FORMAT];
527
533
  type XapiStatsResponse<T> = {
528
534
  endTimestamp: number;
529
535
  interval: number;
package/dist/common.mjs CHANGED
@@ -446,3 +446,8 @@ export const CERTIFICATE_TYPE = {
446
446
  };
447
447
  export const OPAQUE_REF = { EMPTY: 'OpaqueRef:NULL' };
448
448
  export const BACKUP_TYPE = { backup: 'backup', metadata: 'metadataBackup', mirror: 'mirrorBackup' };
449
+ export const SUPPORTED_VDI_FORMAT = {
450
+ raw: 'raw',
451
+ vhd: 'vhd',
452
+ qcow2: 'qcow2',
453
+ };
package/dist/index.d.mts CHANGED
@@ -2,3 +2,4 @@ export * from './common.mjs';
2
2
  export * from './xen-api.mjs';
3
3
  export * from './xo.mjs';
4
4
  export * from './lib/xen-orchestra-xapi.mjs';
5
+ export * from './lib/complex-matcher.mjs';
package/dist/index.mjs CHANGED
@@ -2,3 +2,4 @@ export * from './common.mjs';
2
2
  export * from './xen-api.mjs';
3
3
  export * from './xo.mjs';
4
4
  export * from './lib/xen-orchestra-xapi.mjs';
5
+ export * from './lib/complex-matcher.mjs';
@@ -0,0 +1,7 @@
1
+ export type Or<T> = Id<{
2
+ __or: T[];
3
+ }>;
4
+ export type Id<T> = {
5
+ id: T;
6
+ };
7
+ export type IdOr<T> = Id<T> | Or<T>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { WrappedXenApiRecord, XenApiHost, XenApiNetworkWrapped, XenApiRecord, XenApiSr, XenApiTask, XenApiVdi, XenApiVm, XenApiVmWrapped } from '../xen-api.mjs';
2
- import type { Readable } from 'node:stream';
2
+ import type { PassThrough, Readable } from 'node:stream';
3
3
  import type { XoGpuGroup, XoVgpuType, XoHost, XoNetwork, XoPif, XoSr, XoUser, XoVdi, XoVm, XoVmTemplate } from '../xo.mjs';
4
+ import type { SUPPORTED_VDI_FORMAT } from '../common.mjs';
4
5
  export type XcpPatches = {
5
6
  changelog?: {
6
7
  author: string;
@@ -45,10 +46,24 @@ export interface Xapi {
45
46
  vlan: number;
46
47
  }): Promise<XenApiNetworkWrapped>;
47
48
  deleteNetwork(id: XoNetwork['id']): Promise<void>;
49
+ exportVmOva(vmRef: XenApiVm['$ref']): Promise<PassThrough>;
48
50
  listMissingPatches(host: XoHost['id']): Promise<XcpPatches[] | XsPatches[]>;
49
51
  pool_emergencyShutdown(): Promise<void>;
50
52
  resumeVm(id: XoVm['id']): Promise<void>;
51
53
  unpauseVm(id: XoVm['id']): Promise<void>;
54
+ SR_importVdi(ref: XenApiSr['$ref'], stream: Readable, opts?: {
55
+ format?: SUPPORTED_VDI_FORMAT;
56
+ name_description?: XoVdi['name_description'];
57
+ name_label?: XoVdi['name_label'];
58
+ other_config?: XoVdi['other_config'];
59
+ read_only?: boolean;
60
+ sharable?: boolean;
61
+ SR?: XenApiSr['$ref'];
62
+ tags?: XoVdi['tags'];
63
+ type?: XoVdi['type'];
64
+ virtual_size?: XoVdi['size'];
65
+ xenstore_data?: Record<string, string>;
66
+ }): Promise<XenApiVdi['$ref']>;
52
67
  startVm(id: XoVm['id'], opts?: {
53
68
  bypassMacAddressesCheck?: boolean;
54
69
  force?: boolean;
@@ -61,6 +76,11 @@ export interface Xapi {
61
76
  */
62
77
  startOnly?: boolean;
63
78
  }): Promise<void>;
79
+ VM_export(vmRef: XenApiVm['$ref'], opts?: {
80
+ cancelToken?: unknown;
81
+ compress?: boolean;
82
+ useSnapshot?: boolean;
83
+ }): ReturnType<Xapi['getResource']>;
64
84
  VM_import(stream: Readable, srRef?: XenApiSr['$ref'], onVmCreation?: null | ((vm: XenApiVm) => unknown)): Promise<XenApiVm['$ref']>;
65
85
  createVm(templateUuid: XoVmTemplate['uuid'], metadataVm: {
66
86
  affinityHost?: XoHost['id'];
@@ -108,9 +128,17 @@ export interface Xapi {
108
128
  }, checkLimits?: boolean, creatorId?: XoUser['id'], opts?: {
109
129
  destroyAllVifs: boolean;
110
130
  }): Promise<XenApiVmWrapped>;
131
+ VDI_destroy(vdiRef: XenApiVdi['$ref']): Promise<void>;
111
132
  VDI_destroyCloudInitConfig(vdiRef: XenApiVdi['$ref'], opts?: {
112
133
  timeLimit?: number;
113
134
  }): Promise<void>;
135
+ VDI_exportContent(vdiRef: XenApiVdi['$ref'], opts: {
136
+ baseRef?: string;
137
+ cancelToken?: unknown;
138
+ format: SUPPORTED_VDI_FORMAT;
139
+ }): Promise<Readable & {
140
+ length?: number;
141
+ }>;
114
142
  VM_createCloudInitConfig(vmRef: XenApiVm['$ref'], cloudConfig: string, opts?: {
115
143
  networkConfig?: string;
116
144
  }): Promise<XoVdi['uuid']>;
package/dist/xo.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import type { BACKUP_TYPE, Branded, DOMAIN_TYPE, HOST_ALLOWED_OPERATIONS, HOST_POWER_STATE, IP_CONFIGURATION_MODE, IPV6_CONFIGURATION_MODE, NETWORK_OPERATIONS, PGPU_DOM0_ACCESS, POOL_ALLOWED_OPERATIONS, PRIMARY_ADDRESS_TYPE, STORAGE_OPERATIONS, VDI_OPERATIONS, VDI_TYPE, VIF_LOCKING_MODE, VM_OPERATIONS, VM_POWER_STATE } from './common.mjs';
1
+ import type { Branded, DOMAIN_TYPE, HOST_ALLOWED_OPERATIONS, HOST_POWER_STATE, IP_CONFIGURATION_MODE, IPV6_CONFIGURATION_MODE, NETWORK_OPERATIONS, PGPU_DOM0_ACCESS, POOL_ALLOWED_OPERATIONS, PRIMARY_ADDRESS_TYPE, STORAGE_OPERATIONS, VDI_OPERATIONS, VDI_TYPE, VIF_LOCKING_MODE, VM_OPERATIONS, VM_POWER_STATE } from './common.mjs';
2
+ import type * as CMType from './lib/complex-matcher.mjs';
2
3
  type BaseXapiXo = {
3
4
  $pool: XoPool['id'];
4
5
  /**
@@ -102,6 +103,16 @@ export type XoAlarm = Omit<XoMessage, '$object' | 'body'> & {
102
103
  href?: string;
103
104
  };
104
105
  };
106
+ type BaseXoLog = {
107
+ id: Branded<'xo-log'>;
108
+ [key: string]: unknown;
109
+ };
110
+ export type XoBackupLog = BaseXoLog & {
111
+ message: 'backup' | 'metadata';
112
+ };
113
+ export type XoRestoreLog = BaseXoLog & {
114
+ message: 'restore';
115
+ };
105
116
  export type XoBackupRepository = {
106
117
  benchmarks?: {
107
118
  readRate: number;
@@ -322,70 +333,124 @@ export type XoPool = BaseXapiXo & {
322
333
  };
323
334
  export type XoProxy = {
324
335
  id: Branded<'proxy'>;
325
- };
336
+ url: string;
337
+ version?: string;
338
+ name: string;
339
+ } & ({
340
+ address?: undefined;
341
+ vmUuid: XoVm['id'];
342
+ } | {
343
+ address: string;
344
+ vmUuid?: undefined;
345
+ } | {
346
+ address: string;
347
+ vmUuid: XoVm['id'];
348
+ });
326
349
  type BaseXoJob = {
327
350
  id: Branded<'job'>;
351
+ name?: string;
328
352
  };
329
- export type XoBackupJob = BaseXoJob & {
353
+ type XoBackupJobGeneralSettings = {
354
+ backupReportTpl?: 'compactMjml' | 'mjml';
355
+ reportWhen?: 'always' | 'error' | 'failure' | 'never';
356
+ hideSuccessfulItems?: boolean;
357
+ [key: string]: unknown;
358
+ };
359
+ export type XoVmBackupJobGeneralSettings = XoBackupJobGeneralSettings & {
360
+ cbtDestroySnapshotData?: boolean;
361
+ concurrency?: number;
362
+ longTermRetention?: {
363
+ daily?: {
364
+ retention: number;
365
+ settings: Record<string, unknown>;
366
+ };
367
+ weekly?: {
368
+ retention: number;
369
+ settings: Record<string, unknown>;
370
+ };
371
+ monthly?: {
372
+ retention: number;
373
+ settings: Record<string, unknown>;
374
+ };
375
+ yearly?: {
376
+ retention: number;
377
+ settings: Record<string, unknown>;
378
+ };
379
+ };
380
+ maxExportRate?: number;
381
+ nbdConcurrency?: number;
382
+ nRetriesVmBackupFailures?: number;
383
+ preferNbd?: boolean;
384
+ timezone?: string;
385
+ mergeBackupsSynchronously?: boolean;
386
+ offlineBackup?: boolean;
387
+ timeout?: number;
388
+ [key: string]: unknown;
389
+ };
390
+ export type XoVmBackupJobScheduleSettings = {
391
+ exportRetention?: number;
392
+ healthCheckVmsWithTags?: XoVm['tags'];
393
+ fullInterval?: number;
394
+ copyRetention?: number;
395
+ snapshotRetention?: number;
396
+ cbtDestroySnapshotData?: boolean;
397
+ healthCheckSr?: XoSr['id'];
398
+ [key: string]: unknown;
399
+ };
400
+ export type XoVmBackupJob = BaseXoJob & {
330
401
  compression?: 'native' | 'zstd' | '';
331
402
  proxy?: XoProxy['id'];
332
403
  mode: 'full' | 'delta';
333
- name?: string;
334
- remotes?: {
335
- id: XoBackupRepository['id'] | {
336
- __or: XoBackupRepository['id'][];
337
- };
338
- };
339
- vms?: {
340
- id: XoVm['id'] | {
341
- __or: XoVm['id'][];
342
- } | Record<string, unknown>;
404
+ remotes?: CMType.IdOr<XoBackupRepository['id']>;
405
+ vms: CMType.IdOr<XoVm['id']> | Record<string, unknown>;
406
+ srs?: CMType.IdOr<XoSr['id']>;
407
+ type: 'backup';
408
+ settings: {
409
+ '': XoVmBackupJobGeneralSettings;
410
+ [key: XoSchedule['id']]: XoVmBackupJobScheduleSettings | undefined;
343
411
  };
344
- srs: {
345
- id: XoSr['id'] | {
346
- __or: XoSr['id'][];
347
- };
412
+ };
413
+ export type XoMetadataBackupJobGeneralSettings = XoBackupJobGeneralSettings;
414
+ export type XoMetadataBackupJobScheduleSettings = {
415
+ retentionPoolMetadata?: number;
416
+ retentionXoMetadata?: number;
417
+ [key: string]: unknown;
418
+ };
419
+ export type XoMetadataBackupJob = BaseXoJob & {
420
+ type: 'metadataBackup';
421
+ pools?: CMType.IdOr<XoPool['id']>;
422
+ remotes: CMType.IdOr<XoBackupRepository['id']>;
423
+ settings: {
424
+ ''?: XoMetadataBackupJobGeneralSettings;
425
+ [scheduleId: XoSchedule['id']]: XoMetadataBackupJobScheduleSettings | undefined;
348
426
  };
349
- type: BACKUP_TYPE;
427
+ xoMetadata?: boolean;
428
+ userId: XoUser['id'];
429
+ proxy?: XoProxy['id'];
430
+ };
431
+ export type XoMirrorBackupGeneralSettings = XoBackupJobGeneralSettings & {
432
+ concurrency?: number;
433
+ nRetriesVmBackupFailures?: number;
434
+ timeout?: number;
435
+ maxExportRate?: number;
436
+ backupReportTpl?: 'compactMjml';
437
+ reportWhen: 'failure';
438
+ [key: string]: unknown;
439
+ };
440
+ export type XoMirrorBackupScheduleSettings = {
441
+ exportRetention?: number;
442
+ healthCheckVmsWithTags?: XoVm['tags'];
443
+ healthCheckSr?: XoSr['id'];
444
+ [key: string]: unknown;
445
+ };
446
+ export type XoMirrorBackupJob = BaseXoJob & {
447
+ type: 'mirrorBackup';
448
+ mode: 'full' | 'delta';
449
+ sourceRemote: XoBackupRepository['id'];
450
+ remotes: CMType.IdOr<XoBackupRepository['id']>;
350
451
  settings: {
351
- '': {
352
- cbtDestroySnapshotData?: boolean;
353
- concurrency?: number;
354
- longTermRetention?: {
355
- daily?: {
356
- retention: number;
357
- settings: Record<string, unknown>;
358
- };
359
- weekly?: {
360
- retention: number;
361
- settings: Record<string, unknown>;
362
- };
363
- monthly?: {
364
- retention: number;
365
- settings: Record<string, unknown>;
366
- };
367
- yearly?: {
368
- retention: number;
369
- settings: Record<string, unknown>;
370
- };
371
- };
372
- maxExportRate?: number;
373
- nbdConcurrency?: number;
374
- nRetriesVmBackupFailures?: number;
375
- preferNbd?: boolean;
376
- timezone?: string;
377
- [key: string]: unknown;
378
- };
379
- [key: XoSchedule['id']]: {
380
- exportRetention?: number;
381
- healthCheckSr?: XoSr['id'];
382
- healthCheckVmsWithTags?: string[];
383
- fullInterval?: number;
384
- copyRetention?: number;
385
- snapshotRetention?: number;
386
- cbtDestroySnapshotData?: boolean;
387
- [key: string]: unknown;
388
- };
452
+ '': XoMirrorBackupGeneralSettings;
453
+ [scheduleId: XoSchedule['id']]: XoMirrorBackupScheduleSettings | undefined;
389
454
  };
390
455
  };
391
456
  export type XoJob = BaseXoJob & {};
@@ -393,7 +458,7 @@ export type XoSchedule = {
393
458
  cron: string;
394
459
  enabled: boolean;
395
460
  id: Branded<'schedule'>;
396
- jobId: (XoJob | XoBackupJob)['id'];
461
+ jobId: AnyXoJob['id'];
397
462
  name?: string;
398
463
  timezone?: string;
399
464
  };
@@ -469,7 +534,7 @@ export type XoTask = {
469
534
  status: 'failure' | 'interrupted' | 'pending' | 'success';
470
535
  tasks?: XoTask[];
471
536
  updatedAt?: number;
472
- warning?: {
537
+ warnings?: {
473
538
  data: unknown;
474
539
  message: string;
475
540
  }[];
@@ -484,6 +549,20 @@ export type XoUser = {
484
549
  pw_hash?: string;
485
550
  preferences: Record<string, string>;
486
551
  };
552
+ export type XoAuthenticationToken = {
553
+ client?: {
554
+ id: string;
555
+ [key: string]: unknown;
556
+ };
557
+ created_at?: number;
558
+ description?: string;
559
+ user_id: XoUser['id'];
560
+ expiration: number;
561
+ last_uses?: Record<string, {
562
+ timestamp: number;
563
+ }>;
564
+ id: Branded<'authentication-token'>;
565
+ };
487
566
  export type XoVbd = BaseXapiXo & {
488
567
  attached: boolean;
489
568
  bootable: boolean;
@@ -601,9 +680,11 @@ export type XoVtpm = BaseXapiXo & {
601
680
  type: 'VTPM';
602
681
  };
603
682
  export type XapiXoRecord = XoAlarm | XoGpuGroup | XoHost | XoMessage | XoNetwork | XoPci | XoPgpu | XoPif | XoPool | XoSr | XoVbd | XoVdi | XoVdiSnapshot | XoVdiUnmanaged | XoVgpu | XoVgpuType | XoVif | XoVm | XoVmController | XoVmSnapshot | XoVmTemplate | XoVtpm | XoSm;
604
- export type NonXapiXoRecord = XoGroup | XoProxy | XoJob | XoBackupRepository | XoSchedule | XoServer | XoTask | XoUser;
683
+ export type NonXapiXoRecord = AnyXoJob | AnyXoLog | XoGroup | XoProxy | XoBackupRepository | XoSchedule | XoServer | XoTask | XoUser;
605
684
  export type XoRecord = XapiXoRecord | NonXapiXoRecord;
606
685
  export type AnyXoVm = XoVm | XoVmSnapshot | XoVmTemplate | XoVmController;
607
686
  export type AnyXoVdi = XoVdi | XoVdiSnapshot | XoVdiUnmanaged;
608
- export type AnyXoJob = XoJob | XoBackupJob;
687
+ export type AnyXoJob = XoJob | AnyXoBackupJob;
688
+ export type AnyXoBackupJob = XoVmBackupJob | XoMetadataBackupJob | XoMirrorBackupJob;
689
+ export type AnyXoLog = XoBackupLog | XoRestoreLog;
609
690
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vates/types",
3
3
  "private": false,
4
- "version": "1.11.0",
4
+ "version": "1.12.1",
5
5
  "main": "./dist/index.mjs",
6
6
  "exports": {
7
7
  ".": {
@@ -21,6 +21,10 @@
21
21
  "./lib/xen-orchestra/*": {
22
22
  "default": "./dist/lib/xen-orchestra-*.mjs",
23
23
  "type": "./dist/lib/xen-orchestra-*.d.mts"
24
+ },
25
+ "./lib/complex-matcher": {
26
+ "default": "./dist/lib/complex-matcher.mjs",
27
+ "type": "./dist/lib/complex-matcher.d.mts"
24
28
  }
25
29
  },
26
30
  "type": "module",
package/tsconfig.json CHANGED
@@ -5,7 +5,8 @@
5
5
  "strict": true,
6
6
  "module": "ESNext",
7
7
  "target": "ES2022",
8
- "skipLibCheck": true
8
+ "skipLibCheck": true,
9
+ "types": ["node"] // Only use types from Node.js and packages that are explicitly imported
9
10
  },
10
11
  "include": ["src/**/*"],
11
12
  "exclude": ["node_modules", "dist"]