@trudb/tru-common-lib 0.0.365 → 0.0.366
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/esm2020/lib/components/login/services/tru-auth.mjs +2 -1
- package/esm2020/lib/services/tru-breeze-context-factory.mjs +8 -5
- package/fesm2015/trudb-tru-common-lib.mjs +72 -69
- package/fesm2015/trudb-tru-common-lib.mjs.map +1 -1
- package/fesm2020/trudb-tru-common-lib.mjs +72 -69
- package/fesm2020/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/services/tru-breeze-context-factory.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1013,75 +1013,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
1013
1013
|
}]
|
|
1014
1014
|
}], ctorParameters: function () { return []; } });
|
|
1015
1015
|
|
|
1016
|
-
class TruBreezeContextFactory {
|
|
1017
|
-
constructor(breezeMetadataProvider) {
|
|
1018
|
-
this.breezeMetadataProvider = breezeMetadataProvider;
|
|
1019
|
-
/**
|
|
1020
|
-
* Maximum number of records to return from a query.
|
|
1021
|
-
* @return {number}
|
|
1022
|
-
*/
|
|
1023
|
-
this.servicePath = window.location.hostname === 'localhost' ? 'https://localhost:44303/api/TruDB' : '/api/TruDB';
|
|
1024
|
-
this.metadataStore = new MetadataStore();
|
|
1025
|
-
/**
|
|
1026
|
-
* Note: hasServerMetadata is false to prevent the automatic query of the metadata from the server.
|
|
1027
|
-
*/
|
|
1028
|
-
this.breezeDataService = new DataService({
|
|
1029
|
-
serviceName: this.servicePath,
|
|
1030
|
-
hasServerMetadata: false
|
|
1031
|
-
});
|
|
1032
|
-
this.setUpMetadata = (metadata) => {
|
|
1033
|
-
if (this.metadataStore.isEmpty())
|
|
1034
|
-
return this.metadataStore.importMetadata(metadata);
|
|
1035
|
-
return this.metadataStore;
|
|
1036
|
-
};
|
|
1037
|
-
/**
|
|
1038
|
-
* Returns a new data context object.
|
|
1039
|
-
* @return {object} - Breeze Manager
|
|
1040
|
-
*/
|
|
1041
|
-
this.createContext = (tableName = null) => {
|
|
1042
|
-
let entityManager = new EntityManager({
|
|
1043
|
-
dataService: this.breezeDataService,
|
|
1044
|
-
metadataStore: this.metadataStore
|
|
1045
|
-
});
|
|
1046
|
-
let breezeContext = new TruBreezeContext(entityManager);
|
|
1047
|
-
/**
|
|
1048
|
-
* Cache the active user's user record since it is required to be in the cache
|
|
1049
|
-
* for some situations such as when create new record and the view displays the
|
|
1050
|
-
* created user audit property. If it fails, the next context will try again.
|
|
1051
|
-
* Of course, the already existing context(s) won't have the record cached, but
|
|
1052
|
-
* it's a rather unlikely situation and it's non-fatal, so just let it fail.
|
|
1053
|
-
*/
|
|
1054
|
-
var activeUserRecordExport;
|
|
1055
|
-
if (activeUserRecordExport) {
|
|
1056
|
-
entityManager.importEntities(activeUserRecordExport);
|
|
1057
|
-
}
|
|
1058
|
-
return breezeContext;
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
TruBreezeContextFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruBreezeContextFactory, deps: [{ token: TruBreezeMetadataProvider }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1063
|
-
TruBreezeContextFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruBreezeContextFactory, providedIn: 'root' });
|
|
1064
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruBreezeContextFactory, decorators: [{
|
|
1065
|
-
type: Injectable,
|
|
1066
|
-
args: [{
|
|
1067
|
-
providedIn: 'root',
|
|
1068
|
-
}]
|
|
1069
|
-
}], ctorParameters: function () { return [{ type: TruBreezeMetadataProvider }]; } });
|
|
1070
|
-
class TruBreezeContext {
|
|
1071
|
-
constructor(manager) {
|
|
1072
|
-
this.manager = manager;
|
|
1073
|
-
this._entityManager = manager;
|
|
1074
|
-
}
|
|
1075
|
-
get createQuery() {
|
|
1076
|
-
return (x) => { return new EntityQuery(x); };
|
|
1077
|
-
}
|
|
1078
|
-
;
|
|
1079
|
-
get entityManager() {
|
|
1080
|
-
return this._entityManager;
|
|
1081
|
-
}
|
|
1082
|
-
;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
1016
|
class TruAppEnvironment {
|
|
1086
1017
|
constructor() {
|
|
1087
1018
|
this._activeUserRef = new BehaviorSubject(3);
|
|
@@ -1161,6 +1092,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
1161
1092
|
type: Injectable
|
|
1162
1093
|
}], ctorParameters: function () { return []; } });
|
|
1163
1094
|
|
|
1095
|
+
class TruBreezeContextFactory {
|
|
1096
|
+
constructor(breezeMetadataProvider, environment) {
|
|
1097
|
+
this.breezeMetadataProvider = breezeMetadataProvider;
|
|
1098
|
+
this.environment = environment;
|
|
1099
|
+
/**
|
|
1100
|
+
* Maximum number of records to return from a query.
|
|
1101
|
+
* @return {number}
|
|
1102
|
+
*/
|
|
1103
|
+
this.servicePath = '';
|
|
1104
|
+
this.metadataStore = new MetadataStore();
|
|
1105
|
+
/**
|
|
1106
|
+
* Note: hasServerMetadata is false to prevent the automatic query of the metadata from the server.
|
|
1107
|
+
*/
|
|
1108
|
+
this.breezeDataService = new DataService({
|
|
1109
|
+
serviceName: this.servicePath,
|
|
1110
|
+
hasServerMetadata: false
|
|
1111
|
+
});
|
|
1112
|
+
this.setUpMetadata = (metadata) => {
|
|
1113
|
+
if (this.metadataStore.isEmpty())
|
|
1114
|
+
return this.metadataStore.importMetadata(metadata);
|
|
1115
|
+
return this.metadataStore;
|
|
1116
|
+
};
|
|
1117
|
+
/**
|
|
1118
|
+
* Returns a new data context object.
|
|
1119
|
+
* @return {object} - Breeze Manager
|
|
1120
|
+
*/
|
|
1121
|
+
this.createContext = (tableName = null) => {
|
|
1122
|
+
let entityManager = new EntityManager({
|
|
1123
|
+
dataService: this.breezeDataService,
|
|
1124
|
+
metadataStore: this.metadataStore
|
|
1125
|
+
});
|
|
1126
|
+
let breezeContext = new TruBreezeContext(entityManager);
|
|
1127
|
+
/**
|
|
1128
|
+
* Cache the active user's user record since it is required to be in the cache
|
|
1129
|
+
* for some situations such as when create new record and the view displays the
|
|
1130
|
+
* created user audit property. If it fails, the next context will try again.
|
|
1131
|
+
* Of course, the already existing context(s) won't have the record cached, but
|
|
1132
|
+
* it's a rather unlikely situation and it's non-fatal, so just let it fail.
|
|
1133
|
+
*/
|
|
1134
|
+
var activeUserRecordExport;
|
|
1135
|
+
if (activeUserRecordExport) {
|
|
1136
|
+
entityManager.importEntities(activeUserRecordExport);
|
|
1137
|
+
}
|
|
1138
|
+
return breezeContext;
|
|
1139
|
+
};
|
|
1140
|
+
this.servicePath = environment.appUri + '/api/TruDB';
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
TruBreezeContextFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruBreezeContextFactory, deps: [{ token: TruBreezeMetadataProvider }, { token: TruAppEnvironment }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1144
|
+
TruBreezeContextFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruBreezeContextFactory, providedIn: 'root' });
|
|
1145
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruBreezeContextFactory, decorators: [{
|
|
1146
|
+
type: Injectable,
|
|
1147
|
+
args: [{
|
|
1148
|
+
providedIn: 'root',
|
|
1149
|
+
}]
|
|
1150
|
+
}], ctorParameters: function () { return [{ type: TruBreezeMetadataProvider }, { type: TruAppEnvironment }]; } });
|
|
1151
|
+
class TruBreezeContext {
|
|
1152
|
+
constructor(manager) {
|
|
1153
|
+
this.manager = manager;
|
|
1154
|
+
this._entityManager = manager;
|
|
1155
|
+
}
|
|
1156
|
+
get createQuery() {
|
|
1157
|
+
return (x) => { return new EntityQuery(x); };
|
|
1158
|
+
}
|
|
1159
|
+
;
|
|
1160
|
+
get entityManager() {
|
|
1161
|
+
return this._entityManager;
|
|
1162
|
+
}
|
|
1163
|
+
;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1164
1166
|
class TruExportDialog {
|
|
1165
1167
|
constructor(dialogRef, data) {
|
|
1166
1168
|
this.dialogRef = dialogRef;
|
|
@@ -4527,6 +4529,7 @@ class TruAuth {
|
|
|
4527
4529
|
this.auth = auth;
|
|
4528
4530
|
this.loggedIn = new BehaviorSubject(false);
|
|
4529
4531
|
this.baseUrl = '';
|
|
4532
|
+
this.baseUrl = this.environment.appUri;
|
|
4530
4533
|
}
|
|
4531
4534
|
login(loginRequest) {
|
|
4532
4535
|
return this.http
|