@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.
Files changed (167) hide show
  1. package/README.md +189 -925
  2. package/dist/app-grant/client.js +7 -3
  3. package/dist/app-grant/client.js.map +1 -1
  4. package/dist/app-grant/setup.js +2 -2
  5. package/dist/app-grant/setup.js.map +1 -1
  6. package/dist/app-host/cloud-copy-host.js +1 -1
  7. package/dist/app-host/cloud-copy-host.js.map +1 -1
  8. package/dist/app-host/collection-readiness.js +10 -12
  9. package/dist/app-host/collection-readiness.js.map +1 -1
  10. package/dist/app-host/handover.js +1 -1
  11. package/dist/app-host/handover.js.map +1 -1
  12. package/dist/app-host/initial-sync.js +4 -4
  13. package/dist/app-host/initial-sync.js.map +1 -1
  14. package/dist/app-host/installation-sign-in.d.ts +3 -0
  15. package/dist/app-host/installation-sign-in.js +11 -2
  16. package/dist/app-host/installation-sign-in.js.map +1 -1
  17. package/dist/app-host/web-sign-in-session.d.ts +2 -0
  18. package/dist/app-host/web-sign-in-session.js +25 -3
  19. package/dist/app-host/web-sign-in-session.js.map +1 -1
  20. package/dist/application/asset-pins.json +4 -4
  21. package/dist/application/browser-capabilities.d.ts +1 -1
  22. package/dist/application/browser-capabilities.js +3 -2
  23. package/dist/application/browser-capabilities.js.map +1 -1
  24. package/dist/application/configuration.js +12 -12
  25. package/dist/application/configuration.js.map +1 -1
  26. package/dist/application/entry.d.ts +69 -108
  27. package/dist/application/entry.js +164 -91
  28. package/dist/application/entry.js.map +1 -1
  29. package/dist/application/front-door.d.ts +30 -12
  30. package/dist/application/front-door.js +2 -89
  31. package/dist/application/front-door.js.map +1 -1
  32. package/dist/application/packaged-assets.d.ts +5 -2
  33. package/dist/application/packaged-assets.js +9 -6
  34. package/dist/application/packaged-assets.js.map +1 -1
  35. package/dist/application/phase.d.ts +4 -1
  36. package/dist/application/phase.js +5 -4
  37. package/dist/application/phase.js.map +1 -1
  38. package/dist/application/private-collections.js +2 -1
  39. package/dist/application/private-collections.js.map +1 -1
  40. package/dist/application/registration-refusal.d.ts +1 -1
  41. package/dist/application/registration-refusal.js +1 -3
  42. package/dist/application/registration-refusal.js.map +1 -1
  43. package/dist/application/registration.js +1 -4
  44. package/dist/application/registration.js.map +1 -1
  45. package/dist/application/setup.d.ts +6 -9
  46. package/dist/application/setup.js +16 -0
  47. package/dist/application/setup.js.map +1 -1
  48. package/dist/application/tabs.d.ts +15 -2
  49. package/dist/application/tabs.js +35 -13
  50. package/dist/application/tabs.js.map +1 -1
  51. package/dist/application/unsynced-transfer.d.ts +1 -1
  52. package/dist/application/unsynced-transfer.js +3 -3
  53. package/dist/application/unsynced-transfer.js.map +1 -1
  54. package/dist/application/worker.js +969 -465
  55. package/dist/application/worker.js.map +1 -1
  56. package/dist/browser/mdbase-sdk.js +21319 -20764
  57. package/dist/browser/mdbase-sdk.min.js +65 -65
  58. package/dist/browser.d.ts +1 -0
  59. package/dist/browser.js +1 -0
  60. package/dist/browser.js.map +1 -1
  61. package/dist/client.d.ts +169 -81
  62. package/dist/client.js +236 -178
  63. package/dist/client.js.map +1 -1
  64. package/dist/codec.d.ts +15 -0
  65. package/dist/codec.js +44 -2
  66. package/dist/codec.js.map +1 -1
  67. package/dist/collection-api.d.ts +44 -0
  68. package/dist/collection-api.js +24 -0
  69. package/dist/collection-api.js.map +1 -0
  70. package/dist/collection-availability.js +1 -1
  71. package/dist/collection-availability.js.map +1 -1
  72. package/dist/contract-query.d.ts +22 -3
  73. package/dist/contract-query.js.map +1 -1
  74. package/dist/contract-records.d.ts +2 -1
  75. package/dist/contract-records.js.map +1 -1
  76. package/dist/describe-error.d.ts +1 -1
  77. package/dist/describe-error.js +7 -6
  78. package/dist/describe-error.js.map +1 -1
  79. package/dist/errors.d.ts +3 -5
  80. package/dist/errors.js +3 -8
  81. package/dist/errors.js.map +1 -1
  82. package/dist/files.d.ts +7 -5
  83. package/dist/files.js +16 -17
  84. package/dist/files.js.map +1 -1
  85. package/dist/holds.d.ts +2 -1
  86. package/dist/holds.js.map +1 -1
  87. package/dist/index.d.ts +7 -11
  88. package/dist/index.js +5 -7
  89. package/dist/index.js.map +1 -1
  90. package/dist/live.d.ts +2 -1
  91. package/dist/live.js.map +1 -1
  92. package/dist/manifest.d.ts +1 -1
  93. package/dist/manifest.js +1 -1
  94. package/dist/native/provenance.json +5 -5
  95. package/dist/native/runtime.wasm +0 -0
  96. package/dist/people.js +3 -7
  97. package/dist/people.js.map +1 -1
  98. package/dist/plain.d.ts +102 -0
  99. package/dist/plain.js +62 -0
  100. package/dist/plain.js.map +1 -0
  101. package/dist/presence.d.ts +2 -1
  102. package/dist/presence.js +3 -3
  103. package/dist/presence.js.map +1 -1
  104. package/dist/read-helpers.d.ts +8 -6
  105. package/dist/read-helpers.js +20 -13
  106. package/dist/read-helpers.js.map +1 -1
  107. package/dist/record-set.d.ts +98 -0
  108. package/dist/record-set.js +347 -0
  109. package/dist/record-set.js.map +1 -0
  110. package/dist/records/session.d.ts +2 -1
  111. package/dist/records/session.js +22 -20
  112. package/dist/records/session.js.map +1 -1
  113. package/dist/records/types.d.ts +5 -3
  114. package/dist/records/witness.d.ts +7 -4
  115. package/dist/records/witness.js +13 -8
  116. package/dist/records/witness.js.map +1 -1
  117. package/dist/records.js +5 -2
  118. package/dist/records.js.map +1 -1
  119. package/dist/saved-views.d.ts +12 -4
  120. package/dist/saved-views.js +51 -43
  121. package/dist/saved-views.js.map +1 -1
  122. package/dist/settle.d.ts +62 -0
  123. package/dist/settle.js +119 -0
  124. package/dist/settle.js.map +1 -0
  125. package/dist/status.d.ts +84 -28
  126. package/dist/status.js +54 -48
  127. package/dist/status.js.map +1 -1
  128. package/dist/testing/application.d.ts +16 -9
  129. package/dist/testing/application.js +48 -45
  130. package/dist/testing/application.js.map +1 -1
  131. package/dist/testing/index.d.ts +2 -2
  132. package/dist/testing/memory-contracts.d.ts +5 -0
  133. package/dist/testing/memory-contracts.js.map +1 -1
  134. package/dist/testing/memory-replica.d.ts +58 -5
  135. package/dist/testing/memory-replica.js +126 -19
  136. package/dist/testing/memory-replica.js.map +1 -1
  137. package/dist/testing/test-app.d.ts +9 -10
  138. package/dist/testing/test-app.js +8 -17
  139. package/dist/testing/test-app.js.map +1 -1
  140. package/dist/thin-client.d.ts +15 -38
  141. package/dist/thin-client.js +11 -20
  142. package/dist/thin-client.js.map +1 -1
  143. package/dist/transport/control-route.js +1 -1
  144. package/dist/transport/control-route.js.map +1 -1
  145. package/dist/transport/relay-close.d.ts +0 -1
  146. package/dist/transport/relay-close.js +4 -2
  147. package/dist/transport/relay-close.js.map +1 -1
  148. package/dist/transport/relay-pipe.js +2 -2
  149. package/dist/transport/relay-pipe.js.map +1 -1
  150. package/dist/type-packs.js +4 -4
  151. package/dist/type-packs.js.map +1 -1
  152. package/dist/validation.d.ts +1 -1
  153. package/dist/validation.js +2 -2
  154. package/dist/validation.js.map +1 -1
  155. package/dist/values.d.ts +4 -20
  156. package/dist/values.js +3 -49
  157. package/dist/values.js.map +1 -1
  158. package/dist/view-sources.d.ts +2 -1
  159. package/dist/view-sources.js +1 -1
  160. package/dist/view-sources.js.map +1 -1
  161. package/dist/wire.d.ts +7 -3
  162. package/dist/wire.js +4 -4
  163. package/dist/wire.js.map +1 -1
  164. package/dist/write-ledger.d.ts +2 -1
  165. package/dist/write-ledger.js +3 -6
  166. package/dist/write-ledger.js.map +1 -1
  167. 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 MdbaseTransferPlan, type MdbaseTransferProgress, type MdbaseTransferResult } from "./unsynced-transfer.js";
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 { type MdbaseApplicationSetup } from "./setup.js";
12
+ import type { Mdbase } from "./front-door.js";
13
13
  import { type MdbasePhase } from "./phase.js";
14
- import { type StatusSummary } from "../status.js";
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
- /** Sync of the open collection (null until it is ready). */
57
- readonly sync?: StatusSummary | null;
58
- /** R2: unconfirmed and refused writes of the open collection, and the save
59
- * state to show (null until it is ready). Survives a reload. */
60
- readonly writes?: WriteLedgerSnapshot | null;
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 MdbaseConnectOptions {
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 application entry. New code: `createMdbase(declaration)`, the same
250
- * entry with a strict snapshot; `MdbaseConnect` keeps its name for one cut.
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 app factories, private authority hooks, replacement actors or
255
- * transport-only READY. */
256
- export declare class MdbaseConnect implements MdbaseApplicationEntry {
257
- private readonly app;
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?: MdbaseConnectOptions);
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
- /** One grace window per continuously pending replica, not per edit or request. */
313
- private trackSaveWarning;
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 sync status while it is ready. */
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;