mindoodb-app-sdk 0.0.7 → 0.0.9
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 +198 -29
- package/dist/index.d.ts +2 -2
- package/dist/index.js +165 -68
- package/dist/testing/index.d.ts +4 -4
- package/dist/testing/index.js +347 -89
- package/dist/{types-u5bAeQwY.d.ts → types-Bh1Q2qGN.d.ts} +188 -22
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppViewSortDirection, MindooDBAppViewTotalMode, MindooDBAppViewDefinition
|
|
1
|
+
import { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppViewSortDirection, MindooDBAppViewTotalMode, MindooDBAppViewDefinition } from 'mindoodb-view-language';
|
|
2
2
|
|
|
3
3
|
/** Launch target used by the Administrator when opening an app. */
|
|
4
4
|
type MindooDBAppRuntime = "iframe" | "window";
|
|
@@ -313,6 +313,74 @@ interface MindooDBAppBridgeViewportChangedMessage {
|
|
|
313
313
|
}
|
|
314
314
|
/** Any message that can travel across the dedicated bridge MessagePort. */
|
|
315
315
|
type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage;
|
|
316
|
+
/** Placement hint for a host-rendered overlay menu. */
|
|
317
|
+
type MindooDBAppMenuPlacement = "auto" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | "right-start" | "left-start";
|
|
318
|
+
/** Semantic hint allowing Haven to tune menu behavior or styling. */
|
|
319
|
+
type MindooDBAppMenuKind = "context" | "dropdown" | "picker";
|
|
320
|
+
/** Rectangle expressed in app-viewport coordinates. */
|
|
321
|
+
interface MindooDBAppMenuRect {
|
|
322
|
+
left: number;
|
|
323
|
+
top: number;
|
|
324
|
+
width: number;
|
|
325
|
+
height: number;
|
|
326
|
+
}
|
|
327
|
+
/** Point anchor used for context menus or other click-triggered overlays. */
|
|
328
|
+
interface MindooDBAppMenuPointAnchor {
|
|
329
|
+
type: "point";
|
|
330
|
+
x: number;
|
|
331
|
+
y: number;
|
|
332
|
+
}
|
|
333
|
+
/** Rectangle anchor used for toolbar menus or picker buttons. */
|
|
334
|
+
interface MindooDBAppMenuRectAnchor {
|
|
335
|
+
type: "rect";
|
|
336
|
+
rect: MindooDBAppMenuRect;
|
|
337
|
+
}
|
|
338
|
+
/** Anchor describing where the host should position the rendered menu. */
|
|
339
|
+
type MindooDBAppMenuAnchor = MindooDBAppMenuPointAnchor | MindooDBAppMenuRectAnchor;
|
|
340
|
+
/** Visual separator between menu groups. */
|
|
341
|
+
interface MindooDBAppMenuSeparatorItem {
|
|
342
|
+
separator: true;
|
|
343
|
+
}
|
|
344
|
+
/** One actionable entry in a structured host-rendered menu. */
|
|
345
|
+
interface MindooDBAppMenuCommandItem {
|
|
346
|
+
id: string;
|
|
347
|
+
label: string;
|
|
348
|
+
enabled?: boolean;
|
|
349
|
+
destructive?: boolean;
|
|
350
|
+
checked?: boolean;
|
|
351
|
+
items?: MindooDBAppMenuItem[];
|
|
352
|
+
}
|
|
353
|
+
/** Structured menu item transported over the app bridge. */
|
|
354
|
+
type MindooDBAppMenuItem = MindooDBAppMenuSeparatorItem | MindooDBAppMenuCommandItem;
|
|
355
|
+
/** Request payload for a host-rendered overlay menu. */
|
|
356
|
+
interface MindooDBAppShowMenuInput {
|
|
357
|
+
anchor: MindooDBAppMenuAnchor;
|
|
358
|
+
placement?: MindooDBAppMenuPlacement;
|
|
359
|
+
kind?: MindooDBAppMenuKind;
|
|
360
|
+
items: MindooDBAppMenuItem[];
|
|
361
|
+
dismissOnOutsideClick?: boolean;
|
|
362
|
+
dismissOnEscape?: boolean;
|
|
363
|
+
dismissOnViewportChange?: boolean;
|
|
364
|
+
}
|
|
365
|
+
/** Reason why a host-rendered menu was dismissed without a selection. */
|
|
366
|
+
type MindooDBAppMenuDismissReason = "outside_click" | "escape" | "app_blur" | "viewport_change" | "hide" | "replaced";
|
|
367
|
+
/** Successful selection result returned from a host-rendered menu. */
|
|
368
|
+
interface MindooDBAppMenuSelectionResult {
|
|
369
|
+
action: "selected";
|
|
370
|
+
itemId: string;
|
|
371
|
+
}
|
|
372
|
+
/** Dismissal result returned from a host-rendered menu. */
|
|
373
|
+
interface MindooDBAppMenuDismissedResult {
|
|
374
|
+
action: "dismissed";
|
|
375
|
+
reason: MindooDBAppMenuDismissReason;
|
|
376
|
+
}
|
|
377
|
+
/** Result returned when Haven closes or resolves a host-rendered menu. */
|
|
378
|
+
type MindooDBAppShowMenuResult = MindooDBAppMenuSelectionResult | MindooDBAppMenuDismissedResult;
|
|
379
|
+
/** Overlay menu operations exposed by the host session. */
|
|
380
|
+
interface MindooDBAppMenuApi {
|
|
381
|
+
show(input: MindooDBAppShowMenuInput): Promise<MindooDBAppShowMenuResult>;
|
|
382
|
+
hide(): Promise<void>;
|
|
383
|
+
}
|
|
316
384
|
/** Pull-based read stream for document attachments. */
|
|
317
385
|
interface MindooDBAppReadableAttachmentStream {
|
|
318
386
|
read(): Promise<Uint8Array | null>;
|
|
@@ -336,28 +404,125 @@ interface MindooDBAppDocumentApi {
|
|
|
336
404
|
listHistory(docId: string): Promise<MindooDBAppDocumentHistoryEntry[]>;
|
|
337
405
|
getAtTimestamp(docId: string, timestamp: number): Promise<MindooDBAppHistoricalDocument>;
|
|
338
406
|
}
|
|
339
|
-
|
|
340
|
-
|
|
407
|
+
type MindooDBAppViewEntryKind = "category" | "document";
|
|
408
|
+
/** Unique document identity within a multi-source view. */
|
|
409
|
+
interface MindooDBAppScopedDocId {
|
|
410
|
+
origin: string;
|
|
411
|
+
docId: string;
|
|
412
|
+
}
|
|
413
|
+
/** Serialized view entry returned by the navigator APIs. */
|
|
414
|
+
interface MindooDBAppViewEntry {
|
|
415
|
+
/** Unique occurrence key within the current navigator session. */
|
|
416
|
+
key: string;
|
|
417
|
+
kind: MindooDBAppViewEntryKind;
|
|
418
|
+
origin: string;
|
|
419
|
+
docId: string | null;
|
|
420
|
+
level: number;
|
|
421
|
+
parentKey: string | null;
|
|
422
|
+
categoryPath: unknown[];
|
|
423
|
+
columnValues: Record<string, unknown>;
|
|
424
|
+
descendantDocumentCount: number;
|
|
425
|
+
childCategoryCount: number;
|
|
426
|
+
childDocumentCount: number;
|
|
427
|
+
/** Stable continuation token for the current occurrence. */
|
|
428
|
+
position: string | null;
|
|
429
|
+
expanded: boolean;
|
|
430
|
+
selected: boolean;
|
|
431
|
+
isVisible: boolean;
|
|
432
|
+
}
|
|
433
|
+
/** Options that shape which subtree and entry kinds a navigator exposes. */
|
|
434
|
+
interface MindooDBAppViewNavigatorOpenOptions {
|
|
435
|
+
includeCategories?: boolean;
|
|
436
|
+
includeDocuments?: boolean;
|
|
437
|
+
hideEmptyCategories?: boolean;
|
|
438
|
+
rootCategoryPath?: unknown[];
|
|
439
|
+
rootEntryKey?: string;
|
|
440
|
+
}
|
|
441
|
+
/** Input used when creating a dynamic view and immediately opening a navigator. */
|
|
442
|
+
interface MindooDBAppCreateViewNavigatorInput {
|
|
443
|
+
databaseIds: string[];
|
|
444
|
+
definition: MindooDBAppViewDefinition;
|
|
445
|
+
options?: MindooDBAppViewNavigatorOpenOptions;
|
|
446
|
+
}
|
|
447
|
+
/** @deprecated Use `MindooDBAppCreateViewNavigatorInput`. */
|
|
448
|
+
type MindooDBAppCreateViewInput = MindooDBAppCreateViewNavigatorInput;
|
|
449
|
+
/** Range query options for key and key-range lookups within a category. */
|
|
450
|
+
interface MindooDBAppViewNavigatorRangeQuery {
|
|
451
|
+
startKey?: unknown;
|
|
452
|
+
endKey?: unknown;
|
|
453
|
+
descending?: boolean;
|
|
454
|
+
exact?: boolean;
|
|
455
|
+
}
|
|
456
|
+
/** Options for batched navigator reads. */
|
|
457
|
+
interface MindooDBAppViewNavigatorPageOptions {
|
|
458
|
+
limit?: number;
|
|
459
|
+
selectedOnly?: boolean;
|
|
460
|
+
startPosition?: string | null;
|
|
461
|
+
}
|
|
462
|
+
/** Paged batch of navigator entries. */
|
|
463
|
+
interface MindooDBAppViewNavigatorPageResult {
|
|
464
|
+
entries: MindooDBAppViewEntry[];
|
|
465
|
+
nextPosition: string | null;
|
|
466
|
+
hasMore: boolean;
|
|
467
|
+
}
|
|
468
|
+
/** Serializable selection state for restoring a navigator session. */
|
|
469
|
+
interface MindooDBAppViewNavigatorSelectionState {
|
|
470
|
+
selectAllByDefault: boolean;
|
|
471
|
+
entryKeys: string[];
|
|
472
|
+
}
|
|
473
|
+
/** Serializable expansion state for restoring a navigator session. */
|
|
474
|
+
interface MindooDBAppViewNavigatorExpansionState {
|
|
475
|
+
expandAllByDefault: boolean;
|
|
476
|
+
expandLevel: number;
|
|
477
|
+
entryKeys: string[];
|
|
478
|
+
}
|
|
479
|
+
/** Stateful view navigator that closely mirrors the core VirtualViewNavigator. */
|
|
480
|
+
interface MindooDBAppViewNavigator {
|
|
341
481
|
getDefinition(): Promise<MindooDBAppViewDefinition>;
|
|
342
482
|
refresh(): Promise<void>;
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
483
|
+
getCurrentEntry(): Promise<MindooDBAppViewEntry | null>;
|
|
484
|
+
gotoFirst(): Promise<boolean>;
|
|
485
|
+
gotoLast(): Promise<boolean>;
|
|
486
|
+
gotoNext(): Promise<boolean>;
|
|
487
|
+
gotoPrev(): Promise<boolean>;
|
|
488
|
+
gotoNextSibling(): Promise<boolean>;
|
|
489
|
+
gotoPrevSibling(): Promise<boolean>;
|
|
490
|
+
gotoParent(): Promise<boolean>;
|
|
491
|
+
gotoFirstChild(): Promise<boolean>;
|
|
492
|
+
gotoLastChild(): Promise<boolean>;
|
|
493
|
+
gotoPos(position: string): Promise<boolean>;
|
|
494
|
+
getPos(position: string): Promise<MindooDBAppViewEntry | null>;
|
|
495
|
+
findCategoryEntryByParts(parts: unknown[]): Promise<MindooDBAppViewEntry | null>;
|
|
496
|
+
entriesForward(options?: MindooDBAppViewNavigatorPageOptions): Promise<MindooDBAppViewNavigatorPageResult>;
|
|
497
|
+
entriesBackward(options?: MindooDBAppViewNavigatorPageOptions): Promise<MindooDBAppViewNavigatorPageResult>;
|
|
498
|
+
gotoNextSelected(): Promise<boolean>;
|
|
499
|
+
gotoPrevSelected(): Promise<boolean>;
|
|
500
|
+
select(origin: string, docId: string, selectParentCategories?: boolean): Promise<void>;
|
|
501
|
+
deselect(origin: string, docId: string): Promise<void>;
|
|
502
|
+
selectAllEntries(): Promise<void>;
|
|
503
|
+
deselectAllEntries(): Promise<void>;
|
|
504
|
+
isSelected(origin: string, docId: string): Promise<boolean>;
|
|
505
|
+
getSelectionState(): Promise<MindooDBAppViewNavigatorSelectionState>;
|
|
506
|
+
setSelectionState(state: MindooDBAppViewNavigatorSelectionState): Promise<void>;
|
|
507
|
+
expand(origin: string, docId: string): Promise<void>;
|
|
508
|
+
collapse(origin: string, docId: string): Promise<void>;
|
|
509
|
+
expandAll(): Promise<void>;
|
|
510
|
+
collapseAll(): Promise<void>;
|
|
511
|
+
expandToLevel(level: number): Promise<void>;
|
|
512
|
+
isExpanded(entryKey: string): Promise<boolean>;
|
|
513
|
+
getExpansionState(): Promise<MindooDBAppViewNavigatorExpansionState>;
|
|
514
|
+
setExpansionState(state: MindooDBAppViewNavigatorExpansionState): Promise<void>;
|
|
515
|
+
childEntries(entryKey: string, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
|
|
516
|
+
childCategories(entryKey: string, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
|
|
517
|
+
childDocuments(entryKey: string, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
|
|
518
|
+
childCategoriesByKey(entryKey: string, key: unknown, exact?: boolean, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
|
|
519
|
+
childDocumentsByKey(entryKey: string, key: unknown, exact?: boolean, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
|
|
520
|
+
childCategoriesBetween(entryKey: string, range: MindooDBAppViewNavigatorRangeQuery): Promise<MindooDBAppViewEntry[]>;
|
|
521
|
+
childDocumentsBetween(entryKey: string, range: MindooDBAppViewNavigatorRangeQuery): Promise<MindooDBAppViewEntry[]>;
|
|
522
|
+
getSortedDocIds(descending?: boolean): Promise<MindooDBAppScopedDocId[]>;
|
|
523
|
+
getSortedDocIdsScoped(entryKey: string, descending?: boolean): Promise<MindooDBAppScopedDocId[]>;
|
|
354
524
|
dispose(): Promise<void>;
|
|
355
525
|
}
|
|
356
|
-
/** Payload used when creating one dynamic view inside the current app session. */
|
|
357
|
-
interface MindooDBAppCreateViewInput {
|
|
358
|
-
databaseId: string;
|
|
359
|
-
definition: MindooDBAppViewDefinition;
|
|
360
|
-
}
|
|
361
526
|
/** Attachment operations exposed by an opened database handle. */
|
|
362
527
|
interface MindooDBAppAttachmentApi {
|
|
363
528
|
list(docId: string): Promise<MindooDBAppAttachmentInfo[]>;
|
|
@@ -382,8 +547,9 @@ interface MindooDBAppSession {
|
|
|
382
547
|
getLaunchContext(): Promise<MindooDBAppLaunchContext>;
|
|
383
548
|
listDatabases(): Promise<MindooDBAppDatabaseInfo[]>;
|
|
384
549
|
openDatabase(databaseId: string): Promise<MindooDBAppDatabase>;
|
|
385
|
-
|
|
386
|
-
|
|
550
|
+
createViewNavigator(input: MindooDBAppCreateViewNavigatorInput): Promise<MindooDBAppViewNavigator>;
|
|
551
|
+
openViewNavigator(viewId: string, options?: MindooDBAppViewNavigatorOpenOptions): Promise<MindooDBAppViewNavigator>;
|
|
552
|
+
menus: MindooDBAppMenuApi;
|
|
387
553
|
onThemeChange(listener: (theme: MindooDBAppHostTheme) => void): () => void;
|
|
388
554
|
onViewportChange(listener: (viewport: MindooDBAppViewport) => void): () => void;
|
|
389
555
|
disconnect(): Promise<void>;
|
|
@@ -393,4 +559,4 @@ interface MindooDBAppBridge {
|
|
|
393
559
|
connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
|
|
394
560
|
}
|
|
395
561
|
|
|
396
|
-
export type {
|
|
562
|
+
export type { MindooDBAppHistoricalDocument as $, MindooDBAppConfiguredViewCategorizationStyle as A, MindooDBAppConfiguredViewColumn as B, MindooDBAppConfiguredViewColumnRole as C, MindooDBAppConfiguredViewExpressionMode as D, MindooDBAppConfiguredViewFieldExpression as E, MindooDBAppConfiguredViewFilterDefinition as F, MindooDBAppConfiguredViewFilterMode as G, MindooDBAppConfiguredViewFilterRule as H, MindooDBAppConfiguredViewFormulaExpression as I, MindooDBAppConfiguredViewFormulaFilterDefinition as J, MindooDBAppConfiguredViewPreviewMode as K, MindooDBAppConfiguredViewRuleFilterDefinition as L, MindooDBAppAttachmentPreviewMode as M, MindooDBAppConfiguredViewRuleMatchMode as N, MindooDBAppConfiguredViewRuleOperator as O, MindooDBAppConfiguredViewValueExpression as P, MindooDBAppCreateDocumentInput as Q, MindooDBAppCreateViewInput as R, MindooDBAppCreateViewNavigatorInput as S, MindooDBAppDatabase as T, MindooDBAppDatabaseInfo as U, MindooDBAppDocument as V, MindooDBAppDocumentApi as W, MindooDBAppDocumentHistoryEntry as X, MindooDBAppDocumentListQuery as Y, MindooDBAppDocumentListResult as Z, MindooDBAppDocumentSummary as _, MindooDBAppBridge as a, MindooDBAppHistoryQuery as a0, MindooDBAppHostTheme as a1, MindooDBAppLaunchContext as a2, MindooDBAppMenuAnchor as a3, MindooDBAppMenuApi as a4, MindooDBAppMenuCommandItem as a5, MindooDBAppMenuDismissReason as a6, MindooDBAppMenuDismissedResult as a7, MindooDBAppMenuItem as a8, MindooDBAppMenuKind as a9, MindooDBAppWritableAttachmentStream as aA, MindooDBAppMenuPlacement as aa, MindooDBAppMenuPointAnchor as ab, MindooDBAppMenuRect as ac, MindooDBAppMenuRectAnchor as ad, MindooDBAppMenuSelectionResult as ae, MindooDBAppMenuSeparatorItem as af, MindooDBAppReadableAttachmentStream as ag, MindooDBAppResolvedViewDefinition as ah, MindooDBAppResolvedViewSource as ai, MindooDBAppRuntime as aj, MindooDBAppScopedDocId as ak, MindooDBAppSession as al, MindooDBAppShowMenuInput as am, MindooDBAppShowMenuResult as an, MindooDBAppThemeMode as ao, MindooDBAppUpdateDocumentInput as ap, MindooDBAppViewEntry as aq, MindooDBAppViewEntryKind as ar, MindooDBAppViewNavigator as as, MindooDBAppViewNavigatorExpansionState as at, MindooDBAppViewNavigatorOpenOptions as au, MindooDBAppViewNavigatorPageOptions as av, MindooDBAppViewNavigatorPageResult as aw, MindooDBAppViewNavigatorRangeQuery as ax, MindooDBAppViewNavigatorSelectionState as ay, MindooDBAppViewport as az, MindooDBAppAttachmentApi as b, MindooDBAppAttachmentChunk as c, MindooDBAppAttachmentInfo as d, MindooDBAppAttachmentPreviewOptions as e, MindooDBAppAttachmentPreviewSession as f, MindooDBAppBridgeConnectMessage as g, MindooDBAppBridgeConnectOptions as h, MindooDBAppBridgeConnectedMessage as i, MindooDBAppBridgeErrorPayload as j, MindooDBAppBridgePortMessage as k, MindooDBAppBridgeRpcError as l, MindooDBAppBridgeRpcMessage as m, MindooDBAppBridgeRpcRequest as n, MindooDBAppBridgeRpcSuccess as o, MindooDBAppBridgeStreamAbortRequest as p, MindooDBAppBridgeStreamAck as q, MindooDBAppBridgeStreamCloseRequest as r, MindooDBAppBridgeStreamError as s, MindooDBAppBridgeStreamMessage as t, MindooDBAppBridgeStreamOpenResult as u, MindooDBAppBridgeStreamReadRequest as v, MindooDBAppBridgeStreamWriteRequest as w, MindooDBAppBridgeThemeChangedMessage as x, MindooDBAppBridgeViewportChangedMessage as y, MindooDBAppCapability 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.9",
|
|
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": "0.0.
|
|
43
|
+
"mindoodb-view-language": "0.0.9"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.5.0",
|