@telestack/db-sdk 1.0.5 → 1.0.6
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.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -347,7 +347,7 @@ export class Query {
|
|
|
347
347
|
if (!res.ok)
|
|
348
348
|
throw new TelestackError(await res.text());
|
|
349
349
|
const data = await res.json();
|
|
350
|
-
const docs = data.map((d) => ({ id: d.id,
|
|
350
|
+
const docs = data.map((d) => ({ id: d.id, data: d.data }));
|
|
351
351
|
// Cache results locally if persistence enabled
|
|
352
352
|
if (persistence) {
|
|
353
353
|
for (const d of data) {
|
|
@@ -363,7 +363,7 @@ export class Query {
|
|
|
363
363
|
// Filter docs that belong to this collection and match filters
|
|
364
364
|
const filtered = allDocs
|
|
365
365
|
.filter(d => d.path.startsWith(this.path) && this.matches(d.data))
|
|
366
|
-
.map(d => ({ id: d.path.split('/').pop(),
|
|
366
|
+
.map(d => ({ id: d.path.split('/').pop(), data: d.data, metadata: { fromCache: true, hasPendingWrites: true } }));
|
|
367
367
|
// Sort locally if needed
|
|
368
368
|
if (this.orderByField) {
|
|
369
369
|
filtered.sort((a, b) => {
|