@ls-stack/utils 3.39.0 → 3.41.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.
Files changed (162) hide show
  1. package/dist/arrayUtils.d.cts +70 -57
  2. package/dist/arrayUtils.d.ts +70 -57
  3. package/dist/assertions.d.cts +128 -117
  4. package/dist/assertions.d.ts +128 -117
  5. package/dist/asyncQueue.cjs +117 -112
  6. package/dist/asyncQueue.d.cts +217 -215
  7. package/dist/asyncQueue.d.ts +217 -215
  8. package/dist/asyncQueue.js +117 -112
  9. package/dist/awaitDebounce.d.cts +26 -23
  10. package/dist/awaitDebounce.d.ts +26 -23
  11. package/dist/cache.cjs +2 -1
  12. package/dist/cache.d.cts +15 -9
  13. package/dist/cache.d.ts +15 -9
  14. package/dist/cache.js +2 -1
  15. package/dist/{chunk-GHAQOUA6.js → chunk-23KPGKDT.js} +22 -1
  16. package/dist/{chunk-ADM37GSC.js → chunk-7L4KCZJJ.js} +12 -10
  17. package/dist/{chunk-KW55OTUG.js → chunk-B3KFV2MH.js} +2 -2
  18. package/dist/chunk-DTE2QMWE.js +48 -0
  19. package/dist/concurrentCalls.d.cts +8 -4
  20. package/dist/concurrentCalls.d.ts +8 -4
  21. package/dist/concurrentCalls.js +1 -1
  22. package/dist/consoleFmt.cjs +1 -0
  23. package/dist/consoleFmt.d.cts +6 -0
  24. package/dist/consoleFmt.d.ts +6 -0
  25. package/dist/consoleFmt.js +1 -0
  26. package/dist/debounce.d.cts +12 -20
  27. package/dist/debounce.d.ts +12 -20
  28. package/dist/dedent.d.cts +31 -31
  29. package/dist/dedent.d.ts +31 -31
  30. package/dist/deepEqual.d.cts +10 -9
  31. package/dist/deepEqual.d.ts +10 -9
  32. package/dist/filterObjectOrArrayKeys.d.cts +44 -19
  33. package/dist/filterObjectOrArrayKeys.d.ts +44 -19
  34. package/dist/getAutoIncrementId.d.cts +25 -23
  35. package/dist/getAutoIncrementId.d.ts +25 -23
  36. package/dist/getCompositeKey.d.cts +2 -1
  37. package/dist/getCompositeKey.d.ts +2 -1
  38. package/dist/getValueStableKey.d.cts +4 -3
  39. package/dist/getValueStableKey.d.ts +4 -3
  40. package/dist/mutationUtils.d.cts +2 -2
  41. package/dist/mutationUtils.d.ts +2 -2
  42. package/dist/objUtils.cjs +51 -2
  43. package/dist/objUtils.d.cts +8 -3
  44. package/dist/objUtils.d.ts +8 -3
  45. package/dist/objUtils.js +11 -3
  46. package/dist/parallelAsyncCalls.cjs +2 -1
  47. package/dist/parallelAsyncCalls.d.cts +5 -4
  48. package/dist/parallelAsyncCalls.d.ts +5 -4
  49. package/dist/parallelAsyncCalls.js +2 -1
  50. package/dist/retryOnError.d.cts +23 -20
  51. package/dist/retryOnError.d.ts +23 -20
  52. package/dist/runShellCmd.d.cts +40 -40
  53. package/dist/runShellCmd.d.ts +40 -40
  54. package/dist/safeJson.d.cts +6 -2
  55. package/dist/safeJson.d.ts +6 -2
  56. package/dist/saferTyping.d.cts +21 -14
  57. package/dist/saferTyping.d.ts +21 -14
  58. package/dist/shallowEqual.d.cts +1 -1
  59. package/dist/shallowEqual.d.ts +1 -1
  60. package/dist/stringUtils.cjs +2 -2
  61. package/dist/stringUtils.d.cts +6 -7
  62. package/dist/stringUtils.d.ts +6 -7
  63. package/dist/stringUtils.js +1 -1
  64. package/dist/testUtils.cjs +11 -9
  65. package/dist/testUtils.d.cts +32 -14
  66. package/dist/testUtils.d.ts +32 -14
  67. package/dist/testUtils.js +4 -3
  68. package/dist/throttle.d.cts +57 -48
  69. package/dist/throttle.d.ts +57 -48
  70. package/dist/timers.d.cts +68 -63
  71. package/dist/timers.d.ts +68 -63
  72. package/dist/tsResult.d.cts +7 -6
  73. package/dist/tsResult.d.ts +7 -6
  74. package/dist/typeGuards.d.cts +65 -64
  75. package/dist/typeGuards.d.ts +65 -64
  76. package/dist/typeUtils.d.cts +18 -4
  77. package/dist/typeUtils.d.ts +18 -4
  78. package/dist/typedStrings.d.cts +68 -57
  79. package/dist/typedStrings.d.ts +68 -57
  80. package/dist/typingFnUtils.d.cts +12 -6
  81. package/dist/typingFnUtils.d.ts +12 -6
  82. package/dist/typingFnUtils.js +12 -35
  83. package/dist/typingTestUtils.cjs +7 -1
  84. package/dist/typingTestUtils.d.cts +52 -11
  85. package/dist/typingTestUtils.d.ts +52 -11
  86. package/dist/typingTestUtils.js +7 -1
  87. package/dist/typingUtils.d.cts +4 -1
  88. package/dist/typingUtils.d.ts +4 -1
  89. package/dist/yamlStringify.cjs +11 -9
  90. package/dist/yamlStringify.js +2 -2
  91. package/package.json +6 -2
  92. package/docs/README.md +0 -72
  93. package/docs/_media/modules.md +0 -58
  94. package/docs/arrayUtils/-internal-.md +0 -179
  95. package/docs/arrayUtils/README.md +0 -550
  96. package/docs/assertions/-internal-.md +0 -63
  97. package/docs/assertions/README.md +0 -565
  98. package/docs/asyncQueue/-internal-.md +0 -297
  99. package/docs/asyncQueue/README.md +0 -1485
  100. package/docs/awaitDebounce.md +0 -66
  101. package/docs/cache/-internal-.md +0 -168
  102. package/docs/cache/README.md +0 -360
  103. package/docs/castValues.md +0 -47
  104. package/docs/concurrentCalls/-internal-.md +0 -490
  105. package/docs/concurrentCalls/README.md +0 -299
  106. package/docs/consoleFmt.md +0 -91
  107. package/docs/conversions.md +0 -27
  108. package/docs/createThrottleController/-internal-.md +0 -73
  109. package/docs/createThrottleController/README.md +0 -31
  110. package/docs/debounce.md +0 -188
  111. package/docs/dedent/-internal-.md +0 -17
  112. package/docs/dedent/README.md +0 -204
  113. package/docs/deepEqual.md +0 -94
  114. package/docs/enhancedMap.md +0 -358
  115. package/docs/exhaustiveMatch/-internal-.md +0 -39
  116. package/docs/exhaustiveMatch/README.md +0 -146
  117. package/docs/filterObjectOrArrayKeys.md +0 -109
  118. package/docs/getAutoIncrementId.md +0 -93
  119. package/docs/getCompositeKey.md +0 -39
  120. package/docs/getValueStableKey.md +0 -57
  121. package/docs/hash.md +0 -31
  122. package/docs/interpolate/-internal-.md +0 -61
  123. package/docs/interpolate/README.md +0 -62
  124. package/docs/keepPrevIfUnchanged.md +0 -43
  125. package/docs/levenshtein.md +0 -93
  126. package/docs/main.md +0 -21
  127. package/docs/mathUtils.md +0 -137
  128. package/docs/modules.md +0 -58
  129. package/docs/mutationUtils.md +0 -44
  130. package/docs/objUtils.md +0 -237
  131. package/docs/parallelAsyncCalls/-internal-.md +0 -347
  132. package/docs/parallelAsyncCalls/README.md +0 -45
  133. package/docs/promiseUtils/-internal-.md +0 -69
  134. package/docs/promiseUtils/README.md +0 -31
  135. package/docs/retryOnError/-internal-.md +0 -111
  136. package/docs/retryOnError/README.md +0 -168
  137. package/docs/runShellCmd/-internal-.md +0 -111
  138. package/docs/runShellCmd/README.md +0 -201
  139. package/docs/safeJson.md +0 -51
  140. package/docs/saferTyping.md +0 -228
  141. package/docs/serializeXML.md +0 -100
  142. package/docs/shallowEqual.md +0 -33
  143. package/docs/sleep.md +0 -27
  144. package/docs/stringUtils/-internal-.md +0 -17
  145. package/docs/stringUtils/README.md +0 -270
  146. package/docs/testUtils.md +0 -382
  147. package/docs/throttle/-internal-.md +0 -47
  148. package/docs/throttle/README.md +0 -178
  149. package/docs/time.md +0 -274
  150. package/docs/timers.md +0 -256
  151. package/docs/tsResult/-internal-.md +0 -327
  152. package/docs/tsResult/README.md +0 -702
  153. package/docs/typeGuards.md +0 -399
  154. package/docs/typeUtils/-internal-.md +0 -99
  155. package/docs/typeUtils/README.md +0 -195
  156. package/docs/typeUtils.typesTest.md +0 -7
  157. package/docs/typedStrings.md +0 -458
  158. package/docs/typingFnUtils/-internal-.md +0 -43
  159. package/docs/typingFnUtils/README.md +0 -317
  160. package/docs/typingTestUtils.md +0 -172
  161. package/docs/typingUtils.md +0 -135
  162. package/docs/yamlStringify.md +0 -83
@@ -1,168 +0,0 @@
1
- [**@ls-stack/utils**](../README.md)
2
-
3
- ***
4
-
5
- [@ls-stack/utils](../modules.md) / retryOnError
6
-
7
- # retryOnError
8
-
9
- ## Modules
10
-
11
- - [\<internal\>](-internal-.md)
12
-
13
- ## Functions
14
-
15
- ### retryOnError()
16
-
17
- ```ts
18
- function retryOnError<T>(
19
- fn,
20
- maxRetries,
21
- options,
22
- retry,
23
- originalMaxRetries): Promise<T>;
24
- ```
25
-
26
- Defined in: [packages/utils/src/retryOnError.ts:46](https://github.com/lucasols/utils/blob/main/packages/utils/src/retryOnError.ts#L46)
27
-
28
- Retries a function on error with configurable retry logic.
29
-
30
- #### Type Parameters
31
-
32
- ##### T
33
-
34
- `T`
35
-
36
- #### Parameters
37
-
38
- ##### fn
39
-
40
- (`ctx`) => `Promise`\<`T`\>
41
-
42
- Function to retry that receives context with retry count
43
-
44
- ##### maxRetries
45
-
46
- `number`
47
-
48
- Maximum number of retries
49
-
50
- ##### options
51
-
52
- [`RetryOptions`](-internal-.md#retryoptions) = `{}`
53
-
54
- Configuration options
55
-
56
- ##### retry
57
-
58
- `number` = `0`
59
-
60
- internal use only
61
-
62
- ##### originalMaxRetries
63
-
64
- `number` = `maxRetries`
65
-
66
- internal use only
67
-
68
- #### Returns
69
-
70
- `Promise`\<`T`\>
71
-
72
- Promise resolving to the function result or rejecting with the final error
73
-
74
- #### Example
75
-
76
- ```ts
77
- await retryOnError(
78
- async (ctx) => {
79
- console.log(`Attempt ${ctx.retry + 1}`);
80
- return await fetchData();
81
- },
82
- 3,
83
- { delayBetweenRetriesMs: 1000 }
84
- );
85
- ```
86
-
87
- ***
88
-
89
- ### retryResultOnError()
90
-
91
- ```ts
92
- function retryResultOnError<T, E>(
93
- fn,
94
- maxRetries,
95
- options,
96
- __retry,
97
- __originalMaxRetries): Promise<Result<T, E>>;
98
- ```
99
-
100
- Defined in: [packages/utils/src/retryOnError.ts:132](https://github.com/lucasols/utils/blob/main/packages/utils/src/retryOnError.ts#L132)
101
-
102
- Retries a result function on error with configurable retry logic.
103
-
104
- #### Type Parameters
105
-
106
- ##### T
107
-
108
- `T`
109
-
110
- ##### E
111
-
112
- `E` *extends* `ResultValidErrors`
113
-
114
- #### Parameters
115
-
116
- ##### fn
117
-
118
- (`ctx`) => `Promise`\<`Result`\<`T`, `E`\>\>
119
-
120
- Function to retry that receives context with retry count
121
-
122
- ##### maxRetries
123
-
124
- `number`
125
-
126
- Maximum number of retries
127
-
128
- ##### options
129
-
130
- Configuration options
131
-
132
- ###### debugId?
133
-
134
- `string`
135
-
136
- ###### delayBetweenRetriesMs?
137
-
138
- `number` \| (`retry`) => `number`
139
-
140
- ###### disableRetries?
141
-
142
- `boolean`
143
-
144
- ###### onRetry?
145
-
146
- (`error`, `lastAttempt`) => `void`
147
-
148
- ###### retryCondition?
149
-
150
- (`error`, `lastAttempt`) => `boolean`
151
-
152
- ##### \_\_retry
153
-
154
- `number` = `0`
155
-
156
- internal use only
157
-
158
- ##### \_\_originalMaxRetries
159
-
160
- `number` = `maxRetries`
161
-
162
- internal use only
163
-
164
- #### Returns
165
-
166
- `Promise`\<`Result`\<`T`, `E`\>\>
167
-
168
- Promise resolving to the function result or rejecting with the final error
@@ -1,111 +0,0 @@
1
- [**@ls-stack/utils**](../README.md)
2
-
3
- ***
4
-
5
- [@ls-stack/utils](../modules.md) / [runShellCmd](README.md) / \<internal\>
6
-
7
- # \<internal\>
8
-
9
- ## Type Aliases
10
-
11
- ### CmdResult
12
-
13
- ```ts
14
- type CmdResult = object;
15
- ```
16
-
17
- Defined in: [packages/utils/src/runShellCmd.ts:3](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L3)
18
-
19
- #### Properties
20
-
21
- ##### error
22
-
23
- ```ts
24
- error: boolean;
25
- ```
26
-
27
- Defined in: [packages/utils/src/runShellCmd.ts:6](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L6)
28
-
29
- ##### label
30
-
31
- ```ts
32
- label: string | null;
33
- ```
34
-
35
- Defined in: [packages/utils/src/runShellCmd.ts:4](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L4)
36
-
37
- ##### out
38
-
39
- ```ts
40
- out: string;
41
- ```
42
-
43
- Defined in: [packages/utils/src/runShellCmd.ts:5](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L5)
44
-
45
- ##### stderr
46
-
47
- ```ts
48
- stderr: string;
49
- ```
50
-
51
- Defined in: [packages/utils/src/runShellCmd.ts:8](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L8)
52
-
53
- ##### stdout
54
-
55
- ```ts
56
- stdout: string;
57
- ```
58
-
59
- Defined in: [packages/utils/src/runShellCmd.ts:7](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L7)
60
-
61
- ***
62
-
63
- ### RunCmdOptions
64
-
65
- ```ts
66
- type RunCmdOptions = object;
67
- ```
68
-
69
- Defined in: [packages/utils/src/runShellCmd.ts:13](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L13)
70
-
71
- #### Properties
72
-
73
- ##### cwd?
74
-
75
- ```ts
76
- optional cwd: string;
77
- ```
78
-
79
- Defined in: [packages/utils/src/runShellCmd.ts:16](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L16)
80
-
81
- ##### mock?
82
-
83
- ```ts
84
- optional mock: CmdResult;
85
- ```
86
-
87
- Defined in: [packages/utils/src/runShellCmd.ts:14](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L14)
88
-
89
- ##### noCiColorForce?
90
-
91
- ```ts
92
- optional noCiColorForce: boolean;
93
- ```
94
-
95
- Defined in: [packages/utils/src/runShellCmd.ts:18](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L18)
96
-
97
- ##### silent?
98
-
99
- ```ts
100
- optional silent: boolean | "timeOnly";
101
- ```
102
-
103
- Defined in: [packages/utils/src/runShellCmd.ts:15](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L15)
104
-
105
- ##### throwOnError?
106
-
107
- ```ts
108
- optional throwOnError: boolean;
109
- ```
110
-
111
- Defined in: [packages/utils/src/runShellCmd.ts:17](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L17)
@@ -1,201 +0,0 @@
1
- [**@ls-stack/utils**](../README.md)
2
-
3
- ***
4
-
5
- [@ls-stack/utils](../modules.md) / runShellCmd
6
-
7
- # runShellCmd
8
-
9
- ## Modules
10
-
11
- - [\<internal\>](-internal-.md)
12
-
13
- ## Functions
14
-
15
- ### ~~concurrentCmd()~~
16
-
17
- ```ts
18
- function concurrentCmd(
19
- label,
20
- cmd,
21
- onResult): Promise<() => void>;
22
- ```
23
-
24
- Defined in: [packages/utils/src/runShellCmd.ts:133](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L133)
25
-
26
- #### Parameters
27
-
28
- ##### label
29
-
30
- `string`
31
-
32
- ##### cmd
33
-
34
- `string` | `string`[]
35
-
36
- ##### onResult
37
-
38
- (`result`) => `void`
39
-
40
- #### Returns
41
-
42
- `Promise`\<() => `void`\>
43
-
44
- #### Deprecated
45
-
46
- This utility has been moved to @ls-stack/node-utils. Please update your imports:
47
- ```
48
- // Old (deprecated)
49
- import { concurrentCmd } from '@ls-stack/utils/runShellCmd';
50
-
51
- // New (preferred)
52
- import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
53
- ```
54
-
55
- ***
56
-
57
- ### ~~runCmd()~~
58
-
59
- ```ts
60
- function runCmd(
61
- label,
62
- command,
63
- root0): Promise<CmdResult>;
64
- ```
65
-
66
- Defined in: [packages/utils/src/runShellCmd.ts:39](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L39)
67
-
68
- #### Parameters
69
-
70
- ##### label
71
-
72
- `null` | `string`
73
-
74
- ##### command
75
-
76
- `string` | `string`[]
77
-
78
- ##### root0
79
-
80
- [`RunCmdOptions`](-internal-.md#runcmdoptions) = `{}`
81
-
82
- #### Returns
83
-
84
- `Promise`\<[`CmdResult`](-internal-.md#cmdresult)\>
85
-
86
- #### Deprecated
87
-
88
- This utility has been moved to @ls-stack/node-utils. Please update your imports:
89
- ```
90
- // Old (deprecated)
91
- import { runCmd } from '@ls-stack/utils/runShellCmd';
92
-
93
- // New (preferred)
94
- import { runCmd } from '@ls-stack/node-utils/runShellCmd';
95
- ```
96
-
97
- ***
98
-
99
- ### ~~runCmdSilent()~~
100
-
101
- ```ts
102
- function runCmdSilent(command): Promise<CmdResult>;
103
- ```
104
-
105
- Defined in: [packages/utils/src/runShellCmd.ts:198](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L198)
106
-
107
- #### Parameters
108
-
109
- ##### command
110
-
111
- `string` | `string`[]
112
-
113
- #### Returns
114
-
115
- `Promise`\<[`CmdResult`](-internal-.md#cmdresult)\>
116
-
117
- #### Deprecated
118
-
119
- This utility has been moved to @ls-stack/node-utils. Please update your imports:
120
- ```
121
- // Old (deprecated)
122
- import { runCmdSilent } from '@ls-stack/utils/runShellCmd';
123
-
124
- // New (preferred)
125
- import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
126
- ```
127
-
128
- ***
129
-
130
- ### ~~runCmdSilentUnwrap()~~
131
-
132
- ```ts
133
- function runCmdSilentUnwrap(command): Promise<string>;
134
- ```
135
-
136
- Defined in: [packages/utils/src/runShellCmd.ts:213](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L213)
137
-
138
- #### Parameters
139
-
140
- ##### command
141
-
142
- `string` | `string`[]
143
-
144
- #### Returns
145
-
146
- `Promise`\<`string`\>
147
-
148
- #### Deprecated
149
-
150
- This utility has been moved to @ls-stack/node-utils. Please update your imports:
151
- ```
152
- // Old (deprecated)
153
- import { runCmdSilentUnwrap } from '@ls-stack/utils/runShellCmd';
154
-
155
- // New (preferred)
156
- import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
157
- ```
158
-
159
- ***
160
-
161
- ### ~~runCmdUnwrap()~~
162
-
163
- ```ts
164
- function runCmdUnwrap(
165
- label,
166
- command,
167
- root0): Promise<string>;
168
- ```
169
-
170
- Defined in: [packages/utils/src/runShellCmd.ts:175](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L175)
171
-
172
- #### Parameters
173
-
174
- ##### label
175
-
176
- `null` | `string`
177
-
178
- ##### command
179
-
180
- `string` | `string`[]
181
-
182
- ##### root0
183
-
184
- ###### silent?
185
-
186
- `boolean` \| `"timeOnly"`
187
-
188
- #### Returns
189
-
190
- `Promise`\<`string`\>
191
-
192
- #### Deprecated
193
-
194
- This utility has been moved to @ls-stack/node-utils. Please update your imports:
195
- ```
196
- // Old (deprecated)
197
- import { runCmdUnwrap } from '@ls-stack/utils/runShellCmd';
198
-
199
- // New (preferred)
200
- import { runCmdUnwrap } from '@ls-stack/node-utils/runShellCmd';
201
- ```
package/docs/safeJson.md DELETED
@@ -1,51 +0,0 @@
1
- [**@ls-stack/utils**](README.md)
2
-
3
- ***
4
-
5
- [@ls-stack/utils](modules.md) / safeJson
6
-
7
- # safeJson
8
-
9
- ## Functions
10
-
11
- ### safeJsonParse()
12
-
13
- ```ts
14
- function safeJsonParse(value): unknown;
15
- ```
16
-
17
- Defined in: [packages/utils/src/safeJson.ts:17](https://github.com/lucasols/utils/blob/main/packages/utils/src/safeJson.ts#L17)
18
-
19
- JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
20
-
21
- #### Parameters
22
-
23
- ##### value
24
-
25
- `string`
26
-
27
- #### Returns
28
-
29
- `unknown`
30
-
31
- ***
32
-
33
- ### safeJsonStringify()
34
-
35
- ```ts
36
- function safeJsonStringify(value): undefined | string;
37
- ```
38
-
39
- Defined in: [packages/utils/src/safeJson.ts:5](https://github.com/lucasols/utils/blob/main/packages/utils/src/safeJson.ts#L5)
40
-
41
- JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
42
-
43
- #### Parameters
44
-
45
- ##### value
46
-
47
- `unknown`
48
-
49
- #### Returns
50
-
51
- `undefined` \| `string`