@trudb/tru-common-lib 0.0.677 → 0.0.679

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.
@@ -274,9 +274,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
274
274
  }]
275
275
  }], ctorParameters: function () { return []; } });
276
276
 
277
- class TruAppEnvironment {
277
+ class TruUser {
278
278
  constructor() {
279
- this._user = null;
279
+ this._ref = -1;
280
+ this._username = null;
281
+ this._firstName = null;
282
+ this._lastName = null;
283
+ this._email = null;
284
+ this._roles = null;
285
+ this.hasRoles = (roles) => {
286
+ if (this._roles === null)
287
+ return true;
288
+ return _.intersection(roles, this._roles).length > 0;
289
+ };
290
+ }
291
+ get activeUserRef() {
292
+ if (this._ref < 0)
293
+ throw new Error('Inavlid User.');
294
+ return this._ref;
295
+ }
296
+ set activeUserRef(ref) {
297
+ this._ref = ref;
298
+ }
299
+ get username() {
300
+ return this._username;
301
+ }
302
+ set username(username) {
303
+ this._username = username;
304
+ }
305
+ get firstName() {
306
+ return this._firstName;
307
+ }
308
+ set firstName(firstName) {
309
+ this._firstName = firstName;
310
+ }
311
+ get lastName() {
312
+ return this._lastName;
313
+ }
314
+ set lastName(lastName) {
315
+ this._lastName = lastName;
316
+ }
317
+ get email() {
318
+ return this._email;
319
+ }
320
+ set email(email) {
321
+ this._email = email;
322
+ ;
323
+ }
324
+ set roles(roles) {
325
+ this._roles = roles;
326
+ }
327
+ }
328
+ TruUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruUser, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
329
+ TruUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruUser, providedIn: 'root' });
330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruUser, decorators: [{
331
+ type: Injectable,
332
+ args: [{
333
+ providedIn: 'root',
334
+ }]
335
+ }], ctorParameters: function () { return []; } });
336
+
337
+ class TruAppEnvironment {
338
+ constructor(truUser) {
339
+ this.truUser = truUser;
280
340
  this._isSaving = new BehaviorSubject(false);
281
341
  this._saveComplete = new BehaviorSubject(null);
282
342
  this._revertComplete = new BehaviorSubject(null);
@@ -304,6 +364,7 @@ class TruAppEnvironment {
304
364
  };
305
365
  this._appUri = '';
306
366
  this._maxRecordCount = 0;
367
+ this._user = truUser;
307
368
  this.msgModifierKeyLabel = this.isMac ? 'Cmd' : 'Ctrl';
308
369
  this.msgConfirmExitWithChangesPending = 'You have unsaved changes that will be lost.';
309
370
  this.msgDeleteSuccessful = 'Delete succeeded';
@@ -357,11 +418,14 @@ class TruAppEnvironment {
357
418
  return navigator.platform.toUpperCase().indexOf('MAC') >= 0;
358
419
  }
359
420
  }
360
- TruAppEnvironment.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAppEnvironment, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
361
- TruAppEnvironment.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAppEnvironment });
421
+ TruAppEnvironment.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAppEnvironment, deps: [{ token: TruUser }], target: i0.ɵɵFactoryTarget.Injectable });
422
+ TruAppEnvironment.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAppEnvironment, providedIn: 'root' });
362
423
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAppEnvironment, decorators: [{
363
- type: Injectable
364
- }], ctorParameters: function () { return []; } });
424
+ type: Injectable,
425
+ args: [{
426
+ providedIn: 'root',
427
+ }]
428
+ }], ctorParameters: function () { return [{ type: TruUser }]; } });
365
429
 
366
430
  class TruBreezeContextFactory {
367
431
  constructor(breezeMetadataProvider, environment) {
@@ -3673,6 +3737,7 @@ class TruToolbarUserProfile {
3673
3737
  let user = this.appEnvironment.user;
3674
3738
  this.initial = user?.firstName ? user?.firstName.slice(0, 1).toUpperCase() : user?.username?.slice(0, 1).toUpperCase();
3675
3739
  this.name = user?.firstName && user?.lastName ? user?.firstName + ' ' + user?.lastName : user?.username;
3740
+ this.email = user?.email;
3676
3741
  }
3677
3742
  }
3678
3743
  TruToolbarUserProfile.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruToolbarUserProfile, deps: [{ token: TruDesktopManager }, { token: TruAppEnvironment }, { token: TruAuth }], target: i0.ɵɵFactoryTarget.Component });
@@ -6513,66 +6578,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
6513
6578
  }]
6514
6579
  }], ctorParameters: function () { return []; } });
6515
6580
 
6516
- class TruUser {
6517
- constructor() {
6518
- this._ref = -1;
6519
- this._username = null;
6520
- this._firstName = null;
6521
- this._lastName = null;
6522
- this._email = null;
6523
- this._roles = null;
6524
- this.hasRoles = (roles) => {
6525
- if (this._roles === null)
6526
- return true;
6527
- return true; //_.intersection(roles, this._roles).length > 0;
6528
- };
6529
- }
6530
- get activeUserRef() {
6531
- if (this._ref < 0)
6532
- throw new Error('Inavlid User.');
6533
- return this._ref;
6534
- }
6535
- set activeUserRef(ref) {
6536
- this._ref = ref;
6537
- }
6538
- get username() {
6539
- return this._username;
6540
- }
6541
- set username(username) {
6542
- this._username = username;
6543
- }
6544
- get firstName() {
6545
- return this._firstName;
6546
- }
6547
- set firstName(firstName) {
6548
- this._firstName = firstName;
6549
- }
6550
- get lastName() {
6551
- return this._lastName;
6552
- }
6553
- set lastName(lastName) {
6554
- this._lastName = lastName;
6555
- }
6556
- get email() {
6557
- return this._email;
6558
- }
6559
- set email(email) {
6560
- this._email = email;
6561
- ;
6562
- }
6563
- set roles(roles) {
6564
- this._roles = roles;
6565
- }
6566
- }
6567
- TruUser.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruUser, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6568
- TruUser.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruUser, providedIn: 'root' });
6569
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruUser, decorators: [{
6570
- type: Injectable,
6571
- args: [{
6572
- providedIn: 'root',
6573
- }]
6574
- }], ctorParameters: function () { return []; } });
6575
-
6576
6581
  const GO_TO_ICON = `
6577
6582
  <svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M216-144q-29.7 0-50.85-21.15Q144-186.3 144-216v-528q0-29.7 21.15-50.85Q186.3-816 216-816h264v72H216v528h528v-264h72v264q0 29.7-21.15 50.85Q773.7-144 744-144H216Zm171-192-51-51 357-357H576v-72h240v240h-72v-117L387-336Z"/></svg>
6578
6583
  `;