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

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 (368) hide show
  1. package/{dist/cdn → cdn}/cdn.factory.js +16 -11
  2. package/cdn/cdn.factory.js.map +1 -0
  3. package/{dist/cdn → cdn}/types/cdn-factory.type.d.ts +4 -0
  4. package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js +3 -0
  5. package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js.map +1 -1
  6. package/http/build-search-params.d.ts +2 -0
  7. package/http/build-search-params.js +18 -0
  8. package/http/build-search-params.js.map +1 -0
  9. package/{dist/http → http}/index.d.ts +1 -0
  10. package/{dist/http → http}/index.js +2 -0
  11. package/http/index.js.map +1 -0
  12. package/{src/index.ts → index.d.ts} +14 -15
  13. package/{dist/index.js → index.js} +2 -2
  14. package/package.json +3 -7
  15. package/.circleci/config.yml +0 -40
  16. package/.eslintignore +0 -1
  17. package/.eslintrc.js +0 -17
  18. package/.gitignore +0 -37
  19. package/CHANGELOG.md +0 -34
  20. package/README.md +0 -26
  21. package/dist/cdn/cdn.factory.js.map +0 -1
  22. package/dist/github/branch/create-branch.d.ts +0 -11
  23. package/dist/github/branch/create-branch.js +0 -27
  24. package/dist/github/branch/create-branch.js.map +0 -1
  25. package/dist/github/branch/index.d.ts +0 -2
  26. package/dist/github/branch/index.js +0 -12
  27. package/dist/github/branch/index.js.map +0 -1
  28. package/dist/github/branch/update-branch.d.ts +0 -11
  29. package/dist/github/branch/update-branch.js +0 -26
  30. package/dist/github/branch/update-branch.js.map +0 -1
  31. package/dist/github/commit/create-git-blob.d.ts +0 -26
  32. package/dist/github/commit/create-git-blob.js +0 -42
  33. package/dist/github/commit/create-git-blob.js.map +0 -1
  34. package/dist/github/commit/create-git-commit.d.ts +0 -23
  35. package/dist/github/commit/create-git-commit.js +0 -39
  36. package/dist/github/commit/create-git-commit.js.map +0 -1
  37. package/dist/github/commit/create-git-tree.d.ts +0 -29
  38. package/dist/github/commit/create-git-tree.js +0 -47
  39. package/dist/github/commit/create-git-tree.js.map +0 -1
  40. package/dist/github/commit/get-sha-last-commit-of-branch.d.ts +0 -21
  41. package/dist/github/commit/get-sha-last-commit-of-branch.js +0 -35
  42. package/dist/github/commit/get-sha-last-commit-of-branch.js.map +0 -1
  43. package/dist/github/commit/get-tree-by-commit-sha.d.ts +0 -23
  44. package/dist/github/commit/get-tree-by-commit-sha.js +0 -37
  45. package/dist/github/commit/get-tree-by-commit-sha.js.map +0 -1
  46. package/dist/github/commit/index.d.ts +0 -6
  47. package/dist/github/commit/index.js +0 -20
  48. package/dist/github/commit/run-new-commit-process.d.ts +0 -27
  49. package/dist/github/commit/run-new-commit-process.js +0 -49
  50. package/dist/github/commit/run-new-commit-process.js.map +0 -1
  51. package/dist/github/commit/utils.d.ts +0 -1
  52. package/dist/github/commit/utils.js +0 -29
  53. package/dist/github/commit/utils.js.map +0 -1
  54. package/dist/github/content/get-file-content.d.ts +0 -20
  55. package/dist/github/content/get-file-content.js +0 -38
  56. package/dist/github/content/get-file-content.js.map +0 -1
  57. package/dist/github/github.d.ts +0 -25
  58. package/dist/github/github.js +0 -65
  59. package/dist/github/github.js.map +0 -1
  60. package/dist/github/index.d.ts +0 -1
  61. package/dist/github/index.js +0 -10
  62. package/dist/github/merge/create-pull-request.d.ts +0 -14
  63. package/dist/github/merge/create-pull-request.js +0 -30
  64. package/dist/github/merge/create-pull-request.js.map +0 -1
  65. package/dist/github/merge/index.d.ts +0 -2
  66. package/dist/github/merge/index.js +0 -12
  67. package/dist/github/merge/index.js.map +0 -1
  68. package/dist/github/merge/merge-pull-request.d.ts +0 -13
  69. package/dist/github/merge/merge-pull-request.js +0 -28
  70. package/dist/github/merge/merge-pull-request.js.map +0 -1
  71. package/dist/http/index.js.map +0 -1
  72. package/dist/index.d.ts +0 -15
  73. package/dist/package.json +0 -65
  74. package/dist/string/index.js.map +0 -1
  75. package/dist/time/index.js.map +0 -1
  76. package/global.d.ts +0 -2
  77. package/rollup.config.ts +0 -15
  78. package/src/array/__tests__/array-to-map.test.ts +0 -50
  79. package/src/array/__tests__/get-values-from-keys.test.ts +0 -14
  80. package/src/array/array-to-map.ts +0 -32
  81. package/src/array/get-values-from-keys.ts +0 -3
  82. package/src/array/index.ts +0 -2
  83. package/src/cdn/__tests__/cdn.factory.test.ts +0 -120
  84. package/src/cdn/__tests__/utils.test.ts +0 -456
  85. package/src/cdn/cdn.factory.ts +0 -63
  86. package/src/cdn/index.ts +0 -2
  87. package/src/cdn/types/cdn-factory.type.ts +0 -35
  88. package/src/cdn/types/index.ts +0 -1
  89. package/src/cdn/utils/extract-info-from-url.util.ts +0 -21
  90. package/src/cdn/utils/get-cdn-from-s3-url.util.ts +0 -20
  91. package/src/cdn/utils/get-cdn-url.util.ts +0 -26
  92. package/src/formatting/__tests__/format-number.test.ts +0 -11
  93. package/src/formatting/format-number.ts +0 -14
  94. package/src/formatting/index.ts +0 -1
  95. package/src/fp/__tests__/run-while.test.ts +0 -29
  96. package/src/fp/index.ts +0 -1
  97. package/src/fp/run-while.ts +0 -54
  98. package/src/github/branch/create-branch.ts +0 -36
  99. package/src/github/branch/index.ts +0 -2
  100. package/src/github/branch/update-branch.ts +0 -35
  101. package/src/github/commit/create-git-blob.ts +0 -57
  102. package/src/github/commit/create-git-commit.ts +0 -57
  103. package/src/github/commit/create-git-tree.ts +0 -68
  104. package/src/github/commit/get-sha-last-commit-of-branch.ts +0 -50
  105. package/src/github/commit/get-tree-by-commit-sha.ts +0 -52
  106. package/src/github/commit/index.ts +0 -6
  107. package/src/github/commit/run-new-commit-process.ts +0 -88
  108. package/src/github/commit/utils.ts +0 -31
  109. package/src/github/content/get-file-content.ts +0 -50
  110. package/src/github/github.ts +0 -93
  111. package/src/github/index.ts +0 -1
  112. package/src/github/merge/create-pull-request.ts +0 -42
  113. package/src/github/merge/index.ts +0 -2
  114. package/src/github/merge/merge-pull-request.ts +0 -39
  115. package/src/http/__tests__/encode-search-object.test.ts +0 -34
  116. package/src/http/__tests__/fetch-with-timeout.test.ts +0 -50
  117. package/src/http/encode-search-object.ts +0 -39
  118. package/src/http/fetch-with-timeout.ts +0 -24
  119. package/src/http/index.ts +0 -2
  120. package/src/linked-list/__tests__/apply-diff-linked-list.test.ts +0 -103
  121. package/src/linked-list/__tests__/create-linked-list.test.ts +0 -204
  122. package/src/linked-list/__tests__/find-linked-list.test.ts +0 -40
  123. package/src/linked-list/__tests__/get-linked-list.test.ts +0 -28
  124. package/src/linked-list/__tests__/insert-linked-list.test.ts +0 -186
  125. package/src/linked-list/__tests__/linked-list-utils.test.ts +0 -252
  126. package/src/linked-list/__tests__/reduce-linked-list.test.ts +0 -31
  127. package/src/linked-list/__tests__/remove-linked-list.test.ts +0 -129
  128. package/src/linked-list/__tests__/update-linked-list.test.ts +0 -53
  129. package/src/linked-list/__tests__/while-linked-list.test.ts +0 -58
  130. package/src/linked-list/apply-diff-linked-list.ts +0 -35
  131. package/src/linked-list/create-linked-list.ts +0 -79
  132. package/src/linked-list/find-linked-list.ts +0 -26
  133. package/src/linked-list/get-linked-list.ts +0 -9
  134. package/src/linked-list/index.ts +0 -2
  135. package/src/linked-list/insert-linked-list.ts +0 -50
  136. package/src/linked-list/linked-list-utils.ts +0 -143
  137. package/src/linked-list/reduce-linked-list.ts +0 -18
  138. package/src/linked-list/remove-linked-list.ts +0 -36
  139. package/src/linked-list/type.ts +0 -38
  140. package/src/linked-list/update-linked-list.ts +0 -29
  141. package/src/linked-list/while-linked-list.ts +0 -33
  142. package/src/math/__tests__/clamp-number.test.ts +0 -30
  143. package/src/math/__tests__/interpolate.test.ts +0 -28
  144. package/src/math/__tests__/number-range.test.ts +0 -59
  145. package/src/math/__tests__/random-number.test.ts +0 -11
  146. package/src/math/clamp-number.ts +0 -8
  147. package/src/math/index.ts +0 -4
  148. package/src/math/interpolate.ts +0 -18
  149. package/src/math/number-range.ts +0 -16
  150. package/src/math/random-number.ts +0 -10
  151. package/src/object/__tests__/merge-deep.test.ts +0 -56
  152. package/src/object/index.ts +0 -1
  153. package/src/object/merge-deep.ts +0 -27
  154. package/src/parsing/__tests__/parse-boolean.test.ts +0 -15
  155. package/src/parsing/__tests__/parse-enum.test.ts +0 -19
  156. package/src/parsing/__tests__/parse-number.test.ts +0 -20
  157. package/src/parsing/index.ts +0 -3
  158. package/src/parsing/parse-boolean.ts +0 -10
  159. package/src/parsing/parse-enum.ts +0 -16
  160. package/src/parsing/parse-number.ts +0 -12
  161. package/src/predicates/__tests__/is-function.test.ts +0 -11
  162. package/src/predicates/__tests__/is-null.test.ts +0 -11
  163. package/src/predicates/__tests__/is-object.test.ts +0 -11
  164. package/src/predicates/__tests__/is-primitive.test.ts +0 -42
  165. package/src/predicates/__tests__/is-undefined.test.ts +0 -11
  166. package/src/predicates/__tests__/is-uuid.test.ts +0 -13
  167. package/src/predicates/index.ts +0 -5
  168. package/src/predicates/is-function.ts +0 -3
  169. package/src/predicates/is-null.ts +0 -3
  170. package/src/predicates/is-object.ts +0 -3
  171. package/src/predicates/is-primitive.ts +0 -19
  172. package/src/predicates/is-undefined.ts +0 -3
  173. package/src/predicates/is-uuid.ts +0 -3
  174. package/src/promise/__tests__/delay.test.ts +0 -13
  175. package/src/promise/__tests__/execute-or-resolve-default.test.ts +0 -25
  176. package/src/promise/__tests__/execute-with-delay.test.ts +0 -24
  177. package/src/promise/delay.ts +0 -3
  178. package/src/promise/execute-or-resolve-default.ts +0 -14
  179. package/src/promise/execute-with-delay.ts +0 -6
  180. package/src/promise/index.ts +0 -3
  181. package/src/string/__tests__/replace-in-template.test.ts +0 -52
  182. package/src/string/index.ts +0 -1
  183. package/src/string/replace-in-template.ts +0 -45
  184. package/src/time/__tests__/convert.test.ts +0 -14
  185. package/src/time/__tests__/format-minutes.test.ts +0 -10
  186. package/src/time/__tests__/get-time-diff-as-string.test.ts +0 -128
  187. package/src/time/constants.ts +0 -4
  188. package/src/time/convert.ts +0 -5
  189. package/src/time/format-minutes.ts +0 -9
  190. package/src/time/get-time-diff-as-string.ts +0 -196
  191. package/src/time/index.ts +0 -4
  192. package/src/types/function.ts +0 -1
  193. package/src/types/general.ts +0 -8
  194. package/src/types/index.ts +0 -4
  195. package/src/types/object.ts +0 -33
  196. package/src/types/search.ts +0 -29
  197. package/tsconfig.eslint.json +0 -8
  198. package/tsconfig.json +0 -25
  199. /package/{dist/_virtual → _virtual}/_tslib.js +0 -0
  200. /package/{dist/_virtual → _virtual}/_tslib.js.map +0 -0
  201. /package/{dist/array → array}/array-to-map.d.ts +0 -0
  202. /package/{dist/array → array}/array-to-map.js +0 -0
  203. /package/{dist/array → array}/array-to-map.js.map +0 -0
  204. /package/{dist/array → array}/get-values-from-keys.d.ts +0 -0
  205. /package/{dist/array → array}/get-values-from-keys.js +0 -0
  206. /package/{dist/array → array}/get-values-from-keys.js.map +0 -0
  207. /package/{dist/array → array}/index.d.ts +0 -0
  208. /package/{dist/array → array}/index.js +0 -0
  209. /package/{dist/array → array}/index.js.map +0 -0
  210. /package/{dist/cdn → cdn}/cdn.factory.d.ts +0 -0
  211. /package/{dist/cdn → cdn}/index.d.ts +0 -0
  212. /package/{dist/cdn → cdn}/index.js +0 -0
  213. /package/{dist/cdn → cdn}/index.js.map +0 -0
  214. /package/{dist/cdn → cdn}/types/index.d.ts +0 -0
  215. /package/{dist/cdn → cdn}/types/index.js +0 -0
  216. /package/{dist/cdn → cdn}/types/index.js.map +0 -0
  217. /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.d.ts +0 -0
  218. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.d.ts +0 -0
  219. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js +0 -0
  220. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js.map +0 -0
  221. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.d.ts +0 -0
  222. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js +0 -0
  223. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js.map +0 -0
  224. /package/{dist/formatting → formatting}/format-number.d.ts +0 -0
  225. /package/{dist/formatting → formatting}/format-number.js +0 -0
  226. /package/{dist/formatting → formatting}/format-number.js.map +0 -0
  227. /package/{dist/formatting → formatting}/index.d.ts +0 -0
  228. /package/{dist/formatting → formatting}/index.js +0 -0
  229. /package/{dist/formatting → formatting}/index.js.map +0 -0
  230. /package/{dist/fp → fp}/index.d.ts +0 -0
  231. /package/{dist/fp → fp}/index.js +0 -0
  232. /package/{dist/fp → fp}/index.js.map +0 -0
  233. /package/{dist/fp → fp}/run-while.d.ts +0 -0
  234. /package/{dist/fp → fp}/run-while.js +0 -0
  235. /package/{dist/fp → fp}/run-while.js.map +0 -0
  236. /package/{dist/http → http}/encode-search-object.d.ts +0 -0
  237. /package/{dist/http → http}/encode-search-object.js +0 -0
  238. /package/{dist/http → http}/encode-search-object.js.map +0 -0
  239. /package/{dist/http → http}/fetch-with-timeout.d.ts +0 -0
  240. /package/{dist/http → http}/fetch-with-timeout.js +0 -0
  241. /package/{dist/http → http}/fetch-with-timeout.js.map +0 -0
  242. /package/{dist/index.js.map → index.js.map} +0 -0
  243. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.d.ts +0 -0
  244. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js +0 -0
  245. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js.map +0 -0
  246. /package/{dist/linked-list → linked-list}/create-linked-list.d.ts +0 -0
  247. /package/{dist/linked-list → linked-list}/create-linked-list.js +0 -0
  248. /package/{dist/linked-list → linked-list}/create-linked-list.js.map +0 -0
  249. /package/{dist/linked-list → linked-list}/find-linked-list.d.ts +0 -0
  250. /package/{dist/linked-list → linked-list}/find-linked-list.js +0 -0
  251. /package/{dist/linked-list → linked-list}/find-linked-list.js.map +0 -0
  252. /package/{dist/linked-list → linked-list}/get-linked-list.d.ts +0 -0
  253. /package/{dist/linked-list → linked-list}/get-linked-list.js +0 -0
  254. /package/{dist/linked-list → linked-list}/get-linked-list.js.map +0 -0
  255. /package/{dist/linked-list → linked-list}/index.d.ts +0 -0
  256. /package/{dist/linked-list → linked-list}/index.js +0 -0
  257. /package/{dist/github → linked-list}/index.js.map +0 -0
  258. /package/{dist/linked-list → linked-list}/insert-linked-list.d.ts +0 -0
  259. /package/{dist/linked-list → linked-list}/insert-linked-list.js +0 -0
  260. /package/{dist/linked-list → linked-list}/insert-linked-list.js.map +0 -0
  261. /package/{dist/linked-list → linked-list}/linked-list-utils.d.ts +0 -0
  262. /package/{dist/linked-list → linked-list}/linked-list-utils.js +0 -0
  263. /package/{dist/linked-list → linked-list}/linked-list-utils.js.map +0 -0
  264. /package/{dist/linked-list → linked-list}/reduce-linked-list.d.ts +0 -0
  265. /package/{dist/linked-list → linked-list}/reduce-linked-list.js +0 -0
  266. /package/{dist/linked-list → linked-list}/reduce-linked-list.js.map +0 -0
  267. /package/{dist/linked-list → linked-list}/remove-linked-list.d.ts +0 -0
  268. /package/{dist/linked-list → linked-list}/remove-linked-list.js +0 -0
  269. /package/{dist/linked-list → linked-list}/remove-linked-list.js.map +0 -0
  270. /package/{dist/linked-list → linked-list}/type.d.ts +0 -0
  271. /package/{dist/linked-list → linked-list}/update-linked-list.d.ts +0 -0
  272. /package/{dist/linked-list → linked-list}/update-linked-list.js +0 -0
  273. /package/{dist/linked-list → linked-list}/update-linked-list.js.map +0 -0
  274. /package/{dist/linked-list → linked-list}/while-linked-list.d.ts +0 -0
  275. /package/{dist/linked-list → linked-list}/while-linked-list.js +0 -0
  276. /package/{dist/linked-list → linked-list}/while-linked-list.js.map +0 -0
  277. /package/{dist/math → math}/clamp-number.d.ts +0 -0
  278. /package/{dist/math → math}/clamp-number.js +0 -0
  279. /package/{dist/math → math}/clamp-number.js.map +0 -0
  280. /package/{dist/math → math}/index.d.ts +0 -0
  281. /package/{dist/math → math}/index.js +0 -0
  282. /package/{dist/math → math}/index.js.map +0 -0
  283. /package/{dist/math → math}/interpolate.d.ts +0 -0
  284. /package/{dist/math → math}/interpolate.js +0 -0
  285. /package/{dist/math → math}/interpolate.js.map +0 -0
  286. /package/{dist/math → math}/number-range.d.ts +0 -0
  287. /package/{dist/math → math}/number-range.js +0 -0
  288. /package/{dist/math → math}/number-range.js.map +0 -0
  289. /package/{dist/math → math}/random-number.d.ts +0 -0
  290. /package/{dist/math → math}/random-number.js +0 -0
  291. /package/{dist/math → math}/random-number.js.map +0 -0
  292. /package/{dist/object → object}/index.d.ts +0 -0
  293. /package/{dist/object → object}/index.js +0 -0
  294. /package/{dist/linked-list → object}/index.js.map +0 -0
  295. /package/{dist/object → object}/merge-deep.d.ts +0 -0
  296. /package/{dist/object → object}/merge-deep.js +0 -0
  297. /package/{dist/object → object}/merge-deep.js.map +0 -0
  298. /package/{dist/parsing → parsing}/index.d.ts +0 -0
  299. /package/{dist/parsing → parsing}/index.js +0 -0
  300. /package/{dist/parsing → parsing}/index.js.map +0 -0
  301. /package/{dist/parsing → parsing}/parse-boolean.d.ts +0 -0
  302. /package/{dist/parsing → parsing}/parse-boolean.js +0 -0
  303. /package/{dist/parsing → parsing}/parse-boolean.js.map +0 -0
  304. /package/{dist/parsing → parsing}/parse-enum.d.ts +0 -0
  305. /package/{dist/parsing → parsing}/parse-enum.js +0 -0
  306. /package/{dist/parsing → parsing}/parse-enum.js.map +0 -0
  307. /package/{dist/parsing → parsing}/parse-number.d.ts +0 -0
  308. /package/{dist/parsing → parsing}/parse-number.js +0 -0
  309. /package/{dist/parsing → parsing}/parse-number.js.map +0 -0
  310. /package/{dist/predicates → predicates}/index.d.ts +0 -0
  311. /package/{dist/predicates → predicates}/index.js +0 -0
  312. /package/{dist/predicates → predicates}/index.js.map +0 -0
  313. /package/{dist/predicates → predicates}/is-function.d.ts +0 -0
  314. /package/{dist/predicates → predicates}/is-function.js +0 -0
  315. /package/{dist/predicates → predicates}/is-function.js.map +0 -0
  316. /package/{dist/predicates → predicates}/is-null.d.ts +0 -0
  317. /package/{dist/predicates → predicates}/is-null.js +0 -0
  318. /package/{dist/predicates → predicates}/is-null.js.map +0 -0
  319. /package/{dist/predicates → predicates}/is-object.d.ts +0 -0
  320. /package/{dist/predicates → predicates}/is-object.js +0 -0
  321. /package/{dist/predicates → predicates}/is-object.js.map +0 -0
  322. /package/{dist/predicates → predicates}/is-primitive.d.ts +0 -0
  323. /package/{dist/predicates → predicates}/is-primitive.js +0 -0
  324. /package/{dist/predicates → predicates}/is-primitive.js.map +0 -0
  325. /package/{dist/predicates → predicates}/is-undefined.d.ts +0 -0
  326. /package/{dist/predicates → predicates}/is-undefined.js +0 -0
  327. /package/{dist/predicates → predicates}/is-undefined.js.map +0 -0
  328. /package/{dist/predicates → predicates}/is-uuid.d.ts +0 -0
  329. /package/{dist/promise → promise}/delay.d.ts +0 -0
  330. /package/{dist/promise → promise}/delay.js +0 -0
  331. /package/{dist/promise → promise}/delay.js.map +0 -0
  332. /package/{dist/promise → promise}/execute-or-resolve-default.d.ts +0 -0
  333. /package/{dist/promise → promise}/execute-or-resolve-default.js +0 -0
  334. /package/{dist/promise → promise}/execute-or-resolve-default.js.map +0 -0
  335. /package/{dist/promise → promise}/execute-with-delay.d.ts +0 -0
  336. /package/{dist/promise → promise}/execute-with-delay.js +0 -0
  337. /package/{dist/promise → promise}/execute-with-delay.js.map +0 -0
  338. /package/{dist/promise → promise}/index.d.ts +0 -0
  339. /package/{dist/promise → promise}/index.js +0 -0
  340. /package/{dist/promise → promise}/index.js.map +0 -0
  341. /package/{dist/string → string}/index.d.ts +0 -0
  342. /package/{dist/string → string}/index.js +0 -0
  343. /package/{dist/object → string}/index.js.map +0 -0
  344. /package/{dist/string → string}/replace-in-template.d.ts +0 -0
  345. /package/{dist/string → string}/replace-in-template.js +0 -0
  346. /package/{dist/string → string}/replace-in-template.js.map +0 -0
  347. /package/{dist/time → time}/constants.d.ts +0 -0
  348. /package/{dist/time → time}/constants.js +0 -0
  349. /package/{dist/time → time}/constants.js.map +0 -0
  350. /package/{dist/time → time}/convert.d.ts +0 -0
  351. /package/{dist/time → time}/convert.js +0 -0
  352. /package/{dist/time → time}/convert.js.map +0 -0
  353. /package/{dist/time → time}/format-minutes.d.ts +0 -0
  354. /package/{dist/time → time}/format-minutes.js +0 -0
  355. /package/{dist/time → time}/format-minutes.js.map +0 -0
  356. /package/{dist/time → time}/get-time-diff-as-string.d.ts +0 -0
  357. /package/{dist/time → time}/get-time-diff-as-string.js +0 -0
  358. /package/{dist/time → time}/get-time-diff-as-string.js.map +0 -0
  359. /package/{dist/time → time}/index.d.ts +0 -0
  360. /package/{dist/time → time}/index.js +0 -0
  361. /package/{dist/github/commit → time}/index.js.map +0 -0
  362. /package/{dist/types → types}/function.d.ts +0 -0
  363. /package/{dist/types → types}/general.d.ts +0 -0
  364. /package/{dist/types → types}/index.d.ts +0 -0
  365. /package/{dist/types → types}/index.js +0 -0
  366. /package/{dist/types → types}/index.js.map +0 -0
  367. /package/{dist/types → types}/object.d.ts +0 -0
  368. /package/{dist/types → types}/search.d.ts +0 -0
package/src/fp/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './run-while';
@@ -1,54 +0,0 @@
1
- export type RunWhileConfig<T> = {
2
- /**
3
- * Return a boolean to keep running the callback or not.
4
- */
5
- predicate: (current: T) => boolean,
6
- /**
7
- * The function to run while `predicate` returns `true`
8
- */
9
- callback: (current: T, iteractionCount: number) => T,
10
- /**
11
- * `callback` will not be run again if `iterationCount` exceeds this value.
12
- * Default to `Infinity`
13
- */
14
- iterationLimit?: number,
15
- /**
16
- * The first value passed to the callback.
17
- */
18
- initialValue: T,
19
- };
20
-
21
- export type RunWhileFn = <T>(config: RunWhileConfig<T>) => {
22
- /**
23
- * The callback last result.
24
- */
25
- result: T,
26
- iterationCount: number,
27
- };
28
-
29
- /**
30
- * Run the callback while the predicate return true. Throws an
31
- * error if the iteration count exceeds the iteration limit.
32
- */
33
- export const runWhile: RunWhileFn = ({ predicate, callback, initialValue, iterationLimit = Infinity }) => {
34
- let counter = 0;
35
- let currentValue = initialValue;
36
- let shouldRun = predicate(currentValue);
37
-
38
- while (shouldRun) {
39
- if (counter >= iterationLimit) {
40
- break;
41
- }
42
-
43
- const nextValue = callback(currentValue, counter);
44
-
45
- counter += 1;
46
- shouldRun = predicate(nextValue);
47
- currentValue = nextValue;
48
- }
49
-
50
- return {
51
- result: currentValue,
52
- iterationCount: counter,
53
- };
54
- };
@@ -1,36 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from '../commit/utils';
5
-
6
- export type CreateBranchArgs = {
7
- branchName: string;
8
- shaLastCommitOfBranch: string;
9
- };
10
-
11
- export type CreateBranchResponse = {
12
- ref: string;
13
- };
14
-
15
- const createBranchResponseSchema = z.object({
16
- ref: z.string(),
17
- });
18
-
19
- export type CreateBranch = (args: CreateBranchArgs) => Promise<CreateBranchResponse>;
20
-
21
- export type CreateBranchFactory = (instance: AxiosInstance) => CreateBranch;
22
-
23
- export const createBranchFactory: CreateBranchFactory = (instance) => async (args) => {
24
- const { branchName, shaLastCommitOfBranch } = args;
25
-
26
- try {
27
- const { data } = await instance.post<CreateBranchResponse>('/git/refs', {
28
- ref: `refs/heads/${branchName}`,
29
- sha: shaLastCommitOfBranch,
30
- });
31
-
32
- return createBranchResponseSchema.parse(data);
33
- } catch (error) {
34
- throw handleError(error);
35
- }
36
- };
@@ -1,2 +0,0 @@
1
- export * from './create-branch';
2
- export * from './update-branch';
@@ -1,35 +0,0 @@
1
- import { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from '../commit/utils';
5
-
6
- export type UpdateBranchArgs = {
7
- branchName: string;
8
- shaTree: string;
9
- };
10
-
11
- export type UpdateBranchResponse = {
12
- ref: string;
13
- };
14
-
15
- const updateBranchResponseSchema = z.object({
16
- ref: z.string(),
17
- });
18
-
19
- export type UpdateBranch = (args: UpdateBranchArgs) => Promise<UpdateBranchResponse>;
20
-
21
- export type UpdateBranchFactory = (instance: AxiosInstance) => UpdateBranch;
22
-
23
- export const updateBranchFactory: UpdateBranchFactory = (instance) => async (args) => {
24
- const { branchName, shaTree } = args;
25
-
26
- try {
27
- const { data } = await instance.patch<UpdateBranchResponse>(`/git/refs/heads/${branchName}`, {
28
- sha: shaTree,
29
- });
30
-
31
- return updateBranchResponseSchema.parse(data);
32
- } catch (error) {
33
- throw handleError(error);
34
- }
35
- };
@@ -1,57 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from './utils';
5
-
6
- export type CreateGitBlobArgs = {
7
- content: string;
8
- encoding: 'utf-8' | 'base64';
9
- };
10
-
11
- export type CreateGitBlobResponse = {
12
- sha: string;
13
- url: string;
14
- };
15
-
16
- const createGitBlobResponseSchema = z.object({
17
- sha: z.string(),
18
- url: z.string(),
19
- });
20
-
21
- export type CreateGitBlob = (
22
- args: CreateGitBlobArgs
23
- ) => Promise<CreateGitBlobResponse>;
24
-
25
- export type CreateGitBlobFactory = (instance: AxiosInstance) => CreateGitBlob;
26
-
27
- /**
28
- * Create a git blob
29
- *
30
- * @param owner the owner of the repository
31
- * @param repo the name of the repository
32
- * @param token the github token
33
- * @param content the content of the file
34
- * @param encoding the encoding of the content. Default: utf-8
35
- * @returns CreateGitBlobResponse
36
- * @throws forbidden
37
- * @throws resource-not-found
38
- * @throws conflict
39
- * @throws validation-failed-or-the-endpoint-has-been-spammed
40
- */
41
- export const createGitBlobFactory: CreateGitBlobFactory = (instance) => async (args) => {
42
- const { content, encoding = 'utf-8' } = args;
43
-
44
- try {
45
- const { data } = await instance.post<CreateGitBlobResponse>(
46
- '/git/blobs',
47
- {
48
- content,
49
- encoding,
50
- },
51
- );
52
-
53
- return createGitBlobResponseSchema.parse(data);
54
- } catch (error) {
55
- throw handleError(error);
56
- }
57
- };
@@ -1,57 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from './utils';
5
-
6
- export type CreateGitCommitArgs = {
7
- message: string;
8
- treeSha: string;
9
- parents: string[];
10
- };
11
-
12
- export type CreateGitCommitResponse = {
13
- sha: string;
14
- url: string;
15
- };
16
-
17
- const createGitCommitSchema = z.object({
18
- sha: z.string(),
19
- url: z.string(),
20
- });
21
-
22
- export type CreateGitCommit = (
23
- args: CreateGitCommitArgs
24
- ) => Promise<CreateGitCommitResponse>;
25
-
26
- export type CreateGitCommitFactory = (
27
- instance: AxiosInstance
28
- ) => CreateGitCommit;
29
-
30
- /**
31
- * Create a git commit
32
- * @param owner the owner of the repository
33
- * @param repo the name of the repository
34
- * @param token the github token
35
- * @param message the commit message
36
- * @param treeSha the sha of the tree
37
- * @param parents the parents of the commit
38
- * @returns CreateGitCommitResponse
39
- */
40
- export const createGitCommitFactory: CreateGitCommitFactory = (instance) => async (args) => {
41
- const { message, treeSha, parents } = args;
42
-
43
- try {
44
- const { data } = await instance.post<CreateGitCommitResponse>(
45
- '/git/commits',
46
- {
47
- message,
48
- tree: treeSha,
49
- parents,
50
- },
51
- );
52
-
53
- return createGitCommitSchema.parse(data);
54
- } catch (error) {
55
- throw handleError(error);
56
- }
57
- };
@@ -1,68 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from './utils';
5
-
6
- export type Blob = {
7
- path: string;
8
- sha: string;
9
- };
10
-
11
- export type CreateGitTreeArgs = {
12
- baseTreeSha: string;
13
- blobs: Blob[];
14
- };
15
-
16
- export type CreateGitTreeResponse = {
17
- sha: string;
18
- url: string;
19
- };
20
-
21
- const createGitTreeSchema = z.object({
22
- sha: z.string(),
23
- url: z.string(),
24
- });
25
-
26
- export type CreateGitTree = (
27
- args: CreateGitTreeArgs
28
- ) => Promise<CreateGitTreeResponse>;
29
-
30
- export type CreateGitTreeFactory = (instance: AxiosInstance) => CreateGitTree;
31
-
32
- /**
33
- * Create a git tree
34
- *
35
- * @param owner the owner of the repository
36
- * @param repo the name of the repository
37
- * @param token the github token
38
- * @param baseTreeSha the sha of the base tree
39
- * @param blobs the blobs to add to the tree
40
- * @returns CreateGitTreeResponse
41
- * @throws forbidden
42
- * @throws resource-not-found
43
- * @throws validation-failed-or-the-endpoint-has-been-spammed
44
- */
45
- export const createGitTreeFactory: CreateGitTreeFactory = (instance) => async (args) => {
46
- const { baseTreeSha, blobs } = args;
47
-
48
- const tree = blobs.map((blob) => ({
49
- path: blob.path,
50
- mode: '100644',
51
- type: 'blob',
52
- sha: blob.sha,
53
- }));
54
-
55
- try {
56
- const { data } = await instance.post<CreateGitTreeResponse>(
57
- '/git/trees',
58
- {
59
- base_tree: baseTreeSha,
60
- tree,
61
- },
62
- );
63
-
64
- return createGitTreeSchema.parse(data);
65
- } catch (error) {
66
- throw handleError(error);
67
- }
68
- };
@@ -1,50 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from './utils';
5
-
6
- export type GetShaLastCommitOfBranchArgs = {
7
- ref: `/heads/${string}`;
8
- };
9
-
10
- export type GetShaLastCommitOfBranchResponse = {
11
- sha: string;
12
- url: string;
13
- };
14
-
15
- const getShaLastCommitOfBranchSchema = z.object({
16
- sha: z.string(),
17
- url: z.string(),
18
- });
19
-
20
- export type GetShaLastCommitOfBranch = (
21
- args: GetShaLastCommitOfBranchArgs
22
- ) => Promise<GetShaLastCommitOfBranchResponse>;
23
-
24
- export type GetShaLastCommitOfBranchFactory = (
25
- instance: AxiosInstance
26
- ) => GetShaLastCommitOfBranch;
27
-
28
- /**
29
- * Get the sha of the last commit of a branch
30
- *
31
- * @param owner the owner of the repository
32
- * @param repo the name of the repository
33
- * @param ref the reference to a branch. Example: /heads/master
34
- * @param token the github token
35
- * @returns GetShaLastCommitOfBranchResponse
36
- * @throws ref-not-found
37
- */
38
- export const getShaLastCommitOfBranchFactory: GetShaLastCommitOfBranchFactory = (instance) => async (args) => {
39
- const { ref } = args;
40
-
41
- try {
42
- const { data } = await instance.get<{
43
- object: GetShaLastCommitOfBranchResponse;
44
- }>(`/git/refs/${ref}`);
45
-
46
- return getShaLastCommitOfBranchSchema.parse(data.object);
47
- } catch (error) {
48
- throw handleError(error);
49
- }
50
- };
@@ -1,52 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
- import { z } from 'zod';
3
-
4
- import { handleError } from './utils';
5
-
6
- export type GetTreeShaFromCommitArgs = {
7
- sha: string;
8
- };
9
-
10
- export type GetTreeShaFromCommitResponse = {
11
- url: string;
12
- sha: string;
13
- };
14
-
15
- const getTreeFromCommitShaSchema = z.object({
16
- url: z.string(),
17
- sha: z.string(),
18
- });
19
-
20
- export type GetTreeShaFromCommit = (
21
- args: GetTreeShaFromCommitArgs
22
- ) => Promise<GetTreeShaFromCommitResponse>;
23
-
24
- export type GetTreeShaFromCommitFactory = (
25
- instance: AxiosInstance
26
- ) => GetTreeShaFromCommit;
27
-
28
- /**
29
- * Get the tree of a commit
30
- *
31
- * @param owner the owner of the repository
32
- * @param repo the name of the repository
33
- * @param sha the sha of the commit
34
- * @param token the github token
35
- * @returns GetTreeShaFromCommitResponse
36
- * @throws sha-not-found
37
- * @throws validation-failed-or-the-endpoint-has-been-spammed
38
- * @throws internal-server-error
39
- */
40
- export const getTreeShaFromCommitFactory: GetTreeShaFromCommitFactory = (instance) => async (args) => {
41
- const { sha } = args;
42
-
43
- try {
44
- const { data } = await instance.get<{
45
- tree: GetTreeShaFromCommitResponse;
46
- }>(`/git/commits/${sha}`);
47
-
48
- return getTreeFromCommitShaSchema.parse(data.tree);
49
- } catch (error) {
50
- throw handleError(error);
51
- }
52
- };
@@ -1,6 +0,0 @@
1
- export * from './create-git-blob';
2
- export * from './create-git-commit';
3
- export * from './create-git-tree';
4
- export * from './get-sha-last-commit-of-branch';
5
- export * from './get-tree-by-commit-sha';
6
- export * from './run-new-commit-process';
@@ -1,88 +0,0 @@
1
- import type { CreateGitBlob } from './create-git-blob';
2
- import type { CreateGitCommit } from './create-git-commit';
3
- import type { CreateGitTree } from './create-git-tree';
4
- import type { GetShaLastCommitOfBranch } from './get-sha-last-commit-of-branch';
5
- import type { GetTreeShaFromCommit } from './get-tree-by-commit-sha';
6
-
7
- export type VersionedFile = {
8
- path: string;
9
- content: string;
10
- };
11
-
12
- export type RunNewCommitProcessArgs = {
13
- message: string;
14
- ref: `/heads/${string}`;
15
- files: VersionedFile[];
16
- };
17
-
18
- export type RunNewCommitProcessResponse = {
19
- sha: string;
20
- url: string;
21
- };
22
-
23
- export type RunNewCommitProcess = (
24
- args: RunNewCommitProcessArgs,
25
- updateState?: (state: string) => void
26
- ) => Promise<RunNewCommitProcessResponse>;
27
-
28
- export type RunNewCommitProcessFactory = (args: {
29
- createGitBlob: CreateGitBlob;
30
- createGitCommit: CreateGitCommit;
31
- createGitTree: CreateGitTree;
32
- getShaLastCommitOfBranch: GetShaLastCommitOfBranch;
33
- getTreeShaFromCommit: GetTreeShaFromCommit;
34
- }) => RunNewCommitProcess;
35
-
36
- export const runNewCommitProcessFactory: RunNewCommitProcessFactory = (args) => async (
37
- runNewCommitProcessArgs,
38
- updateState = () => {},
39
- ) => {
40
- const { createGitBlob, createGitCommit, createGitTree, getShaLastCommitOfBranch, getTreeShaFromCommit } = args;
41
-
42
- const { message, ref, files } = runNewCommitProcessArgs;
43
-
44
- updateState('retrieving-sha-last-commit-of-branch');
45
- const { sha: shaLastCommit } = await getShaLastCommitOfBranch({
46
- ref,
47
- });
48
- updateState('retrieved-sha-last-commit-of-branch');
49
-
50
- updateState('creating-blobs-from-file');
51
- const blobs = await Promise.all(
52
- files.map(async (file) => {
53
- const blob = await createGitBlob({
54
- content: file.content,
55
- encoding: 'utf-8',
56
- });
57
-
58
- return {
59
- path: file.path,
60
- sha: blob.sha,
61
- };
62
- }),
63
- );
64
- updateState('created-blobs-from-file');
65
-
66
- updateState('retrieving-branch-current-tree');
67
- const { sha: lastCommitTreeSha } = await getTreeShaFromCommit({
68
- sha: shaLastCommit,
69
- });
70
- updateState('retrieved-branch-current-tree');
71
-
72
- updateState('creating-new-tree-with-changes');
73
- const tree = await createGitTree({
74
- baseTreeSha: lastCommitTreeSha,
75
- blobs,
76
- });
77
- updateState('created-new-tree-with-changes');
78
-
79
- updateState('creating-new-commit');
80
- const commit = await createGitCommit({
81
- message,
82
- treeSha: tree.sha,
83
- parents: [shaLastCommit],
84
- });
85
- updateState('created-new-commit');
86
-
87
- return commit;
88
- };
@@ -1,31 +0,0 @@
1
- import type { AxiosResponse } from 'axios';
2
-
3
- export const handleError = (error: unknown): Error => {
4
- const { response } = error as any;
5
-
6
- if (response) {
7
- const { status } = response as AxiosResponse;
8
-
9
- if (status === 403) {
10
- return new Error('forbidden');
11
- }
12
-
13
- if (status === 404) {
14
- return new Error('resource-not-found');
15
- }
16
-
17
- if (status === 409) {
18
- return new Error('conflict');
19
- }
20
-
21
- if (status === 422) {
22
- return new Error('validation-failed-or-the-endpoint-has-been-spammed');
23
- }
24
-
25
- if (status === 500) {
26
- return new Error('internal-server-error');
27
- }
28
- }
29
-
30
- return error as Error;
31
- };
@@ -1,50 +0,0 @@
1
- import type { AxiosInstance } from 'axios';
2
-
3
- import { handleError } from '../commit/utils';
4
-
5
- export type GetFileContentArgs = {
6
- path: string;
7
- branch: string;
8
- };
9
-
10
- type ApiResponse = {
11
- encoding: 'base64' | 'utf-8';
12
- content: string;
13
- };
14
-
15
- export type GetFileContentResponse = string;
16
-
17
- export type GetFileContent = (args: GetFileContentArgs) => Promise<GetFileContentResponse>;
18
-
19
- export type GetFileContentFactory = (instance: AxiosInstance) => GetFileContent;
20
-
21
- /**
22
- * Get the content of a file
23
- *
24
- * @param path the path of the file
25
- * @param branch the branch of the file
26
- * @returns GetFileContentResponse
27
- * @throws validation-failed-or-the-endpoint-has-been-spammed
28
- * @throws internal-server-error
29
- * @throws forbidden
30
- * @throws resource-not-found
31
- */
32
- export const getFileContentFactory: GetFileContentFactory = (instance) => async (args) => {
33
- const { path, branch } = args;
34
-
35
- try {
36
- const { data } = await instance.get<ApiResponse>(`/contents/${path}`, {
37
- params: {
38
- ref: branch,
39
- },
40
- });
41
-
42
- if (data.encoding === 'base64') {
43
- return Buffer.from(data.content, 'base64').toString('utf-8');
44
- }
45
-
46
- return data.content;
47
- } catch (error) {
48
- throw handleError(error);
49
- }
50
- };
@@ -1,93 +0,0 @@
1
- import axios from 'axios';
2
-
3
- import {
4
- createGitBlobFactory,
5
- createGitCommitFactory,
6
- createGitTreeFactory,
7
- getShaLastCommitOfBranchFactory,
8
- getTreeShaFromCommitFactory,
9
- runNewCommitProcessFactory,
10
- } from './commit';
11
- import type {
12
- CreateGitTree,
13
- CreateGitBlob,
14
- CreateGitCommit,
15
- GetTreeShaFromCommit,
16
- GetShaLastCommitOfBranch,
17
- RunNewCommitProcess,
18
- } from './commit';
19
- import { GetFileContent, getFileContentFactory } from './content/get-file-content';
20
- import { CreateBranch, UpdateBranch, createBranchFactory, updateBranchFactory } from './branch';
21
- import { CreatePullRequest, createPullRequestFactory } from './merge';
22
- import { MergePullRequest, mergePullRequestFactory } from './merge/merge-pull-request';
23
-
24
- export type GithubSdkArgs = {
25
- owner: string;
26
- repo: string;
27
- token: string;
28
- };
29
-
30
- export type GithubSdkInstance = {
31
- createGitBlob: CreateGitBlob;
32
- createGitCommit: CreateGitCommit;
33
- createGitTree: CreateGitTree;
34
- getShaLastCommitOfBranch: GetShaLastCommitOfBranch;
35
- getTreeShaFromCommit: GetTreeShaFromCommit;
36
- runNewCommitProcess: RunNewCommitProcess;
37
- getFileContent: GetFileContent;
38
- createBranch: CreateBranch;
39
- updateBranch: UpdateBranch;
40
- createPullRequest: CreatePullRequest;
41
- mergePullRequest: MergePullRequest;
42
- };
43
-
44
- export type GithubSdk = (args: GithubSdkArgs) => GithubSdkInstance;
45
-
46
- export const githubSdk: GithubSdk = (args) => {
47
- const { owner, repo, token } = args;
48
-
49
- const instance = axios.create({
50
- baseURL: `https://api.github.com/repos/${owner}/${repo}`,
51
- headers: {
52
- Accept: 'application/vnd.github+json',
53
- Authorization: `Bearer ${token}`,
54
- 'X-GitHub-Api-Version': '2022-11-28',
55
- },
56
- });
57
-
58
- const createGitBlob = createGitBlobFactory(instance);
59
- const createGitCommit = createGitCommitFactory(instance);
60
- const createGitTree = createGitTreeFactory(instance);
61
- const getShaLastCommitOfBranch = getShaLastCommitOfBranchFactory(instance);
62
- const getTreeShaFromCommit = getTreeShaFromCommitFactory(instance);
63
-
64
- const getFileContent = getFileContentFactory(instance);
65
-
66
- const runNewCommitProcess = runNewCommitProcessFactory({
67
- createGitBlob,
68
- createGitCommit,
69
- createGitTree,
70
- getShaLastCommitOfBranch,
71
- getTreeShaFromCommit,
72
- });
73
-
74
- const createBranch = createBranchFactory(instance);
75
- const updateBranch = updateBranchFactory(instance);
76
-
77
- const createPullRequest = createPullRequestFactory(instance);
78
- const mergePullRequest = mergePullRequestFactory(instance);
79
-
80
- return {
81
- createGitBlob,
82
- createGitCommit,
83
- createGitTree,
84
- getShaLastCommitOfBranch,
85
- getTreeShaFromCommit,
86
- runNewCommitProcess,
87
- getFileContent,
88
- createBranch,
89
- updateBranch,
90
- createPullRequest,
91
- mergePullRequest,
92
- };
93
- };
@@ -1 +0,0 @@
1
- export * from './github';