@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
|
@@ -278,6 +278,8 @@ var SHELL_COMMANDS = {
|
|
|
278
278
|
create: "extension_shell_create",
|
|
279
279
|
/** Write data to a shell session's stdin */
|
|
280
280
|
write: "extension_shell_write",
|
|
281
|
+
/** Acknowledge `shell:output` events handed on (backpressure; sent by the SDK itself) */
|
|
282
|
+
ack: "extension_shell_ack",
|
|
281
283
|
/** Resize a shell session's terminal */
|
|
282
284
|
resize: "extension_shell_resize",
|
|
283
285
|
/** Close a shell session */
|
|
@@ -318,9 +320,9 @@ var MAIL_COMMANDS = {
|
|
|
318
320
|
sendMessage: "extension_mail_send_message",
|
|
319
321
|
/** Build RFC822 bytes without sending (for Drafts via APPEND) */
|
|
320
322
|
buildRfc822: "extension_mail_build_rfc822",
|
|
321
|
-
/** Start (or replace) a background
|
|
323
|
+
/** Start (or replace) a background new-mail watch for an account/mailbox */
|
|
322
324
|
startWatch: "extension_mail_start_watch",
|
|
323
|
-
/** Stop a background
|
|
325
|
+
/** Stop a background new-mail watch */
|
|
324
326
|
stopWatch: "extension_mail_stop_watch"
|
|
325
327
|
};
|
|
326
328
|
|
|
@@ -948,26 +950,32 @@ var BackendManagement = class {
|
|
|
948
950
|
);
|
|
949
951
|
}
|
|
950
952
|
/**
|
|
951
|
-
*
|
|
952
|
-
*
|
|
953
|
+
* Propose a new storage. The host asks the user; credentials are entered
|
|
954
|
+
* only there. Resolves with the new storage, which the extension may then
|
|
955
|
+
* read and write.
|
|
956
|
+
* @param request - The proposal, without credentials
|
|
953
957
|
* @returns Created backend info
|
|
954
958
|
*/
|
|
955
959
|
async add(request) {
|
|
956
960
|
return this.client.request(
|
|
957
961
|
REMOTE_STORAGE_COMMANDS.addBackend,
|
|
958
|
-
{ request }
|
|
962
|
+
{ request },
|
|
963
|
+
// No deadline: the host waits for the user's answer in its dialog.
|
|
964
|
+
{ timeout: null }
|
|
959
965
|
);
|
|
960
966
|
}
|
|
961
967
|
/**
|
|
962
|
-
*
|
|
963
|
-
* Only provided fields are updated
|
|
968
|
+
* Change a storage after the user confirms it in the host.
|
|
969
|
+
* Only provided fields are updated; new credentials are entered in the host.
|
|
964
970
|
* @param request - Update request with backendId and fields to update
|
|
965
971
|
* @returns Updated backend info
|
|
966
972
|
*/
|
|
967
973
|
async update(request) {
|
|
968
974
|
return this.client.request(
|
|
969
975
|
REMOTE_STORAGE_COMMANDS.updateBackend,
|
|
970
|
-
{ request }
|
|
976
|
+
{ request },
|
|
977
|
+
// No deadline: the host waits for the user's answer in its dialog.
|
|
978
|
+
{ timeout: null }
|
|
971
979
|
);
|
|
972
980
|
}
|
|
973
981
|
/**
|
|
@@ -975,18 +983,22 @@ var BackendManagement = class {
|
|
|
975
983
|
* @param backendId - Backend ID to remove
|
|
976
984
|
*/
|
|
977
985
|
async remove(backendId) {
|
|
978
|
-
await this.client.request(
|
|
979
|
-
|
|
980
|
-
|
|
986
|
+
await this.client.request(
|
|
987
|
+
REMOTE_STORAGE_COMMANDS.removeBackend,
|
|
988
|
+
{ backendId },
|
|
989
|
+
{ timeout: null }
|
|
990
|
+
);
|
|
981
991
|
}
|
|
982
992
|
/**
|
|
983
993
|
* Test connection to a storage backend
|
|
984
994
|
* @param backendId - Backend ID to test
|
|
985
995
|
*/
|
|
986
996
|
async test(backendId) {
|
|
987
|
-
await this.client.request(
|
|
988
|
-
|
|
989
|
-
|
|
997
|
+
await this.client.request(
|
|
998
|
+
REMOTE_STORAGE_COMMANDS.testBackend,
|
|
999
|
+
{ backendId },
|
|
1000
|
+
{ timeout: null }
|
|
1001
|
+
);
|
|
990
1002
|
}
|
|
991
1003
|
};
|
|
992
1004
|
|
|
@@ -1234,9 +1246,44 @@ var SpacesAPI = class {
|
|
|
1234
1246
|
};
|
|
1235
1247
|
|
|
1236
1248
|
// src/api/shell.ts
|
|
1249
|
+
var NOT_SUPPORTED = 8e3;
|
|
1250
|
+
function isUnsupported(error) {
|
|
1251
|
+
if (error?.code === NOT_SUPPORTED) return true;
|
|
1252
|
+
return typeof error === "string" && /\bcommand (\S+ )?not found\b/i.test(error);
|
|
1253
|
+
}
|
|
1237
1254
|
var ShellAPI = class {
|
|
1238
1255
|
constructor(sdk) {
|
|
1239
1256
|
this.sdk = sdk;
|
|
1257
|
+
/** `shell:output` events per session handed on but not yet acknowledged. */
|
|
1258
|
+
this.unacknowledged = /* @__PURE__ */ new Map();
|
|
1259
|
+
this.flushScheduled = false;
|
|
1260
|
+
/** The host does not know `extension_shell_ack` (it reads output without backpressure). */
|
|
1261
|
+
this.ackUnsupported = false;
|
|
1262
|
+
this.sdk.on(SHELL_EVENTS.OUTPUT, (event) => this.acknowledge(event));
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Backpressure: the host keeps reading a shell's output only while this frame has few
|
|
1266
|
+
* events open, so a shell that writes fast waits instead of flooding the page. The SDK
|
|
1267
|
+
* acknowledges every event once the listeners have had it, in one request per session and
|
|
1268
|
+
* task.
|
|
1269
|
+
*/
|
|
1270
|
+
acknowledge(event) {
|
|
1271
|
+
const sessionId = event.data?.sessionId;
|
|
1272
|
+
if (this.ackUnsupported || typeof sessionId !== "string") return;
|
|
1273
|
+
this.unacknowledged.set(sessionId, (this.unacknowledged.get(sessionId) ?? 0) + 1);
|
|
1274
|
+
if (this.flushScheduled) return;
|
|
1275
|
+
this.flushScheduled = true;
|
|
1276
|
+
queueMicrotask(() => this.flushAcknowledgements());
|
|
1277
|
+
}
|
|
1278
|
+
flushAcknowledgements() {
|
|
1279
|
+
this.flushScheduled = false;
|
|
1280
|
+
const counts = [...this.unacknowledged];
|
|
1281
|
+
this.unacknowledged.clear();
|
|
1282
|
+
for (const [sessionId, count] of counts) {
|
|
1283
|
+
this.sdk.request(SHELL_COMMANDS.ack, { sessionId, count }).catch((error) => {
|
|
1284
|
+
if (isUnsupported(error)) this.ackUnsupported = true;
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1240
1287
|
}
|
|
1241
1288
|
/**
|
|
1242
1289
|
* List available shell environments on the host system.
|
|
@@ -1452,22 +1499,29 @@ var MailAPI = class {
|
|
|
1452
1499
|
});
|
|
1453
1500
|
}
|
|
1454
1501
|
/**
|
|
1455
|
-
* Start (or replace) a background
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1458
|
-
*
|
|
1502
|
+
* Start (or replace) a background watch for `accountId`/`mailboxName`.
|
|
1503
|
+
* Requires `mail` permission with action `poll` on the account's IMAP
|
|
1504
|
+
* host (`imap.host` when passed; prompted on first call, same as
|
|
1505
|
+
* `fetch`/`send`).
|
|
1506
|
+
*
|
|
1507
|
+
* Pass the account's `imap` config, as for every other mail call: the host
|
|
1508
|
+
* keeps the credentials in memory for as long as the watch runs and never
|
|
1509
|
+
* stores them. Hosts that wait with IMAP IDLE are told about new mail by the
|
|
1510
|
+
* server; `intervalSeconds` (clamped host-side to [30, 3600]) is the polling
|
|
1511
|
+
* interval for servers without IDLE. Listen for results via `onNewMessages`.
|
|
1459
1512
|
*
|
|
1460
|
-
* `
|
|
1461
|
-
*
|
|
1513
|
+
* `imap` is optional for hosts that resolve the credentials themselves from
|
|
1514
|
+
* `accountId`; holzi requires it.
|
|
1462
1515
|
*/
|
|
1463
|
-
async startWatchingAsync(accountId, mailboxName, intervalSeconds) {
|
|
1516
|
+
async startWatchingAsync(accountId, mailboxName, intervalSeconds, imap) {
|
|
1464
1517
|
return this.client.request(MAIL_COMMANDS.startWatch, {
|
|
1465
1518
|
accountId,
|
|
1466
1519
|
mailboxName,
|
|
1467
|
-
intervalSeconds
|
|
1520
|
+
intervalSeconds,
|
|
1521
|
+
imap
|
|
1468
1522
|
});
|
|
1469
1523
|
}
|
|
1470
|
-
/** Stop a background
|
|
1524
|
+
/** Stop a background watch previously started with `startWatchingAsync`. */
|
|
1471
1525
|
async stopWatchingAsync(accountId, mailboxName) {
|
|
1472
1526
|
return this.client.request(MAIL_COMMANDS.stopWatch, {
|
|
1473
1527
|
accountId,
|