@herdwatch/lokijs 1.5.8-dev.6 → 1.5.8-dev.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herdwatch/lokijs",
3
- "version": "1.5.8-dev.6",
3
+ "version": "1.5.8-dev.7",
4
4
  "description": "Fast document oriented javascript in-memory database",
5
5
  "homepage": "http://lokijs.org",
6
6
  "types": "index.d.ts",
@@ -27,6 +27,7 @@
27
27
  ],
28
28
  "scripts": {
29
29
  "lint": "jshint src",
30
+ "test:browser:dev": "karma start karma.conf.js",
30
31
  "test:browser": "karma start karma.conf.js --single-run",
31
32
  "test:node": "istanbul cover --dir coverage/nodejs node_modules/jasmine/bin/jasmine.js",
32
33
  "pretest": "npm run lint",
@@ -43,6 +43,11 @@
43
43
  this.app = 'loki';
44
44
  this.options = options || {};
45
45
 
46
+ // Helper for reproduce WebKit bug
47
+ // https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/354
48
+ // https://github.com/ionic-team/capacitor/issues/7439
49
+ this.simulateErrorMessage = null;
50
+
46
51
  if (typeof appname !== 'undefined') {
47
52
  this.app = appname;
48
53
  }
@@ -146,13 +151,13 @@
146
151
  var adapter = this;
147
152
 
148
153
  /**
149
- * @param { success: boolean, error: Error } result
154
+ * @param { {success: boolean, error: Error} } result
150
155
  */
151
156
  function saveCallback(result) {
152
157
  if (result && result.success === true) {
153
158
  callback(null);
154
159
  } else {
155
- console.error('Error saving database', result);
160
+ console.error('saveDatabase->saveCallback, Error saving database', result);
156
161
  callback(result);
157
162
  }
158
163
 
@@ -171,7 +176,15 @@
171
176
  }
172
177
 
173
178
  // set (add/update) entry to AKV database
174
- this.catalog.setAppKey(appName, dbname, dbstring, saveCallback);
179
+ try {
180
+ if (this.simulateErrorMessage) {
181
+ throw new Error(this.simulateErrorMessage);
182
+ }
183
+ this.catalog.setAppKey(appName, dbname, dbstring, saveCallback);
184
+ } catch (error) {
185
+ saveCallback({success: false, error});
186
+ }
187
+
175
188
  };
176
189
 
177
190
  // alias
@@ -451,7 +464,7 @@
451
464
  res = {
452
465
  app: app,
453
466
  key: key,
454
- appkey: app + ',' + key,
467
+ appkey: appkey,
455
468
  val: val,
456
469
  };
457
470
  } else {
@@ -463,7 +476,7 @@
463
476
  requestPut.onerror = (function (usercallback) {
464
477
  return function (e) {
465
478
  if (typeof usercallback === 'function') {
466
- usercallback({ success: false, error: request.error });
479
+ usercallback({ success: false, error: requestPut.error });
467
480
  } else {
468
481
  console.error('LokiCatalog.setAppKey (set) onerror');
469
482
  console.error(request.error);