@gooddata/util 11.53.0-alpha.6 → 11.53.0

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 CHANGED
@@ -11,5 +11,5 @@ export { shallowEqualObjects } from "./objectUtils.js";
11
11
  export { type IShortenTextOptions, hashCodeString, randomString, shortenText, escapeRegExp, simplifyText, parseStringToArray, } from "./stringUtils.js";
12
12
  export { removeMetadata, sanitizeLocaleForMoment } from "./translationUtils.js";
13
13
  export { type GuardType, type EmptyObject, combineGuards } from "./typesUtils.js";
14
- export { type MatcherFunction, type ConsoleFunction, type Matcher, type SpecificMatcherFunction, type ConsoleType, delay, suppressConsole, } from "./testUtils.js";
14
+ export { type MatcherFunction, type ConsoleFunction, type Matcher, type SpecificMatcherFunction, type ConsoleType, type WaitForFn, delay, suppressConsole, createTightWaitFor, } from "./testUtils.js";
15
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EACH,KAAK,mBAAmB,EACxB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,EACL,eAAe,GAClB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EACH,KAAK,mBAAmB,EACxB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EACH,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,OAAO,EACZ,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,EACL,eAAe,EACf,kBAAkB,GACrB,MAAM,gBAAgB,CAAC"}
package/esm/index.js CHANGED
@@ -13,4 +13,4 @@ export { shallowEqualObjects } from "./objectUtils.js";
13
13
  export { hashCodeString, randomString, shortenText, escapeRegExp, simplifyText, parseStringToArray, } from "./stringUtils.js";
14
14
  export { removeMetadata, sanitizeLocaleForMoment } from "./translationUtils.js";
15
15
  export { combineGuards } from "./typesUtils.js";
16
- export { delay, suppressConsole, } from "./testUtils.js";
16
+ export { delay, suppressConsole, createTightWaitFor, } from "./testUtils.js";
@@ -60,4 +60,25 @@ export declare function suppressConsole<T>(fn: () => T | Promise<T>, type?: Cons
60
60
  * @internal
61
61
  */
62
62
  export declare function suppressConsole<T>(fn: () => T | Promise<T>, matcherFn: MatcherFunction): T | Promise<T>;
63
+ /**
64
+ * A waitFor-compatible polling function, structurally matching testing-library's waitFor.
65
+ *
66
+ * @internal
67
+ */
68
+ export type WaitForFn = <T>(callback: () => T | Promise<T>, options?: {
69
+ interval?: number;
70
+ timeout?: number;
71
+ }) => Promise<T>;
72
+ /**
73
+ * Wraps a testing-library waitFor so it polls every millisecond instead of the default 50ms.
74
+ *
75
+ * @remarks
76
+ * Use in tests where the awaited work settles on the next microtask or a resolved promise -
77
+ * there, every pending assertion would otherwise cost a full default poll interval.
78
+ *
79
+ * @param waitFor - the consumer's waitFor (e.g. from `@testing-library/react`)
80
+ * @param interval - the polling interval in milliseconds, 1 by default
81
+ * @internal
82
+ */
83
+ export declare function createTightWaitFor(waitFor: WaitForFn, interval?: number): <T>(callback: () => T | Promise<T>) => Promise<T>;
63
84
  //# sourceMappingURL=testUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"testUtils.d.ts","sourceRoot":"","sources":["../src/testUtils.ts"],"names":[],"mappings":"AAIA;;;;;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,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GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAwDvD;;;;;;;;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;AAyCzG;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,EACtB,QAAQ,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC9B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,KAChD,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,SAAS,EAClB,QAAQ,GAAE,MAAU,GACrB,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAEnD"}
package/esm/testUtils.js CHANGED
@@ -98,3 +98,17 @@ export function suppressConsole(fn, type = ["error", "warn", "log", "debug", "in
98
98
  return false;
99
99
  });
100
100
  }
101
+ /**
102
+ * Wraps a testing-library waitFor so it polls every millisecond instead of the default 50ms.
103
+ *
104
+ * @remarks
105
+ * Use in tests where the awaited work settles on the next microtask or a resolved promise -
106
+ * there, every pending assertion would otherwise cost a full default poll interval.
107
+ *
108
+ * @param waitFor - the consumer's waitFor (e.g. from `@testing-library/react`)
109
+ * @param interval - the polling interval in milliseconds, 1 by default
110
+ * @internal
111
+ */
112
+ export function createTightWaitFor(waitFor, interval = 1) {
113
+ return (callback) => waitFor(callback, { interval });
114
+ }
package/esm/util.d.ts CHANGED
@@ -29,6 +29,19 @@ export declare type ConsoleFunction = (...data: any[]) => void;
29
29
  */
30
30
  export declare type ConsoleType = "error" | "warn" | "log" | "debug" | "info";
31
31
 
32
+ /**
33
+ * Wraps a testing-library waitFor so it polls every millisecond instead of the default 50ms.
34
+ *
35
+ * @remarks
36
+ * Use in tests where the awaited work settles on the next microtask or a resolved promise -
37
+ * there, every pending assertion would otherwise cost a full default poll interval.
38
+ *
39
+ * @param waitFor - the consumer's waitFor (e.g. from `@testing-library/react`)
40
+ * @param interval - the polling interval in milliseconds, 1 by default
41
+ * @internal
42
+ */
43
+ export declare function createTightWaitFor(waitFor: WaitForFn, interval?: number): <T>(callback: () => T | Promise<T>) => Promise<T>;
44
+
32
45
  /**
33
46
  * Returns a promise which will resolve after the provided number of milliseconds.
34
47
  *
@@ -200,4 +213,14 @@ export declare function suppressConsole<T>(fn: () => T | Promise<T>, type?: Cons
200
213
  */
201
214
  export declare function suppressConsole<T>(fn: () => T | Promise<T>, matcherFn: MatcherFunction): T | Promise<T>;
202
215
 
216
+ /**
217
+ * A waitFor-compatible polling function, structurally matching testing-library's waitFor.
218
+ *
219
+ * @internal
220
+ */
221
+ export declare type WaitForFn = <T>(callback: () => T | Promise<T>, options?: {
222
+ interval?: number;
223
+ timeout?: number;
224
+ }) => Promise<T>;
225
+
203
226
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/util",
3
- "version": "11.53.0-alpha.6",
3
+ "version": "11.53.0",
4
4
  "description": "GoodData Utility Functions",
5
5
  "license": "MIT",
6
6
  "author": "GoodData",
@@ -47,8 +47,8 @@
47
47
  "oxlint-tsgolint": "0.15.0",
48
48
  "typescript": "5.9.3",
49
49
  "vitest": "4.1.8",
50
- "@gooddata/eslint-config": "11.53.0-alpha.6",
51
- "@gooddata/oxlint-config": "11.53.0-alpha.6"
50
+ "@gooddata/eslint-config": "11.53.0",
51
+ "@gooddata/oxlint-config": "11.53.0"
52
52
  },
53
53
  "scripts": {
54
54
  "_phase:build": "npm run build",