mindoodb-app-sdk 0.0.57 → 0.0.59

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.
@@ -85,6 +85,14 @@ interface MindooDBAppDefinition {
85
85
  allowCamera?: boolean;
86
86
  allowMicrophone?: boolean;
87
87
  allowGeolocation?: boolean;
88
+ /** Lets the app write to the clipboard, e.g. for a "Copy" button. Reading stays denied. */
89
+ allowClipboardWrite?: boolean;
90
+ /**
91
+ * Motion and orientation sensors (Permissions-Policy `accelerometer`, `gyroscope`,
92
+ * `magnetometer`): `devicemotion`/`deviceorientation` events, e.g. to tilt a game or
93
+ * read the compass. iOS still asks the user (`DeviceOrientationEvent.requestPermission`).
94
+ */
95
+ allowMotion?: boolean;
88
96
  allowWebRtc?: boolean;
89
97
  allowWorkers?: boolean;
90
98
  /**
@@ -100,6 +108,13 @@ interface MindooDBAppDefinition {
100
108
  /** `logicalDatabaseId` the app should open first. */
101
109
  defaultLaunchDatabaseId?: string;
102
110
  databases?: MindooDBAppDefinitionDatabase[];
111
+ /**
112
+ * Content this app can receive from the share sheet, "open with", the Files
113
+ * import folder, or a drop/picker in Haven. Each entry is one choice in
114
+ * Haven's "send to app" picker; the app gets it through
115
+ * `session.onIncomingContent` with the entry's `id` as `acceptId`.
116
+ */
117
+ accepts?: MindooDBAppAcceptSpec[];
103
118
  /**
104
119
  * What a person sees before installing: the app's landing page when its URL is
105
120
  * opened directly, and Haven's setup wizard when it arrives through a shared link.
@@ -107,6 +122,24 @@ interface MindooDBAppDefinition {
107
122
  */
108
123
  listing?: MindooDBAppDefinitionListing;
109
124
  }
125
+ /** One kind of content an app takes, as a choice in Haven's picker. */
126
+ interface MindooDBAppAcceptSpec {
127
+ /** Stable id, handed back as `acceptId`. Lowercase letters, digits, `-` and `_`. */
128
+ id: string;
129
+ /** What the choice does, e.g. "Attach to the open document". */
130
+ label: MindooDBAppLocalizedText;
131
+ /**
132
+ * MIME patterns: `image/*`, `application/pdf`, `*\/*`. Use `text/plain`
133
+ * for shared text and `text/uri-list` for shared links.
134
+ */
135
+ types: string[];
136
+ /** Whether whole folders (with relative paths) are welcome. Default false. */
137
+ folders?: boolean;
138
+ /** Whether more than one item at once is welcome. Default true. */
139
+ multiple?: boolean;
140
+ /** Largest total size the app handles; larger deliveries are not offered. */
141
+ maxBytes?: number;
142
+ }
110
143
  /**
111
144
  * Text in one language, or a map from locale (`de`, `fr`, …) to text. A map must carry
112
145
  * `en`, the fallback for every locale it does not name.
@@ -147,6 +180,17 @@ interface MindooDBAppDefinitionValidation {
147
180
  definition: MindooDBAppDefinition | null;
148
181
  errors: string[];
149
182
  }
183
+ declare const MINDOODB_APP_ACCEPTS_MAX = 16;
184
+ /**
185
+ * Validates an `accepts` list on its own, for hosts that read it from another
186
+ * manifest format (Haven's app store catalog).
187
+ */
188
+ declare function validateMindooDBAppAccepts(value: unknown): {
189
+ accepts: MindooDBAppAcceptSpec[] | undefined;
190
+ errors: string[];
191
+ };
192
+ /** Whether `type` (e.g. `image/png`) matches a pattern like `image/*` or `*\/*`. */
193
+ declare function mindooDBAppAcceptMatchesType(pattern: string, type: string): boolean;
150
194
  /**
151
195
  * Picks the text for `locale` out of a localized value: the exact locale, then its
152
196
  * language (`de` for `de-CH`), then `en`.
@@ -283,6 +327,35 @@ interface MindooDBAppResolvedViewDefinition {
283
327
  }
284
328
  /** Permission/capability flags exposed for a database binding inside the app session. */
285
329
  type MindooDBAppCapability = "read" | "create" | "update" | "delete" | "history" | "attachments" | "views" | "sign" | "timestamps" | "directory" | "sealedchannel";
330
+ /**
331
+ * Which browser features the host leaves available to the app. `true` means the host
332
+ * does not block the feature; the browser may still ask the user (camera, microphone,
333
+ * location) or require a click (clipboard, popups). `false` means the host blocks it
334
+ * and the user has to enable it for this app in Haven. Each flag matches the app
335
+ * definition field of the same name (`allowCamera` and so on), so an app can ship with
336
+ * the flag already requested.
337
+ */
338
+ interface MindooDBAppBrowserFeatures {
339
+ /** `window.open` and links with `target="_blank"`. Definition field `allowPopups`. */
340
+ popups: boolean;
341
+ /** `getUserMedia` video. Definition field `allowCamera`. */
342
+ camera: boolean;
343
+ /** `getUserMedia` audio. Definition field `allowMicrophone`. */
344
+ microphone: boolean;
345
+ /** `navigator.geolocation`. Definition field `allowGeolocation`. */
346
+ geolocation: boolean;
347
+ /** `navigator.clipboard.writeText` in response to a user gesture. Definition field `allowClipboardWrite`. */
348
+ clipboardWrite: boolean;
349
+ /**
350
+ * `devicemotion`/`deviceorientation` events (accelerometer, gyroscope, magnetometer).
351
+ * iOS still asks the user. Definition field `allowMotion`.
352
+ */
353
+ motion: boolean;
354
+ /** `RTCPeerConnection`. Blocked only for hosted apps. Definition field `allowWebRtc`. */
355
+ webRtc: boolean;
356
+ /** `new Worker`, shared and service workers. Blocked only for hosted apps. Definition field `allowWorkers`. */
357
+ workers: boolean;
358
+ }
286
359
  /** Metadata about the current app launch supplied by the Haven host. */
287
360
  interface MindooDBAppLaunchContext {
288
361
  appId: string;
@@ -332,6 +405,16 @@ interface MindooDBAppLaunchContext {
332
405
  * permissions".
333
406
  */
334
407
  appPermissions?: MindooDBAppDefinitionRegistrationPermission[];
408
+ /**
409
+ * Browser features the host lets this app use. The iframe sandbox, its `allow`
410
+ * attribute and the hosted app CSP are set by the host from the app's registration,
411
+ * and the browser offers no reliable way to read them from inside the frame. Check
412
+ * this in an initial setup to tell the user which switch to turn on in Haven's app
413
+ * settings before a feature fails silently.
414
+ *
415
+ * Absent on hosts predating this field; treat that as unknown and try the feature.
416
+ */
417
+ browserFeatures?: MindooDBAppBrowserFeatures;
335
418
  launchParameters: Record<string, string>;
336
419
  databases: MindooDBAppDatabaseInfo[];
337
420
  views: MindooDBAppResolvedViewDefinition[];
@@ -1357,7 +1440,64 @@ interface MindooDBAppBridgeAgentResultMessage {
1357
1440
  };
1358
1441
  }
1359
1442
  /** Any message that can travel across the dedicated bridge MessagePort. */
1360
- type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage | MindooDBAppBridgeUiPreferencesChangedMessage | MindooDBAppBridgeLocaleChangedMessage | MindooDBAppBridgeQueryResultMessage | MindooDBAppBridgeViewChangedMessage | MindooDBAppBridgeBeforeCloseMessage | MindooDBAppBridgeBeforeCloseAck | MindooDBAppBridgeShortcutsChangedMessage | MindooDBAppBridgeShortcutInvokedMessage | MindooDBAppBridgeWorkspaceFocusRequestedMessage | MindooDBAppBridgeHostFocusChangedMessage | MindooDBAppBridgeAgentInvokeMessage | MindooDBAppBridgeAgentResultMessage | MindooDBAppBridgeDragOverMessage | MindooDBAppBridgeDragLeaveMessage | MindooDBAppBridgeDragDropMessage;
1443
+ /**
1444
+ * Where content handed to an app came from. Native sources (share sheet,
1445
+ * "open with", the Files import folder, shortcuts) only exist in the Haven
1446
+ * iOS/Android app; `drop` and `picker` work everywhere.
1447
+ */
1448
+ type MindooDBAppIncomingSource = "share-sheet" | "open-with" | "files-folder" | "shortcut" | "drop" | "picker";
1449
+ /** One file, text or link in a delivery, without its bytes. */
1450
+ interface MindooDBAppIncomingItemInfo {
1451
+ itemId: string;
1452
+ /**
1453
+ * POSIX path relative to what the user shared, e.g. `assets/logo.png` for a
1454
+ * folder, or just the file name. Never absolute, never contains `..`.
1455
+ */
1456
+ path: string;
1457
+ kind: "file" | "text" | "url";
1458
+ /** MIME type; `text/plain` for text, `text/uri-list` for links. */
1459
+ type: string;
1460
+ /** Size in bytes. */
1461
+ size: number;
1462
+ /** Inline value for `text` and `url` items. */
1463
+ text?: string;
1464
+ }
1465
+ /** Host → app: what Haven is about to hand over, without the bytes. */
1466
+ interface MindooDBAppIncomingContentInfo {
1467
+ deliveryId: string;
1468
+ /** The manifest `accepts` entry the user picked. */
1469
+ acceptId: string;
1470
+ source: MindooDBAppIncomingSource;
1471
+ items: MindooDBAppIncomingItemInfo[];
1472
+ }
1473
+ /** An item as the app's handler sees it. */
1474
+ interface MindooDBAppIncomingItem extends MindooDBAppIncomingItemInfo {
1475
+ /** Loads the content from Haven in chunks. */
1476
+ read(): Promise<Blob>;
1477
+ /** `read()` decoded as UTF-8; resolves immediately for `text` and `url` items. */
1478
+ readText(): Promise<string>;
1479
+ }
1480
+ /** What `session.onIncomingContent` handlers receive. */
1481
+ interface MindooDBAppIncomingContent {
1482
+ deliveryId: string;
1483
+ acceptId: string;
1484
+ source: MindooDBAppIncomingSource;
1485
+ items: MindooDBAppIncomingItem[];
1486
+ }
1487
+ /** The handler's answer; Haven shows it to the user and clears the queue. */
1488
+ interface MindooDBAppIncomingResult {
1489
+ status: "accepted" | "partial" | "rejected";
1490
+ /** Short text for the user, e.g. "3 attachments added". */
1491
+ message?: string;
1492
+ }
1493
+ type MindooDBAppIncomingContentHandler = (content: MindooDBAppIncomingContent) => Promise<MindooDBAppIncomingResult> | MindooDBAppIncomingResult;
1494
+ /** Host → app: hand over content the user chose this app for. */
1495
+ interface MindooDBAppBridgeIncomingContentMessage {
1496
+ protocol: "mindoodb-app-bridge";
1497
+ kind: "incoming-content";
1498
+ content: MindooDBAppIncomingContentInfo;
1499
+ }
1500
+ type MindooDBAppBridgePortMessage = MindooDBAppBridgeRpcMessage | MindooDBAppBridgeStreamMessage | MindooDBAppBridgeThemeChangedMessage | MindooDBAppBridgeViewportChangedMessage | MindooDBAppBridgeUiPreferencesChangedMessage | MindooDBAppBridgeLocaleChangedMessage | MindooDBAppBridgeQueryResultMessage | MindooDBAppBridgeViewChangedMessage | MindooDBAppBridgeBeforeCloseMessage | MindooDBAppBridgeBeforeCloseAck | MindooDBAppBridgeShortcutsChangedMessage | MindooDBAppBridgeShortcutInvokedMessage | MindooDBAppBridgeWorkspaceFocusRequestedMessage | MindooDBAppBridgeHostFocusChangedMessage | MindooDBAppBridgeAgentInvokeMessage | MindooDBAppBridgeAgentResultMessage | MindooDBAppBridgeDragOverMessage | MindooDBAppBridgeDragLeaveMessage | MindooDBAppBridgeDragDropMessage | MindooDBAppBridgeIncomingContentMessage;
1361
1501
  /** Placement hint for a host-rendered overlay menu. */
1362
1502
  type MindooDBAppMenuPlacement = "auto" | "bottom-start" | "bottom-end" | "top-start" | "top-end" | "right-start" | "left-start";
1363
1503
  /** Semantic hint allowing Haven to tune menu behavior or styling. */
@@ -2981,6 +3121,18 @@ interface MindooDBAppSession {
2981
3121
  * new BCP-47 language tag (e.g. `"de"`). Returns an unsubscribe function.
2982
3122
  */
2983
3123
  onLocaleChange(listener: (locale: string) => void): () => void;
3124
+ /**
3125
+ * Receive content the user hands to this app: files from the share sheet,
3126
+ * "open with", the Files import folder, or dropped/picked in Haven. The app
3127
+ * declares what it takes in its definition's `accepts`; Haven only offers it
3128
+ * for matching content and only after the user picked it.
3129
+ *
3130
+ * Register once, early: Haven waits for a handler before it delivers, so a
3131
+ * launch started for a delivery receives it as soon as this is called.
3132
+ * Content arriving before that is held and handed over on registration.
3133
+ * Returns an unsubscribe function.
3134
+ */
3135
+ onIncomingContent(handler: MindooDBAppIncomingContentHandler): () => void;
2984
3136
  /**
2985
3137
  * Run work before the host tears this launch down, e.g. flushing buffered writes.
2986
3138
  *
@@ -3043,4 +3195,4 @@ interface MindooDBAppBridge {
3043
3195
  connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
3044
3196
  }
3045
3197
 
3046
- export { type MindooDBAppBridgeErrorPayload as $, type MindooDBAppAccessTier as A, type MindooDBAppAgentApi as B, type MindooDBAppAgentRegistration as C, type MindooDBAppAgentTool as D, type MindooDBAppAgentToolAnnotations as E, type MindooDBAppAgentToolDescriptor as F, type MindooDBAppAttachmentApi as G, type MindooDBAppAttachmentChunk as H, type MindooDBAppAttachmentInfo as I, type MindooDBAppAttachmentPreviewOptions as J, type MindooDBAppAttachmentPreviewSession as K, type MindooDBAppAutomergeChangesPatch as L, type MindooDBAppAttachmentPreviewMode as M, type MindooDBAppAutomergeChangesSince as N, type MindooDBAppAutomergeGetOptions as O, type MindooDBAppAutomergePatchResult as P, type MindooDBAppAutomergeSnapshot as Q, type MindooDBAppBridgeAgentInvokeMessage as R, type MindooDBAppBridgeAgentResultMessage as S, type MindooDBAppBridgeBeforeCloseAck as T, type MindooDBAppBridgeBeforeCloseMessage as U, type MindooDBAppBridgeConnectMessage as V, type MindooDBAppBridgeConnectOptions as W, type MindooDBAppBridgeConnectedMessage as X, type MindooDBAppBridgeDragDropMessage as Y, type MindooDBAppBridgeDragLeaveMessage as Z, type MindooDBAppBridgeDragOverMessage as _, type MindooDBAppDragBindSourceOptions as a, type MindooDBAppDragDropEvent as a$, type MindooDBAppBridgeHandshakeErrorMessage as a0, type MindooDBAppBridgeHostFocusChangedMessage as a1, type MindooDBAppBridgeLocaleChangedMessage as a2, type MindooDBAppBridgePortMessage as a3, type MindooDBAppBridgeQueryResultMessage as a4, type MindooDBAppBridgeRpcError as a5, type MindooDBAppBridgeRpcMessage as a6, type MindooDBAppBridgeRpcRequest as a7, type MindooDBAppBridgeRpcSuccess as a8, type MindooDBAppBridgeShortcutInvokedMessage as a9, type MindooDBAppConfiguredViewRuleFilterDefinition as aA, type MindooDBAppConfiguredViewRuleMatchMode as aB, type MindooDBAppConfiguredViewRuleOperator as aC, type MindooDBAppConfiguredViewValueExpression as aD, type MindooDBAppCreateKeyInfo as aE, type MindooDBAppCreateViewInput as aF, type MindooDBAppCreateViewNavigatorInput as aG, type MindooDBAppDatabaseInfo as aH, type MindooDBAppDefinitionDatabase as aI, type MindooDBAppDefinitionListing as aJ, type MindooDBAppDefinitionPermission as aK, type MindooDBAppDefinitionRegistrationPermission as aL, type MindooDBAppDefinitionScreenshot as aM, type MindooDBAppDefinitionValidation as aN, type MindooDBAppDirectoryApi as aO, type MindooDBAppDirectoryEntry as aP, type MindooDBAppDocumentApi as aQ, type MindooDBAppDocumentHeadCursorResult as aR, type MindooDBAppDocumentHistoryEntry as aS, type MindooDBAppDocumentListQuery as aT, type MindooDBAppDocumentListResult as aU, type MindooDBAppDocumentQuery as aV, type MindooDBAppDocumentRevisionId as aW, type MindooDBAppDocumentScanPreset as aX, type MindooDBAppDocumentSummary as aY, type MindooDBAppDragApi as aZ, type MindooDBAppDragCancelReason as a_, type MindooDBAppBridgeShortcutsChangedMessage as aa, type MindooDBAppBridgeStreamAbortRequest as ab, type MindooDBAppBridgeStreamAck as ac, type MindooDBAppBridgeStreamCloseRequest as ad, type MindooDBAppBridgeStreamError as ae, type MindooDBAppBridgeStreamMessage as af, type MindooDBAppBridgeStreamOpenResult as ag, type MindooDBAppBridgeStreamReadRequest as ah, type MindooDBAppBridgeStreamWriteRequest as ai, type MindooDBAppBridgeThemeChangedMessage as aj, type MindooDBAppBridgeUiPreferencesChangedMessage as ak, type MindooDBAppBridgeViewChangedMessage as al, type MindooDBAppBridgeViewportChangedMessage as am, type MindooDBAppBridgeWorkspaceFocusRequestedMessage as an, type MindooDBAppCapability as ao, type MindooDBAppConfiguredViewCategorizationStyle as ap, type MindooDBAppConfiguredViewColumn as aq, type MindooDBAppConfiguredViewColumnRole as ar, type MindooDBAppConfiguredViewExpressionMode as as, type MindooDBAppConfiguredViewFieldExpression as at, type MindooDBAppConfiguredViewFilterDefinition as au, type MindooDBAppConfiguredViewFilterMode as av, type MindooDBAppConfiguredViewFilterRule as aw, type MindooDBAppConfiguredViewFormulaExpression as ax, type MindooDBAppConfiguredViewFormulaFilterDefinition as ay, type MindooDBAppConfiguredViewPreviewMode as az, type MindooDBAppDragStartInput as b, type MindooDBAppResolvedViewSource as b$, type MindooDBAppDragEffect as b0, type MindooDBAppDragHoverResult as b1, type MindooDBAppDragOffer as b2, type MindooDBAppDragOverEvent as b3, type MindooDBAppDragPointer as b4, type MindooDBAppDragProfile as b5, type MindooDBAppEntryAttachmentRef as b6, type MindooDBAppEntryProvenance as b7, type MindooDBAppExtractDocumentTextInput as b8, type MindooDBAppExtractDocumentTextResult as b9, type MindooDBAppMenuCommandItem as bA, type MindooDBAppMenuDismissReason as bB, type MindooDBAppMenuDismissedResult as bC, type MindooDBAppMenuItem as bD, type MindooDBAppMenuKind as bE, type MindooDBAppMenuPlacement as bF, type MindooDBAppMenuPointAnchor as bG, type MindooDBAppMenuRect as bH, type MindooDBAppMenuRectAnchor as bI, type MindooDBAppMenuSelectionResult as bJ, type MindooDBAppMenuSeparatorItem as bK, type MindooDBAppNotificationSeverity as bL, type MindooDBAppNotifyInput as bM, type MindooDBAppNotifyResult as bN, type MindooDBAppProposeAppInput as bO, type MindooDBAppProposeAppResult as bP, type MindooDBAppQueryCoverage as bQ, type MindooDBAppQueryInclude as bR, type MindooDBAppQueryIncludeCardinality as bS, type MindooDBAppQueryIncludeSlots as bT, type MindooDBAppQueryResult as bU, type MindooDBAppQueryRow as bV, type MindooDBAppQuerySortKey as bW, type MindooDBAppQueryTextClause as bX, type MindooDBAppReadableAttachmentStream as bY, type MindooDBAppRecipientOptions as bZ, type MindooDBAppResolvedViewDefinition as b_, type MindooDBAppExtractTextFormat as ba, type MindooDBAppExtractionSetup as bb, type MindooDBAppFulltextSetup as bc, type MindooDBAppHistoricalDocument as bd, type MindooDBAppHistoryQuery as be, type MindooDBAppHostTheme as bf, type MindooDBAppIdentityApi as bg, type MindooDBAppInaccessibleDocument as bh, type MindooDBAppInaccessibleDocumentListQuery as bi, type MindooDBAppInaccessibleDocumentListResult as bj, type MindooDBAppJsonCounterIncrementPatch as bk, type MindooDBAppJsonListDeletePatch as bl, type MindooDBAppJsonListInsertPatch as bm, type MindooDBAppJsonPatch as bn, type MindooDBAppJsonSetPatch as bo, type MindooDBAppJsonTextMarkPatch as bp, type MindooDBAppJsonTextSplicePatch as bq, type MindooDBAppJsonTextUnmarkPatch as br, type MindooDBAppJsonUnsetPatch as bs, type MindooDBAppLaunchContext as bt, type MindooDBAppListUsersOptions as bu, type MindooDBAppListUsersPage as bv, type MindooDBAppLiveQuerySubscription as bw, type MindooDBAppLocalizedText as bx, type MindooDBAppMenuAnchor as by, type MindooDBAppMenuApi as bz, type MindooDBAppDragStartResult as c, type MindooDBAppRevisionPhase as c0, type MindooDBAppRevisionVerification as c1, type MindooDBAppRichTextBlockSpan as c2, type MindooDBAppRichTextGetOptions as c3, type MindooDBAppRichTextImmutableString as c4, type MindooDBAppRichTextMarkRange as c5, type MindooDBAppRichTextMaterializeValue as c6, type MindooDBAppRichTextPatch as c7, type MindooDBAppRichTextScalar as c8, type MindooDBAppRichTextSpliceStep as c9, type MindooDBAppTextPatch as cA, type MindooDBAppThemeMode as cB, type MindooDBAppTimestampApi as cC, type MindooDBAppTimestampInput as cD, type MindooDBAppTimestampProvider as cE, type MindooDBAppTimestampResult as cF, type MindooDBAppUiPreferences as cG, type MindooDBAppUpdateDocumentInput as cH, type MindooDBAppViewCursorDocumentListResult as cI, type MindooDBAppViewCursorResult as cJ, type MindooDBAppViewEntry as cK, type MindooDBAppViewEntryKind as cL, type MindooDBAppViewNavigator as cM, type MindooDBAppViewNavigatorExpansionState as cN, type MindooDBAppViewNavigatorOpenOptions as cO, type MindooDBAppViewNavigatorPageOptions as cP, type MindooDBAppViewNavigatorPageResult as cQ, type MindooDBAppViewNavigatorRangeQuery as cR, type MindooDBAppViewNavigatorSelectionState as cS, type MindooDBAppViewUpdateStats as cT, type MindooDBAppViewport as cU, type MindooDBAppWellKnownDragType as cV, type MindooDBAppWritableAttachmentStream as cW, resolveMindooDBAppDefinitionUrl as cX, resolveMindooDBAppListingAssetUrl as cY, resolveMindooDBAppLocalizedText as cZ, validateMindooDBAppDefinition as c_, type MindooDBAppRichTextStep as ca, type MindooDBAppRichTextStepPatch as cb, type MindooDBAppRichTextTextSpan as cc, type MindooDBAppRuntime as cd, type MindooDBAppScanAttachmentOptions as ce, type MindooDBAppScanAttachmentResult as cf, type MindooDBAppScopedDocId as cg, type MindooDBAppScopedDocumentSummary as ch, type MindooDBAppSealIntent as ci, type MindooDBAppSealedChannelOpenInput as cj, type MindooDBAppSealedChannelOpenResult as ck, type MindooDBAppSealedChannelRequestInput as cl, type MindooDBAppSession as cm, type MindooDBAppShowMenuInput as cn, type MindooDBAppShowMenuResult as co, type MindooDBAppSignPreview as cp, type MindooDBAppSignPreviewScope as cq, type MindooDBAppSignStatementInput as cr, type MindooDBAppSignStatementResult as cs, type MindooDBAppStorageApi as ct, type MindooDBAppSummarySetup as cu, type MindooDBAppTextCursorOptions as cv, type MindooDBAppTextCursorPosition as cw, type MindooDBAppTextCursorPositionsResult as cx, type MindooDBAppTextCursorsResult as cy, type MindooDBAppTextEdit as cz, type MindooDBAppDragPreview as d, type MindooDBAppBridge as e, type MindooDBAppAgentToolErrorCode as f, type MindooDBAppHostShortcutBinding as g, type MindooDBAppHostShortcutAction as h, type MindooDBAppHostingMode as i, type MindooDBAppDefinition as j, type MindooDBAppDatabase as k, type MindooDBAppDocument as l, type MindooDBAppRichTextSpan as m, type MindooDBAppRichTextSnapshot as n, type MindooDBAppCreateDocumentInput as o, MINDOODB_APP_DEFINITION_FILE_NAME as p, MINDOODB_APP_DEFINITION_FORMAT as q, MINDOODB_APP_DEFINITION_PERMISSIONS as r, MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS as s, MINDOODB_APP_DEFINITION_VERSION as t, MINDOODB_APP_LISTING_DESCRIPTION_MAX as u, MINDOODB_APP_LISTING_MAX_SCREENSHOTS as v, MINDOODB_APP_LISTING_SUMMARY_MAX as w, MINDOODB_APP_SEAL_SIGNING_DOMAIN as x, MINDOODB_APP_WELL_KNOWN_DRAG_TYPES as y, type MindooDBAppAccessDecision as z };
3198
+ export { type MindooDBAppBridgeDragLeaveMessage as $, type MindooDBAppAcceptSpec as A, type MindooDBAppAccessDecision as B, type MindooDBAppAccessTier as C, type MindooDBAppAgentApi as D, type MindooDBAppAgentRegistration as E, type MindooDBAppAgentTool as F, type MindooDBAppAgentToolAnnotations as G, type MindooDBAppAgentToolDescriptor as H, type MindooDBAppAttachmentApi as I, type MindooDBAppAttachmentChunk as J, type MindooDBAppAttachmentInfo as K, type MindooDBAppAttachmentPreviewOptions as L, type MindooDBAppAttachmentPreviewMode as M, type MindooDBAppAttachmentPreviewSession as N, type MindooDBAppAutomergeChangesPatch as O, type MindooDBAppAutomergeChangesSince as P, type MindooDBAppAutomergeGetOptions as Q, type MindooDBAppAutomergePatchResult as R, type MindooDBAppAutomergeSnapshot as S, type MindooDBAppBridgeAgentInvokeMessage as T, type MindooDBAppBridgeAgentResultMessage as U, type MindooDBAppBridgeBeforeCloseAck as V, type MindooDBAppBridgeBeforeCloseMessage as W, type MindooDBAppBridgeConnectMessage as X, type MindooDBAppBridgeConnectOptions as Y, type MindooDBAppBridgeConnectedMessage as Z, type MindooDBAppBridgeDragDropMessage as _, type MindooDBAppDragBindSourceOptions as a, type MindooDBAppDocumentScanPreset as a$, type MindooDBAppBridgeDragOverMessage as a0, type MindooDBAppBridgeErrorPayload as a1, type MindooDBAppBridgeHandshakeErrorMessage as a2, type MindooDBAppBridgeHostFocusChangedMessage as a3, type MindooDBAppBridgeIncomingContentMessage as a4, type MindooDBAppBridgeLocaleChangedMessage as a5, type MindooDBAppBridgePortMessage as a6, type MindooDBAppBridgeQueryResultMessage as a7, type MindooDBAppBridgeRpcError as a8, type MindooDBAppBridgeRpcMessage as a9, type MindooDBAppConfiguredViewFilterRule as aA, type MindooDBAppConfiguredViewFormulaExpression as aB, type MindooDBAppConfiguredViewFormulaFilterDefinition as aC, type MindooDBAppConfiguredViewPreviewMode as aD, type MindooDBAppConfiguredViewRuleFilterDefinition as aE, type MindooDBAppConfiguredViewRuleMatchMode as aF, type MindooDBAppConfiguredViewRuleOperator as aG, type MindooDBAppConfiguredViewValueExpression as aH, type MindooDBAppCreateKeyInfo as aI, type MindooDBAppCreateViewInput as aJ, type MindooDBAppCreateViewNavigatorInput as aK, type MindooDBAppDatabaseInfo as aL, type MindooDBAppDefinitionDatabase as aM, type MindooDBAppDefinitionListing as aN, type MindooDBAppDefinitionPermission as aO, type MindooDBAppDefinitionRegistrationPermission as aP, type MindooDBAppDefinitionScreenshot as aQ, type MindooDBAppDefinitionValidation as aR, type MindooDBAppDirectoryApi as aS, type MindooDBAppDirectoryEntry as aT, type MindooDBAppDocumentApi as aU, type MindooDBAppDocumentHeadCursorResult as aV, type MindooDBAppDocumentHistoryEntry as aW, type MindooDBAppDocumentListQuery as aX, type MindooDBAppDocumentListResult as aY, type MindooDBAppDocumentQuery as aZ, type MindooDBAppDocumentRevisionId as a_, type MindooDBAppBridgeRpcRequest as aa, type MindooDBAppBridgeRpcSuccess as ab, type MindooDBAppBridgeShortcutInvokedMessage as ac, type MindooDBAppBridgeShortcutsChangedMessage as ad, type MindooDBAppBridgeStreamAbortRequest as ae, type MindooDBAppBridgeStreamAck as af, type MindooDBAppBridgeStreamCloseRequest as ag, type MindooDBAppBridgeStreamError as ah, type MindooDBAppBridgeStreamMessage as ai, type MindooDBAppBridgeStreamOpenResult as aj, type MindooDBAppBridgeStreamReadRequest as ak, type MindooDBAppBridgeStreamWriteRequest as al, type MindooDBAppBridgeThemeChangedMessage as am, type MindooDBAppBridgeUiPreferencesChangedMessage as an, type MindooDBAppBridgeViewChangedMessage as ao, type MindooDBAppBridgeViewportChangedMessage as ap, type MindooDBAppBridgeWorkspaceFocusRequestedMessage as aq, type MindooDBAppBrowserFeatures as ar, type MindooDBAppCapability as as, type MindooDBAppConfiguredViewCategorizationStyle as at, type MindooDBAppConfiguredViewColumn as au, type MindooDBAppConfiguredViewColumnRole as av, type MindooDBAppConfiguredViewExpressionMode as aw, type MindooDBAppConfiguredViewFieldExpression as ax, type MindooDBAppConfiguredViewFilterDefinition as ay, type MindooDBAppConfiguredViewFilterMode as az, type MindooDBAppDragStartInput as b, type MindooDBAppQueryCoverage as b$, type MindooDBAppDocumentSummary as b0, type MindooDBAppDragApi as b1, type MindooDBAppDragCancelReason as b2, type MindooDBAppDragDropEvent as b3, type MindooDBAppDragEffect as b4, type MindooDBAppDragHoverResult as b5, type MindooDBAppDragOffer as b6, type MindooDBAppDragOverEvent as b7, type MindooDBAppDragPointer as b8, type MindooDBAppDragProfile as b9, type MindooDBAppJsonTextMarkPatch as bA, type MindooDBAppJsonTextSplicePatch as bB, type MindooDBAppJsonTextUnmarkPatch as bC, type MindooDBAppJsonUnsetPatch as bD, type MindooDBAppLaunchContext as bE, type MindooDBAppListUsersOptions as bF, type MindooDBAppListUsersPage as bG, type MindooDBAppLiveQuerySubscription as bH, type MindooDBAppLocalizedText as bI, type MindooDBAppMenuAnchor as bJ, type MindooDBAppMenuApi as bK, type MindooDBAppMenuCommandItem as bL, type MindooDBAppMenuDismissReason as bM, type MindooDBAppMenuDismissedResult as bN, type MindooDBAppMenuItem as bO, type MindooDBAppMenuKind as bP, type MindooDBAppMenuPlacement as bQ, type MindooDBAppMenuPointAnchor as bR, type MindooDBAppMenuRect as bS, type MindooDBAppMenuRectAnchor as bT, type MindooDBAppMenuSelectionResult as bU, type MindooDBAppMenuSeparatorItem as bV, type MindooDBAppNotificationSeverity as bW, type MindooDBAppNotifyInput as bX, type MindooDBAppNotifyResult as bY, type MindooDBAppProposeAppInput as bZ, type MindooDBAppProposeAppResult as b_, type MindooDBAppEntryAttachmentRef as ba, type MindooDBAppEntryProvenance as bb, type MindooDBAppExtractDocumentTextInput as bc, type MindooDBAppExtractDocumentTextResult as bd, type MindooDBAppExtractTextFormat as be, type MindooDBAppExtractionSetup as bf, type MindooDBAppFulltextSetup as bg, type MindooDBAppHistoricalDocument as bh, type MindooDBAppHistoryQuery as bi, type MindooDBAppHostTheme as bj, type MindooDBAppIdentityApi as bk, type MindooDBAppInaccessibleDocument as bl, type MindooDBAppInaccessibleDocumentListQuery as bm, type MindooDBAppInaccessibleDocumentListResult as bn, type MindooDBAppIncomingContent as bo, type MindooDBAppIncomingContentHandler as bp, type MindooDBAppIncomingContentInfo as bq, type MindooDBAppIncomingItem as br, type MindooDBAppIncomingItemInfo as bs, type MindooDBAppIncomingResult as bt, type MindooDBAppIncomingSource as bu, type MindooDBAppJsonCounterIncrementPatch as bv, type MindooDBAppJsonListDeletePatch as bw, type MindooDBAppJsonListInsertPatch as bx, type MindooDBAppJsonPatch as by, type MindooDBAppJsonSetPatch as bz, type MindooDBAppDragStartResult as c, type MindooDBAppViewNavigatorPageResult as c$, type MindooDBAppQueryInclude as c0, type MindooDBAppQueryIncludeCardinality as c1, type MindooDBAppQueryIncludeSlots as c2, type MindooDBAppQueryResult as c3, type MindooDBAppQueryRow as c4, type MindooDBAppQuerySortKey as c5, type MindooDBAppQueryTextClause as c6, type MindooDBAppReadableAttachmentStream as c7, type MindooDBAppRecipientOptions as c8, type MindooDBAppResolvedViewDefinition as c9, type MindooDBAppSignPreview as cA, type MindooDBAppSignPreviewScope as cB, type MindooDBAppSignStatementInput as cC, type MindooDBAppSignStatementResult as cD, type MindooDBAppStorageApi as cE, type MindooDBAppSummarySetup as cF, type MindooDBAppTextCursorOptions as cG, type MindooDBAppTextCursorPosition as cH, type MindooDBAppTextCursorPositionsResult as cI, type MindooDBAppTextCursorsResult as cJ, type MindooDBAppTextEdit as cK, type MindooDBAppTextPatch as cL, type MindooDBAppThemeMode as cM, type MindooDBAppTimestampApi as cN, type MindooDBAppTimestampInput as cO, type MindooDBAppTimestampProvider as cP, type MindooDBAppTimestampResult as cQ, type MindooDBAppUiPreferences as cR, type MindooDBAppUpdateDocumentInput as cS, type MindooDBAppViewCursorDocumentListResult as cT, type MindooDBAppViewCursorResult as cU, type MindooDBAppViewEntry as cV, type MindooDBAppViewEntryKind as cW, type MindooDBAppViewNavigator as cX, type MindooDBAppViewNavigatorExpansionState as cY, type MindooDBAppViewNavigatorOpenOptions as cZ, type MindooDBAppViewNavigatorPageOptions as c_, type MindooDBAppResolvedViewSource as ca, type MindooDBAppRevisionPhase as cb, type MindooDBAppRevisionVerification as cc, type MindooDBAppRichTextBlockSpan as cd, type MindooDBAppRichTextGetOptions as ce, type MindooDBAppRichTextImmutableString as cf, type MindooDBAppRichTextMarkRange as cg, type MindooDBAppRichTextMaterializeValue as ch, type MindooDBAppRichTextPatch as ci, type MindooDBAppRichTextScalar as cj, type MindooDBAppRichTextSpliceStep as ck, type MindooDBAppRichTextStep as cl, type MindooDBAppRichTextStepPatch as cm, type MindooDBAppRichTextTextSpan as cn, type MindooDBAppRuntime as co, type MindooDBAppScanAttachmentOptions as cp, type MindooDBAppScanAttachmentResult as cq, type MindooDBAppScopedDocId as cr, type MindooDBAppScopedDocumentSummary as cs, type MindooDBAppSealIntent as ct, type MindooDBAppSealedChannelOpenInput as cu, type MindooDBAppSealedChannelOpenResult as cv, type MindooDBAppSealedChannelRequestInput as cw, type MindooDBAppSession as cx, type MindooDBAppShowMenuInput as cy, type MindooDBAppShowMenuResult as cz, type MindooDBAppDragPreview as d, type MindooDBAppViewNavigatorRangeQuery as d0, type MindooDBAppViewNavigatorSelectionState as d1, type MindooDBAppViewUpdateStats as d2, type MindooDBAppViewport as d3, type MindooDBAppWellKnownDragType as d4, type MindooDBAppWritableAttachmentStream as d5, mindooDBAppAcceptMatchesType as d6, resolveMindooDBAppDefinitionUrl as d7, resolveMindooDBAppListingAssetUrl as d8, resolveMindooDBAppLocalizedText as d9, validateMindooDBAppAccepts as da, validateMindooDBAppDefinition as db, type MindooDBAppBridge as e, type MindooDBAppAgentToolErrorCode as f, type MindooDBAppHostShortcutBinding as g, type MindooDBAppHostShortcutAction as h, type MindooDBAppHostingMode as i, type MindooDBAppDefinition as j, type MindooDBAppDatabase as k, type MindooDBAppDocument as l, type MindooDBAppRichTextSpan as m, type MindooDBAppRichTextSnapshot as n, type MindooDBAppCreateDocumentInput as o, MINDOODB_APP_ACCEPTS_MAX as p, MINDOODB_APP_DEFINITION_FILE_NAME as q, MINDOODB_APP_DEFINITION_FORMAT as r, MINDOODB_APP_DEFINITION_PERMISSIONS as s, MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS as t, MINDOODB_APP_DEFINITION_VERSION as u, MINDOODB_APP_LISTING_DESCRIPTION_MAX as v, MINDOODB_APP_LISTING_MAX_SCREENSHOTS as w, MINDOODB_APP_LISTING_SUMMARY_MAX as x, MINDOODB_APP_SEAL_SIGNING_DOMAIN as y, MINDOODB_APP_WELL_KNOWN_DRAG_TYPES as z };
@@ -43,6 +43,23 @@ interface ShareHtmlContext {
43
43
  } | null;
44
44
  };
45
45
  }
46
+ /** Structural subset of Vite's dev server (connect middlewares). */
47
+ interface DevServer {
48
+ middlewares: {
49
+ use: (handler: (req: {
50
+ url?: string;
51
+ }, res: {
52
+ statusCode: number;
53
+ setHeader: (name: string, value: string) => void;
54
+ end: () => void;
55
+ }, next: () => void) => void) => void;
56
+ };
57
+ }
58
+ /**
59
+ * The test host lives in the `__haven-test/` directory, so only the URL with the trailing
60
+ * slash reaches its page; without it Vite answers with the app's own `index.html`.
61
+ */
62
+ declare function havenTestRedirect(url: string | undefined): string | null;
46
63
  /** Structural subset of Vite's `Plugin`, so the SDK does not need to depend on Vite. */
47
64
  interface HavenBundleVitePlugin {
48
65
  name: string;
@@ -52,9 +69,11 @@ interface HavenBundleVitePlugin {
52
69
  */
53
70
  configResolved: (config: ResolvedViteConfig) => void;
54
71
  transformIndexHtml: (html: string, ctx: ShareHtmlContext) => Promise<string>;
72
+ /** Dev only: `/__haven-test` redirects to `/__haven-test/`, the test host's page. */
73
+ configureServer: (server: DevServer) => void;
55
74
  writeBundle: () => Promise<void>;
56
75
  closeBundle: () => Promise<void>;
57
76
  }
58
77
  declare function havenBundle(options?: HavenBundleOptions): HavenBundleVitePlugin;
59
78
 
60
- export { type HavenBundleOptions, type HavenBundleVitePlugin, havenBundle };
79
+ export { type HavenBundleOptions, type HavenBundleVitePlugin, havenBundle, havenTestRedirect };
@@ -276,6 +276,11 @@ var DEFAULT_EXCLUDED_ROOT_FILES = /* @__PURE__ */ new Set([
276
276
  MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME
277
277
  ]);
278
278
  var WORKBOX_RUNTIME_PATTERN = /^workbox-[a-z0-9]+\.js(\.map)?$/i;
279
+ function havenTestRedirect(url) {
280
+ if (!url) return null;
281
+ const match = /^(.*\/__haven-test)(\?.*)?$/.exec(url);
282
+ return match ? `${match[1]}/${match[2] ?? ""}` : null;
283
+ }
279
284
  async function directoryExists(dir) {
280
285
  try {
281
286
  await access(dir);
@@ -454,6 +459,15 @@ function havenBundle(options = {}) {
454
459
  const meta2 = havenAppShareMeta(raw, pageUrl);
455
460
  return meta2 ? injectHavenAppShareMeta(html, meta2) : html;
456
461
  },
462
+ configureServer(server) {
463
+ server.middlewares.use((req, res, next) => {
464
+ const target = havenTestRedirect(req.url);
465
+ if (!target) return next();
466
+ res.statusCode = 302;
467
+ res.setHeader("Location", target);
468
+ res.end();
469
+ });
470
+ },
457
471
  async writeBundle() {
458
472
  await emitBundle();
459
473
  },
@@ -463,5 +477,6 @@ function havenBundle(options = {}) {
463
477
  };
464
478
  }
465
479
  export {
466
- havenBundle
480
+ havenBundle,
481
+ havenTestRedirect
467
482
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindoodb-app-sdk",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "engines": {
5
5
  "node": ">=22.13.0"
6
6
  },
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@automerge/automerge": "^3.3.2",
48
- "mindoodb": ">=0.0.69"
48
+ "mindoodb": ">=0.0.70"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "@automerge/automerge": {
@@ -56,8 +56,8 @@
56
56
  }
57
57
  },
58
58
  "devDependencies": {
59
- "@automerge/automerge": "^3.3.2",
60
- "mindoodb": "^0.0.69",
59
+ "@automerge/automerge": "^3.5.0",
60
+ "mindoodb": "^0.0.70",
61
61
  "@types/node": "25.5.0",
62
62
  "jsdom": "^29.0.1",
63
63
  "tsup": "^8.5.1",