@onehat/data 1.22.18 → 1.22.19
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
package/src/Repository/Ajax.js
CHANGED
|
@@ -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
|