mtmsdk 0.0.51 → 0.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (446) hide show
  1. package/dist/gomtmapi/@tanstack/react-query.gen.d.ts +21 -185
  2. package/dist/gomtmapi/@tanstack/react-query.gen.d.ts.map +1 -1
  3. package/dist/gomtmapi/@tanstack/react-query.gen.js +39 -215
  4. package/dist/gomtmapi/@tanstack/react-query.gen.js.map +1 -1
  5. package/dist/gomtmapi/index.d.ts +2 -2
  6. package/dist/gomtmapi/index.d.ts.map +1 -1
  7. package/dist/gomtmapi/index.js +1 -1
  8. package/dist/gomtmapi/index.js.map +1 -1
  9. package/dist/gomtmapi/schemas.gen.d.ts +67 -138
  10. package/dist/gomtmapi/schemas.gen.d.ts.map +1 -1
  11. package/dist/gomtmapi/schemas.gen.js +68 -142
  12. package/dist/gomtmapi/schemas.gen.js.map +1 -1
  13. package/dist/gomtmapi/sdk.gen.d.ts +15 -107
  14. package/dist/gomtmapi/sdk.gen.d.ts.map +1 -1
  15. package/dist/gomtmapi/sdk.gen.js +22 -128
  16. package/dist/gomtmapi/sdk.gen.js.map +1 -1
  17. package/dist/gomtmapi/types.gen.d.ts +66 -303
  18. package/dist/gomtmapi/types.gen.d.ts.map +1 -1
  19. package/dist/gomtmapi/zod.gen.d.ts +48 -183
  20. package/dist/gomtmapi/zod.gen.d.ts.map +1 -1
  21. package/dist/gomtmapi/zod.gen.js +36 -150
  22. package/dist/gomtmapi/zod.gen.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -4
  26. package/dist/index.js.map +1 -1
  27. package/dist/sbmng/@tanstack/react-query.gen.d.ts +183 -209
  28. package/dist/sbmng/@tanstack/react-query.gen.d.ts.map +1 -1
  29. package/dist/sbmng/@tanstack/react-query.gen.js +25 -71
  30. package/dist/sbmng/@tanstack/react-query.gen.js.map +1 -1
  31. package/dist/sbmng/index.d.ts +2 -2
  32. package/dist/sbmng/index.d.ts.map +1 -1
  33. package/dist/sbmng/index.js +1 -1
  34. package/dist/sbmng/index.js.map +1 -1
  35. package/dist/sbmng/schemas.gen.d.ts +10 -99
  36. package/dist/sbmng/schemas.gen.d.ts.map +1 -1
  37. package/dist/sbmng/schemas.gen.js +11 -143
  38. package/dist/sbmng/schemas.gen.js.map +1 -1
  39. package/dist/sbmng/sdk.gen.d.ts +13 -23
  40. package/dist/sbmng/sdk.gen.d.ts.map +1 -1
  41. package/dist/sbmng/sdk.gen.js +16 -38
  42. package/dist/sbmng/sdk.gen.js.map +1 -1
  43. package/dist/sbmng/types.gen.d.ts +41 -157
  44. package/dist/sbmng/types.gen.d.ts.map +1 -1
  45. package/dist/supabase/auth-provider.d.ts +8 -1
  46. package/dist/supabase/auth-provider.d.ts.map +1 -1
  47. package/dist/supabase/context.d.ts +3844 -1
  48. package/dist/supabase/context.d.ts.map +1 -1
  49. package/dist/supabase/cursor-pagination.d.ts +4 -4
  50. package/dist/supabase/cursor-pagination.js +4 -4
  51. package/dist/supabase/schema/index.d.ts +1 -11
  52. package/dist/supabase/schema/index.d.ts.map +1 -1
  53. package/dist/supabase/schema/index.js +1 -19
  54. package/dist/supabase/schema/index.js.map +1 -1
  55. package/dist/supabase/schema/system-config.d.ts +12 -0
  56. package/dist/supabase/schema/system-config.d.ts.map +1 -0
  57. package/dist/supabase/schema/system-config.js +22 -0
  58. package/dist/supabase/schema/system-config.js.map +1 -0
  59. package/dist/supabase/supabase-client.d.ts +25 -591
  60. package/dist/supabase/supabase-client.d.ts.map +1 -1
  61. package/dist/supabase/supabase.d.ts +59 -1191
  62. package/dist/supabase/supabase.d.ts.map +1 -1
  63. package/dist/supabase/use-sb-query/build-query-opts.d.ts +6 -2
  64. package/dist/supabase/use-sb-query/build-query-opts.d.ts.map +1 -1
  65. package/dist/supabase/use-sb-query/build-query-opts.js +8 -4
  66. package/dist/supabase/use-sb-query/build-query-opts.js.map +1 -1
  67. package/dist/supabase/use-sb-query/use-query.d.ts +9 -6
  68. package/dist/supabase/use-sb-query/use-query.d.ts.map +1 -1
  69. package/dist/supabase/use-sb-query/use-query.js.map +1 -1
  70. package/dist/supabase/use-sb-query/use-rpc-mutation.d.ts +8 -8
  71. package/dist/supabase/use-sb-query/use-rpc-mutation.js +8 -8
  72. package/dist/supabase/use-sb-query/use-rpc-query.d.ts +25 -17
  73. package/dist/supabase/use-sb-query/use-rpc-query.d.ts.map +1 -1
  74. package/dist/supabase/use-sb-query/use-rpc-query.js +48 -26
  75. package/dist/supabase/use-sb-query/use-rpc-query.js.map +1 -1
  76. package/dist/types/contracts.d.ts +63 -0
  77. package/dist/types/contracts.d.ts.map +1 -0
  78. package/dist/types/contracts.js +17 -0
  79. package/dist/types/contracts.js.map +1 -0
  80. package/dist/types/database.schemas.d.ts +94 -786
  81. package/dist/types/database.schemas.d.ts.map +1 -1
  82. package/dist/types/database.schemas.js +30 -474
  83. package/dist/types/database.schemas.js.map +1 -1
  84. package/dist/types/database.types.d.ts +25 -596
  85. package/dist/types/database.types.d.ts.map +1 -1
  86. package/dist/types/database.types.js +0 -10
  87. package/dist/types/database.types.js.map +1 -1
  88. package/dist/types/index.d.ts +22 -67
  89. package/dist/types/index.d.ts.map +1 -1
  90. package/dist/types/index.js +16 -5
  91. package/dist/types/index.js.map +1 -1
  92. package/package.json +17 -26
  93. package/dist/adk/api/client.d.ts +0 -9
  94. package/dist/adk/api/client.d.ts.map +0 -1
  95. package/dist/adk/api/client.js +0 -39
  96. package/dist/adk/api/client.js.map +0 -1
  97. package/dist/adk/core/constants/tool-icons.d.ts +0 -21
  98. package/dist/adk/core/constants/tool-icons.d.ts.map +0 -1
  99. package/dist/adk/core/constants/tool-icons.js +0 -47
  100. package/dist/adk/core/constants/tool-icons.js.map +0 -1
  101. package/dist/adk/core/models/AgentBuilder.d.ts +0 -77
  102. package/dist/adk/core/models/AgentBuilder.d.ts.map +0 -1
  103. package/dist/adk/core/models/AgentBuilder.js +0 -18
  104. package/dist/adk/core/models/AgentBuilder.js.map +0 -1
  105. package/dist/adk/core/models/AgentRunRequest.d.ts +0 -37
  106. package/dist/adk/core/models/AgentRunRequest.d.ts.map +0 -1
  107. package/dist/adk/core/models/AgentRunRequest.js +0 -18
  108. package/dist/adk/core/models/AgentRunRequest.js.map +0 -1
  109. package/dist/adk/core/models/Eval.d.ts +0 -55
  110. package/dist/adk/core/models/Eval.d.ts.map +0 -1
  111. package/dist/adk/core/models/Eval.js +0 -27
  112. package/dist/adk/core/models/Eval.js.map +0 -1
  113. package/dist/adk/core/models/LiveRequest.d.ts +0 -23
  114. package/dist/adk/core/models/LiveRequest.d.ts.map +0 -1
  115. package/dist/adk/core/models/LiveRequest.js +0 -18
  116. package/dist/adk/core/models/LiveRequest.js.map +0 -1
  117. package/dist/adk/core/models/RuntimeConfig.d.ts +0 -32
  118. package/dist/adk/core/models/RuntimeConfig.d.ts.map +0 -1
  119. package/dist/adk/core/models/RuntimeConfig.js +0 -18
  120. package/dist/adk/core/models/RuntimeConfig.js.map +0 -1
  121. package/dist/adk/core/models/Session.d.ts +0 -117
  122. package/dist/adk/core/models/Session.d.ts.map +0 -1
  123. package/dist/adk/core/models/Session.js +0 -31
  124. package/dist/adk/core/models/Session.js.map +0 -1
  125. package/dist/adk/core/models/Trace.d.ts +0 -40
  126. package/dist/adk/core/models/Trace.d.ts.map +0 -1
  127. package/dist/adk/core/models/Trace.js +0 -2
  128. package/dist/adk/core/models/Trace.js.map +0 -1
  129. package/dist/adk/core/models/types.d.ts +0 -338
  130. package/dist/adk/core/models/types.d.ts.map +0 -1
  131. package/dist/adk/core/models/types.js +0 -189
  132. package/dist/adk/core/models/types.js.map +0 -1
  133. package/dist/cloud-account/platform-configs.d.ts +0 -64
  134. package/dist/cloud-account/platform-configs.d.ts.map +0 -1
  135. package/dist/cloud-account/platform-configs.js +0 -44
  136. package/dist/cloud-account/platform-configs.js.map +0 -1
  137. package/dist/lib/aisdk/types.d.ts +0 -3
  138. package/dist/lib/aisdk/types.d.ts.map +0 -1
  139. package/dist/lib/aisdk/types.js +0 -5
  140. package/dist/lib/aisdk/types.js.map +0 -1
  141. package/dist/lib/logger/index.d.ts +0 -22
  142. package/dist/lib/logger/index.d.ts.map +0 -1
  143. package/dist/lib/logger/index.js +0 -7
  144. package/dist/lib/logger/index.js.map +0 -1
  145. package/dist/lib/schema.d.ts +0 -53
  146. package/dist/lib/schema.d.ts.map +0 -1
  147. package/dist/lib/schema.js +0 -37
  148. package/dist/lib/schema.js.map +0 -1
  149. package/dist/lib/utils.d.ts +0 -14
  150. package/dist/lib/utils.d.ts.map +0 -1
  151. package/dist/lib/utils.js +0 -45
  152. package/dist/lib/utils.js.map +0 -1
  153. package/dist/mtgate_api/@tanstack/react-query.gen.d.ts +0 -166
  154. package/dist/mtgate_api/@tanstack/react-query.gen.d.ts.map +0 -1
  155. package/dist/mtgate_api/@tanstack/react-query.gen.js +0 -118
  156. package/dist/mtgate_api/@tanstack/react-query.gen.js.map +0 -1
  157. package/dist/mtgate_api/client/client.gen.d.ts +0 -3
  158. package/dist/mtgate_api/client/client.gen.d.ts.map +0 -1
  159. package/dist/mtgate_api/client/client.gen.js +0 -236
  160. package/dist/mtgate_api/client/client.gen.js.map +0 -1
  161. package/dist/mtgate_api/client/index.d.ts +0 -9
  162. package/dist/mtgate_api/client/index.d.ts.map +0 -1
  163. package/dist/mtgate_api/client/index.js +0 -7
  164. package/dist/mtgate_api/client/index.js.map +0 -1
  165. package/dist/mtgate_api/client/types.gen.d.ts +0 -118
  166. package/dist/mtgate_api/client/types.gen.d.ts.map +0 -1
  167. package/dist/mtgate_api/client/types.gen.js +0 -3
  168. package/dist/mtgate_api/client/types.gen.js.map +0 -1
  169. package/dist/mtgate_api/client/utils.gen.d.ts +0 -34
  170. package/dist/mtgate_api/client/utils.gen.d.ts.map +0 -1
  171. package/dist/mtgate_api/client/utils.gen.js +0 -232
  172. package/dist/mtgate_api/client/utils.gen.js.map +0 -1
  173. package/dist/mtgate_api/client.gen.d.ts +0 -13
  174. package/dist/mtgate_api/client.gen.d.ts.map +0 -1
  175. package/dist/mtgate_api/client.gen.js +0 -4
  176. package/dist/mtgate_api/client.gen.js.map +0 -1
  177. package/dist/mtgate_api/core/auth.gen.d.ts +0 -19
  178. package/dist/mtgate_api/core/auth.gen.d.ts.map +0 -1
  179. package/dist/mtgate_api/core/auth.gen.js +0 -15
  180. package/dist/mtgate_api/core/auth.gen.js.map +0 -1
  181. package/dist/mtgate_api/core/bodySerializer.gen.d.ts +0 -26
  182. package/dist/mtgate_api/core/bodySerializer.gen.d.ts.map +0 -1
  183. package/dist/mtgate_api/core/bodySerializer.gen.js +0 -58
  184. package/dist/mtgate_api/core/bodySerializer.gen.js.map +0 -1
  185. package/dist/mtgate_api/core/params.gen.d.ts +0 -44
  186. package/dist/mtgate_api/core/params.gen.d.ts.map +0 -1
  187. package/dist/mtgate_api/core/params.gen.js +0 -101
  188. package/dist/mtgate_api/core/params.gen.js.map +0 -1
  189. package/dist/mtgate_api/core/pathSerializer.gen.d.ts +0 -34
  190. package/dist/mtgate_api/core/pathSerializer.gen.d.ts.map +0 -1
  191. package/dist/mtgate_api/core/pathSerializer.gen.js +0 -115
  192. package/dist/mtgate_api/core/pathSerializer.gen.js.map +0 -1
  193. package/dist/mtgate_api/core/queryKeySerializer.gen.d.ts +0 -19
  194. package/dist/mtgate_api/core/queryKeySerializer.gen.d.ts.map +0 -1
  195. package/dist/mtgate_api/core/queryKeySerializer.gen.js +0 -100
  196. package/dist/mtgate_api/core/queryKeySerializer.gen.js.map +0 -1
  197. package/dist/mtgate_api/core/serverSentEvents.gen.d.ts +0 -72
  198. package/dist/mtgate_api/core/serverSentEvents.gen.d.ts.map +0 -1
  199. package/dist/mtgate_api/core/serverSentEvents.gen.js +0 -138
  200. package/dist/mtgate_api/core/serverSentEvents.gen.js.map +0 -1
  201. package/dist/mtgate_api/core/types.gen.d.ts +0 -79
  202. package/dist/mtgate_api/core/types.gen.d.ts.map +0 -1
  203. package/dist/mtgate_api/core/types.gen.js +0 -3
  204. package/dist/mtgate_api/core/types.gen.js.map +0 -1
  205. package/dist/mtgate_api/core/utils.gen.d.ts +0 -20
  206. package/dist/mtgate_api/core/utils.gen.d.ts.map +0 -1
  207. package/dist/mtgate_api/core/utils.gen.js +0 -88
  208. package/dist/mtgate_api/core/utils.gen.js.map +0 -1
  209. package/dist/mtgate_api/index.d.ts +0 -3
  210. package/dist/mtgate_api/index.d.ts.map +0 -1
  211. package/dist/mtgate_api/index.js +0 -3
  212. package/dist/mtgate_api/index.js.map +0 -1
  213. package/dist/mtgate_api/schemas.gen.d.ts +0 -233
  214. package/dist/mtgate_api/schemas.gen.d.ts.map +0 -1
  215. package/dist/mtgate_api/schemas.gen.js +0 -277
  216. package/dist/mtgate_api/schemas.gen.js.map +0 -1
  217. package/dist/mtgate_api/sdk.gen.d.ts +0 -23
  218. package/dist/mtgate_api/sdk.gen.d.ts.map +0 -1
  219. package/dist/mtgate_api/sdk.gen.js +0 -31
  220. package/dist/mtgate_api/sdk.gen.js.map +0 -1
  221. package/dist/mtgate_api/types.gen.d.ts +0 -203
  222. package/dist/mtgate_api/types.gen.d.ts.map +0 -1
  223. package/dist/mtgate_api/types.gen.js +0 -3
  224. package/dist/mtgate_api/types.gen.js.map +0 -1
  225. package/dist/mtgate_api/zod.gen.d.ts +0 -321
  226. package/dist/mtgate_api/zod.gen.d.ts.map +0 -1
  227. package/dist/mtgate_api/zod.gen.js +0 -148
  228. package/dist/mtgate_api/zod.gen.js.map +0 -1
  229. package/dist/mtmai_api/@tanstack/react-query.gen.d.ts +0 -949
  230. package/dist/mtmai_api/@tanstack/react-query.gen.d.ts.map +0 -1
  231. package/dist/mtmai_api/@tanstack/react-query.gen.js +0 -917
  232. package/dist/mtmai_api/@tanstack/react-query.gen.js.map +0 -1
  233. package/dist/mtmai_api/client/client.gen.d.ts +0 -3
  234. package/dist/mtmai_api/client/client.gen.d.ts.map +0 -1
  235. package/dist/mtmai_api/client/client.gen.js +0 -236
  236. package/dist/mtmai_api/client/client.gen.js.map +0 -1
  237. package/dist/mtmai_api/client/index.d.ts +0 -9
  238. package/dist/mtmai_api/client/index.d.ts.map +0 -1
  239. package/dist/mtmai_api/client/index.js +0 -7
  240. package/dist/mtmai_api/client/index.js.map +0 -1
  241. package/dist/mtmai_api/client/types.gen.d.ts +0 -118
  242. package/dist/mtmai_api/client/types.gen.d.ts.map +0 -1
  243. package/dist/mtmai_api/client/types.gen.js +0 -3
  244. package/dist/mtmai_api/client/types.gen.js.map +0 -1
  245. package/dist/mtmai_api/client/utils.gen.d.ts +0 -34
  246. package/dist/mtmai_api/client/utils.gen.d.ts.map +0 -1
  247. package/dist/mtmai_api/client/utils.gen.js +0 -232
  248. package/dist/mtmai_api/client/utils.gen.js.map +0 -1
  249. package/dist/mtmai_api/client.gen.d.ts +0 -13
  250. package/dist/mtmai_api/client.gen.d.ts.map +0 -1
  251. package/dist/mtmai_api/client.gen.js +0 -4
  252. package/dist/mtmai_api/client.gen.js.map +0 -1
  253. package/dist/mtmai_api/core/auth.gen.d.ts +0 -19
  254. package/dist/mtmai_api/core/auth.gen.d.ts.map +0 -1
  255. package/dist/mtmai_api/core/auth.gen.js +0 -15
  256. package/dist/mtmai_api/core/auth.gen.js.map +0 -1
  257. package/dist/mtmai_api/core/bodySerializer.gen.d.ts +0 -26
  258. package/dist/mtmai_api/core/bodySerializer.gen.d.ts.map +0 -1
  259. package/dist/mtmai_api/core/bodySerializer.gen.js +0 -58
  260. package/dist/mtmai_api/core/bodySerializer.gen.js.map +0 -1
  261. package/dist/mtmai_api/core/params.gen.d.ts +0 -44
  262. package/dist/mtmai_api/core/params.gen.d.ts.map +0 -1
  263. package/dist/mtmai_api/core/params.gen.js +0 -101
  264. package/dist/mtmai_api/core/params.gen.js.map +0 -1
  265. package/dist/mtmai_api/core/pathSerializer.gen.d.ts +0 -34
  266. package/dist/mtmai_api/core/pathSerializer.gen.d.ts.map +0 -1
  267. package/dist/mtmai_api/core/pathSerializer.gen.js +0 -115
  268. package/dist/mtmai_api/core/pathSerializer.gen.js.map +0 -1
  269. package/dist/mtmai_api/core/queryKeySerializer.gen.d.ts +0 -19
  270. package/dist/mtmai_api/core/queryKeySerializer.gen.d.ts.map +0 -1
  271. package/dist/mtmai_api/core/queryKeySerializer.gen.js +0 -100
  272. package/dist/mtmai_api/core/queryKeySerializer.gen.js.map +0 -1
  273. package/dist/mtmai_api/core/serverSentEvents.gen.d.ts +0 -72
  274. package/dist/mtmai_api/core/serverSentEvents.gen.d.ts.map +0 -1
  275. package/dist/mtmai_api/core/serverSentEvents.gen.js +0 -138
  276. package/dist/mtmai_api/core/serverSentEvents.gen.js.map +0 -1
  277. package/dist/mtmai_api/core/types.gen.d.ts +0 -79
  278. package/dist/mtmai_api/core/types.gen.d.ts.map +0 -1
  279. package/dist/mtmai_api/core/types.gen.js +0 -3
  280. package/dist/mtmai_api/core/types.gen.js.map +0 -1
  281. package/dist/mtmai_api/core/utils.gen.d.ts +0 -20
  282. package/dist/mtmai_api/core/utils.gen.d.ts.map +0 -1
  283. package/dist/mtmai_api/core/utils.gen.js +0 -88
  284. package/dist/mtmai_api/core/utils.gen.js.map +0 -1
  285. package/dist/mtmai_api/index.d.ts +0 -3
  286. package/dist/mtmai_api/index.d.ts.map +0 -1
  287. package/dist/mtmai_api/index.js +0 -4
  288. package/dist/mtmai_api/index.js.map +0 -1
  289. package/dist/mtmai_api/schemas.gen.d.ts +0 -7721
  290. package/dist/mtmai_api/schemas.gen.d.ts.map +0 -1
  291. package/dist/mtmai_api/schemas.gen.js +0 -9774
  292. package/dist/mtmai_api/schemas.gen.js.map +0 -1
  293. package/dist/mtmai_api/sdk.gen.d.ts +0 -282
  294. package/dist/mtmai_api/sdk.gen.d.ts.map +0 -1
  295. package/dist/mtmai_api/sdk.gen.js +0 -404
  296. package/dist/mtmai_api/sdk.gen.js.map +0 -1
  297. package/dist/mtmai_api/types.gen.d.ts +0 -7152
  298. package/dist/mtmai_api/types.gen.d.ts.map +0 -1
  299. package/dist/mtmai_api/types.gen.js +0 -253
  300. package/dist/mtmai_api/types.gen.js.map +0 -1
  301. package/dist/mtmai_api/zod.gen.d.ts +0 -55827
  302. package/dist/mtmai_api/zod.gen.d.ts.map +0 -1
  303. package/dist/mtmai_api/zod.gen.js +0 -4805
  304. package/dist/mtmai_api/zod.gen.js.map +0 -1
  305. package/dist/openclaw/client-info.d.ts +0 -38
  306. package/dist/openclaw/client-info.d.ts.map +0 -1
  307. package/dist/openclaw/client-info.js +0 -38
  308. package/dist/openclaw/client-info.js.map +0 -1
  309. package/dist/openclaw/device-auth-utils.d.ts +0 -12
  310. package/dist/openclaw/device-auth-utils.d.ts.map +0 -1
  311. package/dist/openclaw/device-auth-utils.js +0 -16
  312. package/dist/openclaw/device-auth-utils.js.map +0 -1
  313. package/dist/openclaw/device-auth.d.ts +0 -21
  314. package/dist/openclaw/device-auth.d.ts.map +0 -1
  315. package/dist/openclaw/device-auth.js +0 -87
  316. package/dist/openclaw/device-auth.js.map +0 -1
  317. package/dist/openclaw/device-identity.d.ts +0 -8
  318. package/dist/openclaw/device-identity.d.ts.map +0 -1
  319. package/dist/openclaw/device-identity.js +0 -87
  320. package/dist/openclaw/device-identity.js.map +0 -1
  321. package/dist/openclaw/gateway.d.ts +0 -100
  322. package/dist/openclaw/gateway.d.ts.map +0 -1
  323. package/dist/openclaw/gateway.js +0 -302
  324. package/dist/openclaw/gateway.js.map +0 -1
  325. package/dist/openclaw/types.d.ts +0 -473
  326. package/dist/openclaw/types.d.ts.map +0 -1
  327. package/dist/openclaw/types.js +0 -2
  328. package/dist/openclaw/types.js.map +0 -1
  329. package/dist/supabase/use-sb-query/prefetch.d.ts +0 -10
  330. package/dist/supabase/use-sb-query/prefetch.d.ts.map +0 -1
  331. package/dist/supabase/use-sb-query/prefetch.js +0 -14
  332. package/dist/supabase/use-sb-query/prefetch.js.map +0 -1
  333. package/src/adk/api/client.ts +0 -46
  334. package/src/adk/core/constants/tool-icons.ts +0 -51
  335. package/src/adk/core/models/AgentBuilder.ts +0 -80
  336. package/src/adk/core/models/AgentRunRequest.ts +0 -33
  337. package/src/adk/core/models/Eval.ts +0 -70
  338. package/src/adk/core/models/LiveRequest.ts +0 -23
  339. package/src/adk/core/models/RuntimeConfig.ts +0 -33
  340. package/src/adk/core/models/Session.ts +0 -52
  341. package/src/adk/core/models/Trace.ts +0 -42
  342. package/src/adk/core/models/types.ts +0 -255
  343. package/src/cloud-account/platform-configs.ts +0 -73
  344. package/src/gomtmapi/@tanstack/react-query.gen.ts +0 -575
  345. package/src/gomtmapi/client/client.gen.ts +0 -311
  346. package/src/gomtmapi/client/index.ts +0 -25
  347. package/src/gomtmapi/client/types.gen.ts +0 -241
  348. package/src/gomtmapi/client/utils.gen.ts +0 -332
  349. package/src/gomtmapi/client.gen.ts +0 -16
  350. package/src/gomtmapi/core/auth.gen.ts +0 -42
  351. package/src/gomtmapi/core/bodySerializer.gen.ts +0 -100
  352. package/src/gomtmapi/core/params.gen.ts +0 -176
  353. package/src/gomtmapi/core/pathSerializer.gen.ts +0 -181
  354. package/src/gomtmapi/core/queryKeySerializer.gen.ts +0 -136
  355. package/src/gomtmapi/core/serverSentEvents.gen.ts +0 -266
  356. package/src/gomtmapi/core/types.gen.ts +0 -118
  357. package/src/gomtmapi/core/utils.gen.ts +0 -143
  358. package/src/gomtmapi/index.ts +0 -4
  359. package/src/gomtmapi/schemas.gen.ts +0 -596
  360. package/src/gomtmapi/sdk.gen.ts +0 -399
  361. package/src/gomtmapi/types.gen.ts +0 -962
  362. package/src/gomtmapi/zod.gen.ts +0 -507
  363. package/src/index.ts +0 -5
  364. package/src/lib/aisdk/types.ts +0 -8
  365. package/src/lib/logger/index.ts +0 -8
  366. package/src/lib/schema.ts +0 -50
  367. package/src/lib/utils.ts +0 -54
  368. package/src/mtgate_api/@tanstack/react-query.gen.ts +0 -142
  369. package/src/mtgate_api/client/client.gen.ts +0 -311
  370. package/src/mtgate_api/client/index.ts +0 -25
  371. package/src/mtgate_api/client/types.gen.ts +0 -241
  372. package/src/mtgate_api/client/utils.gen.ts +0 -332
  373. package/src/mtgate_api/client.gen.ts +0 -16
  374. package/src/mtgate_api/core/auth.gen.ts +0 -42
  375. package/src/mtgate_api/core/bodySerializer.gen.ts +0 -100
  376. package/src/mtgate_api/core/params.gen.ts +0 -176
  377. package/src/mtgate_api/core/pathSerializer.gen.ts +0 -181
  378. package/src/mtgate_api/core/queryKeySerializer.gen.ts +0 -136
  379. package/src/mtgate_api/core/serverSentEvents.gen.ts +0 -266
  380. package/src/mtgate_api/core/types.gen.ts +0 -118
  381. package/src/mtgate_api/core/utils.gen.ts +0 -143
  382. package/src/mtgate_api/index.ts +0 -4
  383. package/src/mtgate_api/schemas.gen.ts +0 -290
  384. package/src/mtgate_api/sdk.gen.ts +0 -54
  385. package/src/mtgate_api/types.gen.ts +0 -239
  386. package/src/mtgate_api/zod.gen.ts +0 -176
  387. package/src/mtmai_api/@tanstack/react-query.gen.ts +0 -1010
  388. package/src/mtmai_api/client/client.gen.ts +0 -311
  389. package/src/mtmai_api/client/index.ts +0 -25
  390. package/src/mtmai_api/client/types.gen.ts +0 -241
  391. package/src/mtmai_api/client/utils.gen.ts +0 -332
  392. package/src/mtmai_api/client.gen.ts +0 -16
  393. package/src/mtmai_api/core/auth.gen.ts +0 -42
  394. package/src/mtmai_api/core/bodySerializer.gen.ts +0 -100
  395. package/src/mtmai_api/core/params.gen.ts +0 -176
  396. package/src/mtmai_api/core/pathSerializer.gen.ts +0 -181
  397. package/src/mtmai_api/core/queryKeySerializer.gen.ts +0 -136
  398. package/src/mtmai_api/core/serverSentEvents.gen.ts +0 -266
  399. package/src/mtmai_api/core/types.gen.ts +0 -118
  400. package/src/mtmai_api/core/utils.gen.ts +0 -143
  401. package/src/mtmai_api/index.ts +0 -4
  402. package/src/mtmai_api/schemas.gen.ts +0 -9980
  403. package/src/mtmai_api/sdk.gen.ts +0 -471
  404. package/src/mtmai_api/types.gen.ts +0 -7609
  405. package/src/mtmai_api/zod.gen.ts +0 -5101
  406. package/src/openclaw/client-info.ts +0 -54
  407. package/src/openclaw/device-auth-utils.ts +0 -26
  408. package/src/openclaw/device-auth.ts +0 -99
  409. package/src/openclaw/device-identity.ts +0 -108
  410. package/src/openclaw/gateway.ts +0 -392
  411. package/src/openclaw/types.ts +0 -518
  412. package/src/sbmng/@tanstack/react-query.gen.ts +0 -3017
  413. package/src/sbmng/client/client.gen.ts +0 -311
  414. package/src/sbmng/client/index.ts +0 -25
  415. package/src/sbmng/client/types.gen.ts +0 -241
  416. package/src/sbmng/client/utils.gen.ts +0 -332
  417. package/src/sbmng/client.gen.ts +0 -16
  418. package/src/sbmng/core/auth.gen.ts +0 -42
  419. package/src/sbmng/core/bodySerializer.gen.ts +0 -100
  420. package/src/sbmng/core/params.gen.ts +0 -176
  421. package/src/sbmng/core/pathSerializer.gen.ts +0 -181
  422. package/src/sbmng/core/queryKeySerializer.gen.ts +0 -136
  423. package/src/sbmng/core/serverSentEvents.gen.ts +0 -266
  424. package/src/sbmng/core/types.gen.ts +0 -118
  425. package/src/sbmng/core/utils.gen.ts +0 -143
  426. package/src/sbmng/index.ts +0 -4
  427. package/src/sbmng/schemas.gen.ts +0 -9805
  428. package/src/sbmng/sdk.gen.ts +0 -1780
  429. package/src/sbmng/types.gen.ts +0 -8016
  430. package/src/supabase/auth-provider.tsx +0 -67
  431. package/src/supabase/context.tsx +0 -51
  432. package/src/supabase/cursor-pagination.ts +0 -155
  433. package/src/supabase/schema/browser.ts +0 -45
  434. package/src/supabase/schema/index.ts +0 -25
  435. package/src/supabase/supabase-client.ts +0 -30
  436. package/src/supabase/supabase.ts +0 -67
  437. package/src/supabase/use-sb-query/build-query-opts.ts +0 -56
  438. package/src/supabase/use-sb-query/key.ts +0 -57
  439. package/src/supabase/use-sb-query/prefetch.ts +0 -59
  440. package/src/supabase/use-sb-query/use-query.ts +0 -340
  441. package/src/supabase/use-sb-query/use-rpc-mutation.ts +0 -83
  442. package/src/supabase/use-sb-query/use-rpc-query.ts +0 -231
  443. package/src/supabase/utils.ts +0 -75
  444. package/src/types/database.schemas.ts +0 -4378
  445. package/src/types/database.types.ts +0 -4288
  446. package/src/types/index.ts +0 -102
@@ -1,340 +0,0 @@
1
- /**
2
- * 将 supabase api封装位 react query的 形式.
3
- * 原官方库: https://github.com/psteinroe/supabase-cache-helpers
4
- */
5
-
6
- import type {
7
- AnyPostgrestResponse,
8
- BuildNormalizedQueryOps,
9
- PostgrestQueryParserOptions,
10
- } from "@supabase-cache-helpers/postgrest-core";
11
- import { PostgrestFilter, encodeObject, type DecodedKey } from "@supabase-cache-helpers/postgrest-core";
12
- import type {
13
- PostgrestError,
14
- PostgrestMaybeSingleResponse,
15
- PostgrestResponse,
16
- PostgrestResponseSuccess,
17
- PostgrestSingleResponse,
18
- } from "@supabase/postgrest-js";
19
- import {
20
- useQueryClient,
21
- useQuery as useReactQuery,
22
- useSuspenseQuery as useReactSuspenseQuery,
23
- type UseQueryOptions as UseReactQueryOptions,
24
- type UseQueryResult as UseReactQueryResult,
25
- type UseSuspenseQueryResult as UseReactSuspenseQueryResult,
26
- type UseSuspenseQueryOptions as UserReactSuspenseQueryOptions,
27
- } from "@tanstack/react-query";
28
- import { buildQueryOpts, buildSuspenseQueryOpts } from "./build-query-opts";
29
- import { decode, encode } from "./key";
30
-
31
- export const KEY_PREFIX = "postgrest";
32
- export const INFINITE_KEY_PREFIX = "page";
33
-
34
- export type DecodedReactQueryKey = DecodedKey & {
35
- isInfinite: boolean;
36
- key: string[];
37
- };
38
-
39
- export const POSTGREST_FILTER_KEY_PREFIX = "postgrest-filter";
40
-
41
- export const usePostgrestFilterCache = <R extends Record<string, unknown>>() => {
42
- const queryClient = useQueryClient();
43
-
44
- return (query: string, opts?: PostgrestQueryParserOptions) => {
45
- const key = [POSTGREST_FILTER_KEY_PREFIX, query, opts ? encodeObject(opts) : null];
46
- const cacheData = queryClient.getQueryData(key);
47
- if (cacheData instanceof PostgrestFilter) {
48
- return cacheData;
49
- }
50
- const filter = PostgrestFilter.fromQuery(query, opts);
51
- queryClient.setQueryData(key, filter);
52
- return filter as PostgrestFilter<R>;
53
- };
54
- };
55
-
56
- export const useQueriesForTableLoader = (table: string) => {
57
- const queryClient = useQueryClient();
58
- const getPostgrestFilter = usePostgrestFilterCache();
59
-
60
- return () =>
61
- queryClient
62
- .getQueryCache()
63
- .getAll()
64
- .map((c) => c.queryKey)
65
- .reduce<ReturnType<BuildNormalizedQueryOps["queriesForTable"]>>((prev, curr) => {
66
- const decodedKey = decode(curr);
67
- if (decodedKey?.table === table) {
68
- prev.push(getPostgrestFilter(decodedKey.queryKey).params);
69
- }
70
- return prev;
71
- }, []);
72
- };
73
-
74
- /**
75
- * Applies Omit over a union, while preserving its union-ness.
76
- */
77
- // biome-ignore lint/suspicious/noExplicitAny: keyof any 是 TypeScript 泛型约束的标准用法
78
- type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
79
-
80
- /**
81
- * Represents the return value of the `useQuery` hook when `query` is expected to return
82
- * a single row.
83
- */
84
- export type UseQuerySingleReturn<Result> = DistributiveOmit<
85
- UseReactQueryResult<PostgrestSingleResponse<Result>["data"], PostgrestError>,
86
- "refetch"
87
- > &
88
- Pick<UseReactQueryResult<PostgrestSingleResponse<Result>, PostgrestError>, "refetch"> &
89
- Pick<PostgrestSingleResponse<Result>, "count">;
90
-
91
- /**
92
- * Represents the return value of the `useQuery` hook when `query` is expected to return
93
- * either a single row or an empty response.
94
- */
95
- export type UseQueryMaybeSingleReturn<Result> = DistributiveOmit<
96
- UseReactQueryResult<PostgrestMaybeSingleResponse<Result>["data"], PostgrestError>,
97
- "refetch"
98
- > &
99
- Pick<UseReactQueryResult<PostgrestMaybeSingleResponse<Result>, PostgrestError>, "refetch"> &
100
- Pick<PostgrestMaybeSingleResponse<Result>, "count">;
101
-
102
- /**
103
- * Represents the return value of the `useQuery` hook when `query` is expected to return
104
- * one or more rows.
105
- */
106
- export type UseQueryReturn<Result> = DistributiveOmit<
107
- UseReactQueryResult<PostgrestResponse<Result>["data"], PostgrestError>,
108
- "refetch"
109
- > &
110
- Pick<UseReactQueryResult<PostgrestResponse<Result>, PostgrestError>, "refetch"> &
111
- Pick<PostgrestResponse<Result>, "count">;
112
-
113
- /**
114
- * Represents the return value of the `useQuery` hook when the type of the query response
115
- * is not known.
116
- */
117
- export type UseQueryAnyReturn<Result> = DistributiveOmit<
118
- UseReactQueryResult<AnyPostgrestResponse<Result>["data"], PostgrestError>,
119
- "refetch"
120
- > &
121
- Pick<UseReactQueryResult<AnyPostgrestResponse<Result>, PostgrestError>, "refetch"> &
122
- Pick<AnyPostgrestResponse<Result>, "count">;
123
-
124
- /**
125
- * React hook to execute a PostgREST query and return a single item response.
126
- *
127
- * @param {PromiseLike<PostgrestSingleResponse<Result>>} query A promise that resolves to a PostgREST single item response.
128
- * @param {Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
129
- * @returns {UseQuerySingleReturn<Result>} The hook result containing the single item response data.
130
- */
131
- function useQuery<Result>(
132
- query: PromiseLike<PostgrestSingleResponse<Result>>,
133
- config?: Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
134
- ): UseQuerySingleReturn<Result>;
135
- /**
136
- * React hook to execute a PostgREST query and return a maybe single item response.
137
- *
138
- * @param {PromiseLike<PostgrestMaybeSingleResponse<Result>>} query A promise that resolves to a PostgREST maybe single item response.
139
- * @param {Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
140
- * @returns {UseQueryMaybeSingleReturn<Result>} The hook result containing the maybe single item response data.
141
- */
142
- function useQuery<Result>(
143
- query: PromiseLike<PostgrestMaybeSingleResponse<Result>>,
144
- config?: Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
145
- ): UseQueryMaybeSingleReturn<Result>;
146
- /**
147
- * React hook to execute a PostgREST query.
148
- *
149
- * @template Result The expected response data type.
150
- * @param {PromiseLike<PostgrestResponse<Result>>} query A promise that resolves to a PostgREST response.
151
- * @param {Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
152
- * @returns {UseQueryReturn<Result>} The hook result containing the response data.
153
- */
154
- function useQuery<Result>(
155
- query: PromiseLike<PostgrestResponse<Result>>,
156
- config?: Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
157
- ): UseQueryReturn<Result>;
158
-
159
- /**
160
- * React hook to execute a PostgREST query.
161
- *
162
- * @template Result The expected response data type.
163
- * @param {PromiseLike<AnyPostgrestResponse<Result>>} query A promise that resolves to a PostgREST response of any kind.
164
- * @param {Omit<UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
165
- * @returns {UseQueryAnyReturn<Result>} The hook result containing the response data.
166
- */
167
- function useQuery<Result>(
168
- query: PromiseLike<AnyPostgrestResponse<Result>>,
169
- config?: Omit<UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
170
- ): UseQueryAnyReturn<Result> {
171
- const result = useReactQuery<AnyPostgrestResponse<Result>, PostgrestError>(buildQueryOpts<Result>(query, config));
172
-
173
- // isPending and isLoadingError are the only cases in which no data is present
174
- if (result.isPending || result.isLoadingError) {
175
- return {
176
- ...result,
177
- data: undefined,
178
- count: null,
179
- } as UseQueryAnyReturn<Result>;
180
- }
181
-
182
- return {
183
- ...result,
184
- data: result.data?.data,
185
- count: result.data?.count,
186
- } as UseQueryAnyReturn<Result>;
187
- }
188
-
189
- export { useQuery };
190
-
191
- // 增加 queryQuery 获取函数
192
-
193
- /**
194
- * 获取 PostgREST 查询的完整 QueryKey
195
- * @param query Supabase PostgrestBuilder 实例 (例如: sb.from('...').select() 或 sb.rpc(...))
196
- * @param isInfinite 是否为无限查询 (默认 false)
197
- */
198
- export function getSbQueryKey<Result>(query: PromiseLike<AnyPostgrestResponse<Result>>, isInfinite = false): string[] {
199
- return encode(query, isInfinite);
200
- }
201
-
202
- /**
203
- * 获取 PostgREST 查询的 "Base Key" (仅包含前缀、Schema、Table/RPC名称)
204
- * 用于 invalidateQueries 时模糊匹配整个表或RPC的所有查询,忽略具体的 filter/page 参数。
205
- *
206
- * 结构: ['postgrest', 'null'|'page', schema, table|rpc, ...]
207
- * 返回: 前4个元素
208
- */
209
- export function getSbTableKey<Result>(query: PromiseLike<AnyPostgrestResponse<Result>>): string[] {
210
- const fullKey = encode(query, false);
211
- // 截取前4个元素作为基础Key: [prefix, infinitePrefix, schema, table]
212
- // 这样 invalidateQueries(baseKey) 将会匹配该表/RPC下的所有查询变体
213
- return fullKey.slice(0, 4);
214
- }
215
-
216
- // 增加 suspense query 的支持 ========================================================================================
217
-
218
- /**
219
- * Represents the return value of the `useSuspenseQuery` hook when `query` is expected to return
220
- * a single row.
221
- */
222
- export type useSuspenseQuerySingleReturn<Result> = DistributiveOmit<
223
- UseReactSuspenseQueryResult<PostgrestMaybeSingleResponseV4<Result>["data"], PostgrestError>,
224
- "refetch"
225
- > &
226
- Pick<
227
- UseReactSuspenseQueryResult<
228
- // PostgrestSingleResponse<Result>,
229
- Result,
230
- PostgrestError
231
- >,
232
- "refetch"
233
- > &
234
- Pick<PostgrestSingleResponse<Result>, "count">;
235
-
236
- export type PostgrestMaybeSingleResponseV4<T> = PostgrestResponseSuccess<T>;
237
-
238
- /**
239
- * Represents the return value of the `useSuspenseQuery` hook when `query` is expected to return
240
- * either a single row or an empty response.
241
- */
242
- export type useSuspenseQueryMaybeSingleReturn<Result> = DistributiveOmit<
243
- UseReactSuspenseQueryResult<PostgrestMaybeSingleResponseV4<NonNullable<Result>>["data"], PostgrestError>,
244
- "refetch"
245
- > &
246
- Pick<UseReactSuspenseQueryResult<PostgrestMaybeSingleResponseV4<NonNullable<Result>>, PostgrestError>, "refetch"> &
247
- Pick<PostgrestMaybeSingleResponseV4<Result>, "count">;
248
-
249
- /**
250
- * Represents the return value of the `useSuspenseQuery` hook when `query` is expected to return
251
- * one or more rows.
252
- */
253
- export type useSuspenseQueryReturn<Result> = DistributiveOmit<
254
- UseReactSuspenseQueryResult<PostgrestResponse<Result>["data"], PostgrestError>,
255
- "refetch"
256
- > &
257
- Pick<UseReactSuspenseQueryResult<PostgrestResponse<Result>, PostgrestError>, "refetch"> &
258
- Pick<PostgrestResponse<Result>, "count">;
259
-
260
- /**
261
- * Represents the return value of the `useSuspenseQuery` hook when the type of the query response
262
- * is not known.
263
- */
264
- export type useSuspenseQueryAnyReturn<Result> = DistributiveOmit<
265
- UseReactSuspenseQueryResult<PostgrestResponse<Result>["data"], PostgrestError>,
266
- "refetch"
267
- > &
268
- Pick<UseReactSuspenseQueryResult<PostgrestResponse<Result>, PostgrestError>, "refetch"> &
269
- Pick<PostgrestResponse<Result>, "count">;
270
-
271
- /**
272
- * React hook to execute a PostgREST query and return a single item response.
273
- *
274
- * @param {PromiseLike<PostgrestSingleResponse<Result>>} query A promise that resolves to a PostgREST single item response.
275
- * @param {Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
276
- * @returns {useSuspenseQuerySingleReturn<Result>} The hook result containing the single item response data.
277
- */
278
- function useSbSuspenseQuery<Result>(
279
- query: PromiseLike<PostgrestSingleResponse<Result>>,
280
- config?: Omit<UseReactQueryOptions<PostgrestSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
281
- ): useSuspenseQuerySingleReturn<NonNullable<Result>>;
282
- /**
283
- * React hook to execute a PostgREST query and return a maybe single item response.
284
- *
285
- * @param {PromiseLike<PostgrestMaybeSingleResponse<Result>>} query A promise that resolves to a PostgREST maybe single item response.
286
- * @param {Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
287
- * @returns {useSuspenseQueryMaybeSingleReturn<Result>} The hook result containing the maybe single item response data.
288
- */
289
- function useSbSuspenseQuery<Result>(
290
- query: PromiseLike<PostgrestMaybeSingleResponse<Result>>,
291
- config?: Omit<UseReactQueryOptions<PostgrestMaybeSingleResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
292
- ): useSuspenseQueryMaybeSingleReturn<NonNullable<Result>>;
293
- /**
294
- * React hook to execute a PostgREST query.
295
- *
296
- * @template Result The expected response data type.
297
- * @param {PromiseLike<PostgrestResponse<Result>>} query A promise that resolves to a PostgREST response.
298
- * @param {Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
299
- * @returns {useSuspenseQueryReturn<Result>} The hook result containing the response data.
300
- */
301
- function useSbSuspenseQuery<Result>(
302
- query: PromiseLike<PostgrestResponse<Result>>,
303
- config?: Omit<UseReactQueryOptions<PostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
304
- ): useSuspenseQueryReturn<NonNullable<Result>>;
305
-
306
- /**
307
- * React hook to execute a PostgREST query.
308
- *
309
- * @template Result The expected response data type.
310
- * @param {PromiseLike<AnyPostgrestResponse<Result>>} query A promise that resolves to a PostgREST response of any kind.
311
- * @param {Omit<UseReactQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, 'queryKey' | 'queryFn'>} [config] The React Query options.
312
- * @returns {useSuspenseQueryAnyReturn<Result>} The hook result containing the response data.
313
- */
314
- function useSbSuspenseQuery<Result>(
315
- query: PromiseLike<PostgrestResponse<Result>>,
316
- config?: Omit<UserReactSuspenseQueryOptions<AnyPostgrestResponse<Result>, PostgrestError>, "queryKey" | "queryFn">,
317
- ): useSuspenseQueryReturn<NonNullable<Result>> {
318
- const result = useReactSuspenseQuery<AnyPostgrestResponse<Result>, PostgrestError>(
319
- buildSuspenseQueryOpts<Result>(query, config),
320
- );
321
-
322
- // isPending and isLoadingError are the only cases in which no data is present
323
- // if (result.isPending || result.isLoadingError) {
324
- // return {
325
- // ...result,
326
- // data: undefined,
327
- // count: null,
328
- // } //as useSuspenseQueryAnyReturn<Result>;
329
- // }
330
-
331
- return {
332
- ...result,
333
- data: result.data.data, // NonNullable<Result|Result[]>,
334
- count: result.data.count,
335
- } as useSuspenseQueryAnyReturn<NonNullable<Result>>;
336
- }
337
-
338
- export const useSbQuery = useQuery;
339
-
340
- export { useSbSuspenseQuery };
@@ -1,83 +0,0 @@
1
- /**
2
- * Supabase RPC Mutation Hook
3
- * 简化 RPC 写操作(upsert, delete 等)的调用
4
- *
5
- * 使用示例:
6
- * ```tsx
7
- * const updateProject = useRpcMutation("audit_project_upsert");
8
- *
9
- * // 调用
10
- * await updateProject.mutateAsync({
11
- * p_id: projectId,
12
- * p_name: "New Name"
13
- * });
14
- * ```
15
- */
16
-
17
- import type { PostgrestError } from "@supabase/supabase-js";
18
- import { useMutation, type UseMutationOptions, type UseMutationResult } from "@tanstack/react-query";
19
- import { useSupabaseBrowser } from "../context";
20
- import type { RPCFunctionArgs, RPCFunctionName, RPCFunctionReturns } from "./use-rpc-query";
21
-
22
- /**
23
- * RPC Mutation 的返回类型
24
- */
25
- export interface RpcMutationResult<TData> {
26
- data: TData | null;
27
- error: PostgrestError | null;
28
- }
29
-
30
- /**
31
- * 基于 RPC 函数名进行 Mutation 操作的 Hook
32
- *
33
- * @template TFunc RPC 函数名类型
34
- * @template TData 返回数据类型
35
- * @param functionName RPC 函数名
36
- * @param options React Query Mutation 配置选项
37
- * @returns Mutation 结果
38
- *
39
- * @example
40
- * ```tsx
41
- * // 示例1: 基础使用
42
- * const updateProject = useRpcMutation("audit_project_upsert");
43
- *
44
- * // 在表单提交中使用
45
- * const handleSubmit = async (values) => {
46
- * const { data, error } = await updateProject.mutateAsync({
47
- * p_id: project.id,
48
- * p_name: values.name,
49
- * p_target: values.target
50
- * });
51
- *
52
- * if (error) {
53
- * toast.error(error.message);
54
- * } else {
55
- * toast.success("Updated successfully");
56
- * }
57
- * };
58
- *
59
- * // 示例2: 带类型推断
60
- * type ProjectResult = { id: string; name: string };
61
- * const updateProject = useRpcMutation<"audit_project_upsert", ProjectResult>("audit_project_upsert");
62
- * ```
63
- */
64
- export function useRpcMutation<
65
- TFunc extends RPCFunctionName,
66
- TData = RPCFunctionReturns<TFunc>,
67
- TError = PostgrestError,
68
- TContext = unknown,
69
- >(
70
- functionName: TFunc,
71
- options?: Omit<UseMutationOptions<RpcMutationResult<TData>, TError, RPCFunctionArgs<TFunc>, TContext>, "mutationFn">,
72
- ): UseMutationResult<RpcMutationResult<TData>, TError, RPCFunctionArgs<TFunc>, TContext> {
73
- const sb = useSupabaseBrowser();
74
-
75
- return useMutation<RpcMutationResult<TData>, TError, RPCFunctionArgs<TFunc>, TContext>({
76
- mutationFn: async (args) => {
77
- // biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 内部类型系统
78
- const result = await sb.rpc(functionName, args as any);
79
- return result as RpcMutationResult<TData>;
80
- },
81
- ...options,
82
- });
83
- }
@@ -1,231 +0,0 @@
1
- /**
2
- * 简化版的 Supabase RPC 查询 Hook
3
- * 自动处理 Supabase Client 的获取,无需手动调用 useSupabaseBrowser()
4
- *
5
- * 使用示例:
6
- * ```tsx
7
- * // 方式1: 自动推断类型
8
- * const query1 = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" });
9
- *
10
- * // 方式2: 使用 Zod Schema 进行类型验证和推断 (推荐)
11
- * const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
12
- * const query2 = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
13
- * schema: z.object({ rows: z.array(navItemSchema) })
14
- * });
15
- * // data 的类型为 { rows: { label: string; url?: string }[] } | undefined
16
- *
17
- * // 方式3: 显式泛型指定返回类型
18
- * type NavItem = { label: string; url?: string };
19
- * const query3 = useRpcQuery<NavItem[]>("dash_navitems_list", { p_location: "sidebar_admin" });
20
- * ```
21
- */
22
-
23
- import { useMemo } from "react";
24
- import type { z } from "zod";
25
- import type { SBFunctions } from "../../types";
26
- import { useSupabaseBrowser } from "../context";
27
- import {
28
- KEY_PREFIX,
29
- type UseQueryAnyReturn,
30
- type UseQuerySingleReturn,
31
- useSbQuery,
32
- useSbSuspenseQuery,
33
- } from "./use-query";
34
-
35
- /** 从 SBFunctions 中提取 RPC 函数名的类型 */
36
- export type RPCFunctionName = keyof SBFunctions;
37
-
38
- /**
39
- * 获取 RPC 查询的通用 Query Key 前缀 (用于 invalidation)
40
- * 对应 supabase-cache-helpers 生成的 key 结构: ['postgrest', 'null'|'page', schema, table|rpc, ...]
41
- *
42
- * @param functionName RPC 函数名
43
- * @returns Standard Query Key Prefix e.g. ["postgrest", "null", "public", "function_name"]
44
- */
45
- export function getRpcQueryKey(functionName: string): string[] {
46
- // 默认 schema 为 public, infinite prefix 默认为 "null" (即使是 infinite query, invalidate prefix 通常也能匹配?)
47
- // 注意: explicit invalidation 最好匹配 prefix.
48
- // supabase-cache-helpers 的 getSbTableKey 返回的是 4 个元素
49
- // 注: 对于 RPC,表名解析为 rpc/名称
50
- return [KEY_PREFIX, "null", "public", `rpc/${functionName}`];
51
- }
52
-
53
- /** 提取指定 RPC 函数的参数类型 */
54
- export type RPCFunctionArgs<T extends RPCFunctionName> = SBFunctions[T]["Args"] extends never
55
- ? Record<string, never>
56
- : SBFunctions[T]["Args"];
57
-
58
- /** 提取指定 RPC 函数的返回类型 */
59
- export type RPCFunctionReturns<T extends RPCFunctionName> = SBFunctions[T]["Returns"];
60
-
61
- /**
62
- * RPC 查询的额外选项
63
- */
64
- export interface RpcQueryOptions {
65
- /**
66
- * 可选的 Zod Schema 用于验证和推断返回类型
67
- * 当传入时,将自动验证数据并从 schema 推断类型
68
- *
69
- * @example
70
- * ```tsx
71
- * const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
72
- * const resultSchema = z.object({ rows: z.array(navItemSchema), meta: z.any() });
73
- *
74
- * const { data } = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
75
- * schema: resultSchema
76
- * });
77
- * // data 类型自动推断为 { rows: { label: string; url?: string }[]; meta: any } | undefined
78
- * ```
79
- */
80
- schema?: z.ZodType;
81
- }
82
-
83
- /**
84
- * 基于 RPC 函数名和参数进行查询的 Hook (普通模式)
85
- *
86
- * @template TData 返回数据类型(显式指定或从数据库函数推断)
87
- * @param functionName RPC 函数名
88
- * @param args RPC 函数参数
89
- * @param options 配置选项,包含 React Query 配置和可选的 schema
90
- * @returns 查询结果
91
- *
92
- * @example
93
- * ```tsx
94
- * // 示例1: 基础使用(自动推断)
95
- * const { data } = useRpcQuery("sys_config_get", { p_key: "github_app" });
96
- *
97
- * // 示例2: 使用 Zod Schema(推荐)
98
- * const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
99
- * const { data } = useRpcQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
100
- * schema: z.object({ rows: z.array(navItemSchema), meta: z.any() })
101
- * });
102
- *
103
- * // 示例3: 显式泛型
104
- * type NavItem = { label: string; url?: string };
105
- * const { data } = useRpcQuery<NavItem[]>("dash_navitems_list", { p_location: "sidebar_admin" });
106
- * ```
107
- */
108
- // Overload 1: Schema provided -> Infer TData from Schema
109
- export function useRpcQuery<TFunc extends RPCFunctionName, TSchema extends z.ZodType>(
110
- functionName: TFunc,
111
- args: RPCFunctionArgs<TFunc> | undefined,
112
- options: { schema: TSchema } & Record<string, any>,
113
- ): UseQuerySingleReturn<z.infer<TSchema>>;
114
-
115
- // Overload 2: No schema provided -> Infer TData from Generic (defaulting to RPC return)
116
- export function useRpcQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
117
- functionName: TFunc,
118
- args?: RPCFunctionArgs<TFunc>,
119
- options?: { schema?: undefined } & Record<string, any>,
120
- ): UseQueryAnyReturn<TData>;
121
-
122
- // Overload 3: Legacy/Fallback
123
- export function useRpcQuery<TData = any>(
124
- functionName: string,
125
- args?: any,
126
- options?: { schema?: z.ZodType } & Record<string, any>,
127
- ): UseQueryAnyReturn<TData>;
128
-
129
- export function useRpcQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
130
- functionName: TFunc,
131
- args?: RPCFunctionArgs<TFunc>,
132
- options?: RpcQueryOptions & Record<string, any>,
133
- ): UseQueryAnyReturn<TData> {
134
- const sb = useSupabaseBrowser();
135
- const query = sb.rpc(functionName, args as never);
136
-
137
- const { schema, ...reactQueryConfig } = options || {};
138
-
139
- // biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 内部类型系统
140
- const baseResult = useSbQuery(query as any, reactQueryConfig);
141
-
142
- // 如果提供了 schema,对数据进行验证和转换
143
- const transformedResult = useMemo(() => {
144
- if (!schema || !baseResult.data) {
145
- return baseResult;
146
- }
147
-
148
- try {
149
- const validatedData = schema.parse(baseResult.data);
150
- return {
151
- ...baseResult,
152
- data: validatedData as TData,
153
- };
154
- } catch (error) {
155
- console.error(`[useRpcQuery] Schema validation failed for ${String(functionName)}:`, error);
156
- // 验证失败时返回原始数据,避免阻断用户流程
157
- return baseResult;
158
- }
159
- }, [schema, baseResult, functionName]);
160
-
161
- return transformedResult as UseQueryAnyReturn<TData>;
162
- }
163
-
164
- /**
165
- * 基于 RPC 函数名和参数进行查询的 Hook (Suspense 模式)
166
- *
167
- * @template TData 返回数据类型(通过 schema 或泛型指定)
168
- * @param functionName RPC 函数名
169
- * @param args RPC 函数参数
170
- * @param options 配置选项
171
- * @returns Suspense 查询结果
172
- *
173
- * @example
174
- * ```tsx
175
- * const navItemSchema = z.object({ label: z.string(), url: z.string().optional() });
176
- * const { data } = useRpcSuspenseQuery("dash_navitems_list", { p_location: "sidebar_admin" }, {
177
- * schema: z.object({ rows: z.array(navItemSchema) })
178
- * });
179
- * // data 类型: { rows: { label: string; url?: string }[] }
180
- * ```
181
- */
182
- // Overload 1: Schema provided
183
- export function useRpcSuspenseQuery<TFunc extends RPCFunctionName, TSchema extends z.ZodType>(
184
- functionName: TFunc,
185
- args: RPCFunctionArgs<TFunc> | undefined,
186
- // biome-ignore lint/suspicious/noExplicitAny: 允许传入 schema
187
- options: { schema: TSchema } & Omit<any, "queryKey" | "queryFn">,
188
- ): { data: z.infer<TSchema>; [key: string]: unknown };
189
-
190
- // Overload 2: No schema
191
- export function useRpcSuspenseQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
192
- functionName: TFunc,
193
- args?: RPCFunctionArgs<TFunc>,
194
- // biome-ignore lint/suspicious/noExplicitAny: 普通模式
195
- options?: { schema?: undefined } & Omit<any, "queryKey" | "queryFn">,
196
- ): { data: TData; [key: string]: unknown };
197
-
198
- export function useRpcSuspenseQuery<TFunc extends RPCFunctionName, TData = RPCFunctionReturns<TFunc>>(
199
- functionName: TFunc,
200
- args?: RPCFunctionArgs<TFunc>,
201
- // biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 和 ReactQuery 过于复杂的类型推断系统,保持对外类型安全
202
- options?: RpcQueryOptions & Omit<any, "queryKey" | "queryFn">,
203
- ): { data: TData; [key: string]: unknown } {
204
- const sb = useSupabaseBrowser();
205
- const query = sb.rpc(functionName, args as never);
206
-
207
- const { schema, ...reactQueryConfig } = options || {};
208
-
209
- // biome-ignore lint/suspicious/noExplicitAny: 绕过 Supabase 内部类型系统
210
- const baseResult = useSbSuspenseQuery(query as any, reactQueryConfig);
211
-
212
- // 如果提供了 schema,对数据进行验证和转换
213
- const transformedResult = useMemo(() => {
214
- if (!schema) {
215
- return baseResult;
216
- }
217
-
218
- try {
219
- const validatedData = schema.parse(baseResult.data);
220
- return {
221
- ...baseResult,
222
- data: validatedData as TData,
223
- };
224
- } catch (error) {
225
- console.error(`[useRpcSuspenseQuery] Schema validation failed for ${String(functionName)}:`, error);
226
- return baseResult;
227
- }
228
- }, [schema, baseResult, functionName]);
229
-
230
- return transformedResult as { data: TData; [key: string]: unknown };
231
- }