@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
package/dist/vue.d.mts
CHANGED
package/dist/vue.d.ts
CHANGED
package/dist/vue.js
CHANGED
|
@@ -2043,22 +2043,45 @@ var ModelsAPI = class {
|
|
|
2043
2043
|
* `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
|
|
2044
2044
|
* consent, no fitting model) reject. The end can arrive before the start answers; it is kept
|
|
2045
2045
|
* until then.
|
|
2046
|
-
|
|
2047
|
-
|
|
2046
|
+
*
|
|
2047
|
+
* Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
|
|
2048
|
+
* already ended keeps its actual end. A signal that is already aborted rejects with its reason
|
|
2049
|
+
* and starts no job. If the cancel request fails, the run rejects with that error and the job
|
|
2050
|
+
* keeps running on the host; if it reports an unknown job, the run rejects with an error.
|
|
2051
|
+
*/
|
|
2052
|
+
async runAsync(job, options = {}) {
|
|
2053
|
+
const { signal } = options;
|
|
2054
|
+
if (signal?.aborted) throw signal.reason;
|
|
2048
2055
|
const ended = /* @__PURE__ */ new Map();
|
|
2049
2056
|
let waiting = null;
|
|
2050
2057
|
const unsubscribe = this.onCompleted((completion) => {
|
|
2051
2058
|
if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
|
|
2052
2059
|
else ended.set(completion.jobId, completion);
|
|
2053
2060
|
});
|
|
2061
|
+
let detach = () => {
|
|
2062
|
+
};
|
|
2054
2063
|
try {
|
|
2055
2064
|
const { jobId } = await this.startAsync(job);
|
|
2056
|
-
return await new Promise((resolve) => {
|
|
2065
|
+
return await new Promise((resolve, reject) => {
|
|
2057
2066
|
const early = ended.get(jobId);
|
|
2058
|
-
if (early) resolve(early);
|
|
2059
|
-
|
|
2067
|
+
if (early) return resolve(early);
|
|
2068
|
+
waiting = { jobId, resolve };
|
|
2069
|
+
if (!signal) return;
|
|
2070
|
+
const cancel = async () => {
|
|
2071
|
+
try {
|
|
2072
|
+
if (!await this.cancelAsync(jobId)) {
|
|
2073
|
+
reject(new Error("The model job could not be cancelled"));
|
|
2074
|
+
}
|
|
2075
|
+
} catch (error) {
|
|
2076
|
+
reject(error);
|
|
2077
|
+
}
|
|
2078
|
+
};
|
|
2079
|
+
if (signal.aborted) return cancel();
|
|
2080
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
2081
|
+
detach = () => signal.removeEventListener("abort", cancel);
|
|
2060
2082
|
});
|
|
2061
2083
|
} finally {
|
|
2084
|
+
detach();
|
|
2062
2085
|
unsubscribe();
|
|
2063
2086
|
}
|
|
2064
2087
|
}
|