@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
|
@@ -1598,22 +1598,45 @@ var ModelsAPI = class {
|
|
|
1598
1598
|
* `cancelled` with the error. Errors of the start itself (an invalid job, a refused model or
|
|
1599
1599
|
* consent, no fitting model) reject. The end can arrive before the start answers; it is kept
|
|
1600
1600
|
* until then.
|
|
1601
|
-
|
|
1602
|
-
|
|
1601
|
+
*
|
|
1602
|
+
* Aborting `signal` asks to cancel the job, which then ends as `cancelled`; a job that had
|
|
1603
|
+
* already ended keeps its actual end. A signal that is already aborted rejects with its reason
|
|
1604
|
+
* and starts no job. If the cancel request fails, the run rejects with that error and the job
|
|
1605
|
+
* keeps running on the host; if it reports an unknown job, the run rejects with an error.
|
|
1606
|
+
*/
|
|
1607
|
+
async runAsync(job, options = {}) {
|
|
1608
|
+
const { signal } = options;
|
|
1609
|
+
if (signal?.aborted) throw signal.reason;
|
|
1603
1610
|
const ended = /* @__PURE__ */ new Map();
|
|
1604
1611
|
let waiting = null;
|
|
1605
1612
|
const unsubscribe = this.onCompleted((completion) => {
|
|
1606
1613
|
if (waiting && completion.jobId === waiting.jobId) waiting.resolve(completion);
|
|
1607
1614
|
else ended.set(completion.jobId, completion);
|
|
1608
1615
|
});
|
|
1616
|
+
let detach = () => {
|
|
1617
|
+
};
|
|
1609
1618
|
try {
|
|
1610
1619
|
const { jobId } = await this.startAsync(job);
|
|
1611
|
-
return await new Promise((resolve) => {
|
|
1620
|
+
return await new Promise((resolve, reject) => {
|
|
1612
1621
|
const early = ended.get(jobId);
|
|
1613
|
-
if (early) resolve(early);
|
|
1614
|
-
|
|
1622
|
+
if (early) return resolve(early);
|
|
1623
|
+
waiting = { jobId, resolve };
|
|
1624
|
+
if (!signal) return;
|
|
1625
|
+
const cancel = async () => {
|
|
1626
|
+
try {
|
|
1627
|
+
if (!await this.cancelAsync(jobId)) {
|
|
1628
|
+
reject(new Error("The model job could not be cancelled"));
|
|
1629
|
+
}
|
|
1630
|
+
} catch (error) {
|
|
1631
|
+
reject(error);
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
if (signal.aborted) return cancel();
|
|
1635
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
1636
|
+
detach = () => signal.removeEventListener("abort", cancel);
|
|
1615
1637
|
});
|
|
1616
1638
|
} finally {
|
|
1639
|
+
detach();
|
|
1617
1640
|
unsubscribe();
|
|
1618
1641
|
}
|
|
1619
1642
|
}
|
|
@@ -2723,6 +2746,11 @@ var PermissionWaiterRegistry = class {
|
|
|
2723
2746
|
for (const callback of [...set]) callback(decision);
|
|
2724
2747
|
}
|
|
2725
2748
|
};
|
|
2749
|
+
function promptedKey(error) {
|
|
2750
|
+
const details = error.details ?? {};
|
|
2751
|
+
const field = (name) => typeof details[name] === "string" ? details[name] : error[name];
|
|
2752
|
+
return permissionKey(field("resourceType"), field("action"), field("target"));
|
|
2753
|
+
}
|
|
2726
2754
|
function toDeniedError(error) {
|
|
2727
2755
|
return { ...error, code: 1002 /* DENIED */ };
|
|
2728
2756
|
}
|
|
@@ -2735,7 +2763,7 @@ async function withPermissionRetry(send, registry, log, timeoutMs = PERMISSION_D
|
|
|
2735
2763
|
if (!isPermissionPromptError(error) || attempt >= MAX_PERMISSION_PROMPTS) {
|
|
2736
2764
|
throw error;
|
|
2737
2765
|
}
|
|
2738
|
-
const key =
|
|
2766
|
+
const key = promptedKey(error);
|
|
2739
2767
|
const times = asked.get(key) ?? 0;
|
|
2740
2768
|
if (times >= MAX_PERMISSION_RETRIES) throw error;
|
|
2741
2769
|
asked.set(key, times + 1);
|