fca-shadow 0.0.1-security → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fca-shadow might be problematic. Click here for more details.

Files changed (502) hide show
  1. package/.1obgge4cxlazf1346921747~ +0 -0
  2. package/CHANGELOG.md +2 -0
  3. package/DOCS.md +1738 -0
  4. package/GetThreads/GetThreadInfo.js +128 -0
  5. package/GetThreads/Last-Run.js +65 -0
  6. package/LICENSE-MIT +21 -0
  7. package/README.md +132 -3
  8. package/StateCrypt.js +96 -0
  9. package/broadcast.js +22 -0
  10. package/index.html +1200 -0
  11. package/index.js +684 -0
  12. package/languages/index.json +150 -0
  13. package/lib/getInfoNew.js +34 -0
  14. package/lib/getToken.js +44 -0
  15. package/logger.js +23 -0
  16. package/package/database/SyntheticDatabase.sqlite +0 -0
  17. package/package/database/index.js +358 -0
  18. package/package/database/node_modules/lodash/_baseGet/README.md +20 -0
  19. package/package/database/node_modules/lodash/_baseGet/index.js +74 -0
  20. package/package/database/node_modules/lodash/_baseGet/package.json +18 -0
  21. package/package/database/node_modules/lodash/add.js +22 -0
  22. package/package/database/node_modules/lodash/after.js +42 -0
  23. package/package/database/node_modules/lodash/array.js +67 -0
  24. package/package/database/node_modules/lodash/ary.js +29 -0
  25. package/package/database/node_modules/lodash/assign.js +58 -0
  26. package/package/database/node_modules/lodash/assignIn.js +40 -0
  27. package/package/database/node_modules/lodash/assignInWith.js +38 -0
  28. package/package/database/node_modules/lodash/assignWith.js +37 -0
  29. package/package/database/node_modules/lodash/at.js +23 -0
  30. package/package/database/node_modules/lodash/attempt.js +35 -0
  31. package/package/database/node_modules/lodash/before.js +40 -0
  32. package/package/database/node_modules/lodash/bind.js +57 -0
  33. package/package/database/node_modules/lodash/bindAll.js +41 -0
  34. package/package/database/node_modules/lodash/bindKey.js +68 -0
  35. package/package/database/node_modules/lodash/camelCase.js +29 -0
  36. package/package/database/node_modules/lodash/capitalize.js +23 -0
  37. package/package/database/node_modules/lodash/castArray.js +44 -0
  38. package/package/database/node_modules/lodash/ceil.js +26 -0
  39. package/package/database/node_modules/lodash/chain.js +38 -0
  40. package/package/database/node_modules/lodash/chunk.js +50 -0
  41. package/package/database/node_modules/lodash/clamp.js +39 -0
  42. package/package/database/node_modules/lodash/clone.js +36 -0
  43. package/package/database/node_modules/lodash/cloneDeep.js +29 -0
  44. package/package/database/node_modules/lodash/cloneDeepWith.js +40 -0
  45. package/package/database/node_modules/lodash/cloneWith.js +42 -0
  46. package/package/database/node_modules/lodash/collection.js +30 -0
  47. package/package/database/node_modules/lodash/commit.js +33 -0
  48. package/package/database/node_modules/lodash/compact.js +31 -0
  49. package/package/database/node_modules/lodash/concat.js +43 -0
  50. package/package/database/node_modules/lodash/cond.js +60 -0
  51. package/package/database/node_modules/lodash/conforms.js +35 -0
  52. package/package/database/node_modules/lodash/conformsTo.js +32 -0
  53. package/package/database/node_modules/lodash/constant.js +26 -0
  54. package/package/database/node_modules/lodash/core.js +3877 -0
  55. package/package/database/node_modules/lodash/core.min.js +29 -0
  56. package/package/database/node_modules/lodash/countBy.js +40 -0
  57. package/package/database/node_modules/lodash/create.js +43 -0
  58. package/package/database/node_modules/lodash/curry.js +57 -0
  59. package/package/database/node_modules/lodash/curryRight.js +54 -0
  60. package/package/database/node_modules/lodash/date.js +3 -0
  61. package/package/database/node_modules/lodash/debounce.js +191 -0
  62. package/package/database/node_modules/lodash/deburr.js +45 -0
  63. package/package/database/node_modules/lodash/defaultTo.js +25 -0
  64. package/package/database/node_modules/lodash/defaults.js +64 -0
  65. package/package/database/node_modules/lodash/defaultsDeep.js +30 -0
  66. package/package/database/node_modules/lodash/defer.js +26 -0
  67. package/package/database/node_modules/lodash/delay.js +28 -0
  68. package/package/database/node_modules/lodash/difference.js +33 -0
  69. package/package/database/node_modules/lodash/differenceBy.js +44 -0
  70. package/package/database/node_modules/lodash/differenceWith.js +40 -0
  71. package/package/database/node_modules/lodash/divide.js +22 -0
  72. package/package/database/node_modules/lodash/drop.js +38 -0
  73. package/package/database/node_modules/lodash/dropRight.js +39 -0
  74. package/package/database/node_modules/lodash/dropRightWhile.js +45 -0
  75. package/package/database/node_modules/lodash/dropWhile.js +45 -0
  76. package/package/database/node_modules/lodash/each.js +1 -0
  77. package/package/database/node_modules/lodash/eachRight.js +1 -0
  78. package/package/database/node_modules/lodash/endsWith.js +43 -0
  79. package/package/database/node_modules/lodash/entries.js +1 -0
  80. package/package/database/node_modules/lodash/entriesIn.js +1 -0
  81. package/package/database/node_modules/lodash/eq.js +37 -0
  82. package/package/database/node_modules/lodash/escape.js +43 -0
  83. package/package/database/node_modules/lodash/escapeRegExp.js +32 -0
  84. package/package/database/node_modules/lodash/every.js +56 -0
  85. package/package/database/node_modules/lodash/extend.js +1 -0
  86. package/package/database/node_modules/lodash/extendWith.js +1 -0
  87. package/package/database/node_modules/lodash/fill.js +45 -0
  88. package/package/database/node_modules/lodash/filter.js +52 -0
  89. package/package/database/node_modules/lodash/find.js +42 -0
  90. package/package/database/node_modules/lodash/findIndex.js +55 -0
  91. package/package/database/node_modules/lodash/findKey.js +44 -0
  92. package/package/database/node_modules/lodash/findLast.js +25 -0
  93. package/package/database/node_modules/lodash/findLastIndex.js +59 -0
  94. package/package/database/node_modules/lodash/findLastKey.js +44 -0
  95. package/package/database/node_modules/lodash/first.js +1 -0
  96. package/package/database/node_modules/lodash/flake.lock +40 -0
  97. package/package/database/node_modules/lodash/flake.nix +20 -0
  98. package/package/database/node_modules/lodash/flatMap.js +29 -0
  99. package/package/database/node_modules/lodash/flatMapDeep.js +31 -0
  100. package/package/database/node_modules/lodash/flatMapDepth.js +31 -0
  101. package/package/database/node_modules/lodash/flatten.js +22 -0
  102. package/package/database/node_modules/lodash/flattenDeep.js +25 -0
  103. package/package/database/node_modules/lodash/flattenDepth.js +33 -0
  104. package/package/database/node_modules/lodash/flip.js +28 -0
  105. package/package/database/node_modules/lodash/floor.js +26 -0
  106. package/package/database/node_modules/lodash/flow.js +27 -0
  107. package/package/database/node_modules/lodash/flowRight.js +26 -0
  108. package/package/database/node_modules/lodash/forEach.js +41 -0
  109. package/package/database/node_modules/lodash/forEachRight.js +31 -0
  110. package/package/database/node_modules/lodash/forIn.js +39 -0
  111. package/package/database/node_modules/lodash/forInRight.js +37 -0
  112. package/package/database/node_modules/lodash/forOwn.js +36 -0
  113. package/package/database/node_modules/lodash/forOwnRight.js +34 -0
  114. package/package/database/node_modules/lodash/fp/F.js +1 -0
  115. package/package/database/node_modules/lodash/fp/add.js +5 -0
  116. package/package/database/node_modules/lodash/fp/after.js +5 -0
  117. package/package/database/node_modules/lodash/fp/all.js +1 -0
  118. package/package/database/node_modules/lodash/fp/allPass.js +1 -0
  119. package/package/database/node_modules/lodash/fp/always.js +1 -0
  120. package/package/database/node_modules/lodash/fp/any.js +1 -0
  121. package/package/database/node_modules/lodash/fp/anyPass.js +1 -0
  122. package/package/database/node_modules/lodash/fp/apply.js +1 -0
  123. package/package/database/node_modules/lodash/fp/array.js +2 -0
  124. package/package/database/node_modules/lodash/fp/ary.js +5 -0
  125. package/package/database/node_modules/lodash/fp/assign.js +5 -0
  126. package/package/database/node_modules/lodash/fp/assignAll.js +5 -0
  127. package/package/database/node_modules/lodash/fp/assignAllWith.js +5 -0
  128. package/package/database/node_modules/lodash/fp/assignIn.js +5 -0
  129. package/package/database/node_modules/lodash/fp/assignInAll.js +5 -0
  130. package/package/database/node_modules/lodash/fp/assignInAllWith.js +5 -0
  131. package/package/database/node_modules/lodash/fp/assignInWith.js +5 -0
  132. package/package/database/node_modules/lodash/fp/assignWith.js +5 -0
  133. package/package/database/node_modules/lodash/fp/assoc.js +1 -0
  134. package/package/database/node_modules/lodash/fp/assocPath.js +1 -0
  135. package/package/database/node_modules/lodash/fp/at.js +5 -0
  136. package/package/database/node_modules/lodash/fp/attempt.js +5 -0
  137. package/package/database/node_modules/lodash/fp/before.js +5 -0
  138. package/package/database/node_modules/lodash/fp/bind.js +5 -0
  139. package/package/database/node_modules/lodash/fp/bindAll.js +5 -0
  140. package/package/database/node_modules/lodash/fp/bindKey.js +5 -0
  141. package/package/database/node_modules/lodash/fp/camelCase.js +5 -0
  142. package/package/database/node_modules/lodash/fp/capitalize.js +5 -0
  143. package/package/database/node_modules/lodash/fp/castArray.js +5 -0
  144. package/package/database/node_modules/lodash/fp/ceil.js +5 -0
  145. package/package/database/node_modules/lodash/fp/chain.js +5 -0
  146. package/package/database/node_modules/lodash/fp/chunk.js +5 -0
  147. package/package/database/node_modules/lodash/fp/clamp.js +5 -0
  148. package/package/database/node_modules/lodash/fp/clone.js +5 -0
  149. package/package/database/node_modules/lodash/fp/cloneDeep.js +5 -0
  150. package/package/database/node_modules/lodash/fp/cloneDeepWith.js +5 -0
  151. package/package/database/node_modules/lodash/fp/cloneWith.js +5 -0
  152. package/package/database/node_modules/lodash/fp/collection.js +2 -0
  153. package/package/database/node_modules/lodash/fp/commit.js +5 -0
  154. package/package/database/node_modules/lodash/fp/compact.js +5 -0
  155. package/package/database/node_modules/lodash/fp/complement.js +1 -0
  156. package/package/database/node_modules/lodash/fp/compose.js +1 -0
  157. package/package/database/node_modules/lodash/fp/concat.js +5 -0
  158. package/package/database/node_modules/lodash/fp/cond.js +5 -0
  159. package/package/database/node_modules/lodash/fp/conforms.js +1 -0
  160. package/package/database/node_modules/lodash/fp/conformsTo.js +5 -0
  161. package/package/database/node_modules/lodash/fp/constant.js +5 -0
  162. package/package/database/node_modules/lodash/fp/contains.js +1 -0
  163. package/package/database/node_modules/lodash/fp/convert.js +18 -0
  164. package/package/database/node_modules/lodash/fp/countBy.js +5 -0
  165. package/package/database/node_modules/lodash/fp/create.js +5 -0
  166. package/package/database/node_modules/lodash/fp/curry.js +5 -0
  167. package/package/database/node_modules/lodash/fp/curryN.js +5 -0
  168. package/package/database/node_modules/lodash/fp/curryRight.js +5 -0
  169. package/package/database/node_modules/lodash/fp/curryRightN.js +5 -0
  170. package/package/database/node_modules/lodash/fp/date.js +2 -0
  171. package/package/database/node_modules/lodash/fp/debounce.js +5 -0
  172. package/package/database/node_modules/lodash/fp/deburr.js +5 -0
  173. package/package/database/node_modules/lodash/fp/defaultTo.js +5 -0
  174. package/package/database/node_modules/lodash/fp/defaults.js +5 -0
  175. package/package/database/node_modules/lodash/fp/defaultsAll.js +5 -0
  176. package/package/database/node_modules/lodash/fp/defaultsDeep.js +5 -0
  177. package/package/database/node_modules/lodash/fp/defaultsDeepAll.js +5 -0
  178. package/package/database/node_modules/lodash/fp/defer.js +5 -0
  179. package/package/database/node_modules/lodash/fp/delay.js +5 -0
  180. package/package/database/node_modules/lodash/fp/difference.js +5 -0
  181. package/package/database/node_modules/lodash/fp/differenceBy.js +5 -0
  182. package/package/database/node_modules/lodash/fp/differenceWith.js +5 -0
  183. package/package/database/node_modules/lodash/fp/dissoc.js +1 -0
  184. package/package/database/node_modules/lodash/fp/dissocPath.js +1 -0
  185. package/package/database/node_modules/lodash/fp/divide.js +5 -0
  186. package/package/database/node_modules/lodash/fp/drop.js +5 -0
  187. package/package/database/node_modules/lodash/fp/dropLast.js +1 -0
  188. package/package/database/node_modules/lodash/fp/dropLastWhile.js +1 -0
  189. package/package/database/node_modules/lodash/fp/dropRight.js +5 -0
  190. package/package/database/node_modules/lodash/fp/dropRightWhile.js +5 -0
  191. package/package/database/node_modules/lodash/fp/dropWhile.js +5 -0
  192. package/package/database/node_modules/lodash/fp/each.js +1 -0
  193. package/package/database/node_modules/lodash/fp/eachRight.js +1 -0
  194. package/package/database/node_modules/lodash/fp/endsWith.js +5 -0
  195. package/package/database/node_modules/lodash/fp/entries.js +1 -0
  196. package/package/database/node_modules/lodash/fp/entriesIn.js +1 -0
  197. package/package/database/node_modules/lodash/fp/eq.js +5 -0
  198. package/package/database/node_modules/lodash/fp/equals.js +1 -0
  199. package/package/database/node_modules/lodash/fp/escape.js +5 -0
  200. package/package/database/node_modules/lodash/fp/escapeRegExp.js +5 -0
  201. package/package/database/node_modules/lodash/fp/every.js +5 -0
  202. package/package/database/node_modules/lodash/fp/extend.js +1 -0
  203. package/package/database/node_modules/lodash/fp/extendAll.js +1 -0
  204. package/package/database/node_modules/lodash/fp/extendAllWith.js +1 -0
  205. package/package/database/node_modules/lodash/fp/extendWith.js +1 -0
  206. package/package/database/node_modules/lodash/fp/fill.js +5 -0
  207. package/package/database/node_modules/lodash/fp/filter.js +5 -0
  208. package/package/database/node_modules/lodash/fp/find.js +5 -0
  209. package/package/database/node_modules/lodash/fp/findFrom.js +5 -0
  210. package/package/database/node_modules/lodash/fp/findIndex.js +5 -0
  211. package/package/database/node_modules/lodash/fp/findIndexFrom.js +5 -0
  212. package/package/database/node_modules/lodash/fp/findKey.js +5 -0
  213. package/package/database/node_modules/lodash/fp/findLast.js +5 -0
  214. package/package/database/node_modules/lodash/fp.js +2 -0
  215. package/package/database/node_modules/lodash/fromPairs.js +28 -0
  216. package/package/database/node_modules/lodash/function.js +25 -0
  217. package/package/database/node_modules/lodash/functions.js +31 -0
  218. package/package/database/node_modules/lodash/functionsIn.js +31 -0
  219. package/package/database/node_modules/lodash/get.js +33 -0
  220. package/package/database/node_modules/node-fetch/CHANGELOG.md +266 -0
  221. package/package/database/node_modules/node-fetch/LICENSE.md +22 -0
  222. package/package/database/node_modules/node-fetch/README.md +583 -0
  223. package/package/database/node_modules/node-fetch/browser.js +23 -0
  224. package/package/database/node_modules/node-fetch/lib/index.es.js +1633 -0
  225. package/package/database/node_modules/node-fetch/lib/index.js +1642 -0
  226. package/package/database/node_modules/node-fetch/lib/index.mjs +1631 -0
  227. package/package/database/node_modules/node-fetch/package.json +70 -0
  228. package/package/database/node_modules/sqlite3/CHANGELOG.md +313 -0
  229. package/package/database/node_modules/sqlite3/CONTRIBUTING.md +57 -0
  230. package/package/database/node_modules/sqlite3/LICENSE +25 -0
  231. package/package/database/node_modules/sqlite3/README.md +259 -0
  232. package/package/database/node_modules/sqlite3/binding.gyp +66 -0
  233. package/package/database/node_modules/sqlite3/deps/common-sqlite.gypi +60 -0
  234. package/package/database/node_modules/sqlite3/deps/extract.js +10 -0
  235. package/package/database/node_modules/sqlite3/deps/sqlite-autoconf-3380200.tar.gz +0 -0
  236. package/package/database/node_modules/sqlite3/deps/sqlite3.gyp +121 -0
  237. package/package/database/node_modules/sqlite3/lib/binding/napi-v6-linux-x64/node_sqlite3.node +0 -0
  238. package/package/database/node_modules/sqlite3/lib/index.js +1 -0
  239. package/package/database/node_modules/sqlite3/lib/sqlite3-binding.js +5 -0
  240. package/package/database/node_modules/sqlite3/lib/sqlite3.js +205 -0
  241. package/package/database/node_modules/sqlite3/lib/trace.js +38 -0
  242. package/package/database/node_modules/sqlite3/package.json +82 -0
  243. package/package/database/node_modules/sqlite3/sqlite3.js +1 -0
  244. package/package/database/node_modules/sqlite3/src/async.h +82 -0
  245. package/package/database/node_modules/sqlite3/src/backup.cc +420 -0
  246. package/package/database/node_modules/sqlite3/src/backup.h +221 -0
  247. package/package/database/node_modules/sqlite3/src/database.cc +738 -0
  248. package/package/database/node_modules/sqlite3/src/database.h +206 -0
  249. package/package/database/node_modules/sqlite3/src/gcc-preinclude.h +6 -0
  250. package/package/database/node_modules/sqlite3/src/macros.h +212 -0
  251. package/package/database/node_modules/sqlite3/src/node_sqlite3.cc +115 -0
  252. package/package/database/node_modules/sqlite3/src/statement.cc +947 -0
  253. package/package/database/node_modules/sqlite3/src/statement.h +249 -0
  254. package/package/database/node_modules/sqlite3/src/threading.h +48 -0
  255. package/package/database/package.json +31 -0
  256. package/package/database/readme.md +8 -0
  257. package/package/database/test.js +3 -0
  258. package/package/horizon-sp/README.md +11 -0
  259. package/package/horizon-sp/index.js +41 -0
  260. package/package/horizon-sp/logger.js +16 -0
  261. package/package/horizon-sp/node_modules/.package-lock.json +140 -0
  262. package/package/horizon-sp/node_modules/asynckit/LICENSE +21 -0
  263. package/package/horizon-sp/node_modules/asynckit/README.md +233 -0
  264. package/package/horizon-sp/node_modules/asynckit/bench.js +76 -0
  265. package/package/horizon-sp/node_modules/asynckit/index.js +6 -0
  266. package/package/horizon-sp/node_modules/asynckit/lib/abort.js +29 -0
  267. package/package/horizon-sp/node_modules/asynckit/lib/async.js +34 -0
  268. package/package/horizon-sp/node_modules/asynckit/lib/defer.js +26 -0
  269. package/package/horizon-sp/node_modules/asynckit/lib/iterate.js +75 -0
  270. package/package/horizon-sp/node_modules/asynckit/lib/readable_asynckit.js +91 -0
  271. package/package/horizon-sp/node_modules/asynckit/lib/readable_parallel.js +25 -0
  272. package/package/horizon-sp/node_modules/asynckit/lib/readable_serial.js +25 -0
  273. package/package/horizon-sp/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
  274. package/package/horizon-sp/node_modules/asynckit/lib/state.js +37 -0
  275. package/package/horizon-sp/node_modules/asynckit/lib/streamify.js +141 -0
  276. package/package/horizon-sp/node_modules/asynckit/lib/terminator.js +29 -0
  277. package/package/horizon-sp/node_modules/asynckit/package.json +63 -0
  278. package/package/horizon-sp/node_modules/asynckit/parallel.js +43 -0
  279. package/package/horizon-sp/node_modules/asynckit/serial.js +17 -0
  280. package/package/horizon-sp/node_modules/asynckit/serialOrdered.js +75 -0
  281. package/package/horizon-sp/node_modules/asynckit/stream.js +21 -0
  282. package/package/horizon-sp/node_modules/axios/CHANGELOG.md +410 -0
  283. package/package/horizon-sp/node_modules/axios/LICENSE +7 -0
  284. package/package/horizon-sp/node_modules/axios/MIGRATION_GUIDE.md +3 -0
  285. package/package/horizon-sp/node_modules/axios/README.md +1310 -0
  286. package/package/horizon-sp/node_modules/axios/SECURITY.md +6 -0
  287. package/package/horizon-sp/node_modules/axios/index.d.cts +524 -0
  288. package/package/horizon-sp/node_modules/axios/index.d.ts +539 -0
  289. package/package/horizon-sp/node_modules/axios/index.js +41 -0
  290. package/package/horizon-sp/node_modules/axios/lib/adapters/README.md +37 -0
  291. package/package/horizon-sp/node_modules/axios/lib/adapters/adapters.js +59 -0
  292. package/package/horizon-sp/node_modules/axios/lib/adapters/http.js +608 -0
  293. package/package/horizon-sp/node_modules/axios/lib/adapters/xhr.js +249 -0
  294. package/package/horizon-sp/node_modules/axios/lib/axios.js +86 -0
  295. package/package/horizon-sp/node_modules/axios/lib/cancel/CancelToken.js +121 -0
  296. package/package/horizon-sp/node_modules/axios/lib/cancel/CanceledError.js +25 -0
  297. package/package/horizon-sp/node_modules/axios/lib/cancel/isCancel.js +5 -0
  298. package/package/horizon-sp/node_modules/axios/lib/core/Axios.js +197 -0
  299. package/package/horizon-sp/node_modules/axios/lib/core/AxiosError.js +100 -0
  300. package/package/horizon-sp/node_modules/axios/lib/core/AxiosHeaders.js +274 -0
  301. package/package/horizon-sp/node_modules/axios/lib/core/InterceptorManager.js +71 -0
  302. package/package/horizon-sp/node_modules/axios/lib/core/README.md +8 -0
  303. package/package/horizon-sp/node_modules/axios/lib/core/buildFullPath.js +21 -0
  304. package/package/horizon-sp/node_modules/axios/lib/core/dispatchRequest.js +81 -0
  305. package/package/horizon-sp/node_modules/axios/lib/core/mergeConfig.js +105 -0
  306. package/package/horizon-sp/node_modules/axios/lib/core/settle.js +27 -0
  307. package/package/horizon-sp/node_modules/axios/lib/core/transformData.js +28 -0
  308. package/package/horizon-sp/node_modules/axios/lib/defaults/index.js +166 -0
  309. package/package/horizon-sp/node_modules/axios/lib/defaults/transitional.js +7 -0
  310. package/package/horizon-sp/node_modules/axios/lib/env/README.md +3 -0
  311. package/package/horizon-sp/node_modules/axios/lib/env/classes/FormData.js +2 -0
  312. package/package/horizon-sp/node_modules/axios/lib/env/data.js +1 -0
  313. package/package/horizon-sp/node_modules/axios/lib/helpers/AxiosTransformStream.js +191 -0
  314. package/package/horizon-sp/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +58 -0
  315. package/package/horizon-sp/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
  316. package/package/horizon-sp/node_modules/axios/lib/helpers/README.md +7 -0
  317. package/package/horizon-sp/node_modules/axios/lib/helpers/bind.js +7 -0
  318. package/package/horizon-sp/node_modules/axios/lib/helpers/buildURL.js +63 -0
  319. package/package/horizon-sp/node_modules/axios/lib/helpers/combineURLs.js +15 -0
  320. package/package/horizon-sp/node_modules/axios/lib/helpers/cookies.js +52 -0
  321. package/package/horizon-sp/node_modules/axios/lib/helpers/deprecatedMethod.js +26 -0
  322. package/package/horizon-sp/node_modules/axios/lib/helpers/formDataToJSON.js +92 -0
  323. package/package/horizon-sp/node_modules/axios/lib/helpers/fromDataURI.js +53 -0
  324. package/package/horizon-sp/node_modules/axios/lib/helpers/isAbsoluteURL.js +15 -0
  325. package/package/horizon-sp/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
  326. package/package/horizon-sp/node_modules/axios/lib/helpers/isURLSameOrigin.js +67 -0
  327. package/package/horizon-sp/node_modules/axios/lib/helpers/null.js +2 -0
  328. package/package/horizon-sp/node_modules/axios/lib/helpers/parseHeaders.js +55 -0
  329. package/package/horizon-sp/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
  330. package/package/horizon-sp/node_modules/axios/lib/helpers/speedometer.js +55 -0
  331. package/package/horizon-sp/node_modules/axios/lib/helpers/spread.js +28 -0
  332. package/package/horizon-sp/node_modules/axios/lib/helpers/throttle.js +33 -0
  333. package/package/horizon-sp/node_modules/axios/lib/helpers/toFormData.js +229 -0
  334. package/package/horizon-sp/node_modules/axios/lib/helpers/toURLEncodedForm.js +18 -0
  335. package/package/horizon-sp/node_modules/axios/lib/helpers/validator.js +91 -0
  336. package/package/horizon-sp/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
  337. package/package/horizon-sp/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +4 -0
  338. package/package/horizon-sp/node_modules/axios/lib/platform/browser/index.js +63 -0
  339. package/package/horizon-sp/node_modules/axios/lib/platform/index.js +3 -0
  340. package/package/horizon-sp/node_modules/axios/lib/platform/node/classes/FormData.js +3 -0
  341. package/package/horizon-sp/node_modules/axios/lib/platform/node/classes/URLSearchParams.js +4 -0
  342. package/package/horizon-sp/node_modules/axios/lib/platform/node/index.js +12 -0
  343. package/package/horizon-sp/node_modules/axios/lib/utils.js +677 -0
  344. package/package/horizon-sp/node_modules/axios/package.json +197 -0
  345. package/package/horizon-sp/node_modules/child_process/README.md +9 -0
  346. package/package/horizon-sp/node_modules/child_process/package.json +20 -0
  347. package/package/horizon-sp/node_modules/combined-stream/License +19 -0
  348. package/package/horizon-sp/node_modules/combined-stream/Readme.md +138 -0
  349. package/package/horizon-sp/node_modules/combined-stream/lib/combined_stream.js +208 -0
  350. package/package/horizon-sp/node_modules/combined-stream/package.json +25 -0
  351. package/package/horizon-sp/node_modules/delayed-stream/License +19 -0
  352. package/package/horizon-sp/node_modules/delayed-stream/Makefile +7 -0
  353. package/package/horizon-sp/node_modules/delayed-stream/Readme.md +141 -0
  354. package/package/horizon-sp/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  355. package/package/horizon-sp/node_modules/delayed-stream/package.json +27 -0
  356. package/package/horizon-sp/node_modules/follow-redirects/LICENSE +18 -0
  357. package/package/horizon-sp/node_modules/follow-redirects/README.md +155 -0
  358. package/package/horizon-sp/node_modules/follow-redirects/debug.js +15 -0
  359. package/package/horizon-sp/node_modules/follow-redirects/http.js +1 -0
  360. package/package/horizon-sp/node_modules/follow-redirects/https.js +1 -0
  361. package/package/horizon-sp/node_modules/follow-redirects/index.js +621 -0
  362. package/package/horizon-sp/node_modules/follow-redirects/package.json +59 -0
  363. package/package/horizon-sp/node_modules/form-data/License +19 -0
  364. package/package/horizon-sp/node_modules/form-data/README.md.bak +358 -0
  365. package/package/horizon-sp/node_modules/form-data/Readme.md +358 -0
  366. package/package/horizon-sp/node_modules/form-data/index.d.ts +62 -0
  367. package/package/horizon-sp/node_modules/form-data/lib/browser.js +2 -0
  368. package/package/horizon-sp/node_modules/form-data/lib/form_data.js +501 -0
  369. package/package/horizon-sp/node_modules/form-data/lib/populate.js +10 -0
  370. package/package/horizon-sp/node_modules/form-data/package.json +68 -0
  371. package/package/horizon-sp/node_modules/fs-extra/LICENSE +15 -0
  372. package/package/horizon-sp/node_modules/fs-extra/README.md +290 -0
  373. package/package/horizon-sp/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
  374. package/package/horizon-sp/node_modules/fs-extra/lib/copy/copy.js +238 -0
  375. package/package/horizon-sp/node_modules/fs-extra/lib/copy/index.js +7 -0
  376. package/package/horizon-sp/node_modules/fs-extra/lib/empty/index.js +39 -0
  377. package/package/horizon-sp/node_modules/fs-extra/lib/ensure/file.js +69 -0
  378. package/package/horizon-sp/node_modules/fs-extra/lib/ensure/index.js +23 -0
  379. package/package/horizon-sp/node_modules/fs-extra/lib/ensure/link.js +64 -0
  380. package/package/horizon-sp/node_modules/fs-extra/lib/ensure/symlink-paths.js +99 -0
  381. package/package/horizon-sp/node_modules/fs-extra/lib/ensure/symlink-type.js +31 -0
  382. package/package/horizon-sp/node_modules/fs-extra/lib/ensure/symlink.js +82 -0
  383. package/package/horizon-sp/node_modules/fs-extra/lib/esm.mjs +68 -0
  384. package/package/horizon-sp/node_modules/fs-extra/lib/fs/index.js +140 -0
  385. package/package/horizon-sp/node_modules/fs-extra/lib/index.js +16 -0
  386. package/package/horizon-sp/node_modules/fs-extra/lib/json/index.js +16 -0
  387. package/package/horizon-sp/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  388. package/package/horizon-sp/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  389. package/package/horizon-sp/node_modules/fs-extra/lib/json/output-json.js +12 -0
  390. package/package/horizon-sp/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  391. package/package/horizon-sp/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  392. package/package/horizon-sp/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  393. package/package/horizon-sp/node_modules/fs-extra/lib/move/index.js +7 -0
  394. package/package/horizon-sp/node_modules/fs-extra/lib/move/move-sync.js +54 -0
  395. package/package/horizon-sp/node_modules/fs-extra/lib/move/move.js +75 -0
  396. package/package/horizon-sp/node_modules/fs-extra/lib/output-file/index.js +40 -0
  397. package/package/horizon-sp/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  398. package/package/horizon-sp/node_modules/fs-extra/lib/remove/index.js +17 -0
  399. package/package/horizon-sp/node_modules/fs-extra/lib/util/stat.js +154 -0
  400. package/package/horizon-sp/node_modules/fs-extra/lib/util/utimes.js +26 -0
  401. package/package/horizon-sp/node_modules/fs-extra/package.json +71 -0
  402. package/package/horizon-sp/node_modules/graceful-fs/LICENSE +15 -0
  403. package/package/horizon-sp/node_modules/graceful-fs/README.md +143 -0
  404. package/package/horizon-sp/node_modules/graceful-fs/clone.js +23 -0
  405. package/package/horizon-sp/node_modules/graceful-fs/graceful-fs.js +448 -0
  406. package/package/horizon-sp/node_modules/graceful-fs/legacy-streams.js +118 -0
  407. package/package/horizon-sp/node_modules/graceful-fs/package.json +50 -0
  408. package/package/horizon-sp/node_modules/graceful-fs/polyfills.js +355 -0
  409. package/package/horizon-sp/node_modules/jsonfile/CHANGELOG.md +171 -0
  410. package/package/horizon-sp/node_modules/jsonfile/LICENSE +15 -0
  411. package/package/horizon-sp/node_modules/jsonfile/README.md +230 -0
  412. package/package/horizon-sp/node_modules/jsonfile/index.js +88 -0
  413. package/package/horizon-sp/node_modules/jsonfile/package.json +40 -0
  414. package/package/horizon-sp/node_modules/jsonfile/utils.js +14 -0
  415. package/package/horizon-sp/node_modules/mime-db/HISTORY.md +507 -0
  416. package/package/horizon-sp/node_modules/mime-db/LICENSE +23 -0
  417. package/package/horizon-sp/node_modules/mime-db/README.md +100 -0
  418. package/package/horizon-sp/node_modules/mime-db/db.json +8519 -0
  419. package/package/horizon-sp/node_modules/mime-db/index.js +12 -0
  420. package/package/horizon-sp/node_modules/mime-db/package.json +60 -0
  421. package/package/horizon-sp/node_modules/mime-types/HISTORY.md +397 -0
  422. package/package/horizon-sp/node_modules/mime-types/LICENSE +23 -0
  423. package/package/horizon-sp/node_modules/mime-types/README.md +113 -0
  424. package/package/horizon-sp/node_modules/mime-types/index.js +188 -0
  425. package/package/horizon-sp/node_modules/mime-types/package.json +44 -0
  426. package/package/horizon-sp/node_modules/proxy-from-env/LICENSE +20 -0
  427. package/package/horizon-sp/node_modules/proxy-from-env/README.md +131 -0
  428. package/package/horizon-sp/node_modules/proxy-from-env/index.js +108 -0
  429. package/package/horizon-sp/node_modules/proxy-from-env/package.json +34 -0
  430. package/package/horizon-sp/node_modules/proxy-from-env/test.js +483 -0
  431. package/package/horizon-sp/node_modules/universalify/LICENSE +20 -0
  432. package/package/horizon-sp/node_modules/universalify/README.md +76 -0
  433. package/package/horizon-sp/node_modules/universalify/index.js +24 -0
  434. package/package/horizon-sp/node_modules/universalify/package.json +34 -0
  435. package/package/horizon-sp/package-lock.json +150 -0
  436. package/package/horizon-sp/package.json +20 -0
  437. package/package.json +134 -3
  438. package/src/ReportV1.js +55 -0
  439. package/src/addExternalModule.js +16 -0
  440. package/src/addUserToGroup.js +78 -0
  441. package/src/changeAdminStatus.js +79 -0
  442. package/src/changeArchivedStatus.js +41 -0
  443. package/src/changeAvt.js +86 -0
  444. package/src/changeBio.js +65 -0
  445. package/src/changeBlockedStatus.js +36 -0
  446. package/src/changeGroupImage.js +106 -0
  447. package/src/changeNickname.js +45 -0
  448. package/src/changeThreadColor.js +62 -0
  449. package/src/changeThreadEmoji.js +42 -0
  450. package/src/createNewGroup.js +70 -0
  451. package/src/createPoll.js +60 -0
  452. package/src/data/getThreadInfo.json +31985 -0
  453. package/src/deleteMessage.js +45 -0
  454. package/src/deleteThread.js +43 -0
  455. package/src/forwardAttachment.js +48 -0
  456. package/src/getAccessToken.js +33 -0
  457. package/src/getCurrentUserID.js +7 -0
  458. package/src/getEmojiUrl.js +27 -0
  459. package/src/getFriendsList.js +73 -0
  460. package/src/getMessage.js +80 -0
  461. package/src/getThreadHistory.js +537 -0
  462. package/src/getThreadHistoryDeprecated.js +71 -0
  463. package/src/getThreadInfo.js +193 -0
  464. package/src/getThreadInfoDeprecated.js +56 -0
  465. package/src/getThreadList.js +213 -0
  466. package/src/getThreadListDeprecated.js +46 -0
  467. package/src/getThreadMain.js +219 -0
  468. package/src/getThreadPictures.js +59 -0
  469. package/src/getUserID.js +62 -0
  470. package/src/getUserInfo.js +66 -0
  471. package/src/getUserInfoMain.js +65 -0
  472. package/src/getUserInfoV2.js +36 -0
  473. package/src/getUserInfoV3.js +63 -0
  474. package/src/getUserInfoV4.js +55 -0
  475. package/src/getUserInfoV5.js +61 -0
  476. package/src/handleFriendRequest.js +46 -0
  477. package/src/handleMessageRequest.js +49 -0
  478. package/src/httpGet.js +49 -0
  479. package/src/httpPost.js +48 -0
  480. package/src/httpPostFormData.js +41 -0
  481. package/src/listenMqtt.js +629 -0
  482. package/src/logout.js +68 -0
  483. package/src/markAsDelivered.js +48 -0
  484. package/src/markAsRead.js +70 -0
  485. package/src/markAsReadAll.js +43 -0
  486. package/src/markAsSeen.js +51 -0
  487. package/src/muteThread.js +47 -0
  488. package/src/removeUserFromGroup.js +49 -0
  489. package/src/resolvePhotoUrl.js +37 -0
  490. package/src/searchForThread.js +43 -0
  491. package/src/sendMessage.js +321 -0
  492. package/src/sendTypingIndicator.js +80 -0
  493. package/src/setMessageReaction.js +109 -0
  494. package/src/setPostReaction.js +102 -0
  495. package/src/setTitle.js +74 -0
  496. package/src/threadColors.js +39 -0
  497. package/src/unfriend.js +43 -0
  498. package/src/unsendMessage.js +40 -0
  499. package/test/example-config.json +18 -0
  500. package/test/test-page.js +140 -0
  501. package/test/test.js +385 -0
  502. package/utils.js +1246 -0
@@ -0,0 +1,290 @@
1
+ Node.js: fs-extra
2
+ =================
3
+
4
+ `fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`.
5
+
6
+ [![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)
7
+ [![License](https://img.shields.io/npm/l/fs-extra.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE)
8
+ [![build status](https://img.shields.io/github/workflow/status/jprichardson/node-fs-extra/Node.js%20CI/master)](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster)
9
+ [![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra)
10
+ [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
11
+
12
+ Why?
13
+ ----
14
+
15
+ I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects.
16
+
17
+
18
+
19
+
20
+ Installation
21
+ ------------
22
+
23
+ npm install fs-extra
24
+
25
+
26
+
27
+ Usage
28
+ -----
29
+
30
+ ### CommonJS
31
+
32
+ `fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed.
33
+
34
+ You don't ever need to include the original `fs` module again:
35
+
36
+ ```js
37
+ const fs = require('fs') // this is no longer necessary
38
+ ```
39
+
40
+ you can now do this:
41
+
42
+ ```js
43
+ const fs = require('fs-extra')
44
+ ```
45
+
46
+ or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want
47
+ to name your `fs` variable `fse` like so:
48
+
49
+ ```js
50
+ const fse = require('fs-extra')
51
+ ```
52
+
53
+ you can also keep both, but it's redundant:
54
+
55
+ ```js
56
+ const fs = require('fs')
57
+ const fse = require('fs-extra')
58
+ ```
59
+
60
+ ### ESM
61
+
62
+ There is also an `fs-extra/esm` import, that supports both default and named exports. However, note that `fs` methods are not included in `fs-extra/esm`; you still need to import `fs` and/or `fs/promises` seperately:
63
+
64
+ ```js
65
+ import { readFileSync } from 'fs'
66
+ import { readFile } from 'fs/promises'
67
+ import { outputFile, outputFileSync } from 'fs-extra/esm'
68
+ ```
69
+
70
+ Default exports are supported:
71
+
72
+ ```js
73
+ import fs from 'fs'
74
+ import fse from 'fs-extra/esm'
75
+ // fse.readFileSync is not a function; must use fs.readFileSync
76
+ ```
77
+
78
+ but you probably want to just use regular `fs-extra` instead of `fs-extra/esm` for default exports:
79
+
80
+ ```js
81
+ import fs from 'fs-extra'
82
+ // both fs and fs-extra methods are defined
83
+ ```
84
+
85
+ Sync vs Async vs Async/Await
86
+ -------------
87
+ Most methods are async by default. All async methods will return a promise if the callback isn't passed.
88
+
89
+ Sync methods on the other hand will throw if an error occurs.
90
+
91
+ Also Async/Await will throw an error if one occurs.
92
+
93
+ Example:
94
+
95
+ ```js
96
+ const fs = require('fs-extra')
97
+
98
+ // Async with promises:
99
+ fs.copy('/tmp/myfile', '/tmp/mynewfile')
100
+ .then(() => console.log('success!'))
101
+ .catch(err => console.error(err))
102
+
103
+ // Async with callbacks:
104
+ fs.copy('/tmp/myfile', '/tmp/mynewfile', err => {
105
+ if (err) return console.error(err)
106
+ console.log('success!')
107
+ })
108
+
109
+ // Sync:
110
+ try {
111
+ fs.copySync('/tmp/myfile', '/tmp/mynewfile')
112
+ console.log('success!')
113
+ } catch (err) {
114
+ console.error(err)
115
+ }
116
+
117
+ // Async/Await:
118
+ async function copyFiles () {
119
+ try {
120
+ await fs.copy('/tmp/myfile', '/tmp/mynewfile')
121
+ console.log('success!')
122
+ } catch (err) {
123
+ console.error(err)
124
+ }
125
+ }
126
+
127
+ copyFiles()
128
+ ```
129
+
130
+
131
+ Methods
132
+ -------
133
+
134
+ ### Async
135
+
136
+ - [copy](docs/copy.md)
137
+ - [emptyDir](docs/emptyDir.md)
138
+ - [ensureFile](docs/ensureFile.md)
139
+ - [ensureDir](docs/ensureDir.md)
140
+ - [ensureLink](docs/ensureLink.md)
141
+ - [ensureSymlink](docs/ensureSymlink.md)
142
+ - [mkdirp](docs/ensureDir.md)
143
+ - [mkdirs](docs/ensureDir.md)
144
+ - [move](docs/move.md)
145
+ - [outputFile](docs/outputFile.md)
146
+ - [outputJson](docs/outputJson.md)
147
+ - [pathExists](docs/pathExists.md)
148
+ - [readJson](docs/readJson.md)
149
+ - [remove](docs/remove.md)
150
+ - [writeJson](docs/writeJson.md)
151
+
152
+ ### Sync
153
+
154
+ - [copySync](docs/copy-sync.md)
155
+ - [emptyDirSync](docs/emptyDir-sync.md)
156
+ - [ensureFileSync](docs/ensureFile-sync.md)
157
+ - [ensureDirSync](docs/ensureDir-sync.md)
158
+ - [ensureLinkSync](docs/ensureLink-sync.md)
159
+ - [ensureSymlinkSync](docs/ensureSymlink-sync.md)
160
+ - [mkdirpSync](docs/ensureDir-sync.md)
161
+ - [mkdirsSync](docs/ensureDir-sync.md)
162
+ - [moveSync](docs/move-sync.md)
163
+ - [outputFileSync](docs/outputFile-sync.md)
164
+ - [outputJsonSync](docs/outputJson-sync.md)
165
+ - [pathExistsSync](docs/pathExists-sync.md)
166
+ - [readJsonSync](docs/readJson-sync.md)
167
+ - [removeSync](docs/remove-sync.md)
168
+ - [writeJsonSync](docs/writeJson-sync.md)
169
+
170
+
171
+ **NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()`, `fs.write()`, & `fs.writev()`](docs/fs-read-write-writev.md)
172
+
173
+ ### What happened to `walk()` and `walkSync()`?
174
+
175
+ They were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync).
176
+
177
+
178
+ Third Party
179
+ -----------
180
+
181
+ ### CLI
182
+
183
+ [fse-cli](https://www.npmjs.com/package/@atao60/fse-cli) allows you to run `fs-extra` from a console or from [npm](https://www.npmjs.com) scripts.
184
+
185
+ ### TypeScript
186
+
187
+ If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra
188
+
189
+
190
+ ### File / Directory Watching
191
+
192
+ If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar).
193
+
194
+ ### Obtain Filesystem (Devices, Partitions) Information
195
+
196
+ [fs-filesystem](https://github.com/arthurintelligence/node-fs-filesystem) allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system.
197
+
198
+ ### Misc.
199
+
200
+ - [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug).
201
+ - [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls.
202
+
203
+
204
+
205
+ Hacking on fs-extra
206
+ -------------------
207
+
208
+ Wanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project
209
+ uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you,
210
+ you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`.
211
+
212
+ [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
213
+
214
+ What's needed?
215
+ - First, take a look at existing issues. Those are probably going to be where the priority lies.
216
+ - More tests for edge cases. Specifically on different platforms. There can never be enough tests.
217
+ - Improve test coverage.
218
+
219
+ Note: If you make any big changes, **you should definitely file an issue for discussion first.**
220
+
221
+ ### Running the Test Suite
222
+
223
+ fs-extra contains hundreds of tests.
224
+
225
+ - `npm run lint`: runs the linter ([standard](http://standardjs.com/))
226
+ - `npm run unit`: runs the unit tests
227
+ - `npm run unit-esm`: runs tests for `fs-extra/esm` exports
228
+ - `npm test`: runs the linter and all tests
229
+
230
+
231
+ ### Windows
232
+
233
+ If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's
234
+ because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's
235
+ account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7
236
+ However, I didn't have much luck doing this.
237
+
238
+ Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows.
239
+ I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command:
240
+
241
+ net use z: "\\vmware-host\Shared Folders"
242
+
243
+ I can then navigate to my `fs-extra` directory and run the tests.
244
+
245
+
246
+ Naming
247
+ ------
248
+
249
+ I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here:
250
+
251
+ * https://github.com/jprichardson/node-fs-extra/issues/2
252
+ * https://github.com/flatiron/utile/issues/11
253
+ * https://github.com/ryanmcgrath/wrench-js/issues/29
254
+ * https://github.com/substack/node-mkdirp/issues/17
255
+
256
+ First, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes.
257
+
258
+ For example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc.
259
+
260
+ We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`?
261
+
262
+ My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too.
263
+
264
+ So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`.
265
+
266
+
267
+ Credit
268
+ ------
269
+
270
+ `fs-extra` wouldn't be possible without using the modules from the following authors:
271
+
272
+ - [Isaac Shlueter](https://github.com/isaacs)
273
+ - [Charlie McConnel](https://github.com/avianflu)
274
+ - [James Halliday](https://github.com/substack)
275
+ - [Andrew Kelley](https://github.com/andrewrk)
276
+
277
+
278
+
279
+
280
+ License
281
+ -------
282
+
283
+ Licensed under MIT
284
+
285
+ Copyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson)
286
+
287
+ [1]: http://nodejs.org/docs/latest/api/fs.html
288
+
289
+
290
+ [jsonfile]: https://github.com/jprichardson/node-jsonfile
@@ -0,0 +1,161 @@
1
+ 'use strict'
2
+
3
+ const fs = require('graceful-fs')
4
+ const path = require('path')
5
+ const mkdirsSync = require('../mkdirs').mkdirsSync
6
+ const utimesMillisSync = require('../util/utimes').utimesMillisSync
7
+ const stat = require('../util/stat')
8
+
9
+ function copySync (src, dest, opts) {
10
+ if (typeof opts === 'function') {
11
+ opts = { filter: opts }
12
+ }
13
+
14
+ opts = opts || {}
15
+ opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
16
+ opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
17
+
18
+ // Warn about using preserveTimestamps on 32-bit node
19
+ if (opts.preserveTimestamps && process.arch === 'ia32') {
20
+ process.emitWarning(
21
+ 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
22
+ '\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
23
+ 'Warning', 'fs-extra-WARN0002'
24
+ )
25
+ }
26
+
27
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
28
+ stat.checkParentPathsSync(src, srcStat, dest, 'copy')
29
+ if (opts.filter && !opts.filter(src, dest)) return
30
+ const destParent = path.dirname(dest)
31
+ if (!fs.existsSync(destParent)) mkdirsSync(destParent)
32
+ return getStats(destStat, src, dest, opts)
33
+ }
34
+
35
+ function getStats (destStat, src, dest, opts) {
36
+ const statSync = opts.dereference ? fs.statSync : fs.lstatSync
37
+ const srcStat = statSync(src)
38
+
39
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)
40
+ else if (srcStat.isFile() ||
41
+ srcStat.isCharacterDevice() ||
42
+ srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
43
+ else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
44
+ else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
45
+ else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
46
+ throw new Error(`Unknown file: ${src}`)
47
+ }
48
+
49
+ function onFile (srcStat, destStat, src, dest, opts) {
50
+ if (!destStat) return copyFile(srcStat, src, dest, opts)
51
+ return mayCopyFile(srcStat, src, dest, opts)
52
+ }
53
+
54
+ function mayCopyFile (srcStat, src, dest, opts) {
55
+ if (opts.overwrite) {
56
+ fs.unlinkSync(dest)
57
+ return copyFile(srcStat, src, dest, opts)
58
+ } else if (opts.errorOnExist) {
59
+ throw new Error(`'${dest}' already exists`)
60
+ }
61
+ }
62
+
63
+ function copyFile (srcStat, src, dest, opts) {
64
+ fs.copyFileSync(src, dest)
65
+ if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)
66
+ return setDestMode(dest, srcStat.mode)
67
+ }
68
+
69
+ function handleTimestamps (srcMode, src, dest) {
70
+ // Make sure the file is writable before setting the timestamp
71
+ // otherwise open fails with EPERM when invoked with 'r+'
72
+ // (through utimes call)
73
+ if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)
74
+ return setDestTimestamps(src, dest)
75
+ }
76
+
77
+ function fileIsNotWritable (srcMode) {
78
+ return (srcMode & 0o200) === 0
79
+ }
80
+
81
+ function makeFileWritable (dest, srcMode) {
82
+ return setDestMode(dest, srcMode | 0o200)
83
+ }
84
+
85
+ function setDestMode (dest, srcMode) {
86
+ return fs.chmodSync(dest, srcMode)
87
+ }
88
+
89
+ function setDestTimestamps (src, dest) {
90
+ // The initial srcStat.atime cannot be trusted
91
+ // because it is modified by the read(2) system call
92
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
93
+ const updatedSrcStat = fs.statSync(src)
94
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)
95
+ }
96
+
97
+ function onDir (srcStat, destStat, src, dest, opts) {
98
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
99
+ return copyDir(src, dest, opts)
100
+ }
101
+
102
+ function mkDirAndCopy (srcMode, src, dest, opts) {
103
+ fs.mkdirSync(dest)
104
+ copyDir(src, dest, opts)
105
+ return setDestMode(dest, srcMode)
106
+ }
107
+
108
+ function copyDir (src, dest, opts) {
109
+ fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))
110
+ }
111
+
112
+ function copyDirItem (item, src, dest, opts) {
113
+ const srcItem = path.join(src, item)
114
+ const destItem = path.join(dest, item)
115
+ if (opts.filter && !opts.filter(srcItem, destItem)) return
116
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
117
+ return getStats(destStat, srcItem, destItem, opts)
118
+ }
119
+
120
+ function onLink (destStat, src, dest, opts) {
121
+ let resolvedSrc = fs.readlinkSync(src)
122
+ if (opts.dereference) {
123
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
124
+ }
125
+
126
+ if (!destStat) {
127
+ return fs.symlinkSync(resolvedSrc, dest)
128
+ } else {
129
+ let resolvedDest
130
+ try {
131
+ resolvedDest = fs.readlinkSync(dest)
132
+ } catch (err) {
133
+ // dest exists and is a regular file or directory,
134
+ // Windows may throw UNKNOWN error. If dest already exists,
135
+ // fs throws error anyway, so no need to guard against it here.
136
+ if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)
137
+ throw err
138
+ }
139
+ if (opts.dereference) {
140
+ resolvedDest = path.resolve(process.cwd(), resolvedDest)
141
+ }
142
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
143
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)
144
+ }
145
+
146
+ // prevent copy if src is a subdir of dest since unlinking
147
+ // dest in this case would result in removing src contents
148
+ // and therefore a broken symlink would be created.
149
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
150
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)
151
+ }
152
+ return copyLink(resolvedSrc, dest)
153
+ }
154
+ }
155
+
156
+ function copyLink (resolvedSrc, dest) {
157
+ fs.unlinkSync(dest)
158
+ return fs.symlinkSync(resolvedSrc, dest)
159
+ }
160
+
161
+ module.exports = copySync
@@ -0,0 +1,238 @@
1
+ 'use strict'
2
+
3
+ const fs = require('graceful-fs')
4
+ const path = require('path')
5
+ const mkdirs = require('../mkdirs').mkdirs
6
+ const pathExists = require('../path-exists').pathExists
7
+ const utimesMillis = require('../util/utimes').utimesMillis
8
+ const stat = require('../util/stat')
9
+
10
+ function copy (src, dest, opts, cb) {
11
+ if (typeof opts === 'function' && !cb) {
12
+ cb = opts
13
+ opts = {}
14
+ } else if (typeof opts === 'function') {
15
+ opts = { filter: opts }
16
+ }
17
+
18
+ cb = cb || function () {}
19
+ opts = opts || {}
20
+
21
+ opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now
22
+ opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber
23
+
24
+ // Warn about using preserveTimestamps on 32-bit node
25
+ if (opts.preserveTimestamps && process.arch === 'ia32') {
26
+ process.emitWarning(
27
+ 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
28
+ '\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
29
+ 'Warning', 'fs-extra-WARN0001'
30
+ )
31
+ }
32
+
33
+ stat.checkPaths(src, dest, 'copy', opts, (err, stats) => {
34
+ if (err) return cb(err)
35
+ const { srcStat, destStat } = stats
36
+ stat.checkParentPaths(src, srcStat, dest, 'copy', err => {
37
+ if (err) return cb(err)
38
+ runFilter(src, dest, opts, (err, include) => {
39
+ if (err) return cb(err)
40
+ if (!include) return cb()
41
+
42
+ checkParentDir(destStat, src, dest, opts, cb)
43
+ })
44
+ })
45
+ })
46
+ }
47
+
48
+ function checkParentDir (destStat, src, dest, opts, cb) {
49
+ const destParent = path.dirname(dest)
50
+ pathExists(destParent, (err, dirExists) => {
51
+ if (err) return cb(err)
52
+ if (dirExists) return getStats(destStat, src, dest, opts, cb)
53
+ mkdirs(destParent, err => {
54
+ if (err) return cb(err)
55
+ return getStats(destStat, src, dest, opts, cb)
56
+ })
57
+ })
58
+ }
59
+
60
+ function runFilter (src, dest, opts, cb) {
61
+ if (!opts.filter) return cb(null, true)
62
+ Promise.resolve(opts.filter(src, dest))
63
+ .then(include => cb(null, include), error => cb(error))
64
+ }
65
+
66
+ function getStats (destStat, src, dest, opts, cb) {
67
+ const stat = opts.dereference ? fs.stat : fs.lstat
68
+ stat(src, (err, srcStat) => {
69
+ if (err) return cb(err)
70
+
71
+ if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb)
72
+ else if (srcStat.isFile() ||
73
+ srcStat.isCharacterDevice() ||
74
+ srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb)
75
+ else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb)
76
+ else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`))
77
+ else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`))
78
+ return cb(new Error(`Unknown file: ${src}`))
79
+ })
80
+ }
81
+
82
+ function onFile (srcStat, destStat, src, dest, opts, cb) {
83
+ if (!destStat) return copyFile(srcStat, src, dest, opts, cb)
84
+ return mayCopyFile(srcStat, src, dest, opts, cb)
85
+ }
86
+
87
+ function mayCopyFile (srcStat, src, dest, opts, cb) {
88
+ if (opts.overwrite) {
89
+ fs.unlink(dest, err => {
90
+ if (err) return cb(err)
91
+ return copyFile(srcStat, src, dest, opts, cb)
92
+ })
93
+ } else if (opts.errorOnExist) {
94
+ return cb(new Error(`'${dest}' already exists`))
95
+ } else return cb()
96
+ }
97
+
98
+ function copyFile (srcStat, src, dest, opts, cb) {
99
+ fs.copyFile(src, dest, err => {
100
+ if (err) return cb(err)
101
+ if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb)
102
+ return setDestMode(dest, srcStat.mode, cb)
103
+ })
104
+ }
105
+
106
+ function handleTimestampsAndMode (srcMode, src, dest, cb) {
107
+ // Make sure the file is writable before setting the timestamp
108
+ // otherwise open fails with EPERM when invoked with 'r+'
109
+ // (through utimes call)
110
+ if (fileIsNotWritable(srcMode)) {
111
+ return makeFileWritable(dest, srcMode, err => {
112
+ if (err) return cb(err)
113
+ return setDestTimestampsAndMode(srcMode, src, dest, cb)
114
+ })
115
+ }
116
+ return setDestTimestampsAndMode(srcMode, src, dest, cb)
117
+ }
118
+
119
+ function fileIsNotWritable (srcMode) {
120
+ return (srcMode & 0o200) === 0
121
+ }
122
+
123
+ function makeFileWritable (dest, srcMode, cb) {
124
+ return setDestMode(dest, srcMode | 0o200, cb)
125
+ }
126
+
127
+ function setDestTimestampsAndMode (srcMode, src, dest, cb) {
128
+ setDestTimestamps(src, dest, err => {
129
+ if (err) return cb(err)
130
+ return setDestMode(dest, srcMode, cb)
131
+ })
132
+ }
133
+
134
+ function setDestMode (dest, srcMode, cb) {
135
+ return fs.chmod(dest, srcMode, cb)
136
+ }
137
+
138
+ function setDestTimestamps (src, dest, cb) {
139
+ // The initial srcStat.atime cannot be trusted
140
+ // because it is modified by the read(2) system call
141
+ // (See https://nodejs.org/api/fs.html#fs_stat_time_values)
142
+ fs.stat(src, (err, updatedSrcStat) => {
143
+ if (err) return cb(err)
144
+ return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb)
145
+ })
146
+ }
147
+
148
+ function onDir (srcStat, destStat, src, dest, opts, cb) {
149
+ if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb)
150
+ return copyDir(src, dest, opts, cb)
151
+ }
152
+
153
+ function mkDirAndCopy (srcMode, src, dest, opts, cb) {
154
+ fs.mkdir(dest, err => {
155
+ if (err) return cb(err)
156
+ copyDir(src, dest, opts, err => {
157
+ if (err) return cb(err)
158
+ return setDestMode(dest, srcMode, cb)
159
+ })
160
+ })
161
+ }
162
+
163
+ function copyDir (src, dest, opts, cb) {
164
+ fs.readdir(src, (err, items) => {
165
+ if (err) return cb(err)
166
+ return copyDirItems(items, src, dest, opts, cb)
167
+ })
168
+ }
169
+
170
+ function copyDirItems (items, src, dest, opts, cb) {
171
+ const item = items.pop()
172
+ if (!item) return cb()
173
+ return copyDirItem(items, item, src, dest, opts, cb)
174
+ }
175
+
176
+ function copyDirItem (items, item, src, dest, opts, cb) {
177
+ const srcItem = path.join(src, item)
178
+ const destItem = path.join(dest, item)
179
+ runFilter(srcItem, destItem, opts, (err, include) => {
180
+ if (err) return cb(err)
181
+ if (!include) return copyDirItems(items, src, dest, opts, cb)
182
+
183
+ stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {
184
+ if (err) return cb(err)
185
+ const { destStat } = stats
186
+ getStats(destStat, srcItem, destItem, opts, err => {
187
+ if (err) return cb(err)
188
+ return copyDirItems(items, src, dest, opts, cb)
189
+ })
190
+ })
191
+ })
192
+ }
193
+
194
+ function onLink (destStat, src, dest, opts, cb) {
195
+ fs.readlink(src, (err, resolvedSrc) => {
196
+ if (err) return cb(err)
197
+ if (opts.dereference) {
198
+ resolvedSrc = path.resolve(process.cwd(), resolvedSrc)
199
+ }
200
+
201
+ if (!destStat) {
202
+ return fs.symlink(resolvedSrc, dest, cb)
203
+ } else {
204
+ fs.readlink(dest, (err, resolvedDest) => {
205
+ if (err) {
206
+ // dest exists and is a regular file or directory,
207
+ // Windows may throw UNKNOWN error. If dest already exists,
208
+ // fs throws error anyway, so no need to guard against it here.
209
+ if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb)
210
+ return cb(err)
211
+ }
212
+ if (opts.dereference) {
213
+ resolvedDest = path.resolve(process.cwd(), resolvedDest)
214
+ }
215
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
216
+ return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))
217
+ }
218
+
219
+ // do not copy if src is a subdir of dest since unlinking
220
+ // dest in this case would result in removing src contents
221
+ // and therefore a broken symlink would be created.
222
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
223
+ return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))
224
+ }
225
+ return copyLink(resolvedSrc, dest, cb)
226
+ })
227
+ }
228
+ })
229
+ }
230
+
231
+ function copyLink (resolvedSrc, dest, cb) {
232
+ fs.unlink(dest, err => {
233
+ if (err) return cb(err)
234
+ return fs.symlink(resolvedSrc, dest, cb)
235
+ })
236
+ }
237
+
238
+ module.exports = copy
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ const u = require('universalify').fromCallback
4
+ module.exports = {
5
+ copy: u(require('./copy')),
6
+ copySync: require('./copy-sync')
7
+ }