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/index.js
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_HAVEN_HOST_SHORTCUTS,
|
|
3
|
+
applyHostedDocumentOverscrollContain,
|
|
4
|
+
createMindooDBAppBridge,
|
|
5
|
+
installHostShortcutCapture,
|
|
6
|
+
isHostShortcutAction,
|
|
7
|
+
matchHostShortcut,
|
|
8
|
+
releaseMindooDBAppBridgeSessions,
|
|
9
|
+
sanitizeHostShortcutBindings
|
|
10
|
+
} from "./chunk-7RAKZZA6.js";
|
|
11
|
+
import {
|
|
12
|
+
MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME,
|
|
13
|
+
MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME,
|
|
14
|
+
MINDOODB_APP_BUNDLE_MANIFEST_FORMAT,
|
|
15
|
+
MINDOODB_APP_BUNDLE_MANIFEST_VERSION,
|
|
16
|
+
buildMindooDBAppBundleContentHashInput,
|
|
17
|
+
isMindooDBAppBundleHash,
|
|
18
|
+
normalizeMindooDBAppBundlePath,
|
|
19
|
+
validateMindooDBAppBundleManifest
|
|
20
|
+
} from "./chunk-LT4FK6LU.js";
|
|
21
|
+
|
|
1
22
|
// src/types.ts
|
|
2
23
|
var MINDOODB_APP_SEAL_SIGNING_DOMAIN = "mindoodb-seal/v1";
|
|
3
24
|
|
|
@@ -85,1212 +106,294 @@ function expandAbbreviatedName(value) {
|
|
|
85
106
|
}).join("/");
|
|
86
107
|
}
|
|
87
108
|
|
|
88
|
-
// src/client/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (typeof value === "function") {
|
|
95
|
-
throw new Error("Bridge RPC params cannot include functions.");
|
|
96
|
-
}
|
|
97
|
-
if (typeof value === "symbol") {
|
|
98
|
-
throw new Error("Bridge RPC params cannot include symbols.");
|
|
99
|
-
}
|
|
100
|
-
if (value === null || typeof value !== "object") {
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
if (value instanceof Date) {
|
|
104
|
-
return new Date(value.getTime());
|
|
109
|
+
// src/client/hosting.ts
|
|
110
|
+
var MINDOODB_APP_HOSTING_QUERY_PARAM = "mindoodbAppHosting";
|
|
111
|
+
function readMindooDBAppHostingMode(search) {
|
|
112
|
+
const raw = search ?? (typeof window === "undefined" ? "" : window.location.search);
|
|
113
|
+
if (!raw) {
|
|
114
|
+
return "external";
|
|
105
115
|
}
|
|
106
|
-
|
|
107
|
-
return
|
|
116
|
+
try {
|
|
117
|
+
return new URLSearchParams(raw).get(MINDOODB_APP_HOSTING_QUERY_PARAM) === "hosted" ? "hosted" : "external";
|
|
118
|
+
} catch {
|
|
119
|
+
return "external";
|
|
108
120
|
}
|
|
109
|
-
if (ArrayBuffer.isView(value)) {
|
|
110
|
-
return new Uint8Array(value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength));
|
|
111
|
-
}
|
|
112
|
-
if (seen.has(value)) {
|
|
113
|
-
return seen.get(value);
|
|
114
|
-
}
|
|
115
|
-
if (Array.isArray(value)) {
|
|
116
|
-
const copy2 = [];
|
|
117
|
-
seen.set(value, copy2);
|
|
118
|
-
for (const entry of value) {
|
|
119
|
-
copy2.push(normalizeRpcValue(entry, seen));
|
|
120
|
-
}
|
|
121
|
-
return copy2;
|
|
122
|
-
}
|
|
123
|
-
const copy = {};
|
|
124
|
-
seen.set(value, copy);
|
|
125
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
126
|
-
copy[key] = normalizeRpcValue(entry, seen);
|
|
127
|
-
}
|
|
128
|
-
return copy;
|
|
129
|
-
}
|
|
130
|
-
function toBridgeError(error) {
|
|
131
|
-
const wrapped = new Error(error.message);
|
|
132
|
-
wrapped.name = error.code || "MindooDBAppBridgeError";
|
|
133
|
-
return wrapped;
|
|
134
121
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
return "id" in message && typeof message.id === "string";
|
|
122
|
+
function isHostedBundleRuntime(search) {
|
|
123
|
+
return readMindooDBAppHostingMode(search) === "hosted";
|
|
140
124
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
125
|
+
|
|
126
|
+
// src/client/havenStorageShim.ts
|
|
127
|
+
var DEFAULT_QUOTA_BYTES = 256 * 1024;
|
|
128
|
+
var DEFAULT_MAX_VALUE_BYTES = 64 * 1024;
|
|
129
|
+
var DEFAULT_COALESCE_MS = 200;
|
|
130
|
+
var DEFAULT_TIMEOUT_MS = 2e3;
|
|
131
|
+
var MAX_COALESCE_MULTIPLIER = 5;
|
|
132
|
+
var textEncoder = typeof TextEncoder === "undefined" ? null : new TextEncoder();
|
|
133
|
+
function byteLength(value) {
|
|
134
|
+
return textEncoder ? textEncoder.encode(value).byteLength : value.length;
|
|
135
|
+
}
|
|
136
|
+
function createQuotaExceededError(message) {
|
|
137
|
+
if (typeof DOMException === "function") {
|
|
138
|
+
return new DOMException(message, "QuotaExceededError");
|
|
139
|
+
}
|
|
140
|
+
const error = new Error(message);
|
|
141
|
+
error.name = "QuotaExceededError";
|
|
142
|
+
return error;
|
|
145
143
|
}
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (this.disposed) {
|
|
161
|
-
throw new Error("The bridge connection has already been closed.");
|
|
162
|
-
}
|
|
163
|
-
const normalizedParams = normalizeRpcValue(params);
|
|
164
|
-
const id = `${Date.now()}-${this.requestCounter += 1}`;
|
|
165
|
-
const message = {
|
|
166
|
-
protocol: PROTOCOL,
|
|
167
|
-
kind: "request",
|
|
168
|
-
id,
|
|
169
|
-
method,
|
|
170
|
-
params: normalizedParams
|
|
171
|
-
};
|
|
172
|
-
return await new Promise((resolve, reject) => {
|
|
173
|
-
this.pending.set(id, { resolve, reject });
|
|
174
|
-
try {
|
|
175
|
-
this.port.postMessage(message);
|
|
176
|
-
} catch (error) {
|
|
177
|
-
this.pending.delete(id);
|
|
178
|
-
console.error("MindooDB app bridge RPC postMessage failed.", { method, params: normalizedParams, error });
|
|
179
|
-
reject(error instanceof Error ? error : new Error(String(error)));
|
|
144
|
+
var STORAGE_MEMBERS = ["length", "key", "getItem", "setItem", "removeItem", "clear"];
|
|
145
|
+
function createStorageBackend(options) {
|
|
146
|
+
const entries = /* @__PURE__ */ new Map();
|
|
147
|
+
let persistedBytes = 0;
|
|
148
|
+
function entrySize(key, value) {
|
|
149
|
+
return byteLength(key) + byteLength(value);
|
|
150
|
+
}
|
|
151
|
+
function write(key, value, { fromHost }) {
|
|
152
|
+
const persisted = options.isPersisted(key);
|
|
153
|
+
if (persisted && !fromHost) {
|
|
154
|
+
if (byteLength(value) > options.maxValueBytes) {
|
|
155
|
+
throw createQuotaExceededError(
|
|
156
|
+
`Value for "${key}" exceeds the ${options.maxValueBytes} byte per-value limit.`
|
|
157
|
+
);
|
|
180
158
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
159
|
+
const previous = entries.get(key);
|
|
160
|
+
const delta = entrySize(key, value) - (previous === void 0 ? 0 : entrySize(key, previous));
|
|
161
|
+
if (persistedBytes + delta > options.quotaBytes) {
|
|
162
|
+
throw createQuotaExceededError(
|
|
163
|
+
`Storing "${key}" would exceed the ${options.quotaBytes} byte storage quota.`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
persistedBytes += delta;
|
|
167
|
+
} else if (persisted) {
|
|
168
|
+
const previous = entries.get(key);
|
|
169
|
+
persistedBytes += entrySize(key, value) - (previous === void 0 ? 0 : entrySize(key, previous));
|
|
187
170
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
this.pending.forEach(({ reject }) => reject(new Error("The bridge connection was closed.")));
|
|
192
|
-
this.pending.clear();
|
|
193
|
-
this.listeners.clear();
|
|
194
|
-
}
|
|
195
|
-
/** Subscribes to all protocol messages, including attachment stream traffic. */
|
|
196
|
-
addMessageListener(listener) {
|
|
197
|
-
this.listeners.add(listener);
|
|
198
|
-
return () => {
|
|
199
|
-
this.listeners.delete(listener);
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
/** Posts a raw protocol message over the port, optionally with transferables. */
|
|
203
|
-
postMessage(message, transfer = []) {
|
|
204
|
-
if (this.disposed) {
|
|
205
|
-
throw new Error("The bridge connection has already been closed.");
|
|
206
|
-
}
|
|
207
|
-
try {
|
|
208
|
-
this.port.postMessage(message, transfer);
|
|
209
|
-
} catch (error) {
|
|
210
|
-
console.error("MindooDB app bridge raw postMessage failed.", { message, transferCount: transfer.length, error });
|
|
211
|
-
throw error;
|
|
171
|
+
entries.set(key, value);
|
|
172
|
+
if (persisted && !fromHost) {
|
|
173
|
+
options.onPersistedChange(key, value);
|
|
212
174
|
}
|
|
213
175
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (
|
|
176
|
+
function remove(key, { fromHost }) {
|
|
177
|
+
const previous = entries.get(key);
|
|
178
|
+
if (previous === void 0) {
|
|
217
179
|
return;
|
|
218
180
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
const pending = this.pending.get(message.id);
|
|
228
|
-
if (!pending) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
this.pending.delete(message.id);
|
|
232
|
-
if (message.kind === "success") {
|
|
233
|
-
pending.resolve(message.result);
|
|
234
|
-
return;
|
|
181
|
+
entries.delete(key);
|
|
182
|
+
if (options.isPersisted(key)) {
|
|
183
|
+
persistedBytes -= entrySize(key, previous);
|
|
184
|
+
if (!fromHost) {
|
|
185
|
+
options.onPersistedChange(key, null);
|
|
186
|
+
}
|
|
235
187
|
}
|
|
236
|
-
pending.reject(toBridgeError(message.error));
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
// src/client/createMindooDBAppBridge.ts
|
|
241
|
-
var PROTOCOL2 = "mindoodb-app-bridge";
|
|
242
|
-
var DEFAULT_CONNECT_TIMEOUT_MS = 1e4;
|
|
243
|
-
function isMethodNotFoundError(error) {
|
|
244
|
-
return error instanceof Error && error.name === "method-not-found";
|
|
245
|
-
}
|
|
246
|
-
function toTransferableArrayBuffer(chunk) {
|
|
247
|
-
return chunk.buffer.slice(
|
|
248
|
-
chunk.byteOffset,
|
|
249
|
-
chunk.byteOffset + chunk.byteLength
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
function isStreamChunkFor(streamId, message) {
|
|
253
|
-
return message.kind === "stream-chunk" && message.streamId === streamId;
|
|
254
|
-
}
|
|
255
|
-
function isStreamAckFor(streamId, message) {
|
|
256
|
-
return message.kind === "stream-ack" && message.streamId === streamId;
|
|
257
|
-
}
|
|
258
|
-
function isStreamErrorFor(streamId, message) {
|
|
259
|
-
return message.kind === "stream-error" && message.streamId === streamId;
|
|
260
|
-
}
|
|
261
|
-
function isQueryResultFor(subscriptionId, message) {
|
|
262
|
-
return message.kind === "query-result" && message.subscriptionId === subscriptionId;
|
|
263
|
-
}
|
|
264
|
-
function isViewChangedFor(navigatorId, message) {
|
|
265
|
-
return message.kind === "view-changed" && message.navigatorId === navigatorId;
|
|
266
|
-
}
|
|
267
|
-
function normalizeDocumentQuery(query) {
|
|
268
|
-
if (!query) {
|
|
269
|
-
return {};
|
|
270
188
|
}
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
189
|
+
const target = {
|
|
190
|
+
get length() {
|
|
191
|
+
return entries.size;
|
|
192
|
+
},
|
|
193
|
+
key(index) {
|
|
194
|
+
return [...entries.keys()][index] ?? null;
|
|
195
|
+
},
|
|
196
|
+
getItem(key) {
|
|
197
|
+
const value = entries.get(String(key));
|
|
198
|
+
return value === void 0 ? null : value;
|
|
199
|
+
},
|
|
200
|
+
setItem(key, value) {
|
|
201
|
+
write(String(key), String(value), { fromHost: false });
|
|
202
|
+
},
|
|
203
|
+
removeItem(key) {
|
|
204
|
+
remove(String(key), { fromHost: false });
|
|
205
|
+
},
|
|
206
|
+
clear() {
|
|
207
|
+
[...entries.keys()].forEach((key) => remove(key, { fromHost: false }));
|
|
208
|
+
}
|
|
277
209
|
};
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return message.kind === "viewport-changed";
|
|
284
|
-
}
|
|
285
|
-
function isUiPreferencesChangedMessage(message) {
|
|
286
|
-
return message.kind === "ui-preferences-changed";
|
|
287
|
-
}
|
|
288
|
-
function isLocaleChangedMessage(message) {
|
|
289
|
-
return message.kind === "locale-changed";
|
|
290
|
-
}
|
|
291
|
-
function toStreamError(message) {
|
|
292
|
-
const error = new Error(message.error.message);
|
|
293
|
-
error.name = message.error.code || "MindooDBAppBridgeStreamError";
|
|
294
|
-
return error;
|
|
295
|
-
}
|
|
296
|
-
function resolveLaunchId(options) {
|
|
297
|
-
if (options?.launchId) {
|
|
298
|
-
return options.launchId;
|
|
299
|
-
}
|
|
300
|
-
if (typeof window === "undefined") {
|
|
301
|
-
throw new Error(
|
|
302
|
-
"A launchId must be provided when connecting outside the browser."
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
const search = new URLSearchParams(window.location.search);
|
|
306
|
-
const launchId = search.get("mindoodbAppLaunchId");
|
|
307
|
-
if (!launchId) {
|
|
308
|
-
throw new Error("Missing mindoodbAppLaunchId in the current URL.");
|
|
309
|
-
}
|
|
310
|
-
return launchId;
|
|
311
|
-
}
|
|
312
|
-
function shouldUseWindowedHostTab() {
|
|
313
|
-
if (typeof window === "undefined") {
|
|
314
|
-
return false;
|
|
315
|
-
}
|
|
316
|
-
return window.parent === window && Boolean(window.opener);
|
|
317
|
-
}
|
|
318
|
-
function resolveTargetWindow() {
|
|
319
|
-
if (typeof window === "undefined") {
|
|
320
|
-
throw new Error(
|
|
321
|
-
"The MindooDB app bridge is only available in the browser."
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
if (window.parent && window.parent !== window) {
|
|
325
|
-
return window.parent;
|
|
326
|
-
}
|
|
327
|
-
if (window.opener) {
|
|
328
|
-
return window.opener;
|
|
329
|
-
}
|
|
330
|
-
throw new Error("Could not find a MindooDB Haven host window.");
|
|
331
|
-
}
|
|
332
|
-
function waitForConnectedPort(options, launchId) {
|
|
333
|
-
const targetWindow = resolveTargetWindow();
|
|
334
|
-
const targetOrigin = options?.targetOrigin ?? "*";
|
|
335
|
-
const channel = new MessageChannel();
|
|
336
|
-
const timeoutMs = options?.connectTimeoutMs ?? DEFAULT_CONNECT_TIMEOUT_MS;
|
|
337
|
-
return new Promise((resolve, reject) => {
|
|
338
|
-
let timeoutId = null;
|
|
339
|
-
const cleanup = () => {
|
|
340
|
-
if (timeoutId !== null) {
|
|
341
|
-
window.clearTimeout(timeoutId);
|
|
210
|
+
const memberNames = new Set(STORAGE_MEMBERS);
|
|
211
|
+
const storage = new Proxy(target, {
|
|
212
|
+
get(proxyTarget, property, receiver) {
|
|
213
|
+
if (typeof property === "symbol" || memberNames.has(property)) {
|
|
214
|
+
return Reflect.get(proxyTarget, property, receiver);
|
|
342
215
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
)
|
|
347
|
-
|
|
348
|
-
const handleMessage = (event) => {
|
|
349
|
-
const payload = event.data;
|
|
350
|
-
if (!payload || payload.protocol !== PROTOCOL2) {
|
|
351
|
-
return;
|
|
216
|
+
return entries.get(property);
|
|
217
|
+
},
|
|
218
|
+
set(proxyTarget, property, value, receiver) {
|
|
219
|
+
if (typeof property === "symbol" || memberNames.has(property)) {
|
|
220
|
+
return Reflect.set(proxyTarget, property, value, receiver);
|
|
352
221
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
222
|
+
write(property, String(value), { fromHost: false });
|
|
223
|
+
return true;
|
|
224
|
+
},
|
|
225
|
+
has(proxyTarget, property) {
|
|
226
|
+
if (typeof property === "symbol" || memberNames.has(property)) {
|
|
227
|
+
return Reflect.has(proxyTarget, property);
|
|
357
228
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
229
|
+
return entries.has(property);
|
|
230
|
+
},
|
|
231
|
+
deleteProperty(proxyTarget, property) {
|
|
232
|
+
if (typeof property === "symbol" || memberNames.has(property)) {
|
|
233
|
+
return Reflect.deleteProperty(proxyTarget, property);
|
|
363
234
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}, timeoutMs);
|
|
374
|
-
channel.port1.addEventListener("message", handleMessage);
|
|
375
|
-
channel.port1.start();
|
|
376
|
-
const message = {
|
|
377
|
-
protocol: PROTOCOL2,
|
|
378
|
-
type: "mindoodb-app:connect",
|
|
379
|
-
launchId
|
|
380
|
-
};
|
|
381
|
-
targetWindow.postMessage(message, targetOrigin, [channel.port2]);
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
var MindooDBAppViewNavigatorImpl = class {
|
|
385
|
-
constructor(rpc, navigatorId, viewCursor) {
|
|
386
|
-
this.rpc = rpc;
|
|
387
|
-
this.navigatorId = navigatorId;
|
|
388
|
-
this.viewCursor = viewCursor;
|
|
389
|
-
}
|
|
390
|
-
rpc;
|
|
391
|
-
navigatorId;
|
|
392
|
-
viewCursor;
|
|
393
|
-
/** Shorthand: call an RPC method with the navigator ID automatically injected. */
|
|
394
|
-
async call(method, params = {}) {
|
|
395
|
-
return await this.rpc.call(method, {
|
|
396
|
-
navigatorId: this.navigatorId,
|
|
397
|
-
...params
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
async getDefinition() {
|
|
401
|
-
return await this.call("viewNavigators.getDefinition");
|
|
402
|
-
}
|
|
403
|
-
async getViewCursor() {
|
|
404
|
-
return this.viewCursor;
|
|
405
|
-
}
|
|
406
|
-
async refresh() {
|
|
407
|
-
const result = await this.call(
|
|
408
|
-
"viewNavigators.refresh"
|
|
409
|
-
);
|
|
410
|
-
this.viewCursor = result.viewCursor;
|
|
411
|
-
return this.viewCursor;
|
|
412
|
-
}
|
|
413
|
-
onDidUpdate(listener) {
|
|
414
|
-
return this.rpc.addMessageListener((message) => {
|
|
415
|
-
if (isViewChangedFor(this.navigatorId, message)) {
|
|
416
|
-
listener(message.stats);
|
|
235
|
+
remove(property, { fromHost: false });
|
|
236
|
+
return true;
|
|
237
|
+
},
|
|
238
|
+
ownKeys() {
|
|
239
|
+
return [...entries.keys()];
|
|
240
|
+
},
|
|
241
|
+
getOwnPropertyDescriptor(proxyTarget, property) {
|
|
242
|
+
if (typeof property === "symbol" || memberNames.has(property)) {
|
|
243
|
+
return Reflect.getOwnPropertyDescriptor(proxyTarget, property);
|
|
417
244
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
return await this.call("viewNavigators.current.get");
|
|
422
|
-
}
|
|
423
|
-
async gotoFirst() {
|
|
424
|
-
return await this.call("viewNavigators.goto.first");
|
|
425
|
-
}
|
|
426
|
-
async gotoLast() {
|
|
427
|
-
return await this.call("viewNavigators.goto.last");
|
|
428
|
-
}
|
|
429
|
-
async gotoNext() {
|
|
430
|
-
return await this.call("viewNavigators.goto.next");
|
|
431
|
-
}
|
|
432
|
-
async gotoPrev() {
|
|
433
|
-
return await this.call("viewNavigators.goto.prev");
|
|
434
|
-
}
|
|
435
|
-
async gotoNextSibling() {
|
|
436
|
-
return await this.call("viewNavigators.goto.nextSibling");
|
|
437
|
-
}
|
|
438
|
-
async gotoPrevSibling() {
|
|
439
|
-
return await this.call("viewNavigators.goto.prevSibling");
|
|
440
|
-
}
|
|
441
|
-
async gotoParent() {
|
|
442
|
-
return await this.call("viewNavigators.goto.parent");
|
|
443
|
-
}
|
|
444
|
-
async gotoFirstChild() {
|
|
445
|
-
return await this.call("viewNavigators.goto.firstChild");
|
|
446
|
-
}
|
|
447
|
-
async gotoLastChild() {
|
|
448
|
-
return await this.call("viewNavigators.goto.lastChild");
|
|
449
|
-
}
|
|
450
|
-
async gotoPos(position) {
|
|
451
|
-
return await this.call("viewNavigators.goto.pos", { position });
|
|
452
|
-
}
|
|
453
|
-
async getPos(position) {
|
|
454
|
-
return await this.call("viewNavigators.pos.get", { position });
|
|
455
|
-
}
|
|
456
|
-
async findCategoryEntryByParts(parts) {
|
|
457
|
-
return await this.call("viewNavigators.category.findByParts", { parts });
|
|
458
|
-
}
|
|
459
|
-
async entriesForward(options) {
|
|
460
|
-
return await this.call("viewNavigators.entries.forward", {
|
|
461
|
-
options: options ?? {}
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
async entriesBackward(options) {
|
|
465
|
-
return await this.call("viewNavigators.entries.backward", {
|
|
466
|
-
options: options ?? {}
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
async gotoNextSelected() {
|
|
470
|
-
return await this.call("viewNavigators.goto.nextSelected");
|
|
471
|
-
}
|
|
472
|
-
async gotoPrevSelected() {
|
|
473
|
-
return await this.call("viewNavigators.goto.prevSelected");
|
|
474
|
-
}
|
|
475
|
-
async select(origin, docId, selectParentCategories) {
|
|
476
|
-
await this.call("viewNavigators.selection.select", {
|
|
477
|
-
origin,
|
|
478
|
-
docId,
|
|
479
|
-
selectParentCategories
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
async deselect(origin, docId) {
|
|
483
|
-
await this.call("viewNavigators.selection.deselect", { origin, docId });
|
|
484
|
-
}
|
|
485
|
-
async selectAllEntries() {
|
|
486
|
-
await this.call("viewNavigators.selection.selectAll");
|
|
487
|
-
}
|
|
488
|
-
async deselectAllEntries() {
|
|
489
|
-
await this.call("viewNavigators.selection.deselectAll");
|
|
490
|
-
}
|
|
491
|
-
async isSelected(origin, docId) {
|
|
492
|
-
return await this.call("viewNavigators.selection.isSelected", {
|
|
493
|
-
origin,
|
|
494
|
-
docId
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
async getSelectionState() {
|
|
498
|
-
return await this.call("viewNavigators.selection.get");
|
|
499
|
-
}
|
|
500
|
-
async setSelectionState(state) {
|
|
501
|
-
await this.call("viewNavigators.selection.set", { state });
|
|
502
|
-
}
|
|
503
|
-
async expand(origin, docId) {
|
|
504
|
-
await this.call("viewNavigators.expansion.expand", { origin, docId });
|
|
505
|
-
}
|
|
506
|
-
async collapse(origin, docId) {
|
|
507
|
-
await this.call("viewNavigators.expansion.collapse", { origin, docId });
|
|
508
|
-
}
|
|
509
|
-
async expandAll() {
|
|
510
|
-
await this.call("viewNavigators.expansion.expandAll");
|
|
511
|
-
}
|
|
512
|
-
async collapseAll() {
|
|
513
|
-
await this.call("viewNavigators.expansion.collapseAll");
|
|
514
|
-
}
|
|
515
|
-
async expandToLevel(level) {
|
|
516
|
-
await this.call("viewNavigators.expansion.expandToLevel", { level });
|
|
517
|
-
}
|
|
518
|
-
async isExpanded(entryKey) {
|
|
519
|
-
return await this.call("viewNavigators.expansion.isExpanded", { entryKey });
|
|
520
|
-
}
|
|
521
|
-
async getExpansionState() {
|
|
522
|
-
return await this.call("viewNavigators.expansion.get");
|
|
523
|
-
}
|
|
524
|
-
async setExpansionState(state) {
|
|
525
|
-
await this.call("viewNavigators.expansion.set", { state });
|
|
526
|
-
}
|
|
527
|
-
async childEntries(entryKey, descending) {
|
|
528
|
-
return await this.call("viewNavigators.children.entries", {
|
|
529
|
-
entryKey,
|
|
530
|
-
descending
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
async childCategories(entryKey, descending) {
|
|
534
|
-
return await this.call("viewNavigators.children.categories", {
|
|
535
|
-
entryKey,
|
|
536
|
-
descending
|
|
537
|
-
});
|
|
538
|
-
}
|
|
539
|
-
async childDocuments(entryKey, descending) {
|
|
540
|
-
return await this.call("viewNavigators.children.documents", {
|
|
541
|
-
entryKey,
|
|
542
|
-
descending
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
async childCategoriesByKey(entryKey, key, exact, descending) {
|
|
546
|
-
return await this.call("viewNavigators.children.categoriesByKey", {
|
|
547
|
-
entryKey,
|
|
548
|
-
key,
|
|
549
|
-
exact,
|
|
550
|
-
descending
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
async childDocumentsByKey(entryKey, key, exact, descending) {
|
|
554
|
-
return await this.call("viewNavigators.children.documentsByKey", {
|
|
555
|
-
entryKey,
|
|
556
|
-
key,
|
|
557
|
-
exact,
|
|
558
|
-
descending
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
async childCategoriesBetween(entryKey, range) {
|
|
562
|
-
return await this.call("viewNavigators.children.categoriesBetween", {
|
|
563
|
-
entryKey,
|
|
564
|
-
range
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
async childDocumentsBetween(entryKey, range) {
|
|
568
|
-
return await this.call("viewNavigators.children.documentsBetween", {
|
|
569
|
-
entryKey,
|
|
570
|
-
range
|
|
571
|
-
});
|
|
572
|
-
}
|
|
573
|
-
async getSortedDocIds(descending) {
|
|
574
|
-
return await this.call(
|
|
575
|
-
"viewNavigators.sortedDocIds.get",
|
|
576
|
-
{ descending }
|
|
577
|
-
);
|
|
578
|
-
}
|
|
579
|
-
async getSortedDocIdsScoped(entryKey, descending) {
|
|
580
|
-
return await this.call(
|
|
581
|
-
"viewNavigators.sortedDocIds.scoped",
|
|
582
|
-
{ entryKey, descending }
|
|
583
|
-
);
|
|
584
|
-
}
|
|
585
|
-
async dispose() {
|
|
586
|
-
await this.call("viewNavigators.dispose");
|
|
587
|
-
}
|
|
588
|
-
};
|
|
589
|
-
var MindooDBAppReadableAttachmentStreamImpl = class {
|
|
590
|
-
constructor(rpc, streamId) {
|
|
591
|
-
this.rpc = rpc;
|
|
592
|
-
this.streamId = streamId;
|
|
593
|
-
this.unsubscribe = this.rpc.addMessageListener((message) => {
|
|
594
|
-
if (isStreamChunkFor(this.streamId, message)) {
|
|
595
|
-
const pending = this.pendingRead;
|
|
596
|
-
this.pendingRead = null;
|
|
597
|
-
if (!pending) {
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
pending.resolve(
|
|
601
|
-
message.done ? null : new Uint8Array(message.chunk ?? new ArrayBuffer(0))
|
|
602
|
-
);
|
|
603
|
-
if (message.done) {
|
|
604
|
-
this.closed = true;
|
|
605
|
-
this.unsubscribe();
|
|
606
|
-
}
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
if (isStreamErrorFor(this.streamId, message)) {
|
|
610
|
-
const pending = this.pendingRead;
|
|
611
|
-
this.pendingRead = null;
|
|
612
|
-
pending?.reject(toStreamError(message));
|
|
613
|
-
this.closed = true;
|
|
614
|
-
this.unsubscribe();
|
|
245
|
+
const value = entries.get(property);
|
|
246
|
+
if (value === void 0) {
|
|
247
|
+
return void 0;
|
|
615
248
|
}
|
|
616
|
-
|
|
617
|
-
}
|
|
618
|
-
rpc;
|
|
619
|
-
streamId;
|
|
620
|
-
unsubscribe;
|
|
621
|
-
closed = false;
|
|
622
|
-
pendingRead = null;
|
|
623
|
-
/** Requests and returns the next attachment chunk, or `null` when the stream ends. */
|
|
624
|
-
async read() {
|
|
625
|
-
if (this.closed) {
|
|
626
|
-
return null;
|
|
627
|
-
}
|
|
628
|
-
if (this.pendingRead) {
|
|
629
|
-
throw new Error(
|
|
630
|
-
"A read() call is already in progress for this attachment stream."
|
|
631
|
-
);
|
|
632
|
-
}
|
|
633
|
-
return await new Promise((resolve, reject) => {
|
|
634
|
-
this.pendingRead = { resolve, reject };
|
|
635
|
-
this.rpc.postMessage({
|
|
636
|
-
protocol: PROTOCOL2,
|
|
637
|
-
kind: "stream-read",
|
|
638
|
-
streamId: this.streamId
|
|
639
|
-
});
|
|
640
|
-
});
|
|
641
|
-
}
|
|
642
|
-
/** Closes the read stream and releases any pending read waiter. */
|
|
643
|
-
async close() {
|
|
644
|
-
if (this.closed) {
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
this.closed = true;
|
|
648
|
-
this.pendingRead?.resolve(null);
|
|
649
|
-
this.pendingRead = null;
|
|
650
|
-
this.rpc.postMessage({
|
|
651
|
-
protocol: PROTOCOL2,
|
|
652
|
-
kind: "stream-close",
|
|
653
|
-
streamId: this.streamId
|
|
654
|
-
});
|
|
655
|
-
this.unsubscribe();
|
|
656
|
-
}
|
|
657
|
-
};
|
|
658
|
-
var MindooDBAppWritableAttachmentStreamImpl = class {
|
|
659
|
-
constructor(rpc, streamId) {
|
|
660
|
-
this.rpc = rpc;
|
|
661
|
-
this.streamId = streamId;
|
|
662
|
-
this.unsubscribe = this.rpc.addMessageListener((message) => {
|
|
663
|
-
if (isStreamAckFor(this.streamId, message)) {
|
|
664
|
-
const inflight = this.inflight;
|
|
665
|
-
this.inflight = null;
|
|
666
|
-
inflight?.resolve();
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
if (isStreamErrorFor(this.streamId, message)) {
|
|
670
|
-
const inflight = this.inflight;
|
|
671
|
-
this.inflight = null;
|
|
672
|
-
inflight?.reject(toStreamError(message));
|
|
673
|
-
this.closed = true;
|
|
674
|
-
this.unsubscribe();
|
|
675
|
-
}
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
rpc;
|
|
679
|
-
streamId;
|
|
680
|
-
unsubscribe;
|
|
681
|
-
closed = false;
|
|
682
|
-
inflight = null;
|
|
683
|
-
queue = Promise.resolve();
|
|
684
|
-
/** Ensures write/close/abort operations run strictly in order. */
|
|
685
|
-
enqueue(operation) {
|
|
686
|
-
const next = this.queue.then(operation);
|
|
687
|
-
this.queue = next.catch(() => void 0);
|
|
688
|
-
return next;
|
|
689
|
-
}
|
|
690
|
-
/** Sends one stream operation and waits for its ack/error response. */
|
|
691
|
-
async waitForAck(send) {
|
|
692
|
-
return await new Promise((resolve, reject) => {
|
|
693
|
-
this.inflight = { resolve, reject };
|
|
694
|
-
send();
|
|
695
|
-
});
|
|
696
|
-
}
|
|
697
|
-
/** Writes one binary chunk to the host-managed attachment stream. */
|
|
698
|
-
async write(chunk) {
|
|
699
|
-
if (this.closed) {
|
|
700
|
-
throw new Error("The attachment write stream is already closed.");
|
|
249
|
+
return { value, writable: true, enumerable: true, configurable: true };
|
|
701
250
|
}
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
streamId: this.streamId,
|
|
710
|
-
chunk: buffer
|
|
711
|
-
},
|
|
712
|
-
[buffer]
|
|
713
|
-
);
|
|
251
|
+
});
|
|
252
|
+
return {
|
|
253
|
+
storage,
|
|
254
|
+
/** Seeds values from the host without counting them as app-initiated writes. */
|
|
255
|
+
hydrate(values) {
|
|
256
|
+
Object.entries(values).forEach(([key, value]) => {
|
|
257
|
+
write(key, value, { fromHost: true });
|
|
714
258
|
});
|
|
715
|
-
});
|
|
716
|
-
}
|
|
717
|
-
/** Gracefully closes the write stream after any queued writes complete. */
|
|
718
|
-
async close() {
|
|
719
|
-
if (this.closed) {
|
|
720
|
-
return;
|
|
721
259
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
this.unsubscribe();
|
|
733
|
-
}
|
|
734
|
-
/** Aborts the write stream after any in-flight work has settled. */
|
|
735
|
-
async abort() {
|
|
736
|
-
if (this.closed) {
|
|
737
|
-
return;
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function replaceGlobal(name, value) {
|
|
263
|
+
const previous = Object.getOwnPropertyDescriptor(window, name);
|
|
264
|
+
Object.defineProperty(window, name, { value, configurable: true, writable: false });
|
|
265
|
+
return () => {
|
|
266
|
+
if (previous) {
|
|
267
|
+
Object.defineProperty(window, name, previous);
|
|
268
|
+
} else {
|
|
269
|
+
Reflect.deleteProperty(window, name);
|
|
738
270
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
});
|
|
749
|
-
this.unsubscribe();
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
var MindooDBAppDatabaseImpl = class {
|
|
753
|
-
constructor(rpc, databaseId) {
|
|
754
|
-
this.rpc = rpc;
|
|
755
|
-
this.databaseId = databaseId;
|
|
756
|
-
this.documents = {
|
|
757
|
-
list: async (query) => await this.rpc.call("documents.list", {
|
|
758
|
-
databaseId: this.databaseId,
|
|
759
|
-
query: query ?? {}
|
|
760
|
-
}),
|
|
761
|
-
listInaccessible: async (query) => await this.rpc.call("documents.listInaccessible", {
|
|
762
|
-
databaseId: this.databaseId,
|
|
763
|
-
query: query ?? {}
|
|
764
|
-
}),
|
|
765
|
-
query: async (query) => await this.rpc.call("documents.query", {
|
|
766
|
-
databaseId: this.databaseId,
|
|
767
|
-
query: normalizeDocumentQuery(query)
|
|
768
|
-
}),
|
|
769
|
-
liveQuery: async (query, onResult) => {
|
|
770
|
-
const { subscriptionId, result } = await this.rpc.call("documents.liveQuery.subscribe", {
|
|
771
|
-
databaseId: this.databaseId,
|
|
772
|
-
query: normalizeDocumentQuery(query)
|
|
773
|
-
});
|
|
774
|
-
let disposed = false;
|
|
775
|
-
const unsubscribe = this.rpc.addMessageListener((message) => {
|
|
776
|
-
if (!disposed && isQueryResultFor(subscriptionId, message)) {
|
|
777
|
-
onResult(message.result);
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
onResult(result);
|
|
781
|
-
const subscription = {
|
|
782
|
-
refresh: async () => {
|
|
783
|
-
if (disposed) {
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
await this.rpc.call("documents.liveQuery.refresh", {
|
|
787
|
-
subscriptionId
|
|
788
|
-
});
|
|
789
|
-
},
|
|
790
|
-
dispose: async () => {
|
|
791
|
-
if (disposed) {
|
|
792
|
-
return;
|
|
793
|
-
}
|
|
794
|
-
disposed = true;
|
|
795
|
-
unsubscribe();
|
|
796
|
-
await this.rpc.call("documents.liveQuery.unsubscribe", {
|
|
797
|
-
subscriptionId
|
|
798
|
-
});
|
|
799
|
-
}
|
|
800
|
-
};
|
|
801
|
-
return subscription;
|
|
802
|
-
},
|
|
803
|
-
getHeadCursor: async () => await this.rpc.call("documents.getHeadCursor", {
|
|
804
|
-
databaseId: this.databaseId
|
|
805
|
-
}),
|
|
806
|
-
get: async (docId) => await this.rpc.call("documents.get", {
|
|
807
|
-
databaseId: this.databaseId,
|
|
808
|
-
docId
|
|
809
|
-
}),
|
|
810
|
-
getRichText: async (docId, path, options) => await this.rpc.call("documents.richText.get", {
|
|
811
|
-
databaseId: this.databaseId,
|
|
812
|
-
docId,
|
|
813
|
-
path,
|
|
814
|
-
revisionId: options?.revisionId
|
|
815
|
-
}),
|
|
816
|
-
getAutomergeSnapshot: async (docId, options) => await this.rpc.call("documents.automerge.getSnapshot", {
|
|
817
|
-
databaseId: this.databaseId,
|
|
818
|
-
docId,
|
|
819
|
-
revisionId: options?.revisionId
|
|
820
|
-
}),
|
|
821
|
-
applyAutomergeChanges: async (docId, patch) => await this.rpc.call("documents.automerge.applyChanges", {
|
|
822
|
-
databaseId: this.databaseId,
|
|
823
|
-
docId,
|
|
824
|
-
patch
|
|
825
|
-
}),
|
|
826
|
-
create: async (input) => await this.rpc.call("documents.create", {
|
|
827
|
-
databaseId: this.databaseId,
|
|
828
|
-
input
|
|
829
|
-
}),
|
|
830
|
-
createMany: async (inputs) => {
|
|
831
|
-
if (inputs.length === 0) {
|
|
832
|
-
return { ids: [] };
|
|
833
|
-
}
|
|
834
|
-
try {
|
|
835
|
-
return await this.rpc.call("documents.createMany", {
|
|
836
|
-
databaseId: this.databaseId,
|
|
837
|
-
inputs
|
|
838
|
-
});
|
|
839
|
-
} catch (error) {
|
|
840
|
-
if (!isMethodNotFoundError(error)) {
|
|
841
|
-
throw error;
|
|
842
|
-
}
|
|
843
|
-
const ids = [];
|
|
844
|
-
for (const input of inputs) {
|
|
845
|
-
const document = await this.rpc.call("documents.create", {
|
|
846
|
-
databaseId: this.databaseId,
|
|
847
|
-
input
|
|
848
|
-
});
|
|
849
|
-
ids.push(document.id);
|
|
850
|
-
}
|
|
851
|
-
return { ids };
|
|
852
|
-
}
|
|
853
|
-
},
|
|
854
|
-
update: async (docId, patch) => await this.rpc.call("documents.update", {
|
|
855
|
-
databaseId: this.databaseId,
|
|
856
|
-
docId,
|
|
857
|
-
patch
|
|
858
|
-
}),
|
|
859
|
-
addRecipients: async (docId, recipients) => await this.rpc.call("documents.addRecipients", {
|
|
860
|
-
databaseId: this.databaseId,
|
|
861
|
-
docId,
|
|
862
|
-
recipients
|
|
863
|
-
}),
|
|
864
|
-
removeRecipients: async (docId, recipients) => await this.rpc.call("documents.removeRecipients", {
|
|
865
|
-
databaseId: this.databaseId,
|
|
866
|
-
docId,
|
|
867
|
-
recipients
|
|
868
|
-
}),
|
|
869
|
-
setRecipients: async (docId, recipients, options) => await this.rpc.call("documents.setRecipients", {
|
|
870
|
-
databaseId: this.databaseId,
|
|
871
|
-
docId,
|
|
872
|
-
recipients,
|
|
873
|
-
recipientOptions: options
|
|
874
|
-
}),
|
|
875
|
-
delete: async (docId) => await this.rpc.call("documents.delete", {
|
|
876
|
-
databaseId: this.databaseId,
|
|
877
|
-
docId
|
|
878
|
-
}),
|
|
879
|
-
deleteMany: async (docIds) => {
|
|
880
|
-
if (docIds.length === 0) {
|
|
881
|
-
return { ok: true };
|
|
882
|
-
}
|
|
883
|
-
try {
|
|
884
|
-
return await this.rpc.call("documents.deleteMany", {
|
|
885
|
-
databaseId: this.databaseId,
|
|
886
|
-
docIds
|
|
887
|
-
});
|
|
888
|
-
} catch (error) {
|
|
889
|
-
if (!isMethodNotFoundError(error)) {
|
|
890
|
-
throw error;
|
|
891
|
-
}
|
|
892
|
-
for (const docId of docIds) {
|
|
893
|
-
await this.rpc.call("documents.delete", {
|
|
894
|
-
databaseId: this.databaseId,
|
|
895
|
-
docId
|
|
896
|
-
});
|
|
897
|
-
}
|
|
898
|
-
return { ok: true };
|
|
899
|
-
}
|
|
900
|
-
},
|
|
901
|
-
undelete: async (docId) => await this.rpc.call("documents.undelete", {
|
|
902
|
-
databaseId: this.databaseId,
|
|
903
|
-
docId
|
|
904
|
-
}),
|
|
905
|
-
canCreate: async (input) => await this.rpc.call("documents.canCreate", {
|
|
906
|
-
databaseId: this.databaseId,
|
|
907
|
-
input: input ?? {}
|
|
908
|
-
}),
|
|
909
|
-
canChange: async (docId) => await this.rpc.call("documents.canChange", {
|
|
910
|
-
databaseId: this.databaseId,
|
|
911
|
-
docId
|
|
912
|
-
}),
|
|
913
|
-
canDelete: async (docId) => await this.rpc.call("documents.canDelete", {
|
|
914
|
-
databaseId: this.databaseId,
|
|
915
|
-
docId
|
|
916
|
-
}),
|
|
917
|
-
canUndelete: async (docId) => await this.rpc.call("documents.canUndelete", {
|
|
918
|
-
databaseId: this.databaseId,
|
|
919
|
-
docId
|
|
920
|
-
}),
|
|
921
|
-
getDefaultCreateKeyId: async () => await this.rpc.call("documents.getDefaultCreateKeyId", {
|
|
922
|
-
databaseId: this.databaseId
|
|
923
|
-
}),
|
|
924
|
-
listCreateKeys: async () => {
|
|
925
|
-
try {
|
|
926
|
-
return await this.rpc.call("documents.listCreateKeys", {
|
|
927
|
-
databaseId: this.databaseId
|
|
928
|
-
});
|
|
929
|
-
} catch (error) {
|
|
930
|
-
if (!isMethodNotFoundError(error)) {
|
|
931
|
-
throw error;
|
|
932
|
-
}
|
|
933
|
-
const keyId = await this.rpc.call("documents.getDefaultCreateKeyId", {
|
|
934
|
-
databaseId: this.databaseId
|
|
935
|
-
});
|
|
936
|
-
return [{ keyId, isDefault: true }];
|
|
937
|
-
}
|
|
938
|
-
},
|
|
939
|
-
listHistory: async (docId) => await this.rpc.call("documents.history.list", {
|
|
940
|
-
databaseId: this.databaseId,
|
|
941
|
-
docId
|
|
942
|
-
}),
|
|
943
|
-
getAtTimestamp: async (docId, timestamp) => await this.rpc.call("documents.history.getAtTimestamp", {
|
|
944
|
-
databaseId: this.databaseId,
|
|
945
|
-
docId,
|
|
946
|
-
timestamp
|
|
947
|
-
}),
|
|
948
|
-
getAtRevision: async (docId, revisionId, options) => await this.rpc.call("documents.history.getAtRevision", {
|
|
949
|
-
databaseId: this.databaseId,
|
|
950
|
-
docId,
|
|
951
|
-
revisionId,
|
|
952
|
-
phase: options?.phase
|
|
953
|
-
}),
|
|
954
|
-
getAtHeads: async (docId, headIds) => await this.rpc.call("documents.history.getAtHeads", {
|
|
955
|
-
databaseId: this.databaseId,
|
|
956
|
-
docId,
|
|
957
|
-
headIds
|
|
958
|
-
}),
|
|
959
|
-
listVerification: async (docId, revisionIds) => await this.rpc.call("documents.history.listVerification", {
|
|
960
|
-
databaseId: this.databaseId,
|
|
961
|
-
docId,
|
|
962
|
-
revisionIds
|
|
963
|
-
})
|
|
964
|
-
};
|
|
965
|
-
this.identity = {
|
|
966
|
-
signStatement: async (input) => await this.rpc.call("identity.signStatement", {
|
|
967
|
-
databaseId: this.databaseId,
|
|
968
|
-
...input
|
|
969
|
-
})
|
|
970
|
-
};
|
|
971
|
-
this.timestamps = {
|
|
972
|
-
rfc3161: async (input) => await this.rpc.call("timestamps.rfc3161", {
|
|
973
|
-
databaseId: this.databaseId,
|
|
974
|
-
...input
|
|
975
|
-
}),
|
|
976
|
-
listProviders: async () => await this.rpc.call("timestamps.listProviders", {
|
|
977
|
-
databaseId: this.databaseId
|
|
978
|
-
})
|
|
979
|
-
};
|
|
980
|
-
this.directory = {
|
|
981
|
-
excerpt: async (publicKeys) => await this.rpc.call("directory.excerpt", {
|
|
982
|
-
databaseId: this.databaseId,
|
|
983
|
-
publicKeys
|
|
984
|
-
}),
|
|
985
|
-
listUsers: async () => {
|
|
986
|
-
try {
|
|
987
|
-
return await this.rpc.call("directory.listUsers", {
|
|
988
|
-
databaseId: this.databaseId
|
|
989
|
-
});
|
|
990
|
-
} catch (error) {
|
|
991
|
-
if (!isMethodNotFoundError(error)) {
|
|
992
|
-
throw error;
|
|
993
|
-
}
|
|
994
|
-
return [];
|
|
995
|
-
}
|
|
996
|
-
}
|
|
997
|
-
};
|
|
998
|
-
this.attachments = {
|
|
999
|
-
list: async (docId, options) => await this.rpc.call("attachments.list", {
|
|
1000
|
-
databaseId: this.databaseId,
|
|
1001
|
-
docId,
|
|
1002
|
-
timestamp: options?.timestamp,
|
|
1003
|
-
revisionId: options?.revisionId
|
|
1004
|
-
}),
|
|
1005
|
-
remove: async (docId, attachmentName) => await this.rpc.call("attachments.remove", {
|
|
1006
|
-
databaseId: this.databaseId,
|
|
1007
|
-
docId,
|
|
1008
|
-
attachmentName
|
|
1009
|
-
}),
|
|
1010
|
-
openReadStream: async (docId, attachmentName, options) => {
|
|
1011
|
-
const result = await this.rpc.call(
|
|
1012
|
-
"attachments.openReadStream",
|
|
1013
|
-
{
|
|
1014
|
-
databaseId: this.databaseId,
|
|
1015
|
-
docId,
|
|
1016
|
-
attachmentName,
|
|
1017
|
-
timestamp: options?.timestamp,
|
|
1018
|
-
revisionId: options?.revisionId
|
|
1019
|
-
}
|
|
1020
|
-
);
|
|
1021
|
-
return new MindooDBAppReadableAttachmentStreamImpl(
|
|
1022
|
-
this.rpc,
|
|
1023
|
-
result.streamId
|
|
1024
|
-
);
|
|
1025
|
-
},
|
|
1026
|
-
openWriteStream: async (docId, attachmentName, contentType) => {
|
|
1027
|
-
const result = await this.rpc.call(
|
|
1028
|
-
"attachments.openWriteStream",
|
|
1029
|
-
{
|
|
1030
|
-
databaseId: this.databaseId,
|
|
1031
|
-
docId,
|
|
1032
|
-
attachmentName,
|
|
1033
|
-
contentType
|
|
1034
|
-
}
|
|
1035
|
-
);
|
|
1036
|
-
return new MindooDBAppWritableAttachmentStreamImpl(
|
|
1037
|
-
this.rpc,
|
|
1038
|
-
result.streamId
|
|
1039
|
-
);
|
|
1040
|
-
},
|
|
1041
|
-
scan: async (docId, options) => {
|
|
1042
|
-
const scannerTab = shouldUseWindowedHostTab() ? window.open("", "_blank") : null;
|
|
1043
|
-
if (scannerTab) {
|
|
1044
|
-
try {
|
|
1045
|
-
scannerTab.document.title = "Opening document scanner...";
|
|
1046
|
-
const preparedSession = await this.rpc.call("attachments.prepareScanSession", {
|
|
1047
|
-
databaseId: this.databaseId,
|
|
1048
|
-
docId,
|
|
1049
|
-
defaultFileName: options?.defaultFileName,
|
|
1050
|
-
preset: options?.preset,
|
|
1051
|
-
mimeType: options?.mimeType
|
|
1052
|
-
});
|
|
1053
|
-
scannerTab.location.href = preparedSession.scanUrl;
|
|
1054
|
-
return await this.rpc.call(
|
|
1055
|
-
"attachments.awaitScanSession",
|
|
1056
|
-
{
|
|
1057
|
-
databaseId: this.databaseId,
|
|
1058
|
-
sessionId: preparedSession.sessionId
|
|
1059
|
-
}
|
|
1060
|
-
);
|
|
1061
|
-
} catch (error) {
|
|
1062
|
-
scannerTab.close();
|
|
1063
|
-
throw error;
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
return await this.rpc.call(
|
|
1067
|
-
"attachments.scanAndWrite",
|
|
1068
|
-
{
|
|
1069
|
-
databaseId: this.databaseId,
|
|
1070
|
-
docId,
|
|
1071
|
-
defaultFileName: options?.defaultFileName,
|
|
1072
|
-
preset: options?.preset,
|
|
1073
|
-
mimeType: options?.mimeType
|
|
1074
|
-
}
|
|
1075
|
-
);
|
|
1076
|
-
},
|
|
1077
|
-
preparePreviewSession: async (docId, attachmentName, options) => await this.rpc.call("attachments.preparePreviewSession", {
|
|
1078
|
-
databaseId: this.databaseId,
|
|
1079
|
-
docId,
|
|
1080
|
-
attachmentName,
|
|
1081
|
-
timestamp: options?.timestamp,
|
|
1082
|
-
revisionId: options?.revisionId
|
|
1083
|
-
}),
|
|
1084
|
-
openPreview: async (docId, attachmentName, options) => {
|
|
1085
|
-
const previewTab = shouldUseWindowedHostTab() ? window.open("", "_blank") : null;
|
|
1086
|
-
if (previewTab) {
|
|
1087
|
-
try {
|
|
1088
|
-
previewTab.document.title = "Opening attachment preview...";
|
|
1089
|
-
const previewSession = await this.rpc.call("attachments.preparePreviewSession", {
|
|
1090
|
-
databaseId: this.databaseId,
|
|
1091
|
-
docId,
|
|
1092
|
-
attachmentName,
|
|
1093
|
-
timestamp: options?.timestamp,
|
|
1094
|
-
revisionId: options?.revisionId
|
|
1095
|
-
});
|
|
1096
|
-
previewTab.location.href = previewSession.previewUrl;
|
|
1097
|
-
return { ok: true };
|
|
1098
|
-
} catch (error) {
|
|
1099
|
-
previewTab.close();
|
|
1100
|
-
throw error;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
return await this.rpc.call("attachments.openPreview", {
|
|
1104
|
-
databaseId: this.databaseId,
|
|
1105
|
-
docId,
|
|
1106
|
-
attachmentName,
|
|
1107
|
-
timestamp: options?.timestamp,
|
|
1108
|
-
revisionId: options?.revisionId
|
|
1109
|
-
});
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
async function installHavenStorageShim(options = {}) {
|
|
274
|
+
const hosting = options.hosting ?? readMindooDBAppHostingMode();
|
|
275
|
+
if (hosting !== "hosted" || typeof window === "undefined") {
|
|
276
|
+
return {
|
|
277
|
+
installed: false,
|
|
278
|
+
connected: false,
|
|
279
|
+
flush: async () => {
|
|
1110
280
|
},
|
|
1111
|
-
|
|
1112
|
-
return await this.rpc.call("attachments.extractText", {
|
|
1113
|
-
databaseId: this.databaseId,
|
|
1114
|
-
bytes: input.bytes,
|
|
1115
|
-
mimeType: input.mimeType,
|
|
1116
|
-
fileName: input.fileName,
|
|
1117
|
-
format: input.format,
|
|
1118
|
-
languages: input.languages
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
};
|
|
1122
|
-
}
|
|
1123
|
-
rpc;
|
|
1124
|
-
databaseId;
|
|
1125
|
-
documents;
|
|
1126
|
-
attachments;
|
|
1127
|
-
identity;
|
|
1128
|
-
timestamps;
|
|
1129
|
-
directory;
|
|
1130
|
-
/** Returns database metadata for the currently opened binding. */
|
|
1131
|
-
async info() {
|
|
1132
|
-
return await this.rpc.call("databases.info", {
|
|
1133
|
-
databaseId: this.databaseId
|
|
1134
|
-
});
|
|
1135
|
-
}
|
|
1136
|
-
/** Reads the full-text configuration from the synced `dbsetup` document. */
|
|
1137
|
-
async getFulltextSetup() {
|
|
1138
|
-
const result = await this.rpc.call(
|
|
1139
|
-
"database.getFulltextSetup",
|
|
1140
|
-
{ databaseId: this.databaseId }
|
|
1141
|
-
);
|
|
1142
|
-
return result.config;
|
|
1143
|
-
}
|
|
1144
|
-
/** Writes (or removes, with `null`) the full-text configuration. */
|
|
1145
|
-
async setFulltextSetup(config) {
|
|
1146
|
-
await this.rpc.call("database.setFulltextSetup", {
|
|
1147
|
-
databaseId: this.databaseId,
|
|
1148
|
-
config
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
/** Reads the attachment extraction configuration from the synced `dbsetup` document. */
|
|
1152
|
-
async getExtractionSetup() {
|
|
1153
|
-
const result = await this.rpc.call(
|
|
1154
|
-
"database.getExtractionSetup",
|
|
1155
|
-
{ databaseId: this.databaseId }
|
|
1156
|
-
);
|
|
1157
|
-
return result.config;
|
|
1158
|
-
}
|
|
1159
|
-
/** Writes (or removes, with `null`) the attachment extraction configuration. */
|
|
1160
|
-
async setExtractionSetup(config) {
|
|
1161
|
-
await this.rpc.call("database.setExtractionSetup", {
|
|
1162
|
-
databaseId: this.databaseId,
|
|
1163
|
-
config
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
};
|
|
1167
|
-
var MindooDBAppSessionImpl = class {
|
|
1168
|
-
constructor(rpc) {
|
|
1169
|
-
this.rpc = rpc;
|
|
1170
|
-
this.menus = {
|
|
1171
|
-
show: async (input) => await this.rpc.call("menus.show", input),
|
|
1172
|
-
hide: async () => {
|
|
1173
|
-
await this.rpc.call("menus.hide", {});
|
|
281
|
+
uninstall: async () => {
|
|
1174
282
|
}
|
|
1175
283
|
};
|
|
1176
284
|
}
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
/** Opens one database binding and returns a client facade for it. */
|
|
1208
|
-
async openDatabase(databaseId) {
|
|
1209
|
-
await this.rpc.call("session.openDatabase", { databaseId });
|
|
1210
|
-
return new MindooDBAppDatabaseImpl(this.rpc, databaseId);
|
|
1211
|
-
}
|
|
1212
|
-
async listDocumentsSinceViewCursor(cursor) {
|
|
1213
|
-
return await this.rpc.call("session.listDocumentsSinceViewCursor", {
|
|
1214
|
-
cursor
|
|
1215
|
-
});
|
|
1216
|
-
}
|
|
1217
|
-
/**
|
|
1218
|
-
* Create a navigator from an ad-hoc view definition and one or more database bindings.
|
|
1219
|
-
*
|
|
1220
|
-
* The host builds a `VirtualView` from `input.definition`, optionally applying
|
|
1221
|
-
* open options (root scoping, category filtering), and returns a `navigatorId`
|
|
1222
|
-
* that all subsequent navigator RPCs reference.
|
|
1223
|
-
*/
|
|
1224
|
-
async createViewNavigator(input) {
|
|
1225
|
-
const result = await this.rpc.call("session.createViewNavigator", input);
|
|
1226
|
-
return new MindooDBAppViewNavigatorImpl(
|
|
1227
|
-
this.rpc,
|
|
1228
|
-
result.navigatorId,
|
|
1229
|
-
result.viewCursor
|
|
1230
|
-
);
|
|
1231
|
-
}
|
|
1232
|
-
/**
|
|
1233
|
-
* Open a navigator for a preconfigured view that the host already knows about.
|
|
1234
|
-
*
|
|
1235
|
-
* `viewId` must match one of the views declared in the launch context. The
|
|
1236
|
-
* host resolves the full view definition and database bindings automatically.
|
|
1237
|
-
*/
|
|
1238
|
-
async openViewNavigator(viewId, options) {
|
|
1239
|
-
const result = await this.rpc.call("session.openViewNavigator", { viewId, options: options ?? {} });
|
|
1240
|
-
return new MindooDBAppViewNavigatorImpl(
|
|
1241
|
-
this.rpc,
|
|
1242
|
-
result.navigatorId,
|
|
1243
|
-
result.viewCursor
|
|
1244
|
-
);
|
|
1245
|
-
}
|
|
1246
|
-
/** Subscribe to host-pushed theme changes (dark/light mode, color tokens). */
|
|
1247
|
-
onThemeChange(listener) {
|
|
1248
|
-
return this.rpc.addMessageListener((message) => {
|
|
1249
|
-
if (isThemeChangedMessage(message)) {
|
|
1250
|
-
listener(message.theme);
|
|
285
|
+
const persistPrefixes = options.persistPrefixes ?? [];
|
|
286
|
+
const coalesceMs = options.coalesceMs ?? DEFAULT_COALESCE_MS;
|
|
287
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
288
|
+
let session = null;
|
|
289
|
+
const pending = /* @__PURE__ */ new Map();
|
|
290
|
+
let flushTimer = null;
|
|
291
|
+
let deadline = 0;
|
|
292
|
+
let flushChain = Promise.resolve();
|
|
293
|
+
function isPersisted(key) {
|
|
294
|
+
return persistPrefixes.some((prefix) => key.startsWith(prefix));
|
|
295
|
+
}
|
|
296
|
+
function runFlush() {
|
|
297
|
+
if (flushTimer !== null) {
|
|
298
|
+
clearTimeout(flushTimer);
|
|
299
|
+
flushTimer = null;
|
|
300
|
+
}
|
|
301
|
+
deadline = 0;
|
|
302
|
+
const batch = [...pending.entries()];
|
|
303
|
+
pending.clear();
|
|
304
|
+
if (!batch.length || !session) {
|
|
305
|
+
return flushChain;
|
|
306
|
+
}
|
|
307
|
+
const active = session;
|
|
308
|
+
flushChain = flushChain.then(async () => {
|
|
309
|
+
for (const [key, value] of batch) {
|
|
310
|
+
if (value === null) {
|
|
311
|
+
await active.storage.remove(key);
|
|
312
|
+
} else {
|
|
313
|
+
await active.storage.set(key, value);
|
|
314
|
+
}
|
|
1251
315
|
}
|
|
316
|
+
}).catch((error) => {
|
|
317
|
+
console.warn("[mindoodb-app-sdk] Failed to persist app storage to the host.", error);
|
|
1252
318
|
});
|
|
319
|
+
return flushChain;
|
|
1253
320
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
321
|
+
function scheduleFlush() {
|
|
322
|
+
if (!session) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const now = Date.now();
|
|
326
|
+
if (deadline === 0) {
|
|
327
|
+
deadline = now + coalesceMs * MAX_COALESCE_MULTIPLIER;
|
|
328
|
+
}
|
|
329
|
+
if (flushTimer !== null) {
|
|
330
|
+
clearTimeout(flushTimer);
|
|
331
|
+
}
|
|
332
|
+
flushTimer = setTimeout(() => void runFlush(), Math.max(0, Math.min(coalesceMs, deadline - now)));
|
|
1261
333
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
}
|
|
1268
|
-
});
|
|
334
|
+
async function flushAll() {
|
|
335
|
+
for (let pass = 0; pass < 3 && pending.size; pass += 1) {
|
|
336
|
+
await runFlush();
|
|
337
|
+
}
|
|
338
|
+
await flushChain;
|
|
1269
339
|
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
340
|
+
const backend = createStorageBackend({
|
|
341
|
+
quotaBytes: options.quotaBytes ?? DEFAULT_QUOTA_BYTES,
|
|
342
|
+
maxValueBytes: options.maxValueBytes ?? DEFAULT_MAX_VALUE_BYTES,
|
|
343
|
+
isPersisted,
|
|
344
|
+
onPersistedChange(key, value) {
|
|
345
|
+
pending.set(key, value);
|
|
346
|
+
scheduleFlush();
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
const restoreLocal = replaceGlobal("localStorage", backend.storage);
|
|
350
|
+
const restoreSession = options.shimSessionStorage === false ? null : replaceGlobal(
|
|
351
|
+
"sessionStorage",
|
|
352
|
+
createStorageBackend({
|
|
353
|
+
quotaBytes: Number.POSITIVE_INFINITY,
|
|
354
|
+
maxValueBytes: Number.POSITIVE_INFINITY,
|
|
355
|
+
isPersisted: () => false,
|
|
356
|
+
onPersistedChange: () => {
|
|
1275
357
|
}
|
|
1276
|
-
})
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
358
|
+
}).storage
|
|
359
|
+
);
|
|
360
|
+
let connected = false;
|
|
361
|
+
if (persistPrefixes.length) {
|
|
362
|
+
const bridge = options.bridge ?? createMindooDBAppBridge();
|
|
363
|
+
let timeoutHandle = null;
|
|
1280
364
|
try {
|
|
1281
|
-
await
|
|
365
|
+
const connectedSession = await Promise.race([
|
|
366
|
+
bridge.connect(options.launchId ? { launchId: options.launchId } : void 0),
|
|
367
|
+
new Promise((_resolve, reject) => {
|
|
368
|
+
timeoutHandle = setTimeout(
|
|
369
|
+
() => reject(new Error(`Host did not answer within ${timeoutMs} ms.`)),
|
|
370
|
+
timeoutMs
|
|
371
|
+
);
|
|
372
|
+
})
|
|
373
|
+
]);
|
|
374
|
+
backend.hydrate(await connectedSession.storage.snapshot({ prefixes: persistPrefixes }));
|
|
375
|
+
session = connectedSession;
|
|
376
|
+
connected = true;
|
|
377
|
+
connectedSession.onBeforeClose(() => flushAll());
|
|
378
|
+
} catch (error) {
|
|
379
|
+
console.warn(
|
|
380
|
+
"[mindoodb-app-sdk] App storage is not connected to the host; running in-memory only.",
|
|
381
|
+
error
|
|
382
|
+
);
|
|
1282
383
|
} finally {
|
|
1283
|
-
|
|
384
|
+
if (timeoutHandle !== null) {
|
|
385
|
+
clearTimeout(timeoutHandle);
|
|
386
|
+
}
|
|
1284
387
|
}
|
|
1285
388
|
}
|
|
1286
|
-
};
|
|
1287
|
-
function createMindooDBAppBridge() {
|
|
1288
389
|
return {
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
390
|
+
installed: true,
|
|
391
|
+
connected,
|
|
392
|
+
flush: flushAll,
|
|
393
|
+
async uninstall() {
|
|
394
|
+
await flushAll();
|
|
395
|
+
restoreLocal();
|
|
396
|
+
restoreSession?.();
|
|
1294
397
|
}
|
|
1295
398
|
};
|
|
1296
399
|
}
|
|
@@ -1635,7 +738,7 @@ function computeSingleSplice2(previous, next) {
|
|
|
1635
738
|
}
|
|
1636
739
|
|
|
1637
740
|
// src/viewLanguage.ts
|
|
1638
|
-
import { parseMindooDBFormulaBooleanExpression
|
|
741
|
+
import { parseMindooDBFormulaBooleanExpression } from "mindoodb-view-language";
|
|
1639
742
|
import {
|
|
1640
743
|
createViewLanguage,
|
|
1641
744
|
getMindooDBViewLanguageHelper,
|
|
@@ -1646,19 +749,38 @@ async function queryDocuments(db, filter, sortBy, options) {
|
|
|
1646
749
|
if (!db.query) {
|
|
1647
750
|
throw new Error("This MindooDB instance does not support ad-hoc queries.");
|
|
1648
751
|
}
|
|
1649
|
-
const expression = typeof filter === "string" ?
|
|
752
|
+
const expression = typeof filter === "string" ? parseMindooDBFormulaBooleanExpression(filter) : filter;
|
|
1650
753
|
return db.query({ filter: expression, sortBy }, options);
|
|
1651
754
|
}
|
|
1652
755
|
export {
|
|
756
|
+
DEFAULT_HAVEN_HOST_SHORTCUTS,
|
|
757
|
+
MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME,
|
|
758
|
+
MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME,
|
|
759
|
+
MINDOODB_APP_BUNDLE_MANIFEST_FORMAT,
|
|
760
|
+
MINDOODB_APP_BUNDLE_MANIFEST_VERSION,
|
|
761
|
+
MINDOODB_APP_HOSTING_QUERY_PARAM,
|
|
1653
762
|
MINDOODB_APP_SEAL_SIGNING_DOMAIN,
|
|
1654
763
|
MindooDBRichTextHandle,
|
|
1655
764
|
MindooDBTextBuffer,
|
|
1656
765
|
abbreviateCanonicalName,
|
|
766
|
+
applyHostedDocumentOverscrollContain,
|
|
767
|
+
buildMindooDBAppBundleContentHashInput,
|
|
1657
768
|
canPreviewAttachment,
|
|
1658
769
|
createMindooDBAppBridge,
|
|
1659
770
|
createMindooDBRichTextHandle,
|
|
1660
771
|
createMindooDBTextBuffer,
|
|
1661
772
|
createViewLanguage,
|
|
1662
773
|
expandAbbreviatedName,
|
|
1663
|
-
|
|
774
|
+
installHavenStorageShim,
|
|
775
|
+
installHostShortcutCapture,
|
|
776
|
+
isHostShortcutAction,
|
|
777
|
+
isHostedBundleRuntime,
|
|
778
|
+
isMindooDBAppBundleHash,
|
|
779
|
+
matchHostShortcut,
|
|
780
|
+
normalizeMindooDBAppBundlePath,
|
|
781
|
+
queryDocuments,
|
|
782
|
+
readMindooDBAppHostingMode,
|
|
783
|
+
releaseMindooDBAppBridgeSessions,
|
|
784
|
+
sanitizeHostShortcutBindings,
|
|
785
|
+
validateMindooDBAppBundleManifest
|
|
1664
786
|
};
|