liekodb 0.1.6 → 0.1.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 (2) hide show
  1. package/liekodb.js +8 -4
  2. package/package.json +1 -1
package/liekodb.js CHANGED
@@ -197,7 +197,9 @@ class CollectionCache {
197
197
  data.dirty = false;
198
198
  this.dirty.delete(name);
199
199
 
200
- console.log(`[CollectionCache] Saved ${name}.json with ${data.documents.length} documents in ${Format.formatDuration(Utils.endTimer(start))}`);
200
+ if (this.debug) {
201
+ console.log(`[CollectionCache] Saved ${name}.json with ${data.documents.length} documents in ${Format.formatDuration(Utils.endTimer(start))}`);
202
+ }
201
203
  return true;
202
204
  });
203
205
  }
@@ -225,7 +227,9 @@ class CollectionCache {
225
227
 
226
228
  await Promise.all(savePromises);
227
229
 
228
- console.log(`[CollectionCache] Flushed ${savePromises.length} collections in ${Format.formatDuration(Utils.endTimer(start))}`);
230
+ if (this.debug) {
231
+ console.log(`[CollectionCache] Flushed ${savePromises.length} collections in ${Format.formatDuration(Utils.endTimer(start))}`);
232
+ }
229
233
  }
230
234
 
231
235
  async shutdown(signal) {
@@ -1093,7 +1097,7 @@ class LocalAdapter {
1093
1097
  const response = {
1094
1098
  data: {
1095
1099
  //foundCount: documents.length,
1096
- documents,
1100
+ documents: structuredClone(documents),
1097
1101
  //totalDocuments: collection.documents.length
1098
1102
  }
1099
1103
  };
@@ -1178,7 +1182,7 @@ class LocalAdapter {
1178
1182
  this.logRequest('find_By_Id', details, duration, Utils.getDataSize(document));
1179
1183
 
1180
1184
  return {
1181
- data: document ?? null
1185
+ data: structuredClone(document) ?? null
1182
1186
  };
1183
1187
 
1184
1188
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "liekodb",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/eiwSrvt/liekodb"