@onehat/data 1.8.34 → 1.8.35
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.
|
@@ -229,6 +229,16 @@ describe('Repository Base', function() {
|
|
|
229
229
|
expect(didFireChangeSorters).to.be.true;
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
+
it('getSortField', function() {
|
|
233
|
+
const sortField = this.repository.getSortField();
|
|
234
|
+
expect(sortField).to.be.eq('value');
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('getSortDirection', function() {
|
|
238
|
+
const sortDirection = this.repository.getSortDirection();
|
|
239
|
+
expect(sortDirection).to.be.eq('ASC');
|
|
240
|
+
});
|
|
241
|
+
|
|
232
242
|
});
|
|
233
243
|
|
|
234
244
|
describe('filtering', function() {
|
package/package.json
CHANGED
|
@@ -305,7 +305,7 @@ export default class Repository extends EventEmitter {
|
|
|
305
305
|
*/
|
|
306
306
|
_createStatics = () => {
|
|
307
307
|
if (this.isDestroyed) {
|
|
308
|
-
throw Error('this._createStatics is no longer valid.
|
|
308
|
+
throw Error('this._createStatics is no longer valid. Repository has been destroyed.');
|
|
309
309
|
}
|
|
310
310
|
const staticsDefinitions = this.schema.repository.statics || this.originalConfig.statics; // The latter is mainly for lfr repositories
|
|
311
311
|
if (!_.isEmpty(staticsDefinitions)) {
|
|
@@ -1327,11 +1327,39 @@ export default class Repository extends EventEmitter {
|
|
|
1327
1327
|
*/
|
|
1328
1328
|
getSchema = () => {
|
|
1329
1329
|
if (this.isDestroyed) {
|
|
1330
|
-
throw Error('this.getSchema is no longer valid.
|
|
1330
|
+
throw Error('this.getSchema is no longer valid. Repository has been destroyed.');
|
|
1331
1331
|
}
|
|
1332
1332
|
return this.schema;
|
|
1333
1333
|
}
|
|
1334
1334
|
|
|
1335
|
+
/**
|
|
1336
|
+
* Gets the sort field, if only one sorter is applied.
|
|
1337
|
+
* @return {Schema} schema
|
|
1338
|
+
*/
|
|
1339
|
+
getSortField = () => {
|
|
1340
|
+
if (this.isDestroyed) {
|
|
1341
|
+
throw Error('this.getSortField is no longer valid. Repository has been destroyed.');
|
|
1342
|
+
}
|
|
1343
|
+
if (!this.allowsMultiSort || this.sorters.length < 1) {
|
|
1344
|
+
return null;
|
|
1345
|
+
}
|
|
1346
|
+
return this.sorters[0].name;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Gets the sort direction, if only one sorter is applied.
|
|
1351
|
+
* @return {Schema} schema
|
|
1352
|
+
*/
|
|
1353
|
+
getSortDirection = () => {
|
|
1354
|
+
if (this.isDestroyed) {
|
|
1355
|
+
throw Error('this.getSortDirection is no longer valid. Repository has been destroyed.');
|
|
1356
|
+
}
|
|
1357
|
+
if (!this.allowsMultiSort || this.sorters.length < 1) {
|
|
1358
|
+
return null;
|
|
1359
|
+
}
|
|
1360
|
+
return this.sorters[0].direction;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1335
1363
|
/**
|
|
1336
1364
|
* Gets the associated Repository
|
|
1337
1365
|
* @param {string} repositoryName - Name of the Repository to retrieve
|
|
@@ -1339,7 +1367,7 @@ export default class Repository extends EventEmitter {
|
|
|
1339
1367
|
*/
|
|
1340
1368
|
getAssociatedRepository = (repositoryName) => {
|
|
1341
1369
|
if (this.isDestroyed) {
|
|
1342
|
-
throw Error('this.getAssociatedRepository is no longer valid.
|
|
1370
|
+
throw Error('this.getAssociatedRepository is no longer valid. Repository has been destroyed.');
|
|
1343
1371
|
}
|
|
1344
1372
|
|
|
1345
1373
|
const schema = this.getSchema();
|