@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
|
@@ -534,7 +534,8 @@ var FilesystemAPI = class {
|
|
|
534
534
|
this.client = client;
|
|
535
535
|
}
|
|
536
536
|
/**
|
|
537
|
-
* Opens a save file dialog and saves the provided data to the selected location
|
|
537
|
+
* Opens a save file dialog and saves the provided data to the selected location.
|
|
538
|
+
* Waits for the user without the request timeout.
|
|
538
539
|
* @param data The file data as Uint8Array
|
|
539
540
|
* @param options Options for the save dialog
|
|
540
541
|
* @returns The path where the file was saved, or null if cancelled
|
|
@@ -548,7 +549,8 @@ var FilesystemAPI = class {
|
|
|
548
549
|
defaultPath: options.defaultPath,
|
|
549
550
|
title: options.title,
|
|
550
551
|
filters: options.filters
|
|
551
|
-
}
|
|
552
|
+
},
|
|
553
|
+
{ timeout: null }
|
|
552
554
|
);
|
|
553
555
|
return result;
|
|
554
556
|
}
|
|
@@ -668,25 +670,27 @@ var FilesystemAPI = class {
|
|
|
668
670
|
);
|
|
669
671
|
}
|
|
670
672
|
/**
|
|
671
|
-
* Open a folder selection dialog
|
|
673
|
+
* Open a folder selection dialog; waits for the user without the request timeout
|
|
672
674
|
* @param options Dialog options
|
|
673
675
|
* @returns Selected folder path, or null if cancelled
|
|
674
676
|
*/
|
|
675
677
|
async selectFolder(options = {}) {
|
|
676
678
|
return this.client.request(
|
|
677
679
|
FILESYSTEM_COMMANDS.selectFolder,
|
|
678
|
-
options
|
|
680
|
+
options,
|
|
681
|
+
{ timeout: null }
|
|
679
682
|
);
|
|
680
683
|
}
|
|
681
684
|
/**
|
|
682
|
-
* Open a file selection dialog
|
|
685
|
+
* Open a file selection dialog; waits for the user without the request timeout
|
|
683
686
|
* @param options Dialog options
|
|
684
687
|
* @returns Selected file paths, or null if cancelled
|
|
685
688
|
*/
|
|
686
689
|
async selectFile(options = {}) {
|
|
687
690
|
return this.client.request(
|
|
688
691
|
FILESYSTEM_COMMANDS.selectFile,
|
|
689
|
-
options
|
|
692
|
+
options,
|
|
693
|
+
{ timeout: null }
|
|
690
694
|
);
|
|
691
695
|
}
|
|
692
696
|
/**
|
|
@@ -1596,22 +1600,45 @@ var ModelsAPI = class {
|
|
|
1596
1600
|
* `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
|
|
1597
1601
|
* consent, no fitting model) reject. The end can arrive before the start answers; it is kept
|
|
1598
1602
|
* until then.
|
|
1599
|
-
|
|
1600
|
-
|
|
1603
|
+
*
|
|
1604
|
+
* Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
|
|
1605
|
+
* already ended keeps its actual end. A signal that is already aborted rejects with its reason
|
|
1606
|
+
* and starts no job. If the cancel request fails, the run rejects with that error and the job
|
|
1607
|
+
* keeps running on the host; if it reports an unknown job, the run rejects with an error.
|
|
1608
|
+
*/
|
|
1609
|
+
async runAsync(job, options = {}) {
|
|
1610
|
+
const { signal } = options;
|
|
1611
|
+
if (signal?.aborted) throw signal.reason;
|
|
1601
1612
|
const ended = /* @__PURE__ */ new Map();
|
|
1602
1613
|
let waiting = null;
|
|
1603
1614
|
const unsubscribe = this.onCompleted((completion) => {
|
|
1604
1615
|
if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
|
|
1605
1616
|
else ended.set(completion.jobId, completion);
|
|
1606
1617
|
});
|
|
1618
|
+
let detach = () => {
|
|
1619
|
+
};
|
|
1607
1620
|
try {
|
|
1608
1621
|
const { jobId } = await this.startAsync(job);
|
|
1609
|
-
return await new Promise((resolve) => {
|
|
1622
|
+
return await new Promise((resolve, reject) => {
|
|
1610
1623
|
const early = ended.get(jobId);
|
|
1611
|
-
if (early) resolve(early);
|
|
1612
|
-
|
|
1624
|
+
if (early) return resolve(early);
|
|
1625
|
+
waiting = { jobId, resolve };
|
|
1626
|
+
if (!signal) return;
|
|
1627
|
+
const cancel = async () => {
|
|
1628
|
+
try {
|
|
1629
|
+
if (!await this.cancelAsync(jobId)) {
|
|
1630
|
+
reject(new Error("The model job could not be cancelled"));
|
|
1631
|
+
}
|
|
1632
|
+
} catch (error) {
|
|
1633
|
+
reject(error);
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
if (signal.aborted) return cancel();
|
|
1637
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
1638
|
+
detach = () => signal.removeEventListener("abort", cancel);
|
|
1613
1639
|
});
|
|
1614
1640
|
} finally {
|
|
1641
|
+
detach();
|
|
1615
1642
|
unsubscribe();
|
|
1616
1643
|
}
|
|
1617
1644
|
}
|