@onehat/data 1.19.7 → 1.19.9

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": "@onehat/data",
3
- "version": "1.19.7",
3
+ "version": "1.19.9",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -30,7 +30,9 @@ class SecureLocalStorageRepository extends LocalStorageRepository {
30
30
 
31
31
  // BEGIN MOD
32
32
  let result = this._store(name);
33
- result = AES.decrypt(result, this.passphrase);
33
+ if (!_.isEmpty(result)) {
34
+ result = AES.decrypt(result, this.passphrase);
35
+ }
34
36
  // END MOD
35
37
 
36
38
  if (this.debugMode) {
@@ -25,7 +25,9 @@ class SecureSessionStorageRepository extends SessionStorageRepository {
25
25
 
26
26
  // BEGIN MOD
27
27
  let result = this._store.session(name);
28
- result = AES.decrypt(result, this.passphrase);
28
+ if (!_.isEmpty(result)) {
29
+ result = AES.decrypt(result, this.passphrase);
30
+ }
29
31
  // END MOD
30
32
 
31
33
  let value;
@@ -3,6 +3,7 @@
3
3
  import PercentIntProperty from './PercentInt.js';
4
4
  import Formatters from '../Util/Formatters.js';
5
5
  import Parsers from '../Util/Parsers.js';
6
+ import _ from 'lodash';
6
7
 
7
8
  /**
8
9
  * Class represents a Property that stores a percentage value.
@@ -84,10 +84,6 @@ class OfflineRepository extends MemoryRepository {
84
84
  try {
85
85
 
86
86
  this._index = await this._getIndex();
87
- if (!this._index) {
88
- await this._setIndex([]);
89
- this._index = [];
90
- }
91
87
 
92
88
  const ids = this._index,
93
89
  total = ids && ids.length ? ids.length : 0,
@@ -299,7 +295,13 @@ class OfflineRepository extends MemoryRepository {
299
295
  * @private
300
296
  */
301
297
  _getIndex = async () => {
302
- return await this._storageGetValue('index');
298
+ // return await this._storageGetValue('index');
299
+ let result = await this._storageGetValue('index');
300
+ if (!result) {
301
+ await this._setIndex([]);
302
+ result = [];
303
+ }
304
+ return result;
303
305
  }
304
306
 
305
307
  /**