@onehat/data 1.20.9 → 1.21.0

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.
Files changed (51) hide show
  1. package/cypress/downloads/downloads.html +0 -0
  2. package/cypress/e2e/Entity.cy.js +2 -2
  3. package/cypress/e2e/Property/Base64.cy.js +37 -3
  4. package/cypress/e2e/Property/Boolean.cy.js +30 -0
  5. package/cypress/e2e/Property/Currency.cy.js +41 -0
  6. package/cypress/e2e/Property/Date.cy.js +33 -0
  7. package/cypress/e2e/Property/DateTime.cy.js +33 -0
  8. package/cypress/e2e/Property/Float.cy.js +31 -0
  9. package/cypress/e2e/Property/Integer.cy.js +31 -0
  10. package/cypress/e2e/Property/Json.cy.js +29 -0
  11. package/cypress/e2e/Property/PercentInt.cy.js +32 -0
  12. package/cypress/e2e/Property/Property.cy.js +29 -0
  13. package/cypress/e2e/Property/Time.cy.js +33 -0
  14. package/cypress/e2e/Repository/Repository.cy.js +23 -16
  15. package/cypress/e2e/Schema.cy.js +2 -2
  16. package/package.json +1 -1
  17. package/src/Integration/Browser/Repository/Cookie.js +4 -4
  18. package/src/Integration/Browser/Repository/IndexedDB.js +4 -4
  19. package/src/Integration/Browser/Repository/LocalStorage.js +4 -4
  20. package/src/Integration/Browser/Repository/SecureLocalStorage.js +2 -2
  21. package/src/Integration/Browser/Repository/SecureSessionStorage.js +2 -2
  22. package/src/Integration/Browser/Repository/SessionStorage.js +4 -4
  23. package/src/Integration/ReactNative/Repository/AsyncStorage.js +8 -8
  24. package/src/Integration/ReactNative/Repository/SecureStore.js +4 -4
  25. package/src/Property/Base64.js +21 -11
  26. package/src/Property/Boolean.js +20 -12
  27. package/src/Property/Currency.js +30 -21
  28. package/src/Property/Date.js +23 -14
  29. package/src/Property/DateTime.js +18 -9
  30. package/src/Property/File.js +0 -4
  31. package/src/Property/Float.js +19 -10
  32. package/src/Property/Integer.js +19 -10
  33. package/src/Property/Json.js +22 -13
  34. package/src/Property/Percent.js +2 -2
  35. package/src/Property/PercentInt.js +16 -7
  36. package/src/Property/Property.js +150 -140
  37. package/src/Property/String.js +2 -7
  38. package/src/Property/Time.js +17 -8
  39. package/src/Property/Uuid.js +3 -8
  40. package/src/Property/index.js +2 -0
  41. package/src/Repository/Ajax.js +33 -28
  42. package/src/Repository/LocalFromRemote/Command.js +5 -5
  43. package/src/Repository/LocalFromRemote/CommandRepository.js +1 -1
  44. package/src/Repository/LocalFromRemote/LocalFromRemote.js +18 -17
  45. package/src/Repository/Memory.js +22 -21
  46. package/src/Repository/Null.js +5 -5
  47. package/src/Repository/Offline.js +17 -16
  48. package/src/Repository/OneBuild.js +34 -28
  49. package/src/Repository/OneBuild2.js +16 -10
  50. package/src/Repository/Repository.js +105 -102
  51. package/src/Schema/Schema.js +9 -6
@@ -187,7 +187,7 @@ class AjaxRepository extends Repository {
187
187
  * Helper for initialize
188
188
  * Sets the query params for initial loading
189
189
  */
190
- _setInitialQueryParams = () => {
190
+ _setInitialQueryParams() {
191
191
  // Pagination
192
192
  if (this.isPaginated) {
193
193
  this._onChangePagination();
@@ -215,7 +215,7 @@ class AjaxRepository extends Repository {
215
215
  * @param {any} value - Param value to set.
216
216
  * @param {boolean} isBaseParam - Whether param is a base param (to be sent on every request).
217
217
  */
218
- setParam = (name, value, isBaseParam = false) => {
218
+ setParam(name, value, isBaseParam = false) {
219
219
  const re = /^([^\[]+)\[([^\]]+)\](.*)$/,
220
220
  matches = name.match(re),
221
221
  paramsToChange = isBaseParam ? this._baseParams : this._params;
@@ -246,7 +246,7 @@ class AjaxRepository extends Repository {
246
246
  * @param {string} name - Param name to set.
247
247
  * @param {boolean} isBaseParam - Whether param is a base param (to be sent on every request).
248
248
  */
249
- setValuelessParam = (name, isBaseParam = false) => {
249
+ setValuelessParam(name, isBaseParam = false) {
250
250
  const re = /^([^\[]+)\[([^\]]+)\](.*)$/,
251
251
  matches = name.match(re),
252
252
  paramsToChange = isBaseParam ? this._baseParams : this._params;
@@ -272,9 +272,10 @@ class AjaxRepository extends Repository {
272
272
  * Sets query params
273
273
  * @param {object} params - Params to set. Key is parameter name, value is parameter value
274
274
  */
275
- setParams = (params) => {
275
+ setParams(params) {
276
+ const oThis = this;
276
277
  _.each(params, (value, name) => {
277
- this.setParam(name, value);
278
+ oThis.setParam(name, value);
278
279
  });
279
280
  }
280
281
 
@@ -282,7 +283,7 @@ class AjaxRepository extends Repository {
282
283
  * Determines if base query param exists
283
284
  * @param {string} name - Param name
284
285
  */
285
- hasBaseParam = (name) => {
286
+ hasBaseParam(name) {
286
287
  return this._baseParams.hasOwnProperty(name);
287
288
  }
288
289
 
@@ -290,7 +291,7 @@ class AjaxRepository extends Repository {
290
291
  * Determines if query param exists
291
292
  * @param {string} name - Param name
292
293
  */
293
- hasParam = (name) => {
294
+ hasParam(name) {
294
295
  return this._params.hasOwnProperty(name);
295
296
  }
296
297
 
@@ -299,7 +300,7 @@ class AjaxRepository extends Repository {
299
300
  * @param {string} name - Param name to set.
300
301
  * @param {any} value - Param value to set.
301
302
  */
302
- setBaseParam = (name, value) => {
303
+ setBaseParam(name, value) {
303
304
  this.setParam(name, value, true);
304
305
  }
305
306
 
@@ -307,9 +308,10 @@ class AjaxRepository extends Repository {
307
308
  * Sets base query params. These params are sent on every request.
308
309
  * @param {object} params - Base params to set. Key is parameter name, value is parameter value
309
310
  */
310
- setBaseParams = (params) => {
311
+ setBaseParams(params) {
312
+ const oThis = this;
311
313
  _.each(params, (value, name) => {
312
- this.setBaseParam(name, value);
314
+ oThis.setBaseParam(name, value);
313
315
  });
314
316
  }
315
317
 
@@ -318,7 +320,7 @@ class AjaxRepository extends Repository {
318
320
  * *Not intended for normal usage,* but rather for testing.
319
321
  * @param {boolean} reload - Whether to reload repository. Defaults to false.
320
322
  */
321
- clearParams = (reload = false, clearBase = false) => {
323
+ clearParams(reload = false, clearBase = false) {
322
324
  this._params = {};
323
325
  if (clearBase) {
324
326
  this._baseParams = {};
@@ -333,7 +335,7 @@ class AjaxRepository extends Repository {
333
335
  * Only one sorter is allowed with this Repository type.
334
336
  * Refreshes entities.
335
337
  */
336
- _onChangeSorters = () => {
338
+ _onChangeSorters() {
337
339
  const sorter = this.sorters[0];
338
340
  this.setBaseParam(this.paramSort, sorter.name);
339
341
  this.setBaseParam(this.paramDirection, sorter.direction);
@@ -347,9 +349,10 @@ class AjaxRepository extends Repository {
347
349
  * Sets filter params.
348
350
  * Refreshes entities.
349
351
  */
350
- _onChangeFilters = () => {
352
+ _onChangeFilters() {
353
+ const oThis = this;
351
354
  _.each(this.filters, (value, name) => {
352
- this.setParam(name, value);
355
+ oThis.setParam(name, value);
353
356
  });
354
357
 
355
358
  if (this.isLoaded && !this.eventsPaused) {
@@ -361,7 +364,7 @@ class AjaxRepository extends Repository {
361
364
  * Sets pagination params.
362
365
  * Refreshes entities.
363
366
  */
364
- _onChangePagination = () => {
367
+ _onChangePagination() {
365
368
  this.setBaseParam(this.paramPageNum, this.isPaginated ? this.page : null);
366
369
  this.setBaseParam(this.paramPageSize, this.isPaginated ? this.pageSize : null);
367
370
 
@@ -384,7 +387,7 @@ class AjaxRepository extends Repository {
384
387
  * @param {function} callback - Function to call after loading is complete
385
388
  * @fires beforeLoad,changeData,load,error
386
389
  */
387
- load = async (params, callback = null) => {
390
+ async load(params, callback = null) {
388
391
  if (this.isTree && this.loadRootNodes) {
389
392
  return this.loadRootNodes();
390
393
  }
@@ -437,11 +440,12 @@ class AjaxRepository extends Repository {
437
440
  message
438
441
  } = this._processServerResponse(result);
439
442
 
443
+ const oThis = this;
440
444
  if (this.isShowingMore) {
441
445
  // Add to the current entities
442
446
  const newEntities = _.map(root, (data) => {
443
- const entity = Repository._createEntity(this.schema, data, repository, true);
444
- this._relayEntityEvents(entity);
447
+ const entity = Repository._createEntity(oThis.schema, data, repository, true);
448
+ oThis._relayEntityEvents(entity);
445
449
  return entity;
446
450
  });
447
451
  this.entities = this.entities.concat(newEntities);
@@ -449,8 +453,8 @@ class AjaxRepository extends Repository {
449
453
  // Replace the current entities
450
454
  this._destroyEntities();
451
455
  this.entities = _.map(root, (data) => {
452
- const entity = Repository._createEntity(this.schema, data, repository, true);
453
- this._relayEntityEvents(entity);
456
+ const entity = Repository._createEntity(oThis.schema, data, repository, true);
457
+ oThis._relayEntityEvents(entity);
454
458
  return entity;
455
459
  });
456
460
  }
@@ -476,7 +480,7 @@ class AjaxRepository extends Repository {
476
480
  });
477
481
  }
478
482
 
479
- showMore = (params = {}, callback) => {
483
+ showMore(params = {}, callback) {
480
484
  params.showMore = true;
481
485
  return this.load(params, callback);
482
486
  }
@@ -560,7 +564,7 @@ class AjaxRepository extends Repository {
560
564
  * Helper for save.
561
565
  * @private
562
566
  */
563
- _onBeforeSave = () => {
567
+ _onBeforeSave() {
564
568
  this._operations = {
565
569
  add: false,
566
570
  edit: false,
@@ -961,7 +965,7 @@ class AjaxRepository extends Repository {
961
965
  * Fires off axios request to server
962
966
  * @private
963
967
  */
964
- _send = (method, url, data) => {
968
+ _send(method, url, data) {
965
969
 
966
970
  if (!url) {
967
971
  this.throwError('No url submitted');
@@ -1013,7 +1017,7 @@ class AjaxRepository extends Repository {
1013
1017
  * @fires error
1014
1018
  * @private
1015
1019
  */
1016
- _processServerResponse = (result) => {
1020
+ _processServerResponse(result) {
1017
1021
  return this.reader.read(result);
1018
1022
  }
1019
1023
 
@@ -1022,7 +1026,7 @@ class AjaxRepository extends Repository {
1022
1026
  * This is mainly used to sort isPhantom entities,
1023
1027
  * since the server normally sorts, and they haven't yet gone to server.
1024
1028
  */
1025
- sortInMemory = () => {
1029
+ sortInMemory() {
1026
1030
  const sorters = this.sorters;
1027
1031
  let sortNames = [],
1028
1032
  sortDirections = [];
@@ -1043,7 +1047,7 @@ class AjaxRepository extends Repository {
1043
1047
  * @fires save, changeData
1044
1048
  * @private
1045
1049
  */
1046
- _finalizeSave = (promises) => {
1050
+ _finalizeSave(promises) {
1047
1051
  if (!promises.length) {
1048
1052
  return;
1049
1053
  }
@@ -1066,9 +1070,10 @@ class AjaxRepository extends Repository {
1066
1070
  }
1067
1071
  if (this._operations.deletePhantom) {
1068
1072
  // sweep existing deleted records and remove them
1073
+ const oThis = this;
1069
1074
  _.each(this.entities, (entity) => {
1070
1075
  if (entity.isDeleted && entity.isDestroyed) {
1071
- this.removeEntity(entity);
1076
+ oThis.removeEntity(entity);
1072
1077
  }
1073
1078
  })
1074
1079
  }
@@ -1081,7 +1086,7 @@ class AjaxRepository extends Repository {
1081
1086
  }));
1082
1087
  }
1083
1088
 
1084
- setIsOnline = (isOnline) => {
1089
+ setIsOnline(isOnline) {
1085
1090
  this.isOnline = !!isOnline; // force convert type to boolean
1086
1091
  }
1087
1092
 
@@ -35,7 +35,7 @@ export default class Command extends EventEmitter {
35
35
  * Register a handler for this command.
36
36
  * @param {function} handler - The event handler
37
37
  */
38
- registerHandler = (handler) => {
38
+ registerHandler(handler) {
39
39
  this.on('handleServerResponse', handler);
40
40
  }
41
41
 
@@ -43,7 +43,7 @@ export default class Command extends EventEmitter {
43
43
  * Register a handler for this command.
44
44
  * @param {function} handler - The event handler
45
45
  */
46
- unregisterHandler = (handler) => {
46
+ unregisterHandler(handler) {
47
47
  this.off('handleServerResponse', handler);
48
48
  }
49
49
 
@@ -51,7 +51,7 @@ export default class Command extends EventEmitter {
51
51
  * Detect whether this command has any handlers.
52
52
  * @return {int} count - Number of handlers this command has
53
53
  */
54
- hasHandlers = () => {
54
+ hasHandlers() {
55
55
  return this.listenerCount('handleServerResponse');
56
56
  }
57
57
 
@@ -59,7 +59,7 @@ export default class Command extends EventEmitter {
59
59
  * Convenience function to invoke handlers
60
60
  * @return {boolean} results - Results of running all handlers
61
61
  */
62
- processResponse = async (entity) => {
62
+ async processResponse(entity) {
63
63
  return await this.emitAsync('handleServerResponse', entity);
64
64
  }
65
65
 
@@ -68,7 +68,7 @@ export default class Command extends EventEmitter {
68
68
  * - Removes event listeners
69
69
  * @fires destroy
70
70
  */
71
- destroy = () => {
71
+ destroy() {
72
72
  this.emit('destroy');
73
73
  this.isDestroyed = true;
74
74
 
@@ -29,7 +29,7 @@ class CommandRepository extends OneBuildRepository {
29
29
  * Override Ajax._finalizeSave because we *don't* want to automatically
30
30
  * reload after the save.
31
31
  */
32
- _finalizeSave = (promises) => {
32
+ _finalizeSave(promises) {
33
33
  return this.axios.all(promises);
34
34
  }
35
35
 
@@ -214,10 +214,11 @@ class LocalFromRemoteRepository extends EventEmitter {
214
214
  /**
215
215
  * Registers multiple commands for when syncing in MODE_COMMAND_QUEUE mode.
216
216
  */
217
- registerCommands = (commands) => {
217
+ registerCommands(commands) {
218
+ const oThis = this;
218
219
  _.each(commands, (name) => {
219
- if (!this.isRegisteredCommand(name)) {
220
- this.commands[name] = new Command(name);
220
+ if (!oThis.isRegisteredCommand(name)) {
221
+ oThis.commands[name] = new Command(name);
221
222
  }
222
223
  });
223
224
  }
@@ -227,7 +228,7 @@ class LocalFromRemoteRepository extends EventEmitter {
227
228
  * @param {string} name - The command name
228
229
  * @return {function} handler - The handler function
229
230
  */
230
- registerCommandHandler = (name, handler) => {
231
+ registerCommandHandler(name, handler) {
231
232
  const command = this.getCommand(name);
232
233
  if (!command) {
233
234
  return false;
@@ -242,7 +243,7 @@ class LocalFromRemoteRepository extends EventEmitter {
242
243
  * @param {string} name - The command name
243
244
  * @return {function} handler - The handler function
244
245
  */
245
- unregisterCommandHandler = (name, handler) => {
246
+ unregisterCommandHandler(name, handler) {
246
247
  const command = this.getCommand(name);
247
248
  if (!command) {
248
249
  return false;
@@ -256,7 +257,7 @@ class LocalFromRemoteRepository extends EventEmitter {
256
257
  * @param {string} name - The command name
257
258
  * @return {boolean} isRegisteredCommand
258
259
  */
259
- isRegisteredCommand = (name) => {
260
+ isRegisteredCommand(name) {
260
261
  return _.indexOf(this.commands, name) !== -1;
261
262
  }
262
263
 
@@ -265,7 +266,7 @@ class LocalFromRemoteRepository extends EventEmitter {
265
266
  * @param {string} name - The command name
266
267
  * @return {boolean} isRegisteredCommand
267
268
  */
268
- getCommand = (name) => {
269
+ getCommand(name) {
269
270
  return this.commands[name] || null;
270
271
  }
271
272
 
@@ -273,7 +274,7 @@ class LocalFromRemoteRepository extends EventEmitter {
273
274
  * Adds a hook into the normal Repository.add() method,
274
275
  * so we can sync immediately after add for MODE_COMMAND_QUEUE mode.
275
276
  */
276
- add = async (data) => {
277
+ async add(data) {
277
278
  // NORMAL PROCESS, basically call super()
278
279
  // This adds to the local repository, so we can sync later,
279
280
  // if needed.
@@ -289,7 +290,7 @@ class LocalFromRemoteRepository extends EventEmitter {
289
290
  /**
290
291
  * Syncs local and remote repositories, based on operation mode.
291
292
  */
292
- sync = async (entity, callback = null) => {
293
+ async sync(entity, callback = null) {
293
294
 
294
295
  if (this.debugMode) {
295
296
  console.log('sync');
@@ -433,7 +434,7 @@ class LocalFromRemoteRepository extends EventEmitter {
433
434
  * if isRetry, we are retrying to sync, due to being offline.
434
435
  * This will schedule the next sync based on nextRetryDate.
435
436
  */
436
- _doAutoSync = async (isRetry = false) => {
437
+ async _doAutoSync(isRetry = false) {
437
438
 
438
439
  const now = moment(),
439
440
  nowMs = now.valueOf();
@@ -496,7 +497,7 @@ class LocalFromRemoteRepository extends EventEmitter {
496
497
  * Gets lastSync from private variable,
497
498
  * or from local storage medium, if possible.
498
499
  */
499
- getLastSync = async () => {
500
+ async getLastSync() {
500
501
  if (!this.lastSync && this.local.getLastSync) {
501
502
  const lastSync = await this.local.getLastSync();
502
503
  // const lastSync = null;
@@ -511,7 +512,7 @@ class LocalFromRemoteRepository extends EventEmitter {
511
512
  * Sets lastSync to now and saves to local storage medium, if possible.
512
513
  * @private
513
514
  */
514
- _setLastSync = async () => {
515
+ async _setLastSync() {
515
516
  const now = moment();
516
517
  this.lastSync = now;
517
518
  if (this.local.setLastSync) {
@@ -519,7 +520,7 @@ class LocalFromRemoteRepository extends EventEmitter {
519
520
  }
520
521
  };
521
522
 
522
- getNextRetry = () => {
523
+ getNextRetry() {
523
524
  const date = moment().relativeTime(this.retryRate);
524
525
  if (!isNaN(date) && date.isValid()) {
525
526
  return date;
@@ -527,7 +528,7 @@ class LocalFromRemoteRepository extends EventEmitter {
527
528
  return null;
528
529
  }
529
530
 
530
- getNextSync = () => {
531
+ getNextSync() {
531
532
  const oneMinuteAgo = moment().relativeTime('-1 minute');
532
533
  if (!this.lastSync) {
533
534
  return oneMinuteAgo;
@@ -584,7 +585,7 @@ class LocalFromRemoteRepository extends EventEmitter {
584
585
  /**
585
586
  * Sets autoSync. If autoSync is enabled, it immediately starts autosync process.
586
587
  */
587
- setAutoSync = async (isAutoSync) => {
588
+ async setAutoSync(isAutoSync) {
588
589
  let isChanged = false
589
590
  if (this.isAutoSync !== isAutoSync) {
590
591
  isChanged = true;
@@ -601,7 +602,7 @@ class LocalFromRemoteRepository extends EventEmitter {
601
602
  /**
602
603
  * Sets options on the repositories.
603
604
  */
604
- setOptions = (options) => {
605
+ setOptions(options) {
605
606
  this.local.setOptions(options);
606
607
  this.remote.setOptions(options);
607
608
  }
@@ -609,7 +610,7 @@ class LocalFromRemoteRepository extends EventEmitter {
609
610
  /**
610
611
  * Sets isOnline. If isOnline and autoSync is enabled, it immediately starts isAutosync process.
611
612
  */
612
- setIsOnline = (isOnline) => {
613
+ setIsOnline(isOnline) {
613
614
  this.isOnline = !!isOnline; // force convert type to boolean
614
615
  if (isOnline && this.isAutoSync) {
615
616
  this._doAutoSync();
@@ -89,7 +89,7 @@ class MemoryRepository extends Repository {
89
89
  * @param {array} data - Optional array of rawData or entities
90
90
  * to load. If null, data will be loaded from storage medium.
91
91
  */
92
- load = async (data = null) => {
92
+ async load(data = null) {
93
93
 
94
94
  if (this.isDestroyed) {
95
95
  this.throwError('this.load is no longer valid. Repository has been destroyed.');
@@ -127,18 +127,19 @@ class MemoryRepository extends Repository {
127
127
  const repository = this;
128
128
  if (!_.isEmpty(data) && !(data[0] instanceof Entity)) {
129
129
  entities = _.map(data, (dataRow) => {
130
- const entity = Repository._createEntity(this.schema, dataRow, repository, true);
131
- this._relayEntityEvents(entity);
130
+ const entity = Repository._createEntity(repository.schema, dataRow, repository, true);
131
+ repository._relayEntityEvents(entity);
132
132
  return entity;
133
133
  });
134
134
  }
135
135
 
136
136
  // Add to internal store
137
+ const oThis = this;
137
138
  _.each(entities, (entity) => {
138
139
  if (entity.isPhantom) {
139
140
  entity.createTempId();
140
141
  }
141
- this._keyedEntities[entity.id] = entity;
142
+ oThis._keyedEntities[entity.id] = entity;
142
143
  });
143
144
 
144
145
  if (isDirectLoad && this._saveToStorage) {
@@ -158,7 +159,7 @@ class MemoryRepository extends Repository {
158
159
  * This is mainly used for subclasses of MemoryRepository.
159
160
  * @return {array} data - Array of rawData objects
160
161
  */
161
- _loadFromStorage = async () => {
162
+ async _loadFromStorage() {
162
163
  return this.data || []; // this.data may have come from initial config of Repository
163
164
  }
164
165
 
@@ -175,7 +176,7 @@ class MemoryRepository extends Repository {
175
176
  * Override base Repository, just return the entity from storage
176
177
  * @abstract
177
178
  */
178
- reloadEntity = async (entity) => {
179
+ async reloadEntity(entity) {
179
180
  const reloadedEntity = this.getById(entity.id);
180
181
  reloadedEntity.emit('reload', reloadedEntity);
181
182
 
@@ -199,7 +200,7 @@ class MemoryRepository extends Repository {
199
200
  * Internally applies all sorters
200
201
  * @private
201
202
  */
202
- _applySorters = () => {
203
+ _applySorters() {
203
204
  if (this.isDestroyed) {
204
205
  this.throwError('this._applySorters is no longer valid. Repository has been destroyed.');
205
206
  return;
@@ -252,7 +253,7 @@ class MemoryRepository extends Repository {
252
253
  * @private
253
254
  * @static
254
255
  */
255
- static _getNatSort = (sorter) => {
256
+ static _getNatSort(sorter) {
256
257
  const
257
258
  name = sorter.name,
258
259
  direction = sorter.direction.toUpperCase();
@@ -276,7 +277,7 @@ class MemoryRepository extends Repository {
276
277
  * @private
277
278
  * @static
278
279
  */
279
- static _getCompareFunction = (sorter) => {
280
+ static _getCompareFunction(sorter) {
280
281
  const
281
282
  name = sorter.name,
282
283
  direction = sorter.direction.toUpperCase();
@@ -309,7 +310,7 @@ class MemoryRepository extends Repository {
309
310
  * @fires changeFilter
310
311
  * @private
311
312
  */
312
- _applyFilters = () => {
313
+ _applyFilters() {
313
314
  if (this.isDestroyed) {
314
315
  this.throwError('this._applyFilters is no longer valid. Repository has been destroyed.');
315
316
  return;
@@ -399,7 +400,7 @@ class MemoryRepository extends Repository {
399
400
  * @return {string} id
400
401
  * @private
401
402
  */
402
- _generateUniqueId = () => {
403
+ _generateUniqueId() {
403
404
  let isUnique = false,
404
405
  id;
405
406
  while(!isUnique) {
@@ -458,7 +459,7 @@ class MemoryRepository extends Repository {
458
459
  /**
459
460
  * Deletes all entities in repository
460
461
  */
461
- deleteAll = async () => {
462
+ async deleteAll() {
462
463
  const entities = _.map(this._keyedEntities, entity => entity);
463
464
  await this.delete(entities);
464
465
  }
@@ -467,7 +468,7 @@ class MemoryRepository extends Repository {
467
468
  * Get an entity directly from its id.
468
469
  * @return {object} entity
469
470
  */
470
- getById = (id) => {
471
+ getById(id) {
471
472
  if (this.isDestroyed) {
472
473
  this.throwError('this.getById is no longer valid. Repository has been destroyed.');
473
474
  return;
@@ -481,7 +482,7 @@ class MemoryRepository extends Repository {
481
482
  * @param {integer} id - id of record to retrieve
482
483
  * @return {integer} The numerical index, or undefined
483
484
  */
484
- getIxById = (id) => {
485
+ getIxById(id) {
485
486
  if (this.isDestroyed) {
486
487
  this.throwError('this.getIxById is no longer valid. Repository has been destroyed.');
487
488
  return;
@@ -499,7 +500,7 @@ class MemoryRepository extends Repository {
499
500
  * all *active* Entities, with sorting and filtering applied.
500
501
  * @return {array} Entities that passed through filter
501
502
  */
502
- getEntities = () => {
503
+ getEntities() {
503
504
  if (this.isDestroyed) {
504
505
  this.throwError('this.getEntities is no longer valid. Repository has been destroyed.');
505
506
  return;
@@ -512,7 +513,7 @@ class MemoryRepository extends Repository {
512
513
  * Get an array of all Entities
513
514
  * @return {Entity[]} Entities that passed through filter
514
515
  * /
515
- getAllData = () => {
516
+ getAllData() {
516
517
  if (this.isDestroyed) {
517
518
  this.throwError('this.getAllData is no longer valid. Repository has been destroyed.');
518
519
  return;
@@ -550,7 +551,7 @@ class MemoryRepository extends Repository {
550
551
  * @return {array} entities - The slice of entities
551
552
  * @private
552
553
  */
553
- _paginate = (entities) => {
554
+ _paginate(entities) {
554
555
  if (this.isDestroyed) {
555
556
  this.throwError('this._paginate is no longer valid. Repository has been destroyed.');
556
557
  return;
@@ -575,7 +576,7 @@ class MemoryRepository extends Repository {
575
576
  * @fires changeData
576
577
  * @private
577
578
  */
578
- _recalculate = () => {
579
+ _recalculate() {
579
580
  if (this.isDestroyed) {
580
581
  this.throwError('this._recalculate is no longer valid. Repository has been destroyed.');
581
582
  return;
@@ -609,7 +610,7 @@ class MemoryRepository extends Repository {
609
610
  }
610
611
 
611
612
 
612
- _insertBefore = (newEntity, entity = null) => {
613
+ _insertBefore(newEntity, entity = null) {
613
614
  throw Error('Not yet implemented');
614
615
  }
615
616
 
@@ -618,7 +619,7 @@ class MemoryRepository extends Repository {
618
619
  * before any sorting or filtering is applied.
619
620
  * @return {integer} count - The total number of unsorted, unfiltered entities
620
621
  */
621
- getGrandTotal = () => {
622
+ getGrandTotal() {
622
623
  if (this.isDestroyed) {
623
624
  this.throwError('this.getGrandTotal is no longer valid. Repository has been destroyed.');
624
625
  return;
@@ -633,7 +634,7 @@ class MemoryRepository extends Repository {
633
634
  * Otherwise, this is equal to the
634
635
  * @return {integer} count - The total number of unsorted, unfiltered entities
635
636
  */
636
- _getActiveEntities = () => {
637
+ _getActiveEntities() {
637
638
  if (this.isDestroyed) {
638
639
  this.throwError('this._getActiveEntities is no longer valid. Repository has been destroyed.');
639
640
  return;
@@ -41,7 +41,7 @@ class NullRepository extends Repository {
41
41
  * @param {object} data - Data to immediately load
42
42
  * @fires load
43
43
  */
44
- load = (data = this.data) => {
44
+ load(data = this.data) {
45
45
  if (this.isDestroyed) {
46
46
  this.throwError('this.load is no longer valid. Repository has been destroyed.');
47
47
  return;
@@ -54,8 +54,8 @@ class NullRepository extends Repository {
54
54
  if (data[0] instanceof Entity === false) {
55
55
  const repository = this;
56
56
  entities = _.map(data, (item) => {
57
- const entity = Repository._createEntity(this.schema, item, repository, true);
58
- this._relayEntityEvents(entity);
57
+ const entity = Repository._createEntity(repository.schema, item, repository, true);
58
+ repository._relayEntityEvents(entity);
59
59
  return entity;
60
60
  });
61
61
  }
@@ -75,7 +75,7 @@ class NullRepository extends Repository {
75
75
  * Helper for load().
76
76
  * @private
77
77
  */
78
- _updateSize = () => {
78
+ _updateSize() {
79
79
  this.total = _.size(this.entities);
80
80
  }
81
81
 
@@ -118,7 +118,7 @@ class NullRepository extends Repository {
118
118
  return true;
119
119
  }
120
120
 
121
- _doDeleteNonPersisted = (entity) => {
121
+ _doDeleteNonPersisted(entity) {
122
122
  return this._doDelete(entity);
123
123
  }
124
124