@blaxel/core 0.2.3-dev1 → 0.2.4-dev.63
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/authentication/clientcredentials.d.ts +2 -0
- package/dist/authentication/clientcredentials.js +16 -1
- package/dist/common/internal.js +127 -5
- package/dist/common/internal.test.d.ts +1 -0
- package/dist/common/internal.test.js +30 -0
- package/dist/index.browser.test.d.ts +1 -0
- package/dist/index.browser.test.js +45 -0
- package/package.json +9 -3
- package/dist/jobs/batches.d.ts +0 -32
- package/dist/jobs/batches.js +0 -40
- package/dist/jobs/job.d.ts +0 -33
- package/dist/jobs/job.js +0 -51
|
@@ -9,6 +9,8 @@ export declare class ClientCredentials extends Credentials {
|
|
|
9
9
|
get workspace(): string;
|
|
10
10
|
needRefresh(): boolean;
|
|
11
11
|
authenticate(): Promise<void>;
|
|
12
|
+
private sleep;
|
|
13
|
+
processWithRetry(retry?: number): Promise<void>;
|
|
12
14
|
process(): Promise<void>;
|
|
13
15
|
get authorization(): string;
|
|
14
16
|
get token(): string;
|
|
@@ -42,9 +42,24 @@ class ClientCredentials extends credentials_js_1.Credentials {
|
|
|
42
42
|
if (!this.needRefresh()) {
|
|
43
43
|
return this.currentPromise || Promise.resolve();
|
|
44
44
|
}
|
|
45
|
-
this.currentPromise = this.
|
|
45
|
+
this.currentPromise = this.processWithRetry();
|
|
46
46
|
return this.currentPromise;
|
|
47
47
|
}
|
|
48
|
+
sleep(ms) {
|
|
49
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
50
|
+
}
|
|
51
|
+
async processWithRetry(retry = 3) {
|
|
52
|
+
try {
|
|
53
|
+
return await this.process();
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
if (retry > 0) {
|
|
57
|
+
await this.sleep(1000);
|
|
58
|
+
return this.processWithRetry(retry - 1);
|
|
59
|
+
}
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
48
63
|
async process() {
|
|
49
64
|
const response = await (0, authentication_js_1.oauthToken)({
|
|
50
65
|
headers: {
|
package/dist/common/internal.js
CHANGED
|
@@ -1,13 +1,135 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getAlphanumericLimitedHash = getAlphanumericLimitedHash;
|
|
7
4
|
exports.getGlobalUniqueHash = getGlobalUniqueHash;
|
|
8
|
-
|
|
5
|
+
// Pure JS MD5 implementation (public domain, compact)
|
|
6
|
+
function md5(input) {
|
|
7
|
+
function cmn(q, a, b, x, s, t) {
|
|
8
|
+
a = (((a + q) | 0) + ((x + t) | 0)) | 0;
|
|
9
|
+
return (((a << s) | (a >>> (32 - s))) + b) | 0;
|
|
10
|
+
}
|
|
11
|
+
function ff(a, b, c, d, x, s, t) {
|
|
12
|
+
return cmn((b & c) | (~b & d), a, b, x, s, t);
|
|
13
|
+
}
|
|
14
|
+
function gg(a, b, c, d, x, s, t) {
|
|
15
|
+
return cmn((b & d) | (c & ~d), a, b, x, s, t);
|
|
16
|
+
}
|
|
17
|
+
function hh(a, b, c, d, x, s, t) {
|
|
18
|
+
return cmn(b ^ c ^ d, a, b, x, s, t);
|
|
19
|
+
}
|
|
20
|
+
function ii(a, b, c, d, x, s, t) {
|
|
21
|
+
return cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
22
|
+
}
|
|
23
|
+
function md5cycle(x, k) {
|
|
24
|
+
let [a, b, c, d] = x;
|
|
25
|
+
a = ff(a, b, c, d, k[0], 7, -680876936);
|
|
26
|
+
d = ff(d, a, b, c, k[1], 12, -389564586);
|
|
27
|
+
c = ff(c, d, a, b, k[2], 17, 606105819);
|
|
28
|
+
b = ff(b, c, d, a, k[3], 22, -1044525330);
|
|
29
|
+
a = ff(a, b, c, d, k[4], 7, -176418897);
|
|
30
|
+
d = ff(d, a, b, c, k[5], 12, 1200080426);
|
|
31
|
+
c = ff(c, d, a, b, k[6], 17, -1473231341);
|
|
32
|
+
b = ff(b, c, d, a, k[7], 22, -45705983);
|
|
33
|
+
a = ff(a, b, c, d, k[8], 7, 1770035416);
|
|
34
|
+
d = ff(d, a, b, c, k[9], 12, -1958414417);
|
|
35
|
+
c = ff(c, d, a, b, k[10], 17, -42063);
|
|
36
|
+
b = ff(b, c, d, a, k[11], 22, -1990404162);
|
|
37
|
+
a = ff(a, b, c, d, k[12], 7, 1804603682);
|
|
38
|
+
d = ff(d, a, b, c, k[13], 12, -40341101);
|
|
39
|
+
c = ff(c, d, a, b, k[14], 17, -1502002290);
|
|
40
|
+
b = ff(b, c, d, a, k[15], 22, 1236535329);
|
|
41
|
+
a = gg(a, b, c, d, k[1], 5, -165796510);
|
|
42
|
+
d = gg(d, a, b, c, k[6], 9, -1069501632);
|
|
43
|
+
c = gg(c, d, a, b, k[11], 14, 643717713);
|
|
44
|
+
b = gg(b, c, d, a, k[0], 20, -373897302);
|
|
45
|
+
a = gg(a, b, c, d, k[5], 5, -701558691);
|
|
46
|
+
d = gg(d, a, b, c, k[10], 9, 38016083);
|
|
47
|
+
c = gg(c, d, a, b, k[15], 14, -660478335);
|
|
48
|
+
b = gg(b, c, d, a, k[4], 20, -405537848);
|
|
49
|
+
a = gg(a, b, c, d, k[9], 5, 568446438);
|
|
50
|
+
d = gg(d, a, b, c, k[14], 9, -1019803690);
|
|
51
|
+
c = gg(c, d, a, b, k[3], 14, -187363961);
|
|
52
|
+
b = gg(b, c, d, a, k[8], 20, 1163531501);
|
|
53
|
+
a = gg(a, b, c, d, k[13], 5, -1444681467);
|
|
54
|
+
d = gg(d, a, b, c, k[2], 9, -51403784);
|
|
55
|
+
c = gg(c, d, a, b, k[7], 14, 1735328473);
|
|
56
|
+
b = gg(b, c, d, a, k[12], 20, -1926607734);
|
|
57
|
+
a = hh(a, b, c, d, k[5], 4, -378558);
|
|
58
|
+
d = hh(d, a, b, c, k[8], 11, -2022574463);
|
|
59
|
+
c = hh(c, d, a, b, k[11], 16, 1839030562);
|
|
60
|
+
b = hh(b, c, d, a, k[14], 23, -35309556);
|
|
61
|
+
a = hh(a, b, c, d, k[1], 4, -1530992060);
|
|
62
|
+
d = hh(d, a, b, c, k[4], 11, 1272893353);
|
|
63
|
+
c = hh(c, d, a, b, k[7], 16, -155497632);
|
|
64
|
+
b = hh(b, c, d, a, k[10], 23, -1094730640);
|
|
65
|
+
a = hh(a, b, c, d, k[13], 4, 681279174);
|
|
66
|
+
d = hh(d, a, b, c, k[0], 11, -358537222);
|
|
67
|
+
c = hh(c, d, a, b, k[3], 16, -722521979);
|
|
68
|
+
b = hh(b, c, d, a, k[6], 23, 76029189);
|
|
69
|
+
a = hh(a, b, c, d, k[9], 4, -640364487);
|
|
70
|
+
d = hh(d, a, b, c, k[12], 11, -421815835);
|
|
71
|
+
c = hh(c, d, a, b, k[15], 16, 530742520);
|
|
72
|
+
b = hh(b, c, d, a, k[2], 23, -995338651);
|
|
73
|
+
a = ii(a, b, c, d, k[0], 6, -198630844);
|
|
74
|
+
d = ii(d, a, b, c, k[7], 10, 1126891415);
|
|
75
|
+
c = ii(c, d, a, b, k[14], 15, -1416354905);
|
|
76
|
+
b = ii(b, c, d, a, k[5], 21, -57434055);
|
|
77
|
+
a = ii(a, b, c, d, k[12], 6, 1700485571);
|
|
78
|
+
d = ii(d, a, b, c, k[3], 10, -1894986606);
|
|
79
|
+
c = ii(c, d, a, b, k[10], 15, -1051523);
|
|
80
|
+
b = ii(b, c, d, a, k[1], 21, -2054922799);
|
|
81
|
+
a = ii(a, b, c, d, k[8], 6, 1873313359);
|
|
82
|
+
d = ii(d, a, b, c, k[15], 10, -30611744);
|
|
83
|
+
c = ii(c, d, a, b, k[6], 15, -1560198380);
|
|
84
|
+
b = ii(b, c, d, a, k[13], 21, 1309151649);
|
|
85
|
+
a = ii(a, b, c, d, k[4], 6, -145523070);
|
|
86
|
+
d = ii(d, a, b, c, k[11], 10, -1120210379);
|
|
87
|
+
c = ii(c, d, a, b, k[2], 15, 718787259);
|
|
88
|
+
b = ii(b, c, d, a, k[9], 21, -343485551);
|
|
89
|
+
x[0] = (a + x[0]) | 0;
|
|
90
|
+
x[1] = (b + x[1]) | 0;
|
|
91
|
+
x[2] = (c + x[2]) | 0;
|
|
92
|
+
x[3] = (d + x[3]) | 0;
|
|
93
|
+
}
|
|
94
|
+
function md5blk(s) {
|
|
95
|
+
const md5blks = [];
|
|
96
|
+
for (let i = 0; i < 64; i += 4) {
|
|
97
|
+
md5blks[i >> 2] =
|
|
98
|
+
s.charCodeAt(i) +
|
|
99
|
+
(s.charCodeAt(i + 1) << 8) +
|
|
100
|
+
(s.charCodeAt(i + 2) << 16) +
|
|
101
|
+
(s.charCodeAt(i + 3) << 24);
|
|
102
|
+
}
|
|
103
|
+
return md5blks;
|
|
104
|
+
}
|
|
105
|
+
function md51(s) {
|
|
106
|
+
let n = s.length, state = [1732584193, -271733879, -1732584194, 271733878], i;
|
|
107
|
+
for (i = 64; i <= n; i += 64) {
|
|
108
|
+
md5cycle(state, md5blk(s.substring(i - 64, i)));
|
|
109
|
+
}
|
|
110
|
+
s = s.substring(i - 64);
|
|
111
|
+
const tail = Array(16).fill(0);
|
|
112
|
+
for (i = 0; i < s.length; i++)
|
|
113
|
+
tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3);
|
|
114
|
+
tail[i >> 2] |= 0x80 << ((i % 4) << 3);
|
|
115
|
+
if (i > 55) {
|
|
116
|
+
md5cycle(state, tail);
|
|
117
|
+
tail.fill(0);
|
|
118
|
+
}
|
|
119
|
+
tail[14] = n * 8;
|
|
120
|
+
md5cycle(state, tail);
|
|
121
|
+
return state;
|
|
122
|
+
}
|
|
123
|
+
function rhex(n) {
|
|
124
|
+
let s = '', j = 0;
|
|
125
|
+
for (; j < 4; j++)
|
|
126
|
+
s += ('0' + ((n >> (j * 8 + 4)) & 0x0f).toString(16)).slice(-2) + ((n >> (j * 8)) & 0x0f).toString(16);
|
|
127
|
+
return s;
|
|
128
|
+
}
|
|
129
|
+
return md51(input).map(rhex).join('');
|
|
130
|
+
}
|
|
9
131
|
function getAlphanumericLimitedHash(input, maxSize = 48) {
|
|
10
|
-
const hash =
|
|
132
|
+
const hash = md5(input);
|
|
11
133
|
return hash.length > maxSize ? hash.substring(0, maxSize) : hash;
|
|
12
134
|
}
|
|
13
135
|
function getGlobalUniqueHash(workspace, type, name) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const internal_1 = require("./internal");
|
|
5
|
+
(0, vitest_1.describe)('getAlphanumericLimitedHash', () => {
|
|
6
|
+
(0, vitest_1.it)('returns correct MD5 hash for a known string', () => {
|
|
7
|
+
// MD5 of 'hello' is 5d41402abc4b2a76b9719d911017c592
|
|
8
|
+
(0, vitest_1.expect)((0, internal_1.getAlphanumericLimitedHash)('hello')).toBe('05d04104002a0bc04b02a0760b907109d0910100170c5092');
|
|
9
|
+
});
|
|
10
|
+
(0, vitest_1.it)('respects the maxSize parameter', () => {
|
|
11
|
+
const hash = (0, internal_1.getAlphanumericLimitedHash)('hello', 8);
|
|
12
|
+
(0, vitest_1.expect)(hash.length).toBe(8);
|
|
13
|
+
(0, vitest_1.expect)(hash).toBe('05d04104');
|
|
14
|
+
});
|
|
15
|
+
(0, vitest_1.it)('returns full hash if maxSize is larger than hash', () => {
|
|
16
|
+
const hash = (0, internal_1.getAlphanumericLimitedHash)('hello', 64);
|
|
17
|
+
(0, vitest_1.expect)(hash).toBe('05d04104002a0bc04b02a0760b907109d0910100170c5092');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
(0, vitest_1.describe)('getGlobalUniqueHash', () => {
|
|
21
|
+
(0, vitest_1.it)('returns a hash for the combined workspace, type, and name', () => {
|
|
22
|
+
// The input string will be 'ws-type-name'
|
|
23
|
+
const expected = (0, internal_1.getAlphanumericLimitedHash)('ws-type-name', 48);
|
|
24
|
+
(0, vitest_1.expect)((0, internal_1.getGlobalUniqueHash)('ws', 'type', 'name')).toBe(expected);
|
|
25
|
+
});
|
|
26
|
+
(0, vitest_1.it)('returns a 48-character hash by default', () => {
|
|
27
|
+
const hash = (0, internal_1.getGlobalUniqueHash)('a', 'b', 'c');
|
|
28
|
+
(0, vitest_1.expect)(hash.length).toBeLessThanOrEqual(48);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const vitest_1 = require("vitest");
|
|
37
|
+
// Import your SDK entry point or a function to test
|
|
38
|
+
const sdk = __importStar(require("./index"));
|
|
39
|
+
(0, vitest_1.describe)('SDK Browser Integration', () => {
|
|
40
|
+
(0, vitest_1.it)('should load the SDK without Node.js-only modules', () => {
|
|
41
|
+
// Example: check that SDK loads and a function exists
|
|
42
|
+
(0, vitest_1.expect)(typeof sdk).toBe('object');
|
|
43
|
+
// Add more specific tests for your SDK as needed
|
|
44
|
+
});
|
|
45
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaxel/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4-dev.63",
|
|
4
4
|
"description": "Blaxel Core SDK for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Blaxel, INC (https://blaxel.ai)",
|
|
@@ -66,13 +66,19 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@eslint/js": "^9.26.0",
|
|
69
|
+
"@testing-library/dom": "^9.3.0",
|
|
69
70
|
"@types/ws": "^8.18.1",
|
|
71
|
+
"jsdom": "^26.1.0",
|
|
70
72
|
"typescript": "^5.0.0",
|
|
71
|
-
"typescript-eslint": "^8.31.1"
|
|
73
|
+
"typescript-eslint": "^8.31.1",
|
|
74
|
+
"vite": "^5.2.0",
|
|
75
|
+
"vitest": "^1.5.0"
|
|
72
76
|
},
|
|
73
77
|
"scripts": {
|
|
74
78
|
"lint": "eslint src/",
|
|
75
79
|
"dev": "tsc --watch",
|
|
76
|
-
"build": "tsc"
|
|
80
|
+
"build": "tsc",
|
|
81
|
+
"test": "vitest --run",
|
|
82
|
+
"test:watch": "vitest --watch"
|
|
77
83
|
}
|
|
78
84
|
}
|
package/dist/jobs/batches.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
declare class BlBatch {
|
|
2
|
-
/**
|
|
3
|
-
* Lists all remote batch jobs for a given name
|
|
4
|
-
* @param name - The name of the job to list
|
|
5
|
-
*/
|
|
6
|
-
list(name: string): void;
|
|
7
|
-
/**
|
|
8
|
-
* Creates a new remote batch job configuration.
|
|
9
|
-
* This is used for remote execution management, not for local execution.
|
|
10
|
-
* @param name - The name of the job
|
|
11
|
-
* @param args - Array of argument arrays for each job in the batch
|
|
12
|
-
* @returns The batch configuration object
|
|
13
|
-
*/
|
|
14
|
-
create(name: string, args: any[][]): {
|
|
15
|
-
name: string;
|
|
16
|
-
args: any[][];
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Kills a remote batch job
|
|
20
|
-
* @param name - The name of the job
|
|
21
|
-
* @param batchId - The ID of the batch to kill
|
|
22
|
-
*/
|
|
23
|
-
kill(name: string, batchId: string): void;
|
|
24
|
-
/**
|
|
25
|
-
* Retrieves information about a remote batch job
|
|
26
|
-
* @param name - The name of the job
|
|
27
|
-
* @param batchId - The ID of the batch to get information for
|
|
28
|
-
*/
|
|
29
|
-
get(name: string, batchId: string): void;
|
|
30
|
-
}
|
|
31
|
-
export declare const blBatch: BlBatch;
|
|
32
|
-
export {};
|
package/dist/jobs/batches.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.blBatch = void 0;
|
|
4
|
-
class BlBatch {
|
|
5
|
-
/**
|
|
6
|
-
* Lists all remote batch jobs for a given name
|
|
7
|
-
* @param name - The name of the job to list
|
|
8
|
-
*/
|
|
9
|
-
list(name) {
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new remote batch job configuration.
|
|
13
|
-
* This is used for remote execution management, not for local execution.
|
|
14
|
-
* @param name - The name of the job
|
|
15
|
-
* @param args - Array of argument arrays for each job in the batch
|
|
16
|
-
* @returns The batch configuration object
|
|
17
|
-
*/
|
|
18
|
-
create(name, args) {
|
|
19
|
-
const batch = {
|
|
20
|
-
name,
|
|
21
|
-
args,
|
|
22
|
-
};
|
|
23
|
-
return batch;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Kills a remote batch job
|
|
27
|
-
* @param name - The name of the job
|
|
28
|
-
* @param batchId - The ID of the batch to kill
|
|
29
|
-
*/
|
|
30
|
-
kill(name, batchId) {
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Retrieves information about a remote batch job
|
|
34
|
-
* @param name - The name of the job
|
|
35
|
-
* @param batchId - The ID of the batch to get information for
|
|
36
|
-
*/
|
|
37
|
-
get(name, batchId) {
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.blBatch = new BlBatch();
|
package/dist/jobs/job.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
declare class BlJob {
|
|
2
|
-
start(func: (...args: any[]) => Promise<void>): void;
|
|
3
|
-
/**
|
|
4
|
-
* Lists all remote batch jobs for a given name
|
|
5
|
-
* @param name - The name of the job to list
|
|
6
|
-
*/
|
|
7
|
-
list(name: string): void;
|
|
8
|
-
/**
|
|
9
|
-
* Creates a new remote batch job configuration.
|
|
10
|
-
* This is used for remote execution management, not for local execution.
|
|
11
|
-
* @param name - The name of the job
|
|
12
|
-
* @param args - Array of argument arrays for each job in the batch
|
|
13
|
-
* @returns The batch configuration object
|
|
14
|
-
*/
|
|
15
|
-
create(name: string, args: any[][]): {
|
|
16
|
-
name: string;
|
|
17
|
-
args: any[][];
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Kills a remote batch job
|
|
21
|
-
* @param name - The name of the job
|
|
22
|
-
* @param batchId - The ID of the batch to kill
|
|
23
|
-
*/
|
|
24
|
-
kill(name: string, batchId: string): void;
|
|
25
|
-
/**
|
|
26
|
-
* Retrieves information about a remote batch job
|
|
27
|
-
* @param name - The name of the job
|
|
28
|
-
* @param batchId - The ID of the batch to get information for
|
|
29
|
-
*/
|
|
30
|
-
get(name: string, batchId: string): void;
|
|
31
|
-
}
|
|
32
|
-
export declare const blJob: BlJob;
|
|
33
|
-
export {};
|
package/dist/jobs/job.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.blJob = void 0;
|
|
4
|
-
function retrieveArguments() {
|
|
5
|
-
const args = process.argv.slice(2);
|
|
6
|
-
return args;
|
|
7
|
-
}
|
|
8
|
-
class BlJob {
|
|
9
|
-
/*
|
|
10
|
-
Run a job defined in a function, it's run in the current process
|
|
11
|
-
*/
|
|
12
|
-
start(func) {
|
|
13
|
-
const args = retrieveArguments();
|
|
14
|
-
func(...args);
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Lists all remote batch jobs for a given name
|
|
18
|
-
* @param name - The name of the job to list
|
|
19
|
-
*/
|
|
20
|
-
list(name) {
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Creates a new remote batch job configuration.
|
|
24
|
-
* This is used for remote execution management, not for local execution.
|
|
25
|
-
* @param name - The name of the job
|
|
26
|
-
* @param args - Array of argument arrays for each job in the batch
|
|
27
|
-
* @returns The batch configuration object
|
|
28
|
-
*/
|
|
29
|
-
create(name, args) {
|
|
30
|
-
const batch = {
|
|
31
|
-
name,
|
|
32
|
-
args,
|
|
33
|
-
};
|
|
34
|
-
return batch;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Kills a remote batch job
|
|
38
|
-
* @param name - The name of the job
|
|
39
|
-
* @param batchId - The ID of the batch to kill
|
|
40
|
-
*/
|
|
41
|
-
kill(name, batchId) {
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Retrieves information about a remote batch job
|
|
45
|
-
* @param name - The name of the job
|
|
46
|
-
* @param batchId - The ID of the batch to get information for
|
|
47
|
-
*/
|
|
48
|
-
get(name, batchId) {
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.blJob = new BlJob();
|