mindoodb-app-sdk 0.0.6 → 0.0.8

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.
@@ -1,4 +1,4 @@
1
- import { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppViewSortDirection, MindooDBAppViewTotalMode, MindooDBAppViewDefinition, MindooDBAppViewPageRequest, MindooDBAppViewPageResult, MindooDBAppViewExpansionState, MindooDBAppViewRow, MindooDBAppViewLookupByPath, MindooDBAppViewCategoryChildrenPageRequest } from 'mindoodb-view-language';
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";
@@ -126,6 +126,11 @@ interface MindooDBAppAttachmentPreviewOptions {
126
126
  /** Historical snapshot timestamp previously obtained from `documents.history.getAtTimestamp()`. */
127
127
  timestamp?: number;
128
128
  }
129
+ /** Resolved Haven preview session prepared for opening in a separate tab or window. */
130
+ interface MindooDBAppAttachmentPreviewSession {
131
+ sessionId: string;
132
+ previewUrl: string;
133
+ }
129
134
  /** Database entry visible to the app during launch and database listing. */
130
135
  interface MindooDBAppDatabaseInfo {
131
136
  id: string;
@@ -331,28 +336,125 @@ interface MindooDBAppDocumentApi {
331
336
  listHistory(docId: string): Promise<MindooDBAppDocumentHistoryEntry[]>;
332
337
  getAtTimestamp(docId: string, timestamp: number): Promise<MindooDBAppHistoricalDocument>;
333
338
  }
334
- /** Handle for one created or opened virtual view. */
335
- interface MindooDBAppViewHandle {
339
+ type MindooDBAppViewEntryKind = "category" | "document";
340
+ /** Unique document identity within a multi-source view. */
341
+ interface MindooDBAppScopedDocId {
342
+ origin: string;
343
+ docId: string;
344
+ }
345
+ /** Serialized view entry returned by the navigator APIs. */
346
+ interface MindooDBAppViewEntry {
347
+ /** Unique occurrence key within the current navigator session. */
348
+ key: string;
349
+ kind: MindooDBAppViewEntryKind;
350
+ origin: string;
351
+ docId: string | null;
352
+ level: number;
353
+ parentKey: string | null;
354
+ categoryPath: unknown[];
355
+ columnValues: Record<string, unknown>;
356
+ descendantDocumentCount: number;
357
+ childCategoryCount: number;
358
+ childDocumentCount: number;
359
+ /** Stable continuation token for the current occurrence. */
360
+ position: string | null;
361
+ expanded: boolean;
362
+ selected: boolean;
363
+ isVisible: boolean;
364
+ }
365
+ /** Options that shape which subtree and entry kinds a navigator exposes. */
366
+ interface MindooDBAppViewNavigatorOpenOptions {
367
+ includeCategories?: boolean;
368
+ includeDocuments?: boolean;
369
+ hideEmptyCategories?: boolean;
370
+ rootCategoryPath?: unknown[];
371
+ rootEntryKey?: string;
372
+ }
373
+ /** Input used when creating a dynamic view and immediately opening a navigator. */
374
+ interface MindooDBAppCreateViewNavigatorInput {
375
+ databaseIds: string[];
376
+ definition: MindooDBAppViewDefinition;
377
+ options?: MindooDBAppViewNavigatorOpenOptions;
378
+ }
379
+ /** @deprecated Use `MindooDBAppCreateViewNavigatorInput`. */
380
+ type MindooDBAppCreateViewInput = MindooDBAppCreateViewNavigatorInput;
381
+ /** Range query options for key and key-range lookups within a category. */
382
+ interface MindooDBAppViewNavigatorRangeQuery {
383
+ startKey?: unknown;
384
+ endKey?: unknown;
385
+ descending?: boolean;
386
+ exact?: boolean;
387
+ }
388
+ /** Options for batched navigator reads. */
389
+ interface MindooDBAppViewNavigatorPageOptions {
390
+ limit?: number;
391
+ selectedOnly?: boolean;
392
+ startPosition?: string | null;
393
+ }
394
+ /** Paged batch of navigator entries. */
395
+ interface MindooDBAppViewNavigatorPageResult {
396
+ entries: MindooDBAppViewEntry[];
397
+ nextPosition: string | null;
398
+ hasMore: boolean;
399
+ }
400
+ /** Serializable selection state for restoring a navigator session. */
401
+ interface MindooDBAppViewNavigatorSelectionState {
402
+ selectAllByDefault: boolean;
403
+ entryKeys: string[];
404
+ }
405
+ /** Serializable expansion state for restoring a navigator session. */
406
+ interface MindooDBAppViewNavigatorExpansionState {
407
+ expandAllByDefault: boolean;
408
+ expandLevel: number;
409
+ entryKeys: string[];
410
+ }
411
+ /** Stateful view navigator that closely mirrors the core VirtualViewNavigator. */
412
+ interface MindooDBAppViewNavigator {
336
413
  getDefinition(): Promise<MindooDBAppViewDefinition>;
337
414
  refresh(): Promise<void>;
338
- page(input?: MindooDBAppViewPageRequest): Promise<MindooDBAppViewPageResult>;
339
- getExpansionState(): Promise<MindooDBAppViewExpansionState>;
340
- setExpansionState(state: MindooDBAppViewExpansionState): Promise<MindooDBAppViewExpansionState>;
341
- expand(rowKey: string): Promise<MindooDBAppViewExpansionState>;
342
- collapse(rowKey: string): Promise<MindooDBAppViewExpansionState>;
343
- expandAll(): Promise<MindooDBAppViewExpansionState>;
344
- collapseAll(): Promise<MindooDBAppViewExpansionState>;
345
- getRow(rowKey: string): Promise<MindooDBAppViewRow | null>;
346
- getCategory(input: MindooDBAppViewLookupByPath): Promise<MindooDBAppViewRow | null>;
347
- pageCategory(categoryKey: string, input?: MindooDBAppViewCategoryChildrenPageRequest): Promise<MindooDBAppViewPageResult>;
348
- listCategoryDocumentIds(categoryKey: string): Promise<string[]>;
415
+ getCurrentEntry(): Promise<MindooDBAppViewEntry | null>;
416
+ gotoFirst(): Promise<boolean>;
417
+ gotoLast(): Promise<boolean>;
418
+ gotoNext(): Promise<boolean>;
419
+ gotoPrev(): Promise<boolean>;
420
+ gotoNextSibling(): Promise<boolean>;
421
+ gotoPrevSibling(): Promise<boolean>;
422
+ gotoParent(): Promise<boolean>;
423
+ gotoFirstChild(): Promise<boolean>;
424
+ gotoLastChild(): Promise<boolean>;
425
+ gotoPos(position: string): Promise<boolean>;
426
+ getPos(position: string): Promise<MindooDBAppViewEntry | null>;
427
+ findCategoryEntryByParts(parts: unknown[]): Promise<MindooDBAppViewEntry | null>;
428
+ entriesForward(options?: MindooDBAppViewNavigatorPageOptions): Promise<MindooDBAppViewNavigatorPageResult>;
429
+ entriesBackward(options?: MindooDBAppViewNavigatorPageOptions): Promise<MindooDBAppViewNavigatorPageResult>;
430
+ gotoNextSelected(): Promise<boolean>;
431
+ gotoPrevSelected(): Promise<boolean>;
432
+ select(origin: string, docId: string, selectParentCategories?: boolean): Promise<void>;
433
+ deselect(origin: string, docId: string): Promise<void>;
434
+ selectAllEntries(): Promise<void>;
435
+ deselectAllEntries(): Promise<void>;
436
+ isSelected(origin: string, docId: string): Promise<boolean>;
437
+ getSelectionState(): Promise<MindooDBAppViewNavigatorSelectionState>;
438
+ setSelectionState(state: MindooDBAppViewNavigatorSelectionState): Promise<void>;
439
+ expand(origin: string, docId: string): Promise<void>;
440
+ collapse(origin: string, docId: string): Promise<void>;
441
+ expandAll(): Promise<void>;
442
+ collapseAll(): Promise<void>;
443
+ expandToLevel(level: number): Promise<void>;
444
+ isExpanded(entryKey: string): Promise<boolean>;
445
+ getExpansionState(): Promise<MindooDBAppViewNavigatorExpansionState>;
446
+ setExpansionState(state: MindooDBAppViewNavigatorExpansionState): Promise<void>;
447
+ childEntries(entryKey: string, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
448
+ childCategories(entryKey: string, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
449
+ childDocuments(entryKey: string, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
450
+ childCategoriesByKey(entryKey: string, key: unknown, exact?: boolean, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
451
+ childDocumentsByKey(entryKey: string, key: unknown, exact?: boolean, descending?: boolean): Promise<MindooDBAppViewEntry[]>;
452
+ childCategoriesBetween(entryKey: string, range: MindooDBAppViewNavigatorRangeQuery): Promise<MindooDBAppViewEntry[]>;
453
+ childDocumentsBetween(entryKey: string, range: MindooDBAppViewNavigatorRangeQuery): Promise<MindooDBAppViewEntry[]>;
454
+ getSortedDocIds(descending?: boolean): Promise<MindooDBAppScopedDocId[]>;
455
+ getSortedDocIdsScoped(entryKey: string, descending?: boolean): Promise<MindooDBAppScopedDocId[]>;
349
456
  dispose(): Promise<void>;
350
457
  }
351
- /** Payload used when creating one dynamic view inside the current app session. */
352
- interface MindooDBAppCreateViewInput {
353
- databaseId: string;
354
- definition: MindooDBAppViewDefinition;
355
- }
356
458
  /** Attachment operations exposed by an opened database handle. */
357
459
  interface MindooDBAppAttachmentApi {
358
460
  list(docId: string): Promise<MindooDBAppAttachmentInfo[]>;
@@ -361,6 +463,7 @@ interface MindooDBAppAttachmentApi {
361
463
  }>;
362
464
  openReadStream(docId: string, attachmentName: string): Promise<MindooDBAppReadableAttachmentStream>;
363
465
  openWriteStream(docId: string, attachmentName: string, contentType?: string): Promise<MindooDBAppWritableAttachmentStream>;
466
+ preparePreviewSession(docId: string, attachmentName: string, options?: MindooDBAppAttachmentPreviewOptions): Promise<MindooDBAppAttachmentPreviewSession>;
364
467
  openPreview(docId: string, attachmentName: string, options?: MindooDBAppAttachmentPreviewOptions): Promise<{
365
468
  ok: true;
366
469
  }>;
@@ -376,8 +479,8 @@ interface MindooDBAppSession {
376
479
  getLaunchContext(): Promise<MindooDBAppLaunchContext>;
377
480
  listDatabases(): Promise<MindooDBAppDatabaseInfo[]>;
378
481
  openDatabase(databaseId: string): Promise<MindooDBAppDatabase>;
379
- createView(input: MindooDBAppCreateViewInput): Promise<MindooDBAppViewHandle>;
380
- openView(viewId: string): Promise<MindooDBAppViewHandle>;
482
+ createViewNavigator(input: MindooDBAppCreateViewNavigatorInput): Promise<MindooDBAppViewNavigator>;
483
+ openViewNavigator(viewId: string, options?: MindooDBAppViewNavigatorOpenOptions): Promise<MindooDBAppViewNavigator>;
381
484
  onThemeChange(listener: (theme: MindooDBAppHostTheme) => void): () => void;
382
485
  onViewportChange(listener: (viewport: MindooDBAppViewport) => void): () => void;
383
486
  disconnect(): Promise<void>;
@@ -387,4 +490,4 @@ interface MindooDBAppBridge {
387
490
  connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
388
491
  }
389
492
 
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 };
493
+ 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, MindooDBAppReadableAttachmentStream as a3, MindooDBAppResolvedViewDefinition as a4, MindooDBAppResolvedViewSource as a5, MindooDBAppRuntime as a6, MindooDBAppScopedDocId as a7, MindooDBAppSession as a8, MindooDBAppThemeMode as a9, MindooDBAppUpdateDocumentInput as aa, MindooDBAppViewEntry as ab, MindooDBAppViewEntryKind as ac, MindooDBAppViewNavigator as ad, MindooDBAppViewNavigatorExpansionState as ae, MindooDBAppViewNavigatorOpenOptions as af, MindooDBAppViewNavigatorPageOptions as ag, MindooDBAppViewNavigatorPageResult as ah, MindooDBAppViewNavigatorRangeQuery as ai, MindooDBAppViewNavigatorSelectionState as aj, MindooDBAppViewport as ak, MindooDBAppWritableAttachmentStream as al, 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.6",
3
+ "version": "0.0.8",
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.6"
43
+ "mindoodb-view-language": "0.0.7"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^25.5.0",