@ls-stack/utils 3.24.1 → 3.25.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/docs/_media/modules.md +1 -0
- package/docs/arrayUtils/-internal-.md +1 -1
- package/docs/arrayUtils/README.md +12 -12
- package/docs/consoleFmt.md +2 -2
- package/docs/exhaustiveMatch/-internal-.md +1 -1
- package/docs/exhaustiveMatch/README.md +1 -1
- package/docs/filterObjectOrArrayKeys.md +80 -0
- package/docs/modules.md +1 -0
- package/docs/objUtils.md +7 -7
- package/docs/parallelAsyncCalls/-internal-.md +3 -3
- package/docs/parallelAsyncCalls/README.md +1 -1
- package/docs/retryOnError/README.md +1 -1
- package/docs/runShellCmd/README.md +9 -9
- package/docs/safeJson.md +2 -2
- package/docs/saferTyping.md +7 -7
- package/docs/stringUtils/README.md +6 -6
- package/docs/testUtils.md +40 -6
- package/docs/time.md +1 -1
- package/docs/tsResult/README.md +17 -11
- package/docs/typingFnUtils/-internal-.md +1 -1
- package/docs/typingFnUtils/README.md +8 -10
- package/lib/arrayUtils.d.cts +6 -1
- package/lib/arrayUtils.d.ts +6 -1
- package/lib/{chunk-JAPKLFIK.js → chunk-QLD7KG5I.js} +34 -20
- package/lib/chunk-XXYTMSFH.js +240 -0
- package/lib/filterObjectOrArrayKeys.cjs +275 -0
- package/lib/filterObjectOrArrayKeys.d.cts +42 -0
- package/lib/filterObjectOrArrayKeys.d.ts +42 -0
- package/lib/filterObjectOrArrayKeys.js +7 -0
- package/lib/objUtils.d.cts +4 -1
- package/lib/objUtils.d.ts +4 -1
- package/lib/parallelAsyncCalls.cjs +4 -1
- package/lib/parallelAsyncCalls.d.cts +4 -1
- package/lib/parallelAsyncCalls.d.ts +4 -1
- package/lib/parallelAsyncCalls.js +4 -1
- package/lib/retryOnError.d.cts +2 -0
- package/lib/retryOnError.d.ts +2 -0
- package/lib/runShellCmd.d.cts +17 -0
- package/lib/runShellCmd.d.ts +17 -0
- package/lib/safeJson.d.cts +8 -2
- package/lib/safeJson.d.ts +8 -2
- package/lib/saferTyping.d.cts +3 -0
- package/lib/saferTyping.d.ts +3 -0
- package/lib/stringUtils.d.cts +1 -0
- package/lib/stringUtils.d.ts +1 -0
- package/lib/testUtils.cjs +273 -144
- package/lib/testUtils.d.cts +40 -12
- package/lib/testUtils.d.ts +40 -12
- package/lib/testUtils.js +10 -125
- package/lib/tsResult.d.cts +31 -7
- package/lib/tsResult.d.ts +31 -7
- package/lib/typingFnUtils.d.cts +20 -6
- package/lib/typingFnUtils.d.ts +20 -6
- package/lib/yamlStringify.cjs +34 -20
- package/lib/yamlStringify.js +1 -1
- package/package.json +5 -1
package/lib/retryOnError.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ type RetryOptions = {
|
|
|
18
18
|
* @param fn - Function to retry that receives context with retry count
|
|
19
19
|
* @param maxRetries - Maximum number of retries
|
|
20
20
|
* @param options - Configuration options
|
|
21
|
+
* @param retry
|
|
22
|
+
* @param originalMaxRetries
|
|
21
23
|
* @returns Promise resolving to the function result or rejecting with the final error
|
|
22
24
|
*
|
|
23
25
|
* @example
|
package/lib/runShellCmd.d.cts
CHANGED
|
@@ -13,6 +13,14 @@ type RunCmdOptions = {
|
|
|
13
13
|
noCiColorForce?: boolean;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
+
* @param label
|
|
17
|
+
* @param command
|
|
18
|
+
* @param root0
|
|
19
|
+
* @param root0.mock
|
|
20
|
+
* @param root0.silent
|
|
21
|
+
* @param root0.throwOnError
|
|
22
|
+
* @param root0.cwd
|
|
23
|
+
* @param root0.noCiColorForce
|
|
16
24
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
17
25
|
* ```
|
|
18
26
|
* // Old (deprecated)
|
|
@@ -24,6 +32,9 @@ type RunCmdOptions = {
|
|
|
24
32
|
*/
|
|
25
33
|
declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
|
|
26
34
|
/**
|
|
35
|
+
* @param label
|
|
36
|
+
* @param cmd
|
|
37
|
+
* @param onResult
|
|
27
38
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
28
39
|
* ```
|
|
29
40
|
* // Old (deprecated)
|
|
@@ -35,6 +46,10 @@ declare function runCmd(label: string | null, command: string | string[], { mock
|
|
|
35
46
|
*/
|
|
36
47
|
declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
|
|
37
48
|
/**
|
|
49
|
+
* @param label
|
|
50
|
+
* @param command
|
|
51
|
+
* @param root0
|
|
52
|
+
* @param root0.silent
|
|
38
53
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
39
54
|
* ```
|
|
40
55
|
* // Old (deprecated)
|
|
@@ -48,6 +63,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
|
|
|
48
63
|
silent?: boolean | 'timeOnly';
|
|
49
64
|
}): Promise<string>;
|
|
50
65
|
/**
|
|
66
|
+
* @param command
|
|
51
67
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
52
68
|
* ```
|
|
53
69
|
* // Old (deprecated)
|
|
@@ -59,6 +75,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
|
|
|
59
75
|
*/
|
|
60
76
|
declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
|
|
61
77
|
/**
|
|
78
|
+
* @param command
|
|
62
79
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
63
80
|
* ```
|
|
64
81
|
* // Old (deprecated)
|
package/lib/runShellCmd.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ type RunCmdOptions = {
|
|
|
13
13
|
noCiColorForce?: boolean;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
+
* @param label
|
|
17
|
+
* @param command
|
|
18
|
+
* @param root0
|
|
19
|
+
* @param root0.mock
|
|
20
|
+
* @param root0.silent
|
|
21
|
+
* @param root0.throwOnError
|
|
22
|
+
* @param root0.cwd
|
|
23
|
+
* @param root0.noCiColorForce
|
|
16
24
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
17
25
|
* ```
|
|
18
26
|
* // Old (deprecated)
|
|
@@ -24,6 +32,9 @@ type RunCmdOptions = {
|
|
|
24
32
|
*/
|
|
25
33
|
declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
|
|
26
34
|
/**
|
|
35
|
+
* @param label
|
|
36
|
+
* @param cmd
|
|
37
|
+
* @param onResult
|
|
27
38
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
28
39
|
* ```
|
|
29
40
|
* // Old (deprecated)
|
|
@@ -35,6 +46,10 @@ declare function runCmd(label: string | null, command: string | string[], { mock
|
|
|
35
46
|
*/
|
|
36
47
|
declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
|
|
37
48
|
/**
|
|
49
|
+
* @param label
|
|
50
|
+
* @param command
|
|
51
|
+
* @param root0
|
|
52
|
+
* @param root0.silent
|
|
38
53
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
39
54
|
* ```
|
|
40
55
|
* // Old (deprecated)
|
|
@@ -48,6 +63,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
|
|
|
48
63
|
silent?: boolean | 'timeOnly';
|
|
49
64
|
}): Promise<string>;
|
|
50
65
|
/**
|
|
66
|
+
* @param command
|
|
51
67
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
52
68
|
* ```
|
|
53
69
|
* // Old (deprecated)
|
|
@@ -59,6 +75,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
|
|
|
59
75
|
*/
|
|
60
76
|
declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
|
|
61
77
|
/**
|
|
78
|
+
* @param command
|
|
62
79
|
* @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
|
|
63
80
|
* ```
|
|
64
81
|
* // Old (deprecated)
|
package/lib/safeJson.d.cts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
|
|
3
|
+
* @param value
|
|
4
|
+
*/
|
|
2
5
|
declare function safeJsonStringify(value: unknown): string | undefined;
|
|
3
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
|
|
8
|
+
* @param value
|
|
9
|
+
*/
|
|
4
10
|
declare function safeJsonParse(value: string): unknown;
|
|
5
11
|
|
|
6
12
|
export { safeJsonParse, safeJsonStringify };
|
package/lib/safeJson.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
|
|
3
|
+
* @param value
|
|
4
|
+
*/
|
|
2
5
|
declare function safeJsonStringify(value: unknown): string | undefined;
|
|
3
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
|
|
8
|
+
* @param value
|
|
9
|
+
*/
|
|
4
10
|
declare function safeJsonParse(value: string): unknown;
|
|
5
11
|
|
|
6
12
|
export { safeJsonParse, safeJsonStringify };
|
package/lib/saferTyping.d.cts
CHANGED
|
@@ -8,12 +8,14 @@ type EmptyObject = Record<string, never>;
|
|
|
8
8
|
/**
|
|
9
9
|
* Cast a value to `any` type. Use this when you have legit usage of `any` casting.
|
|
10
10
|
*
|
|
11
|
+
* @param value
|
|
11
12
|
* @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
|
|
12
13
|
*/
|
|
13
14
|
declare function __LEGIT_ANY_CAST__<V = unknown>(value: V): __LEGIT_ANY__;
|
|
14
15
|
/**
|
|
15
16
|
* Cast a value to a specific type T. Use this when you have legit usage of type assertion.
|
|
16
17
|
*
|
|
18
|
+
* @param value
|
|
17
19
|
* @template T - The type to cast to
|
|
18
20
|
* @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
|
|
19
21
|
*/
|
|
@@ -21,6 +23,7 @@ declare function __LEGIT_CAST__<T, V = unknown>(value: V): T;
|
|
|
21
23
|
/**
|
|
22
24
|
* Refine a value to a specific type T. Use this when you have legit usage of type assertion.
|
|
23
25
|
*
|
|
26
|
+
* @param value
|
|
24
27
|
* @template T - The type to cast to
|
|
25
28
|
* @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
|
|
26
29
|
*/
|
package/lib/saferTyping.d.ts
CHANGED
|
@@ -8,12 +8,14 @@ type EmptyObject = Record<string, never>;
|
|
|
8
8
|
/**
|
|
9
9
|
* Cast a value to `any` type. Use this when you have legit usage of `any` casting.
|
|
10
10
|
*
|
|
11
|
+
* @param value
|
|
11
12
|
* @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
|
|
12
13
|
*/
|
|
13
14
|
declare function __LEGIT_ANY_CAST__<V = unknown>(value: V): __LEGIT_ANY__;
|
|
14
15
|
/**
|
|
15
16
|
* Cast a value to a specific type T. Use this when you have legit usage of type assertion.
|
|
16
17
|
*
|
|
18
|
+
* @param value
|
|
17
19
|
* @template T - The type to cast to
|
|
18
20
|
* @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
|
|
19
21
|
*/
|
|
@@ -21,6 +23,7 @@ declare function __LEGIT_CAST__<T, V = unknown>(value: V): T;
|
|
|
21
23
|
/**
|
|
22
24
|
* Refine a value to a specific type T. Use this when you have legit usage of type assertion.
|
|
23
25
|
*
|
|
26
|
+
* @param value
|
|
24
27
|
* @template T - The type to cast to
|
|
25
28
|
* @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
|
|
26
29
|
*/
|
package/lib/stringUtils.d.cts
CHANGED