@requence/service 1.0.0-alpha.4 → 1.0.0-alpha.45

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 (90) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/build/{chunk-0x9092n4.js → chunk-6w7td62p.js} +5 -44
  3. package/build/chunk-6w7td62p.js.map +10 -0
  4. package/build/cli.js +19 -12
  5. package/build/cli.js.map +3 -3
  6. package/build/index.js +930 -863
  7. package/build/index.js.map +18 -16
  8. package/build/types/helpers/src/files/RequenceFile.d.ts +40 -0
  9. package/build/types/helpers/src/files/RequenceFile.d.ts.map +1 -0
  10. package/build/types/helpers/src/files/RequenceStream.d.ts +32 -0
  11. package/build/types/helpers/src/files/RequenceStream.d.ts.map +1 -0
  12. package/build/types/helpers/src/files/fileObject.d.ts +16 -0
  13. package/build/types/helpers/src/files/fileObject.d.ts.map +1 -0
  14. package/build/types/helpers/src/files/index.d.ts +7 -0
  15. package/build/types/helpers/src/files/index.d.ts.map +1 -0
  16. package/build/types/helpers/src/files/isValidMimeType.d.ts +5 -0
  17. package/build/types/helpers/src/files/isValidMimeType.d.ts.map +1 -0
  18. package/build/types/helpers/src/files/mapOutput.d.ts +10 -0
  19. package/build/types/helpers/src/files/mapOutput.d.ts.map +1 -0
  20. package/build/types/helpers/src/files/streamObject.d.ts +14 -0
  21. package/build/types/helpers/src/files/streamObject.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 +10 -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 +13 -0
  29. package/build/types/helpers/src/jsonschema/types.d.ts.map +1 -0
  30. package/build/types/helpers/src/jsonschema/validate.d.ts +32 -0
  31. package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -0
  32. package/build/types/helpers/src/jsonschema/zod.d.ts +15 -0
  33. package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
  34. package/build/types/helpers/src/protocol/NodeTree.d.ts +993 -0
  35. package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -0
  36. package/build/types/helpers/src/protocol/command.d.ts +853 -0
  37. package/build/types/helpers/src/protocol/command.d.ts.map +1 -0
  38. package/build/types/helpers/src/protocol/helpers.d.ts +7 -0
  39. package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -0
  40. package/build/types/helpers/src/protocol/index.d.ts +7 -0
  41. package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
  42. package/build/types/helpers/src/protocol/nodeType.d.ts +434 -0
  43. package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -0
  44. package/build/types/helpers/src/protocol/taskOptions.d.ts +23 -0
  45. package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -0
  46. package/build/types/helpers/src/protocol/treeNodes.d.ts +1542 -0
  47. package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -0
  48. package/build/types/helpers/src/protocol/update.d.ts +379 -0
  49. package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
  50. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
  51. package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
  52. package/build/types/helpers/src/utils/clone.d.ts +3 -0
  53. package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
  54. package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
  55. package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
  56. package/build/types/helpers/src/{createRemotePromise.d.ts → utils/createRemotePromise.d.ts} +1 -1
  57. package/build/types/helpers/src/utils/createRemotePromise.d.ts.map +1 -0
  58. package/build/types/helpers/src/utils/isRecord.d.ts +2 -0
  59. package/build/types/helpers/src/utils/isRecord.d.ts.map +1 -0
  60. package/build/types/helpers/src/utils/mapData.d.ts +18 -0
  61. package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
  62. package/build/types/helpers/src/{utils.d.ts → utils/matchSchema.d.ts} +2 -2
  63. package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
  64. package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
  65. package/build/types/helpers/src/utils/requenceCallback.d.ts +17 -0
  66. package/build/types/helpers/src/utils/requenceCallback.d.ts.map +1 -0
  67. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +8 -0
  68. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +1 -0
  69. package/build/types/service/src/createAmqpConnection.d.ts +19 -20
  70. package/build/types/service/src/createAmqpConnection.d.ts.map +1 -1
  71. package/build/types/service/src/helpers.d.ts +72 -99
  72. package/build/types/service/src/helpers.d.ts.map +1 -1
  73. package/build/types/service/src/index.d.ts +8 -4
  74. package/build/types/service/src/index.d.ts.map +1 -1
  75. package/build/types/service/src/macro.d.ts +2 -0
  76. package/build/types/service/src/macro.d.ts.map +1 -0
  77. package/build/types/service/src/mapInput.d.ts +2 -0
  78. package/build/types/service/src/mapInput.d.ts.map +1 -0
  79. package/build/types/service/src/utils.d.ts +6 -0
  80. package/build/types/service/src/utils.d.ts.map +1 -0
  81. package/package.json +8 -7
  82. package/build/chunk-0x9092n4.js.map +0 -12
  83. package/build/types/helpers/src/clone.d.ts +0 -3
  84. package/build/types/helpers/src/clone.d.ts.map +0 -1
  85. package/build/types/helpers/src/createObjectProxy.d.ts +0 -2
  86. package/build/types/helpers/src/createObjectProxy.d.ts.map +0 -1
  87. package/build/types/helpers/src/createRemotePromise.d.ts.map +0 -1
  88. package/build/types/helpers/src/obfuscate.d.ts.map +0 -1
  89. package/build/types/helpers/src/utils.d.ts.map +0 -1
  90. /package/build/types/helpers/src/{obfuscate.d.ts → utils/obfuscate.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,251 @@
1
1
  # @requence/service
2
2
 
3
+ ## 1.0.0-alpha.45
4
+
5
+ ### Patch Changes
6
+
7
+ - 533dc5d: fixed bun version
8
+
9
+ ## 1.0.0-alpha.44
10
+
11
+ ### Patch Changes
12
+
13
+ - 7b2e007: added ttl and retry to ui
14
+
15
+ ## 1.0.0-alpha.43
16
+
17
+ ### Patch Changes
18
+
19
+ - a2c6256: add missing types
20
+
21
+ ## 1.0.0-alpha.42
22
+
23
+ ### Patch Changes
24
+
25
+ - cc258b9: added types for amqplib
26
+
27
+ ## 1.0.0-alpha.41
28
+
29
+ ### Patch Changes
30
+
31
+ - 3175063: new service layout
32
+
33
+ ## 1.0.0-alpha.40
34
+
35
+ ### Patch Changes
36
+
37
+ - 4952eff: python types & bug fixes
38
+
39
+ ## 1.0.0-alpha.39
40
+
41
+ ### Patch Changes
42
+
43
+ - e50d691: use setup code to consume and create queues
44
+
45
+ ## 1.0.0-alpha.38
46
+
47
+ ### Patch Changes
48
+
49
+ - 0c7da80: python types
50
+
51
+ ## 1.0.0-alpha.37
52
+
53
+ ### Patch Changes
54
+
55
+ - b1c67cc: make package.json not mandatory during execution #2
56
+
57
+ ## 1.0.0-alpha.36
58
+
59
+ ### Patch Changes
60
+
61
+ - 08a3d9d: make package.json not mandatory during execution
62
+
63
+ ## 1.0.0-alpha.35
64
+
65
+ ### Patch Changes
66
+
67
+ - b68da9e: linting
68
+
69
+ ## 1.0.0-alpha.34
70
+
71
+ ### Patch Changes
72
+
73
+ - 106afe2: ease version naming restrictions, added iterator helpers to service, added default for boolean and number
74
+
75
+ ## 1.0.0-alpha.33
76
+
77
+ ### Patch Changes
78
+
79
+ - 3463821: wait for connect before assume backchannel exists
80
+
81
+ ## 1.0.0-alpha.32
82
+
83
+ ### Patch Changes
84
+
85
+ - 6555130: fix order of creation
86
+
87
+ ## 1.0.0-alpha.31
88
+
89
+ ### Patch Changes
90
+
91
+ - 9ab17d6: ui improvements, reduce time between backchannel creation and usage
92
+
93
+ ## 1.0.0-alpha.30
94
+
95
+ ### Patch Changes
96
+
97
+ - 63b22b8: fix library display
98
+
99
+ ## 1.0.0-alpha.29
100
+
101
+ ### Patch Changes
102
+
103
+ - e8e7ace: ack after done
104
+
105
+ ## 1.0.0-alpha.28
106
+
107
+ ### Patch Changes
108
+
109
+ - d6b58d4: communicate libversion
110
+
111
+ ## 1.0.0-alpha.27
112
+
113
+ ### Patch Changes
114
+
115
+ - d316984: persist operator instance name
116
+
117
+ ## 1.0.0-alpha.26
118
+
119
+ ### Patch Changes
120
+
121
+ - f6c481d: make services resumable in continuous mode
122
+
123
+ ## 1.0.0-alpha.25
124
+
125
+ ### Patch Changes
126
+
127
+ - d91ec98: added callback types
128
+
129
+ ## 1.0.0-alpha.24
130
+
131
+ ### Patch Changes
132
+
133
+ - f2a63fa: added missing type
134
+
135
+ ## 1.0.0-alpha.23
136
+
137
+ ### Patch Changes
138
+
139
+ - 13c28db: backchannel
140
+
141
+ ## 1.0.0-alpha.22
142
+
143
+ ### Patch Changes
144
+
145
+ - 7cbcfe5: continuous mode improvement
146
+
147
+ ## 1.0.0-alpha.21
148
+
149
+ ### Patch Changes
150
+
151
+ - a5c0c46: scaling
152
+
153
+ ## 1.0.0-alpha.20
154
+
155
+ ### Patch Changes
156
+
157
+ - a8b9588: rerelease
158
+
159
+ ## 1.0.0-alpha.19
160
+
161
+ ### Patch Changes
162
+
163
+ - 817e7ee: granular data / sub tasks / operator logic
164
+
165
+ ## 1.0.0-alpha.18
166
+
167
+ ### Patch Changes
168
+
169
+ - 515325e: use isRecord from helper package
170
+
171
+ ## 1.0.0-alpha.17
172
+
173
+ ### Patch Changes
174
+
175
+ - 41ef8e2: allow overwriting tls options
176
+
177
+ ## 1.0.0-alpha.16
178
+
179
+ ### Patch Changes
180
+
181
+ - 3a5e3e2: allow more access token options
182
+
183
+ ## 1.0.0-alpha.15
184
+
185
+ ### Patch Changes
186
+
187
+ - dc413ab: deps update
188
+
189
+ ## 1.0.0-alpha.14
190
+
191
+ ### Patch Changes
192
+
193
+ - 77bc2ed: improved task creation and event order
194
+
195
+ ## 1.0.0-alpha.13
196
+
197
+ ### Patch Changes
198
+
199
+ - 9dcaeae: fixed dependencies
200
+
201
+ ## 1.0.0-alpha.12
202
+
203
+ ### Patch Changes
204
+
205
+ - 1df3d43: improved typing
206
+
207
+ ## 1.0.0-alpha.11
208
+
209
+ ### Patch Changes
210
+
211
+ - 679cbaf: streams
212
+
213
+ ## 1.0.0-alpha.10
214
+
215
+ ### Patch Changes
216
+
217
+ - a464543: improved file matching algorithm
218
+
219
+ ## 1.0.0-alpha.9
220
+
221
+ ### Patch Changes
222
+
223
+ - 1d847ee: improved files handling
224
+
225
+ ## 1.0.0-alpha.8
226
+
227
+ ### Patch Changes
228
+
229
+ - f7ea7fa: added files support
230
+
231
+ ## 1.0.0-alpha.7
232
+
233
+ ### Patch Changes
234
+
235
+ - 04ce4a9: improved caching and live queries
236
+
237
+ ## 1.0.0-alpha.6
238
+
239
+ ### Patch Changes
240
+
241
+ - 1a0bca0: structure redesign
242
+
243
+ ## 1.0.0-alpha.5
244
+
245
+ ### Patch Changes
246
+
247
+ - add98b7: remove getData(alias) signature, add getNodes()
248
+
3
249
  ## 1.0.0-alpha.4
4
250
 
5
251
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- // ../helpers/src/obfuscate.ts
1
+ // ../helpers/src/utils/obfuscate.ts
2
2
  var separator = "";
3
3
  var base65Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
4
4
  var base65CharToIndex = {};
@@ -49,47 +49,8 @@ function deobfuscate(str) {
49
49
  }
50
50
  return decodedString.split(separator);
51
51
  }
52
- // ../helpers/src/clone.ts
53
- var CLONE_SYMBOL = Symbol("original");
54
- function clone(data) {
55
- if (typeof data !== "object" || data === null) {
56
- return data;
57
- }
58
- const target = data[CLONE_SYMBOL];
59
- if (target) {
60
- return clone(target);
61
- }
62
- if (Array.isArray(data)) {
63
- return data.map(clone);
64
- }
65
- return Object.fromEntries(Object.entries(data).map(([key, value]) => [key, clone(value)]));
66
- }
67
- // ../helpers/src/createObjectProxy.ts
68
- function createObjectProxy(obj, onChange) {
69
- return new Proxy(obj, {
70
- set(target, property, newValue) {
71
- const result = Reflect.set(target, property, newValue);
72
- onChange(target);
73
- return result;
74
- },
75
- deleteProperty(target, property) {
76
- const result = Reflect.deleteProperty(target, property);
77
- onChange(target);
78
- return result;
79
- },
80
- get(target, property, receiver) {
81
- if (property === CLONE_SYMBOL) {
82
- return target;
83
- }
84
- const result = Reflect.get(target, property, receiver);
85
- if (typeof result === "object" && result !== null) {
86
- return createObjectProxy(result, () => onChange(target));
87
- }
88
- return result;
89
- }
90
- });
91
- }
92
- export { obfuscate, deobfuscate, clone, createObjectProxy };
93
52
 
94
- //# debugId=A14CF1AD3BCA776264756E2164756E21
95
- //# sourceMappingURL=chunk-0x9092n4.js.map
53
+ export { obfuscate, deobfuscate };
54
+
55
+ //# debugId=E6AE9819DA2983FC64756E2164756E21
56
+ //# sourceMappingURL=chunk-6w7td62p.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;AAEO,SAAS,SAAS,IAAI,OAAsB;AAAA,EACjD,MAAM,MAAM,MAAM,KAAK,SAAS;AAAA,EAChC,IAAI,eAAe;AAAA,EAEnB,SAAS,IAAI,EAAG,IAAI,IAAI,QAAQ,KAAK;AAAA,IACnC,MAAM,WAAW,IAAI,WAAW,CAAC;AAAA,IACjC,gBAAgB,SAAS,SAAS,CAAC,EAAE,SAAS,IAAI,GAAG;AAAA,EACvD;AAAA,EAEA,IAAI,gBAAgB;AAAA,EACpB,MAAM,YAAY;AAAA,EAClB,IAAI,e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CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  deobfuscate
4
- } from "./chunk-0x9092n4.js";
4
+ } from "./chunk-6w7td62p.js";
5
5
 
6
6
  // src/cli.ts
7
7
  import fs from "node:fs";
@@ -20,36 +20,43 @@ function errorExit(title, text) {
20
20
  process.exit(1);
21
21
  }
22
22
  y.command("generate-types", "generates typescript types", (yargs2) => yargs2.option("access-token", {
23
- describe: "service key"
23
+ describe: "access token",
24
+ type: "string"
24
25
  }).option("outfile", {
25
26
  default: "requence-env.d.ts"
26
27
  }).option("outdir", {
27
28
  default: ""
28
29
  }), async (argv) => {
29
- const token = argv.accessToken ?? process.env.REQUENCE_ACCESS_TOKEN ?? JSON.parse(fs.readFileSync("package.json", "utf-8")).requence?.accessToken;
30
+ let token = argv.accessToken ?? process.env.REQUENCE_SERVICE_ACCESS_TOKEN ?? process.env.REQUENCE_ACCESS_TOKEN;
31
+ if (!token) {
32
+ const pkgJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
33
+ token = pkgJson.requence?.service?.accessToken ?? pkgJson.requence?.accessToken;
34
+ }
30
35
  console.info();
31
36
  if (!token) {
32
- errorExit("No access token found", `You can provide the access token as argument to ${chalk.bold("createTask")},
33
- as environment variable ${chalk.bold("REQUENCE_ACCESS_TOKEN")} or
34
- in your ${chalk.bold("package.json")} in ${chalk.bold("requence.accessToken")}`);
37
+ errorExit("No access token found", `You can provide the access token as argument to ${chalk.bold("requence-service")},
38
+ as environment variable ${chalk.bold("REQUENCE_ACCESS_TOKEN")} / ${chalk.bold("REQUENCE_SERVICE_ACCESS_TOKEN")} or
39
+ in your ${chalk.bold("package.json")} in ${chalk.bold("requence.accessToken")} / ${chalk.bold("requence.service.accessToken")}`);
35
40
  }
36
41
  const parts = deobfuscate(token);
37
42
  if (parts.length !== 3 || parts[0] !== "service") {
38
43
  errorExit("Invalid service key");
39
44
  }
40
45
  const [, connectionString, serverUrl] = parts;
41
- const response = await fetch(serverUrl + "/service/typescript", {
46
+ const response = await fetch(serverUrl + "/service/types/typescript", {
42
47
  method: "GET",
43
48
  headers: {
44
49
  Authorization: `Bearer ${connectionString}`
45
50
  }
46
51
  });
52
+ const text = await response.text();
47
53
  if (!response.ok) {
48
- const error = await response.text();
49
- errorExit(error);
54
+ errorExit(text);
50
55
  }
51
- const text = await response.text();
52
- const data = `/* eslint-disable */
56
+ const data = `// Generated by requence-service CLI — DO NOT EDIT.
57
+ // Changes will be overwritten.
58
+
59
+ /* eslint-disable */
53
60
  /* prettier-ignore */
54
61
 
55
62
  ${text}`;
@@ -58,5 +65,5 @@ ${text}`;
58
65
  console.info(chalk.green("types saved to", chalk.bold(path.relative(process.cwd(), file))));
59
66
  }).scriptName("requence-service").help("h").demandCommand(1, 1).strict().parse();
60
67
 
61
- //# debugId=E1A7B7E377FE0D8E64756E2164756E21
68
+ //# debugId=70A3626C7093F3E864756E2164756E21
62
69
  //# sourceMappingURL=cli.js.map
package/build/cli.js.map CHANGED
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/cli.ts"],
4
4
  "sourcesContent": [
5
- "#!/usr/bin/env node\n\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { deobfuscate } from '@requence/helpers'\nimport chalk from 'chalk'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nconst y = yargs(hideBin(process.argv))\n\nfunction errorExit(title: string, text?: string): never {\n console.error(chalk.red.bold(title + '\\n'))\n if (text) {\n console.error(chalk.red(text) + '\\n')\n }\n process.exit(1)\n}\n\ny.command(\n 'generate-types',\n 'generates typescript types',\n (yargs) =>\n yargs\n .option('access-token', {\n describe: 'service key',\n })\n .option('outfile', {\n default: 'requence-env.d.ts',\n })\n .option('outdir', {\n default: '',\n }),\n async (argv) => {\n const token =\n argv.accessToken ??\n process.env.REQUENCE_ACCESS_TOKEN ??\n JSON.parse(fs.readFileSync('package.json', 'utf-8')).requence?.accessToken\n\n console.info() // newline\n if (!token) {\n errorExit(\n 'No access token found',\n `You can provide the access token as argument to ${chalk.bold('createTask')},\\nas environment variable ${chalk.bold('REQUENCE_ACCESS_TOKEN')} or\\nin your ${chalk.bold('package.json')} in ${chalk.bold('requence.accessToken')}`,\n )\n }\n\n const parts = deobfuscate(token)\n if (parts.length !== 3 || parts[0] !== 'service') {\n errorExit('Invalid service key')\n }\n\n const [, connectionString, serverUrl] = parts\n\n const response = await fetch(serverUrl + '/service/typescript', {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${connectionString}`,\n },\n })\n\n if (!response.ok) {\n const error = await response.text()\n errorExit(error)\n }\n\n const text = await response.text()\n const data = `/* eslint-disable */\\n/* prettier-ignore */\\n\\n${text}`\n\n const file = path.join(argv.outdir || process.cwd(), argv.outfile)\n fs.writeFileSync(file, data)\n\n console.info(\n chalk.green(\n 'types saved to',\n chalk.bold(path.relative(process.cwd(), file)),\n ),\n )\n },\n)\n .scriptName('requence-service')\n .help('h')\n .demandCommand(1, 1)\n .strict()\n .parse()\n"
5
+ "#!/usr/bin/env node\n\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { deobfuscate } from '@requence/helpers'\nimport chalk from 'chalk'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\n\nconst y = yargs(hideBin(process.argv))\n\nfunction errorExit(title: string, text?: string): never {\n console.error(chalk.red.bold(title + '\\n'))\n if (text) {\n console.error(chalk.red(text) + '\\n')\n }\n process.exit(1)\n}\n\ny.command(\n 'generate-types',\n 'generates typescript types',\n (yargs) =>\n yargs\n .option('access-token', {\n describe: 'access token',\n type: 'string',\n })\n .option('outfile', {\n default: 'requence-env.d.ts',\n })\n .option('outdir', {\n default: '',\n }),\n async (argv) => {\n let token =\n argv.accessToken ??\n process.env.REQUENCE_SERVICE_ACCESS_TOKEN ??\n process.env.REQUENCE_ACCESS_TOKEN\n\n if (!token) {\n const pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'))\n token =\n pkgJson.requence?.service?.accessToken ?? pkgJson.requence?.accessToken\n }\n\n console.info() // newline\n if (!token) {\n errorExit(\n 'No access token found',\n `You can provide the access token as argument to ${chalk.bold('requence-service')},\\nas environment variable ${chalk.bold('REQUENCE_ACCESS_TOKEN')} / ${chalk.bold('REQUENCE_SERVICE_ACCESS_TOKEN')} or\\nin your ${chalk.bold('package.json')} in ${chalk.bold('requence.accessToken')} / ${chalk.bold('requence.service.accessToken')}`,\n )\n }\n\n const parts = deobfuscate(token)\n if (parts.length !== 3 || parts[0] !== 'service') {\n errorExit('Invalid service key')\n }\n\n const [, connectionString, serverUrl] = parts\n\n const response = await fetch(serverUrl + '/service/types/typescript', {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${connectionString}`,\n },\n })\n\n const text = await response.text()\n\n if (!response.ok) {\n errorExit(text)\n }\n\n const data = `// Generated by requence-service CLI — DO NOT EDIT.\\n// Changes will be overwritten.\\n\\n/* eslint-disable */\\n/* prettier-ignore */\\n\\n${text}`\n\n const file = path.join(argv.outdir || process.cwd(), argv.outfile)\n fs.writeFileSync(file, data)\n\n console.info(\n chalk.green(\n 'types saved to',\n chalk.bold(path.relative(process.cwd(), file)),\n ),\n )\n },\n)\n .scriptName('requence-service')\n .help('h')\n .demandCommand(1, 1)\n .strict()\n .parse()\n"
6
6
  ],
7
- "mappings": ";;;;;;AAEA;AACA;AAGA;AACA;AACA;AAEA,IAAM,IAAI,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAErC,SAAS,SAAS,CAAC,OAAe,MAAsB;AACtD,UAAQ,MAAM,MAAM,IAAI,KAAK,QAAQ;AAAA,CAAI,CAAC;AAC1C,MAAI,MAAM;AACR,YAAQ,MAAM,MAAM,IAAI,IAAI,IAAI;AAAA,CAAI;AAAA,EACtC;AACA,UAAQ,KAAK,CAAC;AAAA;AAGhB,EAAE,QACA,kBACA,8BACA,CAAC,WACC,OACG,OAAO,gBAAgB;AAAA,EACtB,UAAU;AACZ,CAAC,EACA,OAAO,WAAW;AAAA,EACjB,S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