@onehat/data 1.19.20 → 1.19.22

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.20",
3
+ "version": "1.19.22",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -1,6 +1,7 @@
1
1
  /** @module Repository */
2
2
 
3
3
  import LocalStorageRepository from '@onehat/data/src/Integration/Browser/Repository/LocalStorage';
4
+ import CryptoJS from 'crypto-js';
4
5
  import AES from 'crypto-js/aes';
5
6
  import _ from 'lodash';
6
7
 
@@ -31,7 +32,7 @@ class SecureLocalStorageRepository extends LocalStorageRepository {
31
32
  // BEGIN MOD
32
33
  let result = this._store(name);
33
34
  if (!_.isEmpty(result)) {
34
- result = AES.decrypt(result, this.passphrase);
35
+ result = AES.decrypt(result, this.passphrase).toString(CryptoJS.enc.Utf8);
35
36
  }
36
37
  // END MOD
37
38
 
@@ -66,7 +67,7 @@ class SecureLocalStorageRepository extends LocalStorageRepository {
66
67
  value = JSON.stringify(value);
67
68
  }
68
69
 
69
- value = AES.encrypt(value, this.passphrase); // MOD
70
+ value = AES.encrypt(value, this.passphrase).toString(); // MOD
70
71
 
71
72
  return this._store(name, value);
72
73
 
@@ -1,6 +1,7 @@
1
1
  /** @module Repository */
2
2
 
3
3
  import SessionStorageRepository from '@onehat/data/src/Integration/Browser/Repository/SessionStorage';
4
+ import CryptoJS from 'crypto-js';
4
5
  import AES from 'crypto-js/aes';
5
6
  import _ from 'lodash';
6
7
 
@@ -26,7 +27,7 @@ class SecureSessionStorageRepository extends SessionStorageRepository {
26
27
  // BEGIN MOD
27
28
  let result = this._store.session(name);
28
29
  if (!_.isEmpty(result)) {
29
- result = AES.decrypt(result, this.passphrase);
30
+ result = AES.decrypt(result, this.passphrase).toString(CryptoJS.enc.Utf8);
30
31
  }
31
32
  // END MOD
32
33
 
@@ -45,7 +46,7 @@ class SecureSessionStorageRepository extends SessionStorageRepository {
45
46
  value = JSON.stringify(value);
46
47
  }
47
48
 
48
- value = AES.encrypt(value, this.passphrase); // MOD
49
+ value = AES.encrypt(value, this.passphrase).toString(); // MOD
49
50
 
50
51
  return this._store.session(name, value);
51
52
  }
@@ -322,6 +322,11 @@ class OneBuildRepository extends AjaxRepository {
322
322
  params['conditions[' + idPropertyName + ']'] = id;
323
323
 
324
324
  const data = _.merge(params, this._baseParams);
325
+
326
+ if (this.debugMode) {
327
+ console.log('getSingleEntityFromServer', options);
328
+ }
329
+
325
330
  return this._send(this.methods.get, this.api.get, data)
326
331
  .then(result => {
327
332
  if (this.debugMode) {
@@ -497,6 +502,11 @@ class OneBuildRepository extends AjaxRepository {
497
502
  this.markLoading();
498
503
 
499
504
  const data = _.merge({ depth }, this._baseParams, this._params);
505
+
506
+ if (this.debugMode) {
507
+ console.log('loadRootNodes', data);
508
+ }
509
+
500
510
  return this._send('POST', this.name + '/getNodes', data)
501
511
  .then((result) => {
502
512
  if (this.debugMode) {
@@ -580,6 +590,11 @@ class OneBuildRepository extends AjaxRepository {
580
590
  this.markLoading();
581
591
 
582
592
  const data = _.merge({ depth, nodeId: treeNode.id, }, this._baseParams, this._params);
593
+
594
+ if (this.debugMode) {
595
+ console.log('loadNode', data);
596
+ }
597
+
583
598
  return this._send('POST', this.name + '/getNodes', data)
584
599
  .then((result) => {
585
600
  if (this.debugMode) {
@@ -655,6 +670,11 @@ class OneBuildRepository extends AjaxRepository {
655
670
  this.markLoading();
656
671
 
657
672
  const data = _.merge({ depth, parentId: treeNode.id, }, this._baseParams, this._params);
673
+
674
+ if (this.debugMode) {
675
+ console.log('loadChildNodes', data);
676
+ }
677
+
658
678
  return this._send('POST', this.name + '/getNodes', data)
659
679
  .then((result) => {
660
680
  if (this.debugMode) {
@@ -729,6 +749,11 @@ class OneBuildRepository extends AjaxRepository {
729
749
  }
730
750
 
731
751
  const data = _.merge({ q, }, this._baseParams, this._params);
752
+
753
+ if (this.debugMode) {
754
+ console.log('searchNodes', data);
755
+ }
756
+
732
757
  return this._send('POST', this.name + '/searchNodes', data)
733
758
  .then((result) => {
734
759
  if (this.debugMode) {
@@ -785,6 +810,11 @@ class OneBuildRepository extends AjaxRepository {
785
810
  const oldParentId = treeNode.parent?.id;
786
811
 
787
812
  const data = _.merge({ nodeId: treeNode.id, parentId: newParentId, }, this._baseParams, this._params);
813
+
814
+ if (this.debugMode) {
815
+ console.log('moveTreeNode', data);
816
+ }
817
+
788
818
  return this._send('POST', this.name + '/moveNode', data)
789
819
  .then((result) => {
790
820
  if (this.debugMode) {