@mdbase-dev/sdk 0.1.0-beta.186 → 0.1.0-beta.188
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 +189 -925
- package/dist/app-grant/client.js +7 -3
- package/dist/app-grant/client.js.map +1 -1
- package/dist/app-grant/setup.js +2 -2
- package/dist/app-grant/setup.js.map +1 -1
- package/dist/app-host/cloud-copy-host.js +1 -1
- package/dist/app-host/cloud-copy-host.js.map +1 -1
- package/dist/app-host/collection-readiness.js +10 -12
- package/dist/app-host/collection-readiness.js.map +1 -1
- package/dist/app-host/handover.js +1 -1
- package/dist/app-host/handover.js.map +1 -1
- package/dist/app-host/initial-sync.js +4 -4
- package/dist/app-host/initial-sync.js.map +1 -1
- package/dist/app-host/installation-sign-in.d.ts +3 -0
- package/dist/app-host/installation-sign-in.js +11 -2
- package/dist/app-host/installation-sign-in.js.map +1 -1
- package/dist/app-host/web-sign-in-session.d.ts +2 -0
- package/dist/app-host/web-sign-in-session.js +25 -3
- package/dist/app-host/web-sign-in-session.js.map +1 -1
- package/dist/application/asset-pins.json +4 -4
- package/dist/application/browser-capabilities.d.ts +1 -1
- package/dist/application/browser-capabilities.js +3 -2
- package/dist/application/browser-capabilities.js.map +1 -1
- package/dist/application/configuration.js +12 -12
- package/dist/application/configuration.js.map +1 -1
- package/dist/application/entry.d.ts +69 -108
- package/dist/application/entry.js +164 -91
- package/dist/application/entry.js.map +1 -1
- package/dist/application/front-door.d.ts +30 -12
- package/dist/application/front-door.js +2 -89
- package/dist/application/front-door.js.map +1 -1
- package/dist/application/packaged-assets.d.ts +5 -2
- package/dist/application/packaged-assets.js +9 -6
- package/dist/application/packaged-assets.js.map +1 -1
- package/dist/application/phase.d.ts +4 -1
- package/dist/application/phase.js +5 -4
- package/dist/application/phase.js.map +1 -1
- package/dist/application/private-collections.js +2 -1
- package/dist/application/private-collections.js.map +1 -1
- package/dist/application/registration-refusal.d.ts +1 -1
- package/dist/application/registration-refusal.js +1 -3
- package/dist/application/registration-refusal.js.map +1 -1
- package/dist/application/registration.js +1 -4
- package/dist/application/registration.js.map +1 -1
- package/dist/application/setup.d.ts +6 -9
- package/dist/application/setup.js +16 -0
- package/dist/application/setup.js.map +1 -1
- package/dist/application/tabs.d.ts +15 -2
- package/dist/application/tabs.js +35 -13
- package/dist/application/tabs.js.map +1 -1
- package/dist/application/unsynced-transfer.d.ts +1 -1
- package/dist/application/unsynced-transfer.js +3 -3
- package/dist/application/unsynced-transfer.js.map +1 -1
- package/dist/application/worker.js +969 -465
- package/dist/application/worker.js.map +1 -1
- package/dist/browser/mdbase-sdk.js +21319 -20764
- package/dist/browser/mdbase-sdk.min.js +65 -65
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +1 -0
- package/dist/browser.js.map +1 -1
- package/dist/client.d.ts +169 -81
- package/dist/client.js +236 -178
- package/dist/client.js.map +1 -1
- package/dist/codec.d.ts +15 -0
- package/dist/codec.js +44 -2
- package/dist/codec.js.map +1 -1
- package/dist/collection-api.d.ts +44 -0
- package/dist/collection-api.js +24 -0
- package/dist/collection-api.js.map +1 -0
- package/dist/collection-availability.js +1 -1
- package/dist/collection-availability.js.map +1 -1
- package/dist/contract-query.d.ts +22 -3
- package/dist/contract-query.js.map +1 -1
- package/dist/contract-records.d.ts +2 -1
- package/dist/contract-records.js.map +1 -1
- package/dist/describe-error.d.ts +1 -1
- package/dist/describe-error.js +7 -6
- package/dist/describe-error.js.map +1 -1
- package/dist/errors.d.ts +3 -5
- package/dist/errors.js +3 -8
- package/dist/errors.js.map +1 -1
- package/dist/files.d.ts +7 -5
- package/dist/files.js +16 -17
- package/dist/files.js.map +1 -1
- package/dist/holds.d.ts +2 -1
- package/dist/holds.js.map +1 -1
- package/dist/index.d.ts +7 -11
- package/dist/index.js +5 -7
- package/dist/index.js.map +1 -1
- package/dist/live.d.ts +2 -1
- package/dist/live.js.map +1 -1
- package/dist/manifest.d.ts +1 -1
- package/dist/manifest.js +1 -1
- package/dist/native/provenance.json +5 -5
- package/dist/native/runtime.wasm +0 -0
- package/dist/people.js +3 -7
- package/dist/people.js.map +1 -1
- package/dist/plain.d.ts +102 -0
- package/dist/plain.js +62 -0
- package/dist/plain.js.map +1 -0
- package/dist/presence.d.ts +2 -1
- package/dist/presence.js +3 -3
- package/dist/presence.js.map +1 -1
- package/dist/read-helpers.d.ts +8 -6
- package/dist/read-helpers.js +20 -13
- package/dist/read-helpers.js.map +1 -1
- package/dist/record-set.d.ts +98 -0
- package/dist/record-set.js +347 -0
- package/dist/record-set.js.map +1 -0
- package/dist/records/session.d.ts +2 -1
- package/dist/records/session.js +22 -20
- package/dist/records/session.js.map +1 -1
- package/dist/records/types.d.ts +5 -3
- package/dist/records/witness.d.ts +7 -4
- package/dist/records/witness.js +13 -8
- package/dist/records/witness.js.map +1 -1
- package/dist/records.js +5 -2
- package/dist/records.js.map +1 -1
- package/dist/saved-views.d.ts +12 -4
- package/dist/saved-views.js +51 -43
- package/dist/saved-views.js.map +1 -1
- package/dist/settle.d.ts +62 -0
- package/dist/settle.js +119 -0
- package/dist/settle.js.map +1 -0
- package/dist/status.d.ts +84 -28
- package/dist/status.js +54 -48
- package/dist/status.js.map +1 -1
- package/dist/testing/application.d.ts +16 -9
- package/dist/testing/application.js +48 -45
- package/dist/testing/application.js.map +1 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/memory-contracts.d.ts +5 -0
- package/dist/testing/memory-contracts.js.map +1 -1
- package/dist/testing/memory-replica.d.ts +58 -5
- package/dist/testing/memory-replica.js +126 -19
- package/dist/testing/memory-replica.js.map +1 -1
- package/dist/testing/test-app.d.ts +9 -10
- package/dist/testing/test-app.js +8 -17
- package/dist/testing/test-app.js.map +1 -1
- package/dist/thin-client.d.ts +15 -38
- package/dist/thin-client.js +11 -20
- package/dist/thin-client.js.map +1 -1
- package/dist/transport/control-route.js +1 -1
- package/dist/transport/control-route.js.map +1 -1
- package/dist/transport/relay-close.d.ts +0 -1
- package/dist/transport/relay-close.js +4 -2
- package/dist/transport/relay-close.js.map +1 -1
- package/dist/transport/relay-pipe.js +2 -2
- package/dist/transport/relay-pipe.js.map +1 -1
- package/dist/type-packs.js +4 -4
- package/dist/type-packs.js.map +1 -1
- package/dist/validation.d.ts +1 -1
- package/dist/validation.js +2 -2
- package/dist/validation.js.map +1 -1
- package/dist/values.d.ts +4 -20
- package/dist/values.js +3 -49
- package/dist/values.js.map +1 -1
- package/dist/view-sources.d.ts +2 -1
- package/dist/view-sources.js +1 -1
- package/dist/view-sources.js.map +1 -1
- package/dist/wire.d.ts +7 -3
- package/dist/wire.js +4 -4
- package/dist/wire.js.map +1 -1
- package/dist/write-ledger.d.ts +2 -1
- package/dist/write-ledger.js +3 -6
- package/dist/write-ledger.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type MdbaseApplicationDeclaration } from "./declaration.js";
|
|
2
|
+
import { type DescribeErrorOptions } from "../describe-error.js";
|
|
2
3
|
import { type ApplicationCollectionSelectionSnapshot } from "./collection-selection.js";
|
|
3
|
-
import { type MdbaseTransferMap, type
|
|
4
|
-
import { type MdbaseAccessRequest, type MdbaseAccessRequestOptions, type MdbaseAccessResult } from "./file-access.js";
|
|
4
|
+
import { type MdbaseTransferMap, type MdbaseTransferProgress } from "./unsynced-transfer.js";
|
|
5
5
|
import type { MdbaseClient } from "../client.js";
|
|
6
6
|
import type { FilesApi } from "../files.js";
|
|
7
7
|
import type { MdbasePeopleClient } from "../people.js";
|
|
@@ -9,10 +9,9 @@ import type { TimersApi } from "../timers.js";
|
|
|
9
9
|
import type { AppWebSignInSnapshot } from "../app-host/web-sign-in-session.js";
|
|
10
10
|
import { type AppReplicaScope } from "../app-host/owner.js";
|
|
11
11
|
import { type AppStoragePolicy } from "../app-host/status.js";
|
|
12
|
-
import {
|
|
12
|
+
import type { Mdbase } from "./front-door.js";
|
|
13
13
|
import { type MdbasePhase } from "./phase.js";
|
|
14
|
-
import { type
|
|
15
|
-
import type { WriteLedgerSnapshot } from "../write-ledger.js";
|
|
14
|
+
import { type MdbaseSync } from "../status.js";
|
|
16
15
|
import type { AppCollectionReadinessFenceDetail } from "../app-host/collection-readiness.js";
|
|
17
16
|
export type MdbaseApplicationFacet = "capabilities" | "contracts" | "configuration" | "files" | "people" | "notifications";
|
|
18
17
|
export interface MdbaseApplicationProblem {
|
|
@@ -53,18 +52,21 @@ export interface MdbaseApplicationSnapshot extends AppWebSignInSnapshot {
|
|
|
53
52
|
/** R1: the one derived state for UI. Switch on `phase.kind`; never hand-roll
|
|
54
53
|
* a ready check from `status`/`readiness`. Always set by the SDK entry. */
|
|
55
54
|
readonly phase?: MdbasePhase;
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
readonly
|
|
55
|
+
/** The one status to show for the open collection (null until it is ready):
|
|
56
|
+
* whether changes reach the cloud copy, what is waiting, including each
|
|
57
|
+
* unconfirmed and refused write (`sync.writes`, which survives a reload), and
|
|
58
|
+
* what needs the person. */
|
|
59
|
+
readonly sync?: MdbaseSync | null;
|
|
61
60
|
/** On-device storage policy for this origin, read by the SDK (null where the
|
|
62
61
|
* SDK cannot tell). `persistent` is the browser's answer, never a durability
|
|
63
62
|
* claim: only a log-confirmed receipt counts as saved. */
|
|
64
63
|
readonly storage?: AppStoragePolicy | null;
|
|
65
64
|
/** Pending replica edits on nonpersistent storage: set after 30 seconds
|
|
66
65
|
* continuously pending, or immediately while disconnected. Normal online
|
|
67
|
-
* edits do not flash a warning. Null at zero pending or with persistence.
|
|
66
|
+
* edits do not flash a warning. Null at zero pending or with persistence.
|
|
67
|
+
* The same fact as `storage_may_be_evicted` in `sync.attention`; kept for
|
|
68
|
+
* app-ui's `CollectionSaveWarning`, which pins a published SDK, and removed
|
|
69
|
+
* once that reads `sync.attention`. */
|
|
68
70
|
readonly saveWarning?: "storage_may_be_evicted" | null;
|
|
69
71
|
/** Connect pages for this account (SDK-4). Null where the SDK cannot run. */
|
|
70
72
|
readonly links?: MdbaseLinks | null;
|
|
@@ -120,13 +122,17 @@ export interface MdbaseSignInOpener {
|
|
|
120
122
|
* `dev.example.app://auth/mdbase/callback` for ID `dev.example.app`. */
|
|
121
123
|
readonly returnUrl?: string;
|
|
122
124
|
}
|
|
123
|
-
export interface
|
|
125
|
+
export interface MdbaseOptions {
|
|
124
126
|
readonly signIn?: MdbaseSignInOpener;
|
|
125
127
|
/** Drive `setForeground` from `document.visibilityState`, and sync at once
|
|
126
128
|
* when the page regains focus or the network comes back. A hidden page only
|
|
127
129
|
* finishes sending pending writes (for at most two minutes). Default true;
|
|
128
130
|
* false leaves `setForeground` to the app. */
|
|
129
131
|
readonly followVisibility?: boolean;
|
|
132
|
+
/** Copy for `phase.problem` and the signed-out notice in the person's
|
|
133
|
+
* language: replacement `title`, `message` and `actionLabel` by problem key,
|
|
134
|
+
* as `describeError` takes them. A key left out keeps the English copy. */
|
|
135
|
+
readonly messages?: DescribeErrorOptions["messages"];
|
|
130
136
|
/** Readiness policy. `typeIssues: "degrade"` keeps the collection ready when
|
|
131
137
|
* one of the app's own types has an error-level definition issue, and lists
|
|
132
138
|
* it in `readiness.assessment.unavailableTypes`; the app must then treat
|
|
@@ -144,6 +150,33 @@ export interface MdbaseConnectOptions {
|
|
|
144
150
|
* collection (`phase.kind === "unsynced"`): saved only in this browser,
|
|
145
151
|
* never listed in `collections`. Default false. */
|
|
146
152
|
readonly unsynced?: boolean;
|
|
153
|
+
/** Keep the requested collection in the page URL (`?collection=<id>`): a
|
|
154
|
+
* link or reload opens it, and Back/forward switch collections. Default
|
|
155
|
+
* true; false for a page with no URL of its own, such as a `blob:` document
|
|
156
|
+
* embedded in another app. The URL is then never read or written, and the
|
|
157
|
+
* app chooses with `select`, `approve` and `chooseAnother`. */
|
|
158
|
+
readonly urlSelection?: boolean;
|
|
159
|
+
/** Construct the SDK's module Worker yourself, where the page cannot load
|
|
160
|
+
* it by URL as a secure context (for example a `blob:` document inside a
|
|
161
|
+
* mobile WebView). Called with the URL the SDK would load; return a module
|
|
162
|
+
* Worker that runs that script's exact bytes, such as one from a `blob:`
|
|
163
|
+
* URL of them. The Worker still loads the native assets from beside that
|
|
164
|
+
* URL and checks them against the SDK's pins. A factory that throws or
|
|
165
|
+
* returns no Worker fails with `application_worker_unavailable`. Default:
|
|
166
|
+
* `new Worker(url, {type: "module"})`. */
|
|
167
|
+
readonly worker?: (url: string) => Worker;
|
|
168
|
+
/** One session for contexts of this app that are built separately, such as
|
|
169
|
+
* a browser extension's pages, offscreen document and service worker. By
|
|
170
|
+
* default only contexts loading the same SDK module file share a session.
|
|
171
|
+
* `build` names this build of the app instead: every context of the origin
|
|
172
|
+
* that passes the same `build` and the same declaration uses one sign-in and
|
|
173
|
+
* one Worker. `host: false` is for a context that cannot run that Worker (a
|
|
174
|
+
* service worker) or should leave it to another: it joins the context that
|
|
175
|
+
* runs it and waits while there is none. Default: `host: true`. */
|
|
176
|
+
readonly session?: {
|
|
177
|
+
readonly build: string;
|
|
178
|
+
readonly host?: boolean;
|
|
179
|
+
};
|
|
147
180
|
}
|
|
148
181
|
export interface MdbaseApplicationConnection {
|
|
149
182
|
readonly id: string;
|
|
@@ -158,103 +191,19 @@ export interface MdbaseApplicationConnection {
|
|
|
158
191
|
readonly timers?: TimersApi;
|
|
159
192
|
isCurrent(): boolean;
|
|
160
193
|
}
|
|
161
|
-
export interface MdbaseApplication {
|
|
162
|
-
getSnapshot(): MdbaseApplicationSnapshot;
|
|
163
|
-
subscribe(listener: () => void): () => void;
|
|
164
|
-
start(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
165
|
-
/** Call from the user gesture (reserves the Connect popup synchronously):
|
|
166
|
-
* sign in, or approve the requested collection. Same as approve(). */
|
|
167
|
-
authorize(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
168
|
-
select(collectionId: string, options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
169
|
-
/** Call from the user gesture: approve one named collection (default: the requested one; none: choose in Connect). */
|
|
170
|
-
approve(collectionId?: string | null, options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
171
|
-
/** Call from the user gesture the first time the app needs an optional file
|
|
172
|
-
* action (for example adding an image). Resolves `granted` at once when it
|
|
173
|
-
* is already allowed; otherwise opens Connect for the open collection with
|
|
174
|
-
* your one-line reason. No reload: the connection and app state stay. An
|
|
175
|
-
* action the manifest does not declare rejects with `access_undeclared`.
|
|
176
|
-
* File writes the person has not allowed reject with `access_required`. */
|
|
177
|
-
requestAccess(request: MdbaseAccessRequest, options: MdbaseAccessRequestOptions): Promise<MdbaseAccessResult>;
|
|
178
|
-
/** Call from the user gesture: re-approve the open/requested collection. */
|
|
179
|
-
reauthorize(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
180
|
-
/** Re-read the approved collection list now (for example when a switcher
|
|
181
|
-
* opens). Focus and visibility already refresh it. */
|
|
182
|
-
refreshCollectionList?(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
183
|
-
/** Close the current collection and return to the chooser; Back restores it. */
|
|
184
|
-
chooseAnother(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
185
|
-
/** Refresh current aggregate evidence; checking/read errors never become READY. */
|
|
186
|
-
assess(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationReadinessSnapshot>;
|
|
187
|
-
/** Explicitly configure the current scope from its canonical declaration.
|
|
188
|
-
* No caller operations/plan/SQL; original recovery and consent stay SDK-owned. */
|
|
189
|
-
configure(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
190
|
-
/** Reviewable setup of the open collection: `plan` for one review screen,
|
|
191
|
-
* then `apply` that plan. `configure` is plan+apply with nothing to review. */
|
|
192
|
-
readonly setup: MdbaseApplicationSetup;
|
|
193
|
-
clearSelection(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
194
|
-
/** Local presentation/selection only; never revoke consent or delete records. */
|
|
195
|
-
forget(collectionId: string, options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
196
|
-
/** Owner only, from an explicit confirmation: delete a collection for
|
|
197
|
-
* everyone, on every device and app. `confirmName` is the name the person
|
|
198
|
-
* typed; it must equal the collection's current name. A refusal rejects
|
|
199
|
-
* with a `collection_delete_*` code for `describeError` and changes nothing
|
|
200
|
-
* locally. On success the collection leaves `collections`. */
|
|
201
|
-
deleteCollection(collectionId: string, options: MdbaseCollectionDeleteOptions): Promise<MdbaseApplicationSnapshot>;
|
|
202
|
-
/** Unlock the open Private collection (`phase.kind === "needs_unlock"`,
|
|
203
|
-
* `mode: "password"`) with the account's encryption password or recovery
|
|
204
|
-
* key. Resolves when the attempt settled: opened (`ready` or `needs_setup`),
|
|
205
|
-
* or still `needs_unlock` with `phase.problem` set (wrong password, service
|
|
206
|
-
* unreachable). Rejects with `invalid_request` when that collection is not
|
|
207
|
-
* waiting to be unlocked in this tab. No reload is needed either way.
|
|
208
|
-
* Optional for other implementations of this interface. */
|
|
209
|
-
unlock?(collectionId: string, secret: MdbaseUnlockSecret, options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
210
|
-
setForeground(active: boolean): void;
|
|
211
|
-
close(): Promise<void>;
|
|
212
|
-
/** Sign out of mdbase on this device: ends the server session and removes
|
|
213
|
-
* this browser's sign-in data, keys and cached collections for the account.
|
|
214
|
-
* Rejects with `sign_out_pending_writes` (a `conflict`) while changes have not
|
|
215
|
-
* reached mdbase, unless `{discard: true}`. Resolves signed out; Sign in works
|
|
216
|
-
* again without a reload, and a reload stays signed out. A server sign-out
|
|
217
|
-
* that could not complete (offline) still signs this device out; it shows
|
|
218
|
-
* in `signOutResult`. Optional for other implementations of this interface. */
|
|
219
|
-
signOut?(options?: MdbaseSignOutOptions): Promise<MdbaseApplicationSnapshot>;
|
|
220
|
-
/** Open this app's unsynced collection in this tab (work before
|
|
221
|
-
* connecting), creating it on first use. Optional for other implementations. */
|
|
222
|
-
openUnsynced?(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
223
|
-
/** Compare the unsynced collection with this tab's open (ready) collection,
|
|
224
|
-
* mapping each record with `map`. Nothing is written. Optional for other
|
|
225
|
-
* implementations. */
|
|
226
|
-
planUnsyncedTransfer?(options?: MdbaseTransferPlanOptions): Promise<MdbaseTransferPlan>;
|
|
227
|
-
/** Create a reviewed plan's records in this tab's open collection. Safe to
|
|
228
|
-
* plan and run again after an interruption. Optional for other implementations. */
|
|
229
|
-
transferUnsynced?(plan: MdbaseTransferPlan, options?: MdbaseTransferOptions): Promise<MdbaseTransferResult>;
|
|
230
|
-
/** Erase the unsynced collection from this browser, after the person
|
|
231
|
-
* confirmed it. A tab showing it continues in a new, empty one. Optional for
|
|
232
|
-
* other implementations. */
|
|
233
|
-
discardUnsynced?(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
234
|
-
/** @deprecated Use `createMdbase(...).addCollection(options)` or
|
|
235
|
-
* `approve(null, options)`: the same unified chooser, without a current hint.
|
|
236
|
-
* Optional for other implementations of this interface. */
|
|
237
|
-
addPrivateCollection?(options?: MdbaseApplicationRequestOptions): Promise<MdbaseApplicationSnapshot>;
|
|
238
|
-
}
|
|
239
|
-
/** Structural public consumer port; production uses MdbaseConnect. Explicit
|
|
240
|
-
* SDK testing fixtures may implement this without private fields or casts. */
|
|
241
|
-
export interface MdbaseApplicationEntry {
|
|
242
|
-
application(): MdbaseApplication;
|
|
243
|
-
connection(collectionId: string): MdbaseApplicationConnection | null;
|
|
244
|
-
}
|
|
245
194
|
export declare class MdbaseApplicationUnavailableError extends Error {
|
|
246
195
|
readonly code = "application_not_yet_available";
|
|
247
196
|
constructor();
|
|
248
197
|
}
|
|
249
|
-
/** The
|
|
250
|
-
*
|
|
251
|
-
* Declaration-only public entry. Construction is IO-free; SDK registration,
|
|
198
|
+
/** The entry behind `createMdbase(declaration)`: internal, apps hold its
|
|
199
|
+
* `mdbase`. Declaration-only. Construction is IO-free; SDK registration,
|
|
252
200
|
* same-artifact Worker and original profile/SQL start lazily on the first
|
|
253
201
|
* action. The URL names the requested collection; sign-in approval decides what
|
|
254
|
-
* opens. No
|
|
255
|
-
*
|
|
256
|
-
|
|
257
|
-
|
|
202
|
+
* opens. No private authority hooks, replacement actors or transport-only
|
|
203
|
+
* READY: a host's `worker` factory only constructs the SDK's own Worker, which
|
|
204
|
+
* checks its bootstrap and assets as always. */
|
|
205
|
+
export declare class MdbaseEntry {
|
|
206
|
+
readonly mdbase: Mdbase;
|
|
258
207
|
private readonly declaration;
|
|
259
208
|
private readonly compiled;
|
|
260
209
|
private readonly lifetime;
|
|
@@ -287,6 +236,7 @@ export declare class MdbaseConnect implements MdbaseApplicationEntry {
|
|
|
287
236
|
private revision;
|
|
288
237
|
private readonly links;
|
|
289
238
|
private readonly cpOrigin;
|
|
239
|
+
private readonly messages;
|
|
290
240
|
private opening;
|
|
291
241
|
private syncing;
|
|
292
242
|
/** On-device storage policy for this origin; null where it cannot be read. */
|
|
@@ -294,6 +244,9 @@ export declare class MdbaseConnect implements MdbaseApplicationEntry {
|
|
|
294
244
|
private pendingSave;
|
|
295
245
|
private readonly signIn;
|
|
296
246
|
private readonly typeIssues;
|
|
247
|
+
private readonly createWorker;
|
|
248
|
+
/** The `session` option: the app's own build name, and whether this context may run the Worker. */
|
|
249
|
+
private readonly session;
|
|
297
250
|
/** SDK-10: this tab's Private collections (page-side thin clients, never the Worker). */
|
|
298
251
|
private readonly privates;
|
|
299
252
|
/** Open the unsynced collection when started signed out; tried once per start. */
|
|
@@ -303,18 +256,20 @@ export declare class MdbaseConnect implements MdbaseApplicationEntry {
|
|
|
303
256
|
private unsyncedOpening;
|
|
304
257
|
private readonly timing;
|
|
305
258
|
private readonly overlaid;
|
|
306
|
-
constructor(declaration: MdbaseApplicationDeclaration, options?:
|
|
259
|
+
constructor(declaration: MdbaseApplicationDeclaration, options?: MdbaseOptions);
|
|
307
260
|
/** SDK-10: the session's snapshot with this tab's Private collections listed
|
|
308
261
|
* and, while one is open, as the selected collection. Stable per change. */
|
|
309
262
|
private withPrivate;
|
|
310
263
|
private getSnapshot;
|
|
311
264
|
private linksFor;
|
|
312
|
-
/**
|
|
313
|
-
|
|
265
|
+
/** How long changes have been pending without a break, or null with none:
|
|
266
|
+
* one clock per continuously pending replica, not per edit or request. It
|
|
267
|
+
* wakes the snapshot when a save stops being brief and when it becomes long. */
|
|
268
|
+
private trackPending;
|
|
314
269
|
private clearPendingSave;
|
|
315
270
|
/** SDK-9: one timer per opening collection; `slow` after SLOW_OPENING_MS. */
|
|
316
271
|
private trackOpening;
|
|
317
|
-
/** Follow the open collection's
|
|
272
|
+
/** Follow the open collection's status, write ledger and link while it is ready. */
|
|
318
273
|
private trackSync;
|
|
319
274
|
private nativeAuthorization;
|
|
320
275
|
private account;
|
|
@@ -364,16 +319,23 @@ export declare class MdbaseConnect implements MdbaseApplicationEntry {
|
|
|
364
319
|
private signedOut;
|
|
365
320
|
/** Another tab signed out of the one shared session: this tab is signed out too. */
|
|
366
321
|
private observeSignOut;
|
|
322
|
+
/** This context's tab group. The capability probe has already required Web
|
|
323
|
+
* Locks and BroadcastChannel. */
|
|
367
324
|
private tabsFor;
|
|
368
325
|
/** The leader tab went away: start again, as the new leader or a follower of it.
|
|
369
326
|
* If it went because the session signed out, this tab is signed out too: it
|
|
370
327
|
* neither leads nor starts a new session (its snapshot may not have arrived). */
|
|
371
328
|
private readonly leaderLost;
|
|
329
|
+
/** A context that cannot run the Worker is waiting, and none runs it: start
|
|
330
|
+
* as this context would on load, unless it is already starting or running. */
|
|
331
|
+
private readonly hostWanted;
|
|
372
332
|
/** Every tab signed out, then another tab signed in again: follow that
|
|
373
333
|
* session as this tab would on load (no second sign-in or approval). */
|
|
374
334
|
private readonly signedInElsewhere;
|
|
375
335
|
private setForeground;
|
|
376
336
|
private followVisibility;
|
|
337
|
+
/** `sync.connection` says offline as soon as the browser does, not at the next failed request. */
|
|
338
|
+
private followNetwork;
|
|
377
339
|
/** Back/forward cache: a page parked there is frozen with its Worker, which
|
|
378
340
|
* would keep holding the collection lease and block the next document of
|
|
379
341
|
* this app ("busy"). On pagehide, stop the Worker synchronously (a frozen
|
|
@@ -393,7 +355,6 @@ export declare class MdbaseConnect implements MdbaseApplicationEntry {
|
|
|
393
355
|
private awaitingOtherTab;
|
|
394
356
|
private awaitOtherTab;
|
|
395
357
|
private close;
|
|
396
|
-
application(): MdbaseApplication;
|
|
397
358
|
/** Which revisions of the unsynced collection's records are already in a
|
|
398
359
|
* destination, shared by this browser's tabs. */
|
|
399
360
|
private transferLedger;
|