@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
|
@@ -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-Cx4ZyQFL.mjs';
|
|
4
|
+
import { A as ApplicationContext } from '../types-BwFKGH70.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-CD5QZi7F.js';
|
|
4
|
+
import { A as ApplicationContext } from '../types-BwFKGH70.js';
|
|
5
5
|
import 'drizzle-orm/sqlite-proxy';
|
|
6
6
|
|
|
7
7
|
declare const _default: nuxt_app.Plugin<{
|
|
@@ -280,6 +280,8 @@ var SHELL_COMMANDS = {
|
|
|
280
280
|
create: "extension_shell_create",
|
|
281
281
|
/** Write data to a shell session's stdin */
|
|
282
282
|
write: "extension_shell_write",
|
|
283
|
+
/** Acknowledge `shell:output` events handed on (backpressure; sent by the SDK itself) */
|
|
284
|
+
ack: "extension_shell_ack",
|
|
283
285
|
/** Resize a shell session's terminal */
|
|
284
286
|
resize: "extension_shell_resize",
|
|
285
287
|
/** Close a shell session */
|
|
@@ -320,9 +322,9 @@ var MAIL_COMMANDS = {
|
|
|
320
322
|
sendMessage: "extension_mail_send_message",
|
|
321
323
|
/** Build RFC822 bytes without sending (for Drafts via APPEND) */
|
|
322
324
|
buildRfc822: "extension_mail_build_rfc822",
|
|
323
|
-
/** Start (or replace) a background
|
|
325
|
+
/** Start (or replace) a background new-mail watch for an account/mailbox */
|
|
324
326
|
startWatch: "extension_mail_start_watch",
|
|
325
|
-
/** Stop a background
|
|
327
|
+
/** Stop a background new-mail watch */
|
|
326
328
|
stopWatch: "extension_mail_stop_watch"
|
|
327
329
|
};
|
|
328
330
|
|
|
@@ -1236,9 +1238,44 @@ var SpacesAPI = class {
|
|
|
1236
1238
|
};
|
|
1237
1239
|
|
|
1238
1240
|
// src/api/shell.ts
|
|
1241
|
+
var NOT_SUPPORTED = 8e3;
|
|
1242
|
+
function isUnsupported(error) {
|
|
1243
|
+
if (error?.code === NOT_SUPPORTED) return true;
|
|
1244
|
+
return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
|
|
1245
|
+
}
|
|
1239
1246
|
var ShellAPI = class {
|
|
1240
1247
|
constructor(sdk) {
|
|
1241
1248
|
this.sdk = sdk;
|
|
1249
|
+
/** `shell:output` events per session handed on but not yet acknowledged. */
|
|
1250
|
+
this.unacknowledged = /* @__PURE__ */ new Map();
|
|
1251
|
+
this.flushScheduled = false;
|
|
1252
|
+
/** The host does not know `extension_shell_ack` (it reads output without backpressure). */
|
|
1253
|
+
this.ackUnsupported = false;
|
|
1254
|
+
this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Backpressure: the host keeps reading a shell's output only while this frame has few
|
|
1258
|
+
* events open, so a shell that writes fast waits instead of flooding the page. The SDK
|
|
1259
|
+
* acknowledges every event once the listeners have had it, in one request per session and
|
|
1260
|
+
* task.
|
|
1261
|
+
*/
|
|
1262
|
+
acknowledge(event) {
|
|
1263
|
+
const sessionId = event.data?.sessionId;
|
|
1264
|
+
if (this.ackUnsupported || typeof sessionId !== "string") return;
|
|
1265
|
+
this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
|
|
1266
|
+
if (this.flushScheduled) return;
|
|
1267
|
+
this.flushScheduled = true;
|
|
1268
|
+
queueMicrotask(() => this.flushAcknowledgements());
|
|
1269
|
+
}
|
|
1270
|
+
flushAcknowledgements() {
|
|
1271
|
+
this.flushScheduled = false;
|
|
1272
|
+
const counts = [...this.unacknowledged];
|
|
1273
|
+
this.unacknowledged.clear();
|
|
1274
|
+
for (const [sessionId, count] of counts) {
|
|
1275
|
+
this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
|
|
1276
|
+
if (isUnsupported(error)) this.ackUnsupported = true;
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1242
1279
|
}
|
|
1243
1280
|
/**
|
|
1244
1281
|
* List available shell environments on the host system.
|
|
@@ -1454,22 +1491,29 @@ var MailAPI = class {
|
|
|
1454
1491
|
});
|
|
1455
1492
|
}
|
|
1456
1493
|
/**
|
|
1457
|
-
* Start (or replace) a background
|
|
1458
|
-
*
|
|
1459
|
-
*
|
|
1460
|
-
*
|
|
1494
|
+
* Start (or replace) a background watch for `accountId`/`mailboxName`.
|
|
1495
|
+
* Requires `mail` permission with action `poll` on the account's IMAP
|
|
1496
|
+
* host (`imap.host` when passed; prompted on first call, same as
|
|
1497
|
+
* `fetch`/`send`).
|
|
1498
|
+
*
|
|
1499
|
+
* Pass the account's `imap` config, as for every other mail call: the host
|
|
1500
|
+
* keeps the credentials in memory for as long as the watch runs and never
|
|
1501
|
+
* stores them. Hosts that wait with IMAP IDLE are told about new mail by the
|
|
1502
|
+
* server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
|
|
1503
|
+
* interval for servers without IDLE. Listen for results via `onNewMessages`.
|
|
1461
1504
|
*
|
|
1462
|
-
* `
|
|
1463
|
-
*
|
|
1505
|
+
* `imap` is optional for hosts that resolve the credentials themselves from
|
|
1506
|
+
* `accountId`; holzi requires it.
|
|
1464
1507
|
*/
|
|
1465
|
-
async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
|
|
1508
|
+
async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
|
|
1466
1509
|
return this.client.request(MAIL_COMMANDS.startWatch, {
|
|
1467
1510
|
accountId,
|
|
1468
1511
|
mailboxName,
|
|
1469
|
-
intervalSeconds
|
|
1512
|
+
intervalSeconds,
|
|
1513
|
+
imap
|
|
1470
1514
|
});
|
|
1471
1515
|
}
|
|
1472
|
-
/** Stop a background
|
|
1516
|
+
/** Stop a background watch previously started with `startWatchingAsync`. */
|
|
1473
1517
|
async stopWatchingAsync(accountId, mailboxName) {
|
|
1474
1518
|
return this.client.request(MAIL_COMMANDS.stopWatch, {
|
|
1475
1519
|
accountId,
|