@blaxel/core 0.2.2-dev.58 → 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.
@@ -2,6 +2,7 @@ declare class BlJob {
2
2
  getArguments(): Promise<{
3
3
  [key: number]: any;
4
4
  }>;
5
+ private parseCommandLineArgs;
5
6
  get indexKey(): string;
6
7
  get index(): number;
7
8
  start(func: (args: any) => Promise<void>): Promise<void>;
package/dist/jobs/jobs.js CHANGED
@@ -1,23 +1,36 @@
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.blJob = void 0;
7
- const yargs_1 = __importDefault(require("yargs"));
8
- const helpers_1 = require("yargs/helpers");
9
4
  const env_js_1 = require("../common/env.js");
10
5
  class BlJob {
11
6
  async getArguments() {
12
7
  if (!env_js_1.env.BL_EXECUTION_DATA_URL) {
13
- const argv = await (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
14
- .parseAsync();
15
- return argv;
8
+ const args = this.parseCommandLineArgs();
9
+ return args;
16
10
  }
17
11
  const response = await fetch(env_js_1.env.BL_EXECUTION_DATA_URL);
18
12
  const data = await response.json();
19
13
  return data.tasks[this.index] ?? {};
20
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
+ }
21
34
  get indexKey() {
22
35
  return env_js_1.env.BL_TASK_KEY ?? "TASK_INDEX";
23
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaxel/core",
3
- "version": "0.2.2-dev.58",
3
+ "version": "0.2.2-dev.60",
4
4
  "description": "Blaxel Core SDK for TypeScript",
5
5
  "license": "MIT",
6
6
  "author": "Blaxel, INC (https://blaxel.ai)",
@@ -62,13 +62,11 @@
62
62
  "uuid": "^11.1.0",
63
63
  "ws": "^8.18.2",
64
64
  "yaml": "^2.7.1",
65
- "yargs": "^17.7.2",
66
65
  "zod": "^3.24.3"
67
66
  },
68
67
  "devDependencies": {
69
68
  "@eslint/js": "^9.26.0",
70
69
  "@types/ws": "^8.18.1",
71
- "@types/yargs": "^17.0.33",
72
70
  "typescript": "^5.0.0",
73
71
  "typescript-eslint": "^8.31.1"
74
72
  },