@haex-space/vault-sdk 4.7.1 → 4.8.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 +7 -3
- package/dist/{client-BlUizM-l.d.mts → client-D9zisRb8.d.mts} +9 -2
- package/dist/{client--CgEtJ4G.d.ts → client-DiqylZ59.d.ts} +9 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +27 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -4
- 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 +28 -5
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +28 -5
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.js +28 -5
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +28 -5
- 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 +28 -5
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +28 -5
- 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 +28 -5
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +28 -5
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1596,22 +1596,45 @@ var ModelsAPI = class {
|
|
|
1596
1596
|
* `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
|
|
1597
1597
|
* consent, no fitting model) reject. The end can arrive before the start answers; it is kept
|
|
1598
1598
|
* until then.
|
|
1599
|
-
|
|
1600
|
-
|
|
1599
|
+
*
|
|
1600
|
+
* Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
|
|
1601
|
+
* already ended keeps its actual end. A signal that is already aborted rejects with its reason
|
|
1602
|
+
* and starts no job. If the cancel request fails, the run rejects with that error and the job
|
|
1603
|
+
* keeps running on the host; if it reports an unknown job, the run rejects with an error.
|
|
1604
|
+
*/
|
|
1605
|
+
async runAsync(job, options = {}) {
|
|
1606
|
+
const { signal } = options;
|
|
1607
|
+
if (signal?.aborted) throw signal.reason;
|
|
1601
1608
|
const ended = /* @__PURE__ */ new Map();
|
|
1602
1609
|
let waiting = null;
|
|
1603
1610
|
const unsubscribe = this.onCompleted((completion) => {
|
|
1604
1611
|
if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
|
|
1605
1612
|
else ended.set(completion.jobId, completion);
|
|
1606
1613
|
});
|
|
1614
|
+
let detach = () => {
|
|
1615
|
+
};
|
|
1607
1616
|
try {
|
|
1608
1617
|
const { jobId } = await this.startAsync(job);
|
|
1609
|
-
return await new Promise((resolve) => {
|
|
1618
|
+
return await new Promise((resolve, reject) => {
|
|
1610
1619
|
const early = ended.get(jobId);
|
|
1611
|
-
if (early) resolve(early);
|
|
1612
|
-
|
|
1620
|
+
if (early) return resolve(early);
|
|
1621
|
+
waiting = { jobId, resolve };
|
|
1622
|
+
if (!signal) return;
|
|
1623
|
+
const cancel = async () => {
|
|
1624
|
+
try {
|
|
1625
|
+
if (!await this.cancelAsync(jobId)) {
|
|
1626
|
+
reject(new Error("The model job could not be cancelled"));
|
|
1627
|
+
}
|
|
1628
|
+
} catch (error) {
|
|
1629
|
+
reject(error);
|
|
1630
|
+
}
|
|
1631
|
+
};
|
|
1632
|
+
if (signal.aborted) return cancel();
|
|
1633
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
1634
|
+
detach = () => signal.removeEventListener("abort", cancel);
|
|
1613
1635
|
});
|
|
1614
1636
|
} finally {
|
|
1637
|
+
detach();
|
|
1615
1638
|
unsubscribe();
|
|
1616
1639
|
}
|
|
1617
1640
|
}
|