@haex-space/vault-sdk 4.0.0 → 4.1.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-C6pEREPM.d.ts → client-CD5QZi7F.d.ts} +29 -10
- package/dist/{client-GdCi-m2s.d.mts → client-Cx4ZyQFL.d.mts} +29 -10
- package/dist/index.d.mts +9 -6
- package/dist/index.d.ts +9 -6
- package/dist/index.js +57 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -12
- 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 +57 -13
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +56 -12
- 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 +55 -11
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +55 -11
- 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 +57 -13
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +56 -12
- 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 +57 -13
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +56 -12
- 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
|
|
|
@@ -2078,9 +2080,44 @@ var SpacesAPI = class {
|
|
|
2078
2080
|
|
|
2079
2081
|
// src/api/shell.ts
|
|
2080
2082
|
init_esm_shims();
|
|
2083
|
+
var NOT_SUPPORTED = 8e3;
|
|
2084
|
+
function isUnsupported(error) {
|
|
2085
|
+
if (error?.code === NOT_SUPPORTED) return true;
|
|
2086
|
+
return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
|
|
2087
|
+
}
|
|
2081
2088
|
var ShellAPI = class {
|
|
2082
2089
|
constructor(sdk) {
|
|
2083
2090
|
this.sdk = sdk;
|
|
2091
|
+
/** `shell:output` events per session handed on but not yet acknowledged. */
|
|
2092
|
+
this.unacknowledged = /* @__PURE__ */ new Map();
|
|
2093
|
+
this.flushScheduled = false;
|
|
2094
|
+
/** The host does not know `extension_shell_ack` (it reads output without backpressure). */
|
|
2095
|
+
this.ackUnsupported = false;
|
|
2096
|
+
this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
|
|
2097
|
+
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Backpressure: the host keeps reading a shell's output only while this frame has few
|
|
2100
|
+
* events open, so a shell that writes fast waits instead of flooding the page. The SDK
|
|
2101
|
+
* acknowledges every event once the listeners have had it, in one request per session and
|
|
2102
|
+
* task.
|
|
2103
|
+
*/
|
|
2104
|
+
acknowledge(event) {
|
|
2105
|
+
const sessionId = event.data?.sessionId;
|
|
2106
|
+
if (this.ackUnsupported || typeof sessionId !== "string") return;
|
|
2107
|
+
this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
|
|
2108
|
+
if (this.flushScheduled) return;
|
|
2109
|
+
this.flushScheduled = true;
|
|
2110
|
+
queueMicrotask(() => this.flushAcknowledgements());
|
|
2111
|
+
}
|
|
2112
|
+
flushAcknowledgements() {
|
|
2113
|
+
this.flushScheduled = false;
|
|
2114
|
+
const counts = [...this.unacknowledged];
|
|
2115
|
+
this.unacknowledged.clear();
|
|
2116
|
+
for (const [sessionId, count] of counts) {
|
|
2117
|
+
this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
|
|
2118
|
+
if (isUnsupported(error)) this.ackUnsupported = true;
|
|
2119
|
+
});
|
|
2120
|
+
}
|
|
2084
2121
|
}
|
|
2085
2122
|
/**
|
|
2086
2123
|
* List available shell environments on the host system.
|
|
@@ -2298,22 +2335,29 @@ var MailAPI = class {
|
|
|
2298
2335
|
});
|
|
2299
2336
|
}
|
|
2300
2337
|
/**
|
|
2301
|
-
* Start (or replace) a background
|
|
2302
|
-
*
|
|
2303
|
-
*
|
|
2304
|
-
*
|
|
2338
|
+
* Start (or replace) a background watch for `accountId`/`mailboxName`.
|
|
2339
|
+
* Requires `mail` permission with action `poll` on the account's IMAP
|
|
2340
|
+
* host (`imap.host` when passed; prompted on first call, same as
|
|
2341
|
+
* `fetch`/`send`).
|
|
2342
|
+
*
|
|
2343
|
+
* Pass the account's `imap` config, as for every other mail call: the host
|
|
2344
|
+
* keeps the credentials in memory for as long as the watch runs and never
|
|
2345
|
+
* stores them. Hosts that wait with IMAP IDLE are told about new mail by the
|
|
2346
|
+
* server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
|
|
2347
|
+
* interval for servers without IDLE. Listen for results via `onNewMessages`.
|
|
2305
2348
|
*
|
|
2306
|
-
* `
|
|
2307
|
-
*
|
|
2349
|
+
* `imap` is optional for hosts that resolve the credentials themselves from
|
|
2350
|
+
* `accountId`; holzi requires it.
|
|
2308
2351
|
*/
|
|
2309
|
-
async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
|
|
2352
|
+
async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
|
|
2310
2353
|
return this.client.request(MAIL_COMMANDS.startWatch, {
|
|
2311
2354
|
accountId,
|
|
2312
2355
|
mailboxName,
|
|
2313
|
-
intervalSeconds
|
|
2356
|
+
intervalSeconds,
|
|
2357
|
+
imap
|
|
2314
2358
|
});
|
|
2315
2359
|
}
|
|
2316
|
-
/** Stop a background
|
|
2360
|
+
/** Stop a background watch previously started with `startWatchingAsync`. */
|
|
2317
2361
|
async stopWatchingAsync(accountId, mailboxName) {
|
|
2318
2362
|
return this.client.request(MAIL_COMMANDS.stopWatch, {
|
|
2319
2363
|
accountId,
|