@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/react.mjs
CHANGED
|
@@ -966,7 +966,8 @@ var FilesystemAPI = class {
|
|
|
966
966
|
this.client = client;
|
|
967
967
|
}
|
|
968
968
|
/**
|
|
969
|
-
* Opens a save file dialog and saves the provided data to the selected location
|
|
969
|
+
* Opens a save file dialog and saves the provided data to the selected location.
|
|
970
|
+
* Waits for the user without the request timeout.
|
|
970
971
|
* @param data The file data as Uint8Array
|
|
971
972
|
* @param options Options for the save dialog
|
|
972
973
|
* @returns The path where the file was saved, or null if cancelled
|
|
@@ -980,7 +981,8 @@ var FilesystemAPI = class {
|
|
|
980
981
|
defaultPath: options.defaultPath,
|
|
981
982
|
title: options.title,
|
|
982
983
|
filters: options.filters
|
|
983
|
-
}
|
|
984
|
+
},
|
|
985
|
+
{ timeout: null }
|
|
984
986
|
);
|
|
985
987
|
return result;
|
|
986
988
|
}
|
|
@@ -1100,25 +1102,27 @@ var FilesystemAPI = class {
|
|
|
1100
1102
|
);
|
|
1101
1103
|
}
|
|
1102
1104
|
/**
|
|
1103
|
-
* Open a folder selection dialog
|
|
1105
|
+
* Open a folder selection dialog; waits for the user without the request timeout
|
|
1104
1106
|
* @param options Dialog options
|
|
1105
1107
|
* @returns Selected folder path, or null if cancelled
|
|
1106
1108
|
*/
|
|
1107
1109
|
async selectFolder(options = {}) {
|
|
1108
1110
|
return this.client.request(
|
|
1109
1111
|
FILESYSTEM_COMMANDS.selectFolder,
|
|
1110
|
-
options
|
|
1112
|
+
options,
|
|
1113
|
+
{ timeout: null }
|
|
1111
1114
|
);
|
|
1112
1115
|
}
|
|
1113
1116
|
/**
|
|
1114
|
-
* Open a file selection dialog
|
|
1117
|
+
* Open a file selection dialog; waits for the user without the request timeout
|
|
1115
1118
|
* @param options Dialog options
|
|
1116
1119
|
* @returns Selected file paths, or null if cancelled
|
|
1117
1120
|
*/
|
|
1118
1121
|
async selectFile(options = {}) {
|
|
1119
1122
|
return this.client.request(
|
|
1120
1123
|
FILESYSTEM_COMMANDS.selectFile,
|
|
1121
|
-
options
|
|
1124
|
+
options,
|
|
1125
|
+
{ timeout: null }
|
|
1122
1126
|
);
|
|
1123
1127
|
}
|
|
1124
1128
|
/**
|
|
@@ -2041,22 +2045,45 @@ var ModelsAPI = class {
|
|
|
2041
2045
|
* `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
|
|
2042
2046
|
* consent, no fitting model) reject. The end can arrive before the start answers; it is kept
|
|
2043
2047
|
* until then.
|
|
2044
|
-
|
|
2045
|
-
|
|
2048
|
+
*
|
|
2049
|
+
* Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
|
|
2050
|
+
* already ended keeps its actual end. A signal that is already aborted rejects with its reason
|
|
2051
|
+
* and starts no job. If the cancel request fails, the run rejects with that error and the job
|
|
2052
|
+
* keeps running on the host; if it reports an unknown job, the run rejects with an error.
|
|
2053
|
+
*/
|
|
2054
|
+
async runAsync(job, options = {}) {
|
|
2055
|
+
const { signal } = options;
|
|
2056
|
+
if (signal?.aborted) throw signal.reason;
|
|
2046
2057
|
const ended = /* @__PURE__ */ new Map();
|
|
2047
2058
|
let waiting = null;
|
|
2048
2059
|
const unsubscribe = this.onCompleted((completion) => {
|
|
2049
2060
|
if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
|
|
2050
2061
|
else ended.set(completion.jobId, completion);
|
|
2051
2062
|
});
|
|
2063
|
+
let detach = () => {
|
|
2064
|
+
};
|
|
2052
2065
|
try {
|
|
2053
2066
|
const { jobId } = await this.startAsync(job);
|
|
2054
|
-
return await new Promise((resolve) => {
|
|
2067
|
+
return await new Promise((resolve, reject) => {
|
|
2055
2068
|
const early = ended.get(jobId);
|
|
2056
|
-
if (early) resolve(early);
|
|
2057
|
-
|
|
2069
|
+
if (early) return resolve(early);
|
|
2070
|
+
waiting = { jobId, resolve };
|
|
2071
|
+
if (!signal) return;
|
|
2072
|
+
const cancel = async () => {
|
|
2073
|
+
try {
|
|
2074
|
+
if (!await this.cancelAsync(jobId)) {
|
|
2075
|
+
reject(new Error("The model job could not be cancelled"));
|
|
2076
|
+
}
|
|
2077
|
+
} catch (error) {
|
|
2078
|
+
reject(error);
|
|
2079
|
+
}
|
|
2080
|
+
};
|
|
2081
|
+
if (signal.aborted) return cancel();
|
|
2082
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
2083
|
+
detach = () => signal.removeEventListener("abort", cancel);
|
|
2058
2084
|
});
|
|
2059
2085
|
} finally {
|
|
2086
|
+
detach();
|
|
2060
2087
|
unsubscribe();
|
|
2061
2088
|
}
|
|
2062
2089
|
}
|