mindoodb-app-sdk 0.0.45 → 0.0.47
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 +3 -1
- package/dist/{chunk-ZO7UE6B2.js → chunk-D662SK2G.js} +103 -23
- package/dist/index.d.ts +13 -4
- package/dist/index.js +270 -2
- package/dist/testing/index.d.ts +10 -1
- package/dist/testing/index.js +21 -1
- package/dist/{types-M3RwHErO.d.ts → types-C2WDj-Tv.d.ts} +182 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -253,7 +253,7 @@ const unbind = session.drag.bindSource(cardEl, {
|
|
|
253
253
|
});
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
-
`bindSource` starts after an 8px mouse/pen move, or a 400ms long-press on touch (so lists can still scroll). You can also call `session.drag.start` yourself with a PNG `ArrayBuffer` preview
|
|
256
|
+
`bindSource` starts after an 8px mouse/pen move, or a 400ms long-press on touch (so lists can still scroll). After start, the source frame keeps the pressed pointer (browsers do not retarget mouse-capture into Haven) and forwards `pointermove` / `pointerup` to the host. You can also call `session.drag.start` yourself with a PNG `ArrayBuffer` preview, then `reportPointer` / `release`. v1 is **copy-only** and **iframe-only**. Well-known types: `text/plain`, `text/markdown`, `application/json`, `application/x-mindoo-document`.
|
|
257
257
|
|
|
258
258
|
### Databases and capabilities
|
|
259
259
|
|
|
@@ -1602,6 +1602,8 @@ Connect options: `launchId?`, `targetOrigin?`, `connectTimeoutMs?`.
|
|
|
1602
1602
|
| `drag.setProfile(profile)` | `Promise<void>` |
|
|
1603
1603
|
| `drag.start(input)` | `Promise<MindooDBAppDragStartResult>` |
|
|
1604
1604
|
| `drag.cancel()` | `Promise<void>` |
|
|
1605
|
+
| `drag.reportPointer({ x, y })` | `Promise<void>` |
|
|
1606
|
+
| `drag.release({ x, y })` | `Promise<void>` |
|
|
1605
1607
|
| `drag.bindSource(el, options)` | `() => void` (unbind) |
|
|
1606
1608
|
| `storage` | `MindooDBAppStorageApi` |
|
|
1607
1609
|
| `onThemeChange(listener)` | `() => void` (unsubscribe) |
|
|
@@ -122,15 +122,22 @@ function normalizePreview(value) {
|
|
|
122
122
|
hotspotY: requireFiniteNumber(candidate.hotspotY, "preview.hotspotY")
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
|
+
function normalizeDragPointerInput(value) {
|
|
126
|
+
if (!value || typeof value !== "object") {
|
|
127
|
+
throw new MindooDBAppDragInputError("A drag pointer payload is required.");
|
|
128
|
+
}
|
|
129
|
+
const candidate = value;
|
|
130
|
+
return {
|
|
131
|
+
x: requireFiniteNumber(candidate.x, "pointer.x"),
|
|
132
|
+
y: requireFiniteNumber(candidate.y, "pointer.y")
|
|
133
|
+
};
|
|
134
|
+
}
|
|
125
135
|
function normalizeDragStartInput(value) {
|
|
126
136
|
if (!value || typeof value !== "object") {
|
|
127
137
|
throw new MindooDBAppDragInputError("drag.start requires a payload object.");
|
|
128
138
|
}
|
|
129
139
|
const candidate = value;
|
|
130
|
-
|
|
131
|
-
throw new MindooDBAppDragInputError("pointer is required.");
|
|
132
|
-
}
|
|
133
|
-
const pointer = candidate.pointer;
|
|
140
|
+
const pointer = normalizeDragPointerInput(candidate.pointer);
|
|
134
141
|
let allowedEffects;
|
|
135
142
|
if (candidate.allowedEffects !== void 0) {
|
|
136
143
|
if (!Array.isArray(candidate.allowedEffects) || candidate.allowedEffects.length === 0 || candidate.allowedEffects.some((effect) => effect !== "copy")) {
|
|
@@ -141,10 +148,7 @@ function normalizeDragStartInput(value) {
|
|
|
141
148
|
return {
|
|
142
149
|
offers: normalizeOffers(candidate.offers),
|
|
143
150
|
preview: normalizePreview(candidate.preview),
|
|
144
|
-
pointer
|
|
145
|
-
x: requireFiniteNumber(pointer.x, "pointer.x"),
|
|
146
|
-
y: requireFiniteNumber(pointer.y, "pointer.y")
|
|
147
|
-
},
|
|
151
|
+
pointer,
|
|
148
152
|
allowedEffects
|
|
149
153
|
};
|
|
150
154
|
}
|
|
@@ -237,7 +241,7 @@ function readPreviewElement(source, options) {
|
|
|
237
241
|
}
|
|
238
242
|
return typeof options.preview === "function" ? options.preview() : options.preview;
|
|
239
243
|
}
|
|
240
|
-
function bindDragSource(element, options, start) {
|
|
244
|
+
function bindDragSource(element, options, start, follow) {
|
|
241
245
|
const longPressMs = options.longPressMs ?? DEFAULT_DRAG_LONG_PRESS_MS;
|
|
242
246
|
const thresholdPx = options.pointerThresholdPx ?? DEFAULT_DRAG_POINTER_THRESHOLD_PX;
|
|
243
247
|
let active = null;
|
|
@@ -247,7 +251,9 @@ function bindDragSource(element, options, start) {
|
|
|
247
251
|
}
|
|
248
252
|
active = null;
|
|
249
253
|
};
|
|
250
|
-
|
|
254
|
+
let pendingRelease = null;
|
|
255
|
+
let hostListening = false;
|
|
256
|
+
const beginHostDrag = (event) => {
|
|
251
257
|
if (!active || active.started) {
|
|
252
258
|
return;
|
|
253
259
|
}
|
|
@@ -262,25 +268,50 @@ function bindDragSource(element, options, start) {
|
|
|
262
268
|
return;
|
|
263
269
|
}
|
|
264
270
|
event.preventDefault();
|
|
265
|
-
const
|
|
271
|
+
const pointerId = active.pointerId;
|
|
266
272
|
const hotX = event.clientX - element.getBoundingClientRect().left;
|
|
267
273
|
const hotY = event.clientY - element.getBoundingClientRect().top;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
preview
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
const pointer = { x: event.clientX, y: event.clientY };
|
|
275
|
+
void (async () => {
|
|
276
|
+
const preview = await active?.preview;
|
|
277
|
+
if (!active || active.pointerId !== pointerId || !preview) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const session = start({
|
|
281
|
+
offers,
|
|
282
|
+
preview: {
|
|
283
|
+
...preview,
|
|
284
|
+
hotspotX: hotX,
|
|
285
|
+
hotspotY: hotY
|
|
286
|
+
},
|
|
287
|
+
pointer,
|
|
288
|
+
allowedEffects: ["copy"]
|
|
289
|
+
});
|
|
290
|
+
hostListening = true;
|
|
291
|
+
if (pendingRelease) {
|
|
292
|
+
follow?.release(pendingRelease.x, pendingRelease.y);
|
|
293
|
+
pendingRelease = null;
|
|
294
|
+
}
|
|
295
|
+
try {
|
|
296
|
+
await session;
|
|
297
|
+
} finally {
|
|
298
|
+
hostListening = false;
|
|
299
|
+
pendingRelease = null;
|
|
300
|
+
reset();
|
|
301
|
+
}
|
|
302
|
+
})();
|
|
278
303
|
};
|
|
279
304
|
const onPointerDown = (event) => {
|
|
280
305
|
if (event.button !== 0) {
|
|
281
306
|
return;
|
|
282
307
|
}
|
|
283
308
|
reset();
|
|
309
|
+
pendingRelease = null;
|
|
310
|
+
hostListening = false;
|
|
311
|
+
try {
|
|
312
|
+
element.setPointerCapture(event.pointerId);
|
|
313
|
+
} catch {
|
|
314
|
+
}
|
|
284
315
|
const previewElement = readPreviewElement(element, options);
|
|
285
316
|
active = {
|
|
286
317
|
pointerId: event.pointerId,
|
|
@@ -306,7 +337,11 @@ function bindDragSource(element, options, start) {
|
|
|
306
337
|
}
|
|
307
338
|
};
|
|
308
339
|
const onPointerMove = (event) => {
|
|
309
|
-
if (!active || event.pointerId !== active.pointerId
|
|
340
|
+
if (!active || event.pointerId !== active.pointerId) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
if (active.started) {
|
|
344
|
+
follow?.move(event.clientX, event.clientY);
|
|
310
345
|
return;
|
|
311
346
|
}
|
|
312
347
|
const distance = pointerDistance(active.origin, event);
|
|
@@ -324,6 +359,21 @@ function bindDragSource(element, options, start) {
|
|
|
324
359
|
if (!active || event.pointerId !== active.pointerId) {
|
|
325
360
|
return;
|
|
326
361
|
}
|
|
362
|
+
try {
|
|
363
|
+
if (typeof element.hasPointerCapture === "function" && element.hasPointerCapture(event.pointerId)) {
|
|
364
|
+
element.releasePointerCapture(event.pointerId);
|
|
365
|
+
}
|
|
366
|
+
} catch {
|
|
367
|
+
}
|
|
368
|
+
if (active.started) {
|
|
369
|
+
const point = { x: event.clientX, y: event.clientY };
|
|
370
|
+
if (hostListening) {
|
|
371
|
+
follow?.release(point.x, point.y);
|
|
372
|
+
} else {
|
|
373
|
+
pendingRelease = point;
|
|
374
|
+
}
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
327
377
|
reset();
|
|
328
378
|
};
|
|
329
379
|
element.addEventListener("pointerdown", onPointerDown);
|
|
@@ -1563,8 +1613,30 @@ var MindooDBAppDragApiImpl = class {
|
|
|
1563
1613
|
async cancel() {
|
|
1564
1614
|
await this.rpc.call("drag.cancel", {});
|
|
1565
1615
|
}
|
|
1616
|
+
async reportPointer(point) {
|
|
1617
|
+
await this.rpc.call("drag.reportPointer", normalizeDragPointerInput(point));
|
|
1618
|
+
}
|
|
1619
|
+
async release(point) {
|
|
1620
|
+
await this.rpc.call("drag.release", normalizeDragPointerInput(point));
|
|
1621
|
+
}
|
|
1566
1622
|
bindSource(element, options) {
|
|
1567
|
-
const unbind = bindDragSource(
|
|
1623
|
+
const unbind = bindDragSource(
|
|
1624
|
+
element,
|
|
1625
|
+
options,
|
|
1626
|
+
(input) => this.start(input),
|
|
1627
|
+
{
|
|
1628
|
+
move: (x, y) => {
|
|
1629
|
+
void this.reportPointer({ x, y }).catch((error) => {
|
|
1630
|
+
console.warn("[mindoodb-app-sdk] Could not report a drag pointer.", error);
|
|
1631
|
+
});
|
|
1632
|
+
},
|
|
1633
|
+
release: (x, y) => {
|
|
1634
|
+
void this.release({ x, y }).catch((error) => {
|
|
1635
|
+
console.warn("[mindoodb-app-sdk] Could not release a drag.", error);
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
);
|
|
1568
1640
|
this.unbindSources.add(unbind);
|
|
1569
1641
|
return () => {
|
|
1570
1642
|
unbind();
|
|
@@ -1694,6 +1766,13 @@ var MindooDBAppSessionImpl = class {
|
|
|
1694
1766
|
async getLicensedProducts() {
|
|
1695
1767
|
return await this.rpc.call("session.getLicensedProducts", {});
|
|
1696
1768
|
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Asks the host to install another app. Only a URL crosses the bridge: the host
|
|
1771
|
+
* reads that origin's `haven-app.json` itself and asks the user.
|
|
1772
|
+
*/
|
|
1773
|
+
async proposeApp(input) {
|
|
1774
|
+
return await this.rpc.call("apps.propose", input);
|
|
1775
|
+
}
|
|
1697
1776
|
/** Lists the databases that the host has made available for this app session. */
|
|
1698
1777
|
async listDatabases() {
|
|
1699
1778
|
return await this.rpc.call("session.listDatabases", {});
|
|
@@ -1842,6 +1921,7 @@ export {
|
|
|
1842
1921
|
MindooDBAppDragInputError,
|
|
1843
1922
|
isMindooDBAppDragType,
|
|
1844
1923
|
normalizeDragAccepts,
|
|
1924
|
+
normalizeDragPointerInput,
|
|
1845
1925
|
normalizeDragStartInput,
|
|
1846
1926
|
snapshotElementToPng,
|
|
1847
1927
|
bindDragSource,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppDragBindSourceOptions, b as MindooDBAppDragStartInput, c as MindooDBAppDragStartResult, d as MindooDBAppDragPreview, e as MindooDBAppBridge, f as MindooDBAppHostShortcutBinding, g as MindooDBAppHostShortcutAction, h as MindooDBAppHostingMode, i as MindooDBAppDatabase, j as MindooDBAppDocument, k as MindooDBAppRichTextSpan, l as MindooDBAppRichTextSnapshot } from './types-
|
|
2
|
-
export { m as
|
|
1
|
+
import { M as MindooDBAppAttachmentPreviewMode, a as MindooDBAppDragBindSourceOptions, b as MindooDBAppDragStartInput, c as MindooDBAppDragStartResult, d as MindooDBAppDragPreview, e as MindooDBAppBridge, f as MindooDBAppHostShortcutBinding, g as MindooDBAppHostShortcutAction, h as MindooDBAppHostingMode, i as MindooDBAppDatabase, j as MindooDBAppDocument, k as MindooDBAppRichTextSpan, l as MindooDBAppRichTextSnapshot } from './types-C2WDj-Tv.js';
|
|
2
|
+
export { m as MINDOODB_APP_DEFINITION_FILE_NAME, n as MINDOODB_APP_DEFINITION_FORMAT, o as MINDOODB_APP_DEFINITION_PERMISSIONS, p as MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS, q as MINDOODB_APP_DEFINITION_VERSION, r as MINDOODB_APP_SEAL_SIGNING_DOMAIN, s as MINDOODB_APP_WELL_KNOWN_DRAG_TYPES, t as MindooDBAppAccessDecision, u as MindooDBAppAccessTier, v as MindooDBAppAttachmentApi, w as MindooDBAppAttachmentChunk, x as MindooDBAppAttachmentInfo, y as MindooDBAppAttachmentPreviewOptions, z as MindooDBAppAttachmentPreviewSession, A as MindooDBAppAutomergeChangesPatch, B as MindooDBAppAutomergeChangesSince, C as MindooDBAppAutomergeGetOptions, D as MindooDBAppAutomergePatchResult, E as MindooDBAppAutomergeSnapshot, F as MindooDBAppBridgeBeforeCloseAck, G as MindooDBAppBridgeBeforeCloseMessage, H as MindooDBAppBridgeConnectMessage, I as MindooDBAppBridgeConnectOptions, J as MindooDBAppBridgeConnectedMessage, K as MindooDBAppBridgeDragDropMessage, L as MindooDBAppBridgeDragLeaveMessage, N as MindooDBAppBridgeDragOverMessage, O as MindooDBAppBridgeErrorPayload, P as MindooDBAppBridgeHandshakeErrorMessage, Q as MindooDBAppBridgeLocaleChangedMessage, R as MindooDBAppBridgePortMessage, S as MindooDBAppBridgeQueryResultMessage, T as MindooDBAppBridgeRpcError, U as MindooDBAppBridgeRpcMessage, V as MindooDBAppBridgeRpcRequest, W as MindooDBAppBridgeRpcSuccess, X as MindooDBAppBridgeShortcutInvokedMessage, Y as MindooDBAppBridgeShortcutsChangedMessage, Z as MindooDBAppBridgeStreamAbortRequest, _ as MindooDBAppBridgeStreamAck, $ as MindooDBAppBridgeStreamCloseRequest, a0 as MindooDBAppBridgeStreamError, a1 as MindooDBAppBridgeStreamMessage, a2 as MindooDBAppBridgeStreamOpenResult, a3 as MindooDBAppBridgeStreamReadRequest, a4 as MindooDBAppBridgeStreamWriteRequest, a5 as MindooDBAppBridgeThemeChangedMessage, a6 as MindooDBAppBridgeUiPreferencesChangedMessage, a7 as MindooDBAppBridgeViewChangedMessage, a8 as MindooDBAppBridgeViewportChangedMessage, a9 as MindooDBAppCapability, aa as MindooDBAppConfiguredViewCategorizationStyle, ab as MindooDBAppConfiguredViewColumn, ac as MindooDBAppConfiguredViewColumnRole, ad as MindooDBAppConfiguredViewExpressionMode, ae as MindooDBAppConfiguredViewFieldExpression, af as MindooDBAppConfiguredViewFilterDefinition, ag as MindooDBAppConfiguredViewFilterMode, ah as MindooDBAppConfiguredViewFilterRule, ai as MindooDBAppConfiguredViewFormulaExpression, aj as MindooDBAppConfiguredViewFormulaFilterDefinition, ak as MindooDBAppConfiguredViewPreviewMode, al as MindooDBAppConfiguredViewRuleFilterDefinition, am as MindooDBAppConfiguredViewRuleMatchMode, an as MindooDBAppConfiguredViewRuleOperator, ao as MindooDBAppConfiguredViewValueExpression, ap as MindooDBAppCreateDocumentInput, aq as MindooDBAppCreateKeyInfo, ar as MindooDBAppCreateViewInput, as as MindooDBAppCreateViewNavigatorInput, at as MindooDBAppDatabaseInfo, au as MindooDBAppDefinition, av as MindooDBAppDefinitionDatabase, aw as MindooDBAppDefinitionPermission, ax as MindooDBAppDefinitionRegistrationPermission, ay as MindooDBAppDefinitionValidation, az 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 MindooDBAppDragApi, aL as MindooDBAppDragCancelReason, aM as MindooDBAppDragDropEvent, aN as MindooDBAppDragEffect, aO as MindooDBAppDragHoverResult, aP as MindooDBAppDragOffer, aQ as MindooDBAppDragOverEvent, aR as MindooDBAppDragPointer, aS as MindooDBAppDragProfile, aT as MindooDBAppEntryAttachmentRef, aU as MindooDBAppEntryProvenance, aV as MindooDBAppExtractDocumentTextInput, aW as MindooDBAppExtractDocumentTextResult, aX as MindooDBAppExtractTextFormat, aY as MindooDBAppExtractionSetup, aZ as MindooDBAppFulltextSetup, a_ as MindooDBAppHistoricalDocument, a$ as MindooDBAppHistoryQuery, b0 as MindooDBAppHostTheme, b1 as MindooDBAppIdentityApi, b2 as MindooDBAppInaccessibleDocument, b3 as MindooDBAppInaccessibleDocumentListQuery, b4 as MindooDBAppInaccessibleDocumentListResult, b5 as MindooDBAppJsonListDeletePatch, b6 as MindooDBAppJsonListInsertPatch, b7 as MindooDBAppJsonPatch, b8 as MindooDBAppJsonSetPatch, b9 as MindooDBAppJsonTextMarkPatch, ba as MindooDBAppJsonTextSplicePatch, bb as MindooDBAppJsonTextUnmarkPatch, bc as MindooDBAppJsonUnsetPatch, bd as MindooDBAppLaunchContext, be as MindooDBAppLiveQuerySubscription, bf as MindooDBAppMenuAnchor, bg as MindooDBAppMenuApi, bh as MindooDBAppMenuCommandItem, bi as MindooDBAppMenuDismissReason, bj as MindooDBAppMenuDismissedResult, bk as MindooDBAppMenuItem, bl as MindooDBAppMenuKind, bm as MindooDBAppMenuPlacement, bn as MindooDBAppMenuPointAnchor, bo as MindooDBAppMenuRect, bp as MindooDBAppMenuRectAnchor, bq as MindooDBAppMenuSelectionResult, br as MindooDBAppMenuSeparatorItem, bs as MindooDBAppProposeAppInput, bt as MindooDBAppProposeAppResult, bu as MindooDBAppQueryCoverage, bv as MindooDBAppQueryResult, bw as MindooDBAppQueryRow, bx as MindooDBAppQuerySortKey, by as MindooDBAppQueryTextClause, bz as MindooDBAppReadableAttachmentStream, bA as MindooDBAppRecipientOptions, bB as MindooDBAppResolvedViewDefinition, bC as MindooDBAppResolvedViewSource, bD as MindooDBAppRevisionPhase, bE as MindooDBAppRevisionVerification, bF as MindooDBAppRichTextBlockSpan, bG as MindooDBAppRichTextGetOptions, bH as MindooDBAppRichTextImmutableString, bI as MindooDBAppRichTextMarkRange, bJ as MindooDBAppRichTextMaterializeValue, bK as MindooDBAppRichTextPatch, bL as MindooDBAppRichTextScalar, bM as MindooDBAppRichTextSpliceStep, bN as MindooDBAppRichTextStep, bO as MindooDBAppRichTextStepPatch, bP as MindooDBAppRichTextTextSpan, bQ as MindooDBAppRuntime, bR as MindooDBAppScanAttachmentOptions, bS as MindooDBAppScanAttachmentResult, bT as MindooDBAppScopedDocId, bU as MindooDBAppScopedDocumentSummary, bV as MindooDBAppSealIntent, bW as MindooDBAppSealedChannelOpenInput, bX as MindooDBAppSealedChannelOpenResult, bY as MindooDBAppSealedChannelRequestInput, bZ as MindooDBAppSession, b_ as MindooDBAppShowMenuInput, b$ as MindooDBAppShowMenuResult, c0 as MindooDBAppSignPreview, c1 as MindooDBAppSignPreviewScope, c2 as MindooDBAppSignStatementInput, c3 as MindooDBAppSignStatementResult, c4 as MindooDBAppStorageApi, c5 as MindooDBAppTextEdit, c6 as MindooDBAppTextPatch, c7 as MindooDBAppThemeMode, c8 as MindooDBAppTimestampApi, c9 as MindooDBAppTimestampInput, ca as MindooDBAppTimestampProvider, cb as MindooDBAppTimestampResult, cc as MindooDBAppUiPreferences, cd as MindooDBAppUpdateDocumentInput, ce as MindooDBAppViewCursorDocumentListResult, cf as MindooDBAppViewCursorResult, cg as MindooDBAppViewEntry, ch as MindooDBAppViewEntryKind, ci as MindooDBAppViewNavigator, cj as MindooDBAppViewNavigatorExpansionState, ck as MindooDBAppViewNavigatorOpenOptions, cl as MindooDBAppViewNavigatorPageOptions, cm as MindooDBAppViewNavigatorPageResult, cn as MindooDBAppViewNavigatorRangeQuery, co as MindooDBAppViewNavigatorSelectionState, cp as MindooDBAppViewUpdateStats, cq as MindooDBAppViewport, cr as MindooDBAppWellKnownDragType, cs as MindooDBAppWritableAttachmentStream, ct as resolveMindooDBAppDefinitionUrl, cu as validateMindooDBAppDefinition } from './types-C2WDj-Tv.js';
|
|
3
3
|
export { M as MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME, a as MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME, b as MINDOODB_APP_BUNDLE_MANIFEST_FORMAT, c as MINDOODB_APP_BUNDLE_MANIFEST_VERSION, d as MindooDBAppBundleArchive, e as MindooDBAppBundleFileEntry, f as MindooDBAppBundleHash, g as MindooDBAppBundleManifest, h as MindooDBAppBundleManifestValidation, i as buildMindooDBAppBundleContentHashInput, j as isMindooDBAppBundleHash, n as normalizeMindooDBAppBundlePath, v as validateMindooDBAppBundleManifest } from './appBundleManifest-B0xfpaXG.js';
|
|
4
4
|
import { MindooDBAppBooleanExpression } from 'mindoodb-view-language';
|
|
5
5
|
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';
|
|
@@ -69,6 +69,11 @@ declare class MindooDBAppDragInputError extends Error {
|
|
|
69
69
|
declare function isMindooDBAppDragType(type: string): boolean;
|
|
70
70
|
/** Project and validate the `accepts` list sent with `drag.setProfile`. */
|
|
71
71
|
declare function normalizeDragAccepts(value: unknown): string[];
|
|
72
|
+
/** Project iframe-local pointer coordinates sent after `drag.start`. */
|
|
73
|
+
declare function normalizeDragPointerInput(value: unknown): {
|
|
74
|
+
x: number;
|
|
75
|
+
y: number;
|
|
76
|
+
};
|
|
72
77
|
/** Project and validate a `drag.start` payload. */
|
|
73
78
|
declare function normalizeDragStartInput(value: unknown): MindooDBAppDragStartInput;
|
|
74
79
|
/**
|
|
@@ -80,7 +85,11 @@ declare function snapshotElementToPng(element: HTMLElement): Promise<MindooDBApp
|
|
|
80
85
|
* Start a host drag from a pointer gesture. Mouse/pen use a move threshold;
|
|
81
86
|
* touch waits for a long-press so lists can still scroll.
|
|
82
87
|
*/
|
|
83
|
-
|
|
88
|
+
type MindooDBAppDragPointerFollow = {
|
|
89
|
+
move: (x: number, y: number) => void;
|
|
90
|
+
release: (x: number, y: number) => void;
|
|
91
|
+
};
|
|
92
|
+
declare function bindDragSource(element: HTMLElement, options: MindooDBAppDragBindSourceOptions, start: (input: MindooDBAppDragStartInput) => Promise<MindooDBAppDragStartResult>, follow?: MindooDBAppDragPointerFollow): () => void;
|
|
84
93
|
|
|
85
94
|
/**
|
|
86
95
|
* Drops memoised sessions so the next `connect()` performs a fresh handshake.
|
|
@@ -357,4 +366,4 @@ declare function createMindooDBTextBuffer(options: CreateMindooDBTextBufferOptio
|
|
|
357
366
|
*/
|
|
358
367
|
declare function queryDocuments(db: Pick<MindooDB, "query">, filter: MindooDBAppBooleanExpression | string, sortBy?: MindooQuerySortKey[], options?: MindooQueryOptions): Promise<MindooQueryResult>;
|
|
359
368
|
|
|
360
|
-
export { type CreateMindooDBRichTextHandleOptions, type CreateMindooDBTextBufferOptions, DEFAULT_DRAG_LONG_PRESS_MS, DEFAULT_DRAG_POINTER_THRESHOLD_PX, DEFAULT_HAVEN_HOST_SHORTCUTS, type HavenStorageShimHandle, type InstallHavenStorageShimOptions, MINDOODB_APP_HOSTING_QUERY_PARAM, MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES, MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES, MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE, MINDOODB_APP_MAX_DRAG_TYPES, MINIMAL_DRAG_PREVIEW_PNG, MindooDBAppAttachmentPreviewMode, MindooDBAppBridge, MindooDBAppDatabase, MindooDBAppDocument, MindooDBAppDragBindSourceOptions, MindooDBAppDragInputError, MindooDBAppDragPreview, MindooDBAppDragStartInput, MindooDBAppDragStartResult, MindooDBAppHostShortcutAction, MindooDBAppHostShortcutBinding, MindooDBAppHostingMode, MindooDBAppRichTextSnapshot, MindooDBAppRichTextSpan, MindooDBRichTextHandle, type MindooDBRichTextHandleChangeListener, type MindooDBRichTextHandleFlushResult, MindooDBTextBuffer, type MindooDBTextBufferFlushResult, abbreviateCanonicalName, applyHostedDocumentOverscrollContain, bindDragSource, canPreviewAttachment, createMindooDBAppBridge, createMindooDBRichTextHandle, createMindooDBTextBuffer, expandAbbreviatedName, installHavenStorageShim, installHostShortcutCapture, isHostShortcutAction, isHostedBundleRuntime, isMindooDBAppDragType, matchHostShortcut, normalizeDragAccepts, normalizeDragStartInput, queryDocuments, readMindooDBAppHostingMode, releaseMindooDBAppBridgeSessions, sanitizeHostShortcutBindings, snapshotElementToPng };
|
|
369
|
+
export { type CreateMindooDBRichTextHandleOptions, type CreateMindooDBTextBufferOptions, DEFAULT_DRAG_LONG_PRESS_MS, DEFAULT_DRAG_POINTER_THRESHOLD_PX, DEFAULT_HAVEN_HOST_SHORTCUTS, type HavenStorageShimHandle, type InstallHavenStorageShimOptions, MINDOODB_APP_HOSTING_QUERY_PARAM, MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES, MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES, MINDOODB_APP_MAX_DRAG_PREVIEW_EDGE, MINDOODB_APP_MAX_DRAG_TYPES, MINIMAL_DRAG_PREVIEW_PNG, MindooDBAppAttachmentPreviewMode, MindooDBAppBridge, MindooDBAppDatabase, MindooDBAppDocument, MindooDBAppDragBindSourceOptions, MindooDBAppDragInputError, MindooDBAppDragPreview, MindooDBAppDragStartInput, MindooDBAppDragStartResult, MindooDBAppHostShortcutAction, MindooDBAppHostShortcutBinding, MindooDBAppHostingMode, MindooDBAppRichTextSnapshot, MindooDBAppRichTextSpan, MindooDBRichTextHandle, type MindooDBRichTextHandleChangeListener, type MindooDBRichTextHandleFlushResult, MindooDBTextBuffer, type MindooDBTextBufferFlushResult, abbreviateCanonicalName, applyHostedDocumentOverscrollContain, bindDragSource, canPreviewAttachment, createMindooDBAppBridge, createMindooDBRichTextHandle, createMindooDBTextBuffer, expandAbbreviatedName, installHavenStorageShim, installHostShortcutCapture, isHostShortcutAction, isHostedBundleRuntime, isMindooDBAppDragType, matchHostShortcut, normalizeDragAccepts, normalizeDragPointerInput, normalizeDragStartInput, queryDocuments, readMindooDBAppHostingMode, releaseMindooDBAppBridgeSessions, sanitizeHostShortcutBindings, snapshotElementToPng };
|
package/dist/index.js
CHANGED
|
@@ -16,11 +16,12 @@ import {
|
|
|
16
16
|
isMindooDBAppDragType,
|
|
17
17
|
matchHostShortcut,
|
|
18
18
|
normalizeDragAccepts,
|
|
19
|
+
normalizeDragPointerInput,
|
|
19
20
|
normalizeDragStartInput,
|
|
20
21
|
releaseMindooDBAppBridgeSessions,
|
|
21
22
|
sanitizeHostShortcutBindings,
|
|
22
23
|
snapshotElementToPng
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-D662SK2G.js";
|
|
24
25
|
import {
|
|
25
26
|
MINDOODB_APP_BUNDLE_ARCHIVE_FILE_NAME,
|
|
26
27
|
MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME,
|
|
@@ -41,6 +42,265 @@ var MINDOODB_APP_WELL_KNOWN_DRAG_TYPES = [
|
|
|
41
42
|
];
|
|
42
43
|
var MINDOODB_APP_SEAL_SIGNING_DOMAIN = "mindoodb-seal/v1";
|
|
43
44
|
|
|
45
|
+
// src/appDefinition.ts
|
|
46
|
+
var MINDOODB_APP_DEFINITION_FORMAT = "mindoodb.haven.app";
|
|
47
|
+
var MINDOODB_APP_DEFINITION_VERSION = 1;
|
|
48
|
+
var MINDOODB_APP_DEFINITION_FILE_NAME = "haven-app.json";
|
|
49
|
+
var MINDOODB_APP_DEFINITION_PERMISSIONS = [
|
|
50
|
+
"write",
|
|
51
|
+
"delete",
|
|
52
|
+
"history",
|
|
53
|
+
"attachments",
|
|
54
|
+
"views",
|
|
55
|
+
"sign",
|
|
56
|
+
"timestamps",
|
|
57
|
+
"directory",
|
|
58
|
+
"sealedchannel",
|
|
59
|
+
"proposeapps"
|
|
60
|
+
];
|
|
61
|
+
var MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS = ["proposeapps"];
|
|
62
|
+
var LOGICAL_DATABASE_ID_PATTERN = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
63
|
+
function isPlainObject(value) {
|
|
64
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
65
|
+
}
|
|
66
|
+
function readOptionalString(raw, key, errors) {
|
|
67
|
+
const value = raw[key];
|
|
68
|
+
if (value === void 0 || value === null) {
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
if (typeof value !== "string") {
|
|
72
|
+
errors.push(`App definition ${key} must be a string.`);
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
const trimmed = value.trim();
|
|
76
|
+
return trimmed || void 0;
|
|
77
|
+
}
|
|
78
|
+
function readOptionalBoolean(raw, key, errors) {
|
|
79
|
+
const value = raw[key];
|
|
80
|
+
if (value === void 0 || value === null) {
|
|
81
|
+
return void 0;
|
|
82
|
+
}
|
|
83
|
+
if (typeof value !== "boolean") {
|
|
84
|
+
errors.push(`App definition ${key} must be a boolean.`);
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
return value || void 0;
|
|
88
|
+
}
|
|
89
|
+
function readStringRecord(raw, key, errors) {
|
|
90
|
+
const value = raw[key];
|
|
91
|
+
if (value === void 0 || value === null) {
|
|
92
|
+
return void 0;
|
|
93
|
+
}
|
|
94
|
+
if (!isPlainObject(value)) {
|
|
95
|
+
errors.push(`App definition ${key} must be an object of string values.`);
|
|
96
|
+
return void 0;
|
|
97
|
+
}
|
|
98
|
+
const result = {};
|
|
99
|
+
for (const [entryKey, entryValue] of Object.entries(value)) {
|
|
100
|
+
if (typeof entryValue !== "string") {
|
|
101
|
+
errors.push(`App definition ${key}.${entryKey} must be a string.`);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
result[entryKey] = entryValue;
|
|
105
|
+
}
|
|
106
|
+
return Object.keys(result).length ? result : void 0;
|
|
107
|
+
}
|
|
108
|
+
function readPermissions(value, label, allowed, errors) {
|
|
109
|
+
if (value === void 0 || value === null) {
|
|
110
|
+
return void 0;
|
|
111
|
+
}
|
|
112
|
+
if (!Array.isArray(value)) {
|
|
113
|
+
errors.push(`${label} must be an array of permission names.`);
|
|
114
|
+
return void 0;
|
|
115
|
+
}
|
|
116
|
+
const result = [];
|
|
117
|
+
for (const entry of value) {
|
|
118
|
+
if (typeof entry !== "string" || !allowed.includes(entry)) {
|
|
119
|
+
errors.push(`${label} contains the unknown permission ${JSON.stringify(entry)}.`);
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (!result.includes(entry)) {
|
|
123
|
+
result.push(entry);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return result.length ? result : void 0;
|
|
127
|
+
}
|
|
128
|
+
function readNetworkAllowlist(value, errors) {
|
|
129
|
+
if (value === void 0 || value === null) {
|
|
130
|
+
return void 0;
|
|
131
|
+
}
|
|
132
|
+
if (!Array.isArray(value)) {
|
|
133
|
+
errors.push("App definition networkAllowlist must be an array of origins.");
|
|
134
|
+
return void 0;
|
|
135
|
+
}
|
|
136
|
+
const result = [];
|
|
137
|
+
for (const entry of value) {
|
|
138
|
+
if (typeof entry !== "string" || !entry.trim()) {
|
|
139
|
+
errors.push(`App definition networkAllowlist contains the invalid entry ${JSON.stringify(entry)}.`);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const trimmed = entry.trim();
|
|
143
|
+
if (!result.includes(trimmed)) {
|
|
144
|
+
result.push(trimmed);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return result.length ? result : void 0;
|
|
148
|
+
}
|
|
149
|
+
function readDatabases(value, errors) {
|
|
150
|
+
if (value === void 0 || value === null) {
|
|
151
|
+
return void 0;
|
|
152
|
+
}
|
|
153
|
+
if (!Array.isArray(value)) {
|
|
154
|
+
errors.push("App definition databases must be an array.");
|
|
155
|
+
return void 0;
|
|
156
|
+
}
|
|
157
|
+
const result = [];
|
|
158
|
+
const seen = /* @__PURE__ */ new Set();
|
|
159
|
+
value.forEach((entry, index) => {
|
|
160
|
+
if (!isPlainObject(entry)) {
|
|
161
|
+
errors.push(`App definition database #${index} must be an object.`);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const logicalDatabaseId = typeof entry.logicalDatabaseId === "string" ? entry.logicalDatabaseId.trim() : "";
|
|
165
|
+
if (!logicalDatabaseId) {
|
|
166
|
+
errors.push(`App definition database #${index} is missing a non-empty logicalDatabaseId.`);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (!LOGICAL_DATABASE_ID_PATTERN.test(logicalDatabaseId)) {
|
|
170
|
+
errors.push(
|
|
171
|
+
`App definition database "${logicalDatabaseId}" must match ${String(LOGICAL_DATABASE_ID_PATTERN)}.`
|
|
172
|
+
);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (seen.has(logicalDatabaseId)) {
|
|
176
|
+
errors.push(`App definition lists the database "${logicalDatabaseId}" more than once.`);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
seen.add(logicalDatabaseId);
|
|
180
|
+
const databaseId = typeof entry.databaseId === "string" ? entry.databaseId.trim() : "";
|
|
181
|
+
if (entry.databaseId !== void 0 && entry.databaseId !== null && !databaseId) {
|
|
182
|
+
errors.push(`App definition database "${logicalDatabaseId}" has an empty databaseId.`);
|
|
183
|
+
}
|
|
184
|
+
result.push({
|
|
185
|
+
logicalDatabaseId,
|
|
186
|
+
label: typeof entry.label === "string" && entry.label.trim() ? entry.label.trim() : void 0,
|
|
187
|
+
databaseId: databaseId || void 0,
|
|
188
|
+
permissions: readPermissions(
|
|
189
|
+
entry.permissions,
|
|
190
|
+
`App definition database "${logicalDatabaseId}" permissions`,
|
|
191
|
+
MINDOODB_APP_DEFINITION_PERMISSIONS.filter(
|
|
192
|
+
(permission) => !MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS.includes(permission)
|
|
193
|
+
),
|
|
194
|
+
errors
|
|
195
|
+
),
|
|
196
|
+
create: entry.create === false ? false : void 0
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
return result.length ? result : void 0;
|
|
200
|
+
}
|
|
201
|
+
function validateMindooDBAppDefinition(raw) {
|
|
202
|
+
const errors = [];
|
|
203
|
+
if (!isPlainObject(raw)) {
|
|
204
|
+
return { definition: null, errors: ["App definition must be a JSON object."] };
|
|
205
|
+
}
|
|
206
|
+
if (raw.format !== MINDOODB_APP_DEFINITION_FORMAT) {
|
|
207
|
+
errors.push(
|
|
208
|
+
`App definition format must be "${MINDOODB_APP_DEFINITION_FORMAT}", received ${JSON.stringify(raw.format)}.`
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
if (raw.formatVersion !== MINDOODB_APP_DEFINITION_VERSION) {
|
|
212
|
+
errors.push(
|
|
213
|
+
`Unsupported app definition version ${JSON.stringify(raw.formatVersion)}, expected ${MINDOODB_APP_DEFINITION_VERSION}.`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
const appId = typeof raw.appId === "string" ? raw.appId.trim() : "";
|
|
217
|
+
if (!appId) {
|
|
218
|
+
errors.push("App definition is missing a non-empty appId.");
|
|
219
|
+
}
|
|
220
|
+
const label = typeof raw.label === "string" ? raw.label.trim() : "";
|
|
221
|
+
if (!label) {
|
|
222
|
+
errors.push("App definition is missing a non-empty label.");
|
|
223
|
+
}
|
|
224
|
+
const runtime = raw.runtime;
|
|
225
|
+
if (runtime !== void 0 && runtime !== "iframe" && runtime !== "window") {
|
|
226
|
+
errors.push(`App definition runtime must be "iframe" or "window", received ${JSON.stringify(runtime)}.`);
|
|
227
|
+
}
|
|
228
|
+
const hosting = raw.hosting;
|
|
229
|
+
if (hosting !== void 0 && hosting !== "external" && hosting !== "hosted") {
|
|
230
|
+
errors.push(
|
|
231
|
+
`App definition hosting must be "external" or "hosted", received ${JSON.stringify(hosting)}.`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
const description = readOptionalString(raw, "description", errors);
|
|
235
|
+
const version = readOptionalString(raw, "version", errors);
|
|
236
|
+
const defaultLaunchDatabaseId = readOptionalString(raw, "defaultLaunchDatabaseId", errors);
|
|
237
|
+
const networkAllowlist = readNetworkAllowlist(raw.networkAllowlist, errors);
|
|
238
|
+
const launchParameters = readStringRecord(raw, "launchParameters", errors);
|
|
239
|
+
const databases = readDatabases(raw.databases, errors);
|
|
240
|
+
const permissions = readPermissions(
|
|
241
|
+
raw.permissions,
|
|
242
|
+
"App definition permissions",
|
|
243
|
+
MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS,
|
|
244
|
+
errors
|
|
245
|
+
);
|
|
246
|
+
const allowPopups = readOptionalBoolean(raw, "allowPopups", errors);
|
|
247
|
+
const allowCamera = readOptionalBoolean(raw, "allowCamera", errors);
|
|
248
|
+
const allowMicrophone = readOptionalBoolean(raw, "allowMicrophone", errors);
|
|
249
|
+
const allowGeolocation = readOptionalBoolean(raw, "allowGeolocation", errors);
|
|
250
|
+
const allowWebRtc = readOptionalBoolean(raw, "allowWebRtc", errors);
|
|
251
|
+
const allowWorkers = readOptionalBoolean(raw, "allowWorkers", errors);
|
|
252
|
+
if (defaultLaunchDatabaseId && databases && !databases.some((database) => database.logicalDatabaseId === defaultLaunchDatabaseId)) {
|
|
253
|
+
errors.push(
|
|
254
|
+
`App definition defaultLaunchDatabaseId "${defaultLaunchDatabaseId}" is not one of the declared databases.`
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
if (errors.length) {
|
|
258
|
+
return { definition: null, errors };
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
definition: {
|
|
262
|
+
format: MINDOODB_APP_DEFINITION_FORMAT,
|
|
263
|
+
formatVersion: MINDOODB_APP_DEFINITION_VERSION,
|
|
264
|
+
appId,
|
|
265
|
+
label,
|
|
266
|
+
description,
|
|
267
|
+
version,
|
|
268
|
+
runtime,
|
|
269
|
+
hosting,
|
|
270
|
+
networkAllowlist,
|
|
271
|
+
allowPopups,
|
|
272
|
+
allowCamera,
|
|
273
|
+
allowMicrophone,
|
|
274
|
+
allowGeolocation,
|
|
275
|
+
allowWebRtc,
|
|
276
|
+
allowWorkers,
|
|
277
|
+
permissions,
|
|
278
|
+
launchParameters,
|
|
279
|
+
defaultLaunchDatabaseId,
|
|
280
|
+
databases
|
|
281
|
+
},
|
|
282
|
+
errors: []
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function resolveMindooDBAppDefinitionUrl(baseUrl) {
|
|
286
|
+
const trimmed = baseUrl.trim();
|
|
287
|
+
if (!trimmed) {
|
|
288
|
+
return "";
|
|
289
|
+
}
|
|
290
|
+
const suffix = `/${MINDOODB_APP_DEFINITION_FILE_NAME}`;
|
|
291
|
+
try {
|
|
292
|
+
const url = new URL(trimmed);
|
|
293
|
+
const path = url.pathname.replace(/\/+$/, "") || "/";
|
|
294
|
+
url.search = "";
|
|
295
|
+
url.hash = "";
|
|
296
|
+
url.pathname = path.endsWith(suffix) || path === suffix ? path : `${path === "/" ? "" : path}${suffix}`;
|
|
297
|
+
return url.toString();
|
|
298
|
+
} catch {
|
|
299
|
+
const withoutSlash = trimmed.replace(/\/+$/, "");
|
|
300
|
+
return withoutSlash.toLowerCase().endsWith(suffix) ? withoutSlash : `${withoutSlash}${suffix}`;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
44
304
|
// src/attachmentPreview.ts
|
|
45
305
|
function canPreviewAttachment(fileName, mimeType) {
|
|
46
306
|
const normalizedMimeType = mimeType.toLowerCase();
|
|
@@ -779,6 +1039,11 @@ export {
|
|
|
779
1039
|
MINDOODB_APP_BUNDLE_MANIFEST_FILE_NAME,
|
|
780
1040
|
MINDOODB_APP_BUNDLE_MANIFEST_FORMAT,
|
|
781
1041
|
MINDOODB_APP_BUNDLE_MANIFEST_VERSION,
|
|
1042
|
+
MINDOODB_APP_DEFINITION_FILE_NAME,
|
|
1043
|
+
MINDOODB_APP_DEFINITION_FORMAT,
|
|
1044
|
+
MINDOODB_APP_DEFINITION_PERMISSIONS,
|
|
1045
|
+
MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS,
|
|
1046
|
+
MINDOODB_APP_DEFINITION_VERSION,
|
|
782
1047
|
MINDOODB_APP_HOSTING_QUERY_PARAM,
|
|
783
1048
|
MINDOODB_APP_MAX_DRAG_PAYLOAD_BYTES,
|
|
784
1049
|
MINDOODB_APP_MAX_DRAG_PREVIEW_BYTES,
|
|
@@ -808,12 +1073,15 @@ export {
|
|
|
808
1073
|
isMindooDBAppDragType,
|
|
809
1074
|
matchHostShortcut,
|
|
810
1075
|
normalizeDragAccepts,
|
|
1076
|
+
normalizeDragPointerInput,
|
|
811
1077
|
normalizeDragStartInput,
|
|
812
1078
|
normalizeMindooDBAppBundlePath,
|
|
813
1079
|
queryDocuments,
|
|
814
1080
|
readMindooDBAppHostingMode,
|
|
815
1081
|
releaseMindooDBAppBridgeSessions,
|
|
1082
|
+
resolveMindooDBAppDefinitionUrl,
|
|
816
1083
|
sanitizeHostShortcutBindings,
|
|
817
1084
|
snapshotElementToPng,
|
|
818
|
-
validateMindooDBAppBundleManifest
|
|
1085
|
+
validateMindooDBAppBundleManifest,
|
|
1086
|
+
validateMindooDBAppDefinition
|
|
819
1087
|
};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { as as MindooDBAppCreateViewNavigatorInput, ci as MindooDBAppViewNavigator, bd as MindooDBAppLaunchContext, at as MindooDBAppDatabaseInfo, aB as MindooDBAppDocumentApi, ck as MindooDBAppViewNavigatorOpenOptions, v as MindooDBAppAttachmentApi, b1 as MindooDBAppIdentityApi, c8 as MindooDBAppTimestampApi, az as MindooDBAppDirectoryApi, j as MindooDBAppDocument, aZ as MindooDBAppFulltextSetup, aY as MindooDBAppExtractionSetup, bs as MindooDBAppProposeAppInput, bt as MindooDBAppProposeAppResult, e as MindooDBAppBridge, bZ as MindooDBAppSession, V as MindooDBAppBridgeRpcRequest, b0 as MindooDBAppHostTheme, cq as MindooDBAppViewport, cc as MindooDBAppUiPreferences, bv as MindooDBAppQueryResult, cp as MindooDBAppViewUpdateStats, R as MindooDBAppBridgePortMessage, c as MindooDBAppDragStartResult, aS as MindooDBAppDragProfile } from '../types-C2WDj-Tv.js';
|
|
2
2
|
import * as mindoodb from 'mindoodb';
|
|
3
3
|
import 'mindoodb-view-language';
|
|
4
4
|
|
|
@@ -98,6 +98,11 @@ interface CreateMockMindooDBAppSessionOptions {
|
|
|
98
98
|
databases?: MockMindooDBAppDatabaseDefinition[];
|
|
99
99
|
onDisconnect?: () => MaybePromise<void>;
|
|
100
100
|
sealedChannel?: MockSealedChannelOptions;
|
|
101
|
+
/**
|
|
102
|
+
* Answer for `session.proposeApp`, standing in for the user's decision in the
|
|
103
|
+
* real host's consent dialog. Omitted means declined.
|
|
104
|
+
*/
|
|
105
|
+
proposeApp?: (input: MindooDBAppProposeAppInput) => MindooDBAppProposeAppResult;
|
|
101
106
|
/** Initial contents of `session.storage`. */
|
|
102
107
|
storage?: Record<string, string>;
|
|
103
108
|
}
|
|
@@ -107,6 +112,8 @@ interface MockMindooDBAppSessionController {
|
|
|
107
112
|
getLaunchContext(): MindooDBAppLaunchContext;
|
|
108
113
|
setLaunchContext(patch?: Partial<MindooDBAppLaunchContext>): MindooDBAppLaunchContext;
|
|
109
114
|
getLicensedProducts(): string[];
|
|
115
|
+
/** Every `proposeApp` call the app under test made, in order. */
|
|
116
|
+
proposedApps: MindooDBAppProposeAppInput[];
|
|
110
117
|
listDatabases(): MindooDBAppDatabaseInfo[];
|
|
111
118
|
setDatabases(definitions: MockMindooDBAppDatabaseDefinition[]): void;
|
|
112
119
|
emitThemeChange(theme: MindooDBAppHostTheme): void;
|
|
@@ -140,6 +147,8 @@ interface FakeBridgeHostController {
|
|
|
140
147
|
session: MindooDBAppSession;
|
|
141
148
|
readonly launchId: string;
|
|
142
149
|
readonly requests: ReadonlyArray<MindooDBAppBridgeRpcRequest>;
|
|
150
|
+
/** Every `apps.propose` call the app under test made, in order. */
|
|
151
|
+
readonly proposedApps: ReadonlyArray<MindooDBAppProposeAppInput>;
|
|
143
152
|
install(): void;
|
|
144
153
|
dispose(): void;
|
|
145
154
|
emitThemeChange(theme: MindooDBAppHostTheme): void;
|
package/dist/testing/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
releaseMindooDBAppBridgeSessions
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-D662SK2G.js";
|
|
4
4
|
|
|
5
5
|
// src/testing/index.ts
|
|
6
6
|
import * as Automerge from "@automerge/automerge";
|
|
@@ -679,6 +679,7 @@ function mergeLaunchContext(current, patch) {
|
|
|
679
679
|
viewport: current.viewport ? { ...current.viewport } : null,
|
|
680
680
|
uiPreferences: { ...current.uiPreferences },
|
|
681
681
|
user: { ...current.user },
|
|
682
|
+
appPermissions: [...current.appPermissions ?? []],
|
|
682
683
|
launchParameters: { ...current.launchParameters },
|
|
683
684
|
databases: current.databases.map((database) => ({
|
|
684
685
|
...database,
|
|
@@ -712,6 +713,7 @@ function mergeLaunchContext(current, patch) {
|
|
|
712
713
|
viewport: patch.viewport === void 0 ? current.viewport ? { ...current.viewport } : null : patch.viewport ? { ...patch.viewport } : null,
|
|
713
714
|
uiPreferences: patch.uiPreferences ? { ...current.uiPreferences, ...patch.uiPreferences } : { ...current.uiPreferences },
|
|
714
715
|
user: patch.user ? { ...current.user, ...patch.user } : { ...current.user },
|
|
716
|
+
appPermissions: [...patch.appPermissions ?? current.appPermissions ?? []],
|
|
715
717
|
launchParameters: patch.launchParameters ? { ...current.launchParameters, ...patch.launchParameters } : { ...current.launchParameters },
|
|
716
718
|
databases: patch.databases ? patch.databases.map((database) => ({
|
|
717
719
|
...database,
|
|
@@ -785,6 +787,7 @@ function createDefaultLaunchContext(patch) {
|
|
|
785
787
|
username: "Test User"
|
|
786
788
|
},
|
|
787
789
|
licensedProducts: [],
|
|
790
|
+
appPermissions: [],
|
|
788
791
|
launchParameters: {},
|
|
789
792
|
databases: [],
|
|
790
793
|
views: []
|
|
@@ -1861,6 +1864,7 @@ function createMockSessionState(options = {}) {
|
|
|
1861
1864
|
let dragProfile = null;
|
|
1862
1865
|
let databaseInfos = [];
|
|
1863
1866
|
const openSealedChannels = /* @__PURE__ */ new Map();
|
|
1867
|
+
const proposedApps = [];
|
|
1864
1868
|
const appStorage = new Map(Object.entries(options.storage ?? {}));
|
|
1865
1869
|
const requireCapability = (databaseId, capability) => {
|
|
1866
1870
|
const info = databaseInfos.find((entry) => entry.id === databaseId);
|
|
@@ -1895,6 +1899,10 @@ function createMockSessionState(options = {}) {
|
|
|
1895
1899
|
});
|
|
1896
1900
|
activeDragResolve = null;
|
|
1897
1901
|
},
|
|
1902
|
+
async reportPointer() {
|
|
1903
|
+
},
|
|
1904
|
+
async release() {
|
|
1905
|
+
},
|
|
1898
1906
|
bindSource() {
|
|
1899
1907
|
return () => void 0;
|
|
1900
1908
|
}
|
|
@@ -1992,6 +2000,11 @@ function createMockSessionState(options = {}) {
|
|
|
1992
2000
|
async getLicensedProducts() {
|
|
1993
2001
|
return [...launchContext.licensedProducts ?? []];
|
|
1994
2002
|
},
|
|
2003
|
+
async proposeApp(input) {
|
|
2004
|
+
proposedApps.push({ ...input });
|
|
2005
|
+
const outcome = options.proposeApp?.(input);
|
|
2006
|
+
return outcome ?? { ok: false, reason: "declined" };
|
|
2007
|
+
},
|
|
1995
2008
|
async listDatabases() {
|
|
1996
2009
|
return databaseInfos.map((entry) => ({
|
|
1997
2010
|
...entry,
|
|
@@ -2149,6 +2162,7 @@ function createMockSessionState(options = {}) {
|
|
|
2149
2162
|
getLicensedProducts() {
|
|
2150
2163
|
return [...launchContext.licensedProducts ?? []];
|
|
2151
2164
|
},
|
|
2165
|
+
proposedApps,
|
|
2152
2166
|
createViewNavigator: session.createViewNavigator,
|
|
2153
2167
|
openViewNavigator: session.openViewNavigator,
|
|
2154
2168
|
bridge,
|
|
@@ -2193,6 +2207,7 @@ function createMockMindooDBAppSession(options = {}) {
|
|
|
2193
2207
|
getLaunchContext: state.getLaunchContext,
|
|
2194
2208
|
setLaunchContext: state.setLaunchContext,
|
|
2195
2209
|
getLicensedProducts: state.getLicensedProducts,
|
|
2210
|
+
proposedApps: state.proposedApps,
|
|
2196
2211
|
listDatabases: state.listDatabaseInfos,
|
|
2197
2212
|
setDatabases: state.setDatabases,
|
|
2198
2213
|
emitThemeChange: state.emitThemeChange,
|
|
@@ -2417,6 +2432,8 @@ function createFakeBridgeHost(options = {}) {
|
|
|
2417
2432
|
case "sealedChannel.close":
|
|
2418
2433
|
await state.session.closeSealedChannel(String(params.channelId));
|
|
2419
2434
|
return { ok: true };
|
|
2435
|
+
case "apps.propose":
|
|
2436
|
+
return await state.session.proposeApp(params);
|
|
2420
2437
|
case "documents.list":
|
|
2421
2438
|
return await state.getDatabase(String(params.databaseId)).documents.list(
|
|
2422
2439
|
params.query
|
|
@@ -2911,6 +2928,9 @@ function createFakeBridgeHost(options = {}) {
|
|
|
2911
2928
|
get requests() {
|
|
2912
2929
|
return requests;
|
|
2913
2930
|
},
|
|
2931
|
+
get proposedApps() {
|
|
2932
|
+
return state.proposedApps;
|
|
2933
|
+
},
|
|
2914
2934
|
install,
|
|
2915
2935
|
dispose() {
|
|
2916
2936
|
restoreWindow();
|
|
@@ -1,5 +1,117 @@
|
|
|
1
1
|
import { MindooDBAppBooleanExpression, MindooDBAppExpression, MindooDBAppViewSortDirection, MindooDBAppViewTotalMode, MindooDBAppViewDefinition } from 'mindoodb-view-language';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Shared description of a deployed application, served by the app itself from its own
|
|
5
|
+
* origin as `haven-app.json`.
|
|
6
|
+
*
|
|
7
|
+
* This is the publisher contract: one URL is enough to install an app. Haven fetches
|
|
8
|
+
* this file, shows the user what it asks for, and turns it into an app registration —
|
|
9
|
+
* label, permissions, and the databases the app needs.
|
|
10
|
+
*
|
|
11
|
+
* The definition deliberately carries no tenant ids, no physical database targets, and
|
|
12
|
+
* no identity: those belong to the installing Haven, not to the publisher. A publisher
|
|
13
|
+
* names a *logical* database ("notes") and may suggest a physical id; Haven decides
|
|
14
|
+
* which tenant it lands in.
|
|
15
|
+
*
|
|
16
|
+
* Note for maintainers: Haven validates `haven-app.json` with its own copy of these
|
|
17
|
+
* rules (`features/apps/lib/appDefinition.ts`) because a Haven release runs against a
|
|
18
|
+
* published SDK version, not the workspace source. Both sides must stay wire
|
|
19
|
+
* compatible; add fields as optional and never repurpose an existing name.
|
|
20
|
+
*/
|
|
21
|
+
declare const MINDOODB_APP_DEFINITION_FORMAT = "mindoodb.haven.app";
|
|
22
|
+
declare const MINDOODB_APP_DEFINITION_VERSION = 1;
|
|
23
|
+
declare const MINDOODB_APP_DEFINITION_FILE_NAME = "haven-app.json";
|
|
24
|
+
/**
|
|
25
|
+
* Permissions a publisher may request. `read` is not listed because it is implied by a
|
|
26
|
+
* database mapping existing at all.
|
|
27
|
+
*
|
|
28
|
+
* `sign` and `proposeapps` grant only the right to *ask*: Haven still runs a consent
|
|
29
|
+
* dialog for every signature and every proposed app.
|
|
30
|
+
*/
|
|
31
|
+
declare const MINDOODB_APP_DEFINITION_PERMISSIONS: readonly ["write", "delete", "history", "attachments", "views", "sign", "timestamps", "directory", "sealedchannel", "proposeapps"];
|
|
32
|
+
type MindooDBAppDefinitionPermission = (typeof MINDOODB_APP_DEFINITION_PERMISSIONS)[number];
|
|
33
|
+
/** Permissions that are properties of the app as a whole, not of one database. */
|
|
34
|
+
declare const MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS: readonly ["proposeapps"];
|
|
35
|
+
type MindooDBAppDefinitionRegistrationPermission = (typeof MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS)[number];
|
|
36
|
+
interface MindooDBAppDefinitionDatabase {
|
|
37
|
+
/**
|
|
38
|
+
* The id the app passes to `session.openDatabase()`. Stable part of the app's own
|
|
39
|
+
* source code, independent of where the data physically lives.
|
|
40
|
+
*/
|
|
41
|
+
logicalDatabaseId: string;
|
|
42
|
+
/** Shown to the user during install. Defaults to `logicalDatabaseId`. */
|
|
43
|
+
label?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Suggested physical database id. Haven may substitute a different one; the app must
|
|
46
|
+
* never assume this value and always address the database by `logicalDatabaseId`.
|
|
47
|
+
*/
|
|
48
|
+
databaseId?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Requested per-database permissions. Registration-level permissions
|
|
51
|
+
* (see {@link MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS}) do not belong here.
|
|
52
|
+
*/
|
|
53
|
+
permissions?: MindooDBAppDefinitionPermission[];
|
|
54
|
+
/**
|
|
55
|
+
* Whether Haven should create the database during install when it does not
|
|
56
|
+
* exist yet. Defaults to `true`, because an app that declares a database
|
|
57
|
+
* needs it to start. Set `false` for a database the app only joins if the
|
|
58
|
+
* user already has it.
|
|
59
|
+
*/
|
|
60
|
+
create?: boolean;
|
|
61
|
+
}
|
|
62
|
+
interface MindooDBAppDefinition {
|
|
63
|
+
format: typeof MINDOODB_APP_DEFINITION_FORMAT;
|
|
64
|
+
formatVersion: number;
|
|
65
|
+
/** Stable publisher-side identifier, e.g. `mindoodb-app-builder`. */
|
|
66
|
+
appId: string;
|
|
67
|
+
label: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
/** Human-readable version, shown in the install dialog. */
|
|
70
|
+
version?: string;
|
|
71
|
+
/**
|
|
72
|
+
* How the app wants to be launched. `iframe` is the default and correct for almost
|
|
73
|
+
* every app; `window` exists for apps that cannot run framed.
|
|
74
|
+
*/
|
|
75
|
+
runtime?: "iframe" | "window";
|
|
76
|
+
/**
|
|
77
|
+
* `external` keeps the app live at its own origin. `hosted` asks Haven to download
|
|
78
|
+
* the built assets from `haven-bundle.json` on this same origin and serve them
|
|
79
|
+
* locally, which also works offline.
|
|
80
|
+
*/
|
|
81
|
+
hosting?: "external" | "hosted";
|
|
82
|
+
/** Origins the app needs to reach at runtime. Shown to the user before install. */
|
|
83
|
+
networkAllowlist?: string[];
|
|
84
|
+
allowPopups?: boolean;
|
|
85
|
+
allowCamera?: boolean;
|
|
86
|
+
allowMicrophone?: boolean;
|
|
87
|
+
allowGeolocation?: boolean;
|
|
88
|
+
allowWebRtc?: boolean;
|
|
89
|
+
allowWorkers?: boolean;
|
|
90
|
+
/** Permissions that apply to the app itself rather than to one database. */
|
|
91
|
+
permissions?: MindooDBAppDefinitionRegistrationPermission[];
|
|
92
|
+
/** Static launch parameters the app expects in its launch context. */
|
|
93
|
+
launchParameters?: Record<string, string>;
|
|
94
|
+
/** `logicalDatabaseId` the app should open first. */
|
|
95
|
+
defaultLaunchDatabaseId?: string;
|
|
96
|
+
databases?: MindooDBAppDefinitionDatabase[];
|
|
97
|
+
}
|
|
98
|
+
interface MindooDBAppDefinitionValidation {
|
|
99
|
+
definition: MindooDBAppDefinition | null;
|
|
100
|
+
errors: string[];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Structural validation of a `haven-app.json` payload. Returns the normalized
|
|
104
|
+
* definition, or `null` plus every problem found so a publisher can fix them in one
|
|
105
|
+
* pass instead of one per reload.
|
|
106
|
+
*/
|
|
107
|
+
declare function validateMindooDBAppDefinition(raw: unknown): MindooDBAppDefinitionValidation;
|
|
108
|
+
/**
|
|
109
|
+
* Turns an app origin into the fixed `haven-app.json` path next to `index.html`.
|
|
110
|
+
* A URL that already points at the file is returned unchanged, so a pasted definition
|
|
111
|
+
* URL works as well as a pasted app URL.
|
|
112
|
+
*/
|
|
113
|
+
declare function resolveMindooDBAppDefinitionUrl(baseUrl: string): string;
|
|
114
|
+
|
|
3
115
|
/** Launch target used by the Haven when opening an app. */
|
|
4
116
|
type MindooDBAppRuntime = "iframe" | "window";
|
|
5
117
|
/**
|
|
@@ -151,6 +263,17 @@ interface MindooDBAppLaunchContext {
|
|
|
151
263
|
username: string;
|
|
152
264
|
};
|
|
153
265
|
licensedProducts?: string[];
|
|
266
|
+
/**
|
|
267
|
+
* Permissions granted to the app as a whole rather than to one database — currently
|
|
268
|
+
* only `"proposeapps"`. Read this before offering a feature that needs one: the
|
|
269
|
+
* corresponding bridge call is refused without it, and finding that out after the
|
|
270
|
+
* user has done the work is worse than hiding the button. Per-database permissions
|
|
271
|
+
* live on {@link MindooDBAppDatabaseInfo.capabilities}.
|
|
272
|
+
*
|
|
273
|
+
* Absent on hosts predating this field; treat that as "no registration-level
|
|
274
|
+
* permissions".
|
|
275
|
+
*/
|
|
276
|
+
appPermissions?: MindooDBAppDefinitionRegistrationPermission[];
|
|
154
277
|
launchParameters: Record<string, string>;
|
|
155
278
|
databases: MindooDBAppDatabaseInfo[];
|
|
156
279
|
views: MindooDBAppResolvedViewDefinition[];
|
|
@@ -1144,10 +1267,24 @@ interface MindooDBAppDragApi {
|
|
|
1144
1267
|
start(input: MindooDBAppDragStartInput): Promise<MindooDBAppDragStartResult>;
|
|
1145
1268
|
/** Abort a gesture this app started. */
|
|
1146
1269
|
cancel(): Promise<void>;
|
|
1270
|
+
/**
|
|
1271
|
+
* Forward an iframe-local pointer position after `start`. Required because
|
|
1272
|
+
* the source document keeps the pressed pointer (mouse capture).
|
|
1273
|
+
*/
|
|
1274
|
+
reportPointer(point: {
|
|
1275
|
+
x: number;
|
|
1276
|
+
y: number;
|
|
1277
|
+
}): Promise<void>;
|
|
1278
|
+
/** End the gesture at an iframe-local pointer position. */
|
|
1279
|
+
release(point: {
|
|
1280
|
+
x: number;
|
|
1281
|
+
y: number;
|
|
1282
|
+
}): Promise<void>;
|
|
1147
1283
|
/**
|
|
1148
1284
|
* Pointer helper: mouse/pen starts after a small move; touch starts after
|
|
1149
1285
|
* a long-press. Each element can be bound independently; the returned
|
|
1150
|
-
* function unbinds only that element.
|
|
1286
|
+
* function unbinds only that element. After start, moves and the button-up
|
|
1287
|
+
* stay in this frame and are forwarded to Haven.
|
|
1151
1288
|
*/
|
|
1152
1289
|
bindSource(element: HTMLElement, options: MindooDBAppDragBindSourceOptions): () => void;
|
|
1153
1290
|
}
|
|
@@ -2239,6 +2376,33 @@ interface MindooDBAppStorageApi {
|
|
|
2239
2376
|
prefix?: string;
|
|
2240
2377
|
}): Promise<void>;
|
|
2241
2378
|
}
|
|
2379
|
+
interface MindooDBAppProposeAppInput {
|
|
2380
|
+
/**
|
|
2381
|
+
* Origin of the app to install, or the full `haven-app.json` URL. Haven reads the
|
|
2382
|
+
* definition from there itself.
|
|
2383
|
+
*/
|
|
2384
|
+
url: string;
|
|
2385
|
+
/** Suggested label. The user sees the publisher's own label alongside it. */
|
|
2386
|
+
label?: string;
|
|
2387
|
+
}
|
|
2388
|
+
type MindooDBAppProposeAppResult = {
|
|
2389
|
+
ok: true;
|
|
2390
|
+
/** The app id Haven registered. */
|
|
2391
|
+
appId: string;
|
|
2392
|
+
/** The registration instance id, stable across later updates of this app. */
|
|
2393
|
+
appInstanceId: string;
|
|
2394
|
+
label: string;
|
|
2395
|
+
/**
|
|
2396
|
+
* Non-fatal problems from the install, such as a database that could not be
|
|
2397
|
+
* created. The app is registered; these still need the user's attention.
|
|
2398
|
+
*/
|
|
2399
|
+
warnings: string[];
|
|
2400
|
+
} | {
|
|
2401
|
+
ok: false;
|
|
2402
|
+
/** `declined` — the user said no. `unavailable` — the definition could not be read. */
|
|
2403
|
+
reason: "declined" | "unavailable";
|
|
2404
|
+
message?: string;
|
|
2405
|
+
};
|
|
2242
2406
|
/** Connected session between the running app and the Haven host. */
|
|
2243
2407
|
interface MindooDBAppSession {
|
|
2244
2408
|
/**
|
|
@@ -2309,6 +2473,22 @@ interface MindooDBAppSession {
|
|
|
2309
2473
|
* done.
|
|
2310
2474
|
*/
|
|
2311
2475
|
openViewNavigator(viewId: string, options?: MindooDBAppViewNavigatorOpenOptions): Promise<MindooDBAppViewNavigator>;
|
|
2476
|
+
/**
|
|
2477
|
+
* Ask Haven to install another app from its own origin.
|
|
2478
|
+
*
|
|
2479
|
+
* Requires the registration-level `proposeapps` permission, and even then this
|
|
2480
|
+
* only *asks*: Haven fetches `haven-app.json` from `url` itself, shows the user
|
|
2481
|
+
* the origin, the permissions, the network allowlist and the databases the app
|
|
2482
|
+
* would get, and installs nothing unless they confirm.
|
|
2483
|
+
*
|
|
2484
|
+
* The app passes a URL and nothing else. It cannot supply the definition inline,
|
|
2485
|
+
* choose the tenant, or name a physical database — which is what keeps a proposer
|
|
2486
|
+
* from describing one app and installing another.
|
|
2487
|
+
*
|
|
2488
|
+
* Resolves with `ok: false` when the user declines or the definition could not be
|
|
2489
|
+
* read — ordinary outcomes, not errors.
|
|
2490
|
+
*/
|
|
2491
|
+
proposeApp(input: MindooDBAppProposeAppInput): Promise<MindooDBAppProposeAppResult>;
|
|
2312
2492
|
menus: MindooDBAppMenuApi;
|
|
2313
2493
|
/** Host-owned cross-iframe drag. Iframe-only; copy-only in v1. */
|
|
2314
2494
|
drag: MindooDBAppDragApi;
|
|
@@ -2369,4 +2549,4 @@ interface MindooDBAppBridge {
|
|
|
2369
2549
|
connect(options?: MindooDBAppBridgeConnectOptions): Promise<MindooDBAppSession>;
|
|
2370
2550
|
}
|
|
2371
2551
|
|
|
2372
|
-
export { type
|
|
2552
|
+
export { type MindooDBAppBridgeStreamCloseRequest as $, type MindooDBAppAutomergeChangesPatch as A, type MindooDBAppAutomergeChangesSince as B, type MindooDBAppAutomergeGetOptions as C, type MindooDBAppAutomergePatchResult as D, type MindooDBAppAutomergeSnapshot as E, type MindooDBAppBridgeBeforeCloseAck as F, type MindooDBAppBridgeBeforeCloseMessage as G, type MindooDBAppBridgeConnectMessage as H, type MindooDBAppBridgeConnectOptions as I, type MindooDBAppBridgeConnectedMessage as J, type MindooDBAppBridgeDragDropMessage as K, type MindooDBAppBridgeDragLeaveMessage as L, type MindooDBAppAttachmentPreviewMode as M, type MindooDBAppBridgeDragOverMessage as N, type MindooDBAppBridgeErrorPayload as O, type MindooDBAppBridgeHandshakeErrorMessage as P, type MindooDBAppBridgeLocaleChangedMessage as Q, type MindooDBAppBridgePortMessage as R, type MindooDBAppBridgeQueryResultMessage as S, type MindooDBAppBridgeRpcError as T, type MindooDBAppBridgeRpcMessage as U, type MindooDBAppBridgeRpcRequest as V, type MindooDBAppBridgeRpcSuccess as W, type MindooDBAppBridgeShortcutInvokedMessage as X, type MindooDBAppBridgeShortcutsChangedMessage as Y, type MindooDBAppBridgeStreamAbortRequest as Z, type MindooDBAppBridgeStreamAck as _, type MindooDBAppDragBindSourceOptions as a, type MindooDBAppHistoryQuery as a$, type MindooDBAppBridgeStreamError as a0, type MindooDBAppBridgeStreamMessage as a1, type MindooDBAppBridgeStreamOpenResult as a2, type MindooDBAppBridgeStreamReadRequest as a3, type MindooDBAppBridgeStreamWriteRequest as a4, type MindooDBAppBridgeThemeChangedMessage as a5, type MindooDBAppBridgeUiPreferencesChangedMessage as a6, type MindooDBAppBridgeViewChangedMessage as a7, type MindooDBAppBridgeViewportChangedMessage as a8, type MindooDBAppCapability as a9, 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 MindooDBAppDragApi as aK, type MindooDBAppDragCancelReason as aL, type MindooDBAppDragDropEvent as aM, type MindooDBAppDragEffect as aN, type MindooDBAppDragHoverResult as aO, type MindooDBAppDragOffer as aP, type MindooDBAppDragOverEvent as aQ, type MindooDBAppDragPointer as aR, type MindooDBAppDragProfile as aS, type MindooDBAppEntryAttachmentRef as aT, type MindooDBAppEntryProvenance as aU, type MindooDBAppExtractDocumentTextInput as aV, type MindooDBAppExtractDocumentTextResult as aW, type MindooDBAppExtractTextFormat as aX, type MindooDBAppExtractionSetup as aY, type MindooDBAppFulltextSetup as aZ, type MindooDBAppHistoricalDocument as a_, type MindooDBAppConfiguredViewCategorizationStyle as aa, type MindooDBAppConfiguredViewColumn as ab, type MindooDBAppConfiguredViewColumnRole as ac, type MindooDBAppConfiguredViewExpressionMode as ad, type MindooDBAppConfiguredViewFieldExpression as ae, type MindooDBAppConfiguredViewFilterDefinition as af, type MindooDBAppConfiguredViewFilterMode as ag, type MindooDBAppConfiguredViewFilterRule as ah, type MindooDBAppConfiguredViewFormulaExpression as ai, type MindooDBAppConfiguredViewFormulaFilterDefinition as aj, type MindooDBAppConfiguredViewPreviewMode as ak, type MindooDBAppConfiguredViewRuleFilterDefinition as al, type MindooDBAppConfiguredViewRuleMatchMode as am, type MindooDBAppConfiguredViewRuleOperator as an, type MindooDBAppConfiguredViewValueExpression as ao, type MindooDBAppCreateDocumentInput as ap, type MindooDBAppCreateKeyInfo as aq, type MindooDBAppCreateViewInput as ar, type MindooDBAppCreateViewNavigatorInput as as, type MindooDBAppDatabaseInfo as at, type MindooDBAppDefinition as au, type MindooDBAppDefinitionDatabase as av, type MindooDBAppDefinitionPermission as aw, type MindooDBAppDefinitionRegistrationPermission as ax, type MindooDBAppDefinitionValidation as ay, type MindooDBAppDirectoryApi as az, type MindooDBAppDragStartInput as b, type MindooDBAppShowMenuResult as b$, type MindooDBAppHostTheme as b0, type MindooDBAppIdentityApi as b1, type MindooDBAppInaccessibleDocument as b2, type MindooDBAppInaccessibleDocumentListQuery as b3, type MindooDBAppInaccessibleDocumentListResult as b4, type MindooDBAppJsonListDeletePatch as b5, type MindooDBAppJsonListInsertPatch as b6, type MindooDBAppJsonPatch as b7, type MindooDBAppJsonSetPatch as b8, type MindooDBAppJsonTextMarkPatch as b9, type MindooDBAppRecipientOptions as bA, type MindooDBAppResolvedViewDefinition as bB, type MindooDBAppResolvedViewSource as bC, type MindooDBAppRevisionPhase as bD, type MindooDBAppRevisionVerification as bE, type MindooDBAppRichTextBlockSpan as bF, type MindooDBAppRichTextGetOptions as bG, type MindooDBAppRichTextImmutableString as bH, type MindooDBAppRichTextMarkRange as bI, type MindooDBAppRichTextMaterializeValue as bJ, type MindooDBAppRichTextPatch as bK, type MindooDBAppRichTextScalar as bL, type MindooDBAppRichTextSpliceStep as bM, type MindooDBAppRichTextStep as bN, type MindooDBAppRichTextStepPatch as bO, type MindooDBAppRichTextTextSpan as bP, type MindooDBAppRuntime as bQ, type MindooDBAppScanAttachmentOptions as bR, type MindooDBAppScanAttachmentResult as bS, type MindooDBAppScopedDocId as bT, type MindooDBAppScopedDocumentSummary as bU, type MindooDBAppSealIntent as bV, type MindooDBAppSealedChannelOpenInput as bW, type MindooDBAppSealedChannelOpenResult as bX, type MindooDBAppSealedChannelRequestInput as bY, type MindooDBAppSession as bZ, type MindooDBAppShowMenuInput as b_, type MindooDBAppJsonTextSplicePatch as ba, type MindooDBAppJsonTextUnmarkPatch as bb, type MindooDBAppJsonUnsetPatch as bc, type MindooDBAppLaunchContext as bd, type MindooDBAppLiveQuerySubscription as be, type MindooDBAppMenuAnchor as bf, type MindooDBAppMenuApi as bg, type MindooDBAppMenuCommandItem as bh, type MindooDBAppMenuDismissReason as bi, type MindooDBAppMenuDismissedResult as bj, type MindooDBAppMenuItem as bk, type MindooDBAppMenuKind as bl, type MindooDBAppMenuPlacement as bm, type MindooDBAppMenuPointAnchor as bn, type MindooDBAppMenuRect as bo, type MindooDBAppMenuRectAnchor as bp, type MindooDBAppMenuSelectionResult as bq, type MindooDBAppMenuSeparatorItem as br, type MindooDBAppProposeAppInput as bs, type MindooDBAppProposeAppResult as bt, type MindooDBAppQueryCoverage as bu, type MindooDBAppQueryResult as bv, type MindooDBAppQueryRow as bw, type MindooDBAppQuerySortKey as bx, type MindooDBAppQueryTextClause as by, type MindooDBAppReadableAttachmentStream as bz, type MindooDBAppDragStartResult as c, type MindooDBAppSignPreview as c0, type MindooDBAppSignPreviewScope as c1, type MindooDBAppSignStatementInput as c2, type MindooDBAppSignStatementResult as c3, type MindooDBAppStorageApi as c4, type MindooDBAppTextEdit as c5, type MindooDBAppTextPatch as c6, type MindooDBAppThemeMode as c7, type MindooDBAppTimestampApi as c8, type MindooDBAppTimestampInput as c9, type MindooDBAppTimestampProvider as ca, type MindooDBAppTimestampResult as cb, type MindooDBAppUiPreferences as cc, type MindooDBAppUpdateDocumentInput as cd, type MindooDBAppViewCursorDocumentListResult as ce, type MindooDBAppViewCursorResult as cf, type MindooDBAppViewEntry as cg, type MindooDBAppViewEntryKind as ch, type MindooDBAppViewNavigator as ci, type MindooDBAppViewNavigatorExpansionState as cj, type MindooDBAppViewNavigatorOpenOptions as ck, type MindooDBAppViewNavigatorPageOptions as cl, type MindooDBAppViewNavigatorPageResult as cm, type MindooDBAppViewNavigatorRangeQuery as cn, type MindooDBAppViewNavigatorSelectionState as co, type MindooDBAppViewUpdateStats as cp, type MindooDBAppViewport as cq, type MindooDBAppWellKnownDragType as cr, type MindooDBAppWritableAttachmentStream as cs, resolveMindooDBAppDefinitionUrl as ct, validateMindooDBAppDefinition as cu, type MindooDBAppDragPreview as d, type MindooDBAppBridge as e, type MindooDBAppHostShortcutBinding as f, type MindooDBAppHostShortcutAction as g, type MindooDBAppHostingMode as h, type MindooDBAppDatabase as i, type MindooDBAppDocument as j, type MindooDBAppRichTextSpan as k, type MindooDBAppRichTextSnapshot as l, MINDOODB_APP_DEFINITION_FILE_NAME as m, MINDOODB_APP_DEFINITION_FORMAT as n, MINDOODB_APP_DEFINITION_PERMISSIONS as o, MINDOODB_APP_DEFINITION_REGISTRATION_PERMISSIONS as p, MINDOODB_APP_DEFINITION_VERSION as q, MINDOODB_APP_SEAL_SIGNING_DOMAIN as r, MINDOODB_APP_WELL_KNOWN_DRAG_TYPES as s, type MindooDBAppAccessDecision as t, type MindooDBAppAccessTier as u, type MindooDBAppAttachmentApi as v, type MindooDBAppAttachmentChunk as w, type MindooDBAppAttachmentInfo as x, type MindooDBAppAttachmentPreviewOptions as y, type MindooDBAppAttachmentPreviewSession as z };
|