mindoodb-app-sdk 0.0.18 → 0.0.20

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.
@@ -277,6 +277,103 @@ interface MindooDBAppTextPatch {
277
277
  baseHeads?: string[];
278
278
  edits: MindooDBAppTextEdit[];
279
279
  }
280
+ type MindooDBAppRichTextScalar = string | number | boolean | null;
281
+ interface MindooDBAppRichTextImmutableString {
282
+ type: "immutableString";
283
+ value: string;
284
+ }
285
+ type MindooDBAppRichTextMaterializeValue = MindooDBAppRichTextScalar | MindooDBAppRichTextImmutableString | MindooDBAppRichTextMaterializeValue[] | {
286
+ [key: string]: MindooDBAppRichTextMaterializeValue;
287
+ };
288
+ interface MindooDBAppRichTextTextSpan {
289
+ type: "text";
290
+ value: string;
291
+ marks?: Record<string, MindooDBAppRichTextMaterializeValue>;
292
+ }
293
+ interface MindooDBAppRichTextBlockSpan {
294
+ type: "block";
295
+ value: Record<string, MindooDBAppRichTextMaterializeValue>;
296
+ }
297
+ type MindooDBAppRichTextSpan = MindooDBAppRichTextTextSpan | MindooDBAppRichTextBlockSpan;
298
+ interface MindooDBAppRichTextMarkRange {
299
+ index: number;
300
+ length: number;
301
+ marks: Record<string, MindooDBAppRichTextMaterializeValue>;
302
+ }
303
+ interface MindooDBAppRichTextSpliceStep {
304
+ type: "splice";
305
+ index: number;
306
+ deleteCount: number;
307
+ insert?: string;
308
+ marks?: MindooDBAppRichTextMarkRange[];
309
+ }
310
+ type MindooDBAppRichTextStep = MindooDBAppRichTextSpliceStep;
311
+ interface MindooDBAppRichTextStepPatch {
312
+ /** Path to the Automerge rich-text field inside the document payload. */
313
+ path: Array<string | number>;
314
+ /** Automerge heads of the document state these positional steps were based on. */
315
+ baseHeads?: string[];
316
+ /** Ordered rich-text positional operations to apply with Automerge splice/mark. */
317
+ steps: MindooDBAppRichTextStep[];
318
+ }
319
+ interface MindooDBAppRichTextPatch {
320
+ /** Path to the Automerge rich-text field inside the document payload. */
321
+ path: Array<string | number>;
322
+ /** Automerge heads of the document state this rich-text snapshot was based on. */
323
+ baseHeads?: string[];
324
+ /** Full JSON-safe span snapshot to apply with Automerge `updateSpans`. */
325
+ spans?: MindooDBAppRichTextSpan[];
326
+ /** Ordered snapshots to apply one-by-one so each `updateSpans` diff stays transaction-sized. */
327
+ spansSequence?: MindooDBAppRichTextSpan[][];
328
+ /** Optional Automerge `updateSpans` configuration, kept JSON-safe over the bridge. */
329
+ updateSpansConfig?: Record<string, unknown>;
330
+ }
331
+ interface MindooDBAppRichTextSnapshot {
332
+ path: Array<string | number>;
333
+ heads?: string[];
334
+ spans: MindooDBAppRichTextSpan[];
335
+ }
336
+ interface MindooDBAppRichTextGetOptions {
337
+ /** Stable revision id previously obtained from `documents.listHistory()`. */
338
+ revisionId?: MindooDBAppDocumentRevisionId;
339
+ }
340
+ /** Binary Automerge snapshot of the full internal document. */
341
+ interface MindooDBAppAutomergeSnapshot {
342
+ binary: Uint8Array;
343
+ heads: string[];
344
+ }
345
+ interface MindooDBAppAutomergeGetOptions {
346
+ /** Stable revision id previously obtained from `documents.listHistory()`. */
347
+ revisionId?: MindooDBAppDocumentRevisionId;
348
+ }
349
+ /** Raw Automerge change bytes produced by a local replica. */
350
+ interface MindooDBAppAutomergeChangesPatch {
351
+ /** Heads the client had when authoring `changes`; optional, for correlation only. */
352
+ baseHeads?: string[];
353
+ /**
354
+ * Heads of the local replica after authoring `changes`. When provided, the
355
+ * apply response includes `changesSince` for incremental reconciliation.
356
+ */
357
+ replicaHeads?: string[];
358
+ /** Change bytes from `Automerge.getChangesSince`; merged into Haven's current doc. */
359
+ changes: Uint8Array[];
360
+ }
361
+ /** Incremental catch-up bytes for a local replica after an apply merge. */
362
+ interface MindooDBAppAutomergeChangesSince {
363
+ /** Echo of `replicaHeads` from the request. */
364
+ sinceHeads: string[];
365
+ /** Changes on the merged canonical doc that the replica is missing. */
366
+ changes: Uint8Array[];
367
+ }
368
+ interface MindooDBAppAutomergePatchResult {
369
+ document: MindooDBAppDocument;
370
+ heads: string[];
371
+ /**
372
+ * Present when the request included `replicaHeads`. Apply locally with
373
+ * `Automerge.applyChanges` instead of reloading a full snapshot.
374
+ */
375
+ changesSince?: MindooDBAppAutomergeChangesSince;
376
+ }
280
377
  /**
281
378
  * Sets the value at `path` inside the document payload.
282
379
  *
@@ -319,6 +416,33 @@ interface MindooDBAppJsonListDeletePatch {
319
416
  index: number;
320
417
  deleteCount: number;
321
418
  }
419
+ /**
420
+ * Splices text at `path` using Automerge text semantics.
421
+ */
422
+ interface MindooDBAppJsonTextSplicePatch {
423
+ path: Array<string | number>;
424
+ index: number;
425
+ deleteCount: number;
426
+ insert?: string;
427
+ }
428
+ /**
429
+ * Applies one or more marks to a text range at `path`.
430
+ */
431
+ interface MindooDBAppJsonTextMarkPatch {
432
+ path: Array<string | number>;
433
+ index: number;
434
+ length: number;
435
+ marks: Record<string, MindooDBAppRichTextMaterializeValue>;
436
+ }
437
+ /**
438
+ * Removes marks from a text range at `path`.
439
+ */
440
+ interface MindooDBAppJsonTextUnmarkPatch {
441
+ path: Array<string | number>;
442
+ index: number;
443
+ length: number;
444
+ names: string[];
445
+ }
322
446
  interface MindooDBAppJsonPatch {
323
447
  /**
324
448
  * Automerge heads of the document snapshot this JSON patch was authored
@@ -330,6 +454,9 @@ interface MindooDBAppJsonPatch {
330
454
  unset?: MindooDBAppJsonUnsetPatch[];
331
455
  listInsert?: MindooDBAppJsonListInsertPatch[];
332
456
  listDelete?: MindooDBAppJsonListDeletePatch[];
457
+ textSplice?: MindooDBAppJsonTextSplicePatch[];
458
+ textMark?: MindooDBAppJsonTextMarkPatch[];
459
+ textUnmark?: MindooDBAppJsonTextUnmarkPatch[];
333
460
  }
334
461
  /**
335
462
  * Sparse patch payload used when updating an existing document.
@@ -347,6 +474,10 @@ interface MindooDBAppUpdateDocumentInput {
347
474
  json?: MindooDBAppJsonPatch;
348
475
  /** Granular text edits to apply at document paths. */
349
476
  text?: MindooDBAppTextPatch[];
477
+ /** Rich-text span snapshots to apply at document paths. */
478
+ richText?: MindooDBAppRichTextPatch[];
479
+ /** Rich-text positional steps to apply at document paths. */
480
+ richTextSteps?: MindooDBAppRichTextStepPatch[];
350
481
  }
351
482
  /** Query used for history lookups at a specific timestamp. */
352
483
  interface MindooDBAppHistoryQuery {
@@ -560,6 +691,23 @@ interface MindooDBAppDocumentApi {
560
691
  list(query?: MindooDBAppDocumentListQuery): Promise<MindooDBAppDocumentListResult>;
561
692
  getHeadCursor(): Promise<MindooDBAppDocumentHeadCursorResult>;
562
693
  get(docId: string): Promise<MindooDBAppDocument | null>;
694
+ getRichText(docId: string, path: Array<string | number>, options?: MindooDBAppRichTextGetOptions): Promise<MindooDBAppRichTextSnapshot>;
695
+ /**
696
+ * Export the full internal Automerge document as binary.
697
+ *
698
+ * **Discouraged** — prefer `getRichText`, `get`, and `documents.update` (`set`,
699
+ * `unset`, `text`, `richText`, `json`) unless those APIs cannot express your
700
+ * edits. Added for TeamEdit Word/.docx (local Automerge replica + binary flush).
701
+ */
702
+ getAutomergeSnapshot(docId: string, options?: MindooDBAppAutomergeGetOptions): Promise<MindooDBAppAutomergeSnapshot>;
703
+ /**
704
+ * Merge raw Automerge change bytes into the canonical document on Haven.
705
+ *
706
+ * **Discouraged** — prefer `documents.update` patch operations. Escape hatch
707
+ * for apps that host a local Automerge replica when JSON patches are insufficient.
708
+ * Include `replicaHeads` to receive incremental `changesSince` in the response.
709
+ */
710
+ applyAutomergeChanges(docId: string, patch: MindooDBAppAutomergeChangesPatch): Promise<MindooDBAppAutomergePatchResult>;
563
711
  create(input: MindooDBAppCreateDocumentInput): Promise<MindooDBAppDocument>;
564
712
  update(docId: string, patch: MindooDBAppUpdateDocumentInput): Promise<MindooDBAppDocument>;
565
713
  delete(docId: string): Promise<{
@@ -737,4 +885,4 @@ interface MindooDBAppBridge {
737
885
  connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
738
886
  }
739
887
 
740
- export type { MindooDBAppDocumentListQuery as $, MindooDBAppBridgeThemeChangedMessage as A, MindooDBAppBridgeUiPreferencesChangedMessage as B, MindooDBAppBridgeViewportChangedMessage as C, MindooDBAppCapability as D, MindooDBAppConfiguredViewCategorizationStyle as E, MindooDBAppConfiguredViewColumn as F, MindooDBAppConfiguredViewColumnRole as G, MindooDBAppConfiguredViewExpressionMode as H, MindooDBAppConfiguredViewFieldExpression as I, MindooDBAppConfiguredViewFilterDefinition as J, MindooDBAppConfiguredViewFilterMode as K, MindooDBAppConfiguredViewFilterRule as L, MindooDBAppAttachmentPreviewMode as M, MindooDBAppConfiguredViewFormulaExpression as N, MindooDBAppConfiguredViewFormulaFilterDefinition as O, MindooDBAppConfiguredViewPreviewMode as P, MindooDBAppConfiguredViewRuleFilterDefinition as Q, MindooDBAppConfiguredViewRuleMatchMode as R, MindooDBAppConfiguredViewRuleOperator as S, MindooDBAppConfiguredViewValueExpression as T, MindooDBAppCreateDocumentInput as U, MindooDBAppCreateViewInput as V, MindooDBAppCreateViewNavigatorInput as W, MindooDBAppDatabaseInfo as X, MindooDBAppDocumentApi as Y, MindooDBAppDocumentHeadCursorResult as Z, MindooDBAppDocumentHistoryEntry as _, MindooDBAppBridge as a, MindooDBAppDocumentListResult as a0, MindooDBAppDocumentRevisionId as a1, MindooDBAppDocumentScanPreset as a2, MindooDBAppDocumentSummary as a3, MindooDBAppHistoricalDocument as a4, MindooDBAppHistoryQuery as a5, MindooDBAppHostTheme as a6, MindooDBAppJsonListDeletePatch as a7, MindooDBAppJsonListInsertPatch as a8, MindooDBAppJsonPatch as a9, MindooDBAppShowMenuResult as aA, MindooDBAppTextEdit as aB, MindooDBAppTextPatch as aC, MindooDBAppThemeMode as aD, MindooDBAppUiPreferences as aE, MindooDBAppUpdateDocumentInput as aF, MindooDBAppViewCursorDocumentListResult as aG, MindooDBAppViewCursorResult as aH, MindooDBAppViewEntry as aI, MindooDBAppViewEntryKind as aJ, MindooDBAppViewNavigator as aK, MindooDBAppViewNavigatorExpansionState as aL, MindooDBAppViewNavigatorOpenOptions as aM, MindooDBAppViewNavigatorPageOptions as aN, MindooDBAppViewNavigatorPageResult as aO, MindooDBAppViewNavigatorRangeQuery as aP, MindooDBAppViewNavigatorSelectionState as aQ, MindooDBAppViewport as aR, MindooDBAppWritableAttachmentStream as aS, MindooDBAppJsonSetPatch as aa, MindooDBAppJsonUnsetPatch as ab, MindooDBAppLaunchContext as ac, MindooDBAppMenuAnchor as ad, MindooDBAppMenuApi as ae, MindooDBAppMenuCommandItem as af, MindooDBAppMenuDismissReason as ag, MindooDBAppMenuDismissedResult as ah, MindooDBAppMenuItem as ai, MindooDBAppMenuKind as aj, MindooDBAppMenuPlacement as ak, MindooDBAppMenuPointAnchor as al, MindooDBAppMenuRect as am, MindooDBAppMenuRectAnchor as an, MindooDBAppMenuSelectionResult as ao, MindooDBAppMenuSeparatorItem as ap, MindooDBAppReadableAttachmentStream as aq, MindooDBAppResolvedViewDefinition as ar, MindooDBAppResolvedViewSource as as, MindooDBAppRuntime as at, MindooDBAppScanAttachmentOptions as au, MindooDBAppScanAttachmentResult as av, MindooDBAppScopedDocId as aw, MindooDBAppScopedDocumentSummary as ax, MindooDBAppSession as ay, MindooDBAppShowMenuInput as az, MindooDBAppDatabase as b, MindooDBAppDocument as c, MindooDBAppAttachmentApi as d, MindooDBAppAttachmentChunk as e, MindooDBAppAttachmentInfo as f, MindooDBAppAttachmentPreviewOptions as g, MindooDBAppAttachmentPreviewSession as h, MindooDBAppBridgeConnectMessage as i, MindooDBAppBridgeConnectOptions as j, MindooDBAppBridgeConnectedMessage as k, MindooDBAppBridgeErrorPayload as l, MindooDBAppBridgeHandshakeErrorMessage as m, MindooDBAppBridgePortMessage as n, MindooDBAppBridgeRpcError as o, MindooDBAppBridgeRpcMessage as p, MindooDBAppBridgeRpcRequest as q, MindooDBAppBridgeRpcSuccess as r, MindooDBAppBridgeStreamAbortRequest as s, MindooDBAppBridgeStreamAck as t, MindooDBAppBridgeStreamCloseRequest as u, MindooDBAppBridgeStreamError as v, MindooDBAppBridgeStreamMessage as w, MindooDBAppBridgeStreamOpenResult as x, MindooDBAppBridgeStreamReadRequest as y, MindooDBAppBridgeStreamWriteRequest as z };
888
+ export type { MindooDBAppCreateDocumentInput as $, MindooDBAppBridgeStreamAck as A, MindooDBAppBridgeStreamCloseRequest as B, MindooDBAppBridgeStreamError as C, MindooDBAppBridgeStreamMessage as D, MindooDBAppBridgeStreamOpenResult as E, MindooDBAppBridgeStreamReadRequest as F, MindooDBAppBridgeStreamWriteRequest as G, MindooDBAppBridgeThemeChangedMessage as H, MindooDBAppBridgeUiPreferencesChangedMessage as I, MindooDBAppBridgeViewportChangedMessage as J, MindooDBAppCapability as K, MindooDBAppConfiguredViewCategorizationStyle as L, MindooDBAppAttachmentPreviewMode as M, MindooDBAppConfiguredViewColumn as N, MindooDBAppConfiguredViewColumnRole as O, MindooDBAppConfiguredViewExpressionMode as P, MindooDBAppConfiguredViewFieldExpression as Q, MindooDBAppConfiguredViewFilterDefinition as R, MindooDBAppConfiguredViewFilterMode as S, MindooDBAppConfiguredViewFilterRule as T, MindooDBAppConfiguredViewFormulaExpression as U, MindooDBAppConfiguredViewFormulaFilterDefinition as V, MindooDBAppConfiguredViewPreviewMode as W, MindooDBAppConfiguredViewRuleFilterDefinition as X, MindooDBAppConfiguredViewRuleMatchMode as Y, MindooDBAppConfiguredViewRuleOperator as Z, MindooDBAppConfiguredViewValueExpression as _, MindooDBAppBridge as a, MindooDBAppViewCursorDocumentListResult as a$, MindooDBAppCreateViewInput as a0, MindooDBAppCreateViewNavigatorInput as a1, MindooDBAppDatabaseInfo as a2, MindooDBAppDocumentApi as a3, MindooDBAppDocumentHeadCursorResult as a4, MindooDBAppDocumentHistoryEntry as a5, MindooDBAppDocumentListQuery as a6, MindooDBAppDocumentListResult as a7, MindooDBAppDocumentRevisionId as a8, MindooDBAppDocumentScanPreset as a9, MindooDBAppReadableAttachmentStream as aA, MindooDBAppResolvedViewDefinition as aB, MindooDBAppResolvedViewSource as aC, MindooDBAppRichTextBlockSpan as aD, MindooDBAppRichTextGetOptions as aE, MindooDBAppRichTextImmutableString as aF, MindooDBAppRichTextMarkRange as aG, MindooDBAppRichTextMaterializeValue as aH, MindooDBAppRichTextPatch as aI, MindooDBAppRichTextScalar as aJ, MindooDBAppRichTextSpliceStep as aK, MindooDBAppRichTextStep as aL, MindooDBAppRichTextStepPatch as aM, MindooDBAppRichTextTextSpan as aN, MindooDBAppRuntime as aO, MindooDBAppScanAttachmentOptions as aP, MindooDBAppScanAttachmentResult as aQ, MindooDBAppScopedDocId as aR, MindooDBAppScopedDocumentSummary as aS, MindooDBAppSession as aT, MindooDBAppShowMenuInput as aU, MindooDBAppShowMenuResult as aV, MindooDBAppTextEdit as aW, MindooDBAppTextPatch as aX, MindooDBAppThemeMode as aY, MindooDBAppUiPreferences as aZ, MindooDBAppUpdateDocumentInput as a_, MindooDBAppDocumentSummary as aa, MindooDBAppHistoricalDocument as ab, MindooDBAppHistoryQuery as ac, MindooDBAppHostTheme as ad, MindooDBAppJsonListDeletePatch as ae, MindooDBAppJsonListInsertPatch as af, MindooDBAppJsonPatch as ag, MindooDBAppJsonSetPatch as ah, MindooDBAppJsonTextMarkPatch as ai, MindooDBAppJsonTextSplicePatch as aj, MindooDBAppJsonTextUnmarkPatch as ak, MindooDBAppJsonUnsetPatch as al, MindooDBAppLaunchContext as am, MindooDBAppMenuAnchor as an, MindooDBAppMenuApi as ao, MindooDBAppMenuCommandItem as ap, MindooDBAppMenuDismissReason as aq, MindooDBAppMenuDismissedResult as ar, MindooDBAppMenuItem as as, MindooDBAppMenuKind as at, MindooDBAppMenuPlacement as au, MindooDBAppMenuPointAnchor as av, MindooDBAppMenuRect as aw, MindooDBAppMenuRectAnchor as ax, MindooDBAppMenuSelectionResult as ay, MindooDBAppMenuSeparatorItem as az, MindooDBAppDatabase as b, MindooDBAppViewCursorResult as b0, MindooDBAppViewEntry as b1, MindooDBAppViewEntryKind as b2, MindooDBAppViewNavigator as b3, MindooDBAppViewNavigatorExpansionState as b4, MindooDBAppViewNavigatorOpenOptions as b5, MindooDBAppViewNavigatorPageOptions as b6, MindooDBAppViewNavigatorPageResult as b7, MindooDBAppViewNavigatorRangeQuery as b8, MindooDBAppViewNavigatorSelectionState as b9, MindooDBAppViewport as ba, MindooDBAppWritableAttachmentStream as bb, MindooDBAppDocument as c, MindooDBAppRichTextSpan as d, MindooDBAppRichTextSnapshot as e, MindooDBAppAttachmentApi as f, MindooDBAppAttachmentChunk as g, MindooDBAppAttachmentInfo as h, MindooDBAppAttachmentPreviewOptions as i, MindooDBAppAttachmentPreviewSession as j, MindooDBAppAutomergeChangesPatch as k, MindooDBAppAutomergeChangesSince as l, MindooDBAppAutomergeGetOptions as m, MindooDBAppAutomergePatchResult as n, MindooDBAppAutomergeSnapshot as o, MindooDBAppBridgeConnectMessage as p, MindooDBAppBridgeConnectOptions as q, MindooDBAppBridgeConnectedMessage as r, MindooDBAppBridgeErrorPayload as s, MindooDBAppBridgeHandshakeErrorMessage as t, MindooDBAppBridgePortMessage as u, MindooDBAppBridgeRpcError as v, MindooDBAppBridgeRpcMessage as w, MindooDBAppBridgeRpcRequest as x, MindooDBAppBridgeRpcSuccess as y, MindooDBAppBridgeStreamAbortRequest as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindoodb-app-sdk",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "engines": {
5
5
  "node": ">=22.13.0"
6
6
  },
@@ -39,6 +39,7 @@
39
39
  "mindoodb-view-language": "0.0.13"
40
40
  },
41
41
  "devDependencies": {
42
+ "@automerge/automerge": "^3.2.1",
42
43
  "@types/node": "25.5.0",
43
44
  "tsup": "^8.5.1",
44
45
  "typescript": "^6.0.2",