@qbraid-core/jobs 0.3.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/README.md ADDED
@@ -0,0 +1,34 @@
1
+ <img align="right" width="100" alt="qbraid" src="https://qbraid-static.s3.amazonaws.com/logos/qbraid.png">
2
+
3
+ # [@qbraid-core/jobs](https://qbraid.github.io/qbraid-core-js/modules/jobs.html)
4
+
5
+ [![Stable][preview-stability]](https://qbraid.github.io/qbraid-core-js/#launch-stages)
6
+ [![npm](https://img.shields.io/npm/v/@qbraid-core/jobs?color=blue)](https://npm.im/@qbraid-core/jobs)
7
+
8
+ Client for the qBraid Quantum Jobs service.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @qbraid-core/jobs
14
+ ```
15
+
16
+ ## Usage Example
17
+
18
+ ```typescript
19
+ import { QuantumJobsClient } from '@qbraid-core/jobs';
20
+
21
+ const client = new QuantumJobsClient();
22
+
23
+ const jobs = await client.getJobs();
24
+
25
+ jobs.forEach(job => console.log(`${job.qbraidJobId} - ${job.status}`));
26
+ ```
27
+
28
+ ## License
29
+
30
+ This software is proprietary and subject to the terms of the [qBraid Commercial Software License](https://qbraid.github.io/qbraid-core-js/#license).
31
+
32
+ [stable-stability]: https://img.shields.io/badge/stability-stable-green
33
+ [preview-stability]: https://img.shields.io/badge/stability-preview-orange
34
+ [deprecated-stability]: https://img.shields.io/badge/stability-deprecated-red
@@ -0,0 +1,9 @@
1
+ import { QbraidSession, QbraidClient } from '@qbraid-core/base';
2
+ import { QuantumJobResponse, JobQueryParams, DeleteSingleJobResponse, DeleteMultipleJobsResponse, CancelResponse } from './types';
3
+ export declare class QuantumJobsClient extends QbraidClient {
4
+ constructor(session?: QbraidSession);
5
+ getJobs(params?: JobQueryParams): Promise<QuantumJobResponse[]>;
6
+ deleteJob(jobId: string): Promise<DeleteSingleJobResponse>;
7
+ deleteMultipleJobs(jobIdArray: string[]): Promise<DeleteMultipleJobsResponse>;
8
+ cancelJobs(jobId: string): Promise<CancelResponse>;
9
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ // Copyright (c) 2025, qBraid Development Team
3
+ // All rights reserved.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.QuantumJobsClient = void 0;
6
+ const base_1 = require("@qbraid-core/base");
7
+ class QuantumJobsClient extends base_1.QbraidClient {
8
+ constructor(session) {
9
+ super(session);
10
+ }
11
+ async getJobs(params) {
12
+ const queryTags = params?.tags?.reduce((accumulator, tag) => {
13
+ // reducer function for tags
14
+ accumulator[`tags.${tag.key}`] = tag.value;
15
+ return accumulator;
16
+ },
17
+ // object definition and type
18
+ {});
19
+ if (params) {
20
+ delete params.tags;
21
+ }
22
+ const finalParams = { ...params, ...queryTags };
23
+ const response = await this.session.client.get(`/quantum-jobs`, {
24
+ params: finalParams,
25
+ });
26
+ return response.data;
27
+ }
28
+ async deleteJob(jobId) {
29
+ const response = await this.session.client.delete(`/quantum-jobs/${jobId}`);
30
+ return response.data;
31
+ }
32
+ async deleteMultipleJobs(jobIdArray) {
33
+ const commaSeparatedIds = jobIdArray.join(',');
34
+ const response = await this.session.client.delete(`/quantum-jobs?ids=${commaSeparatedIds}`, {
35
+ data: { jobIdArray },
36
+ });
37
+ return response.data;
38
+ }
39
+ async cancelJobs(jobId) {
40
+ const response = await this.session.client.put(`/quantum-jobs/cancel/${jobId}`);
41
+ return response.data;
42
+ }
43
+ }
44
+ exports.QuantumJobsClient = QuantumJobsClient;
45
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;AAEvB,4CAAgE;AAUhE,MAAa,iBAAkB,SAAQ,mBAAY;IACjD,YAAY,OAAuB;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAuB;QACnC,MAAM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AAwB,KAAK,EAAE,CAAC,CAAC;QAChG,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AAlDD,8CAkDC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module jobs
3
+ */
4
+ export { QuantumJobsClient } from './client';
5
+ export type { QuantumJobResponse, DeleteSingleJobResponse, DeleteMultipleJobsResponse, CancelResponse, } from './types';
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // Copyright (c) 2025, qBraid Development Team
3
+ // All rights reserved.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.QuantumJobsClient = void 0;
6
+ /**
7
+ * @module jobs
8
+ */
9
+ var client_1 = require("./client");
10
+ Object.defineProperty(exports, "QuantumJobsClient", { enumerable: true, get: function () { return client_1.QuantumJobsClient; } });
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB;;;AAEvB;;GAEG;AACH,mCAA6C;AAApC,2GAAA,iBAAiB,OAAA"}
@@ -0,0 +1,65 @@
1
+ export interface Tag {
2
+ key: string;
3
+ value: string;
4
+ }
5
+ export interface TimeStamps {
6
+ createdAt: string;
7
+ endedAt: string;
8
+ executionDuration: number;
9
+ }
10
+ export interface JobQueryParams {
11
+ page?: number;
12
+ resultsPerPage?: number;
13
+ statusGroup?: string;
14
+ provider?: string;
15
+ search?: string;
16
+ tags?: Tag[];
17
+ }
18
+ export interface QuantumJobResponse {
19
+ timeStamps: TimeStamps;
20
+ circuitBatchNumQubits: number[];
21
+ circuitBatchDepth: number[];
22
+ sites: number[];
23
+ rabiArray: number[];
24
+ detuningArray: number[];
25
+ phaseArray: number[];
26
+ filling: number[];
27
+ queuePosition: number | null;
28
+ queueDepth: number | null;
29
+ measurements: number[];
30
+ prelight: boolean;
31
+ _id: string;
32
+ email: string;
33
+ user: string;
34
+ qbraidDeviceId: string;
35
+ vendorDeviceId: string;
36
+ vendorJobId: string;
37
+ qbraidJobId: string;
38
+ slurmJobId: number;
39
+ status: string;
40
+ qbraidStatus: string;
41
+ vendor: string;
42
+ provider: string;
43
+ escrow: number;
44
+ shots: number;
45
+ openQasm: string;
46
+ experimentType: string;
47
+ logo: string;
48
+ logoDark: string;
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ cost: number;
52
+ statusText: string;
53
+ }
54
+ export interface DeleteSingleJobResponse {
55
+ message: string;
56
+ data?: QuantumJobResponse;
57
+ }
58
+ export interface DeleteMultipleJobsResponse {
59
+ message: string;
60
+ deletedJobs?: string[];
61
+ nonDeletedJobs?: string[];
62
+ }
63
+ export interface CancelResponse {
64
+ message: string;
65
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) 2025, qBraid Development Team
3
+ // All rights reserved.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,uBAAuB"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@qbraid-core/jobs",
3
+ "description": "Client for the qBraid Quantum Jobs service.",
4
+ "version": "0.3.0",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
+ "author": "qBraid Development Team",
8
+ "license": "Proprietary",
9
+ "files": [
10
+ "dist/src"
11
+ ],
12
+ "keywords": [
13
+ "qbraid",
14
+ "qbraid-core",
15
+ "qbraid-core-js",
16
+ "qbraid jobs",
17
+ "qbraid quantum jobs",
18
+ "qbraid cloud",
19
+ "qbraid api",
20
+ "qbraid apis",
21
+ "cloud",
22
+ "quantum",
23
+ "quantum computing"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "directory": "packages/jobs",
28
+ "url": "git+https://github.com/qBraid/qbraid-core-js.git"
29
+ },
30
+ "homepage": "https://qbraid.github.io/qbraid-core-js/modules/jobs.html",
31
+ "dependencies": {
32
+ "@qbraid-core/base": "0.3.0"
33
+ },
34
+ "scripts": {
35
+ "clean": "rimraf dist tsconfig.tsbuildinfo src/*.d.ts src/*.js",
36
+ "lint": "eslint src",
37
+ "lint:fix": "eslint src --fix",
38
+ "format": "prettier --write \"src/**/*.{ts,json}\"",
39
+ "format:check": "prettier --check \"src/**/*.{ts,json}\"",
40
+ "docs": "typedoc"
41
+ },
42
+ "engines": {
43
+ "node": ">=20"
44
+ }
45
+ }