@procedures/mongo 0.34.0 → 0.35.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/index.d.ts CHANGED
@@ -26,15 +26,15 @@ export type { ScopeInput } from "./scope.js";
26
26
  export { hasCollection, requireCollection, getBaseMeta, } from "./types.js";
27
27
  export type { MongoProcedures, ProcedureInput, ProcedureOutput, PingInput, PingOutput, InfoInput, ListCollectionsInput, ListCollectionsOutput, CreateCollectionInput, CreateCollectionOutput, DropCollectionInput, DropCollectionOutput, StatsInput, FindInput, FindOutput, GetInput, GetOutput, InsertInput, InsertOutput, UpdateInput, UpdateOutput, DeleteInput, DeleteOutput, CountInput, CountOutput, AggregateInput, AggregateOutput, DistinctInput, DistinctOutput, BulkInput, BulkOutput, ExplainInput, ExplainOutput, WatchInput, WatchChange, ListIndexesInput, ListIndexesOutput, CreateIndexInput, CreateIndexOutput, DropIndexInput, DropIndexOutput, } from "./procedures.types.js";
28
28
  export type { PaginationInput, PaginationOutput, SortOrder, SortSpec, DocumentId, BaseDocument, MongoDocument, DocumentQuery, DocumentUpdate, BaseMeta, CollectionMeta, BulkInsertOne, BulkUpdateOne, BulkUpdateMany, BulkDeleteOne, BulkDeleteMany, BulkOperation, BulkWriteResult, IndexSpec, IndexOptions, IndexInfo, CollectionOptions, CollectionStats, DatabaseInfo, AggregationStage, AggregationOptions, } from "./types.js";
29
- export { MongoStorage, MongoDocumentStorage, selectorPrefilter } from "./storage/index.js";
30
- export type { MongoStorageOptions, MongoDocumentStorageOptions } from "./storage/index.js";
29
+ export { MongoStorage, MongoDocumentStorage, selectorPrefilter, DOCUMENT_STORAGE_FIELDS, TOMBSTONE_FIELD, DEFAULT_STORED_FORM, decodeStoredDocument, } from "./storage/index.js";
30
+ export type { MongoStorageOptions, MongoDocumentStorageOptions, SelectorPrefilterOptions, StoredForm, DecodeStoredDocumentOptions, StoredDocumentEntry } from "./storage/index.js";
31
31
  export { BLOCKED_PIPELINE_OPERATORS, ALLOWED_PIPELINE_STAGES, DEFAULT_PIPELINE_LIMITS, assertNoBlockedOperators, boundPipeline, cutResults, isTimeLimitError, scopePipeline, } from "./storage/index.js";
32
32
  export type { PipelineLimits, PipelineScope } from "./storage/index.js";
33
33
  export { registerMongoProcedures, procedures } from "./module.js";
34
34
  export * from "./procedures/index.js";
35
35
  export type { Db, Collection, Document, ObjectId, Filter, UpdateFilter, FindOptions, AggregateOptions, } from "mongodb";
36
36
  export { ViewMaterializer, identityPartition, partitionTargetId, viewFilter, VIEW_GENERATION_FIELD, VIEW_HASH_FIELD } from "./storage/index.js";
37
- export type { MaterializedView, MaterializedViewStatus, ViewMaterializerOptions, ViewPartitionOf, ViewPipelineScope, ViewTargetId } from "./storage/index.js";
37
+ export type { MaterializedView, MaterializedViewStatus, ViewMaterializerOptions, ViewPartitionOf, ViewPipelineScope, ViewStorageSource, ViewTargetId } from "./storage/index.js";
38
38
  export { MongoViewStorage } from "./storage/index.js";
39
39
  export type { MongoViewStorageOptions } from "./storage/index.js";
40
40
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,OAAO,EACL,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAM7C,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,eAAe,EACf,cAAc,EACd,eAAe,EAEf,SAAS,EACT,UAAU,EACV,SAAS,EACT,oBAAoB,EACpB,q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S,CAAC;AAEjB,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAChJ,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEjL,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ hasCollection, requireCollection, getBaseMeta, } from "./types.js";
33
33
  // =============================================================================
34
34
  // Storage (CollectionStorage implementation)
35
35
  // =============================================================================
36
- export { MongoStorage, MongoDocumentStorage, selectorPrefilter } from "./storage/index.js";
36
+ export { MongoStorage, MongoDocumentStorage, selectorPrefilter, DOCUMENT_STORAGE_FIELDS, TOMBSTONE_FIELD, DEFAULT_STORED_FORM, decodeStoredDocument, } from "./storage/index.js";
37
37
  // The guard of an aggregation pipeline over shared collections, and its limits (Graph's split plan, P3)
38
38
  export { BLOCKED_PIPELINE_OPERATORS, ALLOWED_PIPELINE_STAGES, DEFAULT_PIPELINE_LIMITS, assertNoBlockedOperators, boundPipeline, cutResults, isTimeLimitError, scopePipeline, } from "./storage/index.js";
39
39
  // =============================================================================
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,gFAAgF;AAChF,wBAAwB;AACxB,gFAAgF;AAEhF,OAAO,EACL,OAAO,EACP,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAKzB,gFAAgF;A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6C;AAC7C,gFAAgF;AAEhF,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAE5B,wGAAwG;AACxG,OAAO,EACL,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,aAAa,GACd,MAAM,oBAAoB,CAAC;AAG5B,gFAAgF;AAChF,yBAAyB;AACzB,gFAAgF;AAEhF,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAElE,gFAAgF;AAChF,sDAAsD;AACtD,gFAAgF;AAEhF,cAAc,uBAAuB,CAAC;AAgBtC,uEAAuE;AACvE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEhJ,6GAA6G;AAC7G,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -4,10 +4,13 @@
4
4
  * `{ _id, data }` documents.
5
5
  *
6
6
  * The documents:
7
- * - An item that is a plain object with safe keys is stored flat: its fields beside the fields of
8
- * the storage. Another item (null, a primitive, an array, or an object with a key of the storage,
9
- * a key that starts with `$` or a key with a dot) is stored as JSON text in `_json`. Both ways
10
- * give the item back as it was.
7
+ * - An item that is a plain object is stored flat: its fields beside the fields of the storage. A
8
+ * key with `$` or a dot below the top level, and a top-level key with a dot, stay as they are
9
+ * (MongoDB 5.0 or later keeps them). Another item is stored as JSON text in `_json`: null, a
10
+ * primitive, an array, an object with a top-level key of the storage or a top-level key that
11
+ * starts with `$`, a key `__proto__`, or a class instance other than `Date`. Both ways give the
12
+ * item back as it was. An object with a text `$ref` and an `$id` is refused (`TypeError`):
13
+ * MongoDB gives it back as a `DBRef`.
11
14
  * - An item whose `_id` is its id keeps it: the storage gives it back.
12
15
  * - The fields of the storage: `_key` (the id), `_part` (the partition), `_seq` (the sequence
13
16
  * number of the last write), `_ord` (the number of the first write: the order of the entries, as
@@ -16,6 +19,40 @@
16
19
  * character U+001F. Each partition reads and writes only its documents: each write filter has the
17
20
  * partition too, so a write of a stored `_id` of another partition fails and changes nothing.
18
21
  *
22
+ * The stored form (roadmap CLI-76): an app with its own form of documents keeps it with the option
23
+ * `form`, one `StoredForm` object. `DEFAULT_STORED_FORM` gives the form above, byte for byte.
24
+ * - `storedId(partition, id)` gives the stored `_id`, and `idOf(storedId, partition)` is its inverse.
25
+ * The stored `_id` can be any value but `undefined` and `null`, for example `tenant:key`.
26
+ * - `partitionFields(partition)` gives the fields that name the partition (default `{ _part }`).
27
+ * Each document of the partition has them, and they are the filter of the partition. A field with
28
+ * the value `undefined` is absent: the document does not have it, and the filter is
29
+ * `{ $exists: false }`. An item can have a partition field (one that is not a field of the
30
+ * storage) with the value of its partition: the write leaves it out and notes it in `_kpf`, and
31
+ * the read gives it back. The same field with another value is refused (`TypeError`).
32
+ * - `partitionOf(doc)` gives the partition of a stored document, for `ViewMaterializer`. A delete
33
+ * event has only the `documentKey`: so the `_id` must tell the partition, or the collection needs
34
+ * `changeStreamPreAndPostImages`.
35
+ * - The storage adds its fields (`_key`, `_seq`, `_ord`, `_tomb`, and `_kid` or `_json` as needed)
36
+ * in each form. A reader of the raw documents can leave them out (`DOCUMENT_STORAGE_FIELDS`), and
37
+ * must leave out the tombstones (`TOMBSTONE_FIELD` is `true`). `decodeStoredDocument(doc)` does
38
+ * this, as the storage reads a document.
39
+ * - A document without the fields of the storage (for example one written before the app used the
40
+ * storage) is an item too. Its id comes from `idOf`, else from `_key`, and its item gets that id
41
+ * as `_id`. Its partition fields follow the rule of a written document without `_kpf`: a field
42
+ * with the value of the partition stays out, and a field with another value stays in. So the
43
+ * item has the same form before and after its first write. A document whose id neither
44
+ * tells (for example an `ObjectId` that `idOf` does not name) is not an item: the reads and
45
+ * `size()` leave it out. Its version is `0`, and it comes before the other items in the order of
46
+ * the entries (then by `_id`). A full result of the change log has it, and a delta has it after
47
+ * its first write through the storage. That write gives it its fields and a version, and keeps
48
+ * its place.
49
+ * - Write through the storage. A raw write (for example `findOneAndReplace` or a script) takes no
50
+ * number of the sequence, so a delta of the change log does not give it, and a raw replace drops
51
+ * `_seq`.
52
+ * - A raw writer must not hard-delete an item while the storage writes it. The write of a document
53
+ * without `_seq` is an upsert with `{ _seq: { $exists: false } }`: after a hard delete between
54
+ * the read and the write, the upsert inserts the document again.
55
+ *
19
56
  * The change log:
20
57
  * - Each write gets the next number of the sequence of the collection. `_seq` is also the version
21
58
  * of the item (`versionOf`).
@@ -31,6 +68,9 @@
31
68
  * its lease moves its documents to new numbers, so a reader that passed the old numbers gets
32
69
  * it. One case stays on a single server: a process that stops between such a late write and the
33
70
  * move of its documents. Then a reader that passed the old numbers does not get that change.
71
+ * - The storage uses a transaction only with a client: the option `client`, or the default
72
+ * connection when `db` is absent. With `db` and no `client`, each write uses the watermark, also
73
+ * on a replica set.
34
74
  *
35
75
  * The queries: `query()` sends the conditions that MongoDB tests in the same way (the equality of
36
76
  * a string, a number or a boolean, and `$in` of them) as a filter. `queryEntries()` of the core
@@ -45,6 +85,10 @@
45
85
  * precondition has the `_seq` that the test read in its filter (a compare-and-set). Another writer
46
86
  * between the test and the write makes the write fail with `VersionConflictError`. Then a batch of
47
87
  * more than one item can keep a part of its writes: only a transaction makes a batch all or nothing.
88
+ * One case stays on a single server: a writer outside the storage that writes a document without
89
+ * `_seq` between the test and the write. The guard of such a document is `{ _seq: { $exists:
90
+ * false } }`, so it does not see that writer. On a replica set, the test and the write are one
91
+ * transaction, and this case does not occur.
48
92
  */
49
93
  import type { Db, Document, MongoClient } from "mongodb";
50
94
  import { type CollectionStorage, type StorageBatchWriteOptions, type StorageChanges, type StorageItemWriteOptions, type StorageMetadata, type StoragePatch, type StorageQueryOptions, type StorageQueryPolicy, type StorageSelector, type StorageWriteOptions } from "@procedures/collections";
@@ -52,6 +96,52 @@ import { type Duration } from "@procedures/client";
52
96
  import { type PipelineLimits } from "./pipeline-scope.js";
53
97
  /** The separator of the partition and the id in a stored `_id`. */
54
98
  export declare const SEPARATOR = "\u001F";
99
+ /**
100
+ * The fields that a `MongoDocumentStorage` can add to a stored document, in each stored form
101
+ * (roadmap CLI-76). A reader of the raw documents can leave them out. The partition fields are
102
+ * not in the list.
103
+ */
104
+ export declare const DOCUMENT_STORAGE_FIELDS: readonly string[];
105
+ /** The field that is `true` in a tombstone: the document of a deleted item. A reader of the raw documents leaves them out. */
106
+ export declare const TOMBSTONE_FIELD: "_tomb";
107
+ /**
108
+ * The stored form of a `MongoDocumentStorage` (roadmap CLI-76): how an id and a partition become a
109
+ * stored document, and back. Give the same object to the storage (`form`) and to a
110
+ * `ViewMaterializer` (`storageSources`), or read it from `storage.form`.
111
+ */
112
+ export interface StoredForm {
113
+ /**
114
+ * The stored `_id` of an id in a partition. It must give a value other than `undefined` and
115
+ * `null`, and two ids of one partition must not give the same value.
116
+ */
117
+ storedId(partition: string | undefined, id: string): unknown;
118
+ /** The inverse of `storedId`: the id of a stored `_id`, or `undefined` when the `_id` is not of the partition. */
119
+ idOf(storedId: unknown, partition: string | undefined): string | undefined;
120
+ /**
121
+ * The fields that name a partition. Each document of the partition has them, and they are the
122
+ * filter of the partition. A field with the value `undefined` is absent: the document does not
123
+ * have it, and the filter is `{ $exists: false }`. Give the same names for each partition. A
124
+ * top-level field of an item with one of these names and the value of the partition is left out
125
+ * of the stored fields and noted in `_kpf`, and the read gives it back. Another value is refused
126
+ * with a `TypeError`.
127
+ */
128
+ partitionFields(partition: string | undefined): Readonly<Record<string, unknown>>;
129
+ /**
130
+ * The partition of a stored document, or `undefined` when the document does not tell it. A
131
+ * `ViewMaterializer` gives the document of a change event: `fullDocument`, else
132
+ * `fullDocumentBeforeChange`, else `documentKey`. A delete event has only `documentKey`, so with
133
+ * another `storedId`, the `_id` must tell the partition, or the collection needs
134
+ * `changeStreamPreAndPostImages`. The storage writes a delete as a tombstone (a replace event with
135
+ * the whole document), so the gap is only for a raw hard delete.
136
+ */
137
+ partitionOf(doc: Document): string | undefined;
138
+ }
139
+ /**
140
+ * The default stored form, the form of 0.34.0. The stored `_id` is the id, or `<partition>` +
141
+ * U+001F + `<id>` with a partition. The partition field is `_part` (absent without a partition).
142
+ * `partitionOf` reads `_part`, else the part of `_id` before U+001F.
143
+ */
144
+ export declare const DEFAULT_STORED_FORM: StoredForm;
55
145
  /** The options of a `MongoDocumentStorage`. */
56
146
  export interface MongoDocumentStorageOptions<T = unknown> {
57
147
  /** The MongoDB collection. */
@@ -73,7 +163,8 @@ export interface MongoDocumentStorageOptions<T = unknown> {
73
163
  writeLease?: Duration | undefined;
74
164
  /**
75
165
  * The client of the database, for the transactions. The default is the client of the default
76
- * connection when `db` is absent. Without a client, the writes use the watermark.
166
+ * connection when `db` is absent. Without a client, the writes use the watermark: with `db` and
167
+ * no `client`, a write is not a transaction, also on a replica set.
77
168
  */
78
169
  client?: (() => MongoClient | Promise<MongoClient>) | undefined;
79
170
  /**
@@ -89,12 +180,61 @@ export interface MongoDocumentStorageOptions<T = unknown> {
89
180
  * the sequence number of the last write.
90
181
  */
91
182
  versionOf?: ((item: T) => string | undefined) | undefined;
183
+ /**
184
+ * The stored form (roadmap CLI-76): the stored `_id`, its inverse, the partition fields and the
185
+ * partition of a document. The default `DEFAULT_STORED_FORM` writes the documents of 0.34.0.
186
+ */
187
+ form?: StoredForm | undefined;
188
+ }
189
+ /** The options of `decodeStoredDocument`. */
190
+ export interface DecodeStoredDocumentOptions {
191
+ /** The stored form of the storage, for example `storage.form` (default `DEFAULT_STORED_FORM`). */
192
+ form?: StoredForm | undefined;
193
+ /** The partition of the document. The default is `form.partitionOf(doc)`. */
194
+ partition?: string | undefined;
195
+ /**
196
+ * True (the default): an item that is a plain object without `_id` gets its id as `_id`. False:
197
+ * the item is as the storage gives it, with `_id` only when it had it.
198
+ */
199
+ addId?: boolean | undefined;
200
+ }
201
+ /** An item of a stored document, from `decodeStoredDocument`. */
202
+ export interface StoredDocumentEntry<T> {
203
+ /** The id of the item. */
204
+ id: string;
205
+ /** The partition of the document. */
206
+ partition: string | undefined;
207
+ /** The item. */
208
+ item: T;
209
+ }
210
+ /**
211
+ * This function reads a raw document of a `MongoDocumentStorage` collection as the storage reads
212
+ * it (roadmap CLI-76), for an app that reads the collection directly (a query, a view, an
213
+ * aggregation). It gives `undefined` for a tombstone and for a document whose id neither `idOf`
214
+ * nor `_key` tells. Else it parses `_json`, leaves out the fields of the storage
215
+ * (`DOCUMENT_STORAGE_FIELDS`) and gives the item its id as `_id` (see `addId`).
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * const items = docs.flatMap((doc) => decodeStoredDocument<Note>(doc, { form: notes.form })?.item ?? []);
220
+ * ```
221
+ */
222
+ export declare function decodeStoredDocument<T = Document>(doc: Document, options?: DecodeStoredDocumentOptions): StoredDocumentEntry<T> | undefined;
223
+ /** The options of `selectorPrefilter`. */
224
+ export interface SelectorPrefilterOptions {
225
+ /**
226
+ * The stored `_id` of an id. With it, a condition on `_id` with text values tests the stored
227
+ * `_id` (and uses its index). Without it, the condition tests `_key`.
228
+ */
229
+ storedId?: ((id: string) => unknown) | undefined;
230
+ /** More fields that only the storage writes, for example the partition fields: a condition on one of them does not go in the filter. */
231
+ storageFields?: Iterable<string> | undefined;
92
232
  }
93
233
  /**
94
234
  * This function gives a filter that each item of the selector passes (a filter can pass more),
95
235
  * or undefined for no condition. Only conditions that MongoDB tests in the same way go in it.
96
236
  */
97
- export declare function selectorPrefilter(selector: StorageSelector): Document | undefined;
237
+ export declare function selectorPrefilter(selector: StorageSelector, options?: SelectorPrefilterOptions): Document | undefined;
98
238
  /**
99
239
  * A `CollectionStorage` over MongoDB with flat documents, a change log, versions, queries in the
100
240
  * database and partitions (roadmap CLI-24).
@@ -114,6 +254,14 @@ export declare class MongoDocumentStorage<T> implements CollectionStorage<T> {
114
254
  private readonly writeLeaseMs;
115
255
  /** The storages of the partitions, for `forPartition`: the same storage for the same partition. */
116
256
  private readonly partitions;
257
+ /** The stored form of the documents (roadmap CLI-76). A `ViewMaterializer` of the collection takes the same form. */
258
+ readonly form: StoredForm;
259
+ /** The fields that name the partition, in their order. An `undefined` value is an absent field. */
260
+ private readonly partitionEntries;
261
+ /** The values of the partition fields that are not fields of the storage, by name. */
262
+ private readonly partitionValues;
263
+ /** The fields that only the storage writes: its fields and the partition fields. */
264
+ private readonly reserved;
117
265
  private indexes;
118
266
  private closed;
119
267
  constructor(options: MongoDocumentStorageOptions<T>, partitions?: Map<string, MongoDocumentStorage<T>>);
@@ -123,16 +271,32 @@ export declare class MongoDocumentStorage<T> implements CollectionStorage<T> {
123
271
  private collection;
124
272
  /** The filter of the documents of the partition. */
125
273
  private partitionFilter;
274
+ /** This method puts the partition fields on a stored document, in their order. An absent field stays absent. */
275
+ private putPartition;
126
276
  /** The filter of the items (not the tombstones) of the partition. */
127
277
  private liveFilter;
128
278
  /** The stored `_id` of an id. An id with the separator could name an item of a partition: it is refused. */
129
279
  private storedId;
280
+ /** The id of a stored document: the inverse of its stored `_id`, else `_key`, or undefined when neither tells it. */
281
+ private idOfDoc;
282
+ /** The place of a stored document in the order of the entries. A document without `_ord` comes first. */
283
+ private placeOf;
130
284
  /** The filter of a write of one stored document: its `_id` and the partition. */
131
285
  private writeFilter;
132
286
  /** The stored document of an item, with the number of this write and the number of its place. */
133
287
  private encode;
134
- /** The id and the item of a stored document. */
288
+ /**
289
+ * The fields of the flat document of an item, or undefined when only JSON text keeps it: an item
290
+ * that is not a plain object, an `_id` other than its id, a top-level key of the storage or with
291
+ * `$`, a key `__proto__`, a class instance other than `Date`. It throws a `TypeError` for a flat
292
+ * item that a document cannot keep: a partition field with another value than the partition, or
293
+ * an object that MongoDB gives back as a `DBRef`.
294
+ */
295
+ private flatOf;
296
+ /** The id and the item of a stored document, or undefined when the document does not tell its id. */
135
297
  private decode;
298
+ /** The entries of stored documents, in their order. A document that does not tell its id is left out. */
299
+ private decodeAll;
136
300
  /**
137
301
  * The next `count` numbers of the sequence of the collection. They stay pending in the counter
138
302
  * document until `release()`, so the watermark of the readers stays below them.
@@ -164,6 +328,8 @@ export declare class MongoDocumentStorage<T> implements CollectionStorage<T> {
164
328
  private floorId;
165
329
  /** This method drops the oldest tombstones of the partition over the limit, and keeps the floor of the log. */
166
330
  private pruneTombstones;
331
+ /** The ids of stored documents, in their order. A document that does not tell its id is left out. */
332
+ private idsOf;
167
333
  /** The items of the partition, in the order of the entries. */
168
334
  private liveDocs;
169
335
  /** The places (`_ord`) of the items of some ids that the partition has. */
@@ -188,7 +354,10 @@ export declare class MongoDocumentStorage<T> implements CollectionStorage<T> {
188
354
  docs: Document[];
189
355
  truncated: boolean;
190
356
  }>;
191
- /** The version of an item: the sequence number of its last write, or undefined for a missing id. */
357
+ /**
358
+ * The version of an item: the sequence number of its last write, or undefined for a missing id.
359
+ * An item without a write through the storage (no `_seq`) has the version `0`.
360
+ */
192
361
  versionOf(id: string): Promise<string | undefined>;
193
362
  getChangesSince(since?: string): Promise<StorageChanges<T>>;
194
363
  private write;
@@ -1 +1 @@
1
- {"version":3,"file":"document-storage.d.ts","sourceRoot":"","sources":["../../src/storage/document-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,KAAK,EAAoD,EAAE,EAAE,QAAQ,EAAU,WAAW,EAAE,MAAM,SAAS,CAAC;AACnH,OAAO,EAML,KAAK,iBAAiB,EAEtB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,oBA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