@gooddata/util 10.38.0 → 10.39.0-alpha.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/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -3
- package/esm/index.js.map +1 -1
- package/esm/testUtils.d.ts +55 -0
- package/esm/testUtils.d.ts.map +1 -1
- package/esm/testUtils.js +77 -1
- package/esm/testUtils.js.map +1 -1
- package/esm/util.d.ts +62 -7
- package/package.json +1 -1
package/esm/index.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* @packageDocumentation
|
|
8
8
|
*/
|
|
9
9
|
import * as stringUtils from "./stringUtils.js";
|
|
10
|
-
import * as testUtils from "./testUtils.js";
|
|
11
10
|
import * as translationUtils from "./translationUtils.js";
|
|
12
11
|
import * as arrayUtils from "./arrayUtils.js";
|
|
13
12
|
import * as objectUtils from "./objectUtils.js";
|
|
14
13
|
import * as typesUtils from "./typesUtils.js";
|
|
15
|
-
export
|
|
14
|
+
export * from "./testUtils.js";
|
|
15
|
+
export { stringUtils, translationUtils, arrayUtils, objectUtils, typesUtils };
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAE9C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// (C) 2019-
|
|
1
|
+
// (C) 2019-2025 GoodData Corporation
|
|
2
2
|
/**
|
|
3
3
|
* This package contains utility functions used in production or test code of multiple different GoodData.UI packages.
|
|
4
4
|
*
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
10
|
import * as stringUtils from "./stringUtils.js";
|
|
11
|
-
import * as testUtils from "./testUtils.js";
|
|
12
11
|
import * as translationUtils from "./translationUtils.js";
|
|
13
12
|
import * as arrayUtils from "./arrayUtils.js";
|
|
14
13
|
import * as objectUtils from "./objectUtils.js";
|
|
15
14
|
import * as typesUtils from "./typesUtils.js";
|
|
16
|
-
export
|
|
15
|
+
export * from "./testUtils.js";
|
|
16
|
+
export { stringUtils, translationUtils, arrayUtils, objectUtils, typesUtils };
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC;;;;;;;GAOG;AAEH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC;;;;;;;GAOG;AAEH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAE9C,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC"}
|
package/esm/testUtils.d.ts
CHANGED
|
@@ -5,4 +5,59 @@
|
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
7
|
export declare function delay(timeout?: number): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* A matcher for suppressConsole
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export type Matcher = {
|
|
14
|
+
type: "regex";
|
|
15
|
+
value: RegExp;
|
|
16
|
+
} | {
|
|
17
|
+
type: "includes" | "exact" | "startsWith";
|
|
18
|
+
value: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A type of console to suppress
|
|
22
|
+
*
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export type ConsoleType = "error" | "warn" | "log" | "debug" | "info";
|
|
26
|
+
/**
|
|
27
|
+
* A specific matcher function
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
export type SpecificMatcherFunction = (message: string) => boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A matcher function
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export type MatcherFunction = (console: Record<ConsoleType, ConsoleFunction>, type: ConsoleType, message: string) => boolean;
|
|
38
|
+
/**
|
|
39
|
+
* A console function, like log, warn or error
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
export type ConsoleFunction = (...data: any[]) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Suppresses certain console outputs
|
|
46
|
+
*
|
|
47
|
+
* @param fn - function which emits console activity
|
|
48
|
+
* @param type - type of console activity to suppress, or an array of types
|
|
49
|
+
* @param matchers - an array of matchers to test console activity against, or a SpecificMatcherFunction
|
|
50
|
+
* @returns T | Promise<T> - return value of fn param
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
export declare function suppressConsole<T>(fn: () => T | Promise<T>, type?: ConsoleType | ConsoleType[], matchers?: Matcher[] | SpecificMatcherFunction): T | Promise<T>;
|
|
54
|
+
/**
|
|
55
|
+
* Suppresses certain console outputs
|
|
56
|
+
*
|
|
57
|
+
* @param fn - function which emits console activity
|
|
58
|
+
* @param matcherFn - a MatcherFunction
|
|
59
|
+
* @returns T | Promise<T> - return value of fn param
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
62
|
+
export declare function suppressConsole<T>(fn: () => T | Promise<T>, matcherFn: MatcherFunction): T | Promise<T>;
|
|
8
63
|
//# sourceMappingURL=testUtils.d.ts.map
|
package/esm/testUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAMhD;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,GACb;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,UAAU,GAAG,OAAO,GAAG,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;AAEtE;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC;AAEnE;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAC1B,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,eAAe,CAAC,EAC7C,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,MAAM,KACd,OAAO,CAAC;AAEb;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AA8CvD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC7B,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EACxB,IAAI,CAAC,EAAE,WAAW,GAAG,WAAW,EAAE,EAClC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,uBAAuB,GAC/C,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAElB;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
package/esm/testUtils.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// (C) 2007-
|
|
1
|
+
// (C) 2007-2025 GoodData Corporation
|
|
2
|
+
/* eslint-disable no-console */
|
|
2
3
|
/**
|
|
3
4
|
* Returns a promise which will resolve after the provided number of milliseconds.
|
|
4
5
|
*
|
|
@@ -12,4 +13,79 @@ export function delay(timeout = 0) {
|
|
|
12
13
|
}, timeout);
|
|
13
14
|
});
|
|
14
15
|
}
|
|
16
|
+
function suppressConsoleBase(fn, matcherFn) {
|
|
17
|
+
const types = ["error", "warn", "log", "debug", "info"];
|
|
18
|
+
const originals = {};
|
|
19
|
+
for (const type of types) {
|
|
20
|
+
originals[type] = console[type];
|
|
21
|
+
console[type] = (...data) => {
|
|
22
|
+
const message = data
|
|
23
|
+
.map((part) => {
|
|
24
|
+
if (typeof part === "object") {
|
|
25
|
+
try {
|
|
26
|
+
return JSON.stringify(part);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return "[object with circular reference]";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return part;
|
|
33
|
+
})
|
|
34
|
+
.join(" ");
|
|
35
|
+
if (matcherFn(originals, type, message))
|
|
36
|
+
return;
|
|
37
|
+
originals[type].apply(console, data);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
const result = fn();
|
|
41
|
+
if (result instanceof Promise) {
|
|
42
|
+
return result.finally(() => {
|
|
43
|
+
for (const type of types) {
|
|
44
|
+
// restore the console to previous state
|
|
45
|
+
console[type] = originals[type];
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
for (const type of types) {
|
|
51
|
+
// restore the console to previous state
|
|
52
|
+
console[type] = originals[type];
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function suppressConsole(fn, type = ["error", "warn", "log", "debug", "info"], matchers) {
|
|
58
|
+
if (typeof type === "function")
|
|
59
|
+
return suppressConsoleBase(fn, type); // simple, user handles all
|
|
60
|
+
// this scenario is managed by us slightly more
|
|
61
|
+
// handle the case where they pass a single type
|
|
62
|
+
const typeArray = typeof type === "string" ? [type] : type;
|
|
63
|
+
return suppressConsoleBase(fn, (console, type, message) => {
|
|
64
|
+
if (!typeArray.includes(type))
|
|
65
|
+
return false;
|
|
66
|
+
if (typeof matchers === "function") {
|
|
67
|
+
if (matchers(message))
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
else if (matchers) {
|
|
71
|
+
for (const matcher of matchers) {
|
|
72
|
+
if (matcher.type === "regex" && matcher.value.test(message))
|
|
73
|
+
return true;
|
|
74
|
+
if (matcher.type === "includes" && message.includes(matcher.value))
|
|
75
|
+
return true;
|
|
76
|
+
if (matcher.type === "exact" && message === matcher.value)
|
|
77
|
+
return true;
|
|
78
|
+
if (matcher.type === "startsWith" && message.startsWith(matcher.value))
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// (shown locally, not on CI), devs should use matchers
|
|
84
|
+
console.log(`Wildcard matched (${type}): ${message}`);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
console.error(`Passthrough (${type}): ${message}`);
|
|
88
|
+
return false;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
15
91
|
//# sourceMappingURL=testUtils.js.map
|
package/esm/testUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"testUtils.js","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,+BAA+B;AAE/B;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAO,GAAG,CAAC;IAC7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC3B,UAAU,CAAC,GAAG,EAAE;YACZ,OAAO,EAAE,CAAC;QACd,CAAC,EAAE,OAAO,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;AACP,CAAC;AA2CD,SAAS,mBAAmB,CAAI,EAAwB,EAAE,SAA0B;IAChF,MAAM,KAAK,GAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAEvE,MAAM,SAAS,GAAoC,EAAE,CAAC;IAEtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE;Y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C,KAAK,CAAC,gBAAgB,IAAI,MAAM,OAAO,EAAE,CAAC,CAAC;QAEnD,OAAO,KAAK,CAAC;IACjB,CAAC,CACJ,CAAC;AACN,CAAC"}
|
package/esm/util.d.ts
CHANGED
|
@@ -22,13 +22,27 @@ export { arrayUtils }
|
|
|
22
22
|
*/
|
|
23
23
|
declare function combineGuards<T extends ((x: unknown) => x is unknown)[]>(...guards: T): (x: unknown) => x is GuardType<T[number]>;
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* A console function, like log, warn or error
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
export declare type ConsoleFunction = (...data: any[]) => void;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A type of console to suppress
|
|
34
|
+
*
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
export declare type ConsoleType = "error" | "warn" | "log" | "debug" | "info";
|
|
38
|
+
|
|
25
39
|
/**
|
|
26
40
|
* Returns a promise which will resolve after the provided number of milliseconds.
|
|
27
41
|
*
|
|
28
42
|
* @param timeout - resolve timeout in milliseconds
|
|
29
43
|
* @internal
|
|
30
44
|
*/
|
|
31
|
-
declare function delay(timeout?: number): Promise<void>;
|
|
45
|
+
export declare function delay(timeout?: number): Promise<void>;
|
|
32
46
|
|
|
33
47
|
/**
|
|
34
48
|
* Escapes special characters used in regular expressions.
|
|
@@ -68,6 +82,26 @@ declare interface IShortenTextOptions {
|
|
|
68
82
|
maxLength?: number;
|
|
69
83
|
}
|
|
70
84
|
|
|
85
|
+
/**
|
|
86
|
+
* A matcher for suppressConsole
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export declare type Matcher = {
|
|
91
|
+
type: "regex";
|
|
92
|
+
value: RegExp;
|
|
93
|
+
} | {
|
|
94
|
+
type: "includes" | "exact" | "startsWith";
|
|
95
|
+
value: string;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A matcher function
|
|
100
|
+
*
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
export declare type MatcherFunction = (console: Record<ConsoleType, ConsoleFunction>, type: ConsoleType, message: string) => boolean;
|
|
104
|
+
|
|
71
105
|
declare namespace objectUtils {
|
|
72
106
|
export {
|
|
73
107
|
shallowEqualObjects
|
|
@@ -147,6 +181,13 @@ declare function shortenText(value: string, options?: IShortenTextOptions): stri
|
|
|
147
181
|
*/
|
|
148
182
|
declare function simplifyText(value: string | number | null): string;
|
|
149
183
|
|
|
184
|
+
/**
|
|
185
|
+
* A specific matcher function
|
|
186
|
+
*
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
export declare type SpecificMatcherFunction = (message: string) => boolean;
|
|
190
|
+
|
|
150
191
|
declare namespace stringUtils {
|
|
151
192
|
export {
|
|
152
193
|
shortenText,
|
|
@@ -160,12 +201,26 @@ declare namespace stringUtils {
|
|
|
160
201
|
}
|
|
161
202
|
export { stringUtils }
|
|
162
203
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
204
|
+
/**
|
|
205
|
+
* Suppresses certain console outputs
|
|
206
|
+
*
|
|
207
|
+
* @param fn - function which emits console activity
|
|
208
|
+
* @param type - type of console activity to suppress, or an array of types
|
|
209
|
+
* @param matchers - an array of matchers to test console activity against, or a SpecificMatcherFunction
|
|
210
|
+
* @returns T | Promise<T> - return value of fn param
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
export declare function suppressConsole<T>(fn: () => T | Promise<T>, type?: ConsoleType | ConsoleType[], matchers?: Matcher[] | SpecificMatcherFunction): T | Promise<T>;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Suppresses certain console outputs
|
|
217
|
+
*
|
|
218
|
+
* @param fn - function which emits console activity
|
|
219
|
+
* @param matcherFn - a MatcherFunction
|
|
220
|
+
* @returns T | Promise<T> - return value of fn param
|
|
221
|
+
* @internal
|
|
222
|
+
*/
|
|
223
|
+
export declare function suppressConsole<T>(fn: () => T | Promise<T>, matcherFn: MatcherFunction): T | Promise<T>;
|
|
169
224
|
|
|
170
225
|
declare namespace translationUtils {
|
|
171
226
|
export {
|