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