@trudb/tru-common-lib 0.4.1 → 0.4.2
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.
|
@@ -5,7 +5,7 @@ import * as i1$1 from '@angular/common';
|
|
|
5
5
|
import { CommonModule, DatePipe, NgIf, NgClass } from '@angular/common';
|
|
6
6
|
import * as i8 from '@angular/forms';
|
|
7
7
|
import { FormsModule, FormControl, ReactiveFormsModule, FormGroup, Validators } from '@angular/forms';
|
|
8
|
-
import { BehaviorSubject, merge, defer, from, of, Subject, Observable, fromEvent, Subscription, interval, skip, forkJoin, first,
|
|
8
|
+
import { BehaviorSubject, merge, defer, from, of, Subject, Observable, fromEvent, Subscription, interval, skip, forkJoin, first, throwError, finalize } from 'rxjs';
|
|
9
9
|
import * as _ from 'underscore';
|
|
10
10
|
import ___default from 'underscore';
|
|
11
11
|
import * as i1$2 from '@angular/common/http';
|
|
@@ -10282,9 +10282,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
10282
10282
|
|
|
10283
10283
|
class TruDesktopMenubar {
|
|
10284
10284
|
contextFilters;
|
|
10285
|
+
appEnvironment;
|
|
10285
10286
|
desktopCtrl;
|
|
10286
|
-
constructor(contextFilters) {
|
|
10287
|
+
constructor(contextFilters, appEnvironment) {
|
|
10287
10288
|
this.contextFilters = contextFilters;
|
|
10289
|
+
this.appEnvironment = appEnvironment;
|
|
10290
|
+
}
|
|
10291
|
+
get environmentWarning() {
|
|
10292
|
+
return this.appEnvironment.environmentWarning?.trim() ?? '';
|
|
10288
10293
|
}
|
|
10289
10294
|
options = null;
|
|
10290
10295
|
configs = null;
|
|
@@ -10297,8 +10302,8 @@ class TruDesktopMenubar {
|
|
|
10297
10302
|
this.configs = this.options.menubarConfig;
|
|
10298
10303
|
this.filters = this.contextFilters.filters;
|
|
10299
10304
|
}
|
|
10300
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TruDesktopMenubar, deps: [{ token: TruContextFilters }], target: i0.ɵɵFactoryTarget.Component });
|
|
10301
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: TruDesktopMenubar, isStandalone: true, selector: "tru-desktop-menubar", inputs: { desktopCtrl: "desktopCtrl" }, ngImport: i0, template: "<div class=\"desktop-main-menu\">\r\n <tru-toolbar>\r\n <tru-toolbar-menu *ngFor=\"let config of configs\" [config]=\"config\"></tru-toolbar-menu>\r\n <tru-toolbar-separator *ngIf=\"filters.length\"></tru-toolbar-separator>\r\n <tru-toolbar-context-filter></tru-toolbar-context-filter>\r\n </tru-toolbar>\r\n <tru-toolbar>\r\n <tru-toolbar-app-customization></tru-toolbar-app-customization>\r\n <tru-toolbar-user-profile></tru-toolbar-user-profile>\r\n </tru-toolbar>\r\n</div>\r\n", styles: [".desktop-main-menu
|
|
10305
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TruDesktopMenubar, deps: [{ token: TruContextFilters }, { token: TruAppEnvironment }], target: i0.ɵɵFactoryTarget.Component });
|
|
10306
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.7", type: TruDesktopMenubar, isStandalone: true, selector: "tru-desktop-menubar", inputs: { desktopCtrl: "desktopCtrl" }, ngImport: i0, template: "<div class=\"desktop-main-menu\">\r\n <tru-toolbar>\r\n <tru-toolbar-menu *ngFor=\"let config of configs\" [config]=\"config\"></tru-toolbar-menu>\r\n <tru-toolbar-separator *ngIf=\"filters.length\"></tru-toolbar-separator>\r\n <tru-toolbar-context-filter></tru-toolbar-context-filter>\r\n </tru-toolbar>\r\n <span class=\"desktop-environment-warning\" *ngIf=\"environmentWarning\" [title]=\"environmentWarning\">{{environmentWarning}}</span>\r\n <tru-toolbar>\r\n <tru-toolbar-app-customization></tru-toolbar-app-customization>\r\n <tru-toolbar-user-profile></tru-toolbar-user-profile>\r\n </tru-toolbar>\r\n</div>\r\n", styles: [".desktop-main-menu{display:flex;align-items:center}.desktop-main-menu>tru-toolbar{flex:none}.desktop-main-menu>tru-toolbar:last-child{margin-left:auto}.desktop-environment-warning{flex:1;min-width:0;color:red;font-size:20px;font-weight:700;line-height:1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: TruToolbar, selector: "tru-toolbar", inputs: ["config"] }, { kind: "component", type: TruToolbarMenu, selector: "tru-toolbar-menu", inputs: ["config"] }, { kind: "component", type: TruToolbarSeparator, selector: "tru-toolbar-separator" }, { kind: "component", type: TruToolbarContextFilter, selector: "tru-toolbar-context-filter" }, { kind: "component", type: TruToolbarUserProfile, selector: "tru-toolbar-user-profile" }, { kind: "component", type: TruToolbarAppCustomization, selector: "tru-toolbar-app-customization" }], changeDetection: i0.ChangeDetectionStrategy.Eager, encapsulation: i0.ViewEncapsulation.None });
|
|
10302
10307
|
}
|
|
10303
10308
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TruDesktopMenubar, decorators: [{
|
|
10304
10309
|
type: Component,
|
|
@@ -10315,8 +10320,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
10315
10320
|
TruToolbarContextFilter,
|
|
10316
10321
|
TruToolbarUserProfile,
|
|
10317
10322
|
TruToolbarAppCustomization,
|
|
10318
|
-
], changeDetection: ChangeDetectionStrategy.Eager, encapsulation: ViewEncapsulation.None, template: "<div class=\"desktop-main-menu\">\r\n <tru-toolbar>\r\n <tru-toolbar-menu *ngFor=\"let config of configs\" [config]=\"config\"></tru-toolbar-menu>\r\n <tru-toolbar-separator *ngIf=\"filters.length\"></tru-toolbar-separator>\r\n <tru-toolbar-context-filter></tru-toolbar-context-filter>\r\n </tru-toolbar>\r\n <tru-toolbar>\r\n <tru-toolbar-app-customization></tru-toolbar-app-customization>\r\n <tru-toolbar-user-profile></tru-toolbar-user-profile>\r\n </tru-toolbar>\r\n</div>\r\n", styles: [".desktop-main-menu
|
|
10319
|
-
}], ctorParameters: () => [{ type: TruContextFilters }], propDecorators: { desktopCtrl: [{
|
|
10323
|
+
], changeDetection: ChangeDetectionStrategy.Eager, encapsulation: ViewEncapsulation.None, template: "<div class=\"desktop-main-menu\">\r\n <tru-toolbar>\r\n <tru-toolbar-menu *ngFor=\"let config of configs\" [config]=\"config\"></tru-toolbar-menu>\r\n <tru-toolbar-separator *ngIf=\"filters.length\"></tru-toolbar-separator>\r\n <tru-toolbar-context-filter></tru-toolbar-context-filter>\r\n </tru-toolbar>\r\n <span class=\"desktop-environment-warning\" *ngIf=\"environmentWarning\" [title]=\"environmentWarning\">{{environmentWarning}}</span>\r\n <tru-toolbar>\r\n <tru-toolbar-app-customization></tru-toolbar-app-customization>\r\n <tru-toolbar-user-profile></tru-toolbar-user-profile>\r\n </tru-toolbar>\r\n</div>\r\n", styles: [".desktop-main-menu{display:flex;align-items:center}.desktop-main-menu>tru-toolbar{flex:none}.desktop-main-menu>tru-toolbar:last-child{margin-left:auto}.desktop-environment-warning{flex:1;min-width:0;color:red;font-size:20px;font-weight:700;line-height:1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n"] }]
|
|
10324
|
+
}], ctorParameters: () => [{ type: TruContextFilters }, { type: TruAppEnvironment }], propDecorators: { desktopCtrl: [{
|
|
10320
10325
|
type: Input
|
|
10321
10326
|
}] } });
|
|
10322
10327
|
|
|
@@ -12563,40 +12568,75 @@ class TruErrorDialogConfig {
|
|
|
12563
12568
|
}
|
|
12564
12569
|
|
|
12565
12570
|
class TruServerError {
|
|
12566
|
-
id;
|
|
12567
|
-
type;
|
|
12568
|
-
code;
|
|
12571
|
+
id = '';
|
|
12572
|
+
type = '';
|
|
12573
|
+
code = 0;
|
|
12569
12574
|
title = '';
|
|
12570
12575
|
message = undefined;
|
|
12571
12576
|
data = null;
|
|
12572
|
-
stackTrace;
|
|
12577
|
+
stackTrace = '';
|
|
12573
12578
|
status;
|
|
12574
12579
|
statusText;
|
|
12575
12580
|
componentName = '';
|
|
12576
12581
|
constructor(error) {
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12582
|
+
this.status = error.status;
|
|
12583
|
+
this.statusText = error.statusText;
|
|
12584
|
+
this.type = error.name;
|
|
12585
|
+
this.message = error.message;
|
|
12586
|
+
// HttpClient already decodes JSON responses. Text error bodies must remain readable too.
|
|
12587
|
+
let parsedError = TruServerError.readBody(error.error);
|
|
12588
|
+
if (typeof parsedError === 'string') {
|
|
12589
|
+
this.message = parsedError;
|
|
12590
|
+
return;
|
|
12591
|
+
}
|
|
12592
|
+
if (!parsedError)
|
|
12593
|
+
return;
|
|
12594
|
+
if (parsedError.ExceptionType === 'tru-db-custom-exception') {
|
|
12595
|
+
const customError = TruServerError.readBody(parsedError.Message);
|
|
12596
|
+
if (typeof customError === 'string') {
|
|
12597
|
+
this.message = customError;
|
|
12598
|
+
return;
|
|
12599
|
+
}
|
|
12600
|
+
if (!customError)
|
|
12601
|
+
return;
|
|
12602
|
+
parsedError = customError;
|
|
12603
|
+
this.id = parsedError.$id ?? '';
|
|
12581
12604
|
this.type = 'tru-db-custom-exception';
|
|
12582
|
-
this.code = parsedError.Code;
|
|
12583
|
-
this.title = parsedError.data
|
|
12605
|
+
this.code = parsedError.Code ?? 0;
|
|
12606
|
+
this.title = parsedError.data?.exceptionObj?.title ?? '';
|
|
12584
12607
|
this.message = parsedError.message;
|
|
12585
|
-
this.stackTrace = parsedError.StackTrace;
|
|
12586
|
-
this.
|
|
12587
|
-
this.
|
|
12588
|
-
this.data = parsedError.data.exceptionObj;
|
|
12589
|
-
this.componentName = parsedError.componentName;
|
|
12608
|
+
this.stackTrace = parsedError.StackTrace ?? '';
|
|
12609
|
+
this.data = parsedError.data?.exceptionObj ?? null;
|
|
12610
|
+
this.componentName = parsedError.componentName ?? '';
|
|
12590
12611
|
}
|
|
12591
12612
|
else {
|
|
12592
|
-
this.id = parsedError.$id;
|
|
12593
|
-
this.type = parsedError.$type;
|
|
12594
|
-
this.code = parsedError.Code;
|
|
12595
|
-
this.message =
|
|
12596
|
-
|
|
12597
|
-
this.
|
|
12598
|
-
|
|
12613
|
+
this.id = parsedError.$id ?? '';
|
|
12614
|
+
this.type = parsedError.$type ?? error.name;
|
|
12615
|
+
this.code = parsedError.Code ?? 0;
|
|
12616
|
+
this.message =
|
|
12617
|
+
parsedError.Message ?? parsedError.message ?? error.message;
|
|
12618
|
+
this.stackTrace = parsedError.StackTrace ?? '';
|
|
12619
|
+
}
|
|
12620
|
+
}
|
|
12621
|
+
static readBody(value) {
|
|
12622
|
+
if (typeof value === 'string') {
|
|
12623
|
+
try {
|
|
12624
|
+
const decoded = JSON.parse(value);
|
|
12625
|
+
if (decoded !== null &&
|
|
12626
|
+
typeof decoded === 'object' &&
|
|
12627
|
+
!Array.isArray(decoded)) {
|
|
12628
|
+
return decoded;
|
|
12629
|
+
}
|
|
12630
|
+
return typeof decoded === 'string' ? decoded : value;
|
|
12631
|
+
}
|
|
12632
|
+
catch {
|
|
12633
|
+
// Display the original text, including malformed JSON, without hiding the HTTP error.
|
|
12634
|
+
return value;
|
|
12635
|
+
}
|
|
12599
12636
|
}
|
|
12637
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
12638
|
+
? value
|
|
12639
|
+
: null;
|
|
12600
12640
|
}
|
|
12601
12641
|
}
|
|
12602
12642
|
|
|
@@ -12706,7 +12746,7 @@ class TruErrorInterceptor {
|
|
|
12706
12746
|
return next.handle(request).pipe(catchError((error) => {
|
|
12707
12747
|
if (error.status !== 401 && !(error.error instanceof Blob))
|
|
12708
12748
|
this.errorManager.handleError(error);
|
|
12709
|
-
return
|
|
12749
|
+
return throwError(() => error);
|
|
12710
12750
|
}));
|
|
12711
12751
|
}
|
|
12712
12752
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: TruErrorInterceptor, deps: [{ token: TruErrorManager }], target: i0.ɵɵFactoryTarget.Injectable });
|