@ariestools/cli 0.1.18 → 0.1.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.
- package/README.md +58 -0
- package/dist/bin/aries.mjs +20385 -11280
- package/dist/bin/daemons/chain-server.mjs +2287 -1059
- package/dist/bin/daemons/dapp-server.mjs +1 -1
- package/dist/bin/daemons/datalake-dev.mjs +47092 -32408
- package/dist/node/datalake.mjs +484 -15
- package/package.json +21 -21
package/dist/node/datalake.mjs
CHANGED
|
@@ -68,6 +68,473 @@ var DATALAKE_DATA_OPERATIONS = [
|
|
|
68
68
|
DATALAKE_CONTROL_OPERATIONS.join(" ");
|
|
69
69
|
DATALAKE_DATA_OPERATIONS.join(" ");
|
|
70
70
|
//#endregion
|
|
71
|
+
//#region ../../node_modules/.pnpm/@ariestools+sdk@8.2.0_@opentelemetry+api@1.9.1_zod@4.5.1/node_modules/@ariestools/sdk/dist/neutral/fetch.mjs
|
|
72
|
+
var fetchErrorMarker = "$$xylabs-fetch-error";
|
|
73
|
+
var codeTypes = {
|
|
74
|
+
ENOTFOUND: "dns",
|
|
75
|
+
EAI_AGAIN: "dns",
|
|
76
|
+
ECONNREFUSED: "connection-refused",
|
|
77
|
+
ECONNRESET: "connection-reset",
|
|
78
|
+
EPIPE: "connection-reset",
|
|
79
|
+
ETIMEDOUT: "connection-timeout",
|
|
80
|
+
UND_ERR_CONNECT_TIMEOUT: "connection-timeout",
|
|
81
|
+
UND_ERR_HEADERS_TIMEOUT: "timeout",
|
|
82
|
+
UND_ERR_BODY_TIMEOUT: "timeout",
|
|
83
|
+
EHOSTUNREACH: "unreachable",
|
|
84
|
+
ENETUNREACH: "unreachable",
|
|
85
|
+
CERT_HAS_EXPIRED: "tls",
|
|
86
|
+
DEPTH_ZERO_SELF_SIGNED_CERT: "tls",
|
|
87
|
+
UNABLE_TO_VERIFY_LEAF_SIGNATURE: "tls",
|
|
88
|
+
SELF_SIGNED_CERT_IN_CHAIN: "tls",
|
|
89
|
+
ERR_TLS_CERT_ALTNAME_INVALID: "tls"
|
|
90
|
+
};
|
|
91
|
+
function findErrorCode(error) {
|
|
92
|
+
let current = error;
|
|
93
|
+
for (let depth = 0; depth < 8 && current instanceof Error; depth++) {
|
|
94
|
+
const code = current.code;
|
|
95
|
+
if (typeof code === "string") return code;
|
|
96
|
+
current = current.cause;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function typeFromCode(code) {
|
|
100
|
+
if (Object.hasOwn(codeTypes, code)) return codeTypes[code];
|
|
101
|
+
if (code.startsWith("CERT_") || code.startsWith("ERR_TLS_")) return "tls";
|
|
102
|
+
}
|
|
103
|
+
function classifyFetchError(error) {
|
|
104
|
+
if (error instanceof Error) {
|
|
105
|
+
if (error.name === "TimeoutError") return { type: "timeout" };
|
|
106
|
+
if (error.name === "AbortError") return { type: "aborted" };
|
|
107
|
+
}
|
|
108
|
+
const code = findErrorCode(error);
|
|
109
|
+
if (code !== void 0) {
|
|
110
|
+
const type = typeFromCode(code);
|
|
111
|
+
if (type !== void 0) return {
|
|
112
|
+
type,
|
|
113
|
+
code
|
|
114
|
+
};
|
|
115
|
+
return {
|
|
116
|
+
type: "unknown",
|
|
117
|
+
code
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (error instanceof TypeError && /fetch failed|failed to fetch|network/i.test(error.message)) return { type: "network" };
|
|
121
|
+
return { type: "unknown" };
|
|
122
|
+
}
|
|
123
|
+
var FetchError = class extends Error {
|
|
124
|
+
/** Cross-realm marker consumed by {@link isFetchError}. */
|
|
125
|
+
__fetchErrorMarker = fetchErrorMarker;
|
|
126
|
+
/** Raw unparseable body text for `parse` failures. */
|
|
127
|
+
body;
|
|
128
|
+
/** Node, undici, or TLS system error code when available. */
|
|
129
|
+
code;
|
|
130
|
+
/** HTTP method associated with the failed request. */
|
|
131
|
+
method;
|
|
132
|
+
/** Parsed response for rejected HTTP-status requests. */
|
|
133
|
+
response;
|
|
134
|
+
/** HTTP status when a response was received. */
|
|
135
|
+
status;
|
|
136
|
+
/** HTTP reason phrase when a response was received. */
|
|
137
|
+
statusText;
|
|
138
|
+
/** Classified reason for the fetch failure. */
|
|
139
|
+
type;
|
|
140
|
+
/** Request URL associated with the failure. */
|
|
141
|
+
url;
|
|
142
|
+
/** Creates a structured fetch error from a message and request context. */
|
|
143
|
+
constructor(message, context = {}) {
|
|
144
|
+
super(message, { cause: context.cause });
|
|
145
|
+
this.name = "FetchError";
|
|
146
|
+
this.type = context.type ?? "unknown";
|
|
147
|
+
this.code = context.code;
|
|
148
|
+
this.url = context.url;
|
|
149
|
+
this.method = context.method;
|
|
150
|
+
this.status = context.status;
|
|
151
|
+
this.statusText = context.statusText;
|
|
152
|
+
this.response = context.response;
|
|
153
|
+
this.body = context.body;
|
|
154
|
+
}
|
|
155
|
+
/** Returns a circular-reference-free representation for logs and telemetry. */
|
|
156
|
+
toJSON() {
|
|
157
|
+
return {
|
|
158
|
+
name: this.name,
|
|
159
|
+
message: this.message,
|
|
160
|
+
type: this.type,
|
|
161
|
+
code: this.code,
|
|
162
|
+
url: this.url,
|
|
163
|
+
method: this.method,
|
|
164
|
+
status: this.status,
|
|
165
|
+
statusText: this.statusText
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
function isFetchError(value) {
|
|
170
|
+
return value instanceof FetchError || typeof value === "object" && value !== null && value.__fetchErrorMarker === fetchErrorMarker;
|
|
171
|
+
}
|
|
172
|
+
function toFetchError(error, context = {}) {
|
|
173
|
+
if (isFetchError(error)) return error;
|
|
174
|
+
const { type, code } = classifyFetchError(error);
|
|
175
|
+
return new FetchError(error instanceof Error ? error.message : String(error), {
|
|
176
|
+
...context,
|
|
177
|
+
type,
|
|
178
|
+
code,
|
|
179
|
+
cause: error
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function fetchDefault(input, init) {
|
|
183
|
+
return globalThis.fetch(input, init);
|
|
184
|
+
}
|
|
185
|
+
async function gzipString(body) {
|
|
186
|
+
const stream = new Blob([body]).stream().pipeThrough(new CompressionStream("gzip"));
|
|
187
|
+
return new Response(stream).arrayBuffer();
|
|
188
|
+
}
|
|
189
|
+
async function fetchCompress(url, options = {}) {
|
|
190
|
+
const { compressMinLength = 1024, fetcher = fetchDefault, ...init } = options;
|
|
191
|
+
try {
|
|
192
|
+
if (init.body !== void 0 && init.body !== null) {
|
|
193
|
+
const bodyStr = typeof init.body === "string" ? init.body : JSON.stringify(init.body);
|
|
194
|
+
if (bodyStr.length > compressMinLength) {
|
|
195
|
+
const headers = new Headers(init.headers);
|
|
196
|
+
headers.set("Content-Encoding", "gzip");
|
|
197
|
+
return await fetcher(url, {
|
|
198
|
+
...init,
|
|
199
|
+
body: await gzipString(bodyStr),
|
|
200
|
+
headers
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return await fetcher(url, init);
|
|
205
|
+
} catch (error) {
|
|
206
|
+
throw toFetchError(error, {
|
|
207
|
+
url: url.toString(),
|
|
208
|
+
method: init.method
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function validateMaxResponseBytes(maxResponseBytes) {
|
|
213
|
+
if (maxResponseBytes !== void 0 && (!Number.isSafeInteger(maxResponseBytes) || maxResponseBytes <= 0)) throw new RangeError("maxResponseBytes must be a positive safe integer");
|
|
214
|
+
}
|
|
215
|
+
function abortError(signal) {
|
|
216
|
+
const reason = signal.reason;
|
|
217
|
+
let isTimeout = false;
|
|
218
|
+
try {
|
|
219
|
+
isTimeout = typeof reason === "object" && reason !== null && "name" in reason && reason.name === "TimeoutError" || classifyFetchError(reason).type === "timeout";
|
|
220
|
+
} catch {}
|
|
221
|
+
return new FetchError("Response body read was aborted", {
|
|
222
|
+
type: isTimeout ? "timeout" : "aborted",
|
|
223
|
+
cause: reason
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function readChunk(reader, signal) {
|
|
227
|
+
if (signal == null) return reader.read();
|
|
228
|
+
return new Promise((resolve, reject) => {
|
|
229
|
+
let settled = false;
|
|
230
|
+
const finish = (outcome) => {
|
|
231
|
+
if (settled) return;
|
|
232
|
+
settled = true;
|
|
233
|
+
signal.removeEventListener("abort", onAbort);
|
|
234
|
+
if ("error" in outcome) reject(toFetchError(outcome.error));
|
|
235
|
+
else resolve(outcome.value);
|
|
236
|
+
};
|
|
237
|
+
const onAbort = () => finish({ error: abortError(signal) });
|
|
238
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
239
|
+
if (signal.aborted) {
|
|
240
|
+
onAbort();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
try {
|
|
244
|
+
reader.read().then((value) => signal.aborted ? onAbort() : finish({ value })).catch((error) => finish({ error }));
|
|
245
|
+
} catch (error) {
|
|
246
|
+
finish({ error });
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
function cancelReader(reader, reason) {
|
|
251
|
+
try {
|
|
252
|
+
reader.cancel(reason).catch(() => {});
|
|
253
|
+
} catch {}
|
|
254
|
+
}
|
|
255
|
+
async function readStreamText(reader, maxResponseBytes, signal, response) {
|
|
256
|
+
const decoder = new TextDecoder();
|
|
257
|
+
const parts = [];
|
|
258
|
+
let bytes = 0;
|
|
259
|
+
let completed = false;
|
|
260
|
+
let failure;
|
|
261
|
+
try {
|
|
262
|
+
while (true) {
|
|
263
|
+
const result = await readChunk(reader, signal);
|
|
264
|
+
if (signal?.aborted === true) throw abortError(signal);
|
|
265
|
+
if (result.done) {
|
|
266
|
+
parts.push(decoder.decode());
|
|
267
|
+
completed = true;
|
|
268
|
+
return parts.join("");
|
|
269
|
+
}
|
|
270
|
+
const chunk = result.value;
|
|
271
|
+
if (!ArrayBuffer.isView(chunk) || Object.prototype.toString.call(chunk) !== "[object Uint8Array]") throw new TypeError("Response body chunks must be Uint8Array values");
|
|
272
|
+
if (maxResponseBytes !== void 0) {
|
|
273
|
+
if (chunk.byteLength > maxResponseBytes - bytes) throw new FetchError("Response body exceeds maxResponseBytes", {
|
|
274
|
+
type: "response-too-large",
|
|
275
|
+
status: response.status,
|
|
276
|
+
statusText: response.statusText
|
|
277
|
+
});
|
|
278
|
+
bytes += chunk.byteLength;
|
|
279
|
+
}
|
|
280
|
+
const text = decoder.decode(chunk, { stream: true });
|
|
281
|
+
if (text !== "") parts.push(text);
|
|
282
|
+
}
|
|
283
|
+
} catch (error) {
|
|
284
|
+
failure = error;
|
|
285
|
+
throw error;
|
|
286
|
+
} finally {
|
|
287
|
+
if (!completed) cancelReader(reader, failure);
|
|
288
|
+
reader.releaseLock();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function readResponseText(response, options = {}) {
|
|
292
|
+
const { maxResponseBytes, signal } = options;
|
|
293
|
+
validateMaxResponseBytes(maxResponseBytes);
|
|
294
|
+
if (maxResponseBytes === void 0 && signal == null) return await response.text();
|
|
295
|
+
if (response.bodyUsed) throw new TypeError("Response body has already been consumed");
|
|
296
|
+
const body = response.body;
|
|
297
|
+
if (body === null) {
|
|
298
|
+
if (signal?.aborted === true) throw abortError(signal);
|
|
299
|
+
return "";
|
|
300
|
+
}
|
|
301
|
+
return await readStreamText(body.getReader(), maxResponseBytes, signal, response);
|
|
302
|
+
}
|
|
303
|
+
function contextualizeReadError(error, context, options) {
|
|
304
|
+
const failure = toFetchError(error, context);
|
|
305
|
+
if (options.maxResponseBytes === void 0 && options.signal == null) return failure;
|
|
306
|
+
if ((failure.url !== void 0 || context.url === void 0) && (failure.method !== void 0 || context.method === void 0)) return failure;
|
|
307
|
+
return new FetchError(failure.message, {
|
|
308
|
+
body: failure.body,
|
|
309
|
+
cause: failure.cause,
|
|
310
|
+
code: failure.code,
|
|
311
|
+
method: failure.method ?? context.method,
|
|
312
|
+
response: failure.response,
|
|
313
|
+
status: failure.status,
|
|
314
|
+
statusText: failure.statusText,
|
|
315
|
+
type: failure.type,
|
|
316
|
+
url: failure.url ?? context.url
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
async function parseJsonResponse(response, context = {}, options = {}) {
|
|
320
|
+
let text;
|
|
321
|
+
try {
|
|
322
|
+
text = await readResponseText(response, options);
|
|
323
|
+
} catch (error) {
|
|
324
|
+
throw contextualizeReadError(error, context, options);
|
|
325
|
+
}
|
|
326
|
+
if (text.trim() === "") return null;
|
|
327
|
+
try {
|
|
328
|
+
return JSON.parse(text);
|
|
329
|
+
} catch (error) {
|
|
330
|
+
throw new FetchError("Failed to parse response body as JSON", {
|
|
331
|
+
type: "parse",
|
|
332
|
+
url: context.url,
|
|
333
|
+
method: context.method,
|
|
334
|
+
status: response.status,
|
|
335
|
+
statusText: response.statusText,
|
|
336
|
+
body: text,
|
|
337
|
+
cause: error
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
async function tryParseJson(response, options = {}, context = {}) {
|
|
342
|
+
let text;
|
|
343
|
+
try {
|
|
344
|
+
text = await readResponseText(response, options);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
if (options.maxResponseBytes !== void 0 || options.signal != null) throw contextualizeReadError(error, context, options);
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
try {
|
|
350
|
+
return text.trim() === "" ? null : JSON.parse(text);
|
|
351
|
+
} catch {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
function noop() {}
|
|
356
|
+
function requestSignal(signal, timeout) {
|
|
357
|
+
if (timeout === void 0 || timeout === 0) return {
|
|
358
|
+
signal,
|
|
359
|
+
close: noop
|
|
360
|
+
};
|
|
361
|
+
const timeoutSignal = AbortSignal.timeout(timeout);
|
|
362
|
+
if (signal == null) return {
|
|
363
|
+
signal: timeoutSignal,
|
|
364
|
+
close: noop
|
|
365
|
+
};
|
|
366
|
+
const controller = new AbortController();
|
|
367
|
+
const close = () => {
|
|
368
|
+
signal.removeEventListener("abort", onCallerAbort);
|
|
369
|
+
timeoutSignal.removeEventListener("abort", onTimeout);
|
|
370
|
+
};
|
|
371
|
+
const abort = (source) => {
|
|
372
|
+
if (!controller.signal.aborted) controller.abort(source.reason);
|
|
373
|
+
close();
|
|
374
|
+
};
|
|
375
|
+
const onCallerAbort = () => abort(signal);
|
|
376
|
+
const onTimeout = () => abort(timeoutSignal);
|
|
377
|
+
signal.addEventListener("abort", onCallerAbort, { once: true });
|
|
378
|
+
timeoutSignal.addEventListener("abort", onTimeout, { once: true });
|
|
379
|
+
if (signal.aborted) onCallerAbort();
|
|
380
|
+
else if (timeoutSignal.aborted) onTimeout();
|
|
381
|
+
return {
|
|
382
|
+
signal: controller.signal,
|
|
383
|
+
close
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
var FetchClientError = class extends FetchError {
|
|
387
|
+
/** Effective request configuration, including the resolved request URL. */
|
|
388
|
+
config;
|
|
389
|
+
/** Creates an HTTP-status error with its response and request configuration. */
|
|
390
|
+
constructor(message, response, config) {
|
|
391
|
+
super(message, {
|
|
392
|
+
type: "http-status",
|
|
393
|
+
url: config.url,
|
|
394
|
+
method: config.method,
|
|
395
|
+
status: response.status,
|
|
396
|
+
statusText: response.statusText,
|
|
397
|
+
response
|
|
398
|
+
});
|
|
399
|
+
this.name = "FetchClientError";
|
|
400
|
+
this.config = config;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
function buildHeaders(custom, includeContentType = false) {
|
|
404
|
+
const headers = new Headers();
|
|
405
|
+
headers.set("Accept", "application/json, text/plain, *.*");
|
|
406
|
+
if (includeContentType) headers.set("Content-Type", "application/json");
|
|
407
|
+
if (custom) {
|
|
408
|
+
const merged = new Headers(custom);
|
|
409
|
+
for (const [key, value] of merged.entries()) headers.set(key, value);
|
|
410
|
+
}
|
|
411
|
+
return headers;
|
|
412
|
+
}
|
|
413
|
+
function buildURL(config) {
|
|
414
|
+
const base = config.baseURL ?? "";
|
|
415
|
+
const path = config.url ?? "";
|
|
416
|
+
const url = base === "" ? new URL(path) : new URL(path, base);
|
|
417
|
+
if (config.params) for (const [key, value] of Object.entries(config.params)) url.searchParams.set(key, value);
|
|
418
|
+
return url.href;
|
|
419
|
+
}
|
|
420
|
+
var FetchClient = class _FetchClient {
|
|
421
|
+
/** Instance defaults shallow-merged beneath every request configuration. */
|
|
422
|
+
defaults;
|
|
423
|
+
/** Creates a client with reusable request defaults. */
|
|
424
|
+
constructor(defaults = {}) {
|
|
425
|
+
this.defaults = defaults;
|
|
426
|
+
}
|
|
427
|
+
/** Creates a client with the supplied request defaults. */
|
|
428
|
+
static create(config) {
|
|
429
|
+
return new _FetchClient(config);
|
|
430
|
+
}
|
|
431
|
+
/** Sends a `DELETE` request and parses its response as JSON. */
|
|
432
|
+
delete(url, config) {
|
|
433
|
+
return this.request({
|
|
434
|
+
...config,
|
|
435
|
+
url,
|
|
436
|
+
method: "DELETE"
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
/** Sends a `GET` request and parses its response as JSON. */
|
|
440
|
+
get(url, config) {
|
|
441
|
+
return this.request({
|
|
442
|
+
...config,
|
|
443
|
+
url,
|
|
444
|
+
method: "GET"
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
/** Serializes `data`, sends a `PATCH` request, and parses the JSON response. */
|
|
448
|
+
patch(url, data, config) {
|
|
449
|
+
return this.request({
|
|
450
|
+
...config,
|
|
451
|
+
url,
|
|
452
|
+
data,
|
|
453
|
+
method: "PATCH"
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
/** Serializes `data`, sends a `POST` request, and parses the JSON response. */
|
|
457
|
+
post(url, data, config) {
|
|
458
|
+
return this.request({
|
|
459
|
+
...config,
|
|
460
|
+
url,
|
|
461
|
+
data,
|
|
462
|
+
method: "POST"
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
/** Serializes `data`, sends a `PUT` request, and parses the JSON response. */
|
|
466
|
+
put(url, data, config) {
|
|
467
|
+
return this.request({
|
|
468
|
+
...config,
|
|
469
|
+
url,
|
|
470
|
+
data,
|
|
471
|
+
method: "PUT"
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Resolves and executes a request using native fetch semantics.
|
|
476
|
+
* @returns Response metadata and parsed JSON, or `null` for an empty body.
|
|
477
|
+
* @throws {@link FetchClientError} when `validateStatus` rejects the status.
|
|
478
|
+
* @throws {@link FetchError} for transport or JSON parsing failures.
|
|
479
|
+
*/
|
|
480
|
+
async request(config) {
|
|
481
|
+
const merged = {
|
|
482
|
+
...this.defaults,
|
|
483
|
+
...config
|
|
484
|
+
};
|
|
485
|
+
const url = buildURL(merged);
|
|
486
|
+
const { baseURL: _baseURL, data: requestData, headers, maxResponseBytes, method = "GET", params: _params, signal, timeout, url: _url, validateStatus: validateStatusOption, ...requestInit } = merged;
|
|
487
|
+
validateMaxResponseBytes(maxResponseBytes);
|
|
488
|
+
const scope = requestSignal(signal, timeout);
|
|
489
|
+
try {
|
|
490
|
+
const init = {
|
|
491
|
+
...requestInit,
|
|
492
|
+
method,
|
|
493
|
+
headers: buildHeaders(headers, requestData !== void 0),
|
|
494
|
+
signal: scope.signal
|
|
495
|
+
};
|
|
496
|
+
if (requestData !== void 0) init.body = JSON.stringify(requestData);
|
|
497
|
+
const response = await fetchCompress(url, init);
|
|
498
|
+
const readOptions = {
|
|
499
|
+
maxResponseBytes,
|
|
500
|
+
signal: scope.signal
|
|
501
|
+
};
|
|
502
|
+
const result = {
|
|
503
|
+
data: response.ok ? await parseJsonResponse(response, {
|
|
504
|
+
url,
|
|
505
|
+
method
|
|
506
|
+
}, readOptions) : await tryParseJson(response, readOptions, {
|
|
507
|
+
url,
|
|
508
|
+
method
|
|
509
|
+
}),
|
|
510
|
+
headers: response.headers,
|
|
511
|
+
response,
|
|
512
|
+
status: response.status,
|
|
513
|
+
statusText: response.statusText
|
|
514
|
+
};
|
|
515
|
+
const validateStatus = validateStatusOption === void 0 ? (s) => s >= 200 && s < 300 : validateStatusOption;
|
|
516
|
+
if (validateStatus && !validateStatus(response.status)) throw new FetchClientError(`Request failed with status ${response.status} ${response.statusText}`, result, {
|
|
517
|
+
...merged,
|
|
518
|
+
method,
|
|
519
|
+
url
|
|
520
|
+
});
|
|
521
|
+
return result;
|
|
522
|
+
} finally {
|
|
523
|
+
scope.close();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
new class _FetchJsonClient extends FetchClient {
|
|
528
|
+
/** Creates a JSON client with reusable request and compression defaults. */
|
|
529
|
+
constructor(config) {
|
|
530
|
+
super(config);
|
|
531
|
+
}
|
|
532
|
+
/** Creates a JSON client with the supplied defaults. */
|
|
533
|
+
static create(config) {
|
|
534
|
+
return new _FetchJsonClient(config);
|
|
535
|
+
}
|
|
536
|
+
}();
|
|
537
|
+
//#endregion
|
|
71
538
|
//#region ../datalake-client/dist/node/index.mjs
|
|
72
539
|
function getAriesHome() {
|
|
73
540
|
return process.env.ARIES_HOME ?? path.join(homedir(), ".aries");
|
|
@@ -378,6 +845,22 @@ function extractRequestBase(urlWithPossiblePath) {
|
|
|
378
845
|
return urlWithPossiblePath.replace(/\/$/, "");
|
|
379
846
|
}
|
|
380
847
|
}
|
|
848
|
+
function parsePayloadResponse(response, text, method) {
|
|
849
|
+
const payload = text.length > 0 ? JSON.parse(text) : void 0;
|
|
850
|
+
if (!response.ok) {
|
|
851
|
+
const errorBody = isApiErrorBody2(payload) ? payload : {
|
|
852
|
+
code: "internal",
|
|
853
|
+
message: "Unexpected " + response.status + " response from " + method + " data plane"
|
|
854
|
+
};
|
|
855
|
+
throw new DatalakeApiError(response.status, errorBody);
|
|
856
|
+
}
|
|
857
|
+
return payload;
|
|
858
|
+
}
|
|
859
|
+
function isApiErrorBody2(value) {
|
|
860
|
+
if (typeof value !== "object" || value === null) return false;
|
|
861
|
+
const maybe = value;
|
|
862
|
+
return typeof maybe.code === "string" && typeof maybe.message === "string";
|
|
863
|
+
}
|
|
381
864
|
var RestPayloadsClient = class {
|
|
382
865
|
authToken;
|
|
383
866
|
datalakeId;
|
|
@@ -458,17 +941,8 @@ var RestPayloadsClient = class {
|
|
|
458
941
|
data: void 0,
|
|
459
942
|
headers: response.headers
|
|
460
943
|
};
|
|
461
|
-
const text = await response.text();
|
|
462
|
-
const payload = text.length > 0 ? JSON.parse(text) : void 0;
|
|
463
|
-
if (!response.ok) {
|
|
464
|
-
const errorBody = isApiErrorBody2(payload) ? payload : {
|
|
465
|
-
code: "internal",
|
|
466
|
-
message: `Unexpected ${response.status} response from ${method} data plane`
|
|
467
|
-
};
|
|
468
|
-
throw new DatalakeApiError(response.status, errorBody);
|
|
469
|
-
}
|
|
470
944
|
return {
|
|
471
|
-
data:
|
|
945
|
+
data: parsePayloadResponse(response, await response.text(), method),
|
|
472
946
|
headers: response.headers
|
|
473
947
|
};
|
|
474
948
|
}
|
|
@@ -483,10 +957,5 @@ function readInsertSummary(headers) {
|
|
|
483
957
|
rejected
|
|
484
958
|
};
|
|
485
959
|
}
|
|
486
|
-
function isApiErrorBody2(value) {
|
|
487
|
-
if (typeof value !== "object" || value === null) return false;
|
|
488
|
-
const maybe = value;
|
|
489
|
-
return typeof maybe.code === "string" && typeof maybe.message === "string";
|
|
490
|
-
}
|
|
491
960
|
//#endregion
|
|
492
961
|
export { LocalDatalakeClient, RestDatalakeClient, RestPayloadsClient, clearCredentials, clearDefaultDatalake, createDatalakeClient, getCredentialsLocation, getDefaultDatalake, loadCredentials, saveCredentials, setDefaultDatalake };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ariestools/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Aries Tools CLI - A suite of tools by Arie Trouw",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ariestools",
|
|
@@ -35,38 +35,38 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@opentelemetry/api": "~1.9.1",
|
|
38
|
-
"@xyo-network/archivist-lmdb": "~7.
|
|
39
|
-
"@xyo-network/sdk-protocol": "~7.2
|
|
40
|
-
"@xyo-network/xl1-cli": "~5.0
|
|
38
|
+
"@xyo-network/archivist-lmdb": "~7.4.0",
|
|
39
|
+
"@xyo-network/sdk-protocol": "~7.4.2",
|
|
40
|
+
"@xyo-network/xl1-cli": "~5.3.0",
|
|
41
41
|
"async-mutex": "~0.5.0",
|
|
42
42
|
"ethers": "~6.17.0",
|
|
43
43
|
"pdq-wasm": "~0.3.9",
|
|
44
44
|
"s3rver": "~3.7.1",
|
|
45
|
-
"zod": "~4.
|
|
46
|
-
"@ariestools/aries-dapp-core": "~0.1.
|
|
47
|
-
"@ariestools/aries-dapp-serve": "~0.1.
|
|
48
|
-
"@xyo-network/wallet-xl1-cli": "~0.1.
|
|
45
|
+
"zod": "~4.5.1",
|
|
46
|
+
"@ariestools/aries-dapp-core": "~0.1.20",
|
|
47
|
+
"@ariestools/aries-dapp-serve": "~0.1.20",
|
|
48
|
+
"@xyo-network/wallet-xl1-cli": "~0.1.20"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@ariestools/actor": "~1.3.0",
|
|
52
52
|
"@ariestools/actor-model": "~1.3.0",
|
|
53
53
|
"@ariestools/cli-kit-daemon": "~1.2.3",
|
|
54
|
-
"@ariestools/sdk": "~8.
|
|
55
|
-
"@ariestools/toolchain": "~9.
|
|
56
|
-
"@ariestools/tsconfig": "~9.
|
|
57
|
-
"@types/node": "~26.
|
|
58
|
-
"@xyo-network/sdk": "~7.
|
|
59
|
-
"@xyo-network/xl1-sdk": "~5.
|
|
60
|
-
"eslint": "~10.
|
|
61
|
-
"rolldown": "~1.2.
|
|
54
|
+
"@ariestools/sdk": "~8.2.0",
|
|
55
|
+
"@ariestools/toolchain": "~9.1.2",
|
|
56
|
+
"@ariestools/tsconfig": "~9.1.2",
|
|
57
|
+
"@types/node": "~26.4.0",
|
|
58
|
+
"@xyo-network/sdk": "~7.4.0",
|
|
59
|
+
"@xyo-network/xl1-sdk": "~5.4.1",
|
|
60
|
+
"eslint": "~10.9.1",
|
|
61
|
+
"rolldown": "~1.2.6",
|
|
62
62
|
"tsx": "~4.23.12",
|
|
63
63
|
"typescript": "~6.0.3",
|
|
64
|
-
"vite": "~8.2.
|
|
65
|
-
"vitest": "~4.1.
|
|
64
|
+
"vite": "~8.2.2",
|
|
65
|
+
"vitest": "~4.1.11",
|
|
66
66
|
"yargs": "~18.1.0",
|
|
67
|
-
"@ariestools/aries-cli-core": "~0.1.
|
|
68
|
-
"@ariestools/aries-datalake-client": "~0.1.
|
|
69
|
-
"@ariestools/cli-lib": "~0.1.
|
|
67
|
+
"@ariestools/aries-cli-core": "~0.1.20",
|
|
68
|
+
"@ariestools/aries-datalake-client": "~0.1.20",
|
|
69
|
+
"@ariestools/cli-lib": "~0.1.20"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=24"
|