@haex-space/vault-sdk 3.6.0 → 4.0.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 +51 -19
- package/dist/cli/index.js +437 -355
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +428 -339
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{client-DnCZ3KyI.d.mts → client-C6pEREPM.d.ts} +63 -3
- package/dist/{client-uuhuCPDu.d.ts → client-GdCi-m2s.d.mts} +63 -3
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +14 -59
- package/dist/index.d.ts +14 -59
- package/dist/index.js +139 -105
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +158 -123
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +53 -2
- package/dist/node.d.ts +53 -2
- package/dist/node.js +319 -2
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +320 -5
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +7 -5
- package/dist/nuxt.js.map +1 -1
- package/dist/nuxt.mjs +3 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +146 -7
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +166 -27
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js +54 -7
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +54 -7
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +146 -7
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +166 -27
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-DQZCRfC-.d.mts → types-Ba4G6ZpC.d.mts} +10 -2
- package/dist/{types-DQZCRfC-.d.ts → types-Ba4G6ZpC.d.ts} +10 -2
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +146 -7
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +166 -27
- package/dist/vue.mjs.map +1 -1
- package/package.json +8 -6
|
@@ -180,7 +180,12 @@ var EXTENSION_COMMANDS = {
|
|
|
180
180
|
/** Get extension info (manifest, id, etc.) */
|
|
181
181
|
getInfo: "extension_get_info",
|
|
182
182
|
/** Get application context (theme, locale, etc.) */
|
|
183
|
-
getContext: "extension_context_get"
|
|
183
|
+
getContext: "extension_context_get",
|
|
184
|
+
/** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
|
|
185
|
+
tabAttention: "extension_tab_attention",
|
|
186
|
+
/** Ask the user to confirm, in a dialog the host draws over this extension's tab */
|
|
187
|
+
dialogConfirm: "extension_dialog_confirm"
|
|
188
|
+
};
|
|
184
189
|
|
|
185
190
|
// src/commands/remoteStorage.ts
|
|
186
191
|
var REMOTE_STORAGE_COMMANDS = {
|
|
@@ -260,6 +265,8 @@ var SPACE_COMMANDS = {
|
|
|
260
265
|
unassign: "extension_space_unassign",
|
|
261
266
|
/** Get space assignments for a table */
|
|
262
267
|
getAssignments: "extension_space_get_assignments",
|
|
268
|
+
/** Get members of a shared space */
|
|
269
|
+
getMembers: "extension_space_get_members",
|
|
263
270
|
/** List all spaces the user is a member of (with decrypted names) */
|
|
264
271
|
list: "extension_space_list"};
|
|
265
272
|
|
|
@@ -1217,6 +1224,13 @@ var SpacesAPI = class {
|
|
|
1217
1224
|
async listSpacesAsync() {
|
|
1218
1225
|
return this.client.request(SPACE_COMMANDS.list);
|
|
1219
1226
|
}
|
|
1227
|
+
/**
|
|
1228
|
+
* List members of a shared space (DID + label), flagging the current user.
|
|
1229
|
+
* Used to resolve assignment authors to names and to detect own vs shared-in content.
|
|
1230
|
+
*/
|
|
1231
|
+
async getMembersAsync(spaceId) {
|
|
1232
|
+
return this.client.request(SPACE_COMMANDS.getMembers, { spaceId });
|
|
1233
|
+
}
|
|
1220
1234
|
};
|
|
1221
1235
|
|
|
1222
1236
|
// src/api/shell.ts
|
|
@@ -1506,6 +1520,32 @@ var NotificationsAPI = class {
|
|
|
1506
1520
|
}
|
|
1507
1521
|
};
|
|
1508
1522
|
|
|
1523
|
+
// src/api/tab.ts
|
|
1524
|
+
var TabAPI = class {
|
|
1525
|
+
constructor(client) {
|
|
1526
|
+
this.client = client;
|
|
1527
|
+
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Mark the tab as wanting the user's attention (`true`), e.g. for unread
|
|
1530
|
+
* content, or clear the mark (`false`).
|
|
1531
|
+
*/
|
|
1532
|
+
async requestAttention(active) {
|
|
1533
|
+
await this.client.request(EXTENSION_COMMANDS.tabAttention, { active });
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
// src/api/dialog.ts
|
|
1538
|
+
var DialogAPI = class {
|
|
1539
|
+
constructor(client) {
|
|
1540
|
+
this.client = client;
|
|
1541
|
+
}
|
|
1542
|
+
/** Asks the user; resolves `true` for confirm, `false` for cancel or when the dialog is closed. */
|
|
1543
|
+
async confirm(options) {
|
|
1544
|
+
const answer = await this.client.request(EXTENSION_COMMANDS.dialogConfirm, { ...options }, { timeout: null });
|
|
1545
|
+
return answer === true;
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
|
|
1509
1549
|
// src/messages.ts
|
|
1510
1550
|
var HAEXSPACE_MESSAGE_TYPES = {
|
|
1511
1551
|
/** Debug message for development/troubleshooting */
|
|
@@ -1831,6 +1871,10 @@ function waitForHostPortAsync(log) {
|
|
|
1831
1871
|
const handler = (event) => {
|
|
1832
1872
|
const type = event.data?.type;
|
|
1833
1873
|
if (type !== HAEXSPACE_MESSAGE_TYPES.PORT_INIT) return;
|
|
1874
|
+
if (event.source !== window.parent) {
|
|
1875
|
+
log("PORT_INIT from a window other than the parent \u2014 ignoring");
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1834
1878
|
const port = event.ports[0];
|
|
1835
1879
|
if (!port) {
|
|
1836
1880
|
log("PORT_INIT received but event.ports is empty \u2014 ignoring");
|
|
@@ -1867,7 +1911,7 @@ postMessage error: ${e}`);
|
|
|
1867
1911
|
function generateRequestId(counter) {
|
|
1868
1912
|
return `req_${counter}`;
|
|
1869
1913
|
}
|
|
1870
|
-
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port) {
|
|
1914
|
+
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port, timeoutMs = config.timeout) {
|
|
1871
1915
|
if (!port) {
|
|
1872
1916
|
return Promise.reject(
|
|
1873
1917
|
new HaexVaultSdkError(
|
|
@@ -1882,14 +1926,14 @@ function sendPostMessage(method, params, requestId, config, extensionInfo, pendi
|
|
|
1882
1926
|
timestamp: Date.now()
|
|
1883
1927
|
};
|
|
1884
1928
|
return new Promise((resolve, reject) => {
|
|
1885
|
-
const timeout = setTimeout(() => {
|
|
1929
|
+
const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
|
|
1886
1930
|
pendingRequests.delete(requestId);
|
|
1887
1931
|
reject(
|
|
1888
1932
|
new HaexVaultSdkError("TIMEOUT" /* TIMEOUT */, "errors.timeout", {
|
|
1889
|
-
timeout:
|
|
1933
|
+
timeout: timeoutMs
|
|
1890
1934
|
})
|
|
1891
1935
|
);
|
|
1892
|
-
},
|
|
1936
|
+
}, timeoutMs);
|
|
1893
1937
|
pendingRequests.set(requestId, { resolve, reject, timeout });
|
|
1894
1938
|
if (config.debug) {
|
|
1895
1939
|
console.log("[SDK Debug] ========== Sending Request ==========");
|
|
@@ -2242,6 +2286,8 @@ var HaexVaultSdk = class {
|
|
|
2242
2286
|
this.passwords = new PasswordsAPI(this);
|
|
2243
2287
|
this.mail = new MailAPI(this);
|
|
2244
2288
|
this.notifications = new NotificationsAPI(this);
|
|
2289
|
+
this.tab = new TabAPI(this);
|
|
2290
|
+
this.dialog = new DialogAPI(this);
|
|
2245
2291
|
installConsoleForwarding(this.config.debug);
|
|
2246
2292
|
this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
|
|
2247
2293
|
const data = event.data;
|
|
@@ -2397,7 +2443,7 @@ var HaexVaultSdk = class {
|
|
|
2397
2443
|
// ==========================================================================
|
|
2398
2444
|
// Communication
|
|
2399
2445
|
// ==========================================================================
|
|
2400
|
-
async request(method, params) {
|
|
2446
|
+
async request(method, params, options) {
|
|
2401
2447
|
const resolvedParams = params ?? {};
|
|
2402
2448
|
const send = () => {
|
|
2403
2449
|
if (this.isNativeWindow && hasTauri()) {
|
|
@@ -2416,7 +2462,8 @@ var HaexVaultSdk = class {
|
|
|
2416
2462
|
this.config,
|
|
2417
2463
|
this._extensionInfo,
|
|
2418
2464
|
this.pendingRequests,
|
|
2419
|
-
this.hostPort
|
|
2465
|
+
this.hostPort,
|
|
2466
|
+
options?.timeout
|
|
2420
2467
|
);
|
|
2421
2468
|
};
|
|
2422
2469
|
return withPermissionRetry(send, this.permissionWaiters, this.log.bind(this));
|