@falcon-ng/tailwind 0.0.20 → 0.0.22

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.
@@ -483,124 +483,134 @@ class GenericHttpClient {
483
483
  this.isHttpError = false;
484
484
  }
485
485
  /**
486
- * @description
487
- * Generic Http GET method to Get the response and bind to the view model
488
- * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
489
- * @param {IRequestOptions} options options of the request like headers, body, etc.
490
- * @returns {Observable<T>}
491
- * @usageNotes
492
- * The following snippet shows how to use this method
493
- * ```ts
494
- * this.genericHttpService.Get("get_url").subscribe(data => {
495
- * console.log('success');
496
- * }, error => {
497
- * console.log(error);
498
- * });
499
- * ```
500
- */
486
+ * @description
487
+ * Gets the underlying HttpClient instance
488
+ * @returns {HttpClient}
489
+ */
490
+ getHttpClient() {
491
+ return this.httpClient;
492
+ }
493
+ /**
494
+ * @description
495
+ * Generic Http GET method to Get the response and bind to the view model
496
+ * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
497
+ * @param {IRequestOptions} options options of the request like headers, body, etc.
498
+ * @returns {Observable<T>}
499
+ * @usageNotes
500
+ * The following snippet shows how to use this method
501
+ * ```ts
502
+ * this.genericHttpService.Get("get_url").subscribe(data => {
503
+ * console.log('success');
504
+ * }, error => {
505
+ * console.log(error);
506
+ * });
507
+ * ```
508
+ */
501
509
  get(destinationUrl, options) {
502
510
  return this.request("GET" /* HttpMethod.Get */, destinationUrl, options);
503
511
  }
504
512
  /**
505
- * @description
506
- * Generic Http post method to post the view model and bind the return view model
507
- * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
508
- * @param {IRequestOptions} options options of the request like headers, body, etc.
509
- * @returns {Observable<T>}
510
- * @usageNotes
511
- * The following snippet shows how to use this method
512
- * ```ts
513
- * this.genericHttpClientService.Post(post-url,post-view-model).subscribe(item => {
514
- * console.log(item);
515
- * },
516
- * err => {
517
- * console.log(err);
518
- * });
519
- * ```
520
- */
513
+ * @description
514
+ * Generic Http post method to post the view model and bind the return view model
515
+ * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
516
+ * @param {IRequestOptions} options options of the request like headers, body, etc.
517
+ * @returns {Observable<T>}
518
+ * @usageNotes
519
+ * The following snippet shows how to use this method
520
+ * ```ts
521
+ * this.genericHttpClientService.Post(post-url,post-view-model).subscribe(item => {
522
+ * console.log(item);
523
+ * },
524
+ * err => {
525
+ * console.log(err);
526
+ * });
527
+ * ```
528
+ */
521
529
  post(destinationUrl, options) {
522
530
  return this.request("POST" /* HttpMethod.Post */, destinationUrl, options);
523
531
  }
524
532
  /**
525
- * @description
526
- * Generic Http Put method to post the view model and bind the return view model
527
- * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
528
- * @param {IRequestOptions} options options of the request like headers, body, etc.
529
- * @returns {Observable<T>}
530
- * @usageNotes
531
- * The following snippet shows how to use this method
532
- * ```ts
533
- * this.genericHttpClientService.Put(post-url, post-view-model).subscribe(item => {
534
- * console.log(item);
535
- * },
536
- * err => {
537
- * console.log(err);
538
- * });
539
- * ```
540
- */
533
+ * @description
534
+ * Generic Http Put method to post the view model and bind the return view model
535
+ * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
536
+ * @param {IRequestOptions} options options of the request like headers, body, etc.
537
+ * @returns {Observable<T>}
538
+ * @usageNotes
539
+ * The following snippet shows how to use this method
540
+ * ```ts
541
+ * this.genericHttpClientService.Put(post-url, post-view-model).subscribe(item => {
542
+ * console.log(item);
543
+ * },
544
+ * err => {
545
+ * console.log(err);
546
+ * });
547
+ * ```
548
+ */
541
549
  put(destinationUrl, options) {
542
550
  return this.request("PUT" /* HttpMethod.Put */, destinationUrl, options);
543
551
  }
544
552
  /**
545
- * @description
546
- * Generic Http post method to post the view model and bind the return view model
547
- * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
548
- * @param {IRequestOptions} options options of the request like headers, body, etc.
549
- * @returns {Observable<T>}
550
- * @usageNotes
551
- * The following snippet shows how to use this method
552
- * ```ts
553
- * this.genericHttpClientService.Post(post-url,post-view-model).subscribe(item => {
554
- * console.log(item);
555
- * },
556
- * err => {
557
- * console.log(err);
558
- * });
559
- * ```
560
- */
553
+ * @description
554
+ * Generic Http post method to post the view model and bind the return view model
555
+ * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
556
+ * @param {IRequestOptions} options options of the request like headers, body, etc.
557
+ * @returns {Observable<T>}
558
+ * @usageNotes
559
+ * The following snippet shows how to use this method
560
+ * ```ts
561
+ * this.genericHttpClientService.Post(post-url,post-view-model).subscribe(item => {
562
+ * console.log(item);
563
+ * },
564
+ * err => {
565
+ * console.log(err);
566
+ * });
567
+ * ```
568
+ */
561
569
  patch(destinationUrl, options) {
562
570
  return this.request("PATCH" /* HttpMethod.Patch */, destinationUrl, options);
563
571
  }
564
572
  /**
565
- * @description
566
- * Generic Http Delete method to Delete the item and bind the return view model
567
- * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
568
- * @param {IRequestOptions} options options of the request like headers, body, etc.
569
- * @returns {Observable<T>}
570
- * @usageNotes
571
- * The following snippet shows how to use this method
572
- * ```ts
573
- * this.genericHttpClientService.Delete(this.deleteUserUrl).subscribe(item => {
574
- * console.log('success');
575
- * }, error => {
576
- * console.log(error);
577
- * });
578
- * ```
579
- */
573
+ * @description
574
+ * Generic Http Delete method to Delete the item and bind the return view model
575
+ * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
576
+ * @param {IRequestOptions} options options of the request like headers, body, etc.
577
+ * @returns {Observable<T>}
578
+ * @usageNotes
579
+ * The following snippet shows how to use this method
580
+ * ```ts
581
+ * this.genericHttpClientService.Delete(this.deleteUserUrl).subscribe(item => {
582
+ * console.log('success');
583
+ * }, error => {
584
+ * console.log(error);
585
+ * });
586
+ * ```
587
+ */
580
588
  delete(destinationUrl, options) {
581
589
  return this.request("DELETE" /* HttpMethod.Delete */, destinationUrl, options);
582
590
  }
583
591
  /**
584
- * @description
585
- * Http request method to accept different method type and params
586
- * @param {string} method Http methods - GET, POST, PUT, DELETE.
587
- * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
588
- * @param {IRequestOptions} options options of the request like headers, body, etc.
589
- * @returns {Observable<T>}
590
- * @usageNotes
591
- * The following snippet shows how to use this method
592
- * ```ts
593
- * this.request<T>(HttpMethod.Delete, destinationUrl, options);
594
- * ```
595
- */
592
+ * @description
593
+ * Http request method to accept different method type and params
594
+ * @param {string} method Http methods - GET, POST, PUT, DELETE.
595
+ * @param {string} destinationUrl endPoint it doesn't need / in front of the end point.
596
+ * @param {IRequestOptions} options options of the request like headers, body, etc.
597
+ * @returns {Observable<T>}
598
+ * @usageNotes
599
+ * The following snippet shows how to use this method
600
+ * ```ts
601
+ * this.request<T>(HttpMethod.Delete, destinationUrl, options);
602
+ * ```
603
+ */
596
604
  request(method, url, options) {
597
605
  return Observable.create((observer) => {
598
606
  let destinationUrl = '';
599
607
  if (this.environment.baseUrl != undefined)
600
- destinationUrl = (this.environment.baseUrl) + url;
608
+ destinationUrl = this.environment.baseUrl + url;
601
609
  else
602
610
  destinationUrl = url;
603
- this.httpClient.request(new HttpRequest(method, destinationUrl, options)).subscribe((response) => {
611
+ this.httpClient
612
+ .request(new HttpRequest(method, destinationUrl, options))
613
+ .subscribe((response) => {
604
614
  const responsTye = response;
605
615
  switch (responsTye.type) {
606
616
  case HttpEventType.Sent:
@@ -617,37 +627,44 @@ class GenericHttpClient {
617
627
  observer.next(response.body);
618
628
  this.logger.info('Http Client : Response -> 😺 Done!', responsTye.body);
619
629
  }
620
- }, (error) => {
630
+ }, error => {
621
631
  switch (error.status) {
622
632
  case HttpStatusCode.Forbidden:
623
633
  // observer.complete();
624
- this.snackBarViewModel.messageText = 'Access to the requested resource is forbidden.';
634
+ this.snackBarViewModel.messageText =
635
+ 'Access to the requested resource is forbidden.';
625
636
  this.snackBarViewModel.actionText = 'Forbidden';
626
637
  this.isHttpError = true;
627
638
  break;
628
639
  case HttpStatusCode.BadRequest:
629
- this.snackBarViewModel.messageText = 'Server cannot or will not process the request.';
640
+ this.snackBarViewModel.messageText =
641
+ 'Server cannot or will not process the request.';
630
642
  this.snackBarViewModel.actionText = 'Bad Request';
631
643
  this.isHttpError = true;
632
644
  break;
633
645
  case HttpStatusCode.Unauthorized:
634
- this.snackBarViewModel.messageText = 'Request has not been applied because it lacks valid authentication credentials.';
646
+ this.snackBarViewModel.messageText =
647
+ 'Request has not been applied because it lacks valid authentication credentials.';
635
648
  this.snackBarViewModel.actionText = 'Unauthorized';
636
649
  this.isHttpError = true;
637
650
  break;
638
651
  case HttpStatusCode.InternalServerError:
639
- this.snackBarViewModel.messageText = 'Server encountered an unexpected condition.';
652
+ this.snackBarViewModel.messageText =
653
+ 'Server encountered an unexpected condition.';
640
654
  this.snackBarViewModel.actionText = 'Internal server error';
641
655
  this.isHttpError = true;
642
656
  break;
643
657
  case 0:
644
- this.snackBarViewModel.messageText = 'Not connected to the service.';
658
+ this.snackBarViewModel.messageText =
659
+ 'Not connected to the service.';
645
660
  this.snackBarViewModel.actionText = 'Service not available';
646
661
  this.isHttpError = true;
647
662
  break;
648
663
  }
649
664
  observer.error(error);
650
- if ((this.environment.snackBarEnable != undefined && this.environment.snackBarEnable) && this.isHttpError)
665
+ if (this.environment.snackBarEnable != undefined &&
666
+ this.environment.snackBarEnable &&
667
+ this.isHttpError)
651
668
  this._snackBar.open(this.snackBarViewModel.messageText, this.snackBarViewModel.actionText);
652
669
  });
653
670
  });
@@ -658,7 +675,7 @@ class GenericHttpClient {
658
675
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: GenericHttpClient, decorators: [{
659
676
  type: Injectable,
660
677
  args: [{
661
- providedIn: 'root'
678
+ providedIn: 'root',
662
679
  }]
663
680
  }], ctorParameters: () => [{ type: i1$8.HttpClient }, { type: EnvironmentViewModel }, { type: i3$1.MatSnackBar }, { type: LoggerService }] });
664
681
 
@@ -1155,6 +1172,7 @@ class FalconTailwindModule {
1155
1172
  ngModule: FalconTailwindModule,
1156
1173
  providers: [
1157
1174
  { provide: EnvironmentViewModel, useValue: environment },
1175
+ { provide: IGenericHttpClient, useClass: GenericHttpClient },
1158
1176
  ],
1159
1177
  };
1160
1178
  }
@@ -1202,13 +1220,13 @@ class FalconTailwindModule {
1202
1220
  (req, next) => {
1203
1221
  // Get the auth token from the service.
1204
1222
  const authToken = inject(AuthService).getAuthorizationHeaderValue();
1205
- inject(LoggerService).info("Auth bearer token ", authToken);
1223
+ inject(LoggerService).info('Auth bearer token ', authToken);
1206
1224
  if (authToken) {
1207
1225
  req = req.clone({
1208
1226
  setHeaders: {
1209
1227
  'Content-Type': 'application/json',
1210
- Authorization: authToken
1211
- }
1228
+ Authorization: authToken,
1229
+ },
1212
1230
  });
1213
1231
  }
1214
1232
  return next(req);
@@ -1216,15 +1234,15 @@ class FalconTailwindModule {
1216
1234
  ])),
1217
1235
  { provide: IGenericHttpClient, useClass: GenericHttpClient },
1218
1236
  provideAppInitializer(() => {
1219
- const initializerFn = (appSettingsFactory)(inject(AppSettingService));
1237
+ const initializerFn = appSettingsFactory(inject(AppSettingService));
1220
1238
  return initializerFn();
1221
1239
  }),
1222
1240
  provideAppInitializer(() => {
1223
- const initializerFn = (authServiceFactory)(inject(AuthService), inject(AppSettingService), inject(EnvironmentViewModel));
1241
+ const initializerFn = authServiceFactory(inject(AuthService), inject(AppSettingService), inject(EnvironmentViewModel));
1224
1242
  return initializerFn();
1225
1243
  }),
1226
1244
  provideAppInitializer(() => {
1227
- const initializerFn = (loggerServiceFactory)(inject(LoggerService), inject(AppSettingService));
1245
+ const initializerFn = loggerServiceFactory(inject(LoggerService), inject(AppSettingService));
1228
1246
  return initializerFn();
1229
1247
  }),
1230
1248
  {
@@ -1268,7 +1286,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
1268
1286
  ProgressSpinnerComponent,
1269
1287
  TableComponent,
1270
1288
  PaginationComponent,
1271
- RichTextEditorComponent
1289
+ RichTextEditorComponent,
1272
1290
  ],
1273
1291
  imports: [
1274
1292
  AngularmaterialModule,
@@ -1297,13 +1315,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
1297
1315
  (req, next) => {
1298
1316
  // Get the auth token from the service.
1299
1317
  const authToken = inject(AuthService).getAuthorizationHeaderValue();
1300
- inject(LoggerService).info("Auth bearer token ", authToken);
1318
+ inject(LoggerService).info('Auth bearer token ', authToken);
1301
1319
  if (authToken) {
1302
1320
  req = req.clone({
1303
1321
  setHeaders: {
1304
1322
  'Content-Type': 'application/json',
1305
- Authorization: authToken
1306
- }
1323
+ Authorization: authToken,
1324
+ },
1307
1325
  });
1308
1326
  }
1309
1327
  return next(req);
@@ -1311,15 +1329,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
1311
1329
  ])),
1312
1330
  { provide: IGenericHttpClient, useClass: GenericHttpClient },
1313
1331
  provideAppInitializer(() => {
1314
- const initializerFn = (appSettingsFactory)(inject(AppSettingService));
1332
+ const initializerFn = appSettingsFactory(inject(AppSettingService));
1315
1333
  return initializerFn();
1316
1334
  }),
1317
1335
  provideAppInitializer(() => {
1318
- const initializerFn = (authServiceFactory)(inject(AuthService), inject(AppSettingService), inject(EnvironmentViewModel));
1336
+ const initializerFn = authServiceFactory(inject(AuthService), inject(AppSettingService), inject(EnvironmentViewModel));
1319
1337
  return initializerFn();
1320
1338
  }),
1321
1339
  provideAppInitializer(() => {
1322
- const initializerFn = (loggerServiceFactory)(inject(LoggerService), inject(AppSettingService));
1340
+ const initializerFn = loggerServiceFactory(inject(LoggerService), inject(AppSettingService));
1323
1341
  return initializerFn();
1324
1342
  }),
1325
1343
  {