@haex-space/vault-sdk 4.0.0 → 4.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/dist/cli/index.mjs.map +1 -1
- package/dist/{client-GdCi-m2s.d.mts → client-7bZyiRwE.d.mts} +127 -36
- package/dist/{client-C6pEREPM.d.ts → client-BPwsH1so.d.ts} +127 -36
- package/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +79 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +78 -24
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.mjs +1 -1
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +1 -1
- package/dist/nuxt.js.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +79 -25
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +78 -24
- 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 +77 -23
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +77 -23
- 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 +79 -25
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +78 -24
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-Ba4G6ZpC.d.mts → types-BwFKGH70.d.mts} +1 -1
- package/dist/{types-Ba4G6ZpC.d.ts → types-BwFKGH70.d.ts} +1 -1
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +79 -25
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +78 -24
- package/dist/vue.mjs.map +1 -1
- package/package.json +2 -2
package/dist/vue.mjs
CHANGED
|
@@ -8,7 +8,7 @@ var __esm = (fn, res) => function __init() {
|
|
|
8
8
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
9
|
};
|
|
10
10
|
var init_esm_shims = __esm({
|
|
11
|
-
"node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.
|
|
11
|
+
"node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.29_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js"() {
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
|
|
@@ -716,6 +716,8 @@ var SHELL_COMMANDS = {
|
|
|
716
716
|
create: "extension_shell_create",
|
|
717
717
|
/** Write data to a shell session's stdin */
|
|
718
718
|
write: "extension_shell_write",
|
|
719
|
+
/** Acknowledge `shell:output` events handed on (backpressure; sent by the SDK itself) */
|
|
720
|
+
ack: "extension_shell_ack",
|
|
719
721
|
/** Resize a shell session's terminal */
|
|
720
722
|
resize: "extension_shell_resize",
|
|
721
723
|
/** Close a shell session */
|
|
@@ -758,9 +760,9 @@ var MAIL_COMMANDS = {
|
|
|
758
760
|
sendMessage: "extension_mail_send_message",
|
|
759
761
|
/** Build RFC822 bytes without sending (for Drafts via APPEND) */
|
|
760
762
|
buildRfc822: "extension_mail_build_rfc822",
|
|
761
|
-
/** Start (or replace) a background
|
|
763
|
+
/** Start (or replace) a background new-mail watch for an account/mailbox */
|
|
762
764
|
startWatch: "extension_mail_start_watch",
|
|
763
|
-
/** Stop a background
|
|
765
|
+
/** Stop a background new-mail watch */
|
|
764
766
|
stopWatch: "extension_mail_stop_watch"
|
|
765
767
|
};
|
|
766
768
|
|
|
@@ -1369,26 +1371,32 @@ var BackendManagement = class {
|
|
|
1369
1371
|
);
|
|
1370
1372
|
}
|
|
1371
1373
|
/**
|
|
1372
|
-
*
|
|
1373
|
-
*
|
|
1374
|
+
* Propose a new storage. The host asks the user; credentials are entered
|
|
1375
|
+
* only there. Resolves with the new storage, which the extension may then
|
|
1376
|
+
* read and write.
|
|
1377
|
+
* @param request - The proposal, without credentials
|
|
1374
1378
|
* @returns Created backend info
|
|
1375
1379
|
*/
|
|
1376
1380
|
async add(request) {
|
|
1377
1381
|
return this.client.request(
|
|
1378
1382
|
REMOTE_STORAGE_COMMANDS.addBackend,
|
|
1379
|
-
{ request }
|
|
1383
|
+
{ request },
|
|
1384
|
+
// No deadline: the host waits for the user's answer in its dialog.
|
|
1385
|
+
{ timeout: null }
|
|
1380
1386
|
);
|
|
1381
1387
|
}
|
|
1382
1388
|
/**
|
|
1383
|
-
*
|
|
1384
|
-
* Only provided fields are updated
|
|
1389
|
+
* Change a storage after the user confirms it in the host.
|
|
1390
|
+
* Only provided fields are updated; new credentials are entered in the host.
|
|
1385
1391
|
* @param request - Update request with backendId and fields to update
|
|
1386
1392
|
* @returns Updated backend info
|
|
1387
1393
|
*/
|
|
1388
1394
|
async update(request) {
|
|
1389
1395
|
return this.client.request(
|
|
1390
1396
|
REMOTE_STORAGE_COMMANDS.updateBackend,
|
|
1391
|
-
{ request }
|
|
1397
|
+
{ request },
|
|
1398
|
+
// No deadline: the host waits for the user's answer in its dialog.
|
|
1399
|
+
{ timeout: null }
|
|
1392
1400
|
);
|
|
1393
1401
|
}
|
|
1394
1402
|
/**
|
|
@@ -1396,18 +1404,22 @@ var BackendManagement = class {
|
|
|
1396
1404
|
* @param backendId - Backend ID to remove
|
|
1397
1405
|
*/
|
|
1398
1406
|
async remove(backendId) {
|
|
1399
|
-
await this.client.request(
|
|
1400
|
-
|
|
1401
|
-
|
|
1407
|
+
await this.client.request(
|
|
1408
|
+
REMOTE_STORAGE_COMMANDS.removeBackend,
|
|
1409
|
+
{ backendId },
|
|
1410
|
+
{ timeout: null }
|
|
1411
|
+
);
|
|
1402
1412
|
}
|
|
1403
1413
|
/**
|
|
1404
1414
|
* Test connection to a storage backend
|
|
1405
1415
|
* @param backendId - Backend ID to test
|
|
1406
1416
|
*/
|
|
1407
1417
|
async test(backendId) {
|
|
1408
|
-
await this.client.request(
|
|
1409
|
-
|
|
1410
|
-
|
|
1418
|
+
await this.client.request(
|
|
1419
|
+
REMOTE_STORAGE_COMMANDS.testBackend,
|
|
1420
|
+
{ backendId },
|
|
1421
|
+
{ timeout: null }
|
|
1422
|
+
);
|
|
1411
1423
|
}
|
|
1412
1424
|
};
|
|
1413
1425
|
|
|
@@ -1658,9 +1670,44 @@ var SpacesAPI = class {
|
|
|
1658
1670
|
|
|
1659
1671
|
// src/api/shell.ts
|
|
1660
1672
|
init_esm_shims();
|
|
1673
|
+
var NOT_SUPPORTED = 8e3;
|
|
1674
|
+
function isUnsupported(error) {
|
|
1675
|
+
if (error?.code === NOT_SUPPORTED) return true;
|
|
1676
|
+
return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
|
|
1677
|
+
}
|
|
1661
1678
|
var ShellAPI = class {
|
|
1662
1679
|
constructor(sdk) {
|
|
1663
1680
|
this.sdk = sdk;
|
|
1681
|
+
/** `shell:output` events per session handed on but not yet acknowledged. */
|
|
1682
|
+
this.unacknowledged = /* @__PURE__ */ new Map();
|
|
1683
|
+
this.flushScheduled = false;
|
|
1684
|
+
/** The host does not know `extension_shell_ack` (it reads output without backpressure). */
|
|
1685
|
+
this.ackUnsupported = false;
|
|
1686
|
+
this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Backpressure: the host keeps reading a shell's output only while this frame has few
|
|
1690
|
+
* events open, so a shell that writes fast waits instead of flooding the page. The SDK
|
|
1691
|
+
* acknowledges every event once the listeners have had it, in one request per session and
|
|
1692
|
+
* task.
|
|
1693
|
+
*/
|
|
1694
|
+
acknowledge(event) {
|
|
1695
|
+
const sessionId = event.data?.sessionId;
|
|
1696
|
+
if (this.ackUnsupported || typeof sessionId !== "string") return;
|
|
1697
|
+
this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
|
|
1698
|
+
if (this.flushScheduled) return;
|
|
1699
|
+
this.flushScheduled = true;
|
|
1700
|
+
queueMicrotask(() => this.flushAcknowledgements());
|
|
1701
|
+
}
|
|
1702
|
+
flushAcknowledgements() {
|
|
1703
|
+
this.flushScheduled = false;
|
|
1704
|
+
const counts = [...this.unacknowledged];
|
|
1705
|
+
this.unacknowledged.clear();
|
|
1706
|
+
for (const [sessionId, count] of counts) {
|
|
1707
|
+
this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
|
|
1708
|
+
if (isUnsupported(error)) this.ackUnsupported = true;
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1664
1711
|
}
|
|
1665
1712
|
/**
|
|
1666
1713
|
* List available shell environments on the host system.
|
|
@@ -1878,22 +1925,29 @@ var MailAPI = class {
|
|
|
1878
1925
|
});
|
|
1879
1926
|
}
|
|
1880
1927
|
/**
|
|
1881
|
-
* Start (or replace) a background
|
|
1882
|
-
*
|
|
1883
|
-
*
|
|
1884
|
-
*
|
|
1928
|
+
* Start (or replace) a background watch for `accountId`/`mailboxName`.
|
|
1929
|
+
* Requires `mail` permission with action `poll` on the account's IMAP
|
|
1930
|
+
* host (`imap.host` when passed; prompted on first call, same as
|
|
1931
|
+
* `fetch`/`send`).
|
|
1932
|
+
*
|
|
1933
|
+
* Pass the account's `imap` config, as for every other mail call: the host
|
|
1934
|
+
* keeps the credentials in memory for as long as the watch runs and never
|
|
1935
|
+
* stores them. Hosts that wait with IMAP IDLE are told about new mail by the
|
|
1936
|
+
* server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
|
|
1937
|
+
* interval for servers without IDLE. Listen for results via `onNewMessages`.
|
|
1885
1938
|
*
|
|
1886
|
-
* `
|
|
1887
|
-
*
|
|
1939
|
+
* `imap` is optional for hosts that resolve the credentials themselves from
|
|
1940
|
+
* `accountId`; holzi requires it.
|
|
1888
1941
|
*/
|
|
1889
|
-
async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
|
|
1942
|
+
async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
|
|
1890
1943
|
return this.client.request(MAIL_COMMANDS.startWatch, {
|
|
1891
1944
|
accountId,
|
|
1892
1945
|
mailboxName,
|
|
1893
|
-
intervalSeconds
|
|
1946
|
+
intervalSeconds,
|
|
1947
|
+
imap
|
|
1894
1948
|
});
|
|
1895
1949
|
}
|
|
1896
|
-
/** Stop a background
|
|
1950
|
+
/** Stop a background watch previously started with `startWatchingAsync`. */
|
|
1897
1951
|
async stopWatchingAsync(accountId, mailboxName) {
|
|
1898
1952
|
return this.client.request(MAIL_COMMANDS.stopWatch, {
|
|
1899
1953
|
accountId,
|