@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as nuxt_app from 'nuxt/app';
|
|
2
2
|
import { ShallowRef } from 'vue';
|
|
3
|
-
import { H as HaexVaultSdk } from '../client-
|
|
4
|
-
import { A as ApplicationContext } from '../types-
|
|
3
|
+
import { H as HaexVaultSdk } from '../client-GdCi-m2s.mjs';
|
|
4
|
+
import { A as ApplicationContext } from '../types-Ba4G6ZpC.mjs';
|
|
5
5
|
import 'drizzle-orm/sqlite-proxy';
|
|
6
6
|
|
|
7
7
|
declare const _default: nuxt_app.Plugin<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as nuxt_app from 'nuxt/app';
|
|
2
2
|
import { ShallowRef } from 'vue';
|
|
3
|
-
import { H as HaexVaultSdk } from '../client-
|
|
4
|
-
import { A as ApplicationContext } from '../types-
|
|
3
|
+
import { H as HaexVaultSdk } from '../client-C6pEREPM.js';
|
|
4
|
+
import { A as ApplicationContext } from '../types-Ba4G6ZpC.js';
|
|
5
5
|
import 'drizzle-orm/sqlite-proxy';
|
|
6
6
|
|
|
7
7
|
declare const _default: nuxt_app.Plugin<{
|
|
@@ -182,7 +182,12 @@ var EXTENSION_COMMANDS = {
|
|
|
182
182
|
/** Get extension info (manifest, id, etc.) */
|
|
183
183
|
getInfo: "extension_get_info",
|
|
184
184
|
/** Get application context (theme, locale, etc.) */
|
|
185
|
-
getContext: "extension_context_get"
|
|
185
|
+
getContext: "extension_context_get",
|
|
186
|
+
/** Ask the host to mark (or unmark) this extension's own tab as wanting attention */
|
|
187
|
+
tabAttention: "extension_tab_attention",
|
|
188
|
+
/** Ask the user to confirm, in a dialog the host draws over this extension's tab */
|
|
189
|
+
dialogConfirm: "extension_dialog_confirm"
|
|
190
|
+
};
|
|
186
191
|
|
|
187
192
|
// src/commands/remoteStorage.ts
|
|
188
193
|
var REMOTE_STORAGE_COMMANDS = {
|
|
@@ -262,6 +267,8 @@ var SPACE_COMMANDS = {
|
|
|
262
267
|
unassign: "extension_space_unassign",
|
|
263
268
|
/** Get space assignments for a table */
|
|
264
269
|
getAssignments: "extension_space_get_assignments",
|
|
270
|
+
/** Get members of a shared space */
|
|
271
|
+
getMembers: "extension_space_get_members",
|
|
265
272
|
/** List all spaces the user is a member of (with decrypted names) */
|
|
266
273
|
list: "extension_space_list"};
|
|
267
274
|
|
|
@@ -1219,6 +1226,13 @@ var SpacesAPI = class {
|
|
|
1219
1226
|
async listSpacesAsync() {
|
|
1220
1227
|
return this.client.request(SPACE_COMMANDS.list);
|
|
1221
1228
|
}
|
|
1229
|
+
/**
|
|
1230
|
+
* List members of a shared space (DID + label), flagging the current user.
|
|
1231
|
+
* Used to resolve assignment authors to names and to detect own vs shared-in content.
|
|
1232
|
+
*/
|
|
1233
|
+
async getMembersAsync(spaceId) {
|
|
1234
|
+
return this.client.request(SPACE_COMMANDS.getMembers, { spaceId });
|
|
1235
|
+
}
|
|
1222
1236
|
};
|
|
1223
1237
|
|
|
1224
1238
|
// src/api/shell.ts
|
|
@@ -1508,6 +1522,32 @@ var NotificationsAPI = class {
|
|
|
1508
1522
|
}
|
|
1509
1523
|
};
|
|
1510
1524
|
|
|
1525
|
+
// src/api/tab.ts
|
|
1526
|
+
var TabAPI = class {
|
|
1527
|
+
constructor(client) {
|
|
1528
|
+
this.client = client;
|
|
1529
|
+
}
|
|
1530
|
+
/**
|
|
1531
|
+
* Mark the tab as wanting the user's attention (`true`), e.g. for unread
|
|
1532
|
+
* content, or clear the mark (`false`).
|
|
1533
|
+
*/
|
|
1534
|
+
async requestAttention(active) {
|
|
1535
|
+
await this.client.request(EXTENSION_COMMANDS.tabAttention, { active });
|
|
1536
|
+
}
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
// src/api/dialog.ts
|
|
1540
|
+
var DialogAPI = class {
|
|
1541
|
+
constructor(client) {
|
|
1542
|
+
this.client = client;
|
|
1543
|
+
}
|
|
1544
|
+
/** Asks the user; resolves `true` for confirm, `false` for cancel or when the dialog is closed. */
|
|
1545
|
+
async confirm(options) {
|
|
1546
|
+
const answer = await this.client.request(EXTENSION_COMMANDS.dialogConfirm, { ...options }, { timeout: null });
|
|
1547
|
+
return answer === true;
|
|
1548
|
+
}
|
|
1549
|
+
};
|
|
1550
|
+
|
|
1511
1551
|
// src/messages.ts
|
|
1512
1552
|
var HAEXSPACE_MESSAGE_TYPES = {
|
|
1513
1553
|
/** Debug message for development/troubleshooting */
|
|
@@ -1833,6 +1873,10 @@ function waitForHostPortAsync(log) {
|
|
|
1833
1873
|
const handler = (event) => {
|
|
1834
1874
|
const type = event.data?.type;
|
|
1835
1875
|
if (type !== HAEXSPACE_MESSAGE_TYPES.PORT_INIT) return;
|
|
1876
|
+
if (event.source !== window.parent) {
|
|
1877
|
+
log("PORT_INIT from a window other than the parent \u2014 ignoring");
|
|
1878
|
+
return;
|
|
1879
|
+
}
|
|
1836
1880
|
const port = event.ports[0];
|
|
1837
1881
|
if (!port) {
|
|
1838
1882
|
log("PORT_INIT received but event.ports is empty \u2014 ignoring");
|
|
@@ -1869,7 +1913,7 @@ postMessage error: ${e}`);
|
|
|
1869
1913
|
function generateRequestId(counter) {
|
|
1870
1914
|
return `req_${counter}`;
|
|
1871
1915
|
}
|
|
1872
|
-
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port) {
|
|
1916
|
+
function sendPostMessage(method, params, requestId, config, extensionInfo, pendingRequests, port, timeoutMs = config.timeout) {
|
|
1873
1917
|
if (!port) {
|
|
1874
1918
|
return Promise.reject(
|
|
1875
1919
|
new HaexVaultSdkError(
|
|
@@ -1884,14 +1928,14 @@ function sendPostMessage(method, params, requestId, config, extensionInfo, pendi
|
|
|
1884
1928
|
timestamp: Date.now()
|
|
1885
1929
|
};
|
|
1886
1930
|
return new Promise((resolve, reject) => {
|
|
1887
|
-
const timeout = setTimeout(() => {
|
|
1931
|
+
const timeout = timeoutMs === null ? void 0 : setTimeout(() => {
|
|
1888
1932
|
pendingRequests.delete(requestId);
|
|
1889
1933
|
reject(
|
|
1890
1934
|
new HaexVaultSdkError("TIMEOUT" /* TIMEOUT */, "errors.timeout", {
|
|
1891
|
-
timeout:
|
|
1935
|
+
timeout: timeoutMs
|
|
1892
1936
|
})
|
|
1893
1937
|
);
|
|
1894
|
-
},
|
|
1938
|
+
}, timeoutMs);
|
|
1895
1939
|
pendingRequests.set(requestId, { resolve, reject, timeout });
|
|
1896
1940
|
if (config.debug) {
|
|
1897
1941
|
console.log("[SDK Debug] ========== Sending Request ==========");
|
|
@@ -2244,6 +2288,8 @@ var HaexVaultSdk = class {
|
|
|
2244
2288
|
this.passwords = new PasswordsAPI(this);
|
|
2245
2289
|
this.mail = new MailAPI(this);
|
|
2246
2290
|
this.notifications = new NotificationsAPI(this);
|
|
2291
|
+
this.tab = new TabAPI(this);
|
|
2292
|
+
this.dialog = new DialogAPI(this);
|
|
2247
2293
|
installConsoleForwarding(this.config.debug);
|
|
2248
2294
|
this.on(HAEXTENSION_EVENTS.PERMISSION_RESOLVED, (event) => {
|
|
2249
2295
|
const data = event.data;
|
|
@@ -2399,7 +2445,7 @@ var HaexVaultSdk = class {
|
|
|
2399
2445
|
// ==========================================================================
|
|
2400
2446
|
// Communication
|
|
2401
2447
|
// ==========================================================================
|
|
2402
|
-
async request(method, params) {
|
|
2448
|
+
async request(method, params, options) {
|
|
2403
2449
|
const resolvedParams = params ?? {};
|
|
2404
2450
|
const send = () => {
|
|
2405
2451
|
if (this.isNativeWindow && hasTauri()) {
|
|
@@ -2418,7 +2464,8 @@ var HaexVaultSdk = class {
|
|
|
2418
2464
|
this.config,
|
|
2419
2465
|
this._extensionInfo,
|
|
2420
2466
|
this.pendingRequests,
|
|
2421
|
-
this.hostPort
|
|
2467
|
+
this.hostPort,
|
|
2468
|
+
options?.timeout
|
|
2422
2469
|
);
|
|
2423
2470
|
};
|
|
2424
2471
|
return withPermissionRetry(send, this.permissionWaiters, this.log.bind(this));
|