@oomol-lab/open-connector 1.9.0 → 1.9.1

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 (395) hide show
  1. package/assets/open-connector/catalog/apps/agentearth.json +441 -0
  2. package/assets/open-connector/catalog/apps/appgrowing_mcp.json +863 -0
  3. package/assets/open-connector/catalog/apps/arcmira.json +610 -0
  4. package/assets/open-connector/catalog/apps/bainiu.json +654 -0
  5. package/assets/open-connector/catalog/apps/chaport.json +331 -0
  6. package/assets/open-connector/catalog/apps/cnb.json +1408 -0
  7. package/assets/open-connector/catalog/apps/crtsh.json +123 -0
  8. package/assets/open-connector/catalog/apps/eastmoney_miaoxiang.json +406 -0
  9. package/assets/open-connector/catalog/apps/fastmoss_mcp.json +876 -876
  10. package/assets/open-connector/catalog/apps/ftshare.json +1162 -0
  11. package/assets/open-connector/catalog/apps/fusion-api.json +143 -0
  12. package/assets/open-connector/catalog/apps/fxbaogao.json +308 -0
  13. package/assets/open-connector/catalog/apps/github.json +38 -3
  14. package/assets/open-connector/catalog/apps/hrmos_kintai.json +7519 -0
  15. package/assets/open-connector/catalog/apps/humor_api.json +351 -0
  16. package/assets/open-connector/catalog/apps/kaonavi.json +1723 -0
  17. package/assets/open-connector/catalog/apps/linear_mcp.json +882 -22
  18. package/assets/open-connector/catalog/apps/listinggood.json +362 -0
  19. package/assets/open-connector/catalog/apps/notion_mcp.json +338 -1
  20. package/assets/open-connector/catalog/apps/outlook.json +414 -0
  21. package/assets/open-connector/catalog/apps/porteden.json +1258 -0
  22. package/assets/open-connector/catalog/apps/qiuxiaoce.json +915 -0
  23. package/assets/open-connector/catalog/apps/qqmusic.json +1834 -0
  24. package/assets/open-connector/catalog/apps/rakuraku_seisan.json +217 -0
  25. package/assets/open-connector/catalog/apps/redfox.json +9661 -897
  26. package/assets/open-connector/catalog/apps/salesforce.json +4907 -0
  27. package/assets/open-connector/catalog/apps/sansan.json +4594 -0
  28. package/assets/open-connector/catalog/apps/smarthr.json +8071 -0
  29. package/assets/open-connector/catalog/apps/smooth.json +914 -0
  30. package/assets/open-connector/catalog/apps/tapd.json +727 -0
  31. package/assets/open-connector/catalog/apps/tencent_meeting_mcp.json +1301 -0
  32. package/assets/open-connector/catalog/apps/threatfox.json +203 -0
  33. package/assets/open-connector/catalog/apps/tradebee.json +915 -0
  34. package/assets/open-connector/catalog/apps/twittrapi.json +4914 -0
  35. package/assets/open-connector/catalog/apps/urlhaus.json +246 -0
  36. package/assets/open-connector/catalog/apps/weread.json +1514 -0
  37. package/assets/open-connector/catalog/apps/whatsapp.json +12 -0
  38. package/assets/open-connector/catalog/apps/zhiliaobiaoxun.json +812 -0
  39. package/assets/open-connector/catalog/apps-index.json +1 -1
  40. package/package.json +2 -1
  41. package/src/connection-service.js +55 -11
  42. package/src/core/provider-error-codes.d.ts +9 -0
  43. package/src/core/provider-error-codes.js +13 -0
  44. package/src/core/request.d.ts +2 -0
  45. package/src/core/request.js +11 -2
  46. package/src/mail/imap-smtp/protocol.js +4 -3
  47. package/src/oauth/oauth-flow-service.js +1 -0
  48. package/src/oauth/oauth-token.d.ts +2 -0
  49. package/src/providers/17track/runtime.js +17 -20
  50. package/src/providers/action-contracts.generated.d.ts +36 -6
  51. package/src/providers/agentearth/actions.d.ts +2 -0
  52. package/src/providers/agentearth/actions.js +100 -0
  53. package/src/providers/agentearth/executors.d.ts +4 -0
  54. package/src/providers/agentearth/executors.js +109 -0
  55. package/src/providers/appgrowing_mcp/actions.d.ts +2 -0
  56. package/src/providers/appgrowing_mcp/actions.js +175 -0
  57. package/src/providers/appgrowing_mcp/executors.d.ts +4 -0
  58. package/src/providers/appgrowing_mcp/executors.js +66 -0
  59. package/src/providers/arcmira/executors.d.ts +3 -0
  60. package/src/providers/arcmira/executors.js +8 -0
  61. package/src/providers/arcmira/runtime.d.ts +6 -0
  62. package/src/providers/arcmira/runtime.js +41 -0
  63. package/src/providers/bainiu/actions.d.ts +2 -0
  64. package/src/providers/bainiu/actions.js +108 -0
  65. package/src/providers/bainiu/executors.d.ts +4 -0
  66. package/src/providers/bainiu/executors.js +113 -0
  67. package/src/providers/baixiao/executors.js +1 -1
  68. package/src/providers/bing_webmaster/executors.js +1 -1
  69. package/src/providers/chaport/actions.d.ts +2 -0
  70. package/src/providers/chaport/actions.js +70 -0
  71. package/src/providers/chaport/executors.d.ts +4 -0
  72. package/src/providers/chaport/executors.js +128 -0
  73. package/src/providers/clickup/runtime.js +49 -52
  74. package/src/providers/cnb/actions.d.ts +2 -0
  75. package/src/providers/cnb/actions.js +341 -0
  76. package/src/providers/cnb/executors.d.ts +4 -0
  77. package/src/providers/cnb/executors.js +135 -0
  78. package/src/providers/coupontools/runtime.js +11 -14
  79. package/src/providers/crtsh/executors.d.ts +3 -0
  80. package/src/providers/crtsh/executors.js +19 -0
  81. package/src/providers/crtsh/runtime.d.ts +17 -0
  82. package/src/providers/crtsh/runtime.js +84 -0
  83. package/src/providers/eastmoney_miaoxiang/actions.d.ts +2 -0
  84. package/src/providers/eastmoney_miaoxiang/actions.js +95 -0
  85. package/src/providers/eastmoney_miaoxiang/executors.d.ts +4 -0
  86. package/src/providers/eastmoney_miaoxiang/executors.js +81 -0
  87. package/src/providers/fastmoss_mcp/actions-content.d.ts +2 -0
  88. package/src/providers/fastmoss_mcp/actions-content.js +140 -0
  89. package/src/providers/fastmoss_mcp/actions-creator.d.ts +2 -0
  90. package/src/providers/fastmoss_mcp/actions-creator.js +154 -0
  91. package/src/providers/fastmoss_mcp/actions-product.d.ts +2 -0
  92. package/src/providers/fastmoss_mcp/actions-product.js +167 -0
  93. package/src/providers/fastmoss_mcp/actions-research.d.ts +2 -0
  94. package/src/providers/fastmoss_mcp/actions-research.js +174 -0
  95. package/src/providers/fastmoss_mcp/actions-shop.d.ts +2 -0
  96. package/src/providers/fastmoss_mcp/actions-shop.js +142 -0
  97. package/src/providers/fastmoss_mcp/actions.js +11 -12
  98. package/src/providers/fastmoss_mcp/schemas.d.ts +51 -0
  99. package/src/providers/fastmoss_mcp/schemas.js +52 -0
  100. package/src/providers/ftshare/actions.d.ts +2 -0
  101. package/src/providers/ftshare/actions.js +124 -0
  102. package/src/providers/ftshare/executors.d.ts +4 -0
  103. package/src/providers/ftshare/executors.js +102 -0
  104. package/src/providers/fusion-api/operations.js +37 -0
  105. package/src/providers/fxbaogao/actions.d.ts +2 -0
  106. package/src/providers/fxbaogao/actions.js +74 -0
  107. package/src/providers/fxbaogao/executors.d.ts +4 -0
  108. package/src/providers/fxbaogao/executors.js +155 -0
  109. package/src/providers/github/app-installation.d.ts +37 -0
  110. package/src/providers/github/app-installation.js +233 -0
  111. package/src/providers/github/executors.js +93 -15
  112. package/src/providers/github/runtime-repository.js +21 -1
  113. package/src/providers/github/runtime-shared.d.ts +2 -0
  114. package/src/providers/github/runtime-shared.js +1 -0
  115. package/src/providers/googledrive/runtime-request.js +3 -3
  116. package/src/providers/hrmos_kintai/actions.d.ts +2 -0
  117. package/src/providers/hrmos_kintai/actions.js +139 -0
  118. package/src/providers/hrmos_kintai/attendance-actions.d.ts +2 -0
  119. package/src/providers/hrmos_kintai/attendance-actions.js +276 -0
  120. package/src/providers/hrmos_kintai/business-actions.d.ts +2 -0
  121. package/src/providers/hrmos_kintai/business-actions.js +143 -0
  122. package/src/providers/hrmos_kintai/business-schemas.d.ts +4 -0
  123. package/src/providers/hrmos_kintai/business-schemas.js +320 -0
  124. package/src/providers/hrmos_kintai/executors.d.ts +4 -0
  125. package/src/providers/hrmos_kintai/executors.js +61 -0
  126. package/src/providers/hrmos_kintai/export-actions.d.ts +2 -0
  127. package/src/providers/hrmos_kintai/export-actions.js +58 -0
  128. package/src/providers/hrmos_kintai/operations.d.ts +9 -0
  129. package/src/providers/hrmos_kintai/operations.js +278 -0
  130. package/src/providers/hrmos_kintai/runtime.d.ts +10 -0
  131. package/src/providers/hrmos_kintai/runtime.js +217 -0
  132. package/src/providers/hrmos_kintai/schemas.d.ts +10 -0
  133. package/src/providers/hrmos_kintai/schemas.js +70 -0
  134. package/src/providers/humor_api/actions.d.ts +2 -0
  135. package/src/providers/humor_api/actions.js +96 -0
  136. package/src/providers/humor_api/executors.d.ts +4 -0
  137. package/src/providers/humor_api/executors.js +76 -0
  138. package/src/providers/kaonavi/actions.d.ts +4 -0
  139. package/src/providers/kaonavi/actions.js +144 -0
  140. package/src/providers/kaonavi/additional-actions.d.ts +10 -0
  141. package/src/providers/kaonavi/additional-actions.js +203 -0
  142. package/src/providers/kaonavi/executors.d.ts +4 -0
  143. package/src/providers/kaonavi/executors.js +69 -0
  144. package/src/providers/kaonavi/runtime.d.ts +4 -0
  145. package/src/providers/kaonavi/runtime.js +69 -0
  146. package/src/providers/linear_mcp/actions.d.ts +14 -0
  147. package/src/providers/linear_mcp/actions.js +134 -0
  148. package/src/providers/linear_mcp/runtime-mcp.d.ts +7 -1
  149. package/src/providers/linear_mcp/runtime-mcp.js +140 -28
  150. package/src/providers/linkfox/runtime.js +48 -51
  151. package/src/providers/listinggood/actions.d.ts +2 -0
  152. package/src/providers/listinggood/actions.js +95 -0
  153. package/src/providers/listinggood/executors.d.ts +4 -0
  154. package/src/providers/listinggood/executors.js +99 -0
  155. package/src/providers/mcp-tools.d.ts +3 -0
  156. package/src/providers/mcp-tools.js +5 -4
  157. package/src/providers/notion_mcp/executors.js +53 -24
  158. package/src/providers/notion_mcp/mcp-response.d.ts +26 -0
  159. package/src/providers/notion_mcp/mcp-response.js +95 -0
  160. package/src/providers/omise/executors.js +1 -1
  161. package/src/providers/outlook/executors.js +35 -2
  162. package/src/providers/porteden/actions.d.ts +2 -0
  163. package/src/providers/porteden/actions.js +162 -0
  164. package/src/providers/porteden/executors.d.ts +4 -0
  165. package/src/providers/porteden/executors.js +140 -0
  166. package/src/providers/provider-runtime.d.ts +3 -2
  167. package/src/providers/pushover/runtime.js +28 -31
  168. package/src/providers/qianfan/runtime.js +16 -19
  169. package/src/providers/qiuxiaoce/actions.d.ts +2 -0
  170. package/src/providers/qiuxiaoce/actions.js +248 -0
  171. package/src/providers/qiuxiaoce/executors.d.ts +4 -0
  172. package/src/providers/qiuxiaoce/executors.js +76 -0
  173. package/src/providers/qiuxiaoce/routes.d.ts +1 -0
  174. package/src/providers/qiuxiaoce/routes.js +20 -0
  175. package/src/providers/qqmusic/actions.d.ts +2 -0
  176. package/src/providers/qqmusic/actions.js +229 -0
  177. package/src/providers/qqmusic/executors.d.ts +4 -0
  178. package/src/providers/qqmusic/executors.js +92 -0
  179. package/src/providers/qqmusic/report-schema.d.ts +4 -0
  180. package/src/providers/qqmusic/report-schema.js +119 -0
  181. package/src/providers/rakuraku_seisan/actions.d.ts +2 -0
  182. package/src/providers/rakuraku_seisan/actions.js +50 -0
  183. package/src/providers/rakuraku_seisan/executors.d.ts +4 -0
  184. package/src/providers/rakuraku_seisan/executors.js +40 -0
  185. package/src/providers/rakuraku_seisan/runtime.d.ts +8 -0
  186. package/src/providers/rakuraku_seisan/runtime.js +251 -0
  187. package/src/providers/redfox/actions-account.d.ts +2 -0
  188. package/src/providers/redfox/actions-account.js +24 -0
  189. package/src/providers/redfox/actions-autohome.d.ts +2 -0
  190. package/src/providers/redfox/actions-autohome.js +51 -0
  191. package/src/providers/redfox/actions-baijiahao.d.ts +2 -0
  192. package/src/providers/redfox/actions-baijiahao.js +58 -0
  193. package/src/providers/redfox/actions-bilibili.d.ts +2 -0
  194. package/src/providers/redfox/actions-bilibili.js +67 -0
  195. package/src/providers/redfox/actions-dongchedi.d.ts +2 -0
  196. package/src/providers/redfox/actions-dongchedi.js +49 -0
  197. package/src/providers/redfox/actions-douyin.d.ts +2 -0
  198. package/src/providers/redfox/actions-douyin.js +297 -0
  199. package/src/providers/redfox/actions-generation.d.ts +2 -0
  200. package/src/providers/redfox/actions-generation.js +293 -0
  201. package/src/providers/redfox/actions-instagram.d.ts +2 -0
  202. package/src/providers/redfox/actions-instagram.js +49 -0
  203. package/src/providers/redfox/actions-kuaishou.d.ts +2 -0
  204. package/src/providers/redfox/actions-kuaishou.js +53 -0
  205. package/src/providers/redfox/actions-search.d.ts +2 -0
  206. package/src/providers/redfox/actions-search.js +125 -0
  207. package/src/providers/redfox/actions-tiktok.d.ts +2 -0
  208. package/src/providers/redfox/actions-tiktok.js +136 -0
  209. package/src/providers/redfox/actions-tools.d.ts +2 -0
  210. package/src/providers/redfox/actions-tools.js +151 -0
  211. package/src/providers/redfox/actions-toutiao.d.ts +2 -0
  212. package/src/providers/redfox/actions-toutiao.js +68 -0
  213. package/src/providers/redfox/actions-transcription.d.ts +2 -0
  214. package/src/providers/redfox/actions-transcription.js +165 -0
  215. package/src/providers/redfox/actions-wechat-channel.d.ts +2 -0
  216. package/src/providers/redfox/actions-wechat-channel.js +63 -0
  217. package/src/providers/redfox/actions-wechat.d.ts +2 -0
  218. package/src/providers/redfox/actions-wechat.js +302 -0
  219. package/src/providers/redfox/actions-weibo.d.ts +2 -0
  220. package/src/providers/redfox/actions-weibo.js +61 -0
  221. package/src/providers/redfox/actions-x.d.ts +2 -0
  222. package/src/providers/redfox/actions-x.js +126 -0
  223. package/src/providers/redfox/actions-xiaohongshu.d.ts +2 -0
  224. package/src/providers/redfox/actions-xiaohongshu.js +244 -0
  225. package/src/providers/redfox/actions-yiche.d.ts +2 -0
  226. package/src/providers/redfox/actions-yiche.js +59 -0
  227. package/src/providers/redfox/actions-youtube.d.ts +2 -0
  228. package/src/providers/redfox/actions-youtube.js +64 -0
  229. package/src/providers/redfox/actions-zhihu.d.ts +2 -0
  230. package/src/providers/redfox/actions-zhihu.js +26 -0
  231. package/src/providers/redfox/actions.d.ts +2 -0
  232. package/src/providers/redfox/actions.js +49 -0
  233. package/src/providers/redfox/executors.d.ts +2 -14
  234. package/src/providers/redfox/executors.js +28 -551
  235. package/src/providers/redfox/routes.d.ts +11 -0
  236. package/src/providers/redfox/routes.js +329 -0
  237. package/src/providers/redfox/runtime.d.ts +6 -0
  238. package/src/providers/redfox/runtime.js +151 -0
  239. package/src/providers/redfox/schemas.d.ts +9 -0
  240. package/src/providers/redfox/schemas.js +40 -0
  241. package/src/providers/registry.generated.js +30 -0
  242. package/src/providers/salesforce/context.d.ts +16 -0
  243. package/src/providers/salesforce/context.js +58 -0
  244. package/src/providers/salesforce/executors.d.ts +5 -0
  245. package/src/providers/salesforce/executors.js +54 -0
  246. package/src/providers/salesforce/media.d.ts +9 -0
  247. package/src/providers/salesforce/media.js +66 -0
  248. package/src/providers/salesforce/oauth.d.ts +2 -0
  249. package/src/providers/salesforce/oauth.js +89 -0
  250. package/src/providers/salesforce/runtime-analytics.d.ts +2 -0
  251. package/src/providers/salesforce/runtime-analytics.js +60 -0
  252. package/src/providers/salesforce/runtime-automation.d.ts +2 -0
  253. package/src/providers/salesforce/runtime-automation.js +64 -0
  254. package/src/providers/salesforce/runtime-base.d.ts +2 -0
  255. package/src/providers/salesforce/runtime-base.js +51 -0
  256. package/src/providers/salesforce/runtime-bulk.d.ts +2 -0
  257. package/src/providers/salesforce/runtime-bulk.js +98 -0
  258. package/src/providers/salesforce/runtime-data.d.ts +2 -0
  259. package/src/providers/salesforce/runtime-data.js +207 -0
  260. package/src/providers/salesforce/runtime-files.d.ts +2 -0
  261. package/src/providers/salesforce/runtime-files.js +108 -0
  262. package/src/providers/salesforce/transport.d.ts +9 -0
  263. package/src/providers/salesforce/transport.js +65 -0
  264. package/src/providers/sansan/actions.d.ts +2 -0
  265. package/src/providers/sansan/actions.js +165 -0
  266. package/src/providers/sansan/admin-actions.d.ts +2 -0
  267. package/src/providers/sansan/admin-actions.js +181 -0
  268. package/src/providers/sansan/admin.d.ts +2 -0
  269. package/src/providers/sansan/admin.js +42 -0
  270. package/src/providers/sansan/business-actions.d.ts +2 -0
  271. package/src/providers/sansan/business-actions.js +160 -0
  272. package/src/providers/sansan/business.d.ts +2 -0
  273. package/src/providers/sansan/business.js +51 -0
  274. package/src/providers/sansan/executors.d.ts +4 -0
  275. package/src/providers/sansan/executors.js +59 -0
  276. package/src/providers/sansan/file-schema.d.ts +2 -0
  277. package/src/providers/sansan/file-schema.js +8 -0
  278. package/src/providers/sansan/files.d.ts +11 -0
  279. package/src/providers/sansan/files.js +49 -0
  280. package/src/providers/sansan/organization-actions.d.ts +2 -0
  281. package/src/providers/sansan/organization-actions.js +198 -0
  282. package/src/providers/sansan/organization-columns.d.ts +2 -0
  283. package/src/providers/sansan/organization-columns.js +33 -0
  284. package/src/providers/sansan/organization.d.ts +2 -0
  285. package/src/providers/sansan/organization.js +88 -0
  286. package/src/providers/sansan/read.d.ts +2 -0
  287. package/src/providers/sansan/read.js +25 -0
  288. package/src/providers/sansan/request.d.ts +22 -0
  289. package/src/providers/sansan/request.js +94 -0
  290. package/src/providers/sansan/schemas.d.ts +7 -0
  291. package/src/providers/sansan/schemas.js +72 -0
  292. package/src/providers/shopee/runtime.d.ts +33 -29
  293. package/src/providers/shopee/runtime.js +166 -169
  294. package/src/providers/smarthr/actions.d.ts +2 -0
  295. package/src/providers/smarthr/actions.js +286 -0
  296. package/src/providers/smarthr/employee-runtime.d.ts +1 -0
  297. package/src/providers/smarthr/employee-runtime.js +63 -0
  298. package/src/providers/smarthr/employee-schema.d.ts +3 -0
  299. package/src/providers/smarthr/employee-schema.js +222 -0
  300. package/src/providers/smarthr/executors.d.ts +4 -0
  301. package/src/providers/smarthr/executors.js +35 -0
  302. package/src/providers/smarthr/pagination.d.ts +1 -0
  303. package/src/providers/smarthr/pagination.js +84 -0
  304. package/src/providers/smarthr/resource-routes.d.ts +16 -0
  305. package/src/providers/smarthr/resource-routes.js +163 -0
  306. package/src/providers/smarthr/runtime.d.ts +13 -0
  307. package/src/providers/smarthr/runtime.js +242 -0
  308. package/src/providers/smarthr/supplemental-actions.d.ts +2 -0
  309. package/src/providers/smarthr/supplemental-actions.js +541 -0
  310. package/src/providers/smooth/actions.d.ts +2 -0
  311. package/src/providers/smooth/actions.js +138 -0
  312. package/src/providers/smooth/executors.d.ts +4 -0
  313. package/src/providers/smooth/executors.js +102 -0
  314. package/src/providers/tapd/actions.d.ts +8 -0
  315. package/src/providers/tapd/actions.js +89 -0
  316. package/src/providers/tapd/executors.d.ts +4 -0
  317. package/src/providers/tapd/executors.js +137 -0
  318. package/src/providers/teable/runtime.js +12 -15
  319. package/src/providers/tencent_meeting_mcp/actions.d.ts +2 -0
  320. package/src/providers/tencent_meeting_mcp/actions.js +420 -0
  321. package/src/providers/tencent_meeting_mcp/executors.d.ts +4 -0
  322. package/src/providers/tencent_meeting_mcp/executors.js +117 -0
  323. package/src/providers/threatfox/executors.d.ts +4 -0
  324. package/src/providers/threatfox/executors.js +40 -0
  325. package/src/providers/threatfox/runtime.d.ts +15 -0
  326. package/src/providers/threatfox/runtime.js +128 -0
  327. package/src/providers/ticket_tailor/runtime.js +1 -1
  328. package/src/providers/ticketmaster/runtime.js +3 -6
  329. package/src/providers/timelinesai/runtime.js +13 -16
  330. package/src/providers/tradebee/actions.d.ts +2 -0
  331. package/src/providers/tradebee/actions.js +176 -0
  332. package/src/providers/tradebee/executors.d.ts +4 -0
  333. package/src/providers/tradebee/executors.js +83 -0
  334. package/src/providers/twittrapi/executors.d.ts +4 -0
  335. package/src/providers/twittrapi/executors.js +17 -0
  336. package/src/providers/twittrapi/runtime.d.ts +12 -0
  337. package/src/providers/twittrapi/runtime.js +203 -0
  338. package/src/providers/urlhaus/executors.d.ts +4 -0
  339. package/src/providers/urlhaus/executors.js +40 -0
  340. package/src/providers/urlhaus/runtime.d.ts +15 -0
  341. package/src/providers/urlhaus/runtime.js +142 -0
  342. package/src/providers/wangdian/runtime.js +16 -19
  343. package/src/providers/weread/actions.d.ts +2 -0
  344. package/src/providers/weread/actions.js +424 -0
  345. package/src/providers/weread/executors.d.ts +4 -0
  346. package/src/providers/weread/executors.js +98 -0
  347. package/src/providers/whatsapp/runtime.js +6 -1
  348. package/src/providers/workast/runtime.js +12 -17
  349. package/src/providers/youzan/runtime.js +21 -24
  350. package/src/providers/zenkit/runtime.js +13 -19
  351. package/src/providers/zhiliaobiaoxun/actions.d.ts +2 -0
  352. package/src/providers/zhiliaobiaoxun/actions.js +138 -0
  353. package/src/providers/zhiliaobiaoxun/executors.d.ts +4 -0
  354. package/src/providers/zhiliaobiaoxun/executors.js +78 -0
  355. package/src/server/api/auth.d.ts +2 -0
  356. package/src/server/api/auth.js +2 -1
  357. package/src/server/api/console-catalog-routes.d.ts +17 -0
  358. package/src/server/api/console-catalog-routes.js +88 -0
  359. package/src/server/api/console-oauth-routes.d.ts +18 -0
  360. package/src/server/api/console-oauth-routes.js +298 -0
  361. package/src/server/api/docs-routes.d.ts +12 -0
  362. package/src/server/api/docs-routes.js +38 -0
  363. package/src/server/api/http-utils.d.ts +1 -0
  364. package/src/server/api/http-utils.js +8 -0
  365. package/src/server/api/marketplace-routes.d.ts +7 -0
  366. package/src/server/api/marketplace-routes.js +62 -0
  367. package/src/server/api/mcp-routes.d.ts +18 -0
  368. package/src/server/api/mcp-routes.js +37 -0
  369. package/src/server/api/policy-routes.d.ts +13 -0
  370. package/src/server/api/policy-routes.js +50 -0
  371. package/src/server/api/policy-snapshot.d.ts +14 -0
  372. package/src/server/api/policy-snapshot.js +30 -0
  373. package/src/server/api/run-log-routes.d.ts +7 -0
  374. package/src/server/api/run-log-routes.js +70 -0
  375. package/src/server/api/runtime-api.d.ts +0 -7
  376. package/src/server/api/runtime-api.js +0 -13
  377. package/src/server/api/runtime-app-routes.d.ts +10 -0
  378. package/src/server/api/runtime-app-routes.js +72 -0
  379. package/src/server/api/runtime-catalog-routes.d.ts +37 -0
  380. package/src/server/api/runtime-catalog-routes.js +133 -0
  381. package/src/server/api/runtime-execution-routes.d.ts +16 -0
  382. package/src/server/api/runtime-execution-routes.js +198 -0
  383. package/src/server/api/saas-oauth-routes.d.ts +9 -0
  384. package/src/server/api/saas-oauth-routes.js +27 -0
  385. package/src/server/api/saas-project-routes.d.ts +7 -0
  386. package/src/server/api/saas-project-routes.js +16 -0
  387. package/src/server/api/transit-file-routes.d.ts +9 -0
  388. package/src/server/api/transit-file-routes.js +49 -0
  389. package/src/server/api/trigger-routes.d.ts +15 -0
  390. package/src/server/api/trigger-routes.js +48 -0
  391. package/src/server/connect-app.d.ts +1 -0
  392. package/src/server/connect-app.js +3 -1
  393. package/src/server/connect-server.d.ts +3 -54
  394. package/src/server/connect-server.js +95 -1148
  395. package/src/providers/fastmoss_mcp/official-tools.json +0 -2922
@@ -1,28 +1,22 @@
1
1
  import { createHmac } from "node:crypto";
2
- import { looseArray as asArrayOrEmpty, optionalInteger as asOptionalInteger, optionalNumber as asOptionalNumber, optionalRecord as asOptionalObject, optionalString as asOptionalString, optionalBoolean, } from "../../core/cast.js";
2
+ import { looseArray, optionalInteger, optionalNumber, optionalRecord, optionalString, optionalBoolean, recordOrEmpty, } from "../../core/cast.js";
3
3
  import { createGuardedFetch } from "../../core/guarded-fetch.js";
4
4
  import { assertPublicHttpUrl } from "../../core/request.js";
5
- import { ProviderRequestError, providerUserAgent as connectorUserAgent, runProviderRequest, } from "../provider-runtime.js";
5
+ import { ProviderRequestError, providerUserAgent, runProviderRequest } from "../provider-runtime.js";
6
6
  const shopeeImageMaxBytes = 10 * 1024 * 1024;
7
7
  const shopeeImageContentTypes = new Set(["image/jpeg", "image/png"]);
8
- function createShopeeError(code, message, status) {
9
- return new ProviderRequestError(status, message, undefined, code);
10
- }
11
- function asObjectOrEmpty(value) {
12
- return asOptionalObject(value) ?? {};
13
- }
14
8
  function createSsrfGuardedFetch(fetcher, options) {
15
9
  const guardedFetch = createGuardedFetch({
16
10
  fetch: fetcher,
17
- createError: (message) => createShopeeError("invalid_input", message, 400),
11
+ createError: (message) => new ProviderRequestError(400, message, undefined, "invalid_input"),
18
12
  });
19
13
  return async (input, init) => {
20
14
  const url = assertPublicHttpUrl(String(input), {
21
15
  fieldName: options.fieldName,
22
- createError: (message) => createShopeeError("invalid_input", message, 400),
16
+ createError: (message) => new ProviderRequestError(400, message, undefined, "invalid_input"),
23
17
  });
24
18
  if (options.requireHttps && url.protocol !== "https:") {
25
- throw createShopeeError("invalid_input", `${options.fieldName} must use HTTPS.`, 400);
19
+ throw new ProviderRequestError(400, `${options.fieldName} must use HTTPS.`, undefined, "invalid_input");
26
20
  }
27
21
  return guardedFetch(url, init);
28
22
  };
@@ -30,21 +24,21 @@ function createSsrfGuardedFetch(fetcher, options) {
30
24
  export function resolveShopeeApiBaseUrl(clientConfig) {
31
25
  const apiBaseUrl = clientConfig.extra.apiBaseUrl?.trim();
32
26
  if (!apiBaseUrl) {
33
- throw createShopeeError("provider_error", "Shopee API Base URL is unavailable.", 500);
27
+ throw new ProviderRequestError(500, "Shopee API Base URL is unavailable.", undefined, "provider_error");
34
28
  }
35
29
  return apiBaseUrl;
36
30
  }
37
31
  export function parseShopeePartnerId(clientConfig) {
38
32
  const partnerId = Number(clientConfig.clientId);
39
33
  if (!Number.isSafeInteger(partnerId) || partnerId <= 0) {
40
- throw createShopeeError("provider_error", "Shopee Partner ID must be a positive integer.", 500);
34
+ throw new ProviderRequestError(500, "Shopee Partner ID must be a positive integer.", undefined, "provider_error");
41
35
  }
42
36
  return partnerId;
43
37
  }
44
38
  function getShopeePartnerKey(clientConfig) {
45
39
  const partnerKey = clientConfig.clientSecret.trim();
46
40
  if (!partnerKey) {
47
- throw createShopeeError("provider_error", "Shopee Partner Key is unavailable.", 500);
41
+ throw new ProviderRequestError(500, "Shopee Partner Key is unavailable.", undefined, "provider_error");
48
42
  }
49
43
  return partnerKey;
50
44
  }
@@ -58,16 +52,16 @@ export function parseShopeeToken(payload, now = new Date()) {
58
52
  assertShopeePayloadSuccess(payload, "Shopee token request");
59
53
  const accessToken = requireString(payload.access_token, "access_token");
60
54
  const refreshToken = requireString(payload.refresh_token, "refresh_token");
61
- const expiresIn = asOptionalInteger(payload.expire_in);
55
+ const expiresIn = optionalInteger(payload.expire_in);
62
56
  if (expiresIn == null || expiresIn <= 0) {
63
- throw createShopeeError("provider_error", "Shopee token response is missing a valid expire_in value.", 502);
57
+ throw new ProviderRequestError(502, "Shopee token response is missing a valid expire_in value.", undefined, "provider_error");
64
58
  }
65
59
  const shopIds = uniqueEntityIds([
66
- ...asArrayOrEmpty(payload.shop_id_list),
60
+ ...looseArray(payload.shop_id_list),
67
61
  ...(payload.shop_id == null ? [] : [payload.shop_id]),
68
62
  ]);
69
63
  const merchantIds = uniqueEntityIds([
70
- ...asArrayOrEmpty(payload.merchant_id_list),
64
+ ...looseArray(payload.merchant_id_list),
71
65
  ...(payload.merchant_id == null ? [] : [payload.merchant_id]),
72
66
  ]);
73
67
  return {
@@ -76,7 +70,7 @@ export function parseShopeeToken(payload, now = new Date()) {
76
70
  expiresAt: new Date(now.getTime() + expiresIn * 1_000).toISOString(),
77
71
  shopIds,
78
72
  merchantIds,
79
- requestId: asOptionalString(payload.request_id),
73
+ requestId: optionalString(payload.request_id),
80
74
  };
81
75
  }
82
76
  export function createInitialShopeeTokenInventory(token) {
@@ -91,7 +85,7 @@ export function createInitialShopeeTokenInventory(token) {
91
85
  };
92
86
  }
93
87
  export function readShopeeTokenInventory(providerSecret) {
94
- const inventory = asOptionalObject(providerSecret?.tokenInventory);
88
+ const inventory = optionalRecord(providerSecret?.tokenInventory);
95
89
  return {
96
90
  shops: readEntityTokens(inventory?.shops),
97
91
  merchants: readEntityTokens(inventory?.merchants),
@@ -102,7 +96,7 @@ export async function refreshShopeeTokenInventory(input) {
102
96
  const shopEntries = Object.entries(previous.shops);
103
97
  const merchantEntries = Object.entries(previous.merchants);
104
98
  if (shopEntries.length === 0 && merchantEntries.length === 0) {
105
- throw createShopeeError("provider_error", "Shopee connection has no authorized shop or merchant tokens to refresh.", 409);
99
+ throw new ProviderRequestError(409, "Shopee connection has no authorized shop or merchant tokens to refresh.", undefined, "provider_error");
106
100
  }
107
101
  const shops = {};
108
102
  const merchants = {};
@@ -138,7 +132,7 @@ export async function refreshShopeeTokenInventory(input) {
138
132
  }
139
133
  const representative = Object.values(merchants)[0] ?? Object.values(shops)[0];
140
134
  if (!representative) {
141
- throw createShopeeError("provider_error", "Shopee token refresh returned no tokens.", 502);
135
+ throw new ProviderRequestError(502, "Shopee token refresh returned no tokens.", undefined, "provider_error");
142
136
  }
143
137
  return { inventory: { shops, merchants }, representative };
144
138
  }
@@ -159,37 +153,37 @@ export async function executeShopeeAction(actionName, input, context) {
159
153
  return executeEntityGet("/api/v2/merchant/get_merchant_info", "merchant", input, context);
160
154
  case "list_merchant_shops":
161
155
  return executeEntityGet("/api/v2/merchant/get_shop_list_by_merchant", "merchant", input, context, {
162
- page_no: asOptionalInteger(input.page) ?? 1,
163
- page_size: asOptionalInteger(input.pageSize) ?? 100,
156
+ page_no: optionalInteger(input.page) ?? 1,
157
+ page_size: optionalInteger(input.pageSize) ?? 100,
164
158
  });
165
159
  case "get_shop_info":
166
160
  return executeEntityGet("/api/v2/shop/get_shop_info", "shop", input, context);
167
161
  case "list_global_items":
168
162
  return executeEntityGet("/api/v2/global_product/get_global_item_list", "merchant", input, context, {
169
- offset: asOptionalString(input.cursor),
170
- page_size: asOptionalInteger(input.pageSize) ?? 50,
171
- update_time_from: asOptionalInteger(input.updatedFrom),
172
- update_time_to: asOptionalInteger(input.updatedTo),
163
+ offset: optionalString(input.cursor),
164
+ page_size: optionalInteger(input.pageSize) ?? 50,
165
+ update_time_from: optionalInteger(input.updatedFrom),
166
+ update_time_to: optionalInteger(input.updatedTo),
173
167
  });
174
168
  case "get_global_items":
175
169
  return executeEntityGet("/api/v2/global_product/get_global_item_info", "merchant", input, context, {
176
- global_item_id_list: asArrayOrEmpty(input.globalItemIds).join(","),
170
+ global_item_id_list: looseArray(input.globalItemIds).join(","),
177
171
  });
178
172
  case "list_global_categories":
179
173
  return executeEntityGet("/api/v2/global_product/get_category", "merchant", input, context, {
180
- language: asOptionalString(input.language) ?? "en",
174
+ language: optionalString(input.language) ?? "en",
181
175
  });
182
176
  case "get_global_attribute_tree":
183
177
  return executeEntityGet("/api/v2/global_product/get_attribute_tree", "merchant", input, context, {
184
- category_id_list: asArrayOrEmpty(input.categoryIds).join(","),
185
- language: asOptionalString(input.language) ?? "en",
178
+ category_id_list: looseArray(input.categoryIds).join(","),
179
+ language: optionalString(input.language) ?? "en",
186
180
  });
187
181
  case "list_global_brands":
188
182
  return executeEntityGet("/api/v2/global_product/get_brand_list", "merchant", input, context, {
189
- category_id: asOptionalInteger(input.categoryId),
190
- offset: asOptionalInteger(input.offset) ?? 0,
191
- page_size: asOptionalInteger(input.pageSize) ?? 100,
192
- status: asOptionalInteger(input.status) ?? 1,
183
+ category_id: optionalInteger(input.categoryId),
184
+ offset: optionalInteger(input.offset) ?? 0,
185
+ page_size: optionalInteger(input.pageSize) ?? 100,
186
+ status: optionalInteger(input.status) ?? 1,
193
187
  });
194
188
  case "upload_product_image":
195
189
  return uploadShopeeProductImage(input, context);
@@ -197,21 +191,21 @@ export async function executeShopeeAction(actionName, input, context) {
197
191
  return executeEntityPost("/api/v2/global_product/add_global_item", "merchant", input, context, createGlobalItemBody(input));
198
192
  case "list_shop_items":
199
193
  return executeEntityGet("/api/v2/product/get_item_list", "shop", input, context, {
200
- offset: asOptionalInteger(input.offset) ?? 0,
201
- page_size: asOptionalInteger(input.pageSize) ?? 100,
202
- item_status: asArrayOrEmpty(input.statuses),
203
- update_time_from: asOptionalInteger(input.updatedFrom),
204
- update_time_to: asOptionalInteger(input.updatedTo),
194
+ offset: optionalInteger(input.offset) ?? 0,
195
+ page_size: optionalInteger(input.pageSize) ?? 100,
196
+ item_status: looseArray(input.statuses),
197
+ update_time_from: optionalInteger(input.updatedFrom),
198
+ update_time_to: optionalInteger(input.updatedTo),
205
199
  });
206
200
  case "get_shop_items":
207
201
  return executeEntityGet("/api/v2/product/get_item_base_info", "shop", input, context, {
208
- item_id_list: asArrayOrEmpty(input.itemIds).join(","),
202
+ item_id_list: looseArray(input.itemIds).join(","),
209
203
  need_tax_info: optionalBoolean(input.includeTaxInfo),
210
204
  need_complaint_policy: optionalBoolean(input.includeComplaintPolicy),
211
205
  });
212
206
  case "get_item_models":
213
207
  return executeEntityGet("/api/v2/product/get_model_list", "shop", input, context, {
214
- item_id: asOptionalInteger(input.itemId),
208
+ item_id: optionalInteger(input.itemId),
215
209
  });
216
210
  case "update_item_prices":
217
211
  return executeEntityPost("/api/v2/product/update_price", "shop", input, context, createItemPriceBody(input));
@@ -220,17 +214,17 @@ export async function executeShopeeAction(actionName, input, context) {
220
214
  case "list_orders":
221
215
  validateOrderTimeRange(input);
222
216
  return executeEntityGet("/api/v2/order/get_order_list", "shop", input, context, {
223
- time_range_field: asOptionalString(input.timeRangeField) ?? "update_time",
224
- time_from: asOptionalInteger(input.timeFrom),
225
- time_to: asOptionalInteger(input.timeTo),
226
- page_size: asOptionalInteger(input.pageSize) ?? 100,
227
- cursor: asOptionalString(input.cursor),
228
- order_status: asOptionalString(input.orderStatus),
217
+ time_range_field: optionalString(input.timeRangeField) ?? "update_time",
218
+ time_from: optionalInteger(input.timeFrom),
219
+ time_to: optionalInteger(input.timeTo),
220
+ page_size: optionalInteger(input.pageSize) ?? 100,
221
+ cursor: optionalString(input.cursor),
222
+ order_status: optionalString(input.orderStatus),
229
223
  });
230
224
  case "get_orders":
231
225
  return executeEntityGet("/api/v2/order/get_order_detail", "shop", input, context, {
232
- order_sn_list: asArrayOrEmpty(input.orderSerialNumbers).join(","),
233
- response_optional_fields: asArrayOrEmpty(input.optionalFields).join(",") || undefined,
226
+ order_sn_list: looseArray(input.orderSerialNumbers).join(","),
227
+ response_optional_fields: looseArray(input.optionalFields).join(",") || undefined,
234
228
  });
235
229
  case "get_shipping_parameters":
236
230
  return executePackageGet("/api/v2/logistics/get_shipping_parameter", input, context);
@@ -238,59 +232,59 @@ export async function executeShopeeAction(actionName, input, context) {
238
232
  return executeEntityPost("/api/v2/logistics/ship_order", "shop", input, context, createShipOrderBody(input));
239
233
  case "get_tracking_number":
240
234
  return executePackageGet("/api/v2/logistics/get_tracking_number", input, context, {
241
- response_optional_fields: asArrayOrEmpty(input.optionalFields).join(",") || undefined,
235
+ response_optional_fields: looseArray(input.optionalFields).join(",") || undefined,
242
236
  });
243
237
  case "get_tracking_info":
244
238
  return executePackageGet("/api/v2/logistics/get_tracking_info", input, context);
245
239
  case "list_returns":
246
240
  validateReturnTimeRanges(input);
247
241
  return executeEntityGet("/api/v2/returns/get_return_list", "shop", input, context, {
248
- page_no: asOptionalInteger(input.page) ?? 1,
249
- page_size: asOptionalInteger(input.pageSize) ?? 40,
250
- create_time_from: asOptionalInteger(input.createdFrom),
251
- create_time_to: asOptionalInteger(input.createdTo),
252
- update_time_from: asOptionalInteger(input.updatedFrom),
253
- update_time_to: asOptionalInteger(input.updatedTo),
254
- status: asOptionalString(input.status),
255
- negotiation_status: asOptionalString(input.negotiationStatus),
256
- seller_proof_status: asOptionalString(input.sellerProofStatus),
257
- seller_compensation_status: asOptionalString(input.sellerCompensationStatus),
242
+ page_no: optionalInteger(input.page) ?? 1,
243
+ page_size: optionalInteger(input.pageSize) ?? 40,
244
+ create_time_from: optionalInteger(input.createdFrom),
245
+ create_time_to: optionalInteger(input.createdTo),
246
+ update_time_from: optionalInteger(input.updatedFrom),
247
+ update_time_to: optionalInteger(input.updatedTo),
248
+ status: optionalString(input.status),
249
+ negotiation_status: optionalString(input.negotiationStatus),
250
+ seller_proof_status: optionalString(input.sellerProofStatus),
251
+ seller_compensation_status: optionalString(input.sellerCompensationStatus),
258
252
  });
259
253
  case "get_return":
260
254
  return executeEntityGet("/api/v2/returns/get_return_detail", "shop", input, context, {
261
- return_sn: asOptionalString(input.returnSerialNumber),
255
+ return_sn: optionalString(input.returnSerialNumber),
262
256
  });
263
257
  case "get_order_escrow":
264
258
  return executeEntityGet("/api/v2/payment/get_escrow_detail", "shop", input, context, {
265
- order_sn: asOptionalString(input.orderSerialNumber),
259
+ order_sn: optionalString(input.orderSerialNumber),
266
260
  });
267
261
  }
268
- throw createShopeeError("invalid_input", `Unknown Shopee action: ${actionName}`, 400);
262
+ throw new ProviderRequestError(400, `Unknown Shopee action: ${actionName}`, undefined, "invalid_input");
269
263
  }
270
264
  function createItemPriceBody(input) {
271
265
  return {
272
- item_id: asOptionalInteger(input.itemId),
273
- price_list: asArrayOrEmpty(input.prices).map((value) => {
274
- const price = asObjectOrEmpty(value);
266
+ item_id: optionalInteger(input.itemId),
267
+ price_list: looseArray(input.prices).map((value) => {
268
+ const price = recordOrEmpty(value);
275
269
  return {
276
- model_id: asOptionalInteger(price.modelId) ?? 0,
277
- original_price: asOptionalNumber(price.originalPrice),
270
+ model_id: optionalInteger(price.modelId) ?? 0,
271
+ original_price: optionalNumber(price.originalPrice),
278
272
  };
279
273
  }),
280
274
  };
281
275
  }
282
276
  function createItemStockBody(input) {
283
277
  return {
284
- item_id: asOptionalInteger(input.itemId),
285
- stock_list: asArrayOrEmpty(input.stocks).map((value) => {
286
- const stock = asObjectOrEmpty(value);
278
+ item_id: optionalInteger(input.itemId),
279
+ stock_list: looseArray(input.stocks).map((value) => {
280
+ const stock = recordOrEmpty(value);
287
281
  return {
288
- model_id: asOptionalInteger(stock.modelId) ?? 0,
289
- seller_stock: asArrayOrEmpty(stock.sellerStock).map((locationValue) => {
290
- const location = asObjectOrEmpty(locationValue);
282
+ model_id: optionalInteger(stock.modelId) ?? 0,
283
+ seller_stock: looseArray(stock.sellerStock).map((locationValue) => {
284
+ const location = recordOrEmpty(locationValue);
291
285
  return {
292
- location_id: asOptionalString(location.locationId),
293
- stock: asOptionalInteger(location.stock),
286
+ location_id: optionalString(location.locationId),
287
+ stock: optionalInteger(location.stock),
294
288
  };
295
289
  }),
296
290
  };
@@ -298,38 +292,38 @@ function createItemStockBody(input) {
298
292
  };
299
293
  }
300
294
  function createShipOrderBody(input) {
301
- const pickup = asOptionalObject(input.pickup);
302
- const dropoff = asOptionalObject(input.dropoff);
303
- const nonIntegrated = asOptionalObject(input.nonIntegrated);
295
+ const pickup = optionalRecord(input.pickup);
296
+ const dropoff = optionalRecord(input.dropoff);
297
+ const nonIntegrated = optionalRecord(input.nonIntegrated);
304
298
  const shippingMethodCount = [pickup, dropoff, nonIntegrated].filter(Boolean).length;
305
299
  if (shippingMethodCount !== 1) {
306
- throw createShopeeError("invalid_input", "Provide exactly one of pickup, dropoff, or nonIntegrated.", 400);
300
+ throw new ProviderRequestError(400, "Provide exactly one of pickup, dropoff, or nonIntegrated.", undefined, "invalid_input");
307
301
  }
308
302
  return {
309
- order_sn: asOptionalString(input.orderSerialNumber),
310
- package_number: asOptionalString(input.packageNumber),
303
+ order_sn: optionalString(input.orderSerialNumber),
304
+ package_number: optionalString(input.packageNumber),
311
305
  pickup: pickup
312
306
  ? {
313
- address_id: asOptionalInteger(pickup.addressId),
314
- pickup_time_id: asOptionalString(pickup.pickupTimeId),
315
- tracking_number: asOptionalString(pickup.trackingNumber),
307
+ address_id: optionalInteger(pickup.addressId),
308
+ pickup_time_id: optionalString(pickup.pickupTimeId),
309
+ tracking_number: optionalString(pickup.trackingNumber),
316
310
  }
317
311
  : undefined,
318
312
  dropoff: dropoff
319
313
  ? {
320
- branch_id: asOptionalInteger(dropoff.branchId),
321
- sender_real_name: asOptionalString(dropoff.senderRealName),
322
- tracking_number: asOptionalString(dropoff.trackingNumber),
323
- slug: asOptionalString(dropoff.slug),
314
+ branch_id: optionalInteger(dropoff.branchId),
315
+ sender_real_name: optionalString(dropoff.senderRealName),
316
+ tracking_number: optionalString(dropoff.trackingNumber),
317
+ slug: optionalString(dropoff.slug),
324
318
  }
325
319
  : undefined,
326
- non_integrated: nonIntegrated ? { tracking_number: asOptionalString(nonIntegrated.trackingNumber) } : undefined,
320
+ non_integrated: nonIntegrated ? { tracking_number: optionalString(nonIntegrated.trackingNumber) } : undefined,
327
321
  };
328
322
  }
329
323
  async function uploadShopeeProductImage(input, context) {
330
- const imageUrl = asOptionalString(input.imageUrl);
324
+ const imageUrl = optionalString(input.imageUrl);
331
325
  if (!imageUrl) {
332
- throw createShopeeError("invalid_input", "imageUrl is required.", 400);
326
+ throw new ProviderRequestError(400, "imageUrl is required.", undefined, "invalid_input");
333
327
  }
334
328
  const guardedFetch = createSsrfGuardedFetch(context.fetcher, {
335
329
  fieldName: "imageUrl",
@@ -337,24 +331,24 @@ async function uploadShopeeProductImage(input, context) {
337
331
  });
338
332
  const response = await runProviderRequest({ label: "Shopee image download" }, (signal) => guardedFetch(imageUrl, { signal }));
339
333
  if (!response.ok) {
340
- throw createShopeeError("provider_error", `Shopee image download failed with HTTP ${response.status}.`, 502);
334
+ throw new ProviderRequestError(502, `Shopee image download failed with HTTP ${response.status}.`, undefined, "provider_error");
341
335
  }
342
336
  const contentType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase();
343
337
  if (!contentType || !shopeeImageContentTypes.has(contentType)) {
344
- throw createShopeeError("invalid_input", "imageUrl must return a JPG, JPEG, or PNG image.", 400);
338
+ throw new ProviderRequestError(400, "imageUrl must return a JPG, JPEG, or PNG image.", undefined, "invalid_input");
345
339
  }
346
340
  const bytes = await readImageBytes(response);
347
341
  const extension = contentType === "image/png" ? "png" : "jpg";
348
342
  const body = new FormData();
349
343
  body.set("image", new File([bytes], `product.${extension}`, { type: contentType }));
350
- const scene = asOptionalString(input.scene);
351
- const ratio = asOptionalString(input.ratio);
344
+ const scene = optionalString(input.scene);
345
+ const ratio = optionalString(input.ratio);
352
346
  if (scene)
353
347
  body.set("scene", scene);
354
348
  if (ratio)
355
349
  body.set("ratio", ratio);
356
350
  const inventory = readShopeeTokenInventory(context.providerSecret);
357
- const entityId = resolveEntityId("shop", asOptionalInteger(input.shopId), inventory.shops);
351
+ const entityId = resolveEntityId("shop", optionalInteger(input.shopId), inventory.shops);
358
352
  const payload = await requestShopee({
359
353
  path: "/api/v2/media_space/upload_image",
360
354
  level: "shop",
@@ -369,7 +363,7 @@ async function uploadShopeeProductImage(input, context) {
369
363
  async function readImageBytes(response) {
370
364
  const declaredLength = Number(response.headers.get("content-length"));
371
365
  if (Number.isFinite(declaredLength) && declaredLength > shopeeImageMaxBytes) {
372
- throw createShopeeError("invalid_input", "imageUrl exceeds Shopee's 10 MB image limit.", 400);
366
+ throw new ProviderRequestError(400, "imageUrl exceeds Shopee's 10 MB image limit.", undefined, "invalid_input");
373
367
  }
374
368
  if (!response.body) {
375
369
  return new Uint8Array();
@@ -384,7 +378,7 @@ async function readImageBytes(response) {
384
378
  total += value.byteLength;
385
379
  if (total > shopeeImageMaxBytes) {
386
380
  await reader.cancel();
387
- throw createShopeeError("invalid_input", "imageUrl exceeds Shopee's 10 MB image limit.", 400);
381
+ throw new ProviderRequestError(400, "imageUrl exceeds Shopee's 10 MB image limit.", undefined, "invalid_input");
388
382
  }
389
383
  chunks.push(value);
390
384
  }
@@ -397,27 +391,27 @@ async function readImageBytes(response) {
397
391
  return bytes;
398
392
  }
399
393
  function createGlobalItemBody(input) {
400
- const imageIds = asArrayOrEmpty(input.imageIds);
401
- const attributes = asArrayOrEmpty(input.attributes);
402
- const sellerStock = asArrayOrEmpty(input.sellerStock);
403
- const packageLength = asOptionalNumber(input.packageLength);
404
- const packageWidth = asOptionalNumber(input.packageWidth);
405
- const packageHeight = asOptionalNumber(input.packageHeight);
394
+ const imageIds = looseArray(input.imageIds);
395
+ const attributes = looseArray(input.attributes);
396
+ const sellerStock = looseArray(input.sellerStock);
397
+ const packageLength = optionalNumber(input.packageLength);
398
+ const packageWidth = optionalNumber(input.packageWidth);
399
+ const packageHeight = optionalNumber(input.packageHeight);
406
400
  const dimensionCount = [packageLength, packageWidth, packageHeight].filter((value) => value != null).length;
407
401
  if (dimensionCount !== 0 && dimensionCount !== 3) {
408
- throw createShopeeError("invalid_input", "packageLength, packageWidth, and packageHeight must be provided together.", 400);
402
+ throw new ProviderRequestError(400, "packageLength, packageWidth, and packageHeight must be provided together.", undefined, "invalid_input");
409
403
  }
410
- const brandId = asOptionalInteger(input.brandId);
411
- const brandName = asOptionalString(input.brandName);
404
+ const brandId = optionalInteger(input.brandId);
405
+ const brandName = optionalString(input.brandName);
412
406
  return {
413
- category_id: asOptionalInteger(input.categoryId),
414
- global_item_name: asOptionalString(input.name),
415
- description: asOptionalString(input.description),
416
- global_item_sku: asOptionalString(input.sku),
407
+ category_id: optionalInteger(input.categoryId),
408
+ global_item_name: optionalString(input.name),
409
+ description: optionalString(input.description),
410
+ global_item_sku: optionalString(input.sku),
417
411
  image: imageIds.length > 0 ? { image_id_list: imageIds } : undefined,
418
- original_price: asOptionalNumber(input.originalPrice),
419
- normal_stock: asOptionalInteger(input.stock),
420
- weight: asOptionalNumber(input.weight),
412
+ original_price: optionalNumber(input.originalPrice),
413
+ normal_stock: optionalInteger(input.stock),
414
+ weight: optionalNumber(input.weight),
421
415
  dimension: packageLength != null && packageWidth != null && packageHeight != null
422
416
  ? {
423
417
  package_length: packageLength,
@@ -425,20 +419,20 @@ function createGlobalItemBody(input) {
425
419
  package_height: packageHeight,
426
420
  }
427
421
  : undefined,
428
- pre_order: { days_to_ship: asOptionalInteger(input.daysToShip) },
429
- condition: asOptionalString(input.condition),
422
+ pre_order: { days_to_ship: optionalInteger(input.daysToShip) },
423
+ condition: optionalString(input.condition),
430
424
  brand: brandId != null || brandName != null ? { brand_id: brandId, original_brand_name: brandName } : undefined,
431
425
  attribute_list: attributes.length > 0
432
426
  ? attributes.map((value) => {
433
- const attribute = asObjectOrEmpty(value);
427
+ const attribute = recordOrEmpty(value);
434
428
  return {
435
- attribute_id: asOptionalInteger(attribute.attributeId),
436
- attribute_value_list: asArrayOrEmpty(attribute.values).map((item) => {
437
- const attributeValue = asObjectOrEmpty(item);
429
+ attribute_id: optionalInteger(attribute.attributeId),
430
+ attribute_value_list: looseArray(attribute.values).map((item) => {
431
+ const attributeValue = recordOrEmpty(item);
438
432
  return {
439
- value_id: asOptionalInteger(attributeValue.valueId),
440
- original_value_name: asOptionalString(attributeValue.originalValueName),
441
- value_unit: asOptionalString(attributeValue.valueUnit),
433
+ value_id: optionalInteger(attributeValue.valueId),
434
+ original_value_name: optionalString(attributeValue.originalValueName),
435
+ value_unit: optionalString(attributeValue.valueUnit),
442
436
  };
443
437
  }),
444
438
  };
@@ -446,10 +440,10 @@ function createGlobalItemBody(input) {
446
440
  : undefined,
447
441
  seller_stock: sellerStock.length > 0
448
442
  ? sellerStock.map((value) => {
449
- const stock = asObjectOrEmpty(value);
443
+ const stock = recordOrEmpty(value);
450
444
  return {
451
- location_id: asOptionalString(stock.locationId),
452
- stock: asOptionalInteger(stock.stock),
445
+ location_id: optionalString(stock.locationId),
446
+ stock: optionalInteger(stock.stock),
453
447
  };
454
448
  })
455
449
  : undefined,
@@ -469,7 +463,7 @@ export async function fetchShopeeEntityInfo(input) {
469
463
  async function executeEntityGet(path, entityType, input, context, query) {
470
464
  const inventory = readShopeeTokenInventory(context.providerSecret);
471
465
  const entities = entityType === "shop" ? inventory.shops : inventory.merchants;
472
- const requestedId = asOptionalInteger(input[`${entityType}Id`]);
466
+ const requestedId = optionalInteger(input[`${entityType}Id`]);
473
467
  const entityId = resolveEntityId(entityType, requestedId, entities);
474
468
  const payload = await requestShopee({
475
469
  path,
@@ -484,15 +478,15 @@ async function executeEntityGet(path, entityType, input, context, query) {
484
478
  }
485
479
  function executePackageGet(path, input, context, extraQuery) {
486
480
  return executeEntityGet(path, "shop", input, context, {
487
- order_sn: asOptionalString(input.orderSerialNumber),
488
- package_number: asOptionalString(input.packageNumber),
481
+ order_sn: optionalString(input.orderSerialNumber),
482
+ package_number: optionalString(input.packageNumber),
489
483
  ...extraQuery,
490
484
  });
491
485
  }
492
486
  async function executeEntityPost(path, entityType, input, context, body) {
493
487
  const inventory = readShopeeTokenInventory(context.providerSecret);
494
488
  const entities = entityType === "shop" ? inventory.shops : inventory.merchants;
495
- const requestedId = asOptionalInteger(input[`${entityType}Id`]);
489
+ const requestedId = optionalInteger(input[`${entityType}Id`]);
496
490
  const entityId = resolveEntityId(entityType, requestedId, entities);
497
491
  const payload = await requestShopee({
498
492
  path,
@@ -554,68 +548,71 @@ async function requestShopee(input) {
554
548
  else if (input.body) {
555
549
  requestBody = JSON.stringify(input.body);
556
550
  }
551
+ const headers = {
552
+ accept: "application/json",
553
+ "user-agent": providerUserAgent,
554
+ };
555
+ if (!isFormData && input.body) {
556
+ headers["content-type"] = "application/json";
557
+ }
557
558
  const response = await input.fetcher(url, {
558
559
  method: input.body ? "POST" : "GET",
559
- headers: {
560
- accept: "application/json",
561
- ...(!isFormData && input.body ? { "content-type": "application/json" } : {}),
562
- "user-agent": connectorUserAgent,
563
- },
560
+ headers,
564
561
  body: requestBody,
565
562
  signal,
566
563
  });
567
- const payload = asOptionalObject(await response.json().catch(() => undefined));
564
+ const payload = optionalRecord(await response.json().catch(() => undefined));
568
565
  if (!payload) {
569
- throw createShopeeError("provider_error", `Shopee Open Platform returned a non-JSON response with HTTP ${response.status}.`, response.ok ? 502 : response.status);
566
+ throw new ProviderRequestError(response.ok ? 502 : response.status, `Shopee Open Platform returned a non-JSON response with HTTP ${response.status}.`, undefined, "provider_error");
570
567
  }
571
568
  assertShopeePayloadSuccess(payload, "Shopee Open Platform", response.status);
572
569
  return payload;
573
570
  });
574
571
  }
575
572
  function validateReturnTimeRanges(input) {
576
- const createdFrom = asOptionalInteger(input.createdFrom);
577
- const updatedFrom = asOptionalInteger(input.updatedFrom);
578
- validateTimeRange(createdFrom, asOptionalInteger(input.createdTo), "Shopee return creation time range");
579
- validateTimeRange(updatedFrom, asOptionalInteger(input.updatedTo), "Shopee return update time range");
573
+ const createdFrom = optionalInteger(input.createdFrom);
574
+ const updatedFrom = optionalInteger(input.updatedFrom);
575
+ validateTimeRange(createdFrom, optionalInteger(input.createdTo), "Shopee return creation time range");
576
+ validateTimeRange(updatedFrom, optionalInteger(input.updatedTo), "Shopee return update time range");
580
577
  if (createdFrom != null && updatedFrom != null && updatedFrom < createdFrom) {
581
- throw createShopeeError("invalid_input", "Shopee return update time must not start before creation time.", 400);
578
+ throw new ProviderRequestError(400, "Shopee return update time must not start before creation time.", undefined, "invalid_input");
582
579
  }
583
580
  }
584
581
  function validateTimeRange(from, to, label) {
585
582
  if (from == null || to == null)
586
583
  return;
587
584
  if (to < from) {
588
- throw createShopeeError("invalid_input", `${label} must end after it starts.`, 400);
585
+ throw new ProviderRequestError(400, `${label} must end after it starts.`, undefined, "invalid_input");
589
586
  }
590
587
  if (to - from > 15 * 24 * 60 * 60) {
591
- throw createShopeeError("invalid_input", `${label} cannot exceed 15 days.`, 400);
588
+ throw new ProviderRequestError(400, `${label} cannot exceed 15 days.`, undefined, "invalid_input");
592
589
  }
593
590
  }
594
591
  function assertShopeePayloadSuccess(payload, label, httpStatus = 200) {
595
- const error = asOptionalString(payload.error);
592
+ const error = optionalString(payload.error);
596
593
  if (!error && httpStatus < 400) {
597
594
  return;
598
595
  }
599
- const message = asOptionalString(payload.message);
600
- const requestId = asOptionalString(payload.request_id);
596
+ const message = optionalString(payload.message);
597
+ const requestId = optionalString(payload.request_id);
601
598
  const details = [error, message, requestId ? `request_id=${requestId}` : undefined].filter(Boolean).join(": ");
602
- throw createShopeeError("provider_error", `${label} failed${details ? `: ${details}` : ""}`, httpStatus >= 400 ? httpStatus : 502);
599
+ throw new ProviderRequestError(httpStatus >= 400 ? httpStatus : 502, `${label} failed${details ? `: ${details}` : ""}`, undefined, "provider_error");
603
600
  }
604
601
  function selectEntityToken(entityType, entityId, providerSecret) {
605
602
  if (entityId == null) {
606
- throw createShopeeError("invalid_input", `Shopee ${entityType} ID is required.`, 400);
603
+ throw new ProviderRequestError(400, `Shopee ${entityType} ID is required.`, undefined, "invalid_input");
607
604
  }
608
605
  const inventory = readShopeeTokenInventory(providerSecret);
609
606
  const token = entityType === "shop" ? inventory.shops[String(entityId)] : inventory.merchants[String(entityId)];
610
607
  if (!token) {
611
- throw createShopeeError("invalid_input", `Shopee ${entityType} ${entityId} is not authorized by this connection.`, 400);
608
+ throw new ProviderRequestError(400, `Shopee ${entityType} ${entityId} is not authorized by this connection.`, undefined, "invalid_input");
612
609
  }
613
610
  return token;
614
611
  }
615
612
  function resolveEntityId(entityType, requestedId, entities) {
616
613
  if (requestedId != null) {
617
614
  if (!entities[String(requestedId)]) {
618
- throw createShopeeError("invalid_input", `Shopee ${entityType} ${requestedId} is not authorized by this connection.`, 400);
615
+ throw new ProviderRequestError(400, `Shopee ${entityType} ${requestedId} is not authorized by this connection.`, undefined, "invalid_input");
619
616
  }
620
617
  return requestedId;
621
618
  }
@@ -623,18 +620,18 @@ function resolveEntityId(entityType, requestedId, entities) {
623
620
  if (ids.length === 1) {
624
621
  return ids[0];
625
622
  }
626
- throw createShopeeError("invalid_input", ids.length === 0
623
+ throw new ProviderRequestError(400, ids.length === 0
627
624
  ? `This Shopee connection has no authorized ${entityType}.`
628
- : `This Shopee connection has multiple ${entityType}s; provide ${entityType}Id.`, 400);
625
+ : `This Shopee connection has multiple ${entityType}s; provide ${entityType}Id.`, undefined, "invalid_input");
629
626
  }
630
627
  function readEntityTokens(value) {
631
- const raw = asObjectOrEmpty(value);
628
+ const raw = recordOrEmpty(value);
632
629
  const result = {};
633
630
  for (const [id, candidate] of Object.entries(raw)) {
634
- const token = asOptionalObject(candidate);
635
- const accessToken = asOptionalString(token?.accessToken);
636
- const refreshToken = asOptionalString(token?.refreshToken);
637
- const expiresAt = asOptionalString(token?.expiresAt);
631
+ const token = optionalRecord(candidate);
632
+ const accessToken = optionalString(token?.accessToken);
633
+ const refreshToken = optionalString(token?.refreshToken);
634
+ const expiresAt = optionalString(token?.expiresAt);
638
635
  if (accessToken && refreshToken && expiresAt) {
639
636
  result[id] = { accessToken, refreshToken, expiresAt };
640
637
  }
@@ -666,28 +663,28 @@ function uniqueEntityIds(values) {
666
663
  return [...new Set(ids)];
667
664
  }
668
665
  function requireString(value, fieldName) {
669
- const string = asOptionalString(value);
666
+ const string = optionalString(value);
670
667
  if (!string) {
671
- throw createShopeeError("provider_error", `Shopee token response is missing ${fieldName}.`, 502);
668
+ throw new ProviderRequestError(502, `Shopee token response is missing ${fieldName}.`, undefined, "provider_error");
672
669
  }
673
670
  return string;
674
671
  }
675
672
  function normalizeShopeeResponse(payload) {
676
673
  return {
677
- requestId: asOptionalString(payload.request_id),
674
+ requestId: optionalString(payload.request_id),
678
675
  data: payload,
679
676
  };
680
677
  }
681
678
  function validateOrderTimeRange(input) {
682
- const from = asOptionalInteger(input.timeFrom);
683
- const to = asOptionalInteger(input.timeTo);
679
+ const from = optionalInteger(input.timeFrom);
680
+ const to = optionalInteger(input.timeTo);
684
681
  if (from == null || to == null) {
685
- throw createShopeeError("invalid_input", "timeFrom and timeTo are required.", 400);
682
+ throw new ProviderRequestError(400, "timeFrom and timeTo are required.", undefined, "invalid_input");
686
683
  }
687
684
  if (to < from) {
688
- throw createShopeeError("invalid_input", "timeTo must not be earlier than timeFrom.", 400);
685
+ throw new ProviderRequestError(400, "timeTo must not be earlier than timeFrom.", undefined, "invalid_input");
689
686
  }
690
687
  if (to - from > 15 * 24 * 60 * 60) {
691
- throw createShopeeError("invalid_input", "Shopee order time range cannot exceed 15 days.", 400);
688
+ throw new ProviderRequestError(400, "Shopee order time range cannot exceed 15 days.", undefined, "invalid_input");
692
689
  }
693
690
  }