mindoodb-app-sdk 0.0.41 → 0.0.43
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/README.md +87 -1
- package/dist/appBundleManifest-B0xfpaXG.d.ts +62 -0
- package/dist/chunk-7RAKZZA6.js +1426 -0
- package/dist/chunk-LT4FK6LU.js +146 -0
- package/dist/index.d.ts +123 -3
- package/dist/index.js +292 -1170
- package/dist/testing/index.d.ts +10 -1
- package/dist/testing/index.js +85 -1
- package/dist/{types-B0zYIrv3.d.ts → types-DALNnPXo.d.ts} +122 -2
- package/dist/vite/index.d.ts +46 -0
- package/dist/vite/index.js +291 -0
- package/package.json +9 -4
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { af as MindooDBAppCreateViewNavigatorInput, bR as MindooDBAppViewNavigator, aO as MindooDBAppLaunchContext, ag as MindooDBAppDatabaseInfo, aj as MindooDBAppDocumentApi, bT as MindooDBAppViewNavigatorOpenOptions, l as MindooDBAppAttachmentApi, aC as MindooDBAppIdentityApi, bH as MindooDBAppTimestampApi, ah as MindooDBAppDirectoryApi, f as MindooDBAppDocument, ay as MindooDBAppFulltextSetup, ax as MindooDBAppExtractionSetup, a as MindooDBAppBridge, bw as MindooDBAppSession, H as MindooDBAppBridgeRpcRequest, aB as MindooDBAppHostTheme, bZ as MindooDBAppViewport, bL as MindooDBAppUiPreferences, b2 as MindooDBAppQueryResult, bY as MindooDBAppViewUpdateStats, D as MindooDBAppBridgePortMessage } from '../types-DALNnPXo.js';
|
|
2
2
|
import * as mindoodb from 'mindoodb';
|
|
3
3
|
import 'mindoodb-view-language';
|
|
4
4
|
|
|
@@ -98,6 +98,8 @@ interface CreateMockMindooDBAppSessionOptions {
|
|
|
98
98
|
databases?: MockMindooDBAppDatabaseDefinition[];
|
|
99
99
|
onDisconnect?: () => MaybePromise<void>;
|
|
100
100
|
sealedChannel?: MockSealedChannelOptions;
|
|
101
|
+
/** Initial contents of `session.storage`. */
|
|
102
|
+
storage?: Record<string, string>;
|
|
101
103
|
}
|
|
102
104
|
interface MockMindooDBAppSessionController {
|
|
103
105
|
bridge: MindooDBAppBridge;
|
|
@@ -111,6 +113,8 @@ interface MockMindooDBAppSessionController {
|
|
|
111
113
|
emitViewportChange(viewport: MindooDBAppViewport): void;
|
|
112
114
|
emitUiPreferencesChange(uiPreferences: MindooDBAppUiPreferences): void;
|
|
113
115
|
emitLocaleChange(locale: string): void;
|
|
116
|
+
/** Runs the app's `onBeforeClose` listeners, as the host does before a teardown. */
|
|
117
|
+
emitBeforeClose(): Promise<void>;
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
declare function createMockMindooDBAppSession(options?: CreateMockMindooDBAppSessionOptions): MockMindooDBAppSessionController;
|
|
@@ -144,6 +148,11 @@ interface FakeBridgeHostController {
|
|
|
144
148
|
emitQueryResult(subscriptionId: string, result: MindooDBAppQueryResult): void;
|
|
145
149
|
/** Push a navigator view-changed event to connected apps. */
|
|
146
150
|
emitViewChanged(navigatorId: string, stats: MindooDBAppViewUpdateStats): void;
|
|
151
|
+
/**
|
|
152
|
+
* Ask connected apps to flush before teardown, as the Haven host does. Resolves `true`
|
|
153
|
+
* when every port acknowledged and `false` when the grace period ran out.
|
|
154
|
+
*/
|
|
155
|
+
requestBeforeClose(timeoutMs?: number): Promise<boolean>;
|
|
147
156
|
postPortMessage(message: MindooDBAppBridgePortMessage, transfer?: Transferable[]): void;
|
|
148
157
|
setRequestHandler(method: string, handler: FakeBridgeRequestHandler): void;
|
|
149
158
|
clearRequestHandler(method: string): void;
|
package/dist/testing/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
releaseMindooDBAppBridgeSessions
|
|
3
|
+
} from "../chunk-7RAKZZA6.js";
|
|
4
|
+
|
|
1
5
|
// src/testing/index.ts
|
|
2
6
|
import * as Automerge from "@automerge/automerge";
|
|
3
7
|
import {
|
|
@@ -762,6 +766,7 @@ function createDefaultLaunchContext(patch) {
|
|
|
762
766
|
appVersion: "1.0.0",
|
|
763
767
|
launchId: "test-launch",
|
|
764
768
|
runtime: "iframe",
|
|
769
|
+
hosting: "external",
|
|
765
770
|
theme: {
|
|
766
771
|
mode: "dark",
|
|
767
772
|
preset: "mindoo"
|
|
@@ -1846,6 +1851,7 @@ function createMockSessionState(options = {}) {
|
|
|
1846
1851
|
const viewportListeners = /* @__PURE__ */ new Set();
|
|
1847
1852
|
const uiPreferencesListeners = /* @__PURE__ */ new Set();
|
|
1848
1853
|
const localeListeners = /* @__PURE__ */ new Set();
|
|
1854
|
+
const beforeCloseListeners = /* @__PURE__ */ new Set();
|
|
1849
1855
|
const databaseHandles = /* @__PURE__ */ new Map();
|
|
1850
1856
|
const databaseViewDocumentLists = /* @__PURE__ */ new Map();
|
|
1851
1857
|
const databaseViewApis = /* @__PURE__ */ new Map();
|
|
@@ -1853,6 +1859,7 @@ function createMockSessionState(options = {}) {
|
|
|
1853
1859
|
let activeMenuResolve = null;
|
|
1854
1860
|
let databaseInfos = [];
|
|
1855
1861
|
const openSealedChannels = /* @__PURE__ */ new Map();
|
|
1862
|
+
const appStorage = new Map(Object.entries(options.storage ?? {}));
|
|
1856
1863
|
const requireCapability = (databaseId, capability) => {
|
|
1857
1864
|
const info = databaseInfos.find((entry) => entry.id === databaseId);
|
|
1858
1865
|
if (!info) {
|
|
@@ -2016,6 +2023,39 @@ function createMockSessionState(options = {}) {
|
|
|
2016
2023
|
return view;
|
|
2017
2024
|
},
|
|
2018
2025
|
menus,
|
|
2026
|
+
storage: {
|
|
2027
|
+
async snapshot(snapshotOptions) {
|
|
2028
|
+
const prefixes = snapshotOptions?.prefixes;
|
|
2029
|
+
const result = {};
|
|
2030
|
+
appStorage.forEach((value, key) => {
|
|
2031
|
+
if (!prefixes?.length || prefixes.some((prefix) => key.startsWith(prefix))) {
|
|
2032
|
+
result[key] = value;
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
return result;
|
|
2036
|
+
},
|
|
2037
|
+
async get(key) {
|
|
2038
|
+
return appStorage.get(key) ?? null;
|
|
2039
|
+
},
|
|
2040
|
+
async set(key, value) {
|
|
2041
|
+
appStorage.set(key, value);
|
|
2042
|
+
},
|
|
2043
|
+
async remove(key) {
|
|
2044
|
+
appStorage.delete(key);
|
|
2045
|
+
},
|
|
2046
|
+
async keys(keysOptions) {
|
|
2047
|
+
const prefix = keysOptions?.prefix;
|
|
2048
|
+
return [...appStorage.keys()].filter((key) => !prefix || key.startsWith(prefix)).sort();
|
|
2049
|
+
},
|
|
2050
|
+
async clear(clearOptions) {
|
|
2051
|
+
const prefix = clearOptions?.prefix;
|
|
2052
|
+
if (!prefix) {
|
|
2053
|
+
appStorage.clear();
|
|
2054
|
+
return;
|
|
2055
|
+
}
|
|
2056
|
+
[...appStorage.keys()].filter((key) => key.startsWith(prefix)).forEach((key) => appStorage.delete(key));
|
|
2057
|
+
}
|
|
2058
|
+
},
|
|
2019
2059
|
onThemeChange(listener) {
|
|
2020
2060
|
themeListeners.add(listener);
|
|
2021
2061
|
return () => {
|
|
@@ -2040,6 +2080,12 @@ function createMockSessionState(options = {}) {
|
|
|
2040
2080
|
localeListeners.delete(listener);
|
|
2041
2081
|
};
|
|
2042
2082
|
},
|
|
2083
|
+
onBeforeClose(listener) {
|
|
2084
|
+
beforeCloseListeners.add(listener);
|
|
2085
|
+
return () => {
|
|
2086
|
+
beforeCloseListeners.delete(listener);
|
|
2087
|
+
};
|
|
2088
|
+
},
|
|
2043
2089
|
async disconnect() {
|
|
2044
2090
|
await options.onDisconnect?.();
|
|
2045
2091
|
}
|
|
@@ -2097,6 +2143,9 @@ function createMockSessionState(options = {}) {
|
|
|
2097
2143
|
emitLocaleChange(locale) {
|
|
2098
2144
|
launchContext = mergeLaunchContext(launchContext, { locale });
|
|
2099
2145
|
localeListeners.forEach((listener) => listener(launchContext.locale));
|
|
2146
|
+
},
|
|
2147
|
+
async emitBeforeClose() {
|
|
2148
|
+
await Promise.all([...beforeCloseListeners].map(async (listener) => listener()));
|
|
2100
2149
|
}
|
|
2101
2150
|
};
|
|
2102
2151
|
}
|
|
@@ -2113,7 +2162,8 @@ function createMockMindooDBAppSession(options = {}) {
|
|
|
2113
2162
|
emitThemeChange: state.emitThemeChange,
|
|
2114
2163
|
emitViewportChange: state.emitViewportChange,
|
|
2115
2164
|
emitUiPreferencesChange: state.emitUiPreferencesChange,
|
|
2116
|
-
emitLocaleChange: state.emitLocaleChange
|
|
2165
|
+
emitLocaleChange: state.emitLocaleChange,
|
|
2166
|
+
emitBeforeClose: state.emitBeforeClose
|
|
2117
2167
|
};
|
|
2118
2168
|
}
|
|
2119
2169
|
function createMockMindooDBAppBridge(options = {}) {
|
|
@@ -2126,6 +2176,8 @@ function createFakeBridgeHost(options = {}) {
|
|
|
2126
2176
|
);
|
|
2127
2177
|
const requests = [];
|
|
2128
2178
|
const connectedPorts = /* @__PURE__ */ new Set();
|
|
2179
|
+
const beforeCloseWaiters = /* @__PURE__ */ new Map();
|
|
2180
|
+
let beforeCloseCounter = 0;
|
|
2129
2181
|
const viewSessions = /* @__PURE__ */ new Map();
|
|
2130
2182
|
const readStreams = /* @__PURE__ */ new Map();
|
|
2131
2183
|
const writeStreams = /* @__PURE__ */ new Map();
|
|
@@ -2177,6 +2229,7 @@ function createFakeBridgeHost(options = {}) {
|
|
|
2177
2229
|
port.close();
|
|
2178
2230
|
});
|
|
2179
2231
|
connectedPorts.clear();
|
|
2232
|
+
releaseMindooDBAppBridgeSessions(state.getLaunchContext().launchId);
|
|
2180
2233
|
if (previousWindowDescriptor) {
|
|
2181
2234
|
Object.defineProperty(globalThis, "window", previousWindowDescriptor);
|
|
2182
2235
|
} else if (previousWindowValue !== void 0) {
|
|
@@ -2194,6 +2247,7 @@ function createFakeBridgeHost(options = {}) {
|
|
|
2194
2247
|
if (installed) {
|
|
2195
2248
|
return;
|
|
2196
2249
|
}
|
|
2250
|
+
releaseMindooDBAppBridgeSessions(state.getLaunchContext().launchId);
|
|
2197
2251
|
previousWindowDescriptor = Object.getOwnPropertyDescriptor(
|
|
2198
2252
|
globalThis,
|
|
2199
2253
|
"window"
|
|
@@ -2755,6 +2809,10 @@ function createFakeBridgeHost(options = {}) {
|
|
|
2755
2809
|
if (!message || message.protocol !== PROTOCOL) {
|
|
2756
2810
|
return;
|
|
2757
2811
|
}
|
|
2812
|
+
if (message.kind === "before-close-ack") {
|
|
2813
|
+
beforeCloseWaiters.get(message.closeId)?.();
|
|
2814
|
+
return;
|
|
2815
|
+
}
|
|
2758
2816
|
if (message.kind === "request") {
|
|
2759
2817
|
requests.push(message);
|
|
2760
2818
|
try {
|
|
@@ -2880,6 +2938,32 @@ function createFakeBridgeHost(options = {}) {
|
|
|
2880
2938
|
};
|
|
2881
2939
|
connectedPorts.forEach((port) => port.postMessage(payload));
|
|
2882
2940
|
},
|
|
2941
|
+
async requestBeforeClose(timeoutMs = 500) {
|
|
2942
|
+
if (!connectedPorts.size) {
|
|
2943
|
+
return true;
|
|
2944
|
+
}
|
|
2945
|
+
beforeCloseCounter += 1;
|
|
2946
|
+
const closeId = `close-${beforeCloseCounter}`;
|
|
2947
|
+
let pending = connectedPorts.size;
|
|
2948
|
+
const acknowledged = await new Promise((resolve) => {
|
|
2949
|
+
const timer = setTimeout(() => resolve(false), timeoutMs);
|
|
2950
|
+
beforeCloseWaiters.set(closeId, () => {
|
|
2951
|
+
pending -= 1;
|
|
2952
|
+
if (pending <= 0) {
|
|
2953
|
+
clearTimeout(timer);
|
|
2954
|
+
resolve(true);
|
|
2955
|
+
}
|
|
2956
|
+
});
|
|
2957
|
+
const payload = {
|
|
2958
|
+
protocol: PROTOCOL,
|
|
2959
|
+
kind: "before-close",
|
|
2960
|
+
closeId
|
|
2961
|
+
};
|
|
2962
|
+
connectedPorts.forEach((port) => port.postMessage(payload));
|
|
2963
|
+
});
|
|
2964
|
+
beforeCloseWaiters.delete(closeId);
|
|
2965
|
+
return acknowledged;
|
|
2966
|
+
},
|
|
2883
2967
|
postPortMessage(message, transfer = []) {
|
|
2884
2968
|
connectedPorts.forEach((port) => port.postMessage(message, transfer));
|
|
2885
2969
|
},
|
|
@@ -2,6 +2,16 @@ import { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppViewSor
|
|
|
2
2
|
|
|
3
3
|
/** Launch target used by the Haven when opening an app. */
|
|
4
4
|
type MindooDBAppRuntime = "iframe" | "window";
|
|
5
|
+
/**
|
|
6
|
+
* How the host delivers the app's assets.
|
|
7
|
+
*
|
|
8
|
+
* - `"external"` — loaded from the app's own origin. Normal web platform behaviour.
|
|
9
|
+
* - `"hosted"` — the host serves the app's build from its own cache into a sandboxed
|
|
10
|
+
* iframe without `allow-same-origin`. The document then lives in an opaque origin,
|
|
11
|
+
* where `localStorage`, `sessionStorage`, IndexedDB and service worker registration
|
|
12
|
+
* are unavailable and throw on access.
|
|
13
|
+
*/
|
|
14
|
+
type MindooDBAppHostingMode = "external" | "hosted";
|
|
5
15
|
/** Theme mode currently active in the Haven host UI. */
|
|
6
16
|
type MindooDBAppThemeMode = "light" | "dark";
|
|
7
17
|
/** Host theme snapshot exposed to running apps. */
|
|
@@ -110,6 +120,15 @@ interface MindooDBAppLaunchContext {
|
|
|
110
120
|
appVersion?: string;
|
|
111
121
|
launchId: string;
|
|
112
122
|
runtime: MindooDBAppRuntime;
|
|
123
|
+
/**
|
|
124
|
+
* How the host delivers this app. `"hosted"` means the host serves the app's own
|
|
125
|
+
* build from its cache under an opaque origin: `localStorage`/`sessionStorage` throw
|
|
126
|
+
* on access and the app must not register a service worker of its own. `"external"`
|
|
127
|
+
* means the app was loaded from its own origin with the usual web platform storage.
|
|
128
|
+
*
|
|
129
|
+
* Available synchronously before the bridge connects via {@link isHostedBundleRuntime}.
|
|
130
|
+
*/
|
|
131
|
+
hosting: MindooDBAppHostingMode;
|
|
113
132
|
theme: MindooDBAppHostTheme;
|
|
114
133
|
viewport: MindooDBAppViewport | null;
|
|
115
134
|
uiPreferences: MindooDBAppUiPreferences;
|
|
@@ -760,6 +779,12 @@ interface MindooDBAppBridgeConnectOptions {
|
|
|
760
779
|
targetOrigin?: string;
|
|
761
780
|
/** How long to wait for the host to answer the handshake before rejecting (default 10000 ms). */
|
|
762
781
|
connectTimeoutMs?: number;
|
|
782
|
+
/**
|
|
783
|
+
* When `false`, the SDK does not listen for Haven's host keyboard shortcuts
|
|
784
|
+
* (workspace / app drawer). Default is on: the same chords Haven handles
|
|
785
|
+
* on its own pages are reported from inside the iframe.
|
|
786
|
+
*/
|
|
787
|
+
hostShortcuts?: boolean;
|
|
763
788
|
}
|
|
764
789
|
/** Initial postMessage handshake sent from the app to the Haven. */
|
|
765
790
|
interface MindooDBAppBridgeConnectMessage {
|
|
@@ -908,8 +933,53 @@ interface MindooDBAppBridgeViewChangedMessage {
|
|
|
908
933
|
navigatorId: string;
|
|
909
934
|
stats: MindooDBAppViewUpdateStats;
|
|
910
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* Host-pushed event announcing that this launch is about to be torn down.
|
|
938
|
+
*
|
|
939
|
+
* Removing an iframe from the DOM discards messages its port has not delivered yet, and
|
|
940
|
+
* `pagehide` does not reliably fire for frames — so an app with queued asynchronous writes
|
|
941
|
+
* would lose them. The host therefore asks first and waits, briefly, for
|
|
942
|
+
* {@link MindooDBAppBridgeBeforeCloseAck}.
|
|
943
|
+
*
|
|
944
|
+
* The host proceeds after a short timeout regardless, so an app that does not answer is
|
|
945
|
+
* not able to block the close.
|
|
946
|
+
*/
|
|
947
|
+
interface MindooDBAppBridgeBeforeCloseMessage {
|
|
948
|
+
protocol: "mindoodb-app-bridge";
|
|
949
|
+
kind: "before-close";
|
|
950
|
+
closeId: string;
|
|
951
|
+
}
|
|
952
|
+
/** App acknowledgement that it has finished flushing and is ready to be torn down. */
|
|
953
|
+
interface MindooDBAppBridgeBeforeCloseAck {
|
|
954
|
+
protocol: "mindoodb-app-bridge";
|
|
955
|
+
kind: "before-close-ack";
|
|
956
|
+
closeId: string;
|
|
957
|
+
}
|
|
958
|
+
/** A Haven-owned keyboard chord the iframe should recognise. */
|
|
959
|
+
type MindooDBAppHostShortcutAction = "open-workspace" | "toggle-app-drawer";
|
|
960
|
+
/** One host shortcut, matched against {@link KeyboardEvent.code} plus modifiers. */
|
|
961
|
+
interface MindooDBAppHostShortcutBinding {
|
|
962
|
+
action: MindooDBAppHostShortcutAction;
|
|
963
|
+
/** Physical key, e.g. `"Space"` or `"Enter"`. */
|
|
964
|
+
code: string;
|
|
965
|
+
shiftKey: boolean;
|
|
966
|
+
/** Meta (macOS) or Control (Windows/Linux); Alt is never part of the chord. */
|
|
967
|
+
metaOrCtrl: boolean;
|
|
968
|
+
}
|
|
969
|
+
/** Host-pushed table of chords. The iframe replaces its local copy. */
|
|
970
|
+
interface MindooDBAppBridgeShortcutsChangedMessage {
|
|
971
|
+
protocol: "mindoodb-app-bridge";
|
|
972
|
+
kind: "shortcuts-changed";
|
|
973
|
+
shortcuts: MindooDBAppHostShortcutBinding[];
|
|
974
|
+
}
|
|
975
|
+
/** App → host: a host shortcut was pressed inside the iframe. */
|
|
976
|
+
interface MindooDBAppBridgeShortcutInvokedMessage {
|
|
977
|
+
protocol: "mindoodb-app-bridge";
|
|
978
|
+
kind: "shortcut-invoked";
|
|
979
|
+
action: MindooDBAppHostShortcutAction;
|
|
980
|
+
}
|
|
911
981
|
/** Any message that can travel across the dedicated bridge MessagePort. */
|
|
912
|
-
type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage | MindooDBAppBridgeUiPreferencesChangedMessage | MindooDBAppBridgeLocaleChangedMessage | MindooDBAppBridgeQueryResultMessage | MindooDBAppBridgeViewChangedMessage;
|
|
982
|
+
type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage | MindooDBAppBridgeUiPreferencesChangedMessage | MindooDBAppBridgeLocaleChangedMessage | MindooDBAppBridgeQueryResultMessage | MindooDBAppBridgeViewChangedMessage | MindooDBAppBridgeBeforeCloseMessage | MindooDBAppBridgeBeforeCloseAck | MindooDBAppBridgeShortcutsChangedMessage | MindooDBAppBridgeShortcutInvokedMessage;
|
|
913
983
|
/** Placement hint for a host-rendered overlay menu. */
|
|
914
984
|
type MindooDBAppMenuPlacement = "auto" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | "right-start" | "left-start";
|
|
915
985
|
/** Semantic hint allowing Haven to tune menu behavior or styling. */
|
|
@@ -2016,6 +2086,40 @@ interface MindooDBAppSealedChannelRequestInput {
|
|
|
2016
2086
|
/** JSON-serialisable body. Sealed by the host before it leaves the device. */
|
|
2017
2087
|
payload: unknown;
|
|
2018
2088
|
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Small key/value store the host keeps on the app's behalf.
|
|
2091
|
+
*
|
|
2092
|
+
* Scoped to the app *registration*, so two registrations of the same app do not see each
|
|
2093
|
+
* other's keys, and the data survives a bundle update. Values are strings; the host
|
|
2094
|
+
* enforces a per-value and a total byte budget and rejects writes beyond it with a
|
|
2095
|
+
* `quota-exceeded` bridge error.
|
|
2096
|
+
*
|
|
2097
|
+
* This exists because a hosted app runs in an opaque origin where `localStorage` is not
|
|
2098
|
+
* available. It is meant for preferences and similar small state — documents belong in a
|
|
2099
|
+
* database, not here.
|
|
2100
|
+
*/
|
|
2101
|
+
interface MindooDBAppStorageApi {
|
|
2102
|
+
/**
|
|
2103
|
+
* Read many keys in one round trip. Without `prefixes` it returns everything the app
|
|
2104
|
+
* has stored.
|
|
2105
|
+
*
|
|
2106
|
+
* Apps that replace synchronous `localStorage` access need the whole working set up
|
|
2107
|
+
* front, and doing that as one call instead of N keeps it to a single boot round trip.
|
|
2108
|
+
*/
|
|
2109
|
+
snapshot(options?: {
|
|
2110
|
+
prefixes?: string[];
|
|
2111
|
+
}): Promise<Record<string, string>>;
|
|
2112
|
+
get(key: string): Promise<string | null>;
|
|
2113
|
+
set(key: string, value: string): Promise<void>;
|
|
2114
|
+
remove(key: string): Promise<void>;
|
|
2115
|
+
keys(options?: {
|
|
2116
|
+
prefix?: string;
|
|
2117
|
+
}): Promise<string[]>;
|
|
2118
|
+
/** Remove every key, or only those starting with `prefix`. */
|
|
2119
|
+
clear(options?: {
|
|
2120
|
+
prefix?: string;
|
|
2121
|
+
}): Promise<void>;
|
|
2122
|
+
}
|
|
2019
2123
|
/** Connected session between the running app and the Haven host. */
|
|
2020
2124
|
interface MindooDBAppSession {
|
|
2021
2125
|
/**
|
|
@@ -2087,6 +2191,11 @@ interface MindooDBAppSession {
|
|
|
2087
2191
|
*/
|
|
2088
2192
|
openViewNavigator(viewId: string, options?: MindooDBAppViewNavigatorOpenOptions): Promise<MindooDBAppViewNavigator>;
|
|
2089
2193
|
menus: MindooDBAppMenuApi;
|
|
2194
|
+
/**
|
|
2195
|
+
* Host-backed key/value storage for this app registration. Usable in both hosting
|
|
2196
|
+
* modes; required in `"hosted"` mode, where `localStorage` throws.
|
|
2197
|
+
*/
|
|
2198
|
+
storage: MindooDBAppStorageApi;
|
|
2090
2199
|
/**
|
|
2091
2200
|
* Subscribe to host-pushed theme changes (light/dark mode and preset).
|
|
2092
2201
|
* The initial theme is in `launchContext.theme`. Returns an unsubscribe
|
|
@@ -2110,6 +2219,17 @@ interface MindooDBAppSession {
|
|
|
2110
2219
|
* new BCP-47 language tag (e.g. `"de"`). Returns an unsubscribe function.
|
|
2111
2220
|
*/
|
|
2112
2221
|
onLocaleChange(listener: (locale: string) => void): () => void;
|
|
2222
|
+
/**
|
|
2223
|
+
* Run work before the host tears this launch down, e.g. flushing buffered writes.
|
|
2224
|
+
*
|
|
2225
|
+
* The host waits for all registered listeners to settle, but only for a short grace
|
|
2226
|
+
* period — return quickly and do not start new work here. A rejected listener is logged
|
|
2227
|
+
* and does not stop the teardown. Returns an unsubscribe function.
|
|
2228
|
+
*
|
|
2229
|
+
* This does not fire when the browser tab itself goes away; a crash or a killed tab can
|
|
2230
|
+
* still lose whatever was buffered.
|
|
2231
|
+
*/
|
|
2232
|
+
onBeforeClose(listener: () => void | Promise<void>): () => void;
|
|
2113
2233
|
/**
|
|
2114
2234
|
* Tear down the session: close the bridge port and release all host-side
|
|
2115
2235
|
* resources of this launch (navigators, live queries, streams). The
|
|
@@ -2128,4 +2248,4 @@ interface MindooDBAppBridge {
|
|
|
2128
2248
|
connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
|
|
2129
2249
|
}
|
|
2130
2250
|
|
|
2131
|
-
export { type
|
|
2251
|
+
export { type MindooDBAppConfiguredViewColumnRole as $, type MindooDBAppBridgeErrorPayload as A, type MindooDBAppBridgeHandshakeErrorMessage as B, type MindooDBAppBridgeLocaleChangedMessage as C, type MindooDBAppBridgePortMessage as D, type MindooDBAppBridgeQueryResultMessage as E, type MindooDBAppBridgeRpcError as F, type MindooDBAppBridgeRpcMessage as G, type MindooDBAppBridgeRpcRequest as H, type MindooDBAppBridgeRpcSuccess as I, type MindooDBAppBridgeShortcutInvokedMessage as J, type MindooDBAppBridgeShortcutsChangedMessage as K, type MindooDBAppBridgeStreamAbortRequest as L, type MindooDBAppAttachmentPreviewMode as M, type MindooDBAppBridgeStreamAck as N, type MindooDBAppBridgeStreamCloseRequest as O, type MindooDBAppBridgeStreamError as P, type MindooDBAppBridgeStreamMessage as Q, type MindooDBAppBridgeStreamOpenResult as R, type MindooDBAppBridgeStreamReadRequest as S, type MindooDBAppBridgeStreamWriteRequest as T, type MindooDBAppBridgeThemeChangedMessage as U, type MindooDBAppBridgeUiPreferencesChangedMessage as V, type MindooDBAppBridgeViewChangedMessage as W, type MindooDBAppBridgeViewportChangedMessage as X, type MindooDBAppCapability as Y, type MindooDBAppConfiguredViewCategorizationStyle as Z, type MindooDBAppConfiguredViewColumn as _, type MindooDBAppBridge as a, type MindooDBAppMenuSelectionResult as a$, type MindooDBAppConfiguredViewExpressionMode as a0, type MindooDBAppConfiguredViewFieldExpression as a1, type MindooDBAppConfiguredViewFilterDefinition as a2, type MindooDBAppConfiguredViewFilterMode as a3, type MindooDBAppConfiguredViewFilterRule as a4, type MindooDBAppConfiguredViewFormulaExpression as a5, type MindooDBAppConfiguredViewFormulaFilterDefinition as a6, type MindooDBAppConfiguredViewPreviewMode as a7, type MindooDBAppConfiguredViewRuleFilterDefinition as a8, type MindooDBAppConfiguredViewRuleMatchMode as a9, type MindooDBAppHistoryQuery as aA, type MindooDBAppHostTheme as aB, type MindooDBAppIdentityApi as aC, type MindooDBAppInaccessibleDocument as aD, type MindooDBAppInaccessibleDocumentListQuery as aE, type MindooDBAppInaccessibleDocumentListResult as aF, type MindooDBAppJsonListDeletePatch as aG, type MindooDBAppJsonListInsertPatch as aH, type MindooDBAppJsonPatch as aI, type MindooDBAppJsonSetPatch as aJ, type MindooDBAppJsonTextMarkPatch as aK, type MindooDBAppJsonTextSplicePatch as aL, type MindooDBAppJsonTextUnmarkPatch as aM, type MindooDBAppJsonUnsetPatch as aN, type MindooDBAppLaunchContext as aO, type MindooDBAppLiveQuerySubscription as aP, type MindooDBAppMenuAnchor as aQ, type MindooDBAppMenuApi as aR, type MindooDBAppMenuCommandItem as aS, type MindooDBAppMenuDismissReason as aT, type MindooDBAppMenuDismissedResult as aU, type MindooDBAppMenuItem as aV, type MindooDBAppMenuKind as aW, type MindooDBAppMenuPlacement as aX, type MindooDBAppMenuPointAnchor as aY, type MindooDBAppMenuRect as aZ, type MindooDBAppMenuRectAnchor as a_, type MindooDBAppConfiguredViewRuleOperator as aa, type MindooDBAppConfiguredViewValueExpression as ab, type MindooDBAppCreateDocumentInput as ac, type MindooDBAppCreateKeyInfo as ad, type MindooDBAppCreateViewInput as ae, type MindooDBAppCreateViewNavigatorInput as af, type MindooDBAppDatabaseInfo as ag, type MindooDBAppDirectoryApi as ah, type MindooDBAppDirectoryEntry as ai, type MindooDBAppDocumentApi as aj, type MindooDBAppDocumentHeadCursorResult as ak, type MindooDBAppDocumentHistoryEntry as al, type MindooDBAppDocumentListQuery as am, type MindooDBAppDocumentListResult as an, type MindooDBAppDocumentQuery as ao, type MindooDBAppDocumentRevisionId as ap, type MindooDBAppDocumentScanPreset as aq, type MindooDBAppDocumentSummary as ar, type MindooDBAppEntryAttachmentRef as as, type MindooDBAppEntryProvenance as at, type MindooDBAppExtractDocumentTextInput as au, type MindooDBAppExtractDocumentTextResult as av, type MindooDBAppExtractTextFormat as aw, type MindooDBAppExtractionSetup as ax, type MindooDBAppFulltextSetup as ay, type MindooDBAppHistoricalDocument as az, type MindooDBAppHostShortcutBinding as b, type MindooDBAppMenuSeparatorItem as b0, type MindooDBAppQueryCoverage as b1, type MindooDBAppQueryResult as b2, type MindooDBAppQueryRow as b3, type MindooDBAppQuerySortKey as b4, type MindooDBAppQueryTextClause as b5, type MindooDBAppReadableAttachmentStream as b6, type MindooDBAppRecipientOptions as b7, type MindooDBAppResolvedViewDefinition as b8, type MindooDBAppResolvedViewSource as b9, type MindooDBAppSignPreviewScope as bA, type MindooDBAppSignStatementInput as bB, type MindooDBAppSignStatementResult as bC, type MindooDBAppStorageApi as bD, type MindooDBAppTextEdit as bE, type MindooDBAppTextPatch as bF, type MindooDBAppThemeMode as bG, type MindooDBAppTimestampApi as bH, type MindooDBAppTimestampInput as bI, type MindooDBAppTimestampProvider as bJ, type MindooDBAppTimestampResult as bK, type MindooDBAppUiPreferences as bL, type MindooDBAppUpdateDocumentInput as bM, type MindooDBAppViewCursorDocumentListResult as bN, type MindooDBAppViewCursorResult as bO, type MindooDBAppViewEntry as bP, type MindooDBAppViewEntryKind as bQ, type MindooDBAppViewNavigator as bR, type MindooDBAppViewNavigatorExpansionState as bS, type MindooDBAppViewNavigatorOpenOptions as bT, type MindooDBAppViewNavigatorPageOptions as bU, type MindooDBAppViewNavigatorPageResult as bV, type MindooDBAppViewNavigatorRangeQuery as bW, type MindooDBAppViewNavigatorSelectionState as bX, type MindooDBAppViewUpdateStats as bY, type MindooDBAppViewport as bZ, type MindooDBAppWritableAttachmentStream as b_, type MindooDBAppRevisionPhase as ba, type MindooDBAppRevisionVerification as bb, type MindooDBAppRichTextBlockSpan as bc, type MindooDBAppRichTextGetOptions as bd, type MindooDBAppRichTextImmutableString as be, type MindooDBAppRichTextMarkRange as bf, type MindooDBAppRichTextMaterializeValue as bg, type MindooDBAppRichTextPatch as bh, type MindooDBAppRichTextScalar as bi, type MindooDBAppRichTextSpliceStep as bj, type MindooDBAppRichTextStep as bk, type MindooDBAppRichTextStepPatch as bl, type MindooDBAppRichTextTextSpan as bm, type MindooDBAppRuntime as bn, type MindooDBAppScanAttachmentOptions as bo, type MindooDBAppScanAttachmentResult as bp, type MindooDBAppScopedDocId as bq, type MindooDBAppScopedDocumentSummary as br, type MindooDBAppSealIntent as bs, type MindooDBAppSealedChannelOpenInput as bt, type MindooDBAppSealedChannelOpenResult as bu, type MindooDBAppSealedChannelRequestInput as bv, type MindooDBAppSession as bw, type MindooDBAppShowMenuInput as bx, type MindooDBAppShowMenuResult as by, type MindooDBAppSignPreview as bz, type MindooDBAppHostShortcutAction as c, type MindooDBAppHostingMode as d, type MindooDBAppDatabase as e, type MindooDBAppDocument as f, type MindooDBAppRichTextSpan as g, type MindooDBAppRichTextSnapshot as h, MINDOODB_APP_SEAL_SIGNING_DOMAIN as i, type MindooDBAppAccessDecision as j, type MindooDBAppAccessTier as k, type MindooDBAppAttachmentApi as l, type MindooDBAppAttachmentChunk as m, type MindooDBAppAttachmentInfo as n, type MindooDBAppAttachmentPreviewOptions as o, type MindooDBAppAttachmentPreviewSession as p, type MindooDBAppAutomergeChangesPatch as q, type MindooDBAppAutomergeChangesSince as r, type MindooDBAppAutomergeGetOptions as s, type MindooDBAppAutomergePatchResult as t, type MindooDBAppAutomergeSnapshot as u, type MindooDBAppBridgeBeforeCloseAck as v, type MindooDBAppBridgeBeforeCloseMessage as w, type MindooDBAppBridgeConnectMessage as x, type MindooDBAppBridgeConnectOptions as y, type MindooDBAppBridgeConnectedMessage as z };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { g as MindooDBAppBundleManifest } from '../appBundleManifest-B0xfpaXG.js';
|
|
2
|
+
|
|
3
|
+
interface HavenBundleOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Stable application identifier written to the manifest. Defaults to the `name` field
|
|
6
|
+
* of the project's package.json.
|
|
7
|
+
*/
|
|
8
|
+
appId?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Human-readable version. Defaults to the `version` field of the project's
|
|
11
|
+
* package.json. Informational only — the host keys updates off the content hash.
|
|
12
|
+
*/
|
|
13
|
+
version?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Entry HTML file relative to the build output directory. Auto-detected when omitted:
|
|
16
|
+
* root `index.html`, else a nested `index.html`, else the first HTML file.
|
|
17
|
+
*/
|
|
18
|
+
entry?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Additional exclusion predicate, evaluated with the bundle-relative POSIX path. Return
|
|
21
|
+
* `true` to keep the file out of the bundle.
|
|
22
|
+
*/
|
|
23
|
+
exclude?: (relativePath: string) => boolean;
|
|
24
|
+
/** Skip `.map` files. Defaults to `true` — source maps only bloat the download. */
|
|
25
|
+
excludeSourcemaps?: boolean;
|
|
26
|
+
}
|
|
27
|
+
interface ResolvedViteConfig {
|
|
28
|
+
root: string;
|
|
29
|
+
build: {
|
|
30
|
+
outDir: string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/** Structural subset of Vite's `Plugin`, so the SDK does not need to depend on Vite. */
|
|
34
|
+
interface HavenBundleVitePlugin {
|
|
35
|
+
name: string;
|
|
36
|
+
apply: "build";
|
|
37
|
+
configResolved: (config: ResolvedViteConfig) => void;
|
|
38
|
+
closeBundle: () => Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Emits `haven-bundle.json` and `haven-bundle.zip` next to the build output so a MindooDB
|
|
42
|
+
* host can install and update the app from a URL.
|
|
43
|
+
*/
|
|
44
|
+
declare function havenBundle(options?: HavenBundleOptions): HavenBundleVitePlugin;
|
|
45
|
+
|
|
46
|
+
export { type HavenBundleOptions, type HavenBundleVitePlugin, havenBundle };
|