@signaldb/core 2.0.0-beta.17 → 2.0.0-beta.19
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/.vite/manifest.json +39 -17
- package/dist/WorkerDataAdapter.d.ts +5 -0
- package/dist/index.cjs.js +9 -9
- package/dist/index.mjs +9 -9
- package/dist/index17.cjs.js +7 -2
- package/dist/index17.mjs +7 -2
- package/dist/index27.cjs.js +36 -337
- package/dist/index27.mjs +36 -337
- package/dist/index28.cjs.js +318 -573
- package/dist/index28.mjs +318 -573
- package/dist/index29.cjs.js +599 -8
- package/dist/index29.mjs +599 -8
- package/dist/index30.cjs.js +6 -6
- package/dist/index30.mjs +6 -6
- package/dist/index31.cjs.js +7 -86
- package/dist/index31.mjs +7 -85
- package/dist/index32.cjs.js +76 -465
- package/dist/index32.mjs +75 -465
- package/dist/index33.cjs.js +45 -64
- package/dist/index33.mjs +45 -64
- package/dist/index34.cjs.js +405 -456
- package/dist/index34.mjs +407 -458
- package/dist/index35.cjs.js +68 -17
- package/dist/index35.mjs +68 -17
- package/dist/index36.cjs.js +535 -344
- package/dist/index36.mjs +537 -346
- package/dist/index37.cjs.js +14 -532
- package/dist/index37.mjs +14 -532
- package/dist/index38.cjs.js +363 -0
- package/dist/index38.mjs +363 -0
- package/dist/index39.cjs.js +513 -0
- package/dist/index39.mjs +513 -0
- package/dist/types/StorageAdapter.d.ts +9 -1
- package/dist/utils/idIndexQuery.d.ts +20 -0
- package/dist/utils/storageIndexQuery.d.ts +20 -0
- package/package.json +1 -1
package/dist/index34.cjs.js
CHANGED
|
@@ -1,504 +1,453 @@
|
|
|
1
|
+
const require_isEqual = require("./index2.cjs.js");
|
|
1
2
|
const require_queryDelta = require("./index4.cjs.js");
|
|
2
|
-
const
|
|
3
|
+
const require_getIndexInfo = require("./index17.cjs.js");
|
|
3
4
|
const require_deepClone = require("./index18.cjs.js");
|
|
4
5
|
const require_match = require("./index19.cjs.js");
|
|
5
6
|
const require_modify = require("./index20.cjs.js");
|
|
7
|
+
const require_projectItems = require("./index23.cjs.js");
|
|
8
|
+
const require_sortItems = require("./index24.cjs.js");
|
|
6
9
|
const require_incrementalQueryUpdate = require("./index25.cjs.js");
|
|
7
10
|
const require_queryId = require("./index26.cjs.js");
|
|
8
|
-
const
|
|
9
|
-
|
|
11
|
+
const require_idIndexQuery = require("./index27.cjs.js");
|
|
12
|
+
const require_storageIndexQuery = require("./index33.cjs.js");
|
|
13
|
+
//#region src/AsyncDataAdapter.ts
|
|
10
14
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
15
|
+
* Carries the context needed to act on a failed query. The bare storage error
|
|
16
|
+
* on its own does not say which collection or selector produced it, which made
|
|
17
|
+
* the default `console.error` hook close to useless.
|
|
14
18
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
var QueryError = class extends Error {
|
|
20
|
+
collectionName;
|
|
21
|
+
selector;
|
|
22
|
+
options;
|
|
23
|
+
attempts;
|
|
24
|
+
constructor(collectionName, selector, options, attempts, cause) {
|
|
25
|
+
const reason = cause instanceof Error ? cause.message : String(cause);
|
|
26
|
+
super(`Query on "${collectionName}" failed after ${attempts} attempt(s): ${reason}`);
|
|
27
|
+
this.name = "QueryError";
|
|
28
|
+
this.collectionName = collectionName;
|
|
29
|
+
this.selector = selector;
|
|
30
|
+
this.options = options;
|
|
31
|
+
this.attempts = attempts;
|
|
32
|
+
this.cause = cause;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Turns the item states a write produced into the upsert/delete split a query update needs.
|
|
37
|
+
*
|
|
38
|
+
* The two lists are not symmetric: an item that is still there after the write is described by its
|
|
39
|
+
* new state, while an item that is gone — removed, or given a new id — is described by the id it
|
|
40
|
+
* used to have and nothing else. Mixing the states from before and after a write into one list
|
|
41
|
+
* loses exactly that distinction.
|
|
42
|
+
* @template T - The type of the items.
|
|
43
|
+
* @param previousItems - The items as they were before the write.
|
|
44
|
+
* @param modifiedItems - The items as they are after it.
|
|
45
|
+
* @returns The changeset describing the write.
|
|
46
|
+
*/
|
|
47
|
+
function toChangeset(previousItems, modifiedItems) {
|
|
48
|
+
const modifiedIds = new Set(modifiedItems.map((item) => item.id));
|
|
49
|
+
return {
|
|
50
|
+
upserts: modifiedItems,
|
|
51
|
+
deletes: previousItems.map((item) => item.id).filter((id) => !modifiedIds.has(id))
|
|
52
|
+
};
|
|
26
53
|
}
|
|
27
|
-
var
|
|
28
|
-
|
|
54
|
+
var DEFAULT_RETRY_ATTEMPTS = 3;
|
|
55
|
+
var defaultRetryDelay = (attempt) => 100 * 4 ** (attempt - 1);
|
|
56
|
+
var wait = (ms) => new Promise((resolve) => {
|
|
57
|
+
setTimeout(resolve, ms);
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* AsyncDataAdapter
|
|
61
|
+
* Combines WorkerDataAdapter + WorkerDataAdapterHost into a single, transport-free adapter.
|
|
62
|
+
* - Keeps the DataAdapter/CollectionBackend surface identical to the Worker version.
|
|
63
|
+
* - Executes queries and mutations directly against the provided StorageAdapter.
|
|
64
|
+
* - Preserves index-aware query optimization and push-style query updates to listeners.
|
|
65
|
+
*/
|
|
66
|
+
var AsyncDataAdapter = class {
|
|
29
67
|
options;
|
|
30
68
|
id;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
pendingWriteSeq = 0;
|
|
40
|
-
pendingWriteVersions = /* @__PURE__ */ new Map();
|
|
41
|
-
bumpPendingWriteVersion(collectionName) {
|
|
42
|
-
const current = this.pendingWriteVersions.get(collectionName) ?? 0;
|
|
43
|
-
this.pendingWriteVersions.set(collectionName, current + 1);
|
|
44
|
-
}
|
|
45
|
-
constructor(worker, options) {
|
|
46
|
-
this.worker = worker;
|
|
69
|
+
onError;
|
|
70
|
+
retryAttempts;
|
|
71
|
+
retryDelay;
|
|
72
|
+
storageAdapters = /* @__PURE__ */ new Map();
|
|
73
|
+
storageAdapterReady = /* @__PURE__ */ new Map();
|
|
74
|
+
collectionIndices = /* @__PURE__ */ new Map();
|
|
75
|
+
queries = /* @__PURE__ */ new Map();
|
|
76
|
+
constructor(options) {
|
|
47
77
|
this.options = options;
|
|
48
|
-
this.id =
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const timeoutId = setTimeout(() => {
|
|
52
|
-
reject(/* @__PURE__ */ new Error("WorkerDataAdapter initialization timed out"));
|
|
53
|
-
}, 5e3);
|
|
54
|
-
this.resolveWorkerReady = () => {
|
|
55
|
-
clearTimeout(timeoutId);
|
|
56
|
-
resolve();
|
|
57
|
-
};
|
|
78
|
+
this.id = options.id || "async-data-adapter";
|
|
79
|
+
this.onError = options.onError ?? ((error) => {
|
|
80
|
+
console.error(error);
|
|
58
81
|
});
|
|
59
|
-
this.
|
|
82
|
+
this.retryAttempts = Math.max(1, options.retry?.attempts ?? DEFAULT_RETRY_ATTEMPTS);
|
|
83
|
+
this.retryDelay = options.retry?.delay ?? defaultRetryDelay;
|
|
60
84
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (message.id == null) return;
|
|
72
|
-
const pending = this.pendingRequests.get(message.id);
|
|
73
|
-
if (!pending) return;
|
|
74
|
-
this.pendingRequests.delete(message.id);
|
|
75
|
-
this.log("response", message.data ?? message.error);
|
|
76
|
-
if (message.error) pending.reject(message.error);
|
|
77
|
-
else pending.resolve(message.data);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (message.type === "queryUpdate") this.handleQueryUpdate(message.data, message.error ?? null);
|
|
81
|
-
};
|
|
82
|
-
handleQueryUpdate(data, error) {
|
|
83
|
-
if (data == null) return;
|
|
84
|
-
const { collectionName, qid, selector, options, state, items, delta } = data;
|
|
85
|
-
if (collectionName == null) return;
|
|
86
|
-
const collectionQueries = this.queries[collectionName];
|
|
87
|
-
if (!collectionQueries) return;
|
|
88
|
-
const id = qid ?? (selector === void 0 ? void 0 : require_queryId.default(selector, options));
|
|
89
|
-
if (id == null) return;
|
|
90
|
-
const query = collectionQueries.get(id);
|
|
91
|
-
if (!query) return;
|
|
92
|
-
this.log("queryUpdate", query.selector, query.options, state, data ?? error);
|
|
93
|
-
let nextItems = items;
|
|
94
|
-
let deltaToPublish;
|
|
95
|
-
if (delta != null) {
|
|
96
|
-
const canApply = require_queryDelta.canApplyQueryDelta(query.items, delta);
|
|
97
|
-
if (!canApply || require_queryDelta.isEmptyQueryDelta(delta)) {
|
|
98
|
-
if (state === query.state) return;
|
|
99
|
-
this.updateQuery(collectionName, {
|
|
100
|
-
selector: query.selector,
|
|
101
|
-
options: query.options
|
|
102
|
-
}, {
|
|
103
|
-
state,
|
|
104
|
-
error
|
|
105
|
-
});
|
|
106
|
-
const settled = collectionQueries.get(id);
|
|
107
|
-
if (!settled) return;
|
|
108
|
-
settled.stateChangeCallbacks.forEach((callback) => require_queryDelta.callWithDelta(callback, state, canApply ? delta : void 0));
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
const servedBefore = this.flattenPendingWrites(collectionName) == null ? null : this.servedResult(collectionName, query);
|
|
112
|
-
nextItems = require_queryDelta.applyQueryDelta(query.items, delta);
|
|
113
|
-
if (servedBefore == null) deltaToPublish = delta;
|
|
114
|
-
else {
|
|
115
|
-
this.updateQuery(collectionName, {
|
|
116
|
-
selector: query.selector,
|
|
117
|
-
options: query.options
|
|
118
|
-
}, {
|
|
119
|
-
state,
|
|
120
|
-
error,
|
|
121
|
-
items: nextItems
|
|
122
|
-
});
|
|
123
|
-
const stored = collectionQueries.get(id);
|
|
124
|
-
if (!stored) return;
|
|
125
|
-
const servedDelta = require_queryDelta.diffQueryResults(servedBefore, this.servedResult(collectionName, stored));
|
|
126
|
-
if (require_queryDelta.isEmptyQueryDelta(servedDelta) && state === query.state) return;
|
|
127
|
-
stored.stateChangeCallbacks.forEach((callback) => require_queryDelta.callWithDelta(callback, state, servedDelta));
|
|
128
|
-
return;
|
|
85
|
+
createCollectionBackend(collection, indices) {
|
|
86
|
+
this.collectionIndices.set(collection.name, indices);
|
|
87
|
+
this.queries.set(collection.name, /* @__PURE__ */ new Map());
|
|
88
|
+
this.ensureStorageAdapter(collection.name);
|
|
89
|
+
const ready = (async () => {
|
|
90
|
+
try {
|
|
91
|
+
await this.setupStorage(collection.name, indices);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
this.onError(error);
|
|
94
|
+
throw error;
|
|
129
95
|
}
|
|
130
|
-
}
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
await this.workerReady;
|
|
145
|
-
if (method !== "isReady") {
|
|
146
|
-
const collectionReady = this.collectionReady.get(collectionName);
|
|
147
|
-
if (!collectionReady) throw new Error(`Collection "${collectionName}" is not registered in WorkerDataAdapter`);
|
|
148
|
-
await collectionReady;
|
|
149
|
-
}
|
|
150
|
-
if (this.isDisposed) throw new Error("WorkerDataAdapter is disposed");
|
|
151
|
-
return new Promise((resolve, reject) => {
|
|
152
|
-
const messageId = require_randomId.default();
|
|
153
|
-
this.pendingRequests.set(messageId, {
|
|
154
|
-
resolve,
|
|
155
|
-
reject
|
|
96
|
+
})();
|
|
97
|
+
this.storageAdapterReady.set(collection.name, ready);
|
|
98
|
+
const registerQuery = (selector, options) => {
|
|
99
|
+
const qid = require_queryId.default(selector, options);
|
|
100
|
+
const registry = this.queries.get(collection.name);
|
|
101
|
+
if (!registry) throw new Error(`Collection ${collection.name} not initialized!`);
|
|
102
|
+
registry.set(qid, {
|
|
103
|
+
selector,
|
|
104
|
+
options,
|
|
105
|
+
items: [],
|
|
106
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
107
|
+
...registry.get(qid),
|
|
108
|
+
state: "active",
|
|
109
|
+
error: null
|
|
156
110
|
});
|
|
157
|
-
this.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
111
|
+
this.fulfillQuery(collection.name, selector, options).catch(this.onError);
|
|
112
|
+
};
|
|
113
|
+
const unregisterQuery = (selector, options) => {
|
|
114
|
+
const qid = require_queryId.default(selector, options);
|
|
115
|
+
this.queries.get(collection.name)?.delete(qid);
|
|
116
|
+
};
|
|
117
|
+
const getQueryState = (selector, options) => {
|
|
118
|
+
return (this.queries.get(collection.name)?.get(require_queryId.default(selector, options)))?.state ?? "active";
|
|
119
|
+
};
|
|
120
|
+
const getQueryError = (selector, options) => {
|
|
121
|
+
return (this.queries.get(collection.name)?.get(require_queryId.default(selector, options)))?.error ?? null;
|
|
122
|
+
};
|
|
123
|
+
const getQueryResult = (selector, options) => {
|
|
124
|
+
return (this.queries.get(collection.name)?.get(require_queryId.default(selector, options)))?.items ?? [];
|
|
125
|
+
};
|
|
126
|
+
const retryQuery = (selector, options) => {
|
|
127
|
+
const qid = require_queryId.default(selector, options);
|
|
128
|
+
if (!this.queries.get(collection.name)?.get(qid)) return;
|
|
129
|
+
this.publishState(collection.name, qid, "active", null);
|
|
130
|
+
this.runQuery(collection.name, selector, options);
|
|
131
|
+
};
|
|
132
|
+
const onQueryStateChange = (selector, options, callback) => {
|
|
133
|
+
const qid = require_queryId.default(selector, options);
|
|
134
|
+
const registry = this.queries.get(collection.name);
|
|
135
|
+
if (!registry) throw new Error(`Collection ${collection.name} not initialized!`);
|
|
136
|
+
if (!registry.has(qid)) registry.set(qid, {
|
|
137
|
+
selector,
|
|
138
|
+
options,
|
|
139
|
+
state: "active",
|
|
140
|
+
error: null,
|
|
141
|
+
items: [],
|
|
142
|
+
listeners: /* @__PURE__ */ new Set()
|
|
162
143
|
});
|
|
163
|
-
|
|
144
|
+
registry.get(qid)?.listeners.add(callback);
|
|
145
|
+
if (registry.get(qid)?.state === "error") retryQuery(selector, options);
|
|
146
|
+
return () => registry.get(qid)?.listeners.delete(callback);
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
insert: async (item) => {
|
|
150
|
+
await ready;
|
|
151
|
+
return await this.insert(collection.name, item);
|
|
152
|
+
},
|
|
153
|
+
updateOne: async (selector, modifier) => {
|
|
154
|
+
await ready;
|
|
155
|
+
return this.updateOne(collection.name, selector, modifier);
|
|
156
|
+
},
|
|
157
|
+
updateMany: async (selector, modifier) => {
|
|
158
|
+
await ready;
|
|
159
|
+
return this.updateMany(collection.name, selector, modifier);
|
|
160
|
+
},
|
|
161
|
+
replaceOne: async (selector, replacement) => {
|
|
162
|
+
await ready;
|
|
163
|
+
return this.replaceOne(collection.name, selector, replacement);
|
|
164
|
+
},
|
|
165
|
+
removeOne: async (selector) => {
|
|
166
|
+
await ready;
|
|
167
|
+
return this.removeOne(collection.name, selector);
|
|
168
|
+
},
|
|
169
|
+
removeMany: async (selector) => {
|
|
170
|
+
await ready;
|
|
171
|
+
return this.removeMany(collection.name, selector);
|
|
172
|
+
},
|
|
173
|
+
registerQuery,
|
|
174
|
+
unregisterQuery,
|
|
175
|
+
retryQuery,
|
|
176
|
+
getQueryState,
|
|
177
|
+
getQueryError,
|
|
178
|
+
getQueryResult,
|
|
179
|
+
onQueryStateChange,
|
|
180
|
+
executeQuery: async (selector, options) => {
|
|
181
|
+
await ready;
|
|
182
|
+
return this.executeQuery(collection.name, selector, options);
|
|
183
|
+
},
|
|
184
|
+
dispose: async () => {
|
|
185
|
+
this.storageAdapters.delete(collection.name);
|
|
186
|
+
this.queries.delete(collection.name);
|
|
187
|
+
this.collectionIndices.delete(collection.name);
|
|
188
|
+
this.storageAdapterReady.delete(collection.name);
|
|
189
|
+
},
|
|
190
|
+
isReady: async () => {
|
|
191
|
+
await ready;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
async setupStorage(collectionName, indices) {
|
|
196
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
197
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
198
|
+
await storage.setup();
|
|
199
|
+
await Promise.all(indices.map((index) => storage.createIndex(index)));
|
|
200
|
+
}
|
|
201
|
+
ensureStorageAdapter(name) {
|
|
202
|
+
if (this.storageAdapters.has(name)) return;
|
|
203
|
+
const adapter = this.options.storage(name);
|
|
204
|
+
if (!adapter) return;
|
|
205
|
+
this.storageAdapters.set(name, adapter);
|
|
164
206
|
}
|
|
165
207
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* @param
|
|
170
|
-
* @param collectionName - The collection it applies to.
|
|
171
|
-
* @param args - The remaining arguments.
|
|
172
|
-
* @param onError - Called when the call fails, in place of merely logging it.
|
|
208
|
+
* Compute and publish the result for a specific query
|
|
209
|
+
* @param collectionName - name of the collection
|
|
210
|
+
* @param selector - query selector
|
|
211
|
+
* @param options - query options
|
|
173
212
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
213
|
+
async fulfillQuery(collectionName, selector, options) {
|
|
214
|
+
const qid = require_queryId.default(selector, options);
|
|
215
|
+
const registry = this.queries.get(collectionName);
|
|
216
|
+
if (!registry) throw new Error(`Collection ${collectionName} not initialized!`);
|
|
217
|
+
if (!registry.get(qid)) return;
|
|
218
|
+
this.publishState(collectionName, qid, "active", null);
|
|
219
|
+
await this.runQuery(collectionName, selector, options);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Executes a query, retrying transient failures before giving up. The state
|
|
223
|
+
* stays `'active'` across retries — consumers should see "still loading",
|
|
224
|
+
* not "failed", until we actually stop trying. Only the final failure is
|
|
225
|
+
* published as `'error'` and reported through `onError`; previously that
|
|
226
|
+
* error was swallowed entirely (`fulfillQuery` caught it internally, so the
|
|
227
|
+
* `.catch(this.onError)` on its call site was unreachable) and the query
|
|
228
|
+
* stayed dead for the rest of the session.
|
|
229
|
+
* @param collectionName - name of the collection
|
|
230
|
+
* @param selector - query selector
|
|
231
|
+
* @param options - query options
|
|
232
|
+
*/
|
|
233
|
+
async runQuery(collectionName, selector, options) {
|
|
234
|
+
const qid = require_queryId.default(selector, options);
|
|
235
|
+
let lastError;
|
|
236
|
+
for (let attempt = 1; attempt <= this.retryAttempts; attempt += 1) {
|
|
237
|
+
if (!this.queries.get(collectionName)?.has(qid)) return;
|
|
238
|
+
try {
|
|
239
|
+
const items = await this.executeQuery(collectionName, selector, options);
|
|
240
|
+
const rec = this.queries.get(collectionName)?.get(qid);
|
|
241
|
+
const delta = rec?.answered ? require_queryDelta.diffQueryResults(rec.items, items) : void 0;
|
|
242
|
+
this.publishResult(collectionName, qid, items);
|
|
243
|
+
this.publishState(collectionName, qid, "complete", null, delta);
|
|
178
244
|
return;
|
|
245
|
+
} catch (error) {
|
|
246
|
+
lastError = error;
|
|
247
|
+
if (attempt < this.retryAttempts) await wait(this.retryDelay(attempt));
|
|
179
248
|
}
|
|
180
|
-
|
|
181
|
-
|
|
249
|
+
}
|
|
250
|
+
const queryError = new QueryError(collectionName, selector, options, this.retryAttempts, lastError);
|
|
251
|
+
this.publishState(collectionName, qid, "error", queryError);
|
|
252
|
+
this.onError(queryError);
|
|
182
253
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Notify listeners about state changes and keep the cache updated
|
|
256
|
+
* @param collectionName - name of the collection
|
|
257
|
+
* @param qid - query id
|
|
258
|
+
* @param state - new state
|
|
259
|
+
* @param error - error if state is 'error', null otherwise
|
|
260
|
+
* @param delta - what changed about the result, when that is known
|
|
261
|
+
*/
|
|
262
|
+
publishState(collectionName, qid, state, error, delta) {
|
|
263
|
+
const rec = this.queries.get(collectionName)?.get(qid);
|
|
264
|
+
if (!rec) return;
|
|
265
|
+
rec.state = state;
|
|
266
|
+
rec.error = error;
|
|
267
|
+
const subscribers = [...rec.listeners];
|
|
268
|
+
for (const callback of subscribers) try {
|
|
269
|
+
require_queryDelta.callWithDelta(callback, state, delta);
|
|
270
|
+
} catch (error_) {
|
|
271
|
+
this.onError(error_);
|
|
272
|
+
}
|
|
186
273
|
}
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
if (!
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
write.upserts.forEach((item, id) => {
|
|
194
|
-
upserts.set(id, item);
|
|
195
|
-
deletes.delete(id);
|
|
196
|
-
});
|
|
197
|
-
write.deletes.forEach((id) => {
|
|
198
|
-
deletes.add(id);
|
|
199
|
-
upserts.delete(id);
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
return {
|
|
203
|
-
upserts,
|
|
204
|
-
deletes
|
|
205
|
-
};
|
|
274
|
+
publishResult(collectionName, qid, items) {
|
|
275
|
+
const rec = this.queries.get(collectionName)?.get(qid);
|
|
276
|
+
if (!rec) return;
|
|
277
|
+
rec.items = items;
|
|
278
|
+
rec.itemIds = void 0;
|
|
279
|
+
rec.answered = true;
|
|
206
280
|
}
|
|
207
|
-
|
|
208
|
-
|
|
281
|
+
queryItemIds(rec) {
|
|
282
|
+
if (!rec.itemIds) rec.itemIds = new Set(rec.items.map((item) => item.id));
|
|
283
|
+
return rec.itemIds;
|
|
209
284
|
}
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
285
|
+
async getIndexInfo(collectionName, selector) {
|
|
286
|
+
const storageAdapter = this.storageAdapters.get(collectionName);
|
|
287
|
+
if (!storageAdapter) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
288
|
+
if (selector != null && Object.keys(selector).length === 1 && "id" in selector) {
|
|
289
|
+
const idResult = require_idIndexQuery.default(selector);
|
|
290
|
+
if (idResult.matched) return {
|
|
291
|
+
matched: true,
|
|
292
|
+
ids: idResult.ids.filter(Boolean),
|
|
293
|
+
optimizedSelector: {}
|
|
294
|
+
};
|
|
220
295
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (pending?.deletes.has(id)) return;
|
|
228
|
-
const pendingItem = pending?.upserts.get(id);
|
|
229
|
-
if (pendingItem) {
|
|
230
|
-
found.set(id, pendingItem);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
const queries = this.queries[collectionName];
|
|
234
|
-
if (!queries) return;
|
|
235
|
-
for (const query of queries.values()) {
|
|
236
|
-
if (!WorkerDataAdapter.providesFullItems(query)) continue;
|
|
237
|
-
const item = this.queryItemsById(query).get(id);
|
|
238
|
-
if (item) {
|
|
239
|
-
found.set(id, item);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
return [...found.values()];
|
|
296
|
+
if (selector == null) return {
|
|
297
|
+
matched: false,
|
|
298
|
+
ids: [],
|
|
299
|
+
optimizedSelector: {}
|
|
300
|
+
};
|
|
301
|
+
return require_getIndexInfo.default((this.collectionIndices.get(collectionName) ?? []).map((field) => require_storageIndexQuery.default(storageAdapter, field)), selector);
|
|
245
302
|
}
|
|
246
|
-
|
|
247
|
-
const
|
|
248
|
-
if (
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
303
|
+
async queryItems(collectionName, selector) {
|
|
304
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
305
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
306
|
+
const index = await this.getIndexInfo(collectionName, selector);
|
|
307
|
+
const matchItems = (item) => {
|
|
308
|
+
if (index.optimizedSelector == null) return true;
|
|
309
|
+
if (Object.keys(index.optimizedSelector).length <= 0) return true;
|
|
310
|
+
return require_match.default(item, index.optimizedSelector);
|
|
254
311
|
};
|
|
255
|
-
|
|
312
|
+
if (index.matched) {
|
|
313
|
+
const items = await storage.readIds(index.ids);
|
|
314
|
+
if (require_isEqual.default(index.optimizedSelector, {})) return items;
|
|
315
|
+
return items.filter(matchItems);
|
|
316
|
+
} else {
|
|
317
|
+
const allItems = await storage.readAll();
|
|
318
|
+
if (require_isEqual.default(selector, {})) return allItems;
|
|
319
|
+
return allItems.filter(matchItems);
|
|
320
|
+
}
|
|
256
321
|
}
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
const
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
if (byId.has(id)) affected = true;
|
|
264
|
-
});
|
|
265
|
-
if (!affected) pending.upserts.forEach((item, id) => {
|
|
266
|
-
if (affected) return;
|
|
267
|
-
if (byId.has(id)) affected = true;
|
|
268
|
-
else if (query.selector != null && require_match.default(item, query.selector)) affected = true;
|
|
269
|
-
});
|
|
270
|
-
if (!affected) return query.items;
|
|
271
|
-
return require_incrementalQueryUpdate.mergeChangesetIntoResult(query.items, query.selector, query.options, {
|
|
272
|
-
upserts: [...pending.upserts.values()],
|
|
273
|
-
deletes: [...pending.deletes]
|
|
274
|
-
});
|
|
322
|
+
async executeQuery(collectionName, selector, options) {
|
|
323
|
+
const items = await this.queryItems(collectionName, selector || {});
|
|
324
|
+
const { sort, skip, limit, fields } = options || {};
|
|
325
|
+
const sorted = sort ? require_sortItems.default(items, sort) : items;
|
|
326
|
+
const skipped = skip ? sorted.slice(skip) : sorted;
|
|
327
|
+
return require_projectItems.default(limit ? skipped.slice(0, limit) : skipped, fields);
|
|
275
328
|
}
|
|
276
329
|
/**
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
330
|
+
* After mutations, bring every affected active query up to date.
|
|
331
|
+
*
|
|
332
|
+
* A query whose previous result is enough to answer the change is brought up to date from that
|
|
333
|
+
* result alone — no round trip to the storage, and no detour through `'active'`, because there is
|
|
334
|
+
* no window in which the query is stale. Only a query the change cannot be reasoned about
|
|
335
|
+
* locally — a window onto a larger set, or one that has never been answered — goes back to the
|
|
336
|
+
* store, and that one gets the same retry and reporting behaviour a freshly registered query
|
|
337
|
+
* gets: a refresh that fails silently leaves exactly the same dead cursor.
|
|
338
|
+
* @param collectionName - name of the collection
|
|
339
|
+
* @param changes - the items the write created, updated or removed
|
|
284
340
|
*/
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
deletes: new Set(deletes)
|
|
341
|
+
async checkQueryUpdates(collectionName, changes) {
|
|
342
|
+
const registry = this.queries.get(collectionName);
|
|
343
|
+
if (!registry) throw new Error(`Collection ${collectionName} not initialized!`);
|
|
344
|
+
if (registry.size === 0) return;
|
|
345
|
+
if (changes.upserts.length === 0 && changes.deletes.length === 0) return;
|
|
346
|
+
const affected = [...registry.values()].filter((rec) => {
|
|
347
|
+
const ids = this.queryItemIds(rec);
|
|
348
|
+
if (changes.deletes.some((id) => ids.has(id))) return true;
|
|
349
|
+
return changes.upserts.some((item) => ids.has(item.id) || require_match.default(item, rec.selector));
|
|
295
350
|
});
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
const
|
|
301
|
-
if (
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
const byId = this.queryItemsById(query);
|
|
314
|
-
let wasHolding = false;
|
|
315
|
-
affectedIds.forEach((id) => {
|
|
316
|
-
if (byId.has(id)) wasHolding = true;
|
|
317
|
-
});
|
|
318
|
-
const nowMatches = upserts.some((item) => query.selector != null && require_match.default(item, query.selector));
|
|
319
|
-
if (!wasHolding && !nowMatches) return;
|
|
320
|
-
affected.push(query);
|
|
321
|
-
});
|
|
322
|
-
return affected;
|
|
323
|
-
}
|
|
324
|
-
servedResults(collectionName, queries) {
|
|
325
|
-
return new Map(queries.map((query) => [query, this.servedResult(collectionName, query)]));
|
|
351
|
+
if (affected.length === 0) return;
|
|
352
|
+
const needsReExecution = [];
|
|
353
|
+
for (const rec of affected) {
|
|
354
|
+
const { selector, options } = rec;
|
|
355
|
+
const incremental = rec.answered ? require_incrementalQueryUpdate.default(rec.items, selector, options, changes) : null;
|
|
356
|
+
if (incremental == null) {
|
|
357
|
+
needsReExecution.push(rec);
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const qid = require_queryId.default(selector, options);
|
|
361
|
+
const delta = require_queryDelta.diffQueryResults(rec.items, incremental);
|
|
362
|
+
if (require_queryDelta.isEmptyQueryDelta(delta)) continue;
|
|
363
|
+
this.publishResult(collectionName, qid, incremental);
|
|
364
|
+
this.publishState(collectionName, qid, "complete", null, delta);
|
|
365
|
+
}
|
|
366
|
+
for (const { selector, options } of needsReExecution) this.publishState(collectionName, require_queryId.default(selector, options), "active", null);
|
|
367
|
+
await Promise.all(needsReExecution.map(({ selector, options }) => this.runQuery(collectionName, selector, options)));
|
|
326
368
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
369
|
+
async insert(collectionName, newItem) {
|
|
370
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
371
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
372
|
+
if ((await storage.readIds([newItem.id])).length > 0) throw new Error(`Item with id ${String(newItem.id)} already exists`);
|
|
373
|
+
await storage.insert([newItem]);
|
|
374
|
+
await this.checkQueryUpdates(collectionName, {
|
|
375
|
+
upserts: [newItem],
|
|
376
|
+
deletes: []
|
|
334
377
|
});
|
|
378
|
+
return newItem;
|
|
335
379
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
if (modifiedItem.id !== item.id) deletes.push(item.id);
|
|
350
|
-
});
|
|
351
|
-
return {
|
|
352
|
-
upserts,
|
|
353
|
-
deletes
|
|
354
|
-
};
|
|
380
|
+
async updateOne(collectionName, selector, modifier) {
|
|
381
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
382
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
383
|
+
const [item] = await this.executeQuery(collectionName, selector, { limit: 1 });
|
|
384
|
+
const { $setOnInsert, ...rest } = modifier;
|
|
385
|
+
if (item == null) return [];
|
|
386
|
+
const modified = require_modify.default(require_deepClone.default(item), rest);
|
|
387
|
+
if (item.id !== modified.id) {
|
|
388
|
+
if ((await storage.readIds([modified.id])).length > 0) throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
389
|
+
}
|
|
390
|
+
await storage.replace([modified]);
|
|
391
|
+
await this.checkQueryUpdates(collectionName, toChangeset([item], [modified]));
|
|
392
|
+
return [modified];
|
|
355
393
|
}
|
|
356
|
-
|
|
357
|
-
|
|
394
|
+
async updateMany(collectionName, selector, modifier) {
|
|
395
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
396
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
397
|
+
const items = await this.executeQuery(collectionName, selector);
|
|
398
|
+
if (items.length === 0) return [];
|
|
399
|
+
const { $setOnInsert, ...rest } = modifier;
|
|
400
|
+
const changed = await Promise.all(items.map(async (item) => {
|
|
401
|
+
const modified = require_modify.default(require_deepClone.default(item), rest);
|
|
402
|
+
if (item.id !== modified.id) {
|
|
403
|
+
if ((await storage.readIds([modified.id])).length > 0) throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
404
|
+
}
|
|
405
|
+
return modified;
|
|
406
|
+
}));
|
|
407
|
+
await storage.replace(changed);
|
|
408
|
+
await this.checkQueryUpdates(collectionName, toChangeset(items, changed));
|
|
409
|
+
return changed;
|
|
358
410
|
}
|
|
359
|
-
|
|
360
|
-
const
|
|
411
|
+
async replaceOne(collectionName, selector, replacement) {
|
|
412
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
413
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
414
|
+
const [item] = await this.executeQuery(collectionName, selector, { limit: 1 });
|
|
415
|
+
if (item == null) return [];
|
|
416
|
+
const modified = {
|
|
361
417
|
...replacement,
|
|
362
418
|
id: replacement.id ?? item.id
|
|
363
419
|
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
deletes: modifiedItem.id === item.id ? [] : [item.id]
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
async withPendingWrite(collectionName, delta, run) {
|
|
370
|
-
const dropPendingWrite = this.applyPendingWrite(collectionName, delta.upserts, delta.deletes);
|
|
371
|
-
try {
|
|
372
|
-
return await run();
|
|
373
|
-
} finally {
|
|
374
|
-
dropPendingWrite();
|
|
420
|
+
if (item.id !== modified.id) {
|
|
421
|
+
if ((await storage.readIds([modified.id])).length > 0) throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
375
422
|
}
|
|
423
|
+
await storage.replace([modified]);
|
|
424
|
+
await this.checkQueryUpdates(collectionName, toChangeset([item], [modified]));
|
|
425
|
+
return [modified];
|
|
376
426
|
}
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
if (!
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
selector: query.selector,
|
|
389
|
-
options: query.options,
|
|
390
|
-
state: "active",
|
|
391
|
-
error: null,
|
|
392
|
-
stateChangeCallbacks: [],
|
|
393
|
-
...existing,
|
|
394
|
-
...update,
|
|
395
|
-
...update.items ? {
|
|
396
|
-
items: update.items,
|
|
397
|
-
itemsById: void 0
|
|
398
|
-
} : { items: existing?.items ?? [] }
|
|
399
|
-
};
|
|
400
|
-
collectionQueries.set(id, newState);
|
|
401
|
-
this.queries[collectionName] = collectionQueries;
|
|
427
|
+
async removeOne(collectionName, selector) {
|
|
428
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
429
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
430
|
+
const [item] = await this.executeQuery(collectionName, selector, { limit: 1 });
|
|
431
|
+
if (item == null) return [];
|
|
432
|
+
await storage.remove([item]);
|
|
433
|
+
await this.checkQueryUpdates(collectionName, {
|
|
434
|
+
upserts: [],
|
|
435
|
+
deletes: [item.id]
|
|
436
|
+
});
|
|
437
|
+
return [item];
|
|
402
438
|
}
|
|
403
|
-
|
|
404
|
-
this.
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
},
|
|
415
|
-
updateOne: async (selector, modifier) => {
|
|
416
|
-
return this.withPendingWrite(collection.name, this.resolveUpdate(collection.name, selector, modifier, true), () => this.enqueueBatched(collection.name, "updateOne", [selector, modifier]));
|
|
417
|
-
},
|
|
418
|
-
updateMany: async (selector, modifier) => {
|
|
419
|
-
return this.withPendingWrite(collection.name, this.resolveUpdate(collection.name, selector, modifier, false), () => this.enqueueBatched(collection.name, "updateMany", [selector, modifier]));
|
|
420
|
-
},
|
|
421
|
-
replaceOne: async (selector, replacement) => {
|
|
422
|
-
const [item] = this.matchObservableItems(collection.name, selector, true);
|
|
423
|
-
return this.withPendingWrite(collection.name, item == null ? {
|
|
424
|
-
upserts: [],
|
|
425
|
-
deletes: []
|
|
426
|
-
} : this.resolveReplacement(item, replacement), () => this.enqueueBatched(collection.name, "replaceOne", [selector, replacement]));
|
|
427
|
-
},
|
|
428
|
-
removeOne: async (selector) => {
|
|
429
|
-
return this.withPendingWrite(collection.name, {
|
|
430
|
-
upserts: [],
|
|
431
|
-
deletes: this.resolveRemoval(collection.name, selector, true)
|
|
432
|
-
}, () => this.enqueueBatched(collection.name, "removeOne", [selector]));
|
|
433
|
-
},
|
|
434
|
-
removeMany: async (selector) => {
|
|
435
|
-
return this.withPendingWrite(collection.name, {
|
|
436
|
-
upserts: [],
|
|
437
|
-
deletes: this.resolveRemoval(collection.name, selector, false)
|
|
438
|
-
}, () => this.enqueueBatched(collection.name, "removeMany", [selector]));
|
|
439
|
-
},
|
|
440
|
-
registerQuery: (selector, options) => {
|
|
441
|
-
this.updateQuery(collection.name, {
|
|
442
|
-
selector,
|
|
443
|
-
options
|
|
444
|
-
}, {
|
|
445
|
-
state: "active",
|
|
446
|
-
error: null,
|
|
447
|
-
items: []
|
|
448
|
-
});
|
|
449
|
-
this.execInBackground("registerQuery", collection.name, [selector, options], (error) => {
|
|
450
|
-
const query = this.queries[collection.name]?.get(require_queryId.default(selector, options));
|
|
451
|
-
if (!query) return;
|
|
452
|
-
this.updateQuery(collection.name, {
|
|
453
|
-
selector,
|
|
454
|
-
options
|
|
455
|
-
}, {
|
|
456
|
-
state: "error",
|
|
457
|
-
error
|
|
458
|
-
});
|
|
459
|
-
query.stateChangeCallbacks.forEach((callback) => callback("error"));
|
|
460
|
-
});
|
|
461
|
-
},
|
|
462
|
-
unregisterQuery: (selector, options) => {
|
|
463
|
-
this.queries[collection.name]?.delete(require_queryId.default(selector, options));
|
|
464
|
-
this.execInBackground("unregisterQuery", collection.name, [selector, options]);
|
|
465
|
-
},
|
|
466
|
-
getQueryState: (selector, options) => {
|
|
467
|
-
return (this.queries[collection.name]?.get(require_queryId.default(selector, options)))?.state || "active";
|
|
468
|
-
},
|
|
469
|
-
getQueryError: (selector, options) => {
|
|
470
|
-
return (this.queries[collection.name]?.get(require_queryId.default(selector, options)))?.error || null;
|
|
471
|
-
},
|
|
472
|
-
getQueryResult: (selector, options) => {
|
|
473
|
-
const query = this.queries[collection.name]?.get(require_queryId.default(selector, options));
|
|
474
|
-
if (!query) return [];
|
|
475
|
-
return this.servedResult(collection.name, query);
|
|
476
|
-
},
|
|
477
|
-
onQueryStateChange: (selector, options, callback) => {
|
|
478
|
-
this.updateQuery(collection.name, {
|
|
479
|
-
selector,
|
|
480
|
-
options
|
|
481
|
-
}, { stateChangeCallbacks: [...this.queries[collection.name]?.get(require_queryId.default(selector, options))?.stateChangeCallbacks || [], callback] });
|
|
482
|
-
return () => {
|
|
483
|
-
const currentCallbacks = this.queries[collection.name]?.get(require_queryId.default(selector, options))?.stateChangeCallbacks;
|
|
484
|
-
if (!currentCallbacks) return;
|
|
485
|
-
this.updateQuery(collection.name, {
|
|
486
|
-
selector,
|
|
487
|
-
options
|
|
488
|
-
}, { stateChangeCallbacks: currentCallbacks.filter((existingCallback) => existingCallback !== callback) });
|
|
489
|
-
};
|
|
490
|
-
},
|
|
491
|
-
executeQuery: (selector, options) => this.exec("executeQuery", collection.name, selector, options),
|
|
492
|
-
dispose: async () => {
|
|
493
|
-
await this.exec("unregisterCollection", collection.name);
|
|
494
|
-
this.isDisposed = true;
|
|
495
|
-
this.worker.terminate?.();
|
|
496
|
-
},
|
|
497
|
-
isReady: async () => {
|
|
498
|
-
await this.collectionReady.get(collection.name);
|
|
499
|
-
}
|
|
500
|
-
};
|
|
439
|
+
async removeMany(collectionName, selector) {
|
|
440
|
+
const storage = this.storageAdapters.get(collectionName);
|
|
441
|
+
if (!storage) throw new Error(`No persistence adapter for collection ${collectionName}`);
|
|
442
|
+
const items = await this.executeQuery(collectionName, selector);
|
|
443
|
+
if (items.length === 0) return [];
|
|
444
|
+
await storage.remove(items);
|
|
445
|
+
await this.checkQueryUpdates(collectionName, {
|
|
446
|
+
upserts: [],
|
|
447
|
+
deletes: items.map((item) => item.id)
|
|
448
|
+
});
|
|
449
|
+
return items;
|
|
501
450
|
}
|
|
502
451
|
};
|
|
503
452
|
//#endregion
|
|
504
|
-
exports.default =
|
|
453
|
+
exports.default = AsyncDataAdapter;
|