@requence/service 1.0.0-alpha.3 → 1.0.0-alpha.31
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/CHANGELOG.md +169 -0
- package/build/{chunk-0x9092n4.js → chunk-6w7td62p.js} +5 -44
- package/build/chunk-6w7td62p.js.map +10 -0
- package/build/cli.js +14 -9
- package/build/cli.js.map +3 -3
- package/build/index.js +801 -791
- package/build/index.js.map +17 -16
- package/build/types/helpers/src/files/RequenceFile.d.ts +40 -0
- package/build/types/helpers/src/files/RequenceFile.d.ts.map +1 -0
- package/build/types/helpers/src/files/RequenceStream.d.ts +32 -0
- package/build/types/helpers/src/files/RequenceStream.d.ts.map +1 -0
- package/build/types/helpers/src/files/fileObject.d.ts +16 -0
- package/build/types/helpers/src/files/fileObject.d.ts.map +1 -0
- package/build/types/helpers/src/files/index.d.ts +7 -0
- package/build/types/helpers/src/files/index.d.ts.map +1 -0
- package/build/types/helpers/src/files/isValidMimeType.d.ts +5 -0
- package/build/types/helpers/src/files/isValidMimeType.d.ts.map +1 -0
- package/build/types/helpers/src/files/mapOutput.d.ts +10 -0
- package/build/types/helpers/src/files/mapOutput.d.ts.map +1 -0
- package/build/types/helpers/src/files/streamObject.d.ts +14 -0
- package/build/types/helpers/src/files/streamObject.d.ts.map +1 -0
- package/build/types/helpers/src/files/types.d.ts +4 -0
- package/build/types/helpers/src/files/types.d.ts.map +1 -0
- package/build/types/helpers/src/index.d.ts +10 -6
- package/build/types/helpers/src/index.d.ts.map +1 -1
- package/build/types/helpers/src/jsonschema/mapSchema.d.ts +20 -0
- package/build/types/helpers/src/jsonschema/mapSchema.d.ts.map +1 -0
- package/build/types/helpers/src/jsonschema/types.d.ts +12 -0
- package/build/types/helpers/src/jsonschema/types.d.ts.map +1 -0
- package/build/types/helpers/src/jsonschema/validate.d.ts +29 -0
- package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -0
- package/build/types/helpers/src/jsonschema/zod.d.ts +12 -0
- package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/NodeTree.d.ts +441 -0
- package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/command.d.ts +420 -0
- package/build/types/helpers/src/protocol/command.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/helpers.d.ts +5 -0
- package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/index.d.ts +8 -0
- package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/nodeType.d.ts +283 -0
- package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/targetNodes.d.ts +253 -0
- package/build/types/helpers/src/protocol/targetNodes.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/taskOptions.d.ts +17 -0
- package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/treeNodes.d.ts +606 -0
- package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/update.d.ts +354 -0
- package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
- package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
- package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
- package/build/types/helpers/src/utils/clone.d.ts +3 -0
- package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
- package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
- package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
- package/build/types/helpers/src/{createRemotePromise.d.ts → utils/createRemotePromise.d.ts} +1 -1
- package/build/types/helpers/src/utils/createRemotePromise.d.ts.map +1 -0
- package/build/types/helpers/src/utils/isRecord.d.ts +2 -0
- package/build/types/helpers/src/utils/isRecord.d.ts.map +1 -0
- package/build/types/helpers/src/utils/mapData.d.ts +18 -0
- package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
- package/build/types/helpers/src/{utils.d.ts → utils/matchSchema.d.ts} +2 -2
- package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
- package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
- package/build/types/helpers/src/utils/requenceCallback.d.ts +17 -0
- package/build/types/helpers/src/utils/requenceCallback.d.ts.map +1 -0
- package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +8 -0
- package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +1 -0
- package/build/types/helpers/src/utils/types.d.ts +4 -0
- package/build/types/helpers/src/utils/types.d.ts.map +1 -0
- package/build/types/service/src/createAmqpConnection.d.ts +19 -20
- package/build/types/service/src/createAmqpConnection.d.ts.map +1 -1
- package/build/types/service/src/helpers.d.ts +56 -100
- package/build/types/service/src/helpers.d.ts.map +1 -1
- package/build/types/service/src/index.d.ts +8 -5
- package/build/types/service/src/index.d.ts.map +1 -1
- package/build/types/service/src/macro.d.ts +2 -0
- package/build/types/service/src/macro.d.ts.map +1 -0
- package/build/types/service/src/mapInput.d.ts +2 -0
- package/build/types/service/src/mapInput.d.ts.map +1 -0
- package/package.json +7 -8
- package/build/chunk-0x9092n4.js.map +0 -12
- package/build/types/helpers/src/clone.d.ts +0 -3
- package/build/types/helpers/src/clone.d.ts.map +0 -1
- package/build/types/helpers/src/createObjectProxy.d.ts +0 -2
- package/build/types/helpers/src/createObjectProxy.d.ts.map +0 -1
- package/build/types/helpers/src/createRemotePromise.d.ts.map +0 -1
- package/build/types/helpers/src/obfuscate.d.ts.map +0 -1
- package/build/types/helpers/src/utils.d.ts.map +0 -1
- /package/build/types/helpers/src/{obfuscate.d.ts → utils/obfuscate.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# @requence/service
|
|
2
|
+
|
|
3
|
+
## 1.0.0-alpha.31
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9ab17d6: ui improvements, reduce time between backchannel creation and usage
|
|
8
|
+
|
|
9
|
+
## 1.0.0-alpha.30
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 63b22b8: fix library display
|
|
14
|
+
|
|
15
|
+
## 1.0.0-alpha.29
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- e8e7ace: ack after done
|
|
20
|
+
|
|
21
|
+
## 1.0.0-alpha.28
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- d6b58d4: communicate libversion
|
|
26
|
+
|
|
27
|
+
## 1.0.0-alpha.27
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- d316984: persist operator instance name
|
|
32
|
+
|
|
33
|
+
## 1.0.0-alpha.26
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- f6c481d: make services resumable in continuous mode
|
|
38
|
+
|
|
39
|
+
## 1.0.0-alpha.25
|
|
40
|
+
|
|
41
|
+
### Patch Changes
|
|
42
|
+
|
|
43
|
+
- d91ec98: added callback types
|
|
44
|
+
|
|
45
|
+
## 1.0.0-alpha.24
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- f2a63fa: added missing type
|
|
50
|
+
|
|
51
|
+
## 1.0.0-alpha.23
|
|
52
|
+
|
|
53
|
+
### Patch Changes
|
|
54
|
+
|
|
55
|
+
- 13c28db: backchannel
|
|
56
|
+
|
|
57
|
+
## 1.0.0-alpha.22
|
|
58
|
+
|
|
59
|
+
### Patch Changes
|
|
60
|
+
|
|
61
|
+
- 7cbcfe5: continuous mode improvement
|
|
62
|
+
|
|
63
|
+
## 1.0.0-alpha.21
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- a5c0c46: scaling
|
|
68
|
+
|
|
69
|
+
## 1.0.0-alpha.20
|
|
70
|
+
|
|
71
|
+
### Patch Changes
|
|
72
|
+
|
|
73
|
+
- a8b9588: rerelease
|
|
74
|
+
|
|
75
|
+
## 1.0.0-alpha.19
|
|
76
|
+
|
|
77
|
+
### Patch Changes
|
|
78
|
+
|
|
79
|
+
- 817e7ee: granular data / sub tasks / operator logic
|
|
80
|
+
|
|
81
|
+
## 1.0.0-alpha.18
|
|
82
|
+
|
|
83
|
+
### Patch Changes
|
|
84
|
+
|
|
85
|
+
- 515325e: use isRecord from helper package
|
|
86
|
+
|
|
87
|
+
## 1.0.0-alpha.17
|
|
88
|
+
|
|
89
|
+
### Patch Changes
|
|
90
|
+
|
|
91
|
+
- 41ef8e2: allow overwriting tls options
|
|
92
|
+
|
|
93
|
+
## 1.0.0-alpha.16
|
|
94
|
+
|
|
95
|
+
### Patch Changes
|
|
96
|
+
|
|
97
|
+
- 3a5e3e2: allow more access token options
|
|
98
|
+
|
|
99
|
+
## 1.0.0-alpha.15
|
|
100
|
+
|
|
101
|
+
### Patch Changes
|
|
102
|
+
|
|
103
|
+
- dc413ab: deps update
|
|
104
|
+
|
|
105
|
+
## 1.0.0-alpha.14
|
|
106
|
+
|
|
107
|
+
### Patch Changes
|
|
108
|
+
|
|
109
|
+
- 77bc2ed: improved task creation and event order
|
|
110
|
+
|
|
111
|
+
## 1.0.0-alpha.13
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- 9dcaeae: fixed dependencies
|
|
116
|
+
|
|
117
|
+
## 1.0.0-alpha.12
|
|
118
|
+
|
|
119
|
+
### Patch Changes
|
|
120
|
+
|
|
121
|
+
- 1df3d43: improved typing
|
|
122
|
+
|
|
123
|
+
## 1.0.0-alpha.11
|
|
124
|
+
|
|
125
|
+
### Patch Changes
|
|
126
|
+
|
|
127
|
+
- 679cbaf: streams
|
|
128
|
+
|
|
129
|
+
## 1.0.0-alpha.10
|
|
130
|
+
|
|
131
|
+
### Patch Changes
|
|
132
|
+
|
|
133
|
+
- a464543: improved file matching algorithm
|
|
134
|
+
|
|
135
|
+
## 1.0.0-alpha.9
|
|
136
|
+
|
|
137
|
+
### Patch Changes
|
|
138
|
+
|
|
139
|
+
- 1d847ee: improved files handling
|
|
140
|
+
|
|
141
|
+
## 1.0.0-alpha.8
|
|
142
|
+
|
|
143
|
+
### Patch Changes
|
|
144
|
+
|
|
145
|
+
- f7ea7fa: added files support
|
|
146
|
+
|
|
147
|
+
## 1.0.0-alpha.7
|
|
148
|
+
|
|
149
|
+
### Patch Changes
|
|
150
|
+
|
|
151
|
+
- 04ce4a9: improved caching and live queries
|
|
152
|
+
|
|
153
|
+
## 1.0.0-alpha.6
|
|
154
|
+
|
|
155
|
+
### Patch Changes
|
|
156
|
+
|
|
157
|
+
- 1a0bca0: structure redesign
|
|
158
|
+
|
|
159
|
+
## 1.0.0-alpha.5
|
|
160
|
+
|
|
161
|
+
### Patch Changes
|
|
162
|
+
|
|
163
|
+
- add98b7: remove getData(alias) signature, add getNodes()
|
|
164
|
+
|
|
165
|
+
## 1.0.0-alpha.4
|
|
166
|
+
|
|
167
|
+
### Patch Changes
|
|
168
|
+
|
|
169
|
+
- 3c4feaa: migrated to new service options
|
|
@@ -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
|
-
|
|
95
|
-
|
|
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,YAA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;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": "E6AE9819DA2983FC64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/build/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
deobfuscate
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-6w7td62p.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import fs from "node:fs";
|
|
@@ -19,26 +19,31 @@ function errorExit(title, text) {
|
|
|
19
19
|
}
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
22
|
-
y.command("generate-types", "generates typescript types", (yargs2) => yargs2.option("
|
|
23
|
-
describe: "service key"
|
|
22
|
+
y.command("generate-types", "generates typescript types", (yargs2) => yargs2.option("access-token", {
|
|
23
|
+
describe: "service key",
|
|
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
|
-
|
|
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("
|
|
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("createService")},
|
|
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}`
|
|
@@ -58,5 +63,5 @@ ${text}`;
|
|
|
58
63
|
console.info(chalk.green("types saved to", chalk.bold(path.relative(process.cwd(), file))));
|
|
59
64
|
}).scriptName("requence-service").help("h").demandCommand(1, 1).strict().parse();
|
|
60
65
|
|
|
61
|
-
//# debugId=
|
|
66
|
+
//# debugId=BCA4F1671D286D7E64756E2164756E21
|
|
62
67
|
//# 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('
|
|
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 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('createService')},\\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 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"
|
|
6
6
|
],
|
|
7
|
-
"mappings": ";;;;;;AAEA;AACA;AAGA;AACA;AACA;AAEA,IAAM,IAAI,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAErC,SAAS,SAAS,CAAC,OAAe,MAAsB;
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";;;;;;AAEA;AACA;AAGA;AACA;AACA;AAEA,IAAM,IAAI,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAErC,SAAS,SAAS,CAAC,OAAe,MAAsB;AAAA,EACtD,QAAQ,MAAM,MAAM,IAAI,KAAK,QAAQ;AAAA,CAAI,CAAC;AAAA,EAC1C,IAAI,MAAM;AAAA,IACR,QAAQ,MAAM,MAAM,IAAI,IAAI,IAAI;AAAA,CAAI;AAAA,EACtC;AAAA,EACA,QAAQ,KAAK,CAAC;AAAA;AAGhB,EAAE,QACA,kBACA,8BACA,CAAC,WACC,OACG,OAAO,gBAAgB;AAAA,EACtB,UAAU;AAAA,EACV,MAAM;AACR,CAAC,EACA,OAAO,WAAW;AAAA,EACjB,SAAS;AACX,CAAC,EACA,OAAO,UAAU;AAAA,EAChB,SAAS;AACX,CAAC,GACL,OAAO,SAAS;AAAA,EACd,IAAI,QACF,KAAK,eACL,QAAQ,IAAI,iCACZ,QAAQ,IAAI;AAAA,EAEd,KAAK,OAAO;AAAA,IAC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