ngx-cho-common 0.0.1
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/README.md +24 -0
- package/esm2022/lib/guards/feature-guard.service.mjs +32 -0
- package/esm2022/lib/guards/unsaved-changes.guard.mjs +13 -0
- package/esm2022/lib/logging/console-logger.sink.mjs +27 -0
- package/esm2022/lib/logging/logger-sink-configuration.interface.mjs +2 -0
- package/esm2022/lib/logging/logger-sink.interface.mjs +2 -0
- package/esm2022/lib/logging/logger.model.mjs +3 -0
- package/esm2022/lib/logging/logger.service.mjs +127 -0
- package/esm2022/lib/logging/models/client-log-entry.interface.mjs +2 -0
- package/esm2022/lib/logging/models/severity-level.enum.mjs +9 -0
- package/esm2022/lib/logging/server-logger.sink.mjs +51 -0
- package/esm2022/lib/models/deactivatable.interface.mjs +2 -0
- package/esm2022/lib/models/uuid.model.mjs +32 -0
- package/esm2022/lib/security/auth-callback/auth-callback.component.mjs +18 -0
- package/esm2022/lib/security/models/auth-user.model.mjs +84 -0
- package/esm2022/lib/security/models/authorization-context.model.mjs +6 -0
- package/esm2022/lib/security/models/security-policy.model.mjs +15 -0
- package/esm2022/lib/security/security-policies.mjs +3 -0
- package/esm2022/lib/security/services/auth-guard.service.mjs +32 -0
- package/esm2022/lib/security/services/auth.service.mjs +131 -0
- package/esm2022/lib/security/signin/signin.component.mjs +18 -0
- package/esm2022/lib/security/signout/signout.component.mjs +18 -0
- package/esm2022/lib/services/date.service.mjs +40 -0
- package/esm2022/lib/services/download.service.mjs +49 -0
- package/esm2022/lib/services/feature.service.mjs +66 -0
- package/esm2022/lib/services/interval.service.mjs +115 -0
- package/esm2022/lib/services/local-storage.service.mjs +29 -0
- package/esm2022/lib/services/modal.service.mjs +34 -0
- package/esm2022/lib/services/navigation.service.mjs +45 -0
- package/esm2022/lib/services/object.service.mjs +33 -0
- package/esm2022/lib/services/rest-client.service.mjs +136 -0
- package/esm2022/lib/services/route-param.service.mjs +53 -0
- package/esm2022/lib/services/session-storage.service.mjs +29 -0
- package/esm2022/lib/types/indexable.type.mjs +2 -0
- package/esm2022/lib/types/name-value-item.type.mjs +2 -0
- package/esm2022/ngx-cho-common.mjs +5 -0
- package/esm2022/public-api.mjs +32 -0
- package/fesm2022/ngx-cho-common.mjs +1196 -0
- package/fesm2022/ngx-cho-common.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/guards/feature-guard.service.d.ts +14 -0
- package/lib/guards/unsaved-changes.guard.d.ts +11 -0
- package/lib/logging/console-logger.sink.d.ts +10 -0
- package/lib/logging/logger-sink-configuration.interface.d.ts +14 -0
- package/lib/logging/logger-sink.interface.d.ts +7 -0
- package/lib/logging/logger.model.d.ts +10 -0
- package/lib/logging/logger.service.d.ts +29 -0
- package/lib/logging/models/client-log-entry.interface.d.ts +10 -0
- package/lib/logging/models/severity-level.enum.d.ts +7 -0
- package/lib/logging/server-logger.sink.d.ts +27 -0
- package/lib/models/deactivatable.interface.d.ts +4 -0
- package/lib/models/uuid.model.d.ts +4 -0
- package/lib/security/auth-callback/auth-callback.component.d.ts +10 -0
- package/lib/security/models/auth-user.model.d.ts +57 -0
- package/lib/security/models/authorization-context.model.d.ts +5 -0
- package/lib/security/models/security-policy.model.d.ts +9 -0
- package/lib/security/security-policies.d.ts +3 -0
- package/lib/security/services/auth-guard.service.d.ts +12 -0
- package/lib/security/services/auth.service.d.ts +60 -0
- package/lib/security/signin/signin.component.d.ts +10 -0
- package/lib/security/signout/signout.component.d.ts +10 -0
- package/lib/services/date.service.d.ts +11 -0
- package/lib/services/download.service.d.ts +13 -0
- package/lib/services/feature.service.d.ts +40 -0
- package/lib/services/interval.service.d.ts +37 -0
- package/lib/services/local-storage.service.d.ts +9 -0
- package/lib/services/modal.service.d.ts +12 -0
- package/lib/services/navigation.service.d.ts +14 -0
- package/lib/services/object.service.d.ts +14 -0
- package/lib/services/rest-client.service.d.ts +88 -0
- package/lib/services/route-param.service.d.ts +17 -0
- package/lib/services/session-storage.service.d.ts +9 -0
- package/lib/types/indexable.type.d.ts +6 -0
- package/lib/types/name-value-item.type.d.ts +5 -0
- package/package.json +30 -0
- package/public-api.d.ts +33 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BehaviorSubject } from 'rxjs';
|
|
2
|
+
import { RestClient } from './rest-client.service';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class FeatureService {
|
|
5
|
+
private webApiUrl;
|
|
6
|
+
private readonly restClient;
|
|
7
|
+
readonly featureStream: BehaviorSubject<string[]>;
|
|
8
|
+
private _enabledFeatures;
|
|
9
|
+
private _isInitialized;
|
|
10
|
+
private readonly routePrefix;
|
|
11
|
+
constructor(webApiUrl: string, restClient: RestClient);
|
|
12
|
+
/**
|
|
13
|
+
* Gets the enabled features.
|
|
14
|
+
*/
|
|
15
|
+
get enabledFeatures(): string[];
|
|
16
|
+
/**
|
|
17
|
+
* Sets the enabled features.
|
|
18
|
+
*/
|
|
19
|
+
private set enabledFeatures(value);
|
|
20
|
+
/**
|
|
21
|
+
* Gets whether features have been initialized
|
|
22
|
+
*/
|
|
23
|
+
get isInitialized(): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Checks that the enabled features are set and returns the list.
|
|
26
|
+
*
|
|
27
|
+
* @param name
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
checkEnabledFeatures(): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Checks that the specified feature is enabled.
|
|
33
|
+
*
|
|
34
|
+
* @param name
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
checkFeatureIsEnabled(name: string): boolean;
|
|
38
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FeatureService, never>;
|
|
39
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<FeatureService>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export type IntervalOptions = {
|
|
3
|
+
fireImmediately: FireImmediately;
|
|
4
|
+
blurInterval?: number;
|
|
5
|
+
hiddenInterval?: number;
|
|
6
|
+
};
|
|
7
|
+
type Action = () => Promise<unknown>;
|
|
8
|
+
export declare enum FireImmediately {
|
|
9
|
+
never = 0,
|
|
10
|
+
whenShown = 1,
|
|
11
|
+
whenFocused = 2
|
|
12
|
+
}
|
|
13
|
+
export declare class IntervalService {
|
|
14
|
+
static readonly defaultOptions: IntervalOptions;
|
|
15
|
+
create(action: Action, interval: number, options?: IntervalOptions): IntervalTimer;
|
|
16
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<IntervalService, never>;
|
|
17
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<IntervalService>;
|
|
18
|
+
}
|
|
19
|
+
export declare class IntervalTimer {
|
|
20
|
+
private readonly action;
|
|
21
|
+
private readonly interval;
|
|
22
|
+
private readonly options;
|
|
23
|
+
$handle?: number;
|
|
24
|
+
currentInterval: number;
|
|
25
|
+
isStopped: boolean;
|
|
26
|
+
constructor(action: Action, interval: number, options: IntervalOptions);
|
|
27
|
+
initialize(): void;
|
|
28
|
+
start(): void;
|
|
29
|
+
stop(): void;
|
|
30
|
+
private callActionAndScheduleNext;
|
|
31
|
+
private onBlur;
|
|
32
|
+
private onFocus;
|
|
33
|
+
private onHidden;
|
|
34
|
+
private onShown;
|
|
35
|
+
private setInterval;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class LocalStorageService {
|
|
3
|
+
checkIfKeyExists(key: string): boolean;
|
|
4
|
+
getItem<T>(key: string): T | undefined;
|
|
5
|
+
setItem<T>(key: string, value: T): void;
|
|
6
|
+
removeItem(key: string): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LocalStorageService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LocalStorageService>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NgbModal, NgbModalOptions } from '@ng-bootstrap/ng-bootstrap';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ModalService {
|
|
4
|
+
private readonly ngbModal;
|
|
5
|
+
constructor(ngbModal: NgbModal);
|
|
6
|
+
showModal<T>(component: unknown, componentParameters?: unknown, modalOptions?: NgbModalOptions): Promise<{
|
|
7
|
+
result: T;
|
|
8
|
+
componentInstance: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ModalService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ModalService>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Location } from '@angular/common';
|
|
2
|
+
import { Params, Router } from '@angular/router';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class NavigationService {
|
|
5
|
+
private router;
|
|
6
|
+
private location;
|
|
7
|
+
private history;
|
|
8
|
+
constructor(router: Router, location: Location);
|
|
9
|
+
goBack(): void;
|
|
10
|
+
goBackOrDefault(defaultUrl: string): void;
|
|
11
|
+
setQueryParams(params: Params): void;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NavigationService, never>;
|
|
13
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NavigationService>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HttpParams } from '@angular/common/http';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class ObjectService {
|
|
4
|
+
toValueObject(obj: object): object;
|
|
5
|
+
/**
|
|
6
|
+
* Convert Object to HttpParams
|
|
7
|
+
* @param {object} obj
|
|
8
|
+
* @returns {HttpParams}
|
|
9
|
+
* see: https://stackoverflow.com/questions/45210406/angular-4-3-httpclient-set-params
|
|
10
|
+
*/
|
|
11
|
+
toHttpParams(obj: object): HttpParams;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ObjectService, never>;
|
|
13
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ObjectService>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { HttpClient, HttpResponse } from '@angular/common/http';
|
|
2
|
+
import { Observable, RetryConfig } from 'rxjs';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
type RequestParameters = {
|
|
5
|
+
body?: unknown;
|
|
6
|
+
queryParameters?: {};
|
|
7
|
+
apiVersion?: {};
|
|
8
|
+
headers?: {};
|
|
9
|
+
cacheLifetimeSeconds?: number;
|
|
10
|
+
retry?: RetryConfig;
|
|
11
|
+
showSpinner?: {};
|
|
12
|
+
};
|
|
13
|
+
type DeleteRequestParameters = Omit<RequestParameters, 'body' | 'cacheLifetimeSeconds'>;
|
|
14
|
+
type GetRequestParameters = Omit<RequestParameters, 'body'>;
|
|
15
|
+
export declare class RestClient {
|
|
16
|
+
private readonly httpClient;
|
|
17
|
+
private readonly defaultRetry;
|
|
18
|
+
constructor(httpClient: HttpClient);
|
|
19
|
+
/**
|
|
20
|
+
* Sends a delete request to the specified REST service
|
|
21
|
+
*
|
|
22
|
+
* @param url The service endpoint
|
|
23
|
+
* @param options Additional options
|
|
24
|
+
*/
|
|
25
|
+
delete(url: string, options?: DeleteRequestParameters): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves data from the specified REST service
|
|
28
|
+
*
|
|
29
|
+
* @param url The service endpoint
|
|
30
|
+
* @param options Additional options
|
|
31
|
+
*/
|
|
32
|
+
get<T>(url: string, options?: GetRequestParameters): Promise<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Sends a patch request to the specified REST service
|
|
35
|
+
*
|
|
36
|
+
* @param url The service endpoint
|
|
37
|
+
* @param options Additional options
|
|
38
|
+
*/
|
|
39
|
+
patch<T>(url: string, options?: RequestParameters): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Sends a post request to the specified REST service
|
|
42
|
+
*
|
|
43
|
+
* @param url The service endpoint
|
|
44
|
+
* @param options Additional options
|
|
45
|
+
*/
|
|
46
|
+
post<T>(url: string, options?: RequestParameters): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Sends a put request to the specified REST service
|
|
49
|
+
*
|
|
50
|
+
* @param url The service endpoint
|
|
51
|
+
* @param options Additional options
|
|
52
|
+
*/
|
|
53
|
+
put<T>(url: string, options?: RequestParameters): Promise<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Sends a request to the specified REST service
|
|
56
|
+
*
|
|
57
|
+
* @param method DELETE, GET, POST, PUT, or PATCH
|
|
58
|
+
* @param url The service endpoint
|
|
59
|
+
* @param options Additional options
|
|
60
|
+
*/
|
|
61
|
+
request<T>(method: 'DELETE', url: string, options?: DeleteRequestParameters): Observable<T>;
|
|
62
|
+
request<T>(method: 'GET', url: string, options?: GetRequestParameters): Observable<T>;
|
|
63
|
+
request<T>(method: 'POST' | 'PUT' | 'PATCH', url: string, options?: RequestParameters): Observable<T>;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param url
|
|
67
|
+
* @param options
|
|
68
|
+
* @returns
|
|
69
|
+
*/
|
|
70
|
+
getResponse<T>(method: 'GET' | 'PATCH' | 'POST' | 'PUT', url: string, options?: RequestParameters): Observable<HttpResponse<T>>;
|
|
71
|
+
/**
|
|
72
|
+
* Creates request headers based on the provided options.
|
|
73
|
+
*
|
|
74
|
+
* @param options
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
private createRequestHeaders;
|
|
78
|
+
/**
|
|
79
|
+
* Converts one or more objects to an HttpParams object.
|
|
80
|
+
*
|
|
81
|
+
* @param sources The objects to convert
|
|
82
|
+
* @returns
|
|
83
|
+
*/
|
|
84
|
+
private createRequestParams;
|
|
85
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RestClient, never>;
|
|
86
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RestClient>;
|
|
87
|
+
}
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActivatedRoute, Params } from '@angular/router';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class RouteParamService {
|
|
4
|
+
private readonly route;
|
|
5
|
+
constructor(route: ActivatedRoute);
|
|
6
|
+
getParameterBoolean(params: Params, paramKey: string): boolean | null;
|
|
7
|
+
getParameterNumber(params: Params, paramKey: string): number | null;
|
|
8
|
+
getParameterValue(params: Params, paramKey: string): string | null;
|
|
9
|
+
getQueryParameterBoolean(paramKey: string): boolean | null;
|
|
10
|
+
getQueryParameterNumber(paramKey: string): number | null;
|
|
11
|
+
getQueryParameterValue(paramKey: string): string | null;
|
|
12
|
+
getRouteParameterBoolean(route: ActivatedRoute, paramKey: string): boolean | null;
|
|
13
|
+
getRouteParameterNumber(route: ActivatedRoute, paramKey: string): number | null;
|
|
14
|
+
getRouteParameterValue(route: ActivatedRoute, paramKey: string): string | null;
|
|
15
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RouteParamService, never>;
|
|
16
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<RouteParamService>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class SessionStorageService {
|
|
3
|
+
checkIfKeyExists(key: string): boolean;
|
|
4
|
+
getItem<T>(key: string): T | undefined;
|
|
5
|
+
setItem<T>(key: string, value: T): void;
|
|
6
|
+
removeItem(key: string): void;
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<SessionStorageService, never>;
|
|
8
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<SessionStorageService>;
|
|
9
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ngx-cho-common",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^17.3.0",
|
|
6
|
+
"@angular/core": "^17.3.0",
|
|
7
|
+
"@js-joda/core": "^5.2.0",
|
|
8
|
+
"file-saver": "^2.0.5",
|
|
9
|
+
"ngx-spinner": "16.0.2",
|
|
10
|
+
"ngx-toastr": "^15.2.1",
|
|
11
|
+
"oidc-client": "^1.11.5"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"tslib": "^2.3.0"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"module": "fesm2022/ngx-cho-common.mjs",
|
|
18
|
+
"typings": "index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
"./package.json": {
|
|
21
|
+
"default": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
|
+
"esm2022": "./esm2022/ngx-cho-common.mjs",
|
|
26
|
+
"esm": "./esm2022/ngx-cho-common.mjs",
|
|
27
|
+
"default": "./fesm2022/ngx-cho-common.mjs"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/public-api.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { AuthCallbackComponent } from './lib/security/auth-callback/auth-callback.component';
|
|
2
|
+
export { AuthGuardService } from './lib/security/services/auth-guard.service';
|
|
3
|
+
export { AuthService } from './lib/security/services/auth.service';
|
|
4
|
+
export { AuthUser } from './lib/security/models/auth-user.model';
|
|
5
|
+
export { AuthorizationContext } from './lib/security/models/authorization-context.model';
|
|
6
|
+
export { SECURITY_POLICIES } from './lib/security/security-policies';
|
|
7
|
+
export { SecurityPolicy } from './lib/security/models/security-policy.model';
|
|
8
|
+
export { SigninComponent } from './lib/security/signin/signin.component';
|
|
9
|
+
export { SignoutComponent } from './lib/security/signout/signout.component';
|
|
10
|
+
export { IClientLogEntry } from './lib/logging/models/client-log-entry.interface';
|
|
11
|
+
export { SeverityLevel } from './lib/logging/models/severity-level.enum';
|
|
12
|
+
export { ConsoleLoggerSink } from './lib/logging/console-logger.sink';
|
|
13
|
+
export { ILoggerSinkConfiguration } from './lib/logging/logger-sink-configuration.interface';
|
|
14
|
+
export { ILoggerSink } from './lib/logging/logger-sink.interface';
|
|
15
|
+
export { Logger } from './lib/logging/logger.model';
|
|
16
|
+
export { LoggerService } from './lib/logging/logger.service';
|
|
17
|
+
export { ServerLoggerSink } from './lib/logging/server-logger.sink';
|
|
18
|
+
export { DateService } from './lib/services/date.service';
|
|
19
|
+
export { DownloadService } from './lib/services/download.service';
|
|
20
|
+
export { FeatureGuardService } from './lib/guards/feature-guard.service';
|
|
21
|
+
export { FeatureService } from './lib/services/feature.service';
|
|
22
|
+
export { IntervalService, IntervalTimer } from './lib/services/interval.service';
|
|
23
|
+
export { LocalStorageService } from './lib/services/local-storage.service';
|
|
24
|
+
export { ModalService } from './lib/services/modal.service';
|
|
25
|
+
export { NavigationService } from './lib/services/navigation.service';
|
|
26
|
+
export { ObjectService } from './lib/services/object.service';
|
|
27
|
+
export { RestClient } from './lib/services/rest-client.service';
|
|
28
|
+
export { RouteParamService } from './lib/services/route-param.service';
|
|
29
|
+
export { SessionStorageService } from './lib/services/session-storage.service';
|
|
30
|
+
export { UnsavedChangesGuard } from './lib/guards/unsaved-changes.guard';
|
|
31
|
+
export { IDeactivatable } from './lib/models/deactivatable.interface';
|
|
32
|
+
export { Uuid } from './lib/models/uuid.model';
|
|
33
|
+
export { NameValueItem } from './lib/types/name-value-item.type';
|