zavadil-react-common 1.0.0 → 1.0.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.
- package/package.json +2 -2
- package/dist/component/AdvancedTable.d.ts +0 -12
- package/dist/component/CancellablePromise.d.ts +0 -11
- package/dist/component/EventManager.d.ts +0 -12
- package/dist/component/OAuthRestClient.d.ts +0 -58
- package/dist/component/OAuthSessionManager.d.ts +0 -23
- package/dist/component/OAuthSubject.d.ts +0 -7
- package/dist/component/RestClient.d.ts +0 -24
- package/dist/component/UserAlerts.d.ts +0 -19
- package/dist/type/Paging.d.ts +0 -17
- package/dist/type/UserAlert.d.ts +0 -6
- package/dist/type/index.d.ts +0 -2
- package/dist/util/ArrayUtil.d.ts +0 -5
- package/dist/util/AsyncUtil.d.ts +0 -3
- package/dist/util/ByteUtil.d.ts +0 -3
- package/dist/util/ObjectUtil.d.ts +0 -5
- package/dist/util/StringUtil.d.ts +0 -14
- package/dist/util/index.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zavadil-react-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Common types for React Typescript UI apps.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"react": "18.3.1",
|
|
31
|
-
"zavadil-ts-common": "1.0.
|
|
31
|
+
"zavadil-ts-common": "1.0.2",
|
|
32
32
|
"bootstrap": "^5.3.0",
|
|
33
33
|
"react-bootstrap": "^2.10.5",
|
|
34
34
|
"react-dom": "^18.2.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { PagingRequest } from 'incomaker-react-ts-commons';
|
|
2
|
-
import { PropsWithChildren } from 'react';
|
|
3
|
-
import { TableHeader } from "../../types/TableHeader";
|
|
4
|
-
export type AdvancedTableProps = {
|
|
5
|
-
header: TableHeader;
|
|
6
|
-
paging: PagingRequest;
|
|
7
|
-
totalPages: number;
|
|
8
|
-
totalItems: number;
|
|
9
|
-
onPagingChanged: (p: PagingRequest) => any;
|
|
10
|
-
};
|
|
11
|
-
declare function AdvancedTable({ header, children, paging, totalPages, totalItems, onPagingChanged }: PropsWithChildren<AdvancedTableProps>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export default AdvancedTable;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type CancelledWrapper = {
|
|
2
|
-
value: boolean;
|
|
3
|
-
};
|
|
4
|
-
export declare class CancellablePromise {
|
|
5
|
-
isCancelled: CancelledWrapper;
|
|
6
|
-
throwWhenCancelled: boolean;
|
|
7
|
-
promise: Promise<any | void>;
|
|
8
|
-
constructor(promise: Promise<any | void>, throwWhenCancelled?: boolean);
|
|
9
|
-
cancel(): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type Func = {
|
|
2
|
-
(arg?: any): void;
|
|
3
|
-
};
|
|
4
|
-
export type FuncHandlers = Array<Func>;
|
|
5
|
-
export type FuncHandlersCache = Map<string, FuncHandlers>;
|
|
6
|
-
export declare class EventManager {
|
|
7
|
-
handlers: FuncHandlersCache;
|
|
8
|
-
constructor();
|
|
9
|
-
addEventListener(event: string, handler: Func): void;
|
|
10
|
-
removeEventListener(event: string, handler: Func): void;
|
|
11
|
-
triggerEvent(event: string, arg?: any): void;
|
|
12
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { RestClient } from "./RestClient";
|
|
2
|
-
export type TokenRequestPayloadBase = {
|
|
3
|
-
targetAudience: string;
|
|
4
|
-
};
|
|
5
|
-
export type RequestAccessTokenPayload = TokenRequestPayloadBase & {
|
|
6
|
-
idToken: string;
|
|
7
|
-
};
|
|
8
|
-
export type RequestIdTokenFromSessionPayload = TokenRequestPayloadBase & {
|
|
9
|
-
sessionId: string;
|
|
10
|
-
};
|
|
11
|
-
export type RequestIdTokenFromLoginPayload = TokenRequestPayloadBase & {
|
|
12
|
-
login: string;
|
|
13
|
-
password: string;
|
|
14
|
-
};
|
|
15
|
-
export type RefreshAccessTokenPayload = TokenRequestPayloadBase & {
|
|
16
|
-
accessToken: string;
|
|
17
|
-
refreshToken: string;
|
|
18
|
-
};
|
|
19
|
-
export type TokenResponsePayloadBase = {
|
|
20
|
-
expires?: Date | null;
|
|
21
|
-
};
|
|
22
|
-
export type IdTokenPayload = TokenResponsePayloadBase & {
|
|
23
|
-
idToken: string;
|
|
24
|
-
};
|
|
25
|
-
export type AccessTokenPayload = TokenResponsePayloadBase & {
|
|
26
|
-
accessToken: string;
|
|
27
|
-
refreshToken: string;
|
|
28
|
-
};
|
|
29
|
-
export type JwKeyPayload = {
|
|
30
|
-
kty: string;
|
|
31
|
-
kid: string;
|
|
32
|
-
n: string;
|
|
33
|
-
e: string;
|
|
34
|
-
};
|
|
35
|
-
export type JwksPayload = {
|
|
36
|
-
keys: Array<JwKeyPayload>;
|
|
37
|
-
};
|
|
38
|
-
export type SessionPayload = {
|
|
39
|
-
session_id: string;
|
|
40
|
-
plugin_id: number;
|
|
41
|
-
user_id: number;
|
|
42
|
-
account_id: number;
|
|
43
|
-
server: string;
|
|
44
|
-
user_name: string;
|
|
45
|
-
timezone: string;
|
|
46
|
-
};
|
|
47
|
-
/**
|
|
48
|
-
* This implements rest client for Incomaker OAuth server - https://gitlab.incomaker.com/apis/oauth-server
|
|
49
|
-
*/
|
|
50
|
-
export declare class OAuthRestClient extends RestClient {
|
|
51
|
-
constructor(baseUrl: string);
|
|
52
|
-
jwks(): Promise<JwksPayload>;
|
|
53
|
-
requestIdTokenFromLogin(request: RequestIdTokenFromLoginPayload): Promise<IdTokenPayload>;
|
|
54
|
-
requestIdTokenFromSession(request: RequestIdTokenFromSessionPayload): Promise<IdTokenPayload>;
|
|
55
|
-
requestAccessToken(request: RequestAccessTokenPayload): Promise<AccessTokenPayload>;
|
|
56
|
-
refreshAccessToken(request: RefreshAccessTokenPayload): Promise<AccessTokenPayload>;
|
|
57
|
-
loadSessionById(sessionId: string): Promise<SessionPayload>;
|
|
58
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { AccessTokenPayload, IdTokenPayload, OAuthRestClient, SessionPayload } from "./OAuthRestClient";
|
|
2
|
-
export declare class OAuthSessionManager {
|
|
3
|
-
oAuthServer: OAuthRestClient;
|
|
4
|
-
audience: string;
|
|
5
|
-
idToken?: IdTokenPayload;
|
|
6
|
-
accessToken?: AccessTokenPayload;
|
|
7
|
-
sessionId?: string;
|
|
8
|
-
session?: SessionPayload;
|
|
9
|
-
constructor(oAuthServerBaseUrl: string, targetAudience: string);
|
|
10
|
-
isTokenExpired(expires?: Date | null): boolean;
|
|
11
|
-
isTokenReadyForRefresh(expires?: Date | null): boolean;
|
|
12
|
-
isValidIdToken(idToken?: IdTokenPayload): boolean;
|
|
13
|
-
hasValidIdToken(): boolean;
|
|
14
|
-
isValidAccessToken(accessToken?: AccessTokenPayload): boolean;
|
|
15
|
-
hasValidAccessToken(): boolean;
|
|
16
|
-
reset(): void;
|
|
17
|
-
initializeSessionId(sessionId: string): void;
|
|
18
|
-
getSession(): Promise<SessionPayload>;
|
|
19
|
-
getIdToken(): Promise<string>;
|
|
20
|
-
getAccessToken(): Promise<string>;
|
|
21
|
-
refreshAccessToken(): void;
|
|
22
|
-
checkAccessTokenRefresh(): void;
|
|
23
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { PagingRequest, SortingField, SortingRequest } from "../type";
|
|
2
|
-
export type RestClientHeaders = {};
|
|
3
|
-
export declare class RestClient {
|
|
4
|
-
private baseUrl;
|
|
5
|
-
constructor(baseUrl: string);
|
|
6
|
-
static sortingFieldToString(s: SortingField): string | undefined;
|
|
7
|
-
static sortingRequestToString(s: SortingRequest): string | undefined;
|
|
8
|
-
static pagingRequestToQueryParams(pr: PagingRequest): any;
|
|
9
|
-
/**
|
|
10
|
-
* Override this to customize http headers.
|
|
11
|
-
*/
|
|
12
|
-
getHeaders(): Promise<RestClientHeaders>;
|
|
13
|
-
getUrl(endpoint: string): string;
|
|
14
|
-
getRequestOptions(method?: string, data?: object | null): Promise<any>;
|
|
15
|
-
processRequest(endpoint: string, requestOptions?: object): Promise<Response>;
|
|
16
|
-
processRequestJson(url: string, requestOptions?: object | undefined): Promise<any>;
|
|
17
|
-
getJson(url: string, params?: any): Promise<any>;
|
|
18
|
-
postJson(url: string, data?: object | null): Promise<any>;
|
|
19
|
-
putJson(url: string, data?: object | null): Promise<any>;
|
|
20
|
-
get(url: string): Promise<Response>;
|
|
21
|
-
del(url: string): Promise<Response>;
|
|
22
|
-
post(url: string, data?: object | null): Promise<Response>;
|
|
23
|
-
put(url: string, data?: object | null): Promise<Response>;
|
|
24
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { UserAlert } from "../type";
|
|
2
|
-
import { Func } from "./EventManager";
|
|
3
|
-
export declare class UserAlerts {
|
|
4
|
-
private lifetimeMs;
|
|
5
|
-
private em;
|
|
6
|
-
alerts: Array<UserAlert>;
|
|
7
|
-
constructor();
|
|
8
|
-
flushAlerts(): void;
|
|
9
|
-
addOnChangeHandler(h: Func): void;
|
|
10
|
-
removeOnChangeHandler(h: Func): void;
|
|
11
|
-
triggerChange(): void;
|
|
12
|
-
reset(): void;
|
|
13
|
-
remove(alert: UserAlert): void;
|
|
14
|
-
add(alert: UserAlert): void;
|
|
15
|
-
custom(type: string, title: string, message: string): void;
|
|
16
|
-
err(message: string): void;
|
|
17
|
-
warn(message: string): void;
|
|
18
|
-
info(message: string): void;
|
|
19
|
-
}
|
package/dist/type/Paging.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export type SortingField = {
|
|
2
|
-
name: string;
|
|
3
|
-
desc?: boolean;
|
|
4
|
-
};
|
|
5
|
-
export type SortingRequest = Array<SortingField>;
|
|
6
|
-
export type PagingRequest = {
|
|
7
|
-
page: number;
|
|
8
|
-
size: number;
|
|
9
|
-
search?: string | null;
|
|
10
|
-
sorting: SortingRequest;
|
|
11
|
-
};
|
|
12
|
-
export type Page<Type> = {
|
|
13
|
-
totalPages: number;
|
|
14
|
-
totalElements: number;
|
|
15
|
-
number: number;
|
|
16
|
-
content: Array<Type>;
|
|
17
|
-
};
|
package/dist/type/UserAlert.d.ts
DELETED
package/dist/type/index.d.ts
DELETED
package/dist/util/ArrayUtil.d.ts
DELETED
package/dist/util/AsyncUtil.d.ts
DELETED
package/dist/util/ByteUtil.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ObjectUtil } from "./ObjectUtil";
|
|
2
|
-
export declare class StringUtil extends ObjectUtil {
|
|
3
|
-
static isEmpty(str: string | null | undefined): boolean;
|
|
4
|
-
static notEmpty(str: string | null | undefined): boolean;
|
|
5
|
-
static substr(str: string | null | undefined, start: number, length?: number): string;
|
|
6
|
-
static replace(str: string | null | undefined, find?: null | string, replace?: string): string;
|
|
7
|
-
static containsLineBreaks(str: string | null | undefined): boolean;
|
|
8
|
-
static trimSlashes(str: string | null): string;
|
|
9
|
-
static safeTruncate(str: string | null | undefined, len: number, ellipsis?: string): string;
|
|
10
|
-
static ellipsis(str: string | null | undefined, len: number, ellipsis?: string): string;
|
|
11
|
-
static safeTrim(str: string | null | undefined): string;
|
|
12
|
-
static toBigInt(str: string | null): bigint | null;
|
|
13
|
-
static getNonEmpty(...args: Array<string | null | undefined>): string;
|
|
14
|
-
}
|