@kdtlabs/utils 0.0.4 → 0.0.5

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 (447) hide show
  1. package/SKILL.md +7 -9
  2. package/{common → dist/common}/assertions.d.ts +1 -1
  3. package/{common → dist/common}/assertions.d.ts.map +1 -1
  4. package/{common → dist/common}/types.d.ts +1 -1
  5. package/{common → dist/common}/types.d.ts.map +1 -1
  6. package/{functions → dist/functions}/executions.d.ts +1 -1
  7. package/{functions → dist/functions}/executions.d.ts.map +1 -1
  8. package/dist/index.js +7 -0
  9. package/dist/index.js.map +99 -0
  10. package/{objects → dist/objects}/transformations.d.ts +1 -1
  11. package/{objects → dist/objects}/transformations.d.ts.map +1 -1
  12. package/{objects → dist/objects}/types.d.ts +1 -1
  13. package/{objects → dist/objects}/types.d.ts.map +1 -1
  14. package/{promises → dist/promises}/deferred.d.ts +1 -1
  15. package/{promises → dist/promises}/deferred.d.ts.map +1 -1
  16. package/{promises → dist/promises}/timers.d.ts +1 -1
  17. package/{promises → dist/promises}/timers.d.ts.map +1 -1
  18. package/{serializer → dist/serializer}/context.d.ts +1 -1
  19. package/{serializer → dist/serializer}/context.d.ts.map +1 -1
  20. package/{serializer → dist/serializer}/serialize.d.ts +1 -1
  21. package/{serializer → dist/serializer}/serialize.d.ts.map +1 -1
  22. package/{serializer → dist/serializer}/serializers/array.d.ts +1 -1
  23. package/{serializer → dist/serializer}/serializers/array.d.ts.map +1 -1
  24. package/{serializer → dist/serializer}/serializers/binary.d.ts +1 -1
  25. package/dist/serializer/serializers/binary.d.ts.map +1 -0
  26. package/{serializer → dist/serializer}/serializers/blob.d.ts +1 -1
  27. package/dist/serializer/serializers/blob.d.ts.map +1 -0
  28. package/{serializer → dist/serializer}/serializers/collection.d.ts +1 -1
  29. package/{serializer → dist/serializer}/serializers/collection.d.ts.map +1 -1
  30. package/{serializer → dist/serializer}/serializers/compound.d.ts +1 -1
  31. package/{serializer → dist/serializer}/serializers/compound.d.ts.map +1 -1
  32. package/{serializer → dist/serializer}/serializers/error.d.ts +1 -1
  33. package/{serializer → dist/serializer}/serializers/error.d.ts.map +1 -1
  34. package/{serializer → dist/serializer}/serializers/function.d.ts +1 -1
  35. package/{serializer → dist/serializer}/serializers/function.d.ts.map +1 -1
  36. package/{serializer → dist/serializer}/serializers/leaf-object.d.ts +1 -1
  37. package/{serializer → dist/serializer}/serializers/leaf-object.d.ts.map +1 -1
  38. package/{serializer → dist/serializer}/serializers/number.d.ts +1 -1
  39. package/dist/serializer/serializers/number.d.ts.map +1 -0
  40. package/{serializer → dist/serializer}/serializers/object.d.ts +1 -1
  41. package/{serializer → dist/serializer}/serializers/object.d.ts.map +1 -1
  42. package/{serializer → dist/serializer}/serializers/opaque.d.ts +1 -1
  43. package/dist/serializer/serializers/opaque.d.ts.map +1 -0
  44. package/{serializer → dist/serializer}/serializers/primitive.d.ts +1 -1
  45. package/{serializer → dist/serializer}/serializers/primitive.d.ts.map +1 -1
  46. package/{serializer → dist/serializer}/types.d.ts +1 -1
  47. package/{serializer → dist/serializer}/types.d.ts.map +1 -1
  48. package/{serializer → dist/serializer}/utils.d.ts +1 -1
  49. package/{serializer → dist/serializer}/utils.d.ts.map +1 -1
  50. package/{system → dist/system}/fetch.d.ts +2 -2
  51. package/{system → dist/system}/fetch.d.ts.map +1 -1
  52. package/dist/system/types.d.ts +3 -0
  53. package/{system → dist/system}/types.d.ts.map +1 -1
  54. package/{times → dist/times}/conversions.d.ts +1 -1
  55. package/{times → dist/times}/conversions.d.ts.map +1 -1
  56. package/package.json +11 -73
  57. package/src/arrays/accessors.ts +25 -0
  58. package/src/arrays/conversions.ts +16 -0
  59. package/src/arrays/factories.ts +13 -0
  60. package/src/arrays/guards.ts +7 -0
  61. package/src/arrays/index.ts +8 -0
  62. package/src/arrays/operations.ts +103 -0
  63. package/src/arrays/set-operations.ts +11 -0
  64. package/src/arrays/types.ts +21 -0
  65. package/src/buffers/conversions.ts +26 -0
  66. package/src/buffers/guards.ts +13 -0
  67. package/src/buffers/index.ts +5 -0
  68. package/src/buffers/operations.ts +44 -0
  69. package/src/buffers/types.ts +1 -0
  70. package/src/collections/fifo-map.ts +33 -0
  71. package/src/collections/fifo-set.ts +29 -0
  72. package/src/collections/guards.ts +11 -0
  73. package/src/collections/index.ts +10 -0
  74. package/src/collections/linked-base.ts +117 -0
  75. package/src/collections/linked-map.ts +82 -0
  76. package/src/collections/linked-set.ts +69 -0
  77. package/src/collections/lru-map.ts +36 -0
  78. package/src/collections/lru-set.ts +25 -0
  79. package/src/collections/types.ts +12 -0
  80. package/src/common/assertions.ts +11 -0
  81. package/src/common/guards.ts +58 -0
  82. package/src/common/index.ts +5 -0
  83. package/src/common/transformations.ts +20 -0
  84. package/src/common/types.ts +3 -0
  85. package/src/core/constants.ts +1 -0
  86. package/src/core/conversions.ts +9 -0
  87. package/src/core/guards.ts +57 -0
  88. package/src/core/index.ts +5 -0
  89. package/src/core/types.ts +15 -0
  90. package/src/errors/base-error.ts +48 -0
  91. package/src/errors/factories.ts +74 -0
  92. package/src/errors/guards.ts +12 -0
  93. package/src/errors/index.ts +7 -0
  94. package/src/errors/operations.ts +15 -0
  95. package/src/errors/stringify.ts +131 -0
  96. package/src/errors/types.ts +11 -0
  97. package/src/events/emitter.ts +117 -0
  98. package/src/events/index.ts +2 -0
  99. package/src/events/types.ts +11 -0
  100. package/src/functions/compositions.ts +17 -0
  101. package/src/functions/debounce.ts +34 -0
  102. package/src/functions/executions.ts +12 -0
  103. package/src/functions/guards.ts +5 -0
  104. package/src/functions/index.ts +11 -0
  105. package/src/functions/memoize.ts +33 -0
  106. package/src/functions/once.ts +33 -0
  107. package/src/functions/pipe.ts +39 -0
  108. package/src/functions/throttle.ts +59 -0
  109. package/src/functions/timer-state.ts +33 -0
  110. package/src/functions/types.ts +8 -0
  111. package/src/index.ts +16 -0
  112. package/src/json-rpc/constants.ts +15 -0
  113. package/src/json-rpc/factories.ts +22 -0
  114. package/src/json-rpc/guards.ts +58 -0
  115. package/src/json-rpc/index.ts +5 -0
  116. package/src/json-rpc/types.ts +48 -0
  117. package/src/numbers/bigint-math.ts +163 -0
  118. package/src/numbers/constants.ts +14 -0
  119. package/src/numbers/conversions.ts +83 -0
  120. package/src/numbers/factories.ts +6 -0
  121. package/src/numbers/formats.ts +52 -0
  122. package/src/numbers/guards.ts +22 -0
  123. package/src/numbers/index.ts +10 -0
  124. package/src/numbers/maths.ts +28 -0
  125. package/src/numbers/ranges.ts +17 -0
  126. package/src/numbers/types.ts +7 -0
  127. package/src/objects/deep-merge.ts +76 -0
  128. package/src/objects/guards.ts +21 -0
  129. package/src/objects/index.ts +5 -0
  130. package/src/objects/transformations.ts +34 -0
  131. package/src/objects/types.ts +33 -0
  132. package/src/promises/abortable.ts +37 -0
  133. package/src/promises/compositions.ts +18 -0
  134. package/src/promises/deferred.ts +131 -0
  135. package/src/promises/guards.ts +8 -0
  136. package/src/promises/index.ts +10 -0
  137. package/src/promises/pipe.ts +39 -0
  138. package/src/promises/poll.ts +92 -0
  139. package/src/promises/retry.ts +138 -0
  140. package/src/promises/timers.ts +16 -0
  141. package/src/promises/types.ts +1 -0
  142. package/src/serializer/constants.ts +5 -0
  143. package/src/serializer/context.ts +24 -0
  144. package/src/serializer/index.ts +8 -0
  145. package/src/serializer/serialize.ts +51 -0
  146. package/src/serializer/serializers/array.ts +17 -0
  147. package/src/serializer/serializers/binary.ts +24 -0
  148. package/src/serializer/serializers/blob.ts +18 -0
  149. package/src/serializer/serializers/collection.ts +25 -0
  150. package/src/serializer/serializers/compound.ts +79 -0
  151. package/src/serializer/serializers/error.ts +75 -0
  152. package/src/serializer/serializers/function.ts +13 -0
  153. package/src/serializer/serializers/index.ts +12 -0
  154. package/src/serializer/serializers/leaf-object.ts +18 -0
  155. package/src/serializer/serializers/number.ts +14 -0
  156. package/src/serializer/serializers/object.ts +62 -0
  157. package/src/serializer/serializers/opaque.ts +36 -0
  158. package/src/serializer/serializers/primitive.ts +32 -0
  159. package/src/serializer/symbol-registry.ts +28 -0
  160. package/src/serializer/types.ts +42 -0
  161. package/src/serializer/utils.ts +15 -0
  162. package/src/strings/constants.ts +1 -0
  163. package/src/strings/factories.ts +9 -0
  164. package/src/strings/guards.ts +51 -0
  165. package/src/strings/index.ts +6 -0
  166. package/src/strings/manipulations.ts +99 -0
  167. package/src/strings/types.ts +3 -0
  168. package/src/system/env.ts +32 -0
  169. package/src/system/fetch.ts +23 -0
  170. package/src/system/graceful-exit.ts +46 -0
  171. package/src/system/index.ts +6 -0
  172. package/src/system/path.ts +12 -0
  173. package/src/system/types.ts +3 -0
  174. package/src/times/constants.ts +6 -0
  175. package/src/times/conversions.ts +85 -0
  176. package/src/times/factories.ts +3 -0
  177. package/src/times/guards.ts +3 -0
  178. package/src/times/index.ts +5 -0
  179. package/src/times/operations.ts +9 -0
  180. package/CHANGELOG.md +0 -57
  181. package/arrays/index.js +0 -4
  182. package/arrays/index.js.map +0 -9
  183. package/buffers/index.js +0 -4
  184. package/buffers/index.js.map +0 -9
  185. package/chunk-25ja9350.js +0 -4
  186. package/chunk-25ja9350.js.map +0 -13
  187. package/chunk-3w6nt7kb.js +0 -4
  188. package/chunk-3w6nt7kb.js.map +0 -12
  189. package/chunk-5txwcr6j.js +0 -4
  190. package/chunk-5txwcr6j.js.map +0 -17
  191. package/chunk-6dxad51h.js +0 -4
  192. package/chunk-6dxad51h.js.map +0 -12
  193. package/chunk-6kdnnxe0.js +0 -4
  194. package/chunk-6kdnnxe0.js.map +0 -17
  195. package/chunk-7cndek91.js +0 -4
  196. package/chunk-7cndek91.js.map +0 -15
  197. package/chunk-bee0nxse.js +0 -6
  198. package/chunk-bee0nxse.js.map +0 -14
  199. package/chunk-bjmntg2y.js +0 -4
  200. package/chunk-bjmntg2y.js.map +0 -18
  201. package/chunk-d0d0d285.js +0 -4
  202. package/chunk-d0d0d285.js.map +0 -26
  203. package/chunk-jny2gdyy.js +0 -4
  204. package/chunk-jny2gdyy.js.map +0 -12
  205. package/chunk-kbzgn0z4.js +0 -4
  206. package/chunk-kbzgn0z4.js.map +0 -10
  207. package/chunk-qmbgp0vr.js +0 -4
  208. package/chunk-qmbgp0vr.js.map +0 -12
  209. package/chunk-qn6n0ff5.js +0 -4
  210. package/chunk-qn6n0ff5.js.map +0 -17
  211. package/chunk-r3maskdb.js +0 -5
  212. package/chunk-r3maskdb.js.map +0 -13
  213. package/chunk-st3dxvqt.js +0 -4
  214. package/chunk-st3dxvqt.js.map +0 -14
  215. package/chunk-xp18wdk6.js +0 -4
  216. package/chunk-xp18wdk6.js.map +0 -12
  217. package/collections/index.js +0 -4
  218. package/collections/index.js.map +0 -9
  219. package/common/index.js +0 -4
  220. package/common/index.js.map +0 -9
  221. package/core/index.js +0 -4
  222. package/core/index.js.map +0 -9
  223. package/errors/index.js +0 -4
  224. package/errors/index.js.map +0 -9
  225. package/events/index.js +0 -4
  226. package/events/index.js.map +0 -9
  227. package/functions/index.js +0 -4
  228. package/functions/index.js.map +0 -9
  229. package/index.js +0 -4
  230. package/index.js.map +0 -9
  231. package/json-rpc/index.js +0 -4
  232. package/json-rpc/index.js.map +0 -9
  233. package/meta.json +0 -2998
  234. package/meta.md +0 -1816
  235. package/numbers/index.js +0 -4
  236. package/numbers/index.js.map +0 -9
  237. package/objects/index.js +0 -4
  238. package/objects/index.js.map +0 -9
  239. package/promises/index.js +0 -4
  240. package/promises/index.js.map +0 -9
  241. package/serializer/index.js +0 -4
  242. package/serializer/index.js.map +0 -9
  243. package/serializer/serializers/binary.d.ts.map +0 -1
  244. package/serializer/serializers/blob.d.ts.map +0 -1
  245. package/serializer/serializers/number.d.ts.map +0 -1
  246. package/serializer/serializers/opaque.d.ts.map +0 -1
  247. package/strings/index.js +0 -4
  248. package/strings/index.js.map +0 -9
  249. package/system/index.js +0 -4
  250. package/system/index.js.map +0 -9
  251. package/system/types.d.ts +0 -3
  252. package/times/index.js +0 -4
  253. package/times/index.js.map +0 -9
  254. /package/{arrays → dist/arrays}/accessors.d.ts +0 -0
  255. /package/{arrays → dist/arrays}/accessors.d.ts.map +0 -0
  256. /package/{arrays → dist/arrays}/conversions.d.ts +0 -0
  257. /package/{arrays → dist/arrays}/conversions.d.ts.map +0 -0
  258. /package/{arrays → dist/arrays}/factories.d.ts +0 -0
  259. /package/{arrays → dist/arrays}/factories.d.ts.map +0 -0
  260. /package/{arrays → dist/arrays}/guards.d.ts +0 -0
  261. /package/{arrays → dist/arrays}/guards.d.ts.map +0 -0
  262. /package/{arrays → dist/arrays}/index.d.ts +0 -0
  263. /package/{arrays → dist/arrays}/index.d.ts.map +0 -0
  264. /package/{arrays → dist/arrays}/operations.d.ts +0 -0
  265. /package/{arrays → dist/arrays}/operations.d.ts.map +0 -0
  266. /package/{arrays → dist/arrays}/set-operations.d.ts +0 -0
  267. /package/{arrays → dist/arrays}/set-operations.d.ts.map +0 -0
  268. /package/{arrays → dist/arrays}/types.d.ts +0 -0
  269. /package/{arrays → dist/arrays}/types.d.ts.map +0 -0
  270. /package/{buffers → dist/buffers}/conversions.d.ts +0 -0
  271. /package/{buffers → dist/buffers}/conversions.d.ts.map +0 -0
  272. /package/{buffers → dist/buffers}/guards.d.ts +0 -0
  273. /package/{buffers → dist/buffers}/guards.d.ts.map +0 -0
  274. /package/{buffers → dist/buffers}/index.d.ts +0 -0
  275. /package/{buffers → dist/buffers}/index.d.ts.map +0 -0
  276. /package/{buffers → dist/buffers}/operations.d.ts +0 -0
  277. /package/{buffers → dist/buffers}/operations.d.ts.map +0 -0
  278. /package/{buffers → dist/buffers}/types.d.ts +0 -0
  279. /package/{buffers → dist/buffers}/types.d.ts.map +0 -0
  280. /package/{collections → dist/collections}/fifo-map.d.ts +0 -0
  281. /package/{collections → dist/collections}/fifo-map.d.ts.map +0 -0
  282. /package/{collections → dist/collections}/fifo-set.d.ts +0 -0
  283. /package/{collections → dist/collections}/fifo-set.d.ts.map +0 -0
  284. /package/{collections → dist/collections}/guards.d.ts +0 -0
  285. /package/{collections → dist/collections}/guards.d.ts.map +0 -0
  286. /package/{collections → dist/collections}/index.d.ts +0 -0
  287. /package/{collections → dist/collections}/index.d.ts.map +0 -0
  288. /package/{collections → dist/collections}/linked-base.d.ts +0 -0
  289. /package/{collections → dist/collections}/linked-base.d.ts.map +0 -0
  290. /package/{collections → dist/collections}/linked-map.d.ts +0 -0
  291. /package/{collections → dist/collections}/linked-map.d.ts.map +0 -0
  292. /package/{collections → dist/collections}/linked-set.d.ts +0 -0
  293. /package/{collections → dist/collections}/linked-set.d.ts.map +0 -0
  294. /package/{collections → dist/collections}/lru-map.d.ts +0 -0
  295. /package/{collections → dist/collections}/lru-map.d.ts.map +0 -0
  296. /package/{collections → dist/collections}/lru-set.d.ts +0 -0
  297. /package/{collections → dist/collections}/lru-set.d.ts.map +0 -0
  298. /package/{collections → dist/collections}/types.d.ts +0 -0
  299. /package/{collections → dist/collections}/types.d.ts.map +0 -0
  300. /package/{common → dist/common}/guards.d.ts +0 -0
  301. /package/{common → dist/common}/guards.d.ts.map +0 -0
  302. /package/{common → dist/common}/index.d.ts +0 -0
  303. /package/{common → dist/common}/index.d.ts.map +0 -0
  304. /package/{common → dist/common}/transformations.d.ts +0 -0
  305. /package/{common → dist/common}/transformations.d.ts.map +0 -0
  306. /package/{core → dist/core}/constants.d.ts +0 -0
  307. /package/{core → dist/core}/constants.d.ts.map +0 -0
  308. /package/{core → dist/core}/conversions.d.ts +0 -0
  309. /package/{core → dist/core}/conversions.d.ts.map +0 -0
  310. /package/{core → dist/core}/guards.d.ts +0 -0
  311. /package/{core → dist/core}/guards.d.ts.map +0 -0
  312. /package/{core → dist/core}/index.d.ts +0 -0
  313. /package/{core → dist/core}/index.d.ts.map +0 -0
  314. /package/{core → dist/core}/types.d.ts +0 -0
  315. /package/{core → dist/core}/types.d.ts.map +0 -0
  316. /package/{errors → dist/errors}/base-error.d.ts +0 -0
  317. /package/{errors → dist/errors}/base-error.d.ts.map +0 -0
  318. /package/{errors → dist/errors}/factories.d.ts +0 -0
  319. /package/{errors → dist/errors}/factories.d.ts.map +0 -0
  320. /package/{errors → dist/errors}/guards.d.ts +0 -0
  321. /package/{errors → dist/errors}/guards.d.ts.map +0 -0
  322. /package/{errors → dist/errors}/index.d.ts +0 -0
  323. /package/{errors → dist/errors}/index.d.ts.map +0 -0
  324. /package/{errors → dist/errors}/operations.d.ts +0 -0
  325. /package/{errors → dist/errors}/operations.d.ts.map +0 -0
  326. /package/{errors → dist/errors}/stringify.d.ts +0 -0
  327. /package/{errors → dist/errors}/stringify.d.ts.map +0 -0
  328. /package/{errors → dist/errors}/types.d.ts +0 -0
  329. /package/{errors → dist/errors}/types.d.ts.map +0 -0
  330. /package/{events → dist/events}/emitter.d.ts +0 -0
  331. /package/{events → dist/events}/emitter.d.ts.map +0 -0
  332. /package/{events → dist/events}/index.d.ts +0 -0
  333. /package/{events → dist/events}/index.d.ts.map +0 -0
  334. /package/{events → dist/events}/types.d.ts +0 -0
  335. /package/{events → dist/events}/types.d.ts.map +0 -0
  336. /package/{functions → dist/functions}/compositions.d.ts +0 -0
  337. /package/{functions → dist/functions}/compositions.d.ts.map +0 -0
  338. /package/{functions → dist/functions}/debounce.d.ts +0 -0
  339. /package/{functions → dist/functions}/debounce.d.ts.map +0 -0
  340. /package/{functions → dist/functions}/guards.d.ts +0 -0
  341. /package/{functions → dist/functions}/guards.d.ts.map +0 -0
  342. /package/{functions → dist/functions}/index.d.ts +0 -0
  343. /package/{functions → dist/functions}/index.d.ts.map +0 -0
  344. /package/{functions → dist/functions}/memoize.d.ts +0 -0
  345. /package/{functions → dist/functions}/memoize.d.ts.map +0 -0
  346. /package/{functions → dist/functions}/once.d.ts +0 -0
  347. /package/{functions → dist/functions}/once.d.ts.map +0 -0
  348. /package/{functions → dist/functions}/pipe.d.ts +0 -0
  349. /package/{functions → dist/functions}/pipe.d.ts.map +0 -0
  350. /package/{functions → dist/functions}/throttle.d.ts +0 -0
  351. /package/{functions → dist/functions}/throttle.d.ts.map +0 -0
  352. /package/{functions → dist/functions}/timer-state.d.ts +0 -0
  353. /package/{functions → dist/functions}/timer-state.d.ts.map +0 -0
  354. /package/{functions → dist/functions}/types.d.ts +0 -0
  355. /package/{functions → dist/functions}/types.d.ts.map +0 -0
  356. /package/{index.d.ts → dist/index.d.ts} +0 -0
  357. /package/{index.d.ts.map → dist/index.d.ts.map} +0 -0
  358. /package/{json-rpc → dist/json-rpc}/constants.d.ts +0 -0
  359. /package/{json-rpc → dist/json-rpc}/constants.d.ts.map +0 -0
  360. /package/{json-rpc → dist/json-rpc}/factories.d.ts +0 -0
  361. /package/{json-rpc → dist/json-rpc}/factories.d.ts.map +0 -0
  362. /package/{json-rpc → dist/json-rpc}/guards.d.ts +0 -0
  363. /package/{json-rpc → dist/json-rpc}/guards.d.ts.map +0 -0
  364. /package/{json-rpc → dist/json-rpc}/index.d.ts +0 -0
  365. /package/{json-rpc → dist/json-rpc}/index.d.ts.map +0 -0
  366. /package/{json-rpc → dist/json-rpc}/types.d.ts +0 -0
  367. /package/{json-rpc → dist/json-rpc}/types.d.ts.map +0 -0
  368. /package/{numbers → dist/numbers}/bigint-math.d.ts +0 -0
  369. /package/{numbers → dist/numbers}/bigint-math.d.ts.map +0 -0
  370. /package/{numbers → dist/numbers}/constants.d.ts +0 -0
  371. /package/{numbers → dist/numbers}/constants.d.ts.map +0 -0
  372. /package/{numbers → dist/numbers}/conversions.d.ts +0 -0
  373. /package/{numbers → dist/numbers}/conversions.d.ts.map +0 -0
  374. /package/{numbers → dist/numbers}/factories.d.ts +0 -0
  375. /package/{numbers → dist/numbers}/factories.d.ts.map +0 -0
  376. /package/{numbers → dist/numbers}/formats.d.ts +0 -0
  377. /package/{numbers → dist/numbers}/formats.d.ts.map +0 -0
  378. /package/{numbers → dist/numbers}/guards.d.ts +0 -0
  379. /package/{numbers → dist/numbers}/guards.d.ts.map +0 -0
  380. /package/{numbers → dist/numbers}/index.d.ts +0 -0
  381. /package/{numbers → dist/numbers}/index.d.ts.map +0 -0
  382. /package/{numbers → dist/numbers}/maths.d.ts +0 -0
  383. /package/{numbers → dist/numbers}/maths.d.ts.map +0 -0
  384. /package/{numbers → dist/numbers}/ranges.d.ts +0 -0
  385. /package/{numbers → dist/numbers}/ranges.d.ts.map +0 -0
  386. /package/{numbers → dist/numbers}/types.d.ts +0 -0
  387. /package/{numbers → dist/numbers}/types.d.ts.map +0 -0
  388. /package/{objects → dist/objects}/deep-merge.d.ts +0 -0
  389. /package/{objects → dist/objects}/deep-merge.d.ts.map +0 -0
  390. /package/{objects → dist/objects}/guards.d.ts +0 -0
  391. /package/{objects → dist/objects}/guards.d.ts.map +0 -0
  392. /package/{objects → dist/objects}/index.d.ts +0 -0
  393. /package/{objects → dist/objects}/index.d.ts.map +0 -0
  394. /package/{promises → dist/promises}/abortable.d.ts +0 -0
  395. /package/{promises → dist/promises}/abortable.d.ts.map +0 -0
  396. /package/{promises → dist/promises}/compositions.d.ts +0 -0
  397. /package/{promises → dist/promises}/compositions.d.ts.map +0 -0
  398. /package/{promises → dist/promises}/guards.d.ts +0 -0
  399. /package/{promises → dist/promises}/guards.d.ts.map +0 -0
  400. /package/{promises → dist/promises}/index.d.ts +0 -0
  401. /package/{promises → dist/promises}/index.d.ts.map +0 -0
  402. /package/{promises → dist/promises}/pipe.d.ts +0 -0
  403. /package/{promises → dist/promises}/pipe.d.ts.map +0 -0
  404. /package/{promises → dist/promises}/poll.d.ts +0 -0
  405. /package/{promises → dist/promises}/poll.d.ts.map +0 -0
  406. /package/{promises → dist/promises}/retry.d.ts +0 -0
  407. /package/{promises → dist/promises}/retry.d.ts.map +0 -0
  408. /package/{promises → dist/promises}/types.d.ts +0 -0
  409. /package/{promises → dist/promises}/types.d.ts.map +0 -0
  410. /package/{serializer → dist/serializer}/constants.d.ts +0 -0
  411. /package/{serializer → dist/serializer}/constants.d.ts.map +0 -0
  412. /package/{serializer → dist/serializer}/index.d.ts +0 -0
  413. /package/{serializer → dist/serializer}/index.d.ts.map +0 -0
  414. /package/{serializer → dist/serializer}/serializers/index.d.ts +0 -0
  415. /package/{serializer → dist/serializer}/serializers/index.d.ts.map +0 -0
  416. /package/{serializer → dist/serializer}/symbol-registry.d.ts +0 -0
  417. /package/{serializer → dist/serializer}/symbol-registry.d.ts.map +0 -0
  418. /package/{strings → dist/strings}/constants.d.ts +0 -0
  419. /package/{strings → dist/strings}/constants.d.ts.map +0 -0
  420. /package/{strings → dist/strings}/factories.d.ts +0 -0
  421. /package/{strings → dist/strings}/factories.d.ts.map +0 -0
  422. /package/{strings → dist/strings}/guards.d.ts +0 -0
  423. /package/{strings → dist/strings}/guards.d.ts.map +0 -0
  424. /package/{strings → dist/strings}/index.d.ts +0 -0
  425. /package/{strings → dist/strings}/index.d.ts.map +0 -0
  426. /package/{strings → dist/strings}/manipulations.d.ts +0 -0
  427. /package/{strings → dist/strings}/manipulations.d.ts.map +0 -0
  428. /package/{strings → dist/strings}/types.d.ts +0 -0
  429. /package/{strings → dist/strings}/types.d.ts.map +0 -0
  430. /package/{system → dist/system}/env.d.ts +0 -0
  431. /package/{system → dist/system}/env.d.ts.map +0 -0
  432. /package/{system → dist/system}/graceful-exit.d.ts +0 -0
  433. /package/{system → dist/system}/graceful-exit.d.ts.map +0 -0
  434. /package/{system → dist/system}/index.d.ts +0 -0
  435. /package/{system → dist/system}/index.d.ts.map +0 -0
  436. /package/{system → dist/system}/path.d.ts +0 -0
  437. /package/{system → dist/system}/path.d.ts.map +0 -0
  438. /package/{times → dist/times}/constants.d.ts +0 -0
  439. /package/{times → dist/times}/constants.d.ts.map +0 -0
  440. /package/{times → dist/times}/factories.d.ts +0 -0
  441. /package/{times → dist/times}/factories.d.ts.map +0 -0
  442. /package/{times → dist/times}/guards.d.ts +0 -0
  443. /package/{times → dist/times}/guards.d.ts.map +0 -0
  444. /package/{times → dist/times}/index.d.ts +0 -0
  445. /package/{times → dist/times}/index.d.ts.map +0 -0
  446. /package/{times → dist/times}/operations.d.ts +0 -0
  447. /package/{times → dist/times}/operations.d.ts.map +0 -0
@@ -0,0 +1,51 @@
1
+ import type { Nullish } from '../core'
2
+ import type { HexString, UrlLike } from './types'
3
+ import { wrap } from '../arrays'
4
+ import { transform, tryCatch } from '../functions'
5
+
6
+ export const isEmptyString = (value: string) => value.length === 0
7
+
8
+ export function isValidProtocol({ protocol }: URL, protocols?: Nullish<string[]>) {
9
+ if (!protocols?.length) {
10
+ return true
11
+ }
12
+
13
+ return protocols.some((x) => `${x.toLowerCase()}:` === protocol)
14
+ }
15
+
16
+ export function isValidUrl(url: UrlLike, protocols?: Nullish<string[]>) {
17
+ if (url instanceof URL) {
18
+ return isValidProtocol(url, protocols)
19
+ }
20
+
21
+ return tryCatch(() => isValidProtocol(new URL(url), protocols), false)
22
+ }
23
+
24
+ export const isWebSocketUrl = (url: UrlLike, wsProtocols = ['ws', 'wss']) => isValidUrl(url, wsProtocols)
25
+
26
+ export const isHttpUrl = (url: UrlLike, httpProtocols = ['http', 'https']) => isValidUrl(url, httpProtocols)
27
+
28
+ export const isStringEquals = (str: string, ...others: string[]) => others.length > 0 && others.every((other) => str === other)
29
+
30
+ export const isStringEqualsIgnoreCase = (str: string, ...others: string[]) => (
31
+ others.length > 0 && transform(str.toLowerCase(), (x) => others.every((other) => x === other.toLowerCase()))
32
+ )
33
+
34
+ export const isIncludesAll = (str: string, search: string[]) => search.every((s) => str.includes(s))
35
+
36
+ export const isIncludesAny = (str: string, search: string[]) => search.some((s) => str.includes(s))
37
+
38
+ export const isIncludes = (str: string, search: string[] | string, type: 'all' | 'any' = 'all') => (
39
+ type === 'all' ? isIncludesAll(str, wrap(search)) : isIncludesAny(str, wrap(search))
40
+ )
41
+
42
+ export function isHexString(value: string, length?: number) {
43
+ const len = length ? `{${length * 2}}` : '+'
44
+ const regex = new RegExp(`^(?:0x)?[0-9a-f]${len}$`, 'iu')
45
+
46
+ return regex.test(value)
47
+ }
48
+
49
+ export const isStrictHexString = (value: string, length?: number): value is HexString => (
50
+ value.startsWith('0x') && isHexString(value, length)
51
+ )
@@ -0,0 +1,6 @@
1
+ export * from './constants'
2
+ export * from './factories'
3
+ export * from './guards'
4
+ export * from './manipulations'
5
+
6
+ export type * from './types'
@@ -0,0 +1,99 @@
1
+ import type { Numberish } from '../numbers'
2
+ import { WHITESPACE_CHARACTERS } from './constants'
3
+
4
+ export const ensurePrefix = (str: string, prefix: string) => (str.startsWith(prefix) ? str : prefix + str)
5
+
6
+ export const ensureSuffix = (str: string, suffix: string) => (str.endsWith(suffix) ? str : str + suffix)
7
+
8
+ export const stripPrefix = (str: string, prefix: string) => (str.startsWith(prefix) ? str.slice(prefix.length) : str)
9
+
10
+ export const stripSuffix = (str: string, suffix: string) => (suffix.length > 0 && str.endsWith(suffix) ? str.slice(0, -suffix.length) : str)
11
+
12
+ export const capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1)
13
+
14
+ export const escapeRegExp = (input: string) => (
15
+ input.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`).replaceAll('-', String.raw`\x2d`)
16
+ )
17
+
18
+ export function * chunkStr(str: string, size: number) {
19
+ if (size <= 0) {
20
+ throw new RangeError(`chunk size must be a positive number, got ${size}`)
21
+ }
22
+
23
+ const len = str.length
24
+
25
+ for (let i = 0; i < len; i += size) {
26
+ yield str.slice(i, i + size)
27
+ }
28
+ }
29
+
30
+ export const padStart = (str: string, targetLength: number, padString = ' ') => (
31
+ str.padStart(targetLength, padString)
32
+ )
33
+
34
+ export const padZeroStart = (num: Numberish | string, targetLength: number) => padStart(num.toString(), targetLength, '0')
35
+
36
+ export function truncate(str: string, maxLength: number, omission = '...') {
37
+ if (str.length <= maxLength) {
38
+ return str
39
+ }
40
+
41
+ if (omission.length >= maxLength) {
42
+ return omission.slice(0, maxLength)
43
+ }
44
+
45
+ return str.slice(0, maxLength - omission.length) + omission
46
+ }
47
+
48
+ export function truncateMiddle(str: string, maxLength: number, omission = '...') {
49
+ if (str.length <= maxLength) {
50
+ return str
51
+ }
52
+
53
+ if (omission.length >= maxLength) {
54
+ return omission.slice(0, maxLength)
55
+ }
56
+
57
+ const left = Math.floor((maxLength - omission.length) / 2)
58
+ const right = maxLength - omission.length - left
59
+
60
+ return str.slice(0, left) + omission + str.slice(-right)
61
+ }
62
+
63
+ export function ltrim(str: string, characters: Set<string> | string = WHITESPACE_CHARACTERS) {
64
+ if (typeof characters === 'string') {
65
+ characters = new Set(characters)
66
+ }
67
+
68
+ const end = str.length
69
+
70
+ let start = 0
71
+
72
+ while (start < end && characters.has(str[start]!)) {
73
+ start++
74
+ }
75
+
76
+ return start > 0 ? str.slice(start, end) : str
77
+ }
78
+
79
+ export function rtrim(str: string, characters: Set<string> | string = WHITESPACE_CHARACTERS) {
80
+ if (typeof characters === 'string') {
81
+ characters = new Set(characters)
82
+ }
83
+
84
+ let end = str.length
85
+
86
+ while (end > 0 && characters.has(str[end - 1]!)) {
87
+ end--
88
+ }
89
+
90
+ return end < str.length ? str.slice(0, end) : str
91
+ }
92
+
93
+ export const trim = (str: string, characters: Set<string> | string = WHITESPACE_CHARACTERS) => (
94
+ ltrim(rtrim(str, characters), characters)
95
+ )
96
+
97
+ export const trimRepeated = (input: string, target: string) => (
98
+ input.replaceAll(new RegExp(`(?:${escapeRegExp(target)}){2,}`, 'g'), target)
99
+ )
@@ -0,0 +1,3 @@
1
+ export type UrlLike = URL | string
2
+
3
+ export type HexString = `0x${string}`
@@ -0,0 +1,32 @@
1
+ import { isUndefined } from '../core'
2
+
3
+ export const isInMode = (key: string) => process.env.NODE_ENV === key
4
+
5
+ export const isInDevelopment = () => isInMode('development') || isInMode('dev')
6
+ export const isInDev = isInDevelopment
7
+
8
+ export const isInProduction = () => isInMode('production') || isInMode('prod')
9
+ export const isInProd = isInProduction
10
+
11
+ export const isInStaging = () => isInMode('staging') || isInMode('stage')
12
+ export const isInStage = isInStaging
13
+
14
+ export interface GetEnvOptions {
15
+ env?: NodeJS.ProcessEnv
16
+ includeNonePrefix?: boolean
17
+ prefix?: string
18
+ }
19
+
20
+ export function getEnv<T extends string>(key: T[], { env = process.env, includeNonePrefix = false, prefix }: GetEnvOptions = {}) {
21
+ const result: Record<string, string | undefined> = {}
22
+
23
+ for (const k of key) {
24
+ result[k] = env[prefix ? `${prefix}${k}` : k]
25
+
26
+ if (includeNonePrefix && isUndefined(result[k])) {
27
+ result[k] = env[k]
28
+ }
29
+ }
30
+
31
+ return result as Record<T, string | undefined>
32
+ }
@@ -0,0 +1,23 @@
1
+ import type { UrlLike } from '../strings'
2
+ import { combineSignals, createAbortController } from '../errors'
3
+ import { resolveOptions } from '../objects'
4
+ import { withRetry, type WithRetryOptions } from '../promises'
5
+
6
+ export interface FetchOptions extends Omit<RequestInit, 'signal'> {
7
+ retry?: Omit<WithRetryOptions<Response>, 'signal'> & { enabled?: boolean } | boolean
8
+ signal?: AbortSignal
9
+ timeout?: number
10
+ }
11
+
12
+ export async function fetch(request: RequestInfo | UrlLike, { retry = true, signal, timeout = 10_000, ...options }: FetchOptions = {}) {
13
+ const retryOptions = { enabled: true, ...(resolveOptions(retry, {}) || { enabled: false }) }
14
+
15
+ const execute = async (retrySignal?: AbortSignal) => {
16
+ const controller = createAbortController(timeout)
17
+ const fetchSignal = combineSignals(controller.signal, signal, retrySignal)
18
+
19
+ return globalThis.fetch(request, { ...options, signal: fetchSignal }).finally(() => controller.abort())
20
+ }
21
+
22
+ return retryOptions.enabled ? await withRetry(execute, { ...retryOptions, signal }) : await execute()
23
+ }
@@ -0,0 +1,46 @@
1
+ export type ExitHandler = (exitCode?: number) => Promise<void>
2
+
3
+ const exitTasks = new Map<ExitHandler, number>()
4
+
5
+ export function addExitHandler(handler: ExitHandler, maxWaitTime = 3000) {
6
+ exitTasks.set(handler, maxWaitTime)
7
+
8
+ return () => {
9
+ exitTasks.delete(handler)
10
+ }
11
+ }
12
+
13
+ let _isExiting = false
14
+ let _exitPromise: Promise<never> | undefined
15
+
16
+ export const isExiting = () => {
17
+ return _isExiting
18
+ }
19
+
20
+ export function gracefulExit(exitCode = 0, maxWaitTime = 3000): Promise<never> {
21
+ if (_exitPromise) {
22
+ return _exitPromise
23
+ }
24
+
25
+ _isExiting = true
26
+
27
+ if (exitTasks.size === 0) {
28
+ process.exit(exitCode)
29
+ }
30
+
31
+ const promises: Array<Promise<void>> = []
32
+
33
+ for (const [handler, wait] of exitTasks) {
34
+ promises.push(Promise.resolve().then(() => handler(exitCode)))
35
+ maxWaitTime = Math.max(maxWaitTime, wait)
36
+ }
37
+
38
+ const timer = setTimeout(() => process.exit(exitCode), maxWaitTime)
39
+
40
+ function finish(): never {
41
+ clearTimeout(timer)
42
+ process.exit(exitCode)
43
+ }
44
+
45
+ return _exitPromise = Promise.allSettled(promises).then(finish)
46
+ }
@@ -0,0 +1,6 @@
1
+ export * from './env'
2
+ export * from './fetch'
3
+ export * from './graceful-exit'
4
+ export * from './path'
5
+
6
+ export type * from './types'
@@ -0,0 +1,12 @@
1
+ import type { PathLike } from './types'
2
+ import { dirname, join } from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+ import { bufferToString, isBufferLike } from '../buffers'
5
+
6
+ export const pathToString = (path: PathLike) => (
7
+ isBufferLike(path) ? bufferToString(path) : path.toString()
8
+ )
9
+
10
+ export const pwd = (importMeta: ImportMeta, ...path: PathLike[]) => (
11
+ join(dirname(fileURLToPath(importMeta.url)), ...path.map(pathToString))
12
+ )
@@ -0,0 +1,3 @@
1
+ import type { BufferLike } from '../buffers'
2
+
3
+ export type PathLike = BufferLike | URL | string
@@ -0,0 +1,6 @@
1
+ export const MS_PER_SECOND = 1000
2
+ export const MS_PER_MINUTE = 60_000
3
+ export const MS_PER_HOUR = 3_600_000
4
+ export const MS_PER_DAY = 86_400_000
5
+ export const MS_PER_MONTH = MS_PER_DAY * 30
6
+ export const MS_PER_YEAR = MS_PER_DAY * 365
@@ -0,0 +1,85 @@
1
+ import { isString } from '../core'
2
+ import { BigIntMath, isSpecialNumberString, type Numberish } from '../numbers'
3
+ import { padZeroStart } from '../strings'
4
+
5
+ export const toUnixTimestamp = (date: Date) => Math.floor(date.getTime() / 1000)
6
+
7
+ export const fromUnixTimestamp = (timestamp: number) => new Date(timestamp * 1000)
8
+
9
+ const FORMAT_TOKEN_REGEX = /y{4}|S{3}|MM|dd|HH|mm|ss/gu
10
+ const pad2 = (n: number) => padZeroStart(n, 2)
11
+
12
+ export function formatDate(date: Date, format = 'HH:mm:ss.SSS dd/MM/yyyy') {
13
+ if (Number.isNaN(date.getTime())) {
14
+ throw new TypeError('Invalid Date')
15
+ }
16
+
17
+ const tokens: Record<string, () => string> = {
18
+ dd: () => pad2(date.getDate()),
19
+ HH: () => pad2(date.getHours()),
20
+ MM: () => pad2(date.getMonth() + 1),
21
+ mm: () => pad2(date.getMinutes()),
22
+ ss: () => pad2(date.getSeconds()),
23
+ SSS: () => padZeroStart(date.getMilliseconds(), 3),
24
+ yyyy: () => padZeroStart(date.getFullYear(), 4),
25
+ }
26
+
27
+ return format.replaceAll(FORMAT_TOKEN_REGEX, (match) => tokens[match]!())
28
+ }
29
+
30
+ const NANOSECOND_UNITS: Array<[label: string, value: bigint]> = [
31
+ ['h', 3_600_000_000_000n],
32
+ ['m', 60_000_000_000n],
33
+ ['s', 1_000_000_000n],
34
+ ['ms', 1_000_000n],
35
+ ['\u03BCs', 1000n],
36
+ ['ns', 1n],
37
+ ]
38
+
39
+ export function humanizeNanoseconds(ns: Numberish) {
40
+ if (isString(ns) && isSpecialNumberString(ns)) {
41
+ return ns
42
+ }
43
+
44
+ let remaining: bigint
45
+
46
+ try {
47
+ remaining = BigInt(ns)
48
+ } catch {
49
+ return ns.toString()
50
+ }
51
+
52
+ if (remaining === 0n) {
53
+ return '0ns'
54
+ }
55
+
56
+ const sign = remaining < 0n ? '-' : ''
57
+ const parts: string[] = []
58
+
59
+ remaining = BigIntMath.abs(remaining)
60
+
61
+ for (const [label, value] of NANOSECOND_UNITS) {
62
+ if (remaining >= value) {
63
+ parts.push(`${remaining / value}${label}`)
64
+ remaining %= value
65
+ }
66
+ }
67
+
68
+ return sign + parts.join(' ')
69
+ }
70
+
71
+ export function humanizeWithMultiplier(value: Numberish, multiplier: bigint) {
72
+ if (isString(value) && isSpecialNumberString(value)) {
73
+ return value
74
+ }
75
+
76
+ try {
77
+ return humanizeNanoseconds(BigInt(value) * multiplier)
78
+ } catch {
79
+ return value.toString()
80
+ }
81
+ }
82
+
83
+ export const humanizeMilliseconds = (ms: Numberish) => humanizeWithMultiplier(ms, 1_000_000n)
84
+
85
+ export const humanizeSeconds = (s: Numberish) => humanizeWithMultiplier(s, 1_000_000_000n)
@@ -0,0 +1,3 @@
1
+ import { toUnixTimestamp } from './conversions'
2
+
3
+ export const timestamp = () => toUnixTimestamp(new Date())
@@ -0,0 +1,3 @@
1
+ export const isValidDate = (value: unknown): value is Date => (
2
+ value instanceof Date && !Number.isNaN(value.getTime())
3
+ )
@@ -0,0 +1,5 @@
1
+ export * from './constants'
2
+ export * from './conversions'
3
+ export * from './factories'
4
+ export * from './guards'
5
+ export * from './operations'
@@ -0,0 +1,9 @@
1
+ import { tap } from '../functions'
2
+
3
+ export const startOfDay = (date: Date) => tap(new Date(date), (r) => {
4
+ r.setHours(0, 0, 0, 0)
5
+ })
6
+
7
+ export const endOfDay = (date: Date) => tap(new Date(date), (r) => {
8
+ r.setHours(23, 59, 59, 999)
9
+ })
package/CHANGELOG.md DELETED
@@ -1,57 +0,0 @@
1
- # Changelog
2
-
3
-
4
- ## v0.0.4
5
-
6
- [compare changes](https://github.com/kdtlabs/utils/compare/v0.0.3...v0.0.4)
7
-
8
- ### 🚀 Enhancements
9
-
10
- - **common:** Add nullToUndefined util and NullToUndefined type ([fe1f046](https://github.com/kdtlabs/utils/commit/fe1f046))
11
- - **system:** Implement getEnv with prefix and includeNonePrefix fallback ([15d6da7](https://github.com/kdtlabs/utils/commit/15d6da7))
12
- - **common:** Add isDeepEqual guard ([e79ac3d](https://github.com/kdtlabs/utils/commit/e79ac3d))
13
-
14
- ### 💅 Refactors
15
-
16
- - **core:** Move toString and typeOf to core/conversions ([7f2bfa8](https://github.com/kdtlabs/utils/commit/7f2bfa8))
17
-
18
- ### ❤️ Contributors
19
-
20
- - Diep Dang <kdt310722@gmail.com>
21
-
22
- ## v0.0.3
23
-
24
- [compare changes](https://github.com/kdtlabs/utils/compare/v0.0.2...v0.0.3)
25
-
26
- ## v0.0.2
27
-
28
- [compare changes](https://github.com/kdtlabs/utils/compare/v0.0.1...v0.0.2)
29
-
30
- ### 🩹 Fixes
31
-
32
- - **release:** Build after changelog gen to prevent package.json version error ([459f06c](https://github.com/kdtlabs/utils/commit/459f06c))
33
-
34
- ### ❤️ Contributors
35
-
36
- - Diep Dang <kdt310722@gmail.com>
37
-
38
- ## v0.0.1
39
-
40
-
41
- ### 🚀 Enhancements
42
-
43
- - Add SKILL.md for AI tool discovery of available utils ([e1dde1a](https://github.com/kdtlabs/utils/commit/e1dde1a))
44
-
45
- ### 🩹 Fixes
46
-
47
- - **release:** Fix release script and add CHANGELOG.md to eslint ignore ([a72208c](https://github.com/kdtlabs/utils/commit/a72208c))
48
-
49
- ### 🏡 Chore
50
-
51
- - Initial commit ([058e414](https://github.com/kdtlabs/utils/commit/058e414))
52
- - Add gitnexus to ignore files ([88c2d38](https://github.com/kdtlabs/utils/commit/88c2d38))
53
-
54
- ### ❤️ Contributors
55
-
56
- - Diep Dang <kdt310722@gmail.com>
57
-
package/arrays/index.js DELETED
@@ -1,4 +0,0 @@
1
- import{$b as w,Fb as a,Gb as b,Hb as c,Ib as d,Jb as e,Kb as f,Lb as g,Mb as h,Nb as i,Ob as j,Pb as k,Qb as l,Rb as m,Sb as n,Tb as o,Ub as p,Vb as q,Wb as r,Xb as s,Yb as t,Zb as u,_b as v,ac as x,bc as y}from"../chunk-7cndek91.js";import"../chunk-qn6n0ff5.js";import"../chunk-3w6nt7kb.js";export{g as wrap,v as uniqueBy,u as unique,h as toArray,y as symmetricDiff,s as sortBy,o as shuffle,l as sample,k as range,t as partition,a as nth,m as merge,c as last,q as keyBy,f as isNonEmptyArray,e as isEmptyArray,d as isArray,w as intersection,p as groupBy,n as flatten,b as first,x as diff,j as createArray,i as compact,r as chunk};
2
-
3
- //# debugId=7FF7885B231E2BF464756E2164756E21
4
- //# sourceMappingURL=index.js.map
@@ -1,9 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [
5
- ],
6
- "mappings": "",
7
- "debugId": "7FF7885B231E2BF464756E2164756E21",
8
- "names": []
9
- }
package/buffers/index.js DELETED
@@ -1,4 +0,0 @@
1
- import{gb as a,hb as b,ib as c,jb as d,kb as e,lb as f,mb as g,nb as h,ob as i}from"../chunk-xp18wdk6.js";export{g as toUint8Array,c as isSharedArrayBuffer,e as isBufferLike,a as isBuffer,d as isArrayBufferView,b as isArrayBuffer,h as concatBuffers,f as bufferToString,i as bufferEquals};
2
-
3
- //# debugId=58E6E050C983599364756E2164756E21
4
- //# sourceMappingURL=index.js.map
@@ -1,9 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [
5
- ],
6
- "mappings": "",
7
- "debugId": "58E6E050C983599364756E2164756E21",
8
- "names": []
9
- }
package/chunk-25ja9350.js DELETED
@@ -1,4 +0,0 @@
1
- import{isUndefined as d}from"@/core";var s=(e)=>e==="development",x=()=>s("development")||s("dev"),L=x,g=()=>s("production")||s("prod"),w=g,b=()=>s("staging")||s("stage"),A=b;function H(e,{env:t=process.env,includeNonePrefix:n=!1,prefix:i}={}){let r={};for(let o of e)if(r[o]=t[i?`${i}${o}`:o],n&&d(r[o]))r[o]=t[o];return r}import{combineSignals as h,createAbortController as v}from"@/errors";import{resolveOptions as y}from"@/objects";import{withRetry as P}from"@/promises";async function D(e,{retry:t=!0,signal:n,timeout:i=1e4,...r}={}){let o={enabled:!0,...y(t,{})||{enabled:!1}},p=async(m)=>{let f=v(i),u=h(f.signal,n,m);return globalThis.fetch(e,{...r,signal:u}).finally(()=>f.abort())};return o.enabled?await P(p,{...o,signal:n}):await p()}var a=new Map;function F(e,t=3000){return a.set(e,t),()=>{a.delete(e)}}var l=!1,c,G=()=>{return l};function $(e=0,t=3000){if(c)return c;if(l=!0,a.size===0)process.exit(e);let n=[];for(let[o,p]of a)n.push(Promise.resolve().then(()=>o(e))),t=Math.max(t,p);let i=setTimeout(()=>process.exit(e),t);function r(){clearTimeout(i),process.exit(e)}return c=Promise.allSettled(n).then(r)}import{dirname as E,join as O}from"node:path";import{fileURLToPath as S}from"node:url";import{bufferToString as I,isBufferLike as R}from"@/buffers";var k=(e)=>R(e)?I(e):e.toString(),V=(e,...t)=>O(E(S(e.url)),...t.map(k));export{s as tc,x as uc,L as vc,g as wc,w as xc,b as yc,A as zc,H as Ac,D as Bc,F as Cc,G as Dc,$ as Ec,k as Fc,V as Gc};
2
-
3
- //# debugId=578EB85944C5459C64756E2164756E21
4
- //# sourceMappingURL=chunk-25ja9350.js.map
@@ -1,13 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/system/env.ts", "../src/system/fetch.ts", "../src/system/graceful-exit.ts", "../src/system/path.ts"],
4
- "sourcesContent": [
5
- "import { isUndefined } from '@/core'\n\nexport const isInMode = (key: string) => process.env.NODE_ENV === key\n\nexport const isInDevelopment = () => isInMode('development') || isInMode('dev')\nexport const isInDev = isInDevelopment\n\nexport const isInProduction = () => isInMode('production') || isInMode('prod')\nexport const isInProd = isInProduction\n\nexport const isInStaging = () => isInMode('staging') || isInMode('stage')\nexport const isInStage = isInStaging\n\nexport interface GetEnvOptions {\n env?: NodeJS.ProcessEnv\n includeNonePrefix?: boolean\n prefix?: string\n}\n\nexport function getEnv<T extends string>(key: T[], { env = process.env, includeNonePrefix = false, prefix }: GetEnvOptions = {}) {\n const result: Record<string, string | undefined> = {}\n\n for (const k of key) {\n result[k] = env[prefix ? `${prefix}${k}` : k]\n\n if (includeNonePrefix && isUndefined(result[k])) {\n result[k] = env[k]\n }\n }\n\n return result as Record<T, string | undefined>\n}\n",
6
- "import type { UrlLike } from '@/strings'\nimport { combineSignals, createAbortController } from '@/errors'\nimport { resolveOptions } from '@/objects'\nimport { withRetry, type WithRetryOptions } from '@/promises'\n\nexport interface FetchOptions extends Omit<RequestInit, 'signal'> {\n retry?: Omit<WithRetryOptions<Response>, 'signal'> & { enabled?: boolean } | boolean\n signal?: AbortSignal\n timeout?: number\n}\n\nexport async function fetch(request: RequestInfo | UrlLike, { retry = true, signal, timeout = 10_000, ...options }: FetchOptions = {}) {\n const retryOptions = { enabled: true, ...(resolveOptions(retry, {}) || { enabled: false }) }\n\n const execute = async (retrySignal?: AbortSignal) => {\n const controller = createAbortController(timeout)\n const fetchSignal = combineSignals(controller.signal, signal, retrySignal)\n\n return globalThis.fetch(request, { ...options, signal: fetchSignal }).finally(() => controller.abort())\n }\n\n return retryOptions.enabled ? await withRetry(execute, { ...retryOptions, signal }) : await execute()\n}\n",
7
- "export type ExitHandler = (exitCode?: number) => Promise<void>\n\nconst exitTasks = new Map<ExitHandler, number>()\n\nexport function addExitHandler(handler: ExitHandler, maxWaitTime = 3000) {\n exitTasks.set(handler, maxWaitTime)\n\n return () => {\n exitTasks.delete(handler)\n }\n}\n\nlet _isExiting = false\nlet _exitPromise: Promise<never> | undefined\n\nexport const isExiting = () => {\n return _isExiting\n}\n\nexport function gracefulExit(exitCode = 0, maxWaitTime = 3000): Promise<never> {\n if (_exitPromise) {\n return _exitPromise\n }\n\n _isExiting = true\n\n if (exitTasks.size === 0) {\n process.exit(exitCode)\n }\n\n const promises: Array<Promise<void>> = []\n\n for (const [handler, wait] of exitTasks) {\n promises.push(Promise.resolve().then(() => handler(exitCode)))\n maxWaitTime = Math.max(maxWaitTime, wait)\n }\n\n const timer = setTimeout(() => process.exit(exitCode), maxWaitTime)\n\n function finish(): never {\n clearTimeout(timer)\n process.exit(exitCode)\n }\n\n return _exitPromise = Promise.allSettled(promises).then(finish)\n}\n",
8
- "import type { PathLike } from './types'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { bufferToString, isBufferLike } from '@/buffers'\n\nexport const pathToString = (path: PathLike) => (\n isBufferLike(path) ? bufferToString(path) : path.toString()\n)\n\nexport const pwd = (importMeta: ImportMeta, ...path: PathLike[]) => (\n join(dirname(fileURLToPath(importMeta.url)), ...path.map(pathToString))\n)\n"
9
- ],
10
- "mappings": "AAAA,sBAAS,eAEF,IAAM,EAAW,CAAC,IAAyC,IAAzB,cAE5B,EAAkB,IAAM,EAAS,aAAa,GAAK,EAAS,KAAK,EACjE,EAAU,EAEV,EAAiB,IAAM,EAAS,YAAY,GAAK,EAAS,MAAM,EAChE,EAAW,EAEX,EAAc,IAAM,EAAS,SAAS,GAAK,EAAS,OAAO,EAC3D,EAAY,EAQlB,SAAS,CAAwB,CAAC,GAAY,MAAM,QAAQ,IAAK,oBAAoB,GAAO,UAA0B,CAAC,EAAG,CAC7H,IAAM,EAA6C,CAAC,EAEpD,QAAW,KAAK,EAGZ,GAFA,EAAO,GAAK,EAAI,EAAS,GAAG,IAAS,IAAM,GAEvC,GAAqB,EAAY,EAAO,EAAE,EAC1C,EAAO,GAAK,EAAI,GAIxB,OAAO,EC7BX,yBAAS,2BAAgB,iBACzB,yBAAS,kBACT,oBAAS,mBAQT,eAAsB,CAAK,CAAC,GAAkC,QAAQ,GAAM,SAAQ,UAAU,OAAW,GAA0B,CAAC,EAAG,CACnI,IAAM,EAAe,CAAE,QAAS,MAAU,EAAe,EAAO,CAAC,CAAC,GAAK,CAAE,QAAS,EAAM,CAAG,EAErF,EAAU,MAAO,IAA8B,CACjD,IAAM,EAAa,EAAsB,CAAO,EAC1C,EAAc,EAAe,EAAW,OAAQ,EAAQ,CAAW,EAEzE,OAAO,WAAW,MAAM,EAAS,IAAK,EAAS,OAAQ,CAAY,CAAC,EAAE,QAAQ,IAAM,EAAW,MAAM,CAAC,GAG1G,OAAO,EAAa,QAAU,MAAM,EAAU,EAAS,IAAK,EAAc,QAAO,CAAC,EAAI,MAAM,EAAQ,ECnBxG,IAAM,EAAY,IAAI,IAEf,SAAS,CAAc,CAAC,EAAsB,EAAc,KAAM,CAGrE,OAFA,EAAU,IAAI,EAAS,CAAW,EAE3B,IAAM,CACT,EAAU,OAAO,CAAO,GAIhC,IAAI,EAAa,GACb,EAES,EAAY,IAAM,CAC3B,OAAO,GAGJ,SAAS,CAAY,CAAC,EAAW,EAAG,EAAc,KAAsB,CAC3E,GAAI,EACA,OAAO,EAKX,GAFA,EAAa,GAET,EAAU,OAAS,EACnB,QAAQ,KAAK,CAAQ,EAGzB,IAAM,EAAiC,CAAC,EAExC,QAAY,EAAS,KAAS,EAC1B,EAAS,KAAK,QAAQ,QAAQ,EAAE,KAAK,IAAM,EAAQ,CAAQ,CAAC,CAAC,EAC7D,EAAc,KAAK,IAAI,EAAa,CAAI,EAG5C,IAAM,EAAQ,WAAW,IAAM,QAAQ,KAAK,CAAQ,EAAG,CAAW,EAElE,SAAS,CAAM,EAAU,CACrB,aAAa,CAAK,EAClB,QAAQ,KAAK,CAAQ,EAGzB,OAAO,EAAe,QAAQ,WAAW,CAAQ,EAAE,KAAK,CAAM,EC3ClE,kBAAS,UAAS,kBAClB,wBAAS,iBACT,yBAAS,kBAAgB,kBAElB,IAAM,EAAe,CAAC,IACzB,EAAa,CAAI,EAAI,EAAe,CAAI,EAAI,EAAK,SAAS,EAGjD,EAAM,CAAC,KAA2B,IAC3C,EAAK,EAAQ,EAAc,EAAW,GAAG,CAAC,EAAG,GAAG,EAAK,IAAI,CAAY,CAAC",
11
- "debugId": "578EB85944C5459C64756E2164756E21",
12
- "names": []
13
- }
package/chunk-3w6nt7kb.js DELETED
@@ -1,4 +0,0 @@
1
- var e=new Set(["1","on","true","yes"]);var c=(n)=>Object.prototype.toString.call(n);function b(n){if(n===null)return"null";return typeof n==="object"||typeof n==="function"?c(n).slice(8,-1).toLowerCase():typeof n}var o=(n)=>n===null,i=(n)=>n===void 0,l=(n)=>o(n)||i(n),w=(n)=>!o(n),T=(n)=>!i(n),a=(n)=>!l(n),r=(n)=>typeof n==="boolean",d=(n)=>typeof n==="symbol",y=(n)=>typeof n==="bigint",s=(n)=>typeof n==="number",u=(n)=>typeof n==="string",N=(n)=>n instanceof Date,S=(n)=>n===null||typeof n!=="object"&&typeof n!=="function",g=(n)=>o(n)||u(n)||r(n)||s(n)&&Number.isFinite(n);function P(n,p={}){let{anyNonZeroNumber:t=!1,trueStrings:f=e}=p;if(r(n))return n;if(u(n))return f.has(n.toLowerCase());if(s(n))return t?n!==0&&Number.isFinite(n):n===1;if(y(n))return t?n!==0n:n===1n;return!1}var L=(n)=>typeof n==="object"&&n!==null&&typeof n.next==="function"&&typeof n[Symbol.iterator]==="function";export{e as Fd,c as Gd,b as Hd,o as Id,i as Jd,l as Kd,w as Ld,T as Md,a as Nd,r as Od,d as Pd,y as Qd,s as Rd,u as Sd,N as Td,S as Ud,g as Vd,P as Wd,L as Xd};
2
-
3
- //# debugId=4BB7D5816C29805564756E2164756E21
4
- //# sourceMappingURL=chunk-3w6nt7kb.js.map
@@ -1,12 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/core/constants.ts", "../src/core/conversions.ts", "../src/core/guards.ts"],
4
- "sourcesContent": [
5
- "export const DEFAULT_TRUE_STRINGS = new Set(['1', 'on', 'true', 'yes'])\n",
6
- "export const toString = (value: unknown) => Object.prototype.toString.call(value)\n\nexport function typeOf(value: unknown): string {\n if (value === null) {\n return 'null'\n }\n\n return typeof value === 'object' || typeof value === 'function' ? toString(value).slice(8, -1).toLowerCase() : typeof value\n}\n",
7
- "import type { JsonablePrimitive, Primitive } from './types'\nimport { DEFAULT_TRUE_STRINGS } from './constants'\n\nexport const isNull = (value: unknown): value is null => value === null\nexport const isUndefined = (value: unknown): value is undefined => value === undefined\nexport const isNullish = (value: unknown): value is null | undefined => isNull(value) || isUndefined(value)\n\nexport const notNull = <T>(value: T): value is Exclude<T, null> => !isNull(value)\nexport const notUndefined = <T>(value: T): value is Exclude<T, undefined> => !isUndefined(value)\nexport const notNullish = <T>(value: T): value is NonNullable<T> => !isNullish(value)\n\nexport const isBoolean = (value: unknown): value is boolean => typeof value === 'boolean'\nexport const isSymbol = (value: unknown): value is symbol => typeof value === 'symbol'\nexport const isBigInt = (value: unknown): value is bigint => typeof value === 'bigint'\nexport const isNumber = (value: unknown): value is number => typeof value === 'number'\nexport const isString = (value: unknown): value is string => typeof value === 'string'\nexport const isDate = (value: unknown): value is Date => value instanceof Date\n\nexport const isPrimitive = (value: unknown): value is Primitive => value === null || (typeof value !== 'object' && typeof value !== 'function')\n\nexport const isJsonablePrimitive = (value: unknown): value is JsonablePrimitive => (\n isNull(value) || isString(value) || isBoolean(value) || (isNumber(value) && Number.isFinite(value))\n)\n\nexport interface IsTrueLikeOptions {\n anyNonZeroNumber?: boolean\n trueStrings?: Set<string>\n}\n\nexport function isTrueLike(value: unknown, options: IsTrueLikeOptions = {}) {\n const { anyNonZeroNumber = false, trueStrings = DEFAULT_TRUE_STRINGS } = options\n\n if (isBoolean(value)) {\n return value\n }\n\n if (isString(value)) {\n return trueStrings.has(value.toLowerCase())\n }\n\n if (isNumber(value)) {\n return anyNonZeroNumber ? value !== 0 && Number.isFinite(value) : value === 1\n }\n\n if (isBigInt(value)) {\n return anyNonZeroNumber ? value !== 0n : value === 1n\n }\n\n return false\n}\n\nexport const isGenerator = (value: unknown): boolean => (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as Record<PropertyKey, unknown>).next === 'function' &&\n typeof (value as Record<PropertyKey, unknown>)[Symbol.iterator] === 'function'\n)\n"
8
- ],
9
- "mappings": "AAAO,IAAM,EAAuB,IAAI,IAAI,CAAC,IAAK,KAAM,OAAQ,KAAK,CAAC,ECA/D,IAAM,EAAW,CAAC,IAAmB,OAAO,UAAU,SAAS,KAAK,CAAK,EAEzE,SAAS,CAAM,CAAC,EAAwB,CAC3C,GAAI,IAAU,KACV,MAAO,OAGX,OAAO,OAAO,IAAU,UAAY,OAAO,IAAU,WAAa,EAAS,CAAK,EAAE,MAAM,EAAG,EAAE,EAAE,YAAY,EAAI,OAAO,ECJnH,IAAM,EAAS,CAAC,IAAkC,IAAU,KACtD,EAAc,CAAC,IAAuC,IAAU,OAChE,EAAY,CAAC,IAA8C,EAAO,CAAK,GAAK,EAAY,CAAK,EAE7F,EAAU,CAAI,IAAwC,CAAC,EAAO,CAAK,EACnE,EAAe,CAAI,IAA6C,CAAC,EAAY,CAAK,EAClF,EAAa,CAAI,IAAsC,CAAC,EAAU,CAAK,EAEvE,EAAY,CAAC,IAAqC,OAAO,IAAU,UACnE,EAAW,CAAC,IAAoC,OAAO,IAAU,SACjE,EAAW,CAAC,IAAoC,OAAO,IAAU,SACjE,EAAW,CAAC,IAAoC,OAAO,IAAU,SACjE,EAAW,CAAC,IAAoC,OAAO,IAAU,SACjE,EAAS,CAAC,IAAkC,aAAiB,KAE7D,EAAc,CAAC,IAAuC,IAAU,MAAS,OAAO,IAAU,UAAY,OAAO,IAAU,WAEvH,EAAsB,CAAC,IAChC,EAAO,CAAK,GAAK,EAAS,CAAK,GAAK,EAAU,CAAK,GAAM,EAAS,CAAK,GAAK,OAAO,SAAS,CAAK,EAQ9F,SAAS,CAAU,CAAC,EAAgB,EAA6B,CAAC,EAAG,CACxE,IAAQ,mBAAmB,GAAO,cAAc,GAAyB,EAEzE,GAAI,EAAU,CAAK,EACf,OAAO,EAGX,GAAI,EAAS,CAAK,EACd,OAAO,EAAY,IAAI,EAAM,YAAY,CAAC,EAG9C,GAAI,EAAS,CAAK,EACd,OAAO,EAAmB,IAAU,GAAK,OAAO,SAAS,CAAK,EAAI,IAAU,EAGhF,GAAI,EAAS,CAAK,EACd,OAAO,EAAmB,IAAU,GAAK,IAAU,GAGvD,MAAO,GAGJ,IAAM,EAAc,CAAC,IACxB,OAAO,IAAU,UACjB,IAAU,MACV,OAAQ,EAAuC,OAAS,YACxD,OAAQ,EAAuC,OAAO,YAAc",
10
- "debugId": "4BB7D5816C29805564756E2164756E21",
11
- "names": []
12
- }
package/chunk-5txwcr6j.js DELETED
@@ -1,4 +0,0 @@
1
- import{fd as d,id as P}from"./chunk-bee0nxse.js";function p(e,a,t){if(!a)return e;let r=()=>t?P(t):a.reason??d();if(a.aborted)return Promise.reject(r());return new Promise((T,n)=>{let b=!1,o,f=(i)=>{if(!b)b=!0,a.removeEventListener("abort",o),i?.()};o=()=>{f(()=>n(r()))},a.addEventListener("abort",o),e.then((i)=>f(()=>T(i)),(i)=>f(()=>n(i)))})}var O=(e)=>async(a)=>{return Promise.resolve(e(a)).then(()=>a)};O.catch=(e)=>async(a)=>{throw await e(a),a};async function V(e,a){try{return await e()}catch(t){return await a(t)}}import{combineSignals as W,createAbortController as C,createAbortError as j}from"@/errors";function D(e,a){if(a)e?.removeEventListener("abort",a)}function F(e,a){let t=()=>a();if(e?.aborted)a();else e?.addEventListener("abort",t);return t}function L(e,a,t,r){let T=()=>{try{e()}catch(n){t?.(n)}try{a?.()}catch(n){t?.(n)}};if(r)T();else queueMicrotask(T)}function G({onCallbackError:e,onReject:a,onResolve:t,onSettle:r,signal:T,synchronousCallbacks:n=!1}={}){let b,o,f,i=!1,A=!1,s=!1,l=new Promise((w,y)=>{b=w,o=y}),g=(w)=>{D(T,f),L(w,r,e,n)};return Object.defineProperty(l,"isSettled",{enumerable:!0,get:()=>i}),Object.defineProperty(l,"isPending",{enumerable:!0,get:()=>!i}),Object.defineProperty(l,"isResolved",{enumerable:!0,get:()=>A}),Object.defineProperty(l,"isRejected",{enumerable:!0,get:()=>s}),l.resolve=(w)=>{if(i)return;i=!0,A=!0,b(w),g(()=>t?.(w))},l.reject=(w)=>{if(i)return;i=!0,s=!0,o(w),g(()=>a?.(w))},f=F(T,()=>{l.reject(T?.reason??j())}),l}var Z=(e,{error:a,signal:t,...r}={})=>{let T=C(e,a);return G({...r,onSettle(){T.abort(),r.onSettle?.()},signal:W(t,T.signal)})};import{isFunction as c}from"@/functions";import{isObject as x}from"@/objects";var te=(e)=>x(e)&&c(e.then),re=(e)=>x(e)&&c(e.then)&&c(e.catch)&&c(e.finally);import{isNonEmptyArray as N}from"@/arrays";async function ie(...e){if(!N(e))return;let a=await e[0]();for(let t=1;t<e.length;t++)a=await e[t](a);return a}import{assertParam as h}from"@/common";import{createAbortController as B,isAbortError as H}from"@/errors";import{isFunction as v}from"@/functions";import{isPlainObject as R}from"@/objects";import{combineSignals as I,createAbortController as M}from"@/errors";import{transform as q}from"@/functions";var u=async(e,{error:a,signal:t}={})=>p(new Promise((r)=>setTimeout(r,e)),t,a),we=(e,a,{error:t,signal:r}={})=>q(M(a,t),(T)=>p(e,I(r,T.signal)).finally(()=>T.abort()));function ye(e,a={}){let t,r;if(v(e)&&R(a))t=e,r=a;else h(R(e),"options must be an object"),h(v(a),"fn must be a function"),t=a,r=e;let{delay:T=0,immediately:n=!0,onError:b,stopOnError:o=!0}=r,f=B(),i=!0,A,s=()=>{return i=!1,f.abort(),A??Promise.resolve()},l,g=async()=>{if(!i)return;try{if(await p(Promise.resolve(t(f.signal)),f.signal),i)await u(T,{signal:f.signal})}catch(w){if(H(w)&&!i)return;if(b?.(w),o){s();return}}setTimeout(l,0)};if(l=()=>{A=g().finally(()=>{A=void 0})},n)Promise.resolve().then(l);else setTimeout(l,T);return s}import{isAbortError as E}from"@/errors";import{clamp as k}from"@/numbers";function _(e,{backoff:a=2,delay:t=1000,jitter:r=0.01,maxDelay:T=1e4}={}){let n=t*a**(e-1),b=k(n,0,T);if(r<=0)return b;let o=b*r,f=(Math.random()-0.5)*2*o;return k(b+f,0,T)}function m(e){if(e.length===1)return e[0];return AggregateError(e,"All retry attempts failed")}function z(e){if(!E(e))throw e}async function S(e,a,t,r,T){let n=_(e,a);await t?.(n,T),await u(n,{signal:r}).catch(z)}async function J(e,a,t,r,T,n){if(E(e))throw e;if(a.push(e),t<=0)throw m(a);if(r&&!await r(e,n))throw m(a);await T?.(e,n)}async function K(e,a,t,r,T,n){if(!r||!await r(e,n))return!0;if(t<=0)throw m(a);return await T?.(e,n),!1}async function Re(e,{maxAttempts:a=3,onBeforeWaitForNextAttempt:t,onFailedAttempt:r,onSuccessAttempt:T,shouldRetry:n,shouldRetryOnSuccess:b,signal:o,...f}={}){if(a<1)throw RangeError("maxAttempts must be at least 1");if(o)o.throwIfAborted();let i=0,A,s=[];while(i<a){let l=a-(i+++1),g={attempts:i,retriesLeft:l,signal:o};try{if(o)o.throwIfAborted();A=await p(Promise.resolve(e(o)),o)}catch(y){await J(y,s,l,n,r,g),await S(i,f,t,o,g);continue}if(await K(A,s,l,b,T,g))return A;await S(i,f,t,o,g)}throw m(s)}export{p as Hc,O as Ic,V as Jc,D as Kc,F as Lc,L as Mc,G as Nc,Z as Oc,te as Pc,re as Qc,ie as Rc,u as Sc,we as Tc,ye as Uc,_ as Vc,m as Wc,z as Xc,S as Yc,J as Zc,K as _c,Re as $c};
2
-
3
- //# debugId=857CC4AAB8256DCC64756E2164756E21
4
- //# sourceMappingURL=chunk-5txwcr6j.js.map