mindoodb-app-sdk 0.0.32 → 0.0.34
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 +25 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +41 -2
- package/dist/testing/index.d.ts +4 -1
- package/dist/testing/index.js +112 -1
- package/dist/{types-B-NelfTY.d.ts → types-Bl6CrBn1.d.ts} +316 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -418,7 +418,8 @@ const history = await db.documents.listHistory(docId);
|
|
|
418
418
|
// identityLabel?,
|
|
419
419
|
// isDeleted,
|
|
420
420
|
// isCurrent,
|
|
421
|
-
// summary
|
|
421
|
+
// summary?,
|
|
422
|
+
// dependencyIds?
|
|
422
423
|
// }
|
|
423
424
|
|
|
424
425
|
// Load the document state at an exact DAG revision
|
|
@@ -446,6 +447,27 @@ const pointInTime = await db.documents.getAtTimestamp(
|
|
|
446
447
|
|
|
447
448
|
Historical snapshots include the document data payload as it existed at that revision. When the snapshot has attachments, `attachments` reflects the historical `_attachments` array for that same revision, including the attachment reference that Haven needs to stop at the correct historical `lastChunkId`.
|
|
448
449
|
|
|
450
|
+
#### What one revision changed
|
|
451
|
+
|
|
452
|
+
To show a diff, you need both sides of a revision. Pass `{ phase: "before" }` to read the state the revision was written against instead of the state it produced:
|
|
453
|
+
|
|
454
|
+
```ts
|
|
455
|
+
const after = await db.documents.getAtRevision(docId, revisionId);
|
|
456
|
+
const before = await db.documents.getAtRevision(docId, revisionId, {
|
|
457
|
+
phase: "before",
|
|
458
|
+
});
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
`before` is always a single document, even when the revision merged concurrent branches: it is the merge of all its parents, which is exactly what its author had loaded. For the document's creation there is no prior state, so `before` reports `state: "missing"`.
|
|
462
|
+
|
|
463
|
+
The `dependencyIds` on each history entry are that revision's parents — the edges of the signed change graph. Since a timeline is only one linearization of that graph, use them to draw or walk the graph itself, and `getAtHeads` to materialize any point in it:
|
|
464
|
+
|
|
465
|
+
```ts
|
|
466
|
+
const merged = await db.documents.getAtHeads(docId, entry.dependencyIds ?? []);
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
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.
|
|
470
|
+
|
|
449
471
|
### Granular JSON edits
|
|
450
472
|
|
|
451
473
|
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.
|
|
@@ -1451,7 +1473,8 @@ Connect options: `launchId?`, `targetOrigin?`, `connectTimeoutMs?`.
|
|
|
1451
1473
|
| `undelete(docId)` | `Promise<{ ok: true }>` |
|
|
1452
1474
|
| `listHistory(docId)` | `Promise<MindooDBAppDocumentHistoryEntry[]>` |
|
|
1453
1475
|
| `getAtTimestamp(docId, timestamp)` | `Promise<MindooDBAppHistoricalDocument>` |
|
|
1454
|
-
| `getAtRevision(docId, revisionId)` | `Promise<MindooDBAppHistoricalDocument>`
|
|
1476
|
+
| `getAtRevision(docId, revisionId, opts?)` | `Promise<MindooDBAppHistoricalDocument>` |
|
|
1477
|
+
| `getAtHeads(docId, headIds)` | `Promise<MindooDBAppHistoricalDocument>` |
|
|
1455
1478
|
|
|
1456
1479
|
`getAutomergeSnapshot` and `applyAutomergeChanges` are **discouraged** escape-hatch APIs for binary Automerge sync. Prefer `set`/`unset` and JSON patches (`text`, `richText`, `json`) instead. See [Automerge binary sync (advanced)](#automerge-binary-sync-advanced).
|
|
1457
1480
|
|
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
|
|
1
|
+
import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppBridge, b as MindooDBAppDatabase, c as MindooDBAppDocument, d as MindooDBAppRichTextSpan, e as MindooDBAppRichTextSnapshot } from './types-Bl6CrBn1.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 MindooDBAppCreateViewInput, a7 as MindooDBAppCreateViewNavigatorInput, a8 as MindooDBAppDatabaseInfo, a9 as MindooDBAppDirectoryApi, aa as MindooDBAppDirectoryEntry, ab as MindooDBAppDocumentApi, ac as MindooDBAppDocumentHeadCursorResult, ad as MindooDBAppDocumentHistoryEntry, ae as MindooDBAppDocumentListQuery, af as MindooDBAppDocumentListResult, ag as MindooDBAppDocumentQuery, ah as MindooDBAppDocumentRevisionId, ai as MindooDBAppDocumentScanPreset, aj as MindooDBAppDocumentSummary, ak as MindooDBAppEntryAttachmentRef, al as MindooDBAppEntryProvenance, am as MindooDBAppExtractionSetup, an as MindooDBAppFulltextSetup, ao as MindooDBAppHistoricalDocument, ap as MindooDBAppHistoryQuery, aq as MindooDBAppHostTheme, ar as MindooDBAppIdentityApi, as as MindooDBAppJsonListDeletePatch, at as MindooDBAppJsonListInsertPatch, au as MindooDBAppJsonPatch, av as MindooDBAppJsonSetPatch, aw as MindooDBAppJsonTextMarkPatch, ax as MindooDBAppJsonTextSplicePatch, ay as MindooDBAppJsonTextUnmarkPatch, az as MindooDBAppJsonUnsetPatch, aA as MindooDBAppLaunchContext, aB as MindooDBAppLiveQuerySubscription, aC as MindooDBAppMenuAnchor, aD as MindooDBAppMenuApi, aE as MindooDBAppMenuCommandItem, aF as MindooDBAppMenuDismissReason, aG as MindooDBAppMenuDismissedResult, aH as MindooDBAppMenuItem, aI as MindooDBAppMenuKind, aJ as MindooDBAppMenuPlacement, aK as MindooDBAppMenuPointAnchor, aL as MindooDBAppMenuRect, aM as MindooDBAppMenuRectAnchor, aN as MindooDBAppMenuSelectionResult, aO as MindooDBAppMenuSeparatorItem, aP as MindooDBAppQueryCoverage, aQ as MindooDBAppQueryResult, aR as MindooDBAppQueryRow, aS as MindooDBAppQuerySortKey, aT as MindooDBAppQueryTextClause, aU as MindooDBAppReadableAttachmentStream, aV as MindooDBAppResolvedViewDefinition, aW as MindooDBAppResolvedViewSource, aX as MindooDBAppRevisionPhase, aY as MindooDBAppRevisionVerification, aZ as MindooDBAppRichTextBlockSpan, a_ as MindooDBAppRichTextGetOptions, a$ as MindooDBAppRichTextImmutableString, b0 as MindooDBAppRichTextMarkRange, b1 as MindooDBAppRichTextMaterializeValue, b2 as MindooDBAppRichTextPatch, b3 as MindooDBAppRichTextScalar, b4 as MindooDBAppRichTextSpliceStep, b5 as MindooDBAppRichTextStep, b6 as MindooDBAppRichTextStepPatch, b7 as MindooDBAppRichTextTextSpan, b8 as MindooDBAppRuntime, b9 as MindooDBAppScanAttachmentOptions, ba as MindooDBAppScanAttachmentResult, bb as MindooDBAppScopedDocId, bc as MindooDBAppScopedDocumentSummary, bd as MindooDBAppSealIntent, be as MindooDBAppSession, bf as MindooDBAppShowMenuInput, bg as MindooDBAppShowMenuResult, bh as MindooDBAppSignPreview, bi as MindooDBAppSignPreviewScope, bj as MindooDBAppSignStatementInput, bk as MindooDBAppSignStatementResult, bl as MindooDBAppTextEdit, bm as MindooDBAppTextPatch, bn as MindooDBAppThemeMode, bo as MindooDBAppTimestampApi, bp as MindooDBAppTimestampInput, bq as MindooDBAppTimestampProvider, br as MindooDBAppTimestampResult, bs as MindooDBAppUiPreferences, bt as MindooDBAppUpdateDocumentInput, bu as MindooDBAppViewCursorDocumentListResult, bv as MindooDBAppViewCursorResult, bw as MindooDBAppViewEntry, bx as MindooDBAppViewEntryKind, by as MindooDBAppViewNavigator, bz as MindooDBAppViewNavigatorExpansionState, bA as MindooDBAppViewNavigatorOpenOptions, bB as MindooDBAppViewNavigatorPageOptions, bC as MindooDBAppViewNavigatorPageResult, bD as MindooDBAppViewNavigatorRangeQuery, bE as MindooDBAppViewNavigatorSelectionState, bF as MindooDBAppViewUpdateStats, bG as MindooDBAppViewport, bH as MindooDBAppWritableAttachmentStream } from './types-Bl6CrBn1.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/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/types.ts
|
|
2
|
+
var MINDOODB_APP_SEAL_SIGNING_DOMAIN = "mindoodb-seal/v1";
|
|
3
|
+
|
|
1
4
|
// src/attachmentPreview.ts
|
|
2
5
|
function canPreviewAttachment(fileName, mimeType) {
|
|
3
6
|
const normalizedMimeType = mimeType.toLowerCase();
|
|
@@ -907,10 +910,42 @@ var MindooDBAppDatabaseImpl = class {
|
|
|
907
910
|
docId,
|
|
908
911
|
timestamp
|
|
909
912
|
}),
|
|
910
|
-
getAtRevision: async (docId, revisionId) => await this.rpc.call("documents.history.getAtRevision", {
|
|
913
|
+
getAtRevision: async (docId, revisionId, options) => await this.rpc.call("documents.history.getAtRevision", {
|
|
911
914
|
databaseId: this.databaseId,
|
|
912
915
|
docId,
|
|
913
|
-
revisionId
|
|
916
|
+
revisionId,
|
|
917
|
+
phase: options?.phase
|
|
918
|
+
}),
|
|
919
|
+
getAtHeads: async (docId, headIds) => await this.rpc.call("documents.history.getAtHeads", {
|
|
920
|
+
databaseId: this.databaseId,
|
|
921
|
+
docId,
|
|
922
|
+
headIds
|
|
923
|
+
}),
|
|
924
|
+
listVerification: async (docId, revisionIds) => await this.rpc.call("documents.history.listVerification", {
|
|
925
|
+
databaseId: this.databaseId,
|
|
926
|
+
docId,
|
|
927
|
+
revisionIds
|
|
928
|
+
})
|
|
929
|
+
};
|
|
930
|
+
this.identity = {
|
|
931
|
+
signStatement: async (input) => await this.rpc.call("identity.signStatement", {
|
|
932
|
+
databaseId: this.databaseId,
|
|
933
|
+
...input
|
|
934
|
+
})
|
|
935
|
+
};
|
|
936
|
+
this.timestamps = {
|
|
937
|
+
rfc3161: async (input) => await this.rpc.call("timestamps.rfc3161", {
|
|
938
|
+
databaseId: this.databaseId,
|
|
939
|
+
...input
|
|
940
|
+
}),
|
|
941
|
+
listProviders: async () => await this.rpc.call("timestamps.listProviders", {
|
|
942
|
+
databaseId: this.databaseId
|
|
943
|
+
})
|
|
944
|
+
};
|
|
945
|
+
this.directory = {
|
|
946
|
+
excerpt: async (publicKeys) => await this.rpc.call("directory.excerpt", {
|
|
947
|
+
databaseId: this.databaseId,
|
|
948
|
+
publicKeys
|
|
914
949
|
})
|
|
915
950
|
};
|
|
916
951
|
this.attachments = {
|
|
@@ -1032,6 +1067,9 @@ var MindooDBAppDatabaseImpl = class {
|
|
|
1032
1067
|
databaseId;
|
|
1033
1068
|
documents;
|
|
1034
1069
|
attachments;
|
|
1070
|
+
identity;
|
|
1071
|
+
timestamps;
|
|
1072
|
+
directory;
|
|
1035
1073
|
/** Returns database metadata for the currently opened binding. */
|
|
1036
1074
|
async info() {
|
|
1037
1075
|
return await this.rpc.call("databases.info", {
|
|
@@ -1539,6 +1577,7 @@ async function queryDocuments(db, filter, sortBy, options) {
|
|
|
1539
1577
|
return db.query({ filter: expression, sortBy }, options);
|
|
1540
1578
|
}
|
|
1541
1579
|
export {
|
|
1580
|
+
MINDOODB_APP_SEAL_SIGNING_DOMAIN,
|
|
1542
1581
|
MindooDBRichTextHandle,
|
|
1543
1582
|
MindooDBTextBuffer,
|
|
1544
1583
|
abbreviateCanonicalName,
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aA as MindooDBAppLaunchContext, a8 as MindooDBAppDatabaseInfo, ab as MindooDBAppDocumentApi, a7 as MindooDBAppCreateViewNavigatorInput, by as MindooDBAppViewNavigator, bA as MindooDBAppViewNavigatorOpenOptions, i as MindooDBAppAttachmentApi, ar as MindooDBAppIdentityApi, bo as MindooDBAppTimestampApi, a9 as MindooDBAppDirectoryApi, an as MindooDBAppFulltextSetup, am as MindooDBAppExtractionSetup, a as MindooDBAppBridge, be as MindooDBAppSession, C as MindooDBAppBridgeRpcRequest, aq as MindooDBAppHostTheme, bG as MindooDBAppViewport, bs as MindooDBAppUiPreferences, aQ as MindooDBAppQueryResult, bF as MindooDBAppViewUpdateStats, y as MindooDBAppBridgePortMessage } from '../types-Bl6CrBn1.js';
|
|
2
2
|
import 'mindoodb-view-language';
|
|
3
3
|
|
|
4
4
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -10,6 +10,9 @@ type MockDatabaseMethods = {
|
|
|
10
10
|
documents?: Partial<MindooDBAppDocumentApi>;
|
|
11
11
|
views?: Partial<MockViewApi>;
|
|
12
12
|
attachments?: Partial<MindooDBAppAttachmentApi>;
|
|
13
|
+
identity?: Partial<MindooDBAppIdentityApi>;
|
|
14
|
+
timestamps?: Partial<MindooDBAppTimestampApi>;
|
|
15
|
+
directory?: Partial<MindooDBAppDirectoryApi>;
|
|
13
16
|
};
|
|
14
17
|
interface MockMindooDBAppDatabaseDefinition {
|
|
15
18
|
info: MindooDBAppDatabaseInfo;
|
package/dist/testing/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
parseMindooDBFormulaBooleanExpression
|
|
6
6
|
} from "mindoodb-view-language";
|
|
7
7
|
var PROTOCOL = "mindoodb-app-bridge";
|
|
8
|
+
var MOCK_SIGNING_PUBLIC_KEY_PEM = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAmockmockmockmockmockmockmockmockmockmockmoc=\n-----END PUBLIC KEY-----\n";
|
|
8
9
|
function createBridgeErrorPayload(error, fallbackCode = "bridge-error") {
|
|
9
10
|
if (error && typeof error === "object" && "message" in error) {
|
|
10
11
|
const namedError = error;
|
|
@@ -746,6 +747,14 @@ function createDefaultViewNavigator() {
|
|
|
746
747
|
}
|
|
747
748
|
};
|
|
748
749
|
}
|
|
750
|
+
async function mockSha256Hex(value) {
|
|
751
|
+
const subtle = globalThis.crypto?.subtle;
|
|
752
|
+
if (!subtle) {
|
|
753
|
+
return null;
|
|
754
|
+
}
|
|
755
|
+
const digest = await subtle.digest("SHA-256", new TextEncoder().encode(value));
|
|
756
|
+
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
757
|
+
}
|
|
749
758
|
function createDatabaseHandle(definition) {
|
|
750
759
|
let createCounter = 0;
|
|
751
760
|
let changeCounter = 0;
|
|
@@ -1067,6 +1076,69 @@ function createDatabaseHandle(definition) {
|
|
|
1067
1076
|
data: null,
|
|
1068
1077
|
attachments: []
|
|
1069
1078
|
};
|
|
1079
|
+
},
|
|
1080
|
+
async getAtHeads(docId, _headIds) {
|
|
1081
|
+
return {
|
|
1082
|
+
id: docId,
|
|
1083
|
+
timestamp: Date.now(),
|
|
1084
|
+
heads: [],
|
|
1085
|
+
state: "missing",
|
|
1086
|
+
data: null,
|
|
1087
|
+
attachments: []
|
|
1088
|
+
};
|
|
1089
|
+
},
|
|
1090
|
+
async listVerification() {
|
|
1091
|
+
return [];
|
|
1092
|
+
}
|
|
1093
|
+
};
|
|
1094
|
+
const defaultIdentity = {
|
|
1095
|
+
async signStatement(input) {
|
|
1096
|
+
if (input.preview.svg != null && input.preview.renderDigest != null) {
|
|
1097
|
+
const actual = await mockSha256Hex(input.preview.svg);
|
|
1098
|
+
if (actual != null && actual !== input.preview.renderDigest) {
|
|
1099
|
+
return { ok: false, reason: "render-mismatch" };
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
return {
|
|
1103
|
+
ok: true,
|
|
1104
|
+
signature: `mock-signature-${input.statement.byteLength}`,
|
|
1105
|
+
publicKey: MOCK_SIGNING_PUBLIC_KEY_PEM,
|
|
1106
|
+
fingerprint: "0".repeat(64),
|
|
1107
|
+
domain: input.domain,
|
|
1108
|
+
signedAt: Date.now()
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
const defaultTimestamps = {
|
|
1113
|
+
async rfc3161(input) {
|
|
1114
|
+
return {
|
|
1115
|
+
token: `mock-timestamp-token-${input.digest.byteLength}`,
|
|
1116
|
+
providerId: input.providerId ?? "mock",
|
|
1117
|
+
providerName: "Mock TSA (test host)",
|
|
1118
|
+
transport: "direct",
|
|
1119
|
+
genTime: Date.now(),
|
|
1120
|
+
rootInPublicTrustStores: false
|
|
1121
|
+
};
|
|
1122
|
+
},
|
|
1123
|
+
async listProviders() {
|
|
1124
|
+
return [
|
|
1125
|
+
{
|
|
1126
|
+
id: "mock",
|
|
1127
|
+
name: "Mock TSA (test host)",
|
|
1128
|
+
qualified: false,
|
|
1129
|
+
rootInPublicTrustStores: false,
|
|
1130
|
+
browserReachable: true
|
|
1131
|
+
}
|
|
1132
|
+
];
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
const defaultDirectory = {
|
|
1136
|
+
async excerpt(publicKeys) {
|
|
1137
|
+
return publicKeys.map((signingPublicKey) => ({
|
|
1138
|
+
signingPublicKey,
|
|
1139
|
+
fingerprint: "0".repeat(64),
|
|
1140
|
+
status: "unknown"
|
|
1141
|
+
}));
|
|
1070
1142
|
}
|
|
1071
1143
|
};
|
|
1072
1144
|
const defaultViews = {
|
|
@@ -1129,6 +1201,18 @@ function createDatabaseHandle(definition) {
|
|
|
1129
1201
|
...defaultAttachments,
|
|
1130
1202
|
...methods.attachments
|
|
1131
1203
|
},
|
|
1204
|
+
identity: {
|
|
1205
|
+
...defaultIdentity,
|
|
1206
|
+
...methods.identity
|
|
1207
|
+
},
|
|
1208
|
+
timestamps: {
|
|
1209
|
+
...defaultTimestamps,
|
|
1210
|
+
...methods.timestamps
|
|
1211
|
+
},
|
|
1212
|
+
directory: {
|
|
1213
|
+
...defaultDirectory,
|
|
1214
|
+
...methods.directory
|
|
1215
|
+
},
|
|
1132
1216
|
async getFulltextSetup() {
|
|
1133
1217
|
return fulltextSetup === null ? null : { ...fulltextSetup };
|
|
1134
1218
|
},
|
|
@@ -1676,7 +1760,34 @@ function createFakeBridgeHost(options = {}) {
|
|
|
1676
1760
|
case "documents.history.getAtRevision":
|
|
1677
1761
|
return await state.getDatabase(String(params.databaseId)).documents.getAtRevision(
|
|
1678
1762
|
String(params.docId),
|
|
1679
|
-
String(params.revisionId)
|
|
1763
|
+
String(params.revisionId),
|
|
1764
|
+
params.phase === "before" ? { phase: "before" } : void 0
|
|
1765
|
+
);
|
|
1766
|
+
case "documents.history.getAtHeads":
|
|
1767
|
+
return await state.getDatabase(String(params.databaseId)).documents.getAtHeads(
|
|
1768
|
+
String(params.docId),
|
|
1769
|
+
Array.isArray(params.headIds) ? params.headIds.map(String) : []
|
|
1770
|
+
);
|
|
1771
|
+
case "documents.history.listVerification":
|
|
1772
|
+
return await state.getDatabase(String(params.databaseId)).documents.listVerification(
|
|
1773
|
+
String(params.docId),
|
|
1774
|
+
Array.isArray(params.revisionIds) ? params.revisionIds.map(String) : void 0
|
|
1775
|
+
);
|
|
1776
|
+
case "identity.signStatement": {
|
|
1777
|
+
const { databaseId: _databaseId, ...input } = params;
|
|
1778
|
+
return await state.getDatabase(String(params.databaseId)).identity.signStatement(
|
|
1779
|
+
input
|
|
1780
|
+
);
|
|
1781
|
+
}
|
|
1782
|
+
case "timestamps.rfc3161": {
|
|
1783
|
+
const { databaseId: _databaseId, ...input } = params;
|
|
1784
|
+
return await state.getDatabase(String(params.databaseId)).timestamps.rfc3161(input);
|
|
1785
|
+
}
|
|
1786
|
+
case "timestamps.listProviders":
|
|
1787
|
+
return await state.getDatabase(String(params.databaseId)).timestamps.listProviders();
|
|
1788
|
+
case "directory.excerpt":
|
|
1789
|
+
return await state.getDatabase(String(params.databaseId)).directory.excerpt(
|
|
1790
|
+
Array.isArray(params.publicKeys) ? params.publicKeys.map(String) : []
|
|
1680
1791
|
);
|
|
1681
1792
|
case "attachments.list":
|
|
1682
1793
|
return await state.getDatabase(String(params.databaseId)).attachments.list(
|
|
@@ -102,7 +102,7 @@ interface MindooDBAppResolvedViewDefinition {
|
|
|
102
102
|
columns: MindooDBAppConfiguredViewColumn[];
|
|
103
103
|
}
|
|
104
104
|
/** Permission/capability flags exposed for a database binding inside the app session. */
|
|
105
|
-
type MindooDBAppCapability = "read" | "create" | "update" | "delete" | "history" | "attachments" | "views";
|
|
105
|
+
type MindooDBAppCapability = "read" | "create" | "update" | "delete" | "history" | "attachments" | "views" | "sign" | "timestamps" | "directory";
|
|
106
106
|
/** Metadata about the current app launch supplied by the Haven host. */
|
|
107
107
|
interface MindooDBAppLaunchContext {
|
|
108
108
|
appId: string;
|
|
@@ -208,6 +208,108 @@ interface MindooDBAppDocumentHistoryEntry {
|
|
|
208
208
|
isDeleted: boolean;
|
|
209
209
|
isCurrent: boolean;
|
|
210
210
|
summary?: string;
|
|
211
|
+
/**
|
|
212
|
+
* The revisions this one was written on top of — the edges of the signed
|
|
213
|
+
* change graph, in the same id space as {@link revisionId}. More than one id
|
|
214
|
+
* means this revision merged concurrent branches.
|
|
215
|
+
*
|
|
216
|
+
* A timeline is a linearization of that graph, so an id here may name a
|
|
217
|
+
* revision the timeline does not list (a change that left the document state
|
|
218
|
+
* untouched produces no timeline row). Draw only the edges whose endpoints you
|
|
219
|
+
* have; use {@link MindooDBAppDocumentHistoryApi.getAtHeads} to reconstruct
|
|
220
|
+
* state from the full list.
|
|
221
|
+
*/
|
|
222
|
+
dependencyIds?: string[];
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Which side of a revision to read: the state it produced (`after`, the
|
|
226
|
+
* default), or the state it was written against (`before`).
|
|
227
|
+
*
|
|
228
|
+
* `before` is a single document even for a revision that merged several
|
|
229
|
+
* branches: it is the merge of all its parents, which is what its author had
|
|
230
|
+
* loaded. For the document's creation there is no prior state, so `before`
|
|
231
|
+
* reports a `missing` snapshot.
|
|
232
|
+
*/
|
|
233
|
+
type MindooDBAppRevisionPhase = "before" | "after";
|
|
234
|
+
/**
|
|
235
|
+
* The cryptographic record behind one revision, as it sits in the append-only
|
|
236
|
+
* store — what a seal or an audit needs and what {@link MindooDBAppDocumentHistoryEntry}
|
|
237
|
+
* deliberately omits.
|
|
238
|
+
*
|
|
239
|
+
* Nothing here requires the document's decryption key. `metadataSignature`
|
|
240
|
+
* covers the entry id, and an entry id ends in the hash of the *plaintext*
|
|
241
|
+
* Automerge change, so an outsider can attribute every change to a key and
|
|
242
|
+
* order the whole edit DAG while learning nothing about what any change
|
|
243
|
+
* contained.
|
|
244
|
+
*
|
|
245
|
+
* Byte fields are base64 rather than `Uint8Array` because these records are
|
|
246
|
+
* written verbatim into evidence bundles as JSON, and read back years later by
|
|
247
|
+
* a verifier that has no Haven, no tenant and no network.
|
|
248
|
+
*/
|
|
249
|
+
interface MindooDBAppRevisionVerification {
|
|
250
|
+
/** Matches `revisionId` in {@link MindooDBAppDocumentHistoryEntry}. */
|
|
251
|
+
revisionId: MindooDBAppDocumentRevisionId;
|
|
252
|
+
/** Store entry id: `<docId>_d_<depsFingerprint>_<automergeChangeHash>`. */
|
|
253
|
+
entryId: string;
|
|
254
|
+
entryType: string;
|
|
255
|
+
docId: string;
|
|
256
|
+
/** Database name the entry lives under; bound into the witness receipt. */
|
|
257
|
+
dbid: string;
|
|
258
|
+
/** SHA-256 of the *encrypted* payload. */
|
|
259
|
+
contentHash: string;
|
|
260
|
+
createdAt: number;
|
|
261
|
+
createdByPublicKey: string;
|
|
262
|
+
decryptionKeyId: string;
|
|
263
|
+
dependencyIds: string[];
|
|
264
|
+
attachmentRefs?: MindooDBAppEntryAttachmentRef[];
|
|
265
|
+
provenance?: MindooDBAppEntryProvenance;
|
|
266
|
+
/** Base64 legacy signature, over the ciphertext only. */
|
|
267
|
+
signature: string;
|
|
268
|
+
/**
|
|
269
|
+
* Base64 signature over the canonical metadata layout, which includes the
|
|
270
|
+
* entry id. Absent on entries written before this field existed — those
|
|
271
|
+
* cannot be bound to a plaintext change at all, and a verifier must report
|
|
272
|
+
* them as unattributable rather than pass them.
|
|
273
|
+
*/
|
|
274
|
+
metadataSignature?: string;
|
|
275
|
+
/** Epoch ms at which a witnessing server accepted the entry. */
|
|
276
|
+
receivedAt?: number;
|
|
277
|
+
receivedByPublicKey?: string;
|
|
278
|
+
/** Base64 Ed25519 signature by the witness over the receipt layout. */
|
|
279
|
+
receivedDateSignature?: string;
|
|
280
|
+
receiptScheme?: string;
|
|
281
|
+
entryVersion?: number;
|
|
282
|
+
/**
|
|
283
|
+
* The tenant's trusted witness keys *as of* `receivedAt`. A receipt is only
|
|
284
|
+
* worth something if its signer was trusted when it was made, and that set
|
|
285
|
+
* changes over a tenant's life — so it is resolved at read time and carried
|
|
286
|
+
* along, not left for the verifier to guess.
|
|
287
|
+
*/
|
|
288
|
+
trustedWitnessKeys?: string[];
|
|
289
|
+
}
|
|
290
|
+
/** Attachment reference bound into an entry's metadata signature. */
|
|
291
|
+
interface MindooDBAppEntryAttachmentRef {
|
|
292
|
+
attachmentId: string;
|
|
293
|
+
lastChunkId: string;
|
|
294
|
+
size: number;
|
|
295
|
+
}
|
|
296
|
+
/** Where a copied entry came from, as recorded in its signed metadata. */
|
|
297
|
+
interface MindooDBAppEntryProvenance {
|
|
298
|
+
sourceTenantId: string;
|
|
299
|
+
sourceDbId: string;
|
|
300
|
+
source: {
|
|
301
|
+
entryType: string;
|
|
302
|
+
id: string;
|
|
303
|
+
docId: string;
|
|
304
|
+
decryptionKeyId: string;
|
|
305
|
+
createdAt: number;
|
|
306
|
+
dependencyIds: string[];
|
|
307
|
+
contentHash: string;
|
|
308
|
+
createdByPublicKey: string;
|
|
309
|
+
attachmentRefs?: MindooDBAppEntryAttachmentRef[];
|
|
310
|
+
};
|
|
311
|
+
/** Base64 signature by the original author. */
|
|
312
|
+
sourceMetadataSignature?: string;
|
|
211
313
|
}
|
|
212
314
|
/** Historical snapshot returned for a document at a specific timestamp. */
|
|
213
315
|
interface MindooDBAppHistoricalDocument {
|
|
@@ -1175,8 +1277,10 @@ interface MindooDBAppDocumentApi {
|
|
|
1175
1277
|
getDefaultCreateKeyId(): Promise<string>;
|
|
1176
1278
|
/**
|
|
1177
1279
|
* List the document's revision timeline (newest first), including author
|
|
1178
|
-
* identity metadata and the stable `revisionId` per entry.
|
|
1179
|
-
*
|
|
1280
|
+
* identity metadata and the stable `revisionId` per entry. Entries are
|
|
1281
|
+
* metadata-only — document bodies are not included; load a revision with
|
|
1282
|
+
* {@link getAtRevision} or {@link getAtTimestamp}. Requires the `history`
|
|
1283
|
+
* capability.
|
|
1180
1284
|
*/
|
|
1181
1285
|
listHistory(docId: string): Promise<MindooDBAppDocumentHistoryEntry[]>;
|
|
1182
1286
|
/**
|
|
@@ -1192,8 +1296,204 @@ interface MindooDBAppDocumentApi {
|
|
|
1192
1296
|
* identifiers — the preferred way to load historical states and the value
|
|
1193
1297
|
* to pass to historical attachment APIs. Requires the `history`
|
|
1194
1298
|
* capability.
|
|
1299
|
+
*
|
|
1300
|
+
* Pass `{ phase: "before" }` to read the state the revision was written
|
|
1301
|
+
* against instead of the state it produced, which is how you show what one
|
|
1302
|
+
* revision changed. See {@link MindooDBAppRevisionPhase}.
|
|
1303
|
+
*/
|
|
1304
|
+
getAtRevision(docId: string, revisionId: MindooDBAppDocumentRevisionId, options?: {
|
|
1305
|
+
phase?: MindooDBAppRevisionPhase;
|
|
1306
|
+
}): Promise<MindooDBAppHistoricalDocument>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Read-only snapshot of the document as it stood at a set of concurrent
|
|
1309
|
+
* revisions: the merge of those heads, with nothing that came after them.
|
|
1310
|
+
*
|
|
1311
|
+
* Use it to reconstruct a specific point in the change graph rather than in
|
|
1312
|
+
* the timeline — for example, pass a revision's
|
|
1313
|
+
* {@link MindooDBAppDocumentHistoryEntry.dependencyIds} to see exactly the
|
|
1314
|
+
* document its author was editing. An empty or unresolvable head list means
|
|
1315
|
+
* there was no document yet and reports a `missing` snapshot. Requires the
|
|
1316
|
+
* `history` capability.
|
|
1317
|
+
*/
|
|
1318
|
+
getAtHeads(docId: string, headIds: MindooDBAppDocumentRevisionId[]): Promise<MindooDBAppHistoricalDocument>;
|
|
1319
|
+
/**
|
|
1320
|
+
* The signatures and witness receipts behind a document's revisions —
|
|
1321
|
+
* everything {@link listHistory} leaves out because a timeline UI does not
|
|
1322
|
+
* need it and an audit cannot do without it.
|
|
1323
|
+
*
|
|
1324
|
+
* Pass `revisionIds` to fetch only the revisions being sealed; omit it for
|
|
1325
|
+
* the whole document. Requires the `history` capability.
|
|
1326
|
+
*/
|
|
1327
|
+
listVerification(docId: string, revisionIds?: MindooDBAppDocumentRevisionId[]): Promise<MindooDBAppRevisionVerification[]>;
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Signing with the launching user's MindooDB identity key.
|
|
1331
|
+
*
|
|
1332
|
+
* The app never touches the key, and never signs silently: every call opens a
|
|
1333
|
+
* Haven dialog showing what is about to be signed. Requires the `sign`
|
|
1334
|
+
* capability, which only grants the *right to ask*.
|
|
1335
|
+
*/
|
|
1336
|
+
interface MindooDBAppIdentityApi {
|
|
1337
|
+
/**
|
|
1338
|
+
* Ask the user to sign `input.statement` under `input.domain`.
|
|
1339
|
+
*
|
|
1340
|
+
* Resolves with `ok: false` when the user declines or when the preview SVG
|
|
1341
|
+
* does not match the `renderDigest` inside the statement — neither is an
|
|
1342
|
+
* error, and both should leave the app's UI intact.
|
|
1195
1343
|
*/
|
|
1196
|
-
|
|
1344
|
+
signStatement(input: MindooDBAppSignStatementInput): Promise<MindooDBAppSignStatementResult>;
|
|
1345
|
+
}
|
|
1346
|
+
/** RFC 3161 timestamps over app-supplied digests. */
|
|
1347
|
+
interface MindooDBAppTimestampApi {
|
|
1348
|
+
/**
|
|
1349
|
+
* Obtain a timestamp token. Haven calls a browser-reachable TSA directly
|
|
1350
|
+
* where it can, and otherwise proxies through the tenant's server; the
|
|
1351
|
+
* returned `transport` says which happened.
|
|
1352
|
+
*
|
|
1353
|
+
* A token proves the digest existed *no later than* `genTime`. It cannot
|
|
1354
|
+
* prove a lower bound, and no amount of UI wording should imply otherwise.
|
|
1355
|
+
* Requires the `timestamps` capability.
|
|
1356
|
+
*/
|
|
1357
|
+
rfc3161(input: MindooDBAppTimestampInput): Promise<MindooDBAppTimestampResult>;
|
|
1358
|
+
/** Providers this host can currently reach, best first. */
|
|
1359
|
+
listProviders(): Promise<MindooDBAppTimestampProvider[]>;
|
|
1360
|
+
}
|
|
1361
|
+
/** Read-only lookups against the tenant's user directory. */
|
|
1362
|
+
interface MindooDBAppDirectoryApi {
|
|
1363
|
+
/**
|
|
1364
|
+
* Resolve the directory's claims about specific signing keys.
|
|
1365
|
+
*
|
|
1366
|
+
* Only the keys asked for are returned, and unknown keys come back with
|
|
1367
|
+
* `status: "unknown"` rather than being dropped — an evidence excerpt should
|
|
1368
|
+
* name the keys it could not resolve. Requires the `directory` capability.
|
|
1369
|
+
*/
|
|
1370
|
+
excerpt(publicKeys: string[]): Promise<MindooDBAppDirectoryEntry[]>;
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* The only signing domain apps may request today. Domain separation is not
|
|
1374
|
+
* decoration: the same Ed25519 key signs store entries and auth challenges, and
|
|
1375
|
+
* an app that could choose its own prefix could have the user unwittingly sign
|
|
1376
|
+
* something that replays as one of those.
|
|
1377
|
+
*/
|
|
1378
|
+
declare const MINDOODB_APP_SEAL_SIGNING_DOMAIN = "mindoodb-seal/v1";
|
|
1379
|
+
/** What the seal asserts about the material it covers. */
|
|
1380
|
+
type MindooDBAppSealIntent = "approval" | "countersign" | "authorship";
|
|
1381
|
+
/**
|
|
1382
|
+
* What Haven shows the user before signing.
|
|
1383
|
+
*
|
|
1384
|
+
* This is the WYSIWYS ("what you see is what you sign") surface. The app hands
|
|
1385
|
+
* over the exact picture and wording it wants attested; Haven checks the SVG
|
|
1386
|
+
* against `renderDigest` — which is inside the signed bytes — and refuses to
|
|
1387
|
+
* sign when they disagree. Without that check a signature would attest to bytes
|
|
1388
|
+
* nobody ever looked at.
|
|
1389
|
+
*/
|
|
1390
|
+
interface MindooDBAppSignPreview {
|
|
1391
|
+
/** Headline of the consent dialog, e.g. "Approve page 3 of Site survey". */
|
|
1392
|
+
title: string;
|
|
1393
|
+
intent: MindooDBAppSealIntent;
|
|
1394
|
+
/**
|
|
1395
|
+
* SVG source of what is being sealed, shown inline. Haven verifies that its
|
|
1396
|
+
* SHA-256 equals {@link renderDigest} before rendering it.
|
|
1397
|
+
*/
|
|
1398
|
+
svg?: string;
|
|
1399
|
+
/** Lower-case hex SHA-256 of `svg`, as it appears in the statement. */
|
|
1400
|
+
renderDigest?: string;
|
|
1401
|
+
/** One row per sealed document, shown as a list the user can read. */
|
|
1402
|
+
scope: MindooDBAppSignPreviewScope[];
|
|
1403
|
+
/** Free-text note that is part of the signed statement. */
|
|
1404
|
+
note?: string;
|
|
1405
|
+
}
|
|
1406
|
+
/** One sealed document as presented in the consent dialog. */
|
|
1407
|
+
interface MindooDBAppSignPreviewScope {
|
|
1408
|
+
label: string;
|
|
1409
|
+
detail?: string;
|
|
1410
|
+
}
|
|
1411
|
+
/** Request to sign a canonical statement with the launching user's identity key. */
|
|
1412
|
+
interface MindooDBAppSignStatementInput {
|
|
1413
|
+
/** Must be {@link MINDOODB_APP_SEAL_SIGNING_DOMAIN}. */
|
|
1414
|
+
domain: string;
|
|
1415
|
+
/** Canonical (RFC 8785) statement bytes. Signed verbatim under `domain`. */
|
|
1416
|
+
statement: Uint8Array;
|
|
1417
|
+
preview: MindooDBAppSignPreview;
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Outcome of a signing request.
|
|
1421
|
+
*
|
|
1422
|
+
* Declining is an ordinary outcome, not an error: `ok: false` with a `reason`,
|
|
1423
|
+
* so an app can distinguish "the user said no" from "the bridge broke" without
|
|
1424
|
+
* inspecting error strings.
|
|
1425
|
+
*/
|
|
1426
|
+
type MindooDBAppSignStatementResult = {
|
|
1427
|
+
ok: true;
|
|
1428
|
+
/** Base64 Ed25519 signature over `domain || 0x00 || statement`. */
|
|
1429
|
+
signature: string;
|
|
1430
|
+
/** PEM public key of the signing identity. */
|
|
1431
|
+
publicKey: string;
|
|
1432
|
+
/** Lower-case hex SHA-256 of the DER SubjectPublicKeyInfo. */
|
|
1433
|
+
fingerprint: string;
|
|
1434
|
+
domain: string;
|
|
1435
|
+
/** Client wall-clock at signing. Not evidence — the TSA token is. */
|
|
1436
|
+
signedAt: number;
|
|
1437
|
+
} | {
|
|
1438
|
+
ok: false;
|
|
1439
|
+
reason: "declined" | "render-mismatch";
|
|
1440
|
+
};
|
|
1441
|
+
/** Request for an RFC 3161 token over a digest the app computed. */
|
|
1442
|
+
interface MindooDBAppTimestampInput {
|
|
1443
|
+
/** Raw digest bytes to be timestamped (32 bytes for SHA-256). */
|
|
1444
|
+
digest: Uint8Array;
|
|
1445
|
+
/** @defaultValue `"SHA-256"` */
|
|
1446
|
+
hashAlgorithm?: "SHA-256" | "SHA-512";
|
|
1447
|
+
/**
|
|
1448
|
+
* Preferred provider id from {@link MindooDBAppTimestampProvider}. Apps name
|
|
1449
|
+
* a provider, never a URL — the URL set is server configuration, so a hostile
|
|
1450
|
+
* app cannot aim the host at an address of its choosing.
|
|
1451
|
+
*/
|
|
1452
|
+
providerId?: string;
|
|
1453
|
+
/** Ask the TSA to include its certificate chain in the token. @defaultValue `true` */
|
|
1454
|
+
requestCertificates?: boolean;
|
|
1455
|
+
}
|
|
1456
|
+
/** A timestamp token, with enough context to verify it offline later. */
|
|
1457
|
+
interface MindooDBAppTimestampResult {
|
|
1458
|
+
/** Base64 DER `TimeStampResp`. */
|
|
1459
|
+
token: string;
|
|
1460
|
+
providerId: string;
|
|
1461
|
+
providerName?: string;
|
|
1462
|
+
/** Where the token came from: a direct browser call or the tenant's server. */
|
|
1463
|
+
transport: "direct" | "proxy";
|
|
1464
|
+
/** TSA-asserted time, epoch ms, as parsed from the token. */
|
|
1465
|
+
genTime?: number;
|
|
1466
|
+
policyOid?: string;
|
|
1467
|
+
/** True when the token chains to a root in public trust stores. */
|
|
1468
|
+
rootInPublicTrustStores?: boolean;
|
|
1469
|
+
/** PEM chain extracted from the token, for a verifier with no trust store. */
|
|
1470
|
+
certificateChainPem?: string;
|
|
1471
|
+
}
|
|
1472
|
+
/** A timestamping provider this host can reach. */
|
|
1473
|
+
interface MindooDBAppTimestampProvider {
|
|
1474
|
+
id: string;
|
|
1475
|
+
name: string;
|
|
1476
|
+
/** eIDAS-qualified. Free and non-qualified are the common case. */
|
|
1477
|
+
qualified: boolean;
|
|
1478
|
+
rootInPublicTrustStores: boolean;
|
|
1479
|
+
policyOid?: string;
|
|
1480
|
+
/** Reachable straight from the browser (CORS-enabled), no server needed. */
|
|
1481
|
+
browserReachable: boolean;
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* One directory entry, for the identity excerpt a bundle carries.
|
|
1485
|
+
*
|
|
1486
|
+
* This is the weakest link in the evidence and the docs say so plainly: it
|
|
1487
|
+
* records what the tenant's directory claimed about a key, which is an
|
|
1488
|
+
* agreement between the parties, not a cryptographic fact.
|
|
1489
|
+
*/
|
|
1490
|
+
interface MindooDBAppDirectoryEntry {
|
|
1491
|
+
/** PEM Ed25519 signing key, as it appears in entry metadata. */
|
|
1492
|
+
signingPublicKey: string;
|
|
1493
|
+
fingerprint: string;
|
|
1494
|
+
label?: string;
|
|
1495
|
+
email?: string;
|
|
1496
|
+
status: "active" | "revoked" | "unknown";
|
|
1197
1497
|
}
|
|
1198
1498
|
type MindooDBAppViewEntryKind = "category" | "document";
|
|
1199
1499
|
/** Unique document identity within a multi-source view. */
|
|
@@ -1485,6 +1785,17 @@ interface MindooDBAppDatabase {
|
|
|
1485
1785
|
info(): Promise<MindooDBAppDatabaseInfo>;
|
|
1486
1786
|
documents: MindooDBAppDocumentApi;
|
|
1487
1787
|
attachments: MindooDBAppAttachmentApi;
|
|
1788
|
+
/**
|
|
1789
|
+
* Signing, timestamping and directory lookups.
|
|
1790
|
+
*
|
|
1791
|
+
* These hang off a database rather than the session because each one is
|
|
1792
|
+
* granted per binding and resolves through that binding's tenant — the
|
|
1793
|
+
* signing identity, the server that proxies timestamps and the directory
|
|
1794
|
+
* being quoted are all the tenant's, not the app's.
|
|
1795
|
+
*/
|
|
1796
|
+
identity: MindooDBAppIdentityApi;
|
|
1797
|
+
timestamps: MindooDBAppTimestampApi;
|
|
1798
|
+
directory: MindooDBAppDirectoryApi;
|
|
1488
1799
|
/**
|
|
1489
1800
|
* Read the database's full-text index configuration from the synced
|
|
1490
1801
|
* `dbsetup` document. Resolves to `null` when full-text indexing has
|
|
@@ -1614,4 +1925,4 @@ interface MindooDBAppBridge {
|
|
|
1614
1925
|
connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
|
|
1615
1926
|
}
|
|
1616
1927
|
|
|
1617
|
-
export type
|
|
1928
|
+
export { type MindooDBAppConfiguredViewFormulaFilterDefinition as $, type MindooDBAppBridgeRpcError as A, type MindooDBAppBridgeRpcMessage as B, type MindooDBAppBridgeRpcRequest as C, type MindooDBAppBridgeRpcSuccess as D, type MindooDBAppBridgeStreamAbortRequest as E, type MindooDBAppBridgeStreamAck as F, type MindooDBAppBridgeStreamCloseRequest as G, type MindooDBAppBridgeStreamError as H, type MindooDBAppBridgeStreamMessage as I, type MindooDBAppBridgeStreamOpenResult as J, type MindooDBAppBridgeStreamReadRequest as K, type MindooDBAppBridgeStreamWriteRequest as L, type MindooDBAppAttachmentPreviewMode as M, type MindooDBAppBridgeThemeChangedMessage as N, type MindooDBAppBridgeUiPreferencesChangedMessage as O, type MindooDBAppBridgeViewChangedMessage as P, type MindooDBAppBridgeViewportChangedMessage as Q, type MindooDBAppCapability as R, type MindooDBAppConfiguredViewCategorizationStyle as S, type MindooDBAppConfiguredViewColumn as T, type MindooDBAppConfiguredViewColumnRole as U, type MindooDBAppConfiguredViewExpressionMode as V, type MindooDBAppConfiguredViewFieldExpression as W, type MindooDBAppConfiguredViewFilterDefinition as X, type MindooDBAppConfiguredViewFilterMode as Y, type MindooDBAppConfiguredViewFilterRule as Z, type MindooDBAppConfiguredViewFormulaExpression as _, type MindooDBAppBridge as a, type MindooDBAppRichTextImmutableString as a$, type MindooDBAppConfiguredViewPreviewMode as a0, type MindooDBAppConfiguredViewRuleFilterDefinition as a1, type MindooDBAppConfiguredViewRuleMatchMode as a2, type MindooDBAppConfiguredViewRuleOperator as a3, type MindooDBAppConfiguredViewValueExpression as a4, type MindooDBAppCreateDocumentInput as a5, type MindooDBAppCreateViewInput as a6, type MindooDBAppCreateViewNavigatorInput as a7, type MindooDBAppDatabaseInfo as a8, type MindooDBAppDirectoryApi as a9, type MindooDBAppLaunchContext as aA, type MindooDBAppLiveQuerySubscription as aB, type MindooDBAppMenuAnchor as aC, type MindooDBAppMenuApi as aD, type MindooDBAppMenuCommandItem as aE, type MindooDBAppMenuDismissReason as aF, type MindooDBAppMenuDismissedResult as aG, type MindooDBAppMenuItem as aH, type MindooDBAppMenuKind as aI, type MindooDBAppMenuPlacement as aJ, type MindooDBAppMenuPointAnchor as aK, type MindooDBAppMenuRect as aL, type MindooDBAppMenuRectAnchor as aM, type MindooDBAppMenuSelectionResult as aN, type MindooDBAppMenuSeparatorItem as aO, type MindooDBAppQueryCoverage as aP, type MindooDBAppQueryResult as aQ, type MindooDBAppQueryRow as aR, type MindooDBAppQuerySortKey as aS, type MindooDBAppQueryTextClause as aT, type MindooDBAppReadableAttachmentStream as aU, type MindooDBAppResolvedViewDefinition as aV, type MindooDBAppResolvedViewSource as aW, type MindooDBAppRevisionPhase as aX, type MindooDBAppRevisionVerification as aY, type MindooDBAppRichTextBlockSpan as aZ, type MindooDBAppRichTextGetOptions as a_, type MindooDBAppDirectoryEntry as aa, type MindooDBAppDocumentApi as ab, type MindooDBAppDocumentHeadCursorResult as ac, type MindooDBAppDocumentHistoryEntry as ad, type MindooDBAppDocumentListQuery as ae, type MindooDBAppDocumentListResult as af, type MindooDBAppDocumentQuery as ag, type MindooDBAppDocumentRevisionId as ah, type MindooDBAppDocumentScanPreset as ai, type MindooDBAppDocumentSummary as aj, type MindooDBAppEntryAttachmentRef as ak, type MindooDBAppEntryProvenance as al, type MindooDBAppExtractionSetup as am, type MindooDBAppFulltextSetup as an, type MindooDBAppHistoricalDocument as ao, type MindooDBAppHistoryQuery as ap, type MindooDBAppHostTheme as aq, type MindooDBAppIdentityApi as ar, type MindooDBAppJsonListDeletePatch as as, type MindooDBAppJsonListInsertPatch as at, type MindooDBAppJsonPatch as au, type MindooDBAppJsonSetPatch as av, type MindooDBAppJsonTextMarkPatch as aw, type MindooDBAppJsonTextSplicePatch as ax, type MindooDBAppJsonTextUnmarkPatch as ay, type MindooDBAppJsonUnsetPatch as az, type MindooDBAppDatabase as b, type MindooDBAppRichTextMarkRange as b0, type MindooDBAppRichTextMaterializeValue as b1, type MindooDBAppRichTextPatch as b2, type MindooDBAppRichTextScalar as b3, type MindooDBAppRichTextSpliceStep as b4, type MindooDBAppRichTextStep as b5, type MindooDBAppRichTextStepPatch as b6, type MindooDBAppRichTextTextSpan as b7, type MindooDBAppRuntime as b8, type MindooDBAppScanAttachmentOptions as b9, type MindooDBAppViewNavigatorOpenOptions as bA, type MindooDBAppViewNavigatorPageOptions as bB, type MindooDBAppViewNavigatorPageResult as bC, type MindooDBAppViewNavigatorRangeQuery as bD, type MindooDBAppViewNavigatorSelectionState as bE, type MindooDBAppViewUpdateStats as bF, type MindooDBAppViewport as bG, type MindooDBAppWritableAttachmentStream as bH, type MindooDBAppScanAttachmentResult as ba, type MindooDBAppScopedDocId as bb, type MindooDBAppScopedDocumentSummary as bc, type MindooDBAppSealIntent as bd, type MindooDBAppSession as be, type MindooDBAppShowMenuInput as bf, type MindooDBAppShowMenuResult as bg, type MindooDBAppSignPreview as bh, type MindooDBAppSignPreviewScope as bi, type MindooDBAppSignStatementInput as bj, type MindooDBAppSignStatementResult as bk, type MindooDBAppTextEdit as bl, type MindooDBAppTextPatch as bm, type MindooDBAppThemeMode as bn, type MindooDBAppTimestampApi as bo, type MindooDBAppTimestampInput as bp, type MindooDBAppTimestampProvider as bq, type MindooDBAppTimestampResult as br, type MindooDBAppUiPreferences as bs, type MindooDBAppUpdateDocumentInput as bt, type MindooDBAppViewCursorDocumentListResult as bu, type MindooDBAppViewCursorResult as bv, type MindooDBAppViewEntry as bw, type MindooDBAppViewEntryKind as bx, type MindooDBAppViewNavigator as by, type MindooDBAppViewNavigatorExpansionState as bz, type MindooDBAppDocument as c, type MindooDBAppRichTextSpan as d, type MindooDBAppRichTextSnapshot as e, MINDOODB_APP_SEAL_SIGNING_DOMAIN as f, type MindooDBAppAccessDecision as g, type MindooDBAppAccessTier as h, type MindooDBAppAttachmentApi as i, type MindooDBAppAttachmentChunk as j, type MindooDBAppAttachmentInfo as k, type MindooDBAppAttachmentPreviewOptions as l, type MindooDBAppAttachmentPreviewSession as m, type MindooDBAppAutomergeChangesPatch as n, type MindooDBAppAutomergeChangesSince as o, type MindooDBAppAutomergeGetOptions as p, type MindooDBAppAutomergePatchResult as q, type MindooDBAppAutomergeSnapshot as r, type MindooDBAppBridgeConnectMessage as s, type MindooDBAppBridgeConnectOptions as t, type MindooDBAppBridgeConnectedMessage as u, type MindooDBAppBridgeErrorPayload as v, type MindooDBAppBridgeHandshakeErrorMessage as w, type MindooDBAppBridgeLocaleChangedMessage as x, type MindooDBAppBridgePortMessage as y, type MindooDBAppBridgeQueryResultMessage as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindoodb-app-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22.13.0"
|
|
6
6
|
},
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@automerge/automerge": "^3.2.1",
|
|
51
|
-
"mindoodb": "^0.0.
|
|
51
|
+
"mindoodb": "^0.0.47",
|
|
52
52
|
"@types/node": "25.5.0",
|
|
53
53
|
"tsup": "^8.5.1",
|
|
54
54
|
"typescript": "^6.0.2",
|