@vates/types 1.24.0 → 1.25.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,7 @@
1
1
  import { WrappedXenApiRecord, XenApiHost, XenApiHostWrapped, XenApiNetwork, XenApiNetworkWrapped, XenApiRecord, XenApiSr, XenApiTask, XenApiVbd, XenApiVdi, XenApiVif, XenApiVm, XenApiVmWrapped, XenApiVtpm } from '../xen-api.mjs';
2
2
  import type { BOND_MODE, OPAQUE_REF_NULL, SUPPORTED_VDI_FORMAT, VBD_MODE, VBD_TYPE, VDI_TYPE, VIF_LOCKING_MODE } from '../common.mjs';
3
3
  import type { PassThrough, Readable } from 'node:stream';
4
- import type { XapiXoRecord, XoGpuGroup, XoHost, XoNetwork, XoPif, XoSr, XoUser, XoVdi, XoVgpuType, XoVm, XoVmTemplate, XoVif } from '../xo.mjs';
4
+ import type { XapiXoRecord, XoGpuGroup, XoHost, XoNetwork, XoPif, XoSr, XoUser, XoVdi, XoVgpuType, XoVm, XoVmTemplate, XoVif, XoVmSnapshot } from '../xo.mjs';
5
5
  export type XcpPatches = {
6
6
  changelog?: {
7
7
  author: string;
@@ -74,6 +74,7 @@ export interface Xapi {
74
74
  listMissingPatches(host: XoHost['id']): Promise<XcpPatches[] | XsPatches[]>;
75
75
  pool_emergencyShutdown(): Promise<void>;
76
76
  resumeVm(id: XoVm['id']): Promise<void>;
77
+ revertVm(snapshotId: XoVmSnapshot['id']): Promise<void>;
77
78
  unpauseVm(id: XoVm['id']): Promise<void>;
78
79
  cloneVm(vmId: XoVm['id'], opts?: {
79
80
  nameLabel?: string;
@@ -261,4 +262,13 @@ export interface Xapi {
261
262
  is_unique?: boolean;
262
263
  contents?: string;
263
264
  }): Promise<XenApiVtpm['$ref']>;
265
+ destroySr(id: XoSr['id']): Promise<void>;
266
+ xostor_delete(ref: XenApiSr['$ref']): Promise<void>;
267
+ objects: {
268
+ indexes: {
269
+ type: {
270
+ [XenApiRecord in WrappedXenApiRecord as XenApiRecord['$type']]: Record<XenApiRecord['uuid'], XenApiRecord>;
271
+ };
272
+ };
273
+ };
264
274
  }
@@ -404,7 +404,9 @@ export interface XenApiDrTask {
404
404
  introduced_SRs: XenApiSr['$ref'][];
405
405
  uuid: string;
406
406
  }
407
- type XenApiHostCallMethods = TagCallMethods & {};
407
+ type XenApiHostCallMethods = TagCallMethods & {
408
+ <T>(method: 'call_plugin', plugin: string, fn: string, args: Record<string, string>): Promise<T>;
409
+ };
408
410
  export interface XenApiHost {
409
411
  $ref: Branded<'host'>;
410
412
  address: string;
package/dist/xo-app.d.mts CHANGED
@@ -39,7 +39,41 @@ type XapiRecordByXapiXoRecord = {
39
39
  'VM-template': XenApiVmWrapped;
40
40
  VTPM: XenApiVtpmWrapped;
41
41
  };
42
+ type LicenseProductId = 'premium' | 'xcpng-enterprise' | 'xcpng-standard' | 'xo-proxy' | 'xosan.trial' | 'xostor' | 'xostor.trial';
43
+ type LicenseProductType = 'xo' | 'xoproxy' | 'xcpng' | 'xosan' | 'xostor';
44
+ type License = {
45
+ id: string;
46
+ type: 'license';
47
+ created: number;
48
+ licenseType: 'unit';
49
+ productId: LicenseProductId;
50
+ tags: string[];
51
+ expires?: number;
52
+ boundObjectId?: string;
53
+ bindDate?: number;
54
+ buyer?: {
55
+ token: string;
56
+ email: string;
57
+ };
58
+ history?: {
59
+ date: number;
60
+ boundObjectId: string;
61
+ }[];
62
+ rebound?: number;
63
+ productTypes?: LicenseProductType[];
64
+ bundleInfo?: {
65
+ name: string;
66
+ id: string;
67
+ };
68
+ };
42
69
  export type XoApp = {
70
+ hooks: EventEmitter;
71
+ _redis: {
72
+ get(key: string): Promise<string | null>;
73
+ mSet(args: string[]): Promise<unknown>;
74
+ sMembers(key: string): Promise<string[]>;
75
+ sIsMember(key: string, member: string): Promise<boolean>;
76
+ };
43
77
  config: {
44
78
  get<T = string>(path: string): T;
45
79
  getOptional(path: string): Record<string, string> | undefined;
@@ -93,6 +127,10 @@ export type XoApp = {
93
127
  addAclV2GroupRole(groupId: XoGroup['id'], roleId: XoAclRole['id']): Promise<XoGroupRole>;
94
128
  addAclV2UserRole(userId: XoUser['id'], roleId: XoAclRole['id']): Promise<XoUserRole>;
95
129
  addUserToGroup: (userId: XoUser['id'], groupId: XoGroup['id']) => Promise<void>;
130
+ addApiMethod: <A extends unknown[], R>(name: string, method: (...args: A) => Promise<R>, info: {
131
+ resolve?: any;
132
+ params?: any;
133
+ }) => () => void;
96
134
  authenticateUser: (credentials: {
97
135
  token?: string;
98
136
  username?: string;
@@ -262,5 +300,18 @@ export type XoApp = {
262
300
  filter?: Record<string, unknown>;
263
301
  limit?: number;
264
302
  }): Record<string, XapiXoRecord>;
303
+ getLicenses(params?: {
304
+ productType?: LicenseProductType;
305
+ }): Promise<License[]>;
306
+ bindLicense(params: {
307
+ licenseId: string;
308
+ boundObjectId: string;
309
+ }): Promise<License>;
310
+ unbindLicense(params: {
311
+ productId: LicenseProductId;
312
+ boundObjectId: string;
313
+ licenseId: string;
314
+ data?: Record<string, string>;
315
+ }): Promise<License>;
265
316
  };
266
317
  export {};
package/dist/xo.d.mts CHANGED
@@ -621,7 +621,7 @@ export type XoTask = {
621
621
  userId?: string;
622
622
  [key: string]: unknown | undefined;
623
623
  };
624
- result: Record<string, unknown>;
624
+ result?: Record<string, unknown>;
625
625
  start: number;
626
626
  status: 'failure' | 'interrupted' | 'pending' | 'success';
627
627
  tasks?: XoTask[];
@@ -637,7 +637,7 @@ export type XoUser = {
637
637
  groups: XoGroup['id'][];
638
638
  id: Branded<'user'>;
639
639
  name?: string;
640
- permission: string;
640
+ permission: 'none' | 'admin';
641
641
  pw_hash?: string;
642
642
  preferences: Record<string, string>;
643
643
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vates/types",
3
3
  "private": false,
4
- "version": "1.24.0",
4
+ "version": "1.25.0",
5
5
  "main": "./dist/index.mjs",
6
6
  "exports": {
7
7
  ".": {