@haex-space/vault-sdk 4.7.0 → 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-DkVe1o-u.d.ts → client-D9zisRb8.d.mts} +10 -3
- package/dist/{client-DS-j-fHu.d.mts → client-DiqylZ59.d.ts} +10 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +33 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -5
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +34 -6
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +34 -6
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.js +34 -6
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +34 -6
- 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 +34 -6
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +34 -6
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-snPkjDCj.d.mts → types-3iifP-Q1.d.mts} +2 -0
- package/dist/{types-snPkjDCj.d.ts → types-3iifP-Q1.d.ts} +2 -0
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +34 -6
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +34 -6
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/svelte.mjs
CHANGED
|
@@ -2041,22 +2041,45 @@ var ModelsAPI = class {
|
|
|
2041
2041
|
* `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
|
|
2042
2042
|
* consent, no fitting model) reject. The end can arrive before the start answers; it is kept
|
|
2043
2043
|
* until then.
|
|
2044
|
-
|
|
2045
|
-
|
|
2044
|
+
*
|
|
2045
|
+
* Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
|
|
2046
|
+
* already ended keeps its actual end. A signal that is already aborted rejects with its reason
|
|
2047
|
+
* and starts no job. If the cancel request fails, the run rejects with that error and the job
|
|
2048
|
+
* keeps running on the host; if it reports an unknown job, the run rejects with an error.
|
|
2049
|
+
*/
|
|
2050
|
+
async runAsync(job, options = {}) {
|
|
2051
|
+
const { signal } = options;
|
|
2052
|
+
if (signal?.aborted) throw signal.reason;
|
|
2046
2053
|
const ended = /* @__PURE__ */ new Map();
|
|
2047
2054
|
let waiting = null;
|
|
2048
2055
|
const unsubscribe = this.onCompleted((completion) => {
|
|
2049
2056
|
if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
|
|
2050
2057
|
else ended.set(completion.jobId, completion);
|
|
2051
2058
|
});
|
|
2059
|
+
let detach = () => {
|
|
2060
|
+
};
|
|
2052
2061
|
try {
|
|
2053
2062
|
const { jobId } = await this.startAsync(job);
|
|
2054
|
-
return await new Promise((resolve) => {
|
|
2063
|
+
return await new Promise((resolve, reject) => {
|
|
2055
2064
|
const early = ended.get(jobId);
|
|
2056
|
-
if (early) resolve(early);
|
|
2057
|
-
|
|
2065
|
+
if (early) return resolve(early);
|
|
2066
|
+
waiting = { jobId, resolve };
|
|
2067
|
+
if (!signal) return;
|
|
2068
|
+
const cancel = async () => {
|
|
2069
|
+
try {
|
|
2070
|
+
if (!await this.cancelAsync(jobId)) {
|
|
2071
|
+
reject(new Error("The model job could not be cancelled"));
|
|
2072
|
+
}
|
|
2073
|
+
} catch (error) {
|
|
2074
|
+
reject(error);
|
|
2075
|
+
}
|
|
2076
|
+
};
|
|
2077
|
+
if (signal.aborted) return cancel();
|
|
2078
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
2079
|
+
detach = () => signal.removeEventListener("abort", cancel);
|
|
2058
2080
|
});
|
|
2059
2081
|
} finally {
|
|
2082
|
+
detach();
|
|
2060
2083
|
unsubscribe();
|
|
2061
2084
|
}
|
|
2062
2085
|
}
|
|
@@ -3089,6 +3112,11 @@ var PermissionWaiterRegistry = class {
|
|
|
3089
3112
|
for (const callback of [...set]) callback(decision);
|
|
3090
3113
|
}
|
|
3091
3114
|
};
|
|
3115
|
+
function promptedKey(error) {
|
|
3116
|
+
const details = error.details ?? {};
|
|
3117
|
+
const field = (name) => typeof details[name] === "string" ? details[name] : error[name];
|
|
3118
|
+
return permissionKey(field("resourceType"), field("action"), field("target"));
|
|
3119
|
+
}
|
|
3092
3120
|
function toDeniedError(error) {
|
|
3093
3121
|
return { ...error, code: 1002 /* DENIED */ };
|
|
3094
3122
|
}
|
|
@@ -3101,7 +3129,7 @@ async function withPermissionRetry(send, registry, log, timeoutMs = PERMISSION_D
|
|
|
3101
3129
|
if (!isPermissionPromptError(error) || attempt >= MAX_PERMISSION_PROMPTS) {
|
|
3102
3130
|
throw error;
|
|
3103
3131
|
}
|
|
3104
|
-
const key =
|
|
3132
|
+
const key = promptedKey(error);
|
|
3105
3133
|
const times = asked.get(key) ?? 0;
|
|
3106
3134
|
if (times >= MAX_PERMISSION_RETRIES) throw error;
|
|
3107
3135
|
asked.set(key, times + 1);
|