@haex-space/vault-sdk 4.7.1 → 4.8.1
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 +7 -3
- package/dist/{client--CgEtJ4G.d.ts → client-CNbwFQjB.d.ts} +13 -5
- package/dist/{client-BlUizM-l.d.mts → client-DOAj36ga.d.mts} +13 -5
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -10
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +38 -11
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +38 -11
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.js +38 -11
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +38 -11
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +38 -11
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +38 -11
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +38 -11
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +38 -11
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1408,7 +1408,8 @@ var FilesystemAPI = class {
|
|
|
1408
1408
|
this.client = client;
|
|
1409
1409
|
}
|
|
1410
1410
|
/**
|
|
1411
|
-
* Opens a save file dialog and saves the provided data to the selected location
|
|
1411
|
+
* Opens a save file dialog and saves the provided data to the selected location.
|
|
1412
|
+
* Waits for the user without the request timeout.
|
|
1412
1413
|
* @param data The file data as Uint8Array
|
|
1413
1414
|
* @param options Options for the save dialog
|
|
1414
1415
|
* @returns The path where the file was saved, or null if cancelled
|
|
@@ -1422,7 +1423,8 @@ var FilesystemAPI = class {
|
|
|
1422
1423
|
defaultPath: options.defaultPath,
|
|
1423
1424
|
title: options.title,
|
|
1424
1425
|
filters: options.filters
|
|
1425
|
-
}
|
|
1426
|
+
},
|
|
1427
|
+
{ timeout: null }
|
|
1426
1428
|
);
|
|
1427
1429
|
return result;
|
|
1428
1430
|
}
|
|
@@ -1542,25 +1544,27 @@ var FilesystemAPI = class {
|
|
|
1542
1544
|
);
|
|
1543
1545
|
}
|
|
1544
1546
|
/**
|
|
1545
|
-
* Open a folder selection dialog
|
|
1547
|
+
* Open a folder selection dialog; waits for the user without the request timeout
|
|
1546
1548
|
* @param options Dialog options
|
|
1547
1549
|
* @returns Selected folder path, or null if cancelled
|
|
1548
1550
|
*/
|
|
1549
1551
|
async selectFolder(options = {}) {
|
|
1550
1552
|
return this.client.request(
|
|
1551
1553
|
FILESYSTEM_COMMANDS.selectFolder,
|
|
1552
|
-
options
|
|
1554
|
+
options,
|
|
1555
|
+
{ timeout: null }
|
|
1553
1556
|
);
|
|
1554
1557
|
}
|
|
1555
1558
|
/**
|
|
1556
|
-
* Open a file selection dialog
|
|
1559
|
+
* Open a file selection dialog; waits for the user without the request timeout
|
|
1557
1560
|
* @param options Dialog options
|
|
1558
1561
|
* @returns Selected file paths, or null if cancelled
|
|
1559
1562
|
*/
|
|
1560
1563
|
async selectFile(options = {}) {
|
|
1561
1564
|
return this.client.request(
|
|
1562
1565
|
FILESYSTEM_COMMANDS.selectFile,
|
|
1563
|
-
options
|
|
1566
|
+
options,
|
|
1567
|
+
{ timeout: null }
|
|
1564
1568
|
);
|
|
1565
1569
|
}
|
|
1566
1570
|
/**
|
|
@@ -2483,22 +2487,45 @@ var ModelsAPI = class {
|
|
|
2483
2487
|
* `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
|
|
2484
2488
|
* consent, no fitting model) reject. The end can arrive before the start answers; it is kept
|
|
2485
2489
|
* until then.
|
|
2490
|
+
*
|
|
2491
|
+
* Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
|
|
2492
|
+
* already ended keeps its actual end. A signal that is already aborted rejects with its reason
|
|
2493
|
+
* and starts no job. If the cancel request fails, the run rejects with that error and the job
|
|
2494
|
+
* keeps running on the host; if it reports an unknown job, the run rejects with an error.
|
|
2486
2495
|
*/
|
|
2487
|
-
async runAsync(job) {
|
|
2496
|
+
async runAsync(job, options = {}) {
|
|
2497
|
+
const { signal } = options;
|
|
2498
|
+
if (signal?.aborted) throw signal.reason;
|
|
2488
2499
|
const ended = /* @__PURE__ */ new Map();
|
|
2489
2500
|
let waiting = null;
|
|
2490
2501
|
const unsubscribe = this.onCompleted((completion) => {
|
|
2491
2502
|
if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
|
|
2492
2503
|
else ended.set(completion.jobId, completion);
|
|
2493
2504
|
});
|
|
2505
|
+
let detach = () => {
|
|
2506
|
+
};
|
|
2494
2507
|
try {
|
|
2495
2508
|
const { jobId } = await this.startAsync(job);
|
|
2496
|
-
return await new Promise((resolve) => {
|
|
2509
|
+
return await new Promise((resolve, reject) => {
|
|
2497
2510
|
const early = ended.get(jobId);
|
|
2498
|
-
if (early) resolve(early);
|
|
2499
|
-
|
|
2511
|
+
if (early) return resolve(early);
|
|
2512
|
+
waiting = { jobId, resolve };
|
|
2513
|
+
if (!signal) return;
|
|
2514
|
+
const cancel = async () => {
|
|
2515
|
+
try {
|
|
2516
|
+
if (!await this.cancelAsync(jobId)) {
|
|
2517
|
+
reject(new Error("The model job could not be cancelled"));
|
|
2518
|
+
}
|
|
2519
|
+
} catch (error) {
|
|
2520
|
+
reject(error);
|
|
2521
|
+
}
|
|
2522
|
+
};
|
|
2523
|
+
if (signal.aborted) return cancel();
|
|
2524
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
2525
|
+
detach = () => signal.removeEventListener("abort", cancel);
|
|
2500
2526
|
});
|
|
2501
2527
|
} finally {
|
|
2528
|
+
detach();
|
|
2502
2529
|
unsubscribe();
|
|
2503
2530
|
}
|
|
2504
2531
|
}
|