@signaldb/core 2.0.0-beta.6 → 2.0.0-beta.8

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 (126) hide show
  1. package/dist/.vite/manifest.json +118 -84
  2. package/dist/AsyncDataAdapter.d.ts +4 -6
  3. package/dist/AutoFetchDataAdapter.d.ts +4 -6
  4. package/dist/Collection/Cursor.d.ts +3 -3
  5. package/dist/Collection/index.d.ts +8 -9
  6. package/dist/Collection/types.d.ts +2 -2
  7. package/dist/DataAdapter.d.ts +3 -4
  8. package/dist/DefaultDataAdapter.d.ts +3 -5
  9. package/dist/WorkerDataAdapter.d.ts +2 -4
  10. package/dist/WorkerDataAdapterHost.d.ts +5 -5
  11. package/dist/createIndex.d.ts +2 -2
  12. package/dist/createIndexProvider.d.ts +2 -2
  13. package/dist/createReactivityAdapter.d.ts +2 -2
  14. package/dist/createStorageAdapter.d.ts +1 -1
  15. package/dist/getIndexInfo.d.ts +3 -4
  16. package/dist/index.cjs.js +33 -34
  17. package/dist/index.mjs +17 -35
  18. package/dist/index10.cjs.js +23 -0
  19. package/dist/index10.mjs +21 -17
  20. package/dist/index11.cjs.js +45 -0
  21. package/dist/index11.mjs +44 -15
  22. package/dist/index12.cjs.js +22 -0
  23. package/dist/index12.mjs +21 -47
  24. package/dist/index13.cjs.js +45 -0
  25. package/dist/index13.mjs +44 -365
  26. package/dist/index14.cjs.js +86 -0
  27. package/dist/index14.mjs +85 -416
  28. package/dist/index15.cjs.js +15 -0
  29. package/dist/index15.mjs +14 -206
  30. package/dist/index16.cjs.js +136 -0
  31. package/dist/index16.mjs +135 -388
  32. package/dist/index17.cjs.js +47 -0
  33. package/dist/index17.mjs +45 -578
  34. package/dist/index18.cjs.js +15 -0
  35. package/dist/index18.mjs +14 -157
  36. package/dist/index19.cjs.js +23 -0
  37. package/dist/index19.mjs +22 -26
  38. package/dist/index2.cjs.js +33 -0
  39. package/dist/index2.mjs +32 -258
  40. package/dist/index20.cjs.js +37 -0
  41. package/dist/index20.mjs +36 -41
  42. package/dist/index21.cjs.js +35 -0
  43. package/dist/index21.mjs +34 -16
  44. package/dist/index22.cjs.js +25 -0
  45. package/dist/index22.mjs +24 -104
  46. package/dist/index23.cjs.js +19 -0
  47. package/dist/index23.mjs +18 -128
  48. package/dist/index24.cjs.js +342 -0
  49. package/dist/index24.mjs +340 -6
  50. package/dist/index25.cjs.js +519 -0
  51. package/dist/index25.mjs +518 -27
  52. package/dist/index26.cjs.js +11 -0
  53. package/dist/index26.mjs +10 -10
  54. package/dist/index27.cjs.js +11 -0
  55. package/dist/index27.mjs +10 -29
  56. package/dist/index28.cjs.js +90 -0
  57. package/dist/index28.mjs +88 -46
  58. package/dist/index29.cjs.js +370 -0
  59. package/dist/index29.mjs +369 -8
  60. package/dist/index3.cjs.js +19 -0
  61. package/dist/index3.mjs +18 -539
  62. package/dist/index30.cjs.js +72 -0
  63. package/dist/index30.mjs +71 -9
  64. package/dist/index31.cjs.js +191 -0
  65. package/dist/index31.mjs +190 -7
  66. package/dist/index32.cjs.js +21 -0
  67. package/dist/index32.mjs +20 -42
  68. package/dist/index33.cjs.js +336 -0
  69. package/dist/index33.mjs +335 -29
  70. package/dist/index34.cjs.js +539 -0
  71. package/dist/index34.mjs +537 -4
  72. package/dist/index4.cjs.js +150 -0
  73. package/dist/index4.mjs +149 -5
  74. package/dist/index5.cjs.js +254 -0
  75. package/dist/index5.mjs +252 -4
  76. package/dist/index6.cjs.js +125 -0
  77. package/dist/index6.mjs +124 -29
  78. package/dist/index7.cjs.js +33 -0
  79. package/dist/index7.mjs +32 -12
  80. package/dist/index8.cjs.js +12 -0
  81. package/dist/index8.mjs +10 -4
  82. package/dist/index9.cjs.js +11 -0
  83. package/dist/index9.mjs +10 -133
  84. package/dist/types/IndexProvider.d.ts +2 -2
  85. package/dist/types/Modifier.d.ts +1 -1
  86. package/dist/types/ReactivityAdapter.d.ts +1 -1
  87. package/dist/utils/createSignal.d.ts +2 -2
  88. package/dist/utils/getMatchingKeys.d.ts +2 -2
  89. package/dist/utils/isFieldExpression.d.ts +1 -1
  90. package/dist/utils/match.d.ts +1 -1
  91. package/dist/utils/modify.d.ts +1 -1
  92. package/dist/utils/queryId.d.ts +2 -2
  93. package/package.json +1 -1
  94. package/dist/index.cjs10.js +0 -18
  95. package/dist/index.cjs11.js +0 -15
  96. package/dist/index.cjs12.js +0 -48
  97. package/dist/index.cjs13.js +0 -365
  98. package/dist/index.cjs14.js +0 -416
  99. package/dist/index.cjs15.js +0 -206
  100. package/dist/index.cjs16.js +0 -388
  101. package/dist/index.cjs17.js +0 -579
  102. package/dist/index.cjs18.js +0 -157
  103. package/dist/index.cjs19.js +0 -26
  104. package/dist/index.cjs2.js +0 -259
  105. package/dist/index.cjs20.js +0 -42
  106. package/dist/index.cjs21.js +0 -16
  107. package/dist/index.cjs22.js +0 -104
  108. package/dist/index.cjs23.js +0 -129
  109. package/dist/index.cjs24.js +0 -7
  110. package/dist/index.cjs25.js +0 -27
  111. package/dist/index.cjs26.js +0 -10
  112. package/dist/index.cjs27.js +0 -29
  113. package/dist/index.cjs28.js +0 -46
  114. package/dist/index.cjs29.js +0 -8
  115. package/dist/index.cjs3.js +0 -540
  116. package/dist/index.cjs30.js +0 -9
  117. package/dist/index.cjs31.js +0 -7
  118. package/dist/index.cjs32.js +0 -42
  119. package/dist/index.cjs33.js +0 -29
  120. package/dist/index.cjs34.js +0 -5
  121. package/dist/index.cjs4.js +0 -5
  122. package/dist/index.cjs5.js +0 -5
  123. package/dist/index.cjs6.js +0 -29
  124. package/dist/index.cjs7.js +0 -12
  125. package/dist/index.cjs8.js +0 -5
  126. package/dist/index.cjs9.js +0 -133
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- function unwrap(value) {
4
- return (function* () {
5
- return yield value;
6
- })();
7
- }
8
- function isThenable(value) {
9
- return typeof value === "object" && value !== null && typeof value.then === "function";
10
- }
11
- function runReactiveOrAsync(thisArgument, mode, gen) {
12
- const a = !!mode?.async;
13
- const it = gen.call(thisArgument, a);
14
- if (!a) {
15
- let step = it.next();
16
- while (!step.done) {
17
- const y = step.value;
18
- if (isThenable(y))
19
- throw new Error("Promise yielded in sync flow");
20
- step = it.next(y);
21
- }
22
- return step.value;
23
- }
24
- return (async function() {
25
- let step = it.next();
26
- while (!step.done) {
27
- const y = step.value;
28
- const v = isThenable(y) ? await y : y;
29
- step = it.next(v);
30
- }
31
- return step.value;
32
- })();
33
- }
34
- function reactiveOrAsync(gen) {
35
- function method(...allArguments) {
36
- const last = allArguments.length > 0 ? allArguments.at(-1) : void 0;
37
- const hasMode = typeof last === "object" && last !== null && "async" in last;
38
- const mode = hasMode ? last : void 0;
39
- const parameters = hasMode ? allArguments.slice(0, -1) : allArguments;
40
- return runReactiveOrAsync(this, mode, function* (a) {
41
- return yield* gen.call(this, a, ...parameters);
42
- });
43
- }
44
- method.generator = gen;
45
- return method;
46
- }
47
- exports.default = reactiveOrAsync;
48
- exports.unwrap = unwrap;
@@ -1,365 +0,0 @@
1
- "use strict";
2
- const createIndex = require("./index.cjs22.js");
3
- const getIndexInfo = require("./index.cjs23.js");
4
- const deepClone = require("./index.cjs20.js");
5
- const EventEmitter = require("./index.cjs9.js");
6
- const isEqual = require("./index.cjs6.js");
7
- const match = require("./index.cjs24.js");
8
- const modify = require("./index.cjs7.js");
9
- const project = require("./index.cjs25.js");
10
- const queryId = require("./index.cjs21.js");
11
- const serializeValue = require("./index.cjs11.js");
12
- const sortItems = require("./index.cjs26.js");
13
- function hasPendingUpdates(pendingUpdates) {
14
- return pendingUpdates.added.length > 0 || pendingUpdates.modified.length > 0 || pendingUpdates.removed.length > 0;
15
- }
16
- class DefaultDataAdapter {
17
- items = /* @__PURE__ */ new Map();
18
- options;
19
- storageAdapters = /* @__PURE__ */ new Map();
20
- collections = /* @__PURE__ */ new Set();
21
- indices = /* @__PURE__ */ new Map();
22
- activeQueries = /* @__PURE__ */ new Map();
23
- queryEmitters = /* @__PURE__ */ new Map();
24
- queuedQueryUpdates = /* @__PURE__ */ new Map();
25
- cachedQueryResults = /* @__PURE__ */ new Map();
26
- constructor(options) {
27
- this.options = options || {};
28
- }
29
- ensureStorageAdapter(name) {
30
- if (this.storageAdapters.get(name))
31
- return;
32
- if (!this.options.storage)
33
- return;
34
- const adapter = this.options.storage(name);
35
- if (!adapter)
36
- return;
37
- this.storageAdapters.set(name, adapter);
38
- }
39
- rebuildIndices(collection) {
40
- const items = this.items.get(collection.name);
41
- if (!items)
42
- throw new Error(`Items not found for collection ${collection.name}`);
43
- const indices = this.indices.get(collection.name);
44
- if (!indices)
45
- throw new Error(`Indices not found for collection ${collection.name}`);
46
- indices.forEach((index) => index.rebuild([...items.values()]));
47
- }
48
- async setupStorageAdapter(collection) {
49
- const storageAdapter = this.storageAdapters.get(collection.name);
50
- if (!storageAdapter)
51
- return;
52
- return storageAdapter.setup().then(async () => {
53
- await this.fetchItemsFromStorage(collection);
54
- }).catch((error) => {
55
- if (!this.options.onError) {
56
- console.error(`Error during data persistence operation in collection ${collection.name}`, error);
57
- return;
58
- }
59
- this.options.onError(collection.name, error instanceof Error ? error : new Error(error));
60
- });
61
- }
62
- getIndexInfo(collection, selector) {
63
- if (selector != null && Object.keys(selector).length === 1 && "id" in selector && typeof selector.id !== "object") {
64
- return {
65
- matched: true,
66
- ids: [serializeValue(selector.id)],
67
- optimizedSelector: {}
68
- };
69
- }
70
- if (selector == null) {
71
- return {
72
- matched: false,
73
- ids: [],
74
- optimizedSelector: {}
75
- };
76
- }
77
- return getIndexInfo.default((this.indices.get(collection.name) ?? []).map((i) => i.query.bind(i)), selector);
78
- }
79
- applyIndexDeltas(collection, changes) {
80
- const indices = this.indices.get(collection.name) ?? [];
81
- for (const index of indices) {
82
- if (changes.modified)
83
- index.update(changes.modified);
84
- if (changes.added && changes.added.length > 0)
85
- index.insert(changes.added);
86
- if (changes.removed && changes.removed.length > 0)
87
- index.remove(changes.removed);
88
- }
89
- }
90
- getItem(collection, selector) {
91
- const memory = this.items.get(collection.name) ?? /* @__PURE__ */ new Map();
92
- const indexInfo = this.getIndexInfo(collection, selector);
93
- const items = indexInfo.matched ? indexInfo.ids.map((id) => memory.get(serializeValue(id))).filter((i) => i != null) : [...memory.values()];
94
- const item = items.find((document) => match(document, selector));
95
- return item;
96
- }
97
- queryItems(collection, selector) {
98
- const indexInfo = this.getIndexInfo(collection, selector);
99
- const matchItems = (item) => {
100
- if (indexInfo.optimizedSelector == null)
101
- return true;
102
- if (Object.keys(indexInfo.optimizedSelector).length <= 0)
103
- return true;
104
- const matches = match(item, indexInfo.optimizedSelector);
105
- return matches;
106
- };
107
- const items = this.items.get(collection.name);
108
- if (!indexInfo.matched) {
109
- if (isEqual(selector, {}))
110
- return [...items.values()];
111
- return [...items.values()].filter(matchItems);
112
- }
113
- const foundItems = indexInfo.ids.map((ids) => items.get(serializeValue(ids))).filter((i) => i != null);
114
- if (isEqual(indexInfo.optimizedSelector, {}))
115
- return foundItems;
116
- return foundItems.filter(matchItems);
117
- }
118
- executeQuery(collection, selector, options) {
119
- const items = this.queryItems(collection, selector || {});
120
- const { sort, skip, limit, fields } = options || {};
121
- const sorted = sort ? sortItems(items, sort) : items;
122
- const skipped = skip ? sorted.slice(skip) : sorted;
123
- const limited = limit ? skipped.slice(0, limit) : skipped;
124
- const idExcluded = fields && fields.id === 0;
125
- return limited.map((item) => {
126
- if (!fields)
127
- return item;
128
- return {
129
- ...idExcluded ? {} : { id: item.id },
130
- ...project(item, fields)
131
- };
132
- });
133
- }
134
- flushQueuedQueryUpdates(collection) {
135
- if (!this.queuedQueryUpdates.get(collection.name))
136
- return;
137
- const changes = this.queuedQueryUpdates.get(collection.name);
138
- if (!changes || !hasPendingUpdates(changes))
139
- return;
140
- this.queuedQueryUpdates.set(collection.name, { added: [], modified: [], removed: [] });
141
- const flatItems = [...changes.added, ...changes.modified, ...changes.removed];
142
- const itemIds = new Set(flatItems.map((i) => i.id));
143
- const queries = [
144
- ...this.activeQueries.get(collection.name)?.values() ?? []
145
- ].filter(({ selector, options }) => {
146
- const idsInQuery = this.cachedQueryResults.get(collection.name)?.get(queryId(selector, options))?.map((i) => i.id) ?? [];
147
- if (idsInQuery.some((id) => itemIds.has(id)))
148
- return true;
149
- return flatItems.some((item) => match(item, selector));
150
- });
151
- queries.forEach(({ selector, options }) => {
152
- this.executeAndCacheQuery(collection, selector, options);
153
- });
154
- }
155
- executeAndCacheQuery(collection, selector, options) {
156
- const result = this.executeQuery(collection, selector, options);
157
- this.cachedQueryResults.set(collection.name, this.cachedQueryResults.get(collection.name) || /* @__PURE__ */ new Map());
158
- this.cachedQueryResults.get(collection.name)?.set(queryId(selector, options), result);
159
- const emitter = this.queryEmitters.get(collection.name);
160
- if (!emitter)
161
- return;
162
- emitter.emit("change", selector, options, "complete");
163
- }
164
- updateQueries(collection, changes) {
165
- this.queuedQueryUpdates.set(collection.name, this.queuedQueryUpdates.get(collection.name) || { added: [], modified: [], removed: [] });
166
- this.queuedQueryUpdates.get(collection.name)?.added.push(...changes.added);
167
- this.queuedQueryUpdates.get(collection.name)?.modified.push(...changes.modified);
168
- this.queuedQueryUpdates.get(collection.name)?.removed.push(...changes.removed);
169
- this.flushQueuedQueryUpdates(collection);
170
- }
171
- createCollectionBackend(collection, indices) {
172
- this.collections.add(collection);
173
- this.ensureStorageAdapter(collection.name);
174
- this.items.set(collection.name, this.items.get(collection.name) ?? /* @__PURE__ */ new Map());
175
- this.queryEmitters.set(collection.name, this.queryEmitters.get(collection.name) ?? new EventEmitter());
176
- this.queryEmitters.get(collection.name)?.setMaxListeners(Infinity);
177
- this.activeQueries.set(collection.name, this.activeQueries.get(collection.name) || /* @__PURE__ */ new Map());
178
- this.indices.set(collection.name, indices.map((field) => createIndex(field)));
179
- this.rebuildIndices(collection);
180
- const persistenceReadyPromise = this.setupStorageAdapter(collection);
181
- const backend = {
182
- // CRUD operations
183
- insert: async (newItem) => {
184
- const items = this.items.get(collection.name);
185
- if (!items)
186
- throw new Error(`Items not found for collection ${collection.name}`);
187
- if (items.has(serializeValue(newItem.id))) {
188
- throw new Error(`Item with id '${newItem.id}' already exists`);
189
- }
190
- this.items.get(collection.name)?.set(serializeValue(newItem.id), newItem);
191
- await this.storageAdapters.get(collection.name)?.insert([newItem]);
192
- this.applyIndexDeltas(collection, { added: [newItem] });
193
- this.updateQueries(collection, {
194
- added: [],
195
- modified: [newItem],
196
- removed: []
197
- });
198
- return newItem;
199
- },
200
- updateOne: async (selector, modifier) => {
201
- const { $setOnInsert, ...restModifier } = modifier;
202
- const item = this.getItem(collection, selector);
203
- if (item == null)
204
- return [];
205
- const modifiedItem = modify(deepClone.default(item), restModifier);
206
- const hasItemWithSameId = item.id !== modifiedItem.id && this.getItem(collection, { id: modifiedItem.id }) != null;
207
- if (hasItemWithSameId) {
208
- throw new Error(`Item with id '${modifiedItem.id}' already exists`);
209
- }
210
- this.items.get(collection.name)?.set(serializeValue(modifiedItem.id), modifiedItem);
211
- await this.storageAdapters.get(collection.name)?.replace([modifiedItem]);
212
- this.applyIndexDeltas(collection, { modified: [{ oldItem: item, newItem: modifiedItem }] });
213
- this.updateQueries(collection, {
214
- added: [],
215
- modified: [modifiedItem],
216
- removed: []
217
- });
218
- return [modifiedItem];
219
- },
220
- updateMany: async (selector, modifier) => {
221
- const { $setOnInsert, ...restModifier } = modifier;
222
- const items = this.executeQuery(collection, selector, {});
223
- const changedItems = items.map((item) => {
224
- const modifiedItem = modify(deepClone.default(item), restModifier);
225
- const hasItemWithSameId = item.id !== modifiedItem.id && this.getItem(collection, { id: modifiedItem.id }) != null;
226
- if (hasItemWithSameId) {
227
- throw new Error(`Item with id '${modifiedItem.id}' already exists`);
228
- }
229
- return modifiedItem;
230
- });
231
- changedItems.forEach((item) => {
232
- this.items.get(collection.name)?.set(serializeValue(item.id), item);
233
- });
234
- await this.storageAdapters.get(collection.name)?.replace(changedItems);
235
- const pairs = items.map((oldItem, index) => ({ oldItem, newItem: changedItems[index] }));
236
- this.applyIndexDeltas(collection, { modified: pairs });
237
- this.updateQueries(collection, {
238
- added: [],
239
- modified: changedItems,
240
- removed: []
241
- });
242
- return changedItems;
243
- },
244
- replaceOne: async (selector, replacement) => {
245
- const item = this.getItem(collection, selector);
246
- if (item == null)
247
- return [];
248
- const hasItemWithSameId = item.id !== replacement.id && replacement.id != null && this.getItem(collection, { id: replacement.id }) != null;
249
- if (hasItemWithSameId) {
250
- throw new Error(`Item with id '${replacement.id}' already exists`);
251
- }
252
- const modifiedItem = { id: item.id, ...replacement };
253
- this.items.get(collection.name)?.set(serializeValue(modifiedItem.id), modifiedItem);
254
- await this.storageAdapters.get(collection.name)?.replace([modifiedItem]);
255
- this.applyIndexDeltas(collection, { modified: [{ oldItem: item, newItem: modifiedItem }] });
256
- this.updateQueries(collection, {
257
- added: [],
258
- modified: [modifiedItem],
259
- removed: []
260
- });
261
- return [modifiedItem];
262
- },
263
- removeOne: async (selector) => {
264
- const item = this.getItem(collection, selector);
265
- if (item == null)
266
- return [];
267
- this.items.get(collection.name)?.delete(serializeValue(item.id));
268
- await this.storageAdapters.get(collection.name)?.remove([item]);
269
- this.applyIndexDeltas(collection, { removed: [item] });
270
- this.updateQueries(collection, {
271
- added: [],
272
- modified: [],
273
- removed: [item]
274
- });
275
- return [item];
276
- },
277
- removeMany: async (selector) => {
278
- const items = backend.getQueryResult(selector, {});
279
- items.forEach((item) => {
280
- this.items.get(collection.name)?.delete(serializeValue(item.id));
281
- });
282
- await this.storageAdapters.get(collection.name)?.remove(items);
283
- this.applyIndexDeltas(collection, { removed: items });
284
- this.updateQueries(collection, {
285
- added: [],
286
- modified: [],
287
- removed: items
288
- });
289
- return items;
290
- },
291
- // methods for registering and unregistering queries that will be called from the collection during find/findOne
292
- registerQuery: (selector, options) => {
293
- this.activeQueries.set(collection.name, this.activeQueries.get(collection.name) || /* @__PURE__ */ new Map());
294
- this.activeQueries.get(collection.name)?.set(queryId(selector, options), {
295
- selector,
296
- options
297
- });
298
- this.executeAndCacheQuery(collection, selector, options);
299
- },
300
- unregisterQuery: (selector, options) => {
301
- if (!this.activeQueries.get(collection.name))
302
- return;
303
- this.activeQueries.get(collection.name)?.delete(queryId(selector, options));
304
- },
305
- getQueryState: () => "complete",
306
- onQueryStateChange: (selector, options, callback) => {
307
- const emitter = this.queryEmitters.get(collection.name);
308
- if (!emitter)
309
- throw new Error(`Query emitter not found for collection ${collection.name}`);
310
- const handler = (querySelector, queryOptions, state) => {
311
- if (queryId(querySelector, queryOptions) !== queryId(selector, options))
312
- return;
313
- callback(state);
314
- };
315
- emitter.on("change", handler);
316
- return () => {
317
- emitter.off("change", handler);
318
- };
319
- },
320
- getQueryError: () => null,
321
- getQueryResult: (selector, options) => {
322
- const isQueryActive = this.activeQueries.get(collection.name)?.has(queryId(selector, options));
323
- if (isQueryActive) {
324
- const results = this.cachedQueryResults.get(collection.name)?.get(queryId(selector, options));
325
- if (!results)
326
- throw new Error("Cached query results are not defined!");
327
- return results;
328
- }
329
- return this.executeQuery(collection, selector, options);
330
- },
331
- executeQuery: (selector, options) => Promise.resolve(this.executeQuery(collection, selector, options)),
332
- // lifecycle methods
333
- dispose: async () => {
334
- const adapter = this.storageAdapters.get(collection.name);
335
- if (adapter?.teardown)
336
- await adapter.teardown();
337
- this.storageAdapters.delete(collection.name);
338
- this.items.delete(collection.name);
339
- this.indices.delete(collection.name);
340
- this.activeQueries.delete(collection.name);
341
- this.queryEmitters.delete(collection.name);
342
- this.queuedQueryUpdates.delete(collection.name);
343
- this.cachedQueryResults.delete(collection.name);
344
- },
345
- isReady: () => persistenceReadyPromise
346
- };
347
- return backend;
348
- }
349
- async fetchItemsFromStorage(collection) {
350
- if (!collection) {
351
- await Promise.all([...this.collections].map((currentCollection) => this.fetchItemsFromStorage(currentCollection)));
352
- return;
353
- }
354
- const storageAdapter = this.storageAdapters.get(collection.name);
355
- if (!storageAdapter)
356
- return;
357
- const items = await storageAdapter.readAll();
358
- this.items.set(collection.name, items.reduce((map, item) => {
359
- map.set(serializeValue(item.id), item);
360
- return map;
361
- }, /* @__PURE__ */ new Map()));
362
- this.rebuildIndices(collection);
363
- }
364
- }
365
- module.exports = DefaultDataAdapter;