zavadil-ts-common 1.1.41 → 1.1.43
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/dist/cache/CacheAsync.d.ts +9 -0
- package/dist/cache/HashCacheAsync.d.ts +14 -0
- package/dist/cache/Lazy.d.ts +7 -0
- package/dist/cache/LazyAsync.d.ts +7 -0
- package/dist/cache/index.d.ts +4 -0
- package/dist/client/EntityCachedClient.d.ts +10 -0
- package/dist/client/EntityClient.d.ts +12 -0
- package/dist/client/EntityClientWithStub.d.ts +8 -0
- package/dist/client/LookupClient.d.ts +12 -0
- package/dist/client/RestClient.d.ts +23 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/component/UserAlerts.d.ts +1 -1
- package/dist/component/index.d.ts +0 -8
- package/dist/index.d.ts +218 -160
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/oauth/OAuthRestClient.d.ts +44 -0
- package/dist/oauth/OAuthSubject.d.ts +7 -0
- package/dist/oauth/OAuthTokenManager.d.ts +21 -0
- package/dist/oauth/RestClientWithOAuth.d.ts +18 -0
- package/dist/oauth/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/client/EntityCachedClient.ts +3 -2
- package/src/client/EntityClient.ts +3 -2
- package/src/client/EntityClientWithStub.ts +1 -1
- package/src/client/LookupClient.ts +3 -2
- package/src/component/UserAlerts.ts +2 -2
- package/src/oauth/RestClientWithOAuth.ts +1 -1
@@ -0,0 +1,14 @@
|
|
1
|
+
import { HashCacheStats } from "../type/Stats";
|
2
|
+
export declare class HashCacheAsync<K, V> {
|
3
|
+
private cache;
|
4
|
+
private supplier;
|
5
|
+
private maxSize;
|
6
|
+
constructor(supplier: (k: K) => Promise<V>, maxSize?: number);
|
7
|
+
private obtainCache;
|
8
|
+
get(k: K): Promise<V>;
|
9
|
+
set(k: K, v: V): void;
|
10
|
+
reset(k?: K): void;
|
11
|
+
getSize(): number;
|
12
|
+
getMaxSize(): number;
|
13
|
+
getStats(): HashCacheStats;
|
14
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { EntityClient } from "./EntityClient";
|
2
|
+
import { EntityBase } from "../type/Entity";
|
3
|
+
import { RestClient } from "./RestClient";
|
4
|
+
export declare class EntityCachedClient<T extends EntityBase> extends EntityClient<T> {
|
5
|
+
private cache;
|
6
|
+
constructor(client: RestClient, name: string, maxSize?: number);
|
7
|
+
loadSingle(id: number): Promise<T>;
|
8
|
+
save(d: T): Promise<T>;
|
9
|
+
delete(id: number): Promise<any>;
|
10
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { EntityBase } from "../type/Entity";
|
2
|
+
import { RestClient } from "./RestClient";
|
3
|
+
import { Page, PagingRequest } from "../type";
|
4
|
+
export declare class EntityClient<T extends EntityBase> {
|
5
|
+
client: RestClient;
|
6
|
+
name: string;
|
7
|
+
constructor(client: RestClient, name: string);
|
8
|
+
loadSingle(id: number): Promise<T>;
|
9
|
+
loadPage(pr: PagingRequest): Promise<Page<T>>;
|
10
|
+
save(d: T): Promise<T>;
|
11
|
+
delete(id: number): Promise<any>;
|
12
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { EntityClient } from "./EntityClient";
|
2
|
+
import { EntityBase } from "../type/Entity";
|
3
|
+
export declare class EntityClientWithStub<T extends EntityBase, TStub extends EntityBase> extends EntityClient<T> {
|
4
|
+
loadSingle(id: number): Promise<T>;
|
5
|
+
loadSingleStub(id: number): Promise<TStub>;
|
6
|
+
save(d: T): Promise<T>;
|
7
|
+
saveStub(d: TStub): Promise<TStub>;
|
8
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { EntityClient } from "./EntityClient";
|
2
|
+
import { EntityBase } from "../type/Entity";
|
3
|
+
import { RestClient } from "./RestClient";
|
4
|
+
export declare class LookupClient<T extends EntityBase> extends EntityClient<T> {
|
5
|
+
private cache;
|
6
|
+
constructor(client: RestClient, name: string);
|
7
|
+
private loadAllInternal;
|
8
|
+
loadAll(): Promise<Array<T>>;
|
9
|
+
loadSingle(id: number): Promise<T>;
|
10
|
+
save(d: T): Promise<T>;
|
11
|
+
delete(id: number): Promise<any>;
|
12
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { PagingRequest } from "../type";
|
2
|
+
export type RestClientHeaders = {};
|
3
|
+
export declare class RestClient {
|
4
|
+
private baseUrl;
|
5
|
+
constructor(baseUrl: string);
|
6
|
+
static pagingRequestToQueryParams(pr?: PagingRequest | null): any;
|
7
|
+
/**
|
8
|
+
* Override this to customize http headers.
|
9
|
+
*/
|
10
|
+
getHeaders(): Promise<RestClientHeaders>;
|
11
|
+
paramsToQueryString(params?: any): string;
|
12
|
+
getUrl(endpoint: string, params?: any): string;
|
13
|
+
getRequestOptions(method?: string, data?: object | null): Promise<RequestInit>;
|
14
|
+
processRequest(endpoint: string, requestOptions?: RequestInit): Promise<Response>;
|
15
|
+
processRequestJson(url: string, requestOptions?: object | undefined): Promise<any>;
|
16
|
+
getJson(url: string, params?: any): Promise<any>;
|
17
|
+
postJson(url: string, data?: object | null): Promise<any>;
|
18
|
+
putJson(url: string, data?: object | null): Promise<any>;
|
19
|
+
get(url: string): Promise<Response>;
|
20
|
+
del(url: string): Promise<Response>;
|
21
|
+
post(url: string, data?: object | null): Promise<Response>;
|
22
|
+
put(url: string, data?: object | null): Promise<Response>;
|
23
|
+
}
|
@@ -12,7 +12,7 @@ export declare class UserAlerts {
|
|
12
12
|
remove(alert: UserAlert): void;
|
13
13
|
add(alert: UserAlert): void;
|
14
14
|
custom(type: UserAlertType, message: string): void;
|
15
|
-
err(
|
15
|
+
err(error: string | Error): void;
|
16
16
|
warn(message: string): void;
|
17
17
|
info(message: string): void;
|
18
18
|
getSummary(): Map<UserAlertType, number>;
|
@@ -1,11 +1,3 @@
|
|
1
1
|
export * from './EventManager';
|
2
2
|
export * from './UserAlerts';
|
3
|
-
export * from './RestClient';
|
4
|
-
export * from './OAuthRestClient';
|
5
|
-
export * from './OAuthTokenManager';
|
6
|
-
export * from './OAuthSubject';
|
7
3
|
export * from './CancellablePromise';
|
8
|
-
export * from './Lazy';
|
9
|
-
export * from './LazyAsync';
|
10
|
-
export * from './CacheAsync';
|
11
|
-
export * from './HashCacheAsync';
|
package/dist/index.d.ts
CHANGED
@@ -1,30 +1,66 @@
|
|
1
|
-
declare class
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
1
|
+
declare class CacheAsync<T> {
|
2
|
+
private cache?;
|
3
|
+
private supplier;
|
4
|
+
private maxAgeMs?;
|
5
|
+
private expires?;
|
6
|
+
constructor(supplier: () => Promise<T>, maxAgeMs?: number);
|
7
|
+
get(): Promise<T>;
|
8
|
+
set(v: T): void;
|
9
|
+
}
|
10
|
+
|
11
|
+
type JavaHeapStats = {
|
12
|
+
heapSize: number;
|
13
|
+
heapMaxSize: number;
|
14
|
+
heapFreeSize: number;
|
15
|
+
};
|
16
|
+
type QueueStats = {
|
17
|
+
remaining: number;
|
18
|
+
loaded: number;
|
19
|
+
processed: number;
|
20
|
+
state: string;
|
21
|
+
};
|
22
|
+
type CacheStats = {
|
23
|
+
cachedItems: number;
|
24
|
+
capacity: number;
|
25
|
+
};
|
26
|
+
type HashCacheStats = CacheStats & {};
|
27
|
+
|
28
|
+
declare class HashCacheAsync<K, V> {
|
29
|
+
private cache;
|
30
|
+
private supplier;
|
31
|
+
private maxSize;
|
32
|
+
constructor(supplier: (k: K) => Promise<V>, maxSize?: number);
|
33
|
+
private obtainCache;
|
34
|
+
get(k: K): Promise<V>;
|
35
|
+
set(k: K, v: V): void;
|
36
|
+
reset(k?: K): void;
|
37
|
+
getSize(): number;
|
38
|
+
getMaxSize(): number;
|
39
|
+
getStats(): HashCacheStats;
|
26
40
|
}
|
27
41
|
|
42
|
+
declare class Lazy<T> {
|
43
|
+
private cache?;
|
44
|
+
private supplier;
|
45
|
+
constructor(supplier: () => T);
|
46
|
+
get(): T;
|
47
|
+
reset(): void;
|
48
|
+
}
|
49
|
+
|
50
|
+
declare class LazyAsync<T> {
|
51
|
+
private cache?;
|
52
|
+
private supplier;
|
53
|
+
constructor(supplier: () => Promise<T>);
|
54
|
+
get(): Promise<T>;
|
55
|
+
reset(): void;
|
56
|
+
}
|
57
|
+
|
58
|
+
type EntityBase = {
|
59
|
+
id?: number | null;
|
60
|
+
created_on?: Date;
|
61
|
+
last_update_on?: Date;
|
62
|
+
};
|
63
|
+
|
28
64
|
type SortingField = {
|
29
65
|
name: string;
|
30
66
|
desc?: boolean;
|
@@ -55,86 +91,62 @@ type UserAlert = {
|
|
55
91
|
message: string;
|
56
92
|
};
|
57
93
|
|
58
|
-
type
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
declare class StringUtil extends ObjectUtil {
|
82
|
-
static isEmpty(str: string | null | undefined): boolean;
|
83
|
-
static notEmpty(str: string | null | undefined): boolean;
|
84
|
-
static substr(str: string | null | undefined, start: number, length?: number): string;
|
85
|
-
static replace(str: string | null | undefined, find?: null | string, replace?: string): string;
|
86
|
-
static containsLineBreaks(str: string | null | undefined): boolean;
|
87
|
-
static trimLeadingSlashes(str: string | null): string;
|
88
|
-
static trimTrailingSlashes(str: string | null): string;
|
89
|
-
static trimSlashes(str: string | null): string;
|
90
|
-
static safeTruncate(str: string | null | undefined, len: number, ellipsis?: string): string;
|
91
|
-
static ellipsis(str: string | null | undefined, len: number, ellipsis?: string): string;
|
92
|
-
static safeTrim(str: string | null | undefined): string;
|
93
|
-
static safeLowercase(str: string | null | undefined): string;
|
94
|
-
static safeUppercase(str: string | null | undefined): string;
|
95
|
-
static toBigInt(str: string | null): bigint | null;
|
96
|
-
static getNonEmpty(...args: Array<string | null | undefined>): string;
|
97
|
-
}
|
98
|
-
|
99
|
-
declare class ArrayUtil {
|
100
|
-
static isEmpty(arr?: Array<any> | null): boolean;
|
101
|
-
static notEmpty(arr?: Array<any> | null): boolean;
|
102
|
-
static remove(arr?: Array<any> | null, element?: any): Array<any>;
|
94
|
+
type RestClientHeaders = {};
|
95
|
+
declare class RestClient {
|
96
|
+
private baseUrl;
|
97
|
+
constructor(baseUrl: string);
|
98
|
+
static pagingRequestToQueryParams(pr?: PagingRequest | null): any;
|
99
|
+
/**
|
100
|
+
* Override this to customize http headers.
|
101
|
+
*/
|
102
|
+
getHeaders(): Promise<RestClientHeaders>;
|
103
|
+
paramsToQueryString(params?: any): string;
|
104
|
+
getUrl(endpoint: string, params?: any): string;
|
105
|
+
getRequestOptions(method?: string, data?: object | null): Promise<RequestInit>;
|
106
|
+
processRequest(endpoint: string, requestOptions?: RequestInit): Promise<Response>;
|
107
|
+
processRequestJson(url: string, requestOptions?: object | undefined): Promise<any>;
|
108
|
+
getJson(url: string, params?: any): Promise<any>;
|
109
|
+
postJson(url: string, data?: object | null): Promise<any>;
|
110
|
+
putJson(url: string, data?: object | null): Promise<any>;
|
111
|
+
get(url: string): Promise<Response>;
|
112
|
+
del(url: string): Promise<Response>;
|
113
|
+
post(url: string, data?: object | null): Promise<Response>;
|
114
|
+
put(url: string, data?: object | null): Promise<Response>;
|
103
115
|
}
|
104
116
|
|
105
|
-
declare class
|
106
|
-
|
117
|
+
declare class EntityClient<T extends EntityBase> {
|
118
|
+
client: RestClient;
|
119
|
+
name: string;
|
120
|
+
constructor(client: RestClient, name: string);
|
121
|
+
loadSingle(id: number): Promise<T>;
|
122
|
+
loadPage(pr: PagingRequest): Promise<Page<T>>;
|
123
|
+
save(d: T): Promise<T>;
|
124
|
+
delete(id: number): Promise<any>;
|
107
125
|
}
|
108
126
|
|
109
|
-
declare class
|
110
|
-
|
127
|
+
declare class EntityCachedClient<T extends EntityBase> extends EntityClient<T> {
|
128
|
+
private cache;
|
129
|
+
constructor(client: RestClient, name: string, maxSize?: number);
|
130
|
+
loadSingle(id: number): Promise<T>;
|
131
|
+
save(d: T): Promise<T>;
|
132
|
+
delete(id: number): Promise<any>;
|
111
133
|
}
|
112
134
|
|
113
|
-
declare class
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
static pagingRequestToQueryParams(pr?: PagingRequest | null): any;
|
119
|
-
static pagingRequestToString(pr?: PagingRequest): string;
|
120
|
-
static pagingRequestFromString(pr?: string): PagingRequest;
|
135
|
+
declare class EntityClientWithStub<T extends EntityBase, TStub extends EntityBase> extends EntityClient<T> {
|
136
|
+
loadSingle(id: number): Promise<T>;
|
137
|
+
loadSingleStub(id: number): Promise<TStub>;
|
138
|
+
save(d: T): Promise<T>;
|
139
|
+
saveStub(d: TStub): Promise<TStub>;
|
121
140
|
}
|
122
141
|
|
123
|
-
declare class
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
static formatDuration(ms?: number | null): string;
|
132
|
-
}
|
133
|
-
|
134
|
-
declare class NumberUtil extends ObjectUtil {
|
135
|
-
static parseNumber(str: string | null | undefined): number | null;
|
136
|
-
static round(n: number, d?: number): number;
|
137
|
-
static portionToPercent(p: number, d?: number): string;
|
142
|
+
declare class LookupClient<T extends EntityBase> extends EntityClient<T> {
|
143
|
+
private cache;
|
144
|
+
constructor(client: RestClient, name: string);
|
145
|
+
private loadAllInternal;
|
146
|
+
loadAll(): Promise<Array<T>>;
|
147
|
+
loadSingle(id: number): Promise<T>;
|
148
|
+
save(d: T): Promise<T>;
|
149
|
+
delete(id: number): Promise<any>;
|
138
150
|
}
|
139
151
|
|
140
152
|
type Func = {
|
@@ -162,33 +174,21 @@ declare class UserAlerts {
|
|
162
174
|
remove(alert: UserAlert): void;
|
163
175
|
add(alert: UserAlert): void;
|
164
176
|
custom(type: UserAlertType, message: string): void;
|
165
|
-
err(
|
177
|
+
err(error: string | Error): void;
|
166
178
|
warn(message: string): void;
|
167
179
|
info(message: string): void;
|
168
180
|
getSummary(): Map<UserAlertType, number>;
|
169
181
|
}
|
170
182
|
|
171
|
-
type
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
paramsToQueryString(params?: any): string;
|
181
|
-
getUrl(endpoint: string, params?: any): string;
|
182
|
-
getRequestOptions(method?: string, data?: object | null): Promise<RequestInit>;
|
183
|
-
processRequest(endpoint: string, requestOptions?: RequestInit): Promise<Response>;
|
184
|
-
processRequestJson(url: string, requestOptions?: object | undefined): Promise<any>;
|
185
|
-
getJson(url: string, params?: any): Promise<any>;
|
186
|
-
postJson(url: string, data?: object | null): Promise<any>;
|
187
|
-
putJson(url: string, data?: object | null): Promise<any>;
|
188
|
-
get(url: string): Promise<Response>;
|
189
|
-
del(url: string): Promise<Response>;
|
190
|
-
post(url: string, data?: object | null): Promise<Response>;
|
191
|
-
put(url: string, data?: object | null): Promise<Response>;
|
183
|
+
type CancelledWrapper = {
|
184
|
+
value: boolean;
|
185
|
+
};
|
186
|
+
declare class CancellablePromise {
|
187
|
+
isCancelled: CancelledWrapper;
|
188
|
+
throwWhenCancelled: boolean;
|
189
|
+
promise: Promise<any | void>;
|
190
|
+
constructor(promise: Promise<any | void>, throwWhenCancelled?: boolean);
|
191
|
+
cancel(): void;
|
192
192
|
}
|
193
193
|
|
194
194
|
type TokenRequestPayloadBase = {
|
@@ -264,55 +264,113 @@ declare class OAuthSubject {
|
|
264
264
|
toString(): string;
|
265
265
|
}
|
266
266
|
|
267
|
-
type
|
268
|
-
|
267
|
+
type ServerOAuthInfoPayload = {
|
268
|
+
debugMode?: boolean;
|
269
|
+
targetAudience: string;
|
270
|
+
oauthServerUrl: string;
|
271
|
+
version: string;
|
269
272
|
};
|
270
|
-
declare class
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
constructor(
|
275
|
-
|
273
|
+
declare class RestClientWithOAuth extends RestClient {
|
274
|
+
private tokenManager?;
|
275
|
+
private serverInfo?;
|
276
|
+
private insecureClient;
|
277
|
+
constructor(url: string);
|
278
|
+
getServerInfo(): Promise<ServerOAuthInfoPayload>;
|
279
|
+
getTokenManager(): Promise<OAuthTokenManager>;
|
280
|
+
login(login: string, password: string): Promise<boolean>;
|
281
|
+
getHeaders(): Promise<RestClientHeaders>;
|
276
282
|
}
|
277
283
|
|
278
|
-
declare class
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
get(): T;
|
283
|
-
reset(): void;
|
284
|
+
declare class ObjectUtil {
|
285
|
+
static isEmpty(obj: any): boolean;
|
286
|
+
static notEmpty(obj: any): boolean;
|
287
|
+
static clone<T>(obj: T): T;
|
284
288
|
}
|
285
289
|
|
286
|
-
declare class
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
290
|
+
declare class StringUtil extends ObjectUtil {
|
291
|
+
static isEmpty(str: string | null | undefined): boolean;
|
292
|
+
static notEmpty(str: string | null | undefined): boolean;
|
293
|
+
static substr(str: string | null | undefined, start: number, length?: number): string;
|
294
|
+
static replace(str: string | null | undefined, find?: null | string, replace?: string): string;
|
295
|
+
static containsLineBreaks(str: string | null | undefined): boolean;
|
296
|
+
static trimLeadingSlashes(str: string | null): string;
|
297
|
+
static trimTrailingSlashes(str: string | null): string;
|
298
|
+
static trimSlashes(str: string | null): string;
|
299
|
+
static safeTruncate(str: string | null | undefined, len: number, ellipsis?: string): string;
|
300
|
+
static ellipsis(str: string | null | undefined, len: number, ellipsis?: string): string;
|
301
|
+
static safeTrim(str: string | null | undefined): string;
|
302
|
+
static safeLowercase(str: string | null | undefined): string;
|
303
|
+
static safeUppercase(str: string | null | undefined): string;
|
304
|
+
static toBigInt(str: string | null): bigint | null;
|
305
|
+
static getNonEmpty(...args: Array<string | null | undefined>): string;
|
292
306
|
}
|
293
307
|
|
294
|
-
declare class
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
private expires?;
|
299
|
-
constructor(supplier: () => Promise<T>, maxAgeMs?: number);
|
300
|
-
get(): Promise<T>;
|
301
|
-
set(v: T): void;
|
308
|
+
declare class ArrayUtil {
|
309
|
+
static isEmpty(arr?: Array<any> | null): boolean;
|
310
|
+
static notEmpty(arr?: Array<any> | null): boolean;
|
311
|
+
static remove(arr?: Array<any> | null, element?: any): Array<any>;
|
302
312
|
}
|
303
313
|
|
304
|
-
declare class
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
314
|
+
declare class AsyncUtil {
|
315
|
+
static sleep: (ms: number) => Promise<unknown>;
|
316
|
+
}
|
317
|
+
|
318
|
+
declare class ByteUtil {
|
319
|
+
static formatByteSize(size?: number | null): string;
|
320
|
+
}
|
321
|
+
|
322
|
+
declare class PagingUtil {
|
323
|
+
static sortingFieldToString(s: SortingField): string;
|
324
|
+
static sortingFieldFromString(s: string): SortingField;
|
325
|
+
static sortingRequestToString(s: SortingRequest): string | undefined;
|
326
|
+
static sortingRequestFromString(s?: string | null): SortingRequest;
|
327
|
+
static pagingRequestToQueryParams(pr?: PagingRequest | null): any;
|
328
|
+
static pagingRequestToString(pr?: PagingRequest): string;
|
329
|
+
static pagingRequestFromString(pr?: string): PagingRequest;
|
330
|
+
}
|
331
|
+
|
332
|
+
declare class DateUtil {
|
333
|
+
static formatNumber(n: number, digits?: number): string;
|
334
|
+
static parseDate(d: Date | string | null | undefined): Date | undefined;
|
335
|
+
static formatDateForHumans(d: Date | string | null | undefined, showTime?: boolean): string;
|
336
|
+
static formatDateTimeForHumans(d: Date | string | null | undefined): string;
|
337
|
+
static formatDateForInput(d: any): string;
|
338
|
+
static getDurationMs(d1?: Date | string | null, d2?: Date | string | null): number | null;
|
339
|
+
static getSinceDurationMs(d1?: Date | string | null): number | null;
|
340
|
+
static formatDuration(ms?: number | null): string;
|
341
|
+
}
|
342
|
+
|
343
|
+
declare class NumberUtil extends ObjectUtil {
|
344
|
+
static parseNumber(str: string | null | undefined): number | null;
|
345
|
+
static round(n: number, d?: number): number;
|
346
|
+
static portionToPercent(p: number, d?: number): string;
|
347
|
+
}
|
348
|
+
|
349
|
+
declare class Vector2 {
|
350
|
+
x: number;
|
351
|
+
y: number;
|
352
|
+
constructor(x: number, y: number);
|
353
|
+
distanceTo(v: Vector2): number;
|
354
|
+
equalsTo(v: Vector2): boolean;
|
355
|
+
size(): number;
|
356
|
+
inSize(size: number): Vector2;
|
357
|
+
round(): Vector2;
|
358
|
+
add(v: Vector2): Vector2;
|
359
|
+
multiply(s: number): Vector2;
|
360
|
+
subtract(v: Vector2): Vector2;
|
361
|
+
sub(v: Vector2): Vector2;
|
362
|
+
toArray(): number[];
|
363
|
+
static fromArray(arr: number[]): Vector2 | undefined;
|
364
|
+
clone(): Vector2;
|
365
|
+
/***
|
366
|
+
* Return angle between AB and Y axis in radians
|
367
|
+
* @param {Vector2} b
|
368
|
+
* @returns {number}
|
369
|
+
*/
|
370
|
+
getAngleToYAxis(b: Vector2): number;
|
371
|
+
getNeighborPositions(size?: number, includeCenter?: boolean): Vector2[];
|
372
|
+
getClosest(positions: Vector2[]): Vector2 | null;
|
373
|
+
toString(decimals?: number): string;
|
316
374
|
}
|
317
375
|
|
318
|
-
export { type AccessTokenPayload, ArrayUtil, AsyncUtil, ByteUtil, CacheAsync, type CacheStats, CancellablePromise, DateUtil, EventManager, type Func, type FuncHandlers, type FuncHandlersCache, HashCacheAsync, type HashCacheStats, type IdTokenPayload, type JavaHeapStats, type JwKeyPayload, type JwksPayload, Lazy, LazyAsync, NumberUtil, OAuthRestClient, OAuthSubject, OAuthTokenManager, ObjectUtil, type Page, type PagingRequest, PagingUtil, type QueueStats, type RequestAccessTokenPayload, type RequestIdTokenFromLoginPayload, type RequestIdTokenFromPrevTokenPayload, RestClient, type RestClientHeaders, type SortingField, type SortingRequest, StringUtil, type TokenRequestPayloadBase, type TokenResponsePayloadBase, type UserAlert, UserAlertType, UserAlerts, Vector2 };
|
376
|
+
export { type AccessTokenPayload, ArrayUtil, AsyncUtil, ByteUtil, CacheAsync, type CacheStats, CancellablePromise, DateUtil, EntityCachedClient, EntityClient, EntityClientWithStub, EventManager, type Func, type FuncHandlers, type FuncHandlersCache, HashCacheAsync, type HashCacheStats, type IdTokenPayload, type JavaHeapStats, type JwKeyPayload, type JwksPayload, Lazy, LazyAsync, LookupClient, NumberUtil, OAuthRestClient, OAuthSubject, OAuthTokenManager, ObjectUtil, type Page, type PagingRequest, PagingUtil, type QueueStats, type RequestAccessTokenPayload, type RequestIdTokenFromLoginPayload, type RequestIdTokenFromPrevTokenPayload, RestClient, type RestClientHeaders, RestClientWithOAuth, type ServerOAuthInfoPayload, type SortingField, type SortingRequest, StringUtil, type TokenRequestPayloadBase, type TokenResponsePayloadBase, type UserAlert, UserAlertType, UserAlerts, Vector2 };
|