convex 1.46.0 → 1.48.0-alpha.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 (479) hide show
  1. package/CHANGELOG.md +58 -1
  2. package/dist/browser.bundle.js +7 -1
  3. package/dist/browser.bundle.js.map +2 -2
  4. package/dist/cjs/bundler/context.js +7 -5
  5. package/dist/cjs/bundler/context.js.map +2 -2
  6. package/dist/cjs/bundler/fs.js +47 -6
  7. package/dist/cjs/bundler/fs.js.map +2 -2
  8. package/dist/cjs/bundler/index.js +5 -4
  9. package/dist/cjs/bundler/index.js.map +2 -2
  10. package/dist/cjs/cli/account.js +237 -0
  11. package/dist/cjs/cli/account.js.map +7 -0
  12. package/dist/cjs/cli/codegen.js +0 -4
  13. package/dist/cjs/cli/codegen.js.map +2 -2
  14. package/dist/cjs/cli/configure.js +28 -6
  15. package/dist/cjs/cli/configure.js.map +2 -2
  16. package/dist/cjs/cli/deploy.js +27 -2
  17. package/dist/cjs/cli/deploy.js.map +2 -2
  18. package/dist/cjs/cli/deploymentSelect.js +2 -2
  19. package/dist/cjs/cli/deploymentSelect.js.map +2 -2
  20. package/dist/cjs/cli/dev.js +6 -0
  21. package/dist/cjs/cli/dev.js.map +2 -2
  22. package/dist/cjs/cli/env.js +10 -5
  23. package/dist/cjs/cli/env.js.map +2 -2
  24. package/dist/cjs/cli/envDefault.js +7 -2
  25. package/dist/cjs/cli/envDefault.js.map +2 -2
  26. package/dist/cjs/cli/generatedApi.js.map +1 -1
  27. package/dist/cjs/cli/lib/api.js +2 -0
  28. package/dist/cjs/cli/lib/api.js.map +2 -2
  29. package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js +113 -0
  30. package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
  31. package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js +36 -47
  32. package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
  33. package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js +58 -39
  34. package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js.map +2 -2
  35. package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js +90 -0
  36. package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
  37. package/dist/cjs/cli/lib/codegen.js.map +2 -2
  38. package/dist/cjs/cli/lib/command.js +2 -1
  39. package/dist/cjs/cli/lib/command.js.map +2 -2
  40. package/dist/cjs/cli/lib/components/definition/bundle.js +37 -11
  41. package/dist/cjs/cli/lib/components/definition/bundle.js.map +2 -2
  42. package/dist/cjs/cli/lib/components.js +48 -5
  43. package/dist/cjs/cli/lib/components.js.map +2 -2
  44. package/dist/cjs/cli/lib/config.js +56 -17
  45. package/dist/cjs/cli/lib/config.js.map +2 -2
  46. package/dist/cjs/cli/lib/deploy2.js +3 -1
  47. package/dist/cjs/cli/lib/deploy2.js.map +2 -2
  48. package/dist/cjs/cli/lib/deployApi/evaluateSchema.js +30 -2
  49. package/dist/cjs/cli/lib/deployApi/evaluateSchema.js.map +2 -2
  50. package/dist/cjs/cli/lib/deployKeyWarning.js +43 -0
  51. package/dist/cjs/cli/lib/deployKeyWarning.js.map +7 -0
  52. package/dist/cjs/cli/lib/deployment.js +2 -0
  53. package/dist/cjs/cli/lib/deployment.js.map +2 -2
  54. package/dist/cjs/cli/lib/deploymentSelection.js +27 -18
  55. package/dist/cjs/cli/lib/deploymentSelection.js.map +2 -2
  56. package/dist/cjs/cli/lib/dev.js +5 -0
  57. package/dist/cjs/cli/lib/dev.js.map +2 -2
  58. package/dist/cjs/cli/lib/envvars.js +32 -0
  59. package/dist/cjs/cli/lib/envvars.js.map +2 -2
  60. package/dist/cjs/cli/lib/formatValidationProgress.js +47 -0
  61. package/dist/cjs/cli/lib/formatValidationProgress.js.map +7 -0
  62. package/dist/cjs/cli/lib/fsUtils.js +1 -1
  63. package/dist/cjs/cli/lib/fsUtils.js.map +2 -2
  64. package/dist/cjs/cli/lib/generateDocs.js +1 -1
  65. package/dist/cjs/cli/lib/generateDocs.js.map +1 -1
  66. package/dist/cjs/cli/lib/indexes.js.map +1 -1
  67. package/dist/cjs/cli/lib/login.js +28 -4
  68. package/dist/cjs/cli/lib/login.js.map +2 -2
  69. package/dist/cjs/cli/lib/mcp/requestContext.js +5 -1
  70. package/dist/cjs/cli/lib/mcp/requestContext.js.map +2 -2
  71. package/dist/cjs/cli/lib/mcp/tools/env.js +10 -3
  72. package/dist/cjs/cli/lib/mcp/tools/env.js.map +2 -2
  73. package/dist/cjs/cli/lib/profileManagement.js +196 -0
  74. package/dist/cjs/cli/lib/profileManagement.js.map +7 -0
  75. package/dist/cjs/cli/lib/profiles.js +333 -0
  76. package/dist/cjs/cli/lib/profiles.js.map +7 -0
  77. package/dist/cjs/cli/lib/run.js +4 -0
  78. package/dist/cjs/cli/lib/run.js.map +2 -2
  79. package/dist/cjs/cli/lib/schemaEvaluation.js +62 -0
  80. package/dist/cjs/cli/lib/schemaEvaluation.js.map +7 -0
  81. package/dist/cjs/cli/lib/usageLimits.js +4 -2
  82. package/dist/cjs/cli/lib/usageLimits.js.map +2 -2
  83. package/dist/cjs/cli/lib/utils/mutex.js +9 -24
  84. package/dist/cjs/cli/lib/utils/mutex.js.map +2 -2
  85. package/dist/cjs/cli/lib/utils/utils.js +66 -27
  86. package/dist/cjs/cli/lib/utils/utils.js.map +2 -2
  87. package/dist/cjs/cli/login.js +213 -114
  88. package/dist/cjs/cli/login.js.map +3 -3
  89. package/dist/cjs/cli/logout.js +113 -12
  90. package/dist/cjs/cli/logout.js.map +3 -3
  91. package/dist/cjs/cli/mcp.js +43 -10
  92. package/dist/cjs/cli/mcp.js.map +3 -3
  93. package/dist/cjs/cli/program.js +2 -1
  94. package/dist/cjs/cli/program.js.map +2 -2
  95. package/dist/cjs/cli/projectCreate.js +1 -1
  96. package/dist/cjs/cli/projectCreate.js.map +1 -1
  97. package/dist/cjs/index.js +1 -1
  98. package/dist/cjs/index.js.map +1 -1
  99. package/dist/cjs/server/impl/actions_impl.js +8 -3
  100. package/dist/cjs/server/impl/actions_impl.js.map +2 -2
  101. package/dist/cjs/server/impl/storage_impl.js +29 -0
  102. package/dist/cjs/server/impl/storage_impl.js.map +2 -2
  103. package/dist/cjs/server/index.js +1 -0
  104. package/dist/cjs/server/index.js.map +2 -2
  105. package/dist/cjs/server/meta.js.map +1 -1
  106. package/dist/cjs/server/registration.js.map +1 -1
  107. package/dist/cjs/server/schema.js +34 -12
  108. package/dist/cjs/server/schema.js.map +2 -2
  109. package/dist/cjs/server/storage.js.map +1 -1
  110. package/dist/cjs/values/validators.js +1 -1
  111. package/dist/cjs/values/validators.js.map +2 -2
  112. package/dist/cjs/values/value.js +6 -0
  113. package/dist/cjs/values/value.js.map +2 -2
  114. package/dist/cjs-types/bundler/context.d.ts +5 -0
  115. package/dist/cjs-types/bundler/context.d.ts.map +1 -1
  116. package/dist/cjs-types/bundler/fs.d.ts +7 -2
  117. package/dist/cjs-types/bundler/fs.d.ts.map +1 -1
  118. package/dist/cjs-types/bundler/index.d.ts +9 -2
  119. package/dist/cjs-types/bundler/index.d.ts.map +1 -1
  120. package/dist/cjs-types/cli/account.d.ts +6 -0
  121. package/dist/cjs-types/cli/account.d.ts.map +1 -0
  122. package/dist/cjs-types/cli/codegen.d.ts.map +1 -1
  123. package/dist/cjs-types/cli/configure.d.ts +6 -0
  124. package/dist/cjs-types/cli/configure.d.ts.map +1 -1
  125. package/dist/cjs-types/cli/deploy.d.ts +2 -0
  126. package/dist/cjs-types/cli/deploy.d.ts.map +1 -1
  127. package/dist/cjs-types/cli/deploymentCreate.d.ts +6 -6
  128. package/dist/cjs-types/cli/deploymentSelect.d.ts.map +1 -1
  129. package/dist/cjs-types/cli/dev.d.ts +1 -0
  130. package/dist/cjs-types/cli/dev.d.ts.map +1 -1
  131. package/dist/cjs-types/cli/env.d.ts.map +1 -1
  132. package/dist/cjs-types/cli/envDefault.d.ts.map +1 -1
  133. package/dist/cjs-types/cli/generatedApi.d.ts +1 -1
  134. package/dist/cjs-types/cli/generatedApi.d.ts.map +1 -1
  135. package/dist/cjs-types/cli/lib/api.d.ts.map +1 -1
  136. package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
  137. package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
  138. package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts +5 -7
  139. package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
  140. package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts +4 -10
  141. package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -1
  142. package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
  143. package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
  144. package/dist/cjs-types/cli/lib/codegen.d.ts +0 -3
  145. package/dist/cjs-types/cli/lib/codegen.d.ts.map +1 -1
  146. package/dist/cjs-types/cli/lib/command.d.ts +2 -0
  147. package/dist/cjs-types/cli/lib/command.d.ts.map +1 -1
  148. package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts +13 -0
  149. package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
  150. package/dist/cjs-types/cli/lib/components.d.ts +4 -0
  151. package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
  152. package/dist/cjs-types/cli/lib/config.d.ts +2 -1
  153. package/dist/cjs-types/cli/lib/config.d.ts.map +1 -1
  154. package/dist/cjs-types/cli/lib/deploy2.d.ts +2 -0
  155. package/dist/cjs-types/cli/lib/deploy2.d.ts.map +1 -1
  156. package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts +460 -16
  157. package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -1
  158. package/dist/cjs-types/cli/lib/deployKeyWarning.d.ts +3 -0
  159. package/dist/cjs-types/cli/lib/deployKeyWarning.d.ts.map +1 -0
  160. package/dist/cjs-types/cli/lib/deployment.d.ts +2 -0
  161. package/dist/cjs-types/cli/lib/deployment.d.ts.map +1 -1
  162. package/dist/cjs-types/cli/lib/deploymentSelection.d.ts +2 -1
  163. package/dist/cjs-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  164. package/dist/cjs-types/cli/lib/dev.d.ts +1 -0
  165. package/dist/cjs-types/cli/lib/dev.d.ts.map +1 -1
  166. package/dist/cjs-types/cli/lib/envvars.d.ts +6 -0
  167. package/dist/cjs-types/cli/lib/envvars.d.ts.map +1 -1
  168. package/dist/cjs-types/cli/lib/formatValidationProgress.d.ts +8 -0
  169. package/dist/cjs-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
  170. package/dist/cjs-types/cli/lib/fsUtils.d.ts +1 -0
  171. package/dist/cjs-types/cli/lib/fsUtils.d.ts.map +1 -1
  172. package/dist/cjs-types/cli/lib/login.d.ts +3 -1
  173. package/dist/cjs-types/cli/lib/login.d.ts.map +1 -1
  174. package/dist/cjs-types/cli/lib/mcp/requestContext.d.ts.map +1 -1
  175. package/dist/cjs-types/cli/lib/mcp/tools/env.d.ts +8 -5
  176. package/dist/cjs-types/cli/lib/mcp/tools/env.d.ts.map +1 -1
  177. package/dist/cjs-types/cli/lib/mcp/tools/insights.d.ts +2 -2
  178. package/dist/cjs-types/cli/lib/profileManagement.d.ts +10 -0
  179. package/dist/cjs-types/cli/lib/profileManagement.d.ts.map +1 -0
  180. package/dist/cjs-types/cli/lib/profiles.d.ts +59 -0
  181. package/dist/cjs-types/cli/lib/profiles.d.ts.map +1 -0
  182. package/dist/cjs-types/cli/lib/run.d.ts.map +1 -1
  183. package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts +33 -0
  184. package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
  185. package/dist/cjs-types/cli/lib/usageLimits.d.ts +1 -1
  186. package/dist/cjs-types/cli/lib/usageLimits.d.ts.map +1 -1
  187. package/dist/cjs-types/cli/lib/utils/mutex.d.ts +1 -3
  188. package/dist/cjs-types/cli/lib/utils/mutex.d.ts.map +1 -1
  189. package/dist/cjs-types/cli/lib/utils/utils.d.ts +15 -2
  190. package/dist/cjs-types/cli/lib/utils/utils.d.ts.map +1 -1
  191. package/dist/cjs-types/cli/login.d.ts +21 -0
  192. package/dist/cjs-types/cli/login.d.ts.map +1 -1
  193. package/dist/cjs-types/cli/logout.d.ts +8 -1
  194. package/dist/cjs-types/cli/logout.d.ts.map +1 -1
  195. package/dist/cjs-types/cli/mcp.d.ts.map +1 -1
  196. package/dist/cjs-types/cli/program.d.ts.map +1 -1
  197. package/dist/cjs-types/index.d.ts +1 -1
  198. package/dist/cjs-types/index.d.ts.map +1 -1
  199. package/dist/cjs-types/server/impl/actions_impl.d.ts +18 -3
  200. package/dist/cjs-types/server/impl/actions_impl.d.ts.map +1 -1
  201. package/dist/cjs-types/server/impl/storage_impl.d.ts.map +1 -1
  202. package/dist/cjs-types/server/index.d.ts +1 -1
  203. package/dist/cjs-types/server/index.d.ts.map +1 -1
  204. package/dist/cjs-types/server/meta.d.ts +63 -0
  205. package/dist/cjs-types/server/meta.d.ts.map +1 -1
  206. package/dist/cjs-types/server/registration.d.ts +10 -0
  207. package/dist/cjs-types/server/registration.d.ts.map +1 -1
  208. package/dist/cjs-types/server/schema.d.ts +33 -0
  209. package/dist/cjs-types/server/schema.d.ts.map +1 -1
  210. package/dist/cjs-types/server/storage.d.ts.map +1 -1
  211. package/dist/cjs-types/values/value.d.ts.map +1 -1
  212. package/dist/cli.bundle.cjs +4889 -2980
  213. package/dist/cli.bundle.cjs.map +4 -4
  214. package/dist/esm/bundler/context.js +7 -5
  215. package/dist/esm/bundler/context.js.map +2 -2
  216. package/dist/esm/bundler/fs.js +47 -6
  217. package/dist/esm/bundler/fs.js.map +2 -2
  218. package/dist/esm/bundler/index.js +5 -4
  219. package/dist/esm/bundler/index.js.map +2 -2
  220. package/dist/esm/cli/account.js +221 -0
  221. package/dist/esm/cli/account.js.map +7 -0
  222. package/dist/esm/cli/codegen.js +0 -4
  223. package/dist/esm/cli/codegen.js.map +2 -2
  224. package/dist/esm/cli/configure.js +27 -6
  225. package/dist/esm/cli/configure.js.map +2 -2
  226. package/dist/esm/cli/deploy.js +27 -2
  227. package/dist/esm/cli/deploy.js.map +2 -2
  228. package/dist/esm/cli/deploymentSelect.js +6 -3
  229. package/dist/esm/cli/deploymentSelect.js.map +2 -2
  230. package/dist/esm/cli/dev.js +6 -0
  231. package/dist/esm/cli/dev.js.map +2 -2
  232. package/dist/esm/cli/env.js +11 -6
  233. package/dist/esm/cli/env.js.map +2 -2
  234. package/dist/esm/cli/envDefault.js +7 -2
  235. package/dist/esm/cli/envDefault.js.map +2 -2
  236. package/dist/esm/cli/lib/api.js +2 -0
  237. package/dist/esm/cli/lib/api.js.map +2 -2
  238. package/dist/esm/cli/lib/checkForLargeIndexBackfill.js +95 -0
  239. package/dist/esm/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
  240. package/dist/esm/cli/lib/checkForLargeIndexDeletion.js +37 -48
  241. package/dist/esm/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
  242. package/dist/esm/cli/lib/checkForSlowSchemaValidation.js +63 -41
  243. package/dist/esm/cli/lib/checkForSlowSchemaValidation.js.map +2 -2
  244. package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js +68 -0
  245. package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
  246. package/dist/esm/cli/lib/codegen.js.map +2 -2
  247. package/dist/esm/cli/lib/command.js +2 -1
  248. package/dist/esm/cli/lib/command.js.map +2 -2
  249. package/dist/esm/cli/lib/components/definition/bundle.js +37 -11
  250. package/dist/esm/cli/lib/components/definition/bundle.js.map +2 -2
  251. package/dist/esm/cli/lib/components.js +55 -5
  252. package/dist/esm/cli/lib/components.js.map +2 -2
  253. package/dist/esm/cli/lib/config.js +55 -17
  254. package/dist/esm/cli/lib/config.js.map +2 -2
  255. package/dist/esm/cli/lib/deploy2.js +3 -1
  256. package/dist/esm/cli/lib/deploy2.js.map +2 -2
  257. package/dist/esm/cli/lib/deployApi/evaluateSchema.js +28 -2
  258. package/dist/esm/cli/lib/deployApi/evaluateSchema.js.map +2 -2
  259. package/dist/esm/cli/lib/deployKeyWarning.js +27 -0
  260. package/dist/esm/cli/lib/deployKeyWarning.js.map +7 -0
  261. package/dist/esm/cli/lib/deployment.js +2 -2
  262. package/dist/esm/cli/lib/deployment.js.map +2 -2
  263. package/dist/esm/cli/lib/deploymentSelection.js +35 -20
  264. package/dist/esm/cli/lib/deploymentSelection.js.map +2 -2
  265. package/dist/esm/cli/lib/dev.js +5 -0
  266. package/dist/esm/cli/lib/dev.js.map +2 -2
  267. package/dist/esm/cli/lib/envvars.js +35 -1
  268. package/dist/esm/cli/lib/envvars.js.map +2 -2
  269. package/dist/esm/cli/lib/formatValidationProgress.js +24 -0
  270. package/dist/esm/cli/lib/formatValidationProgress.js.map +7 -0
  271. package/dist/esm/cli/lib/fsUtils.js +1 -1
  272. package/dist/esm/cli/lib/fsUtils.js.map +2 -2
  273. package/dist/esm/cli/lib/generateDocs.js +1 -1
  274. package/dist/esm/cli/lib/generateDocs.js.map +1 -1
  275. package/dist/esm/cli/lib/indexes.js.map +1 -1
  276. package/dist/esm/cli/lib/login.js +36 -4
  277. package/dist/esm/cli/lib/login.js.map +2 -2
  278. package/dist/esm/cli/lib/mcp/requestContext.js +5 -1
  279. package/dist/esm/cli/lib/mcp/requestContext.js.map +2 -2
  280. package/dist/esm/cli/lib/mcp/tools/env.js +10 -3
  281. package/dist/esm/cli/lib/mcp/tools/env.js.map +2 -2
  282. package/dist/esm/cli/lib/profileManagement.js +179 -0
  283. package/dist/esm/cli/lib/profileManagement.js.map +7 -0
  284. package/dist/esm/cli/lib/profiles.js +288 -0
  285. package/dist/esm/cli/lib/profiles.js.map +7 -0
  286. package/dist/esm/cli/lib/run.js +4 -0
  287. package/dist/esm/cli/lib/run.js.map +2 -2
  288. package/dist/esm/cli/lib/schemaEvaluation.js +39 -0
  289. package/dist/esm/cli/lib/schemaEvaluation.js.map +7 -0
  290. package/dist/esm/cli/lib/usageLimits.js +4 -2
  291. package/dist/esm/cli/lib/usageLimits.js.map +2 -2
  292. package/dist/esm/cli/lib/utils/mutex.js +9 -24
  293. package/dist/esm/cli/lib/utils/mutex.js.map +2 -2
  294. package/dist/esm/cli/lib/utils/utils.js +63 -27
  295. package/dist/esm/cli/lib/utils/utils.js.map +2 -2
  296. package/dist/esm/cli/login.js +225 -112
  297. package/dist/esm/cli/login.js.map +3 -3
  298. package/dist/esm/cli/logout.js +110 -13
  299. package/dist/esm/cli/logout.js.map +2 -2
  300. package/dist/esm/cli/mcp.js +34 -10
  301. package/dist/esm/cli/mcp.js.map +2 -2
  302. package/dist/esm/cli/program.js +2 -1
  303. package/dist/esm/cli/program.js.map +2 -2
  304. package/dist/esm/cli/projectCreate.js +1 -1
  305. package/dist/esm/cli/projectCreate.js.map +1 -1
  306. package/dist/esm/index.js +1 -1
  307. package/dist/esm/index.js.map +1 -1
  308. package/dist/esm/server/impl/actions_impl.js +7 -3
  309. package/dist/esm/server/impl/actions_impl.js.map +2 -2
  310. package/dist/esm/server/impl/storage_impl.js +29 -0
  311. package/dist/esm/server/impl/storage_impl.js.map +2 -2
  312. package/dist/esm/server/index.js +4 -1
  313. package/dist/esm/server/index.js.map +2 -2
  314. package/dist/esm/server/schema.js +34 -12
  315. package/dist/esm/server/schema.js.map +2 -2
  316. package/dist/esm/values/validators.js +1 -1
  317. package/dist/esm/values/validators.js.map +2 -2
  318. package/dist/esm/values/value.js +6 -0
  319. package/dist/esm/values/value.js.map +2 -2
  320. package/dist/esm-types/bundler/context.d.ts +5 -0
  321. package/dist/esm-types/bundler/context.d.ts.map +1 -1
  322. package/dist/esm-types/bundler/fs.d.ts +7 -2
  323. package/dist/esm-types/bundler/fs.d.ts.map +1 -1
  324. package/dist/esm-types/bundler/index.d.ts +9 -2
  325. package/dist/esm-types/bundler/index.d.ts.map +1 -1
  326. package/dist/esm-types/cli/account.d.ts +6 -0
  327. package/dist/esm-types/cli/account.d.ts.map +1 -0
  328. package/dist/esm-types/cli/codegen.d.ts.map +1 -1
  329. package/dist/esm-types/cli/configure.d.ts +6 -0
  330. package/dist/esm-types/cli/configure.d.ts.map +1 -1
  331. package/dist/esm-types/cli/deploy.d.ts +2 -0
  332. package/dist/esm-types/cli/deploy.d.ts.map +1 -1
  333. package/dist/esm-types/cli/deploymentCreate.d.ts +6 -6
  334. package/dist/esm-types/cli/deploymentSelect.d.ts.map +1 -1
  335. package/dist/esm-types/cli/dev.d.ts +1 -0
  336. package/dist/esm-types/cli/dev.d.ts.map +1 -1
  337. package/dist/esm-types/cli/env.d.ts.map +1 -1
  338. package/dist/esm-types/cli/envDefault.d.ts.map +1 -1
  339. package/dist/esm-types/cli/generatedApi.d.ts +1 -1
  340. package/dist/esm-types/cli/generatedApi.d.ts.map +1 -1
  341. package/dist/esm-types/cli/lib/api.d.ts.map +1 -1
  342. package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
  343. package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
  344. package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts +5 -7
  345. package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
  346. package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts +4 -10
  347. package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -1
  348. package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
  349. package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
  350. package/dist/esm-types/cli/lib/codegen.d.ts +0 -3
  351. package/dist/esm-types/cli/lib/codegen.d.ts.map +1 -1
  352. package/dist/esm-types/cli/lib/command.d.ts +2 -0
  353. package/dist/esm-types/cli/lib/command.d.ts.map +1 -1
  354. package/dist/esm-types/cli/lib/components/definition/bundle.d.ts +13 -0
  355. package/dist/esm-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
  356. package/dist/esm-types/cli/lib/components.d.ts +4 -0
  357. package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
  358. package/dist/esm-types/cli/lib/config.d.ts +2 -1
  359. package/dist/esm-types/cli/lib/config.d.ts.map +1 -1
  360. package/dist/esm-types/cli/lib/deploy2.d.ts +2 -0
  361. package/dist/esm-types/cli/lib/deploy2.d.ts.map +1 -1
  362. package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts +460 -16
  363. package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -1
  364. package/dist/esm-types/cli/lib/deployKeyWarning.d.ts +3 -0
  365. package/dist/esm-types/cli/lib/deployKeyWarning.d.ts.map +1 -0
  366. package/dist/esm-types/cli/lib/deployment.d.ts +2 -0
  367. package/dist/esm-types/cli/lib/deployment.d.ts.map +1 -1
  368. package/dist/esm-types/cli/lib/deploymentSelection.d.ts +2 -1
  369. package/dist/esm-types/cli/lib/deploymentSelection.d.ts.map +1 -1
  370. package/dist/esm-types/cli/lib/dev.d.ts +1 -0
  371. package/dist/esm-types/cli/lib/dev.d.ts.map +1 -1
  372. package/dist/esm-types/cli/lib/envvars.d.ts +6 -0
  373. package/dist/esm-types/cli/lib/envvars.d.ts.map +1 -1
  374. package/dist/esm-types/cli/lib/formatValidationProgress.d.ts +8 -0
  375. package/dist/esm-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
  376. package/dist/esm-types/cli/lib/fsUtils.d.ts +1 -0
  377. package/dist/esm-types/cli/lib/fsUtils.d.ts.map +1 -1
  378. package/dist/esm-types/cli/lib/login.d.ts +3 -1
  379. package/dist/esm-types/cli/lib/login.d.ts.map +1 -1
  380. package/dist/esm-types/cli/lib/mcp/requestContext.d.ts.map +1 -1
  381. package/dist/esm-types/cli/lib/mcp/tools/env.d.ts +8 -5
  382. package/dist/esm-types/cli/lib/mcp/tools/env.d.ts.map +1 -1
  383. package/dist/esm-types/cli/lib/mcp/tools/insights.d.ts +2 -2
  384. package/dist/esm-types/cli/lib/profileManagement.d.ts +10 -0
  385. package/dist/esm-types/cli/lib/profileManagement.d.ts.map +1 -0
  386. package/dist/esm-types/cli/lib/profiles.d.ts +59 -0
  387. package/dist/esm-types/cli/lib/profiles.d.ts.map +1 -0
  388. package/dist/esm-types/cli/lib/run.d.ts.map +1 -1
  389. package/dist/esm-types/cli/lib/schemaEvaluation.d.ts +33 -0
  390. package/dist/esm-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
  391. package/dist/esm-types/cli/lib/usageLimits.d.ts +1 -1
  392. package/dist/esm-types/cli/lib/usageLimits.d.ts.map +1 -1
  393. package/dist/esm-types/cli/lib/utils/mutex.d.ts +1 -3
  394. package/dist/esm-types/cli/lib/utils/mutex.d.ts.map +1 -1
  395. package/dist/esm-types/cli/lib/utils/utils.d.ts +15 -2
  396. package/dist/esm-types/cli/lib/utils/utils.d.ts.map +1 -1
  397. package/dist/esm-types/cli/login.d.ts +21 -0
  398. package/dist/esm-types/cli/login.d.ts.map +1 -1
  399. package/dist/esm-types/cli/logout.d.ts +8 -1
  400. package/dist/esm-types/cli/logout.d.ts.map +1 -1
  401. package/dist/esm-types/cli/mcp.d.ts.map +1 -1
  402. package/dist/esm-types/cli/program.d.ts.map +1 -1
  403. package/dist/esm-types/index.d.ts +1 -1
  404. package/dist/esm-types/index.d.ts.map +1 -1
  405. package/dist/esm-types/server/impl/actions_impl.d.ts +18 -3
  406. package/dist/esm-types/server/impl/actions_impl.d.ts.map +1 -1
  407. package/dist/esm-types/server/impl/storage_impl.d.ts.map +1 -1
  408. package/dist/esm-types/server/index.d.ts +1 -1
  409. package/dist/esm-types/server/index.d.ts.map +1 -1
  410. package/dist/esm-types/server/meta.d.ts +63 -0
  411. package/dist/esm-types/server/meta.d.ts.map +1 -1
  412. package/dist/esm-types/server/registration.d.ts +10 -0
  413. package/dist/esm-types/server/registration.d.ts.map +1 -1
  414. package/dist/esm-types/server/schema.d.ts +33 -0
  415. package/dist/esm-types/server/schema.d.ts.map +1 -1
  416. package/dist/esm-types/server/storage.d.ts.map +1 -1
  417. package/dist/esm-types/values/value.d.ts.map +1 -1
  418. package/dist/react.bundle.js +7 -1
  419. package/dist/react.bundle.js.map +2 -2
  420. package/package.json +5 -5
  421. package/schemas/convex.schema.json +5 -5
  422. package/src/bundler/context.ts +9 -5
  423. package/src/bundler/fs.ts +54 -5
  424. package/src/bundler/index.ts +9 -4
  425. package/src/cli/account.ts +320 -0
  426. package/src/cli/codegen.ts +0 -2
  427. package/src/cli/configure.ts +45 -9
  428. package/src/cli/deploy.ts +36 -5
  429. package/src/cli/deploymentSelect.ts +7 -4
  430. package/src/cli/dev.ts +9 -0
  431. package/src/cli/env.ts +12 -6
  432. package/src/cli/envDefault.ts +8 -2
  433. package/src/cli/generatedApi.ts +1 -1
  434. package/src/cli/lib/api.ts +5 -1
  435. package/src/cli/lib/checkForLargeIndexBackfill.ts +173 -0
  436. package/src/cli/lib/checkForLargeIndexDeletion.ts +45 -58
  437. package/src/cli/lib/checkForSlowSchemaValidation.ts +76 -65
  438. package/src/cli/lib/checkForStagedValidatorDeletion.ts +104 -0
  439. package/src/cli/lib/codegen.ts +0 -3
  440. package/src/cli/lib/command.ts +3 -0
  441. package/src/cli/lib/components/definition/bundle.ts +68 -14
  442. package/src/cli/lib/components.ts +71 -4
  443. package/src/cli/lib/config.ts +85 -18
  444. package/src/cli/lib/deploy2.ts +10 -1
  445. package/src/cli/lib/deployApi/evaluateSchema.ts +35 -0
  446. package/src/cli/lib/deployKeyWarning.ts +43 -0
  447. package/src/cli/lib/deployment.ts +2 -2
  448. package/src/cli/lib/deploymentSelection.ts +37 -18
  449. package/src/cli/lib/dev.ts +14 -0
  450. package/src/cli/lib/envvars.ts +43 -1
  451. package/src/cli/lib/formatValidationProgress.ts +35 -0
  452. package/src/cli/lib/fsUtils.ts +5 -2
  453. package/src/cli/lib/generateDocs.ts +1 -1
  454. package/src/cli/lib/indexes.ts +1 -1
  455. package/src/cli/lib/login.ts +47 -3
  456. package/src/cli/lib/mcp/requestContext.ts +7 -1
  457. package/src/cli/lib/mcp/tools/env.ts +17 -3
  458. package/src/cli/lib/profileManagement.ts +262 -0
  459. package/src/cli/lib/profiles.ts +398 -0
  460. package/src/cli/lib/run.ts +2 -0
  461. package/src/cli/lib/schemaEvaluation.ts +88 -0
  462. package/src/cli/lib/usageLimits.ts +2 -0
  463. package/src/cli/lib/utils/mutex.ts +9 -27
  464. package/src/cli/lib/utils/utils.ts +83 -36
  465. package/src/cli/login.ts +293 -168
  466. package/src/cli/logout.ts +142 -17
  467. package/src/cli/mcp.ts +48 -11
  468. package/src/cli/program.ts +2 -0
  469. package/src/cli/projectCreate.ts +1 -1
  470. package/src/index.ts +1 -1
  471. package/src/server/impl/actions_impl.ts +26 -6
  472. package/src/server/impl/storage_impl.ts +30 -0
  473. package/src/server/index.ts +5 -1
  474. package/src/server/meta.ts +56 -2
  475. package/src/server/registration.ts +10 -0
  476. package/src/server/schema.ts +37 -15
  477. package/src/server/storage.ts +17 -0
  478. package/src/values/validators.ts +1 -1
  479. package/src/values/value.ts +9 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "convex",
3
3
  "description": "Client for the Convex Cloud",
4
- "version": "1.46.0",
4
+ "version": "1.48.0-alpha.0",
5
5
  "author": "Convex, Inc. <no-reply@convex.dev>",
6
6
  "homepage": "https://convex.dev",
7
7
  "repository": {
@@ -204,7 +204,7 @@
204
204
  "@babel/types": "^7.27.1",
205
205
  "@clerk/react": "^6.4.3",
206
206
  "@commander-js/extra-typings": "^14.0.0",
207
- "@convex-dev/platform": "0.1.10",
207
+ "@convex-dev/platform": "0.1.11",
208
208
  "@eslint/compat": "~2.0.0",
209
209
  "@eslint/eslintrc": "^3",
210
210
  "@eslint/js": "~9.39.0",
@@ -228,7 +228,7 @@
228
228
  "@types/serve-handler": "~6.1.4",
229
229
  "@types/ws": "^8.5.13",
230
230
  "@vitest/eslint-plugin": "~1.6.0",
231
- "adm-zip": "^0.6.0",
231
+ "adm-zip": "^0.6.1",
232
232
  "bufferutil": "^4.0.7",
233
233
  "chalk": "5",
234
234
  "chokidar": "3.6.0",
@@ -269,7 +269,7 @@
269
269
  "typedoc": "^0.24.6",
270
270
  "typescript": "~5.0.3",
271
271
  "typescript-eslint": "~8.57.0",
272
- "undici": "7.29.0",
272
+ "undici": "7.29.1",
273
273
  "vitest": "^4.1.0",
274
274
  "wait-for-expect": "~4.0.0",
275
275
  "zod": "^3.24.0",
@@ -280,7 +280,7 @@
280
280
  "node": ">=20.0.0"
281
281
  },
282
282
  "scripts": {
283
- "build": "npm run generateApiSpec && python3 scripts/build.py 2>&1",
283
+ "build": "npm run generateApiSpec && uv run --script scripts/build.py 2>&1",
284
284
  "bundle-server": "node scripts/bundle-server.mjs",
285
285
  "clean": "shx rm -rf dist tmpDist*",
286
286
  "lint": "eslint . --cache",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
- "description": "Configuration schema for Convex project settings.\n\nDocumentation: https://docs.convex.dev/production/project-configuration#convexjson",
3
+ "description": "Configuration schema for Convex project settings.\n\nDocumentation: https://docs.convex.dev/config/convex.json",
4
4
  "type": "object",
5
5
  "definitions": {
6
6
  "authKitConfigureSettings": {
@@ -123,7 +123,7 @@
123
123
  },
124
124
  "nodeVersion": {
125
125
  "type": "string",
126
- "description": "The Node.js version to use for Node.js actions. The currently supported values are '20', '22', and '24'.\n\nDocumentation: https://docs.convex.dev/production/project-configuration#configuring-the-nodejs-version",
126
+ "description": "The Node.js version to use for Node.js actions. The currently supported values are '20', '22', and '24'.\n\nDocumentation: https://docs.convex.dev/config/convex.json#configuring-the-nodejs-version",
127
127
  "default": "20"
128
128
  }
129
129
  }
@@ -135,7 +135,7 @@
135
135
  },
136
136
  "functions": {
137
137
  "type": "string",
138
- "description": "Path to the directory containing Convex functions. You can customize this to use a different location than the default 'convex/' directory.\n\nDocumentation: https://docs.convex.dev/production/project-configuration#changing-the-convex-folder-name-or-location",
138
+ "description": "Path to the directory containing Convex functions. You can customize this to use a different location than the default 'convex/' directory.\n\nDocumentation: https://docs.convex.dev/config/convex.json#changing-the-convex-folder-name-or-location",
139
139
  "default": "convex/"
140
140
  },
141
141
  "codegen": {
@@ -155,12 +155,12 @@
155
155
  },
156
156
  "staticApi": {
157
157
  "type": "boolean",
158
- "description": "When true, generates static `api.d.ts` files, which improves autocomplete and incremental typechecking performance in large codebases.\n\nDocumentation: https://docs.convex.dev/production/project-configuration#using-static-code-generation-beta",
158
+ "description": "When true, generates static `api.d.ts` files, which improves autocomplete and incremental typechecking performance in large codebases.\n\nDocumentation: https://docs.convex.dev/config/convex.json#using-static-code-generation-beta",
159
159
  "default": false
160
160
  },
161
161
  "staticDataModel": {
162
162
  "type": "boolean",
163
- "description": "When true, generates static `dataModel.d.ts` files, which improves autocomplete and incremental typechecking performance in large codebases.\n\nDocumentation: https://docs.convex.dev/production/project-configuration#using-static-code-generation-beta",
163
+ "description": "When true, generates static `dataModel.d.ts` files, which improves autocomplete and incremental typechecking performance in large codebases.\n\nDocumentation: https://docs.convex.dev/config/convex.json#using-static-code-generation-beta",
164
164
  "default": false
165
165
  }
166
166
  }
@@ -54,6 +54,7 @@ export type BigBrainAuth = {
54
54
  | {
55
55
  kind: "accessToken";
56
56
  accessToken: string;
57
+ profile?: { name: string; source: string } | null;
57
58
  }
58
59
  );
59
60
 
@@ -190,16 +191,19 @@ export const oneoffContext: (args: {
190
191
  url?: string | undefined;
191
192
  adminKey?: string | undefined;
192
193
  envFile?: string | undefined;
194
+ skipAuth?: boolean;
193
195
  }) => Promise<OneoffCtx> = async (args) => {
194
196
  const ctx = new OneoffContextImpl();
195
197
  await detectSuspiciousEnvironmentVariables(
196
198
  ctx,
197
199
  !!process.env.CONVEX_IGNORE_SUSPICIOUS_ENV_VARS,
198
200
  );
199
- await initializeBigBrainAuth(ctx, {
200
- url: args.url,
201
- adminKey: args.adminKey,
202
- envFile: args.envFile,
203
- });
201
+ if (!args.skipAuth) {
202
+ await initializeBigBrainAuth(ctx, {
203
+ url: args.url,
204
+ adminKey: args.adminKey,
205
+ envFile: args.envFile,
206
+ });
207
+ }
204
208
  return ctx;
205
209
  };
package/src/bundler/fs.ts CHANGED
@@ -63,6 +63,7 @@ export interface Filesystem {
63
63
 
64
64
  exists(path: string): boolean;
65
65
  stat(path: string): Stats;
66
+ lstat(path: string): Stats;
66
67
  readUtf8File(path: string): string;
67
68
  // createReadStream returns a stream for which [Symbol.asyncIterator]
68
69
  // yields chunks of size highWaterMark (until the last one), or 64KB if
@@ -153,6 +154,9 @@ export class NodeFs implements Filesystem {
153
154
  stat(path: string) {
154
155
  return stdFs.statSync(path);
155
156
  }
157
+ lstat(path: string) {
158
+ return stdFs.lstatSync(path);
159
+ }
156
160
  readUtf8File(path: string) {
157
161
  return stdFs.readFileSync(path, { encoding: "utf-8" });
158
162
  }
@@ -260,6 +264,9 @@ export class RecordingFs implements Filesystem {
260
264
  // Absolute path -> observed stat (or null if observed nonexistent)
261
265
  private observedFiles: Map<string, Stats | null> = new Map();
262
266
 
267
+ // lstat observes the link itself, while stat observes its target.
268
+ private observedLstats: Map<string, Stats | null> = new Map();
269
+
263
270
  // Have we noticed that files have changed while recording?
264
271
  private invalidated = false;
265
272
 
@@ -305,6 +312,20 @@ export class RecordingFs implements Filesystem {
305
312
  return entries;
306
313
  }
307
314
 
315
+ lstat(filePath: string): Stats {
316
+ const absPath = path.resolve(filePath);
317
+ try {
318
+ const st = nodeFs.lstat(filePath);
319
+ this.registerNormalized(absPath, st, this.observedLstats);
320
+ return st;
321
+ } catch (err: any) {
322
+ if (err.code === "ENOENT") {
323
+ this.registerNormalized(absPath, null, this.observedLstats);
324
+ }
325
+ throw err;
326
+ }
327
+ }
328
+
308
329
  exists(path: string): boolean {
309
330
  try {
310
331
  const st = nodeFs.stat(path);
@@ -419,6 +440,8 @@ export class RecordingFs implements Filesystem {
419
440
  const newSt = nodeFs.stat(absPath);
420
441
  // Skip invalidation checking since we don't want to conflict if we previously read this file.
421
442
  this.observedFiles.set(absPath, newSt);
443
+ if (this.observedLstats.has(absPath))
444
+ this.observedLstats.set(absPath, nodeFs.lstat(absPath));
422
445
 
423
446
  // If we observed the parent, add our newly created file.
424
447
  const parentPath = path.resolve(path.dirname(absPath));
@@ -430,6 +453,8 @@ export class RecordingFs implements Filesystem {
430
453
  private updateOnDelete(absPath: string) {
431
454
  // Expect this file to be gone.
432
455
  this.observedFiles.set(absPath, null);
456
+ if (this.observedLstats.has(absPath))
457
+ this.observedLstats.set(absPath, null);
433
458
 
434
459
  // Unlink it from our parent if observed.
435
460
  const parentPath = path.resolve(path.dirname(absPath));
@@ -448,8 +473,12 @@ export class RecordingFs implements Filesystem {
448
473
  this.invalidated = true;
449
474
  }
450
475
 
451
- registerNormalized(absPath: string, observed: Stats | null): void {
452
- const existing = this.observedFiles.get(absPath);
476
+ registerNormalized(
477
+ absPath: string,
478
+ observed: Stats | null,
479
+ observations = this.observedFiles,
480
+ ): void {
481
+ const existing = observations.get(absPath);
453
482
  if (existing !== undefined) {
454
483
  const stMatch = stMatches(observed, existing);
455
484
  if (!stMatch.matches) {
@@ -466,14 +495,18 @@ export class RecordingFs implements Filesystem {
466
495
  this.invalidated = true;
467
496
  }
468
497
  }
469
- this.observedFiles.set(absPath, observed);
498
+ observations.set(absPath, observed);
470
499
  }
471
500
 
472
501
  finalize(): Observations | "invalidated" {
473
502
  if (this.invalidated) {
474
503
  return "invalidated";
475
504
  }
476
- return new Observations(this.observedDirectories, this.observedFiles);
505
+ return new Observations(
506
+ this.observedDirectories,
507
+ this.observedFiles,
508
+ this.observedLstats,
509
+ );
477
510
  }
478
511
  }
479
512
 
@@ -489,6 +522,7 @@ export class Observations {
489
522
  constructor(
490
523
  directories: Map<string, Set<string>>,
491
524
  files: Map<string, Stats | null>,
525
+ private lstats: Map<string, Stats | null> = new Map(),
492
526
  ) {
493
527
  this.directories = directories;
494
528
  this.files = files;
@@ -502,7 +536,8 @@ export class Observations {
502
536
  for (const path of this.files.keys()) {
503
537
  out.push(path);
504
538
  }
505
- return out;
539
+ for (const path of this.lstats.keys()) out.push(path);
540
+ return [...new Set(out)];
506
541
  }
507
542
 
508
543
  overlaps({
@@ -529,6 +564,20 @@ export class Observations {
529
564
  }
530
565
  }
531
566
 
567
+ const observedLstat = this.lstats.get(absPath);
568
+ if (observedLstat !== undefined) {
569
+ let currentLstat: Stats | null;
570
+ try {
571
+ currentLstat = nodeFs.lstat(absPath);
572
+ } catch (err: any) {
573
+ if (err.code !== "ENOENT") throw err;
574
+ currentLstat = null;
575
+ }
576
+ const match = stMatches(observedLstat, currentLstat);
577
+ if (!match.matches)
578
+ return { overlaps: true, reason: `modified (${match.reason})` };
579
+ }
580
+
532
581
  // Second, check if we listed the directory this file is in.
533
582
  const parentPath = path.resolve(path.dirname(absPath));
534
583
  const observedParent = this.directories.get(parentPath);
@@ -205,6 +205,7 @@ export async function bundle({
205
205
  modules: Bundle[];
206
206
  externalDependencies: Map<string, string>;
207
207
  bundledModuleNames: Set<string>;
208
+ metafile: esbuild.Metafile | null;
208
209
  }> {
209
210
  const availableExternalPackages = await computeExternalPackages(
210
211
  ctx,
@@ -264,6 +265,7 @@ export async function bundle({
264
265
  result.externalModuleNames,
265
266
  ),
266
267
  bundledModuleNames: result.bundledModuleNames,
268
+ metafile: result.metafile ?? null,
267
269
  };
268
270
  }
269
271
 
@@ -321,10 +323,13 @@ export async function bundleSchema(
321
323
  platform: "browser",
322
324
  extraConditions,
323
325
  });
324
- return result.modules;
326
+ return { modules: result.modules, metafile: result.metafile };
325
327
  }
326
328
 
327
- export async function bundleAuthConfig(ctx: Context, dir: string) {
329
+ export async function bundleAuthConfig(
330
+ ctx: Context,
331
+ dir: string,
332
+ ): Promise<{ modules: Bundle[]; metafile: esbuild.Metafile | null }> {
328
333
  const authConfigPath = path.resolve(dir, "auth.config.js");
329
334
  const authConfigTsPath = path.resolve(dir, "auth.config.ts");
330
335
  if (ctx.fs.exists(authConfigPath) && ctx.fs.exists(authConfigTsPath)) {
@@ -343,7 +348,7 @@ export async function bundleAuthConfig(ctx: Context, dir: string) {
343
348
  `Found no auth config file at ${authConfigTsPath} or ${authConfigPath} so there are no configured auth providers`,
344
349
  ),
345
350
  );
346
- return [];
351
+ return { modules: [], metafile: null };
347
352
  }
348
353
  logVerbose(chalkStderr.yellow(`Bundling auth config found at ${chosenPath}`));
349
354
  const result = await bundle({
@@ -355,7 +360,7 @@ export async function bundleAuthConfig(ctx: Context, dir: string) {
355
360
  // The auth config must be one module
356
361
  splitting: false,
357
362
  });
358
- return result.modules;
363
+ return { modules: result.modules, metafile: result.metafile };
359
364
  }
360
365
 
361
366
  export async function doesImportConvexHttpRouter(source: string) {
@@ -0,0 +1,320 @@
1
+ import { Command } from "@commander-js/extra-typings";
2
+ import path from "path";
3
+ import { createLoginCommand } from "./login.js";
4
+ import { createLogoutCommand } from "./logout.js";
5
+ import { Context, oneoffContext } from "../bundler/context.js";
6
+ import {
7
+ logFinishedStep,
8
+ logMessage,
9
+ logOutput,
10
+ logWarning,
11
+ } from "../bundler/log.js";
12
+ import { loadProjectEnvironmentVariables } from "./lib/envvars.js";
13
+ import { isAuthorizedHeader, performLogin } from "./lib/login.js";
14
+ import {
15
+ getProfileSelection,
16
+ initializeDefaultProfile,
17
+ readProfileAuth,
18
+ readProfileCredentials,
19
+ readProfileSettings,
20
+ savedProfileNames,
21
+ validateProfileName,
22
+ updateProfileSettings,
23
+ } from "./lib/profiles.js";
24
+ import {
25
+ bindProfileToDirectory,
26
+ projectAccess,
27
+ } from "./lib/profileManagement.js";
28
+ import { warnIfDeployKeyOverridesLogin } from "./lib/deployKeyWarning.js";
29
+ import { ProjectSelection } from "./lib/deploymentSelection.js";
30
+ import { promptOptions, promptString } from "./lib/utils/prompts.js";
31
+
32
+ async function profileContext() {
33
+ const ctx = await oneoffContext({ skipAuth: true });
34
+ loadProjectEnvironmentVariables();
35
+ return ctx;
36
+ }
37
+
38
+ const profileList = new Command("list")
39
+ .description(
40
+ "List saved accounts, credential status, and directory selections",
41
+ )
42
+ .allowExcessArguments(false)
43
+ .action(async () => {
44
+ const ctx = await profileContext();
45
+ const settings = await readProfileSettings(ctx);
46
+ const selected = await getProfileSelection(ctx);
47
+ const names = new Set([
48
+ ...savedProfileNames(ctx),
49
+ ...Object.values(settings.directories ?? {}),
50
+ ...(settings.defaultProfile === undefined
51
+ ? []
52
+ : [settings.defaultProfile]),
53
+ ...(selected === null ? [] : [selected.name]),
54
+ ]);
55
+ warnIfDeployKeyOverridesLogin(
56
+ ctx,
57
+ typeof settings.accessToken === "string" ||
58
+ savedProfileNames(ctx).length > 0,
59
+ );
60
+ if (names.size === 0) {
61
+ logMessage(
62
+ typeof settings.accessToken === "string"
63
+ ? (await isAuthorizedHeader(ctx, `Bearer ${settings.accessToken}`))
64
+ ? "Logged in without a named account. Name this login with `npx convex login --account personal --select`."
65
+ : "Your saved login is no longer valid. Run `npx convex login --account <name>`."
66
+ : "No saved accounts. Run `npx convex login --account <name>`.",
67
+ );
68
+ return;
69
+ }
70
+ if (selected !== null)
71
+ logMessage(`Selected account: ${selected.name} (${selected.source})`);
72
+ if (settings.defaultProfile !== undefined)
73
+ logMessage(`Default account: ${settings.defaultProfile}`);
74
+ for (const name of [...names].sort()) {
75
+ const credentials = await readProfileCredentials(
76
+ ctx,
77
+ { name, source: "saved accounts" },
78
+ true,
79
+ );
80
+ const valid =
81
+ credentials !== null &&
82
+ (await isAuthorizedHeader(ctx, `Bearer ${credentials.accessToken}`));
83
+ const label = `${name}${credentials?.email ? ` (${credentials.email})` : ""}`;
84
+ const status =
85
+ credentials === null
86
+ ? " ⚠️ Not logged in"
87
+ : valid
88
+ ? ""
89
+ : " ⚠️ Invalid credentials";
90
+ logOutput(`${label}${status}`);
91
+ for (const [directory, profile] of Object.entries(
92
+ settings.directories ?? {},
93
+ )) {
94
+ if (profile === name) logOutput(` ${directory}`);
95
+ }
96
+ }
97
+ });
98
+
99
+ const accountSelect = new Command("select")
100
+ .description("Use a saved account in this directory and its subdirectories")
101
+ .argument("<account>", "Account name, such as work or personal")
102
+ .option(
103
+ "--force",
104
+ "Select this account even if deployment access cannot be verified",
105
+ )
106
+ .allowExcessArguments(false)
107
+ .action(async (name, options) => {
108
+ const ctx = await profileContext();
109
+ if (!(await bindProfileToDirectory(ctx, name, options.force))) {
110
+ await ctx.crash({
111
+ exitCode: 1,
112
+ errorType: "fatal",
113
+ printedMessage: null,
114
+ });
115
+ }
116
+ });
117
+
118
+ const profileDefault = new Command("default")
119
+ .description(
120
+ "Show or set the default account for directories without a directory selection",
121
+ )
122
+ .argument("[account]", "Account name")
123
+ .allowExcessArguments(false)
124
+ .action(async (name) => {
125
+ const ctx = await profileContext();
126
+ if (name === undefined) {
127
+ const settings = await readProfileSettings(ctx);
128
+ logOutput(
129
+ settings.defaultProfile === undefined
130
+ ? "No default account is set."
131
+ : `Default account: ${settings.defaultProfile}`,
132
+ );
133
+ return;
134
+ }
135
+ await updateProfileSettings(ctx, async (settings) => {
136
+ const credentials = await readProfileCredentials(ctx, {
137
+ name,
138
+ source: "account default",
139
+ });
140
+ settings.defaultProfile = name;
141
+ settings.accessToken = credentials!.accessToken;
142
+ });
143
+ logFinishedStep(`Default account: ${name}`);
144
+ });
145
+
146
+ const accountDeselect = new Command("deselect")
147
+ .description(
148
+ "Clear this directory's account selection, inheriting its parent's selection or the default",
149
+ )
150
+ .allowExcessArguments(false)
151
+ .action(async () => {
152
+ const ctx = await profileContext();
153
+ const directory = path.resolve(process.cwd());
154
+ const removed = await updateProfileSettings(ctx, (settings) => {
155
+ if (
156
+ settings.directories &&
157
+ Object.hasOwn(settings.directories, directory)
158
+ ) {
159
+ delete settings.directories[directory];
160
+ return true;
161
+ }
162
+ return false;
163
+ });
164
+ if (removed)
165
+ logFinishedStep(`Removed the directory selection for ${directory}.`);
166
+ else logMessage(`No directory selection is saved for ${directory}.`);
167
+ const selected = await getProfileSelection(ctx);
168
+ if (selected !== null)
169
+ logMessage(`Selected account: ${selected.name} (${selected.source})`);
170
+ });
171
+
172
+ const profileSettings = new Command("settings")
173
+ .summary("Show or change account settings")
174
+ .description(
175
+ "Show or change account settings.\n\n" +
176
+ "Renewing an account login revokes its replaced personal access token unless another saved login uses it. To keep replaced tokens active, run:\n\n" +
177
+ " `npx convex@latest account settings revoke-replaced-tokens false`",
178
+ )
179
+ .argument("[name]", "revoke-replaced-tokens")
180
+ .argument("[value]", "true or false")
181
+ .allowExcessArguments(false)
182
+ .action(async (name, value, _options, cmd) => {
183
+ const ctx = await profileContext();
184
+ const settings = await readProfileSettings(ctx);
185
+ if (name === undefined && value === undefined) {
186
+ logOutput(
187
+ `revoke-replaced-tokens: ${settings.revokeReplacedTokens ?? true}`,
188
+ );
189
+ return;
190
+ }
191
+ if (
192
+ name !== "revoke-replaced-tokens" ||
193
+ (value !== "true" && value !== "false")
194
+ ) {
195
+ cmd.error(
196
+ "Usage: npx convex account settings revoke-replaced-tokens <true|false>",
197
+ );
198
+ }
199
+ await updateProfileSettings(ctx, (settings) => {
200
+ settings.revokeReplacedTokens = value === "true";
201
+ });
202
+ logFinishedStep(`Set revoke-replaced-tokens to ${value}.`);
203
+ });
204
+
205
+ export const account = new Command("account")
206
+ .summary("Manage saved accounts and their directory selections")
207
+ .description(
208
+ "Manage saved accounts and their directory selections.\n\n" +
209
+ "Save logins for multiple Convex accounts under names such as work and personal. `npx convex@latest account login` and `npx convex@latest account logout` are aliases for the top-level login and logout commands, with the same options. Select the appropriate account for each personal, work, or client project.\n\n" +
210
+ "In your personal project directory, save an account:\n\n" +
211
+ " `npx convex@latest login --account personal --select`\n\n" +
212
+ "In your work project directory, log in with your work account and check its teams:\n\n" +
213
+ " `npx convex@latest login --account work --select`\n" +
214
+ " `npx convex@latest login status`\n\n" +
215
+ "Choose the appropriate account in the browser; sign out of the dashboard first if it is using another account. Upgrade each project's `convex` dependency to a version that supports saved accounts, then run `npx convex dev` to develop with its selected account.\n\n" +
216
+ "`login --account` saves credentials without changing directory selections. Add `--select` to select the account for this directory and its subdirectories after checking deployment access. The first saved account becomes the default if no other account is saved. To select a saved account in another directory, run `npx convex@latest account select work`. Run `npx convex@latest account deselect` to remove this directory's selection and inherit its parent or default. Run `npx convex@latest account default` to show the default, or `npx convex@latest account default work` to change it. The closest directory selection wins. Selections use absolute paths, so select the account again after moving a project.\n\n" +
217
+ "The first account name is assigned to your existing login if you are already logged in, and becomes the default for directories without a selection. Use `--force` to authenticate another account instead, keeping the existing login as the default. Names start with a lowercase letter or number and contain only lowercase letters, numbers, hyphens, and underscores.\n\n" +
218
+ "`CONVEX_ACCOUNT` in the shell or project env file overrides directory selections and the default account. Deployment and project keys take priority over saved accounts.\n\n" +
219
+ "Use `npx convex@latest logout --account work` to remove one account's credentials, or `npx convex@latest logout --all` to remove all saved credentials. Logout preserves directory selections; a logged-out account requires login before use.\n\n" +
220
+ "After saving accounts, use `npx convex@latest` for login, logout, and account commands in every project directory on this machine. Plain `npx convex` can run the older version installed in that project. Specifying `@latest` runs the latest published CLI without updating the project's dependency.\n\n" +
221
+ "Older CLIs ignore directory selections and `CONVEX_ACCOUNT`, using the shared login instead (normally the default account). Upgrade the project's `convex` dependency to use saved accounts with project commands such as `npx convex dev` and `npx convex deploy`.\n\n" +
222
+ "Logging in with an older CLI can change the shared login independently of your saved accounts, or discard account settings if the shared login has been removed. Logging out with an older CLI deletes directory selections and the default selection but leaves named account credentials behind. Recreate any lost selections with `npx convex@latest account select <name>` and `npx convex@latest account default <name>`.\n\n" +
223
+ "Renewing an account login can revoke its previous token and interrupt running CLI processes of any version that still use it. Restart those commands after renewing the login, or keep replaced tokens active with `npx convex@latest account settings revoke-replaced-tokens false`.",
224
+ )
225
+ .addCommand(profileList)
226
+ .addCommand(accountSelect)
227
+ .addCommand(profileDefault)
228
+ .addCommand(accountDeselect)
229
+ .addCommand(profileSettings)
230
+ .addCommand(createLoginCommand())
231
+ .addCommand(createLogoutCommand())
232
+ .addHelpCommand(false);
233
+
234
+ export async function handleNoAccessToConfiguredProject(
235
+ ctx: Context,
236
+ target: ProjectSelection,
237
+ envFile?: string,
238
+ ): Promise<"retry" | "chooseProject"> {
239
+ const auth = ctx.bigBrainAuth();
240
+ const current = auth?.kind === "accessToken" ? auth.profile?.name : undefined;
241
+ const project =
242
+ target.kind === "deploymentName"
243
+ ? `deployment "${target.deploymentName}"`
244
+ : target.kind === "teamAndProjectSlugs"
245
+ ? `project "${target.teamSlug}/${target.projectSlug}"`
246
+ : "the configured project";
247
+ logWarning(
248
+ `${current ? `Account "${current}"` : "Your account"} cannot access ${project}. It may belong to another account.`,
249
+ );
250
+ const alternatives: string[] = [];
251
+ if (target.kind !== "projectDeployKey") {
252
+ for (const name of savedProfileNames(ctx)) {
253
+ if (name === current) continue;
254
+ const credentials = await readProfileCredentials(ctx, {
255
+ name,
256
+ source: "saved accounts",
257
+ });
258
+ if ((await projectAccess(credentials!.accessToken, target)) === "yes")
259
+ alternatives.push(name);
260
+ }
261
+ }
262
+ if (!process.stdin.isTTY) {
263
+ const selection = await getProfileSelection(ctx, { envFile });
264
+ const overrideHint = selection?.source.startsWith("CONVEX_ACCOUNT")
265
+ ? ` Update or unset CONVEX_ACCOUNT (${selection.source}) before retrying.`
266
+ : "";
267
+ return await ctx.crash({
268
+ exitCode: 1,
269
+ errorType: "fatal",
270
+ printedMessage: `${
271
+ alternatives.length > 0
272
+ ? `A saved account can access it: ${alternatives.map((name) => `\`npx convex account select ${name}\``).join(" or ")}.`
273
+ : "Log in to its account with `npx convex login --account <name> --select`."
274
+ }${overrideHint} To select a different project, run \`npx convex dev --configure\` (this changes CONVEX_DEPLOYMENT).`,
275
+ });
276
+ }
277
+ type Choice =
278
+ | { kind: "use"; name: string }
279
+ | { kind: "login" }
280
+ | { kind: "chooseProject" };
281
+ const choice = await promptOptions<Choice>(ctx, {
282
+ message: "Which account should this project use?",
283
+ choices: [
284
+ ...alternatives.map((name) => ({
285
+ name: `Use account "${name}"`,
286
+ value: { kind: "use", name } as const,
287
+ })),
288
+ { name: "Log in to another account", value: { kind: "login" } as const },
289
+ {
290
+ name: "Configure a different project (changes CONVEX_DEPLOYMENT)",
291
+ value: { kind: "chooseProject" } as const,
292
+ },
293
+ ],
294
+ });
295
+ if (choice.kind === "chooseProject") return "chooseProject";
296
+ const name =
297
+ choice.kind === "use"
298
+ ? choice.name
299
+ : await promptString(ctx, {
300
+ message: "Account name (for example, work):",
301
+ });
302
+ await validateProfileName(ctx, name);
303
+ if (choice.kind === "login") {
304
+ const selection = { name, source: "account recovery" };
305
+ await performLogin(ctx, { profile: selection });
306
+ await initializeDefaultProfile(ctx, selection, false);
307
+ }
308
+ if (!(await bindProfileToDirectory(ctx, name, false, target)))
309
+ return "chooseProject";
310
+ const selection = await getProfileSelection(ctx, { envFile });
311
+ if (selection?.name !== name) {
312
+ return await ctx.crash({
313
+ exitCode: 1,
314
+ errorType: "invalid filesystem or env vars",
315
+ printedMessage: `Remove the account override from ${selection?.source} before retrying.`,
316
+ });
317
+ }
318
+ ctx._updateBigBrainAuth(await readProfileAuth(ctx, selection));
319
+ return "retry";
320
+ }
@@ -67,8 +67,6 @@ export const codegen = new Command("codegen")
67
67
  liveComponentSources: !!options.liveComponentSources,
68
68
  debugNodeApis: false,
69
69
  systemUdfs: !!options.systemUdfs,
70
- largeIndexDeletionCheck: "no verification" as const, // `codegen` is a read-only operation
71
- warnOnSlowSchemaValidation: false, // ditto: a codegen dry run never deploys
72
70
  codegenOnlyThisComponent: options.componentDir,
73
71
  };
74
72