mindoodb-app-sdk 0.0.14 → 0.0.17

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/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge } from './types-B1iKRIuy.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 MindooDBAppDocumentHeadCursorResult, Z as MindooDBAppDocumentHistoryEntry, _ as MindooDBAppDocumentListQuery, $ as MindooDBAppDocumentListResult, a0 as MindooDBAppDocumentSummary, a1 as MindooDBAppHistoricalDocument, a2 as MindooDBAppHistoryQuery, a3 as MindooDBAppHostTheme, a4 as MindooDBAppLaunchContext, a5 as MindooDBAppMenuAnchor, a6 as MindooDBAppMenuApi, a7 as MindooDBAppMenuCommandItem, a8 as MindooDBAppMenuDismissReason, a9 as MindooDBAppMenuDismissedResult, aa as MindooDBAppMenuItem, ab as MindooDBAppMenuKind, ac as MindooDBAppMenuPlacement, ad as MindooDBAppMenuPointAnchor, ae as MindooDBAppMenuRect, af as MindooDBAppMenuRectAnchor, ag as MindooDBAppMenuSelectionResult, ah as MindooDBAppMenuSeparatorItem, ai as MindooDBAppReadableAttachmentStream, aj as MindooDBAppResolvedViewDefinition, ak as MindooDBAppResolvedViewSource, al as MindooDBAppRuntime, am as MindooDBAppScopedDocId, an as MindooDBAppScopedDocumentSummary, ao as MindooDBAppSession, ap as MindooDBAppShowMenuInput, aq as MindooDBAppShowMenuResult, ar as MindooDBAppThemeMode, as as MindooDBAppUiPreferences, at as MindooDBAppUpdateDocumentInput, au as MindooDBAppViewCursorDocumentListResult, av as MindooDBAppViewCursorResult, aw as MindooDBAppViewEntry, ax as MindooDBAppViewEntryKind, ay as MindooDBAppViewNavigator, az as MindooDBAppViewNavigatorExpansionState, aA as MindooDBAppViewNavigatorOpenOptions, aB as MindooDBAppViewNavigatorPageOptions, aC as MindooDBAppViewNavigatorPageResult, aD as MindooDBAppViewNavigatorRangeQuery, aE as MindooDBAppViewNavigatorSelectionState, aF as MindooDBAppViewport, aG as MindooDBAppWritableAttachmentStream } from './types-B1iKRIuy.js';
1
+ import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge, b as MindooDBAppDatabase, c as MindooDBAppDocument } from './types-Dw6YRApH.js';
2
+ export { d as MindooDBAppAttachmentApi, e as MindooDBAppAttachmentChunk, f as MindooDBAppAttachmentInfo, g as MindooDBAppAttachmentPreviewOptions, h as MindooDBAppAttachmentPreviewSession, i as MindooDBAppBridgeConnectMessage, j as MindooDBAppBridgeConnectOptions, k as MindooDBAppBridgeConnectedMessage, l as MindooDBAppBridgeErrorPayload, m as MindooDBAppBridgeHandshakeErrorMessage, n as MindooDBAppBridgePortMessage, o as MindooDBAppBridgeRpcError, p as MindooDBAppBridgeRpcMessage, q as MindooDBAppBridgeRpcRequest, r as MindooDBAppBridgeRpcSuccess, s as MindooDBAppBridgeStreamAbortRequest, t as MindooDBAppBridgeStreamAck, u as MindooDBAppBridgeStreamCloseRequest, v as MindooDBAppBridgeStreamError, w as MindooDBAppBridgeStreamMessage, x as MindooDBAppBridgeStreamOpenResult, y as MindooDBAppBridgeStreamReadRequest, z as MindooDBAppBridgeStreamWriteRequest, A as MindooDBAppBridgeThemeChangedMessage, B as MindooDBAppBridgeUiPreferencesChangedMessage, C as MindooDBAppBridgeViewportChangedMessage, D as MindooDBAppCapability, E as MindooDBAppConfiguredViewCategorizationStyle, F as MindooDBAppConfiguredViewColumn, G as MindooDBAppConfiguredViewColumnRole, H as MindooDBAppConfiguredViewExpressionMode, I as MindooDBAppConfiguredViewFieldExpression, J as MindooDBAppConfiguredViewFilterDefinition, K as MindooDBAppConfiguredViewFilterMode, L as MindooDBAppConfiguredViewFilterRule, N as MindooDBAppConfiguredViewFormulaExpression, O as MindooDBAppConfiguredViewFormulaFilterDefinition, P as MindooDBAppConfiguredViewPreviewMode, Q as MindooDBAppConfiguredViewRuleFilterDefinition, R as MindooDBAppConfiguredViewRuleMatchMode, S as MindooDBAppConfiguredViewRuleOperator, T as MindooDBAppConfiguredViewValueExpression, U as MindooDBAppCreateDocumentInput, V as MindooDBAppCreateViewInput, W as MindooDBAppCreateViewNavigatorInput, X as MindooDBAppDatabaseInfo, Y as MindooDBAppDocumentApi, Z as MindooDBAppDocumentHeadCursorResult, _ as MindooDBAppDocumentHistoryEntry, $ as MindooDBAppDocumentListQuery, a0 as MindooDBAppDocumentListResult, a1 as MindooDBAppDocumentRevisionId, a2 as MindooDBAppDocumentScanPreset, a3 as MindooDBAppDocumentSummary, a4 as MindooDBAppHistoricalDocument, a5 as MindooDBAppHistoryQuery, a6 as MindooDBAppHostTheme, a7 as MindooDBAppJsonListDeletePatch, a8 as MindooDBAppJsonListInsertPatch, a9 as MindooDBAppJsonPatch, aa as MindooDBAppJsonSetPatch, ab as MindooDBAppJsonUnsetPatch, ac as MindooDBAppLaunchContext, ad as MindooDBAppMenuAnchor, ae as MindooDBAppMenuApi, af as MindooDBAppMenuCommandItem, ag as MindooDBAppMenuDismissReason, ah as MindooDBAppMenuDismissedResult, ai as MindooDBAppMenuItem, aj as MindooDBAppMenuKind, ak as MindooDBAppMenuPlacement, al as MindooDBAppMenuPointAnchor, am as MindooDBAppMenuRect, an as MindooDBAppMenuRectAnchor, ao as MindooDBAppMenuSelectionResult, ap as MindooDBAppMenuSeparatorItem, aq as MindooDBAppReadableAttachmentStream, ar as MindooDBAppResolvedViewDefinition, as as MindooDBAppResolvedViewSource, at as MindooDBAppRuntime, au as MindooDBAppScanAttachmentOptions, av as MindooDBAppScanAttachmentResult, aw as MindooDBAppScopedDocId, ax as MindooDBAppScopedDocumentSummary, ay as MindooDBAppSession, az as MindooDBAppShowMenuInput, aA as MindooDBAppShowMenuResult, aB as MindooDBAppTextEdit, aC as MindooDBAppTextPatch, aD as MindooDBAppThemeMode, aE as MindooDBAppUiPreferences, aF as MindooDBAppUpdateDocumentInput, aG as MindooDBAppViewCursorDocumentListResult, aH as MindooDBAppViewCursorResult, aI as MindooDBAppViewEntry, aJ as MindooDBAppViewEntryKind, aK as MindooDBAppViewNavigator, aL as MindooDBAppViewNavigatorExpansionState, aM as MindooDBAppViewNavigatorOpenOptions, aN as MindooDBAppViewNavigatorPageOptions, aO as MindooDBAppViewNavigatorPageResult, aP as MindooDBAppViewNavigatorRangeQuery, aQ as MindooDBAppViewNavigatorSelectionState, aR as MindooDBAppViewport, aS as MindooDBAppWritableAttachmentStream } from './types-Dw6YRApH.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
  /**
@@ -32,9 +32,102 @@ declare function expandAbbreviatedName(value: string): string;
32
32
  * Creates the browser-side bridge entry point used by MindooDB apps.
33
33
  *
34
34
  * The returned object performs the initial postMessage handshake with the
35
- * Administrator host and exposes a session with document, view, and attachment
35
+ * Haven host and exposes a session with document, view, and attachment
36
36
  * APIs over a dedicated `MessagePort`.
37
37
  */
38
38
  declare function createMindooDBAppBridge(): MindooDBAppBridge;
39
39
 
40
- export { MindooDBAppAttachmentPreviewMode, MindooDBAppBridge, abbreviateCanonicalName, canPreviewAttachment, createMindooDBAppBridge, expandAbbreviatedName };
40
+ /**
41
+ * Options used to create a text buffer for one string field in a MindooDB
42
+ * document.
43
+ *
44
+ * The buffer keeps a local editable string and records text operations that can
45
+ * later be flushed over the JSON bridge. `path` points to the string inside
46
+ * `document.data`, for example `["body"]` for a markdown body field.
47
+ */
48
+ interface CreateMindooDBTextBufferOptions {
49
+ /** Open database handle used when `flush()` sends the buffered text patch. */
50
+ database: MindooDBAppDatabase;
51
+ /** Document snapshot the local editor state is based on. */
52
+ document: MindooDBAppDocument;
53
+ /** Path to the string field inside `document.data`. */
54
+ path: Array<string | number>;
55
+ }
56
+ /**
57
+ * Result returned after flushing pending text edits.
58
+ */
59
+ interface MindooDBTextBufferFlushResult {
60
+ /** Updated document returned by Haven after applying and reconciling edits. */
61
+ document: MindooDBAppDocument;
62
+ /** Canonical text value at the configured path after the flush. */
63
+ value: string;
64
+ /**
65
+ * `true` when the canonical value returned by Haven differs from the local
66
+ * value that was flushed. This usually means concurrent edits from another
67
+ * app instance or sync source were merged during save and the editor should
68
+ * replace its visible content with `value`.
69
+ */
70
+ reconciled: boolean;
71
+ }
72
+ /**
73
+ * Local text editing buffer for SDK apps.
74
+ *
75
+ * `MindooDBTextBuffer` is intentionally not an Automerge document. It is a
76
+ * small app-side helper that behaves like a mutable string, keeps track of
77
+ * local text edits, and flushes those edits as JSON-safe operations to Haven.
78
+ * Haven then applies the operations against the real Automerge document using
79
+ * the document heads captured when this buffer was created or last reconciled.
80
+ *
81
+ * Use `splice()` when your editor can report exact text operations. Use
82
+ * `replaceText()` for WYSIWYG or markdown editors that expose only the full
83
+ * current text value; the buffer computes a minimal single-splice diff.
84
+ */
85
+ declare class MindooDBTextBuffer {
86
+ private readonly options;
87
+ private valueInternal;
88
+ private heads;
89
+ private pendingEdits;
90
+ constructor(options: CreateMindooDBTextBufferOptions);
91
+ get value(): string;
92
+ /** Whether there are local edits that have not been flushed yet. */
93
+ get dirty(): boolean;
94
+ /** Number of pending text operations currently buffered. */
95
+ get pendingCount(): number;
96
+ /** Return the current local text value. */
97
+ toString(): string;
98
+ /**
99
+ * Apply an exact local text splice and queue it for the next flush.
100
+ *
101
+ * Offsets use JavaScript string indexing. The delete count is clamped to the
102
+ * remaining local text length so callers can safely delete to the end.
103
+ */
104
+ splice(index: number, deleteCount: number, insert?: string): void;
105
+ /**
106
+ * Replace the current local text value and queue the change as one splice.
107
+ *
108
+ * This is useful for editors such as Milkdown that can produce the full
109
+ * markdown string after each transaction but do not expose raw text splices.
110
+ */
111
+ replaceText(nextValue: string): void;
112
+ /**
113
+ * Replace local state from a fresh document snapshot and clear pending edits.
114
+ *
115
+ * Returns whether the text value changed. Use this after an external refresh
116
+ * or after receiving a document update through another app-level mechanism.
117
+ */
118
+ reconcile(document: MindooDBAppDocument): boolean;
119
+ /**
120
+ * Flush pending edits to Haven using `documents.update({ text: ... })`.
121
+ *
122
+ * The request includes the document heads this buffer is based on, allowing
123
+ * Haven to apply the text operations at the original causal version and merge
124
+ * them with any concurrent document changes. After a successful flush the
125
+ * buffer adopts the returned canonical value and heads, and clears the
126
+ * pending edit queue.
127
+ */
128
+ flush(): Promise<MindooDBTextBufferFlushResult>;
129
+ }
130
+ /** Create a local text buffer for one string field in a document. */
131
+ declare function createMindooDBTextBuffer(options: CreateMindooDBTextBufferOptions): MindooDBTextBuffer;
132
+
133
+ export { type CreateMindooDBTextBufferOptions, MindooDBAppAttachmentPreviewMode, MindooDBAppBridge, MindooDBAppDatabase, MindooDBAppDocument, MindooDBTextBuffer, type MindooDBTextBufferFlushResult, abbreviateCanonicalName, canPreviewAttachment, createMindooDBAppBridge, createMindooDBTextBuffer, expandAbbreviatedName };