@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.
- package/fesm2022/falcon-ng-tailwind.mjs +131 -113
- package/fesm2022/falcon-ng-tailwind.mjs.map +1 -1
- package/index.d.ts +11 -0
- package/package.json +1 -1
|
@@ -483,124 +483,134 @@ class GenericHttpClient {
|
|
|
483
483
|
this.isHttpError = false;
|
|
484
484
|
}
|
|
485
485
|
/**
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
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
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
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
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
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 =
|
|
608
|
+
destinationUrl = this.environment.baseUrl + url;
|
|
601
609
|
else
|
|
602
610
|
destinationUrl = url;
|
|
603
|
-
this.httpClient
|
|
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
|
-
},
|
|
630
|
+
}, error => {
|
|
621
631
|
switch (error.status) {
|
|
622
632
|
case HttpStatusCode.Forbidden:
|
|
623
633
|
// observer.complete();
|
|
624
|
-
this.snackBarViewModel.messageText =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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 (
|
|
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(
|
|
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 =
|
|
1237
|
+
const initializerFn = appSettingsFactory(inject(AppSettingService));
|
|
1220
1238
|
return initializerFn();
|
|
1221
1239
|
}),
|
|
1222
1240
|
provideAppInitializer(() => {
|
|
1223
|
-
const initializerFn =
|
|
1241
|
+
const initializerFn = authServiceFactory(inject(AuthService), inject(AppSettingService), inject(EnvironmentViewModel));
|
|
1224
1242
|
return initializerFn();
|
|
1225
1243
|
}),
|
|
1226
1244
|
provideAppInitializer(() => {
|
|
1227
|
-
const initializerFn =
|
|
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(
|
|
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 =
|
|
1332
|
+
const initializerFn = appSettingsFactory(inject(AppSettingService));
|
|
1315
1333
|
return initializerFn();
|
|
1316
1334
|
}),
|
|
1317
1335
|
provideAppInitializer(() => {
|
|
1318
|
-
const initializerFn =
|
|
1336
|
+
const initializerFn = authServiceFactory(inject(AuthService), inject(AppSettingService), inject(EnvironmentViewModel));
|
|
1319
1337
|
return initializerFn();
|
|
1320
1338
|
}),
|
|
1321
1339
|
provideAppInitializer(() => {
|
|
1322
|
-
const initializerFn =
|
|
1340
|
+
const initializerFn = loggerServiceFactory(inject(LoggerService), inject(AppSettingService));
|
|
1323
1341
|
return initializerFn();
|
|
1324
1342
|
}),
|
|
1325
1343
|
{
|