@trudb/tru-common-lib 0.2.507 → 0.2.508
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.
|
@@ -4843,7 +4843,7 @@ class TruDetailViewBase {
|
|
|
4843
4843
|
onAddEntity = (newEntity, dataNotification = false) => {
|
|
4844
4844
|
if (!newEntity)
|
|
4845
4845
|
newEntity = this.dataContext.entityAccess().add(this.entityType);
|
|
4846
|
-
if (this.view.parentTableRefName)
|
|
4846
|
+
if (!dataNotification && this.view.parentTableRefName)
|
|
4847
4847
|
newEntity[this.view.parentTableRefName] = this.entity[this.view.parentTableRefName];
|
|
4848
4848
|
if (!dataNotification) {
|
|
4849
4849
|
this.entities.unshift(newEntity);
|
|
@@ -8178,14 +8178,7 @@ class TruDataChangeParser {
|
|
|
8178
8178
|
dataChanged(change) {
|
|
8179
8179
|
this.dataChanged$.next(change);
|
|
8180
8180
|
}
|
|
8181
|
-
|
|
8182
|
-
this.dataContext = null;
|
|
8183
|
-
this.entity = null;
|
|
8184
|
-
this.tableName = null;
|
|
8185
|
-
this.addEntity = null;
|
|
8186
|
-
this.getLatestResults = null;
|
|
8187
|
-
}
|
|
8188
|
-
constructor(connection, appEnviroment, user, dataContext, globalDataContext, entity, tableName, addEntity, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded, modelTypeLookup, modelPropertyLookup, destroyParser = null) {
|
|
8181
|
+
constructor(connection, appEnviroment, user, dataContext, globalDataContext, entity, tableName, addEntity, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded, modelTypeLookup, modelPropertyLookup) {
|
|
8189
8182
|
this.appEnvionment = appEnviroment;
|
|
8190
8183
|
this.user = user;
|
|
8191
8184
|
this.dataContext = dataContext;
|
|
@@ -8203,11 +8196,10 @@ class TruDataChangeParser {
|
|
|
8203
8196
|
connection.on("change", (payload) => {
|
|
8204
8197
|
this.update(payload);
|
|
8205
8198
|
});
|
|
8206
|
-
destroyParser = this.destroy;
|
|
8207
8199
|
}
|
|
8208
8200
|
findEntityInCache = (change) => {
|
|
8209
|
-
var entityAccessor = this.dataContext
|
|
8210
|
-
return entityAccessor
|
|
8201
|
+
var entityAccessor = this.dataContext.entityAccess();
|
|
8202
|
+
return entityAccessor.searchByRefCacheOnly(this.types.getType(change.tableName), parseInt(change.tableRef, 10), true);
|
|
8211
8203
|
};
|
|
8212
8204
|
findEntityInGlobalCache = (change) => {
|
|
8213
8205
|
var entityAccessor = this.globalDataContext.entityAccess();
|
|
@@ -8283,17 +8275,17 @@ class TruDataChangeParser {
|
|
|
8283
8275
|
});
|
|
8284
8276
|
};
|
|
8285
8277
|
entityFoundByQuery = (change) => {
|
|
8286
|
-
|
|
8287
|
-
|
|
8278
|
+
var entityAccessor = this.dataContext.entityAccess();
|
|
8279
|
+
var entities = entityAccessor.searchByRefArrayCacheOnly(this.entity, this.getLatestQuery(), [change.tableRef]);
|
|
8288
8280
|
if (!entities?.length) {
|
|
8289
|
-
|
|
8281
|
+
var entityAccessor = this.globalDataContext.entityAccess();
|
|
8290
8282
|
entities = entityAccessor.searchByRefArrayCacheOnly(this.entity, this.getLatestQuery(), [change.tableRef]);
|
|
8291
8283
|
}
|
|
8292
8284
|
return entities === null ? 0 : entities.length;
|
|
8293
8285
|
};
|
|
8294
8286
|
getEntityFromServer = (change) => {
|
|
8295
|
-
var entityAccessor = this.dataContext
|
|
8296
|
-
var entitiy = entityAccessor
|
|
8287
|
+
var entityAccessor = this.dataContext.entityAccess();
|
|
8288
|
+
var entitiy = entityAccessor.searchByRefWithQuery(this.entity, this.getLatestQuery(), change.tableRef);
|
|
8297
8289
|
return entitiy;
|
|
8298
8290
|
};
|
|
8299
8291
|
getEntityFromResults = (results, change) => {
|
|
@@ -8378,7 +8370,7 @@ class TruDataChangeParser {
|
|
|
8378
8370
|
}
|
|
8379
8371
|
}
|
|
8380
8372
|
else if (!globalEntity) {
|
|
8381
|
-
|
|
8373
|
+
var newEntity = this.globalDataContext.entityAccess().add(this.entity, this.contextFilters);
|
|
8382
8374
|
const pkeyName = change.tableName + 'Ref';
|
|
8383
8375
|
newEntity[pkeyName] = change.tableRef;
|
|
8384
8376
|
this.applyPropertyChanges(change, newEntity);
|
|
@@ -8449,7 +8441,6 @@ class TruConnectionHub {
|
|
|
8449
8441
|
modelTypeLookup;
|
|
8450
8442
|
modelPropertyLookup;
|
|
8451
8443
|
connection;
|
|
8452
|
-
parser;
|
|
8453
8444
|
constructor(dataContext, appEnvironment, user, modelTypeLookup, modelPropertyLookup) {
|
|
8454
8445
|
this.dataContext = dataContext;
|
|
8455
8446
|
this.appEnvironment = appEnvironment;
|
|
@@ -8486,9 +8477,8 @@ class TruConnectionHub {
|
|
|
8486
8477
|
});
|
|
8487
8478
|
this.connect();
|
|
8488
8479
|
};
|
|
8489
|
-
subscribe = (dataContext, entity, tableName, addEntity, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded
|
|
8490
|
-
|
|
8491
|
-
return this.parser.onDataChanged();
|
|
8480
|
+
subscribe = (dataContext, entity, tableName, addEntity, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded) => {
|
|
8481
|
+
return new TruDataChangeParser(this.connection, this.appEnvironment, this.user, dataContext, this.appEnvironment.globalDataContext, entity, tableName, addEntity, getLatestResults, getLatestQuery, contextFilters, expandPaths, isLoaded, this.modelTypeLookup, this.modelPropertyLookup).onDataChanged();
|
|
8492
8482
|
};
|
|
8493
8483
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruConnectionHub, deps: [{ token: TruDataContext }, { token: TruAppEnvironment }, { token: TruUser }, { token: TruModelTypeLookup }, { token: TruModelPropertyLookup }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8494
8484
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruConnectionHub, providedIn: 'root' });
|