@onehat/data 1.19.33 → 1.19.36

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.33",
3
+ "version": "1.19.36",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -92,7 +92,7 @@ class LocalStorageRepository extends OfflineRepository {
92
92
  }
93
93
  }
94
94
 
95
- _clearAll = () => {
95
+ clearAll = () => {
96
96
  return this._store.clearAll();
97
97
  }
98
98
 
@@ -47,7 +47,7 @@ class SessionStorageRepository extends OfflineRepository {
47
47
  return this._store.session.remove(name);
48
48
  }
49
49
 
50
- _clearAll = () => {
50
+ clearAll = () => {
51
51
  return this._store.session.clearAll();
52
52
  }
53
53
 
@@ -1,10 +1,10 @@
1
1
  /** @module Reader */
2
2
 
3
3
  import JsonReader from './JsonReader.js';
4
- // import XmlReader from './XmlReader.js';
4
+ import XmlReader from './XmlReader.js';
5
5
 
6
6
  const ReaderTypes = {
7
7
  [JsonReader.type]: JsonReader,
8
- // [XmlReader.type]: XmlReader,
8
+ [XmlReader.type]: XmlReader,
9
9
  };
10
10
  export default ReaderTypes;
@@ -545,13 +545,13 @@ export default class Repository extends EventEmitter {
545
545
  } else if (!_.isNil(this.schema.model.sortProperty)) {
546
546
  sorters = [{
547
547
  name: this.schema.model.sortProperty,
548
- direction: 'ASC',
548
+ direction: this.schema.model.sortDir,
549
549
  fn: 'default',
550
550
  }];
551
551
  } else if (!_.isNil(this.schema.model.displayProperty)) {
552
552
  sorters = [{
553
553
  name: this.schema.model.displayProperty,
554
- direction: 'ASC',
554
+ direction: this.schema.model.sortDir,
555
555
  fn: 'default',
556
556
  }];
557
557
  }
@@ -65,6 +65,12 @@ export default class Schema extends EventEmitter {
65
65
  */
66
66
  sortProperty: null,
67
67
 
68
+ /**
69
+ * @member {string} sortDir - direction of sort Property ('ASC' || 'DESC')
70
+ * if sortProperty has a value and sorters is left blank, an automatic sorter with this property will be created.
71
+ */
72
+ sortDir: 'ASC',
73
+
68
74
  /**
69
75
  * @member {string} parentIdProperty - name of parent_id Property (e.g. 'categories__parent_id' for Adjacency Lists, and parent_id for Closure Tables)
70
76
  * For trees only
@@ -1,10 +1,10 @@
1
1
  /** @module Writer */
2
2
 
3
3
  import JsonWriter from './JsonWriter.js';
4
- // import XmlWriter from './XmlWriter.js';
4
+ import XmlWriter from './XmlWriter.js';
5
5
 
6
6
  const WriterTypes = {
7
7
  [JsonWriter.type]: JsonWriter,
8
- // [XmlWriter.type]: XmlWriter,
8
+ [XmlWriter.type]: XmlWriter,
9
9
  };
10
10
  export default WriterTypes;