@haex-space/vault-sdk 5.0.0 → 5.2.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 +29 -0
- package/dist/{client-DXHXxcgw.d.mts → client-CgngeKPm.d.ts} +42 -3
- package/dist/{client-EtzmMEnK.d.ts → client-HdPYJ_9t.d.mts} +42 -3
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -2
- 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 +51 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +51 -1
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.js +50 -1
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +50 -1
- 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 +51 -1
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +51 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-BZVkX0Wf.d.mts → types-CNxDNQgb.d.mts} +17 -2
- package/dist/{types-BZVkX0Wf.d.ts → types-CNxDNQgb.d.ts} +17 -2
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +51 -1
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +51 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -453,6 +453,10 @@ var NOTIFICATION_EVENTS = {
|
|
|
453
453
|
/** A click on one of this extension's notifications (body or action button). */
|
|
454
454
|
CLICK: "haextension:notification:click"
|
|
455
455
|
};
|
|
456
|
+
var OPENER_EVENTS = {
|
|
457
|
+
/** A request waits for this extension: take it with `client.openers.take()`. The event carries no content. */
|
|
458
|
+
REQUEST: "opener-request"
|
|
459
|
+
};
|
|
456
460
|
var MODEL_JOB_EVENTS = {
|
|
457
461
|
/** A job of this frame ended: completed, failed or cancelled. */
|
|
458
462
|
COMPLETED: "haextension:model-job:completed"
|
|
@@ -646,7 +650,9 @@ var EXTENSION_COMMANDS = {
|
|
|
646
650
|
/** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
|
|
647
651
|
tabAttention: "extension_tab_attention",
|
|
648
652
|
/** Ask the user to confirm, in a dialog the host draws over this extension's tab */
|
|
649
|
-
dialogConfirm: "extension_dialog_confirm"
|
|
653
|
+
dialogConfirm: "extension_dialog_confirm",
|
|
654
|
+
/** Take the request the user gave this extension (holzi spec 063): `null` or `{ action, mail }` */
|
|
655
|
+
openerTake: "extension_opener_take"
|
|
650
656
|
};
|
|
651
657
|
|
|
652
658
|
// src/commands/remoteStorage.ts
|
|
@@ -2543,6 +2549,49 @@ var DialogAPI = class {
|
|
|
2543
2549
|
}
|
|
2544
2550
|
};
|
|
2545
2551
|
|
|
2552
|
+
// src/api/openers.ts
|
|
2553
|
+
init_esm_shims();
|
|
2554
|
+
var OpenersAPI = class {
|
|
2555
|
+
constructor(client) {
|
|
2556
|
+
this.client = client;
|
|
2557
|
+
}
|
|
2558
|
+
/**
|
|
2559
|
+
* Takes the request that waits for this extension, or `null` when none does (it expired after
|
|
2560
|
+
* 15 seconds, was taken already, or the extension did not register for the kind). Call it once when
|
|
2561
|
+
* the extension starts: a frame that the choice itself opened misses the event.
|
|
2562
|
+
*/
|
|
2563
|
+
async take() {
|
|
2564
|
+
await this.client.ready();
|
|
2565
|
+
const request = await this.client.request(EXTENSION_COMMANDS.openerTake, {});
|
|
2566
|
+
return request ?? null;
|
|
2567
|
+
}
|
|
2568
|
+
/**
|
|
2569
|
+
* Calls `handler` with each request that arrives while the extension is open; the SDK takes it
|
|
2570
|
+
* for you. Errors while taking a request go to `onError`, or to the SDK console log when omitted.
|
|
2571
|
+
* Returns an unsubscribe function.
|
|
2572
|
+
*/
|
|
2573
|
+
onRequest(handler, onError) {
|
|
2574
|
+
let active = true;
|
|
2575
|
+
const wrapped = () => {
|
|
2576
|
+
void this.take().then(
|
|
2577
|
+
(request) => {
|
|
2578
|
+
if (active && request) handler(request);
|
|
2579
|
+
},
|
|
2580
|
+
(error) => {
|
|
2581
|
+
if (!active) return;
|
|
2582
|
+
if (onError) onError(error);
|
|
2583
|
+
else console.error("[HaexVault SDK] Failed to take opener request:", error);
|
|
2584
|
+
}
|
|
2585
|
+
);
|
|
2586
|
+
};
|
|
2587
|
+
this.client.on(OPENER_EVENTS.REQUEST, wrapped);
|
|
2588
|
+
return () => {
|
|
2589
|
+
active = false;
|
|
2590
|
+
this.client.off(OPENER_EVENTS.REQUEST, wrapped);
|
|
2591
|
+
};
|
|
2592
|
+
}
|
|
2593
|
+
};
|
|
2594
|
+
|
|
2546
2595
|
// src/api/tools/index.ts
|
|
2547
2596
|
init_esm_shims();
|
|
2548
2597
|
|
|
@@ -3418,6 +3467,7 @@ var HaexVaultSdk = class {
|
|
|
3418
3467
|
this.notifications = new NotificationsAPI(this);
|
|
3419
3468
|
this.tab = new TabAPI(this);
|
|
3420
3469
|
this.dialog = new DialogAPI(this);
|
|
3470
|
+
this.openers = new OpenersAPI(this);
|
|
3421
3471
|
this.tools = new ToolsAPI({
|
|
3422
3472
|
manifest: () => this.config.manifest,
|
|
3423
3473
|
send: (message) => this.sendMcpMessage(message)
|