@onehat/data 1.22.18 → 1.22.20

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.
@@ -38,6 +38,21 @@ describe('OneBuildRepository', function() {
38
38
  expect(r._params.test).to.be.eq(1);
39
39
  });
40
40
 
41
+ it('getBaseParamConditions', function() {
42
+ const
43
+ r = this.repository,
44
+ newConditions = {
45
+ 'conditions[Model.model]': 'test1',
46
+ 'conditions[Model.modelid]': 'test2',
47
+ };
48
+
49
+ r.setBaseParams(newConditions);
50
+
51
+ const conditions = r.getBaseParamConditions();
52
+
53
+ expect(conditions).to.eql(newConditions);
54
+ });
55
+
41
56
  it('hasParam', function() {
42
57
  const r = this.repository;
43
58
  r.setParam('test', 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/data",
3
- "version": "1.22.18",
3
+ "version": "1.22.20",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -354,6 +354,19 @@ class AjaxRepository extends Repository {
354
354
  return this._baseParams;
355
355
  }
356
356
 
357
+ /**
358
+ * Returns current value of any baseParam query conditions
359
+ */
360
+ getBaseParamConditions() {
361
+ const
362
+ existingConditions = this._baseParams.conditions || {},
363
+ convertedConditions = {};
364
+ _.each(existingConditions, (value, key) => {
365
+ convertedConditions['conditions[' + key + ']'] = value;
366
+ });
367
+ return convertedConditions;
368
+ }
369
+
357
370
  /**
358
371
  * Determines if query param exists
359
372
  * @param {string} name - Param name
@@ -522,7 +535,7 @@ class AjaxRepository extends Repository {
522
535
 
523
536
  const repository = this;
524
537
 
525
- return this._send(this.methods.get, url, data, { isLoadRequest: true, requestKey, })
538
+ return this._send(this.methods.get, url, data, { isLoadRequest: true, requestKey, })
526
539
  .then(result => {
527
540
  if (this.debugMode) {
528
541
  console.log('Response for ' + this.name, result);
@@ -113,6 +113,7 @@ class TreeRepository extends OneBuildRepository {
113
113
  this.total = total;
114
114
  this._setPaginationVars();
115
115
 
116
+ this.markLoaded();
116
117
  this.areRootNodesLoaded = true;
117
118
 
118
119