js-bao 0.11.1 → 0.12.0-alpha.0

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/dist/browser.cjs CHANGED
@@ -9106,16 +9106,11 @@ var init_BaseModel = __esm({
9106
9106
  this.format2Documents.clear();
9107
9107
  }
9108
9108
  /**
9109
- * The SYNCHRONOUS record store for `docId`, when one runs in this thread.
9110
- *
9111
- * `null` for a format-1 document, and `null` for a format-2 document whose
9112
- * store lives in a worker (#3429) — there is no such object here to hand
9113
- * out. The ORM drives {@link getFormat2StoreAsync}; this is kept for the
9114
- * direct reaches that predate the boundary (tests, diagnostics).
9109
+ * Return the synchronous record store for a document, or `null` for a
9110
+ * legacy document or a store running in a worker.
9115
9111
  *
9116
- * A write made through it is visible to the facade's reads and marks at
9117
- * once — it is the same database — but it does NOT refresh row-cache entries
9118
- * live instances are already holding; those follow the next settlement.
9112
+ * Direct writes update the store but do not immediately refresh cached model
9113
+ * instances. Use model methods for application writes.
9119
9114
  */
9120
9115
  static getFormat2Store(docId) {
9121
9116
  return resolveOrmContext(this).getFormat2Store(docId);
@@ -9236,16 +9231,9 @@ var init_BaseModel = __esm({
9236
9231
  );
9237
9232
  }
9238
9233
  /**
9239
- * Run an epoch move with `docId`'s local writes held back (#2816,
9240
- * behavior 10).
9241
- *
9242
- * A move replaces the document's overlay: the sealed Y.Doc is destroyed once
9243
- * the fresh one is bound. A write that resolved its target document before
9244
- * the move and lands its overlay entry after would land it in the doomed
9245
- * doc — and it could never be recovered, because `_pending_ops` records
9246
- * which fields a write touched, not the values it wrote. A write that starts
9247
- * during the move therefore waits here and resolves the document again on
9248
- * the other side. (Concurrent moves are serialized for the same reason.)
9234
+ * Run an operation while local writes to this large document are paused.
9235
+ * Concurrent operations are serialized. Writes resume against the current
9236
+ * document state after the operation completes.
9249
9237
  */
9250
9238
  static async holdFormat2Writes(docId, run2) {
9251
9239
  return resolveOrmContext(this).holdFormat2Writes(docId, run2);
@@ -9258,13 +9246,8 @@ var init_BaseModel = __esm({
9258
9246
  return resolveOrmContext(this).format2WritesHeld(docId);
9259
9247
  }
9260
9248
  /**
9261
- * The record store, Y.Doc and model map a format-2 write should land on,
9262
- * having waited out any epoch move in flight (#2816, behavior 10).
9263
- *
9264
- * Resolves to the callers' own values in the overwhelmingly common case that
9265
- * no move is running, so an ordinary write pays one map lookup. When a move
9266
- * IS running, the write waits for it and the freshly bound overlay — and its
9267
- * rebuilt store — are what it lands on.
9249
+ * Wait for any document transition to finish, then return the current
9250
+ * record store, Y.Doc, and model map for the write.
9268
9251
  */
9269
9252
  static async resolveFormat2Target(docId, modelName, store, yDoc, modelYMap) {
9270
9253
  const held = this.format2WritesHeld(docId);
@@ -9857,11 +9840,9 @@ var init_BaseModel = __esm({
9857
9840
  resolveOrmContext(this).trackDocumentIndexing(docId, work);
9858
9841
  }
9859
9842
  /**
9860
- * Resolve once `docId`'s applied changes have reached this class's instance
9861
- * of the query tables (#3023). See
9862
- * {@link OrmContext.whenDocumentIndexed} — an `open()` that waited for the
9863
- * initial sync waits for this too, otherwise it resolves on the sync signal
9864
- * and the caller's first `query()` sees a partly-written table.
9843
+ * Wait for applied document changes to reach the query tables.
9844
+ * Stops waiting and logs a warning if indexing has not settled after
9845
+ * 50 drain passes.
9865
9846
  */
9866
9847
  static async whenDocumentIndexed(docId) {
9867
9848
  const drained = await resolveOrmContext(this).whenDocumentIndexed(docId);
@@ -9874,14 +9855,9 @@ var init_BaseModel = __esm({
9874
9855
  /**
9875
9856
  * Initialize this model for a connected document.
9876
9857
  *
9877
- * `documentFormat` (#2816) decides where the records come from. On a legacy
9878
- * document the Y.Map IS the records, so this loads them into the query
9879
- * tables and observes the map. On a format-2 document the Y.Map is an epoch
9880
- * OVERLAY of flat `recordId/field` entries — walking it as records would
9881
- * read a scalar (or a `null` unset) as a record and mint junk rows, and
9882
- * observing it would run every overlay change through the legacy
9883
- * record-shaped path. There the tables are prepared here and hydrated and
9884
- * observed by `Format2DocumentBinding` from the merged view instead.
9858
+ * For legacy documents, load records and observe their changes. For large
9859
+ * documents, prepare the query tables; the document binding loads records
9860
+ * and observes changes.
9885
9861
  */
9886
9862
  static async initializeForDocument(yDoc, db, docId, permissionHint, documentFormat = 1) {
9887
9863
  const schema = this.getSchema?.();
@@ -10418,23 +10394,8 @@ var init_BaseModel = __esm({
10418
10394
  );
10419
10395
  }
10420
10396
  /**
10421
- * Re-index ONE record of a document from its current Y.Map state (#3615).
10422
- *
10423
- * A legacy document's initial load walks the Y.Map before the permanent
10424
- * observers are installed, so an update that lands in that window reaches
10425
- * Yjs and misses the query tables. For a document connected long ago — which
10426
- * is exactly what a model registered at runtime is initialized against —
10427
- * that window is open on a live document. `registerModel` collects the
10428
- * record ids touched while it runs and brings each of them here afterwards,
10429
- * writing the same row the permanent per-record observer would have written.
10430
- *
10431
- * A record the window DELETED is deleted here for the same reason.
10432
- *
10433
- * A storage failure REJECTS rather than being logged and passed over, the
10434
- * way the permanent observers' writes are: this write is part of what a
10435
- * registration promises before it resolves, so swallowing it would resolve a
10436
- * registration whose query tables are missing the very updates this call
10437
- * exists to catch, and mark the pair complete so no retry would repair it.
10397
+ * Refresh one record in the query tables from its current Y.Map state.
10398
+ * Remove the indexed record if it was deleted. Reject on storage failure.
10438
10399
  */
10439
10400
  static async reindexDocumentRecord(docId, recordId) {
10440
10401
  const modelConstructor = this;
@@ -10494,20 +10455,9 @@ var init_BaseModel = __esm({
10494
10455
  ctx.notifyListeners(modelName);
10495
10456
  }
10496
10457
  /**
10497
- * Withdraw ONE document's registration of this model (#3615).
10498
- *
10499
- * A `registerModel` that fails part-way through a document keeps the class
10500
- * registered, because retrying is the recovery. This is what keeps that
10501
- * half-finished pair from LOOKING finished in the meantime: without the
10502
- * Y.Map mapping a save raises the same `YMap not found` an unregistered
10503
- * model raises, instead of writing into a document whose observers were
10504
- * never installed, and clearing the rows the failed load managed to write
10505
- * keeps a query from answering out of a document nothing is watching. The
10506
- * retry's `initializeForDocument` publishes both again.
10507
- *
10508
- * `connectedDocuments` is deliberately left alone: it is the CONTEXT's map,
10509
- * shared by every model on the instance, so the document itself is still
10510
- * connected for everything else.
10458
+ * Remove this model's registration and indexed rows for one document
10459
+ * after a failed initialization. The document stays connected for other
10460
+ * models. Retry initialization to restore this model's registration.
10511
10461
  */
10512
10462
  static async withdrawDocumentRegistration(docId) {
10513
10463
  const modelConstructor = this;
@@ -11711,12 +11661,8 @@ var init_BaseModel = __esm({
11711
11661
  return true;
11712
11662
  }
11713
11663
  /**
11714
- * Remove a PAGE of records from the query tables, without consulting the
11715
- * merged view (#2816).
11716
- *
11717
- * The discard path: the rows are erased BEFORE the merged view is thrown
11718
- * away, because the view is the only place that still names them. Projecting
11719
- * would re-insert them — the record is still there at that point.
11664
+ * Remove records from the query tables before discarding their document
11665
+ * state. Notify listeners after the rows are removed.
11720
11666
  */
11721
11667
  static async deleteFormat2QueryRows(docId, recordIds) {
11722
11668
  if (recordIds.length === 0) return;
@@ -11730,12 +11676,8 @@ var init_BaseModel = __esm({
11730
11676
  modelConstructor.notifyListeners();
11731
11677
  }
11732
11678
  /**
11733
- * Project a PAGE of merged-view rows into the query tables (#2816).
11734
- *
11735
- * The hydration path: one notification for the page rather than one per
11736
- * record, because a model being hydrated has no intermediate states worth
11737
- * telling anyone about — and on a large document the per-record version is a
11738
- * subscriber callback per row of the document.
11679
+ * Update the query tables for a page of large-document records.
11680
+ * Notify listeners once after the page is indexed.
11739
11681
  */
11740
11682
  static async projectFormat2Records(docId, recordIds) {
11741
11683
  if (recordIds.length === 0) return;
@@ -4029,8 +4029,7 @@ declare class BaseModel implements StringSetChangeTracker {
4029
4029
  */
4030
4030
  static registerFormat2Document(docId: string,
4031
4031
  /**
4032
- * The facade, or a bare synchronous store — which is wrapped in an
4033
- * in-process host so the ORM has one thing to drive either way (#3429).
4032
+ * The asynchronous store, or a synchronous store to wrap for asynchronous use.
4034
4033
  */
4035
4034
  store: Format2RecordStoreAsync | Format2RecordStore,
4036
4035
  /**
@@ -4047,16 +4046,11 @@ declare class BaseModel implements StringSetChangeTracker {
4047
4046
  */
4048
4047
  static clearFormat2Documents(): void;
4049
4048
  /**
4050
- * The SYNCHRONOUS record store for `docId`, when one runs in this thread.
4051
- *
4052
- * `null` for a format-1 document, and `null` for a format-2 document whose
4053
- * store lives in a worker (#3429) — there is no such object here to hand
4054
- * out. The ORM drives {@link getFormat2StoreAsync}; this is kept for the
4055
- * direct reaches that predate the boundary (tests, diagnostics).
4049
+ * Return the synchronous record store for a document, or `null` for a
4050
+ * legacy document or a store running in a worker.
4056
4051
  *
4057
- * A write made through it is visible to the facade's reads and marks at
4058
- * once — it is the same database — but it does NOT refresh row-cache entries
4059
- * live instances are already holding; those follow the next settlement.
4052
+ * Direct writes update the store but do not immediately refresh cached model
4053
+ * instances. Use model methods for application writes.
4060
4054
  */
4061
4055
  static getFormat2Store(docId: string | null | undefined): Format2RecordStore | null;
4062
4056
  /** The asynchronous facade for `docId`, or `null` when it is format 1. */
@@ -4111,16 +4105,9 @@ declare class BaseModel implements StringSetChangeTracker {
4111
4105
  /** Every connected format-2 document, or just the ones a caller scoped to. */
4112
4106
  protected static format2DocumentsInScope(documents?: string | readonly string[] | null): string[];
4113
4107
  /**
4114
- * Run an epoch move with `docId`'s local writes held back (#2816,
4115
- * behavior 10).
4116
- *
4117
- * A move replaces the document's overlay: the sealed Y.Doc is destroyed once
4118
- * the fresh one is bound. A write that resolved its target document before
4119
- * the move and lands its overlay entry after would land it in the doomed
4120
- * doc — and it could never be recovered, because `_pending_ops` records
4121
- * which fields a write touched, not the values it wrote. A write that starts
4122
- * during the move therefore waits here and resolves the document again on
4123
- * the other side. (Concurrent moves are serialized for the same reason.)
4108
+ * Run an operation while local writes to this large document are paused.
4109
+ * Concurrent operations are serialized. Writes resume against the current
4110
+ * document state after the operation completes.
4124
4111
  */
4125
4112
  static holdFormat2Writes<T>(docId: string, run: () => Promise<T>): Promise<T>;
4126
4113
  /**
@@ -4129,13 +4116,8 @@ declare class BaseModel implements StringSetChangeTracker {
4129
4116
  */
4130
4117
  static format2WritesHeld(docId: string | null | undefined): Promise<void> | null;
4131
4118
  /**
4132
- * The record store, Y.Doc and model map a format-2 write should land on,
4133
- * having waited out any epoch move in flight (#2816, behavior 10).
4134
- *
4135
- * Resolves to the callers' own values in the overwhelmingly common case that
4136
- * no move is running, so an ordinary write pays one map lookup. When a move
4137
- * IS running, the write waits for it and the freshly bound overlay — and its
4138
- * rebuilt store — are what it lands on.
4119
+ * Wait for any document transition to finish, then return the current
4120
+ * record store, Y.Doc, and model map for the write.
4139
4121
  */
4140
4122
  static resolveFormat2Target(docId: string, modelName: string, store: Format2RecordStoreAsync, yDoc: Y.Doc, modelYMap: Y.Map<any>): Promise<{
4141
4123
  store: Format2RecordStoreAsync;
@@ -4213,61 +4195,28 @@ declare class BaseModel implements StringSetChangeTracker {
4213
4195
  */
4214
4196
  protected static trackDocumentIndexing(docId: string, work: Promise<void>): void;
4215
4197
  /**
4216
- * Resolve once `docId`'s applied changes have reached this class's instance
4217
- * of the query tables (#3023). See
4218
- * {@link OrmContext.whenDocumentIndexed} — an `open()` that waited for the
4219
- * initial sync waits for this too, otherwise it resolves on the sync signal
4220
- * and the caller's first `query()` sees a partly-written table.
4198
+ * Wait for applied document changes to reach the query tables.
4199
+ * Stops waiting and logs a warning if indexing has not settled after
4200
+ * 50 drain passes.
4221
4201
  */
4222
4202
  static whenDocumentIndexed(docId: string): Promise<void>;
4223
4203
  /**
4224
4204
  * Initialize this model for a connected document.
4225
4205
  *
4226
- * `documentFormat` (#2816) decides where the records come from. On a legacy
4227
- * document the Y.Map IS the records, so this loads them into the query
4228
- * tables and observes the map. On a format-2 document the Y.Map is an epoch
4229
- * OVERLAY of flat `recordId/field` entries — walking it as records would
4230
- * read a scalar (or a `null` unset) as a record and mint junk rows, and
4231
- * observing it would run every overlay change through the legacy
4232
- * record-shaped path. There the tables are prepared here and hydrated and
4233
- * observed by `Format2DocumentBinding` from the merged view instead.
4206
+ * For legacy documents, load records and observe their changes. For large
4207
+ * documents, prepare the query tables; the document binding loads records
4208
+ * and observes changes.
4234
4209
  */
4235
4210
  static initializeForDocument(yDoc: Y.Doc, db: DatabaseEngine, docId: string, permissionHint: DocumentPermissionHint, documentFormat?: 1 | 2): Promise<void>;
4236
4211
  /**
4237
- * Re-index ONE record of a document from its current Y.Map state (#3615).
4238
- *
4239
- * A legacy document's initial load walks the Y.Map before the permanent
4240
- * observers are installed, so an update that lands in that window reaches
4241
- * Yjs and misses the query tables. For a document connected long ago — which
4242
- * is exactly what a model registered at runtime is initialized against —
4243
- * that window is open on a live document. `registerModel` collects the
4244
- * record ids touched while it runs and brings each of them here afterwards,
4245
- * writing the same row the permanent per-record observer would have written.
4246
- *
4247
- * A record the window DELETED is deleted here for the same reason.
4248
- *
4249
- * A storage failure REJECTS rather than being logged and passed over, the
4250
- * way the permanent observers' writes are: this write is part of what a
4251
- * registration promises before it resolves, so swallowing it would resolve a
4252
- * registration whose query tables are missing the very updates this call
4253
- * exists to catch, and mark the pair complete so no retry would repair it.
4212
+ * Refresh one record in the query tables from its current Y.Map state.
4213
+ * Remove the indexed record if it was deleted. Reject on storage failure.
4254
4214
  */
4255
4215
  static reindexDocumentRecord(docId: string, recordId: string): Promise<void>;
4256
4216
  /**
4257
- * Withdraw ONE document's registration of this model (#3615).
4258
- *
4259
- * A `registerModel` that fails part-way through a document keeps the class
4260
- * registered, because retrying is the recovery. This is what keeps that
4261
- * half-finished pair from LOOKING finished in the meantime: without the
4262
- * Y.Map mapping a save raises the same `YMap not found` an unregistered
4263
- * model raises, instead of writing into a document whose observers were
4264
- * never installed, and clearing the rows the failed load managed to write
4265
- * keeps a query from answering out of a document nothing is watching. The
4266
- * retry's `initializeForDocument` publishes both again.
4267
- *
4268
- * `connectedDocuments` is deliberately left alone: it is the CONTEXT's map,
4269
- * shared by every model on the instance, so the document itself is still
4270
- * connected for everything else.
4217
+ * Remove this model's registration and indexed rows for one document
4218
+ * after a failed initialization. The document stays connected for other
4219
+ * models. Retry initialization to restore this model's registration.
4271
4220
  */
4272
4221
  static withdrawDocumentRegistration(docId: string): Promise<void>;
4273
4222
  static cleanupDocumentData(docId: string): Promise<void>;
@@ -4433,10 +4382,8 @@ declare class BaseModel implements StringSetChangeTracker {
4433
4382
  */
4434
4383
  static projectFormat2Record(docId: string, recordId: string,
4435
4384
  /**
4436
- * `notify: false` withholds the listener notification, for a caller
4437
- * projecting many records at once (#2816): hydrating a model would
4438
- * otherwise tell every subscriber once per record, which on a large
4439
- * document is a re-render per row of the document.
4385
+ * Set `notify: false` to suppress listener notifications when indexing
4386
+ * several records together.
4440
4387
  */
4441
4388
  options?: {
4442
4389
  notify?: boolean;
@@ -4458,21 +4405,13 @@ declare class BaseModel implements StringSetChangeTracker {
4458
4405
  /** Project `recordIds` through the store's host; whether anything was sent. */
4459
4406
  private static projectFormat2Ids;
4460
4407
  /**
4461
- * Remove a PAGE of records from the query tables, without consulting the
4462
- * merged view (#2816).
4463
- *
4464
- * The discard path: the rows are erased BEFORE the merged view is thrown
4465
- * away, because the view is the only place that still names them. Projecting
4466
- * would re-insert them — the record is still there at that point.
4408
+ * Remove records from the query tables before discarding their document
4409
+ * state. Notify listeners after the rows are removed.
4467
4410
  */
4468
4411
  static deleteFormat2QueryRows(docId: string, recordIds: readonly string[]): Promise<void>;
4469
4412
  /**
4470
- * Project a PAGE of merged-view rows into the query tables (#2816).
4471
- *
4472
- * The hydration path: one notification for the page rather than one per
4473
- * record, because a model being hydrated has no intermediate states worth
4474
- * telling anyone about — and on a large document the per-record version is a
4475
- * subscriber callback per row of the document.
4413
+ * Update the query tables for a page of large-document records.
4414
+ * Notify listeners once after the page is indexed.
4476
4415
  */
4477
4416
  static projectFormat2Records(docId: string, recordIds: readonly string[]): Promise<void>;
4478
4417
  delete(): Promise<void>;
package/dist/browser.d.ts CHANGED
@@ -4029,8 +4029,7 @@ declare class BaseModel implements StringSetChangeTracker {
4029
4029
  */
4030
4030
  static registerFormat2Document(docId: string,
4031
4031
  /**
4032
- * The facade, or a bare synchronous store — which is wrapped in an
4033
- * in-process host so the ORM has one thing to drive either way (#3429).
4032
+ * The asynchronous store, or a synchronous store to wrap for asynchronous use.
4034
4033
  */
4035
4034
  store: Format2RecordStoreAsync | Format2RecordStore,
4036
4035
  /**
@@ -4047,16 +4046,11 @@ declare class BaseModel implements StringSetChangeTracker {
4047
4046
  */
4048
4047
  static clearFormat2Documents(): void;
4049
4048
  /**
4050
- * The SYNCHRONOUS record store for `docId`, when one runs in this thread.
4051
- *
4052
- * `null` for a format-1 document, and `null` for a format-2 document whose
4053
- * store lives in a worker (#3429) — there is no such object here to hand
4054
- * out. The ORM drives {@link getFormat2StoreAsync}; this is kept for the
4055
- * direct reaches that predate the boundary (tests, diagnostics).
4049
+ * Return the synchronous record store for a document, or `null` for a
4050
+ * legacy document or a store running in a worker.
4056
4051
  *
4057
- * A write made through it is visible to the facade's reads and marks at
4058
- * once — it is the same database — but it does NOT refresh row-cache entries
4059
- * live instances are already holding; those follow the next settlement.
4052
+ * Direct writes update the store but do not immediately refresh cached model
4053
+ * instances. Use model methods for application writes.
4060
4054
  */
4061
4055
  static getFormat2Store(docId: string | null | undefined): Format2RecordStore | null;
4062
4056
  /** The asynchronous facade for `docId`, or `null` when it is format 1. */
@@ -4111,16 +4105,9 @@ declare class BaseModel implements StringSetChangeTracker {
4111
4105
  /** Every connected format-2 document, or just the ones a caller scoped to. */
4112
4106
  protected static format2DocumentsInScope(documents?: string | readonly string[] | null): string[];
4113
4107
  /**
4114
- * Run an epoch move with `docId`'s local writes held back (#2816,
4115
- * behavior 10).
4116
- *
4117
- * A move replaces the document's overlay: the sealed Y.Doc is destroyed once
4118
- * the fresh one is bound. A write that resolved its target document before
4119
- * the move and lands its overlay entry after would land it in the doomed
4120
- * doc — and it could never be recovered, because `_pending_ops` records
4121
- * which fields a write touched, not the values it wrote. A write that starts
4122
- * during the move therefore waits here and resolves the document again on
4123
- * the other side. (Concurrent moves are serialized for the same reason.)
4108
+ * Run an operation while local writes to this large document are paused.
4109
+ * Concurrent operations are serialized. Writes resume against the current
4110
+ * document state after the operation completes.
4124
4111
  */
4125
4112
  static holdFormat2Writes<T>(docId: string, run: () => Promise<T>): Promise<T>;
4126
4113
  /**
@@ -4129,13 +4116,8 @@ declare class BaseModel implements StringSetChangeTracker {
4129
4116
  */
4130
4117
  static format2WritesHeld(docId: string | null | undefined): Promise<void> | null;
4131
4118
  /**
4132
- * The record store, Y.Doc and model map a format-2 write should land on,
4133
- * having waited out any epoch move in flight (#2816, behavior 10).
4134
- *
4135
- * Resolves to the callers' own values in the overwhelmingly common case that
4136
- * no move is running, so an ordinary write pays one map lookup. When a move
4137
- * IS running, the write waits for it and the freshly bound overlay — and its
4138
- * rebuilt store — are what it lands on.
4119
+ * Wait for any document transition to finish, then return the current
4120
+ * record store, Y.Doc, and model map for the write.
4139
4121
  */
4140
4122
  static resolveFormat2Target(docId: string, modelName: string, store: Format2RecordStoreAsync, yDoc: Y.Doc, modelYMap: Y.Map<any>): Promise<{
4141
4123
  store: Format2RecordStoreAsync;
@@ -4213,61 +4195,28 @@ declare class BaseModel implements StringSetChangeTracker {
4213
4195
  */
4214
4196
  protected static trackDocumentIndexing(docId: string, work: Promise<void>): void;
4215
4197
  /**
4216
- * Resolve once `docId`'s applied changes have reached this class's instance
4217
- * of the query tables (#3023). See
4218
- * {@link OrmContext.whenDocumentIndexed} — an `open()` that waited for the
4219
- * initial sync waits for this too, otherwise it resolves on the sync signal
4220
- * and the caller's first `query()` sees a partly-written table.
4198
+ * Wait for applied document changes to reach the query tables.
4199
+ * Stops waiting and logs a warning if indexing has not settled after
4200
+ * 50 drain passes.
4221
4201
  */
4222
4202
  static whenDocumentIndexed(docId: string): Promise<void>;
4223
4203
  /**
4224
4204
  * Initialize this model for a connected document.
4225
4205
  *
4226
- * `documentFormat` (#2816) decides where the records come from. On a legacy
4227
- * document the Y.Map IS the records, so this loads them into the query
4228
- * tables and observes the map. On a format-2 document the Y.Map is an epoch
4229
- * OVERLAY of flat `recordId/field` entries — walking it as records would
4230
- * read a scalar (or a `null` unset) as a record and mint junk rows, and
4231
- * observing it would run every overlay change through the legacy
4232
- * record-shaped path. There the tables are prepared here and hydrated and
4233
- * observed by `Format2DocumentBinding` from the merged view instead.
4206
+ * For legacy documents, load records and observe their changes. For large
4207
+ * documents, prepare the query tables; the document binding loads records
4208
+ * and observes changes.
4234
4209
  */
4235
4210
  static initializeForDocument(yDoc: Y.Doc, db: DatabaseEngine, docId: string, permissionHint: DocumentPermissionHint, documentFormat?: 1 | 2): Promise<void>;
4236
4211
  /**
4237
- * Re-index ONE record of a document from its current Y.Map state (#3615).
4238
- *
4239
- * A legacy document's initial load walks the Y.Map before the permanent
4240
- * observers are installed, so an update that lands in that window reaches
4241
- * Yjs and misses the query tables. For a document connected long ago — which
4242
- * is exactly what a model registered at runtime is initialized against —
4243
- * that window is open on a live document. `registerModel` collects the
4244
- * record ids touched while it runs and brings each of them here afterwards,
4245
- * writing the same row the permanent per-record observer would have written.
4246
- *
4247
- * A record the window DELETED is deleted here for the same reason.
4248
- *
4249
- * A storage failure REJECTS rather than being logged and passed over, the
4250
- * way the permanent observers' writes are: this write is part of what a
4251
- * registration promises before it resolves, so swallowing it would resolve a
4252
- * registration whose query tables are missing the very updates this call
4253
- * exists to catch, and mark the pair complete so no retry would repair it.
4212
+ * Refresh one record in the query tables from its current Y.Map state.
4213
+ * Remove the indexed record if it was deleted. Reject on storage failure.
4254
4214
  */
4255
4215
  static reindexDocumentRecord(docId: string, recordId: string): Promise<void>;
4256
4216
  /**
4257
- * Withdraw ONE document's registration of this model (#3615).
4258
- *
4259
- * A `registerModel` that fails part-way through a document keeps the class
4260
- * registered, because retrying is the recovery. This is what keeps that
4261
- * half-finished pair from LOOKING finished in the meantime: without the
4262
- * Y.Map mapping a save raises the same `YMap not found` an unregistered
4263
- * model raises, instead of writing into a document whose observers were
4264
- * never installed, and clearing the rows the failed load managed to write
4265
- * keeps a query from answering out of a document nothing is watching. The
4266
- * retry's `initializeForDocument` publishes both again.
4267
- *
4268
- * `connectedDocuments` is deliberately left alone: it is the CONTEXT's map,
4269
- * shared by every model on the instance, so the document itself is still
4270
- * connected for everything else.
4217
+ * Remove this model's registration and indexed rows for one document
4218
+ * after a failed initialization. The document stays connected for other
4219
+ * models. Retry initialization to restore this model's registration.
4271
4220
  */
4272
4221
  static withdrawDocumentRegistration(docId: string): Promise<void>;
4273
4222
  static cleanupDocumentData(docId: string): Promise<void>;
@@ -4433,10 +4382,8 @@ declare class BaseModel implements StringSetChangeTracker {
4433
4382
  */
4434
4383
  static projectFormat2Record(docId: string, recordId: string,
4435
4384
  /**
4436
- * `notify: false` withholds the listener notification, for a caller
4437
- * projecting many records at once (#2816): hydrating a model would
4438
- * otherwise tell every subscriber once per record, which on a large
4439
- * document is a re-render per row of the document.
4385
+ * Set `notify: false` to suppress listener notifications when indexing
4386
+ * several records together.
4440
4387
  */
4441
4388
  options?: {
4442
4389
  notify?: boolean;
@@ -4458,21 +4405,13 @@ declare class BaseModel implements StringSetChangeTracker {
4458
4405
  /** Project `recordIds` through the store's host; whether anything was sent. */
4459
4406
  private static projectFormat2Ids;
4460
4407
  /**
4461
- * Remove a PAGE of records from the query tables, without consulting the
4462
- * merged view (#2816).
4463
- *
4464
- * The discard path: the rows are erased BEFORE the merged view is thrown
4465
- * away, because the view is the only place that still names them. Projecting
4466
- * would re-insert them — the record is still there at that point.
4408
+ * Remove records from the query tables before discarding their document
4409
+ * state. Notify listeners after the rows are removed.
4467
4410
  */
4468
4411
  static deleteFormat2QueryRows(docId: string, recordIds: readonly string[]): Promise<void>;
4469
4412
  /**
4470
- * Project a PAGE of merged-view rows into the query tables (#2816).
4471
- *
4472
- * The hydration path: one notification for the page rather than one per
4473
- * record, because a model being hydrated has no intermediate states worth
4474
- * telling anyone about — and on a large document the per-record version is a
4475
- * subscriber callback per row of the document.
4413
+ * Update the query tables for a page of large-document records.
4414
+ * Notify listeners once after the page is indexed.
4476
4415
  */
4477
4416
  static projectFormat2Records(docId: string, recordIds: readonly string[]): Promise<void>;
4478
4417
  delete(): Promise<void>;