@onehat/data 1.19.6 → 1.19.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.
package/package.json
CHANGED
|
@@ -30,7 +30,9 @@ class SecureLocalStorageRepository extends LocalStorageRepository {
|
|
|
30
30
|
|
|
31
31
|
// BEGIN MOD
|
|
32
32
|
let result = this._store(name);
|
|
33
|
-
|
|
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
|
-
|
|
28
|
+
if (!_.isEmpty(result)) {
|
|
29
|
+
result = AES.decrypt(result, this.passphrase);
|
|
30
|
+
}
|
|
29
31
|
// END MOD
|
|
30
32
|
|
|
31
33
|
let 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
|
/**
|
|
@@ -1044,14 +1044,10 @@ export default class Repository extends EventEmitter {
|
|
|
1044
1044
|
this.throwError('this.createStandaloneEntity is no longer valid. Repository has been destroyed.');
|
|
1045
1045
|
return;
|
|
1046
1046
|
}
|
|
1047
|
-
if (this.isRemotePhantomMode) {
|
|
1048
|
-
this.throwError('This repository uses isRemotePhantomMode, and therefore cannot create standalone entities.');
|
|
1049
|
-
return;
|
|
1050
|
-
}
|
|
1051
1047
|
|
|
1052
1048
|
const entity = Repository._createEntity(this.schema, data, this, isPersisted, isDelayedSave, this.isRemotePhantomMode);
|
|
1053
1049
|
|
|
1054
|
-
if (entity.isPhantom) {
|
|
1050
|
+
if (entity.isPhantom && !this.isRemotePhantomMode) {
|
|
1055
1051
|
entity.createTempId();
|
|
1056
1052
|
}
|
|
1057
1053
|
|