clyops-jobs 0.7.0 → 0.8.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.
Files changed (2) hide show
  1. package/clyops-jobs.cjs +13 -4
  2. package/package.json +2 -2
package/clyops-jobs.cjs CHANGED
@@ -230,6 +230,9 @@ var InputError = class extends Error {
230
230
  function isPathValued(validation, type) {
231
231
  return type === "path" || validation === "path" || validation.startsWith("file:") || validation.startsWith("dir:");
232
232
  }
233
+ function isBareProgram(validation, value) {
234
+ return validation === "file:executable" && value !== "" && !value.includes("/") && !(process.platform === "win32" && value.includes("\\"));
235
+ }
233
236
  var TRUE = /^(true|1|yes|on)$/i;
234
237
  var FALSE = /^(false|0|no|off)$/i;
235
238
  function toArgv(schema, input, opts = {}) {
@@ -244,9 +247,10 @@ function toArgv(schema, input, opts = {}) {
244
247
  }
245
248
  return void 0;
246
249
  };
247
- const text = (value, pathValued, name = "") => {
250
+ const text = (value, pathValued, name = "", validation = "") => {
248
251
  let s = typeof value === "object" ? JSON.stringify(value) : String(value);
249
252
  if (opts.render) s = opts.render(s);
253
+ if (isBareProgram(validation, s)) return s;
250
254
  if (pathValued && opts.base && !["", "-", "disabled", "false"].includes(s) && !(0, import_node_path2.isAbsolute)(s) && !/^[a-z][a-z0-9+.-]*:\/\//i.test(s)) {
251
255
  s = (0, import_node_path2.resolve)(opts.base, s);
252
256
  }
@@ -273,11 +277,11 @@ function toArgv(schema, input, opts = {}) {
273
277
  continue;
274
278
  }
275
279
  if (opts.secretEnv && option.secret && !option.isArray) {
276
- out.env[option.variableName] = text(found.value, isPathValued(option.validation, option.type), `--${option.name}`);
280
+ out.env[option.variableName] = text(found.value, isPathValued(option.validation, option.type), `--${option.name}`, option.validation);
277
281
  continue;
278
282
  }
279
283
  for (const item of Array.isArray(found.value) ? found.value : [found.value]) {
280
- out.argv.push(`--${option.name}`, text(item, isPathValued(option.validation, option.type), `--${option.name}`));
284
+ out.argv.push(`--${option.name}`, text(item, isPathValued(option.validation, option.type), `--${option.name}`, option.validation));
281
285
  }
282
286
  }
283
287
  const explicit = Array.isArray(opts.positionals) ? opts.positionals : void 0;
@@ -288,6 +292,11 @@ function toArgv(schema, input, opts = {}) {
288
292
  let skipped = [];
289
293
  for (const argument of schema.arguments) {
290
294
  const found = pick(argument);
295
+ if (found && opts.controlled?.includes(argument.name)) {
296
+ out.controlled.push(found.key);
297
+ skipped.push(argument);
298
+ continue;
299
+ }
291
300
  if (!found || found.value === null || found.value === void 0) {
292
301
  skipped.push(argument);
293
302
  continue;
@@ -298,7 +307,7 @@ function toArgv(schema, input, opts = {}) {
298
307
  }
299
308
  skipped = [];
300
309
  const values = Array.isArray(found.value) ? found.value : [found.value];
301
- positionals.push(...values.map((v) => text(v, isPathValued(argument.validation), argument.name)));
310
+ positionals.push(...values.map((v) => text(v, isPathValued(argument.validation), argument.name, argument.validation)));
302
311
  }
303
312
  }
304
313
  if (positionals.some((p) => p.startsWith("-"))) out.argv.push("--", ...positionals);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clyops-jobs",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Run clyops tools as jobs: config-bound functions, templated invocation, artifacts, job records and a queue.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "typescript": "^5.6.0"
39
39
  },
40
40
  "dependencies": {
41
- "clyops-tools": "0.7.0"
41
+ "clyops-tools": "0.8.0"
42
42
  },
43
43
  "homepage": "https://clyops.io/node-tools.html",
44
44
  "scripts": {