@exedev/sdk 0.1.0 → 0.3.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.
- package/README.md +165 -59
- package/dist/client.d.ts +70 -43
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +319 -101
- package/dist/client.js.map +1 -1
- package/dist/commands.gen.d.ts +358 -293
- package/dist/commands.gen.d.ts.map +1 -1
- package/dist/commands.gen.js +905 -511
- package/dist/commands.gen.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +327 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
package/dist/client.js
CHANGED
|
@@ -1,78 +1,157 @@
|
|
|
1
|
-
|
|
1
|
+
// Code generated by "go run ./cmd/gensdkjs" in the exe.dev repository. DO NOT EDIT.
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Command methods resolve to the command's parsed JSON output and reject with
|
|
7
|
-
* ExeAPIError when the command fails.
|
|
3
|
+
* API rejection. The message carries the server's error text, shortened; the
|
|
4
|
+
* request and the full response body stay out of it.
|
|
8
5
|
*/
|
|
9
|
-
export class
|
|
6
|
+
export class ExeAPIError extends Error {
|
|
7
|
+
operation;
|
|
8
|
+
/** The HTTP status, or 404 for a VM the server reported missing. */
|
|
9
|
+
status;
|
|
10
|
+
#body;
|
|
11
|
+
constructor(operation, status, body) {
|
|
12
|
+
const reason = errorText(body);
|
|
13
|
+
super(`exe.dev API error (${status}) during ${operation}${reason ? `: ${reason}` : ""}`);
|
|
14
|
+
this.name = "ExeAPIError";
|
|
15
|
+
this.operation = operation;
|
|
16
|
+
this.status = status;
|
|
17
|
+
this.#body = body;
|
|
18
|
+
}
|
|
19
|
+
/** Opt-in server diagnostics; may contain secrets. Does not establish whether an operation ran. */
|
|
20
|
+
details() { return { body: this.#body }; }
|
|
21
|
+
}
|
|
22
|
+
export class ExeProtocolError extends Error {
|
|
23
|
+
operation;
|
|
24
|
+
constructor(operation) {
|
|
25
|
+
super(`exedev: invalid ${operation} response`);
|
|
26
|
+
this.operation = operation;
|
|
27
|
+
this.name = "ExeProtocolError";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** The command's exit status is unknown; captured output is only a prefix. Do not blindly retry. */
|
|
31
|
+
export class SSHStreamError extends Error {
|
|
32
|
+
code;
|
|
33
|
+
captured;
|
|
34
|
+
#stdout;
|
|
35
|
+
#stderr;
|
|
36
|
+
#detail;
|
|
37
|
+
#cause;
|
|
38
|
+
constructor(code, captured, stdout, stderr, detail, cause) {
|
|
39
|
+
super(`exedev: ssh ${code === "output_limit" ? "capture limit exceeded" : code === "protocol" ? "invalid output stream" : "connection ended before the command's exit status arrived"}`);
|
|
40
|
+
this.code = code;
|
|
41
|
+
this.captured = captured;
|
|
42
|
+
this.name = "SSHStreamError";
|
|
43
|
+
this.#stdout = stdout;
|
|
44
|
+
this.#stderr = stderr;
|
|
45
|
+
this.#detail = detail;
|
|
46
|
+
this.#cause = cause;
|
|
47
|
+
}
|
|
48
|
+
get stdoutBytes() { return this.#stdout; }
|
|
49
|
+
get stderrBytes() { return this.#stderr; }
|
|
50
|
+
get stdout() { return decodeUTF8(this.#stdout); }
|
|
51
|
+
get stderr() { return decodeUTF8(this.#stderr); }
|
|
52
|
+
/** Opt-in diagnostics: the server's message, or the transport's error. Either may contain secrets. */
|
|
53
|
+
details() { return { message: this.#detail, cause: this.#cause }; }
|
|
54
|
+
}
|
|
55
|
+
/** Internal transport, deliberately not exported from the package entry point. */
|
|
56
|
+
export class Transport {
|
|
10
57
|
#token;
|
|
11
58
|
#baseURL;
|
|
12
59
|
#fetch;
|
|
13
60
|
constructor(opts) {
|
|
14
|
-
|
|
15
|
-
if (!opts?.token) {
|
|
61
|
+
if (!opts?.token)
|
|
16
62
|
throw new Error("exedev: token is required");
|
|
17
|
-
}
|
|
18
63
|
this.#token = opts.token;
|
|
19
64
|
this.#baseURL = (opts.baseURL ?? "https://exe.dev").replace(/\/$/, "");
|
|
20
65
|
this.#fetch = opts.fetch ?? ((input, init) => fetch(input, init));
|
|
21
66
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
const docs = parseDocuments(result.body);
|
|
43
|
-
if (docs === undefined) {
|
|
44
|
-
return result.body;
|
|
67
|
+
async #post(command, options) {
|
|
68
|
+
const signal = options?.signal;
|
|
69
|
+
signal?.throwIfAborted();
|
|
70
|
+
try {
|
|
71
|
+
const response = await abortable(this.#fetch(`${this.#baseURL}/exec`, {
|
|
72
|
+
method: "POST",
|
|
73
|
+
headers: {
|
|
74
|
+
Authorization: `Bearer ${this.#token}`,
|
|
75
|
+
"Content-Type": "text/plain",
|
|
76
|
+
Accept: "application/json, application/x-ndjson",
|
|
77
|
+
},
|
|
78
|
+
body: command,
|
|
79
|
+
signal,
|
|
80
|
+
}), signal);
|
|
81
|
+
if (signal?.aborted) {
|
|
82
|
+
response.body?.cancel().catch(() => { });
|
|
83
|
+
signal.throwIfAborted();
|
|
84
|
+
}
|
|
85
|
+
return response;
|
|
45
86
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
87
|
+
catch (err) {
|
|
88
|
+
signal?.throwIfAborted();
|
|
89
|
+
throw err;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async #text(response, signal) {
|
|
93
|
+
try {
|
|
94
|
+
const body = await abortable(response.text(), signal);
|
|
95
|
+
signal?.throwIfAborted();
|
|
96
|
+
return body;
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
signal?.throwIfAborted();
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async call(path, args, options, flags, json = false) {
|
|
104
|
+
const { status, body, docs } = await this.documents(path, args, options, flags);
|
|
105
|
+
if (docs === undefined) {
|
|
106
|
+
if (json)
|
|
107
|
+
throw new ExeProtocolError(path);
|
|
108
|
+
return body;
|
|
50
109
|
}
|
|
110
|
+
if (docs.some(isErrorDocument))
|
|
111
|
+
throw new ExeAPIError(path, status, body);
|
|
51
112
|
return docs.length === 1 ? docs[0] : docs;
|
|
52
113
|
}
|
|
114
|
+
/** A successful response's JSON documents, including any in-band error documents. */
|
|
115
|
+
async documents(path, args, options, flags) {
|
|
116
|
+
const res = await this.#post(commandLine(path, args, options, flags), options);
|
|
117
|
+
const body = await this.#text(res, options?.signal);
|
|
118
|
+
if (!res.ok)
|
|
119
|
+
throw new ExeAPIError(path, res.status, body);
|
|
120
|
+
return { status: res.status, body, docs: parseDocuments(body) };
|
|
121
|
+
}
|
|
122
|
+
async ssh(vm, command, options = {}) {
|
|
123
|
+
const { capture = true, maxOutputBytes = 8 * 1024 * 1024 } = options;
|
|
124
|
+
if (typeof capture !== "boolean" || !Number.isSafeInteger(maxOutputBytes) || maxOutputBytes < 0) {
|
|
125
|
+
throw new TypeError("exedev: capture must be boolean and maxOutputBytes a nonnegative safe integer");
|
|
126
|
+
}
|
|
127
|
+
let res;
|
|
128
|
+
try {
|
|
129
|
+
res = await this.#post(`ssh ${quote(vm)} ${quote(command)}`, options);
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
options.signal?.throwIfAborted();
|
|
133
|
+
// The request may have reached the VM: whether the command ran is unknown.
|
|
134
|
+
throw new SSHStreamError("interrupted", capture, new Uint8Array(), new Uint8Array(), undefined, err);
|
|
135
|
+
}
|
|
136
|
+
if (!res.ok) {
|
|
137
|
+
const body = await this.#text(res, options.signal);
|
|
138
|
+
throw new ExeAPIError("ssh", res.status, body);
|
|
139
|
+
}
|
|
140
|
+
if (!isNDJSON(res)) {
|
|
141
|
+
// An older server may be streaming an infinite command in its raw
|
|
142
|
+
// format. Do not read it as an error body, or claim the command never ran.
|
|
143
|
+
res.body?.cancel().catch(() => { });
|
|
144
|
+
options.signal?.throwIfAborted();
|
|
145
|
+
throw new ExeProtocolError("ssh");
|
|
146
|
+
}
|
|
147
|
+
return readSSHOutput(res, { ...options, capture, maxOutputBytes });
|
|
148
|
+
}
|
|
53
149
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Create an exe.dev API client.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* import exedev from "@exedev/sdk";
|
|
60
|
-
*
|
|
61
|
-
* const exe = exedev({ token: process.env.EXE_TOKEN! });
|
|
62
|
-
* const { vms } = await exe.ls();
|
|
63
|
-
* console.log(vms);
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
export default function exedev(opts) {
|
|
67
|
-
return new ExedevClient(opts);
|
|
68
|
-
}
|
|
69
|
-
/** Builds the command line for a generated command method. */
|
|
70
150
|
export function commandLine(path, args, options, flags) {
|
|
71
151
|
const words = [path];
|
|
72
152
|
for (const [key, value] of Object.entries(options ?? {})) {
|
|
73
|
-
if (key === "signal" || value === undefined)
|
|
153
|
+
if (key === "signal" || value === undefined)
|
|
74
154
|
continue;
|
|
75
|
-
}
|
|
76
155
|
const kind = Object.hasOwn(flags, key) ? flags[key] : undefined;
|
|
77
156
|
switch (kind) {
|
|
78
157
|
case "bool":
|
|
@@ -83,12 +162,10 @@ export function commandLine(path, args, options, flags) {
|
|
|
83
162
|
words.push(`--${key}=${quote(String(value))}`);
|
|
84
163
|
break;
|
|
85
164
|
case "repeated":
|
|
86
|
-
for (const v of [value].flat())
|
|
165
|
+
for (const v of [value].flat())
|
|
87
166
|
words.push(`--${key}=${quote(String(v))}`);
|
|
88
|
-
}
|
|
89
167
|
break;
|
|
90
|
-
default:
|
|
91
|
-
throw new TypeError(`${path}: unknown option ${JSON.stringify(key)}`);
|
|
168
|
+
default: throw new TypeError(`${path}: unknown option ${JSON.stringify(key)}`);
|
|
92
169
|
}
|
|
93
170
|
}
|
|
94
171
|
const positionals = [];
|
|
@@ -99,70 +176,211 @@ export function commandLine(path, args, options, flags) {
|
|
|
99
176
|
continue;
|
|
100
177
|
}
|
|
101
178
|
for (const a of [arg].flat()) {
|
|
102
|
-
if (skipped)
|
|
103
|
-
throw new TypeError(`${path}: argument
|
|
104
|
-
}
|
|
179
|
+
if (skipped)
|
|
180
|
+
throw new TypeError(`${path}: argument follows an omitted argument`);
|
|
105
181
|
positionals.push(a);
|
|
106
182
|
}
|
|
107
183
|
}
|
|
108
|
-
if (positionals.some((p) => p.startsWith("-")))
|
|
184
|
+
if (positionals.some((p) => p.startsWith("-")))
|
|
109
185
|
words.push("--");
|
|
110
|
-
}
|
|
111
186
|
words.push(...positionals.map(quote));
|
|
112
187
|
return words.join(" ");
|
|
113
188
|
}
|
|
114
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Quote a string as one POSIX shell word, for untrusted values interpolated
|
|
191
|
+
* into vm.ssh() commands: vm.ssh(`cat ${quote(path)}`).
|
|
192
|
+
*/
|
|
115
193
|
export function quote(s) {
|
|
116
|
-
|
|
117
|
-
|
|
194
|
+
return /^[A-Za-z0-9_@%+=:,./-]+$/.test(s) ? s : `'${s.replaceAll("'", `'"'"'`)}'`;
|
|
195
|
+
}
|
|
196
|
+
function isNDJSON(res) {
|
|
197
|
+
return (res.headers.get("Content-Type") ?? "").split(";")[0].trim().toLowerCase() === "application/x-ndjson";
|
|
198
|
+
}
|
|
199
|
+
// SSH writes are small; refuse an unbounded/incomplete NDJSON frame even in stream-only mode.
|
|
200
|
+
const maxFrameChars = 1024 * 1024;
|
|
201
|
+
async function readSSHOutput(res, options) {
|
|
202
|
+
const { signal, capture, maxOutputBytes } = options;
|
|
203
|
+
const chunks = { stdout: [], stderr: [] };
|
|
204
|
+
const decoders = { stdout: new TextDecoder(), stderr: new TextDecoder() };
|
|
205
|
+
const callbacks = { stdout: options.onStdout, stderr: options.onStderr };
|
|
206
|
+
let count = 0;
|
|
207
|
+
let exitCode;
|
|
208
|
+
let terminal = false;
|
|
209
|
+
const failure = (code, detail, cause) => new SSHStreamError(code, capture, concat(chunks.stdout), concat(chunks.stderr), detail, cause);
|
|
210
|
+
const deliver = async (name, text) => {
|
|
211
|
+
if (text && callbacks[name])
|
|
212
|
+
await abortable(Promise.resolve().then(() => callbacks[name](text)), signal);
|
|
213
|
+
signal?.throwIfAborted();
|
|
214
|
+
};
|
|
215
|
+
const frame = async (line) => {
|
|
216
|
+
signal?.throwIfAborted();
|
|
217
|
+
if (line.trim() === "")
|
|
218
|
+
return;
|
|
219
|
+
if (terminal || line.length > maxFrameChars)
|
|
220
|
+
throw failure("protocol");
|
|
221
|
+
let f;
|
|
222
|
+
try {
|
|
223
|
+
f = JSON.parse(line);
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
throw failure("protocol");
|
|
227
|
+
}
|
|
228
|
+
if (typeof f !== "object" || f === null || Array.isArray(f) || Object.keys(f).length !== 1)
|
|
229
|
+
throw failure("protocol");
|
|
230
|
+
const value = f;
|
|
231
|
+
for (const name of ["stdout", "stderr"]) {
|
|
232
|
+
if (typeof value[name] !== "string")
|
|
233
|
+
continue;
|
|
234
|
+
let bytes;
|
|
235
|
+
try {
|
|
236
|
+
bytes = decodeBase64(value[name]);
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
throw failure("protocol");
|
|
240
|
+
}
|
|
241
|
+
if (capture) {
|
|
242
|
+
if (count + bytes.length > maxOutputBytes)
|
|
243
|
+
throw failure("output_limit");
|
|
244
|
+
count += bytes.length;
|
|
245
|
+
chunks[name].push(bytes);
|
|
246
|
+
}
|
|
247
|
+
if (callbacks[name])
|
|
248
|
+
await deliver(name, decoders[name].decode(bytes, { stream: true }));
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (typeof value.exit_code === "number" && Number.isSafeInteger(value.exit_code) && value.exit_code >= 0) {
|
|
252
|
+
exitCode = value.exit_code;
|
|
253
|
+
terminal = true;
|
|
254
|
+
}
|
|
255
|
+
else if (typeof value.error === "string") {
|
|
256
|
+
throw failure("interrupted", value.error);
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
throw failure("protocol");
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
const reader = res.body?.getReader();
|
|
263
|
+
const decoder = new TextDecoder();
|
|
264
|
+
let pending = "";
|
|
265
|
+
let done = false;
|
|
266
|
+
try {
|
|
267
|
+
if (!reader)
|
|
268
|
+
throw failure("interrupted");
|
|
269
|
+
while (true) {
|
|
270
|
+
signal?.throwIfAborted();
|
|
271
|
+
let chunk;
|
|
272
|
+
try {
|
|
273
|
+
chunk = await abortable(reader.read(), signal);
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
signal?.throwIfAborted();
|
|
277
|
+
throw failure("interrupted", undefined, err);
|
|
278
|
+
}
|
|
279
|
+
if (chunk.done)
|
|
280
|
+
break;
|
|
281
|
+
const lines = (pending + decoder.decode(chunk.value, { stream: true })).split("\n");
|
|
282
|
+
pending = lines.pop();
|
|
283
|
+
for (const line of lines)
|
|
284
|
+
await frame(line);
|
|
285
|
+
if (pending.length > maxFrameChars)
|
|
286
|
+
throw failure("protocol");
|
|
287
|
+
}
|
|
288
|
+
await frame(pending + decoder.decode());
|
|
289
|
+
if (exitCode === undefined)
|
|
290
|
+
throw failure("interrupted");
|
|
291
|
+
for (const name of ["stdout", "stderr"]) {
|
|
292
|
+
if (callbacks[name])
|
|
293
|
+
await deliver(name, decoders[name].decode());
|
|
294
|
+
}
|
|
295
|
+
signal?.throwIfAborted();
|
|
296
|
+
done = true;
|
|
297
|
+
const stdoutBytes = concat(chunks.stdout);
|
|
298
|
+
const stderrBytes = concat(chunks.stderr);
|
|
299
|
+
return {
|
|
300
|
+
exitCode, captured: capture, stdoutBytes, stderrBytes,
|
|
301
|
+
get stdout() { return decodeUTF8(stdoutBytes); },
|
|
302
|
+
get stderr() { return decodeUTF8(stderrBytes); },
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
finally {
|
|
306
|
+
if (!done)
|
|
307
|
+
reader?.cancel().catch(() => { });
|
|
308
|
+
reader?.releaseLock();
|
|
118
309
|
}
|
|
119
|
-
return `'${s.replaceAll("'", `'"'"'`)}'`;
|
|
120
310
|
}
|
|
121
|
-
/**
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
311
|
+
/** Stop waiting for an uncooperative fetch/body/callback when the caller cancels. */
|
|
312
|
+
export async function abortable(promise, signal) {
|
|
313
|
+
if (!signal)
|
|
314
|
+
return promise;
|
|
315
|
+
let abort;
|
|
316
|
+
try {
|
|
317
|
+
return await Promise.race([promise, new Promise((_, reject) => {
|
|
318
|
+
abort = () => reject(signal.reason);
|
|
319
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
320
|
+
if (signal.aborted)
|
|
321
|
+
abort();
|
|
322
|
+
})]);
|
|
323
|
+
}
|
|
324
|
+
finally {
|
|
325
|
+
if (abort)
|
|
326
|
+
signal.removeEventListener("abort", abort);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
export function delay(ms, signal) {
|
|
330
|
+
return new Promise((resolve, reject) => {
|
|
331
|
+
const done = () => { signal.removeEventListener("abort", abort); resolve(); };
|
|
332
|
+
const timer = setTimeout(done, ms);
|
|
333
|
+
const abort = () => { clearTimeout(timer); signal.removeEventListener("abort", abort); reject(signal.reason); };
|
|
334
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
335
|
+
if (signal.aborted)
|
|
336
|
+
abort();
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function decodeBase64(s) {
|
|
340
|
+
const bin = atob(s);
|
|
341
|
+
const bytes = new Uint8Array(bin.length);
|
|
342
|
+
for (let i = 0; i < bin.length; i++)
|
|
343
|
+
bytes[i] = bin.charCodeAt(i);
|
|
344
|
+
return bytes;
|
|
345
|
+
}
|
|
346
|
+
function decodeUTF8(bytes) { return new TextDecoder().decode(bytes); }
|
|
347
|
+
function concat(chunks) {
|
|
348
|
+
if (chunks.length === 1)
|
|
349
|
+
return chunks[0];
|
|
350
|
+
const out = new Uint8Array(chunks.reduce((n, c) => n + c.length, 0));
|
|
351
|
+
let at = 0;
|
|
352
|
+
for (const c of chunks) {
|
|
353
|
+
out.set(c, at);
|
|
354
|
+
at += c.length;
|
|
355
|
+
}
|
|
356
|
+
return out;
|
|
357
|
+
}
|
|
125
358
|
function parseDocuments(body) {
|
|
126
359
|
const text = body.trim();
|
|
127
|
-
if (text
|
|
360
|
+
if (!text)
|
|
128
361
|
return undefined;
|
|
129
|
-
}
|
|
130
362
|
try {
|
|
131
363
|
return [JSON.parse(text)];
|
|
132
364
|
}
|
|
133
|
-
catch {
|
|
134
|
-
// Not a single document.
|
|
135
|
-
}
|
|
365
|
+
catch { /* Try NDJSON. */ }
|
|
136
366
|
try {
|
|
137
|
-
return text.split("\n").filter((
|
|
367
|
+
return text.split("\n").filter((s) => s.trim() !== "").map((s) => JSON.parse(s));
|
|
138
368
|
}
|
|
139
369
|
catch {
|
|
140
370
|
return undefined;
|
|
141
371
|
}
|
|
142
372
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
constructor(command, status, body) {
|
|
153
|
-
super(`exe.dev API error (${status}): ${errorMessage(body)}`);
|
|
154
|
-
this.name = "ExeAPIError";
|
|
155
|
-
this.command = command;
|
|
156
|
-
this.status = status;
|
|
157
|
-
this.body = body;
|
|
158
|
-
}
|
|
373
|
+
/** The server's first error text, on one line and at most 200 characters. */
|
|
374
|
+
function errorText(body) {
|
|
375
|
+
const docs = parseDocuments(body) ?? [];
|
|
376
|
+
const hasError = (doc) => typeof doc?.error === "string";
|
|
377
|
+
const doc = (docs.find(isErrorDocument) ?? docs.find(hasError));
|
|
378
|
+
if (typeof doc?.error !== "string")
|
|
379
|
+
return undefined;
|
|
380
|
+
const text = doc.error.replace(/\s+/g, " ").trim();
|
|
381
|
+
return text.length > 200 ? `${text.slice(0, 199)}…` : text || undefined;
|
|
159
382
|
}
|
|
160
|
-
function
|
|
161
|
-
|
|
162
|
-
if (isErrorDocument(doc)) {
|
|
163
|
-
return String(doc.error);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return body.trim();
|
|
383
|
+
export function isErrorDocument(doc) {
|
|
384
|
+
return typeof doc === "object" && doc !== null && !Array.isArray(doc) && Object.keys(doc).length === 1 && "error" in doc;
|
|
167
385
|
}
|
|
168
386
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAwB7C;;;;;;GAMG;AACH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IAC/B,MAAM,CAAS;IACf,QAAQ,CAAS;IACjB,MAAM,CAAe;IAE9B,YAAY,IAAmB;QAC7B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,iBAAiB,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,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