@postpeer/node 0.7.0 → 0.8.0

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 (467) hide show
  1. package/CHANGELOG.md +5 -130
  2. package/README.md +91 -317
  3. package/dist/index.cjs +1709 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +3484 -0
  6. package/dist/index.d.ts +3484 -0
  7. package/dist/index.js +1690 -0
  8. package/dist/index.js.map +1 -0
  9. package/package.json +59 -131
  10. package/api-promise.d.mts +0 -3
  11. package/api-promise.d.mts.map +0 -1
  12. package/api-promise.d.ts +0 -3
  13. package/api-promise.d.ts.map +0 -1
  14. package/api-promise.js +0 -6
  15. package/api-promise.js.map +0 -1
  16. package/api-promise.mjs +0 -3
  17. package/api-promise.mjs.map +0 -1
  18. package/client.d.mts +0 -190
  19. package/client.d.mts.map +0 -1
  20. package/client.d.ts +0 -190
  21. package/client.d.ts.map +0 -1
  22. package/client.js +0 -485
  23. package/client.js.map +0 -1
  24. package/client.mjs +0 -481
  25. package/client.mjs.map +0 -1
  26. package/core/api-promise.d.mts +0 -46
  27. package/core/api-promise.d.mts.map +0 -1
  28. package/core/api-promise.d.ts +0 -46
  29. package/core/api-promise.d.ts.map +0 -1
  30. package/core/api-promise.js +0 -74
  31. package/core/api-promise.js.map +0 -1
  32. package/core/api-promise.mjs +0 -70
  33. package/core/api-promise.mjs.map +0 -1
  34. package/core/error.d.mts +0 -46
  35. package/core/error.d.mts.map +0 -1
  36. package/core/error.d.ts +0 -46
  37. package/core/error.d.ts.map +0 -1
  38. package/core/error.js +0 -113
  39. package/core/error.js.map +0 -1
  40. package/core/error.mjs +0 -97
  41. package/core/error.mjs.map +0 -1
  42. package/core/resource.d.mts +0 -6
  43. package/core/resource.d.mts.map +0 -1
  44. package/core/resource.d.ts +0 -6
  45. package/core/resource.d.ts.map +0 -1
  46. package/core/resource.js +0 -11
  47. package/core/resource.js.map +0 -1
  48. package/core/resource.mjs +0 -7
  49. package/core/resource.mjs.map +0 -1
  50. package/core/uploads.d.mts +0 -3
  51. package/core/uploads.d.mts.map +0 -1
  52. package/core/uploads.d.ts +0 -3
  53. package/core/uploads.d.ts.map +0 -1
  54. package/core/uploads.js +0 -6
  55. package/core/uploads.js.map +0 -1
  56. package/core/uploads.mjs +0 -2
  57. package/core/uploads.mjs.map +0 -1
  58. package/error.d.mts +0 -3
  59. package/error.d.mts.map +0 -1
  60. package/error.d.ts +0 -3
  61. package/error.d.ts.map +0 -1
  62. package/error.js +0 -6
  63. package/error.js.map +0 -1
  64. package/error.mjs +0 -3
  65. package/error.mjs.map +0 -1
  66. package/index.d.mts +0 -6
  67. package/index.d.mts.map +0 -1
  68. package/index.d.ts +0 -6
  69. package/index.d.ts.map +0 -1
  70. package/index.js +0 -30
  71. package/index.js.map +0 -1
  72. package/index.mjs +0 -7
  73. package/index.mjs.map +0 -1
  74. package/internal/builtin-types.d.mts +0 -73
  75. package/internal/builtin-types.d.mts.map +0 -1
  76. package/internal/builtin-types.d.ts +0 -73
  77. package/internal/builtin-types.d.ts.map +0 -1
  78. package/internal/builtin-types.js +0 -4
  79. package/internal/builtin-types.js.map +0 -1
  80. package/internal/builtin-types.mjs +0 -3
  81. package/internal/builtin-types.mjs.map +0 -1
  82. package/internal/detect-platform.d.mts +0 -15
  83. package/internal/detect-platform.d.mts.map +0 -1
  84. package/internal/detect-platform.d.ts +0 -15
  85. package/internal/detect-platform.d.ts.map +0 -1
  86. package/internal/detect-platform.js +0 -162
  87. package/internal/detect-platform.js.map +0 -1
  88. package/internal/detect-platform.mjs +0 -157
  89. package/internal/detect-platform.mjs.map +0 -1
  90. package/internal/errors.d.mts +0 -3
  91. package/internal/errors.d.mts.map +0 -1
  92. package/internal/errors.d.ts +0 -3
  93. package/internal/errors.d.ts.map +0 -1
  94. package/internal/errors.js +0 -41
  95. package/internal/errors.js.map +0 -1
  96. package/internal/errors.mjs +0 -36
  97. package/internal/errors.mjs.map +0 -1
  98. package/internal/headers.d.mts +0 -20
  99. package/internal/headers.d.mts.map +0 -1
  100. package/internal/headers.d.ts +0 -20
  101. package/internal/headers.d.ts.map +0 -1
  102. package/internal/headers.js +0 -79
  103. package/internal/headers.js.map +0 -1
  104. package/internal/headers.mjs +0 -74
  105. package/internal/headers.mjs.map +0 -1
  106. package/internal/parse.d.mts +0 -12
  107. package/internal/parse.d.mts.map +0 -1
  108. package/internal/parse.d.ts +0 -12
  109. package/internal/parse.d.ts.map +0 -1
  110. package/internal/parse.js +0 -40
  111. package/internal/parse.js.map +0 -1
  112. package/internal/parse.mjs +0 -37
  113. package/internal/parse.mjs.map +0 -1
  114. package/internal/qs/formats.d.mts +0 -7
  115. package/internal/qs/formats.d.mts.map +0 -1
  116. package/internal/qs/formats.d.ts +0 -7
  117. package/internal/qs/formats.d.ts.map +0 -1
  118. package/internal/qs/formats.js +0 -13
  119. package/internal/qs/formats.js.map +0 -1
  120. package/internal/qs/formats.mjs +0 -9
  121. package/internal/qs/formats.mjs.map +0 -1
  122. package/internal/qs/index.d.mts +0 -10
  123. package/internal/qs/index.d.mts.map +0 -1
  124. package/internal/qs/index.d.ts +0 -10
  125. package/internal/qs/index.d.ts.map +0 -1
  126. package/internal/qs/index.js +0 -14
  127. package/internal/qs/index.js.map +0 -1
  128. package/internal/qs/index.mjs +0 -10
  129. package/internal/qs/index.mjs.map +0 -1
  130. package/internal/qs/stringify.d.mts +0 -3
  131. package/internal/qs/stringify.d.mts.map +0 -1
  132. package/internal/qs/stringify.d.ts +0 -3
  133. package/internal/qs/stringify.d.ts.map +0 -1
  134. package/internal/qs/stringify.js +0 -277
  135. package/internal/qs/stringify.js.map +0 -1
  136. package/internal/qs/stringify.mjs +0 -274
  137. package/internal/qs/stringify.mjs.map +0 -1
  138. package/internal/qs/types.d.mts +0 -57
  139. package/internal/qs/types.d.mts.map +0 -1
  140. package/internal/qs/types.d.ts +0 -57
  141. package/internal/qs/types.d.ts.map +0 -1
  142. package/internal/qs/types.js +0 -3
  143. package/internal/qs/types.js.map +0 -1
  144. package/internal/qs/types.mjs +0 -2
  145. package/internal/qs/types.mjs.map +0 -1
  146. package/internal/qs/utils.d.mts +0 -15
  147. package/internal/qs/utils.d.mts.map +0 -1
  148. package/internal/qs/utils.d.ts +0 -15
  149. package/internal/qs/utils.d.ts.map +0 -1
  150. package/internal/qs/utils.js +0 -230
  151. package/internal/qs/utils.js.map +0 -1
  152. package/internal/qs/utils.mjs +0 -217
  153. package/internal/qs/utils.mjs.map +0 -1
  154. package/internal/request-options.d.mts +0 -75
  155. package/internal/request-options.d.mts.map +0 -1
  156. package/internal/request-options.d.ts +0 -75
  157. package/internal/request-options.d.ts.map +0 -1
  158. package/internal/request-options.js +0 -14
  159. package/internal/request-options.js.map +0 -1
  160. package/internal/request-options.mjs +0 -10
  161. package/internal/request-options.mjs.map +0 -1
  162. package/internal/shim-types.d.mts +0 -17
  163. package/internal/shim-types.d.mts.map +0 -1
  164. package/internal/shim-types.d.ts +0 -17
  165. package/internal/shim-types.d.ts.map +0 -1
  166. package/internal/shim-types.js +0 -4
  167. package/internal/shim-types.js.map +0 -1
  168. package/internal/shim-types.mjs +0 -3
  169. package/internal/shim-types.mjs.map +0 -1
  170. package/internal/shims.d.mts +0 -26
  171. package/internal/shims.d.mts.map +0 -1
  172. package/internal/shims.d.ts +0 -26
  173. package/internal/shims.d.ts.map +0 -1
  174. package/internal/shims.js +0 -92
  175. package/internal/shims.js.map +0 -1
  176. package/internal/shims.mjs +0 -85
  177. package/internal/shims.mjs.map +0 -1
  178. package/internal/to-file.d.mts +0 -45
  179. package/internal/to-file.d.mts.map +0 -1
  180. package/internal/to-file.d.ts +0 -45
  181. package/internal/to-file.d.ts.map +0 -1
  182. package/internal/to-file.js +0 -91
  183. package/internal/to-file.js.map +0 -1
  184. package/internal/to-file.mjs +0 -88
  185. package/internal/to-file.mjs.map +0 -1
  186. package/internal/tslib.js +0 -81
  187. package/internal/tslib.mjs +0 -17
  188. package/internal/types.d.mts +0 -69
  189. package/internal/types.d.mts.map +0 -1
  190. package/internal/types.d.ts +0 -69
  191. package/internal/types.d.ts.map +0 -1
  192. package/internal/types.js +0 -4
  193. package/internal/types.js.map +0 -1
  194. package/internal/types.mjs +0 -3
  195. package/internal/types.mjs.map +0 -1
  196. package/internal/uploads.d.mts +0 -42
  197. package/internal/uploads.d.mts.map +0 -1
  198. package/internal/uploads.d.ts +0 -42
  199. package/internal/uploads.d.ts.map +0 -1
  200. package/internal/uploads.js +0 -141
  201. package/internal/uploads.js.map +0 -1
  202. package/internal/uploads.mjs +0 -131
  203. package/internal/uploads.mjs.map +0 -1
  204. package/internal/utils/base64.d.mts +0 -3
  205. package/internal/utils/base64.d.mts.map +0 -1
  206. package/internal/utils/base64.d.ts +0 -3
  207. package/internal/utils/base64.d.ts.map +0 -1
  208. package/internal/utils/base64.js +0 -38
  209. package/internal/utils/base64.js.map +0 -1
  210. package/internal/utils/base64.mjs +0 -33
  211. package/internal/utils/base64.mjs.map +0 -1
  212. package/internal/utils/bytes.d.mts +0 -4
  213. package/internal/utils/bytes.d.mts.map +0 -1
  214. package/internal/utils/bytes.d.ts +0 -4
  215. package/internal/utils/bytes.d.ts.map +0 -1
  216. package/internal/utils/bytes.js +0 -31
  217. package/internal/utils/bytes.js.map +0 -1
  218. package/internal/utils/bytes.mjs +0 -26
  219. package/internal/utils/bytes.mjs.map +0 -1
  220. package/internal/utils/env.d.mts +0 -9
  221. package/internal/utils/env.d.mts.map +0 -1
  222. package/internal/utils/env.d.ts +0 -9
  223. package/internal/utils/env.d.ts.map +0 -1
  224. package/internal/utils/env.js +0 -22
  225. package/internal/utils/env.js.map +0 -1
  226. package/internal/utils/env.mjs +0 -18
  227. package/internal/utils/env.mjs.map +0 -1
  228. package/internal/utils/log.d.mts +0 -37
  229. package/internal/utils/log.d.mts.map +0 -1
  230. package/internal/utils/log.d.ts +0 -37
  231. package/internal/utils/log.d.ts.map +0 -1
  232. package/internal/utils/log.js +0 -88
  233. package/internal/utils/log.js.map +0 -1
  234. package/internal/utils/log.mjs +0 -82
  235. package/internal/utils/log.mjs.map +0 -1
  236. package/internal/utils/path.d.mts +0 -15
  237. package/internal/utils/path.d.mts.map +0 -1
  238. package/internal/utils/path.d.ts +0 -15
  239. package/internal/utils/path.d.ts.map +0 -1
  240. package/internal/utils/path.js +0 -79
  241. package/internal/utils/path.js.map +0 -1
  242. package/internal/utils/path.mjs +0 -74
  243. package/internal/utils/path.mjs.map +0 -1
  244. package/internal/utils/query.d.mts +0 -2
  245. package/internal/utils/query.d.mts.map +0 -1
  246. package/internal/utils/query.d.ts +0 -2
  247. package/internal/utils/query.d.ts.map +0 -1
  248. package/internal/utils/query.js +0 -10
  249. package/internal/utils/query.js.map +0 -1
  250. package/internal/utils/query.mjs +0 -6
  251. package/internal/utils/query.mjs.map +0 -1
  252. package/internal/utils/sleep.d.mts +0 -2
  253. package/internal/utils/sleep.d.mts.map +0 -1
  254. package/internal/utils/sleep.d.ts +0 -2
  255. package/internal/utils/sleep.d.ts.map +0 -1
  256. package/internal/utils/sleep.js +0 -7
  257. package/internal/utils/sleep.js.map +0 -1
  258. package/internal/utils/sleep.mjs +0 -3
  259. package/internal/utils/sleep.mjs.map +0 -1
  260. package/internal/utils/uuid.d.mts +0 -5
  261. package/internal/utils/uuid.d.mts.map +0 -1
  262. package/internal/utils/uuid.d.ts +0 -5
  263. package/internal/utils/uuid.d.ts.map +0 -1
  264. package/internal/utils/uuid.js +0 -19
  265. package/internal/utils/uuid.js.map +0 -1
  266. package/internal/utils/uuid.mjs +0 -15
  267. package/internal/utils/uuid.mjs.map +0 -1
  268. package/internal/utils/values.d.mts +0 -18
  269. package/internal/utils/values.d.mts.map +0 -1
  270. package/internal/utils/values.d.ts +0 -18
  271. package/internal/utils/values.d.ts.map +0 -1
  272. package/internal/utils/values.js +0 -112
  273. package/internal/utils/values.js.map +0 -1
  274. package/internal/utils/values.mjs +0 -94
  275. package/internal/utils/values.mjs.map +0 -1
  276. package/internal/utils.d.mts +0 -8
  277. package/internal/utils.d.mts.map +0 -1
  278. package/internal/utils.d.ts +0 -8
  279. package/internal/utils.d.ts.map +0 -1
  280. package/internal/utils.js +0 -12
  281. package/internal/utils.js.map +0 -1
  282. package/internal/utils.mjs +0 -9
  283. package/internal/utils.mjs.map +0 -1
  284. package/resource.d.mts +0 -3
  285. package/resource.d.mts.map +0 -1
  286. package/resource.d.ts +0 -3
  287. package/resource.d.ts.map +0 -1
  288. package/resource.js +0 -6
  289. package/resource.js.map +0 -1
  290. package/resource.mjs +0 -3
  291. package/resource.mjs.map +0 -1
  292. package/resources/connect/connect.d.mts +0 -31
  293. package/resources/connect/connect.d.mts.map +0 -1
  294. package/resources/connect/connect.d.ts +0 -31
  295. package/resources/connect/connect.d.ts.map +0 -1
  296. package/resources/connect/connect.js +0 -24
  297. package/resources/connect/connect.js.map +0 -1
  298. package/resources/connect/connect.mjs +0 -19
  299. package/resources/connect/connect.mjs.map +0 -1
  300. package/resources/connect/index.d.mts +0 -3
  301. package/resources/connect/index.d.mts.map +0 -1
  302. package/resources/connect/index.d.ts +0 -3
  303. package/resources/connect/index.d.ts.map +0 -1
  304. package/resources/connect/index.js +0 -9
  305. package/resources/connect/index.js.map +0 -1
  306. package/resources/connect/index.mjs +0 -4
  307. package/resources/connect/index.mjs.map +0 -1
  308. package/resources/connect/integrations.d.mts +0 -78
  309. package/resources/connect/integrations.d.mts.map +0 -1
  310. package/resources/connect/integrations.d.ts +0 -78
  311. package/resources/connect/integrations.d.ts.map +0 -1
  312. package/resources/connect/integrations.js +0 -22
  313. package/resources/connect/integrations.js.map +0 -1
  314. package/resources/connect/integrations.mjs +0 -18
  315. package/resources/connect/integrations.mjs.map +0 -1
  316. package/resources/connect.d.mts +0 -2
  317. package/resources/connect.d.mts.map +0 -1
  318. package/resources/connect.d.ts +0 -2
  319. package/resources/connect.d.ts.map +0 -1
  320. package/resources/connect.js +0 -6
  321. package/resources/connect.js.map +0 -1
  322. package/resources/connect.mjs +0 -3
  323. package/resources/connect.mjs.map +0 -1
  324. package/resources/health.d.mts +0 -23
  325. package/resources/health.d.mts.map +0 -1
  326. package/resources/health.d.ts +0 -23
  327. package/resources/health.d.ts.map +0 -1
  328. package/resources/health.js +0 -21
  329. package/resources/health.js.map +0 -1
  330. package/resources/health.mjs +0 -17
  331. package/resources/health.mjs.map +0 -1
  332. package/resources/index.d.mts +0 -6
  333. package/resources/index.d.mts.map +0 -1
  334. package/resources/index.d.ts +0 -6
  335. package/resources/index.d.ts.map +0 -1
  336. package/resources/index.js +0 -15
  337. package/resources/index.js.map +0 -1
  338. package/resources/index.mjs +0 -7
  339. package/resources/index.mjs.map +0 -1
  340. package/resources/media.d.mts +0 -27
  341. package/resources/media.d.mts.map +0 -1
  342. package/resources/media.d.ts +0 -27
  343. package/resources/media.d.ts.map +0 -1
  344. package/resources/media.js +0 -15
  345. package/resources/media.js.map +0 -1
  346. package/resources/media.mjs +0 -11
  347. package/resources/media.mjs.map +0 -1
  348. package/resources/platforms.d.mts +0 -22
  349. package/resources/platforms.d.mts.map +0 -1
  350. package/resources/platforms.d.ts +0 -22
  351. package/resources/platforms.d.ts.map +0 -1
  352. package/resources/platforms.js +0 -15
  353. package/resources/platforms.js.map +0 -1
  354. package/resources/platforms.mjs +0 -11
  355. package/resources/platforms.mjs.map +0 -1
  356. package/resources/posts/index.d.mts +0 -3
  357. package/resources/posts/index.d.mts.map +0 -1
  358. package/resources/posts/index.d.ts +0 -3
  359. package/resources/posts/index.d.ts.map +0 -1
  360. package/resources/posts/index.js +0 -9
  361. package/resources/posts/index.js.map +0 -1
  362. package/resources/posts/index.mjs +0 -4
  363. package/resources/posts/index.mjs.map +0 -1
  364. package/resources/posts/posts.d.mts +0 -300
  365. package/resources/posts/posts.d.mts.map +0 -1
  366. package/resources/posts/posts.d.ts +0 -300
  367. package/resources/posts/posts.d.ts.map +0 -1
  368. package/resources/posts/posts.js +0 -69
  369. package/resources/posts/posts.js.map +0 -1
  370. package/resources/posts/posts.mjs +0 -64
  371. package/resources/posts/posts.mjs.map +0 -1
  372. package/resources/posts/scheduled.d.mts +0 -121
  373. package/resources/posts/scheduled.d.mts.map +0 -1
  374. package/resources/posts/scheduled.d.ts +0 -121
  375. package/resources/posts/scheduled.d.ts.map +0 -1
  376. package/resources/posts/scheduled.js +0 -49
  377. package/resources/posts/scheduled.js.map +0 -1
  378. package/resources/posts/scheduled.mjs +0 -45
  379. package/resources/posts/scheduled.mjs.map +0 -1
  380. package/resources/posts.d.mts +0 -2
  381. package/resources/posts.d.mts.map +0 -1
  382. package/resources/posts.d.ts +0 -2
  383. package/resources/posts.d.ts.map +0 -1
  384. package/resources/posts.js +0 -6
  385. package/resources/posts.js.map +0 -1
  386. package/resources/posts.mjs +0 -3
  387. package/resources/posts.mjs.map +0 -1
  388. package/resources.d.mts +0 -2
  389. package/resources.d.mts.map +0 -1
  390. package/resources.d.ts +0 -2
  391. package/resources.d.ts.map +0 -1
  392. package/resources.js +0 -5
  393. package/resources.js.map +0 -1
  394. package/resources.mjs +0 -2
  395. package/resources.mjs.map +0 -1
  396. package/src/api-promise.ts +0 -2
  397. package/src/client.ts +0 -789
  398. package/src/core/README.md +0 -3
  399. package/src/core/api-promise.ts +0 -92
  400. package/src/core/error.ts +0 -130
  401. package/src/core/resource.ts +0 -11
  402. package/src/core/uploads.ts +0 -2
  403. package/src/error.ts +0 -2
  404. package/src/index.ts +0 -22
  405. package/src/internal/README.md +0 -3
  406. package/src/internal/builtin-types.ts +0 -93
  407. package/src/internal/detect-platform.ts +0 -196
  408. package/src/internal/errors.ts +0 -33
  409. package/src/internal/headers.ts +0 -97
  410. package/src/internal/parse.ts +0 -56
  411. package/src/internal/qs/LICENSE.md +0 -13
  412. package/src/internal/qs/README.md +0 -3
  413. package/src/internal/qs/formats.ts +0 -10
  414. package/src/internal/qs/index.ts +0 -13
  415. package/src/internal/qs/stringify.ts +0 -385
  416. package/src/internal/qs/types.ts +0 -71
  417. package/src/internal/qs/utils.ts +0 -265
  418. package/src/internal/request-options.ts +0 -91
  419. package/src/internal/shim-types.ts +0 -26
  420. package/src/internal/shims.ts +0 -107
  421. package/src/internal/to-file.ts +0 -154
  422. package/src/internal/types.ts +0 -93
  423. package/src/internal/uploads.ts +0 -187
  424. package/src/internal/utils/base64.ts +0 -40
  425. package/src/internal/utils/bytes.ts +0 -32
  426. package/src/internal/utils/env.ts +0 -18
  427. package/src/internal/utils/log.ts +0 -129
  428. package/src/internal/utils/path.ts +0 -88
  429. package/src/internal/utils/query.ts +0 -7
  430. package/src/internal/utils/sleep.ts +0 -3
  431. package/src/internal/utils/uuid.ts +0 -17
  432. package/src/internal/utils/values.ts +0 -105
  433. package/src/internal/utils.ts +0 -9
  434. package/src/lib/.keep +0 -4
  435. package/src/resource.ts +0 -2
  436. package/src/resources/connect/connect.ts +0 -70
  437. package/src/resources/connect/index.ts +0 -9
  438. package/src/resources/connect/integrations.ts +0 -130
  439. package/src/resources/connect.ts +0 -3
  440. package/src/resources/health.ts +0 -36
  441. package/src/resources/index.ts +0 -16
  442. package/src/resources/media.ts +0 -38
  443. package/src/resources/platforms.ts +0 -39
  444. package/src/resources/posts/index.ts +0 -20
  445. package/src/resources/posts/posts.ts +0 -472
  446. package/src/resources/posts/scheduled.ts +0 -180
  447. package/src/resources/posts.ts +0 -3
  448. package/src/resources.ts +0 -1
  449. package/src/tsconfig.json +0 -11
  450. package/src/uploads.ts +0 -2
  451. package/src/version.ts +0 -1
  452. package/uploads.d.mts +0 -3
  453. package/uploads.d.mts.map +0 -1
  454. package/uploads.d.ts +0 -3
  455. package/uploads.d.ts.map +0 -1
  456. package/uploads.js +0 -6
  457. package/uploads.js.map +0 -1
  458. package/uploads.mjs +0 -3
  459. package/uploads.mjs.map +0 -1
  460. package/version.d.mts +0 -2
  461. package/version.d.mts.map +0 -1
  462. package/version.d.ts +0 -2
  463. package/version.d.ts.map +0 -1
  464. package/version.js +0 -5
  465. package/version.js.map +0 -1
  466. package/version.mjs +0 -2
  467. package/version.mjs.map +0 -1
package/client.d.mts DELETED
@@ -1,190 +0,0 @@
1
- import type { RequestInit, RequestInfo } from "./internal/builtin-types.mjs";
2
- import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.mjs";
3
- export type { Logger, LogLevel } from "./internal/utils/log.mjs";
4
- import * as Opts from "./internal/request-options.mjs";
5
- import * as Errors from "./core/error.mjs";
6
- import * as Uploads from "./core/uploads.mjs";
7
- import * as API from "./resources/index.mjs";
8
- import { APIPromise } from "./core/api-promise.mjs";
9
- import { Health, HealthCheckResponse, HealthVerifyAccessKeyResponse } from "./resources/health.mjs";
10
- import { Media, MediaUploadParams, MediaUploadResponse } from "./resources/media.mjs";
11
- import { PlatformListResponse, Platforms } from "./resources/platforms.mjs";
12
- import { Connect, ConnectGetOAuthURLParams, ConnectGetOAuthURLResponse } from "./resources/connect/connect.mjs";
13
- import { PostCreateParams, PostCreateResponse, PostDeleteResponse, PostListParams, PostListResponse, PostRetrieveResponse, Posts, Status } from "./resources/posts/posts.mjs";
14
- import { type Fetch } from "./internal/builtin-types.mjs";
15
- import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
16
- import { FinalRequestOptions, RequestOptions } from "./internal/request-options.mjs";
17
- import { type LogLevel, type Logger } from "./internal/utils/log.mjs";
18
- export interface ClientOptions {
19
- /**
20
- * Defaults to process.env['POSTPEER_API_KEY'].
21
- */
22
- apiKey?: string | undefined;
23
- /**
24
- * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
25
- *
26
- * Defaults to process.env['POSTPEER_BASE_URL'].
27
- */
28
- baseURL?: string | null | undefined;
29
- /**
30
- * The maximum amount of time (in milliseconds) that the client should wait for a response
31
- * from the server before timing out a single request.
32
- *
33
- * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
34
- * much longer than this timeout before the promise succeeds or fails.
35
- *
36
- * @unit milliseconds
37
- */
38
- timeout?: number | undefined;
39
- /**
40
- * Additional `RequestInit` options to be passed to `fetch` calls.
41
- * Properties will be overridden by per-request `fetchOptions`.
42
- */
43
- fetchOptions?: MergedRequestInit | undefined;
44
- /**
45
- * Specify a custom `fetch` function implementation.
46
- *
47
- * If not provided, we expect that `fetch` is defined globally.
48
- */
49
- fetch?: Fetch | undefined;
50
- /**
51
- * The maximum number of times that the client will retry a request in case of a
52
- * temporary failure, like a network error or a 5XX error from the server.
53
- *
54
- * @default 2
55
- */
56
- maxRetries?: number | undefined;
57
- /**
58
- * Default headers to include with every request to the API.
59
- *
60
- * These can be removed in individual requests by explicitly setting the
61
- * header to `null` in request options.
62
- */
63
- defaultHeaders?: HeadersLike | undefined;
64
- /**
65
- * Default query parameters to include with every request to the API.
66
- *
67
- * These can be removed in individual requests by explicitly setting the
68
- * param to `undefined` in request options.
69
- */
70
- defaultQuery?: Record<string, string | undefined> | undefined;
71
- /**
72
- * Set the log level.
73
- *
74
- * Defaults to process.env['POSTPEER_LOG'] or 'warn' if it isn't set.
75
- */
76
- logLevel?: LogLevel | undefined;
77
- /**
78
- * Set the logger.
79
- *
80
- * Defaults to globalThis.console.
81
- */
82
- logger?: Logger | undefined;
83
- }
84
- /**
85
- * API Client for interfacing with the Postpeer API.
86
- */
87
- export declare class Postpeer {
88
- #private;
89
- apiKey: string;
90
- baseURL: string;
91
- maxRetries: number;
92
- timeout: number;
93
- logger: Logger;
94
- logLevel: LogLevel | undefined;
95
- fetchOptions: MergedRequestInit | undefined;
96
- private fetch;
97
- protected idempotencyHeader?: string;
98
- private _options;
99
- /**
100
- * API Client for interfacing with the Postpeer API.
101
- *
102
- * @param {string | undefined} [opts.apiKey=process.env['POSTPEER_API_KEY'] ?? undefined]
103
- * @param {string} [opts.baseURL=process.env['POSTPEER_BASE_URL'] ?? https://api.postpeer.dev] - Override the default base URL for the API.
104
- * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
105
- * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
106
- * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
107
- * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
108
- * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
109
- * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
110
- */
111
- constructor({ baseURL, apiKey, ...opts }?: ClientOptions);
112
- /**
113
- * Create a new client instance re-using the same options given to the current client with optional overriding.
114
- */
115
- withOptions(options: Partial<ClientOptions>): this;
116
- protected defaultQuery(): Record<string, string | undefined> | undefined;
117
- protected validateHeaders({ values, nulls }: NullableHeaders): void;
118
- protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
119
- protected stringifyQuery(query: object | Record<string, unknown>): string;
120
- private getUserAgent;
121
- protected defaultIdempotencyKey(): string;
122
- protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
123
- buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
124
- /**
125
- * Used as a callback for mutating the given `FinalRequestOptions` object.
126
- */
127
- protected prepareOptions(options: FinalRequestOptions): Promise<void>;
128
- /**
129
- * Used as a callback for mutating the given `RequestInit` object.
130
- *
131
- * This is useful for cases where you want to add certain headers based off of
132
- * the request properties, e.g. `method` or `url`.
133
- */
134
- protected prepareRequest(request: RequestInit, { url, options }: {
135
- url: string;
136
- options: FinalRequestOptions;
137
- }): Promise<void>;
138
- get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
139
- post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
140
- patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
141
- put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
142
- delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
143
- private methodRequest;
144
- request<Rsp>(options: PromiseOrValue<FinalRequestOptions>, remainingRetries?: number | null): APIPromise<Rsp>;
145
- private makeRequest;
146
- fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
147
- private shouldRetry;
148
- private retryRequest;
149
- private calculateDefaultRetryTimeoutMillis;
150
- buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
151
- retryCount?: number;
152
- }): Promise<{
153
- req: FinalizedRequestInit;
154
- url: string;
155
- timeout: number;
156
- }>;
157
- private buildHeaders;
158
- private _makeAbort;
159
- private buildBody;
160
- static Postpeer: typeof Postpeer;
161
- static DEFAULT_TIMEOUT: number;
162
- static PostpeerError: typeof Errors.PostpeerError;
163
- static APIError: typeof Errors.APIError;
164
- static APIConnectionError: typeof Errors.APIConnectionError;
165
- static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
166
- static APIUserAbortError: typeof Errors.APIUserAbortError;
167
- static NotFoundError: typeof Errors.NotFoundError;
168
- static ConflictError: typeof Errors.ConflictError;
169
- static RateLimitError: typeof Errors.RateLimitError;
170
- static BadRequestError: typeof Errors.BadRequestError;
171
- static AuthenticationError: typeof Errors.AuthenticationError;
172
- static InternalServerError: typeof Errors.InternalServerError;
173
- static PermissionDeniedError: typeof Errors.PermissionDeniedError;
174
- static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
175
- static toFile: typeof Uploads.toFile;
176
- health: API.Health;
177
- connect: API.Connect;
178
- platforms: API.Platforms;
179
- posts: API.Posts;
180
- media: API.Media;
181
- }
182
- export declare namespace Postpeer {
183
- export type RequestOptions = Opts.RequestOptions;
184
- export { Health as Health, type HealthCheckResponse as HealthCheckResponse, type HealthVerifyAccessKeyResponse as HealthVerifyAccessKeyResponse, };
185
- export { Connect as Connect, type ConnectGetOAuthURLResponse as ConnectGetOAuthURLResponse, type ConnectGetOAuthURLParams as ConnectGetOAuthURLParams, };
186
- export { Platforms as Platforms, type PlatformListResponse as PlatformListResponse };
187
- export { Posts as Posts, type Status as Status, type PostCreateResponse as PostCreateResponse, type PostRetrieveResponse as PostRetrieveResponse, type PostListResponse as PostListResponse, type PostDeleteResponse as PostDeleteResponse, type PostCreateParams as PostCreateParams, type PostListParams as PostListParams, };
188
- export { Media as Media, type MediaUploadResponse as MediaUploadResponse, type MediaUploadParams as MediaUploadParams, };
189
- }
190
- //# sourceMappingURL=client.d.mts.map
package/client.d.mts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY,qCAAiC;AACnF,OAAO,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,6BAAyB;AAI5G,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,iCAA6B;AAK7D,OAAO,KAAK,IAAI,uCAAmC;AAGnD,OAAO,KAAK,MAAM,yBAAqB;AACvC,OAAO,KAAK,OAAO,2BAAuB;AAC1C,OAAO,KAAK,GAAG,8BAA0B;AACzC,OAAO,EAAE,UAAU,EAAE,+BAA2B;AAChD,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,+BAA2B;AAChG,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,8BAA0B;AAClF,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,kCAA8B;AACxE,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,wCAAoC;AAC5G,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,EACL,MAAM,EACP,oCAAgC;AACjC,OAAO,EAAE,KAAK,KAAK,EAAE,qCAAiC;AACtD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAgB,+BAA2B;AAChF,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uCAAmC;AAEjF,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,MAAM,E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AkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,cAAc,IAAI,cAAc,GACtC,CAAC;IAEF,OAAO,EACL,KAAK,IAAI,KAAK,EACd,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
package/client.d.ts DELETED
@@ -1,190 +0,0 @@
1
- import type { RequestInit, RequestInfo } from "./internal/builtin-types.js";
2
- import type { PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from "./internal/types.js";
3
- export type { Logger, LogLevel } from "./internal/utils/log.js";
4
- import * as Opts from "./internal/request-options.js";
5
- import * as Errors from "./core/error.js";
6
- import * as Uploads from "./core/uploads.js";
7
- import * as API from "./resources/index.js";
8
- import { APIPromise } from "./core/api-promise.js";
9
- import { Health, HealthCheckResponse, HealthVerifyAccessKeyResponse } from "./resources/health.js";
10
- import { Media, MediaUploadParams, MediaUploadResponse } from "./resources/media.js";
11
- import { PlatformListResponse, Platforms } from "./resources/platforms.js";
12
- import { Connect, ConnectGetOAuthURLParams, ConnectGetOAuthURLResponse } from "./resources/connect/connect.js";
13
- import { PostCreateParams, PostCreateResponse, PostDeleteResponse, PostListParams, PostListResponse, PostRetrieveResponse, Posts, Status } from "./resources/posts/posts.js";
14
- import { type Fetch } from "./internal/builtin-types.js";
15
- import { HeadersLike, NullableHeaders } from "./internal/headers.js";
16
- import { FinalRequestOptions, RequestOptions } from "./internal/request-options.js";
17
- import { type LogLevel, type Logger } from "./internal/utils/log.js";
18
- export interface ClientOptions {
19
- /**
20
- * Defaults to process.env['POSTPEER_API_KEY'].
21
- */
22
- apiKey?: string | undefined;
23
- /**
24
- * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
25
- *
26
- * Defaults to process.env['POSTPEER_BASE_URL'].
27
- */
28
- baseURL?: string | null | undefined;
29
- /**
30
- * The maximum amount of time (in milliseconds) that the client should wait for a response
31
- * from the server before timing out a single request.
32
- *
33
- * Note that request timeouts are retried by default, so in a worst-case scenario you may wait
34
- * much longer than this timeout before the promise succeeds or fails.
35
- *
36
- * @unit milliseconds
37
- */
38
- timeout?: number | undefined;
39
- /**
40
- * Additional `RequestInit` options to be passed to `fetch` calls.
41
- * Properties will be overridden by per-request `fetchOptions`.
42
- */
43
- fetchOptions?: MergedRequestInit | undefined;
44
- /**
45
- * Specify a custom `fetch` function implementation.
46
- *
47
- * If not provided, we expect that `fetch` is defined globally.
48
- */
49
- fetch?: Fetch | undefined;
50
- /**
51
- * The maximum number of times that the client will retry a request in case of a
52
- * temporary failure, like a network error or a 5XX error from the server.
53
- *
54
- * @default 2
55
- */
56
- maxRetries?: number | undefined;
57
- /**
58
- * Default headers to include with every request to the API.
59
- *
60
- * These can be removed in individual requests by explicitly setting the
61
- * header to `null` in request options.
62
- */
63
- defaultHeaders?: HeadersLike | undefined;
64
- /**
65
- * Default query parameters to include with every request to the API.
66
- *
67
- * These can be removed in individual requests by explicitly setting the
68
- * param to `undefined` in request options.
69
- */
70
- defaultQuery?: Record<string, string | undefined> | undefined;
71
- /**
72
- * Set the log level.
73
- *
74
- * Defaults to process.env['POSTPEER_LOG'] or 'warn' if it isn't set.
75
- */
76
- logLevel?: LogLevel | undefined;
77
- /**
78
- * Set the logger.
79
- *
80
- * Defaults to globalThis.console.
81
- */
82
- logger?: Logger | undefined;
83
- }
84
- /**
85
- * API Client for interfacing with the Postpeer API.
86
- */
87
- export declare class Postpeer {
88
- #private;
89
- apiKey: string;
90
- baseURL: string;
91
- maxRetries: number;
92
- timeout: number;
93
- logger: Logger;
94
- logLevel: LogLevel | undefined;
95
- fetchOptions: MergedRequestInit | undefined;
96
- private fetch;
97
- protected idempotencyHeader?: string;
98
- private _options;
99
- /**
100
- * API Client for interfacing with the Postpeer API.
101
- *
102
- * @param {string | undefined} [opts.apiKey=process.env['POSTPEER_API_KEY'] ?? undefined]
103
- * @param {string} [opts.baseURL=process.env['POSTPEER_BASE_URL'] ?? https://api.postpeer.dev] - Override the default base URL for the API.
104
- * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
105
- * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
106
- * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
107
- * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
108
- * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API.
109
- * @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
110
- */
111
- constructor({ baseURL, apiKey, ...opts }?: ClientOptions);
112
- /**
113
- * Create a new client instance re-using the same options given to the current client with optional overriding.
114
- */
115
- withOptions(options: Partial<ClientOptions>): this;
116
- protected defaultQuery(): Record<string, string | undefined> | undefined;
117
- protected validateHeaders({ values, nulls }: NullableHeaders): void;
118
- protected authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined>;
119
- protected stringifyQuery(query: object | Record<string, unknown>): string;
120
- private getUserAgent;
121
- protected defaultIdempotencyKey(): string;
122
- protected makeStatusError(status: number, error: Object, message: string | undefined, headers: Headers): Errors.APIError;
123
- buildURL(path: string, query: Record<string, unknown> | null | undefined, defaultBaseURL?: string | undefined): string;
124
- /**
125
- * Used as a callback for mutating the given `FinalRequestOptions` object.
126
- */
127
- protected prepareOptions(options: FinalRequestOptions): Promise<void>;
128
- /**
129
- * Used as a callback for mutating the given `RequestInit` object.
130
- *
131
- * This is useful for cases where you want to add certain headers based off of
132
- * the request properties, e.g. `method` or `url`.
133
- */
134
- protected prepareRequest(request: RequestInit, { url, options }: {
135
- url: string;
136
- options: FinalRequestOptions;
137
- }): Promise<void>;
138
- get<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
139
- post<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
140
- patch<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
141
- put<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
142
- delete<Rsp>(path: string, opts?: PromiseOrValue<RequestOptions>): APIPromise<Rsp>;
143
- private methodRequest;
144
- request<Rsp>(options: PromiseOrValue<FinalRequestOptions>, remainingRetries?: number | null): APIPromise<Rsp>;
145
- private makeRequest;
146
- fetchWithTimeout(url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController): Promise<Response>;
147
- private shouldRetry;
148
- private retryRequest;
149
- private calculateDefaultRetryTimeoutMillis;
150
- buildRequest(inputOptions: FinalRequestOptions, { retryCount }?: {
151
- retryCount?: number;
152
- }): Promise<{
153
- req: FinalizedRequestInit;
154
- url: string;
155
- timeout: number;
156
- }>;
157
- private buildHeaders;
158
- private _makeAbort;
159
- private buildBody;
160
- static Postpeer: typeof Postpeer;
161
- static DEFAULT_TIMEOUT: number;
162
- static PostpeerError: typeof Errors.PostpeerError;
163
- static APIError: typeof Errors.APIError;
164
- static APIConnectionError: typeof Errors.APIConnectionError;
165
- static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
166
- static APIUserAbortError: typeof Errors.APIUserAbortError;
167
- static NotFoundError: typeof Errors.NotFoundError;
168
- static ConflictError: typeof Errors.ConflictError;
169
- static RateLimitError: typeof Errors.RateLimitError;
170
- static BadRequestError: typeof Errors.BadRequestError;
171
- static AuthenticationError: typeof Errors.AuthenticationError;
172
- static InternalServerError: typeof Errors.InternalServerError;
173
- static PermissionDeniedError: typeof Errors.PermissionDeniedError;
174
- static UnprocessableEntityError: typeof Errors.UnprocessableEntityError;
175
- static toFile: typeof Uploads.toFile;
176
- health: API.Health;
177
- connect: API.Connect;
178
- platforms: API.Platforms;
179
- posts: API.Posts;
180
- media: API.Media;
181
- }
182
- export declare namespace Postpeer {
183
- export type RequestOptions = Opts.RequestOptions;
184
- export { Health as Health, type HealthCheckResponse as HealthCheckResponse, type HealthVerifyAccessKeyResponse as HealthVerifyAccessKeyResponse, };
185
- export { Connect as Connect, type ConnectGetOAuthURLResponse as ConnectGetOAuthURLResponse, type ConnectGetOAuthURLParams as ConnectGetOAuthURLParams, };
186
- export { Platforms as Platforms, type PlatformListResponse as PlatformListResponse };
187
- export { Posts as Posts, type Status as Status, type PostCreateResponse as PostCreateResponse, type PostRetrieveResponse as PostRetrieveResponse, type PostListResponse as PostListResponse, type PostDeleteResponse as PostDeleteResponse, type PostCreateParams as PostCreateParams, type PostListParams as PostListParams, };
188
- export { Media as Media, type MediaUploadResponse as MediaUploadResponse, type MediaUploadParams as MediaUploadParams, };
189
- }
190
- //# sourceMappingURL=client.d.ts.map
package/client.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY,oCAAiC;AACnF,OAAO,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,4BAAyB;AAI5G,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,gCAA6B;AAK7D,OAAO,KAAK,IAAI,sCAAmC;AAGnD,OAAO,KAAK,MAAM,wBAAqB;AACvC,OAAO,KAAK,OAAO,0BAAuB;AAC1C,OAAO,KAAK,GAAG,6BAA0B;AACzC,OAAO,EAAE,UAAU,EAAE,8BAA2B;AAChD,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,8BAA2B;AAChG,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,6BAA0B;AAClF,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,iCAA8B;AACxE,OAAO,EAAE,OAAO,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,uCAAoC;AAC5G,OAAO,EACL,gBAAgB,EAChB,kBA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