@krainovsd/js-helpers 0.3.2 → 0.3.4

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 (235) hide show
  1. package/lib/cjs/index.cjs +841 -0
  2. package/lib/cjs/index.cjs.map +1 -0
  3. package/lib/esm/lib/api/core.js +3 -3
  4. package/lib/esm/lib/api/middlewares/auth-middleware.js +3 -3
  5. package/lib/esm/lib/api/token-request.js +2 -2
  6. package/lib/esm/lib/browser/download-file.js +3 -3
  7. package/lib/esm/lib/date/date-difference.js +1 -1
  8. package/lib/esm/lib/date/date-format.js +1 -1
  9. package/lib/esm/lib/date/is-today.js +2 -2
  10. package/lib/esm/lib/date/is-tomorrow.js +2 -2
  11. package/lib/esm/lib/date/is-yesterday.js +2 -2
  12. package/lib/esm/lib/utils/field-view-format.js +1 -1
  13. package/lib/esm/lib/utils/get-by-path.js +1 -1
  14. package/lib/esm/lib/utils/set-by-path.js +1 -1
  15. package/lib/index.d.ts +215 -0
  16. package/package.json +13 -9
  17. package/lib/cjs/index.js +0 -2874
  18. package/lib/cjs/index.js.map +0 -1
  19. package/lib/esm/_virtual/_commonjsHelpers.js +0 -8
  20. package/lib/esm/_virtual/_commonjsHelpers.js.map +0 -1
  21. package/lib/esm/_virtual/dayjs.min.js +0 -8
  22. package/lib/esm/_virtual/dayjs.min.js.map +0 -1
  23. package/lib/esm/_virtual/dayjs.min2.js +0 -4
  24. package/lib/esm/_virtual/dayjs.min2.js.map +0 -1
  25. package/lib/esm/_virtual/get.js +0 -8
  26. package/lib/esm/_virtual/get.js.map +0 -1
  27. package/lib/esm/_virtual/isToday.js +0 -8
  28. package/lib/esm/_virtual/isToday.js.map +0 -1
  29. package/lib/esm/_virtual/isToday2.js +0 -4
  30. package/lib/esm/_virtual/isToday2.js.map +0 -1
  31. package/lib/esm/_virtual/isTomorrow.js +0 -8
  32. package/lib/esm/_virtual/isTomorrow.js.map +0 -1
  33. package/lib/esm/_virtual/isTomorrow2.js +0 -4
  34. package/lib/esm/_virtual/isTomorrow2.js.map +0 -1
  35. package/lib/esm/_virtual/isYesterday.js +0 -8
  36. package/lib/esm/_virtual/isYesterday.js.map +0 -1
  37. package/lib/esm/_virtual/isYesterday2.js +0 -4
  38. package/lib/esm/_virtual/isYesterday2.js.map +0 -1
  39. package/lib/esm/_virtual/set.js +0 -8
  40. package/lib/esm/_virtual/set.js.map +0 -1
  41. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js +0 -17
  42. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/dayjs.min.js.map +0 -1
  43. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isToday.js +0 -17
  44. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isToday.js.map +0 -1
  45. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isTomorrow.js +0 -17
  46. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isTomorrow.js.map +0 -1
  47. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isYesterday.js +0 -17
  48. package/lib/esm/node_modules/.pnpm/dayjs@1.11.13/node_modules/dayjs/plugin/isYesterday.js.map +0 -1
  49. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js +0 -49
  50. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Hash.js.map +0 -1
  51. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js +0 -49
  52. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_ListCache.js.map +0 -1
  53. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js +0 -21
  54. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Map.js.map +0 -1
  55. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js +0 -49
  56. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_MapCache.js.map +0 -1
  57. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js +0 -19
  58. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js.map +0 -1
  59. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js +0 -33
  60. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js.map +0 -1
  61. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js +0 -42
  62. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assignValue.js.map +0 -1
  63. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js +0 -34
  64. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_assocIndexOf.js.map +0 -1
  65. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js +0 -38
  66. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseAssignValue.js.map +0 -1
  67. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js +0 -38
  68. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGet.js.map +0 -1
  69. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js +0 -43
  70. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js.map +0 -1
  71. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js +0 -63
  72. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseIsNative.js.map +0 -1
  73. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js +0 -68
  74. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSet.js.map +0 -1
  75. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js +0 -53
  76. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js.map +0 -1
  77. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js +0 -37
  78. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castPath.js.map +0 -1
  79. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js +0 -19
  80. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_coreJsData.js.map +0 -1
  81. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js +0 -24
  82. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_defineProperty.js.map +0 -1
  83. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js +0 -18
  84. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js.map +0 -1
  85. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js +0 -31
  86. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getMapData.js.map +0 -1
  87. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js +0 -31
  88. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getNative.js.map +0 -1
  89. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js +0 -59
  90. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js.map +0 -1
  91. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js +0 -25
  92. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getValue.js.map +0 -1
  93. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js +0 -28
  94. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashClear.js.map +0 -1
  95. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js +0 -29
  96. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashDelete.js.map +0 -1
  97. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js +0 -43
  98. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashGet.js.map +0 -1
  99. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js +0 -36
  100. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashHas.js.map +0 -1
  101. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js +0 -36
  102. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hashSet.js.map +0 -1
  103. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js +0 -37
  104. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isIndex.js.map +0 -1
  105. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js +0 -43
  106. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKey.js.map +0 -1
  107. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js +0 -27
  108. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isKeyable.js.map +0 -1
  109. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js +0 -33
  110. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_isMasked.js.map +0 -1
  111. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js +0 -25
  112. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheClear.js.map +0 -1
  113. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js +0 -48
  114. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheDelete.js.map +0 -1
  115. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js +0 -32
  116. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheGet.js.map +0 -1
  117. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js +0 -29
  118. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheHas.js.map +0 -1
  119. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js +0 -39
  120. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_listCacheSet.js.map +0 -1
  121. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js +0 -36
  122. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheClear.js.map +0 -1
  123. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js +0 -31
  124. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheDelete.js.map +0 -1
  125. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js +0 -29
  126. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheGet.js.map +0 -1
  127. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js +0 -29
  128. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheHas.js.map +0 -1
  129. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js +0 -35
  130. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_mapCacheSet.js.map +0 -1
  131. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js +0 -39
  132. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_memoizeCapped.js.map +0 -1
  133. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js +0 -19
  134. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_nativeCreate.js.map +0 -1
  135. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js +0 -34
  136. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js.map +0 -1
  137. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js +0 -22
  138. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js.map +0 -1
  139. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js +0 -40
  140. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToPath.js.map +0 -1
  141. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js +0 -34
  142. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toKey.js.map +0 -1
  143. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js +0 -38
  144. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_toSource.js.map +0 -1
  145. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js +0 -49
  146. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/eq.js.map +0 -1
  147. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js +0 -46
  148. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/get.js.map +0 -1
  149. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js +0 -38
  150. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js.map +0 -1
  151. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js +0 -51
  152. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isFunction.js.map +0 -1
  153. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js +0 -43
  154. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObject.js.map +0 -1
  155. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js +0 -41
  156. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js.map +0 -1
  157. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js +0 -43
  158. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js.map +0 -1
  159. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js +0 -86
  160. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/memoize.js.map +0 -1
  161. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/set.js +0 -48
  162. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/set.js.map +0 -1
  163. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js +0 -41
  164. package/lib/esm/node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js.map +0 -1
  165. package/tmp/constants/api.d.ts +0 -4
  166. package/tmp/constants/colors.d.ts +0 -6
  167. package/tmp/constants/date.d.ts +0 -8
  168. package/tmp/constants/environment.d.ts +0 -6
  169. package/tmp/constants/fields.d.ts +0 -8
  170. package/tmp/constants/index.d.ts +0 -5
  171. package/tmp/index.d.ts +0 -3
  172. package/tmp/lib/api/core.d.ts +0 -19
  173. package/tmp/lib/api/index.d.ts +0 -1
  174. package/tmp/lib/api/middlewares/auth-middleware.d.ts +0 -2
  175. package/tmp/lib/api/middlewares/console-middleware.d.ts +0 -2
  176. package/tmp/lib/api/middlewares/index.d.ts +0 -2
  177. package/tmp/lib/api/token-request.d.ts +0 -2
  178. package/tmp/lib/browser/download-file.d.ts +0 -7
  179. package/tmp/lib/browser/download-json.d.ts +0 -1
  180. package/tmp/lib/browser/index.d.ts +0 -3
  181. package/tmp/lib/browser/read-file.d.ts +0 -1
  182. package/tmp/lib/colors/get-color-format.d.ts +0 -1
  183. package/tmp/lib/colors/index.d.ts +0 -6
  184. package/tmp/lib/colors/take-opacity-colors.d.ts +0 -1
  185. package/tmp/lib/colors/transform-hex-to-rgb.d.ts +0 -1
  186. package/tmp/lib/colors/transform-rgb-to-rgba.d.ts +0 -1
  187. package/tmp/lib/colors/transform-rgba-to-rgb.d.ts +0 -1
  188. package/tmp/lib/colors/transform-to-color.d.ts +0 -2
  189. package/tmp/lib/date/date-difference.d.ts +0 -2
  190. package/tmp/lib/date/date-format.d.ts +0 -1
  191. package/tmp/lib/date/get-date-by-rules.d.ts +0 -2
  192. package/tmp/lib/date/get-today.d.ts +0 -4
  193. package/tmp/lib/date/get-tomorrow.d.ts +0 -1
  194. package/tmp/lib/date/get-yesterday.d.ts +0 -1
  195. package/tmp/lib/date/index.d.ts +0 -9
  196. package/tmp/lib/date/is-today.d.ts +0 -2
  197. package/tmp/lib/date/is-tomorrow.d.ts +0 -2
  198. package/tmp/lib/date/is-yesterday.d.ts +0 -2
  199. package/tmp/lib/index.d.ts +0 -6
  200. package/tmp/lib/typings/check-type.d.ts +0 -1
  201. package/tmp/lib/typings/index.d.ts +0 -11
  202. package/tmp/lib/typings/is-array.d.ts +0 -1
  203. package/tmp/lib/typings/is-boolean.d.ts +0 -1
  204. package/tmp/lib/typings/is-date.d.ts +0 -1
  205. package/tmp/lib/typings/is-id.d.ts +0 -1
  206. package/tmp/lib/typings/is-null.d.ts +0 -1
  207. package/tmp/lib/typings/is-nullable.d.ts +0 -1
  208. package/tmp/lib/typings/is-number.d.ts +0 -1
  209. package/tmp/lib/typings/is-object.d.ts +0 -1
  210. package/tmp/lib/typings/is-string.d.ts +0 -1
  211. package/tmp/lib/typings/is-undefined.d.ts +0 -1
  212. package/tmp/lib/utils/array-to-map-by-key.d.ts +0 -1
  213. package/tmp/lib/utils/build-query-string.d.ts +0 -2
  214. package/tmp/lib/utils/create-url-with-params.d.ts +0 -7
  215. package/tmp/lib/utils/field-view-format.d.ts +0 -2
  216. package/tmp/lib/utils/get-by-path.d.ts +0 -1
  217. package/tmp/lib/utils/get-file-name-from-header.d.ts +0 -1
  218. package/tmp/lib/utils/index.d.ts +0 -16
  219. package/tmp/lib/utils/json-parse.d.ts +0 -1
  220. package/tmp/lib/utils/limit-stream-of-requests.d.ts +0 -14
  221. package/tmp/lib/utils/random-number.d.ts +0 -1
  222. package/tmp/lib/utils/random-string.d.ts +0 -1
  223. package/tmp/lib/utils/set-by-path.d.ts +0 -1
  224. package/tmp/lib/utils/sync-object-values.d.ts +0 -1
  225. package/tmp/lib/utils/transform-to-number.d.ts +0 -1
  226. package/tmp/lib/utils/trim-url.d.ts +0 -1
  227. package/tmp/lib/utils/wait-until.d.ts +0 -1
  228. package/tmp/lib/utils/wait.d.ts +0 -1
  229. package/tmp/libs.d.ts +0 -2
  230. package/tmp/types/api.d.ts +0 -33
  231. package/tmp/types/colors.d.ts +0 -3
  232. package/tmp/types/common.d.ts +0 -2
  233. package/tmp/types/date.d.ts +0 -7
  234. package/tmp/types/fields.d.ts +0 -3
  235. package/tmp/types/index.d.ts +0 -5
@@ -0,0 +1,841 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const get = require('lodash/get');
6
+ const dayjs = require('dayjs');
7
+ const todayPlugin = require('dayjs/plugin/isToday');
8
+ const tomorrowPlugin = require('dayjs/plugin/isTomorrow');
9
+ const yesterdayPlugin = require('dayjs/plugin/isYesterday');
10
+ const set = require('lodash/set');
11
+
12
+ const DATE_TYPES = {
13
+ Days: "days",
14
+ Months: "months",
15
+ Years: "years",
16
+ Seconds: "seconds",
17
+ Minutes: "minutes",
18
+ Hours: "hours",
19
+ };
20
+
21
+ const API_MIDDLEWARES = {
22
+ Auth: "auth",
23
+ Logger: "logger",
24
+ };
25
+
26
+ /* eslint-disable no-restricted-globals */
27
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
28
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
29
+ const IS_JEST = typeof process != "undefined" && process.env.JEST_WORKER_ID !== undefined;
30
+ const IS_BUN = typeof process !== "undefined" && process.versions != null && process.versions.bun != null;
31
+ const IS_DENO = // @ts-expect-error
32
+ typeof Deno !== "undefined" &&
33
+ // @ts-expect-error
34
+ typeof Deno.version !== "undefined" &&
35
+ // @ts-expect-error
36
+ typeof Deno.version.deno !== "undefined";
37
+ const IS_NODE = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
38
+ const IS_WEB_WORKER = typeof self === "object" &&
39
+ self.constructor &&
40
+ self.constructor.name === "DedicatedWorkerGlobalScope";
41
+ const IS_BROWSER = typeof window !== "undefined" && typeof window.document !== "undefined";
42
+
43
+ const COLOR_FORMATS = {
44
+ Hex: "HEX",
45
+ Rgb: "RGB",
46
+ Rgba: "RGBA",
47
+ Hsl: "HSL",
48
+ };
49
+
50
+ const FIELD_TYPES = {
51
+ Date: "date",
52
+ Time: "time",
53
+ DateTime: "dateTime",
54
+ String: "string",
55
+ Number: "number",
56
+ Array: "array",
57
+ };
58
+
59
+ const waitUntil = (condition, checkInterval = 100) => {
60
+ return new Promise((resolve) => {
61
+ const interval = setInterval(() => {
62
+ if (condition())
63
+ return;
64
+ clearInterval(interval);
65
+ resolve(true);
66
+ }, checkInterval);
67
+ });
68
+ };
69
+
70
+ function checkType(value, condition) {
71
+ if (condition) {
72
+ return true;
73
+ }
74
+ return false;
75
+ }
76
+
77
+ function isArray(value) {
78
+ return Boolean(value && Array.isArray(value));
79
+ }
80
+
81
+ function isBoolean(value) {
82
+ return typeof value === "boolean";
83
+ }
84
+
85
+ function isNumber(value) {
86
+ return typeof value === "number" && !Number.isNaN(value);
87
+ }
88
+
89
+ function isString(value) {
90
+ return typeof value === "string";
91
+ }
92
+
93
+ function isId(value) {
94
+ return isNumber(value) || isString(value);
95
+ }
96
+
97
+ function isNull(value) {
98
+ return value === null;
99
+ }
100
+
101
+ function isNullable(value) {
102
+ return typeof value === "undefined" || value === null;
103
+ }
104
+
105
+ function isObject(value) {
106
+ return Boolean(value && typeof value === "object" && !Array.isArray(value));
107
+ }
108
+
109
+ function isUndefined(value) {
110
+ return typeof value === "undefined";
111
+ }
112
+
113
+ function isDate(value) {
114
+ if (value instanceof Date)
115
+ return !Number.isNaN(value.valueOf());
116
+ return false;
117
+ }
118
+
119
+ function getByPath(data, path, defaultValue = undefined) {
120
+ if ((!isObject(data) && !isArray(data)) || !isString(path))
121
+ return defaultValue;
122
+ return get(data, path, defaultValue);
123
+ }
124
+
125
+ function dateDifference(type, firstDate, secondDate = new Date(), float = false) {
126
+ const first = dayjs(firstDate);
127
+ return first.diff(secondDate, type, float);
128
+ }
129
+
130
+ function getDateByRules(rules, date = new Date()) {
131
+ let result = new Date(date);
132
+ for (const rule of rules) {
133
+ result = getDate(rule.increment, rule.type, result);
134
+ }
135
+ return result;
136
+ }
137
+ function getDate(increment, type, date = new Date()) {
138
+ const result = new Date(date);
139
+ switch (type) {
140
+ case DATE_TYPES.Days: {
141
+ result.setDate(result.getDate() + increment);
142
+ return result;
143
+ }
144
+ case DATE_TYPES.Months: {
145
+ result.setMonth(result.getMonth() + increment);
146
+ return result;
147
+ }
148
+ case DATE_TYPES.Years: {
149
+ result.setFullYear(result.getFullYear() + increment);
150
+ return result;
151
+ }
152
+ case DATE_TYPES.Seconds: {
153
+ result.setSeconds(result.getSeconds() + increment);
154
+ return result;
155
+ }
156
+ case DATE_TYPES.Minutes: {
157
+ result.setMinutes(result.getMinutes() + increment);
158
+ return result;
159
+ }
160
+ case DATE_TYPES.Hours: {
161
+ result.setHours(result.getHours() + increment);
162
+ return result;
163
+ }
164
+ default:
165
+ return result;
166
+ }
167
+ }
168
+
169
+ function getToday() {
170
+ const startToday = new Date();
171
+ startToday.setHours(0, 0, 0, 0);
172
+ const endToday = new Date();
173
+ endToday.setHours(23, 59, 59, 999);
174
+ return { startToday, endToday };
175
+ }
176
+
177
+ function getTomorrow() {
178
+ const tomorrow = new Date();
179
+ tomorrow.setHours(0, 0, 0, 0);
180
+ tomorrow.setDate(tomorrow.getDate() + 1);
181
+ return tomorrow;
182
+ }
183
+
184
+ function getYesterday() {
185
+ const yesterday = new Date();
186
+ yesterday.setHours(0, 0, 0, 0);
187
+ yesterday.setDate(yesterday.getDate() - 1);
188
+ return yesterday;
189
+ }
190
+
191
+ dayjs.extend(todayPlugin);
192
+ function isToday(date) {
193
+ try {
194
+ return dayjs(date).isToday();
195
+ }
196
+ catch {
197
+ return false;
198
+ }
199
+ }
200
+
201
+ dayjs.extend(tomorrowPlugin);
202
+ function isTomorrow(date) {
203
+ try {
204
+ return dayjs(date).isTomorrow();
205
+ }
206
+ catch {
207
+ return false;
208
+ }
209
+ }
210
+
211
+ dayjs.extend(yesterdayPlugin);
212
+ function isYesterday(date) {
213
+ try {
214
+ return dayjs(date).isYesterday();
215
+ }
216
+ catch {
217
+ return false;
218
+ }
219
+ }
220
+
221
+ function dateFormat(date, format) {
222
+ const correctDate = new Date(date);
223
+ if (!isDate(correctDate))
224
+ return "";
225
+ return dayjs(correctDate).format(format);
226
+ }
227
+
228
+ function transformToNumber(value) {
229
+ let result;
230
+ if (isString(value))
231
+ result = parseInt(value, 10);
232
+ else
233
+ result = Number(value);
234
+ return Number.isNaN(result) ? 0 : result;
235
+ }
236
+
237
+ function fieldViewFormat(field, type = "string") {
238
+ switch (type) {
239
+ case FIELD_TYPES.Array: {
240
+ return isArray(field) ? field.join(", ") : "";
241
+ }
242
+ case FIELD_TYPES.Date: {
243
+ return isString(field) || isNumber(field) || isDate(field)
244
+ ? dateFormat(field, "DD.MM.YYYY")
245
+ : "";
246
+ }
247
+ case FIELD_TYPES.DateTime: {
248
+ return isString(field) || isNumber(field) || isDate(field)
249
+ ? dateFormat(field, "DD.MM.YYYY HH:mm")
250
+ : "";
251
+ }
252
+ case FIELD_TYPES.Number: {
253
+ return isString(field) || isNumber(field) || isBoolean(field)
254
+ ? String(transformToNumber(field))
255
+ : "";
256
+ }
257
+ case FIELD_TYPES.String: {
258
+ return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : "";
259
+ }
260
+ case FIELD_TYPES.Time: {
261
+ return isString(field) || isNumber(field) || isDate(field) ? dateFormat(field, "HH:mm") : "";
262
+ }
263
+ default: {
264
+ return isString(field) || isNumber(field) || isBoolean(field) ? String(field) : "";
265
+ }
266
+ }
267
+ }
268
+
269
+ function setByPath(data, path, value) {
270
+ try {
271
+ if (!isObject(data) && !isArray(data))
272
+ throw new Error("bad data");
273
+ set(data, path, value);
274
+ }
275
+ catch (error) {
276
+ // eslint-disable-next-line no-console
277
+ console.warn(error);
278
+ }
279
+ }
280
+
281
+ function jsonParse(json) {
282
+ if (!isString(json))
283
+ return null;
284
+ try {
285
+ return JSON.parse(json);
286
+ }
287
+ catch {
288
+ return null;
289
+ }
290
+ }
291
+
292
+ const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
293
+ function randomString(length = 10, allowCharacters = characters) {
294
+ let result = "";
295
+ let counter = 0;
296
+ while (counter < length) {
297
+ result += allowCharacters.charAt(Math.floor(Math.random() * allowCharacters.length));
298
+ counter += 1;
299
+ }
300
+ return result;
301
+ }
302
+
303
+ function wait(delay) {
304
+ return new Promise((resolve) => {
305
+ setTimeout(() => {
306
+ resolve(true);
307
+ }, delay);
308
+ });
309
+ }
310
+
311
+ function buildQueryString(params) {
312
+ const queryString = [];
313
+ for (const [key, value] of Object.entries(params)) {
314
+ if (isObject(value) || value == undefined)
315
+ continue;
316
+ if (isArray(value)) {
317
+ for (const item of value) {
318
+ if (item != undefined && !isObject(item))
319
+ queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(item))}`);
320
+ }
321
+ }
322
+ else {
323
+ queryString.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
324
+ }
325
+ }
326
+ return queryString.join("&");
327
+ }
328
+
329
+ function createURLWithParams(options) {
330
+ const url = options.baseURL.replace(/\/$/, "").replace(/\?$/, "");
331
+ if (!options.params) {
332
+ return url;
333
+ }
334
+ const queryString = buildQueryString(options.params);
335
+ return `${url}?${queryString}`;
336
+ }
337
+
338
+ function trimUrl(url) {
339
+ return url.replace(/^\//, "").replace(/\/$/, "");
340
+ }
341
+
342
+ function arrayToMapByKey(array, key) {
343
+ const map = {};
344
+ for (const item of array) {
345
+ const keyValue = item[key];
346
+ if (isId(keyValue))
347
+ map[keyValue] = item;
348
+ }
349
+ return map;
350
+ }
351
+
352
+ function syncObjectValues(oldObj, newObj, exception = []) {
353
+ for (const field in newObj) {
354
+ if (exception.includes(field))
355
+ continue;
356
+ const oldValue = getByPath(oldObj, field, undefined);
357
+ const newValue = getByPath(newObj, field, undefined);
358
+ if (isUndefined(oldValue) || isUndefined(newValue))
359
+ continue;
360
+ if (oldValue === newValue)
361
+ continue;
362
+ setByPath(oldObj, field, newValue);
363
+ }
364
+ }
365
+
366
+ function randomNumber(min, max) {
367
+ min = Math.ceil(min);
368
+ max = Math.floor(max);
369
+ return Math.floor(Math.random() * (max - min) + min);
370
+ }
371
+
372
+ const filenameVariables = ["filename=", "filename*=UTF-8''"];
373
+ function getFileNameFromHeader(header) {
374
+ const name = header
375
+ .split(";")
376
+ .find((info) => ~info.indexOf(filenameVariables[0]) || ~info.indexOf(filenameVariables[1]))
377
+ ?.replace(filenameVariables[0], "")
378
+ ?.replace(filenameVariables[1], "")
379
+ ?.replace(/"/g, "")
380
+ ?.trim();
381
+ return name ? decodeURI(name) : null;
382
+ }
383
+
384
+ function limitStreamOfRequests({ countRequests, maxCountInParallel, promiseGetter, refetchAfterError, resultCb, collectResult, maxTryCount = 3, }) {
385
+ let isStopped = false;
386
+ return {
387
+ cancel: () => {
388
+ isStopped = true;
389
+ },
390
+ promise: new Promise((resolve) => {
391
+ let currentRequests = 0;
392
+ let currentResponses = 0;
393
+ const results = [];
394
+ for (let i = 0; i < maxCountInParallel; i++) {
395
+ request(promiseGetter(++currentRequests), currentRequests);
396
+ }
397
+ function request(promise, position, tryCount = 1) {
398
+ if (isStopped)
399
+ return void resolve(results);
400
+ if (currentResponses === countRequests)
401
+ return void resolve(results);
402
+ if (position > countRequests || promise == undefined)
403
+ return;
404
+ promise
405
+ .then((result) => {
406
+ if (isStopped)
407
+ return void resolve(results);
408
+ if (collectResult)
409
+ results.push(result);
410
+ if (resultCb)
411
+ resultCb(result);
412
+ currentResponses++;
413
+ request(promiseGetter(++currentRequests), currentRequests);
414
+ })
415
+ .catch(() => {
416
+ if (isStopped)
417
+ return void resolve(results);
418
+ if (refetchAfterError && maxTryCount > tryCount) {
419
+ void wait(1000).then(() => request(promiseGetter(position), position, tryCount + 1));
420
+ }
421
+ else {
422
+ currentResponses++;
423
+ request(promiseGetter(++currentRequests), currentRequests);
424
+ }
425
+ });
426
+ }
427
+ }),
428
+ };
429
+ }
430
+
431
+ function downloadFile({ data, fileName, mimeType }) {
432
+ if (!IS_BROWSER && !IS_JEST)
433
+ return null;
434
+ const name = getFileNameFromHeader(fileName);
435
+ if (!name)
436
+ throw new Error("Bad filename");
437
+ const blob = new Blob([data], {
438
+ type: mimeType,
439
+ });
440
+ const downloadUrl = window.URL.createObjectURL(blob);
441
+ const link = document.createElement("a");
442
+ link.style.display = "none";
443
+ link.download = name;
444
+ link.href = downloadUrl;
445
+ document.body.appendChild(link);
446
+ link.click();
447
+ document.body.removeChild(link);
448
+ link.remove();
449
+ window.URL.revokeObjectURL(downloadUrl);
450
+ return null;
451
+ }
452
+
453
+ function downloadJson(data, name) {
454
+ if (!IS_BROWSER && !IS_JEST)
455
+ return null;
456
+ const url = `data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(data))}`;
457
+ const link = document.createElement("a");
458
+ link.style.display = "none";
459
+ link.download = name;
460
+ link.href = url;
461
+ document.body.appendChild(link);
462
+ link.click();
463
+ document.body.removeChild(link);
464
+ link.remove();
465
+ }
466
+
467
+ function readFile(file) {
468
+ return new Promise((resolve) => {
469
+ if (!IS_BROWSER && !IS_JEST) {
470
+ resolve(null);
471
+ return;
472
+ }
473
+ const reader = new FileReader();
474
+ reader.readAsText(file);
475
+ reader.onload = () => {
476
+ resolve(reader.result);
477
+ };
478
+ reader.onerror = () => {
479
+ resolve(null);
480
+ };
481
+ });
482
+ }
483
+
484
+ const tokenRequest = async (options) => {
485
+ try {
486
+ const response = await fetch(options.authTokenUrl, {
487
+ method: "GET",
488
+ });
489
+ if (!response.ok) {
490
+ throw new Error(`HTTP error! Status: ${response.status}`);
491
+ }
492
+ const result = (await response.json());
493
+ const { expiresToken, token } = transformData(result, options.pathToToken, options.pathToExpires);
494
+ localStorage.setItem(options.storageExpiresTokenName, expiresToken);
495
+ localStorage.setItem(options.storageTokenName, token);
496
+ return token;
497
+ }
498
+ catch (error) {
499
+ // eslint-disable-next-line no-console
500
+ console.log(error);
501
+ window.location.replace(options.authRedirectUrl);
502
+ return null;
503
+ }
504
+ };
505
+ function transformData(data, pathToToken, pathToExpires) {
506
+ if (!isObject(data))
507
+ throw new Error("Bad response data");
508
+ const token = getByPath(data, pathToToken);
509
+ const expiresToken = getByPath(data, pathToExpires);
510
+ if ((!isString(expiresToken) && !isNumber(expiresToken)) || !isString(token))
511
+ throw new Error("Bad response data");
512
+ return {
513
+ expiresToken: String(expiresToken),
514
+ token,
515
+ };
516
+ }
517
+
518
+ let isFetchingAccessToken = false;
519
+ const generateAuthMiddleWare = (options) => async (request) => {
520
+ if (!options.authRedirectUrl ||
521
+ !options.authRedirectUrl ||
522
+ !options.storageExpiresTokenName ||
523
+ !options.storageTokenName ||
524
+ !options.pathToExpires ||
525
+ !options.pathToToken) {
526
+ // eslint-disable-next-line no-console
527
+ console.error("Auth middleware hasn't required options");
528
+ return;
529
+ }
530
+ const isSameOrigin = !request.path.includes("http") && !request.path.includes("https");
531
+ if (request.token && !isSameOrigin) {
532
+ request.headers = {
533
+ ...request.headers,
534
+ Authorization: `Bearer ${request.token}`,
535
+ };
536
+ return;
537
+ }
538
+ if (isFetchingAccessToken)
539
+ await waitUntil(() => isFetchingAccessToken);
540
+ const expires = localStorage.getItem(options.storageExpiresTokenName);
541
+ let token = localStorage.getItem(options.storageTokenName);
542
+ if (!expires || Date.now() > +expires || !token) {
543
+ isFetchingAccessToken = true;
544
+ token = await tokenRequest(options);
545
+ isFetchingAccessToken = false;
546
+ }
547
+ if (!isSameOrigin)
548
+ request.headers = {
549
+ ...request.headers,
550
+ Authorization: `Bearer ${token}`,
551
+ };
552
+ };
553
+
554
+ const consoleMiddleware = (response) => {
555
+ return new Promise((resolve) => {
556
+ // eslint-disable-next-line no-console
557
+ console.log(response);
558
+ resolve(true);
559
+ });
560
+ };
561
+
562
+ function generateMiddlewares(activeMiddlewares, middlewareOptions) {
563
+ const selectedMiddlewares = [];
564
+ for (const key of activeMiddlewares) {
565
+ switch (key) {
566
+ case API_MIDDLEWARES.Auth: {
567
+ if (middlewareOptions.auth && (IS_BROWSER || IS_JEST))
568
+ selectedMiddlewares.push(generateAuthMiddleWare(middlewareOptions.auth));
569
+ continue;
570
+ }
571
+ case API_MIDDLEWARES.Logger: {
572
+ selectedMiddlewares.push(consoleMiddleware);
573
+ continue;
574
+ }
575
+ default: {
576
+ continue;
577
+ }
578
+ }
579
+ }
580
+ return function executeMiddlewares(request) {
581
+ return new Promise((resolve) => {
582
+ void (async () => {
583
+ for (const middleware of selectedMiddlewares) {
584
+ // eslint-disable-next-line no-await-in-loop
585
+ await middleware(request);
586
+ }
587
+ resolve(1);
588
+ })();
589
+ });
590
+ };
591
+ }
592
+
593
+ class ResponseError extends Error {
594
+ status;
595
+ description;
596
+ constructor({ message, status, description }) {
597
+ super(message);
598
+ this.status = status;
599
+ this.description = description;
600
+ }
601
+ }
602
+ function generateRequestsInstance(activeMiddlewares, middlewareOptions) {
603
+ const executeMiddlewares = generateMiddlewares(activeMiddlewares || [], middlewareOptions || {});
604
+ async function handleRequest(request, responseWithStatus) {
605
+ if (request.delay) {
606
+ await wait(request.delay);
607
+ }
608
+ if (request.mock) {
609
+ const transformedResult = request.transformIncomingData
610
+ ? request.transformIncomingData(request.mock)
611
+ : request.mock;
612
+ return responseWithStatus ? { data: transformedResult, status: 200 } : transformedResult;
613
+ }
614
+ await executeMiddlewares(request);
615
+ const { method, body, path, params, headers } = request;
616
+ const trimedPath = path.replace(/^\//, "").replace(/\/$/, "");
617
+ const fullPath = trimedPath.includes("http") || trimedPath.includes("https")
618
+ ? trimedPath
619
+ : `${window.location.origin}/${trimedPath}`;
620
+ const url = createURLWithParams({ baseURL: fullPath, params });
621
+ let preparedBody = body;
622
+ if (body && !(preparedBody instanceof FormData)) {
623
+ if (request.transformOutcomingData) {
624
+ preparedBody = request.transformOutcomingData(body);
625
+ }
626
+ if (isObject(body) || isArray(body))
627
+ preparedBody = JSON.stringify(preparedBody);
628
+ }
629
+ let response;
630
+ if (IS_BROWSER || IS_JEST) {
631
+ response = await fetch(url, {
632
+ method,
633
+ body: preparedBody,
634
+ headers: {
635
+ ...(body instanceof FormData
636
+ ? {}
637
+ : { "Content-Type": "application/json; charset=UTF-8" }),
638
+ ...headers,
639
+ },
640
+ signal: request.signal,
641
+ });
642
+ }
643
+ if (IS_NODE && !IS_JEST) {
644
+ const nodeFetch = (await import('node-fetch')).default;
645
+ response = await nodeFetch(url, {
646
+ method,
647
+ body: preparedBody,
648
+ headers: {
649
+ ...(body instanceof FormData
650
+ ? {}
651
+ : { "Content-Type": "application/json; charset=UTF-8" }),
652
+ ...headers,
653
+ },
654
+ signal: request.signal,
655
+ });
656
+ }
657
+ if (!response) {
658
+ throw new Error("hasn't response");
659
+ }
660
+ if (!response.ok) {
661
+ throw new ResponseError({
662
+ status: response.status,
663
+ message: `HTTP error! Status: ${response.status}`,
664
+ });
665
+ }
666
+ if (request.downloadFile) {
667
+ const data = await response.blob();
668
+ const mimeType = response.headers.get("content-type");
669
+ const fileName = response.headers.get("content-disposition");
670
+ if (!mimeType || !fileName)
671
+ throw new Error("Download Error! Empty info!");
672
+ if (IS_BROWSER)
673
+ downloadFile({
674
+ data,
675
+ fileName,
676
+ mimeType,
677
+ });
678
+ return responseWithStatus
679
+ ? {
680
+ data: data,
681
+ status: response.status,
682
+ }
683
+ : data;
684
+ }
685
+ if (request.withoutResponse)
686
+ return responseWithStatus ? { data: true, status: response.status } : true;
687
+ const result = (await response.json());
688
+ const transformedResult = request.transformIncomingData
689
+ ? request.transformIncomingData(result)
690
+ : result;
691
+ return responseWithStatus
692
+ ? { data: transformedResult, status: response.status }
693
+ : transformedResult;
694
+ }
695
+ async function requestApi(request) {
696
+ return handleRequest(request, false);
697
+ }
698
+ async function requestApiWithStatus(request) {
699
+ return handleRequest(request, true);
700
+ }
701
+ return {
702
+ requestApi,
703
+ requestApiWithStatus,
704
+ };
705
+ }
706
+
707
+ function getColorFormat(color) {
708
+ if (color.startsWith("#")) {
709
+ return COLOR_FORMATS.Hex;
710
+ }
711
+ if (color.startsWith("rgba")) {
712
+ return COLOR_FORMATS.Rgba;
713
+ }
714
+ if (color.startsWith("rgb")) {
715
+ return COLOR_FORMATS.Rgb;
716
+ }
717
+ if (color.startsWith("hsl")) {
718
+ return COLOR_FORMATS.Hsl;
719
+ }
720
+ }
721
+
722
+ function transformHEXtoRGB(hex) {
723
+ return `rgb(${hex.match(/\w\w/g)?.map((x) => +`0x${x}`)})`;
724
+ }
725
+
726
+ function transformRGBtoRGBA(rgb, opacity) {
727
+ const code = rgb.match(/\d+/g);
728
+ code?.push(String(opacity / 100));
729
+ return `rgba(${code?.join(",")})`;
730
+ }
731
+
732
+ function transformRGBAtoRGB(rgba) {
733
+ const code = rgba.match(/\d+/g);
734
+ code?.splice(3);
735
+ return `rgb(${code?.join(",")})`;
736
+ }
737
+
738
+ function takeOpacityColors(color, opacities) {
739
+ let rgbColor = color;
740
+ if (!rgbColor)
741
+ return [];
742
+ if (getColorFormat(rgbColor) === COLOR_FORMATS.Hex) {
743
+ rgbColor = transformHEXtoRGB(rgbColor);
744
+ }
745
+ else if (getColorFormat(rgbColor) === COLOR_FORMATS.Rgba) {
746
+ rgbColor = transformRGBAtoRGB(rgbColor);
747
+ }
748
+ if (getColorFormat(rgbColor) !== COLOR_FORMATS.Rgb)
749
+ return [];
750
+ return [...opacities.map((opacity) => transformRGBtoRGBA(rgbColor, opacity))];
751
+ }
752
+
753
+ function transformToColor(currentColor, defaultColor = "black", defaultFormat = COLOR_FORMATS.Hex) {
754
+ if (!isString(currentColor))
755
+ return defaultColor;
756
+ let correctColor = currentColor;
757
+ if (!getColorFormat(correctColor)) {
758
+ switch (defaultFormat) {
759
+ case COLOR_FORMATS.Hex: {
760
+ correctColor = `#${correctColor}`;
761
+ break;
762
+ }
763
+ case COLOR_FORMATS.Rgb: {
764
+ correctColor = `rgb(${correctColor})`;
765
+ break;
766
+ }
767
+ case COLOR_FORMATS.Rgba: {
768
+ correctColor = `rgba(${correctColor})`;
769
+ break;
770
+ }
771
+ case COLOR_FORMATS.Hsl: {
772
+ correctColor = `hsl(${correctColor})`;
773
+ break;
774
+ }
775
+ default: {
776
+ correctColor = `#${correctColor}`;
777
+ break;
778
+ }
779
+ }
780
+ }
781
+ return correctColor;
782
+ }
783
+
784
+ exports.API_MIDDLEWARES = API_MIDDLEWARES;
785
+ exports.COLOR_FORMATS = COLOR_FORMATS;
786
+ exports.DATE_TYPES = DATE_TYPES;
787
+ exports.FIELD_TYPES = FIELD_TYPES;
788
+ exports.IS_BROWSER = IS_BROWSER;
789
+ exports.IS_BUN = IS_BUN;
790
+ exports.IS_DENO = IS_DENO;
791
+ exports.IS_JEST = IS_JEST;
792
+ exports.IS_NODE = IS_NODE;
793
+ exports.IS_WEB_WORKER = IS_WEB_WORKER;
794
+ exports.ResponseError = ResponseError;
795
+ exports.arrayToMapByKey = arrayToMapByKey;
796
+ exports.buildQueryString = buildQueryString;
797
+ exports.checkType = checkType;
798
+ exports.createURLWithParams = createURLWithParams;
799
+ exports.dateDifference = dateDifference;
800
+ exports.dateFormat = dateFormat;
801
+ exports.downloadFile = downloadFile;
802
+ exports.downloadJson = downloadJson;
803
+ exports.fieldViewFormat = fieldViewFormat;
804
+ exports.generateRequestsInstance = generateRequestsInstance;
805
+ exports.getByPath = getByPath;
806
+ exports.getColorFormat = getColorFormat;
807
+ exports.getDateByRules = getDateByRules;
808
+ exports.getFileNameFromHeader = getFileNameFromHeader;
809
+ exports.getToday = getToday;
810
+ exports.getTomorrow = getTomorrow;
811
+ exports.getYesterday = getYesterday;
812
+ exports.isArray = isArray;
813
+ exports.isBoolean = isBoolean;
814
+ exports.isDate = isDate;
815
+ exports.isId = isId;
816
+ exports.isNull = isNull;
817
+ exports.isNullable = isNullable;
818
+ exports.isNumber = isNumber;
819
+ exports.isObject = isObject;
820
+ exports.isString = isString;
821
+ exports.isToday = isToday;
822
+ exports.isTomorrow = isTomorrow;
823
+ exports.isUndefined = isUndefined;
824
+ exports.isYesterday = isYesterday;
825
+ exports.jsonParse = jsonParse;
826
+ exports.limitStreamOfRequests = limitStreamOfRequests;
827
+ exports.randomNumber = randomNumber;
828
+ exports.randomString = randomString;
829
+ exports.readFile = readFile;
830
+ exports.setByPath = setByPath;
831
+ exports.syncObjectValues = syncObjectValues;
832
+ exports.takeOpacityColors = takeOpacityColors;
833
+ exports.transformHEXtoRGB = transformHEXtoRGB;
834
+ exports.transformRGBAtoRGB = transformRGBAtoRGB;
835
+ exports.transformRGBtoRGBA = transformRGBtoRGBA;
836
+ exports.transformToColor = transformToColor;
837
+ exports.transformToNumber = transformToNumber;
838
+ exports.trimUrl = trimUrl;
839
+ exports.wait = wait;
840
+ exports.waitUntil = waitUntil;
841
+ //# sourceMappingURL=index.cjs.map