@sparted/shared-library 1.0.8-alpha.6 → 1.0.8

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 (363) hide show
  1. package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js +3 -0
  2. package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js.map +1 -1
  3. package/{src/index.ts → index.d.ts} +14 -15
  4. package/{dist/index.js → index.js} +0 -2
  5. package/{dist/index.js.map → index.js.map} +1 -1
  6. package/package.json +3 -7
  7. package/.circleci/config.yml +0 -40
  8. package/.eslintignore +0 -1
  9. package/.eslintrc.js +0 -17
  10. package/.gitignore +0 -37
  11. package/CHANGELOG.md +0 -34
  12. package/README.md +0 -26
  13. package/dist/github/branch/create-branch.d.ts +0 -11
  14. package/dist/github/branch/create-branch.js +0 -27
  15. package/dist/github/branch/create-branch.js.map +0 -1
  16. package/dist/github/branch/index.d.ts +0 -2
  17. package/dist/github/branch/index.js +0 -12
  18. package/dist/github/branch/index.js.map +0 -1
  19. package/dist/github/branch/update-branch.d.ts +0 -11
  20. package/dist/github/branch/update-branch.js +0 -26
  21. package/dist/github/branch/update-branch.js.map +0 -1
  22. package/dist/github/commit/create-git-blob.d.ts +0 -26
  23. package/dist/github/commit/create-git-blob.js +0 -42
  24. package/dist/github/commit/create-git-blob.js.map +0 -1
  25. package/dist/github/commit/create-git-commit.d.ts +0 -23
  26. package/dist/github/commit/create-git-commit.js +0 -39
  27. package/dist/github/commit/create-git-commit.js.map +0 -1
  28. package/dist/github/commit/create-git-tree.d.ts +0 -29
  29. package/dist/github/commit/create-git-tree.js +0 -47
  30. package/dist/github/commit/create-git-tree.js.map +0 -1
  31. package/dist/github/commit/get-sha-last-commit-of-branch.d.ts +0 -21
  32. package/dist/github/commit/get-sha-last-commit-of-branch.js +0 -35
  33. package/dist/github/commit/get-sha-last-commit-of-branch.js.map +0 -1
  34. package/dist/github/commit/get-tree-by-commit-sha.d.ts +0 -23
  35. package/dist/github/commit/get-tree-by-commit-sha.js +0 -37
  36. package/dist/github/commit/get-tree-by-commit-sha.js.map +0 -1
  37. package/dist/github/commit/index.d.ts +0 -6
  38. package/dist/github/commit/index.js +0 -20
  39. package/dist/github/commit/run-new-commit-process.d.ts +0 -27
  40. package/dist/github/commit/run-new-commit-process.js +0 -49
  41. package/dist/github/commit/run-new-commit-process.js.map +0 -1
  42. package/dist/github/commit/utils.d.ts +0 -1
  43. package/dist/github/commit/utils.js +0 -29
  44. package/dist/github/commit/utils.js.map +0 -1
  45. package/dist/github/content/get-file-content.d.ts +0 -20
  46. package/dist/github/content/get-file-content.js +0 -38
  47. package/dist/github/content/get-file-content.js.map +0 -1
  48. package/dist/github/github.d.ts +0 -25
  49. package/dist/github/github.js +0 -65
  50. package/dist/github/github.js.map +0 -1
  51. package/dist/github/index.d.ts +0 -1
  52. package/dist/github/index.js +0 -10
  53. package/dist/github/merge/create-pull-request.d.ts +0 -14
  54. package/dist/github/merge/create-pull-request.js +0 -30
  55. package/dist/github/merge/create-pull-request.js.map +0 -1
  56. package/dist/github/merge/index.d.ts +0 -2
  57. package/dist/github/merge/index.js +0 -12
  58. package/dist/github/merge/index.js.map +0 -1
  59. package/dist/github/merge/merge-pull-request.d.ts +0 -13
  60. package/dist/github/merge/merge-pull-request.js +0 -28
  61. package/dist/github/merge/merge-pull-request.js.map +0 -1
  62. package/dist/index.d.ts +0 -15
  63. package/dist/package.json +0 -65
  64. package/dist/string/index.js.map +0 -1
  65. package/dist/time/index.js.map +0 -1
  66. package/global.d.ts +0 -2
  67. package/rollup.config.ts +0 -15
  68. package/src/array/__tests__/array-to-map.test.ts +0 -50
  69. package/src/array/__tests__/get-values-from-keys.test.ts +0 -14
  70. package/src/array/array-to-map.ts +0 -32
  71. package/src/array/get-values-from-keys.ts +0 -3
  72. package/src/array/index.ts +0 -2
  73. package/src/cdn/__tests__/cdn.factory.test.ts +0 -120
  74. package/src/cdn/__tests__/utils.test.ts +0 -456
  75. package/src/cdn/cdn.factory.ts +0 -63
  76. package/src/cdn/index.ts +0 -2
  77. package/src/cdn/types/cdn-factory.type.ts +0 -35
  78. package/src/cdn/types/index.ts +0 -1
  79. package/src/cdn/utils/extract-info-from-url.util.ts +0 -21
  80. package/src/cdn/utils/get-cdn-from-s3-url.util.ts +0 -20
  81. package/src/cdn/utils/get-cdn-url.util.ts +0 -26
  82. package/src/formatting/__tests__/format-number.test.ts +0 -11
  83. package/src/formatting/format-number.ts +0 -14
  84. package/src/formatting/index.ts +0 -1
  85. package/src/fp/__tests__/run-while.test.ts +0 -29
  86. package/src/fp/index.ts +0 -1
  87. package/src/fp/run-while.ts +0 -54
  88. package/src/github/branch/create-branch.ts +0 -36
  89. package/src/github/branch/index.ts +0 -2
  90. package/src/github/branch/update-branch.ts +0 -35
  91. package/src/github/commit/create-git-blob.ts +0 -57
  92. package/src/github/commit/create-git-commit.ts +0 -57
  93. package/src/github/commit/create-git-tree.ts +0 -68
  94. package/src/github/commit/get-sha-last-commit-of-branch.ts +0 -50
  95. package/src/github/commit/get-tree-by-commit-sha.ts +0 -52
  96. package/src/github/commit/index.ts +0 -6
  97. package/src/github/commit/run-new-commit-process.ts +0 -88
  98. package/src/github/commit/utils.ts +0 -31
  99. package/src/github/content/get-file-content.ts +0 -50
  100. package/src/github/github.ts +0 -93
  101. package/src/github/index.ts +0 -1
  102. package/src/github/merge/create-pull-request.ts +0 -42
  103. package/src/github/merge/index.ts +0 -2
  104. package/src/github/merge/merge-pull-request.ts +0 -39
  105. package/src/http/__tests__/encode-search-object.test.ts +0 -34
  106. package/src/http/__tests__/fetch-with-timeout.test.ts +0 -50
  107. package/src/http/encode-search-object.ts +0 -39
  108. package/src/http/fetch-with-timeout.ts +0 -24
  109. package/src/http/index.ts +0 -2
  110. package/src/linked-list/__tests__/apply-diff-linked-list.test.ts +0 -103
  111. package/src/linked-list/__tests__/create-linked-list.test.ts +0 -204
  112. package/src/linked-list/__tests__/find-linked-list.test.ts +0 -40
  113. package/src/linked-list/__tests__/get-linked-list.test.ts +0 -28
  114. package/src/linked-list/__tests__/insert-linked-list.test.ts +0 -186
  115. package/src/linked-list/__tests__/linked-list-utils.test.ts +0 -252
  116. package/src/linked-list/__tests__/reduce-linked-list.test.ts +0 -31
  117. package/src/linked-list/__tests__/remove-linked-list.test.ts +0 -129
  118. package/src/linked-list/__tests__/update-linked-list.test.ts +0 -53
  119. package/src/linked-list/__tests__/while-linked-list.test.ts +0 -58
  120. package/src/linked-list/apply-diff-linked-list.ts +0 -35
  121. package/src/linked-list/create-linked-list.ts +0 -79
  122. package/src/linked-list/find-linked-list.ts +0 -26
  123. package/src/linked-list/get-linked-list.ts +0 -9
  124. package/src/linked-list/index.ts +0 -2
  125. package/src/linked-list/insert-linked-list.ts +0 -50
  126. package/src/linked-list/linked-list-utils.ts +0 -143
  127. package/src/linked-list/reduce-linked-list.ts +0 -18
  128. package/src/linked-list/remove-linked-list.ts +0 -36
  129. package/src/linked-list/type.ts +0 -38
  130. package/src/linked-list/update-linked-list.ts +0 -29
  131. package/src/linked-list/while-linked-list.ts +0 -33
  132. package/src/math/__tests__/clamp-number.test.ts +0 -30
  133. package/src/math/__tests__/interpolate.test.ts +0 -28
  134. package/src/math/__tests__/number-range.test.ts +0 -59
  135. package/src/math/__tests__/random-number.test.ts +0 -11
  136. package/src/math/clamp-number.ts +0 -8
  137. package/src/math/index.ts +0 -4
  138. package/src/math/interpolate.ts +0 -18
  139. package/src/math/number-range.ts +0 -16
  140. package/src/math/random-number.ts +0 -10
  141. package/src/object/__tests__/merge-deep.test.ts +0 -56
  142. package/src/object/index.ts +0 -1
  143. package/src/object/merge-deep.ts +0 -27
  144. package/src/parsing/__tests__/parse-boolean.test.ts +0 -15
  145. package/src/parsing/__tests__/parse-enum.test.ts +0 -19
  146. package/src/parsing/__tests__/parse-number.test.ts +0 -20
  147. package/src/parsing/index.ts +0 -3
  148. package/src/parsing/parse-boolean.ts +0 -10
  149. package/src/parsing/parse-enum.ts +0 -16
  150. package/src/parsing/parse-number.ts +0 -12
  151. package/src/predicates/__tests__/is-function.test.ts +0 -11
  152. package/src/predicates/__tests__/is-null.test.ts +0 -11
  153. package/src/predicates/__tests__/is-object.test.ts +0 -11
  154. package/src/predicates/__tests__/is-primitive.test.ts +0 -42
  155. package/src/predicates/__tests__/is-undefined.test.ts +0 -11
  156. package/src/predicates/__tests__/is-uuid.test.ts +0 -13
  157. package/src/predicates/index.ts +0 -5
  158. package/src/predicates/is-function.ts +0 -3
  159. package/src/predicates/is-null.ts +0 -3
  160. package/src/predicates/is-object.ts +0 -3
  161. package/src/predicates/is-primitive.ts +0 -19
  162. package/src/predicates/is-undefined.ts +0 -3
  163. package/src/predicates/is-uuid.ts +0 -3
  164. package/src/promise/__tests__/delay.test.ts +0 -13
  165. package/src/promise/__tests__/execute-or-resolve-default.test.ts +0 -25
  166. package/src/promise/__tests__/execute-with-delay.test.ts +0 -24
  167. package/src/promise/delay.ts +0 -3
  168. package/src/promise/execute-or-resolve-default.ts +0 -14
  169. package/src/promise/execute-with-delay.ts +0 -6
  170. package/src/promise/index.ts +0 -3
  171. package/src/string/__tests__/replace-in-template.test.ts +0 -52
  172. package/src/string/index.ts +0 -1
  173. package/src/string/replace-in-template.ts +0 -45
  174. package/src/time/__tests__/convert.test.ts +0 -14
  175. package/src/time/__tests__/format-minutes.test.ts +0 -10
  176. package/src/time/__tests__/get-time-diff-as-string.test.ts +0 -128
  177. package/src/time/constants.ts +0 -4
  178. package/src/time/convert.ts +0 -5
  179. package/src/time/format-minutes.ts +0 -9
  180. package/src/time/get-time-diff-as-string.ts +0 -196
  181. package/src/time/index.ts +0 -4
  182. package/src/types/function.ts +0 -1
  183. package/src/types/general.ts +0 -8
  184. package/src/types/index.ts +0 -4
  185. package/src/types/object.ts +0 -33
  186. package/src/types/search.ts +0 -29
  187. package/tsconfig.eslint.json +0 -8
  188. package/tsconfig.json +0 -25
  189. /package/{dist/_virtual → _virtual}/_tslib.js +0 -0
  190. /package/{dist/_virtual → _virtual}/_tslib.js.map +0 -0
  191. /package/{dist/array → array}/array-to-map.d.ts +0 -0
  192. /package/{dist/array → array}/array-to-map.js +0 -0
  193. /package/{dist/array → array}/array-to-map.js.map +0 -0
  194. /package/{dist/array → array}/get-values-from-keys.d.ts +0 -0
  195. /package/{dist/array → array}/get-values-from-keys.js +0 -0
  196. /package/{dist/array → array}/get-values-from-keys.js.map +0 -0
  197. /package/{dist/array → array}/index.d.ts +0 -0
  198. /package/{dist/array → array}/index.js +0 -0
  199. /package/{dist/array → array}/index.js.map +0 -0
  200. /package/{dist/cdn → cdn}/cdn.factory.d.ts +0 -0
  201. /package/{dist/cdn → cdn}/cdn.factory.js +0 -0
  202. /package/{dist/cdn → cdn}/cdn.factory.js.map +0 -0
  203. /package/{dist/cdn → cdn}/index.d.ts +0 -0
  204. /package/{dist/cdn → cdn}/index.js +0 -0
  205. /package/{dist/cdn → cdn}/index.js.map +0 -0
  206. /package/{dist/cdn → cdn}/types/cdn-factory.type.d.ts +0 -0
  207. /package/{dist/cdn → cdn}/types/index.d.ts +0 -0
  208. /package/{dist/cdn → cdn}/types/index.js +0 -0
  209. /package/{dist/cdn → cdn}/types/index.js.map +0 -0
  210. /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.d.ts +0 -0
  211. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.d.ts +0 -0
  212. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js +0 -0
  213. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js.map +0 -0
  214. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.d.ts +0 -0
  215. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js +0 -0
  216. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js.map +0 -0
  217. /package/{dist/formatting → formatting}/format-number.d.ts +0 -0
  218. /package/{dist/formatting → formatting}/format-number.js +0 -0
  219. /package/{dist/formatting → formatting}/format-number.js.map +0 -0
  220. /package/{dist/formatting → formatting}/index.d.ts +0 -0
  221. /package/{dist/formatting → formatting}/index.js +0 -0
  222. /package/{dist/formatting → formatting}/index.js.map +0 -0
  223. /package/{dist/fp → fp}/index.d.ts +0 -0
  224. /package/{dist/fp → fp}/index.js +0 -0
  225. /package/{dist/fp → fp}/index.js.map +0 -0
  226. /package/{dist/fp → fp}/run-while.d.ts +0 -0
  227. /package/{dist/fp → fp}/run-while.js +0 -0
  228. /package/{dist/fp → fp}/run-while.js.map +0 -0
  229. /package/{dist/http → http}/encode-search-object.d.ts +0 -0
  230. /package/{dist/http → http}/encode-search-object.js +0 -0
  231. /package/{dist/http → http}/encode-search-object.js.map +0 -0
  232. /package/{dist/http → http}/fetch-with-timeout.d.ts +0 -0
  233. /package/{dist/http → http}/fetch-with-timeout.js +0 -0
  234. /package/{dist/http → http}/fetch-with-timeout.js.map +0 -0
  235. /package/{dist/http → http}/index.d.ts +0 -0
  236. /package/{dist/http → http}/index.js +0 -0
  237. /package/{dist/http → http}/index.js.map +0 -0
  238. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.d.ts +0 -0
  239. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js +0 -0
  240. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js.map +0 -0
  241. /package/{dist/linked-list → linked-list}/create-linked-list.d.ts +0 -0
  242. /package/{dist/linked-list → linked-list}/create-linked-list.js +0 -0
  243. /package/{dist/linked-list → linked-list}/create-linked-list.js.map +0 -0
  244. /package/{dist/linked-list → linked-list}/find-linked-list.d.ts +0 -0
  245. /package/{dist/linked-list → linked-list}/find-linked-list.js +0 -0
  246. /package/{dist/linked-list → linked-list}/find-linked-list.js.map +0 -0
  247. /package/{dist/linked-list → linked-list}/get-linked-list.d.ts +0 -0
  248. /package/{dist/linked-list → linked-list}/get-linked-list.js +0 -0
  249. /package/{dist/linked-list → linked-list}/get-linked-list.js.map +0 -0
  250. /package/{dist/linked-list → linked-list}/index.d.ts +0 -0
  251. /package/{dist/linked-list → linked-list}/index.js +0 -0
  252. /package/{dist/github → linked-list}/index.js.map +0 -0
  253. /package/{dist/linked-list → linked-list}/insert-linked-list.d.ts +0 -0
  254. /package/{dist/linked-list → linked-list}/insert-linked-list.js +0 -0
  255. /package/{dist/linked-list → linked-list}/insert-linked-list.js.map +0 -0
  256. /package/{dist/linked-list → linked-list}/linked-list-utils.d.ts +0 -0
  257. /package/{dist/linked-list → linked-list}/linked-list-utils.js +0 -0
  258. /package/{dist/linked-list → linked-list}/linked-list-utils.js.map +0 -0
  259. /package/{dist/linked-list → linked-list}/reduce-linked-list.d.ts +0 -0
  260. /package/{dist/linked-list → linked-list}/reduce-linked-list.js +0 -0
  261. /package/{dist/linked-list → linked-list}/reduce-linked-list.js.map +0 -0
  262. /package/{dist/linked-list → linked-list}/remove-linked-list.d.ts +0 -0
  263. /package/{dist/linked-list → linked-list}/remove-linked-list.js +0 -0
  264. /package/{dist/linked-list → linked-list}/remove-linked-list.js.map +0 -0
  265. /package/{dist/linked-list → linked-list}/type.d.ts +0 -0
  266. /package/{dist/linked-list → linked-list}/update-linked-list.d.ts +0 -0
  267. /package/{dist/linked-list → linked-list}/update-linked-list.js +0 -0
  268. /package/{dist/linked-list → linked-list}/update-linked-list.js.map +0 -0
  269. /package/{dist/linked-list → linked-list}/while-linked-list.d.ts +0 -0
  270. /package/{dist/linked-list → linked-list}/while-linked-list.js +0 -0
  271. /package/{dist/linked-list → linked-list}/while-linked-list.js.map +0 -0
  272. /package/{dist/math → math}/clamp-number.d.ts +0 -0
  273. /package/{dist/math → math}/clamp-number.js +0 -0
  274. /package/{dist/math → math}/clamp-number.js.map +0 -0
  275. /package/{dist/math → math}/index.d.ts +0 -0
  276. /package/{dist/math → math}/index.js +0 -0
  277. /package/{dist/math → math}/index.js.map +0 -0
  278. /package/{dist/math → math}/interpolate.d.ts +0 -0
  279. /package/{dist/math → math}/interpolate.js +0 -0
  280. /package/{dist/math → math}/interpolate.js.map +0 -0
  281. /package/{dist/math → math}/number-range.d.ts +0 -0
  282. /package/{dist/math → math}/number-range.js +0 -0
  283. /package/{dist/math → math}/number-range.js.map +0 -0
  284. /package/{dist/math → math}/random-number.d.ts +0 -0
  285. /package/{dist/math → math}/random-number.js +0 -0
  286. /package/{dist/math → math}/random-number.js.map +0 -0
  287. /package/{dist/object → object}/index.d.ts +0 -0
  288. /package/{dist/object → object}/index.js +0 -0
  289. /package/{dist/linked-list → object}/index.js.map +0 -0
  290. /package/{dist/object → object}/merge-deep.d.ts +0 -0
  291. /package/{dist/object → object}/merge-deep.js +0 -0
  292. /package/{dist/object → object}/merge-deep.js.map +0 -0
  293. /package/{dist/parsing → parsing}/index.d.ts +0 -0
  294. /package/{dist/parsing → parsing}/index.js +0 -0
  295. /package/{dist/parsing → parsing}/index.js.map +0 -0
  296. /package/{dist/parsing → parsing}/parse-boolean.d.ts +0 -0
  297. /package/{dist/parsing → parsing}/parse-boolean.js +0 -0
  298. /package/{dist/parsing → parsing}/parse-boolean.js.map +0 -0
  299. /package/{dist/parsing → parsing}/parse-enum.d.ts +0 -0
  300. /package/{dist/parsing → parsing}/parse-enum.js +0 -0
  301. /package/{dist/parsing → parsing}/parse-enum.js.map +0 -0
  302. /package/{dist/parsing → parsing}/parse-number.d.ts +0 -0
  303. /package/{dist/parsing → parsing}/parse-number.js +0 -0
  304. /package/{dist/parsing → parsing}/parse-number.js.map +0 -0
  305. /package/{dist/predicates → predicates}/index.d.ts +0 -0
  306. /package/{dist/predicates → predicates}/index.js +0 -0
  307. /package/{dist/predicates → predicates}/index.js.map +0 -0
  308. /package/{dist/predicates → predicates}/is-function.d.ts +0 -0
  309. /package/{dist/predicates → predicates}/is-function.js +0 -0
  310. /package/{dist/predicates → predicates}/is-function.js.map +0 -0
  311. /package/{dist/predicates → predicates}/is-null.d.ts +0 -0
  312. /package/{dist/predicates → predicates}/is-null.js +0 -0
  313. /package/{dist/predicates → predicates}/is-null.js.map +0 -0
  314. /package/{dist/predicates → predicates}/is-object.d.ts +0 -0
  315. /package/{dist/predicates → predicates}/is-object.js +0 -0
  316. /package/{dist/predicates → predicates}/is-object.js.map +0 -0
  317. /package/{dist/predicates → predicates}/is-primitive.d.ts +0 -0
  318. /package/{dist/predicates → predicates}/is-primitive.js +0 -0
  319. /package/{dist/predicates → predicates}/is-primitive.js.map +0 -0
  320. /package/{dist/predicates → predicates}/is-undefined.d.ts +0 -0
  321. /package/{dist/predicates → predicates}/is-undefined.js +0 -0
  322. /package/{dist/predicates → predicates}/is-undefined.js.map +0 -0
  323. /package/{dist/predicates → predicates}/is-uuid.d.ts +0 -0
  324. /package/{dist/promise → promise}/delay.d.ts +0 -0
  325. /package/{dist/promise → promise}/delay.js +0 -0
  326. /package/{dist/promise → promise}/delay.js.map +0 -0
  327. /package/{dist/promise → promise}/execute-or-resolve-default.d.ts +0 -0
  328. /package/{dist/promise → promise}/execute-or-resolve-default.js +0 -0
  329. /package/{dist/promise → promise}/execute-or-resolve-default.js.map +0 -0
  330. /package/{dist/promise → promise}/execute-with-delay.d.ts +0 -0
  331. /package/{dist/promise → promise}/execute-with-delay.js +0 -0
  332. /package/{dist/promise → promise}/execute-with-delay.js.map +0 -0
  333. /package/{dist/promise → promise}/index.d.ts +0 -0
  334. /package/{dist/promise → promise}/index.js +0 -0
  335. /package/{dist/promise → promise}/index.js.map +0 -0
  336. /package/{dist/string → string}/index.d.ts +0 -0
  337. /package/{dist/string → string}/index.js +0 -0
  338. /package/{dist/object → string}/index.js.map +0 -0
  339. /package/{dist/string → string}/replace-in-template.d.ts +0 -0
  340. /package/{dist/string → string}/replace-in-template.js +0 -0
  341. /package/{dist/string → string}/replace-in-template.js.map +0 -0
  342. /package/{dist/time → time}/constants.d.ts +0 -0
  343. /package/{dist/time → time}/constants.js +0 -0
  344. /package/{dist/time → time}/constants.js.map +0 -0
  345. /package/{dist/time → time}/convert.d.ts +0 -0
  346. /package/{dist/time → time}/convert.js +0 -0
  347. /package/{dist/time → time}/convert.js.map +0 -0
  348. /package/{dist/time → time}/format-minutes.d.ts +0 -0
  349. /package/{dist/time → time}/format-minutes.js +0 -0
  350. /package/{dist/time → time}/format-minutes.js.map +0 -0
  351. /package/{dist/time → time}/get-time-diff-as-string.d.ts +0 -0
  352. /package/{dist/time → time}/get-time-diff-as-string.js +0 -0
  353. /package/{dist/time → time}/get-time-diff-as-string.js.map +0 -0
  354. /package/{dist/time → time}/index.d.ts +0 -0
  355. /package/{dist/time → time}/index.js +0 -0
  356. /package/{dist/github/commit → time}/index.js.map +0 -0
  357. /package/{dist/types → types}/function.d.ts +0 -0
  358. /package/{dist/types → types}/general.d.ts +0 -0
  359. /package/{dist/types → types}/index.d.ts +0 -0
  360. /package/{dist/types → types}/index.js +0 -0
  361. /package/{dist/types → types}/index.js.map +0 -0
  362. /package/{dist/types → types}/object.d.ts +0 -0
  363. /package/{dist/types → types}/search.d.ts +0 -0
@@ -1,42 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from '../commit/utils';
5
-
6
- export type CreatePullRequestArgs = {
7
- title: string;
8
- body: string;
9
- head: string;
10
- base: string;
11
- };
12
-
13
- export type CreatePullRequestResponse = {
14
- url: string;
15
- number: number;
16
- };
17
-
18
- const createPullRequestResponseSchema = z.object({
19
- url: z.string(),
20
- number: z.number(),
21
- });
22
-
23
- export type CreatePullRequest = (args: CreatePullRequestArgs) => Promise<CreatePullRequestResponse>;
24
-
25
- export type CreatePullRequestFactory = (instance: AxiosInstance) => CreatePullRequest;
26
-
27
- export const createPullRequestFactory: CreatePullRequestFactory = (instance) => async (args) => {
28
- const { title, body, head, base } = args;
29
-
30
- try {
31
- const { data } = await instance.post<CreatePullRequestResponse>('/pulls', {
32
- title,
33
- body,
34
- head,
35
- base,
36
- });
37
-
38
- return createPullRequestResponseSchema.parse(data);
39
- } catch (error) {
40
- throw handleError(error);
41
- }
42
- };
@@ -1,2 +0,0 @@
1
- export * from './create-pull-request';
2
- export * from './merge-pull-request';
@@ -1,39 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from '../commit/utils';
5
-
6
- export type MergePullRequestArgs = {
7
- pullRequestNumber: number;
8
- commitTitle: string;
9
- commitMessage: string;
10
- mergeMethod: 'merge' | 'squash' | 'rebase';
11
- };
12
-
13
- export type MergePullRequestResponse = {
14
- sha: string;
15
- };
16
-
17
- const mergePullRequestResponseSchema = z.object({
18
- sha: z.string(),
19
- });
20
-
21
- export type MergePullRequest = (args: MergePullRequestArgs) => Promise<MergePullRequestResponse>;
22
-
23
- export type MergePullRequestFactory = (instance: AxiosInstance) => MergePullRequest;
24
-
25
- export const mergePullRequestFactory: MergePullRequestFactory = (instance) => async (args) => {
26
- const { pullRequestNumber, commitTitle, commitMessage, mergeMethod } = args;
27
-
28
- try {
29
- const { data } = await instance.put<MergePullRequestResponse>(`/pulls/${pullRequestNumber}/merge`, {
30
- commit_title: commitTitle,
31
- commit_message: commitMessage,
32
- merge_method: mergeMethod,
33
- });
34
-
35
- return mergePullRequestResponseSchema.parse(data);
36
- } catch (error) {
37
- throw handleError(error);
38
- }
39
- };
@@ -1,34 +0,0 @@
1
- import { encodeSearchObject } from '../encode-search-object';
2
-
3
- describe('encodeSearchObject', () => {
4
- it('should not encode sort and query if undefined', () => {
5
- const url = encodeSearchObject({
6
- limit: 10,
7
- offset: 15,
8
- });
9
-
10
- expect(url).toStrictEqual('offset=15&limit=10');
11
- });
12
-
13
- it('should encode sort and query twice', () => {
14
- const url = encodeSearchObject({
15
- limit: 10,
16
- offset: 0,
17
- sort: {
18
- name: 'asc',
19
- editionDate: 'desc',
20
- },
21
- query: {
22
- name: 'The name of something',
23
- status: 'published',
24
- },
25
- });
26
-
27
- expect(url).toStrictEqual([
28
- 'offset=0',
29
- 'limit=10',
30
- 'sort=name%3Aasc%2BeditionDate%3Adesc',
31
- 'query=name%3AThe%2520name%2520of%2520something%2Bstatus%3Apublished',
32
- ].join('&'));
33
- });
34
- });
@@ -1,50 +0,0 @@
1
- /* eslint-disable import/first -- https://github.com/jefflau/jest-fetch-mock#to-setup-for-an-individual-test */
2
-
3
- import fetchMock, { enableFetchMocks } from 'jest-fetch-mock';
4
-
5
- // must appear before any other imports
6
- enableFetchMocks();
7
-
8
- import { fetchWithTimeout } from '../fetch-with-timeout';
9
-
10
- describe('fetchWithTimeout', () => {
11
- beforeEach(() => {
12
- fetchMock.resetMocks();
13
- });
14
-
15
- it('should call fetch with the same parameters', async () => {
16
- const url = 'http://some/url';
17
- const init = {
18
- headers: {
19
- some: 'header',
20
- },
21
- };
22
-
23
- fetchMock.mockResponseOnce('mock response');
24
- const response = await fetchWithTimeout(url, init);
25
-
26
- expect(fetch as any).toHaveBeenNthCalledWith(1, url, expect.objectContaining(init));
27
- expect(await response.text()).toBe('mock response');
28
- });
29
-
30
- it('should abort the request if timeout has elapsed', async () => {
31
- jest.useFakeTimers();
32
- const TIMEOUT = 3000;
33
- const REQUEST_TIMEOUT = TIMEOUT * 2;
34
-
35
- // This request will take too long
36
- fetchMock.mockResponseOnce(async () => {
37
- jest.advanceTimersByTime(REQUEST_TIMEOUT);
38
- return 'mock response';
39
- });
40
-
41
- // https://github.com/jefflau/jest-fetch-mock/issues/159
42
- (global as any).DOMException = Error;
43
-
44
- const responsePromise = fetchWithTimeout('http://some/url', { timeout: TIMEOUT });
45
-
46
- jest.advanceTimersByTime(TIMEOUT + 100);
47
-
48
- await expect(responsePromise).rejects.toThrow('The operation was aborted. ');
49
- });
50
- });
@@ -1,39 +0,0 @@
1
- import { SearchObject } from '../types';
2
-
3
- export type EncodingConfig = {
4
- keyValueDelimiter: string,
5
- pairDelimiter: string,
6
- };
7
-
8
- const defaultEncodingConfig: EncodingConfig = {
9
- keyValueDelimiter: ':',
10
- pairDelimiter: '+',
11
- };
12
-
13
- export const encodeSearchValue = <T extends Record<string, string>>(
14
- searchValue: T,
15
- config: EncodingConfig = defaultEncodingConfig,
16
- ) => {
17
- const { pairDelimiter, keyValueDelimiter } = config;
18
-
19
- return Object.entries(searchValue)
20
- .map(([key, value]) => `${key}${keyValueDelimiter}${encodeURI(value)}`)
21
- .join(pairDelimiter);
22
- };
23
-
24
- export const encodeSearchObject = (searchObject: SearchObject): string => {
25
- const { sort, query, offset, limit } = searchObject;
26
-
27
- const sortEncoded = sort ? encodeSearchValue(sort) : null;
28
- const queryEncoded = query ? encodeSearchValue(query) : null;
29
-
30
- const urlParams = new URLSearchParams({
31
- offset: offset.toString(),
32
- limit: limit.toString(),
33
- });
34
-
35
- if (sortEncoded) urlParams.append('sort', sortEncoded);
36
- if (queryEncoded) urlParams.append('query', queryEncoded);
37
-
38
- return urlParams.toString();
39
- };
@@ -1,24 +0,0 @@
1
- export type RequestInitWithTimeout = RequestInit & {
2
- timeout?: number
3
- };
4
-
5
- /**
6
- * Use fetch to perform an HTTP request
7
- * Add an optional timeout, that will abort the request if it has not returned before
8
- */
9
- export const fetchWithTimeout = (input: RequestInfo, init?: Omit<RequestInitWithTimeout, 'signal'> | undefined): Promise<Response> => {
10
- const abortController = new AbortController();
11
-
12
- const { timeout, ...rest } = init || {};
13
-
14
- const params = {
15
- ...rest,
16
- signal: abortController.signal,
17
- };
18
-
19
- if (timeout !== undefined) {
20
- setTimeout(() => abortController.abort(), timeout);
21
- }
22
-
23
- return fetch(input, params);
24
- };
package/src/http/index.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './encode-search-object';
2
- export * from './fetch-with-timeout';
@@ -1,103 +0,0 @@
1
- import { createLinkedList } from '../create-linked-list';
2
- import { applyDiffLinkedList } from '../apply-diff-linked-list';
3
-
4
- describe('applyDiffLinkedList', () => {
5
- const items = {
6
- 1: { id: '1', nextId: '2', previousId: null, value: 1 },
7
- 2: { id: '2', nextId: '3', previousId: '1', value: 2 },
8
- 3: { id: '3', nextId: '4', previousId: '2', value: 3 },
9
- 4: { id: '4', nextId: null, previousId: '3', value: 4 },
10
- };
11
-
12
- const linkedList = createLinkedList('1', items);
13
-
14
- it('should handle a delete', () => {
15
- const newList = applyDiffLinkedList(items['2'], null, linkedList);
16
-
17
- expect(newList.items).toStrictEqual({
18
- 1: { id: '1', nextId: '3', previousId: null, value: 1 },
19
- 3: { id: '3', nextId: '4', previousId: '1', value: 3 },
20
- 4: { id: '4', nextId: null, previousId: '3', value: 4 },
21
- });
22
- expect(newList.head).toStrictEqual(newList.items['1']);
23
- });
24
-
25
- it('should handle an insert', () => {
26
- const insertedItem = { id: '5', nextId: null, previousId: '4', value: 5 };
27
- const newList = applyDiffLinkedList(null, insertedItem, linkedList);
28
-
29
- expect(newList.items).toStrictEqual({
30
- 1: { id: '1', nextId: '2', previousId: null, value: 1 },
31
- 2: { id: '2', nextId: '3', previousId: '1', value: 2 },
32
- 3: { id: '3', nextId: '4', previousId: '2', value: 3 },
33
- 4: { id: '4', nextId: '5', previousId: '3', value: 4 },
34
- 5: { id: '5', nextId: null, previousId: '4', value: 5 },
35
- });
36
- expect(newList.head).toStrictEqual(newList.items['1']);
37
- });
38
-
39
- it('should throw an error if the two items are null', () => {
40
- expect(() => applyDiffLinkedList(null, null, linkedList)).toThrowError(
41
- 'Cannot have both before & after as null',
42
- );
43
- });
44
-
45
- it('should throw an error if it tries to change the id', () => {
46
- const before = linkedList.items['2'];
47
- const after = { ...before, id: '6' };
48
-
49
- expect(() => applyDiffLinkedList(before, after, linkedList)).toThrowError(
50
- 'Cannot change id of a ListNode',
51
- );
52
- });
53
-
54
- it('should update a node if it has the same nextId', () => {
55
- const before = linkedList.items['2'];
56
- const after = { ...before, value: 22 };
57
-
58
- const newList = applyDiffLinkedList(before, after, linkedList);
59
-
60
- expect(newList.items).toStrictEqual({
61
- 1: { id: '1', nextId: '2', previousId: null, value: 1 },
62
- 2: { id: '2', nextId: '3', previousId: '1', value: 22 },
63
- 3: { id: '3', nextId: '4', previousId: '2', value: 3 },
64
- 4: { id: '4', nextId: null, previousId: '3', value: 4 },
65
- });
66
- expect(newList.head).toStrictEqual(newList.items['1']);
67
- });
68
-
69
- it('should update a node if it has the same nextId', () => {
70
- const before = linkedList.items['2'];
71
- const after = { ...before, value: 22 };
72
-
73
- const newList = applyDiffLinkedList(before, after, linkedList);
74
-
75
- expect(newList.items).toStrictEqual({
76
- 1: { id: '1', nextId: '2', previousId: null, value: 1 },
77
- 2: { id: '2', nextId: '3', previousId: '1', value: 22 },
78
- 3: { id: '3', nextId: '4', previousId: '2', value: 3 },
79
- 4: { id: '4', nextId: null, previousId: '3', value: 4 },
80
- });
81
- expect(newList.head).toStrictEqual(newList.items['1']);
82
- });
83
-
84
- it('should handle a reorder and an update', () => {
85
- const before = linkedList.items['2'];
86
- const after = {
87
- ...before,
88
- value: 22,
89
- nextId: '4',
90
- previousId: '3',
91
- };
92
-
93
- const newList = applyDiffLinkedList(before, after, linkedList);
94
-
95
- expect(newList.items).toStrictEqual({
96
- 1: { id: '1', nextId: '3', previousId: null, value: 1 },
97
- 3: { id: '3', nextId: '2', previousId: '1', value: 3 },
98
- 2: { id: '2', nextId: '4', previousId: '3', value: 22 },
99
- 4: { id: '4', nextId: null, previousId: '2', value: 4 },
100
- });
101
- expect(newList.head).toStrictEqual(newList.items['1']);
102
- });
103
- });
@@ -1,204 +0,0 @@
1
- import { createLinkedList } from '../create-linked-list';
2
-
3
- import { reduceLinkedList } from '../reduce-linked-list';
4
- import { findLinkedList } from '../find-linked-list';
5
- import { whileLinkedList } from '../while-linked-list';
6
- import { removeLinkedList } from '../remove-linked-list';
7
- import { insertLinkedList } from '../insert-linked-list';
8
- import { getLinkedList } from '../get-linked-list';
9
- import { updateLinkedList } from '../update-linked-list';
10
- import { applyDiffLinkedList } from '../apply-diff-linked-list';
11
-
12
- jest.mock('../reduce-linked-list');
13
- jest.mock('../find-linked-list');
14
- jest.mock('../while-linked-list');
15
- jest.mock('../remove-linked-list');
16
- jest.mock('../insert-linked-list');
17
- jest.mock('../get-linked-list');
18
- jest.mock('../update-linked-list');
19
- jest.mock('../apply-diff-linked-list');
20
-
21
- describe('createLinkedList', () => {
22
- it('should create an empty list', () => {
23
- const linkedList = createLinkedList(null, {});
24
-
25
- expect(linkedList.head).toBeNull();
26
- expect(linkedList.items).toStrictEqual({});
27
- expect(linkedList.format).toBeNull();
28
- });
29
-
30
- it('should have the right head', () => {
31
- const node = { title: 'Micro knowledge', id: '2', nextId: null };
32
- const map = { 2: node };
33
-
34
- const linkedList = createLinkedList('2', map);
35
-
36
- expect(linkedList.head).toStrictEqual(node);
37
- });
38
-
39
- it('should set format to single', () => {
40
- const map = {
41
- 1: { id: '1', nextId: '2' },
42
- 2: { id: '2', nextId: null },
43
- };
44
-
45
- const linkedList = createLinkedList('1', map);
46
-
47
- expect(linkedList.format).toStrictEqual('single');
48
- });
49
-
50
- it('should set format to double', () => {
51
- const map = {
52
- 1: { id: '1', nextId: '2', previousId: null },
53
- 2: { id: '2', nextId: null, previousId: '1' },
54
- };
55
-
56
- const linkedList = createLinkedList('1', map);
57
-
58
- expect(linkedList.format).toStrictEqual('double');
59
- });
60
-
61
- it('should throw an error if some nodes are double linkedand some are single linked', () => {
62
- const map = {
63
- 1: { id: '1', nextId: '2', previousId: null },
64
- 2: { id: '2', nextId: null },
65
- };
66
-
67
- expect(() => createLinkedList('1', map)).toThrowError(
68
- 'Invalid previous node in the linked list',
69
- );
70
- });
71
-
72
- it('should throw an error if some nodes have invalid previous', () => {
73
- const map = {
74
- 1: { id: '1', nextId: '2', previousId: null },
75
- 2: { id: '2', nextId: '3', previousId: '1' },
76
- 3: { id: '3', nextId: null, previousId: '1' },
77
- };
78
-
79
- expect(() => createLinkedList('1', map)).toThrowError(
80
- 'Invalid previous node in the linked list',
81
- );
82
- });
83
-
84
- it('should have the right size', () => {
85
- const map = {
86
- 1: { id: '1', nextId: '2', previousId: null },
87
- 2: { id: '2', nextId: '3', previousId: '1' },
88
- 3: { id: '3', nextId: null, previousId: '2' },
89
- };
90
-
91
- const linkedList = createLinkedList('1', map);
92
-
93
- expect(linkedList.size).toStrictEqual(3);
94
- });
95
-
96
- describe('methods', () => {
97
- const reduceLinkedListMocked = jest.mocked(reduceLinkedList);
98
- const findLinkedListMocked = jest.mocked(findLinkedList);
99
- const whileLinkedListMocked = jest.mocked(whileLinkedList);
100
- const removeLinkedListMocked = jest.mocked(removeLinkedList);
101
- const insertLinkedListMocked = jest.mocked(insertLinkedList);
102
- const getLinkedListMocked = jest.mocked(getLinkedList);
103
- const updateLinkedListMocked = jest.mocked(updateLinkedList);
104
- const applyDiffLinkedListMocked = jest.mocked(applyDiffLinkedList);
105
-
106
- const record = {
107
- 1: { id: '1', nextId: '2', previousId: null },
108
- 2: { id: '2', nextId: null, previousId: '1' },
109
- };
110
- const linkedList = createLinkedList('1', record);
111
- const list = {
112
- headId: '1',
113
- items: record,
114
- };
115
- const manipulationConfig = {
116
- factory: expect.toBeFunction(),
117
- format: 'double',
118
- list,
119
- };
120
-
121
- beforeEach(() => {
122
- jest.clearAllMocks();
123
- });
124
-
125
- it('it should have reduce', () => {
126
- reduceLinkedListMocked.mockReturnValue('reduce');
127
-
128
- const accumulatorFunction = jest.fn().mockName('accumulatorFunction');
129
- const result = linkedList.reduce(accumulatorFunction, 'init');
130
-
131
- expect(result).toStrictEqual('reduce');
132
- expect(reduceLinkedListMocked).toHaveBeenCalledWith(accumulatorFunction, 'init', list);
133
- });
134
-
135
- it('it should have find', () => {
136
- findLinkedListMocked.mockReturnValue('find' as any);
137
-
138
- const findPredicate = jest.fn().mockName('findPredicate');
139
- const result = linkedList.find(findPredicate);
140
-
141
- expect(result).toStrictEqual('find');
142
- expect(findLinkedListMocked).toHaveBeenCalledWith(findPredicate, list);
143
- });
144
-
145
- it('it should have while', () => {
146
- whileLinkedListMocked.mockReturnValue('while' as any);
147
-
148
- const whilePredicate = jest.fn().mockName('whilePredicate');
149
- const result = linkedList.while(whilePredicate, '2');
150
-
151
- expect(result).toStrictEqual('while');
152
- expect(whileLinkedListMocked).toHaveBeenCalledWith(whilePredicate, list, '2');
153
- });
154
-
155
- it('it should have remove', () => {
156
- removeLinkedListMocked.mockReturnValue('remove' as any);
157
-
158
- const result = linkedList.remove('3');
159
-
160
- expect(result).toStrictEqual('remove');
161
- expect(removeLinkedListMocked).toHaveBeenCalledWith('3', manipulationConfig);
162
- });
163
-
164
- it('it should have insert', () => {
165
- insertLinkedListMocked.mockReturnValue('insert' as any);
166
-
167
- const item = { id: '5', nextId: '6', previousId: '4' };
168
- const result = linkedList.insert(item as any);
169
-
170
- expect(result).toStrictEqual('insert');
171
- expect(insertLinkedListMocked).toHaveBeenCalledWith(item, manipulationConfig);
172
- });
173
-
174
- it('it should have get', () => {
175
- getLinkedListMocked.mockReturnValue('get' as any);
176
-
177
- const result = linkedList.get('5');
178
-
179
- expect(result).toStrictEqual('get');
180
- expect(getLinkedListMocked).toHaveBeenCalledWith('5', list);
181
- });
182
-
183
- it('it should have update', () => {
184
- updateLinkedListMocked.mockReturnValue('update' as any);
185
-
186
- const updatedItem = { id: '5', nextId: '6', previousId: '4' };
187
- const result = linkedList.update(updatedItem as any);
188
-
189
- expect(result).toStrictEqual('update');
190
- expect(updateLinkedListMocked).toHaveBeenCalledWith(updatedItem, manipulationConfig);
191
- });
192
-
193
- it('it should have applyDiff', () => {
194
- applyDiffLinkedListMocked.mockReturnValue('applydiff' as any);
195
-
196
- const before = { id: '5', nextId: '6', previousId: '4' };
197
- const after = { id: '5', nextId: '7', previousId: '4' };
198
- const result = linkedList.applyDiff(before as any, after as any);
199
-
200
- expect(result).toStrictEqual('applydiff');
201
- expect(applyDiffLinkedListMocked).toHaveBeenCalledWith(before, after, linkedList);
202
- });
203
- });
204
- });
@@ -1,40 +0,0 @@
1
- import { findLinkedList } from '../find-linked-list';
2
-
3
- describe('findLinkedList', () => {
4
- const list = {
5
- items: {
6
- 1: {
7
- id: '1',
8
- nextId: '2',
9
- },
10
- 2: {
11
- id: '2',
12
- nextId: '3',
13
- },
14
- 3: {
15
- id: '3',
16
- nextId: '4',
17
- },
18
- 4: {
19
- id: '1',
20
- nextId: null,
21
- },
22
- },
23
- headId: '1',
24
- };
25
-
26
- it('should return the right item if it is found', () => {
27
- const foundItem = findLinkedList((item) => item.id === '3', list);
28
-
29
- expect(foundItem).toStrictEqual({
30
- id: '3',
31
- nextId: '4',
32
- });
33
- });
34
-
35
- it('should return null if no item match the predicate', () => {
36
- const foundItem = findLinkedList((item) => item.id === '5', list);
37
-
38
- expect(foundItem).toBeNull();
39
- });
40
- });
@@ -1,28 +0,0 @@
1
- import { getLinkedList } from '../get-linked-list';
2
-
3
- describe('getLinkedList', () => {
4
- const list = {
5
- headId: '1',
6
- items: {
7
- 1: {
8
- id: '1',
9
- nextId: '2',
10
- },
11
- 2: {
12
- id: '2',
13
- nextId: null,
14
- },
15
- },
16
- };
17
-
18
- it('should get the item corresponding to the id', () => {
19
- expect(getLinkedList('1', list)).toStrictEqual({
20
- id: '1',
21
- nextId: '2',
22
- });
23
- });
24
-
25
- it('should return null if the item with the given id does not exist', () => {
26
- expect(getLinkedList('5', list)).toBeNull();
27
- });
28
- });