mindoodb-app-sdk 0.0.40 → 0.0.41
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 +7 -2
- package/TESTING.md +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/testing/index.d.ts +2 -1
- package/dist/testing/index.js +27 -12
- package/dist/{types-DlZpHkfb.d.ts → types-B0zYIrv3.d.ts} +13 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -412,6 +412,8 @@ await db.documents.undelete(docId);
|
|
|
412
412
|
|
|
413
413
|
Every `MindooDBAppDocument` snapshot also exposes a `heads?: string[]` field. Those heads identify the document's current Automerge version and are the value you pass to `baseHeads` when issuing the next text patch. After Haven applies and merges your patch, the returned document carries the new `heads` you should use for the following edit cycle.
|
|
414
414
|
|
|
415
|
+
A snapshot also carries `decryptionKeyId?: string` — the named shared key its payload is encrypted with (`"default"` unless the document was created with another key). That is the key someone else needs access to before they can open the document, so show it wherever an app offers sharing. It is absent for person-encrypted documents (created with `recipients`), which have no shareable named key: those are shared by editing the recipient list. It is also absent on Haven versions older than this field.
|
|
416
|
+
|
|
415
417
|
`documents.list()` is backed by Haven's internal changefeed, not by a positional offset. The query object supports:
|
|
416
418
|
|
|
417
419
|
| Field | Meaning |
|
|
@@ -455,7 +457,8 @@ const history = await db.documents.listHistory(docId);
|
|
|
455
457
|
// isDeleted,
|
|
456
458
|
// isCurrent,
|
|
457
459
|
// summary?,
|
|
458
|
-
// dependencyIds
|
|
460
|
+
// dependencyIds?,
|
|
461
|
+
// decryptionKeyId?
|
|
459
462
|
// }
|
|
460
463
|
|
|
461
464
|
// Load the document state at an exact DAG revision
|
|
@@ -504,6 +507,8 @@ const merged = await db.documents.getAtHeads(docId, entry.dependencyIds ?? []);
|
|
|
504
507
|
|
|
505
508
|
An id in `dependencyIds` may name a revision the timeline does not list, because a change that left the document state untouched produces no timeline row. Draw only the edges whose endpoints you have; `getAtHeads` still resolves the full list.
|
|
506
509
|
|
|
510
|
+
`decryptionKeyId` is per revision, so a document whose key changed over its life shows that in the timeline — useful when deciding which key to grant before handing an old version to someone. It follows the same rule as on `documents.get`: absent for person-encrypted revisions.
|
|
511
|
+
|
|
507
512
|
### Granular JSON edits
|
|
508
513
|
|
|
509
514
|
When you need to edit nested objects or lists inside a document — not just top-level fields — describe the change as a **granular JSON patch** rather than rewriting the whole document. This is the model behind structured collaborative editing in apps like [`mindoodb-app-teamgrid`](https://github.com/klehmann/mindoodb-app-teamgrid), where two users can insert different rows into the same worksheet on different devices and the merge keeps both sides cleanly.
|
|
@@ -1549,7 +1554,7 @@ Connect options: `launchId?`, `targetOrigin?`, `connectTimeoutMs?`.
|
|
|
1549
1554
|
|
|
1550
1555
|
`list(query?)` accepts the changefeed query options documented above. The `cursor` value is an opaque checkpoint string managed by Haven and should be stored and passed back unchanged.
|
|
1551
1556
|
|
|
1552
|
-
`listInaccessible(query?)` returns documents that exist locally but the current user cannot decrypt (not a recipient, or missing the document key). Those ids never appear in `list` / `get`. Each row is unsigned store metadata only (`id`, `createdAt`, `decryptionKeyId`, optional `authorLabel`) — the app does not get CAS access. Use it to distinguish an empty database from one sealed to someone else.
|
|
1557
|
+
`listInaccessible(query?)` returns documents that exist locally but the current user cannot decrypt (not a recipient, or missing the document key). Those ids never appear in `list` / `get`. Each row is unsigned store metadata only (`id`, `createdAt`, `decryptionKeyId`, optional `authorLabel`) — the app does not get CAS access. Use it to distinguish an empty database from one sealed to someone else. For documents the user *can* open, the same key id is on `documents.get` and on each `listHistory` entry; `documents.list` rows do not carry it.
|
|
1553
1558
|
|
|
1554
1559
|
For `create(input)`, use `MindooDBAppCreateDocumentInput` with shape `{ set: Record<string, unknown>; decryptionKeyId?: string; recipients?: string[]; recipientOptions?: { includeSelf?: boolean }; id?: string }`. Omit both `decryptionKeyId` and `recipients` to use the database default shared key (`getDefaultCreateKeyId()` / `listCreateKeys()`). Pass `recipients` to encrypt the document for specific directory users (the launching user is included unless `recipientOptions.includeSelf` is `false`). Use `includeSelf: false` to write initial `set` values and hand the document to someone else — empty `recipients` with `includeSelf: false` is rejected. Changing that list later is `addRecipients` / `removeRecipients` / `setRecipients` — do not write `_encryptFor` via `update`. The optional `id` lets the app pick the document id instead of letting MindooDB generate an ObjectId; when provided it must match `/^[a-z][a-z0-9_]*$/` (lowercase only, since ids become on-disk filenames) and existing live documents with that id are returned as-is (idempotent create-if-missing). If an existing custom-id document is deleted, `create({ id })` undeletes it and preserves the previous document body. Documents created with the same custom id on different replicas converge correctly when synced.
|
|
1555
1560
|
|
package/TESTING.md
CHANGED
|
@@ -102,7 +102,7 @@ When you pass `databases`, the mock session also exposes them through `session.g
|
|
|
102
102
|
Each database entry can provide:
|
|
103
103
|
|
|
104
104
|
- `info`
|
|
105
|
-
- `documents` — seed documents into the mock store (used by `list`/`query` and by evaluating VirtualViews)
|
|
105
|
+
- `documents` — seed documents into the mock store (used by `list`/`query` and by evaluating VirtualViews). A seed's `decryptionKeyId` is reported back by `documents.get`, like a real host; documents created through the mock report `"default"` unless `create` named a key, and person-encrypted documents (`recipients`) report none.
|
|
106
106
|
- `methods.documents`
|
|
107
107
|
- `methods.views` for session-level `createView()` and `openView()` calls (overrides the default evaluating navigator)
|
|
108
108
|
- `methods.attachments`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge, b as MindooDBAppDatabase, c as MindooDBAppDocument, d as MindooDBAppRichTextSpan, e as MindooDBAppRichTextSnapshot } from './types-
|
|
2
|
-
export { f as MINDOODB_APP_SEAL_SIGNING_DOMAIN, g as MindooDBAppAccessDecision, h as MindooDBAppAccessTier, i as MindooDBAppAttachmentApi, j as MindooDBAppAttachmentChunk, k as MindooDBAppAttachmentInfo, l as MindooDBAppAttachmentPreviewOptions, m as MindooDBAppAttachmentPreviewSession, n as MindooDBAppAutomergeChangesPatch, o as MindooDBAppAutomergeChangesSince, p as MindooDBAppAutomergeGetOptions, q as MindooDBAppAutomergePatchResult, r as MindooDBAppAutomergeSnapshot, s as MindooDBAppBridgeConnectMessage, t as MindooDBAppBridgeConnectOptions, u as MindooDBAppBridgeConnectedMessage, v as MindooDBAppBridgeErrorPayload, w as MindooDBAppBridgeHandshakeErrorMessage, x as MindooDBAppBridgeLocaleChangedMessage, y as MindooDBAppBridgePortMessage, z as MindooDBAppBridgeQueryResultMessage, A as MindooDBAppBridgeRpcError, B as MindooDBAppBridgeRpcMessage, C as MindooDBAppBridgeRpcRequest, D as MindooDBAppBridgeRpcSuccess, E as MindooDBAppBridgeStreamAbortRequest, F as MindooDBAppBridgeStreamAck, G as MindooDBAppBridgeStreamCloseRequest, H as MindooDBAppBridgeStreamError, I as MindooDBAppBridgeStreamMessage, J as MindooDBAppBridgeStreamOpenResult, K as MindooDBAppBridgeStreamReadRequest, L as MindooDBAppBridgeStreamWriteRequest, N as MindooDBAppBridgeThemeChangedMessage, O as MindooDBAppBridgeUiPreferencesChangedMessage, P as MindooDBAppBridgeViewChangedMessage, Q as MindooDBAppBridgeViewportChangedMessage, R as MindooDBAppCapability, S as MindooDBAppConfiguredViewCategorizationStyle, T as MindooDBAppConfiguredViewColumn, U as MindooDBAppConfiguredViewColumnRole, V as MindooDBAppConfiguredViewExpressionMode, W as MindooDBAppConfiguredViewFieldExpression, X as MindooDBAppConfiguredViewFilterDefinition, Y as MindooDBAppConfiguredViewFilterMode, Z as MindooDBAppConfiguredViewFilterRule, _ as MindooDBAppConfiguredViewFormulaExpression, $ as MindooDBAppConfiguredViewFormulaFilterDefinition, a0 as MindooDBAppConfiguredViewPreviewMode, a1 as MindooDBAppConfiguredViewRuleFilterDefinition, a2 as MindooDBAppConfiguredViewRuleMatchMode, a3 as MindooDBAppConfiguredViewRuleOperator, a4 as MindooDBAppConfiguredViewValueExpression, a5 as MindooDBAppCreateDocumentInput, a6 as MindooDBAppCreateKeyInfo, a7 as MindooDBAppCreateViewInput, a8 as MindooDBAppCreateViewNavigatorInput, a9 as MindooDBAppDatabaseInfo, aa as MindooDBAppDirectoryApi, ab as MindooDBAppDirectoryEntry, ac as MindooDBAppDocumentApi, ad as MindooDBAppDocumentHeadCursorResult, ae as MindooDBAppDocumentHistoryEntry, af as MindooDBAppDocumentListQuery, ag as MindooDBAppDocumentListResult, ah as MindooDBAppDocumentQuery, ai as MindooDBAppDocumentRevisionId, aj as MindooDBAppDocumentScanPreset, ak as MindooDBAppDocumentSummary, al as MindooDBAppEntryAttachmentRef, am as MindooDBAppEntryProvenance, an as MindooDBAppExtractDocumentTextInput, ao as MindooDBAppExtractDocumentTextResult, ap as MindooDBAppExtractTextFormat, aq as MindooDBAppExtractionSetup, ar as MindooDBAppFulltextSetup, as as MindooDBAppHistoricalDocument, at as MindooDBAppHistoryQuery, au as MindooDBAppHostTheme, av as MindooDBAppIdentityApi, aw as MindooDBAppInaccessibleDocument, ax as MindooDBAppInaccessibleDocumentListQuery, ay as MindooDBAppInaccessibleDocumentListResult, az as MindooDBAppJsonListDeletePatch, aA as MindooDBAppJsonListInsertPatch, aB as MindooDBAppJsonPatch, aC as MindooDBAppJsonSetPatch, aD as MindooDBAppJsonTextMarkPatch, aE as MindooDBAppJsonTextSplicePatch, aF as MindooDBAppJsonTextUnmarkPatch, aG as MindooDBAppJsonUnsetPatch, aH as MindooDBAppLaunchContext, aI as MindooDBAppLiveQuerySubscription, aJ as MindooDBAppMenuAnchor, aK as MindooDBAppMenuApi, aL as MindooDBAppMenuCommandItem, aM as MindooDBAppMenuDismissReason, aN as MindooDBAppMenuDismissedResult, aO as MindooDBAppMenuItem, aP as MindooDBAppMenuKind, aQ as MindooDBAppMenuPlacement, aR as MindooDBAppMenuPointAnchor, aS as MindooDBAppMenuRect, aT as MindooDBAppMenuRectAnchor, aU as MindooDBAppMenuSelectionResult, aV as MindooDBAppMenuSeparatorItem, aW as MindooDBAppQueryCoverage, aX as MindooDBAppQueryResult, aY as MindooDBAppQueryRow, aZ as MindooDBAppQuerySortKey, a_ as MindooDBAppQueryTextClause, a$ as MindooDBAppReadableAttachmentStream, b0 as MindooDBAppRecipientOptions, b1 as MindooDBAppResolvedViewDefinition, b2 as MindooDBAppResolvedViewSource, b3 as MindooDBAppRevisionPhase, b4 as MindooDBAppRevisionVerification, b5 as MindooDBAppRichTextBlockSpan, b6 as MindooDBAppRichTextGetOptions, b7 as MindooDBAppRichTextImmutableString, b8 as MindooDBAppRichTextMarkRange, b9 as MindooDBAppRichTextMaterializeValue, ba as MindooDBAppRichTextPatch, bb as MindooDBAppRichTextScalar, bc as MindooDBAppRichTextSpliceStep, bd as MindooDBAppRichTextStep, be as MindooDBAppRichTextStepPatch, bf as MindooDBAppRichTextTextSpan, bg as MindooDBAppRuntime, bh as MindooDBAppScanAttachmentOptions, bi as MindooDBAppScanAttachmentResult, bj as MindooDBAppScopedDocId, bk as MindooDBAppScopedDocumentSummary, bl as MindooDBAppSealIntent, bm as MindooDBAppSealedChannelOpenInput, bn as MindooDBAppSealedChannelOpenResult, bo as MindooDBAppSealedChannelRequestInput, bp as MindooDBAppSession, bq as MindooDBAppShowMenuInput, br as MindooDBAppShowMenuResult, bs as MindooDBAppSignPreview, bt as MindooDBAppSignPreviewScope, bu as MindooDBAppSignStatementInput, bv as MindooDBAppSignStatementResult, bw as MindooDBAppTextEdit, bx as MindooDBAppTextPatch, by as MindooDBAppThemeMode, bz as MindooDBAppTimestampApi, bA as MindooDBAppTimestampInput, bB as MindooDBAppTimestampProvider, bC as MindooDBAppTimestampResult, bD as MindooDBAppUiPreferences, bE as MindooDBAppUpdateDocumentInput, bF as MindooDBAppViewCursorDocumentListResult, bG as MindooDBAppViewCursorResult, bH as MindooDBAppViewEntry, bI as MindooDBAppViewEntryKind, bJ as MindooDBAppViewNavigator, bK as MindooDBAppViewNavigatorExpansionState, bL as MindooDBAppViewNavigatorOpenOptions, bM as MindooDBAppViewNavigatorPageOptions, bN as MindooDBAppViewNavigatorPageResult, bO as MindooDBAppViewNavigatorRangeQuery, bP as MindooDBAppViewNavigatorSelectionState, bQ as MindooDBAppViewUpdateStats, bR as MindooDBAppViewport, bS as MindooDBAppWritableAttachmentStream } from './types-
|
|
1
|
+
import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge, b as MindooDBAppDatabase, c as MindooDBAppDocument, d as MindooDBAppRichTextSpan, e as MindooDBAppRichTextSnapshot } from './types-B0zYIrv3.js';
|
|
2
|
+
export { f as MINDOODB_APP_SEAL_SIGNING_DOMAIN, g as MindooDBAppAccessDecision, h as MindooDBAppAccessTier, i as MindooDBAppAttachmentApi, j as MindooDBAppAttachmentChunk, k as MindooDBAppAttachmentInfo, l as MindooDBAppAttachmentPreviewOptions, m as MindooDBAppAttachmentPreviewSession, n as MindooDBAppAutomergeChangesPatch, o as MindooDBAppAutomergeChangesSince, p as MindooDBAppAutomergeGetOptions, q as MindooDBAppAutomergePatchResult, r as MindooDBAppAutomergeSnapshot, s as MindooDBAppBridgeConnectMessage, t as MindooDBAppBridgeConnectOptions, u as MindooDBAppBridgeConnectedMessage, v as MindooDBAppBridgeErrorPayload, w as MindooDBAppBridgeHandshakeErrorMessage, x as MindooDBAppBridgeLocaleChangedMessage, y as MindooDBAppBridgePortMessage, z as MindooDBAppBridgeQueryResultMessage, A as MindooDBAppBridgeRpcError, B as MindooDBAppBridgeRpcMessage, C as MindooDBAppBridgeRpcRequest, D as MindooDBAppBridgeRpcSuccess, E as MindooDBAppBridgeStreamAbortRequest, F as MindooDBAppBridgeStreamAck, G as MindooDBAppBridgeStreamCloseRequest, H as MindooDBAppBridgeStreamError, I as MindooDBAppBridgeStreamMessage, J as MindooDBAppBridgeStreamOpenResult, K as MindooDBAppBridgeStreamReadRequest, L as MindooDBAppBridgeStreamWriteRequest, N as MindooDBAppBridgeThemeChangedMessage, O as MindooDBAppBridgeUiPreferencesChangedMessage, P as MindooDBAppBridgeViewChangedMessage, Q as MindooDBAppBridgeViewportChangedMessage, R as MindooDBAppCapability, S as MindooDBAppConfiguredViewCategorizationStyle, T as MindooDBAppConfiguredViewColumn, U as MindooDBAppConfiguredViewColumnRole, V as MindooDBAppConfiguredViewExpressionMode, W as MindooDBAppConfiguredViewFieldExpression, X as MindooDBAppConfiguredViewFilterDefinition, Y as MindooDBAppConfiguredViewFilterMode, Z as MindooDBAppConfiguredViewFilterRule, _ as MindooDBAppConfiguredViewFormulaExpression, $ as MindooDBAppConfiguredViewFormulaFilterDefinition, a0 as MindooDBAppConfiguredViewPreviewMode, a1 as MindooDBAppConfiguredViewRuleFilterDefinition, a2 as MindooDBAppConfiguredViewRuleMatchMode, a3 as MindooDBAppConfiguredViewRuleOperator, a4 as MindooDBAppConfiguredViewValueExpression, a5 as MindooDBAppCreateDocumentInput, a6 as MindooDBAppCreateKeyInfo, a7 as MindooDBAppCreateViewInput, a8 as MindooDBAppCreateViewNavigatorInput, a9 as MindooDBAppDatabaseInfo, aa as MindooDBAppDirectoryApi, ab as MindooDBAppDirectoryEntry, ac as MindooDBAppDocumentApi, ad as MindooDBAppDocumentHeadCursorResult, ae as MindooDBAppDocumentHistoryEntry, af as MindooDBAppDocumentListQuery, ag as MindooDBAppDocumentListResult, ah as MindooDBAppDocumentQuery, ai as MindooDBAppDocumentRevisionId, aj as MindooDBAppDocumentScanPreset, ak as MindooDBAppDocumentSummary, al as MindooDBAppEntryAttachmentRef, am as MindooDBAppEntryProvenance, an as MindooDBAppExtractDocumentTextInput, ao as MindooDBAppExtractDocumentTextResult, ap as MindooDBAppExtractTextFormat, aq as MindooDBAppExtractionSetup, ar as MindooDBAppFulltextSetup, as as MindooDBAppHistoricalDocument, at as MindooDBAppHistoryQuery, au as MindooDBAppHostTheme, av as MindooDBAppIdentityApi, aw as MindooDBAppInaccessibleDocument, ax as MindooDBAppInaccessibleDocumentListQuery, ay as MindooDBAppInaccessibleDocumentListResult, az as MindooDBAppJsonListDeletePatch, aA as MindooDBAppJsonListInsertPatch, aB as MindooDBAppJsonPatch, aC as MindooDBAppJsonSetPatch, aD as MindooDBAppJsonTextMarkPatch, aE as MindooDBAppJsonTextSplicePatch, aF as MindooDBAppJsonTextUnmarkPatch, aG as MindooDBAppJsonUnsetPatch, aH as MindooDBAppLaunchContext, aI as MindooDBAppLiveQuerySubscription, aJ as MindooDBAppMenuAnchor, aK as MindooDBAppMenuApi, aL as MindooDBAppMenuCommandItem, aM as MindooDBAppMenuDismissReason, aN as MindooDBAppMenuDismissedResult, aO as MindooDBAppMenuItem, aP as MindooDBAppMenuKind, aQ as MindooDBAppMenuPlacement, aR as MindooDBAppMenuPointAnchor, aS as MindooDBAppMenuRect, aT as MindooDBAppMenuRectAnchor, aU as MindooDBAppMenuSelectionResult, aV as MindooDBAppMenuSeparatorItem, aW as MindooDBAppQueryCoverage, aX as MindooDBAppQueryResult, aY as MindooDBAppQueryRow, aZ as MindooDBAppQuerySortKey, a_ as MindooDBAppQueryTextClause, a$ as MindooDBAppReadableAttachmentStream, b0 as MindooDBAppRecipientOptions, b1 as MindooDBAppResolvedViewDefinition, b2 as MindooDBAppResolvedViewSource, b3 as MindooDBAppRevisionPhase, b4 as MindooDBAppRevisionVerification, b5 as MindooDBAppRichTextBlockSpan, b6 as MindooDBAppRichTextGetOptions, b7 as MindooDBAppRichTextImmutableString, b8 as MindooDBAppRichTextMarkRange, b9 as MindooDBAppRichTextMaterializeValue, ba as MindooDBAppRichTextPatch, bb as MindooDBAppRichTextScalar, bc as MindooDBAppRichTextSpliceStep, bd as MindooDBAppRichTextStep, be as MindooDBAppRichTextStepPatch, bf as MindooDBAppRichTextTextSpan, bg as MindooDBAppRuntime, bh as MindooDBAppScanAttachmentOptions, bi as MindooDBAppScanAttachmentResult, bj as MindooDBAppScopedDocId, bk as MindooDBAppScopedDocumentSummary, bl as MindooDBAppSealIntent, bm as MindooDBAppSealedChannelOpenInput, bn as MindooDBAppSealedChannelOpenResult, bo as MindooDBAppSealedChannelRequestInput, bp as MindooDBAppSession, bq as MindooDBAppShowMenuInput, br as MindooDBAppShowMenuResult, bs as MindooDBAppSignPreview, bt as MindooDBAppSignPreviewScope, bu as MindooDBAppSignStatementInput, bv as MindooDBAppSignStatementResult, bw as MindooDBAppTextEdit, bx as MindooDBAppTextPatch, by as MindooDBAppThemeMode, bz as MindooDBAppTimestampApi, bA as MindooDBAppTimestampInput, bB as MindooDBAppTimestampProvider, bC as MindooDBAppTimestampResult, bD as MindooDBAppUiPreferences, bE as MindooDBAppUpdateDocumentInput, bF as MindooDBAppViewCursorDocumentListResult, bG as MindooDBAppViewCursorResult, bH as MindooDBAppViewEntry, bI as MindooDBAppViewEntryKind, bJ as MindooDBAppViewNavigator, bK as MindooDBAppViewNavigatorExpansionState, bL as MindooDBAppViewNavigatorOpenOptions, bM as MindooDBAppViewNavigatorPageOptions, bN as MindooDBAppViewNavigatorPageResult, bO as MindooDBAppViewNavigatorRangeQuery, bP as MindooDBAppViewNavigatorSelectionState, bQ as MindooDBAppViewUpdateStats, bR as MindooDBAppViewport, bS as MindooDBAppWritableAttachmentStream } from './types-B0zYIrv3.js';
|
|
3
3
|
import { MindooDBAppBooleanExpression } from 'mindoodb-view-language';
|
|
4
4
|
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';
|
|
5
5
|
import { MindooDB, MindooQuerySortKey, MindooQueryOptions, MindooQueryResult } from 'mindoodb';
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a8 as MindooDBAppCreateViewNavigatorInput, bJ as MindooDBAppViewNavigator, aH as MindooDBAppLaunchContext, a9 as MindooDBAppDatabaseInfo, ac as MindooDBAppDocumentApi, bL as MindooDBAppViewNavigatorOpenOptions, i as MindooDBAppAttachmentApi, av as MindooDBAppIdentityApi, bz as MindooDBAppTimestampApi, aa as MindooDBAppDirectoryApi, c as MindooDBAppDocument, ar as MindooDBAppFulltextSetup, aq as MindooDBAppExtractionSetup, a as MindooDBAppBridge, bp as MindooDBAppSession, C as MindooDBAppBridgeRpcRequest, au as MindooDBAppHostTheme, bR as MindooDBAppViewport, bD as MindooDBAppUiPreferences, aX as MindooDBAppQueryResult, bQ as MindooDBAppViewUpdateStats, y as MindooDBAppBridgePortMessage } from '../types-
|
|
1
|
+
import { a8 as MindooDBAppCreateViewNavigatorInput, bJ as MindooDBAppViewNavigator, aH as MindooDBAppLaunchContext, a9 as MindooDBAppDatabaseInfo, ac as MindooDBAppDocumentApi, bL as MindooDBAppViewNavigatorOpenOptions, i as MindooDBAppAttachmentApi, av as MindooDBAppIdentityApi, bz as MindooDBAppTimestampApi, aa as MindooDBAppDirectoryApi, c as MindooDBAppDocument, ar as MindooDBAppFulltextSetup, aq as MindooDBAppExtractionSetup, a as MindooDBAppBridge, bp as MindooDBAppSession, C as MindooDBAppBridgeRpcRequest, au as MindooDBAppHostTheme, bR as MindooDBAppViewport, bD as MindooDBAppUiPreferences, aX as MindooDBAppQueryResult, bQ as MindooDBAppViewUpdateStats, y as MindooDBAppBridgePortMessage } from '../types-B0zYIrv3.js';
|
|
2
2
|
import * as mindoodb from 'mindoodb';
|
|
3
3
|
import 'mindoodb-view-language';
|
|
4
4
|
|
|
@@ -42,6 +42,7 @@ interface MockSeedDocument {
|
|
|
42
42
|
isDeleted?: boolean;
|
|
43
43
|
/** When true the doc is hidden from `list`/`get` and returned by `listInaccessible`. */
|
|
44
44
|
inaccessible?: boolean;
|
|
45
|
+
/** Key the doc is encrypted with — reported by `get` and by `listInaccessible`. */
|
|
45
46
|
decryptionKeyId?: string;
|
|
46
47
|
authorLabel?: string;
|
|
47
48
|
heads?: string[];
|
package/dist/testing/index.js
CHANGED
|
@@ -823,6 +823,12 @@ function createDefaultWritableAttachmentStream() {
|
|
|
823
823
|
}
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
|
+
function mockDecryptionKeyId(document) {
|
|
827
|
+
if (!document.decryptionKeyId || document.data._encryptFor) {
|
|
828
|
+
return {};
|
|
829
|
+
}
|
|
830
|
+
return { decryptionKeyId: document.decryptionKeyId };
|
|
831
|
+
}
|
|
826
832
|
function loadMockAutomergeDocument(document) {
|
|
827
833
|
if (document.automergeBinary) {
|
|
828
834
|
return Automerge.load(document.automergeBinary);
|
|
@@ -1282,7 +1288,8 @@ function createDatabaseHandle(definition) {
|
|
|
1282
1288
|
data: structuredClone(updated.data),
|
|
1283
1289
|
attachments: updated.attachments ? structuredClone(updated.attachments) : [],
|
|
1284
1290
|
isDeleted: false,
|
|
1285
|
-
automergeBinary: void 0
|
|
1291
|
+
automergeBinary: void 0,
|
|
1292
|
+
decryptionKeyId: existing.decryptionKeyId
|
|
1286
1293
|
});
|
|
1287
1294
|
notifyLiveQueries();
|
|
1288
1295
|
return updated;
|
|
@@ -1386,7 +1393,8 @@ function createDatabaseHandle(definition) {
|
|
|
1386
1393
|
data: structuredClone(document.data),
|
|
1387
1394
|
heads: document.heads ? [...document.heads] : void 0,
|
|
1388
1395
|
attachments: document.attachments ? structuredClone(document.attachments) : [],
|
|
1389
|
-
updatedAt: document.updatedAt
|
|
1396
|
+
updatedAt: document.updatedAt,
|
|
1397
|
+
...mockDecryptionKeyId(document)
|
|
1390
1398
|
};
|
|
1391
1399
|
},
|
|
1392
1400
|
async getRichText(docId, path, _options) {
|
|
@@ -1441,7 +1449,8 @@ function createDatabaseHandle(definition) {
|
|
|
1441
1449
|
data: structuredClone(document.data),
|
|
1442
1450
|
heads: mergedHeads,
|
|
1443
1451
|
attachments: document.attachments ? structuredClone(document.attachments) : [],
|
|
1444
|
-
updatedAt: document.updatedAt
|
|
1452
|
+
updatedAt: document.updatedAt,
|
|
1453
|
+
...mockDecryptionKeyId(document)
|
|
1445
1454
|
},
|
|
1446
1455
|
heads: mergedHeads,
|
|
1447
1456
|
changesSince
|
|
@@ -1469,7 +1478,8 @@ function createDatabaseHandle(definition) {
|
|
|
1469
1478
|
data: structuredClone(existing.data),
|
|
1470
1479
|
heads: existing.heads ? [...existing.heads] : void 0,
|
|
1471
1480
|
attachments: existing.attachments ? structuredClone(existing.attachments) : [],
|
|
1472
|
-
updatedAt: existing.updatedAt
|
|
1481
|
+
updatedAt: existing.updatedAt,
|
|
1482
|
+
...mockDecryptionKeyId(existing)
|
|
1473
1483
|
};
|
|
1474
1484
|
}
|
|
1475
1485
|
}
|
|
@@ -1499,15 +1509,18 @@ function createDatabaseHandle(definition) {
|
|
|
1499
1509
|
attachments: [],
|
|
1500
1510
|
updatedAt: createdAt
|
|
1501
1511
|
};
|
|
1502
|
-
|
|
1512
|
+
const stored = {
|
|
1503
1513
|
...created,
|
|
1504
1514
|
data: structuredClone(created.data),
|
|
1505
1515
|
attachments: [],
|
|
1506
|
-
isDeleted: false
|
|
1507
|
-
|
|
1516
|
+
isDeleted: false,
|
|
1517
|
+
decryptionKeyId: input.decryptionKeyId ?? "default"
|
|
1518
|
+
};
|
|
1519
|
+
storedDocuments.set(created.id, stored);
|
|
1508
1520
|
notifyLiveQueries();
|
|
1509
1521
|
return {
|
|
1510
|
-
...created
|
|
1522
|
+
...created,
|
|
1523
|
+
...mockDecryptionKeyId(stored)
|
|
1511
1524
|
};
|
|
1512
1525
|
},
|
|
1513
1526
|
async createMany(inputs) {
|
|
@@ -1528,15 +1541,17 @@ function createDatabaseHandle(definition) {
|
|
|
1528
1541
|
attachments: existing?.attachments ? structuredClone(existing.attachments) : [],
|
|
1529
1542
|
updatedAt
|
|
1530
1543
|
};
|
|
1531
|
-
|
|
1544
|
+
const stored = {
|
|
1532
1545
|
...updated,
|
|
1533
1546
|
data: structuredClone(updated.data),
|
|
1534
1547
|
attachments: updated.attachments ? structuredClone(updated.attachments) : [],
|
|
1535
1548
|
isDeleted: false,
|
|
1536
|
-
automergeBinary: void 0
|
|
1537
|
-
|
|
1549
|
+
automergeBinary: void 0,
|
|
1550
|
+
decryptionKeyId: existing?.decryptionKeyId ?? "default"
|
|
1551
|
+
};
|
|
1552
|
+
storedDocuments.set(docId, stored);
|
|
1538
1553
|
notifyLiveQueries();
|
|
1539
|
-
return updated;
|
|
1554
|
+
return { ...updated, ...mockDecryptionKeyId(stored) };
|
|
1540
1555
|
},
|
|
1541
1556
|
async addRecipients(docId, recipients) {
|
|
1542
1557
|
const existing = storedDocuments.get(docId);
|
|
@@ -194,6 +194,13 @@ interface MindooDBAppDocument {
|
|
|
194
194
|
attachments?: MindooDBAppAttachmentInfo[];
|
|
195
195
|
createdAt?: string;
|
|
196
196
|
updatedAt?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Named shared key the document's payload is encrypted with — the key another
|
|
199
|
+
* user needs access to before they can open it. Absent for person-encrypted
|
|
200
|
+
* documents (`recipients`), where there is no shareable named key, and on
|
|
201
|
+
* hosts predating this field.
|
|
202
|
+
*/
|
|
203
|
+
decryptionKeyId?: string;
|
|
197
204
|
}
|
|
198
205
|
/** Opaque persisted id for a document revision in the MindooDB DAG. */
|
|
199
206
|
type MindooDBAppDocumentRevisionId = string;
|
|
@@ -208,6 +215,12 @@ interface MindooDBAppDocumentHistoryEntry {
|
|
|
208
215
|
isDeleted: boolean;
|
|
209
216
|
isCurrent: boolean;
|
|
210
217
|
summary?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Named shared key this revision was written with, so a key change along the
|
|
220
|
+
* timeline stays visible. Absent for person-encrypted revisions and on hosts
|
|
221
|
+
* predating this field. See {@link MindooDBAppDocument.decryptionKeyId}.
|
|
222
|
+
*/
|
|
223
|
+
decryptionKeyId?: string;
|
|
211
224
|
/**
|
|
212
225
|
* The revisions this one was written on top of — the edges of the signed
|
|
213
226
|
* change graph, in the same id space as {@link revisionId}. More than one id
|