convex 1.34.1 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (512) hide show
  1. package/CHANGELOG.md +86 -43
  2. package/dist/browser.bundle.js +8 -2
  3. package/dist/browser.bundle.js.map +3 -3
  4. package/dist/cjs/browser/index-node.js +3 -1
  5. package/dist/cjs/browser/index.js +3 -1
  6. package/dist/cjs/browser/index.js.map +2 -2
  7. package/dist/cjs/browser/query_options.js.map +2 -2
  8. package/dist/cjs/cli/aiFiles.js +31 -13
  9. package/dist/cjs/cli/aiFiles.js.map +3 -3
  10. package/dist/cjs/cli/codegen_templates/readme.js +14 -1
  11. package/dist/cjs/cli/codegen_templates/readme.js.map +2 -2
  12. package/dist/cjs/cli/configure.js +21 -24
  13. package/dist/cjs/cli/configure.js.map +2 -2
  14. package/dist/cjs/cli/deploy.js +7 -8
  15. package/dist/cjs/cli/deploy.js.map +2 -2
  16. package/dist/cjs/cli/deploymentCreate.js +225 -40
  17. package/dist/cjs/cli/deploymentCreate.js.map +3 -3
  18. package/dist/cjs/cli/deploymentSelect.js +14 -13
  19. package/dist/cjs/cli/deploymentSelect.js.map +2 -2
  20. package/dist/cjs/cli/dev.js +30 -11
  21. package/dist/cjs/cli/dev.js.map +2 -2
  22. package/dist/cjs/cli/docs.js +1 -1
  23. package/dist/cjs/cli/docs.js.map +2 -2
  24. package/dist/cjs/cli/init.js +1 -1
  25. package/dist/cjs/cli/init.js.map +2 -2
  26. package/dist/cjs/cli/lib/aiFiles/agentsmd.js +14 -10
  27. package/dist/cjs/cli/lib/aiFiles/agentsmd.js.map +2 -2
  28. package/dist/cjs/cli/lib/aiFiles/claudemd.js +14 -10
  29. package/dist/cjs/cli/lib/aiFiles/claudemd.js.map +2 -2
  30. package/dist/cjs/cli/lib/aiFiles/guidelinesmd.js +10 -3
  31. package/dist/cjs/cli/lib/aiFiles/guidelinesmd.js.map +2 -2
  32. package/dist/cjs/cli/lib/aiFiles/index.js +70 -86
  33. package/dist/cjs/cli/lib/aiFiles/index.js.map +3 -3
  34. package/dist/cjs/cli/lib/aiFiles/skills.js +28 -12
  35. package/dist/cjs/cli/lib/aiFiles/skills.js.map +2 -2
  36. package/dist/cjs/cli/lib/aiFiles/state.js +96 -0
  37. package/dist/cjs/cli/lib/aiFiles/state.js.map +7 -0
  38. package/dist/cjs/cli/lib/aiFiles/status.js +31 -28
  39. package/dist/cjs/cli/lib/aiFiles/status.js.map +2 -2
  40. package/dist/cjs/cli/lib/aiFiles/utils.js +31 -14
  41. package/dist/cjs/cli/lib/aiFiles/utils.js.map +2 -2
  42. package/dist/cjs/cli/lib/api.js +70 -7
  43. package/dist/cjs/cli/lib/api.js.map +2 -2
  44. package/dist/cjs/cli/lib/command.js +4 -5
  45. package/dist/cjs/cli/lib/command.js.map +2 -2
  46. package/dist/cjs/cli/lib/config.js +41 -4
  47. package/dist/cjs/cli/lib/config.js.map +3 -3
  48. package/dist/cjs/cli/lib/deploy2.js +9 -26
  49. package/dist/cjs/cli/lib/deploy2.js.map +2 -2
  50. package/dist/cjs/cli/lib/deployApi/componentDefinition.js +4 -1
  51. package/dist/cjs/cli/lib/deployApi/componentDefinition.js.map +2 -2
  52. package/dist/cjs/cli/lib/deploymentSelection.js +45 -2
  53. package/dist/cjs/cli/lib/deploymentSelection.js.map +2 -2
  54. package/dist/cjs/cli/lib/deploymentSelector.js +1 -0
  55. package/dist/cjs/cli/lib/deploymentSelector.js.map +2 -2
  56. package/dist/cjs/cli/lib/dev.js +162 -117
  57. package/dist/cjs/cli/lib/dev.js.map +2 -2
  58. package/dist/cjs/cli/lib/env.js +1 -13
  59. package/dist/cjs/cli/lib/env.js.map +2 -2
  60. package/dist/cjs/cli/lib/expiration.js +104 -0
  61. package/dist/cjs/cli/lib/expiration.js.map +7 -0
  62. package/dist/cjs/cli/lib/generatedFunctionLogsApi.js.map +1 -1
  63. package/dist/cjs/cli/lib/init.js +4 -3
  64. package/dist/cjs/cli/lib/init.js.map +2 -2
  65. package/dist/cjs/cli/lib/insights.js +1 -1
  66. package/dist/cjs/cli/lib/insights.js.map +2 -2
  67. package/dist/cjs/cli/lib/localDeployment/anonymous.js +14 -7
  68. package/dist/cjs/cli/lib/localDeployment/anonymous.js.map +2 -2
  69. package/dist/cjs/cli/lib/localDeployment/localDeployment.js +8 -10
  70. package/dist/cjs/cli/lib/localDeployment/localDeployment.js.map +2 -2
  71. package/dist/cjs/cli/lib/localDeployment/run.js +1 -0
  72. package/dist/cjs/cli/lib/localDeployment/run.js.map +2 -2
  73. package/dist/cjs/cli/lib/localDeployment/upgrade.js +2 -2
  74. package/dist/cjs/cli/lib/localDeployment/upgrade.js.map +2 -2
  75. package/dist/cjs/cli/lib/localDeployment/utils.js +9 -0
  76. package/dist/cjs/cli/lib/localDeployment/utils.js.map +2 -2
  77. package/dist/cjs/cli/lib/mcp/tools/status.js +1 -1
  78. package/dist/cjs/cli/lib/mcp/tools/status.js.map +2 -2
  79. package/dist/cjs/cli/lib/updates.js +8 -9
  80. package/dist/cjs/cli/lib/updates.js.map +2 -2
  81. package/dist/cjs/cli/lib/usage.js +2 -1
  82. package/dist/cjs/cli/lib/usage.js.map +2 -2
  83. package/dist/cjs/cli/lib/utils/prompts.js +2 -1
  84. package/dist/cjs/cli/lib/utils/prompts.js.map +2 -2
  85. package/dist/cjs/cli/lib/utils/utils.js +46 -20
  86. package/dist/cjs/cli/lib/utils/utils.js.map +3 -3
  87. package/dist/cjs/index.js +1 -1
  88. package/dist/cjs/index.js.map +1 -1
  89. package/dist/cjs/react/client.js +43 -6
  90. package/dist/cjs/react/client.js.map +2 -2
  91. package/dist/cjs/react/index.js +2 -0
  92. package/dist/cjs/react/index.js.map +2 -2
  93. package/dist/cjs/react-clerk/ConvexProviderWithClerk.js.map +1 -1
  94. package/dist/cjs/server/api.js.map +2 -2
  95. package/dist/cjs/server/components/definition.js.map +1 -1
  96. package/dist/cjs/server/components/index.js +40 -4
  97. package/dist/cjs/server/components/index.js.map +2 -2
  98. package/dist/cjs/server/data_model.js.map +1 -1
  99. package/dist/cjs/server/impl/meta_impl.js +78 -0
  100. package/dist/cjs/server/impl/meta_impl.js.map +7 -0
  101. package/dist/cjs/server/impl/registration_impl.js +16 -11
  102. package/dist/cjs/server/impl/registration_impl.js.map +2 -2
  103. package/dist/cjs/server/index.js.map +2 -2
  104. package/dist/cjs/server/meta.js +17 -0
  105. package/dist/cjs/server/meta.js.map +7 -0
  106. package/dist/cjs/server/registration.js.map +1 -1
  107. package/dist/cjs-types/browser/index.d.ts +1 -0
  108. package/dist/cjs-types/browser/index.d.ts.map +1 -1
  109. package/dist/cjs-types/browser/query_options.d.ts +12 -9
  110. package/dist/cjs-types/browser/query_options.d.ts.map +1 -1
  111. package/dist/cjs-types/cli/aiFiles.d.ts.map +1 -1
  112. package/dist/cjs-types/cli/codegen_templates/readme.d.ts.map +1 -1
  113. package/dist/cjs-types/cli/configure.d.ts.map +1 -1
  114. package/dist/cjs-types/cli/configure.test.d.ts +2 -0
  115. package/dist/cjs-types/cli/configure.test.d.ts.map +1 -0
  116. package/dist/cjs-types/cli/deploy.d.ts.map +1 -1
  117. package/dist/cjs-types/cli/deploymentCreate.d.ts +1 -0
  118. package/dist/cjs-types/cli/deploymentCreate.d.ts.map +1 -1
  119. package/dist/cjs-types/cli/deploymentSelect.d.ts +2 -1
  120. package/dist/cjs-types/cli/deploymentSelect.d.ts.map +1 -1
  121. package/dist/cjs-types/cli/dev.d.ts +3 -1
  122. package/dist/cjs-types/cli/dev.d.ts.map +1 -1
  123. package/dist/cjs-types/cli/lib/aiFiles/agentsmd.d.ts +5 -5
  124. package/dist/cjs-types/cli/lib/aiFiles/agentsmd.d.ts.map +1 -1
  125. package/dist/cjs-types/cli/lib/aiFiles/claudemd.d.ts +5 -5
  126. package/dist/cjs-types/cli/lib/aiFiles/claudemd.d.ts.map +1 -1
  127. package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.d.ts +3 -3
  128. package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.d.ts.map +1 -1
  129. package/dist/cjs-types/cli/lib/aiFiles/index.d.ts +20 -18
  130. package/dist/cjs-types/cli/lib/aiFiles/index.d.ts.map +1 -1
  131. package/dist/cjs-types/cli/lib/aiFiles/skills.d.ts +6 -4
  132. package/dist/cjs-types/cli/lib/aiFiles/skills.d.ts.map +1 -1
  133. package/dist/cjs-types/cli/lib/aiFiles/state.d.ts +38 -0
  134. package/dist/cjs-types/cli/lib/aiFiles/state.d.ts.map +1 -0
  135. package/dist/cjs-types/cli/lib/aiFiles/state.test.d.ts +2 -0
  136. package/dist/cjs-types/cli/lib/aiFiles/state.test.d.ts.map +1 -0
  137. package/dist/cjs-types/cli/lib/aiFiles/status.d.ts +4 -1
  138. package/dist/cjs-types/cli/lib/aiFiles/status.d.ts.map +1 -1
  139. package/dist/cjs-types/cli/lib/aiFiles/utils.d.ts +13 -3
  140. package/dist/cjs-types/cli/lib/aiFiles/utils.d.ts.map +1 -1
  141. package/dist/cjs-types/cli/lib/aiFiles/utils.test.d.ts +2 -0
  142. package/dist/cjs-types/cli/lib/aiFiles/utils.test.d.ts.map +1 -0
  143. package/dist/cjs-types/cli/lib/api.d.ts +3 -3
  144. package/dist/cjs-types/cli/lib/api.d.ts.map +1 -1
  145. package/dist/cjs-types/cli/lib/command.d.ts +2 -1
  146. package/dist/cjs-types/cli/lib/command.d.ts.map +1 -1
  147. package/dist/cjs-types/cli/lib/config.d.ts +17 -6
  148. package/dist/cjs-types/cli/lib/config.d.ts.map +1 -1
  149. package/dist/cjs-types/cli/lib/deploy2.d.ts +5 -2
  150. package/dist/cjs-types/cli/lib/deploy2.d.ts.map +1 -1
  151. package/dist/cjs-types/cli/lib/deployApi/componentDefinition.d.ts +27 -12
  152. package/dist/cjs-types/cli/lib/deployApi/componentDefinition.d.ts.map +1 -1
  153. package/dist/cjs-types/cli/lib/deployApi/definitionConfig.d.ts +24 -24
  154. package/dist/cjs-types/cli/lib/deployApi/modules.d.ts +14 -14
  155. package/dist/cjs-types/cli/lib/deployApi/startPush.d.ts +61 -52
  156. package/dist/cjs-types/cli/lib/deployApi/startPush.d.ts.map +1 -1
  157. package/dist/cjs-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  158. package/dist/cjs-types/cli/lib/deploymentSelector.d.ts +2 -0
  159. package/dist/cjs-types/cli/lib/deploymentSelector.d.ts.map +1 -1
  160. package/dist/cjs-types/cli/lib/dev.d.ts.map +1 -1
  161. package/dist/cjs-types/cli/lib/env.d.ts +0 -4
  162. package/dist/cjs-types/cli/lib/env.d.ts.map +1 -1
  163. package/dist/cjs-types/cli/lib/expiration.d.ts +35 -0
  164. package/dist/cjs-types/cli/lib/expiration.d.ts.map +1 -0
  165. package/dist/cjs-types/cli/lib/expiration.test.d.ts +2 -0
  166. package/dist/cjs-types/cli/lib/expiration.test.d.ts.map +1 -0
  167. package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts +16 -1
  168. package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
  169. package/dist/cjs-types/cli/lib/init.d.ts.map +1 -1
  170. package/dist/cjs-types/cli/lib/localDeployment/anonymous.d.ts.map +1 -1
  171. package/dist/cjs-types/cli/lib/localDeployment/localDeployment.d.ts.map +1 -1
  172. package/dist/cjs-types/cli/lib/localDeployment/run.d.ts +15 -0
  173. package/dist/cjs-types/cli/lib/localDeployment/run.d.ts.map +1 -1
  174. package/dist/cjs-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
  175. package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts +7 -0
  176. package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
  177. package/dist/cjs-types/cli/lib/mcp/requestContext.d.ts +3 -3
  178. package/dist/cjs-types/cli/lib/mcp/tools/insights.d.ts +2 -2
  179. package/dist/cjs-types/cli/lib/updates.d.ts +4 -3
  180. package/dist/cjs-types/cli/lib/updates.d.ts.map +1 -1
  181. package/dist/cjs-types/cli/lib/usage.d.ts.map +1 -1
  182. package/dist/cjs-types/cli/lib/utils/prompts.d.ts +1 -0
  183. package/dist/cjs-types/cli/lib/utils/prompts.d.ts.map +1 -1
  184. package/dist/cjs-types/cli/lib/utils/utils.d.ts +16 -2
  185. package/dist/cjs-types/cli/lib/utils/utils.d.ts.map +1 -1
  186. package/dist/cjs-types/index.d.ts +1 -1
  187. package/dist/cjs-types/react/client.d.ts +54 -2
  188. package/dist/cjs-types/react/client.d.ts.map +1 -1
  189. package/dist/cjs-types/react/index.d.ts +7 -2
  190. package/dist/cjs-types/react/index.d.ts.map +1 -1
  191. package/dist/cjs-types/react/use_query_object_options.test.d.ts +5 -0
  192. package/dist/cjs-types/react/use_query_object_options.test.d.ts.map +1 -0
  193. package/dist/cjs-types/react/use_query_result.test.d.ts +5 -0
  194. package/dist/cjs-types/react/use_query_result.test.d.ts.map +1 -0
  195. package/dist/cjs-types/react-clerk/ConvexProviderWithClerk.d.ts +1 -1
  196. package/dist/cjs-types/server/api.d.ts +5 -1
  197. package/dist/cjs-types/server/api.d.ts.map +1 -1
  198. package/dist/cjs-types/server/components/definition.d.ts +1 -0
  199. package/dist/cjs-types/server/components/definition.d.ts.map +1 -1
  200. package/dist/cjs-types/server/components/index.d.ts +5 -1
  201. package/dist/cjs-types/server/components/index.d.ts.map +1 -1
  202. package/dist/cjs-types/server/data_model.d.ts +2 -1
  203. package/dist/cjs-types/server/data_model.d.ts.map +1 -1
  204. package/dist/cjs-types/server/impl/meta_impl.d.ts +5 -0
  205. package/dist/cjs-types/server/impl/meta_impl.d.ts.map +1 -0
  206. package/dist/cjs-types/server/impl/registration_impl.d.ts.map +1 -1
  207. package/dist/cjs-types/server/index.d.ts +1 -0
  208. package/dist/cjs-types/server/index.d.ts.map +1 -1
  209. package/dist/cjs-types/server/meta.d.ts +72 -0
  210. package/dist/cjs-types/server/meta.d.ts.map +1 -0
  211. package/dist/cjs-types/server/registration.d.ts.map +1 -1
  212. package/dist/cli.bundle.cjs +1670 -1214
  213. package/dist/cli.bundle.cjs.map +4 -4
  214. package/dist/esm/browser/index-node.js +1 -0
  215. package/dist/esm/browser/index.js +1 -0
  216. package/dist/esm/browser/index.js.map +2 -2
  217. package/dist/esm/browser/query_options.js.map +2 -2
  218. package/dist/esm/cli/aiFiles.js +33 -15
  219. package/dist/esm/cli/aiFiles.js.map +2 -2
  220. package/dist/esm/cli/codegen_templates/readme.js +14 -1
  221. package/dist/esm/cli/codegen_templates/readme.js.map +2 -2
  222. package/dist/esm/cli/configure.js +23 -26
  223. package/dist/esm/cli/configure.js.map +2 -2
  224. package/dist/esm/cli/deploy.js +11 -10
  225. package/dist/esm/cli/deploy.js.map +2 -2
  226. package/dist/esm/cli/deploymentCreate.js +238 -42
  227. package/dist/esm/cli/deploymentCreate.js.map +2 -2
  228. package/dist/esm/cli/deploymentSelect.js +13 -12
  229. package/dist/esm/cli/deploymentSelect.js.map +2 -2
  230. package/dist/esm/cli/dev.js +34 -13
  231. package/dist/esm/cli/dev.js.map +2 -2
  232. package/dist/esm/cli/docs.js +1 -1
  233. package/dist/esm/cli/docs.js.map +2 -2
  234. package/dist/esm/cli/init.js +2 -2
  235. package/dist/esm/cli/init.js.map +2 -2
  236. package/dist/esm/cli/lib/aiFiles/agentsmd.js +13 -9
  237. package/dist/esm/cli/lib/aiFiles/agentsmd.js.map +2 -2
  238. package/dist/esm/cli/lib/aiFiles/claudemd.js +13 -9
  239. package/dist/esm/cli/lib/aiFiles/claudemd.js.map +2 -2
  240. package/dist/esm/cli/lib/aiFiles/guidelinesmd.js +12 -5
  241. package/dist/esm/cli/lib/aiFiles/guidelinesmd.js.map +2 -2
  242. package/dist/esm/cli/lib/aiFiles/index.js +72 -89
  243. package/dist/esm/cli/lib/aiFiles/index.js.map +2 -2
  244. package/dist/esm/cli/lib/aiFiles/skills.js +29 -13
  245. package/dist/esm/cli/lib/aiFiles/skills.js.map +2 -2
  246. package/dist/esm/cli/lib/aiFiles/state.js +60 -0
  247. package/dist/esm/cli/lib/aiFiles/state.js.map +7 -0
  248. package/dist/esm/cli/lib/aiFiles/status.js +32 -29
  249. package/dist/esm/cli/lib/aiFiles/status.js.map +2 -2
  250. package/dist/esm/cli/lib/aiFiles/utils.js +25 -10
  251. package/dist/esm/cli/lib/aiFiles/utils.js.map +2 -2
  252. package/dist/esm/cli/lib/api.js +70 -7
  253. package/dist/esm/cli/lib/api.js.map +2 -2
  254. package/dist/esm/cli/lib/command.js +4 -5
  255. package/dist/esm/cli/lib/command.js.map +2 -2
  256. package/dist/esm/cli/lib/config.js +39 -3
  257. package/dist/esm/cli/lib/config.js.map +2 -2
  258. package/dist/esm/cli/lib/deploy2.js +13 -26
  259. package/dist/esm/cli/lib/deploy2.js.map +2 -2
  260. package/dist/esm/cli/lib/deployApi/componentDefinition.js +4 -1
  261. package/dist/esm/cli/lib/deployApi/componentDefinition.js.map +2 -2
  262. package/dist/esm/cli/lib/deploymentSelection.js +46 -2
  263. package/dist/esm/cli/lib/deploymentSelection.js.map +2 -2
  264. package/dist/esm/cli/lib/deploymentSelector.js +1 -0
  265. package/dist/esm/cli/lib/deploymentSelector.js.map +2 -2
  266. package/dist/esm/cli/lib/dev.js +162 -118
  267. package/dist/esm/cli/lib/dev.js.map +2 -2
  268. package/dist/esm/cli/lib/env.js +0 -11
  269. package/dist/esm/cli/lib/env.js.map +2 -2
  270. package/dist/esm/cli/lib/expiration.js +80 -0
  271. package/dist/esm/cli/lib/expiration.js.map +7 -0
  272. package/dist/esm/cli/lib/init.js +4 -3
  273. package/dist/esm/cli/lib/init.js.map +2 -2
  274. package/dist/esm/cli/lib/insights.js +1 -1
  275. package/dist/esm/cli/lib/insights.js.map +2 -2
  276. package/dist/esm/cli/lib/localDeployment/anonymous.js +16 -9
  277. package/dist/esm/cli/lib/localDeployment/anonymous.js.map +2 -2
  278. package/dist/esm/cli/lib/localDeployment/localDeployment.js +9 -11
  279. package/dist/esm/cli/lib/localDeployment/localDeployment.js.map +2 -2
  280. package/dist/esm/cli/lib/localDeployment/run.js +1 -1
  281. package/dist/esm/cli/lib/localDeployment/run.js.map +2 -2
  282. package/dist/esm/cli/lib/localDeployment/upgrade.js +2 -2
  283. package/dist/esm/cli/lib/localDeployment/upgrade.js.map +2 -2
  284. package/dist/esm/cli/lib/localDeployment/utils.js +8 -0
  285. package/dist/esm/cli/lib/localDeployment/utils.js.map +2 -2
  286. package/dist/esm/cli/lib/mcp/tools/status.js +1 -1
  287. package/dist/esm/cli/lib/mcp/tools/status.js.map +2 -2
  288. package/dist/esm/cli/lib/updates.js +11 -9
  289. package/dist/esm/cli/lib/updates.js.map +2 -2
  290. package/dist/esm/cli/lib/usage.js +2 -1
  291. package/dist/esm/cli/lib/usage.js.map +2 -2
  292. package/dist/esm/cli/lib/utils/prompts.js +2 -1
  293. package/dist/esm/cli/lib/utils/prompts.js.map +2 -2
  294. package/dist/esm/cli/lib/utils/utils.js +45 -20
  295. package/dist/esm/cli/lib/utils/utils.js.map +3 -3
  296. package/dist/esm/index.js +1 -1
  297. package/dist/esm/index.js.map +1 -1
  298. package/dist/esm/react/client.js +43 -6
  299. package/dist/esm/react/client.js.map +2 -2
  300. package/dist/esm/react/index.js +1 -0
  301. package/dist/esm/react/index.js.map +2 -2
  302. package/dist/esm/react-clerk/ConvexProviderWithClerk.js.map +1 -1
  303. package/dist/esm/server/api.js.map +2 -2
  304. package/dist/esm/server/components/index.js +40 -4
  305. package/dist/esm/server/components/index.js.map +2 -2
  306. package/dist/esm/server/impl/meta_impl.js +54 -0
  307. package/dist/esm/server/impl/meta_impl.js.map +7 -0
  308. package/dist/esm/server/impl/registration_impl.js +20 -11
  309. package/dist/esm/server/impl/registration_impl.js.map +2 -2
  310. package/dist/esm/server/index.js.map +2 -2
  311. package/dist/esm/server/meta.js +2 -0
  312. package/dist/esm/server/meta.js.map +7 -0
  313. package/dist/esm-types/browser/index.d.ts +1 -0
  314. package/dist/esm-types/browser/index.d.ts.map +1 -1
  315. package/dist/esm-types/browser/query_options.d.ts +12 -9
  316. package/dist/esm-types/browser/query_options.d.ts.map +1 -1
  317. package/dist/esm-types/cli/aiFiles.d.ts.map +1 -1
  318. package/dist/esm-types/cli/codegen_templates/readme.d.ts.map +1 -1
  319. package/dist/esm-types/cli/configure.d.ts.map +1 -1
  320. package/dist/esm-types/cli/configure.test.d.ts +2 -0
  321. package/dist/esm-types/cli/configure.test.d.ts.map +1 -0
  322. package/dist/esm-types/cli/deploy.d.ts.map +1 -1
  323. package/dist/esm-types/cli/deploymentCreate.d.ts +1 -0
  324. package/dist/esm-types/cli/deploymentCreate.d.ts.map +1 -1
  325. package/dist/esm-types/cli/deploymentSelect.d.ts +2 -1
  326. package/dist/esm-types/cli/deploymentSelect.d.ts.map +1 -1
  327. package/dist/esm-types/cli/dev.d.ts +3 -1
  328. package/dist/esm-types/cli/dev.d.ts.map +1 -1
  329. package/dist/esm-types/cli/lib/aiFiles/agentsmd.d.ts +5 -5
  330. package/dist/esm-types/cli/lib/aiFiles/agentsmd.d.ts.map +1 -1
  331. package/dist/esm-types/cli/lib/aiFiles/claudemd.d.ts +5 -5
  332. package/dist/esm-types/cli/lib/aiFiles/claudemd.d.ts.map +1 -1
  333. package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.d.ts +3 -3
  334. package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.d.ts.map +1 -1
  335. package/dist/esm-types/cli/lib/aiFiles/index.d.ts +20 -18
  336. package/dist/esm-types/cli/lib/aiFiles/index.d.ts.map +1 -1
  337. package/dist/esm-types/cli/lib/aiFiles/skills.d.ts +6 -4
  338. package/dist/esm-types/cli/lib/aiFiles/skills.d.ts.map +1 -1
  339. package/dist/esm-types/cli/lib/aiFiles/state.d.ts +38 -0
  340. package/dist/esm-types/cli/lib/aiFiles/state.d.ts.map +1 -0
  341. package/dist/esm-types/cli/lib/aiFiles/state.test.d.ts +2 -0
  342. package/dist/esm-types/cli/lib/aiFiles/state.test.d.ts.map +1 -0
  343. package/dist/esm-types/cli/lib/aiFiles/status.d.ts +4 -1
  344. package/dist/esm-types/cli/lib/aiFiles/status.d.ts.map +1 -1
  345. package/dist/esm-types/cli/lib/aiFiles/utils.d.ts +13 -3
  346. package/dist/esm-types/cli/lib/aiFiles/utils.d.ts.map +1 -1
  347. package/dist/esm-types/cli/lib/aiFiles/utils.test.d.ts +2 -0
  348. package/dist/esm-types/cli/lib/aiFiles/utils.test.d.ts.map +1 -0
  349. package/dist/esm-types/cli/lib/api.d.ts +3 -3
  350. package/dist/esm-types/cli/lib/api.d.ts.map +1 -1
  351. package/dist/esm-types/cli/lib/command.d.ts +2 -1
  352. package/dist/esm-types/cli/lib/command.d.ts.map +1 -1
  353. package/dist/esm-types/cli/lib/config.d.ts +17 -6
  354. package/dist/esm-types/cli/lib/config.d.ts.map +1 -1
  355. package/dist/esm-types/cli/lib/deploy2.d.ts +5 -2
  356. package/dist/esm-types/cli/lib/deploy2.d.ts.map +1 -1
  357. package/dist/esm-types/cli/lib/deployApi/componentDefinition.d.ts +27 -12
  358. package/dist/esm-types/cli/lib/deployApi/componentDefinition.d.ts.map +1 -1
  359. package/dist/esm-types/cli/lib/deployApi/definitionConfig.d.ts +24 -24
  360. package/dist/esm-types/cli/lib/deployApi/modules.d.ts +14 -14
  361. package/dist/esm-types/cli/lib/deployApi/startPush.d.ts +61 -52
  362. package/dist/esm-types/cli/lib/deployApi/startPush.d.ts.map +1 -1
  363. package/dist/esm-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  364. package/dist/esm-types/cli/lib/deploymentSelector.d.ts +2 -0
  365. package/dist/esm-types/cli/lib/deploymentSelector.d.ts.map +1 -1
  366. package/dist/esm-types/cli/lib/dev.d.ts.map +1 -1
  367. package/dist/esm-types/cli/lib/env.d.ts +0 -4
  368. package/dist/esm-types/cli/lib/env.d.ts.map +1 -1
  369. package/dist/esm-types/cli/lib/expiration.d.ts +35 -0
  370. package/dist/esm-types/cli/lib/expiration.d.ts.map +1 -0
  371. package/dist/esm-types/cli/lib/expiration.test.d.ts +2 -0
  372. package/dist/esm-types/cli/lib/expiration.test.d.ts.map +1 -0
  373. package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts +16 -1
  374. package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
  375. package/dist/esm-types/cli/lib/init.d.ts.map +1 -1
  376. package/dist/esm-types/cli/lib/localDeployment/anonymous.d.ts.map +1 -1
  377. package/dist/esm-types/cli/lib/localDeployment/localDeployment.d.ts.map +1 -1
  378. package/dist/esm-types/cli/lib/localDeployment/run.d.ts +15 -0
  379. package/dist/esm-types/cli/lib/localDeployment/run.d.ts.map +1 -1
  380. package/dist/esm-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
  381. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts +7 -0
  382. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
  383. package/dist/esm-types/cli/lib/mcp/requestContext.d.ts +3 -3
  384. package/dist/esm-types/cli/lib/mcp/tools/insights.d.ts +2 -2
  385. package/dist/esm-types/cli/lib/updates.d.ts +4 -3
  386. package/dist/esm-types/cli/lib/updates.d.ts.map +1 -1
  387. package/dist/esm-types/cli/lib/usage.d.ts.map +1 -1
  388. package/dist/esm-types/cli/lib/utils/prompts.d.ts +1 -0
  389. package/dist/esm-types/cli/lib/utils/prompts.d.ts.map +1 -1
  390. package/dist/esm-types/cli/lib/utils/utils.d.ts +16 -2
  391. package/dist/esm-types/cli/lib/utils/utils.d.ts.map +1 -1
  392. package/dist/esm-types/index.d.ts +1 -1
  393. package/dist/esm-types/react/client.d.ts +54 -2
  394. package/dist/esm-types/react/client.d.ts.map +1 -1
  395. package/dist/esm-types/react/index.d.ts +7 -2
  396. package/dist/esm-types/react/index.d.ts.map +1 -1
  397. package/dist/esm-types/react/use_query_object_options.test.d.ts +5 -0
  398. package/dist/esm-types/react/use_query_object_options.test.d.ts.map +1 -0
  399. package/dist/esm-types/react/use_query_result.test.d.ts +5 -0
  400. package/dist/esm-types/react/use_query_result.test.d.ts.map +1 -0
  401. package/dist/esm-types/react-clerk/ConvexProviderWithClerk.d.ts +1 -1
  402. package/dist/esm-types/server/api.d.ts +5 -1
  403. package/dist/esm-types/server/api.d.ts.map +1 -1
  404. package/dist/esm-types/server/components/definition.d.ts +1 -0
  405. package/dist/esm-types/server/components/definition.d.ts.map +1 -1
  406. package/dist/esm-types/server/components/index.d.ts +5 -1
  407. package/dist/esm-types/server/components/index.d.ts.map +1 -1
  408. package/dist/esm-types/server/data_model.d.ts +2 -1
  409. package/dist/esm-types/server/data_model.d.ts.map +1 -1
  410. package/dist/esm-types/server/impl/meta_impl.d.ts +5 -0
  411. package/dist/esm-types/server/impl/meta_impl.d.ts.map +1 -0
  412. package/dist/esm-types/server/impl/registration_impl.d.ts.map +1 -1
  413. package/dist/esm-types/server/index.d.ts +1 -0
  414. package/dist/esm-types/server/index.d.ts.map +1 -1
  415. package/dist/esm-types/server/meta.d.ts +72 -0
  416. package/dist/esm-types/server/meta.d.ts.map +1 -0
  417. package/dist/esm-types/server/registration.d.ts.map +1 -1
  418. package/dist/react.bundle.js +50 -7
  419. package/dist/react.bundle.js.map +3 -3
  420. package/package.json +11 -7
  421. package/schemas/convex.schema.json +15 -2
  422. package/src/browser/index.ts +3 -0
  423. package/src/browser/query_options.test.ts +0 -9
  424. package/src/browser/query_options.ts +36 -15
  425. package/src/cli/aiFiles.ts +44 -14
  426. package/src/cli/codegen_templates/readme.ts +14 -1
  427. package/src/cli/configure.test.ts +138 -0
  428. package/src/cli/configure.ts +48 -47
  429. package/src/cli/deploy.ts +12 -9
  430. package/src/cli/deploymentCreate.test.ts +349 -14
  431. package/src/cli/deploymentCreate.ts +268 -41
  432. package/src/cli/deploymentSelect.test.ts +136 -27
  433. package/src/cli/deploymentSelect.ts +50 -41
  434. package/src/cli/deploymentSelection.test.ts +343 -35
  435. package/src/cli/dev.ts +49 -14
  436. package/src/cli/docs.ts +1 -1
  437. package/src/cli/init.ts +2 -2
  438. package/src/cli/lib/aiFiles/agentsmd.ts +15 -11
  439. package/src/cli/lib/aiFiles/claudemd.ts +15 -11
  440. package/src/cli/lib/aiFiles/guidelinesmd.test.ts +12 -2
  441. package/src/cli/lib/aiFiles/guidelinesmd.ts +15 -7
  442. package/src/cli/lib/aiFiles/index.test.ts +188 -222
  443. package/src/cli/lib/aiFiles/index.ts +119 -125
  444. package/src/cli/lib/aiFiles/integration.test.ts +112 -45
  445. package/src/cli/lib/aiFiles/prompt.test.ts +6 -6
  446. package/src/cli/lib/aiFiles/skills.ts +46 -16
  447. package/src/cli/lib/aiFiles/state.test.ts +280 -0
  448. package/src/cli/lib/aiFiles/state.ts +82 -0
  449. package/src/cli/lib/aiFiles/status.ts +45 -39
  450. package/src/cli/lib/aiFiles/utils.test.ts +50 -0
  451. package/src/cli/lib/aiFiles/utils.ts +38 -10
  452. package/src/cli/lib/api.ts +88 -7
  453. package/src/cli/lib/command.ts +12 -7
  454. package/src/cli/lib/config.test.ts +184 -7
  455. package/src/cli/lib/config.ts +67 -7
  456. package/src/cli/lib/deploy2.ts +14 -27
  457. package/src/cli/lib/deployApi/componentDefinition.ts +4 -1
  458. package/src/cli/lib/deploymentSelection.ts +59 -6
  459. package/src/cli/lib/deploymentSelector.test.ts +6 -0
  460. package/src/cli/lib/deploymentSelector.ts +2 -0
  461. package/src/cli/lib/dev.ts +202 -153
  462. package/src/cli/lib/env.ts +0 -15
  463. package/src/cli/lib/expiration.test.ts +159 -0
  464. package/src/cli/lib/expiration.ts +124 -0
  465. package/src/cli/lib/generatedFunctionLogsApi.ts +16 -1
  466. package/src/cli/lib/init.ts +6 -2
  467. package/src/cli/lib/insights.ts +1 -1
  468. package/src/cli/lib/localDeployment/anonymous.ts +19 -9
  469. package/src/cli/lib/localDeployment/localDeployment.ts +9 -11
  470. package/src/cli/lib/localDeployment/run.ts +1 -1
  471. package/src/cli/lib/localDeployment/upgrade.ts +12 -10
  472. package/src/cli/lib/localDeployment/utils.ts +12 -0
  473. package/src/cli/lib/mcp/tools/status.ts +1 -1
  474. package/src/cli/lib/updates.test.ts +102 -75
  475. package/src/cli/lib/updates.ts +14 -12
  476. package/src/cli/lib/usage.ts +3 -1
  477. package/src/cli/lib/utils/prompts.ts +2 -0
  478. package/src/cli/lib/utils/utils.test.ts +6 -6
  479. package/src/cli/lib/utils/utils.ts +66 -27
  480. package/src/index.ts +1 -1
  481. package/src/react/client.test.tsx +65 -0
  482. package/src/react/client.ts +129 -13
  483. package/src/react/index.ts +9 -1
  484. package/src/react/use_query_object_options.test.ts +50 -0
  485. package/src/react/use_query_result.test.ts +41 -0
  486. package/src/react-clerk/ConvexProviderWithClerk.test.tsx +1 -1
  487. package/src/react-clerk/ConvexProviderWithClerk.tsx +1 -1
  488. package/src/server/api.ts +5 -1
  489. package/src/server/components/definition.ts +3 -0
  490. package/src/server/components/index.ts +62 -5
  491. package/src/server/data_model.ts +2 -1
  492. package/src/server/impl/meta_impl.ts +74 -0
  493. package/src/server/impl/registration_impl.ts +21 -9
  494. package/src/server/index.ts +8 -0
  495. package/src/server/meta.ts +76 -0
  496. package/src/server/registration.ts +10 -0
  497. package/src/server/schema.test.ts +78 -1
  498. package/dist/cjs/cli/lib/aiFiles/config.js +0 -171
  499. package/dist/cjs/cli/lib/aiFiles/config.js.map +0 -7
  500. package/dist/cjs-types/cli/lib/aiFiles/config.d.ts +0 -46
  501. package/dist/cjs-types/cli/lib/aiFiles/config.d.ts.map +0 -1
  502. package/dist/cjs-types/cli/lib/aiFiles/config.test.d.ts +0 -2
  503. package/dist/cjs-types/cli/lib/aiFiles/config.test.d.ts.map +0 -1
  504. package/dist/esm/cli/lib/aiFiles/config.js +0 -135
  505. package/dist/esm/cli/lib/aiFiles/config.js.map +0 -7
  506. package/dist/esm-types/cli/lib/aiFiles/config.d.ts +0 -46
  507. package/dist/esm-types/cli/lib/aiFiles/config.d.ts.map +0 -1
  508. package/dist/esm-types/cli/lib/aiFiles/config.test.d.ts +0 -2
  509. package/dist/esm-types/cli/lib/aiFiles/config.test.d.ts.map +0 -1
  510. package/src/cli/lib/aiFiles/config.test.ts +0 -460
  511. package/src/cli/lib/aiFiles/config.ts +0 -188
  512. package/src/values/.claude/settings.local.json +0 -10
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/server/components/index.ts"],
4
- "sourcesContent": ["import { PropertyValidators, convexToJson } from \"../../values/index.js\";\nimport { version } from \"../../index.js\";\nimport {\n AnyFunctionReference,\n FunctionReference,\n FunctionType,\n} from \"../api.js\";\nimport { performAsyncSyscall } from \"../impl/syscall.js\";\nimport { DefaultFunctionArgs } from \"../registration.js\";\nimport {\n AppDefinitionAnalysis,\n ComponentDefinitionAnalysis,\n ComponentDefinitionType,\n} from \"./definition.js\";\nimport {\n getFunctionAddress,\n setReferencePath,\n toReferencePath,\n} from \"./paths.js\";\nexport { getFunctionAddress } from \"./paths.js\";\n\n/**\n * A serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type FunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs = any,\n ReturnType = any,\n> = string & FunctionReference<Type, \"internal\", Args, ReturnType>;\n\n/**\n * Create a serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport async function createFunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs,\n ReturnType,\n>(\n functionReference: FunctionReference<\n Type,\n \"public\" | \"internal\",\n Args,\n ReturnType\n >,\n): Promise<FunctionHandle<Type, Args, ReturnType>> {\n const address = getFunctionAddress(functionReference);\n return await performAsyncSyscall(\"1.0/createFunctionHandle\", {\n ...address,\n version,\n });\n}\n\ninterface ComponentExports {\n [key: string]: FunctionReference<any, any, any, any> | ComponentExports;\n}\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component definition directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ComponentDefinition<Exports extends ComponentExports = any> = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n\n /**\n * Internal type-only property tracking exports provided.\n *\n * @deprecated This is a type-only property, don't use it.\n */\n __exports: Exports;\n};\n\ntype ComponentDefinitionExports<T extends ComponentDefinition<any>> =\n T[\"__exports\"];\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component-aware convex directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type AppDefinition = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ninterface ExportTree {\n // Tree with serialized `Reference`s as leaves.\n [key: string]: string | ExportTree;\n}\n\ntype CommonDefinitionData = {\n _isRoot: boolean;\n _childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][];\n _exportTree: ExportTree;\n};\n\ntype ComponentDefinitionData = CommonDefinitionData & {\n _args: PropertyValidators;\n _name: string;\n _onInitCallbacks: Record<string, (argsStr: string) => string>;\n};\ntype AppDefinitionData = CommonDefinitionData;\n\n/**\n * Used to refer to an already-installed component.\n */\nclass InstalledComponent<Definition extends ComponentDefinition<any>> {\n /**\n * @internal\n */\n _definition: Definition;\n\n /**\n * @internal\n */\n _name: string;\n\n constructor(definition: Definition, name: string) {\n this._definition = definition;\n this._name = name;\n setReferencePath(this, `_reference/childComponent/${name}`);\n }\n\n get exports(): ComponentDefinitionExports<Definition> {\n return createExports(this._name, []);\n }\n}\n\nfunction createExports(name: string, pathParts: string[]): any {\n const handler: ProxyHandler<any> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createExports(name, newParts);\n } else if (prop === toReferencePath) {\n let reference = `_reference/childComponent/${name}`;\n for (const part of pathParts) {\n reference += `/${part}`;\n }\n return reference;\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nfunction use<Definition extends ComponentDefinition<any>>(\n this: CommonDefinitionData,\n definition: Definition,\n options?: {\n name?: string;\n },\n): InstalledComponent<Definition> {\n // At runtime an imported component will have this shape.\n const importedComponentDefinition =\n definition as unknown as ImportedComponentDefinition;\n if (typeof importedComponentDefinition.componentDefinitionPath !== \"string\") {\n throw new Error(\n \"Component definition does not have the required componentDefinitionPath property. This code only works in Convex runtime.\",\n );\n }\n const name =\n options?.name ??\n // added recently\n importedComponentDefinition.defaultName ??\n // can be removed once backend is out\n importedComponentDefinition.componentDefinitionPath.split(\"/\").pop()!;\n\n if (typeof name !== \"string\") {\n throw new Error(\n `Component name must be a string. Received: ${typeof name}`,\n );\n }\n if (name.length === 0) {\n // \"\" is used internally as the name for the root component, so\n // users shouldn\u2019t try to define child components with an empty name.\n throw new Error(\"Component name cannot be empty.\");\n }\n\n this._childComponents.push([name, importedComponentDefinition, {}]);\n return new InstalledComponent(definition, name);\n}\n\n/**\n * The runtime type of a ComponentDefinition. TypeScript will claim\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ImportedComponentDefinition = {\n componentDefinitionPath: string;\n defaultName: string;\n};\n\nfunction exportAppForAnalysis(\n this: ComponentDefinition<any> & AppDefinitionData,\n): AppDefinitionAnalysis {\n const definitionType = { type: \"app\" as const };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\nfunction serializeExportTree(tree: ExportTree): any {\n const branch: any[] = [];\n for (const [key, child] of Object.entries(tree)) {\n let node;\n if (typeof child === \"string\") {\n node = { type: \"leaf\", leaf: child };\n } else {\n node = serializeExportTree(child);\n }\n branch.push([key, node]);\n }\n return { type: \"branch\", branch };\n}\n\nfunction serializeChildComponents(\n childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n ][],\n): {\n name: string;\n path: string;\n args: [string, { type: \"value\"; value: string }][] | null;\n}[] {\n return childComponents.map(([name, definition, p]) => {\n let args: [string, { type: \"value\"; value: string }][] | null = null;\n if (p !== null) {\n args = [];\n for (const [name, value] of Object.entries(p)) {\n if (value !== undefined) {\n args.push([\n name,\n { type: \"value\", value: JSON.stringify(convexToJson(value)) },\n ]);\n }\n }\n }\n // we know that components carry this extra information\n const path = definition.componentDefinitionPath;\n if (!path)\n throw new Error(\n \"no .componentPath for component definition \" +\n JSON.stringify(definition, null, 2),\n );\n\n return {\n name: name!,\n path: path!,\n args,\n };\n });\n}\n\nfunction exportComponentForAnalysis(\n this: ComponentDefinition<any> & ComponentDefinitionData,\n): ComponentDefinitionAnalysis {\n const args: [string, { type: \"value\"; value: string }][] = Object.entries(\n this._args,\n ).map(([name, validator]) => [\n name,\n {\n type: \"value\",\n value: JSON.stringify(validator.json),\n },\n ]);\n const definitionType: ComponentDefinitionType = {\n type: \"childComponent\" as const,\n name: this._name,\n args,\n };\n const childComponents = serializeChildComponents(this._childComponents);\n return {\n name: this._name,\n definitionType,\n childComponents: childComponents as any,\n httpMounts: {},\n exports: serializeExportTree(this._exportTree),\n };\n}\n\n// This is what is actually contained in a ComponentDefinition.\ntype RuntimeComponentDefinition = Omit<ComponentDefinition<any>, \"__exports\"> &\n ComponentDefinitionData & {\n export: () => ComponentDefinitionAnalysis;\n };\ntype RuntimeAppDefinition = AppDefinition &\n AppDefinitionData & {\n export: () => AppDefinitionAnalysis;\n };\n\n/**\n * Define a component, a piece of a Convex deployment with namespaced resources.\n *\n * The default\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * @param name Name must be alphanumeric plus underscores. Typically these are\n * lowercase with underscores like `\"onboarding_flow_tracker\"`.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineComponent<Exports extends ComponentExports = any>(\n name: string,\n): ComponentDefinition<Exports> {\n const ret: RuntimeComponentDefinition = {\n _isRoot: false,\n _name: name,\n _args: {},\n _childComponents: [],\n _exportTree: {},\n _onInitCallbacks: {},\n\n export: exportComponentForAnalysis,\n use,\n\n // pretend to conform to ComponentDefinition, which temporarily expects __args\n ...({} as { __args: any; __exports: any }),\n };\n return ret as any as ComponentDefinition<Exports>;\n}\n\n/**\n * Attach components, reuseable pieces of a Convex deployment, to this Convex app.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineApp(): AppDefinition {\n const ret: RuntimeAppDefinition = {\n _isRoot: true,\n _childComponents: [],\n _exportTree: {},\n\n export: exportAppForAnalysis,\n use,\n };\n return ret as AppDefinition;\n}\n\ntype AnyInterfaceType = {\n [key: string]: AnyInterfaceType;\n} & AnyFunctionReference;\nexport type AnyComponentReference = Record<string, AnyInterfaceType>;\n\nexport type AnyChildComponents = Record<string, AnyComponentReference>;\n\n/**\n * @internal\n */\nexport function currentSystemUdfInComponent(\n componentId: string,\n): AnyComponentReference {\n return {\n [toReferencePath]: `_reference/currentSystemUdfInComponent/${componentId}`,\n };\n}\n\nfunction createChildComponents(\n root: string,\n pathParts: string[],\n): AnyChildComponents {\n const handler: ProxyHandler<object> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createChildComponents(root, newParts);\n } else if (prop === toReferencePath) {\n if (pathParts.length < 1) {\n const found = [root, ...pathParts].join(\".\");\n throw new Error(\n `API path is expected to be of the form \\`${root}.childComponent.functionName\\`. Found: \\`${found}\\``,\n );\n }\n return `_reference/childComponent/` + pathParts.join(\"/\");\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nexport const componentsGeneric = () => createChildComponents(\"components\", []);\n\nexport type AnyComponents = AnyChildComponents;\n"],
5
- "mappings": ";;;;AAAA,SAA6B,oBAAoB;AACjD,SAAS,eAAe;AAMxB,SAAS,2BAA2B;AAOpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,0BAA0B;AAkCnC,sBAAsB,qBAKpB,mBAMiD;AACjD,QAAM,UAAU,mBAAmB,iBAAiB;AACpD,SAAO,MAAM,oBAAoB,4BAA4B;AAAA,IAC3D,GAAG;AAAA,IACH;AAAA,EACF,CAAC;AACH;AAyFA,MAAM,mBAAgE;AAAA,EAWpE,YAAY,YAAwB,MAAc;AAPlD;AAAA;AAAA;AAAA;AAKA;AAAA;AAAA;AAAA;AAGE,SAAK,cAAc;AACnB,SAAK,QAAQ;AACb,qBAAiB,MAAM,6BAA6B,IAAI,EAAE;AAAA,EAC5D;AAAA,EAEA,IAAI,UAAkD;AACpD,WAAO,cAAc,KAAK,OAAO,CAAC,CAAC;AAAA,EACrC;AACF;AAEA,SAAS,cAAc,MAAc,WAA0B;AAC7D,QAAM,UAA6B;AAAA,IACjC,IAAI,GAAG,MAAuB;AAC5B,UAAI,OAAO,SAAS,UAAU;AAC5B,cAAM,WAAW,CAAC,GAAG,WAAW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,gBACd,MAC8B;AAC9B,QAAM,MAAkC;AAAA,IACtC,SAAS;AAAA,IACT,OAAO;AAAA,IACP,OAAO,CAAC;AAAA,IACR,kBAAkB,CAAC;AAAA,IACnB,aAAa,CAAC;AAAA,IACd,kBAAkB,CAAC;AAAA,IAEnB,QAAQ;AAAA,IACR;AAAA;AAAA,IAGA,GAAI,CAAC;AAAA,EACP;AACA,SAAO;AACT;AAQO,gBAAS,YAA2B;AACzC,QAAM,MAA4B;AAAA,IAChC,SAAS;AAAA,IACT,kBAAkB,CAAC;AAAA,IACnB,aAAa,CAAC;AAAA,IAEd,QAAQ;AAAA,IACR;AAAA,EACF;AACA,SAAO;AACT;AAYO,gBAAS,4BACd,aACuB;AACvB,SAAO;AAAA,IACL,CAAC,eAAe,GAAG,0CAA0C,WAAW;AAAA,EAC1E;AACF;AAEA,SAAS,sBACP,MACA,WACoB;AACpB,QAAM,UAAgC;AAAA,IACpC,IAAI,GAAG,MAAuB;AAC5B,UAAI,OAAO,SAAS,UAAU;AAC5B,cAAM,WAAW,CAAC,GAAG,WAAW,IAAI;AACpC,eAAO,sBAAsB,MAAM,QAAQ;AAAA,MAC7C,WAAW,SAAS,iBAAiB;AACnC,YAAI,UAAU,SAAS,GAAG;AACxB,gBAAM,QAAQ,CAAC,MAAM,GAAG,SAAS,EAAE,KAAK,GAAG;AAC3C,gBAAM,IAAI;AAAA,YACR,4CAA4C,IAAI,4CAA4C,KAAK;AAAA,UACnG;AAAA,QACF;AACA,eAAO,+BAA+B,UAAU,KAAK,GAAG;AAAA,MAC1D,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO,IAAI,MAAM,CAAC,GAAG,OAAO;AAC9B;AAEO,aAAM,oBAAoB,MAAM,sBAAsB,cAAc,CAAC,CAAC;",
4
+ "sourcesContent": ["import { PropertyValidators, convexToJson } from \"../../values/index.js\";\nimport { version } from \"../../index.js\";\nimport {\n AnyFunctionReference,\n FunctionReference,\n FunctionType,\n} from \"../api.js\";\nimport { performAsyncSyscall } from \"../impl/syscall.js\";\nimport { DefaultFunctionArgs } from \"../registration.js\";\nimport {\n AppDefinitionAnalysis,\n ComponentDefinitionAnalysis,\n ComponentDefinitionType,\n} from \"./definition.js\";\nimport {\n getFunctionAddress,\n setReferencePath,\n toReferencePath,\n} from \"./paths.js\";\nexport { getFunctionAddress } from \"./paths.js\";\n\n/**\n * A serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type FunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs = any,\n ReturnType = any,\n> = string & FunctionReference<Type, \"internal\", Args, ReturnType>;\n\n/**\n * Create a serializable reference to a Convex function.\n * Passing a this reference to another component allows that component to call this\n * function during the current function execution or at any later time.\n * Function handles are used like `api.folder.function` FunctionReferences,\n * e.g. `ctx.scheduler.runAfter(0, functionReference, args)`.\n *\n * A function reference is stable across code pushes but it's possible\n * the Convex function it refers to might no longer exist.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport async function createFunctionHandle<\n Type extends FunctionType,\n Args extends DefaultFunctionArgs,\n ReturnType,\n>(\n functionReference: FunctionReference<\n Type,\n \"public\" | \"internal\",\n Args,\n ReturnType\n >,\n): Promise<FunctionHandle<Type, Args, ReturnType>> {\n const address = getFunctionAddress(functionReference);\n return await performAsyncSyscall(\"1.0/createFunctionHandle\", {\n ...address,\n version,\n });\n}\n\ninterface ComponentExports {\n [key: string]: FunctionReference<any, any, any, any> | ComponentExports;\n}\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component definition directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ComponentDefinition<Exports extends ComponentExports = any> = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n httpPrefix?: string;\n },\n ): InstalledComponent<Definition>;\n\n /**\n * Internal type-only property tracking exports provided.\n *\n * @deprecated This is a type-only property, don't use it.\n */\n __exports: Exports;\n};\n\ntype ComponentDefinitionExports<T extends ComponentDefinition<any>> =\n T[\"__exports\"];\n\n/**\n * An object of this type should be the default export of a\n * convex.config.ts file in a component-aware convex directory.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type AppDefinition = {\n /**\n * Install a component with the given definition in this component definition.\n *\n * Takes a component definition and an optional name.\n *\n * For editor tooling this method expects a {@link ComponentDefinition}\n * but at runtime the object that is imported will be a {@link ImportedComponentDefinition}\n */\n use<Definition extends ComponentDefinition<any>>(\n definition: Definition,\n options?: {\n name?: string;\n httpPrefix?: string;\n },\n ): InstalledComponent<Definition>;\n};\n\ninterface ExportTree {\n // Tree with serialized `Reference`s as leaves.\n [key: string]: string | ExportTree;\n}\n\ntype CommonDefinitionData = {\n _isRoot: boolean;\n _childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n string | undefined,\n ][];\n _exportTree: ExportTree;\n};\n\ntype ComponentDefinitionData = CommonDefinitionData & {\n _args: PropertyValidators;\n _name: string;\n _onInitCallbacks: Record<string, (argsStr: string) => string>;\n};\ntype AppDefinitionData = CommonDefinitionData & {\n _httpPrefix?: string;\n};\n\n/**\n * Used to refer to an already-installed component.\n */\nclass InstalledComponent<Definition extends ComponentDefinition<any>> {\n /**\n * @internal\n */\n _definition: Definition;\n\n /**\n * @internal\n */\n _name: string;\n\n constructor(definition: Definition, name: string) {\n this._definition = definition;\n this._name = name;\n setReferencePath(this, `_reference/childComponent/${name}`);\n }\n\n get exports(): ComponentDefinitionExports<Definition> {\n return createExports(this._name, []);\n }\n}\n\nfunction createExports(name: string, pathParts: string[]): any {\n const handler: ProxyHandler<any> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createExports(name, newParts);\n } else if (prop === toReferencePath) {\n let reference = `_reference/childComponent/${name}`;\n for (const part of pathParts) {\n reference += `/${part}`;\n }\n return reference;\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nfunction use<Definition extends ComponentDefinition<any>>(\n this: CommonDefinitionData,\n definition: Definition,\n options?: {\n name?: string;\n httpPrefix?: string;\n },\n): InstalledComponent<Definition> {\n // At runtime an imported component will have this shape.\n const importedComponentDefinition =\n definition as unknown as ImportedComponentDefinition;\n if (typeof importedComponentDefinition.componentDefinitionPath !== \"string\") {\n throw new Error(\n \"Component definition does not have the required componentDefinitionPath property. This code only works in Convex runtime.\",\n );\n }\n const name =\n options?.name ??\n // added recently\n importedComponentDefinition.defaultName ??\n // can be removed once backend is out\n importedComponentDefinition.componentDefinitionPath.split(\"/\").pop()!;\n\n if (typeof name !== \"string\") {\n throw new Error(\n `Component name must be a string. Received: ${typeof name}`,\n );\n }\n if (name.length === 0) {\n // \"\" is used internally as the name for the root component, so\n // users shouldn\u2019t try to define child components with an empty name.\n throw new Error(\"Component name cannot be empty.\");\n }\n\n const httpPrefix = options?.httpPrefix;\n if (httpPrefix !== undefined) {\n if (!httpPrefix.startsWith(\"/\")) {\n throw new Error(\n `httpPrefix must start with \"/\". Received: \"${httpPrefix}\"`,\n );\n }\n }\n\n this._childComponents.push([\n name,\n importedComponentDefinition,\n {},\n httpPrefix,\n ]);\n return new InstalledComponent(definition, name);\n}\n\n/**\n * The runtime type of a ComponentDefinition. TypeScript will claim\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport type ImportedComponentDefinition = {\n componentDefinitionPath: string;\n defaultName: string;\n};\n\nfunction exportAppForAnalysis(\n this: ComponentDefinition<any> & AppDefinitionData,\n): AppDefinitionAnalysis {\n const definitionType = { type: \"app\" as const };\n const childComponents = serializeChildComponents(this._childComponents);\n const httpMounts = buildHttpMounts(this._childComponents);\n return {\n definitionType,\n ...(this._httpPrefix !== undefined\n ? { httpPrefix: normalizeHttpPrefix(this._httpPrefix) }\n : {}),\n childComponents: childComponents as any,\n httpMounts,\n exports: serializeExportTree(this._exportTree),\n };\n}\n\nfunction serializeExportTree(tree: ExportTree): any {\n const branch: any[] = [];\n for (const [key, child] of Object.entries(tree)) {\n let node;\n if (typeof child === \"string\") {\n node = { type: \"leaf\", leaf: child };\n } else {\n node = serializeExportTree(child);\n }\n branch.push([key, node]);\n }\n return { type: \"branch\", branch };\n}\n\nfunction normalizeHttpPrefix(prefix: string): string {\n // Ensure the prefix ends with \"/\" as required by HttpMountPath in Rust.\n return prefix.endsWith(\"/\") ? prefix : prefix + \"/\";\n}\n\nfunction buildHttpMounts(\n childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n string | undefined,\n ][],\n): Record<string, string> {\n const httpMounts: Record<string, string> = {};\n for (const [name, , , httpPrefix] of childComponents) {\n if (httpPrefix !== undefined) {\n const normalized = normalizeHttpPrefix(httpPrefix);\n httpMounts[normalized] = `_reference/childComponent/${name}`;\n }\n }\n return httpMounts;\n}\n\nfunction serializeChildComponents(\n childComponents: [\n string,\n ImportedComponentDefinition,\n Record<string, any> | null,\n string | undefined,\n ][],\n): {\n name: string;\n path: string;\n args: [string, { type: \"value\"; value: string }][] | null;\n}[] {\n return childComponents.map(([name, definition, p]) => {\n // Note: httpPrefix (4th element) is used separately in buildHttpMounts()\n let args: [string, { type: \"value\"; value: string }][] | null = null;\n if (p !== null) {\n args = [];\n for (const [name, value] of Object.entries(p)) {\n if (value !== undefined) {\n args.push([\n name,\n { type: \"value\", value: JSON.stringify(convexToJson(value)) },\n ]);\n }\n }\n }\n // we know that components carry this extra information\n const path = definition.componentDefinitionPath;\n if (!path)\n throw new Error(\n \"no .componentPath for component definition \" +\n JSON.stringify(definition, null, 2),\n );\n\n return {\n name: name!,\n path: path!,\n args,\n };\n });\n}\n\nfunction exportComponentForAnalysis(\n this: ComponentDefinition<any> & ComponentDefinitionData,\n): ComponentDefinitionAnalysis {\n const args: [string, { type: \"value\"; value: string }][] = Object.entries(\n this._args,\n ).map(([name, validator]) => [\n name,\n {\n type: \"value\",\n value: JSON.stringify(validator.json),\n },\n ]);\n const definitionType: ComponentDefinitionType = {\n type: \"childComponent\" as const,\n name: this._name,\n args,\n };\n const childComponents = serializeChildComponents(this._childComponents);\n const httpMounts = buildHttpMounts(this._childComponents);\n return {\n name: this._name,\n definitionType,\n childComponents: childComponents as any,\n httpMounts,\n exports: serializeExportTree(this._exportTree),\n };\n}\n\n// This is what is actually contained in a ComponentDefinition.\ntype RuntimeComponentDefinition = Omit<ComponentDefinition<any>, \"__exports\"> &\n ComponentDefinitionData & {\n export: () => ComponentDefinitionAnalysis;\n };\ntype RuntimeAppDefinition = AppDefinition &\n AppDefinitionData & {\n export: () => AppDefinitionAnalysis;\n };\n\n/**\n * Define a component, a piece of a Convex deployment with namespaced resources.\n *\n * The default\n * the default export of a module like \"cool-component/convex.config.js\"\n * is a `@link ComponentDefinition}, but during component definition evaluation\n * this is its type instead.\n *\n * @param name Name must be alphanumeric plus underscores. Typically these are\n * lowercase with underscores like `\"onboarding_flow_tracker\"`.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineComponent<Exports extends ComponentExports = any>(\n name: string,\n): ComponentDefinition<Exports> {\n const ret: RuntimeComponentDefinition = {\n _isRoot: false,\n _name: name,\n _args: {},\n _childComponents: [],\n _exportTree: {},\n _onInitCallbacks: {},\n\n export: exportComponentForAnalysis,\n use,\n\n // pretend to conform to ComponentDefinition, which temporarily expects __args\n ...({} as { __args: any; __exports: any }),\n };\n return ret as any as ComponentDefinition<Exports>;\n}\n\n/**\n * Attach components, reuseable pieces of a Convex deployment, to this Convex app.\n *\n * This is a feature of components, which are in beta.\n * This API is unstable and may change in subsequent releases.\n */\nexport function defineApp(options?: { httpPrefix?: string }): AppDefinition {\n const httpPrefix = options?.httpPrefix;\n if (httpPrefix !== undefined && !httpPrefix.startsWith(\"/\")) {\n throw new Error(\n `httpPrefix must start with \"/\". Received: \"${httpPrefix}\"`,\n );\n }\n const ret: RuntimeAppDefinition = {\n _isRoot: true,\n _childComponents: [],\n _exportTree: {},\n ...(httpPrefix !== undefined ? { _httpPrefix: httpPrefix } : {}),\n\n export: exportAppForAnalysis,\n use,\n };\n return ret as AppDefinition;\n}\n\ntype AnyInterfaceType = {\n [key: string]: AnyInterfaceType;\n} & AnyFunctionReference;\nexport type AnyComponentReference = Record<string, AnyInterfaceType>;\n\nexport type AnyChildComponents = Record<string, AnyComponentReference>;\n\n/**\n * @internal\n */\nexport function currentSystemUdfInComponent(\n componentId: string,\n): AnyComponentReference {\n return {\n [toReferencePath]: `_reference/currentSystemUdfInComponent/${componentId}`,\n };\n}\n\nfunction createChildComponents(\n root: string,\n pathParts: string[],\n): AnyChildComponents {\n const handler: ProxyHandler<object> = {\n get(_, prop: string | symbol) {\n if (typeof prop === \"string\") {\n const newParts = [...pathParts, prop];\n return createChildComponents(root, newParts);\n } else if (prop === toReferencePath) {\n if (pathParts.length < 1) {\n const found = [root, ...pathParts].join(\".\");\n throw new Error(\n `API path is expected to be of the form \\`${root}.childComponent.functionName\\`. Found: \\`${found}\\``,\n );\n }\n return `_reference/childComponent/` + pathParts.join(\"/\");\n } else {\n return undefined;\n }\n },\n };\n return new Proxy({}, handler);\n}\n\nexport const componentsGeneric = () => createChildComponents(\"components\", []);\n\nexport type AnyComponents = AnyChildComponents;\n"],
5
+ "mappings": ";;;;AAAA,SAA6B,oBAAoB;AACjD,SAAS,eAAe;AAMxB,SA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A,QACF;AACA,eAAO,+BAA+B,UAAU,KAAK,GAAG;AAAA,MAC1D,OAAO;AACL,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACA,SAAO,IAAI,MAAM,CAAC,GAAG,OAAO;AAC9B;AAEO,aAAM,oBAAoB,MAAM,sBAAsB,cAAc,CAAC,CAAC;",
6
6
  "names": ["name"]
7
7
  }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ import { jsonToConvex } from "../../values/index.js";
3
+ import { performAsyncSyscall } from "./syscall.js";
4
+ async function getTransactionMetrics() {
5
+ let syscallJSON;
6
+ try {
7
+ syscallJSON = await performAsyncSyscall("1.0/getTransactionMetrics", {});
8
+ } catch (e) {
9
+ if (e.message?.includes("Unknown async operation")) {
10
+ throw new Error(
11
+ "getTransactionMetrics() can only be called from a query or mutation. It is not available in actions or outside of a Convex function."
12
+ );
13
+ }
14
+ throw e;
15
+ }
16
+ return jsonToConvex(syscallJSON);
17
+ }
18
+ async function getFunctionMetadata() {
19
+ const { name, componentPath } = await performAsyncSyscall(
20
+ "1.0/getFunctionMetadata",
21
+ {}
22
+ );
23
+ return { name, componentPath };
24
+ }
25
+ export function setupQueryMeta(visibility) {
26
+ return {
27
+ getFunctionMetadata: async () => ({
28
+ ...await getFunctionMetadata(),
29
+ type: "query",
30
+ visibility
31
+ }),
32
+ getTransactionMetrics
33
+ };
34
+ }
35
+ export function setupMutationMeta(visibility) {
36
+ return {
37
+ getFunctionMetadata: async () => ({
38
+ ...await getFunctionMetadata(),
39
+ type: "mutation",
40
+ visibility
41
+ }),
42
+ getTransactionMetrics
43
+ };
44
+ }
45
+ export function setupActionMeta(visibility) {
46
+ return {
47
+ getFunctionMetadata: async () => ({
48
+ ...await getFunctionMetadata(),
49
+ type: "action",
50
+ visibility
51
+ })
52
+ };
53
+ }
54
+ //# sourceMappingURL=meta_impl.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/server/impl/meta_impl.ts"],
4
+ "sourcesContent": ["import { jsonToConvex } from \"../../values/index.js\";\nimport {\n ActionMeta,\n MutationMeta,\n QueryMeta,\n FunctionMetadata,\n TransactionMetrics,\n} from \"../meta.js\";\nimport { performAsyncSyscall } from \"./syscall.js\";\n\nasync function getTransactionMetrics(): Promise<TransactionMetrics> {\n let syscallJSON;\n try {\n syscallJSON = await performAsyncSyscall(\"1.0/getTransactionMetrics\", {});\n } catch (e: any) {\n if (e.message?.includes(\"Unknown async operation\")) {\n throw new Error(\n \"getTransactionMetrics() can only be called from a query or mutation. \" +\n \"It is not available in actions or outside of a Convex function.\",\n );\n }\n throw e;\n }\n return jsonToConvex(syscallJSON) as any;\n}\n\nasync function getFunctionMetadata(): Promise<{\n name: string;\n componentPath: string;\n}> {\n const { name, componentPath } = await performAsyncSyscall(\n \"1.0/getFunctionMetadata\",\n {},\n );\n return { name, componentPath };\n}\n\nexport function setupQueryMeta(\n visibility: FunctionMetadata[\"visibility\"],\n): QueryMeta {\n return {\n getFunctionMetadata: async () => ({\n ...(await getFunctionMetadata()),\n type: \"query\",\n visibility,\n }),\n getTransactionMetrics,\n };\n}\n\nexport function setupMutationMeta(\n visibility: FunctionMetadata[\"visibility\"],\n): MutationMeta {\n return {\n getFunctionMetadata: async () => ({\n ...(await getFunctionMetadata()),\n type: \"mutation\",\n visibility,\n }),\n getTransactionMetrics,\n };\n}\n\nexport function setupActionMeta(\n visibility: FunctionMetadata[\"visibility\"],\n): ActionMeta {\n return {\n getFunctionMetadata: async () => ({\n ...(await getFunctionMetadata()),\n type: \"action\",\n visibility,\n }),\n };\n}\n"],
5
+ "mappings": ";AAAA,SAAS,oBAAoB;AAQ7B,SAAS,2BAA2B;AAEpC,eAAe,wBAAqD;AAClE,MAAI;AACJ,MAAI;AACF,kBAAc,MAAM,oBAAoB,6BAA6B,CAAC,CAAC;AAAA,EACzE,SAAS,GAAQ;AACf,QAAI,EAAE,SAAS,SAAS,yBAAyB,GAAG;AAClD,YAAM,IAAI;AAAA,QACR;AAAA,MAEF;AAAA,IACF;AACA,UAAM;AAAA,EACR;AACA,SAAO,aAAa,WAAW;AACjC;AAEA,eAAe,sBAGZ;AACD,QAAM,EAAE,MAAM,cAAc,IAAI,MAAM;AAAA,IACpC;AAAA,IACA,CAAC;AAAA,EACH;AACA,SAAO,EAAE,MAAM,cAAc;AAC/B;AAEO,gBAAS,eACd,YACW;AACX,SAAO;AAAA,IACL,qBAAqB,aAAa;AAAA,MAChC,GAAI,MAAM,oBAAoB;AAAA,MAC9B,MAAM;AAAA,MACN;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;AAEO,gBAAS,kBACd,YACc;AACd,SAAO;AAAA,IACL,qBAAqB,aAAa;AAAA,MAChC,GAAI,MAAM,oBAAoB;AAAA,MAC9B,MAAM;AAAA,MACN;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;AAEO,gBAAS,gBACd,YACY;AACZ,SAAO;AAAA,IACL,qBAAqB,aAAa;AAAA,MAChC,GAAI,MAAM,oBAAoB;AAAA,MAC9B,MAAM;AAAA,MACN;AAAA,IACF;AAAA,EACF;AACF;",
6
+ "names": []
7
+ }
@@ -22,7 +22,12 @@ import { parseArgs } from "../../common/index.js";
22
22
  import { performAsyncSyscall } from "./syscall.js";
23
23
  import { asObjectValidator } from "../../values/validator.js";
24
24
  import { getFunctionAddress } from "../components/paths.js";
25
- async function invokeMutation(func, argsStr) {
25
+ import {
26
+ setupQueryMeta,
27
+ setupMutationMeta,
28
+ setupActionMeta
29
+ } from "./meta_impl.js";
30
+ async function invokeMutation(func, argsStr, visibility) {
26
31
  const requestId = "";
27
32
  const args = jsonToConvex(JSON.parse(argsStr));
28
33
  const mutationCtx = {
@@ -30,6 +35,7 @@ async function invokeMutation(func, argsStr) {
30
35
  auth: setupAuth(requestId),
31
36
  storage: setupStorageWriter(requestId),
32
37
  scheduler: setupMutationScheduler(),
38
+ meta: setupMutationMeta(visibility),
33
39
  runQuery: (reference, args2) => runUdf("query", reference, args2),
34
40
  runMutation: (reference, args2) => runUdf("mutation", reference, args2)
35
41
  };
@@ -116,7 +122,7 @@ export const mutationGeneric = ((functionDefinition) => {
116
122
  assertNotBrowser();
117
123
  func.isMutation = true;
118
124
  func.isPublic = true;
119
- func.invokeMutation = (argsStr) => invokeMutation(handler, argsStr);
125
+ func.invokeMutation = (argsStr) => invokeMutation(handler, argsStr, "public");
120
126
  func.exportArgs = exportArgs(functionDefinition);
121
127
  func.exportReturns = exportReturns(functionDefinition);
122
128
  func._handler = handler;
@@ -131,19 +137,20 @@ export const internalMutationGeneric = ((functionDefinition) => {
131
137
  assertNotBrowser();
132
138
  func.isMutation = true;
133
139
  func.isInternal = true;
134
- func.invokeMutation = (argsStr) => invokeMutation(handler, argsStr);
140
+ func.invokeMutation = (argsStr) => invokeMutation(handler, argsStr, "internal");
135
141
  func.exportArgs = exportArgs(functionDefinition);
136
142
  func.exportReturns = exportReturns(functionDefinition);
137
143
  func._handler = handler;
138
144
  return func;
139
145
  });
140
- async function invokeQuery(func, argsStr) {
146
+ async function invokeQuery(func, argsStr, visibility) {
141
147
  const requestId = "";
142
148
  const args = jsonToConvex(JSON.parse(argsStr));
143
149
  const queryCtx = {
144
150
  db: setupReader(),
145
151
  auth: setupAuth(requestId),
146
152
  storage: setupStorageReader(requestId),
153
+ meta: setupQueryMeta(visibility),
147
154
  runQuery: (reference, args2) => runUdf("query", reference, args2)
148
155
  };
149
156
  const result = await invokeFunction(func, queryCtx, args);
@@ -156,7 +163,7 @@ export const queryGeneric = ((functionDefinition) => {
156
163
  assertNotBrowser();
157
164
  func.isQuery = true;
158
165
  func.isPublic = true;
159
- func.invokeQuery = (argsStr) => invokeQuery(handler, argsStr);
166
+ func.invokeQuery = (argsStr) => invokeQuery(handler, argsStr, "public");
160
167
  func.exportArgs = exportArgs(functionDefinition);
161
168
  func.exportReturns = exportReturns(functionDefinition);
162
169
  func._handler = handler;
@@ -168,13 +175,13 @@ export const internalQueryGeneric = ((functionDefinition) => {
168
175
  assertNotBrowser();
169
176
  func.isQuery = true;
170
177
  func.isInternal = true;
171
- func.invokeQuery = (argsStr) => invokeQuery(handler, argsStr);
178
+ func.invokeQuery = (argsStr) => invokeQuery(handler, argsStr, "internal");
172
179
  func.exportArgs = exportArgs(functionDefinition);
173
180
  func.exportReturns = exportReturns(functionDefinition);
174
181
  func._handler = handler;
175
182
  return func;
176
183
  });
177
- async function invokeAction(func, requestId, argsStr) {
184
+ async function invokeAction(func, requestId, argsStr, visibility) {
178
185
  const args = jsonToConvex(JSON.parse(argsStr));
179
186
  const calls = setupActionCalls(requestId);
180
187
  const ctx = {
@@ -182,7 +189,8 @@ async function invokeAction(func, requestId, argsStr) {
182
189
  auth: setupAuth(requestId),
183
190
  scheduler: setupActionScheduler(requestId),
184
191
  storage: setupStorageActionWriter(requestId),
185
- vectorSearch: setupActionVectorSearch(requestId)
192
+ vectorSearch: setupActionVectorSearch(requestId),
193
+ meta: setupActionMeta(visibility)
186
194
  };
187
195
  const result = await invokeFunction(func, ctx, args);
188
196
  return JSON.stringify(convexToJson(result === void 0 ? null : result));
@@ -193,7 +201,7 @@ export const actionGeneric = ((functionDefinition) => {
193
201
  assertNotBrowser();
194
202
  func.isAction = true;
195
203
  func.isPublic = true;
196
- func.invokeAction = (requestId, argsStr) => invokeAction(handler, requestId, argsStr);
204
+ func.invokeAction = (requestId, argsStr) => invokeAction(handler, requestId, argsStr, "public");
197
205
  func.exportArgs = exportArgs(functionDefinition);
198
206
  func.exportReturns = exportReturns(functionDefinition);
199
207
  func._handler = handler;
@@ -205,7 +213,7 @@ export const internalActionGeneric = ((functionDefinition) => {
205
213
  assertNotBrowser();
206
214
  func.isAction = true;
207
215
  func.isInternal = true;
208
- func.invokeAction = (requestId, argsStr) => invokeAction(handler, requestId, argsStr);
216
+ func.invokeAction = (requestId, argsStr) => invokeAction(handler, requestId, argsStr, "internal");
209
217
  func.exportArgs = exportArgs(functionDefinition);
210
218
  func.exportReturns = exportReturns(functionDefinition);
211
219
  func._handler = handler;
@@ -219,7 +227,8 @@ async function invokeHttpAction(func, request) {
219
227
  auth: setupAuth(requestId),
220
228
  storage: setupStorageActionWriter(requestId),
221
229
  scheduler: setupActionScheduler(requestId),
222
- vectorSearch: setupActionVectorSearch(requestId)
230
+ vectorSearch: setupActionVectorSearch(requestId),
231
+ meta: setupActionMeta("public")
223
232
  };
224
233
  return await invokeFunction(func, ctx, [request]);
225
234
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/server/impl/registration_impl.ts"],
4
- "sourcesContent": ["import {\n ConvexError,\n convexToJson,\n GenericValidator,\n jsonToConvex,\n v,\n Validator,\n Value,\n} from \"../../values/index.js\";\nimport { GenericDataModel } from \"../data_model.js\";\nimport {\n ActionBuilder,\n DefaultFunctionArgs,\n GenericActionCtx,\n GenericMutationCtx,\n GenericQueryCtx,\n MutationBuilder,\n PublicHttpAction,\n QueryBuilder,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"../registration.js\";\nimport { setupActionCalls } from \"./actions_impl.js\";\nimport { setupActionVectorSearch } from \"./vector_search_impl.js\";\nimport { setupAuth } from \"./authentication_impl.js\";\nimport { setupReader, setupWriter } from \"./database_impl.js\";\nimport { QueryImpl, QueryInitializerImpl } from \"./query_impl.js\";\nimport {\n setupActionScheduler,\n setupMutationScheduler,\n} from \"./scheduler_impl.js\";\nimport {\n setupStorageActionWriter,\n setupStorageReader,\n setupStorageWriter,\n} from \"./storage_impl.js\";\nimport { parseArgs } from \"../../common/index.js\";\nimport { performAsyncSyscall } from \"./syscall.js\";\nimport { asObjectValidator } from \"../../values/validator.js\";\nimport { getFunctionAddress } from \"../components/paths.js\";\n\nasync function invokeMutation<\n F extends (ctx: GenericMutationCtx<GenericDataModel>, ...args: any) => any,\n>(func: F, argsStr: string) {\n // TODO(presley): Change the function signature and propagate the requestId from Rust.\n // Ok, to mock it out for now, since queries are only running in V8.\n const requestId = \"\";\n const args = jsonToConvex(JSON.parse(argsStr));\n const mutationCtx = {\n db: setupWriter(),\n auth: setupAuth(requestId),\n storage: setupStorageWriter(requestId),\n scheduler: setupMutationScheduler(),\n\n runQuery: (reference: any, args?: any) => runUdf(\"query\", reference, args),\n runMutation: (reference: any, args?: any) =>\n runUdf(\"mutation\", reference, args),\n };\n const result = await invokeFunction(func, mutationCtx, args as any);\n validateReturnValue(result);\n return JSON.stringify(convexToJson(result === undefined ? null : result));\n}\n\nexport function validateReturnValue(v: any) {\n if (v instanceof QueryInitializerImpl || v instanceof QueryImpl) {\n throw new Error(\n \"Return value is a Query. Results must be retrieved with `.collect()`, `.take(n), `.unique()`, or `.first()`.\",\n );\n }\n}\n\nexport async function invokeFunction<\n Ctx,\n Args extends any[],\n F extends (ctx: Ctx, ...args: Args) => any,\n>(func: F, ctx: Ctx, args: Args) {\n let result;\n try {\n result = await Promise.resolve(func(ctx, ...args));\n } catch (thrown: unknown) {\n throw serializeConvexErrorData(thrown);\n }\n return result;\n}\n\nfunction dontCallDirectly(\n funcType: string,\n handler: (ctx: any, args: any) => any,\n): unknown {\n return (ctx: any, args: any) => {\n globalThis.console.warn(\n \"Convex functions should not directly call other Convex functions. Consider calling a helper function instead. \" +\n `e.g. \\`export const foo = ${funcType}(...); await foo(ctx);\\` is not supported. ` +\n \"See https://docs.convex.dev/production/best-practices/#use-helper-functions-to-write-shared-code\",\n );\n return handler(ctx, args);\n };\n}\n\n// Keep in sync with node executor\nfunction serializeConvexErrorData(thrown: unknown) {\n if (\n typeof thrown === \"object\" &&\n thrown !== null &&\n Symbol.for(\"ConvexError\") in thrown\n ) {\n const error = thrown as ConvexError<any>;\n error.data = JSON.stringify(\n convexToJson(error.data === undefined ? null : error.data),\n );\n (error as any).ConvexErrorSymbol = Symbol.for(\"ConvexError\");\n return error;\n } else {\n return thrown;\n }\n}\n\n/**\n * Guard against Convex functions accidentally getting included in a browser bundle.\n * Convex functions may include secret logic or credentials that should not be\n * send to untrusted clients (browsers).\n */\nfunction assertNotBrowser() {\n if (\n typeof window === \"undefined\" ||\n (window as any).__convexAllowFunctionsInBrowser\n ) {\n return;\n }\n // JSDom doesn't count, developers are allowed to use JSDom in Convex functions.\n const isRealBrowser =\n Object.getOwnPropertyDescriptor(globalThis, \"window\")\n ?.get?.toString()\n .includes(\"[native code]\") ?? false;\n if (isRealBrowser) {\n // eslint-disable-next-line no-console\n console.error(\n \"Convex functions should not be imported in the browser. This will throw an error in future versions of `convex`. If this is a false negative, please report it to Convex support.\",\n );\n }\n}\n\ntype FunctionDefinition =\n | ((ctx: any, args: DefaultFunctionArgs) => any)\n | {\n args?: GenericValidator | Record<string, GenericValidator>;\n returns?: GenericValidator | Record<string, GenericValidator>;\n handler: (ctx: any, args: DefaultFunctionArgs) => any;\n };\n\nfunction strictReplacer(key: string, value: any) {\n if (value === undefined) {\n throw new Error(\n `A validator is undefined for field \"${key}\". ` +\n `This is often caused by circular imports. ` +\n `See https://docs.convex.dev/error#undefined-validator for details.`,\n );\n }\n return value;\n}\nfunction exportArgs(functionDefinition: FunctionDefinition) {\n return () => {\n let args: GenericValidator = v.any();\n if (\n typeof functionDefinition === \"object\" &&\n functionDefinition.args !== undefined\n ) {\n args = asObjectValidator(functionDefinition.args);\n }\n return JSON.stringify(args.json, strictReplacer);\n };\n}\n\nfunction exportReturns(functionDefinition: FunctionDefinition) {\n return () => {\n let returns: Validator<any, any, any> | undefined;\n if (\n typeof functionDefinition === \"object\" &&\n functionDefinition.returns !== undefined\n ) {\n returns = asObjectValidator(functionDefinition.returns);\n }\n return JSON.stringify(returns ? returns.json : null, strictReplacer);\n };\n}\n\n/**\n * Define a mutation in this Convex app's public API.\n *\n * You should generally use the `mutation` function from\n * `\"./_generated/server\"`.\n *\n * Mutations can read from and write to the database, and are accessible from\n * the client. They run **transactionally**, all database reads and writes\n * within a single mutation are atomic and isolated from other mutations.\n *\n * @example\n * ```typescript\n * import { mutation } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * export const createTask = mutation({\n * args: { text: v.string() },\n * returns: v.id(\"tasks\"),\n * handler: async (ctx, args) => {\n * const taskId = await ctx.db.insert(\"tasks\", {\n * text: args.text,\n * completed: false,\n * });\n * return taskId;\n * },\n * });\n * ```\n *\n * **Best practice:** Always include `args` and `returns` validators on all\n * mutations. If the function doesn't return a value, use `returns: v.null()`.\n * Argument validation is critical for security since public mutations are\n * exposed to the internet.\n *\n * **Common mistake:** Mutations cannot call third-party APIs or use `fetch`.\n * They must be deterministic. Use actions for external API calls.\n *\n * **Common mistake:** Do not use `mutation` for sensitive internal functions\n * that should not be called by clients. Use `internalMutation` instead.\n *\n * @param func - The mutation function. It receives a {@link GenericMutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/mutation-functions\n * @public\n */\nexport const mutationGeneric: MutationBuilder<any, \"public\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericMutationCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"mutation\", handler) as RegisteredMutation<\n \"public\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isMutation = true;\n func.isPublic = true;\n func.invokeMutation = (argsStr) => invokeMutation(handler, argsStr);\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as MutationBuilder<any, \"public\">;\n\n/**\n * Define a mutation that is only accessible from other Convex functions (but not from the client).\n *\n * You should generally use the `internalMutation` function from\n * `\"./_generated/server\"`.\n *\n * Internal mutations can read from and write to the database but are **not**\n * exposed as part of your app's public API. They can only be called by other\n * Convex functions using `ctx.runMutation` or by the scheduler. Like public\n * mutations, they run transactionally.\n *\n * @example\n * ```typescript\n * import { internalMutation } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * // This mutation can only be called from other Convex functions:\n * export const markTaskCompleted = internalMutation({\n * args: { taskId: v.id(\"tasks\") },\n * returns: v.null(),\n * handler: async (ctx, args) => {\n * await ctx.db.patch(\"tasks\", args.taskId, { completed: true });\n * return null;\n * },\n * });\n * ```\n *\n * **Best practice:** Use `internalMutation` for any mutation that should not\n * be directly callable by clients, such as write-back functions from actions\n * or scheduled background work. Reference it via the `internal` object:\n * `await ctx.runMutation(internal.myModule.markTaskCompleted, { taskId })`.\n *\n * @param func - The mutation function. It receives a {@link GenericMutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/internal-functions\n * @public\n */\nexport const internalMutationGeneric: MutationBuilder<any, \"internal\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericMutationCtx<any>, args: any) => any;\n const func = dontCallDirectly(\n \"internalMutation\",\n handler,\n ) as RegisteredMutation<\"internal\", any, any>;\n\n assertNotBrowser();\n func.isMutation = true;\n func.isInternal = true;\n func.invokeMutation = (argsStr) => invokeMutation(handler, argsStr);\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as MutationBuilder<any, \"internal\">;\n\nasync function invokeQuery<\n F extends (ctx: GenericQueryCtx<GenericDataModel>, ...args: any) => any,\n>(func: F, argsStr: string) {\n // TODO(presley): Change the function signature and propagate the requestId from Rust.\n // Ok, to mock it out for now, since queries are only running in V8.\n const requestId = \"\";\n const args = jsonToConvex(JSON.parse(argsStr));\n const queryCtx = {\n db: setupReader(),\n auth: setupAuth(requestId),\n storage: setupStorageReader(requestId),\n runQuery: (reference: any, args?: any) => runUdf(\"query\", reference, args),\n };\n const result = await invokeFunction(func, queryCtx, args as any);\n validateReturnValue(result);\n return JSON.stringify(convexToJson(result === undefined ? null : result));\n}\n\n/**\n * Define a query in this Convex app's public API.\n *\n * You should generally use the `query` function from\n * `\"./_generated/server\"`.\n *\n * Queries can read from the database and are accessible from the client. They\n * are **reactive**, when used with `useQuery` in React, the component\n * automatically re-renders whenever the underlying data changes. Queries\n * cannot modify the database.\n * Query results are automatically cached by the Convex client and kept\n * consistent via WebSocket subscriptions.\n *\n *\n * @example\n * ```typescript\n * import { query } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * export const listTasks = query({\n * args: { completed: v.optional(v.boolean()) },\n * returns: v.array(v.object({\n * _id: v.id(\"tasks\"),\n * _creationTime: v.number(),\n * text: v.string(),\n * completed: v.boolean(),\n * })),\n * handler: async (ctx, args) => {\n * if (args.completed !== undefined) {\n * return await ctx.db\n * .query(\"tasks\")\n * .withIndex(\"by_completed\", (q) => q.eq(\"completed\", args.completed))\n * .collect();\n * }\n * return await ctx.db.query(\"tasks\").collect();\n * },\n * });\n * ```\n *\n * **Best practice:** Always include `args` and `returns` validators. Use\n * `.withIndex()` instead of `.filter()` for efficient database queries.\n * Queries should be fast since they run on every relevant data change.\n *\n * **Common mistake:** Queries are pure reads, they cannot write to the\n * database, call external APIs, or schedule functions. Use actions for HTTP\n * calls and mutations for database writes and scheduling.\n *\n * @param func - The query function. It receives a {@link GenericQueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/query-functions\n * @public\n */\nexport const queryGeneric: QueryBuilder<any, \"public\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericQueryCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"query\", handler) as RegisteredQuery<\n \"public\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isQuery = true;\n func.isPublic = true;\n func.invokeQuery = (argsStr) => invokeQuery(handler, argsStr);\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as QueryBuilder<any, \"public\">;\n\n/**\n * Define a query that is only accessible from other Convex functions (but not from the client).\n *\n * You should generally use the `internalQuery` function from\n * `\"./_generated/server\"`.\n *\n * Internal queries can read from the database but are **not** exposed as part\n * of your app's public API. They can only be called by other Convex functions\n * using `ctx.runQuery`. This is useful for loading data in actions or for\n * helper queries that shouldn't be client-facing.\n *\n * @example\n * ```typescript\n * import { internalQuery } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * // Only callable from other Convex functions:\n * export const getUser = internalQuery({\n * args: { userId: v.id(\"users\") },\n * returns: v.union(\n * v.object({\n * _id: v.id(\"users\"),\n * _creationTime: v.number(),\n * name: v.string(),\n * email: v.string(),\n * }),\n * v.null(),\n * ),\n * handler: async (ctx, args) => {\n * return await ctx.db.get(\"users\", args.userId);\n * },\n * });\n * ```\n *\n * **Best practice:** Use `internalQuery` for data-loading in actions via\n * `ctx.runQuery(internal.myModule.getUser, { userId })`.\n *\n * @param func - The query function. It receives a {@link GenericQueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/internal-functions\n * @public\n */\nexport const internalQueryGeneric: QueryBuilder<any, \"internal\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericQueryCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"internalQuery\", handler) as RegisteredQuery<\n \"internal\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isQuery = true;\n func.isInternal = true;\n func.invokeQuery = (argsStr) => invokeQuery(handler as any, argsStr);\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as QueryBuilder<any, \"internal\">;\n\nasync function invokeAction<\n F extends (ctx: GenericActionCtx<GenericDataModel>, ...args: any) => any,\n>(func: F, requestId: string, argsStr: string) {\n const args = jsonToConvex(JSON.parse(argsStr));\n const calls = setupActionCalls(requestId);\n const ctx = {\n ...calls,\n auth: setupAuth(requestId),\n scheduler: setupActionScheduler(requestId),\n storage: setupStorageActionWriter(requestId),\n vectorSearch: setupActionVectorSearch(requestId) as any,\n };\n const result = await invokeFunction(func, ctx, args as any);\n return JSON.stringify(convexToJson(result === undefined ? null : result));\n}\n\n/**\n * Define an action in this Convex app's public API.\n *\n * Actions can call third-party APIs, use Node.js libraries, and perform other\n * side effects. Unlike queries and mutations, actions do **not** have direct\n * database access (`ctx.db` is not available). Instead, use `ctx.runQuery`\n * and `ctx.runMutation` to read and write data.\n *\n * You should generally use the `action` function from\n * `\"./_generated/server\"`.\n *\n * Actions are accessible from the client and run outside of the database\n * transaction, so they are not atomic. They are best for integrating with\n * external services.\n *\n * @example\n * ```typescript\n * // Add \"use node\"; at the top of the file if using Node.js built-in modules.\n * import { action } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n * import { internal } from \"./_generated/api\";\n *\n * export const generateSummary = action({\n * args: { text: v.string() },\n * returns: v.string(),\n * handler: async (ctx, args) => {\n * // Call an external API:\n * const response = await fetch(\"https://api.example.com/summarize\", {\n * method: \"POST\",\n * body: JSON.stringify({ text: args.text }),\n * });\n * const { summary } = await response.json();\n *\n * // Write results back via a mutation:\n * await ctx.runMutation(internal.myModule.saveSummary, {\n * text: args.text,\n * summary,\n * });\n *\n * return summary;\n * },\n * });\n * ```\n *\n * **Best practice:** Minimize the number of `ctx.runQuery` and\n * `ctx.runMutation` calls from actions. Each call is a separate transaction,\n * so splitting logic across multiple calls introduces the risk of race\n * conditions. Try to batch reads/writes into single query/mutation calls.\n *\n * **`\"use node\"` runtime:** Actions run in Convex's default JavaScript\n * runtime, which supports `fetch` and most NPM packages. Only add\n * `\"use node\";` at the top of the file if a third-party library specifically\n * requires Node.js built-in APIs, it is a last resort, not the default.\n * Node.js actions have slower cold starts, and **only actions can be defined\n * in `\"use node\"` files** (no queries or mutations), so prefer the default\n * runtime whenever possible.\n *\n * **Common mistake:** Do not try to access `ctx.db` in an action, it is\n * not available. Use `ctx.runQuery` and `ctx.runMutation` instead.\n *\n * @param func - The function. It receives a {@link GenericActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/actions\n * @public\n */\nexport const actionGeneric: ActionBuilder<any, \"public\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericActionCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"action\", handler) as RegisteredAction<\n \"public\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isAction = true;\n func.isPublic = true;\n func.invokeAction = (requestId, argsStr) =>\n invokeAction(handler, requestId, argsStr);\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as ActionBuilder<any, \"public\">;\n\n/**\n * Define an action that is only accessible from other Convex functions (but not from the client).\n *\n * You should generally use the `internalAction` function from\n * `\"./_generated/server\"`.\n *\n * Internal actions behave like public actions (they can call external APIs and\n * use Node.js libraries) but are **not** exposed in your app's public API. They\n * can only be called by other Convex functions using `ctx.runAction` or via the\n * scheduler.\n *\n * @example\n * ```typescript\n * import { internalAction } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * export const sendEmail = internalAction({\n * args: { to: v.string(), subject: v.string(), body: v.string() },\n * returns: v.null(),\n * handler: async (ctx, args) => {\n * // Call an external email service (fetch works in the default runtime):\n * await fetch(\"https://api.email-service.com/send\", {\n * method: \"POST\",\n * headers: { \"Content-Type\": \"application/json\" },\n * body: JSON.stringify(args),\n * });\n * return null;\n * },\n * });\n * ```\n *\n * **Best practice:** Use `internalAction` for background work scheduled from\n * mutations: `await ctx.scheduler.runAfter(0, internal.myModule.sendEmail, { ... })`.\n * Only use `ctx.runAction` from another action if you need to cross runtimes\n * (e.g., default Convex runtime to Node.js). Otherwise, extract shared code\n * into a helper function.\n *\n * **`\"use node\"` runtime:** Only add `\"use node\";` at the top of the file\n * as a last resort when a third-party library requires Node.js APIs. Node.js\n * actions have slower cold starts, and **only actions can be defined in\n * `\"use node\"` files** (no queries or mutations).\n *\n * @param func - The function. It receives a {@link GenericActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/internal-functions\n * @public\n */\nexport const internalActionGeneric: ActionBuilder<any, \"internal\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericActionCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"internalAction\", handler) as RegisteredAction<\n \"internal\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isAction = true;\n func.isInternal = true;\n func.invokeAction = (requestId, argsStr) =>\n invokeAction(handler, requestId, argsStr);\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as ActionBuilder<any, \"internal\">;\n\nasync function invokeHttpAction<\n F extends (ctx: GenericActionCtx<GenericDataModel>, request: Request) => any,\n>(func: F, request: Request) {\n // TODO(presley): Change the function signature and propagate the requestId from Rust.\n // Ok, to mock it out for now, since http endpoints are only running in V8.\n const requestId = \"\";\n const calls = setupActionCalls(requestId);\n const ctx = {\n ...calls,\n auth: setupAuth(requestId),\n storage: setupStorageActionWriter(requestId),\n scheduler: setupActionScheduler(requestId),\n vectorSearch: setupActionVectorSearch(requestId) as any,\n };\n return await invokeFunction(func, ctx, [request]);\n}\n\n/**\n * Define a Convex HTTP action.\n *\n * HTTP actions handle raw HTTP requests and return HTTP responses. They are\n * registered by routing URL paths to them in `convex/http.ts` using\n * {@link HttpRouter}. Like regular actions, they can call external APIs and\n * use `ctx.runQuery` / `ctx.runMutation` but do not have direct `ctx.db` access.\n *\n * @example\n * ```typescript\n * // convex/http.ts\n * import { httpRouter } from \"convex/server\";\n * import { httpAction } from \"./_generated/server\";\n *\n * const http = httpRouter();\n *\n * http.route({\n * path: \"/api/webhook\",\n * method: \"POST\",\n * handler: httpAction(async (ctx, request) => {\n * const body = await request.json();\n * // Process the webhook payload...\n * return new Response(JSON.stringify({ ok: true }), {\n * status: 200,\n * headers: { \"Content-Type\": \"application/json\" },\n * });\n * }),\n * });\n *\n * export default http;\n * ```\n *\n * **Best practice:** HTTP actions are registered at the exact path specified.\n * For example, `path: \"/api/webhook\"` registers at `/api/webhook`.\n *\n * @param func - The function. It receives a {@link GenericActionCtx} as its first argument, and a `Request` object\n * as its second.\n * @returns The wrapped function. Route a URL path to this function in `convex/http.ts`.\n *\n * @see https://docs.convex.dev/functions/http-actions\n * @public\n */\nexport const httpActionGeneric = (\n func: (\n ctx: GenericActionCtx<GenericDataModel>,\n request: Request,\n ) => Promise<Response>,\n): PublicHttpAction => {\n const q = dontCallDirectly(\"httpAction\", func) as PublicHttpAction;\n assertNotBrowser();\n q.isHttp = true;\n q.invokeHttpAction = (request) => invokeHttpAction(func as any, request);\n q._handler = func;\n return q;\n};\n\nasync function runUdf(\n udfType: \"query\" | \"mutation\",\n f: any,\n args?: Record<string, Value>,\n): Promise<any> {\n const queryArgs = parseArgs(args);\n const syscallArgs = {\n udfType,\n args: convexToJson(queryArgs),\n ...getFunctionAddress(f),\n };\n const result = await performAsyncSyscall(\"1.0/runUdf\", syscallArgs);\n return jsonToConvex(result);\n}\n"],
5
- "mappings": ";AAAA;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,OAGK;AAeP,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,iBAAiB;AAC1B,SAAS,aAAa,mBAAmB;AACzC,SAAS,WAAW,4BAA4B;AAChD;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AAEnC,eAAe,eAEb,MAAS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K,gBAAgB,cAAc,kBAAkB;AACrD,OAAK,WAAW;AAChB,SAAO;AACT;AAEA,eAAe,iBAEb,MAAS,SAAkB;AAG3B,QAAM,YAAY;AAClB,QAAM,QAAQ,iBAAiB,SAAS;AACxC,QAAM,MAAM;AAAA,IACV,GAAG;AAAA,IACH,MAAM,UAAU,SAAS;AAAA,IACzB,SAAS,yBAAyB,SAAS;AAAA,IAC3C,WAAW,qBAAqB,SAAS;AAAA,IACzC,cAAc,wBAAwB,SAAS;AAAA,EACjD;AACA,SAAO,MAAM,eAAe,MAAM,KAAK,CAAC,OAAO,CAAC;AAClD;AA4CO,aAAM,oBAAoB,CAC/B,SAIqB;AACrB,QAAM,IAAI,iBAAiB,cAAc,IAAI;AAC7C,mBAAiB;AACjB,IAAE,SAAS;AACX,IAAE,mBAAmB,CAAC,YAAY,iBAAiB,MAAa,OAAO;AACvE,IAAE,WAAW;AACb,SAAO;AACT;AAEA,eAAe,OACb,SACA,GACA,MACc;AACd,QAAM,YAAY,UAAU,IAAI;AAChC,QAAM,cAAc;AAAA,IAClB;AAAA,IACA,MAAM,aAAa,SAAS;AAAA,IAC5B,GAAG,mBAAmB,CAAC;AAAA,EACzB;AACA,QAAM,SAAS,MAAM,oBAAoB,cAAc,WAAW;AAClE,SAAO,aAAa,MAAM;AAC5B;",
4
+ "sourcesContent": ["import {\n ConvexError,\n convexToJson,\n GenericValidator,\n jsonToConvex,\n v,\n Validator,\n Value,\n} from \"../../values/index.js\";\nimport { GenericDataModel } from \"../data_model.js\";\nimport {\n ActionBuilder,\n DefaultFunctionArgs,\n FunctionVisibility,\n GenericActionCtx,\n GenericMutationCtx,\n GenericQueryCtx,\n MutationBuilder,\n PublicHttpAction,\n QueryBuilder,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n} from \"../registration.js\";\nimport { setupActionCalls } from \"./actions_impl.js\";\nimport { setupActionVectorSearch } from \"./vector_search_impl.js\";\nimport { setupAuth } from \"./authentication_impl.js\";\nimport { setupReader, setupWriter } from \"./database_impl.js\";\nimport { QueryImpl, QueryInitializerImpl } from \"./query_impl.js\";\nimport {\n setupActionScheduler,\n setupMutationScheduler,\n} from \"./scheduler_impl.js\";\nimport {\n setupStorageActionWriter,\n setupStorageReader,\n setupStorageWriter,\n} from \"./storage_impl.js\";\nimport { parseArgs } from \"../../common/index.js\";\nimport { performAsyncSyscall } from \"./syscall.js\";\nimport { asObjectValidator } from \"../../values/validator.js\";\nimport { getFunctionAddress } from \"../components/paths.js\";\nimport {\n setupQueryMeta,\n setupMutationMeta,\n setupActionMeta,\n} from \"./meta_impl.js\";\n\nasync function invokeMutation<\n F extends (ctx: GenericMutationCtx<GenericDataModel>, ...args: any) => any,\n>(func: F, argsStr: string, visibility: FunctionVisibility) {\n // TODO(presley): Change the function signature and propagate the requestId from Rust.\n // Ok, to mock it out for now, since queries are only running in V8.\n const requestId = \"\";\n const args = jsonToConvex(JSON.parse(argsStr));\n const mutationCtx = {\n db: setupWriter(),\n auth: setupAuth(requestId),\n storage: setupStorageWriter(requestId),\n scheduler: setupMutationScheduler(),\n meta: setupMutationMeta(visibility),\n\n runQuery: (reference: any, args?: any) => runUdf(\"query\", reference, args),\n runMutation: (reference: any, args?: any) =>\n runUdf(\"mutation\", reference, args),\n };\n const result = await invokeFunction(func, mutationCtx, args as any);\n validateReturnValue(result);\n return JSON.stringify(convexToJson(result === undefined ? null : result));\n}\n\nexport function validateReturnValue(v: any) {\n if (v instanceof QueryInitializerImpl || v instanceof QueryImpl) {\n throw new Error(\n \"Return value is a Query. Results must be retrieved with `.collect()`, `.take(n), `.unique()`, or `.first()`.\",\n );\n }\n}\n\nexport async function invokeFunction<\n Ctx,\n Args extends any[],\n F extends (ctx: Ctx, ...args: Args) => any,\n>(func: F, ctx: Ctx, args: Args) {\n let result;\n try {\n result = await Promise.resolve(func(ctx, ...args));\n } catch (thrown: unknown) {\n throw serializeConvexErrorData(thrown);\n }\n return result;\n}\n\nfunction dontCallDirectly(\n funcType: string,\n handler: (ctx: any, args: any) => any,\n): unknown {\n return (ctx: any, args: any) => {\n globalThis.console.warn(\n \"Convex functions should not directly call other Convex functions. Consider calling a helper function instead. \" +\n `e.g. \\`export const foo = ${funcType}(...); await foo(ctx);\\` is not supported. ` +\n \"See https://docs.convex.dev/production/best-practices/#use-helper-functions-to-write-shared-code\",\n );\n return handler(ctx, args);\n };\n}\n\n// Keep in sync with node executor\nfunction serializeConvexErrorData(thrown: unknown) {\n if (\n typeof thrown === \"object\" &&\n thrown !== null &&\n Symbol.for(\"ConvexError\") in thrown\n ) {\n const error = thrown as ConvexError<any>;\n error.data = JSON.stringify(\n convexToJson(error.data === undefined ? null : error.data),\n );\n (error as any).ConvexErrorSymbol = Symbol.for(\"ConvexError\");\n return error;\n } else {\n return thrown;\n }\n}\n\n/**\n * Guard against Convex functions accidentally getting included in a browser bundle.\n * Convex functions may include secret logic or credentials that should not be\n * send to untrusted clients (browsers).\n */\nfunction assertNotBrowser() {\n if (\n typeof window === \"undefined\" ||\n (window as any).__convexAllowFunctionsInBrowser\n ) {\n return;\n }\n // JSDom doesn't count, developers are allowed to use JSDom in Convex functions.\n const isRealBrowser =\n Object.getOwnPropertyDescriptor(globalThis, \"window\")\n ?.get?.toString()\n .includes(\"[native code]\") ?? false;\n if (isRealBrowser) {\n // eslint-disable-next-line no-console\n console.error(\n \"Convex functions should not be imported in the browser. This will throw an error in future versions of `convex`. If this is a false negative, please report it to Convex support.\",\n );\n }\n}\n\ntype FunctionDefinition =\n | ((ctx: any, args: DefaultFunctionArgs) => any)\n | {\n args?: GenericValidator | Record<string, GenericValidator>;\n returns?: GenericValidator | Record<string, GenericValidator>;\n handler: (ctx: any, args: DefaultFunctionArgs) => any;\n };\n\nfunction strictReplacer(key: string, value: any) {\n if (value === undefined) {\n throw new Error(\n `A validator is undefined for field \"${key}\". ` +\n `This is often caused by circular imports. ` +\n `See https://docs.convex.dev/error#undefined-validator for details.`,\n );\n }\n return value;\n}\nfunction exportArgs(functionDefinition: FunctionDefinition) {\n return () => {\n let args: GenericValidator = v.any();\n if (\n typeof functionDefinition === \"object\" &&\n functionDefinition.args !== undefined\n ) {\n args = asObjectValidator(functionDefinition.args);\n }\n return JSON.stringify(args.json, strictReplacer);\n };\n}\n\nfunction exportReturns(functionDefinition: FunctionDefinition) {\n return () => {\n let returns: Validator<any, any, any> | undefined;\n if (\n typeof functionDefinition === \"object\" &&\n functionDefinition.returns !== undefined\n ) {\n returns = asObjectValidator(functionDefinition.returns);\n }\n return JSON.stringify(returns ? returns.json : null, strictReplacer);\n };\n}\n\n/**\n * Define a mutation in this Convex app's public API.\n *\n * You should generally use the `mutation` function from\n * `\"./_generated/server\"`.\n *\n * Mutations can read from and write to the database, and are accessible from\n * the client. They run **transactionally**, all database reads and writes\n * within a single mutation are atomic and isolated from other mutations.\n *\n * @example\n * ```typescript\n * import { mutation } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * export const createTask = mutation({\n * args: { text: v.string() },\n * returns: v.id(\"tasks\"),\n * handler: async (ctx, args) => {\n * const taskId = await ctx.db.insert(\"tasks\", {\n * text: args.text,\n * completed: false,\n * });\n * return taskId;\n * },\n * });\n * ```\n *\n * **Best practice:** Always include `args` and `returns` validators on all\n * mutations. If the function doesn't return a value, use `returns: v.null()`.\n * Argument validation is critical for security since public mutations are\n * exposed to the internet.\n *\n * **Common mistake:** Mutations cannot call third-party APIs or use `fetch`.\n * They must be deterministic. Use actions for external API calls.\n *\n * **Common mistake:** Do not use `mutation` for sensitive internal functions\n * that should not be called by clients. Use `internalMutation` instead.\n *\n * @param func - The mutation function. It receives a {@link GenericMutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/mutation-functions\n * @public\n */\nexport const mutationGeneric: MutationBuilder<any, \"public\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericMutationCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"mutation\", handler) as RegisteredMutation<\n \"public\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isMutation = true;\n func.isPublic = true;\n func.invokeMutation = (argsStr) => invokeMutation(handler, argsStr, \"public\");\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as MutationBuilder<any, \"public\">;\n\n/**\n * Define a mutation that is only accessible from other Convex functions (but not from the client).\n *\n * You should generally use the `internalMutation` function from\n * `\"./_generated/server\"`.\n *\n * Internal mutations can read from and write to the database but are **not**\n * exposed as part of your app's public API. They can only be called by other\n * Convex functions using `ctx.runMutation` or by the scheduler. Like public\n * mutations, they run transactionally.\n *\n * @example\n * ```typescript\n * import { internalMutation } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * // This mutation can only be called from other Convex functions:\n * export const markTaskCompleted = internalMutation({\n * args: { taskId: v.id(\"tasks\") },\n * returns: v.null(),\n * handler: async (ctx, args) => {\n * await ctx.db.patch(\"tasks\", args.taskId, { completed: true });\n * return null;\n * },\n * });\n * ```\n *\n * **Best practice:** Use `internalMutation` for any mutation that should not\n * be directly callable by clients, such as write-back functions from actions\n * or scheduled background work. Reference it via the `internal` object:\n * `await ctx.runMutation(internal.myModule.markTaskCompleted, { taskId })`.\n *\n * @param func - The mutation function. It receives a {@link GenericMutationCtx} as its first argument.\n * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/internal-functions\n * @public\n */\nexport const internalMutationGeneric: MutationBuilder<any, \"internal\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericMutationCtx<any>, args: any) => any;\n const func = dontCallDirectly(\n \"internalMutation\",\n handler,\n ) as RegisteredMutation<\"internal\", any, any>;\n\n assertNotBrowser();\n func.isMutation = true;\n func.isInternal = true;\n func.invokeMutation = (argsStr) =>\n invokeMutation(handler, argsStr, \"internal\");\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as MutationBuilder<any, \"internal\">;\n\nasync function invokeQuery<\n F extends (ctx: GenericQueryCtx<GenericDataModel>, ...args: any) => any,\n>(func: F, argsStr: string, visibility: FunctionVisibility) {\n // TODO(presley): Change the function signature and propagate the requestId from Rust.\n // Ok, to mock it out for now, since queries are only running in V8.\n const requestId = \"\";\n const args = jsonToConvex(JSON.parse(argsStr));\n const queryCtx = {\n db: setupReader(),\n auth: setupAuth(requestId),\n storage: setupStorageReader(requestId),\n meta: setupQueryMeta(visibility),\n runQuery: (reference: any, args?: any) => runUdf(\"query\", reference, args),\n };\n const result = await invokeFunction(func, queryCtx, args as any);\n validateReturnValue(result);\n return JSON.stringify(convexToJson(result === undefined ? null : result));\n}\n\n/**\n * Define a query in this Convex app's public API.\n *\n * You should generally use the `query` function from\n * `\"./_generated/server\"`.\n *\n * Queries can read from the database and are accessible from the client. They\n * are **reactive**, when used with `useQuery` in React, the component\n * automatically re-renders whenever the underlying data changes. Queries\n * cannot modify the database.\n * Query results are automatically cached by the Convex client and kept\n * consistent via WebSocket subscriptions.\n *\n *\n * @example\n * ```typescript\n * import { query } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * export const listTasks = query({\n * args: { completed: v.optional(v.boolean()) },\n * returns: v.array(v.object({\n * _id: v.id(\"tasks\"),\n * _creationTime: v.number(),\n * text: v.string(),\n * completed: v.boolean(),\n * })),\n * handler: async (ctx, args) => {\n * if (args.completed !== undefined) {\n * return await ctx.db\n * .query(\"tasks\")\n * .withIndex(\"by_completed\", (q) => q.eq(\"completed\", args.completed))\n * .collect();\n * }\n * return await ctx.db.query(\"tasks\").collect();\n * },\n * });\n * ```\n *\n * **Best practice:** Always include `args` and `returns` validators. Use\n * `.withIndex()` instead of `.filter()` for efficient database queries.\n * Queries should be fast since they run on every relevant data change.\n *\n * **Common mistake:** Queries are pure reads, they cannot write to the\n * database, call external APIs, or schedule functions. Use actions for HTTP\n * calls and mutations for database writes and scheduling.\n *\n * @param func - The query function. It receives a {@link GenericQueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/query-functions\n * @public\n */\nexport const queryGeneric: QueryBuilder<any, \"public\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericQueryCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"query\", handler) as RegisteredQuery<\n \"public\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isQuery = true;\n func.isPublic = true;\n func.invokeQuery = (argsStr) => invokeQuery(handler, argsStr, \"public\");\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as QueryBuilder<any, \"public\">;\n\n/**\n * Define a query that is only accessible from other Convex functions (but not from the client).\n *\n * You should generally use the `internalQuery` function from\n * `\"./_generated/server\"`.\n *\n * Internal queries can read from the database but are **not** exposed as part\n * of your app's public API. They can only be called by other Convex functions\n * using `ctx.runQuery`. This is useful for loading data in actions or for\n * helper queries that shouldn't be client-facing.\n *\n * @example\n * ```typescript\n * import { internalQuery } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * // Only callable from other Convex functions:\n * export const getUser = internalQuery({\n * args: { userId: v.id(\"users\") },\n * returns: v.union(\n * v.object({\n * _id: v.id(\"users\"),\n * _creationTime: v.number(),\n * name: v.string(),\n * email: v.string(),\n * }),\n * v.null(),\n * ),\n * handler: async (ctx, args) => {\n * return await ctx.db.get(\"users\", args.userId);\n * },\n * });\n * ```\n *\n * **Best practice:** Use `internalQuery` for data-loading in actions via\n * `ctx.runQuery(internal.myModule.getUser, { userId })`.\n *\n * @param func - The query function. It receives a {@link GenericQueryCtx} as its first argument.\n * @returns The wrapped query. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/internal-functions\n * @public\n */\nexport const internalQueryGeneric: QueryBuilder<any, \"internal\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericQueryCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"internalQuery\", handler) as RegisteredQuery<\n \"internal\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isQuery = true;\n func.isInternal = true;\n func.invokeQuery = (argsStr) =>\n invokeQuery(handler as any, argsStr, \"internal\");\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as QueryBuilder<any, \"internal\">;\n\nasync function invokeAction<\n F extends (ctx: GenericActionCtx<GenericDataModel>, ...args: any) => any,\n>(func: F, requestId: string, argsStr: string, visibility: FunctionVisibility) {\n const args = jsonToConvex(JSON.parse(argsStr));\n const calls = setupActionCalls(requestId);\n const ctx = {\n ...calls,\n auth: setupAuth(requestId),\n scheduler: setupActionScheduler(requestId),\n storage: setupStorageActionWriter(requestId),\n vectorSearch: setupActionVectorSearch(requestId) as any,\n meta: setupActionMeta(visibility),\n };\n const result = await invokeFunction(func, ctx, args as any);\n return JSON.stringify(convexToJson(result === undefined ? null : result));\n}\n\n/**\n * Define an action in this Convex app's public API.\n *\n * Actions can call third-party APIs, use Node.js libraries, and perform other\n * side effects. Unlike queries and mutations, actions do **not** have direct\n * database access (`ctx.db` is not available). Instead, use `ctx.runQuery`\n * and `ctx.runMutation` to read and write data.\n *\n * You should generally use the `action` function from\n * `\"./_generated/server\"`.\n *\n * Actions are accessible from the client and run outside of the database\n * transaction, so they are not atomic. They are best for integrating with\n * external services.\n *\n * @example\n * ```typescript\n * // Add \"use node\"; at the top of the file if using Node.js built-in modules.\n * import { action } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n * import { internal } from \"./_generated/api\";\n *\n * export const generateSummary = action({\n * args: { text: v.string() },\n * returns: v.string(),\n * handler: async (ctx, args) => {\n * // Call an external API:\n * const response = await fetch(\"https://api.example.com/summarize\", {\n * method: \"POST\",\n * body: JSON.stringify({ text: args.text }),\n * });\n * const { summary } = await response.json();\n *\n * // Write results back via a mutation:\n * await ctx.runMutation(internal.myModule.saveSummary, {\n * text: args.text,\n * summary,\n * });\n *\n * return summary;\n * },\n * });\n * ```\n *\n * **Best practice:** Minimize the number of `ctx.runQuery` and\n * `ctx.runMutation` calls from actions. Each call is a separate transaction,\n * so splitting logic across multiple calls introduces the risk of race\n * conditions. Try to batch reads/writes into single query/mutation calls.\n *\n * **`\"use node\"` runtime:** Actions run in Convex's default JavaScript\n * runtime, which supports `fetch` and most NPM packages. Only add\n * `\"use node\";` at the top of the file if a third-party library specifically\n * requires Node.js built-in APIs, it is a last resort, not the default.\n * Node.js actions have slower cold starts, and **only actions can be defined\n * in `\"use node\"` files** (no queries or mutations), so prefer the default\n * runtime whenever possible.\n *\n * **Common mistake:** Do not try to access `ctx.db` in an action, it is\n * not available. Use `ctx.runQuery` and `ctx.runMutation` instead.\n *\n * @param func - The function. It receives a {@link GenericActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/actions\n * @public\n */\nexport const actionGeneric: ActionBuilder<any, \"public\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericActionCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"action\", handler) as RegisteredAction<\n \"public\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isAction = true;\n func.isPublic = true;\n func.invokeAction = (requestId, argsStr) =>\n invokeAction(handler, requestId, argsStr, \"public\");\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as ActionBuilder<any, \"public\">;\n\n/**\n * Define an action that is only accessible from other Convex functions (but not from the client).\n *\n * You should generally use the `internalAction` function from\n * `\"./_generated/server\"`.\n *\n * Internal actions behave like public actions (they can call external APIs and\n * use Node.js libraries) but are **not** exposed in your app's public API. They\n * can only be called by other Convex functions using `ctx.runAction` or via the\n * scheduler.\n *\n * @example\n * ```typescript\n * import { internalAction } from \"./_generated/server\";\n * import { v } from \"convex/values\";\n *\n * export const sendEmail = internalAction({\n * args: { to: v.string(), subject: v.string(), body: v.string() },\n * returns: v.null(),\n * handler: async (ctx, args) => {\n * // Call an external email service (fetch works in the default runtime):\n * await fetch(\"https://api.email-service.com/send\", {\n * method: \"POST\",\n * headers: { \"Content-Type\": \"application/json\" },\n * body: JSON.stringify(args),\n * });\n * return null;\n * },\n * });\n * ```\n *\n * **Best practice:** Use `internalAction` for background work scheduled from\n * mutations: `await ctx.scheduler.runAfter(0, internal.myModule.sendEmail, { ... })`.\n * Only use `ctx.runAction` from another action if you need to cross runtimes\n * (e.g., default Convex runtime to Node.js). Otherwise, extract shared code\n * into a helper function.\n *\n * **`\"use node\"` runtime:** Only add `\"use node\";` at the top of the file\n * as a last resort when a third-party library requires Node.js APIs. Node.js\n * actions have slower cold starts, and **only actions can be defined in\n * `\"use node\"` files** (no queries or mutations).\n *\n * @param func - The function. It receives a {@link GenericActionCtx} as its first argument.\n * @returns The wrapped function. Include this as an `export` to name it and make it accessible.\n *\n * @see https://docs.convex.dev/functions/internal-functions\n * @public\n */\nexport const internalActionGeneric: ActionBuilder<any, \"internal\"> = ((\n functionDefinition: FunctionDefinition,\n) => {\n const handler = (\n typeof functionDefinition === \"function\"\n ? functionDefinition\n : functionDefinition.handler\n ) as (ctx: GenericActionCtx<any>, args: any) => any;\n const func = dontCallDirectly(\"internalAction\", handler) as RegisteredAction<\n \"internal\",\n any,\n any\n >;\n\n assertNotBrowser();\n func.isAction = true;\n func.isInternal = true;\n func.invokeAction = (requestId, argsStr) =>\n invokeAction(handler, requestId, argsStr, \"internal\");\n func.exportArgs = exportArgs(functionDefinition);\n func.exportReturns = exportReturns(functionDefinition);\n func._handler = handler;\n return func;\n}) as ActionBuilder<any, \"internal\">;\n\nasync function invokeHttpAction<\n F extends (ctx: GenericActionCtx<GenericDataModel>, request: Request) => any,\n>(func: F, request: Request) {\n // TODO(presley): Change the function signature and propagate the requestId from Rust.\n // Ok, to mock it out for now, since http endpoints are only running in V8.\n const requestId = \"\";\n const calls = setupActionCalls(requestId);\n const ctx = {\n ...calls,\n auth: setupAuth(requestId),\n storage: setupStorageActionWriter(requestId),\n scheduler: setupActionScheduler(requestId),\n vectorSearch: setupActionVectorSearch(requestId) as any,\n meta: setupActionMeta(\"public\"),\n };\n return await invokeFunction(func, ctx, [request]);\n}\n\n/**\n * Define a Convex HTTP action.\n *\n * HTTP actions handle raw HTTP requests and return HTTP responses. They are\n * registered by routing URL paths to them in `convex/http.ts` using\n * {@link HttpRouter}. Like regular actions, they can call external APIs and\n * use `ctx.runQuery` / `ctx.runMutation` but do not have direct `ctx.db` access.\n *\n * @example\n * ```typescript\n * // convex/http.ts\n * import { httpRouter } from \"convex/server\";\n * import { httpAction } from \"./_generated/server\";\n *\n * const http = httpRouter();\n *\n * http.route({\n * path: \"/api/webhook\",\n * method: \"POST\",\n * handler: httpAction(async (ctx, request) => {\n * const body = await request.json();\n * // Process the webhook payload...\n * return new Response(JSON.stringify({ ok: true }), {\n * status: 200,\n * headers: { \"Content-Type\": \"application/json\" },\n * });\n * }),\n * });\n *\n * export default http;\n * ```\n *\n * **Best practice:** HTTP actions are registered at the exact path specified.\n * For example, `path: \"/api/webhook\"` registers at `/api/webhook`.\n *\n * @param func - The function. It receives a {@link GenericActionCtx} as its first argument, and a `Request` object\n * as its second.\n * @returns The wrapped function. Route a URL path to this function in `convex/http.ts`.\n *\n * @see https://docs.convex.dev/functions/http-actions\n * @public\n */\nexport const httpActionGeneric = (\n func: (\n ctx: GenericActionCtx<GenericDataModel>,\n request: Request,\n ) => Promise<Response>,\n): PublicHttpAction => {\n const q = dontCallDirectly(\"httpAction\", func) as PublicHttpAction;\n assertNotBrowser();\n q.isHttp = true;\n q.invokeHttpAction = (request) => invokeHttpAction(func as any, request);\n q._handler = func;\n return q;\n};\n\nasync function runUdf(\n udfType: \"query\" | \"mutation\",\n f: any,\n args?: Record<string, Value>,\n): Promise<any> {\n const queryArgs = parseArgs(args);\n const syscallArgs = {\n udfType,\n args: convexToJson(queryArgs),\n ...getFunctionAddress(f),\n };\n const result = await performAsyncSyscall(\"1.0/runUdf\", syscallArgs);\n return jsonToConvex(result);\n}\n"],
5
+ "mappings": ";AAAA;AAAA,EAEE;AAAA,EAEA;AAAA,EACA;AAAA,OAGK;AAgBP,SAAS,wBAAwB;AACjC,SAAS,+BAA+B;AACxC,SAAS,iBAAiB;AAC1B,SAAS,aAAa,mBAAmB;AACzC,SAAS,WAAW,4BAA4B;AAChD;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AACpC,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,eAAe,eAEb,MAAS,SAAiB,YAAgC;AAG1D,QAAM,YAAY;AAClB,QAAM,OAAO,aAAa,KAAK,MAAM,OAAO,CAAC;AAC7C,QAAM,cAAc;AAAA,IAClB,IAAI,YAAY;AAAA,IAChB,MAAM,UAAU,SAAS;AAAA,IACzB,SAAS,mBAAmB,SAAS;AAAA,IACrC,WAAW,uBAAuB;AAAA,IAClC,MAAM,kBAAkB,UAAU;AAAA,IAElC,UAAU,CAAC,WAAgBA,UAAe,OAAO,SAAS,WAAWA,KAAI;AAAA,IACzE,aAAa,CAAC,WAAgBA,UAC5B,OAAO,YAAY,WAAWA,KAAI;AAAA,EACtC;AACA,QAAM,SAAS,MAAM,eAAe,MAAM,aAAa,IAAW;AAClE,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zC,cAAc,wBAAwB,SAAS;AAAA,IAC/C,MAAM,gBAAgB,QAAQ;AAAA,EAChC;AACA,SAAO,MAAM,eAAe,MAAM,KAAK,CAAC,OAAO,CAAC;AAClD;AA4CO,aAAM,oBAAoB,CAC/B,SAIqB;AACrB,QAAM,IAAI,iBAAiB,cAAc,IAAI;AAC7C,mBAAiB;AACjB,IAAE,SAAS;AACX,IAAE,mBAAmB,CAAC,YAAY,iBAAiB,MAAa,OAAO;AACvE,IAAE,WAAW;AACb,SAAO;AACT;AAEA,eAAe,OACb,SACA,GACA,MACc;AACd,QAAM,YAAY,UAAU,IAAI;AAChC,QAAM,cAAc;AAAA,IAClB;AAAA,IACA,MAAM,aAAa,SAAS;AAAA,IAC5B,GAAG,mBAAmB,CAAC;AAAA,EACzB;AACA,QAAM,SAAS,MAAM,oBAAoB,cAAc,WAAW;AAClE,SAAO,aAAa,MAAM;AAC5B;",
6
6
  "names": ["args", "v"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/server/index.ts"],
4
- "sourcesContent": ["/**\n * Utilities for implementing server-side Convex query and mutation functions.\n *\n * ## Usage\n *\n * ### Code Generation\n *\n * This module is typically used alongside generated server code.\n *\n * To generate the server code, run `npx convex dev` in your Convex project.\n * This will create a `convex/_generated/server.js` file with the following\n * functions, typed for your schema:\n * - [query](https://docs.convex.dev/generated-api/server#query)\n * - [mutation](https://docs.convex.dev/generated-api/server#mutation)\n *\n * If you aren't using TypeScript and code generation, you can use these untyped\n * functions instead:\n * - {@link queryGeneric}\n * - {@link mutationGeneric}\n *\n * ### Example\n *\n * Convex functions are defined by using either the `query` or\n * `mutation` wrappers.\n *\n * Queries receive a `db` that implements the {@link GenericDatabaseReader} interface.\n *\n * ```js\n * import { query } from \"./_generated/server\";\n *\n * export default query({\n * handler: async ({ db }, { arg1, arg2 }) => {\n * // Your (read-only) code here!\n * },\n * });\n * ```\n *\n * If your function needs to write to the database, such as inserting, updating,\n * or deleting documents, use `mutation` instead which provides a `db` that\n * implements the {@link GenericDatabaseWriter} interface.\n *\n * ```js\n * import { mutation } from \"./_generated/server\";\n *\n * export default mutation({\n * handler: async ({ db }, { arg1, arg2 }) => {\n * // Your mutation code here!\n * },\n * });\n * ```\n * @module\n */\n\nexport type {\n Auth,\n AuthConfig,\n AuthProvider,\n UserIdentity,\n UserIdentityAttributes,\n} from \"./authentication.js\";\nexport * from \"./database.js\";\nexport type {\n GenericDocument,\n GenericFieldPaths,\n GenericIndexFields,\n GenericTableIndexes,\n GenericSearchIndexConfig,\n GenericTableSearchIndexes,\n GenericVectorIndexConfig,\n GenericTableVectorIndexes,\n FieldTypeFromFieldPath,\n FieldTypeFromFieldPathInner,\n GenericTableInfo,\n DocumentByInfo,\n FieldPaths,\n Indexes,\n IndexNames,\n NamedIndex,\n SearchIndexes,\n SearchIndexNames,\n NamedSearchIndex,\n VectorIndexes,\n VectorIndexNames,\n NamedVectorIndex,\n GenericDataModel,\n AnyDataModel,\n TableNamesInDataModel,\n NamedTableInfo,\n DocumentByName,\n} from \"./data_model.js\";\n\nexport type {\n Expression,\n ExpressionOrValue,\n FilterBuilder,\n} from \"./filter_builder.js\";\nexport {\n actionGeneric,\n httpActionGeneric,\n mutationGeneric,\n queryGeneric,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n} from \"./impl/registration_impl.js\";\nexport type { IndexRange, IndexRangeBuilder } from \"./index_range_builder.js\";\nexport * from \"./pagination.js\";\nexport type { OrderedQuery, Query, QueryInitializer } from \"./query.js\";\nexport type {\n ArgsArray,\n DefaultFunctionArgs,\n FunctionVisibility,\n ActionBuilder,\n MutationBuilder,\n MutationBuilderWithTable,\n QueryBuilder,\n QueryBuilderWithTable,\n HttpActionBuilder,\n GenericActionCtx,\n GenericMutationCtx,\n GenericMutationCtxWithTable,\n GenericQueryCtx,\n GenericQueryCtxWithTable,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n PublicHttpAction,\n UnvalidatedFunction,\n ValidatedFunction,\n ReturnValueForOptionalValidator,\n ArgsArrayForOptionalValidator,\n ArgsArrayToObject,\n DefaultArgsForOptionalValidator,\n} from \"./registration.js\";\nexport * from \"./search_filter_builder.js\";\nexport * from \"./storage.js\";\nexport type { Scheduler, SchedulableFunctionReference } from \"./scheduler.js\";\nexport { cronJobs } from \"./cron.js\";\nexport type { CronJob, Crons } from \"./cron.js\";\nexport type {\n SystemFields,\n IdField,\n WithoutSystemFields,\n WithOptionalSystemFields,\n SystemIndexes,\n IndexTiebreakerField,\n} from \"./system_fields.js\";\nexport { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from \"./router.js\";\nexport type {\n RoutableMethod,\n RouteSpec,\n RouteSpecWithPath,\n RouteSpecWithPathPrefix,\n} from \"./router.js\";\nexport {\n anyApi,\n getFunctionName,\n makeFunctionReference,\n filterApi,\n} from \"./api.js\";\nexport type {\n ApiFromModules,\n AnyApi,\n FilterApi,\n FunctionType,\n FunctionReference,\n FunctionArgs,\n OptionalRestArgs,\n PartialApi,\n ArgsAndOptions,\n FunctionReturnType,\n} from \"./api.js\";\nexport {\n defineApp,\n defineComponent,\n componentsGeneric,\n createFunctionHandle,\n type AnyChildComponents,\n} from \"./components/index.js\";\n/**\n * @internal\n */\nexport { currentSystemUdfInComponent } from \"./components/index.js\";\nexport { getFunctionAddress } from \"./components/index.js\";\nexport type {\n ComponentDefinition,\n AnyComponents,\n FunctionHandle,\n} from \"./components/index.js\";\n\n/**\n * @internal\n */\nexport type { Index, SearchIndex, VectorIndex } from \"./schema.js\";\n\nexport type {\n SearchIndexConfig,\n VectorIndexConfig,\n TableDefinition,\n SchemaDefinition,\n DefineSchemaOptions,\n GenericSchema,\n DataModelFromSchemaDefinition,\n SystemDataModel,\n SystemTableNames,\n} from \"./schema.js\";\nexport { defineTable, defineSchema } from \"./schema.js\";\n\nexport type {\n VectorSearch,\n VectorSearchQuery,\n VectorFilterBuilder,\n FilterExpression,\n} from \"./vector_search.js\";\n\n/**\n * @public\n */\nexport type { BetterOmit, Expand } from \"../type_utils.js\";\n"],
5
- "mappings": ";AA4DA,cAAc;AAoCd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,cAAc;AA4Bd,cAAc;AACd,cAAc;AAEd,SAAS,gBAAgB;AAUzB,SAAS,YAAY,YAAY,6BAA6B;AAO9D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAIP,SAAS,mCAAmC;AAC5C,SAAS,0BAA0B;AAuBnC,SAAS,aAAa,oBAAoB;",
4
+ "sourcesContent": ["/**\n * Utilities for implementing server-side Convex query and mutation functions.\n *\n * ## Usage\n *\n * ### Code Generation\n *\n * This module is typically used alongside generated server code.\n *\n * To generate the server code, run `npx convex dev` in your Convex project.\n * This will create a `convex/_generated/server.js` file with the following\n * functions, typed for your schema:\n * - [query](https://docs.convex.dev/generated-api/server#query)\n * - [mutation](https://docs.convex.dev/generated-api/server#mutation)\n *\n * If you aren't using TypeScript and code generation, you can use these untyped\n * functions instead:\n * - {@link queryGeneric}\n * - {@link mutationGeneric}\n *\n * ### Example\n *\n * Convex functions are defined by using either the `query` or\n * `mutation` wrappers.\n *\n * Queries receive a `db` that implements the {@link GenericDatabaseReader} interface.\n *\n * ```js\n * import { query } from \"./_generated/server\";\n *\n * export default query({\n * handler: async ({ db }, { arg1, arg2 }) => {\n * // Your (read-only) code here!\n * },\n * });\n * ```\n *\n * If your function needs to write to the database, such as inserting, updating,\n * or deleting documents, use `mutation` instead which provides a `db` that\n * implements the {@link GenericDatabaseWriter} interface.\n *\n * ```js\n * import { mutation } from \"./_generated/server\";\n *\n * export default mutation({\n * handler: async ({ db }, { arg1, arg2 }) => {\n * // Your mutation code here!\n * },\n * });\n * ```\n * @module\n */\n\nexport type {\n Auth,\n AuthConfig,\n AuthProvider,\n UserIdentity,\n UserIdentityAttributes,\n} from \"./authentication.js\";\nexport * from \"./database.js\";\nexport type {\n GenericDocument,\n GenericFieldPaths,\n GenericIndexFields,\n GenericTableIndexes,\n GenericSearchIndexConfig,\n GenericTableSearchIndexes,\n GenericVectorIndexConfig,\n GenericTableVectorIndexes,\n FieldTypeFromFieldPath,\n FieldTypeFromFieldPathInner,\n GenericTableInfo,\n DocumentByInfo,\n FieldPaths,\n Indexes,\n IndexNames,\n NamedIndex,\n SearchIndexes,\n SearchIndexNames,\n NamedSearchIndex,\n VectorIndexes,\n VectorIndexNames,\n NamedVectorIndex,\n GenericDataModel,\n AnyDataModel,\n TableNamesInDataModel,\n NamedTableInfo,\n DocumentByName,\n} from \"./data_model.js\";\n\nexport type {\n Expression,\n ExpressionOrValue,\n FilterBuilder,\n} from \"./filter_builder.js\";\nexport {\n actionGeneric,\n httpActionGeneric,\n mutationGeneric,\n queryGeneric,\n internalActionGeneric,\n internalMutationGeneric,\n internalQueryGeneric,\n} from \"./impl/registration_impl.js\";\nexport type {\n TransactionMetric,\n TransactionMetrics,\n FunctionMetadata,\n QueryMeta,\n MutationMeta,\n ActionMeta,\n} from \"./meta.js\";\nexport type { IndexRange, IndexRangeBuilder } from \"./index_range_builder.js\";\nexport * from \"./pagination.js\";\nexport type { OrderedQuery, Query, QueryInitializer } from \"./query.js\";\nexport type {\n ArgsArray,\n DefaultFunctionArgs,\n FunctionVisibility,\n ActionBuilder,\n MutationBuilder,\n MutationBuilderWithTable,\n QueryBuilder,\n QueryBuilderWithTable,\n HttpActionBuilder,\n GenericActionCtx,\n GenericMutationCtx,\n GenericMutationCtxWithTable,\n GenericQueryCtx,\n GenericQueryCtxWithTable,\n RegisteredAction,\n RegisteredMutation,\n RegisteredQuery,\n PublicHttpAction,\n UnvalidatedFunction,\n ValidatedFunction,\n ReturnValueForOptionalValidator,\n ArgsArrayForOptionalValidator,\n ArgsArrayToObject,\n DefaultArgsForOptionalValidator,\n} from \"./registration.js\";\nexport * from \"./search_filter_builder.js\";\nexport * from \"./storage.js\";\nexport type { Scheduler, SchedulableFunctionReference } from \"./scheduler.js\";\nexport { cronJobs } from \"./cron.js\";\nexport type { CronJob, Crons } from \"./cron.js\";\nexport type {\n SystemFields,\n IdField,\n WithoutSystemFields,\n WithOptionalSystemFields,\n SystemIndexes,\n IndexTiebreakerField,\n} from \"./system_fields.js\";\nexport { httpRouter, HttpRouter, ROUTABLE_HTTP_METHODS } from \"./router.js\";\nexport type {\n RoutableMethod,\n RouteSpec,\n RouteSpecWithPath,\n RouteSpecWithPathPrefix,\n} from \"./router.js\";\nexport {\n anyApi,\n getFunctionName,\n makeFunctionReference,\n filterApi,\n} from \"./api.js\";\nexport type {\n ApiFromModules,\n AnyApi,\n FilterApi,\n FunctionType,\n FunctionReference,\n FunctionArgs,\n OptionalRestArgs,\n PartialApi,\n ArgsAndOptions,\n FunctionReturnType,\n} from \"./api.js\";\nexport {\n defineApp,\n defineComponent,\n componentsGeneric,\n createFunctionHandle,\n type AnyChildComponents,\n} from \"./components/index.js\";\n/**\n * @internal\n */\nexport { currentSystemUdfInComponent } from \"./components/index.js\";\nexport { getFunctionAddress } from \"./components/index.js\";\nexport type {\n ComponentDefinition,\n AnyComponents,\n FunctionHandle,\n} from \"./components/index.js\";\n\n/**\n * @internal\n */\nexport type { Index, SearchIndex, VectorIndex } from \"./schema.js\";\n\nexport type {\n SearchIndexConfig,\n VectorIndexConfig,\n TableDefinition,\n SchemaDefinition,\n DefineSchemaOptions,\n GenericSchema,\n DataModelFromSchemaDefinition,\n SystemDataModel,\n SystemTableNames,\n} from \"./schema.js\";\nexport { defineTable, defineSchema } from \"./schema.js\";\n\nexport type {\n VectorSearch,\n VectorSearchQuery,\n VectorFilterBuilder,\n FilterExpression,\n} from \"./vector_search.js\";\n\n/**\n * @public\n */\nexport type { BetterOmit, Expand } from \"../type_utils.js\";\n"],
5
+ "mappings": ";AA4DA,cAAc;AAoCd;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP,cAAc;AA4Bd,cAAc;AACd,cAAc;AAEd,SAAS,gBAAgB;AAUzB,SAAS,YAAY,YAAY,6BAA6B;AAO9D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAaP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAIP,SAAS,mCAAmC;AAC5C,SAAS,0BAA0B;AAuBnC,SAAS,aAAa,oBAAoB;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=meta.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -27,4 +27,5 @@ export { ConvexHttpClient } from "./http_client.js";
27
27
  export type { HttpMutationOptions } from "./http_client.js";
28
28
  export type { QueryJournal } from "./sync/protocol.js";
29
29
  export type { FunctionResult } from "./sync/function_result.js";
30
+ export type { QueryOptions } from "./query_options.js";
30
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EACV,uBAAuB,EACvB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EACV,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1,16 +1,19 @@
1
- /**
2
- * Query options are a potential new API for a variety of functions, but in particular a new overload of the React hook for queries.
3
- *
4
- * Inspired by https://tanstack.com/query/v5/docs/framework/react/guides/query-options
5
- */
6
1
  import type { FunctionArgs, FunctionReference } from "../server/api.js";
7
2
  /**
8
- * Query options.
3
+ * Options for a Convex query: the query function reference and its arguments.
4
+ *
5
+ * Used with the object-form overload of {@link useQuery}.
6
+ *
7
+ * @public
9
8
  */
10
- export type ConvexQueryOptions<Query extends FunctionReference<"query">> = {
9
+ export type QueryOptions<Query extends FunctionReference<"query">> = {
10
+ /**
11
+ * The query function to run.
12
+ */
11
13
  query: Query;
14
+ /**
15
+ * The arguments to the query function.
16
+ */
12
17
  args: FunctionArgs<Query>;
13
- extendSubscriptionFor?: number;
14
18
  };
15
- export declare function convexQueryOptions<Query extends FunctionReference<"query">>(options: ConvexQueryOptions<Query>): ConvexQueryOptions<Query>;
16
19
  //# sourceMappingURL=query_options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query_options.d.ts","sourceRoot":"","sources":["../../../src/browser/query_options.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAMxE;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,KAAK,SAAS,iBAAiB,CAAC,OAAO,CAAC,IAAI;IACzE,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAGF,wBAAgB,kBAAkB,CAAC,KAAK,SAAS,iBAAiB,CAAC,OAAO,CAAC,EACzE,OAAO,EAAE,kBAAkB,CAAC,KAAK,CAAC,GACjC,kBAAkB,CAAC,KAAK,CAAC,CAE3B"}
1
+ {"version":3,"file":"query_options.d.ts","sourceRoot":"","sources":["../../../src/browser/query_options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,iBAAiB,CAAC,OAAO,CAAC,IAAI;IACnE;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;CAC3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"aiFiles.d.ts","sourceRoot":"","sources":["../../../src/cli/aiFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAkHtD,eAAO,MAAM,OAAO,qBAaI,CAAC"}
1
+ {"version":3,"file":"aiFiles.d.ts","sourceRoot":"","sources":["../../../src/cli/aiFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAgJtD,eAAO,MAAM,OAAO,qBAaI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../../../src/cli/codegen_templates/readme.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,WAwF5B"}
1
+ {"version":3,"file":"readme.d.ts","sourceRoot":"","sources":["../../../../src/cli/codegen_templates/readme.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,WAqG5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../src/cli/configure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAQhD,OAAO,EACL,cAAc,EACd,cAAc,EAMf,MAAM,cAAc,CAAC;AA8BtB,OAAO,EACL,mBAAmB,EAGpB,MAAM,8BAA8B,CAAC;AAItC,KAAK,qBAAqB,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,mBAAmB,GAEpB,KAAK,GAEL,UAAU,GAEV,KAAK,GAEL,IAAI,CAAC;AAET,KAAK,mBAAmB,GAAG;IACzB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE;QACZ,KAAK,C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IAC9C,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,GACA,OAAO,CAAC;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;CAClC,CAAC,CAkBD;AAiPD,wBAAsB,wCAAwC,CAC5D,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE;IACP,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;CAChC,EACD,aAAa,EAAE,MAAM,GAAG,IAAI,iBA2B7B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=configure.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.test.d.ts","sourceRoot":"","sources":["../../../src/cli/configure.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AA8B9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;MAqJf,CAAC"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/deploy.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAiC9D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;MAwJf,CAAC"}
@@ -5,6 +5,7 @@ export declare const deploymentCreate: Command<[string | undefined], {
5
5
  region?: string;
6
6
  select?: true;
7
7
  default?: true;
8
+ expiration?: string;
8
9
  }, {}>;
9
10
  export declare function fetchAvailableRegions(ctx: Context, teamId: number): Promise<{
10
11
  available: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"deploymentCreate.d.ts","sourceRoot":"","sources":["../../../src/cli/deploymentCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAiB,MAAM,uBAAuB,CAAC;AAyB/D,eAAO,MAAM,gBAAgB;;;;;MAqFzB,CAAC;AAgVL,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;KAYvE;AAED,KAAK,eAAe,GAAG,OAAO,CAC5B,UAAU,CAAC,OAAO,qBAAqB,CAAC,CACzC,CAAC,MAAM,CAAC,CAAC;AAEV,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,eAAe,EAAE,EACnC,MAAM,EAAE,MAAM;;;;SAIf"}
1
+ {"version":3,"file":"deploymentCreate.d.ts","sourceRoot":"","sources":["../../../src/cli/deploymentCreate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAiB,MAAM,uBAAuB,CAAC;AA2C/D,eAAO,MAAM,gBAAgB;;;;;;MAkKzB,CAAC;AA2ZL,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;KAYvE;AAED,KAAK,eAAe,GAAG,OAAO,CAC5B,UAAU,CAAC,OAAO,qBAAqB,CAAC,CACzC,CAAC,MAAM,CAAC,CAAC;AAEV,wBAAgB,oBAAoB,CAClC,gBAAgB,EAAE,eAAe,EAAE,EACnC,MAAM,EAAE,MAAM;;;;SAIf"}