@requence/task 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (94) hide show
  1. package/CHANGELOG.md +109 -0
  2. package/build/{chunk-s4kgf465.js → chunk-4r30g3ha.js} +4 -33
  3. package/build/chunk-4r30g3ha.js.map +10 -0
  4. package/build/cli.js +18 -22
  5. package/build/cli.js.map +3 -3
  6. package/build/index.js +783 -158
  7. package/build/index.js.map +18 -6
  8. package/build/types/helpers/src/context/context.d.ts +156 -0
  9. package/build/types/helpers/src/context/context.d.ts.map +1 -0
  10. package/build/types/helpers/src/context/index.d.ts +2 -0
  11. package/build/types/helpers/src/context/index.d.ts.map +1 -0
  12. package/build/types/helpers/src/files/RequenceFile.d.ts +40 -0
  13. package/build/types/helpers/src/files/RequenceFile.d.ts.map +1 -0
  14. package/build/types/helpers/src/files/RequenceStream.d.ts +32 -0
  15. package/build/types/helpers/src/files/RequenceStream.d.ts.map +1 -0
  16. package/build/types/helpers/src/files/index.d.ts +48 -0
  17. package/build/types/helpers/src/files/index.d.ts.map +1 -0
  18. package/build/types/helpers/src/files/isValidMimeType.d.ts +5 -0
  19. package/build/types/helpers/src/files/isValidMimeType.d.ts.map +1 -0
  20. package/build/types/helpers/src/files/mapOutput.d.ts +10 -0
  21. package/build/types/helpers/src/files/mapOutput.d.ts.map +1 -0
  22. package/build/types/helpers/src/files/types.d.ts +4 -0
  23. package/build/types/helpers/src/files/types.d.ts.map +1 -0
  24. package/build/types/helpers/src/index.d.ts +8 -6
  25. package/build/types/helpers/src/index.d.ts.map +1 -1
  26. package/build/types/helpers/src/jsonschema/mapSchema.d.ts +20 -0
  27. package/build/types/helpers/src/jsonschema/mapSchema.d.ts.map +1 -0
  28. package/build/types/helpers/src/jsonschema/types.d.ts +11 -0
  29. package/build/types/helpers/src/jsonschema/types.d.ts.map +1 -0
  30. package/build/types/helpers/src/jsonschema/validate.d.ts +28 -0
  31. package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -0
  32. package/build/types/helpers/src/jsonschema/zod.d.ts +20 -0
  33. package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
  34. package/build/types/helpers/src/protocol/command.d.ts +1995 -0
  35. package/build/types/helpers/src/protocol/command.d.ts.map +1 -0
  36. package/build/types/helpers/src/protocol/createNodeMaps.d.ts +10 -0
  37. package/build/types/helpers/src/protocol/createNodeMaps.d.ts.map +1 -0
  38. package/build/types/helpers/src/protocol/getCycles.d.ts +3 -0
  39. package/build/types/helpers/src/protocol/getCycles.d.ts.map +1 -0
  40. package/build/types/helpers/src/protocol/getNodeOutputs.d.ts +4 -0
  41. package/build/types/helpers/src/protocol/getNodeOutputs.d.ts.map +1 -0
  42. package/build/types/helpers/src/protocol/getPossiblePaths.d.ts +9 -0
  43. package/build/types/helpers/src/protocol/getPossiblePaths.d.ts.map +1 -0
  44. package/build/types/helpers/src/protocol/identifyNode.d.ts +4 -0
  45. package/build/types/helpers/src/protocol/identifyNode.d.ts.map +1 -0
  46. package/build/types/helpers/src/protocol/index.d.ts +10 -0
  47. package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
  48. package/build/types/helpers/src/protocol/node.d.ts +1014 -0
  49. package/build/types/helpers/src/protocol/node.d.ts.map +1 -0
  50. package/build/types/helpers/src/protocol/nodes.d.ts +801 -0
  51. package/build/types/helpers/src/protocol/nodes.d.ts.map +1 -0
  52. package/build/types/helpers/src/protocol/update.d.ts +17951 -0
  53. package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
  54. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
  55. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
  56. package/build/types/helpers/src/utils/clone.d.ts +3 -0
  57. package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
  58. package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
  59. package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
  60. package/build/types/helpers/src/{createRemotePromise.d.ts → utils/createRemotePromise.d.ts} +1 -1
  61. package/build/types/helpers/src/utils/createRemotePromise.d.ts.map +1 -0
  62. package/build/types/helpers/src/utils/isRecord.d.ts +2 -0
  63. package/build/types/helpers/src/utils/isRecord.d.ts.map +1 -0
  64. package/build/types/helpers/src/utils/mapData.d.ts +13 -0
  65. package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
  66. package/build/types/helpers/src/{utils.d.ts → utils/matchSchema.d.ts} +1 -1
  67. package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
  68. package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
  69. package/build/types/task/src/abortTask.d.ts +8 -0
  70. package/build/types/task/src/abortTask.d.ts.map +1 -0
  71. package/build/types/task/src/createTask.d.ts +13 -0
  72. package/build/types/task/src/createTask.d.ts.map +1 -0
  73. package/build/types/task/src/index.d.ts +4 -101
  74. package/build/types/task/src/index.d.ts.map +1 -1
  75. package/build/types/task/src/types.d.ts +4954 -231
  76. package/build/types/task/src/types.d.ts.map +1 -1
  77. package/build/types/task/src/utils/getAccessToken.d.ts +5 -0
  78. package/build/types/task/src/utils/getAccessToken.d.ts.map +1 -0
  79. package/build/types/task/src/utils/mapOutput.d.ts +2 -0
  80. package/build/types/task/src/utils/mapOutput.d.ts.map +1 -0
  81. package/build/types/task/src/watchTasks.d.ts +10 -0
  82. package/build/types/task/src/watchTasks.d.ts.map +1 -0
  83. package/package.json +7 -5
  84. package/build/chunk-s4kgf465.js.map +0 -12
  85. package/build/types/helpers/src/clone.d.ts +0 -3
  86. package/build/types/helpers/src/clone.d.ts.map +0 -1
  87. package/build/types/helpers/src/createObjectProxy.d.ts +0 -2
  88. package/build/types/helpers/src/createObjectProxy.d.ts.map +0 -1
  89. package/build/types/helpers/src/createRemotePromise.d.ts.map +0 -1
  90. package/build/types/helpers/src/obfuscate.d.ts.map +0 -1
  91. package/build/types/helpers/src/utils.d.ts.map +0 -1
  92. package/build/types/task/src/utils/callbackToAsyncIterator.d.ts +0 -5
  93. package/build/types/task/src/utils/callbackToAsyncIterator.d.ts.map +0 -1
  94. /package/build/types/helpers/src/{obfuscate.d.ts → utils/obfuscate.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -0,0 +1,109 @@
1
+ # @requence/task
2
+
3
+ ## 1.0.0-alpha.20
4
+
5
+ ### Patch Changes
6
+
7
+ - e83bf22: improve task updates
8
+
9
+ ## 1.0.0-alpha.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 831c549: added abort reason
14
+
15
+ ## 1.0.0-alpha.18
16
+
17
+ ### Patch Changes
18
+
19
+ - 3e78516: allow task abort in task package
20
+
21
+ ## 1.0.0-alpha.17
22
+
23
+ ### Patch Changes
24
+
25
+ - 0a7c05f: include output name in update info
26
+
27
+ ## 1.0.0-alpha.16
28
+
29
+ ### Patch Changes
30
+
31
+ - 92ef7aa: include node info in all node related task updates
32
+
33
+ ## 1.0.0-alpha.15
34
+
35
+ ### Patch Changes
36
+
37
+ - 45d26fc: fixed task access token retrieval
38
+
39
+ ## 1.0.0-alpha.14
40
+
41
+ ### Patch Changes
42
+
43
+ - 3a5e3e2: allow more access token options
44
+
45
+ ## 1.0.0-alpha.13
46
+
47
+ ### Patch Changes
48
+
49
+ - dc413ab: deps update
50
+
51
+ ## 1.0.0-alpha.12
52
+
53
+ ### Patch Changes
54
+
55
+ - 77bc2ed: improved task creation and event order
56
+
57
+ ## 1.0.0-alpha.11
58
+
59
+ ### Patch Changes
60
+
61
+ - 300f7de: temporary upload as formdata
62
+
63
+ ## 1.0.0-alpha.10
64
+
65
+ ### Patch Changes
66
+
67
+ - 9dcaeae: fixed dependencies
68
+
69
+ ## 1.0.0-alpha.9
70
+
71
+ ### Patch Changes
72
+
73
+ - 1df3d43: improved typing
74
+
75
+ ## 1.0.0-alpha.8
76
+
77
+ ### Patch Changes
78
+
79
+ - 679cbaf: streams
80
+
81
+ ## 1.0.0-alpha.7
82
+
83
+ ### Patch Changes
84
+
85
+ - a464543: improved file matching algorithm
86
+
87
+ ## 1.0.0-alpha.6
88
+
89
+ ### Patch Changes
90
+
91
+ - 1d847ee: improved files handling
92
+
93
+ ## 1.0.0-alpha.5
94
+
95
+ ### Patch Changes
96
+
97
+ - f7ea7fa: added files support
98
+
99
+ ## 1.0.0-alpha.4
100
+
101
+ ### Patch Changes
102
+
103
+ - 04ce4a9: improved caching and live queries
104
+
105
+ ## 1.0.0-alpha.3
106
+
107
+ ### Patch Changes
108
+
109
+ - 1a0bca0: structure redesign
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from "node:module";
2
2
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
3
3
 
4
- // ../helpers/src/obfuscate.ts
4
+ // ../helpers/src/utils/obfuscate.ts
5
5
  var separator = "";
6
6
  var base65Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
7
7
  var base65CharToIndex = {};
@@ -32,36 +32,7 @@ function deobfuscate(str) {
32
32
  return decodedString.split(separator);
33
33
  }
34
34
 
35
- // ../helpers/src/createRemotePromise.ts
36
- function createRemotePromise(onAwait) {
37
- let resolvePromise;
38
- let rejectPromise;
39
- const internalPromise = new Promise((resolve, reject) => {
40
- resolvePromise = resolve;
41
- rejectPromise = reject;
42
- });
43
- let isAwaited = false;
44
- const wrappedPromise = new Proxy(internalPromise, {
45
- get(target, property) {
46
- if (property === "then" || property === "catch" || property === "finally") {
47
- if (!isAwaited && onAwait) {
48
- isAwaited = true;
49
- onAwait(resolvePromise, rejectPromise);
50
- }
51
- return target[property].bind(target);
52
- }
53
- return target[property];
54
- }
55
- });
56
- return Object.assign(wrappedPromise, {
57
- resolve: resolvePromise,
58
- reject: rejectPromise,
59
- promise: wrappedPromise
60
- });
61
- }
62
- // ../helpers/src/clone.ts
63
- var CLONE_SYMBOL = Symbol("original");
64
- export { __require, deobfuscate, createRemotePromise };
35
+ export { __require, deobfuscate };
65
36
 
66
- //# debugId=2ED31CEB12C9D51264756E2164756E21
67
- //# sourceMappingURL=chunk-s4kgf465.js.map
37
+ //# debugId=8688A1F5E25724A064756E2164756E21
38
+ //# sourceMappingURL=chunk-4r30g3ha.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../helpers/src/utils/obfuscate.ts"],
4
+ "sourcesContent": [
5
+ "const separator = '\\u{f6ee}'\n\nconst base65Chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$'\n\nconst base65CharToIndex: Record<string, number> = {}\nfor (let i = 0; i < base65Chars.length; i++) {\n base65CharToIndex[base65Chars[i]] = i\n}\n\nexport function obfuscate(...parts: Array<string>) {\n const str = parts.join(separator)\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const charCode = str.charCodeAt(i)\n binaryString += charCode.toString(2).padStart(16, '0')\n }\n\n let encodedString = ''\n const chunkSize = 6\n let paddingCount = 0\n\n for (let i = 0; i < binaryString.length; i += chunkSize) {\n let chunk = binaryString.substring(i, i + chunkSize)\n\n if (chunk.length < chunkSize) {\n paddingCount = chunkSize - chunk.length\n chunk = chunk.padEnd(chunkSize, '0')\n }\n\n const decimalValue = parseInt(chunk, 2)\n encodedString += base65Chars[decimalValue]\n }\n\n return encodedString + paddingCount.toString()\n}\n\nexport function randomString(length: number) {\n const randomValues = new Uint8Array(length)\n crypto.getRandomValues(randomValues)\n\n let randomString = ''\n for (let i = 0; i < length; i++) {\n randomString += base65Chars[randomValues[i] % base65Chars.length]\n }\n\n return randomString\n}\n\nexport function deobfuscate(str: string) {\n const paddingCount = parseInt(str.slice(-1), 10)\n str = str.slice(0, -1)\n\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const decimalValue = base65CharToIndex[str[i]]\n const binaryChunk = decimalValue.toString(2).padStart(6, '0')\n binaryString += binaryChunk\n }\n\n if (paddingCount > 0) {\n binaryString = binaryString.slice(0, -paddingCount)\n }\n\n let decodedString = ''\n const charSize = 16\n\n for (let i = 0; i < binaryString.length; i += charSize) {\n const byte = binaryString.substring(i, i + charSize)\n if (byte.length === 16) {\n const charCode = parseInt(byte, 2)\n decodedString += String.fromCharCode(charCode)\n }\n }\n\n return decodedString.split(separator)\n}\n"
6
+ ],
7
+ "mappings": ";;;;AAAA,IAAM,YAAY;AAElB,IAAM,cACJ;AAEF,IAAM,oBAA4C,CAAC;AACnD,SAAS,IAAI,EAAG,IAAI,YAAY,QAAQ,KAAK;AAAA,EAC3C,kBAAkB,YAAY,MAAM;AACtC;AA0CO,SAAS,WAAW,CAAC,KAAa;AAAA,EACvC,MAAM,eAAe,SAAS,IAAI,MAAM,EAAE,GAAG,EAAE;AAAA,EAC/C,MAAM,IAAI,MAAM,GAAG,EAAE;AAAA,EAErB,IAAI,eAAe;AAAA,EAEnB,SAAS,IAAI,EAAG,IAAI,IAAI,QAAQ,KAAK;AAAA,IACnC,MAAM,eAAe,kBAAkB,IAAI;AAAA,IAC3C,MAAM,cAAc,aAAa,SAAS,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,IAC5D,gBAAgB;AAAA,EAClB;AAAA,EAEA,IAAI,eAAe,GAAG;AAAA,IACpB,eAAe,aAAa,MAAM,IAAI,YAAY;AAAA,EACpD;AAAA,EAEA,IAAI,gBAAgB;AAAA,EACpB,MAAM,WAAW;AAAA,EAEjB,SAAS,IAAI,EAAG,IAAI,aAAa,QAAQ,KAAK,UAAU;AAAA,IACtD,MAAM,OAAO,aAAa,UAAU,GAAG,IAAI,QAAQ;AAAA,IACnD,IAAI,KAAK,WAAW,IAAI;AAAA,MACtB,MAAM,WAAW,SAAS,MAAM,CAAC;AAAA,MACjC,iBAAiB,OAAO,aAAa,QAAQ;AAAA,IAC/C;AAAA,EACF;AAAA,EAEA,OAAO,cAAc,MAAM,SAAS;AAAA;",
8
+ "debugId": "8688A1F5E25724A064756E2164756E21",
9
+ "names": []
10
+ }
package/build/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  __require,
4
4
  deobfuscate
5
- } from "./chunk-s4kgf465.js";
5
+ } from "./chunk-4r30g3ha.js";
6
6
 
7
7
  // src/cli.ts
8
8
  import fs from "node:fs";
@@ -1376,12 +1376,10 @@ class Y18N {
1376
1376
  return this._taggedLiteral(arguments[0], ...arguments);
1377
1377
  }
1378
1378
  const str = args.shift();
1379
- let cb = function() {
1380
- };
1379
+ let cb = function() {};
1381
1380
  if (typeof args[args.length - 1] === "function")
1382
1381
  cb = args.pop();
1383
- cb = cb || function() {
1384
- };
1382
+ cb = cb || function() {};
1385
1383
  if (!this.cache[this.locale])
1386
1384
  this._readLocaleFile();
1387
1385
  if (!this.cache[this.locale][str] && this.updateFiles) {
@@ -1401,8 +1399,7 @@ class Y18N {
1401
1399
  const singular = args.shift();
1402
1400
  const plural = args.shift();
1403
1401
  const quantity = args.shift();
1404
- let cb = function() {
1405
- };
1402
+ let cb = function() {};
1406
1403
  if (typeof args[args.length - 1] === "function")
1407
1404
  cb = args.pop();
1408
1405
  if (!this.cache[this.locale])
@@ -1838,8 +1835,7 @@ class CommandInstance {
1838
1835
  addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) {
1839
1836
  let aliases = [];
1840
1837
  const middlewares = commandMiddlewareFactory(commandMiddleware);
1841
- handler = handler || (() => {
1842
- });
1838
+ handler = handler || (() => {});
1843
1839
  if (Array.isArray(cmd)) {
1844
1840
  if (isCommandAndAliases(cmd)) {
1845
1841
  [cmd, ...aliases] = cmd;
@@ -1988,8 +1984,7 @@ class CommandInstance {
1988
1984
  innerArgv.catch((error) => {
1989
1985
  try {
1990
1986
  yargs.getInternalMethods().getUsageInstance().fail(null, error);
1991
- } catch (_err) {
1992
- }
1987
+ } catch (_err) {}
1993
1988
  });
1994
1989
  }
1995
1990
  }
@@ -4337,8 +4332,7 @@ class YargsInstance {
4337
4332
  argv._.push.apply(argv._, argv["--"]);
4338
4333
  try {
4339
4334
  delete argv["--"];
4340
- } catch (_err) {
4341
- }
4335
+ } catch (_err) {}
4342
4336
  return argv;
4343
4337
  }
4344
4338
  [kCreateLogger]() {
@@ -4466,8 +4460,7 @@ class YargsInstance {
4466
4460
  });
4467
4461
  assertNotStrictEqual(pkgJsonPath, undefined, __classPrivateFieldGet(this, _YargsInstance_shim, "f"));
4468
4462
  obj = JSON.parse(__classPrivateFieldGet(this, _YargsInstance_shim, "f").readFileSync(pkgJsonPath, "utf8"));
4469
- } catch (_noop) {
4470
- }
4463
+ } catch (_noop) {}
4471
4464
  __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath] = obj || {};
4472
4465
  return __classPrivateFieldGet(this, _YargsInstance_pkgs, "f")[npath];
4473
4466
  }
@@ -4881,13 +4874,18 @@ function errorExit(title, text) {
4881
4874
  process.exit(1);
4882
4875
  }
4883
4876
  y.command("generate-types", "generates typescript types", (yargs) => yargs.option("access-token", {
4884
- describe: "access token"
4877
+ describe: "access token",
4878
+ type: "string"
4885
4879
  }).option("outfile", {
4886
4880
  default: "requence-env.d.ts"
4887
4881
  }).option("outdir", {
4888
4882
  default: ""
4889
4883
  }), async (argv) => {
4890
- const token = argv.accessToken ?? process.env.REQUENCE_ACCESS_TOKEN ?? JSON.parse(fs.readFileSync("package.json", "utf-8")).requence?.accessToken;
4884
+ let token = argv.accessToken ?? process.env.REQUENCE_TASK_ACCESS_TOKEN ?? process.env.REQUENCE_ACCESS_TOKEN;
4885
+ if (!token) {
4886
+ const pkgJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
4887
+ token = pkgJson.requence?.task?.accessToken ?? pkgJson.requence?.accessToken;
4888
+ }
4891
4889
  console.info();
4892
4890
  if (!token) {
4893
4891
  errorExit("No access token found", `You can provide the access token as argument to ${chalk.bold("createTask")},
@@ -4911,14 +4909,12 @@ in your ${chalk.bold("package.json")} in ${chalk.bold("requence.accessToken")}`)
4911
4909
  errorExit(error);
4912
4910
  }
4913
4911
  const text = await response.text();
4914
- const data = `/* eslint-disable */
4915
- /* prettier-ignore */
4916
-
4917
- ${text}`;
4912
+ const data = ["/* eslint-disable */", "/* prettier-ignore */", text].join(`
4913
+ `);
4918
4914
  const file = path.join(argv.outdir || process.cwd(), argv.outfile);
4919
4915
  fs.writeFileSync(file, data);
4920
4916
  console.info(chalk.green("types saved to", chalk.bold(path.relative(process.cwd(), file))));
4921
4917
  }).scriptName("requence-task").help("h").demandCommand(1, 1).strict().parse();
4922
4918
 
4923
- //# debugId=B7E3681F48E5677864756E2164756E21
4919
+ //# debugId=F3A972B39B5A133F64756E2164756E21
4924
4920
  //# sourceMappingURL=cli.js.map