clientnode 4.0.1440 → 4.0.1442
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/Lock.d.ts +39 -0
- package/dist/Logger.d.ts +102 -0
- package/dist/Semaphore.d.ts +29 -0
- package/dist/array.d.ts +150 -0
- package/dist/cli.d.ts +31 -0
- package/dist/constants.d.ts +99 -0
- package/dist/context.d.ts +8 -0
- package/dist/cookie.d.ts +31 -0
- package/dist/data-transfer.d.ts +45 -0
- package/dist/datetime.d.ts +37 -0
- package/dist/domNode.d.ts +82 -0
- package/dist/expression/evaluators.d.ts +55 -0
- package/dist/expression/helper.d.ts +4 -0
- package/dist/expression/index.d.ts +7 -0
- package/dist/expression/indicator-functions.d.ts +14 -0
- package/dist/expression/type.d.ts +70 -0
- package/dist/filesystem.d.ts +143 -0
- package/dist/function.d.ts +20 -0
- package/dist/index.d.ts +23 -0
- package/dist/indicators.d.ts +68 -0
- package/dist/module.d.ts +8 -0
- package/dist/number.d.ts +35 -0
- package/dist/object.d.ts +231 -0
- package/dist/process.d.ts +22 -0
- package/dist/property-types.d.ts +460 -0
- package/dist/scope.d.ts +44 -0
- package/dist/string.d.ts +312 -0
- package/dist/test/Lock.d.ts +1 -0
- package/dist/test/Logger.d.ts +1 -0
- package/dist/test/Semaphore.d.ts +1 -0
- package/dist/test/array.d.ts +1 -0
- package/dist/test/cookie.d.ts +1 -0
- package/dist/test/data-transfer.d.ts +1 -0
- package/dist/test/datetime.d.ts +1 -0
- package/dist/test/domNode.d.ts +1 -0
- package/dist/test/expression/evaluators.d.ts +1 -0
- package/dist/test/expression/helper.d.ts +1 -0
- package/dist/test/expression/indicator-functions.d.ts +1 -0
- package/dist/test/filesystem.d.ts +1 -0
- package/dist/test/function.d.ts +1 -0
- package/dist/test/indicators.d.ts +1 -0
- package/dist/test/number.d.ts +1 -0
- package/dist/test/object.d.ts +1 -0
- package/dist/test/process.d.ts +1 -0
- package/dist/test/property-types.d.ts +1 -0
- package/dist/test/scope.d.ts +1 -0
- package/dist/test/string.d.ts +1 -0
- package/dist/test/utility.d.ts +1 -0
- package/dist/test-helper.d.ts +143 -0
- package/dist/type.d.ts +230 -0
- package/dist/utility.d.ts +44 -0
- package/package.json +2 -2
package/dist/Lock.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { LockCallbackFunction, Mapping } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the lock state.
|
|
4
|
+
* @property locks - Mapping of lock descriptions to their corresponding
|
|
5
|
+
* callbacks.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Lock<Type = string | undefined> {
|
|
8
|
+
lock?: Array<LockCallbackFunction<Type>>;
|
|
9
|
+
locks: Mapping<Array<LockCallbackFunction<Type>>>;
|
|
10
|
+
/**
|
|
11
|
+
* Initializes locks.
|
|
12
|
+
* @param locks - Mapping of a lock description to callbacks for calling
|
|
13
|
+
* when given lock should be released.
|
|
14
|
+
*/
|
|
15
|
+
constructor(locks?: Mapping<Array<LockCallbackFunction<Type>>>);
|
|
16
|
+
/**
|
|
17
|
+
* Calling this method introduces a starting point for a critical area with
|
|
18
|
+
* potential race conditions. The area will be bind to given description
|
|
19
|
+
* string. So don't use same names for different areas.
|
|
20
|
+
* @param description - A short string describing the critical areas
|
|
21
|
+
* properties.
|
|
22
|
+
* @param callback - A procedure which should only be executed if the
|
|
23
|
+
* interpreter isn't in the given critical area. The lock description
|
|
24
|
+
* string will be given to the callback function.
|
|
25
|
+
* @param autoRelease - Release the lock after execution of given callback.
|
|
26
|
+
* @returns Returns a promise which will be resolved after releasing lock.
|
|
27
|
+
*/
|
|
28
|
+
acquire(description?: string, callback?: LockCallbackFunction<Type>, autoRelease?: boolean): Promise<Type>;
|
|
29
|
+
/**
|
|
30
|
+
* Calling this method causes the given critical area to be finished and
|
|
31
|
+
* all functions given to "acquire()" will be executed in right order.
|
|
32
|
+
* @param description - A short string describing the critical areas
|
|
33
|
+
* properties.
|
|
34
|
+
* @returns Returns the return (maybe promise resolved) value of the
|
|
35
|
+
* callback given to the "acquire" method.
|
|
36
|
+
*/
|
|
37
|
+
release(description?: string): Promise<Type | undefined>;
|
|
38
|
+
}
|
|
39
|
+
export default Lock;
|
package/dist/Logger.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { LoggerOptions, Mapping } from './type';
|
|
2
|
+
export declare const LEVELS: readonly ["error", "critical", "warn", "info", "debug"];
|
|
3
|
+
export declare const LEVELS_COLOR: ("\u001B[0;34m" | "\u001B[32m" | "\u001B[35m" | "\u001B[31m" | "\u001B[33m")[];
|
|
4
|
+
export type Level = typeof LEVELS[number];
|
|
5
|
+
/**
|
|
6
|
+
* This plugin provides such interface logic like generic controller logic for
|
|
7
|
+
* integrating plugins into $, mutual exclusion for dependent gui elements,
|
|
8
|
+
* logging additional string, array or function handling. A set of helper
|
|
9
|
+
* functions to parse option objects dom trees or handle events is also
|
|
10
|
+
* provided.
|
|
11
|
+
* @property level - Logging level.
|
|
12
|
+
* @property name - Logger description.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Logger {
|
|
15
|
+
static defaultLevel: Level;
|
|
16
|
+
static defaultName: string;
|
|
17
|
+
static selfClass: typeof Logger;
|
|
18
|
+
static instances: Mapping<Logger>;
|
|
19
|
+
static runtimeVersion: number;
|
|
20
|
+
/**
|
|
21
|
+
* Configures all logger instances.
|
|
22
|
+
* @param options - Options to set.
|
|
23
|
+
*/
|
|
24
|
+
static configureAllInstances(options?: Partial<LoggerOptions>): void;
|
|
25
|
+
level: Level;
|
|
26
|
+
name: string;
|
|
27
|
+
/**
|
|
28
|
+
* Initializes logger.
|
|
29
|
+
* @param options - Options to set.
|
|
30
|
+
*/
|
|
31
|
+
constructor(options?: Partial<LoggerOptions>);
|
|
32
|
+
/**
|
|
33
|
+
* Configures logger.
|
|
34
|
+
* @param options - Options to set.
|
|
35
|
+
* @param options.name - Description of the logger instance.
|
|
36
|
+
* @param options.level - Logging level to configure.
|
|
37
|
+
*/
|
|
38
|
+
configure({ name, level }: Partial<LoggerOptions>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Shows the given object's representation in the browsers console if
|
|
41
|
+
* possible or in a standalone alert-window as fallback.
|
|
42
|
+
* @param object - Any object to print.
|
|
43
|
+
* @param force - If set to "true" given input will be shown independently
|
|
44
|
+
* of current logging configuration or interpreter's console
|
|
45
|
+
* implementation.
|
|
46
|
+
* @param avoidAnnotation - If set to "true" given input has no module or
|
|
47
|
+
* log level specific annotations.
|
|
48
|
+
* @param level - Description of log messages importance.
|
|
49
|
+
* @param additionalArguments - Additional values to print.
|
|
50
|
+
*/
|
|
51
|
+
log(object: unknown, force?: boolean, avoidAnnotation?: boolean, level?: Level, ...additionalArguments: Array<unknown>): void;
|
|
52
|
+
/**
|
|
53
|
+
* Wrapper method for the native console method usually provided by
|
|
54
|
+
* interpreter.
|
|
55
|
+
* @param object - Any object to print.
|
|
56
|
+
* @param additionalArguments - Additional arguments are used for string
|
|
57
|
+
* formatting.
|
|
58
|
+
*/
|
|
59
|
+
info(object: unknown, ...additionalArguments: Array<unknown>): void;
|
|
60
|
+
/**
|
|
61
|
+
* Wrapper method for the native console method usually provided by
|
|
62
|
+
* interpreter.
|
|
63
|
+
* @param object - Any object to print.
|
|
64
|
+
* @param additionalArguments - Additional arguments are used for string
|
|
65
|
+
* formatting.
|
|
66
|
+
*/
|
|
67
|
+
debug(object: unknown, ...additionalArguments: Array<unknown>): void;
|
|
68
|
+
/**
|
|
69
|
+
* Wrapper method for the native console method usually provided by
|
|
70
|
+
* interpreter.
|
|
71
|
+
* @param object - Any object to print.
|
|
72
|
+
* @param additionalArguments - Additional arguments are used for string
|
|
73
|
+
* formatting.
|
|
74
|
+
*/
|
|
75
|
+
error(object: unknown, ...additionalArguments: Array<unknown>): void;
|
|
76
|
+
/**
|
|
77
|
+
* Wrapper method for the native console method usually provided by
|
|
78
|
+
* interpreter.
|
|
79
|
+
* @param object - Any object to print.
|
|
80
|
+
* @param additionalArguments - Additional arguments are used for string
|
|
81
|
+
* formatting.
|
|
82
|
+
*/
|
|
83
|
+
critical(object: unknown, ...additionalArguments: Array<unknown>): void;
|
|
84
|
+
/**
|
|
85
|
+
* Wrapper method for the native console method usually provided by
|
|
86
|
+
* interpreter.
|
|
87
|
+
* @param object - Any object to print.
|
|
88
|
+
* @param additionalArguments - Additional arguments are used for string
|
|
89
|
+
* formatting.
|
|
90
|
+
*/
|
|
91
|
+
warn(object: unknown, ...additionalArguments: Array<unknown>): void;
|
|
92
|
+
/**
|
|
93
|
+
* Dumps a given object in a human-readable format.
|
|
94
|
+
* @param object - Any object to show.
|
|
95
|
+
* @param level - Number of levels to dig into given object recursively.
|
|
96
|
+
* @param currentLevel - Maximal number of recursive function calls to
|
|
97
|
+
* represent given object.
|
|
98
|
+
* @returns Returns the serialized version of given object.
|
|
99
|
+
*/
|
|
100
|
+
static show(object: unknown, level?: number, currentLevel?: number): string;
|
|
101
|
+
}
|
|
102
|
+
export default Logger;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { AnyFunction } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the semaphore state.
|
|
4
|
+
* @property queue - List of waiting resource requests.
|
|
5
|
+
* @property numberOfFreeResources - Number free allowed concurrent resource
|
|
6
|
+
* uses.
|
|
7
|
+
* @property numberOfResources - Number of allowed concurrent resource uses.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Semaphore {
|
|
10
|
+
queue: Array<AnyFunction>;
|
|
11
|
+
numberOfResources: number;
|
|
12
|
+
numberOfFreeResources: number;
|
|
13
|
+
/**
|
|
14
|
+
* Initializes number of resources.
|
|
15
|
+
* @param numberOfResources - Number of resources to manage.
|
|
16
|
+
*/
|
|
17
|
+
constructor(numberOfResources?: number);
|
|
18
|
+
/**
|
|
19
|
+
* Acquires a new resource and runs given callback if available.
|
|
20
|
+
* @returns A promise which will be resolved if requested resource is
|
|
21
|
+
* available.
|
|
22
|
+
*/
|
|
23
|
+
acquire(): Promise<number>;
|
|
24
|
+
/**
|
|
25
|
+
* Releases a resource and runs a waiting resolver if there exists some.
|
|
26
|
+
*/
|
|
27
|
+
release(): void;
|
|
28
|
+
}
|
|
29
|
+
export default Semaphore;
|
package/dist/array.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { Mapping, Page, PaginateOptions } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* Summarizes given property of given item list.
|
|
4
|
+
* @param data - Array of objects with given property name.
|
|
5
|
+
* @param propertyName - Property name to summarize.
|
|
6
|
+
* @param defaultValue - Value to return if property values doesn't match.
|
|
7
|
+
* @returns Aggregated value.
|
|
8
|
+
*/
|
|
9
|
+
export declare const aggregatePropertyIfEqual: <T = unknown>(data: Array<Mapping<unknown>>, propertyName: string, defaultValue?: T) => T;
|
|
10
|
+
/**
|
|
11
|
+
* Deletes every item witch has only empty attributes for given property names.
|
|
12
|
+
* If given property names are empty each attribute will be considered. The
|
|
13
|
+
* empty string, "null" and "undefined" will be interpreted as empty.
|
|
14
|
+
* @param data - Data to filter.
|
|
15
|
+
* @param propertyNames - Properties to consider.
|
|
16
|
+
* @returns Given data without empty items.
|
|
17
|
+
*/
|
|
18
|
+
export declare const deleteEmptyItems: <T extends Mapping<unknown> = Mapping<unknown>>(data: Array<T>, propertyNames?: Array<string | symbol>) => Array<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Extracts all properties from all items which occur in given property names.
|
|
21
|
+
* @param data - Data where each item should be sliced.
|
|
22
|
+
* @param propertyNames - Property names to extract.
|
|
23
|
+
* @returns Data with sliced items.
|
|
24
|
+
*/
|
|
25
|
+
export declare const extract: <T = Mapping<unknown>>(data: unknown, propertyNames: Array<string>) => Array<T>;
|
|
26
|
+
/**
|
|
27
|
+
* Extracts all values which matches given regular expression.
|
|
28
|
+
* @param data - Data to filter.
|
|
29
|
+
* @param regularExpression - Pattern to match for.
|
|
30
|
+
* @returns Filtered data.
|
|
31
|
+
*/
|
|
32
|
+
export declare const extractIfMatches: (data: unknown, regularExpression: string | RegExp) => Array<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Filters given data if given property is set or not.
|
|
35
|
+
* @param data - Data to filter.
|
|
36
|
+
* @param propertyName - Property name to check for existence.
|
|
37
|
+
* @returns Given data without the items which doesn't have specified property.
|
|
38
|
+
*/
|
|
39
|
+
export declare const extractIfPropertyExists: <T extends Mapping<unknown> = Mapping<unknown>>(data: unknown, propertyName: string) => Array<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Extract given data where specified property value matches given patterns.
|
|
42
|
+
* @param data - Data to filter.
|
|
43
|
+
* @param propertyPattern - Mapping of property names to pattern.
|
|
44
|
+
* @returns Filtered data.
|
|
45
|
+
*/
|
|
46
|
+
export declare const extractIfPropertyMatches: <T = unknown>(data: unknown, propertyPattern: Mapping<RegExp | string>) => Array<T>;
|
|
47
|
+
/**
|
|
48
|
+
* Determines all objects which exists in "first" and in "second".
|
|
49
|
+
* Object key which will be compared are given by "keys". If an empty array is
|
|
50
|
+
* given each key will be compared. If an object is given corresponding initial
|
|
51
|
+
* data key will be mapped to referenced new data key.
|
|
52
|
+
* @param first - Referenced data to check for.
|
|
53
|
+
* @param second - Data to check for existence.
|
|
54
|
+
* @param keys - Keys to define equality.
|
|
55
|
+
* @param strict - The strict parameter indicates whether "null" and
|
|
56
|
+
* "undefined" should be interpreted as equal (takes only effect if given keys
|
|
57
|
+
* aren't empty).
|
|
58
|
+
* @returns Data which does exit in given initial data.
|
|
59
|
+
*/
|
|
60
|
+
export declare const intersect: <T = unknown>(first: unknown, second: unknown, keys?: Array<string> | Mapping<number | string>, strict?: boolean) => Array<T>;
|
|
61
|
+
/**
|
|
62
|
+
* Converts given object into an array.
|
|
63
|
+
* @param object - Target to convert.
|
|
64
|
+
* @returns Generated array.
|
|
65
|
+
*/
|
|
66
|
+
export declare const makeArray: <T = unknown>(object: unknown) => Array<T>;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a list of items within given range.
|
|
69
|
+
* @param range - Array of lower and upper bounds. If only one value is given
|
|
70
|
+
* lower bound will be assumed to be zero. Both integers have to be positive
|
|
71
|
+
* and will be contained in the resulting array. If more than two numbers are
|
|
72
|
+
* provided given range will be returned.
|
|
73
|
+
* @param step - Space between two consecutive values.
|
|
74
|
+
* @param ignoreLastStep - Removes last step.
|
|
75
|
+
* @returns Produced array of integers.
|
|
76
|
+
*/
|
|
77
|
+
export declare const makeRange: (range: number | Array<number> | [number] | [number, number], step?: number, ignoreLastStep?: boolean) => Array<number>;
|
|
78
|
+
/**
|
|
79
|
+
* Merge the contents of two arrays together into the first array.
|
|
80
|
+
* @param target - Target array.
|
|
81
|
+
* @param source - Source array.
|
|
82
|
+
* @returns Target array with merged given source one.
|
|
83
|
+
*/
|
|
84
|
+
export declare const merge: <T = unknown>(target: Array<T>, source: Array<T>) => Array<T>;
|
|
85
|
+
/**
|
|
86
|
+
* Generates a list if pagination symbols to render a pagination from.
|
|
87
|
+
* @param options - Configure bounds and current page of pagination to
|
|
88
|
+
* determine.
|
|
89
|
+
* @param options.boundaryCount - Indicates where to start pagination within
|
|
90
|
+
* given total range.
|
|
91
|
+
* @param options.disabled - Indicates whether to disable all items.
|
|
92
|
+
* @param options.hideNextButton - Indicates whether to show a jump to next
|
|
93
|
+
* item.
|
|
94
|
+
* @param options.hidePrevButton - Indicates whether to show a jump to previous
|
|
95
|
+
* item.
|
|
96
|
+
* @param options.page - Indicates current visible page.
|
|
97
|
+
* @param options.pageSize - Number of items per page.
|
|
98
|
+
* @param options.showFirstButton - Indicates whether to show a jump to first
|
|
99
|
+
* item.
|
|
100
|
+
* @param options.showLastButton - Indicates whether to show a jump to last
|
|
101
|
+
* item.
|
|
102
|
+
* @param options.siblingCount - Number of sibling page symbols next to current
|
|
103
|
+
* page symbol.
|
|
104
|
+
* @param options.total - Number of all items to paginate.
|
|
105
|
+
* @returns A list of pagination symbols.
|
|
106
|
+
*/
|
|
107
|
+
export declare const paginate: (options?: Partial<PaginateOptions>) => Array<Page>;
|
|
108
|
+
/**
|
|
109
|
+
* Generates all permutations of given iterable.
|
|
110
|
+
* @param data - Array like object.
|
|
111
|
+
* @returns Array of permuted arrays.
|
|
112
|
+
*/
|
|
113
|
+
export declare const permute: <T = unknown>(data: Array<T>) => Array<Array<T>>;
|
|
114
|
+
/**
|
|
115
|
+
* Generates all lengths permutations of given iterable.
|
|
116
|
+
* @param data - Array like object.
|
|
117
|
+
* @param minimalSubsetLength - Defines how long the minimal subset length
|
|
118
|
+
* should be.
|
|
119
|
+
* @returns Array of permuted arrays.
|
|
120
|
+
*/
|
|
121
|
+
export declare const permuteLength: <T = unknown>(data: Array<T>, minimalSubsetLength?: number) => Array<Array<T>>;
|
|
122
|
+
/**
|
|
123
|
+
* Sums up given property of given item list.
|
|
124
|
+
* @param data - The objects with specified property to sum up.
|
|
125
|
+
* @param propertyName - Property name to sum up its value.
|
|
126
|
+
* @returns The aggregated value.
|
|
127
|
+
*/
|
|
128
|
+
export declare const sumUpProperty: (data: unknown, propertyName: string) => number;
|
|
129
|
+
/**
|
|
130
|
+
* Removes given target on given list.
|
|
131
|
+
* @param list - Array to splice.
|
|
132
|
+
* @param target - Target to remove from given list.
|
|
133
|
+
* @param strict - Indicates whether to fire an exception if given target
|
|
134
|
+
* doesn't exist given list.
|
|
135
|
+
* @returns Item with the appended target.
|
|
136
|
+
*/
|
|
137
|
+
export declare const removeArrayItem: <T = unknown>(list: Array<T>, target: T, strict?: boolean) => Array<T>;
|
|
138
|
+
/**
|
|
139
|
+
* Sorts given object of dependencies in a topological order.
|
|
140
|
+
* @param items - Items to sort.
|
|
141
|
+
* @returns Sorted array of given items respecting their dependencies.
|
|
142
|
+
*/
|
|
143
|
+
export declare const sortTopological: (items: Mapping<Array<string> | string>) => Array<string>;
|
|
144
|
+
/**
|
|
145
|
+
* Makes all values in given iterable unique by removing duplicates (The first
|
|
146
|
+
* occurrences will be left).
|
|
147
|
+
* @param data - Array like object.
|
|
148
|
+
* @returns Sliced version of given object.
|
|
149
|
+
*/
|
|
150
|
+
export declare const unique: <T = unknown>(data: Array<T>) => Array<T>;
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const CLI_COLOR: {
|
|
2
|
+
readonly black: "\u001B[30m";
|
|
3
|
+
readonly blink: "\u001B[5m";
|
|
4
|
+
readonly blue: "\u001B[0;34m";
|
|
5
|
+
readonly bold: "\u001B[1m";
|
|
6
|
+
readonly cyan: "\u001B[36m";
|
|
7
|
+
readonly darkGray: "\u001B[0;90m";
|
|
8
|
+
readonly default: "\u001B[0m";
|
|
9
|
+
readonly dim: "\u001B[2m";
|
|
10
|
+
readonly green: "\u001B[32m";
|
|
11
|
+
readonly invert: "\u001B[7m";
|
|
12
|
+
readonly invisible: "\u001B[8m";
|
|
13
|
+
readonly lightBlue: "\u001B[0;94m";
|
|
14
|
+
readonly lightCyan: "\u001B[0;96m";
|
|
15
|
+
readonly lightGray: "\u001B[0;37m";
|
|
16
|
+
readonly lightGreen: "\u001B[0;92m";
|
|
17
|
+
readonly lightMagenta: "\u001B[0;95m";
|
|
18
|
+
readonly lightRed: "\u001B[0;91m";
|
|
19
|
+
readonly lightYellow: "\u001B[0;93m";
|
|
20
|
+
readonly magenta: "\u001B[35m";
|
|
21
|
+
readonly nodim: "\u001B[22m";
|
|
22
|
+
readonly noblink: "\u001B[25m";
|
|
23
|
+
readonly nobold: "\u001B[21m";
|
|
24
|
+
readonly noinvert: "\u001B[27m";
|
|
25
|
+
readonly noinvisible: "\u001B[28m";
|
|
26
|
+
readonly nounderline: "\u001B[24m";
|
|
27
|
+
readonly red: "\u001B[31m";
|
|
28
|
+
readonly underline: "\u001B[4m";
|
|
29
|
+
readonly white: "\u001B[37m";
|
|
30
|
+
readonly yellow: "\u001B[33m";
|
|
31
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Encoding, FirstParameter } from './type';
|
|
2
|
+
export { Lock } from './Lock';
|
|
3
|
+
export { Semaphore } from './Semaphore';
|
|
4
|
+
export declare const DEFAULT_ENCODING: Encoding;
|
|
5
|
+
export declare const CLOSE_EVENT_NAMES: readonly ["close", "exit", "SIGINT", "SIGTERM", "SIGQUIT", "uncaughtException"];
|
|
6
|
+
export declare const CONSOLE_METHODS: readonly ["debug", "error", "info", "log", "warn"];
|
|
7
|
+
export declare const VALUE_COPY_SYMBOL: unique symbol;
|
|
8
|
+
export declare const IGNORE_NULL_AND_UNDEFINED_SYMBOL: unique symbol;
|
|
9
|
+
export declare const ABBREVIATIONS: Array<string>;
|
|
10
|
+
export declare const ANIMATION_END_EVENT_NAMES = "animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd";
|
|
11
|
+
export declare const CLASS_TO_TYPE_MAPPING: {
|
|
12
|
+
readonly '[object Array]': "array";
|
|
13
|
+
readonly '[object Boolean]': "boolean";
|
|
14
|
+
readonly '[object Date]': "date";
|
|
15
|
+
readonly '[object Error]': "error";
|
|
16
|
+
readonly '[object Function]': "function";
|
|
17
|
+
readonly '[object Map]': "map";
|
|
18
|
+
readonly '[object Number]': "number";
|
|
19
|
+
readonly '[object Object]': "object";
|
|
20
|
+
readonly '[object RegExp]': "regexp";
|
|
21
|
+
readonly '[object Set]': "set";
|
|
22
|
+
readonly '[object String]': "string";
|
|
23
|
+
};
|
|
24
|
+
export declare const KEY_CODES: {
|
|
25
|
+
readonly BACKSPACE: 8;
|
|
26
|
+
readonly SPACE: 32;
|
|
27
|
+
readonly TAB: 9;
|
|
28
|
+
readonly DELETE: 46;
|
|
29
|
+
readonly ENTER: 13;
|
|
30
|
+
readonly COMMA: 188;
|
|
31
|
+
readonly PERIOD: 190;
|
|
32
|
+
readonly END: 35;
|
|
33
|
+
readonly ESCAPE: 27;
|
|
34
|
+
readonly F1: 112;
|
|
35
|
+
readonly F2: 113;
|
|
36
|
+
readonly F3: 114;
|
|
37
|
+
readonly F4: 115;
|
|
38
|
+
readonly F5: 116;
|
|
39
|
+
readonly F6: 117;
|
|
40
|
+
readonly F7: 118;
|
|
41
|
+
readonly F8: 119;
|
|
42
|
+
readonly F9: 120;
|
|
43
|
+
readonly F10: 121;
|
|
44
|
+
readonly F11: 122;
|
|
45
|
+
readonly F12: 123;
|
|
46
|
+
readonly HOME: 36;
|
|
47
|
+
readonly NUMPAD_ADD: 107;
|
|
48
|
+
readonly NUMPAD_SUBTRACT: 109;
|
|
49
|
+
readonly NUMPAD_DECIMAL: 110;
|
|
50
|
+
readonly NUMPAD_DIVIDE: 111;
|
|
51
|
+
readonly NUMPAD_ENTER: 108;
|
|
52
|
+
readonly NUMPAD_MULTIPLY: 106;
|
|
53
|
+
readonly PAGE_UP: 33;
|
|
54
|
+
readonly PAGE_DOWN: 34;
|
|
55
|
+
readonly UP: 38;
|
|
56
|
+
readonly DOWN: 40;
|
|
57
|
+
readonly LEFT: 37;
|
|
58
|
+
readonly RIGHT: 39;
|
|
59
|
+
};
|
|
60
|
+
export declare const KEYBOARD_CODES: {
|
|
61
|
+
readonly BACKSPACE: "Backspace";
|
|
62
|
+
readonly SPACE: "Space";
|
|
63
|
+
readonly TAB: "Tab";
|
|
64
|
+
readonly DELETE: "Delete";
|
|
65
|
+
readonly ENTER: "Enter";
|
|
66
|
+
readonly COMMA: "Comma";
|
|
67
|
+
readonly PERIOD: "Period";
|
|
68
|
+
readonly END: "End";
|
|
69
|
+
readonly ESCAPE: "Escape";
|
|
70
|
+
readonly F1: "F1";
|
|
71
|
+
readonly F2: "F2";
|
|
72
|
+
readonly F3: "F3";
|
|
73
|
+
readonly F4: "F4";
|
|
74
|
+
readonly F5: "F5";
|
|
75
|
+
readonly F6: "F6";
|
|
76
|
+
readonly F7: "F7";
|
|
77
|
+
readonly F8: "F8";
|
|
78
|
+
readonly F9: "F9";
|
|
79
|
+
readonly F10: "F10";
|
|
80
|
+
readonly F11: "F111";
|
|
81
|
+
readonly F12: "F12";
|
|
82
|
+
readonly HOME: "Home";
|
|
83
|
+
readonly NUMPAD_ADD: "NumpadAdd";
|
|
84
|
+
readonly NUMPAD_SUBTRACT: "NumpadSubtract";
|
|
85
|
+
readonly NUMPAD_DECIMAL: "NumpadDecimal";
|
|
86
|
+
readonly NUMPAD_DIVIDE: "NumpadDivide";
|
|
87
|
+
readonly NUMPAD_ENTER: "NumpadEnter";
|
|
88
|
+
readonly NUMPAD_MULTIPLY: "NumpadMultiply";
|
|
89
|
+
readonly PAGE_UP: "PageUp";
|
|
90
|
+
readonly PAGE_DOWN: "PageUp";
|
|
91
|
+
readonly UP: "ArrowUp";
|
|
92
|
+
readonly DOWN: "ArrowDown";
|
|
93
|
+
readonly LEFT: "ArrowLeft";
|
|
94
|
+
readonly RIGHT: "ArrowUp";
|
|
95
|
+
};
|
|
96
|
+
export declare const LOCALES: Array<string>;
|
|
97
|
+
export declare const PLAIN_OBJECT_PROTOTYPES: Array<FirstParameter<typeof Object.getPrototypeOf>>;
|
|
98
|
+
export declare const SPECIAL_REGEX_SEQUENCES: Array<string>;
|
|
99
|
+
export declare const TRANSITION_END_EVENT_NAMES = "transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AnyFunction } from './type';
|
|
2
|
+
export declare let globalContext: Partial<typeof globalThis>;
|
|
3
|
+
export declare const setGlobalContext: (context: typeof globalThis) => void;
|
|
4
|
+
export declare const MAXIMAL_NUMBER_OF_ITERATIONS: {
|
|
5
|
+
value: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const NOOP: AnyFunction;
|
|
8
|
+
export declare const mockConsole: () => void;
|
package/dist/cookie.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { CookieOptions } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* Deletes a cookie value by given name.
|
|
4
|
+
* @param name - Name to identify requested value.
|
|
5
|
+
*/
|
|
6
|
+
export declare const deleteCookie: (name: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Gets a cookie value by given name.
|
|
9
|
+
* @param name - Name to identify requested value.
|
|
10
|
+
* @returns Requested value.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getCookie: (name: string) => string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Sets a cookie key-value-pair.
|
|
15
|
+
* @param name - Name to identify given value.
|
|
16
|
+
* @param value - Value to set.
|
|
17
|
+
* @param givenOptions - Cookie set options.
|
|
18
|
+
* @param givenOptions.domain - Domain to reference with given key-value-pair.
|
|
19
|
+
* @param givenOptions.httpOnly - Indicates if this cookie should be accessible
|
|
20
|
+
* from client or not.
|
|
21
|
+
* @param givenOptions.minimal - Set only minimum number of options.
|
|
22
|
+
* @param givenOptions.numberOfDaysUntilExpiration - Number of days until given
|
|
23
|
+
* key shouldn't be deleted.
|
|
24
|
+
* @param givenOptions.path - Path to reference with given key-value-pair.
|
|
25
|
+
* @param givenOptions.sameSite - Set same site policy to "Lax", "None" or
|
|
26
|
+
* "Strict".
|
|
27
|
+
* @param givenOptions.secure - Indicates if this cookie is only valid for
|
|
28
|
+
* "https" connections.
|
|
29
|
+
* @returns A boolean indicating whether cookie could be set or not.
|
|
30
|
+
*/
|
|
31
|
+
export declare const setCookie: (name: string, value: string, givenOptions?: Partial<CookieOptions>) => boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { CheckReachabilityOptions, RecursivePartial } from './type';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if given url response with given status code.
|
|
4
|
+
* @param url - Url to check reachability.
|
|
5
|
+
* @param givenOptions - Options to configure.
|
|
6
|
+
* @param givenOptions.wait - Boolean indicating if we should retry until a
|
|
7
|
+
* status code will be given.
|
|
8
|
+
* @param givenOptions.statusCodes - Status codes to check for.
|
|
9
|
+
* @param givenOptions.timeoutInSeconds - Delay after assuming given resource
|
|
10
|
+
* isn't available if no response is coming.
|
|
11
|
+
* @param givenOptions.pollIntervallInSeconds - Seconds between two tries to
|
|
12
|
+
* reach given url.
|
|
13
|
+
* @param givenOptions.options - Fetch options to use.
|
|
14
|
+
* @param givenOptions.expectedIntermediateStatusCodes - A list of expected but
|
|
15
|
+
* unwanted response codes. If detecting them waiting will continue until an
|
|
16
|
+
* expected (positive) code occurs or timeout is reached.
|
|
17
|
+
* @returns A promise which will be resolved if a request to given url has
|
|
18
|
+
* finished and resulting status code matches given expected status code.
|
|
19
|
+
* Otherwise, returned promise will be rejected.
|
|
20
|
+
*/
|
|
21
|
+
export declare const checkReachability: (url: string, givenOptions?: RecursivePartial<CheckReachabilityOptions>) => ReturnType<typeof fetch>;
|
|
22
|
+
/**
|
|
23
|
+
* Checks if given url isn't reachable.
|
|
24
|
+
* @param url - Url to check reachability.
|
|
25
|
+
* @param givenOptions - Options to configure.
|
|
26
|
+
* @param givenOptions.wait - Boolean indicating if we should retry until a
|
|
27
|
+
* status code will be given.
|
|
28
|
+
* @param givenOptions.timeoutInSeconds - Delay after assuming given resource
|
|
29
|
+
* will stay available.
|
|
30
|
+
* @param givenOptions.pollIntervallInSeconds - Seconds between two tries to
|
|
31
|
+
* reach given url.
|
|
32
|
+
* @param givenOptions.statusCodes - Status codes to check for.
|
|
33
|
+
* @param givenOptions.options - Fetch options to use.
|
|
34
|
+
* @returns A promise which will be resolved if a request to given url couldn't
|
|
35
|
+
* be finished. Otherwise, returned promise will be rejected. If "wait" is set
|
|
36
|
+
* to "true" we will resolve to another promise still resolving when final
|
|
37
|
+
* timeout is reached or the endpoint is unreachable (after some tries).
|
|
38
|
+
*/
|
|
39
|
+
export declare const checkUnreachability: (url: string, givenOptions?: RecursivePartial<CheckReachabilityOptions>) => Promise<Error | null | Promise<Error | null>>;
|
|
40
|
+
/**
|
|
41
|
+
* Preloads a given url via a temporary created image element.
|
|
42
|
+
* @param url - To image which should be downloaded.
|
|
43
|
+
* @returns A Promise indicating whether the image was loaded.
|
|
44
|
+
*/
|
|
45
|
+
export declare const cacheImage: (url: string) => Promise<void>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SecondParameter } from './type';
|
|
2
|
+
export declare const DATE_TIME_PATTERN_CACHE: Array<RegExp>;
|
|
3
|
+
/**
|
|
4
|
+
* Formats given date or current via given format specification.
|
|
5
|
+
* @param format - Format specification.
|
|
6
|
+
* @param dateTime - Date time to format.
|
|
7
|
+
* @param options - Additional configuration options for "Intl.DateTimeFormat".
|
|
8
|
+
* @param locales - Locale or list of locales to use for formatting. First one
|
|
9
|
+
* take precedence of latter ones.
|
|
10
|
+
* @returns Formatted date time string.
|
|
11
|
+
*/
|
|
12
|
+
export declare const dateTimeFormat: (format?: string, dateTime?: Date | number | string, options?: SecondParameter<typeof Intl.DateTimeFormat>, locales?: Array<string> | string) => string;
|
|
13
|
+
/**
|
|
14
|
+
* Interprets given content string as date time.
|
|
15
|
+
* @param value - Date time string to interpret.
|
|
16
|
+
* @param interpretAsUTC - Identifies if given date should be interpreted as
|
|
17
|
+
* utc. If not set given strings will be interpreted as it is depended on
|
|
18
|
+
* given format and number like string as utc.
|
|
19
|
+
* @returns Interpret date time object.
|
|
20
|
+
*/
|
|
21
|
+
export declare const interpretDateTime: (value: string, interpretAsUTC?: boolean | null) => Date | null;
|
|
22
|
+
/**
|
|
23
|
+
* Interprets a date object from given artefact.
|
|
24
|
+
* @param value - To interpret.
|
|
25
|
+
* @param interpretAsUTC - Identifies if given date should be interpreted as
|
|
26
|
+
* utc. If not set given strings will be interpreted as it is dependent on
|
|
27
|
+
* given format and numbers as utc.
|
|
28
|
+
* @returns Interpreted date object or "null" if given value couldn't be
|
|
29
|
+
* interpreted.
|
|
30
|
+
*/
|
|
31
|
+
export declare const normalizeDateTime: (value?: string | null | number | Date, interpretAsUTC?: boolean | null) => Date | null;
|
|
32
|
+
/**
|
|
33
|
+
* Slice weekday from given date representation.
|
|
34
|
+
* @param value - String to process.
|
|
35
|
+
* @returns Sliced given string.
|
|
36
|
+
*/
|
|
37
|
+
export declare const sliceWeekday: (value: string) => string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { GivenInterruptableScrollToOptions, KnownEventName } from './type';
|
|
2
|
+
export declare const createDomNodes: <Type extends Node = Node>(html: string) => Type;
|
|
3
|
+
export declare const fade: (domNode: HTMLElement, intervalInMilliseconds?: number, out?: boolean) => Promise<void> & {
|
|
4
|
+
clear: () => void;
|
|
5
|
+
resetStyles: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const fadeIn: (domNode: HTMLElement, intervalInMilliseconds?: number) => Promise<void> & {
|
|
8
|
+
clear: () => void;
|
|
9
|
+
resetStyles: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const fadeOut: (domNode: HTMLElement, intervalInMilliseconds?: number) => Promise<void> & {
|
|
12
|
+
clear: () => void;
|
|
13
|
+
resetStyles: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const STOP_AUTO_SCROLLING: {
|
|
16
|
+
value: import("./type").AnyFunction;
|
|
17
|
+
};
|
|
18
|
+
export declare const MANUAL_SCROLL_EVENT_NAMES: Array<KnownEventName>;
|
|
19
|
+
export declare const SCROLL_EVENT_NAMES: Array<KnownEventName>;
|
|
20
|
+
/**
|
|
21
|
+
* Smoothly scrolls both horizontally and vertically to a target DOM node.
|
|
22
|
+
* Cancels instantly if the user interacts with the mouse, touch, or keys.
|
|
23
|
+
* @param givenOptions - Configuration options.
|
|
24
|
+
* @param givenOptions.targetDomNode - The DOM node you want to scroll to.
|
|
25
|
+
* @param givenOptions.containerDomNode - The scrollable parent.
|
|
26
|
+
* @param givenOptions.durationInMilliseconds - Animation duration in
|
|
27
|
+
* milliseconds.
|
|
28
|
+
* @param givenOptions.interruptOnManualScroll - Whether to stop the animation
|
|
29
|
+
* if the user starts to scroll manually.
|
|
30
|
+
* @param givenOptions.offset - Pixel offsets.
|
|
31
|
+
* @param givenOptions.offset.top - Vertical offset in pixels.
|
|
32
|
+
* @param givenOptions.offset.left - Horizontal offset in pixels.
|
|
33
|
+
*/
|
|
34
|
+
export declare const interruptableScrollTo: (givenOptions?: GivenInterruptableScrollToOptions) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Scrolls to the given DomNode's location or tio of the page.
|
|
37
|
+
* @param targetDomNode - DomNode to scroll to. If not given, scrolls to the
|
|
38
|
+
* top of the page.
|
|
39
|
+
* @param behavior - Scroll behavior to use.
|
|
40
|
+
*/
|
|
41
|
+
export declare const scrollTo: (targetDomNode?: Node | null, behavior?: ScrollToOptions["behavior"]) => void;
|
|
42
|
+
export declare const getAll: (root: Node) => Node[];
|
|
43
|
+
export declare const closest: (node: Node, selector: string, startWithParent?: boolean) => Element | null;
|
|
44
|
+
export declare const getParents: (node: Node) => Array<Node>;
|
|
45
|
+
export declare const getText: (root: Node, recursive?: boolean) => Array<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Checks whether given html or text strings are equal.
|
|
48
|
+
* @param first - First html, selector to dom node or text to compare.
|
|
49
|
+
* @param second - Second html, selector to dom node or text to compare.
|
|
50
|
+
* @param forceHTMLString - Indicates whether given contents are
|
|
51
|
+
* interpreted as html string (otherwise automatic detection will be
|
|
52
|
+
* triggered).
|
|
53
|
+
* @returns Returns true if both dom representations are equivalent.
|
|
54
|
+
*/
|
|
55
|
+
export declare const isEquivalent: (first: Node | string, second: Node | string, forceHTMLString?: boolean) => boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Checks whether the given dom node is visible or takes space in the document
|
|
58
|
+
* flow.
|
|
59
|
+
* Elements with visibility: hidden or opacity: 0 are considered to be visible,
|
|
60
|
+
* since they still consume space in the layout. During animations that hide an
|
|
61
|
+
* element, the element is considered to be visible until the end of the
|
|
62
|
+
* animation.
|
|
63
|
+
* @param domNode - To inspect.
|
|
64
|
+
* @returns A boolean indicating the visibility.
|
|
65
|
+
*/
|
|
66
|
+
export declare const isHidden: (domNode: HTMLElement) => boolean;
|
|
67
|
+
export declare const onDocumentReady: (callback?: () => void) => Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Replaces a given dom node with given nodes.
|
|
70
|
+
* @param domNodeToReplace - Node to replace its children.
|
|
71
|
+
* @param replacementDomNodes - Node or array of nodes to use as replacement.
|
|
72
|
+
* @param skipEmptyTextNodes - Configures whether to trim text.
|
|
73
|
+
*/
|
|
74
|
+
export declare const replace: (domNodeToReplace: HTMLElement, replacementDomNodes: Array<Node> | Node, skipEmptyTextNodes?: boolean) => void;
|
|
75
|
+
export declare const wrap: (domNodes: Node | NodeListOf<Node>, wrapper: HTMLElement) => void;
|
|
76
|
+
/**
|
|
77
|
+
* Moves the content of a given dom node one level up and removes the given
|
|
78
|
+
* node.
|
|
79
|
+
* @param domNode - Node to unwrap.
|
|
80
|
+
* @returns List of unwrapped nodes.
|
|
81
|
+
*/
|
|
82
|
+
export declare const unwrap: (domNode: HTMLElement) => Array<ChildNode>;
|