@blaxel/core 0.2.2-dev.59 → 0.2.2-dev.60
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/jobs/jobs.d.ts +1 -0
- package/dist/jobs/jobs.js +21 -6
- package/package.json +1 -1
package/dist/jobs/jobs.d.ts
CHANGED
package/dist/jobs/jobs.js
CHANGED
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.blJob = void 0;
|
|
4
|
-
// import yargs from 'yargs';
|
|
5
4
|
const env_js_1 = require("../common/env.js");
|
|
6
5
|
class BlJob {
|
|
7
6
|
async getArguments() {
|
|
8
7
|
if (!env_js_1.env.BL_EXECUTION_DATA_URL) {
|
|
9
|
-
|
|
8
|
+
const args = this.parseCommandLineArgs();
|
|
9
|
+
return args;
|
|
10
10
|
}
|
|
11
|
-
// const argv = await yargs(hideBin(process.argv))
|
|
12
|
-
// .parseAsync();
|
|
13
|
-
// return argv;
|
|
14
|
-
// }
|
|
15
11
|
const response = await fetch(env_js_1.env.BL_EXECUTION_DATA_URL);
|
|
16
12
|
const data = await response.json();
|
|
17
13
|
return data.tasks[this.index] ?? {};
|
|
18
14
|
}
|
|
15
|
+
parseCommandLineArgs() {
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
const result = {};
|
|
18
|
+
for (let i = 0; i < args.length; i++) {
|
|
19
|
+
const arg = args[i];
|
|
20
|
+
if (arg.startsWith('--')) {
|
|
21
|
+
const key = arg.slice(2);
|
|
22
|
+
const value = args[i + 1];
|
|
23
|
+
if (value && !value.startsWith('--')) {
|
|
24
|
+
result[key] = value;
|
|
25
|
+
i++;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
result[key] = 'true';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
19
34
|
get indexKey() {
|
|
20
35
|
return env_js_1.env.BL_TASK_KEY ?? "TASK_INDEX";
|
|
21
36
|
}
|