mindoodb-app-sdk 0.0.10 → 0.0.11

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 CHANGED
@@ -107,10 +107,31 @@ session.onViewportChange((viewport) => {
107
107
  const db = await session.openDatabase(ctx.databases[0]!.id);
108
108
  const result = await db.documents.list({ limit: 25 });
109
109
  console.log("Documents:", result.items);
110
+
111
+ // 5. Open a Haven-configured view
112
+ //
113
+ // A "view" is a pre-built, categorized query that a Haven administrator
114
+ // attaches to your app (think: a pivot table over one or more databases).
115
+ // `ctx.views` is the list of views that were made available at launch time.
116
+ // `openViewNavigator()` returns a stateful "cursor" over the view's rows
117
+ // that you can page through and navigate entry by entry.
118
+ if (ctx.views[0]) {
119
+ const viewNav = await session.openViewNavigator(ctx.views[0].id);
120
+
121
+ // Move the cursor to the first row and read a batch of visible entries.
122
+ await viewNav.gotoFirst();
123
+ const page = await viewNav.entriesForward({ limit: 50 });
124
+ console.log("View rows:", page.entries);
125
+
126
+ // Always dispose when you are done -- this frees the host-side navigator.
127
+ await viewNav.dispose();
128
+ }
110
129
  ```
111
130
 
112
131
  When Haven launches your app it injects a `mindoodbAppLaunchId` query parameter into the URL. `connect()` reads it automatically -- no manual wiring needed.
113
132
 
133
+ > New to views? They are optional. If your app only needs raw document access you can stop at step 4. The full navigator API (paging, category expand/collapse, selection, child lookups, dynamic app-defined views via `session.createViewNavigator()`) is documented in the [Virtual Views](#virtual-views) section below, and the [`mindoodb-app-example`](https://github.com/klehmann/mindoodb-app-example) repo shows an end-to-end UI built on top of it.
134
+
114
135
  ## Core concepts
115
136
 
116
137
  ### Launch context
@@ -443,12 +464,13 @@ Haven includes a **built-in file viewer** that your app can open for common atta
443
464
  |---|---|
444
465
  | `image` | All common image formats (JPEG, PNG, GIF, WebP, SVG, ...) |
445
466
  | `pdf` | PDF documents |
446
- | `text` | Plain text, Markdown, CSV, JSON, XML, YAML, SVG, log files |
467
+ | `markdown` | Markdown rendered to HTML (.md, .markdown, .mdown, .mkd, .mkdn) |
468
+ | `text` | Plain text, CSV, JSON, XML, YAML, SVG, log files |
447
469
  | `docx` | Microsoft Word (.docx) |
448
470
  | `pptx` | Microsoft PowerPoint (.pptx) |
449
471
  | `spreadsheet` | Microsoft Excel (.xls, .xlsx, .xlsm, .xlsb) |
450
- | `video` | Video files with embedded player (streaming + seek support) |
451
- | `audio` | Audio files with embedded player (streaming + seek support) |
472
+ | `video` | Video files with embedded player, streaming + seek (.mp4, .m4v, .webm, .ogv, .ogg, plus any `video/*`) |
473
+ | `audio` | Audio files with embedded player, streaming + seek (.mp3, .m4a, .wav, .aac, .oga, plus any `audio/*`) |
452
474
 
453
475
  **Open the Haven preview dialog:**
454
476
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge } from './types-Bh1Q2qGN.js';
2
- export { b as MindooDBAppAttachmentApi, c as MindooDBAppAttachmentChunk, d as MindooDBAppAttachmentInfo, e as MindooDBAppAttachmentPreviewOptions, f as MindooDBAppAttachmentPreviewSession, g as MindooDBAppBridgeConnectMessage, h as MindooDBAppBridgeConnectOptions, i as MindooDBAppBridgeConnectedMessage, j as MindooDBAppBridgeErrorPayload, k as MindooDBAppBridgePortMessage, l as MindooDBAppBridgeRpcError, m as MindooDBAppBridgeRpcMessage, n as MindooDBAppBridgeRpcRequest, o as MindooDBAppBridgeRpcSuccess, p as MindooDBAppBridgeStreamAbortRequest, q as MindooDBAppBridgeStreamAck, r as MindooDBAppBridgeStreamCloseRequest, s as MindooDBAppBridgeStreamError, t as MindooDBAppBridgeStreamMessage, u as MindooDBAppBridgeStreamOpenResult, v as MindooDBAppBridgeStreamReadRequest, w as MindooDBAppBridgeStreamWriteRequest, x as MindooDBAppBridgeThemeChangedMessage, y as MindooDBAppBridgeViewportChangedMessage, z as MindooDBAppCapability, A as MindooDBAppConfiguredViewCategorizationStyle, B as MindooDBAppConfiguredViewColumn, C as MindooDBAppConfiguredViewColumnRole, D as MindooDBAppConfiguredViewExpressionMode, E as MindooDBAppConfiguredViewFieldExpression, F as MindooDBAppConfiguredViewFilterDefinition, G as MindooDBAppConfiguredViewFilterMode, H as MindooDBAppConfiguredViewFilterRule, I as MindooDBAppConfiguredViewFormulaExpression, J as MindooDBAppConfiguredViewFormulaFilterDefinition, K as MindooDBAppConfiguredViewPreviewMode, L as MindooDBAppConfiguredViewRuleFilterDefinition, N as MindooDBAppConfiguredViewRuleMatchMode, O as MindooDBAppConfiguredViewRuleOperator, P as MindooDBAppConfiguredViewValueExpression, Q as MindooDBAppCreateDocumentInput, R as MindooDBAppCreateViewInput, S as MindooDBAppCreateViewNavigatorInput, T as MindooDBAppDatabase, U as MindooDBAppDatabaseInfo, V as MindooDBAppDocument, W as MindooDBAppDocumentApi, X as MindooDBAppDocumentHistoryEntry, Y as MindooDBAppDocumentListQuery, Z as MindooDBAppDocumentListResult, _ as MindooDBAppDocumentSummary, $ as MindooDBAppHistoricalDocument, a0 as MindooDBAppHistoryQuery, a1 as MindooDBAppHostTheme, a2 as MindooDBAppLaunchContext, a3 as MindooDBAppMenuAnchor, a4 as MindooDBAppMenuApi, a5 as MindooDBAppMenuCommandItem, a6 as MindooDBAppMenuDismissReason, a7 as MindooDBAppMenuDismissedResult, a8 as MindooDBAppMenuItem, a9 as MindooDBAppMenuKind, aa as MindooDBAppMenuPlacement, ab as MindooDBAppMenuPointAnchor, ac as MindooDBAppMenuRect, ad as MindooDBAppMenuRectAnchor, ae as MindooDBAppMenuSelectionResult, af as MindooDBAppMenuSeparatorItem, ag as MindooDBAppReadableAttachmentStream, ah as MindooDBAppResolvedViewDefinition, ai as MindooDBAppResolvedViewSource, aj as MindooDBAppRuntime, ak as MindooDBAppScopedDocId, al as MindooDBAppSession, am as MindooDBAppShowMenuInput, an as MindooDBAppShowMenuResult, ao as MindooDBAppThemeMode, ap as MindooDBAppUpdateDocumentInput, aq as MindooDBAppViewEntry, ar as MindooDBAppViewEntryKind, as as MindooDBAppViewNavigator, at as MindooDBAppViewNavigatorExpansionState, au as MindooDBAppViewNavigatorOpenOptions, av as MindooDBAppViewNavigatorPageOptions, aw as MindooDBAppViewNavigatorPageResult, ax as MindooDBAppViewNavigatorRangeQuery, ay as MindooDBAppViewNavigatorSelectionState, az as MindooDBAppViewport, aA as MindooDBAppWritableAttachmentStream } from './types-Bh1Q2qGN.js';
1
+ import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge } from './types-vleeW9E5.js';
2
+ export { b as MindooDBAppAttachmentApi, c as MindooDBAppAttachmentChunk, d as MindooDBAppAttachmentInfo, e as MindooDBAppAttachmentPreviewOptions, f as MindooDBAppAttachmentPreviewSession, g as MindooDBAppBridgeConnectMessage, h as MindooDBAppBridgeConnectOptions, i as MindooDBAppBridgeConnectedMessage, j as MindooDBAppBridgeErrorPayload, k as MindooDBAppBridgePortMessage, l as MindooDBAppBridgeRpcError, m as MindooDBAppBridgeRpcMessage, n as MindooDBAppBridgeRpcRequest, o as MindooDBAppBridgeRpcSuccess, p as MindooDBAppBridgeStreamAbortRequest, q as MindooDBAppBridgeStreamAck, r as MindooDBAppBridgeStreamCloseRequest, s as MindooDBAppBridgeStreamError, t as MindooDBAppBridgeStreamMessage, u as MindooDBAppBridgeStreamOpenResult, v as MindooDBAppBridgeStreamReadRequest, w as MindooDBAppBridgeStreamWriteRequest, x as MindooDBAppBridgeThemeChangedMessage, y as MindooDBAppBridgeUiPreferencesChangedMessage, z as MindooDBAppBridgeViewportChangedMessage, A as MindooDBAppCapability, B as MindooDBAppConfiguredViewCategorizationStyle, C as MindooDBAppConfiguredViewColumn, D as MindooDBAppConfiguredViewColumnRole, E as MindooDBAppConfiguredViewExpressionMode, F as MindooDBAppConfiguredViewFieldExpression, G as MindooDBAppConfiguredViewFilterDefinition, H as MindooDBAppConfiguredViewFilterMode, I as MindooDBAppConfiguredViewFilterRule, J as MindooDBAppConfiguredViewFormulaExpression, K as MindooDBAppConfiguredViewFormulaFilterDefinition, L as MindooDBAppConfiguredViewPreviewMode, N as MindooDBAppConfiguredViewRuleFilterDefinition, O as MindooDBAppConfiguredViewRuleMatchMode, P as MindooDBAppConfiguredViewRuleOperator, Q as MindooDBAppConfiguredViewValueExpression, R as MindooDBAppCreateDocumentInput, S as MindooDBAppCreateViewInput, T as MindooDBAppCreateViewNavigatorInput, U as MindooDBAppDatabase, V as MindooDBAppDatabaseInfo, W as MindooDBAppDocument, X as MindooDBAppDocumentApi, Y as MindooDBAppDocumentHistoryEntry, Z as MindooDBAppDocumentListQuery, _ as MindooDBAppDocumentListResult, $ as MindooDBAppDocumentSummary, a0 as MindooDBAppHistoricalDocument, a1 as MindooDBAppHistoryQuery, a2 as MindooDBAppHostTheme, a3 as MindooDBAppLaunchContext, a4 as MindooDBAppMenuAnchor, a5 as MindooDBAppMenuApi, a6 as MindooDBAppMenuCommandItem, a7 as MindooDBAppMenuDismissReason, a8 as MindooDBAppMenuDismissedResult, a9 as MindooDBAppMenuItem, aa as MindooDBAppMenuKind, ab as MindooDBAppMenuPlacement, ac as MindooDBAppMenuPointAnchor, ad as MindooDBAppMenuRect, ae as MindooDBAppMenuRectAnchor, af as MindooDBAppMenuSelectionResult, ag as MindooDBAppMenuSeparatorItem, ah as MindooDBAppReadableAttachmentStream, ai as MindooDBAppResolvedViewDefinition, aj as MindooDBAppResolvedViewSource, ak as MindooDBAppRuntime, al as MindooDBAppScopedDocId, am as MindooDBAppSession, an as MindooDBAppShowMenuInput, ao as MindooDBAppShowMenuResult, ap as MindooDBAppThemeMode, aq as MindooDBAppUiPreferences, ar as MindooDBAppUpdateDocumentInput, as as MindooDBAppViewEntry, at as MindooDBAppViewEntryKind, au as MindooDBAppViewNavigator, av as MindooDBAppViewNavigatorExpansionState, aw as MindooDBAppViewNavigatorOpenOptions, ax as MindooDBAppViewNavigatorPageOptions, ay as MindooDBAppViewNavigatorPageResult, az as MindooDBAppViewNavigatorRangeQuery, aA as MindooDBAppViewNavigatorSelectionState, aB as MindooDBAppViewport, aC as MindooDBAppWritableAttachmentStream } from './types-vleeW9E5.js';
3
3
  export { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppFilterDefinition, MindooDBAppViewCategoryChildrenPageRequest, MindooDBAppViewColumn, MindooDBAppViewColumnRole, MindooDBAppViewDefinition, MindooDBAppViewExpansionState, MindooDBAppViewExpressionBase, MindooDBAppViewExpressionDatePart, MindooDBAppViewExpressionOperation, MindooDBAppViewFieldExpression, MindooDBAppViewIfExpression, MindooDBAppViewLetExpression, MindooDBAppViewLiteralExpression, MindooDBAppViewLookupByPath, MindooDBAppViewOperationExpression, MindooDBAppViewOriginExpression, MindooDBAppViewPageRequest, MindooDBAppViewPageResult, MindooDBAppViewRow, MindooDBAppViewSortDirection, MindooDBAppViewTotalMode, MindooDBAppViewValueExpressionRef, MindooDBAppViewVariableExpression, createViewLanguage } from 'mindoodb-view-language';
4
4
 
5
5
  /**
package/dist/index.js CHANGED
@@ -2,6 +2,9 @@
2
2
  function canPreviewAttachment(fileName, mimeType) {
3
3
  const normalizedMimeType = mimeType.toLowerCase();
4
4
  const normalizedFileName = fileName.toLowerCase();
5
+ if (normalizedMimeType === "text/markdown" || normalizedMimeType === "text/x-markdown" || normalizedMimeType === "application/markdown" || normalizedMimeType === "application/x-markdown" || normalizedFileName.endsWith(".md") || normalizedFileName.endsWith(".markdown") || normalizedFileName.endsWith(".mdown") || normalizedFileName.endsWith(".mkd") || normalizedFileName.endsWith(".mkdn")) {
6
+ return "markdown";
7
+ }
5
8
  if (normalizedMimeType.startsWith("image/")) {
6
9
  return "image";
7
10
  }
@@ -11,6 +14,12 @@ function canPreviewAttachment(fileName, mimeType) {
11
14
  if (normalizedMimeType.startsWith("audio/")) {
12
15
  return "audio";
13
16
  }
17
+ if (normalizedFileName.endsWith(".mp4") || normalizedFileName.endsWith(".m4v") || normalizedFileName.endsWith(".webm") || normalizedFileName.endsWith(".ogv") || normalizedFileName.endsWith(".ogg")) {
18
+ return "video";
19
+ }
20
+ if (normalizedFileName.endsWith(".m4a") || normalizedFileName.endsWith(".mp3") || normalizedFileName.endsWith(".wav") || normalizedFileName.endsWith(".aac") || normalizedFileName.endsWith(".oga")) {
21
+ return "audio";
22
+ }
14
23
  if (normalizedMimeType === "application/pdf" || normalizedFileName.endsWith(".pdf")) {
15
24
  return "pdf";
16
25
  }
@@ -23,7 +32,7 @@ function canPreviewAttachment(fileName, mimeType) {
23
32
  if (normalizedMimeType === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || normalizedFileName.endsWith(".pptx")) {
24
33
  return "pptx";
25
34
  }
26
- if (normalizedMimeType.startsWith("text/") || normalizedMimeType === "application/json" || normalizedMimeType === "application/xml" || normalizedMimeType === "image/svg+xml" || normalizedFileName.endsWith(".json") || normalizedFileName.endsWith(".txt") || normalizedFileName.endsWith(".md") || normalizedFileName.endsWith(".csv") || normalizedFileName.endsWith(".log") || normalizedFileName.endsWith(".xml") || normalizedFileName.endsWith(".yaml") || normalizedFileName.endsWith(".yml") || normalizedFileName.endsWith(".svg")) {
35
+ if (normalizedMimeType.startsWith("text/") || normalizedMimeType === "application/json" || normalizedMimeType === "application/xml" || normalizedMimeType === "image/svg+xml" || normalizedFileName.endsWith(".json") || normalizedFileName.endsWith(".txt") || normalizedFileName.endsWith(".csv") || normalizedFileName.endsWith(".log") || normalizedFileName.endsWith(".xml") || normalizedFileName.endsWith(".yaml") || normalizedFileName.endsWith(".yml") || normalizedFileName.endsWith(".svg")) {
27
36
  return "text";
28
37
  }
29
38
  return null;
@@ -240,6 +249,9 @@ function isThemeChangedMessage(message) {
240
249
  function isViewportChangedMessage(message) {
241
250
  return message.kind === "viewport-changed";
242
251
  }
252
+ function isUiPreferencesChangedMessage(message) {
253
+ return message.kind === "ui-preferences-changed";
254
+ }
243
255
  function toStreamError(message) {
244
256
  const error = new Error(message.error.message);
245
257
  error.name = message.error.code || "MindooDBAppBridgeStreamError";
@@ -765,6 +777,14 @@ var MindooDBAppSessionImpl = class {
765
777
  }
766
778
  });
767
779
  }
780
+ /** Subscribe to host-pushed embedded UI preference changes. */
781
+ onUiPreferencesChange(listener) {
782
+ return this.rpc.addMessageListener((message) => {
783
+ if (isUiPreferencesChangedMessage(message)) {
784
+ listener(message.uiPreferences);
785
+ }
786
+ });
787
+ }
768
788
  /** Disconnects from the host and always disposes the underlying port client. */
769
789
  async disconnect() {
770
790
  try {
@@ -1,4 +1,4 @@
1
- import { a2 as MindooDBAppLaunchContext, U as MindooDBAppDatabaseInfo, W as MindooDBAppDocumentApi, S as MindooDBAppCreateViewNavigatorInput, as as MindooDBAppViewNavigator, au as MindooDBAppViewNavigatorOpenOptions, b as MindooDBAppAttachmentApi, a as MindooDBAppBridge, al as MindooDBAppSession, n as MindooDBAppBridgeRpcRequest, a1 as MindooDBAppHostTheme, az as MindooDBAppViewport, k as MindooDBAppBridgePortMessage } from '../types-Bh1Q2qGN.js';
1
+ import { a3 as MindooDBAppLaunchContext, V as MindooDBAppDatabaseInfo, X as MindooDBAppDocumentApi, T as MindooDBAppCreateViewNavigatorInput, au as MindooDBAppViewNavigator, aw as MindooDBAppViewNavigatorOpenOptions, b as MindooDBAppAttachmentApi, a as MindooDBAppBridge, am as MindooDBAppSession, n as MindooDBAppBridgeRpcRequest, a2 as MindooDBAppHostTheme, aB as MindooDBAppViewport, aq as MindooDBAppUiPreferences, k as MindooDBAppBridgePortMessage } from '../types-vleeW9E5.js';
2
2
  import 'mindoodb-view-language';
3
3
 
4
4
  type MaybePromise<T> = T | Promise<T>;
@@ -29,6 +29,7 @@ interface MockMindooDBAppSessionController {
29
29
  setDatabases(definitions: MockMindooDBAppDatabaseDefinition[]): void;
30
30
  emitThemeChange(theme: MindooDBAppHostTheme): void;
31
31
  emitViewportChange(viewport: MindooDBAppViewport): void;
32
+ emitUiPreferencesChange(uiPreferences: MindooDBAppUiPreferences): void;
32
33
  }
33
34
  declare function createMockMindooDBAppSession(options?: CreateMockMindooDBAppSessionOptions): MockMindooDBAppSessionController;
34
35
  declare function createMockMindooDBAppBridge(options?: CreateMockMindooDBAppSessionOptions): MockMindooDBAppSessionController;
@@ -55,6 +56,7 @@ interface FakeBridgeHostController {
55
56
  dispose(): void;
56
57
  emitThemeChange(theme: MindooDBAppHostTheme): void;
57
58
  emitViewportChange(viewport: MindooDBAppViewport): void;
59
+ emitUiPreferencesChange(uiPreferences: MindooDBAppUiPreferences): void;
58
60
  postPortMessage(message: MindooDBAppBridgePortMessage, transfer?: Transferable[]): void;
59
61
  setRequestHandler(method: string, handler: FakeBridgeRequestHandler): void;
60
62
  clearRequestHandler(method: string): void;
@@ -18,6 +18,7 @@ function mergeLaunchContext(current, patch) {
18
18
  ...current,
19
19
  theme: { ...current.theme },
20
20
  viewport: current.viewport ? { ...current.viewport } : null,
21
+ uiPreferences: { ...current.uiPreferences },
21
22
  user: { ...current.user },
22
23
  launchParameters: { ...current.launchParameters },
23
24
  databases: current.databases.map((database) => ({
@@ -47,6 +48,7 @@ function mergeLaunchContext(current, patch) {
47
48
  ...patch,
48
49
  theme: patch.theme ? { ...current.theme, ...patch.theme } : { ...current.theme },
49
50
  viewport: patch.viewport === void 0 ? current.viewport ? { ...current.viewport } : null : patch.viewport ? { ...patch.viewport } : null,
51
+ uiPreferences: patch.uiPreferences ? { ...current.uiPreferences, ...patch.uiPreferences } : { ...current.uiPreferences },
50
52
  user: patch.user ? { ...current.user, ...patch.user } : { ...current.user },
51
53
  launchParameters: patch.launchParameters ? { ...current.launchParameters, ...patch.launchParameters } : { ...current.launchParameters },
52
54
  databases: patch.databases ? patch.databases.map((database) => ({
@@ -104,6 +106,9 @@ function createDefaultLaunchContext(patch) {
104
106
  width: 1024,
105
107
  height: 768
106
108
  },
109
+ uiPreferences: {
110
+ iosMultitaskingOptimized: false
111
+ },
107
112
  user: {
108
113
  id: "user-1",
109
114
  username: "Test User"
@@ -526,6 +531,7 @@ function createMockSessionState(options = {}) {
526
531
  let launchContext = createDefaultLaunchContext(options.launchContext);
527
532
  const themeListeners = /* @__PURE__ */ new Set();
528
533
  const viewportListeners = /* @__PURE__ */ new Set();
534
+ const uiPreferencesListeners = /* @__PURE__ */ new Set();
529
535
  const databaseHandles = /* @__PURE__ */ new Map();
530
536
  const databaseViewApis = /* @__PURE__ */ new Map();
531
537
  const sessionViews = /* @__PURE__ */ new Map();
@@ -634,6 +640,12 @@ function createMockSessionState(options = {}) {
634
640
  viewportListeners.delete(listener);
635
641
  };
636
642
  },
643
+ onUiPreferencesChange(listener) {
644
+ uiPreferencesListeners.add(listener);
645
+ return () => {
646
+ uiPreferencesListeners.delete(listener);
647
+ };
648
+ },
637
649
  async disconnect() {
638
650
  await options.onDisconnect?.();
639
651
  }
@@ -676,6 +688,10 @@ function createMockSessionState(options = {}) {
676
688
  emitViewportChange(viewport) {
677
689
  launchContext = mergeLaunchContext(launchContext, { viewport });
678
690
  viewportListeners.forEach((listener) => listener({ ...viewport }));
691
+ },
692
+ emitUiPreferencesChange(uiPreferences) {
693
+ launchContext = mergeLaunchContext(launchContext, { uiPreferences });
694
+ uiPreferencesListeners.forEach((listener) => listener({ ...launchContext.uiPreferences }));
679
695
  }
680
696
  };
681
697
  }
@@ -689,7 +705,8 @@ function createMockMindooDBAppSession(options = {}) {
689
705
  listDatabases: state.listDatabaseInfos,
690
706
  setDatabases: state.setDatabases,
691
707
  emitThemeChange: state.emitThemeChange,
692
- emitViewportChange: state.emitViewportChange
708
+ emitViewportChange: state.emitViewportChange,
709
+ emitUiPreferencesChange: state.emitUiPreferencesChange
693
710
  };
694
711
  }
695
712
  function createMockMindooDBAppBridge(options = {}) {
@@ -1198,6 +1215,15 @@ function createFakeBridgeHost(options = {}) {
1198
1215
  };
1199
1216
  connectedPorts.forEach((port) => port.postMessage(payload));
1200
1217
  },
1218
+ emitUiPreferencesChange(uiPreferences) {
1219
+ state.emitUiPreferencesChange(uiPreferences);
1220
+ const payload = {
1221
+ protocol: PROTOCOL,
1222
+ kind: "ui-preferences-changed",
1223
+ uiPreferences
1224
+ };
1225
+ connectedPorts.forEach((port) => port.postMessage(payload));
1226
+ },
1201
1227
  postPortMessage(message, transfer = []) {
1202
1228
  connectedPorts.forEach((port) => port.postMessage(message, transfer));
1203
1229
  },
@@ -14,6 +14,10 @@ interface MindooDBAppViewport {
14
14
  width: number;
15
15
  height: number;
16
16
  }
17
+ /** Host-controlled UI preferences exposed to embedded apps. */
18
+ interface MindooDBAppUiPreferences {
19
+ iosMultitaskingOptimized: boolean;
20
+ }
17
21
  /** Saved categorization mode for Haven-managed view mappings delivered at launch time. */
18
22
  type MindooDBAppConfiguredViewCategorizationStyle = "document_then_category" | "category_then_document";
19
23
  /** Preferred preview layout for a Haven-managed view mapping. */
@@ -93,7 +97,7 @@ interface MindooDBAppResolvedViewDefinition {
93
97
  }
94
98
  /** Permission/capability flags exposed for a database binding inside the app session. */
95
99
  type MindooDBAppCapability = "read" | "create" | "update" | "delete" | "history" | "attachments" | "views";
96
- /** Metadata about the current app launch supplied by the Administrator host. */
100
+ /** Metadata about the current app launch supplied by the Haven host. */
97
101
  interface MindooDBAppLaunchContext {
98
102
  appId: string;
99
103
  appInstanceId: string;
@@ -102,6 +106,7 @@ interface MindooDBAppLaunchContext {
102
106
  runtime: MindooDBAppRuntime;
103
107
  theme: MindooDBAppHostTheme;
104
108
  viewport: MindooDBAppViewport | null;
109
+ uiPreferences: MindooDBAppUiPreferences;
105
110
  tenantId?: string;
106
111
  preferredDatabaseId?: string;
107
112
  user: {
@@ -120,7 +125,7 @@ interface MindooDBAppAttachmentInfo {
120
125
  size: number;
121
126
  }
122
127
  /** Preview modes supported by the Haven-hosted attachment preview dialog. */
123
- type MindooDBAppAttachmentPreviewMode = "image" | "pdf" | "text" | "docx" | "pptx" | "spreadsheet" | "video" | "audio";
128
+ type MindooDBAppAttachmentPreviewMode = "image" | "pdf" | "text" | "markdown" | "docx" | "pptx" | "spreadsheet" | "video" | "audio";
124
129
  /** Optional parameters for opening an attachment preview in Haven. */
125
130
  interface MindooDBAppAttachmentPreviewOptions {
126
131
  /** Historical snapshot timestamp previously obtained from `documents.history.getAtTimestamp()`. */
@@ -311,8 +316,14 @@ interface MindooDBAppBridgeViewportChangedMessage {
311
316
  kind: "viewport-changed";
312
317
  viewport: MindooDBAppViewport;
313
318
  }
319
+ /** Host-pushed event emitted when host-controlled UI preferences change. */
320
+ interface MindooDBAppBridgeUiPreferencesChangedMessage {
321
+ protocol: "mindoodb-app-bridge";
322
+ kind: "ui-preferences-changed";
323
+ uiPreferences: MindooDBAppUiPreferences;
324
+ }
314
325
  /** Any message that can travel across the dedicated bridge MessagePort. */
315
- type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage;
326
+ type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage | MindooDBAppBridgeUiPreferencesChangedMessage;
316
327
  /** Placement hint for a host-rendered overlay menu. */
317
328
  type MindooDBAppMenuPlacement = "auto" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | "right-start" | "left-start";
318
329
  /** Semantic hint allowing Haven to tune menu behavior or styling. */
@@ -552,6 +563,7 @@ interface MindooDBAppSession {
552
563
  menus: MindooDBAppMenuApi;
553
564
  onThemeChange(listener: (theme: MindooDBAppHostTheme) => void): () => void;
554
565
  onViewportChange(listener: (viewport: MindooDBAppViewport) => void): () => void;
566
+ onUiPreferencesChange(listener: (uiPreferences: MindooDBAppUiPreferences) => void): () => void;
555
567
  disconnect(): Promise<void>;
556
568
  }
557
569
  /** Root SDK bridge object used to establish a session. */
@@ -559,4 +571,4 @@ interface MindooDBAppBridge {
559
571
  connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
560
572
  }
561
573
 
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 };
574
+ export type { MindooDBAppDocumentSummary as $, MindooDBAppCapability as A, MindooDBAppConfiguredViewCategorizationStyle as B, MindooDBAppConfiguredViewColumn as C, MindooDBAppConfiguredViewColumnRole as D, MindooDBAppConfiguredViewExpressionMode as E, MindooDBAppConfiguredViewFieldExpression as F, MindooDBAppConfiguredViewFilterDefinition as G, MindooDBAppConfiguredViewFilterMode as H, MindooDBAppConfiguredViewFilterRule as I, MindooDBAppConfiguredViewFormulaExpression as J, MindooDBAppConfiguredViewFormulaFilterDefinition as K, MindooDBAppConfiguredViewPreviewMode as L, MindooDBAppAttachmentPreviewMode as M, MindooDBAppConfiguredViewRuleFilterDefinition as N, MindooDBAppConfiguredViewRuleMatchMode as O, MindooDBAppConfiguredViewRuleOperator as P, MindooDBAppConfiguredViewValueExpression as Q, MindooDBAppCreateDocumentInput as R, MindooDBAppCreateViewInput as S, MindooDBAppCreateViewNavigatorInput as T, MindooDBAppDatabase as U, MindooDBAppDatabaseInfo as V, MindooDBAppDocument as W, MindooDBAppDocumentApi as X, MindooDBAppDocumentHistoryEntry as Y, MindooDBAppDocumentListQuery as Z, MindooDBAppDocumentListResult as _, MindooDBAppBridge as a, MindooDBAppHistoricalDocument as a0, MindooDBAppHistoryQuery as a1, MindooDBAppHostTheme as a2, MindooDBAppLaunchContext as a3, MindooDBAppMenuAnchor as a4, MindooDBAppMenuApi as a5, MindooDBAppMenuCommandItem as a6, MindooDBAppMenuDismissReason as a7, MindooDBAppMenuDismissedResult as a8, MindooDBAppMenuItem as a9, MindooDBAppViewNavigatorSelectionState as aA, MindooDBAppViewport as aB, MindooDBAppWritableAttachmentStream as aC, MindooDBAppMenuKind as aa, MindooDBAppMenuPlacement as ab, MindooDBAppMenuPointAnchor as ac, MindooDBAppMenuRect as ad, MindooDBAppMenuRectAnchor as ae, MindooDBAppMenuSelectionResult as af, MindooDBAppMenuSeparatorItem as ag, MindooDBAppReadableAttachmentStream as ah, MindooDBAppResolvedViewDefinition as ai, MindooDBAppResolvedViewSource as aj, MindooDBAppRuntime as ak, MindooDBAppScopedDocId as al, MindooDBAppSession as am, MindooDBAppShowMenuInput as an, MindooDBAppShowMenuResult as ao, MindooDBAppThemeMode as ap, MindooDBAppUiPreferences as aq, MindooDBAppUpdateDocumentInput as ar, MindooDBAppViewEntry as as, MindooDBAppViewEntryKind as at, MindooDBAppViewNavigator as au, MindooDBAppViewNavigatorExpansionState as av, MindooDBAppViewNavigatorOpenOptions as aw, MindooDBAppViewNavigatorPageOptions as ax, MindooDBAppViewNavigatorPageResult as ay, MindooDBAppViewNavigatorRangeQuery 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, MindooDBAppBridgeUiPreferencesChangedMessage as y, MindooDBAppBridgeViewportChangedMessage as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindoodb-app-sdk",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
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",