@mx-space/api-client 1.0.0 → 1.0.2

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 (446) hide show
  1. package/.eslintcache +1 -1
  2. package/LICENSE +661 -0
  3. package/controllers/recently.ts +24 -3
  4. package/dist/index.cjs +18 -0
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.js +18 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.min.cjs +1 -1
  9. package/dist/index.min.cjs.map +1 -1
  10. package/dist/index.min.js +1 -1
  11. package/dist/index.min.js.map +1 -1
  12. package/dist/index.umd.js +18 -0
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/index.umd.min.js +1 -1
  15. package/dist/index.umd.min.js.map +1 -1
  16. package/esm/adaptors/axios.d.ts +4 -0
  17. package/esm/adaptors/axios.js +37 -0
  18. package/esm/adaptors/axios.js.map +1 -0
  19. package/esm/adaptors/ky.d.ts +23 -0
  20. package/esm/adaptors/ky.js +62 -0
  21. package/esm/adaptors/ky.js.map +1 -0
  22. package/esm/adaptors/umi-request.d.ts +4 -0
  23. package/esm/adaptors/umi-request.js +31 -0
  24. package/esm/adaptors/umi-request.js.map +1 -0
  25. package/esm/controllers/aggregate.d.ts +64 -0
  26. package/esm/controllers/aggregate.js +42 -0
  27. package/esm/controllers/aggregate.js.map +1 -0
  28. package/esm/controllers/base.d.ts +43 -0
  29. package/esm/controllers/base.js +27 -0
  30. package/esm/controllers/base.js.map +1 -0
  31. package/esm/controllers/category.d.ts +114 -0
  32. package/esm/controllers/category.js +68 -0
  33. package/esm/controllers/category.js.map +1 -0
  34. package/esm/controllers/comment.d.ts +81 -0
  35. package/esm/controllers/comment.js +47 -0
  36. package/esm/controllers/comment.js.map +1 -0
  37. package/esm/controllers/index.d.ts +18 -0
  38. package/esm/controllers/index.js +55 -0
  39. package/esm/controllers/index.js.map +1 -0
  40. package/esm/controllers/link.d.ts +20 -0
  41. package/esm/controllers/link.js +21 -0
  42. package/esm/controllers/link.js.map +1 -0
  43. package/esm/controllers/note.d.ts +123 -0
  44. package/esm/controllers/note.js +68 -0
  45. package/esm/controllers/note.js.map +1 -0
  46. package/esm/controllers/page.d.ts +59 -0
  47. package/esm/controllers/page.js +42 -0
  48. package/esm/controllers/page.js.map +1 -0
  49. package/esm/controllers/post.d.ts +72 -0
  50. package/esm/controllers/post.js +52 -0
  51. package/esm/controllers/post.js.map +1 -0
  52. package/esm/controllers/project.d.ts +15 -0
  53. package/esm/controllers/project.js +12 -0
  54. package/esm/controllers/project.js.map +1 -0
  55. package/esm/controllers/recently.d.ts +110 -0
  56. package/esm/controllers/recently.js +49 -0
  57. package/esm/controllers/recently.js.map +1 -0
  58. package/esm/controllers/say.d.ts +37 -0
  59. package/esm/controllers/say.js +21 -0
  60. package/esm/controllers/say.js.map +1 -0
  61. package/esm/controllers/search.d.ts +247 -0
  62. package/esm/controllers/search.js +28 -0
  63. package/esm/controllers/search.js.map +1 -0
  64. package/esm/controllers/severless.d.ts +24 -0
  65. package/esm/controllers/severless.js +16 -0
  66. package/esm/controllers/severless.js.map +1 -0
  67. package/esm/controllers/snippet.d.ts +24 -0
  68. package/esm/controllers/snippet.js +19 -0
  69. package/esm/controllers/snippet.js.map +1 -0
  70. package/esm/controllers/topic.d.ts +26 -0
  71. package/esm/controllers/topic.js +18 -0
  72. package/esm/controllers/topic.js.map +1 -0
  73. package/esm/controllers/user.d.ts +70 -0
  74. package/esm/controllers/user.js +40 -0
  75. package/esm/controllers/user.js.map +1 -0
  76. package/esm/core/attach-request.d.ts +2 -0
  77. package/esm/core/attach-request.js +36 -0
  78. package/esm/core/attach-request.js.map +1 -0
  79. package/esm/core/client.d.ts +29 -0
  80. package/esm/core/client.js +186 -0
  81. package/esm/core/client.js.map +1 -0
  82. package/esm/core/error.d.ts +6 -0
  83. package/esm/core/error.js +9 -0
  84. package/esm/core/error.js.map +1 -0
  85. package/esm/core/index.d.ts +2 -0
  86. package/esm/core/index.js +3 -0
  87. package/esm/core/index.js.map +1 -0
  88. package/esm/dtos/comment.d.ts +6 -0
  89. package/esm/dtos/comment.js +3 -0
  90. package/esm/dtos/comment.js.map +1 -0
  91. package/esm/index.d.ts +7 -0
  92. package/esm/index.js +8 -0
  93. package/esm/index.js.map +1 -0
  94. package/esm/interfaces/adapter.d.ts +14 -0
  95. package/esm/interfaces/adapter.js +2 -0
  96. package/esm/interfaces/adapter.js.map +1 -0
  97. package/esm/interfaces/client.d.ts +13 -0
  98. package/esm/interfaces/client.js +2 -0
  99. package/esm/interfaces/client.js.map +1 -0
  100. package/esm/interfaces/controller.d.ts +4 -0
  101. package/esm/interfaces/controller.js +2 -0
  102. package/esm/interfaces/controller.js.map +1 -0
  103. package/esm/interfaces/instance.d.ts +7 -0
  104. package/esm/interfaces/instance.js +2 -0
  105. package/esm/interfaces/instance.js.map +1 -0
  106. package/esm/interfaces/options.d.ts +1 -0
  107. package/esm/interfaces/options.js +2 -0
  108. package/esm/interfaces/options.js.map +1 -0
  109. package/esm/interfaces/params.d.ts +4 -0
  110. package/esm/interfaces/params.js +2 -0
  111. package/esm/interfaces/params.js.map +1 -0
  112. package/esm/interfaces/request.d.ts +43 -0
  113. package/esm/interfaces/request.js +2 -0
  114. package/esm/interfaces/request.js.map +1 -0
  115. package/esm/interfaces/types.d.ts +2 -0
  116. package/esm/interfaces/types.js +2 -0
  117. package/esm/interfaces/types.js.map +1 -0
  118. package/esm/models/aggregate.d.ts +53 -0
  119. package/esm/models/aggregate.js +6 -0
  120. package/esm/models/aggregate.js.map +1 -0
  121. package/esm/models/base.d.ts +41 -0
  122. package/esm/models/base.js +2 -0
  123. package/esm/models/base.js.map +1 -0
  124. package/esm/models/category.d.ts +22 -0
  125. package/esm/models/category.js +6 -0
  126. package/esm/models/category.js.map +1 -0
  127. package/esm/models/comment.d.ts +37 -0
  128. package/esm/models/comment.js +13 -0
  129. package/esm/models/comment.js.map +1 -0
  130. package/esm/models/index.d.ts +14 -0
  131. package/esm/models/index.js +15 -0
  132. package/esm/models/index.js.map +1 -0
  133. package/esm/models/link.d.ts +22 -0
  134. package/esm/models/link.js +14 -0
  135. package/esm/models/link.js.map +1 -0
  136. package/esm/models/note.d.ts +38 -0
  137. package/esm/models/note.js +2 -0
  138. package/esm/models/note.js.map +1 -0
  139. package/esm/models/page.d.ts +14 -0
  140. package/esm/models/page.js +7 -0
  141. package/esm/models/page.js.map +1 -0
  142. package/esm/models/post.d.ts +17 -0
  143. package/esm/models/post.js +2 -0
  144. package/esm/models/post.js.map +1 -0
  145. package/esm/models/project.d.ts +11 -0
  146. package/esm/models/project.js +2 -0
  147. package/esm/models/project.js.map +1 -0
  148. package/esm/models/recently.d.ts +20 -0
  149. package/esm/models/recently.js +7 -0
  150. package/esm/models/recently.js.map +1 -0
  151. package/esm/models/say.d.ts +6 -0
  152. package/esm/models/say.js +2 -0
  153. package/esm/models/say.js.map +1 -0
  154. package/esm/models/setting.d.ts +66 -0
  155. package/esm/models/setting.js +2 -0
  156. package/esm/models/setting.js.map +1 -0
  157. package/esm/models/snippet.d.ts +18 -0
  158. package/esm/models/snippet.js +8 -0
  159. package/esm/models/snippet.js.map +1 -0
  160. package/esm/models/topic.d.ts +8 -0
  161. package/esm/models/topic.js +2 -0
  162. package/esm/models/topic.js.map +1 -0
  163. package/esm/models/user.d.ts +21 -0
  164. package/esm/models/user.js +2 -0
  165. package/esm/models/user.js.map +1 -0
  166. package/esm/utils/auto-bind.d.ts +4 -0
  167. package/esm/utils/auto-bind.js +36 -0
  168. package/esm/utils/auto-bind.js.map +1 -0
  169. package/esm/utils/camelcase-keys.d.ts +6 -0
  170. package/esm/utils/camelcase-keys.js +23 -0
  171. package/esm/utils/camelcase-keys.js.map +1 -0
  172. package/esm/utils/index.d.ts +5 -0
  173. package/esm/utils/index.js +43 -0
  174. package/esm/utils/index.js.map +1 -0
  175. package/esm/utils/path.d.ts +1 -0
  176. package/esm/utils/path.js +7 -0
  177. package/esm/utils/path.js.map +1 -0
  178. package/esm/vitest.config.d.ts +2 -0
  179. package/esm/vitest.config.js +12 -0
  180. package/esm/vitest.config.js.map +1 -0
  181. package/lib/adaptors/axios.d.ts +4 -0
  182. package/lib/adaptors/axios.js +43 -0
  183. package/lib/adaptors/axios.js.map +1 -0
  184. package/lib/adaptors/ky.d.ts +23 -0
  185. package/lib/adaptors/ky.js +69 -0
  186. package/lib/adaptors/ky.js.map +1 -0
  187. package/lib/adaptors/umi-request.d.ts +4 -0
  188. package/lib/adaptors/umi-request.js +34 -0
  189. package/lib/adaptors/umi-request.js.map +1 -0
  190. package/lib/controllers/aggregate.d.ts +64 -0
  191. package/lib/controllers/aggregate.js +46 -0
  192. package/lib/controllers/aggregate.js.map +1 -0
  193. package/lib/controllers/base.d.ts +43 -0
  194. package/lib/controllers/base.js +31 -0
  195. package/lib/controllers/base.js.map +1 -0
  196. package/lib/controllers/category.d.ts +114 -0
  197. package/lib/controllers/category.js +72 -0
  198. package/lib/controllers/category.js.map +1 -0
  199. package/lib/controllers/comment.d.ts +81 -0
  200. package/lib/controllers/comment.js +51 -0
  201. package/lib/controllers/comment.js.map +1 -0
  202. package/lib/controllers/index.d.ts +18 -0
  203. package/lib/controllers/index.js +72 -0
  204. package/lib/controllers/index.js.map +1 -0
  205. package/lib/controllers/link.d.ts +20 -0
  206. package/lib/controllers/link.js +25 -0
  207. package/lib/controllers/link.js.map +1 -0
  208. package/lib/controllers/note.d.ts +123 -0
  209. package/lib/controllers/note.js +72 -0
  210. package/lib/controllers/note.js.map +1 -0
  211. package/lib/controllers/page.d.ts +59 -0
  212. package/lib/controllers/page.js +46 -0
  213. package/lib/controllers/page.js.map +1 -0
  214. package/lib/controllers/post.d.ts +72 -0
  215. package/lib/controllers/post.js +56 -0
  216. package/lib/controllers/post.js.map +1 -0
  217. package/lib/controllers/project.d.ts +15 -0
  218. package/lib/controllers/project.js +16 -0
  219. package/lib/controllers/project.js.map +1 -0
  220. package/lib/controllers/recently.d.ts +110 -0
  221. package/lib/controllers/recently.js +53 -0
  222. package/lib/controllers/recently.js.map +1 -0
  223. package/lib/controllers/say.d.ts +37 -0
  224. package/lib/controllers/say.js +25 -0
  225. package/lib/controllers/say.js.map +1 -0
  226. package/lib/controllers/search.d.ts +247 -0
  227. package/lib/controllers/search.js +32 -0
  228. package/lib/controllers/search.js.map +1 -0
  229. package/lib/controllers/severless.d.ts +24 -0
  230. package/lib/controllers/severless.js +20 -0
  231. package/lib/controllers/severless.js.map +1 -0
  232. package/lib/controllers/snippet.d.ts +24 -0
  233. package/lib/controllers/snippet.js +23 -0
  234. package/lib/controllers/snippet.js.map +1 -0
  235. package/lib/controllers/topic.d.ts +26 -0
  236. package/lib/controllers/topic.js +22 -0
  237. package/lib/controllers/topic.js.map +1 -0
  238. package/lib/controllers/user.d.ts +70 -0
  239. package/lib/controllers/user.js +44 -0
  240. package/lib/controllers/user.js.map +1 -0
  241. package/lib/core/attach-request.d.ts +2 -0
  242. package/lib/core/attach-request.js +40 -0
  243. package/lib/core/attach-request.js.map +1 -0
  244. package/lib/core/client.d.ts +29 -0
  245. package/lib/core/client.js +190 -0
  246. package/lib/core/client.js.map +1 -0
  247. package/lib/core/error.d.ts +6 -0
  248. package/lib/core/error.js +13 -0
  249. package/lib/core/error.js.map +1 -0
  250. package/lib/core/index.d.ts +2 -0
  251. package/lib/core/index.js +19 -0
  252. package/lib/core/index.js.map +1 -0
  253. package/lib/dtos/comment.d.ts +6 -0
  254. package/lib/dtos/comment.js +7 -0
  255. package/lib/dtos/comment.js.map +1 -0
  256. package/lib/index.d.ts +7 -0
  257. package/lib/index.js +28 -0
  258. package/lib/index.js.map +1 -0
  259. package/lib/interfaces/adapter.d.ts +14 -0
  260. package/lib/interfaces/adapter.js +3 -0
  261. package/lib/interfaces/adapter.js.map +1 -0
  262. package/lib/interfaces/client.d.ts +13 -0
  263. package/lib/interfaces/client.js +3 -0
  264. package/lib/interfaces/client.js.map +1 -0
  265. package/lib/interfaces/controller.d.ts +4 -0
  266. package/lib/interfaces/controller.js +3 -0
  267. package/lib/interfaces/controller.js.map +1 -0
  268. package/lib/interfaces/instance.d.ts +7 -0
  269. package/lib/interfaces/instance.js +3 -0
  270. package/lib/interfaces/instance.js.map +1 -0
  271. package/lib/interfaces/options.d.ts +1 -0
  272. package/lib/interfaces/options.js +3 -0
  273. package/lib/interfaces/options.js.map +1 -0
  274. package/lib/interfaces/params.d.ts +4 -0
  275. package/lib/interfaces/params.js +3 -0
  276. package/lib/interfaces/params.js.map +1 -0
  277. package/lib/interfaces/request.d.ts +43 -0
  278. package/lib/interfaces/request.js +3 -0
  279. package/lib/interfaces/request.js.map +1 -0
  280. package/lib/interfaces/types.d.ts +2 -0
  281. package/lib/interfaces/types.js +3 -0
  282. package/lib/interfaces/types.js.map +1 -0
  283. package/lib/models/aggregate.d.ts +53 -0
  284. package/lib/models/aggregate.js +9 -0
  285. package/lib/models/aggregate.js.map +1 -0
  286. package/lib/models/base.d.ts +41 -0
  287. package/lib/models/base.js +3 -0
  288. package/lib/models/base.js.map +1 -0
  289. package/lib/models/category.d.ts +22 -0
  290. package/lib/models/category.js +9 -0
  291. package/lib/models/category.js.map +1 -0
  292. package/lib/models/comment.d.ts +37 -0
  293. package/lib/models/comment.js +16 -0
  294. package/lib/models/comment.js.map +1 -0
  295. package/lib/models/index.d.ts +14 -0
  296. package/lib/models/index.js +31 -0
  297. package/lib/models/index.js.map +1 -0
  298. package/lib/models/link.d.ts +22 -0
  299. package/lib/models/link.js +17 -0
  300. package/lib/models/link.js.map +1 -0
  301. package/lib/models/note.d.ts +38 -0
  302. package/lib/models/note.js +3 -0
  303. package/lib/models/note.js.map +1 -0
  304. package/lib/models/page.d.ts +14 -0
  305. package/lib/models/page.js +10 -0
  306. package/lib/models/page.js.map +1 -0
  307. package/lib/models/post.d.ts +17 -0
  308. package/lib/models/post.js +3 -0
  309. package/lib/models/post.js.map +1 -0
  310. package/lib/models/project.d.ts +11 -0
  311. package/lib/models/project.js +3 -0
  312. package/lib/models/project.js.map +1 -0
  313. package/lib/models/recently.d.ts +20 -0
  314. package/lib/models/recently.js +10 -0
  315. package/lib/models/recently.js.map +1 -0
  316. package/lib/models/say.d.ts +6 -0
  317. package/lib/models/say.js +3 -0
  318. package/lib/models/say.js.map +1 -0
  319. package/lib/models/setting.d.ts +66 -0
  320. package/lib/models/setting.js +3 -0
  321. package/lib/models/setting.js.map +1 -0
  322. package/lib/models/snippet.d.ts +18 -0
  323. package/lib/models/snippet.js +11 -0
  324. package/lib/models/snippet.js.map +1 -0
  325. package/lib/models/topic.d.ts +8 -0
  326. package/lib/models/topic.js +3 -0
  327. package/lib/models/topic.js.map +1 -0
  328. package/lib/models/user.d.ts +21 -0
  329. package/lib/models/user.js +3 -0
  330. package/lib/models/user.js.map +1 -0
  331. package/lib/utils/auto-bind.d.ts +4 -0
  332. package/lib/utils/auto-bind.js +40 -0
  333. package/lib/utils/auto-bind.js.map +1 -0
  334. package/lib/utils/camelcase-keys.d.ts +6 -0
  335. package/lib/utils/camelcase-keys.js +28 -0
  336. package/lib/utils/camelcase-keys.js.map +1 -0
  337. package/lib/utils/index.d.ts +5 -0
  338. package/lib/utils/index.js +50 -0
  339. package/lib/utils/index.js.map +1 -0
  340. package/lib/utils/path.d.ts +1 -0
  341. package/lib/utils/path.js +11 -0
  342. package/lib/utils/path.js.map +1 -0
  343. package/lib/vitest.config.d.ts +2 -0
  344. package/lib/vitest.config.js +17 -0
  345. package/lib/vitest.config.js.map +1 -0
  346. package/package.json +26 -12
  347. package/types/adaptors/axios.d.ts +4 -0
  348. package/types/adaptors/ky.d.ts +23 -0
  349. package/types/adaptors/umi-request.d.ts +4 -0
  350. package/types/controllers/aggregate.d.ts +64 -0
  351. package/types/controllers/base.d.ts +43 -0
  352. package/types/controllers/category.d.ts +114 -0
  353. package/types/controllers/comment.d.ts +81 -0
  354. package/types/controllers/index.d.ts +18 -0
  355. package/types/controllers/link.d.ts +20 -0
  356. package/types/controllers/note.d.ts +123 -0
  357. package/types/controllers/page.d.ts +59 -0
  358. package/types/controllers/post.d.ts +72 -0
  359. package/types/controllers/project.d.ts +15 -0
  360. package/types/controllers/recently.d.ts +110 -0
  361. package/types/controllers/say.d.ts +37 -0
  362. package/types/controllers/search.d.ts +247 -0
  363. package/types/controllers/severless.d.ts +24 -0
  364. package/types/controllers/snippet.d.ts +24 -0
  365. package/types/controllers/topic.d.ts +26 -0
  366. package/types/controllers/user.d.ts +70 -0
  367. package/types/core/attach-request.d.ts +2 -0
  368. package/types/core/client.d.ts +29 -0
  369. package/types/core/error.d.ts +6 -0
  370. package/types/core/index.d.ts +2 -0
  371. package/types/dtos/comment.d.ts +6 -0
  372. package/types/index.d.ts +7 -0
  373. package/types/interfaces/adapter.d.ts +14 -0
  374. package/types/interfaces/client.d.ts +13 -0
  375. package/types/interfaces/controller.d.ts +4 -0
  376. package/types/interfaces/instance.d.ts +7 -0
  377. package/types/interfaces/options.d.ts +1 -0
  378. package/types/interfaces/params.d.ts +4 -0
  379. package/types/interfaces/request.d.ts +43 -0
  380. package/types/interfaces/types.d.ts +2 -0
  381. package/types/models/aggregate.d.ts +53 -0
  382. package/types/models/base.d.ts +41 -0
  383. package/types/models/category.d.ts +22 -0
  384. package/types/models/comment.d.ts +37 -0
  385. package/types/models/index.d.ts +14 -0
  386. package/types/models/link.d.ts +22 -0
  387. package/types/models/note.d.ts +38 -0
  388. package/types/models/page.d.ts +14 -0
  389. package/types/models/post.d.ts +17 -0
  390. package/types/models/project.d.ts +11 -0
  391. package/types/models/recently.d.ts +20 -0
  392. package/types/models/say.d.ts +6 -0
  393. package/types/models/setting.d.ts +66 -0
  394. package/types/models/snippet.d.ts +18 -0
  395. package/types/models/topic.d.ts +8 -0
  396. package/types/models/user.d.ts +21 -0
  397. package/types/utils/auto-bind.d.ts +4 -0
  398. package/types/utils/camelcase-keys.d.ts +6 -0
  399. package/types/utils/index.d.ts +5 -0
  400. package/types/utils/path.d.ts +1 -0
  401. package/types/vitest.config.d.ts +2 -0
  402. package/__tests__/adaptors/axios.spec.ts +0 -7
  403. package/__tests__/adaptors/ky.spec.ts +0 -9
  404. package/__tests__/adaptors/umi-request.spec.ts +0 -7
  405. package/__tests__/contronllers/aggregate.test.ts +0 -389
  406. package/__tests__/contronllers/category.test.ts +0 -284
  407. package/__tests__/contronllers/comment.test.ts +0 -113
  408. package/__tests__/contronllers/link.test.ts +0 -95
  409. package/__tests__/contronllers/note.test.ts +0 -120
  410. package/__tests__/contronllers/page.test.ts +0 -49
  411. package/__tests__/contronllers/post.test.ts +0 -77
  412. package/__tests__/contronllers/recently.test.ts +0 -49
  413. package/__tests__/contronllers/say.test.ts +0 -106
  414. package/__tests__/contronllers/search.test.ts +0 -81
  415. package/__tests__/contronllers/serverless.test.ts +0 -19
  416. package/__tests__/contronllers/snippet.test.ts +0 -38
  417. package/__tests__/contronllers/topic.test.ts +0 -17
  418. package/__tests__/contronllers/user.test.ts +0 -59
  419. package/__tests__/core/client.test.ts +0 -293
  420. package/__tests__/helpers/adaptor-test.ts +0 -108
  421. package/__tests__/helpers/e2e-mock-server.ts +0 -22
  422. package/__tests__/helpers/global-fetch.ts +0 -39
  423. package/__tests__/helpers/instance.ts +0 -11
  424. package/__tests__/helpers/response.ts +0 -76
  425. package/__tests__/mock/algolia.json +0 -446
  426. package/__tests__/utils/auto-bind.spec.ts +0 -27
  427. package/__tests__/utils/camelcase-keys.spec.ts +0 -86
  428. package/__tests__/utils/index.test.ts +0 -33
  429. package/__tests__/utils/path.spec.ts +0 -8
  430. package/adaptors/axios.ts +0 -44
  431. package/adaptors/ky.ts +0 -76
  432. package/adaptors/umi-request.ts +0 -38
  433. package/core/attach-request.ts +0 -43
  434. package/core/client.ts +0 -252
  435. package/core/error.ts +0 -10
  436. package/core/index.ts +0 -2
  437. package/coverage/lcov-report/__tests__/helpers/adaptor-test.ts.html +0 -405
  438. package/coverage/lcov-report/__tests__/helpers/e2e-mock-server.ts.html +0 -150
  439. package/coverage/lcov-report/__tests__/helpers/index.html +0 -236
  440. package/coverage/lcov-report/__tests__/helpers/instance.ts.html +0 -120
  441. package/coverage/lcov-report/__tests__/helpers/response.ts.html +0 -231
  442. package/rollup.config.js +0 -150
  443. package/utils/auto-bind.ts +0 -48
  444. package/utils/camelcase-keys.ts +0 -26
  445. package/utils/index.ts +0 -53
  446. package/utils/path.ts +0 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"category.js","sourceRoot":"","sources":["../../models/category.ts"],"names":[],"mappings":";;;AAGA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,uDAAQ,CAAA;IACR,6CAAG,CAAA;AACL,CAAC,EAHW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAGvB"}
@@ -0,0 +1,37 @@
1
+ import { BaseModel } from './base';
2
+ import { CategoryModel } from './category';
3
+ export declare enum RefType {
4
+ Page = "Page",
5
+ Post = "Post",
6
+ Note = "Note"
7
+ }
8
+ export interface CommentModel extends BaseModel {
9
+ refType: RefType;
10
+ ref: string;
11
+ state: number;
12
+ commentsIndex: number;
13
+ author: string;
14
+ text: string;
15
+ mail?: string;
16
+ url?: string;
17
+ ip?: string;
18
+ agent?: string;
19
+ key: string;
20
+ pin?: boolean;
21
+ avatar: string;
22
+ parent?: CommentModel | string;
23
+ children: CommentModel[];
24
+ isWhispers?: boolean;
25
+ }
26
+ export interface CommentRef {
27
+ id: string;
28
+ categoryId?: string;
29
+ slug: string;
30
+ title: string;
31
+ category?: CategoryModel;
32
+ }
33
+ export declare enum CommentState {
34
+ Unread = 0,
35
+ Read = 1,
36
+ Junk = 2
37
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommentState = exports.RefType = void 0;
4
+ var RefType;
5
+ (function (RefType) {
6
+ RefType["Page"] = "Page";
7
+ RefType["Post"] = "Post";
8
+ RefType["Note"] = "Note";
9
+ })(RefType = exports.RefType || (exports.RefType = {}));
10
+ var CommentState;
11
+ (function (CommentState) {
12
+ CommentState[CommentState["Unread"] = 0] = "Unread";
13
+ CommentState[CommentState["Read"] = 1] = "Read";
14
+ CommentState[CommentState["Junk"] = 2] = "Junk";
15
+ })(CommentState = exports.CommentState || (exports.CommentState = {}));
16
+ //# sourceMappingURL=comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.js","sourceRoot":"","sources":["../../models/comment.ts"],"names":[],"mappings":";;;AAGA,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,wBAAa,CAAA;IACb,wBAAa,CAAA;IACb,wBAAa,CAAA;AACf,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB;AA6BD,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mDAAM,CAAA;IACN,+CAAI,CAAA;IACJ,+CAAI,CAAA;AACN,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB"}
@@ -0,0 +1,14 @@
1
+ export * from './aggregate';
2
+ export * from './base';
3
+ export * from './category';
4
+ export * from './comment';
5
+ export * from './link';
6
+ export * from './note';
7
+ export * from './page';
8
+ export * from './post';
9
+ export * from './project';
10
+ export * from './recently';
11
+ export * from './say';
12
+ export * from './setting';
13
+ export * from './snippet';
14
+ export * from './user';
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./aggregate"), exports);
18
+ __exportStar(require("./base"), exports);
19
+ __exportStar(require("./category"), exports);
20
+ __exportStar(require("./comment"), exports);
21
+ __exportStar(require("./link"), exports);
22
+ __exportStar(require("./note"), exports);
23
+ __exportStar(require("./page"), exports);
24
+ __exportStar(require("./post"), exports);
25
+ __exportStar(require("./project"), exports);
26
+ __exportStar(require("./recently"), exports);
27
+ __exportStar(require("./say"), exports);
28
+ __exportStar(require("./setting"), exports);
29
+ __exportStar(require("./snippet"), exports);
30
+ __exportStar(require("./user"), exports);
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,yCAAsB;AACtB,6CAA0B;AAC1B,4CAAyB;AACzB,yCAAsB;AACtB,yCAAsB;AACtB,yCAAsB;AACtB,yCAAsB;AACtB,4CAAyB;AACzB,6CAA0B;AAC1B,wCAAqB;AACrB,4CAAyB;AACzB,4CAAyB;AACzB,yCAAsB"}
@@ -0,0 +1,22 @@
1
+ import { BaseModel } from './base';
2
+ export declare enum LinkType {
3
+ Friend = 0,
4
+ Collection = 1
5
+ }
6
+ export declare enum LinkState {
7
+ Pass = 0,
8
+ Audit = 1,
9
+ Outdate = 2,
10
+ Banned = 3,
11
+ Reject = 4
12
+ }
13
+ export interface LinkModel extends BaseModel {
14
+ name: string;
15
+ url: string;
16
+ avatar: string;
17
+ description?: string;
18
+ type: LinkType;
19
+ state: LinkState;
20
+ hide: boolean;
21
+ email: string;
22
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LinkState = exports.LinkType = void 0;
4
+ var LinkType;
5
+ (function (LinkType) {
6
+ LinkType[LinkType["Friend"] = 0] = "Friend";
7
+ LinkType[LinkType["Collection"] = 1] = "Collection";
8
+ })(LinkType = exports.LinkType || (exports.LinkType = {}));
9
+ var LinkState;
10
+ (function (LinkState) {
11
+ LinkState[LinkState["Pass"] = 0] = "Pass";
12
+ LinkState[LinkState["Audit"] = 1] = "Audit";
13
+ LinkState[LinkState["Outdate"] = 2] = "Outdate";
14
+ LinkState[LinkState["Banned"] = 3] = "Banned";
15
+ LinkState[LinkState["Reject"] = 4] = "Reject";
16
+ })(LinkState = exports.LinkState || (exports.LinkState = {}));
17
+ //# sourceMappingURL=link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link.js","sourceRoot":"","sources":["../../models/link.ts"],"names":[],"mappings":";;;AAEA,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,2CAAM,CAAA;IACN,mDAAU,CAAA;AACZ,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAED,IAAY,SAMX;AAND,WAAY,SAAS;IACnB,yCAAI,CAAA;IACJ,2CAAK,CAAA;IACL,+CAAO,CAAA;IACP,6CAAM,CAAA;IACN,6CAAM,CAAA;AACR,CAAC,EANW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAMpB"}
@@ -0,0 +1,38 @@
1
+ import { ModelWithLiked, TextBaseModel } from './base';
2
+ import { TopicModel } from './topic';
3
+ export interface NoteModel extends TextBaseModel {
4
+ hide: boolean;
5
+ count: {
6
+ read: number;
7
+ like: number;
8
+ };
9
+ mood?: string;
10
+ weather?: string;
11
+ hasMemory?: boolean;
12
+ secret?: Date;
13
+ password?: string | null;
14
+ nid: number;
15
+ music?: NoteMusicRecord[];
16
+ location?: string;
17
+ coordinates?: Coordinate;
18
+ topic?: TopicModel;
19
+ topicId?: string;
20
+ }
21
+ export interface NoteMusicRecord {
22
+ type: string;
23
+ id: string;
24
+ }
25
+ export interface Coordinate {
26
+ latitude: number;
27
+ longitude: number;
28
+ }
29
+ export interface NoteWrappedPayload {
30
+ data: NoteModel;
31
+ next?: Partial<NoteModel>;
32
+ prev?: Partial<NoteModel>;
33
+ }
34
+ export interface NoteWrappedWithLikedPayload {
35
+ data: ModelWithLiked<NoteModel>;
36
+ next?: Partial<NoteModel>;
37
+ prev?: Partial<NoteModel>;
38
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"note.js","sourceRoot":"","sources":["../../models/note.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { TextBaseModel } from './base';
2
+ export declare enum EnumPageType {
3
+ 'md' = "md",
4
+ 'html' = "html",
5
+ 'frame' = "frame"
6
+ }
7
+ export interface PageModel extends TextBaseModel {
8
+ created: string;
9
+ slug: string;
10
+ subtitle?: string;
11
+ order?: number;
12
+ type?: EnumPageType;
13
+ options?: object;
14
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnumPageType = void 0;
4
+ var EnumPageType;
5
+ (function (EnumPageType) {
6
+ EnumPageType["md"] = "md";
7
+ EnumPageType["html"] = "html";
8
+ EnumPageType["frame"] = "frame";
9
+ })(EnumPageType = exports.EnumPageType || (exports.EnumPageType = {}));
10
+ //# sourceMappingURL=page.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sourceRoot":"","sources":["../../models/page.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,+BAAiB,CAAA;AACnB,CAAC,EAJW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAIvB"}
@@ -0,0 +1,17 @@
1
+ import { Count, Image, TextBaseModel } from './base';
2
+ import { CategoryModel } from './category';
3
+ export interface PostModel extends TextBaseModel {
4
+ summary?: string;
5
+ copyright: boolean;
6
+ tags: string[];
7
+ count: Count;
8
+ text: string;
9
+ title: string;
10
+ slug: string;
11
+ categoryId: string;
12
+ images: Image[];
13
+ category: CategoryModel;
14
+ pin?: string | null;
15
+ pinOrder?: number;
16
+ related?: Pick<PostModel, 'id' | 'category' | 'categoryId' | 'created' | 'modified' | 'title' | 'slug' | 'summary'>[];
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post.js","sourceRoot":"","sources":["../../models/post.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { BaseModel } from './base';
2
+ export interface ProjectModel extends BaseModel {
3
+ name: string;
4
+ previewUrl?: string;
5
+ docUrl?: string;
6
+ projectUrl?: string;
7
+ images?: string[];
8
+ description: string;
9
+ avatar?: string;
10
+ text: string;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../../models/project.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import { BaseCommentIndexModel } from './base';
2
+ export declare enum RecentlyRefTypes {
3
+ Post = "Post",
4
+ Note = "Note",
5
+ Page = "Page"
6
+ }
7
+ export type RecentlyRefType = {
8
+ title: string;
9
+ url: string;
10
+ };
11
+ export interface RecentlyModel extends BaseCommentIndexModel {
12
+ content: string;
13
+ ref?: RecentlyRefType & {
14
+ [key: string]: any;
15
+ };
16
+ refId?: string;
17
+ refType?: RecentlyRefTypes;
18
+ up: number;
19
+ down: number;
20
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecentlyRefTypes = void 0;
4
+ var RecentlyRefTypes;
5
+ (function (RecentlyRefTypes) {
6
+ RecentlyRefTypes["Post"] = "Post";
7
+ RecentlyRefTypes["Note"] = "Note";
8
+ RecentlyRefTypes["Page"] = "Page";
9
+ })(RecentlyRefTypes = exports.RecentlyRefTypes || (exports.RecentlyRefTypes = {}));
10
+ //# sourceMappingURL=recently.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recently.js","sourceRoot":"","sources":["../../models/recently.ts"],"names":[],"mappings":";;;AAEA,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,iCAAa,CAAA;IACb,iCAAa,CAAA;AACf,CAAC,EAJW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAI3B"}
@@ -0,0 +1,6 @@
1
+ import { BaseModel } from './base';
2
+ export interface SayModel extends BaseModel {
3
+ text: string;
4
+ source?: string;
5
+ author?: string;
6
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=say.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"say.js","sourceRoot":"","sources":["../../models/say.ts"],"names":[],"mappings":""}
@@ -0,0 +1,66 @@
1
+ export declare class SeoOptionModel {
2
+ title: string;
3
+ description: string;
4
+ icon?: string;
5
+ keywords?: string[];
6
+ }
7
+ export declare class UrlOptionModel {
8
+ webUrl: string;
9
+ adminUrl: string;
10
+ serverUrl: string;
11
+ wsUrl: string;
12
+ }
13
+ declare class MailOptionModel {
14
+ port: number;
15
+ host: string;
16
+ }
17
+ export declare class MailOptionsModel {
18
+ enable: boolean;
19
+ user: string;
20
+ pass: string;
21
+ options?: MailOptionModel;
22
+ }
23
+ export declare class CommentOptionsModel {
24
+ antiSpam: boolean;
25
+ spamKeywords?: string[];
26
+ blockIps?: string[];
27
+ disableNoChinese?: boolean;
28
+ }
29
+ export declare class BackupOptionsModel {
30
+ enable: boolean;
31
+ secretId?: string;
32
+ secretKey?: string;
33
+ bucket?: string;
34
+ region: string;
35
+ }
36
+ export declare class BaiduSearchOptionsModel {
37
+ enable: boolean;
38
+ token?: string;
39
+ }
40
+ export declare class AlgoliaSearchOptionsModel {
41
+ enable: boolean;
42
+ apiKey?: string;
43
+ appId?: string;
44
+ indexName?: string;
45
+ }
46
+ export declare class AdminExtraModel {
47
+ background?: string;
48
+ gaodemapKey?: string;
49
+ title?: string;
50
+ /**
51
+ * 是否开启后台反代访问
52
+ */
53
+ enableAdminProxy?: boolean;
54
+ }
55
+ export interface IConfig {
56
+ seo: SeoOptionModel;
57
+ url: UrlOptionModel;
58
+ mailOptions: MailOptionsModel;
59
+ commentOptions: CommentOptionsModel;
60
+ backupOptions: BackupOptionsModel;
61
+ baiduSearchOptions: BaiduSearchOptionsModel;
62
+ algoliaSearchOptions: AlgoliaSearchOptionsModel;
63
+ adminExtra: AdminExtraModel;
64
+ }
65
+ export declare type IConfigKeys = keyof IConfig;
66
+ export {};
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=setting.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setting.js","sourceRoot":"","sources":["../../models/setting.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { BaseModel } from './base';
2
+ export declare enum SnippetType {
3
+ JSON = "json",
4
+ Function = "function",
5
+ Text = "text",
6
+ YAML = "yaml"
7
+ }
8
+ export interface SnippetModel<T = unknown> extends BaseModel {
9
+ type: SnippetType;
10
+ private: boolean;
11
+ raw: string;
12
+ name: string;
13
+ reference: string;
14
+ comment?: string;
15
+ metatype?: string;
16
+ schema?: string;
17
+ data: T;
18
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SnippetType = void 0;
4
+ var SnippetType;
5
+ (function (SnippetType) {
6
+ SnippetType["JSON"] = "json";
7
+ SnippetType["Function"] = "function";
8
+ SnippetType["Text"] = "text";
9
+ SnippetType["YAML"] = "yaml";
10
+ })(SnippetType = exports.SnippetType || (exports.SnippetType = {}));
11
+ //# sourceMappingURL=snippet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snippet.js","sourceRoot":"","sources":["../../models/snippet.ts"],"names":[],"mappings":";;;AAEA,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;AACf,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB"}
@@ -0,0 +1,8 @@
1
+ import { BaseModel } from './base';
2
+ export interface TopicModel extends BaseModel {
3
+ description?: string;
4
+ introduce: string;
5
+ name: string;
6
+ slug: string;
7
+ icon?: string;
8
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=topic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"topic.js","sourceRoot":"","sources":["../../models/topic.ts"],"names":[],"mappings":""}
@@ -0,0 +1,21 @@
1
+ import { BaseModel } from './base';
2
+ export interface UserModel extends BaseModel {
3
+ introduce: string;
4
+ mail: string;
5
+ url: string;
6
+ name: string;
7
+ socialIds: Record<string, string>;
8
+ username: string;
9
+ modified: string;
10
+ v: number;
11
+ lastLoginTime: string;
12
+ lastLoginIp?: string;
13
+ avatar: string;
14
+ postID: string;
15
+ }
16
+ export type TLogin = {
17
+ token: string;
18
+ expiresIn: number;
19
+ lastLoginTime: null | string;
20
+ lastLoginIp?: null | string;
21
+ } & Pick<UserModel, 'name' | 'username' | 'created' | 'url' | 'mail' | 'avatar' | 'id'>;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../models/user.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export declare function autoBind(self: any, { include, exclude }?: {
2
+ include: any;
3
+ exclude: any;
4
+ }): any;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ // @copy: https://github.com/sindresorhus/auto-bind/blob/main/index.js
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.autoBind = void 0;
6
+ // Gets all non-builtin properties up the prototype chain.
7
+ const getAllProperties = (object) => {
8
+ const properties = new Set();
9
+ do {
10
+ for (const key of Reflect.ownKeys(object)) {
11
+ properties.add([object, key]);
12
+ }
13
+ } while ((object = Reflect.getPrototypeOf(object)) &&
14
+ object !== Object.prototype);
15
+ return properties;
16
+ };
17
+ function autoBind(self, { include, exclude } = {}) {
18
+ const filter = (key) => {
19
+ const match = (pattern) => typeof pattern === 'string' ? key === pattern : pattern.test(key);
20
+ if (include) {
21
+ return include.some(match);
22
+ }
23
+ if (exclude) {
24
+ return !exclude.some(match);
25
+ }
26
+ return true;
27
+ };
28
+ for (const [object, key] of getAllProperties(self.constructor.prototype)) {
29
+ if (key === 'constructor' || !filter(key)) {
30
+ continue;
31
+ }
32
+ const descriptor = Reflect.getOwnPropertyDescriptor(object, key);
33
+ if (descriptor && typeof descriptor.value === 'function') {
34
+ self[key] = self[key].bind(self);
35
+ }
36
+ }
37
+ return self;
38
+ }
39
+ exports.autoBind = autoBind;
40
+ //# sourceMappingURL=auto-bind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-bind.js","sourceRoot":"","sources":["../../utils/auto-bind.ts"],"names":[],"mappings":";AAAA,cAAc;AACd,sEAAsE;;;AAEtE,0DAA0D;AAC1D,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,EAAE;IAClC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAE,CAAA;IAE5B,GAAG;QACD,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACzC,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;SAC9B;KACF,QACC,CAAC,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,KAAK,MAAM,CAAC,SAAS,EAC5B;IAED,OAAO,UAAU,CAAA;AACnB,CAAC,CAAA;AAED,SAAgB,QAAQ,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;IACtD,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE;QACrB,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,EAAE,CACxB,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAEnE,IAAI,OAAO,EAAE;YACX,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SAC3B;QAED,IAAI,OAAO,EAAE;YACX,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SAC5B;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;IAED,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;QACxE,IAAI,GAAG,KAAK,aAAa,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE;YACzC,SAAQ;SACT;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAChE,IAAI,UAAU,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,UAAU,EAAE;YACxD,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SACjC;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AA5BD,4BA4BC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * A simple camelCase function that only handles strings, but not handling symbol, date, or other complex case.
3
+ * If you need to handle more complex cases, please use camelcase-keys package.
4
+ */
5
+ export declare const camelcaseKeys: <T = any>(obj: any) => T;
6
+ export declare function camelcase(str: string): string;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.camelcase = exports.camelcaseKeys = void 0;
4
+ const _1 = require(".");
5
+ /**
6
+ * A simple camelCase function that only handles strings, but not handling symbol, date, or other complex case.
7
+ * If you need to handle more complex cases, please use camelcase-keys package.
8
+ */
9
+ const camelcaseKeys = (obj) => {
10
+ if (Array.isArray(obj)) {
11
+ return obj.map((x) => (0, exports.camelcaseKeys)(x));
12
+ }
13
+ if ((0, _1.isPlainObject)(obj)) {
14
+ return Object.keys(obj).reduce((result, key) => {
15
+ result[camelcase(key)] = (0, exports.camelcaseKeys)(obj[key]);
16
+ return result;
17
+ }, {});
18
+ }
19
+ return obj;
20
+ };
21
+ exports.camelcaseKeys = camelcaseKeys;
22
+ function camelcase(str) {
23
+ return str.replace(/([-_][a-z])/gi, ($1) => {
24
+ return $1.toUpperCase().replace('-', '').replace('_', '');
25
+ });
26
+ }
27
+ exports.camelcase = camelcase;
28
+ //# sourceMappingURL=camelcase-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"camelcase-keys.js","sourceRoot":"","sources":["../../utils/camelcase-keys.ts"],"names":[],"mappings":";;;AAAA,wBAAiC;AAEjC;;;GAGG;AACI,MAAM,aAAa,GAAG,CAAU,GAAQ,EAAK,EAAE;IACpD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;QACtB,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,CAAC,CAAC,CAAQ,CAAA;KAC/C;IAED,IAAI,IAAA,gBAAa,EAAC,GAAG,CAAC,EAAE;QACtB,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,MAAW,EAAE,GAAG,EAAE,EAAE;YAClD,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,IAAA,qBAAa,EAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;YAChD,OAAO,MAAM,CAAA;QACf,CAAC,EAAE,EAAE,CAAQ,CAAA;KACd;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAbY,QAAA,aAAa,iBAazB;AAED,SAAgB,SAAS,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,EAAE,EAAE,EAAE;QACzC,OAAO,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IAC3D,CAAC,CAAC,CAAA;AACJ,CAAC;AAJD,8BAIC"}
@@ -0,0 +1,5 @@
1
+ import { SortOrder } from '../interfaces/options';
2
+ export declare const isPlainObject: (obj: any) => any;
3
+ export declare const sortOrderToNumber: (order: SortOrder) => number;
4
+ export declare const destructureData: (payload: any) => any;
5
+ export declare const attachRawFromOneToAnthor: (from: any, to: any) => void;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.attachRawFromOneToAnthor = exports.destructureData = exports.sortOrderToNumber = exports.isPlainObject = void 0;
4
+ const isPlainObject = (obj) => isObject(obj) &&
5
+ Object.prototype.toString.call(obj) === '[object Object]' &&
6
+ Object.getPrototypeOf(obj) === Object.prototype;
7
+ exports.isPlainObject = isPlainObject;
8
+ const sortOrderToNumber = (order) => {
9
+ return ({
10
+ asc: 1,
11
+ desc: -1,
12
+ }[order] || 1);
13
+ };
14
+ exports.sortOrderToNumber = sortOrderToNumber;
15
+ const isObject = (obj) => obj && typeof obj === 'object';
16
+ const destructureData = (payload) => {
17
+ if (typeof payload !== 'object') {
18
+ return payload;
19
+ }
20
+ if (payload === null) {
21
+ return payload;
22
+ }
23
+ const data = payload.data;
24
+ const dataIsPlainObject = (0, exports.isPlainObject)(data);
25
+ if (dataIsPlainObject && Object.keys(payload).length === 1) {
26
+ const d = Object.assign({}, data);
27
+ // attach raw onto new data
28
+ (0, exports.attachRawFromOneToAnthor)(payload, d);
29
+ return d;
30
+ }
31
+ return payload;
32
+ };
33
+ exports.destructureData = destructureData;
34
+ const attachRawFromOneToAnthor = (from, to) => {
35
+ if (!from || !isObject(to)) {
36
+ return;
37
+ }
38
+ from.$raw &&
39
+ Object.defineProperty(to, '$raw', {
40
+ value: { ...from.$raw },
41
+ enumerable: false,
42
+ });
43
+ from.$request &&
44
+ Object.defineProperty(to, '$request', {
45
+ value: { ...from.$request },
46
+ enumerable: false,
47
+ });
48
+ };
49
+ exports.attachRawFromOneToAnthor = attachRawFromOneToAnthor;
50
+ //# sourceMappingURL=index.js.map