@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.
- package/cypress/downloads/downloads.html +0 -0
- package/cypress/e2e/Entity.cy.js +2 -2
- package/cypress/e2e/Property/Base64.cy.js +37 -3
- package/cypress/e2e/Property/Boolean.cy.js +30 -0
- package/cypress/e2e/Property/Currency.cy.js +41 -0
- package/cypress/e2e/Property/Date.cy.js +33 -0
- package/cypress/e2e/Property/DateTime.cy.js +33 -0
- package/cypress/e2e/Property/Float.cy.js +31 -0
- package/cypress/e2e/Property/Integer.cy.js +31 -0
- package/cypress/e2e/Property/Json.cy.js +29 -0
- package/cypress/e2e/Property/PercentInt.cy.js +32 -0
- package/cypress/e2e/Property/Property.cy.js +29 -0
- package/cypress/e2e/Property/Time.cy.js +33 -0
- package/cypress/e2e/Repository/Repository.cy.js +23 -16
- package/cypress/e2e/Schema.cy.js +2 -2
- package/package.json +1 -1
- package/src/Integration/Browser/Repository/Cookie.js +4 -4
- package/src/Integration/Browser/Repository/IndexedDB.js +4 -4
- package/src/Integration/Browser/Repository/LocalStorage.js +4 -4
- package/src/Integration/Browser/Repository/SecureLocalStorage.js +2 -2
- package/src/Integration/Browser/Repository/SecureSessionStorage.js +2 -2
- package/src/Integration/Browser/Repository/SessionStorage.js +4 -4
- package/src/Integration/ReactNative/Repository/AsyncStorage.js +8 -8
- package/src/Integration/ReactNative/Repository/SecureStore.js +4 -4
- package/src/Property/Base64.js +21 -11
- package/src/Property/Boolean.js +20 -12
- package/src/Property/Currency.js +30 -21
- package/src/Property/Date.js +23 -14
- package/src/Property/DateTime.js +18 -9
- package/src/Property/File.js +0 -4
- package/src/Property/Float.js +19 -10
- package/src/Property/Integer.js +19 -10
- package/src/Property/Json.js +22 -13
- package/src/Property/Percent.js +2 -2
- package/src/Property/PercentInt.js +16 -7
- package/src/Property/Property.js +150 -140
- package/src/Property/String.js +2 -7
- package/src/Property/Time.js +17 -8
- package/src/Property/Uuid.js +3 -8
- package/src/Property/index.js +2 -0
- package/src/Repository/Ajax.js +33 -28
- package/src/Repository/LocalFromRemote/Command.js +5 -5
- package/src/Repository/LocalFromRemote/CommandRepository.js +1 -1
- package/src/Repository/LocalFromRemote/LocalFromRemote.js +18 -17
- package/src/Repository/Memory.js +22 -21
- package/src/Repository/Null.js +5 -5
- package/src/Repository/Offline.js +17 -16
- package/src/Repository/OneBuild.js +34 -28
- package/src/Repository/OneBuild2.js +16 -10
- package/src/Repository/Repository.js +105 -102
- package/src/Schema/Schema.js +9 -6
|
@@ -41,7 +41,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
41
41
|
* Deletes all data in storage medium.
|
|
42
42
|
* @private
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
async _deleteFromStorage() {
|
|
45
45
|
try {
|
|
46
46
|
const ids = await this._getIndex(),
|
|
47
47
|
total = ids.length,
|
|
@@ -80,7 +80,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
80
80
|
* @return {array} data - Array of rawData objects
|
|
81
81
|
* @private
|
|
82
82
|
*/
|
|
83
|
-
|
|
83
|
+
async _loadFromStorage() {
|
|
84
84
|
try {
|
|
85
85
|
|
|
86
86
|
this._index = await this._getIndex();
|
|
@@ -122,7 +122,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
122
122
|
* @return {array} data - Array of rawData objects
|
|
123
123
|
* @private
|
|
124
124
|
*/
|
|
125
|
-
|
|
125
|
+
async _saveToStorage(entities) {
|
|
126
126
|
try {
|
|
127
127
|
let i, entity,
|
|
128
128
|
total = entities.length,
|
|
@@ -197,7 +197,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
197
197
|
* @param {string} id - The id to add.
|
|
198
198
|
* @private
|
|
199
199
|
*/
|
|
200
|
-
|
|
200
|
+
async _addToIndex(id) {
|
|
201
201
|
let index = await this._getIndex();
|
|
202
202
|
index.push(id);
|
|
203
203
|
index = _.uniq(index);
|
|
@@ -266,7 +266,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
266
266
|
* @param {string} id - The id to delete.
|
|
267
267
|
* @private
|
|
268
268
|
*/
|
|
269
|
-
|
|
269
|
+
async _deleteFromIndex(id) {
|
|
270
270
|
let index = await this._getIndex();
|
|
271
271
|
_.pull(index, id);
|
|
272
272
|
await this._setIndex(index);
|
|
@@ -289,7 +289,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
289
289
|
* @fires save
|
|
290
290
|
* @private
|
|
291
291
|
*/
|
|
292
|
-
|
|
292
|
+
async _finalizeSave(results) {
|
|
293
293
|
return Promise.all(results)
|
|
294
294
|
.then(() => {
|
|
295
295
|
this.isSaving = false;
|
|
@@ -309,7 +309,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
309
309
|
* @return {array} index - Array of ids.
|
|
310
310
|
* @private
|
|
311
311
|
*/
|
|
312
|
-
|
|
312
|
+
async _getIndex() {
|
|
313
313
|
// return await this._storageGetValue('index');
|
|
314
314
|
let result = await this._storageGetValue('index');
|
|
315
315
|
if (!result) {
|
|
@@ -325,7 +325,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
325
325
|
* @return {array} index - Array of keys.
|
|
326
326
|
* @private
|
|
327
327
|
*/
|
|
328
|
-
|
|
328
|
+
async _getKeys() {
|
|
329
329
|
if (!this._getAllKeys) {
|
|
330
330
|
this.throwError('Storage medium does not support _getAllKeys');
|
|
331
331
|
return;
|
|
@@ -342,7 +342,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
342
342
|
* @param {array} index - Array of ids.
|
|
343
343
|
* @private
|
|
344
344
|
*/
|
|
345
|
-
|
|
345
|
+
async _setIndex(index) {
|
|
346
346
|
if (!_.isEqual(this._index, index)) {
|
|
347
347
|
this._index = index;
|
|
348
348
|
return await this._storageSetValue('index', index);
|
|
@@ -358,7 +358,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
358
358
|
* @private
|
|
359
359
|
* @abstract
|
|
360
360
|
*/
|
|
361
|
-
|
|
361
|
+
async _storageGetValue(name) {
|
|
362
362
|
this.throwError('this._storageGetValue must be implemented by OfflineRepository subclass.');
|
|
363
363
|
return;
|
|
364
364
|
}
|
|
@@ -370,7 +370,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
370
370
|
* @private
|
|
371
371
|
* @abstract
|
|
372
372
|
*/
|
|
373
|
-
|
|
373
|
+
async _storageSetValue(name, value) {
|
|
374
374
|
this.throwError('this._storageSetValue must be implemented by OfflineRepository subclass.');
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
@@ -381,7 +381,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
381
381
|
* @private
|
|
382
382
|
* @abstract
|
|
383
383
|
*/
|
|
384
|
-
|
|
384
|
+
async _storageDeleteValue(name) {
|
|
385
385
|
this.throwError('this._storageDeleteValue must be implemented by OfflineRepository subclass.');
|
|
386
386
|
return;
|
|
387
387
|
}
|
|
@@ -394,7 +394,8 @@ class OfflineRepository extends MemoryRepository {
|
|
|
394
394
|
*/
|
|
395
395
|
_namespace(name) {
|
|
396
396
|
if (_.isArray(name)) {
|
|
397
|
-
|
|
397
|
+
const oThis = this;
|
|
398
|
+
return _.map(name, (key) => oThis.schema.name + '-' + key);
|
|
398
399
|
}
|
|
399
400
|
return this.schema.name + '-' + name;
|
|
400
401
|
}
|
|
@@ -404,7 +405,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
404
405
|
* (when this is the "local" side of at LocalFromRemoteRepository)
|
|
405
406
|
* @return {moment} lastSync
|
|
406
407
|
*/
|
|
407
|
-
|
|
408
|
+
async getLastSync() {
|
|
408
409
|
const dateStr = await this._storageGetValue(LAST_SYNC);
|
|
409
410
|
if (!_.isNil(dateStr)) {
|
|
410
411
|
const date = moment(dateStr);
|
|
@@ -420,7 +421,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
420
421
|
* Used when this is the "local" side of a LocalFromRemoteRepository
|
|
421
422
|
* @param {date} lastSync
|
|
422
423
|
*/
|
|
423
|
-
|
|
424
|
+
async setLastSync(date) {
|
|
424
425
|
await this._storageSetValue(LAST_SYNC, date);
|
|
425
426
|
}
|
|
426
427
|
|
|
@@ -429,7 +430,7 @@ class OfflineRepository extends MemoryRepository {
|
|
|
429
430
|
* Clears the date when this Repository was last synced with remote.
|
|
430
431
|
* Used when this is the "local" side of a LocalFromRemoteRepository
|
|
431
432
|
*/
|
|
432
|
-
|
|
433
|
+
async clearLastSync() {
|
|
433
434
|
await this._storageDeleteValue(LAST_SYNC);
|
|
434
435
|
}
|
|
435
436
|
|
|
@@ -93,7 +93,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
93
93
|
* Fires off axios request to server
|
|
94
94
|
* @private
|
|
95
95
|
*/
|
|
96
|
-
_send
|
|
96
|
+
_send(method, url, data) {
|
|
97
97
|
|
|
98
98
|
if (!url) {
|
|
99
99
|
this.throwError('No url submitted');
|
|
@@ -161,7 +161,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
161
161
|
* OneBuild uses a single, multi-dimentional param for filtering.
|
|
162
162
|
* Refreshes entities.
|
|
163
163
|
*/
|
|
164
|
-
_onChangeFilters
|
|
164
|
+
_onChangeFilters() {
|
|
165
165
|
// Clear existing "conditions" params
|
|
166
166
|
if (!_.isEmpty(this._params)) {
|
|
167
167
|
this._params = _.omitBy(this._params, (value, key) => {
|
|
@@ -169,11 +169,12 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
const oThis = this;
|
|
172
173
|
_.each(this.filters, (filter, ix) => {
|
|
173
174
|
if (_.includes(nonConditionFilters, filter.name)) {
|
|
174
|
-
|
|
175
|
+
oThis.setParam(filter.name, filter.value);
|
|
175
176
|
} else {
|
|
176
|
-
|
|
177
|
+
oThis.setParam('conditions[' + filter.name + ']', filter.value);
|
|
177
178
|
}
|
|
178
179
|
});
|
|
179
180
|
|
|
@@ -191,7 +192,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
191
192
|
* OneBuild uses a single order param, rather than separate name & direction params.
|
|
192
193
|
* Refreshes entities.
|
|
193
194
|
*/
|
|
194
|
-
_onChangeSorters
|
|
195
|
+
_onChangeSorters() {
|
|
195
196
|
let sorterStrings = [];
|
|
196
197
|
_.each(this.sorters, (sorter) => {
|
|
197
198
|
sorterStrings.push(sorter.name + ' ' + sorter.direction);
|
|
@@ -225,7 +226,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
225
226
|
* @fires error
|
|
226
227
|
* @private
|
|
227
228
|
*/
|
|
228
|
-
_processServerResponse
|
|
229
|
+
_processServerResponse(result) {
|
|
229
230
|
|
|
230
231
|
if (result === false) { // e.g. 401 error
|
|
231
232
|
return {
|
|
@@ -267,7 +268,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
267
268
|
* @param {string} dropPosition - position in which it was dropped; could be 'before' or 'after'
|
|
268
269
|
* @return {Promise}
|
|
269
270
|
*/
|
|
270
|
-
reorder
|
|
271
|
+
reorder(dragRecordOrIds, dropRecord, dropPosition) {
|
|
271
272
|
|
|
272
273
|
if (!this.isOnline) {
|
|
273
274
|
this.throwError('Offline');
|
|
@@ -316,7 +317,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
316
317
|
});
|
|
317
318
|
}
|
|
318
319
|
|
|
319
|
-
|
|
320
|
+
async remoteDuplicate(entity) {
|
|
320
321
|
|
|
321
322
|
this.markLoading();
|
|
322
323
|
|
|
@@ -358,7 +359,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
358
359
|
return duplicateEntity;
|
|
359
360
|
}
|
|
360
361
|
|
|
361
|
-
|
|
362
|
+
async loadOneAdditionalEntity(id) {
|
|
362
363
|
const entity = await this.getSingleEntityFromServer(id);
|
|
363
364
|
if (!entity) {
|
|
364
365
|
this.throwError('entity not found');
|
|
@@ -372,7 +373,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
372
373
|
this.emit('changeData', this.entities);
|
|
373
374
|
}
|
|
374
375
|
|
|
375
|
-
|
|
376
|
+
async getSingleEntityFromServer(id) {
|
|
376
377
|
if (this.isDestroyed) {
|
|
377
378
|
this.throwError('this.getSingleEntityFromServer is no longer valid. Repository has been destroyed.');
|
|
378
379
|
return;
|
|
@@ -438,7 +439,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
438
439
|
* - password,
|
|
439
440
|
* @return {Promise}
|
|
440
441
|
*/
|
|
441
|
-
login
|
|
442
|
+
login(creds) {
|
|
442
443
|
|
|
443
444
|
if (!this.isOnline) {
|
|
444
445
|
this.throwError('Offline');
|
|
@@ -477,7 +478,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
477
478
|
* Logout from OneBuild API
|
|
478
479
|
* @return {Promise}
|
|
479
480
|
*/
|
|
480
|
-
logout
|
|
481
|
+
logout() {
|
|
481
482
|
|
|
482
483
|
if (!this.isOnline) {
|
|
483
484
|
this.throwError('Offline');
|
|
@@ -513,7 +514,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
513
514
|
});
|
|
514
515
|
}
|
|
515
516
|
|
|
516
|
-
forgotPassword
|
|
517
|
+
forgotPassword(email = null, username = null) {
|
|
517
518
|
|
|
518
519
|
if (!this.isOnline) {
|
|
519
520
|
this.throwError('Offline');
|
|
@@ -560,7 +561,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
560
561
|
/**
|
|
561
562
|
* Loads the root nodes of this tree.
|
|
562
563
|
*/
|
|
563
|
-
loadRootNodes
|
|
564
|
+
loadRootNodes(depth) {
|
|
564
565
|
this.ensureTree();
|
|
565
566
|
if (this.isDestroyed) {
|
|
566
567
|
this.throwError('this.setRootNode is no longer valid. Repository has been destroyed.');
|
|
@@ -607,9 +608,10 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
607
608
|
this._destroyEntities();
|
|
608
609
|
|
|
609
610
|
// Set the current entities
|
|
611
|
+
const oThis = this;
|
|
610
612
|
this.entities = _.map(root, (data) => {
|
|
611
|
-
const entity = Repository._createEntity(
|
|
612
|
-
|
|
613
|
+
const entity = Repository._createEntity(oThis.schema, data, this, true);
|
|
614
|
+
oThis._relayEntityEvents(entity);
|
|
613
615
|
return entity;
|
|
614
616
|
});
|
|
615
617
|
|
|
@@ -639,7 +641,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
639
641
|
/**
|
|
640
642
|
* Loads (or reloads) the supplied treeNode
|
|
641
643
|
*/
|
|
642
|
-
loadNode
|
|
644
|
+
loadNode(treeNode, depth = 1) {
|
|
643
645
|
this.ensureTree();
|
|
644
646
|
if (this.isDestroyed) {
|
|
645
647
|
this.throwError('this.loadNode is no longer valid. Repository has been destroyed.');
|
|
@@ -656,8 +658,9 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
656
658
|
const children = treeNode.children;
|
|
657
659
|
treeNode.children = [];
|
|
658
660
|
|
|
661
|
+
const oThis = this;
|
|
659
662
|
_.each(children, (child) => {
|
|
660
|
-
|
|
663
|
+
oThis.removeEntity(child);
|
|
661
664
|
});
|
|
662
665
|
}
|
|
663
666
|
|
|
@@ -694,9 +697,10 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
694
697
|
}
|
|
695
698
|
|
|
696
699
|
// Set the current entities
|
|
700
|
+
const oThis = this;
|
|
697
701
|
const children = _.map(root, (data) => {
|
|
698
|
-
const entity = Repository._createEntity(
|
|
699
|
-
|
|
702
|
+
const entity = Repository._createEntity(oThis.schema, data, this, true);
|
|
703
|
+
oThis._relayEntityEvents(entity);
|
|
700
704
|
return entity;
|
|
701
705
|
});
|
|
702
706
|
|
|
@@ -720,7 +724,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
720
724
|
/**
|
|
721
725
|
* Loads (or reloads) the children of the supplied treeNode
|
|
722
726
|
*/
|
|
723
|
-
loadChildNodes
|
|
727
|
+
loadChildNodes(treeNode, depth = 1) {
|
|
724
728
|
this.ensureTree();
|
|
725
729
|
if (this.isDestroyed) {
|
|
726
730
|
this.throwError('this.loadChildNodes is no longer valid. Repository has been destroyed.');
|
|
@@ -737,8 +741,9 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
737
741
|
const children = treeNode.children;
|
|
738
742
|
treeNode.children = [];
|
|
739
743
|
|
|
744
|
+
const oThis = this;
|
|
740
745
|
_.each(children, (child) => {
|
|
741
|
-
|
|
746
|
+
oThis.removeEntity(child);
|
|
742
747
|
});
|
|
743
748
|
}
|
|
744
749
|
|
|
@@ -775,9 +780,10 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
775
780
|
}
|
|
776
781
|
|
|
777
782
|
// Set the current entities
|
|
783
|
+
const oThis = this;
|
|
778
784
|
const children = _.map(root, (data) => {
|
|
779
|
-
const entity = Repository._createEntity(
|
|
780
|
-
|
|
785
|
+
const entity = Repository._createEntity(oThis.schema, data, this, true);
|
|
786
|
+
oThis._relayEntityEvents(entity);
|
|
781
787
|
return entity;
|
|
782
788
|
});
|
|
783
789
|
|
|
@@ -801,7 +807,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
801
807
|
/**
|
|
802
808
|
* Override the AjaxRepository to we can reload a treeNode if needed
|
|
803
809
|
*/
|
|
804
|
-
reloadEntity
|
|
810
|
+
reloadEntity(entity, callback = null) {
|
|
805
811
|
if (!entity.isTree) {
|
|
806
812
|
return super.reloadEntity(entity, callback);
|
|
807
813
|
}
|
|
@@ -813,7 +819,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
813
819
|
* Searches all nodes for the supplied text.
|
|
814
820
|
* This basically takes the search query and returns whatever the server sends
|
|
815
821
|
*/
|
|
816
|
-
searchNodes
|
|
822
|
+
searchNodes(q) {
|
|
817
823
|
this.ensureTree();
|
|
818
824
|
if (this.isDestroyed) {
|
|
819
825
|
this.throwError('this.searchNodes is no longer valid. Repository has been destroyed.');
|
|
@@ -864,7 +870,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
864
870
|
/**
|
|
865
871
|
* Alias for loadChildren
|
|
866
872
|
*/
|
|
867
|
-
reloadChildren
|
|
873
|
+
reloadChildren(treeNode, depth) {
|
|
868
874
|
return this.loadChildren(treeNode, depth);
|
|
869
875
|
}
|
|
870
876
|
|
|
@@ -872,7 +878,7 @@ class OneBuildRepository extends AjaxRepository {
|
|
|
872
878
|
* Moves the supplied treeNode to a new position on the tree
|
|
873
879
|
* @returns id of common ancestor node
|
|
874
880
|
*/
|
|
875
|
-
moveTreeNode
|
|
881
|
+
moveTreeNode(treeNode, newParentId) {
|
|
876
882
|
this.ensureTree();
|
|
877
883
|
if (this.isDestroyed) {
|
|
878
884
|
this.throwError('this.moveTreeNode is no longer valid. Repository has been destroyed.');
|
|
@@ -169,11 +169,12 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
const oThis = this;
|
|
172
173
|
_.each(this.filters, (filter, ix) => {
|
|
173
174
|
if (_.includes(nonConditionFilters, filter.name)) {
|
|
174
|
-
|
|
175
|
+
oThis.setParam(filter.name, filter.value);
|
|
175
176
|
} else {
|
|
176
|
-
|
|
177
|
+
oThis.setParam('conditions[' + filter.name + ']', filter.value);
|
|
177
178
|
}
|
|
178
179
|
});
|
|
179
180
|
|
|
@@ -607,9 +608,10 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
607
608
|
this._destroyEntities();
|
|
608
609
|
|
|
609
610
|
// Set the current entities
|
|
611
|
+
const oThis = this;
|
|
610
612
|
this.entities = _.map(root, (data) => {
|
|
611
|
-
const entity = Repository._createEntity(
|
|
612
|
-
|
|
613
|
+
const entity = Repository._createEntity(oThis.schema, data, this, true);
|
|
614
|
+
oThis._relayEntityEvents(entity);
|
|
613
615
|
return entity;
|
|
614
616
|
});
|
|
615
617
|
|
|
@@ -656,8 +658,9 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
656
658
|
const children = treeNode.children;
|
|
657
659
|
treeNode.children = [];
|
|
658
660
|
|
|
661
|
+
const oThis = this;
|
|
659
662
|
_.each(children, (child) => {
|
|
660
|
-
|
|
663
|
+
oThis.removeEntity(child);
|
|
661
664
|
});
|
|
662
665
|
}
|
|
663
666
|
|
|
@@ -694,9 +697,10 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
694
697
|
}
|
|
695
698
|
|
|
696
699
|
// Set the current entities
|
|
700
|
+
const oThis = this;
|
|
697
701
|
const children = _.map(root, (data) => {
|
|
698
|
-
const entity = Repository._createEntity(
|
|
699
|
-
|
|
702
|
+
const entity = Repository._createEntity(oThis.schema, data, this, true);
|
|
703
|
+
oThis._relayEntityEvents(entity);
|
|
700
704
|
return entity;
|
|
701
705
|
});
|
|
702
706
|
|
|
@@ -737,8 +741,9 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
737
741
|
const children = treeNode.children;
|
|
738
742
|
treeNode.children = [];
|
|
739
743
|
|
|
744
|
+
const oThis = this;
|
|
740
745
|
_.each(children, (child) => {
|
|
741
|
-
|
|
746
|
+
oThis.removeEntity(child);
|
|
742
747
|
});
|
|
743
748
|
}
|
|
744
749
|
|
|
@@ -775,9 +780,10 @@ class OneBuild2Repository extends AjaxRepository {
|
|
|
775
780
|
}
|
|
776
781
|
|
|
777
782
|
// Set the current entities
|
|
783
|
+
const oThis = this;
|
|
778
784
|
const children = _.map(root, (data) => {
|
|
779
|
-
const entity = Repository._createEntity(
|
|
780
|
-
|
|
785
|
+
const entity = Repository._createEntity(oThis.schema, data, this, true);
|
|
786
|
+
oThis._relayEntityEvents(entity);
|
|
781
787
|
return entity;
|
|
782
788
|
});
|
|
783
789
|
|