@qbraid-core/devices 0.11.0 → 0.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/README.md CHANGED
@@ -15,6 +15,22 @@ npm install @qbraid-core/devices
15
15
 
16
16
  ## Usage Example
17
17
 
18
+ ### V2 API (Recommended)
19
+
20
+ ```typescript
21
+ import { QbraidSessionV1 } from '@qbraid-core/base';
22
+ import { QuantumDevicesClientV1 } from '@qbraid-core/devices';
23
+
24
+ const session = new QbraidSessionV1('your-api-key');
25
+ const client = new QuantumDevicesClientV1(session);
26
+
27
+ const devices = await client.getDevices();
28
+
29
+ devices.forEach(device => console.log(`${device.qrn} - ${device.status}`));
30
+ ```
31
+
32
+ ### V1 API (Legacy)
33
+
18
34
  ```typescript
19
35
  import { QuantumDevicesClient } from '@qbraid-core/devices';
20
36
 
@@ -1,6 +1,16 @@
1
1
  import { QbraidClient, QbraidSession } from '@qbraid-core/base';
2
- import { Device, DeviceQueryParams } from './types';
2
+ import { QbraidClientV1, QbraidSessionV1 } from '@qbraid-core/base';
3
+ import { Device, DeviceQueryParams, PlatformDevice, DeviceQueryParamsV1 } from './types';
3
4
  export declare class QuantumDevicesClient extends QbraidClient {
4
5
  constructor(session: QbraidSession);
5
6
  getDevices(params?: DeviceQueryParams): Promise<Device[]>;
6
7
  }
8
+ export declare class QuantumDevicesClientV1 extends QbraidClientV1 {
9
+ constructor(session: QbraidSessionV1);
10
+ /**
11
+ * Get devices from the V1 API.
12
+ * @param params - Optional query parameters to filter devices
13
+ * @returns Array of PlatformDevice objects
14
+ */
15
+ getDevices(params?: DeviceQueryParamsV1): Promise<PlatformDevice[]>;
16
+ }
@@ -2,8 +2,9 @@
2
2
  // Copyright (c) 2025, qBraid Development Team
3
3
  // All rights reserved.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.QuantumDevicesClient = void 0;
5
+ exports.QuantumDevicesClientV1 = exports.QuantumDevicesClient = void 0;
6
6
  const base_1 = require("@qbraid-core/base");
7
+ const base_2 = require("@qbraid-core/base");
7
8
  class QuantumDevicesClient extends base_1.QbraidClient {
8
9
  constructor(session) {
9
10
  super(session);
@@ -14,4 +15,20 @@ class QuantumDevicesClient extends base_1.QbraidClient {
14
15
  }
15
16
  }
16
17
  exports.QuantumDevicesClient = QuantumDevicesClient;
18
+ class QuantumDevicesClientV1 extends base_2.QbraidClientV1 {
19
+ constructor(session) {
20
+ super(session);
21
+ }
22
+ /**
23
+ * Get devices from the V1 API.
24
+ * @param params - Optional query parameters to filter devices
25
+ * @returns Array of PlatformDevice objects
26
+ */
27
+ async getDevices(params) {
28
+ // V1 API returns a wrapper: { success: boolean, data: PlatformDevice[] }
29
+ const response = await this.session.client.get('/devices', { params });
30
+ return response?.data?.data ?? [];
31
+ }
32
+ }
33
+ exports.QuantumDevicesClientV1 = QuantumDevicesClientV1;
17
34
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;AAEvB,4CAAgE;AAIhE,MAAa,oBAAqB,SAAQ,mBAAY;IACpD,YAAY,OAAsB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAA0B;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAW,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACzF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AATD,oDASC"}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;AAEvB,4CAAgE;AAChE,4CAAoE;AAIpE,MAAa,oBAAqB,SAAQ,mBAAY;IACpD,YAAY,OAAsB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,MAA0B;QACzC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAW,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QACzF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AATD,oDASC;AAED,MAAa,sBAAuB,SAAQ,qBAAc;IACxD,YAAY,OAAwB;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,UAAU,CAAC,MAA4B;QAC3C,yEAAyE;QACzE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAC5C,UAAU,EACV,EAAE,MAAM,EAAE,CACX,CAAC;QACF,OAAO,QAAQ,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;IACpC,CAAC;CACF;AAlBD,wDAkBC"}
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * @module devices
3
3
  */
4
- export { QuantumDevicesClient } from './client';
5
- export type { Device, DevicePricing } from './types';
4
+ export { QuantumDevicesClient, QuantumDevicesClientV1 } from './client';
5
+ export type { Device, DevicePricing, DeviceQueryParams } from './types';
6
+ export type { PlatformDevice, DeviceQueryParamsV1, DevicePricingV1, PricingModelV1, Vendor, DeviceType, ExperimentType, } from './types';
7
+ export { DeviceStatus, DeviceVerification } from './types';
package/dist/src/index.js CHANGED
@@ -2,10 +2,14 @@
2
2
  // Copyright (c) 2025, qBraid Development Team
3
3
  // All rights reserved.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.QuantumDevicesClient = void 0;
5
+ exports.DeviceVerification = exports.DeviceStatus = exports.QuantumDevicesClientV1 = exports.QuantumDevicesClient = void 0;
6
6
  /**
7
7
  * @module devices
8
8
  */
9
9
  var client_1 = require("./client");
10
10
  Object.defineProperty(exports, "QuantumDevicesClient", { enumerable: true, get: function () { return client_1.QuantumDevicesClient; } });
11
+ Object.defineProperty(exports, "QuantumDevicesClientV1", { enumerable: true, get: function () { return client_1.QuantumDevicesClientV1; } });
12
+ var types_1 = require("./types");
13
+ Object.defineProperty(exports, "DeviceStatus", { enumerable: true, get: function () { return types_1.DeviceStatus; } });
14
+ Object.defineProperty(exports, "DeviceVerification", { enumerable: true, get: function () { return types_1.DeviceVerification; } });
11
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;AAEvB;;GAEG;AACH,mCAAgD;AAAvC,8GAAA,oBAAoB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;AAEvB;;GAEG;AACH,mCAAwE;AAA/D,8GAAA,oBAAoB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAerD,iCAA2D;AAAlD,qGAAA,YAAY,OAAA;AAAE,2GAAA,kBAAkB,OAAA"}
@@ -31,3 +31,95 @@ export interface DeviceQueryParams {
31
31
  runPackage?: string;
32
32
  [key: string]: unknown;
33
33
  }
34
+ /**
35
+ * Enumeration for device verification statuses.
36
+ */
37
+ export declare enum DeviceVerification {
38
+ VERIFIED = "verified",
39
+ UNVERIFIED = "unverified",
40
+ PENDING = "pending",
41
+ FAILED = "failed"
42
+ }
43
+ /**
44
+ * Enumeration for device operational statuses.
45
+ */
46
+ export declare enum DeviceStatus {
47
+ ONLINE = "ONLINE",
48
+ UNAVAILABLE = "UNAVAILABLE",
49
+ OFFLINE = "OFFLINE",
50
+ RETIRED = "RETIRED"
51
+ }
52
+ /**
53
+ * Device type enumeration.
54
+ */
55
+ export type DeviceType = 'SIMULATOR' | 'QPU';
56
+ /**
57
+ * Vendor type enumeration.
58
+ */
59
+ export type Vendor = 'aws' | 'azure' | 'ibm' | 'ionq' | 'qbraid' | 'NEEDS ADMIN APPROVAL';
60
+ /**
61
+ * Experiment type / paradigm enumeration.
62
+ */
63
+ export type ExperimentType = 'gate_model' | 'annealing' | 'analog' | 'other';
64
+ /**
65
+ * Pricing model enumeration.
66
+ */
67
+ export type PricingModelV1 = 'fixed' | 'dynamic';
68
+ /**
69
+ * Device pricing information (V1).
70
+ */
71
+ export interface DevicePricingV1 {
72
+ perTask: number;
73
+ perShot: number;
74
+ perMinute: number;
75
+ }
76
+ export interface RuntimeDevice {
77
+ name: string;
78
+ qrn: string;
79
+ vrn: string;
80
+ vendor: Vendor;
81
+ deviceType: DeviceType;
82
+ runInputTypes: string[];
83
+ status: DeviceStatus;
84
+ statusMsg?: string | null;
85
+ nextAvailable?: string | null;
86
+ queueDepth?: number | null;
87
+ avgQueueTime?: number | null;
88
+ numberQubits?: number | null;
89
+ modality?: string | null;
90
+ noiseModels?: string[] | null;
91
+ pricingModel?: PricingModelV1 | null;
92
+ pricing?: DevicePricingV1 | null;
93
+ directAccess: boolean;
94
+ }
95
+ /**
96
+ * Device V2 schema - complete device information matching Python PlatformDevice.
97
+ * Includes all fields from RuntimeDevice + platform-specific fields.
98
+ */
99
+ export interface PlatformDevice extends RuntimeDevice {
100
+ providerId: string;
101
+ visibility: 'public' | 'private';
102
+ paradigm: ExperimentType;
103
+ verified: DeviceVerification;
104
+ requestedBy?: string | null;
105
+ pendingEdits?: unknown | null;
106
+ image?: string | null;
107
+ description?: string | null;
108
+ activeVersion?: string | null;
109
+ whiteListedDomains?: string[] | null;
110
+ blackListedDomains?: string[] | null;
111
+ notes?: string | null;
112
+ }
113
+ /**
114
+ * Query parameters for fetching devices (V1).
115
+ */
116
+ export interface DeviceQueryParamsV1 {
117
+ qrn?: string;
118
+ vendor?: Vendor;
119
+ deviceType?: DeviceType;
120
+ status?: DeviceStatus;
121
+ visibility?: 'public' | 'private';
122
+ paradigm?: ExperimentType;
123
+ verified?: DeviceVerification;
124
+ providerId?: string;
125
+ }
package/dist/src/types.js CHANGED
@@ -2,4 +2,26 @@
2
2
  // Copyright (c) 2025, qBraid Development Team
3
3
  // All rights reserved.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.DeviceStatus = exports.DeviceVerification = void 0;
6
+ // ==================== V1 Types ====================
7
+ /**
8
+ * Enumeration for device verification statuses.
9
+ */
10
+ var DeviceVerification;
11
+ (function (DeviceVerification) {
12
+ DeviceVerification["VERIFIED"] = "verified";
13
+ DeviceVerification["UNVERIFIED"] = "unverified";
14
+ DeviceVerification["PENDING"] = "pending";
15
+ DeviceVerification["FAILED"] = "failed";
16
+ })(DeviceVerification || (exports.DeviceVerification = DeviceVerification = {}));
17
+ /**
18
+ * Enumeration for device operational statuses.
19
+ */
20
+ var DeviceStatus;
21
+ (function (DeviceStatus) {
22
+ DeviceStatus["ONLINE"] = "ONLINE";
23
+ DeviceStatus["UNAVAILABLE"] = "UNAVAILABLE";
24
+ DeviceStatus["OFFLINE"] = "OFFLINE";
25
+ DeviceStatus["RETIRED"] = "RETIRED";
26
+ })(DeviceStatus || (exports.DeviceStatus = DeviceStatus = {}));
5
27
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;AAwCvB,qDAAqD;AAErD;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;AACnB,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAED;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,iCAAiB,CAAA;IACjB,2CAA2B,CAAA;IAC3B,mCAAmB,CAAA;IACnB,mCAAmB,CAAA;AACrB,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qbraid-core/devices",
3
3
  "description": "Client for the qBraid Quantum Devices service.",
4
- "version": "0.11.0",
4
+ "version": "0.12.1",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
7
7
  "author": "qBraid Development Team",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {},
39
39
  "peerDependencies": {
40
- "@qbraid-core/base": "0.11.0"
40
+ "@qbraid-core/base": "0.12.1"
41
41
  },
42
42
  "scripts": {
43
43
  "clean": "rimraf dist tsconfig.tsbuildinfo src/*.d.ts src/*.js",