@endge/utils 0.24.14 → 0.25.3
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/collection/collection.d.ts +2 -2
- package/dist/collection/collection.types.d.ts +10 -10
- package/dist/collection/indexed-collection.d.ts +1 -1
- package/dist/events/ChangeNotifier.d.ts +8 -0
- package/dist/events/EventBus.d.ts +2 -2
- package/dist/execute/NamedExecutor.d.ts +2 -2
- package/dist/index.d.ts +8 -14
- package/dist/shared/serialize/decorator.d.ts +2 -2
- package/dist/tools/logs.d.ts +3 -3
- package/dist/tools/tools.types.d.ts +2 -2
- package/dist/utils.js +347 -445
- package/package.json +11 -17
- package/dist/composable/useCookie.d.ts +0 -1
- package/dist/events/Subscribable.d.ts +0 -31
- package/dist/serialize/useStorageDebounced.d.ts +0 -2
- package/dist/tooltip/TooltipRegistrator.d.ts +0 -15
- package/dist/tooltip/store.d.ts +0 -29
- package/dist/tooltip/tooltip.types.d.ts +0 -10
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CollectionEntity, CollectionEvents } from './collection.types';
|
|
2
|
-
import {
|
|
2
|
+
import { ChangeNotifier } from '../events/ChangeNotifier';
|
|
3
3
|
/**
|
|
4
4
|
* Описывает ответственность Collection в архитектуре проекта.
|
|
5
5
|
*/
|
|
6
|
-
export declare class Collection<T extends CollectionEntity> extends
|
|
6
|
+
export declare class Collection<T extends CollectionEntity> extends ChangeNotifier {
|
|
7
7
|
private items;
|
|
8
8
|
private indices;
|
|
9
9
|
private rootIds;
|
|
@@ -8,28 +8,28 @@ export declare enum Events {
|
|
|
8
8
|
Update = "update",
|
|
9
9
|
IndexCreate = "indexCreate"
|
|
10
10
|
}
|
|
11
|
-
export
|
|
11
|
+
export interface CollectionEvents<T extends CollectionEntity> {
|
|
12
12
|
[Events.Add]: Array<T>;
|
|
13
13
|
[Events.Remove]: Array<T>;
|
|
14
14
|
[Events.Update]: Array<T>;
|
|
15
15
|
[Events.IndexCreate]: keyof T;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
export interface IndexCollectionEntity<ID = string | null> {
|
|
18
18
|
id: ID;
|
|
19
19
|
index: number;
|
|
20
20
|
filteredIndex: number;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export interface CollectionOptions<T extends IndexCollectionEntity<ID>, ID = string | null> {
|
|
23
23
|
sortFn: (a: T, b: T) => number;
|
|
24
24
|
filterFn: (item: T) => boolean;
|
|
25
25
|
indexEnabled: boolean;
|
|
26
26
|
filterIndexEnabled: boolean;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
export interface ReadonlyIndexCollection<T extends IndexCollectionEntity<ID>, ID = string | null> {
|
|
29
|
-
get(id: ID)
|
|
30
|
-
all()
|
|
31
|
-
size()
|
|
32
|
-
unfiltered()
|
|
33
|
-
has(id: ID)
|
|
34
|
-
forEach(callback: (item: T) => void)
|
|
29
|
+
get: (id: ID) => T | undefined;
|
|
30
|
+
all: () => ReadonlyArray<T>;
|
|
31
|
+
size: () => number;
|
|
32
|
+
unfiltered: () => ReadonlyArray<T>;
|
|
33
|
+
has: (id: ID) => boolean;
|
|
34
|
+
forEach: (callback: (item: T) => void) => void;
|
|
35
35
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Внутренний механизм уведомления generic utilities об изменениях. */
|
|
2
|
+
export declare class ChangeNotifier {
|
|
3
|
+
private readonly _listeners;
|
|
4
|
+
/** Подписывает listener на изменения utility owner. */
|
|
5
|
+
subscribe(listener: () => void): () => void;
|
|
6
|
+
/** Уведомляет текущих listeners об изменении. */
|
|
7
|
+
notify(): void;
|
|
8
|
+
}
|
|
@@ -106,12 +106,12 @@ export declare class EventBus<StaticEvents extends Record<string, any>, CustomEv
|
|
|
106
106
|
*/
|
|
107
107
|
clear(event?: string): void;
|
|
108
108
|
}
|
|
109
|
-
export
|
|
109
|
+
export interface GlobalEvents {
|
|
110
110
|
notify: {
|
|
111
111
|
severity: 'success' | 'error' | 'info' | 'warn';
|
|
112
112
|
summary: string;
|
|
113
113
|
detail?: string;
|
|
114
114
|
life?: number;
|
|
115
115
|
};
|
|
116
|
-
}
|
|
116
|
+
}
|
|
117
117
|
export declare const AppBus: EventBus<GlobalEvents, Record<string, any>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
export { useCookie } from './composable/useCookie';
|
|
2
1
|
export * from './collection/collection';
|
|
3
|
-
export * from './collection/indexed-collection';
|
|
4
2
|
export * from './collection/collection.types';
|
|
3
|
+
export * from './collection/indexed-collection';
|
|
5
4
|
export * from './collection/RingBuffer';
|
|
6
|
-
export * from './events/EventBus';
|
|
7
|
-
export * from './events/Subscribable';
|
|
8
5
|
export * from './database/PayloadHttpClient';
|
|
6
|
+
export * from './events/EventBus';
|
|
9
7
|
export * from './execute/delay-executor';
|
|
10
8
|
export * from './execute/NamedExecutor';
|
|
11
|
-
export { toInstance, toPlain } from './shared/serialize/parse';
|
|
12
|
-
export * from './shared/serialize/decorator';
|
|
13
|
-
export { isNullOrUndefined } from './shared/types/maybe';
|
|
14
|
-
export type { Maybe as SharedMaybe } from './shared/types/maybe';
|
|
15
|
-
export * from './serialize/Serialize';
|
|
16
9
|
export * from './serialize/decorators/json';
|
|
17
10
|
export * from './serialize/decorators/jsonString';
|
|
18
11
|
export * from './serialize/decorators/onDeserialized';
|
|
19
12
|
export * from './serialize/decorators/script';
|
|
20
13
|
export * from './serialize/decorators/typeMap';
|
|
21
14
|
export * from './serialize/decorators/typeRecord';
|
|
22
|
-
export * from './serialize/
|
|
15
|
+
export * from './serialize/Serialize';
|
|
16
|
+
export * from './shared/serialize/decorator';
|
|
17
|
+
export { toInstance, toPlain } from './shared/serialize/parse';
|
|
18
|
+
export { isNullOrUndefined } from './shared/types/maybe';
|
|
19
|
+
export type { Maybe as SharedMaybe } from './shared/types/maybe';
|
|
23
20
|
export * from './tools/compare';
|
|
24
21
|
export * from './tools/console';
|
|
25
22
|
export * from './tools/debug';
|
|
@@ -34,9 +31,6 @@ export * from './tools/system-clock';
|
|
|
34
31
|
export * from './tools/text';
|
|
35
32
|
export * from './tools/time';
|
|
36
33
|
export * from './tools/tools.types';
|
|
34
|
+
export * from './ui/tree.types';
|
|
37
35
|
export * from './updates/SSEManager';
|
|
38
36
|
export * from './updates/UPSMeter_Service';
|
|
39
|
-
export * from './tooltip/store';
|
|
40
|
-
export * from './tooltip/TooltipRegistrator';
|
|
41
|
-
export * from './tooltip/tooltip.types';
|
|
42
|
-
export * from './ui/tree.types';
|
|
@@ -5,8 +5,8 @@ export declare function BeforeSerialize(): (target: any, propertyKey: string, _d
|
|
|
5
5
|
export declare function AfterDeserialize(target: any, propertyKey: string, _descriptor: PropertyDescriptor): void;
|
|
6
6
|
export declare function IsOptionalTransformed(validationOptions?: ValidationOptions): (object: object, propertyName: string) => void;
|
|
7
7
|
export interface ISerializable {
|
|
8
|
-
toPlain()
|
|
9
|
-
toJson()
|
|
8
|
+
toPlain: () => any;
|
|
9
|
+
toJson: () => string;
|
|
10
10
|
}
|
|
11
11
|
export declare function DeserializeId(): PropertyDecorator;
|
|
12
12
|
export declare function DeserializeArrayField(field: string): PropertyDecorator;
|
package/dist/tools/logs.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChangeNotifier } from '../events/ChangeNotifier';
|
|
2
2
|
/**
|
|
3
3
|
* Структурированная запись лога.
|
|
4
4
|
*
|
|
@@ -38,7 +38,7 @@ export interface StructuredLogEntry {
|
|
|
38
38
|
* - Иерархического контекста (`context`, `start`, `end`).
|
|
39
39
|
* - Разных уровней (`_debug`, `info`, `warn`, `error`).
|
|
40
40
|
* - Action-кнопок для каждого лога.
|
|
41
|
-
* - Подписки на
|
|
41
|
+
* - Подписки на обновления.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* const logger = new StructuredLogger()
|
|
@@ -61,7 +61,7 @@ export interface StructuredLogEntry {
|
|
|
61
61
|
* // Получаем все логи
|
|
62
62
|
* const logs = logger.getLogs()
|
|
63
63
|
*/
|
|
64
|
-
export declare class StructuredLogger extends
|
|
64
|
+
export declare class StructuredLogger extends ChangeNotifier {
|
|
65
65
|
/** Массив всех логов */
|
|
66
66
|
private logs;
|
|
67
67
|
/** Текущий контекст (иерархия) */
|
|
@@ -89,10 +89,10 @@ export type OneOrMany<T> = T | Array<T>;
|
|
|
89
89
|
/**
|
|
90
90
|
* Тип для активного состояния с вычисляемым значением.
|
|
91
91
|
*/
|
|
92
|
-
export
|
|
92
|
+
export interface ActiveState<T> {
|
|
93
93
|
value: T;
|
|
94
94
|
computed: T;
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
96
|
/**
|
|
97
97
|
* Тип для глубокой частичной рекурсии.
|
|
98
98
|
*/
|