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.
Files changed (52) hide show
  1. package/dist/Lock.d.ts +39 -0
  2. package/dist/Logger.d.ts +102 -0
  3. package/dist/Semaphore.d.ts +29 -0
  4. package/dist/array.d.ts +150 -0
  5. package/dist/cli.d.ts +31 -0
  6. package/dist/constants.d.ts +99 -0
  7. package/dist/context.d.ts +8 -0
  8. package/dist/cookie.d.ts +31 -0
  9. package/dist/data-transfer.d.ts +45 -0
  10. package/dist/datetime.d.ts +37 -0
  11. package/dist/domNode.d.ts +82 -0
  12. package/dist/expression/evaluators.d.ts +55 -0
  13. package/dist/expression/helper.d.ts +4 -0
  14. package/dist/expression/index.d.ts +7 -0
  15. package/dist/expression/indicator-functions.d.ts +14 -0
  16. package/dist/expression/type.d.ts +70 -0
  17. package/dist/filesystem.d.ts +143 -0
  18. package/dist/function.d.ts +20 -0
  19. package/dist/index.d.ts +23 -0
  20. package/dist/indicators.d.ts +68 -0
  21. package/dist/module.d.ts +8 -0
  22. package/dist/number.d.ts +35 -0
  23. package/dist/object.d.ts +231 -0
  24. package/dist/process.d.ts +22 -0
  25. package/dist/property-types.d.ts +460 -0
  26. package/dist/scope.d.ts +44 -0
  27. package/dist/string.d.ts +312 -0
  28. package/dist/test/Lock.d.ts +1 -0
  29. package/dist/test/Logger.d.ts +1 -0
  30. package/dist/test/Semaphore.d.ts +1 -0
  31. package/dist/test/array.d.ts +1 -0
  32. package/dist/test/cookie.d.ts +1 -0
  33. package/dist/test/data-transfer.d.ts +1 -0
  34. package/dist/test/datetime.d.ts +1 -0
  35. package/dist/test/domNode.d.ts +1 -0
  36. package/dist/test/expression/evaluators.d.ts +1 -0
  37. package/dist/test/expression/helper.d.ts +1 -0
  38. package/dist/test/expression/indicator-functions.d.ts +1 -0
  39. package/dist/test/filesystem.d.ts +1 -0
  40. package/dist/test/function.d.ts +1 -0
  41. package/dist/test/indicators.d.ts +1 -0
  42. package/dist/test/number.d.ts +1 -0
  43. package/dist/test/object.d.ts +1 -0
  44. package/dist/test/process.d.ts +1 -0
  45. package/dist/test/property-types.d.ts +1 -0
  46. package/dist/test/scope.d.ts +1 -0
  47. package/dist/test/string.d.ts +1 -0
  48. package/dist/test/utility.d.ts +1 -0
  49. package/dist/test-helper.d.ts +143 -0
  50. package/dist/type.d.ts +230 -0
  51. package/dist/utility.d.ts +44 -0
  52. package/package.json +2 -2
package/dist/type.d.ts ADDED
@@ -0,0 +1,230 @@
1
+ import type { Matchers } from 'expect';
2
+ import type { Dirent as DirectoryEntry, Stats as FileStats } from 'fs';
3
+ import type { Level } from './Logger';
4
+ import type { TEST_DEFINED_SYMBOL, TEST_THROW_SYMBOL, TEST_UNDEFINED_SYMBOL } from './test-helper';
5
+ export type AnyFunction = (...parameters: Array<any>) => any;
6
+ export type Unpacked<T> = T extends Array<infer U> ? U : T extends (...parameters: Array<unknown>) => infer U ? U : T extends Promise<infer U> ? U : T;
7
+ export type FirstParameter<FunctionType extends AnyFunction> = Parameters<FunctionType>[0];
8
+ export type SecondParameter<FunctionType extends AnyFunction> = Parameters<FunctionType>[1];
9
+ export type ThirdParameter<FunctionType extends AnyFunction> = Parameters<FunctionType>[2];
10
+ export type ParametersExceptFirst<FunctionType> = FunctionType extends (parameter: any, ...additionalParameters: infer AdditionalParameters) => any ? AdditionalParameters : [
11
+ ];
12
+ export type FunctionTestTuple<FunctionType extends AnyFunction> = [
13
+ ReturnType<FunctionType>,
14
+ ...Parameters<FunctionType>
15
+ ];
16
+ export type FunctionTestPromiseTuple<FunctionType extends AnyFunction> = [
17
+ ThenParameter<ReturnType<FunctionType>>,
18
+ ...Parameters<FunctionType>
19
+ ];
20
+ export type FunctionTestPromiseRejectionTuple<FunctionType extends AnyFunction> = [Error, ...Parameters<FunctionType>];
21
+ export type TestSymbol = (typeof TEST_DEFINED_SYMBOL | typeof TEST_THROW_SYMBOL | typeof TEST_UNDEFINED_SYMBOL);
22
+ export type ThenParameter<Type> = Type extends PromiseLike<infer U> ? U : Type;
23
+ export type ThenParameterRecursive<Type> = Type extends PromiseLike<infer U> ? ThenParameterRecursive<U> : Type;
24
+ export type ValueOf<Type> = Type[keyof Type];
25
+ export type RecursiveNonNullable<Type> = {
26
+ [Property in keyof Type]: Type[Property] extends Array<infer OtherType> ? Array<RecursiveNonNullable<OtherType>> : Type[Property] extends AnyFunction ? NonNullable<Type[Property]> : Type[Property] extends Mapping<unknown> ? RecursiveNonNullable<Type[Property]> : NonNullable<Type[Property]>;
27
+ };
28
+ export type RecursivePartial<Type> = Partial<Type> | {
29
+ [Property in keyof Type]?: Type[Property] extends Array<infer OtherType> ? Array<RecursivePartial<OtherType>> : Type[Property] extends AnyFunction ? Partial<Type[Property]> : Type[Property] extends Mapping<unknown> ? RecursivePartial<Type[Property]> : Partial<Type[Property]>;
30
+ };
31
+ export type FileTraverseResult = false | null | Promise<false | null | undefined> | undefined;
32
+ export type TestMatchers<T extends Promise<void> | void> = Matchers<T> & {
33
+ not: Matchers<T>;
34
+ };
35
+ export type ImportFunction = (id: string) => Promise<ReturnType<typeof require>>;
36
+ export type HTMLItem = Comment | HTMLElement | Text;
37
+ export type Primitive = boolean | null | number | string | undefined;
38
+ export type Mapping<V = string, K extends string = string> = Record<K, V>;
39
+ export type PlainObject<V = Primitive, K extends string = string> = {
40
+ [key in K]: Array<PlainObject<V, K> | V> | PlainObject<V, K> | V;
41
+ };
42
+ export interface ProxyHandler<T = unknown> {
43
+ deleteProperty: (target: T, key: string | symbol) => boolean;
44
+ get: (target: T, key: string | symbol) => unknown;
45
+ has: (target: T, key: string | symbol) => boolean;
46
+ set: (target: T, key: string | symbol, value: unknown) => boolean;
47
+ }
48
+ export type ProxyType<T = unknown> = T & {
49
+ __revoke__?: () => void;
50
+ __target__: T;
51
+ };
52
+ export interface CookieOptions {
53
+ domain: string;
54
+ httpOnly: boolean;
55
+ minimal: boolean;
56
+ numberOfDaysUntilExpiration: number;
57
+ path: string;
58
+ sameSite: 'Lax' | 'None' | 'Strict' | '';
59
+ secure: boolean;
60
+ }
61
+ export interface KnownWindowEventMap extends WindowEventMap {
62
+ DOMMouseScroll: Event;
63
+ mousewheel: Event;
64
+ }
65
+ export type KnownEventName = keyof KnownWindowEventMap;
66
+ export type UnknownFunction = (...parameters: Array<unknown>) => unknown;
67
+ export type ArrayTransformer<T = unknown, R = unknown, P = unknown> = (data: Array<T>, ...additionalParameter: Array<P>) => Array<R>;
68
+ export type SynchronousProcedureFunction = (...parameters: Array<unknown>) => void;
69
+ export type AsynchronousProcedureFunction = (...parameters: Array<unknown>) => Promise<void>;
70
+ export type ProcedureFunction = AsynchronousProcedureFunction | SynchronousProcedureFunction;
71
+ export type GetterFunction = (keyOrValue: unknown, key: string | symbol, target: unknown) => unknown;
72
+ export type SetterFunction = (key: string | symbol, value: unknown, target: unknown) => unknown;
73
+ export interface CheckReachabilityOptions {
74
+ abortController: AbortController;
75
+ expectedIntermediateStatusCodes: Array<number> | number;
76
+ options: RequestInit;
77
+ pollIntervallInSeconds: number;
78
+ statusCodes: Array<number> | number;
79
+ timeoutInSeconds: number;
80
+ wait: boolean;
81
+ }
82
+ export interface CompareOptions {
83
+ compareBlobs: boolean;
84
+ deep: number;
85
+ exceptionPrefixes: Array<string>;
86
+ ignoreFunctions: boolean;
87
+ properties: Array<string> | null;
88
+ returnReasonIfNotEqual: boolean;
89
+ }
90
+ export type Encoding = 'ascii' | 'base64' | 'base64url' | 'binary' | 'hex' | 'latin1' | 'ucs2' | 'ucs-2' | 'utf8' | 'utf16le' | 'utf-8';
91
+ export interface File {
92
+ directoryPath: string;
93
+ directoryEntry: DirectoryEntry | null;
94
+ error: Error | null;
95
+ name: string;
96
+ path: string;
97
+ stats: FileStats | null;
98
+ }
99
+ export interface ProcessError extends Error {
100
+ parameters: Array<unknown>;
101
+ returnCode: number;
102
+ }
103
+ export type QueryParameters = Array<Array<string> | string> & Mapping<Array<string> | string>;
104
+ export interface TimeoutPromise extends Promise<boolean> {
105
+ clear: () => void;
106
+ timeoutID: NodeJS.Timeout;
107
+ }
108
+ export type ObjectMask = Array<string> | boolean | {
109
+ [key: string]: ObjectMask;
110
+ };
111
+ export type NormalizedObjectMask = boolean | Mapping<ObjectMask>;
112
+ export interface ObjectMaskConfiguration {
113
+ exclude?: ObjectMask;
114
+ include?: ObjectMask;
115
+ }
116
+ export interface EvaluateObject {
117
+ __evaluate__: string;
118
+ }
119
+ export interface ExecuteObject {
120
+ __execute__: string;
121
+ }
122
+ export type Evaluateable = EvaluateObject | ExecuteObject;
123
+ export type EvaluatedObject<Type extends object> = {
124
+ [Property in keyof Type]: (Type[Property] extends Evaluateable ? unknown : Type[Property] extends object ? EvaluatedObject<Type[Property]> : Type[Property]);
125
+ };
126
+ export type RecursiveEvaluateable<Type> = Evaluateable | {
127
+ [Property in keyof Type]: (Evaluateable | (Type[Property] extends Array<infer OtherType> ? Array<RecursiveEvaluateable<OtherType>> : Type[Property] extends Mapping<unknown> ? RecursiveEvaluateable<Type[Property]> : Evaluateable | Type[Property]));
128
+ };
129
+ export interface AsyncEvaluateObject {
130
+ __await_evaluate__: string;
131
+ }
132
+ export interface AsyncExecuteObject {
133
+ __await_execute__: string;
134
+ }
135
+ export type AsyncEvaluateable = AsyncEvaluateObject | AsyncExecuteObject;
136
+ export type AsyncEvaluatedObject<Type extends object> = {
137
+ [Property in keyof Type]: (Type[Property] extends AsyncEvaluateable ? unknown : Type[Property] extends object ? AsyncEvaluatedObject<Type[Property]> : Type[Property]);
138
+ };
139
+ export type RecursiveAsyncEvaluateable<Type> = AsyncEvaluateable | {
140
+ [Property in keyof Type]: (AsyncEvaluateable | (Type[Property] extends Array<infer OtherType> ? Array<RecursiveAsyncEvaluateable<OtherType>> : Type[Property] extends Mapping<unknown> ? RecursiveAsyncEvaluateable<Type[Property]> : AsyncEvaluateable | Type[Property]));
141
+ };
142
+ export interface PaginateOptions {
143
+ boundaryCount: number;
144
+ disabled: boolean;
145
+ hideNextButton: boolean;
146
+ hidePrevButton: boolean;
147
+ page: number;
148
+ pageSize?: null | number;
149
+ showFirstButton: boolean;
150
+ showLastButton: boolean;
151
+ siblingCount: number;
152
+ total: number;
153
+ }
154
+ export interface Page {
155
+ disabled: boolean;
156
+ page?: number;
157
+ selected: boolean;
158
+ type: PageType;
159
+ }
160
+ export type PageType = 'end-ellipsis' | 'first' | 'last' | 'next' | 'page' | 'previous' | 'start-ellipsis';
161
+ export interface Offset {
162
+ left: number;
163
+ top: number;
164
+ }
165
+ export interface Position extends Offset {
166
+ bottom: number;
167
+ right: number;
168
+ }
169
+ export type ProcessHandler = (returnCode: unknown, ...parameters: Array<unknown>) => void;
170
+ export interface ProcessCloseReason {
171
+ parameters: Array<unknown>;
172
+ reason: unknown;
173
+ }
174
+ export type ProcessCloseCallback = (reason: ProcessCloseReason) => void;
175
+ export type ProcessErrorCallback = (reason: ProcessError) => void;
176
+ export type RelativePosition = 'above' | 'below' | 'in' | 'left' | 'right';
177
+ export type TemplateFunction<Type = string> = (...parameters: Array<unknown>) => Type;
178
+ export interface CompilationResult<T = string, N extends Array<string> = Array<string>> {
179
+ error: null | string;
180
+ globalNames: Array<string>;
181
+ globalNamesUndefinedList: Array<undefined>;
182
+ originalScopeNames: N;
183
+ scopeNameMapping: Record<N[number], string>;
184
+ scopeNames: Array<string>;
185
+ templateFunction: TemplateFunction<T>;
186
+ }
187
+ export interface NegativeEvaluationResult {
188
+ compileError: null | string;
189
+ error: string;
190
+ result: undefined;
191
+ runtimeError: null | string;
192
+ }
193
+ export interface PositiveEvaluationResult<Type = string> {
194
+ compileError: null;
195
+ error: null;
196
+ result: Type;
197
+ runtimeError: null;
198
+ }
199
+ export type EvaluationResult<Type = string> = PositiveEvaluationResult<Type> | NegativeEvaluationResult;
200
+ export type LockCallbackFunction<Type> = (description?: string) => Promise<Type> | Type;
201
+ export interface StringMarkOptions {
202
+ marker: ((foundWord: string, markedTarget: Array<unknown>) => unknown) | string;
203
+ normalizer: (value: unknown) => string;
204
+ skipTagDelimitedParts: null | [string, string];
205
+ }
206
+ export interface InterruptableScrollToOptions {
207
+ targetDomNode: HTMLElement;
208
+ containerDomNode: HTMLElement | Window;
209
+ durationInMilliseconds: number;
210
+ interruptOnManualScroll: boolean;
211
+ offset: {
212
+ top: number;
213
+ left: number;
214
+ };
215
+ }
216
+ export interface GivenInterruptableScrollToOptions extends Partial<ScrollToOptions> {
217
+ targetDomNode?: Node | null;
218
+ containerDomNode?: Node | null | Window;
219
+ offset?: Partial<InterruptableScrollToOptions['offset']>;
220
+ }
221
+ export interface LoggerOptions {
222
+ level: Level;
223
+ name: string;
224
+ }
225
+ export interface EvaluateDynamicDataOptions {
226
+ scope: Mapping<unknown>;
227
+ selfReferenceName: string;
228
+ expressionIndicatorKey: string;
229
+ executionIndicatorKey: string;
230
+ }
@@ -0,0 +1,44 @@
1
+ import type { TimeoutPromise } from './type';
2
+ /**
3
+ * Prevents event functions from triggering too often by defining a minimal
4
+ * span between each function call. Additional arguments given to this function
5
+ * will be forwarded to the given event function call.
6
+ * @param callback - The function to call debounced.
7
+ * @param thresholdInMilliseconds - The minimum time span between each
8
+ * function call.
9
+ * @param additionalArguments - Additional arguments to forward to given
10
+ * function.
11
+ * @returns Returns the wrapped method.
12
+ */
13
+ export declare const trailingThrottle: <T = unknown>(callback: (...parameters: Array<unknown>) => T, thresholdInMilliseconds?: number, ...additionalArguments: Array<unknown>) => (...parameters: Array<unknown>) => void;
14
+ /**
15
+ * Prevents event functions from triggering too close after each trigger by
16
+ * defining a minimal span between each function call. Additional arguments
17
+ * given to this function will be forwarded to the given event function call.
18
+ * @param callback - The function to call debounced.
19
+ * @param thresholdInMilliseconds - The minimum time span between each
20
+ * function call.
21
+ * @param additionalArguments - Additional arguments to forward to given
22
+ * function.
23
+ * @returns Returns the wrapped method.
24
+ */
25
+ export declare const debounce: <T = unknown>(callback: (...parameters: Array<unknown>) => T, thresholdInMilliseconds?: number, ...additionalArguments: Array<unknown>) => ((...parameters: Array<unknown>) => Promise<T>);
26
+ /**
27
+ * Triggers given callback after given duration. Supports unlimited
28
+ * duration length and returns a promise which will be resolved after given
29
+ * duration has been passed.
30
+ * @param parameters - Observes the first three existing parameters. If one
31
+ * is a number it will be interpreted as delay in milliseconds until given
32
+ * callback will be triggered. If one is of type function it will be used
33
+ * as callback and if one is of type boolean it will indicate if returning
34
+ * promise should be rejected or resolved if given internally created
35
+ * timeout should be canceled. Additional parameters will be forwarded to
36
+ * given callback.
37
+ * @returns A promise resolving after given delay or being rejected if
38
+ * value "true" is within one of the first three parameters. The promise
39
+ * holds a boolean indicating whether timeout has been canceled or
40
+ * resolved.
41
+ */
42
+ export declare const timeout: (...parameters: Array<unknown>) => TimeoutPromise;
43
+ export declare const preventDefault: (event: Event) => void;
44
+ export declare const stopPropagation: (event: Event) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clientnode",
3
- "version": "4.0.1440",
3
+ "version": "4.0.1442",
4
4
  "description": "Handy utilities for any JavaScript environments.",
5
5
  "keywords": [
6
6
  "client",
@@ -127,7 +127,7 @@
127
127
  "yarn": ">=4"
128
128
  },
129
129
  "resolutions": {
130
- "weboptimizer/clientnode": "4.0.1435",
130
+ "weboptimizer/clientnode": "4.0.1440",
131
131
  "colors": "1.4.0",
132
132
  "globals@npm:^14.0.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch",
133
133
  "globals@npm:^11.1.0": "patch:globals@npm%3A11.12.0#~/.yarn/patches/globals-npm-11.12.0-1fa7f41a6c.patch",