@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/index.mjs
CHANGED
|
@@ -12,7 +12,7 @@ var __export = (target, all) => {
|
|
|
12
12
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
13
|
};
|
|
14
14
|
var init_esm_shims = __esm({
|
|
15
|
-
"node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.
|
|
15
|
+
"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"() {
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -1109,6 +1109,8 @@ var SHELL_COMMANDS = {
|
|
|
1109
1109
|
create: "extension_shell_create",
|
|
1110
1110
|
/** Write data to a shell session's stdin */
|
|
1111
1111
|
write: "extension_shell_write",
|
|
1112
|
+
/** Acknowledge `shell:output` events handed on (backpressure; sent by the SDK itself) */
|
|
1113
|
+
ack: "extension_shell_ack",
|
|
1112
1114
|
/** Resize a shell session's terminal */
|
|
1113
1115
|
resize: "extension_shell_resize",
|
|
1114
1116
|
/** Close a shell session */
|
|
@@ -1151,9 +1153,9 @@ var MAIL_COMMANDS = {
|
|
|
1151
1153
|
sendMessage: "extension_mail_send_message",
|
|
1152
1154
|
/** Build RFC822 bytes without sending (for Drafts via APPEND) */
|
|
1153
1155
|
buildRfc822: "extension_mail_build_rfc822",
|
|
1154
|
-
/** Start (or replace) a background
|
|
1156
|
+
/** Start (or replace) a background new-mail watch for an account/mailbox */
|
|
1155
1157
|
startWatch: "extension_mail_start_watch",
|
|
1156
|
-
/** Stop a background
|
|
1158
|
+
/** Stop a background new-mail watch */
|
|
1157
1159
|
stopWatch: "extension_mail_stop_watch"
|
|
1158
1160
|
};
|
|
1159
1161
|
|
|
@@ -1789,26 +1791,32 @@ var BackendManagement = class {
|
|
|
1789
1791
|
);
|
|
1790
1792
|
}
|
|
1791
1793
|
/**
|
|
1792
|
-
*
|
|
1793
|
-
*
|
|
1794
|
+
* Propose a new storage. The host asks the user; credentials are entered
|
|
1795
|
+
* only there. Resolves with the new storage, which the extension may then
|
|
1796
|
+
* read and write.
|
|
1797
|
+
* @param request - The proposal, without credentials
|
|
1794
1798
|
* @returns Created backend info
|
|
1795
1799
|
*/
|
|
1796
1800
|
async add(request) {
|
|
1797
1801
|
return this.client.request(
|
|
1798
1802
|
REMOTE_STORAGE_COMMANDS.addBackend,
|
|
1799
|
-
{ request }
|
|
1803
|
+
{ request },
|
|
1804
|
+
// No deadline: the host waits for the user's answer in its dialog.
|
|
1805
|
+
{ timeout: null }
|
|
1800
1806
|
);
|
|
1801
1807
|
}
|
|
1802
1808
|
/**
|
|
1803
|
-
*
|
|
1804
|
-
* Only provided fields are updated
|
|
1809
|
+
* Change a storage after the user confirms it in the host.
|
|
1810
|
+
* Only provided fields are updated; new credentials are entered in the host.
|
|
1805
1811
|
* @param request - Update request with backendId and fields to update
|
|
1806
1812
|
* @returns Updated backend info
|
|
1807
1813
|
*/
|
|
1808
1814
|
async update(request) {
|
|
1809
1815
|
return this.client.request(
|
|
1810
1816
|
REMOTE_STORAGE_COMMANDS.updateBackend,
|
|
1811
|
-
{ request }
|
|
1817
|
+
{ request },
|
|
1818
|
+
// No deadline: the host waits for the user's answer in its dialog.
|
|
1819
|
+
{ timeout: null }
|
|
1812
1820
|
);
|
|
1813
1821
|
}
|
|
1814
1822
|
/**
|
|
@@ -1816,18 +1824,22 @@ var BackendManagement = class {
|
|
|
1816
1824
|
* @param backendId - Backend ID to remove
|
|
1817
1825
|
*/
|
|
1818
1826
|
async remove(backendId) {
|
|
1819
|
-
await this.client.request(
|
|
1820
|
-
|
|
1821
|
-
|
|
1827
|
+
await this.client.request(
|
|
1828
|
+
REMOTE_STORAGE_COMMANDS.removeBackend,
|
|
1829
|
+
{ backendId },
|
|
1830
|
+
{ timeout: null }
|
|
1831
|
+
);
|
|
1822
1832
|
}
|
|
1823
1833
|
/**
|
|
1824
1834
|
* Test connection to a storage backend
|
|
1825
1835
|
* @param backendId - Backend ID to test
|
|
1826
1836
|
*/
|
|
1827
1837
|
async test(backendId) {
|
|
1828
|
-
await this.client.request(
|
|
1829
|
-
|
|
1830
|
-
|
|
1838
|
+
await this.client.request(
|
|
1839
|
+
REMOTE_STORAGE_COMMANDS.testBackend,
|
|
1840
|
+
{ backendId },
|
|
1841
|
+
{ timeout: null }
|
|
1842
|
+
);
|
|
1831
1843
|
}
|
|
1832
1844
|
};
|
|
1833
1845
|
|
|
@@ -2078,9 +2090,44 @@ var SpacesAPI = class {
|
|
|
2078
2090
|
|
|
2079
2091
|
// src/api/shell.ts
|
|
2080
2092
|
init_esm_shims();
|
|
2093
|
+
var NOT_SUPPORTED = 8e3;
|
|
2094
|
+
function isUnsupported(error) {
|
|
2095
|
+
if (error?.code === NOT_SUPPORTED) return true;
|
|
2096
|
+
return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
|
|
2097
|
+
}
|
|
2081
2098
|
var ShellAPI = class {
|
|
2082
2099
|
constructor(sdk) {
|
|
2083
2100
|
this.sdk = sdk;
|
|
2101
|
+
/** `shell:output` events per session handed on but not yet acknowledged. */
|
|
2102
|
+
this.unacknowledged = /* @__PURE__ */ new Map();
|
|
2103
|
+
this.flushScheduled = false;
|
|
2104
|
+
/** The host does not know `extension_shell_ack` (it reads output without backpressure). */
|
|
2105
|
+
this.ackUnsupported = false;
|
|
2106
|
+
this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* Backpressure: the host keeps reading a shell's output only while this frame has few
|
|
2110
|
+
* events open, so a shell that writes fast waits instead of flooding the page. The SDK
|
|
2111
|
+
* acknowledges every event once the listeners have had it, in one request per session and
|
|
2112
|
+
* task.
|
|
2113
|
+
*/
|
|
2114
|
+
acknowledge(event) {
|
|
2115
|
+
const sessionId = event.data?.sessionId;
|
|
2116
|
+
if (this.ackUnsupported || typeof sessionId !== "string") return;
|
|
2117
|
+
this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
|
|
2118
|
+
if (this.flushScheduled) return;
|
|
2119
|
+
this.flushScheduled = true;
|
|
2120
|
+
queueMicrotask(() => this.flushAcknowledgements());
|
|
2121
|
+
}
|
|
2122
|
+
flushAcknowledgements() {
|
|
2123
|
+
this.flushScheduled = false;
|
|
2124
|
+
const counts = [...this.unacknowledged];
|
|
2125
|
+
this.unacknowledged.clear();
|
|
2126
|
+
for (const [sessionId, count] of counts) {
|
|
2127
|
+
this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
|
|
2128
|
+
if (isUnsupported(error)) this.ackUnsupported = true;
|
|
2129
|
+
});
|
|
2130
|
+
}
|
|
2084
2131
|
}
|
|
2085
2132
|
/**
|
|
2086
2133
|
* List available shell environments on the host system.
|
|
@@ -2298,22 +2345,29 @@ var MailAPI = class {
|
|
|
2298
2345
|
});
|
|
2299
2346
|
}
|
|
2300
2347
|
/**
|
|
2301
|
-
* Start (or replace) a background
|
|
2302
|
-
*
|
|
2303
|
-
*
|
|
2304
|
-
*
|
|
2348
|
+
* Start (or replace) a background watch for `accountId`/`mailboxName`.
|
|
2349
|
+
* Requires `mail` permission with action `poll` on the account's IMAP
|
|
2350
|
+
* host (`imap.host` when passed; prompted on first call, same as
|
|
2351
|
+
* `fetch`/`send`).
|
|
2352
|
+
*
|
|
2353
|
+
* Pass the account's `imap` config, as for every other mail call: the host
|
|
2354
|
+
* keeps the credentials in memory for as long as the watch runs and never
|
|
2355
|
+
* stores them. Hosts that wait with IMAP IDLE are told about new mail by the
|
|
2356
|
+
* server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
|
|
2357
|
+
* interval for servers without IDLE. Listen for results via `onNewMessages`.
|
|
2305
2358
|
*
|
|
2306
|
-
* `
|
|
2307
|
-
*
|
|
2359
|
+
* `imap` is optional for hosts that resolve the credentials themselves from
|
|
2360
|
+
* `accountId`; holzi requires it.
|
|
2308
2361
|
*/
|
|
2309
|
-
async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
|
|
2362
|
+
async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
|
|
2310
2363
|
return this.client.request(MAIL_COMMANDS.startWatch, {
|
|
2311
2364
|
accountId,
|
|
2312
2365
|
mailboxName,
|
|
2313
|
-
intervalSeconds
|
|
2366
|
+
intervalSeconds,
|
|
2367
|
+
imap
|
|
2314
2368
|
});
|
|
2315
2369
|
}
|
|
2316
|
-
/** Stop a background
|
|
2370
|
+
/** Stop a background watch previously started with `startWatchingAsync`. */
|
|
2317
2371
|
async stopWatchingAsync(accountId, mailboxName) {
|
|
2318
2372
|
return this.client.request(MAIL_COMMANDS.stopWatch, {
|
|
2319
2373
|
accountId,
|