mindoodb-app-sdk 0.0.4 → 0.0.6
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 +493 -253
- package/TESTING.md +3 -1
- package/dist/index.d.ts +29 -3
- package/dist/index.js +93 -29
- package/dist/testing/index.d.ts +7 -3
- package/dist/testing/index.js +185 -39
- package/dist/{types-BGdIfp-D.d.ts → types-BDY_80wd.d.ts} +26 -8
- package/package.json +2 -2
package/dist/testing/index.js
CHANGED
|
@@ -20,6 +20,10 @@ function mergeLaunchContext(current, patch) {
|
|
|
20
20
|
viewport: current.viewport ? { ...current.viewport } : null,
|
|
21
21
|
user: { ...current.user },
|
|
22
22
|
launchParameters: { ...current.launchParameters },
|
|
23
|
+
databases: current.databases.map((database) => ({
|
|
24
|
+
...database,
|
|
25
|
+
capabilities: [...database.capabilities]
|
|
26
|
+
})),
|
|
23
27
|
views: current.views.map((view) => ({
|
|
24
28
|
...view,
|
|
25
29
|
sources: view.sources.map((source) => ({ ...source })),
|
|
@@ -45,6 +49,13 @@ function mergeLaunchContext(current, patch) {
|
|
|
45
49
|
viewport: patch.viewport === void 0 ? current.viewport ? { ...current.viewport } : null : patch.viewport ? { ...patch.viewport } : null,
|
|
46
50
|
user: patch.user ? { ...current.user, ...patch.user } : { ...current.user },
|
|
47
51
|
launchParameters: patch.launchParameters ? { ...current.launchParameters, ...patch.launchParameters } : { ...current.launchParameters },
|
|
52
|
+
databases: patch.databases ? patch.databases.map((database) => ({
|
|
53
|
+
...database,
|
|
54
|
+
capabilities: [...database.capabilities]
|
|
55
|
+
})) : current.databases.map((database) => ({
|
|
56
|
+
...database,
|
|
57
|
+
capabilities: [...database.capabilities]
|
|
58
|
+
})),
|
|
48
59
|
views: patch.views ? patch.views.map((view) => ({
|
|
49
60
|
...view,
|
|
50
61
|
sources: view.sources.map((source) => ({ ...source })),
|
|
@@ -98,6 +109,7 @@ function createDefaultLaunchContext(patch) {
|
|
|
98
109
|
username: "Test User"
|
|
99
110
|
},
|
|
100
111
|
launchParameters: {},
|
|
112
|
+
databases: [],
|
|
101
113
|
views: []
|
|
102
114
|
};
|
|
103
115
|
return mergeLaunchContext(base, patch);
|
|
@@ -139,6 +151,27 @@ function createDefaultWritableAttachmentStream() {
|
|
|
139
151
|
}
|
|
140
152
|
};
|
|
141
153
|
}
|
|
154
|
+
function getFieldValue(source, field) {
|
|
155
|
+
return field.split(".").reduce((current, part) => {
|
|
156
|
+
if (current && typeof current === "object" && part in current) {
|
|
157
|
+
return current[part];
|
|
158
|
+
}
|
|
159
|
+
return void 0;
|
|
160
|
+
}, source);
|
|
161
|
+
}
|
|
162
|
+
function matchesDocumentFilter(document, filter) {
|
|
163
|
+
if (!filter) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
return Object.entries(filter).every(([field, expected]) => getFieldValue(document.data, field) === expected);
|
|
167
|
+
}
|
|
168
|
+
function decodeMockListCursor(cursor) {
|
|
169
|
+
if (!cursor) {
|
|
170
|
+
return 0;
|
|
171
|
+
}
|
|
172
|
+
const offset = Number.parseInt(cursor, 10);
|
|
173
|
+
return Number.isFinite(offset) && offset >= 0 ? offset : 0;
|
|
174
|
+
}
|
|
142
175
|
function createDefaultViewHandle() {
|
|
143
176
|
const definition = {
|
|
144
177
|
title: "Mock View",
|
|
@@ -205,32 +238,94 @@ function createDefaultViewHandle() {
|
|
|
205
238
|
function createDatabaseHandle(definition) {
|
|
206
239
|
let createCounter = 0;
|
|
207
240
|
const defaultViewFactory = async () => createDefaultViewHandle();
|
|
241
|
+
const storedDocuments = /* @__PURE__ */ new Map();
|
|
208
242
|
const defaultDocuments = {
|
|
209
|
-
async list(
|
|
243
|
+
async list(query) {
|
|
244
|
+
const status = query?.status ?? "existing";
|
|
245
|
+
const skip = Math.max(0, query?.skip ?? 0);
|
|
246
|
+
const limit = Math.max(1, query?.limit ?? 50);
|
|
247
|
+
const offset = decodeMockListCursor(query?.cursor) + skip;
|
|
248
|
+
const metadataOnly = query?.metadataOnly ?? false;
|
|
249
|
+
const items = Array.from(storedDocuments.values()).filter((document) => status === "all" ? true : status === "deleted" ? document.isDeleted : !document.isDeleted).filter((document) => metadataOnly ? true : matchesDocumentFilter(document, query?.filter)).sort((left, right) => left.id.localeCompare(right.id));
|
|
250
|
+
const page = items.slice(offset, offset + limit).map((document) => {
|
|
251
|
+
if (metadataOnly) {
|
|
252
|
+
return {
|
|
253
|
+
id: document.id,
|
|
254
|
+
isDeleted: document.isDeleted
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
const projectedData = query?.fields ? Object.fromEntries(query.fields.map((field) => [field, getFieldValue(document.data, field)])) : document.data;
|
|
258
|
+
return {
|
|
259
|
+
id: document.id,
|
|
260
|
+
data: projectedData,
|
|
261
|
+
attachmentCount: document.attachments?.length ?? 0,
|
|
262
|
+
updatedAt: document.updatedAt,
|
|
263
|
+
isDeleted: status !== "existing" ? document.isDeleted : void 0
|
|
264
|
+
};
|
|
265
|
+
});
|
|
266
|
+
const nextCursor = offset + page.length < items.length ? String(offset + page.length) : null;
|
|
210
267
|
return {
|
|
211
|
-
items:
|
|
212
|
-
nextCursor
|
|
268
|
+
items: page,
|
|
269
|
+
nextCursor
|
|
213
270
|
};
|
|
214
271
|
},
|
|
215
272
|
async get(_docId) {
|
|
216
|
-
|
|
273
|
+
const document = storedDocuments.get(_docId);
|
|
274
|
+
if (!document || document.isDeleted) {
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
id: document.id,
|
|
279
|
+
data: structuredClone(document.data),
|
|
280
|
+
attachments: document.attachments ? structuredClone(document.attachments) : [],
|
|
281
|
+
updatedAt: document.updatedAt
|
|
282
|
+
};
|
|
217
283
|
},
|
|
218
284
|
async create(input) {
|
|
219
285
|
createCounter += 1;
|
|
220
|
-
|
|
286
|
+
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
287
|
+
const created = {
|
|
221
288
|
id: `doc-${createCounter}`,
|
|
222
289
|
data: { ...input.data },
|
|
223
|
-
attachments: []
|
|
290
|
+
attachments: [],
|
|
291
|
+
updatedAt: createdAt
|
|
292
|
+
};
|
|
293
|
+
storedDocuments.set(created.id, {
|
|
294
|
+
...created,
|
|
295
|
+
data: structuredClone(created.data),
|
|
296
|
+
attachments: [],
|
|
297
|
+
isDeleted: false
|
|
298
|
+
});
|
|
299
|
+
return {
|
|
300
|
+
...created
|
|
224
301
|
};
|
|
225
302
|
},
|
|
226
303
|
async update(docId, patch) {
|
|
227
|
-
|
|
304
|
+
const updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
305
|
+
const existing = storedDocuments.get(docId);
|
|
306
|
+
const updated = {
|
|
228
307
|
id: docId,
|
|
229
308
|
data: { ...patch.data },
|
|
230
|
-
attachments: []
|
|
309
|
+
attachments: existing?.attachments ? structuredClone(existing.attachments) : [],
|
|
310
|
+
updatedAt
|
|
231
311
|
};
|
|
312
|
+
storedDocuments.set(docId, {
|
|
313
|
+
...updated,
|
|
314
|
+
data: structuredClone(updated.data),
|
|
315
|
+
attachments: updated.attachments ? structuredClone(updated.attachments) : [],
|
|
316
|
+
isDeleted: false
|
|
317
|
+
});
|
|
318
|
+
return updated;
|
|
232
319
|
},
|
|
233
320
|
async delete(_docId) {
|
|
321
|
+
const existing = storedDocuments.get(_docId);
|
|
322
|
+
if (existing) {
|
|
323
|
+
storedDocuments.set(_docId, {
|
|
324
|
+
...existing,
|
|
325
|
+
isDeleted: true,
|
|
326
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
327
|
+
});
|
|
328
|
+
}
|
|
234
329
|
return { ok: true };
|
|
235
330
|
},
|
|
236
331
|
async listHistory(_docId) {
|
|
@@ -265,6 +360,9 @@ function createDatabaseHandle(definition) {
|
|
|
265
360
|
},
|
|
266
361
|
async openWriteStream(_docId, _attachmentName, _contentType) {
|
|
267
362
|
return createDefaultWritableAttachmentStream();
|
|
363
|
+
},
|
|
364
|
+
async openPreview(_docId, _attachmentName, _options) {
|
|
365
|
+
return { ok: true };
|
|
268
366
|
}
|
|
269
367
|
};
|
|
270
368
|
const methods = definition.methods ?? {};
|
|
@@ -276,10 +374,6 @@ function createDatabaseHandle(definition) {
|
|
|
276
374
|
...defaultDocuments,
|
|
277
375
|
...methods.documents
|
|
278
376
|
},
|
|
279
|
-
views: {
|
|
280
|
-
...defaultViews,
|
|
281
|
-
...methods.views
|
|
282
|
-
},
|
|
283
377
|
attachments: {
|
|
284
378
|
...defaultAttachments,
|
|
285
379
|
...methods.attachments
|
|
@@ -291,16 +385,29 @@ function createMockSessionState(options = {}) {
|
|
|
291
385
|
const themeListeners = /* @__PURE__ */ new Set();
|
|
292
386
|
const viewportListeners = /* @__PURE__ */ new Set();
|
|
293
387
|
const databaseHandles = /* @__PURE__ */ new Map();
|
|
388
|
+
const databaseViewApis = /* @__PURE__ */ new Map();
|
|
389
|
+
const sessionViews = /* @__PURE__ */ new Map();
|
|
294
390
|
let databaseInfos = [];
|
|
295
391
|
const setDatabases = (definitions) => {
|
|
296
392
|
databaseHandles.clear();
|
|
393
|
+
databaseViewApis.clear();
|
|
297
394
|
databaseInfos = definitions.map((definition) => ({
|
|
298
395
|
...definition.info,
|
|
299
396
|
capabilities: [...definition.info.capabilities]
|
|
300
397
|
}));
|
|
301
398
|
for (const definition of definitions) {
|
|
302
399
|
databaseHandles.set(definition.info.id, createDatabaseHandle(definition));
|
|
400
|
+
databaseViewApis.set(definition.info.id, {
|
|
401
|
+
async create(_definition) {
|
|
402
|
+
return await createDefaultViewHandle();
|
|
403
|
+
},
|
|
404
|
+
async open(_viewId) {
|
|
405
|
+
return await createDefaultViewHandle();
|
|
406
|
+
},
|
|
407
|
+
...definition.methods?.views ?? {}
|
|
408
|
+
});
|
|
303
409
|
}
|
|
410
|
+
launchContext = mergeLaunchContext(launchContext, { databases: databaseInfos });
|
|
304
411
|
};
|
|
305
412
|
setDatabases(options.databases ?? []);
|
|
306
413
|
const session = {
|
|
@@ -320,6 +427,33 @@ function createMockSessionState(options = {}) {
|
|
|
320
427
|
}
|
|
321
428
|
return database;
|
|
322
429
|
},
|
|
430
|
+
async createView(input) {
|
|
431
|
+
const api = databaseViewApis.get(input.databaseId);
|
|
432
|
+
if (!api) {
|
|
433
|
+
throw new Error(`Unknown test database for view creation: ${input.databaseId}`);
|
|
434
|
+
}
|
|
435
|
+
const view = await api.create(input.definition);
|
|
436
|
+
const viewId = input.definition.id || crypto.randomUUID();
|
|
437
|
+
sessionViews.set(viewId, view);
|
|
438
|
+
return view;
|
|
439
|
+
},
|
|
440
|
+
async openView(viewId) {
|
|
441
|
+
const existing = sessionViews.get(viewId);
|
|
442
|
+
if (existing) {
|
|
443
|
+
return existing;
|
|
444
|
+
}
|
|
445
|
+
const sourceDatabaseId = launchContext.views.find((view2) => view2.id === viewId)?.sources[0]?.databaseId;
|
|
446
|
+
if (!sourceDatabaseId) {
|
|
447
|
+
throw new Error(`Unknown test view: ${viewId}`);
|
|
448
|
+
}
|
|
449
|
+
const api = databaseViewApis.get(sourceDatabaseId);
|
|
450
|
+
if (!api) {
|
|
451
|
+
throw new Error(`Unknown test database for view ${viewId}: ${sourceDatabaseId}`);
|
|
452
|
+
}
|
|
453
|
+
const view = await api.open(viewId);
|
|
454
|
+
sessionViews.set(viewId, view);
|
|
455
|
+
return view;
|
|
456
|
+
},
|
|
323
457
|
onThemeChange(listener) {
|
|
324
458
|
themeListeners.add(listener);
|
|
325
459
|
return () => {
|
|
@@ -363,6 +497,8 @@ function createMockSessionState(options = {}) {
|
|
|
363
497
|
}
|
|
364
498
|
return database;
|
|
365
499
|
},
|
|
500
|
+
createView: session.createView,
|
|
501
|
+
openView: session.openView,
|
|
366
502
|
bridge,
|
|
367
503
|
session,
|
|
368
504
|
emitThemeChange(theme) {
|
|
@@ -492,15 +628,13 @@ function createFakeBridgeHost(options = {}) {
|
|
|
492
628
|
});
|
|
493
629
|
installed = true;
|
|
494
630
|
}
|
|
495
|
-
async function resolveViewHandle(
|
|
496
|
-
const
|
|
497
|
-
const existing = viewSessions.get(key);
|
|
631
|
+
async function resolveViewHandle(viewId) {
|
|
632
|
+
const existing = viewSessions.get(viewId);
|
|
498
633
|
if (existing) {
|
|
499
634
|
return existing;
|
|
500
635
|
}
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
viewSessions.set(key, handle);
|
|
636
|
+
const handle = await state.openView(viewId);
|
|
637
|
+
viewSessions.set(viewId, handle);
|
|
504
638
|
return handle;
|
|
505
639
|
}
|
|
506
640
|
function postRpcSuccess(port, requestId, result) {
|
|
@@ -544,6 +678,18 @@ function createFakeBridgeHost(options = {}) {
|
|
|
544
678
|
case "session.openDatabase":
|
|
545
679
|
state.getDatabase(String(params.databaseId));
|
|
546
680
|
return { ok: true };
|
|
681
|
+
case "session.createView": {
|
|
682
|
+
const viewId = `view-${viewCounter += 1}`;
|
|
683
|
+
const handle = await state.createView({
|
|
684
|
+
databaseId: String(params.databaseId),
|
|
685
|
+
definition: params.definition
|
|
686
|
+
});
|
|
687
|
+
viewSessions.set(viewId, handle);
|
|
688
|
+
return { viewId };
|
|
689
|
+
}
|
|
690
|
+
case "session.openView":
|
|
691
|
+
await state.openView(String(params.viewId));
|
|
692
|
+
return { ok: true };
|
|
547
693
|
case "session.disconnect":
|
|
548
694
|
await state.session.disconnect();
|
|
549
695
|
return { ok: true };
|
|
@@ -593,52 +739,52 @@ function createFakeBridgeHost(options = {}) {
|
|
|
593
739
|
writeStreams.set(streamId, stream);
|
|
594
740
|
return { streamId };
|
|
595
741
|
}
|
|
596
|
-
case "
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
742
|
+
case "attachments.openPreview":
|
|
743
|
+
return await state.getDatabase(String(params.databaseId)).attachments.openPreview(
|
|
744
|
+
String(params.docId),
|
|
745
|
+
String(params.attachmentName),
|
|
746
|
+
typeof params.timestamp === "number" ? { timestamp: params.timestamp } : void 0
|
|
747
|
+
);
|
|
602
748
|
case "views.getDefinition":
|
|
603
|
-
return await (await resolveViewHandle(String(params.
|
|
749
|
+
return await (await resolveViewHandle(String(params.viewId))).getDefinition();
|
|
604
750
|
case "views.refresh":
|
|
605
|
-
return await (await resolveViewHandle(String(params.
|
|
751
|
+
return await (await resolveViewHandle(String(params.viewId))).refresh();
|
|
606
752
|
case "views.page":
|
|
607
|
-
return await (await resolveViewHandle(String(params.
|
|
753
|
+
return await (await resolveViewHandle(String(params.viewId))).page(
|
|
608
754
|
params.request
|
|
609
755
|
);
|
|
610
756
|
case "views.expansion.get":
|
|
611
|
-
return await (await resolveViewHandle(String(params.
|
|
757
|
+
return await (await resolveViewHandle(String(params.viewId))).getExpansionState();
|
|
612
758
|
case "views.expansion.set":
|
|
613
|
-
return await (await resolveViewHandle(String(params.
|
|
759
|
+
return await (await resolveViewHandle(String(params.viewId))).setExpansionState(
|
|
614
760
|
params.expansion
|
|
615
761
|
);
|
|
616
762
|
case "views.expansion.expand":
|
|
617
|
-
return await (await resolveViewHandle(String(params.
|
|
763
|
+
return await (await resolveViewHandle(String(params.viewId))).expand(String(params.rowKey));
|
|
618
764
|
case "views.expansion.collapse":
|
|
619
|
-
return await (await resolveViewHandle(String(params.
|
|
765
|
+
return await (await resolveViewHandle(String(params.viewId))).collapse(String(params.rowKey));
|
|
620
766
|
case "views.expansion.expandAll":
|
|
621
|
-
return await (await resolveViewHandle(String(params.
|
|
767
|
+
return await (await resolveViewHandle(String(params.viewId))).expandAll();
|
|
622
768
|
case "views.expansion.collapseAll":
|
|
623
|
-
return await (await resolveViewHandle(String(params.
|
|
769
|
+
return await (await resolveViewHandle(String(params.viewId))).collapseAll();
|
|
624
770
|
case "views.row.get":
|
|
625
|
-
return await (await resolveViewHandle(String(params.
|
|
771
|
+
return await (await resolveViewHandle(String(params.viewId))).getRow(String(params.rowKey));
|
|
626
772
|
case "views.category.get":
|
|
627
|
-
return await (await resolveViewHandle(String(params.
|
|
773
|
+
return await (await resolveViewHandle(String(params.viewId))).getCategory(
|
|
628
774
|
params.lookup
|
|
629
775
|
);
|
|
630
776
|
case "views.category.page":
|
|
631
|
-
return await (await resolveViewHandle(String(params.
|
|
777
|
+
return await (await resolveViewHandle(String(params.viewId))).pageCategory(
|
|
632
778
|
String(params.categoryKey),
|
|
633
779
|
params.request
|
|
634
780
|
);
|
|
635
781
|
case "views.category.documentIds":
|
|
636
|
-
return await (await resolveViewHandle(String(params.
|
|
782
|
+
return await (await resolveViewHandle(String(params.viewId))).listCategoryDocumentIds(
|
|
637
783
|
String(params.categoryKey)
|
|
638
784
|
);
|
|
639
785
|
case "views.dispose": {
|
|
640
|
-
const key =
|
|
641
|
-
const handle = await resolveViewHandle(String(params.
|
|
786
|
+
const key = String(params.viewId);
|
|
787
|
+
const handle = await resolveViewHandle(String(params.viewId));
|
|
642
788
|
await handle.dispose();
|
|
643
789
|
viewSessions.delete(key);
|
|
644
790
|
return void 0;
|
|
@@ -109,6 +109,7 @@ interface MindooDBAppLaunchContext {
|
|
|
109
109
|
username: string;
|
|
110
110
|
};
|
|
111
111
|
launchParameters: Record<string, string>;
|
|
112
|
+
databases: MindooDBAppDatabaseInfo[];
|
|
112
113
|
views: MindooDBAppResolvedViewDefinition[];
|
|
113
114
|
}
|
|
114
115
|
/** Attachment metadata returned by the attachment APIs. */
|
|
@@ -118,6 +119,13 @@ interface MindooDBAppAttachmentInfo {
|
|
|
118
119
|
mimeType: string;
|
|
119
120
|
size: number;
|
|
120
121
|
}
|
|
122
|
+
/** Preview modes supported by the Haven-hosted attachment preview dialog. */
|
|
123
|
+
type MindooDBAppAttachmentPreviewMode = "image" | "pdf" | "text" | "docx" | "pptx" | "spreadsheet" | "video" | "audio";
|
|
124
|
+
/** Optional parameters for opening an attachment preview in Haven. */
|
|
125
|
+
interface MindooDBAppAttachmentPreviewOptions {
|
|
126
|
+
/** Historical snapshot timestamp previously obtained from `documents.history.getAtTimestamp()`. */
|
|
127
|
+
timestamp?: number;
|
|
128
|
+
}
|
|
121
129
|
/** Database entry visible to the app during launch and database listing. */
|
|
122
130
|
interface MindooDBAppDatabaseInfo {
|
|
123
131
|
id: string;
|
|
@@ -131,6 +139,9 @@ interface MindooDBAppDocumentSummary {
|
|
|
131
139
|
data?: Record<string, unknown>;
|
|
132
140
|
attachmentCount?: number;
|
|
133
141
|
updatedAt?: string;
|
|
142
|
+
identityLabel?: string;
|
|
143
|
+
publicKeyFingerprint?: string;
|
|
144
|
+
isDeleted?: boolean;
|
|
134
145
|
}
|
|
135
146
|
/** Fully loaded document returned by `get()`, `create()`, or `update()`. */
|
|
136
147
|
interface MindooDBAppDocument {
|
|
@@ -156,10 +167,13 @@ interface MindooDBAppHistoricalDocument {
|
|
|
156
167
|
state: "missing" | "deleted" | "exists";
|
|
157
168
|
data: Record<string, unknown> | null;
|
|
158
169
|
}
|
|
159
|
-
/** Query options for paging through
|
|
170
|
+
/** Query options for paging through changefeed-backed document listings in a database. */
|
|
160
171
|
interface MindooDBAppDocumentListQuery {
|
|
161
|
-
limit?: number;
|
|
162
172
|
cursor?: string | null;
|
|
173
|
+
limit?: number;
|
|
174
|
+
skip?: number;
|
|
175
|
+
status?: "all" | "existing" | "deleted";
|
|
176
|
+
metadataOnly?: boolean;
|
|
163
177
|
fields?: string[];
|
|
164
178
|
filter?: Record<string, unknown>;
|
|
165
179
|
}
|
|
@@ -334,10 +348,10 @@ interface MindooDBAppViewHandle {
|
|
|
334
348
|
listCategoryDocumentIds(categoryKey: string): Promise<string[]>;
|
|
335
349
|
dispose(): Promise<void>;
|
|
336
350
|
}
|
|
337
|
-
/**
|
|
338
|
-
interface
|
|
339
|
-
|
|
340
|
-
|
|
351
|
+
/** Payload used when creating one dynamic view inside the current app session. */
|
|
352
|
+
interface MindooDBAppCreateViewInput {
|
|
353
|
+
databaseId: string;
|
|
354
|
+
definition: MindooDBAppViewDefinition;
|
|
341
355
|
}
|
|
342
356
|
/** Attachment operations exposed by an opened database handle. */
|
|
343
357
|
interface MindooDBAppAttachmentApi {
|
|
@@ -347,12 +361,14 @@ interface MindooDBAppAttachmentApi {
|
|
|
347
361
|
}>;
|
|
348
362
|
openReadStream(docId: string, attachmentName: string): Promise<MindooDBAppReadableAttachmentStream>;
|
|
349
363
|
openWriteStream(docId: string, attachmentName: string, contentType?: string): Promise<MindooDBAppWritableAttachmentStream>;
|
|
364
|
+
openPreview(docId: string, attachmentName: string, options?: MindooDBAppAttachmentPreviewOptions): Promise<{
|
|
365
|
+
ok: true;
|
|
366
|
+
}>;
|
|
350
367
|
}
|
|
351
368
|
/** Database handle returned from `session.openDatabase()`. */
|
|
352
369
|
interface MindooDBAppDatabase {
|
|
353
370
|
info(): Promise<MindooDBAppDatabaseInfo>;
|
|
354
371
|
documents: MindooDBAppDocumentApi;
|
|
355
|
-
views: MindooDBAppViewApi;
|
|
356
372
|
attachments: MindooDBAppAttachmentApi;
|
|
357
373
|
}
|
|
358
374
|
/** Connected session between the running app and the Administrator host. */
|
|
@@ -360,6 +376,8 @@ interface MindooDBAppSession {
|
|
|
360
376
|
getLaunchContext(): Promise<MindooDBAppLaunchContext>;
|
|
361
377
|
listDatabases(): Promise<MindooDBAppDatabaseInfo[]>;
|
|
362
378
|
openDatabase(databaseId: string): Promise<MindooDBAppDatabase>;
|
|
379
|
+
createView(input: MindooDBAppCreateViewInput): Promise<MindooDBAppViewHandle>;
|
|
380
|
+
openView(viewId: string): Promise<MindooDBAppViewHandle>;
|
|
363
381
|
onThemeChange(listener: (theme: MindooDBAppHostTheme) => void): () => void;
|
|
364
382
|
onViewportChange(listener: (viewport: MindooDBAppViewport) => void): () => void;
|
|
365
383
|
disconnect(): Promise<void>;
|
|
@@ -369,4 +387,4 @@ interface MindooDBAppBridge {
|
|
|
369
387
|
connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
|
|
370
388
|
}
|
|
371
389
|
|
|
372
|
-
export type {
|
|
390
|
+
export type { MindooDBAppHostTheme as $, MindooDBAppConfiguredViewColumn as A, MindooDBAppConfiguredViewColumnRole as B, MindooDBAppConfiguredViewExpressionMode as C, MindooDBAppConfiguredViewFieldExpression as D, MindooDBAppConfiguredViewFilterDefinition as E, MindooDBAppConfiguredViewFilterMode as F, MindooDBAppConfiguredViewFilterRule as G, MindooDBAppConfiguredViewFormulaExpression as H, MindooDBAppConfiguredViewFormulaFilterDefinition as I, MindooDBAppConfiguredViewPreviewMode as J, MindooDBAppConfiguredViewRuleFilterDefinition as K, MindooDBAppConfiguredViewRuleMatchMode as L, MindooDBAppAttachmentPreviewMode as M, MindooDBAppConfiguredViewRuleOperator as N, MindooDBAppConfiguredViewValueExpression as O, MindooDBAppCreateDocumentInput as P, MindooDBAppCreateViewInput as Q, MindooDBAppDatabase as R, MindooDBAppDatabaseInfo as S, MindooDBAppDocument as T, MindooDBAppDocumentApi as U, MindooDBAppDocumentHistoryEntry as V, MindooDBAppDocumentListQuery as W, MindooDBAppDocumentListResult as X, MindooDBAppDocumentSummary as Y, MindooDBAppHistoricalDocument as Z, MindooDBAppHistoryQuery as _, MindooDBAppBridge as a, MindooDBAppLaunchContext as a0, MindooDBAppReadableAttachmentStream as a1, MindooDBAppResolvedViewDefinition as a2, MindooDBAppResolvedViewSource as a3, MindooDBAppRuntime as a4, MindooDBAppSession as a5, MindooDBAppThemeMode as a6, MindooDBAppUpdateDocumentInput as a7, MindooDBAppViewHandle as a8, MindooDBAppViewport as a9, MindooDBAppWritableAttachmentStream as aa, MindooDBAppAttachmentApi as b, MindooDBAppAttachmentChunk as c, MindooDBAppAttachmentInfo as d, MindooDBAppAttachmentPreviewOptions as e, MindooDBAppBridgeConnectMessage as f, MindooDBAppBridgeConnectOptions as g, MindooDBAppBridgeConnectedMessage as h, MindooDBAppBridgeErrorPayload as i, MindooDBAppBridgePortMessage as j, MindooDBAppBridgeRpcError as k, MindooDBAppBridgeRpcMessage as l, MindooDBAppBridgeRpcRequest as m, MindooDBAppBridgeRpcSuccess as n, MindooDBAppBridgeStreamAbortRequest as o, MindooDBAppBridgeStreamAck as p, MindooDBAppBridgeStreamCloseRequest as q, MindooDBAppBridgeStreamError as r, MindooDBAppBridgeStreamMessage as s, MindooDBAppBridgeStreamOpenResult as t, MindooDBAppBridgeStreamReadRequest as u, MindooDBAppBridgeStreamWriteRequest as v, MindooDBAppBridgeThemeChangedMessage as w, MindooDBAppBridgeViewportChangedMessage as x, MindooDBAppCapability as y, MindooDBAppConfiguredViewCategorizationStyle as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindoodb-app-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "MindooDB app SDK for building apps that connect to the Haven host bridge",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "Mindoo GmbH",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"prepublishOnly": "npm run build && npm run test"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"mindoodb-view-language": "
|
|
43
|
+
"mindoodb-view-language": "0.0.6"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.5.0",
|