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