convex 1.45.0 → 1.47.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 (511) hide show
  1. package/CHANGELOG.md +105 -6
  2. package/dist/browser.bundle.js +7 -1
  3. package/dist/browser.bundle.js.map +2 -2
  4. package/dist/cjs/browser/http_client.js.map +2 -2
  5. package/dist/cjs/browser/query_options.js.map +2 -2
  6. package/dist/cjs/browser/simple_client.js.map +2 -2
  7. package/dist/cjs/browser/sync/optimistic_updates.js.map +1 -1
  8. package/dist/cjs/browser/sync/optimistic_updates_impl.js.map +2 -2
  9. package/dist/cjs/bundler/index.js +5 -4
  10. package/dist/cjs/bundler/index.js.map +2 -2
  11. package/dist/cjs/cli/codegen.js +0 -2
  12. package/dist/cjs/cli/codegen.js.map +2 -2
  13. package/dist/cjs/cli/configure.js +13 -4
  14. package/dist/cjs/cli/configure.js.map +2 -2
  15. package/dist/cjs/cli/deploy.js +28 -2
  16. package/dist/cjs/cli/deploy.js.map +2 -2
  17. package/dist/cjs/cli/deploymentSelect.js +2 -2
  18. package/dist/cjs/cli/deploymentSelect.js.map +2 -2
  19. package/dist/cjs/cli/dev.js +6 -0
  20. package/dist/cjs/cli/dev.js.map +2 -2
  21. package/dist/cjs/cli/docs.js +3 -36
  22. package/dist/cjs/cli/docs.js.map +2 -2
  23. package/dist/cjs/cli/env.js +10 -5
  24. package/dist/cjs/cli/env.js.map +2 -2
  25. package/dist/cjs/cli/envDefault.js +7 -2
  26. package/dist/cjs/cli/envDefault.js.map +2 -2
  27. package/dist/cjs/cli/generatedApi.js.map +1 -1
  28. package/dist/cjs/cli/lib/api.js +2 -0
  29. package/dist/cjs/cli/lib/api.js.map +2 -2
  30. package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js +113 -0
  31. package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
  32. package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js +100 -70
  33. package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
  34. package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js +126 -0
  35. package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js.map +7 -0
  36. package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js +90 -0
  37. package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
  38. package/dist/cjs/cli/lib/codegen.js.map +2 -2
  39. package/dist/cjs/cli/lib/command.js +2 -1
  40. package/dist/cjs/cli/lib/command.js.map +2 -2
  41. package/dist/cjs/cli/lib/components/definition/bundle.js +37 -11
  42. package/dist/cjs/cli/lib/components/definition/bundle.js.map +2 -2
  43. package/dist/cjs/cli/lib/components.js +56 -1
  44. package/dist/cjs/cli/lib/components.js.map +2 -2
  45. package/dist/cjs/cli/lib/config.js +56 -17
  46. package/dist/cjs/cli/lib/config.js.map +2 -2
  47. package/dist/cjs/cli/lib/deploy2.js +32 -3
  48. package/dist/cjs/cli/lib/deploy2.js.map +2 -2
  49. package/dist/cjs/cli/lib/deployApi/evaluateSchema.js +101 -0
  50. package/dist/cjs/cli/lib/deployApi/evaluateSchema.js.map +7 -0
  51. package/dist/cjs/cli/lib/deployApi/finishPush.js +1 -0
  52. package/dist/cjs/cli/lib/deployApi/finishPush.js.map +2 -2
  53. package/dist/cjs/cli/lib/deployApi/startPush.js +1 -1
  54. package/dist/cjs/cli/lib/deployApi/startPush.js.map +2 -2
  55. package/dist/cjs/cli/lib/dev.js +6 -0
  56. package/dist/cjs/cli/lib/dev.js.map +2 -2
  57. package/dist/cjs/cli/lib/formatValidationProgress.js +47 -0
  58. package/dist/cjs/cli/lib/formatValidationProgress.js.map +7 -0
  59. package/dist/cjs/cli/lib/generatedFunctionLogsApi.js.map +1 -1
  60. package/dist/cjs/cli/lib/indexes.js.map +1 -1
  61. package/dist/cjs/cli/lib/localDeployment/run.js +30 -1
  62. package/dist/cjs/cli/lib/localDeployment/run.js.map +2 -2
  63. package/dist/cjs/cli/lib/localDeployment/upgrade.js +6 -5
  64. package/dist/cjs/cli/lib/localDeployment/upgrade.js.map +2 -2
  65. package/dist/cjs/cli/lib/localDeployment/utils.js +5 -1
  66. package/dist/cjs/cli/lib/localDeployment/utils.js.map +2 -2
  67. package/dist/cjs/cli/lib/mcp/tools/env.js +10 -3
  68. package/dist/cjs/cli/lib/mcp/tools/env.js.map +2 -2
  69. package/dist/cjs/cli/lib/run.js +5 -0
  70. package/dist/cjs/cli/lib/run.js.map +2 -2
  71. package/dist/cjs/cli/lib/schemaEvaluation.js +62 -0
  72. package/dist/cjs/cli/lib/schemaEvaluation.js.map +7 -0
  73. package/dist/cjs/cli/lib/usageLimits.js +4 -2
  74. package/dist/cjs/cli/lib/usageLimits.js.map +2 -2
  75. package/dist/cjs/cli/lib/utils/mutex.js +9 -24
  76. package/dist/cjs/cli/lib/utils/mutex.js.map +2 -2
  77. package/dist/cjs/cli/lib/utils/utils.js +84 -47
  78. package/dist/cjs/cli/lib/utils/utils.js.map +2 -2
  79. package/dist/cjs/cli/projectCreate.js +1 -1
  80. package/dist/cjs/cli/projectCreate.js.map +1 -1
  81. package/dist/cjs/index.js +1 -1
  82. package/dist/cjs/index.js.map +1 -1
  83. package/dist/cjs/nextjs/index.js.map +2 -2
  84. package/dist/cjs/react/client.js.map +2 -2
  85. package/dist/cjs/react/hydration.js.map +2 -2
  86. package/dist/cjs/react/queries_observer.js.map +2 -2
  87. package/dist/cjs/react/use_paginated_query2.js.map +2 -2
  88. package/dist/cjs/react/use_queries.js.map +2 -2
  89. package/dist/cjs/server/api.js.map +2 -2
  90. package/dist/cjs/server/components/index.js.map +2 -2
  91. package/dist/cjs/server/cron.js +10 -10
  92. package/dist/cjs/server/cron.js.map +2 -2
  93. package/dist/cjs/server/impl/actions_impl.js +8 -3
  94. package/dist/cjs/server/impl/actions_impl.js.map +2 -2
  95. package/dist/cjs/server/impl/meta_impl.js +8 -2
  96. package/dist/cjs/server/impl/meta_impl.js.map +2 -2
  97. package/dist/cjs/server/impl/scheduler_impl.js.map +2 -2
  98. package/dist/cjs/server/impl/storage_impl.js +29 -0
  99. package/dist/cjs/server/impl/storage_impl.js.map +2 -2
  100. package/dist/cjs/server/index.js +1 -0
  101. package/dist/cjs/server/index.js.map +2 -2
  102. package/dist/cjs/server/meta.js.map +1 -1
  103. package/dist/cjs/server/registration.js.map +1 -1
  104. package/dist/cjs/server/scheduler.js.map +1 -1
  105. package/dist/cjs/server/schema.js +72 -3
  106. package/dist/cjs/server/schema.js.map +2 -2
  107. package/dist/cjs/server/storage.js.map +1 -1
  108. package/dist/cjs/values/validator.js +1 -1
  109. package/dist/cjs/values/validator.js.map +2 -2
  110. package/dist/cjs/values/validators.js +82 -26
  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/browser/http_client.d.ts +5 -5
  115. package/dist/cjs-types/browser/http_client.d.ts.map +1 -1
  116. package/dist/cjs-types/browser/query_options.d.ts +2 -2
  117. package/dist/cjs-types/browser/query_options.d.ts.map +1 -1
  118. package/dist/cjs-types/browser/simple_client.d.ts +6 -6
  119. package/dist/cjs-types/browser/simple_client.d.ts.map +1 -1
  120. package/dist/cjs-types/browser/sync/optimistic_updates.d.ts +4 -4
  121. package/dist/cjs-types/browser/sync/optimistic_updates.d.ts.map +1 -1
  122. package/dist/cjs-types/browser/sync/optimistic_updates_impl.d.ts.map +1 -1
  123. package/dist/cjs-types/bundler/index.d.ts +9 -2
  124. package/dist/cjs-types/bundler/index.d.ts.map +1 -1
  125. package/dist/cjs-types/cli/codegen.d.ts.map +1 -1
  126. package/dist/cjs-types/cli/configure.d.ts +6 -0
  127. package/dist/cjs-types/cli/configure.d.ts.map +1 -1
  128. package/dist/cjs-types/cli/deploy.d.ts +2 -0
  129. package/dist/cjs-types/cli/deploy.d.ts.map +1 -1
  130. package/dist/cjs-types/cli/deploymentCreate.d.ts +6 -6
  131. package/dist/cjs-types/cli/deploymentSelect.d.ts.map +1 -1
  132. package/dist/cjs-types/cli/dev.d.ts +1 -0
  133. package/dist/cjs-types/cli/dev.d.ts.map +1 -1
  134. package/dist/cjs-types/cli/docs.d.ts.map +1 -1
  135. package/dist/cjs-types/cli/env.d.ts.map +1 -1
  136. package/dist/cjs-types/cli/envDefault.d.ts.map +1 -1
  137. package/dist/cjs-types/cli/generatedApi.d.ts +1 -1
  138. package/dist/cjs-types/cli/generatedApi.d.ts.map +1 -1
  139. package/dist/cjs-types/cli/lib/api.d.ts.map +1 -1
  140. package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
  141. package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
  142. package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts +25 -6
  143. package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
  144. package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts +8 -0
  145. package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -0
  146. package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
  147. package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
  148. package/dist/cjs-types/cli/lib/codegen.d.ts +0 -2
  149. package/dist/cjs-types/cli/lib/codegen.d.ts.map +1 -1
  150. package/dist/cjs-types/cli/lib/command.d.ts +2 -0
  151. package/dist/cjs-types/cli/lib/command.d.ts.map +1 -1
  152. package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts +13 -0
  153. package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
  154. package/dist/cjs-types/cli/lib/components.d.ts +5 -0
  155. package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
  156. package/dist/cjs-types/cli/lib/config.d.ts +2 -1
  157. package/dist/cjs-types/cli/lib/config.d.ts.map +1 -1
  158. package/dist/cjs-types/cli/lib/deploy2.d.ts +8 -0
  159. package/dist/cjs-types/cli/lib/deploy2.d.ts.map +1 -1
  160. package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts +897 -0
  161. package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -0
  162. package/dist/cjs-types/cli/lib/deployApi/finishPush.d.ts +1 -2
  163. package/dist/cjs-types/cli/lib/deployApi/finishPush.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/formatValidationProgress.d.ts +8 -0
  167. package/dist/cjs-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
  168. package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts +2 -0
  169. package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
  170. package/dist/cjs-types/cli/lib/localDeployment/run.d.ts +2 -0
  171. package/dist/cjs-types/cli/lib/localDeployment/run.d.ts.map +1 -1
  172. package/dist/cjs-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
  173. package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts +1 -0
  174. package/dist/cjs-types/cli/lib/localDeployment/utils.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/run.d.ts.map +1 -1
  178. package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts +33 -0
  179. package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
  180. package/dist/cjs-types/cli/lib/usageLimits.d.ts +1 -1
  181. package/dist/cjs-types/cli/lib/usageLimits.d.ts.map +1 -1
  182. package/dist/cjs-types/cli/lib/utils/mutex.d.ts +1 -3
  183. package/dist/cjs-types/cli/lib/utils/mutex.d.ts.map +1 -1
  184. package/dist/cjs-types/cli/lib/utils/utils.d.ts +15 -7
  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/nextjs/index.d.ts +6 -6
  188. package/dist/cjs-types/nextjs/index.d.ts.map +1 -1
  189. package/dist/cjs-types/react/client.d.ts +15 -15
  190. package/dist/cjs-types/react/client.d.ts.map +1 -1
  191. package/dist/cjs-types/react/hydration.d.ts +3 -3
  192. package/dist/cjs-types/react/hydration.d.ts.map +1 -1
  193. package/dist/cjs-types/react/queries_observer.d.ts +9 -9
  194. package/dist/cjs-types/react/queries_observer.d.ts.map +1 -1
  195. package/dist/cjs-types/react/use_paginated_query2.d.ts.map +1 -1
  196. package/dist/cjs-types/react/use_queries.d.ts +14 -6
  197. package/dist/cjs-types/react/use_queries.d.ts.map +1 -1
  198. package/dist/cjs-types/server/api.d.ts +157 -7
  199. package/dist/cjs-types/server/api.d.ts.map +1 -1
  200. package/dist/cjs-types/server/components/index.d.ts +2 -2
  201. package/dist/cjs-types/server/components/index.d.ts.map +1 -1
  202. package/dist/cjs-types/server/cron.d.ts +21 -20
  203. package/dist/cjs-types/server/cron.d.ts.map +1 -1
  204. package/dist/cjs-types/server/impl/actions_impl.d.ts +22 -7
  205. package/dist/cjs-types/server/impl/actions_impl.d.ts.map +1 -1
  206. package/dist/cjs-types/server/impl/meta_impl.d.ts.map +1 -1
  207. package/dist/cjs-types/server/impl/scheduler_impl.d.ts.map +1 -1
  208. package/dist/cjs-types/server/impl/storage_impl.d.ts.map +1 -1
  209. package/dist/cjs-types/server/index.d.ts +2 -2
  210. package/dist/cjs-types/server/index.d.ts.map +1 -1
  211. package/dist/cjs-types/server/meta.d.ts +63 -0
  212. package/dist/cjs-types/server/meta.d.ts.map +1 -1
  213. package/dist/cjs-types/server/registration.d.ts +17 -7
  214. package/dist/cjs-types/server/registration.d.ts.map +1 -1
  215. package/dist/cjs-types/server/scheduler.d.ts +9 -7
  216. package/dist/cjs-types/server/scheduler.d.ts.map +1 -1
  217. package/dist/cjs-types/server/schema.d.ts +34 -0
  218. package/dist/cjs-types/server/schema.d.ts.map +1 -1
  219. package/dist/cjs-types/server/storage.d.ts.map +1 -1
  220. package/dist/cjs-types/values/validator.d.ts.map +1 -1
  221. package/dist/cjs-types/values/validators.d.ts +30 -0
  222. package/dist/cjs-types/values/validators.d.ts.map +1 -1
  223. package/dist/cjs-types/values/value.d.ts.map +1 -1
  224. package/dist/cli.bundle.cjs +2728 -1627
  225. package/dist/cli.bundle.cjs.map +4 -4
  226. package/dist/esm/browser/http_client.js.map +2 -2
  227. package/dist/esm/browser/query_options.js.map +2 -2
  228. package/dist/esm/browser/simple_client.js.map +2 -2
  229. package/dist/esm/browser/sync/optimistic_updates_impl.js.map +2 -2
  230. package/dist/esm/bundler/index.js +5 -4
  231. package/dist/esm/bundler/index.js.map +2 -2
  232. package/dist/esm/cli/codegen.js +0 -2
  233. package/dist/esm/cli/codegen.js.map +2 -2
  234. package/dist/esm/cli/configure.js +12 -4
  235. package/dist/esm/cli/configure.js.map +2 -2
  236. package/dist/esm/cli/deploy.js +28 -2
  237. package/dist/esm/cli/deploy.js.map +2 -2
  238. package/dist/esm/cli/deploymentSelect.js +6 -3
  239. package/dist/esm/cli/deploymentSelect.js.map +2 -2
  240. package/dist/esm/cli/dev.js +6 -0
  241. package/dist/esm/cli/dev.js.map +2 -2
  242. package/dist/esm/cli/docs.js +3 -43
  243. package/dist/esm/cli/docs.js.map +2 -2
  244. package/dist/esm/cli/env.js +11 -6
  245. package/dist/esm/cli/env.js.map +2 -2
  246. package/dist/esm/cli/envDefault.js +7 -2
  247. package/dist/esm/cli/envDefault.js.map +2 -2
  248. package/dist/esm/cli/lib/api.js +2 -0
  249. package/dist/esm/cli/lib/api.js.map +2 -2
  250. package/dist/esm/cli/lib/checkForLargeIndexBackfill.js +95 -0
  251. package/dist/esm/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
  252. package/dist/esm/cli/lib/checkForLargeIndexDeletion.js +98 -69
  253. package/dist/esm/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
  254. package/dist/esm/cli/lib/checkForSlowSchemaValidation.js +107 -0
  255. package/dist/esm/cli/lib/checkForSlowSchemaValidation.js.map +7 -0
  256. package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js +68 -0
  257. package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
  258. package/dist/esm/cli/lib/codegen.js.map +2 -2
  259. package/dist/esm/cli/lib/command.js +2 -1
  260. package/dist/esm/cli/lib/command.js.map +2 -2
  261. package/dist/esm/cli/lib/components/definition/bundle.js +37 -11
  262. package/dist/esm/cli/lib/components/definition/bundle.js.map +2 -2
  263. package/dist/esm/cli/lib/components.js +63 -1
  264. package/dist/esm/cli/lib/components.js.map +2 -2
  265. package/dist/esm/cli/lib/config.js +55 -17
  266. package/dist/esm/cli/lib/config.js.map +2 -2
  267. package/dist/esm/cli/lib/deploy2.js +33 -3
  268. package/dist/esm/cli/lib/deploy2.js.map +2 -2
  269. package/dist/esm/cli/lib/deployApi/evaluateSchema.js +72 -0
  270. package/dist/esm/cli/lib/deployApi/evaluateSchema.js.map +7 -0
  271. package/dist/esm/cli/lib/deployApi/finishPush.js +1 -1
  272. package/dist/esm/cli/lib/deployApi/finishPush.js.map +2 -2
  273. package/dist/esm/cli/lib/deployApi/startPush.js +1 -1
  274. package/dist/esm/cli/lib/deployApi/startPush.js.map +2 -2
  275. package/dist/esm/cli/lib/dev.js +6 -0
  276. package/dist/esm/cli/lib/dev.js.map +2 -2
  277. package/dist/esm/cli/lib/formatValidationProgress.js +24 -0
  278. package/dist/esm/cli/lib/formatValidationProgress.js.map +7 -0
  279. package/dist/esm/cli/lib/indexes.js.map +1 -1
  280. package/dist/esm/cli/lib/localDeployment/run.js +30 -2
  281. package/dist/esm/cli/lib/localDeployment/run.js.map +2 -2
  282. package/dist/esm/cli/lib/localDeployment/upgrade.js +4 -3
  283. package/dist/esm/cli/lib/localDeployment/upgrade.js.map +2 -2
  284. package/dist/esm/cli/lib/localDeployment/utils.js +3 -0
  285. package/dist/esm/cli/lib/localDeployment/utils.js.map +2 -2
  286. package/dist/esm/cli/lib/mcp/tools/env.js +10 -3
  287. package/dist/esm/cli/lib/mcp/tools/env.js.map +2 -2
  288. package/dist/esm/cli/lib/run.js +5 -0
  289. package/dist/esm/cli/lib/run.js.map +2 -2
  290. package/dist/esm/cli/lib/schemaEvaluation.js +39 -0
  291. package/dist/esm/cli/lib/schemaEvaluation.js.map +7 -0
  292. package/dist/esm/cli/lib/usageLimits.js +4 -2
  293. package/dist/esm/cli/lib/usageLimits.js.map +2 -2
  294. package/dist/esm/cli/lib/utils/mutex.js +9 -24
  295. package/dist/esm/cli/lib/utils/mutex.js.map +2 -2
  296. package/dist/esm/cli/lib/utils/utils.js +84 -49
  297. package/dist/esm/cli/lib/utils/utils.js.map +2 -2
  298. package/dist/esm/cli/projectCreate.js +1 -1
  299. package/dist/esm/cli/projectCreate.js.map +1 -1
  300. package/dist/esm/index.js +1 -1
  301. package/dist/esm/index.js.map +1 -1
  302. package/dist/esm/nextjs/index.js.map +2 -2
  303. package/dist/esm/react/client.js.map +2 -2
  304. package/dist/esm/react/hydration.js +3 -1
  305. package/dist/esm/react/hydration.js.map +2 -2
  306. package/dist/esm/react/queries_observer.js +3 -1
  307. package/dist/esm/react/queries_observer.js.map +2 -2
  308. package/dist/esm/react/use_paginated_query2.js +3 -1
  309. package/dist/esm/react/use_paginated_query2.js.map +2 -2
  310. package/dist/esm/react/use_queries.js.map +2 -2
  311. package/dist/esm/server/api.js.map +2 -2
  312. package/dist/esm/server/components/index.js.map +2 -2
  313. package/dist/esm/server/cron.js +13 -11
  314. package/dist/esm/server/cron.js.map +2 -2
  315. package/dist/esm/server/impl/actions_impl.js +7 -3
  316. package/dist/esm/server/impl/actions_impl.js.map +2 -2
  317. package/dist/esm/server/impl/meta_impl.js +9 -3
  318. package/dist/esm/server/impl/meta_impl.js.map +2 -2
  319. package/dist/esm/server/impl/scheduler_impl.js.map +2 -2
  320. package/dist/esm/server/impl/storage_impl.js +29 -0
  321. package/dist/esm/server/impl/storage_impl.js.map +2 -2
  322. package/dist/esm/server/index.js +4 -1
  323. package/dist/esm/server/index.js.map +2 -2
  324. package/dist/esm/server/schema.js +72 -3
  325. package/dist/esm/server/schema.js.map +2 -2
  326. package/dist/esm/values/validator.js +1 -1
  327. package/dist/esm/values/validator.js.map +2 -2
  328. package/dist/esm/values/validators.js +82 -26
  329. package/dist/esm/values/validators.js.map +2 -2
  330. package/dist/esm/values/value.js +6 -0
  331. package/dist/esm/values/value.js.map +2 -2
  332. package/dist/esm-types/browser/http_client.d.ts +5 -5
  333. package/dist/esm-types/browser/http_client.d.ts.map +1 -1
  334. package/dist/esm-types/browser/query_options.d.ts +2 -2
  335. package/dist/esm-types/browser/query_options.d.ts.map +1 -1
  336. package/dist/esm-types/browser/simple_client.d.ts +6 -6
  337. package/dist/esm-types/browser/simple_client.d.ts.map +1 -1
  338. package/dist/esm-types/browser/sync/optimistic_updates.d.ts +4 -4
  339. package/dist/esm-types/browser/sync/optimistic_updates.d.ts.map +1 -1
  340. package/dist/esm-types/browser/sync/optimistic_updates_impl.d.ts.map +1 -1
  341. package/dist/esm-types/bundler/index.d.ts +9 -2
  342. package/dist/esm-types/bundler/index.d.ts.map +1 -1
  343. package/dist/esm-types/cli/codegen.d.ts.map +1 -1
  344. package/dist/esm-types/cli/configure.d.ts +6 -0
  345. package/dist/esm-types/cli/configure.d.ts.map +1 -1
  346. package/dist/esm-types/cli/deploy.d.ts +2 -0
  347. package/dist/esm-types/cli/deploy.d.ts.map +1 -1
  348. package/dist/esm-types/cli/deploymentCreate.d.ts +6 -6
  349. package/dist/esm-types/cli/deploymentSelect.d.ts.map +1 -1
  350. package/dist/esm-types/cli/dev.d.ts +1 -0
  351. package/dist/esm-types/cli/dev.d.ts.map +1 -1
  352. package/dist/esm-types/cli/docs.d.ts.map +1 -1
  353. package/dist/esm-types/cli/env.d.ts.map +1 -1
  354. package/dist/esm-types/cli/envDefault.d.ts.map +1 -1
  355. package/dist/esm-types/cli/generatedApi.d.ts +1 -1
  356. package/dist/esm-types/cli/generatedApi.d.ts.map +1 -1
  357. package/dist/esm-types/cli/lib/api.d.ts.map +1 -1
  358. package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
  359. package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
  360. package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts +25 -6
  361. package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
  362. package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts +8 -0
  363. package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -0
  364. package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
  365. package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
  366. package/dist/esm-types/cli/lib/codegen.d.ts +0 -2
  367. package/dist/esm-types/cli/lib/codegen.d.ts.map +1 -1
  368. package/dist/esm-types/cli/lib/command.d.ts +2 -0
  369. package/dist/esm-types/cli/lib/command.d.ts.map +1 -1
  370. package/dist/esm-types/cli/lib/components/definition/bundle.d.ts +13 -0
  371. package/dist/esm-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
  372. package/dist/esm-types/cli/lib/components.d.ts +5 -0
  373. package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
  374. package/dist/esm-types/cli/lib/config.d.ts +2 -1
  375. package/dist/esm-types/cli/lib/config.d.ts.map +1 -1
  376. package/dist/esm-types/cli/lib/deploy2.d.ts +8 -0
  377. package/dist/esm-types/cli/lib/deploy2.d.ts.map +1 -1
  378. package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts +897 -0
  379. package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -0
  380. package/dist/esm-types/cli/lib/deployApi/finishPush.d.ts +1 -2
  381. package/dist/esm-types/cli/lib/deployApi/finishPush.d.ts.map +1 -1
  382. package/dist/esm-types/cli/lib/dev.d.ts +1 -0
  383. package/dist/esm-types/cli/lib/dev.d.ts.map +1 -1
  384. package/dist/esm-types/cli/lib/formatValidationProgress.d.ts +8 -0
  385. package/dist/esm-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
  386. package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts +2 -0
  387. package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
  388. package/dist/esm-types/cli/lib/localDeployment/run.d.ts +2 -0
  389. package/dist/esm-types/cli/lib/localDeployment/run.d.ts.map +1 -1
  390. package/dist/esm-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
  391. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts +1 -0
  392. package/dist/esm-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
  393. package/dist/esm-types/cli/lib/mcp/tools/env.d.ts +8 -5
  394. package/dist/esm-types/cli/lib/mcp/tools/env.d.ts.map +1 -1
  395. package/dist/esm-types/cli/lib/run.d.ts.map +1 -1
  396. package/dist/esm-types/cli/lib/schemaEvaluation.d.ts +33 -0
  397. package/dist/esm-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
  398. package/dist/esm-types/cli/lib/usageLimits.d.ts +1 -1
  399. package/dist/esm-types/cli/lib/usageLimits.d.ts.map +1 -1
  400. package/dist/esm-types/cli/lib/utils/mutex.d.ts +1 -3
  401. package/dist/esm-types/cli/lib/utils/mutex.d.ts.map +1 -1
  402. package/dist/esm-types/cli/lib/utils/utils.d.ts +15 -7
  403. package/dist/esm-types/cli/lib/utils/utils.d.ts.map +1 -1
  404. package/dist/esm-types/index.d.ts +1 -1
  405. package/dist/esm-types/nextjs/index.d.ts +6 -6
  406. package/dist/esm-types/nextjs/index.d.ts.map +1 -1
  407. package/dist/esm-types/react/client.d.ts +15 -15
  408. package/dist/esm-types/react/client.d.ts.map +1 -1
  409. package/dist/esm-types/react/hydration.d.ts +3 -3
  410. package/dist/esm-types/react/hydration.d.ts.map +1 -1
  411. package/dist/esm-types/react/queries_observer.d.ts +9 -9
  412. package/dist/esm-types/react/queries_observer.d.ts.map +1 -1
  413. package/dist/esm-types/react/use_paginated_query2.d.ts.map +1 -1
  414. package/dist/esm-types/react/use_queries.d.ts +14 -6
  415. package/dist/esm-types/react/use_queries.d.ts.map +1 -1
  416. package/dist/esm-types/server/api.d.ts +157 -7
  417. package/dist/esm-types/server/api.d.ts.map +1 -1
  418. package/dist/esm-types/server/components/index.d.ts +2 -2
  419. package/dist/esm-types/server/components/index.d.ts.map +1 -1
  420. package/dist/esm-types/server/cron.d.ts +21 -20
  421. package/dist/esm-types/server/cron.d.ts.map +1 -1
  422. package/dist/esm-types/server/impl/actions_impl.d.ts +22 -7
  423. package/dist/esm-types/server/impl/actions_impl.d.ts.map +1 -1
  424. package/dist/esm-types/server/impl/meta_impl.d.ts.map +1 -1
  425. package/dist/esm-types/server/impl/scheduler_impl.d.ts.map +1 -1
  426. package/dist/esm-types/server/impl/storage_impl.d.ts.map +1 -1
  427. package/dist/esm-types/server/index.d.ts +2 -2
  428. package/dist/esm-types/server/index.d.ts.map +1 -1
  429. package/dist/esm-types/server/meta.d.ts +63 -0
  430. package/dist/esm-types/server/meta.d.ts.map +1 -1
  431. package/dist/esm-types/server/registration.d.ts +17 -7
  432. package/dist/esm-types/server/registration.d.ts.map +1 -1
  433. package/dist/esm-types/server/scheduler.d.ts +9 -7
  434. package/dist/esm-types/server/scheduler.d.ts.map +1 -1
  435. package/dist/esm-types/server/schema.d.ts +34 -0
  436. package/dist/esm-types/server/schema.d.ts.map +1 -1
  437. package/dist/esm-types/server/storage.d.ts.map +1 -1
  438. package/dist/esm-types/values/validator.d.ts.map +1 -1
  439. package/dist/esm-types/values/validators.d.ts +30 -0
  440. package/dist/esm-types/values/validators.d.ts.map +1 -1
  441. package/dist/esm-types/values/value.d.ts.map +1 -1
  442. package/dist/react.bundle.js +7 -1
  443. package/dist/react.bundle.js.map +2 -2
  444. package/package.json +9 -9
  445. package/schemas/convex.schema.json +5 -5
  446. package/src/browser/http_client.ts +43 -10
  447. package/src/browser/query_options.ts +11 -5
  448. package/src/browser/simple_client.ts +35 -14
  449. package/src/browser/sync/optimistic_updates.ts +17 -4
  450. package/src/browser/sync/optimistic_updates_impl.ts +17 -4
  451. package/src/bundler/index.ts +9 -4
  452. package/src/cli/codegen.ts +0 -1
  453. package/src/cli/configure.ts +27 -7
  454. package/src/cli/deploy.ts +37 -5
  455. package/src/cli/deploymentSelect.ts +7 -4
  456. package/src/cli/dev.ts +9 -0
  457. package/src/cli/docs.ts +3 -44
  458. package/src/cli/env.ts +12 -6
  459. package/src/cli/envDefault.ts +8 -2
  460. package/src/cli/generatedApi.ts +1 -1
  461. package/src/cli/lib/api.ts +5 -1
  462. package/src/cli/lib/checkForLargeIndexBackfill.ts +173 -0
  463. package/src/cli/lib/checkForLargeIndexDeletion.ts +150 -91
  464. package/src/cli/lib/checkForSlowSchemaValidation.ts +141 -0
  465. package/src/cli/lib/checkForStagedValidatorDeletion.ts +104 -0
  466. package/src/cli/lib/codegen.ts +0 -2
  467. package/src/cli/lib/command.ts +3 -0
  468. package/src/cli/lib/components/definition/bundle.ts +68 -14
  469. package/src/cli/lib/components.ts +84 -0
  470. package/src/cli/lib/config.ts +85 -18
  471. package/src/cli/lib/deploy2.ts +66 -2
  472. package/src/cli/lib/deployApi/evaluateSchema.ts +97 -0
  473. package/src/cli/lib/deployApi/finishPush.ts +1 -1
  474. package/src/cli/lib/deployApi/startPush.ts +1 -1
  475. package/src/cli/lib/dev.ts +15 -0
  476. package/src/cli/lib/formatValidationProgress.ts +35 -0
  477. package/src/cli/lib/generatedFunctionLogsApi.ts +2 -0
  478. package/src/cli/lib/indexes.ts +1 -1
  479. package/src/cli/lib/localDeployment/run.ts +44 -2
  480. package/src/cli/lib/localDeployment/upgrade.ts +4 -6
  481. package/src/cli/lib/localDeployment/utils.ts +6 -0
  482. package/src/cli/lib/mcp/tools/env.ts +17 -3
  483. package/src/cli/lib/run.ts +3 -0
  484. package/src/cli/lib/schemaEvaluation.ts +88 -0
  485. package/src/cli/lib/usageLimits.ts +2 -0
  486. package/src/cli/lib/utils/mutex.ts +9 -27
  487. package/src/cli/lib/utils/utils.ts +127 -56
  488. package/src/cli/projectCreate.ts +1 -1
  489. package/src/index.ts +1 -1
  490. package/src/nextjs/index.ts +19 -8
  491. package/src/react/client.ts +73 -30
  492. package/src/react/hydration.tsx +14 -6
  493. package/src/react/queries_observer.ts +19 -16
  494. package/src/react/use_paginated_query2.ts +10 -6
  495. package/src/react/use_queries.ts +23 -7
  496. package/src/server/api.ts +220 -14
  497. package/src/server/components/index.ts +4 -6
  498. package/src/server/cron.ts +34 -24
  499. package/src/server/impl/actions_impl.ts +39 -10
  500. package/src/server/impl/meta_impl.ts +8 -1
  501. package/src/server/impl/scheduler_impl.ts +13 -6
  502. package/src/server/impl/storage_impl.ts +30 -0
  503. package/src/server/index.ts +6 -1
  504. package/src/server/meta.ts +79 -0
  505. package/src/server/registration.ts +38 -7
  506. package/src/server/scheduler.ts +22 -7
  507. package/src/server/schema.ts +77 -0
  508. package/src/server/storage.ts +17 -0
  509. package/src/values/validator.ts +3 -1
  510. package/src/values/validators.ts +85 -27
  511. package/src/values/value.ts +9 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/cli/lib/command.ts"],
4
- "sourcesContent": ["import { Command, Option, OptionValues } from \"@commander-js/extra-typings\";\nimport { OneoffCtx } from \"../../bundler/context.js\";\nimport { LogMode } from \"./logs.js\";\nimport {\n CONVEX_DEPLOYMENT_ENV_VAR_NAME,\n CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME,\n CONVEX_SELF_HOSTED_URL_VAR_NAME,\n parseInteger,\n parsePositiveInteger,\n} from \"./utils/utils.js\";\nimport { INLINE_QUERY_DESCRIPTION } from \"./runTestFunction.js\";\n\ndeclare module \"@commander-js/extra-typings\" {\n interface Command<Args extends any[] = [], Opts extends OptionValues = {}> {\n /**\n * For a command that talks to the configured dev deployment by default,\n * add flags for talking to prod, preview, or other deployment in the same\n * project.\n *\n * These flags are added to the end of `command` (ordering matters for `--help`\n * output). `action` should look like \"Import data into\" because it is prefixed\n * onto help strings.\n *\n * The options can be passed to `deploymentSelectionFromOptions`.\n *\n * NOTE: This method only exists at runtime if this file is imported.\n * To help avoid this bug, this method takes in an `ActionDescription` which\n * can only be constructed via `actionDescription` from this file.\n *\n * @param action - The action description\n * @param options - Optional settings\n * @param options.showUrlHelp - If true, show the --url option in help output\n */\n addDeploymentSelectionOptions(\n action: ActionDescription,\n options?: { showUrlHelp?: boolean },\n ): Command<\n Args,\n Opts & {\n envFile?: string;\n url?: string;\n adminKey?: string;\n prod?: boolean;\n previewName?: string;\n deploymentName?: string;\n deployment?: string;\n }\n >;\n\n /**\n * Adds options for the `deploy` command.\n */\n addDeployOptions(): Command<\n Args,\n Opts & {\n verbose?: boolean;\n dryRun?: boolean;\n yes?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n cmd?: string;\n cmdUrlEnvVarName?: string;\n debugBundlePath?: string;\n debug?: boolean;\n writePushRequest?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for `self-host` subcommands.\n */\n addSelfHostOptions(): Command<\n Args,\n Opts & {\n url?: string;\n adminKey?: string;\n env?: string;\n }\n >;\n\n /**\n * Adds options and arguments for the `run` command.\n */\n addRunOptions(): Command<\n [...Args, string | undefined, string | undefined],\n Opts & {\n watch?: boolean;\n push?: boolean;\n identity?: string;\n inlineQuery?: string;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n component?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for the `import` command.\n */\n addImportOptions(): Command<\n [...Args, string],\n Opts & {\n table?: string;\n format?: \"csv\" | \"jsonLines\" | \"jsonArray\" | \"zip\";\n replace?: boolean;\n append?: boolean;\n replaceAll?: boolean;\n yes?: boolean;\n component?: string;\n }\n >;\n\n /**\n * Adds options for the `export` command.\n */\n addExportOptions(): Command<\n Args,\n Opts & {\n path: string;\n includeFileStorage?: boolean;\n }\n >;\n\n /**\n * Adds options for the `data` command.\n */\n addDataOptions(): Command<\n [...Args, string | undefined],\n Opts & {\n limit: number;\n order: \"asc\" | \"desc\";\n component?: string;\n format?: \"json\" | \"jsonArray\" | \"jsonLines\" | \"jsonl\" | \"pretty\";\n }\n >;\n\n /**\n * Adds options for the `logs` command.\n */\n addLogsOptions(): Command<\n Args,\n Opts & {\n history: number;\n success: boolean;\n jsonl: boolean;\n tail?: number | boolean;\n }\n >;\n\n /**\n * Adds options for the `network-test` command.\n */\n addNetworkTestOptions(): Command<\n Args,\n Opts & {\n timeout?: string;\n ipFamily?: string;\n speedTest?: boolean;\n }\n >;\n }\n}\n\nCommand.prototype.addDeploymentSelectionOptions = function (\n action: ActionDescription,\n options?: { showUrlHelp?: boolean },\n) {\n const urlOption = new Option(\n \"--url <url>\",\n options?.showUrlHelp\n ? action + \" the deployment at the given URL.\"\n : undefined,\n ).conflicts([\n \"--prod\",\n \"--preview-name\",\n \"--deployment-name\",\n \"--deployment\",\n ]);\n if (!options?.showUrlHelp) {\n urlOption.hideHelp();\n }\n return this.addOption(urlOption)\n .addOption(new Option(\"--admin-key <adminKey>\").hideHelp())\n .addOption(\n new Option(\n \"--prod\",\n action + \" this project's default production deployment.\",\n ).conflicts([\n \"--preview-name\",\n \"--deployment-name\",\n \"--url\",\n \"--deployment\",\n ]),\n )\n .addOption(\n new Option(\n \"--preview-name <previewName>\",\n action + \" the preview deployment with the given name.\",\n )\n .conflicts([\"--prod\", \"--deployment-name\", \"--url\", \"--deployment\"])\n .hideHelp(),\n )\n .addOption(\n new Option(\n \"--deployment-name <deploymentName>\",\n action + \" the specified deployment.\",\n )\n .conflicts([\"--prod\", \"--preview-name\", \"--url\", \"--deployment\"])\n .hideHelp(),\n )\n .addOption(\n new Option(\n \"--deployment <deployment>\",\n action +\n \" a specific deployment. Accepts:\\n\" +\n \"\u2022 a deployment name (e.g. joyful-capybara-123)\\n\" +\n \"\u2022 a deployment reference (e.g. dev/james, staging)\\n\" +\n \"\u2022 `dev` (for your personal dev deployment)\\n\" +\n \"\u2022 `prod` (for your project\u2019s default production deployment)\\n\" +\n \"\u2022 `local` (for your local dev deployment).\" +\n \"\\nYou can also select deployments in other projects with `project-slug:reference` or `team-slug:project-slug:reference`.\",\n ).conflicts([\"--prod\", \"--preview-name\", \"--deployment-name\", \"--url\"]),\n )\n .addOption(\n new Option(\n \"--env-file <envFile>\",\n `Path to a custom file of environment variables, for choosing the \\\ndeployment, e.g. ${CONVEX_DEPLOYMENT_ENV_VAR_NAME} or ${CONVEX_SELF_HOSTED_URL_VAR_NAME}. \\\nSame format as .env.local or .env files, and overrides them.`,\n ).hideHelp(),\n ) as any;\n};\n\ndeclare const tag: unique symbol;\ntype ActionDescription = string & { readonly [tag]: \"noop\" };\nexport function actionDescription(action: string): ActionDescription {\n return action as any;\n}\n\nexport async function normalizeDevOptions(\n ctx: OneoffCtx,\n cmdOptions: {\n verbose?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents?: boolean;\n codegen: \"enable\" | \"disable\";\n once?: boolean;\n untilSuccess: boolean;\n start?: string;\n runSh?: string;\n run?: string | undefined;\n runComponent?: string;\n tailLogs?: string | true;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis?: boolean;\n liveComponentSources?: boolean;\n pushAllModules?: boolean;\n while?: string;\n },\n): Promise<{\n verbose: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: boolean;\n once: boolean;\n untilSuccess: boolean;\n run?:\n | { kind: \"function\"; name: string; component?: string | undefined }\n | { kind: \"shell\"; command: string }\n | undefined;\n tailLogs: LogMode;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis: boolean;\n liveComponentSources: boolean;\n pushAllModules: boolean;\n}> {\n if (cmdOptions.runComponent && !cmdOptions.run) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"Can't specify `--run-component` option without `--run`\",\n });\n }\n\n if (cmdOptions.debugBundlePath !== undefined && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-bundle-path` can only be used with `--once`.\",\n });\n }\n if (cmdOptions.debugNodeApis && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-node-apis` can only be used with `--once`.\",\n });\n }\n\n return {\n verbose: !!cmdOptions.verbose,\n typecheck: cmdOptions.typecheck,\n typecheckComponents: !!cmdOptions.typecheckComponents,\n codegen: cmdOptions.codegen === \"enable\",\n once: !!cmdOptions.once,\n untilSuccess: cmdOptions.untilSuccess,\n run:\n cmdOptions.run !== undefined\n ? {\n kind: \"function\",\n name: cmdOptions.run,\n component: cmdOptions.runComponent,\n }\n : (cmdOptions.start ?? cmdOptions.runSh) !== undefined\n ? {\n kind: \"shell\",\n command: (cmdOptions.start ?? cmdOptions.runSh)!,\n }\n : undefined,\n tailLogs:\n typeof cmdOptions.tailLogs === \"string\"\n ? (cmdOptions.tailLogs as LogMode)\n : \"pause-on-deploy\",\n traceEvents: cmdOptions.traceEvents,\n debugBundlePath: cmdOptions.debugBundlePath,\n debugNodeApis: !!cmdOptions.debugNodeApis,\n liveComponentSources: !!cmdOptions.liveComponentSources,\n pushAllModules: !!cmdOptions.pushAllModules,\n };\n}\n\nCommand.prototype.addDeployOptions = function () {\n return this.option(\"-v, --verbose\", \"Show full listing of changes\")\n .option(\n \"--dry-run\",\n \"Print out the generated configuration without deploying to your Convex deployment\",\n )\n .addOption(\n new Option(\n \"-y, --yes\",\n \"Skip confirmation prompt when running interactively. Warning: this deploys to PRODUCTION. To deploy to your current dev environment, run npx convex dev --once\",\n ).hideHelp(),\n )\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\` before deploying.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Whether to regenerate code in `convex/_generated/` before pushing.\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--cmd <command>\",\n \"Command to run as part of deploying your app (e.g. `vite build`). This command can depend on the environment variables specified in `--cmd-url-env-var-name` being set.\",\n ),\n )\n .addOption(\n new Option(\n \"--cmd-url-env-var-name <name>\",\n \"Environment variable name to set Convex deployment URL (e.g. `VITE_CONVEX_URL`) when using `--cmd`\",\n ),\n )\n .addOption(new Option(\"--debug-bundle-path <path>\").hideHelp())\n .addOption(new Option(\"--debug\").hideHelp())\n .addOption(new Option(\"--write-push-request <writePushRequest>\").hideHelp())\n .addOption(new Option(\"--live-component-sources\").hideHelp())\n .addOption(\n new Option(\n \"--push-all-modules\",\n \"Push all modules without checking for unchanged module hashes from the server\",\n )\n .default(false)\n .hideHelp(),\n );\n};\n\nCommand.prototype.addSelfHostOptions = function () {\n return this.option(\n \"--admin-key <adminKey>\",\n `An admin key for the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--url <url>\",\n `The url of the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--env <env>\",\n `Path to a custom file of environment variables, containing \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` and \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\`.`,\n );\n};\n\nCommand.prototype.addRunOptions = function () {\n return (\n this.argument(\n \"[functionName]\",\n \"identifier of the function to run, like `listMessages` or `dir/file:myFunction`\",\n )\n .argument(\n \"[args]\",\n \"JSON-formatted arguments object to pass to the function.\",\n )\n .option(\n \"-w, --watch\",\n \"Watch a query, printing its result if the underlying data changes. Given function must be a query.\",\n )\n .addOption(\n new Option(\n \"--inline-query <query>\",\n INLINE_QUERY_DESCRIPTION,\n ).conflicts(\"--watch\"),\n )\n .option(\"--push\", \"Push code to deployment before running the function.\")\n .addOption(\n new Option(\n \"--identity <identity>\",\n 'JSON-formatted UserIdentity object, e.g. \\'{ name: \"John\", address: \"0x123\" }\\'',\n ),\n )\n // For backwards compatibility we still support --no-push which is a noop\n .addOption(new Option(\"--no-push\").hideHelp())\n // Options for the deploy that --push does\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\`.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Regenerate code in `convex/_generated/`\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n 'Path to the component (e.g. \"workflow\" or \"workflow/workpool\")',\n ),\n )\n .addOption(new Option(\"--live-component-sources\").hideHelp())\n );\n};\n\nCommand.prototype.addImportOptions = function () {\n return this.argument(\"<path>\", \"Path to the input file\")\n .addOption(\n new Option(\n \"--table <table>\",\n \"Destination table name. Required if format is csv, jsonLines, or jsonArray. Not supported if format is zip.\",\n ),\n )\n .addOption(\n new Option(\n \"--replace\",\n \"Replace all existing data in any of the imported tables\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace-all\"),\n )\n .addOption(\n new Option(\"--append\", \"Append imported data to any existing tables\")\n .conflicts(\"--replace-all\")\n .conflicts(\"--replace\"),\n )\n .addOption(\n new Option(\n \"--replace-all\",\n \"Replace all existing data in the deployment with the imported tables,\\n\" +\n \"deleting tables that don't appear in the import file or the schema,\\n\" +\n \"and clearing tables that appear in the schema but not in the import file\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace\"),\n )\n .option(\n \"-y, --yes\",\n \"Skip confirmation prompt when import leads to deleting existing documents\",\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Input file format. This flag is only required if the filename is missing an extension.\\n\" +\n \"- CSV files must have a header, and each row's entries are interpreted either as a (floating point) number or a string.\\n\" +\n \"- JSON files must be an array of JSON objects.\\n\" +\n \"- JSONLines files must have a JSON object per line.\\n\" +\n \"- ZIP files must have one directory per table, containing <table>/documents.jsonl. Snapshot exports from the Convex dashboard have this format.\",\n ).choices([\"csv\", \"jsonLines\", \"jsonArray\", \"zip\"]),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n 'Path to the component (e.g. \"workflow\" or \"workflow/workpool\")',\n ),\n );\n};\n\nCommand.prototype.addExportOptions = function () {\n return this.requiredOption(\n \"--path <zipFilePath>\",\n \"Exports data into a ZIP file at this path, which may be a directory or unoccupied .zip path\",\n ).addOption(\n new Option(\n \"--include-file-storage\",\n \"Includes stored files (https://dashboard.convex.dev/deployment/files) in a _storage folder within the ZIP file\",\n ),\n );\n};\n\nCommand.prototype.addDataOptions = function () {\n return this.addOption(\n new Option(\n \"--limit <n>\",\n \"List only the `n` the most recently created documents.\",\n )\n .default(100)\n .argParser(parsePositiveInteger),\n )\n .addOption(\n new Option(\n \"--order <choice>\",\n \"Order the documents by their `_creationTime`.\",\n )\n .choices([\"asc\", \"desc\"])\n .default(\"desc\"),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n 'Path to the component (e.g. \"workflow\" or \"workflow/workpool\")',\n ),\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Format to print the data in. This flag is only required if the filename is missing an extension.\\n\" +\n \"- jsonArray (aka json): print the data as a JSON array of objects.\\n\" +\n \"- jsonLines (aka jsonl): print the data as a JSON object per line.\\n\" +\n \"- pretty: print the data in a human-readable format.\",\n ).choices([\"jsonArray\", \"json\", \"jsonLines\", \"jsonl\", \"pretty\"]),\n )\n .argument(\"[table]\", \"If specified, list documents in this table.\");\n};\n\nCommand.prototype.addLogsOptions = function () {\n return this.option(\n \"--history [n]\",\n \"Show `n` most recent logs. Defaults to showing all available logs.\",\n parseInteger,\n )\n .option(\n \"--success\",\n \"Print a log line for every successful function execution\",\n false,\n )\n .option(\"--jsonl\", \"Output raw log events as JSONL\", false)\n .addOption(\n new Option(\n \"--tail [n]\",\n \"Deprecated/unnecessary: `convex logs` already tails by default. Accepted as an alias for --history for compatibility with agents that pass it.\",\n )\n .argParser(parseInteger)\n .hideHelp(),\n );\n};\n\nCommand.prototype.addNetworkTestOptions = function () {\n return this.addOption(\n new Option(\n \"--timeout <timeout>\",\n \"Timeout in seconds for the network test (default: 30).\",\n ),\n )\n .addOption(\n new Option(\n \"--ip-family <ipFamily>\",\n \"IP family to use (ipv4, ipv6, or auto)\",\n ),\n )\n .addOption(\n new Option(\n \"--speed-test\",\n \"Perform a large echo test to measure network speed.\",\n ),\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8C;AAG9C,mBAMO;AACP,6BAAyC;AA6JzC,6BAAQ,UAAU,gCAAgC,SAChD,QACA,SACA;AACA,QAAM,YAAY,IAAI;AAAA,IACpB;AAAA,IACA,SAAS,cACL,SAAS,sCACT;AAAA,EACN,EAAE,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,MAAI,CAAC,SAAS,aAAa;AACzB,cAAU,SAAS;AAAA,EACrB;AACA,SAAO,KAAK,UAAU,SAAS,EAC5B,UAAU,IAAI,4BAAO,wBAAwB,EAAE,SAAS,CAAC,EACzD;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACX,EAAE,U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ACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IAIF,EAAE,QAAQ,CAAC,aAAa,QAAQ,aAAa,SAAS,QAAQ,CAAC;AAAA,EACjE,EACC,SAAS,WAAW,6CAA6C;AACtE;AAEA,6BAAQ,UAAU,iBAAiB,WAAY;AAC7C,SAAO,KAAK;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,OAAO,WAAW,kCAAkC,KAAK,EACzD;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF,EACG,UAAU,yBAAY,EACtB,SAAS;AAAA,EACd;AACJ;AAEA,6BAAQ,UAAU,wBAAwB,WAAY;AACpD,SAAO,KAAK;AAAA,IACV,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACG;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACJ;",
4
+ "sourcesContent": ["import { Command, Option, OptionValues } from \"@commander-js/extra-typings\";\nimport { OneoffCtx } from \"../../bundler/context.js\";\nimport { LogMode } from \"./logs.js\";\nimport {\n CONVEX_DEPLOYMENT_ENV_VAR_NAME,\n CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME,\n CONVEX_SELF_HOSTED_URL_VAR_NAME,\n parseInteger,\n parsePositiveInteger,\n} from \"./utils/utils.js\";\nimport { INLINE_QUERY_DESCRIPTION } from \"./runTestFunction.js\";\n\ndeclare module \"@commander-js/extra-typings\" {\n interface Command<Args extends any[] = [], Opts extends OptionValues = {}> {\n /**\n * For a command that talks to the configured dev deployment by default,\n * add flags for talking to prod, preview, or other deployment in the same\n * project.\n *\n * These flags are added to the end of `command` (ordering matters for `--help`\n * output). `action` should look like \"Import data into\" because it is prefixed\n * onto help strings.\n *\n * The options can be passed to `deploymentSelectionFromOptions`.\n *\n * NOTE: This method only exists at runtime if this file is imported.\n * To help avoid this bug, this method takes in an `ActionDescription` which\n * can only be constructed via `actionDescription` from this file.\n *\n * @param action - The action description\n * @param options - Optional settings\n * @param options.showUrlHelp - If true, show the --url option in help output\n */\n addDeploymentSelectionOptions(\n action: ActionDescription,\n options?: { showUrlHelp?: boolean },\n ): Command<\n Args,\n Opts & {\n envFile?: string;\n url?: string;\n adminKey?: string;\n prod?: boolean;\n previewName?: string;\n deploymentName?: string;\n deployment?: string;\n }\n >;\n\n /**\n * Adds options for the `deploy` command.\n */\n addDeployOptions(): Command<\n Args,\n Opts & {\n verbose?: boolean;\n dryRun?: boolean;\n yes?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n cmd?: string;\n cmdUrlEnvVarName?: string;\n debugBundlePath?: string;\n debug?: boolean;\n writePushRequest?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for `self-host` subcommands.\n */\n addSelfHostOptions(): Command<\n Args,\n Opts & {\n url?: string;\n adminKey?: string;\n env?: string;\n }\n >;\n\n /**\n * Adds options and arguments for the `run` command.\n */\n addRunOptions(): Command<\n [...Args, string | undefined, string | undefined],\n Opts & {\n watch?: boolean;\n push?: boolean;\n identity?: string;\n inlineQuery?: string;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: \"enable\" | \"disable\";\n component?: string;\n liveComponentSources?: boolean;\n }\n >;\n\n /**\n * Adds options for the `import` command.\n */\n addImportOptions(): Command<\n [...Args, string],\n Opts & {\n table?: string;\n format?: \"csv\" | \"jsonLines\" | \"jsonArray\" | \"zip\";\n replace?: boolean;\n append?: boolean;\n replaceAll?: boolean;\n yes?: boolean;\n component?: string;\n }\n >;\n\n /**\n * Adds options for the `export` command.\n */\n addExportOptions(): Command<\n Args,\n Opts & {\n path: string;\n includeFileStorage?: boolean;\n }\n >;\n\n /**\n * Adds options for the `data` command.\n */\n addDataOptions(): Command<\n [...Args, string | undefined],\n Opts & {\n limit: number;\n order: \"asc\" | \"desc\";\n component?: string;\n format?: \"json\" | \"jsonArray\" | \"jsonLines\" | \"jsonl\" | \"pretty\";\n }\n >;\n\n /**\n * Adds options for the `logs` command.\n */\n addLogsOptions(): Command<\n Args,\n Opts & {\n history: number;\n success: boolean;\n jsonl: boolean;\n tail?: number | boolean;\n }\n >;\n\n /**\n * Adds options for the `network-test` command.\n */\n addNetworkTestOptions(): Command<\n Args,\n Opts & {\n timeout?: string;\n ipFamily?: string;\n speedTest?: boolean;\n }\n >;\n }\n}\n\nCommand.prototype.addDeploymentSelectionOptions = function (\n action: ActionDescription,\n options?: { showUrlHelp?: boolean },\n) {\n const urlOption = new Option(\n \"--url <url>\",\n options?.showUrlHelp\n ? action + \" the deployment at the given URL.\"\n : undefined,\n ).conflicts([\n \"--prod\",\n \"--preview-name\",\n \"--deployment-name\",\n \"--deployment\",\n ]);\n if (!options?.showUrlHelp) {\n urlOption.hideHelp();\n }\n return this.addOption(urlOption)\n .addOption(new Option(\"--admin-key <adminKey>\").hideHelp())\n .addOption(\n new Option(\n \"--prod\",\n action + \" this project's default production deployment.\",\n ).conflicts([\n \"--preview-name\",\n \"--deployment-name\",\n \"--url\",\n \"--deployment\",\n ]),\n )\n .addOption(\n new Option(\n \"--preview-name <previewName>\",\n action + \" the preview deployment with the given name.\",\n )\n .conflicts([\"--prod\", \"--deployment-name\", \"--url\", \"--deployment\"])\n .hideHelp(),\n )\n .addOption(\n new Option(\n \"--deployment-name <deploymentName>\",\n action + \" the specified deployment.\",\n )\n .conflicts([\"--prod\", \"--preview-name\", \"--url\", \"--deployment\"])\n .hideHelp(),\n )\n .addOption(\n new Option(\n \"--deployment <deployment>\",\n action +\n \" a specific deployment. Accepts:\\n\" +\n \"\u2022 a deployment name (e.g. joyful-capybara-123)\\n\" +\n \"\u2022 a deployment reference (e.g. dev/james, staging)\\n\" +\n \"\u2022 `dev` (for your personal dev deployment)\\n\" +\n \"\u2022 `prod` (for your project\u2019s default production deployment)\\n\" +\n \"\u2022 `local` (for your local dev deployment).\" +\n \"\\nYou can also select deployments in other projects with `project-slug:reference` or `team-slug:project-slug:reference`.\",\n ).conflicts([\"--prod\", \"--preview-name\", \"--deployment-name\", \"--url\"]),\n )\n .addOption(\n new Option(\n \"--env-file <envFile>\",\n `Path to a custom file of environment variables, for choosing the \\\ndeployment, e.g. ${CONVEX_DEPLOYMENT_ENV_VAR_NAME} or ${CONVEX_SELF_HOSTED_URL_VAR_NAME}. \\\nSame format as .env.local or .env files, and overrides them.`,\n ).hideHelp(),\n ) as any;\n};\n\ndeclare const tag: unique symbol;\ntype ActionDescription = string & { readonly [tag]: \"noop\" };\nexport function actionDescription(action: string): ActionDescription {\n return action as any;\n}\n\nexport async function normalizeDevOptions(\n ctx: OneoffCtx,\n cmdOptions: {\n verbose?: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents?: boolean;\n codegen: \"enable\" | \"disable\";\n once?: boolean;\n untilSuccess: boolean;\n start?: string;\n runSh?: string;\n run?: string | undefined;\n runComponent?: string;\n tailLogs?: string | true;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis?: boolean;\n liveComponentSources?: boolean;\n pushAllModules?: boolean;\n allowUnstagingSchema?: boolean;\n while?: string;\n },\n): Promise<{\n verbose: boolean;\n typecheck: \"enable\" | \"try\" | \"disable\";\n typecheckComponents: boolean;\n codegen: boolean;\n once: boolean;\n untilSuccess: boolean;\n run?:\n | { kind: \"function\"; name: string; component?: string | undefined }\n | { kind: \"shell\"; command: string }\n | undefined;\n tailLogs: LogMode;\n traceEvents: boolean;\n debugBundlePath?: string | undefined;\n debugNodeApis: boolean;\n liveComponentSources: boolean;\n pushAllModules: boolean;\n allowUnstagingSchema: boolean;\n}> {\n if (cmdOptions.runComponent && !cmdOptions.run) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"Can't specify `--run-component` option without `--run`\",\n });\n }\n\n if (cmdOptions.debugBundlePath !== undefined && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-bundle-path` can only be used with `--once`.\",\n });\n }\n if (cmdOptions.debugNodeApis && !cmdOptions.once) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"`--debug-node-apis` can only be used with `--once`.\",\n });\n }\n\n return {\n verbose: !!cmdOptions.verbose,\n typecheck: cmdOptions.typecheck,\n typecheckComponents: !!cmdOptions.typecheckComponents,\n codegen: cmdOptions.codegen === \"enable\",\n once: !!cmdOptions.once,\n untilSuccess: cmdOptions.untilSuccess,\n run:\n cmdOptions.run !== undefined\n ? {\n kind: \"function\",\n name: cmdOptions.run,\n component: cmdOptions.runComponent,\n }\n : (cmdOptions.start ?? cmdOptions.runSh) !== undefined\n ? {\n kind: \"shell\",\n command: (cmdOptions.start ?? cmdOptions.runSh)!,\n }\n : undefined,\n tailLogs:\n typeof cmdOptions.tailLogs === \"string\"\n ? (cmdOptions.tailLogs as LogMode)\n : \"pause-on-deploy\",\n traceEvents: cmdOptions.traceEvents,\n debugBundlePath: cmdOptions.debugBundlePath,\n debugNodeApis: !!cmdOptions.debugNodeApis,\n liveComponentSources: !!cmdOptions.liveComponentSources,\n pushAllModules: !!cmdOptions.pushAllModules,\n allowUnstagingSchema: !!cmdOptions.allowUnstagingSchema,\n };\n}\n\nCommand.prototype.addDeployOptions = function () {\n return this.option(\"-v, --verbose\", \"Show full listing of changes\")\n .option(\n \"--dry-run\",\n \"Print out the generated configuration without deploying to your Convex deployment\",\n )\n .addOption(\n new Option(\n \"-y, --yes\",\n \"Skip confirmation prompt when running interactively. Warning: this deploys to PRODUCTION. To deploy to your current dev environment, run npx convex dev --once\",\n ).hideHelp(),\n )\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\` before deploying.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Whether to regenerate code in `convex/_generated/` before pushing.\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--cmd <command>\",\n \"Command to run as part of deploying your app (e.g. `vite build`). This command can depend on the environment variables specified in `--cmd-url-env-var-name` being set.\",\n ),\n )\n .addOption(\n new Option(\n \"--cmd-url-env-var-name <name>\",\n \"Environment variable name to set Convex deployment URL (e.g. `VITE_CONVEX_URL`) when using `--cmd`\",\n ),\n )\n .addOption(new Option(\"--debug-bundle-path <path>\").hideHelp())\n .addOption(new Option(\"--debug\").hideHelp())\n .addOption(new Option(\"--write-push-request <writePushRequest>\").hideHelp())\n .addOption(new Option(\"--live-component-sources\").hideHelp())\n .addOption(\n new Option(\n \"--push-all-modules\",\n \"Push all modules without checking for unchanged module hashes from the server\",\n )\n .default(false)\n .hideHelp(),\n );\n};\n\nCommand.prototype.addSelfHostOptions = function () {\n return this.option(\n \"--admin-key <adminKey>\",\n `An admin key for the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--url <url>\",\n `The url of the deployment. Can alternatively be set as \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` environment variable.`,\n )\n .option(\n \"--env <env>\",\n `Path to a custom file of environment variables, containing \\`${CONVEX_SELF_HOSTED_URL_VAR_NAME}\\` and \\`${CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME}\\`.`,\n );\n};\n\nCommand.prototype.addRunOptions = function () {\n return (\n this.argument(\n \"[functionName]\",\n \"identifier of the function to run, like `listMessages` or `dir/file:myFunction`\",\n )\n .argument(\n \"[args]\",\n \"JSON-formatted arguments object to pass to the function.\",\n )\n .option(\n \"-w, --watch\",\n \"Watch a query, printing its result if the underlying data changes. Given function must be a query.\",\n )\n .addOption(\n new Option(\n \"--inline-query <query>\",\n INLINE_QUERY_DESCRIPTION,\n ).conflicts(\"--watch\"),\n )\n .option(\"--push\", \"Push code to deployment before running the function.\")\n .addOption(\n new Option(\n \"--identity <identity>\",\n 'JSON-formatted UserIdentity object, e.g. \\'{ name: \"John\", address: \"0x123\" }\\'',\n ),\n )\n // For backwards compatibility we still support --no-push which is a noop\n .addOption(new Option(\"--no-push\").hideHelp())\n // Options for the deploy that --push does\n .addOption(\n new Option(\n \"--typecheck <mode>\",\n `Whether to check TypeScript files with \\`tsc --noEmit\\`.`,\n )\n .choices([\"enable\", \"try\", \"disable\"] as const)\n .default(\"try\" as const),\n )\n .option(\n \"--typecheck-components\",\n \"Check TypeScript files within component implementations with `tsc --noEmit`.\",\n false,\n )\n .addOption(\n new Option(\n \"--codegen <mode>\",\n \"Regenerate code in `convex/_generated/`\",\n )\n .choices([\"enable\", \"disable\"] as const)\n .default(\"enable\" as const),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n 'Path to the component (e.g. \"workflow\" or \"workflow/workpool\")',\n ),\n )\n .addOption(new Option(\"--live-component-sources\").hideHelp())\n );\n};\n\nCommand.prototype.addImportOptions = function () {\n return this.argument(\"<path>\", \"Path to the input file\")\n .addOption(\n new Option(\n \"--table <table>\",\n \"Destination table name. Required if format is csv, jsonLines, or jsonArray. Not supported if format is zip.\",\n ),\n )\n .addOption(\n new Option(\n \"--replace\",\n \"Replace all existing data in any of the imported tables\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace-all\"),\n )\n .addOption(\n new Option(\"--append\", \"Append imported data to any existing tables\")\n .conflicts(\"--replace-all\")\n .conflicts(\"--replace\"),\n )\n .addOption(\n new Option(\n \"--replace-all\",\n \"Replace all existing data in the deployment with the imported tables,\\n\" +\n \"deleting tables that don't appear in the import file or the schema,\\n\" +\n \"and clearing tables that appear in the schema but not in the import file\",\n )\n .conflicts(\"--append\")\n .conflicts(\"--replace\"),\n )\n .option(\n \"-y, --yes\",\n \"Skip confirmation prompt when import leads to deleting existing documents\",\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Input file format. This flag is only required if the filename is missing an extension.\\n\" +\n \"- CSV files must have a header, and each row's entries are interpreted either as a (floating point) number or a string.\\n\" +\n \"- JSON files must be an array of JSON objects.\\n\" +\n \"- JSONLines files must have a JSON object per line.\\n\" +\n \"- ZIP files must have one directory per table, containing <table>/documents.jsonl. Snapshot exports from the Convex dashboard have this format.\",\n ).choices([\"csv\", \"jsonLines\", \"jsonArray\", \"zip\"]),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n 'Path to the component (e.g. \"workflow\" or \"workflow/workpool\")',\n ),\n );\n};\n\nCommand.prototype.addExportOptions = function () {\n return this.requiredOption(\n \"--path <zipFilePath>\",\n \"Exports data into a ZIP file at this path, which may be a directory or unoccupied .zip path\",\n ).addOption(\n new Option(\n \"--include-file-storage\",\n \"Includes stored files (https://dashboard.convex.dev/deployment/files) in a _storage folder within the ZIP file\",\n ),\n );\n};\n\nCommand.prototype.addDataOptions = function () {\n return this.addOption(\n new Option(\n \"--limit <n>\",\n \"List only the `n` the most recently created documents.\",\n )\n .default(100)\n .argParser(parsePositiveInteger),\n )\n .addOption(\n new Option(\n \"--order <choice>\",\n \"Order the documents by their `_creationTime`.\",\n )\n .choices([\"asc\", \"desc\"])\n .default(\"desc\"),\n )\n .addOption(\n new Option(\n \"--component <path>\",\n 'Path to the component (e.g. \"workflow\" or \"workflow/workpool\")',\n ),\n )\n .addOption(\n new Option(\n \"--format <format>\",\n \"Format to print the data in. This flag is only required if the filename is missing an extension.\\n\" +\n \"- jsonArray (aka json): print the data as a JSON array of objects.\\n\" +\n \"- jsonLines (aka jsonl): print the data as a JSON object per line.\\n\" +\n \"- pretty: print the data in a human-readable format.\",\n ).choices([\"jsonArray\", \"json\", \"jsonLines\", \"jsonl\", \"pretty\"]),\n )\n .argument(\"[table]\", \"If specified, list documents in this table.\");\n};\n\nCommand.prototype.addLogsOptions = function () {\n return this.option(\n \"--history [n]\",\n \"Show `n` most recent logs. Defaults to showing all available logs.\",\n parseInteger,\n )\n .option(\n \"--success\",\n \"Print a log line for every successful function execution\",\n false,\n )\n .option(\"--jsonl\", \"Output raw log events as JSONL\", false)\n .addOption(\n new Option(\n \"--tail [n]\",\n \"Deprecated/unnecessary: `convex logs` already tails by default. Accepted as an alias for --history for compatibility with agents that pass it.\",\n )\n .argParser(parseInteger)\n .hideHelp(),\n );\n};\n\nCommand.prototype.addNetworkTestOptions = function () {\n return this.addOption(\n new Option(\n \"--timeout <timeout>\",\n \"Timeout in seconds for the network test (default: 30).\",\n ),\n )\n .addOption(\n new Option(\n \"--ip-family <ipFamily>\",\n \"IP family to use (ipv4, ipv6, or auto)\",\n ),\n )\n .addOption(\n new Option(\n \"--speed-test\",\n \"Perform a large echo test to measure network speed.\",\n ),\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8C;AAG9C,mBAMO;AACP,6BAAyC;AA6JzC,6BAAQ,UAAU,gCAAgC,SAChD,QACA,SACA;AACA,QAAM,YAAY,IAAI;AAAA,IACpB;AAAA,IACA,SAAS,cACL,SAAS,sCACT;AAAA,EACN,EAAE,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,MAAI,CAAC,SAAS,aAAa;AACzB,cAAU,SAAS;AAAA,EACrB;AACA,SAAO,KAAK,UAAU,SAAS,EAC5B,UAAU,IAAI,4BAAO,wBAAwB,EAAE,SAAS,CAAC,EACzD;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA,SAAS;AAAA,IACX,EAAE,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MAC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aAAa,QAAQ,aAAa,SAAS,QAAQ,CAAC;AAAA,EACjE,EACC,SAAS,WAAW,6CAA6C;AACtE;AAEA,6BAAQ,UAAU,iBAAiB,WAAY;AAC7C,SAAO,KAAK;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACG;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF,EACC,OAAO,WAAW,kCAAkC,KAAK,EACzD;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF,EACG,UAAU,yBAAY,EACtB,SAAS;AAAA,EACd;AACJ;AAEA,6BAAQ,UAAU,wBAAwB,WAAY;AACpD,SAAO,KAAK;AAAA,IACV,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACG;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF,EACC;AAAA,IACC,IAAI;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACJ;",
6
6
  "names": []
7
7
  }
@@ -456,6 +456,7 @@ async function bundleImplementations({
456
456
  }) {
457
457
  let appImplementation;
458
458
  const componentImplementations = [];
459
+ const buildDebugInfos = [];
459
460
  const directoriesToBundle = rootComponentDirectory.syntheticComponentImport ? componentDirectories : [rootComponentDirectory, ...componentDirectories];
460
461
  for (const directory of directoriesToBundle) {
461
462
  const isRoot = directory.path === rootComponentDirectory.path;
@@ -463,11 +464,21 @@ async function bundleImplementations({
463
464
  rootComponentDirectory.path,
464
465
  directory.path
465
466
  );
467
+ const definitionPath = (0, import_directoryStructure.toComponentDefinitionPath)(
468
+ rootComponentDirectory,
469
+ directory
470
+ );
466
471
  let schema;
467
- if (ctx.fs.exists(import_path.default.resolve(resolvedPath, "schema.ts"))) {
468
- schema = (await (0, import_bundler.bundleSchema)(ctx, resolvedPath, extraConditions))[0] || null;
469
- } else if (ctx.fs.exists(import_path.default.resolve(resolvedPath, "schema.js"))) {
470
- schema = (await (0, import_bundler.bundleSchema)(ctx, resolvedPath, extraConditions))[0] || null;
472
+ if (ctx.fs.exists(import_path.default.resolve(resolvedPath, "schema.ts")) || ctx.fs.exists(import_path.default.resolve(resolvedPath, "schema.js"))) {
473
+ const schemaResult = await (0, import_bundler.bundleSchema)(
474
+ ctx,
475
+ resolvedPath,
476
+ extraConditions
477
+ );
478
+ buildDebugInfos.push(
479
+ buildDebugInfo(directory, definitionPath, "schema", schemaResult)
480
+ );
481
+ schema = schemaResult.modules[0] || null;
471
482
  } else {
472
483
  schema = null;
473
484
  }
@@ -488,6 +499,9 @@ async function bundleImplementations({
488
499
  printedMessage: "external dependencies not supported"
489
500
  });
490
501
  }
502
+ buildDebugInfos.push(
503
+ buildDebugInfo(directory, definitionPath, "convex", convexResult)
504
+ );
491
505
  const functions = convexResult.modules;
492
506
  if (isRoot) {
493
507
  if (verbose) {
@@ -504,6 +518,9 @@ async function bundleImplementations({
504
518
  extraConditions,
505
519
  includeSourcesContent
506
520
  });
521
+ buildDebugInfos.push(
522
+ buildDebugInfo(directory, definitionPath, "node", nodeResult)
523
+ );
507
524
  const externalNodeDependencies = [];
508
525
  for (const [
509
526
  moduleName,
@@ -514,10 +531,13 @@ async function bundleImplementations({
514
531
  version: moduleVersion
515
532
  });
516
533
  }
517
- const authBundle = await (0, import_bundler.bundleAuthConfig)(ctx, resolvedPath);
534
+ const authResult = await (0, import_bundler.bundleAuthConfig)(ctx, resolvedPath);
535
+ buildDebugInfos.push(
536
+ buildDebugInfo(directory, definitionPath, "auth", authResult)
537
+ );
518
538
  appImplementation = {
519
539
  schema,
520
- functions: functions.concat(nodeResult.modules).concat(authBundle),
540
+ functions: functions.concat(nodeResult.modules).concat(authResult.modules),
521
541
  externalNodeDependencies
522
542
  };
523
543
  } else {
@@ -541,10 +561,6 @@ async function bundleImplementations({
541
561
  });
542
562
  }
543
563
  }
544
- const definitionPath = (0, import_directoryStructure.toComponentDefinitionPath)(
545
- rootComponentDirectory,
546
- directory
547
- );
548
564
  componentImplementations.push({ definitionPath, schema, functions });
549
565
  }
550
566
  }
@@ -563,7 +579,17 @@ async function bundleImplementations({
563
579
  });
564
580
  }
565
581
  }
566
- return { appImplementation, componentImplementations };
582
+ return { appImplementation, componentImplementations, buildDebugInfos };
583
+ }
584
+ function buildDebugInfo(directory, definitionPath, kind, result) {
585
+ return {
586
+ directory,
587
+ definitionPath,
588
+ kind,
589
+ metafile: result.metafile,
590
+ modules: result.modules,
591
+ externalDependencies: result.externalDependencies ?? /* @__PURE__ */ new Map()
592
+ };
567
593
  }
568
594
  async function registerEsbuildReads(ctx, absWorkingDir, metafile) {
569
595
  for (const [relPath, input] of Object.entries(metafile.inputs)) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/cli/lib/components/definition/bundle.ts"],
4
- "sourcesContent": ["import path from \"path\";\nimport {\n ComponentDirectory,\n ComponentDefinitionPath,\n buildComponentDirectory,\n isComponentDirectory,\n qualifiedDefinitionPath,\n toComponentDefinitionPath,\n} from \"./directoryStructure.js\";\nimport { Context } from \"../../../../bundler/context.js\";\nimport {\n logMessage,\n logWarning,\n showSpinner,\n} from \"../../../../bundler/log.js\";\nimport esbuild, { BuildOptions, Metafile, OutputFile, Plugin } from \"esbuild\";\nimport { chalkStderr } from \"chalk\";\nimport {\n AppDefinitionSpecWithoutImpls,\n ComponentDefinitionSpecWithoutImpls,\n} from \"../../config.js\";\nimport {\n Bundle,\n bundle,\n bundleAuthConfig,\n bundleSchema,\n entryPointsByEnvironment,\n} from \"../../../../bundler/index.js\";\nimport { NodeDependency } from \"../../deployApi/modules.js\";\n\nconst VIRTUAL_CONFIG_NAMESPACE = \"convex-virtual-config\";\nconst VIRTUAL_CONFIG_CONTENTS = `import { defineApp } from \"convex/server\";\\nconst app = defineApp();\\nexport default app;`;\n\n/**\n * An esbuild plugin to insert a virtual `convex.config.js` file into the bundle\n * when Convex project doesn't have one explicitly defined.\n *\n * This allows us to use the components push path even when the Convex project doesn't\n * have a config file defined.\n *\n * When importComponentPath is provided, the virtual config will import and use the\n * component found at that path.\n */\nfunction virtualConfig({\n rootComponentDirectory,\n importComponentPath,\n}: {\n rootComponentDirectory: ComponentDirectory;\n importComponentPath?: string;\n}): Plugin {\n // Empty config with no components\n let contents = VIRTUAL_CONFIG_CONTENTS;\n\n if (importComponentPath) {\n // Generate config that imports the specified component\n const relativeImport = path.relative(\n rootComponentDirectory.path,\n importComponentPath,\n );\n let normalizedImport = relativeImport\n .replace(/\\\\/g, \"/\")\n .replace(/\\.ts$/, \".js\");\n\n // We don't generate code for this synthetic root component so the name we\n // use for the component doesn't matter.\n contents = `import { defineApp } from \"convex/server\";\nimport component from \"${normalizedImport}\";\n\nconst app = defineApp();\napp.use(component, { name: \"exampleComponentInstance\" });\nexport default app;`;\n }\n\n return {\n name: `convex-virtual-config`,\n async setup(build) {\n const filter = pathToRegexFilter(rootComponentDirectory);\n build.onResolve({ filter }, async (args) => {\n return { path: args.path, namespace: VIRTUAL_CONFIG_NAMESPACE };\n });\n build.onLoad(\n { filter, namespace: VIRTUAL_CONFIG_NAMESPACE },\n async (_args) => {\n return {\n contents,\n resolveDir: rootComponentDirectory.path,\n };\n },\n );\n },\n };\n}\n\nfunction pathToRegexFilter(root: ComponentDirectory) {\n let path = qualifiedDefinitionPath(root);\n const escaped = path\n .replace(/\\\\/g, \"/\")\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n return new RegExp(`^${escaped}$`);\n}\n\n/**\n * An esbuild plugin to mark component definitions external or return a list of\n * all component definitions.\n *\n * By default this plugin runs in \"bundle\" mode and marks all imported component\n * definition files as external, not traversing further.\n *\n * If \"discover\" mode is specified it traverses the entire tree.\n */\nfunction componentPlugin({\n mode = \"bundle\",\n rootComponentDirectory,\n verbose,\n ctx,\n}: {\n mode: \"discover\" | \"bundle\";\n rootComponentDirectory: ComponentDirectory;\n verbose?: boolean;\n ctx: Context;\n}): Plugin {\n const components = new Map<string, ComponentDirectory>();\n return {\n name: `convex-${mode === \"discover\" ? \"discover-components\" : \"bundle-components\"}`,\n async setup(build) {\n // This regex can't be really precise since developers could import\n // \"convex.config\", \"convex.config.js\", \"convex.config.ts\", etc.\n build.onResolve({ filter: /.*convex.config.*/ }, async (args) => {\n verbose && logMessage(\"esbuild resolving import:\", args);\n if (\n args.namespace !== \"file\" &&\n args.namespace !== VIRTUAL_CONFIG_NAMESPACE\n ) {\n verbose && logMessage(\" Not a file or virtual config.\");\n return;\n }\n if (args.kind === \"entry-point\") {\n verbose && logMessage(\" -> Top-level entry-point.\");\n const componentDirectory = await buildComponentDirectory(\n ctx,\n path.resolve(args.path),\n );\n\n // No attempt to resolve args.path is made for entry points so they\n // must be relative or absolute file paths, not npm packages.\n // Whether we're bundling or discovering, we're done.\n if (components.get(args.path)) {\n // We always invoke esbuild in a try/catch.\n // eslint-disable-next-line no-restricted-syntax\n throw new Error(\n `Entry point component \"${args.path}\" already registered.`,\n );\n }\n components.set(args.path, componentDirectory);\n return;\n }\n\n const candidates = [args.path];\n const ext = path.extname(args.path);\n if (ext === \".js\") {\n candidates.push(args.path.slice(0, -\".js\".length) + \".ts\");\n }\n if (ext !== \".js\" && ext !== \".ts\") {\n candidates.push(args.path + \".js\");\n candidates.push(args.path + \".ts\");\n }\n let resolvedPath = undefined;\n for (const candidate of candidates) {\n const result = await build.resolve(candidate, {\n // We expect this to be \"import-statement\" but pass 'kind' through\n // to say honest to normal esbuild behavior.\n kind: args.kind,\n resolveDir: args.resolveDir,\n });\n if (result.path) {\n resolvedPath = result.path;\n break;\n }\n }\n if (resolvedPath === undefined) {\n verbose && logMessage(` -> ${args.path} not found.`);\n return;\n }\n\n const parentDir = path.dirname(resolvedPath);\n let imported = components.get(resolvedPath);\n if (!imported) {\n const isComponent = isComponentDirectory(ctx, parentDir, false);\n if (isComponent.kind !== \"ok\") {\n verbose && logMessage(\" -> Not a component:\", isComponent);\n return;\n }\n imported = isComponent.component;\n components.set(resolvedPath, imported);\n }\n\n verbose &&\n logMessage(\n \" -> Component import! Recording it.\",\n args.path,\n resolvedPath,\n );\n\n if (mode === \"discover\") {\n return {\n path: resolvedPath,\n };\n } else {\n // In bundle mode, transform external imports to use componentPaths:\n // import rateLimiter from \"convex_ratelimiter\";\n // => import rateLimiter from `_componentDeps/${base64('../node_modules/convex_ratelimiter')}`;\n\n // A componentPath is path from the root component to the directory\n // of the this component's definition file.\n const componentPath = toComponentDefinitionPath(\n rootComponentDirectory,\n imported,\n );\n const importPath = definitionImportPath(componentPath);\n return {\n path: importPath,\n external: true,\n };\n }\n });\n },\n };\n}\n\n/** The path on the deployment that identifier a component definition. */\nfunction definitionImportPath(componentPath: ComponentDefinitionPath): string {\n return `./_componentDeps/${Buffer.from(componentPath).toString(\"base64url\")}`;\n}\n\n// Share configuration between the component definition discovery and bundling passes.\nfunction sharedEsbuildOptions({\n liveComponentSources = false,\n}: {\n liveComponentSources?: boolean;\n}) {\n const options = {\n bundle: true,\n platform: \"browser\",\n format: \"esm\",\n target: \"esnext\",\n\n conditions: [\"convex\", \"module\"] as string[],\n\n // `false` is the default for splitting. It's simpler to evaluate these on\n // the server as a single file.\n // Splitting could be enabled for speed once the server supports it.\n splitting: false,\n\n // place output files in memory at their source locations\n write: false,\n outdir: path.parse(process.cwd()).root,\n outbase: path.parse(process.cwd()).root,\n\n minify: true, // Note that this implies NODE_ENV=\"production\".\n keepNames: true,\n\n metafile: true,\n } as const satisfies BuildOptions;\n\n // Link directly to component sources (usually .ts) in order to\n // skip the build step. This also causes codegen to run for components\n // loaded from npm packages.\n if (liveComponentSources) {\n options.conditions.push(\"@convex-dev/component-source\");\n }\n return options;\n}\n\n// Use the esbuild metafile to discover the dependency graph in which component\n// definitions are nodes.\nexport async function componentGraph(\n ctx: Context,\n absWorkingDir: string,\n rootComponentDirectory: ComponentDirectory,\n liveComponentSources: boolean,\n verbose: boolean = true,\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n if (\n rootComponentDirectory.isRootWithoutConfig &&\n !rootComponentDirectory.syntheticComponentImport\n ) {\n return {\n components: new Map([\n [rootComponentDirectory.path, rootComponentDirectory],\n ]),\n dependencyGraph: [],\n };\n }\n let result;\n try {\n result = await esbuild.build({\n absWorkingDir, // This is mostly useful for formatting error messages.\n entryPoints: [qualifiedDefinitionPath(rootComponentDirectory)],\n plugins: [\n componentPlugin({\n ctx,\n mode: \"discover\",\n verbose,\n rootComponentDirectory,\n }),\n ...(rootComponentDirectory.syntheticComponentImport\n ? [\n virtualConfig({\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }),\n ]\n : []),\n ],\n sourcemap: \"external\",\n sourcesContent: false,\n\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n if (rootComponentDirectory.syntheticComponentImport) {\n // Virtual configs appear in the metafile with a namespace prefix\n // and can't have ComponentDirectory objects built by reading the filesystem\n // so swap in this rootComponentDirectory.\n return await findComponentDependencies(ctx, result.metafile, {\n [`${VIRTUAL_CONFIG_NAMESPACE}:${qualifiedDefinitionPath(rootComponentDirectory)}`]:\n rootComponentDirectory,\n });\n }\n\n return await findComponentDependencies(ctx, result.metafile);\n}\n\n/**\n * Get dependencies of a ComponenDirectory as ComponentPaths.\n *\n * Component paths are paths relative to the root component.\n */\nexport function getDeps(\n rootComponent: ComponentDirectory,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n definitionPath: string,\n): ComponentDefinitionPath[] {\n return dependencyGraph\n .filter(\n ([importer, _imported]) => importer.definitionPath === definitionPath,\n )\n .map(([_importer, imported]) =>\n toComponentDefinitionPath(rootComponent, imported),\n );\n}\n\n/**\n * The returned dependency graph is an array of tuples of [importer, imported]\n *\n * This doesn't work on just any esbuild metafile because it assumes input\n * imports have not been transformed. We run it on the metafile produced by\n * the esbuild invocation that uses the component plugin in \"discover\" mode.\n *\n * @param inputOverrides - ComponentDirectory objects to be used for metafile.inputs\n * keys, in case they don't exist (namely virtual configs via esbuild plugin namespaces).\n */\nasync function findComponentDependencies(\n ctx: Context,\n metafile: Metafile,\n inputOverrides: Record<string, ComponentDirectory> = {},\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n const { inputs } = metafile;\n\n const componentsByKey = new Map<string, ComponentDirectory>();\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n const override: ComponentDirectory | undefined = inputOverrides[inputPath];\n if (override) {\n componentsByKey.set(inputPath, override);\n } else {\n // Normal component - build from filesystem\n const component = await buildComponentDirectory(ctx, inputPath);\n componentsByKey.set(path.resolve(inputPath), component);\n }\n }\n\n const dependencyGraph: [ComponentDirectory, ComponentDirectory][] = [];\n\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n // For overridden inputs, use the original key; for normal components, use resolved path\n const importerKey =\n inputPath in inputOverrides ? inputPath : path.resolve(inputPath);\n\n const importer = componentsByKey.get(importerKey);\n if (!importer) continue;\n\n const { imports } = inputs[inputPath];\n const componentImports = imports.filter((imp) =>\n imp.path.includes(\".config.\"),\n );\n\n for (const imp of componentImports) {\n const imported = componentsByKey.get(path.resolve(imp.path));\n if (!imported) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Didn't find ${path.resolve(imp.path)} in ${[...componentsByKey.keys()].toString()}`,\n });\n }\n\n // Grab the import specifier from the metafile (e.g. `@convex-dev/workpool/convex.config`) so\n // we can use it to import component APIs\n if (imp.original) {\n const importSpecifier = imp.original;\n const relativeSpecifier = importSpecifier.replace(\n /\\/convex\\.config.*$/,\n \"\",\n );\n\n imported.importSpecifier = relativeSpecifier;\n }\n\n dependencyGraph.push([importer, imported]);\n }\n }\n\n const components = new Map<string, ComponentDirectory>();\n for (const directory of componentsByKey.values()) {\n components.set(directory.path, directory);\n }\n\n return { components, dependencyGraph };\n}\n\n// NB: If a directory linked to is not a member of the passed\n// componentDirectories array then there will be external links\n// with no corresponding definition bundle.\n// That could be made to throw an error but maybe those are already available\n// on the Convex definition filesystem somehow, e.g. builtin components.\n/** Bundle the component definitions listed. */\nexport async function bundleDefinitions(\n ctx: Context,\n absWorkingDir: string,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n rootComponentDirectory: ComponentDirectory,\n componentDirectories: ComponentDirectory[],\n liveComponentSources: boolean,\n verbose: boolean = false,\n): Promise<{\n appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls;\n componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[];\n}> {\n let result;\n try {\n let plugins = [\n componentPlugin({\n ctx,\n mode: \"bundle\",\n verbose,\n rootComponentDirectory,\n }),\n ];\n if (\n rootComponentDirectory.syntheticComponentImport ||\n rootComponentDirectory.isRootWithoutConfig\n ) {\n // Use virtual config (either with a component import or empty)\n plugins.push(\n virtualConfig(\n rootComponentDirectory.syntheticComponentImport\n ? {\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }\n : { rootComponentDirectory },\n ),\n );\n }\n result = await esbuild.build({\n absWorkingDir,\n entryPoints: componentDirectories.map((dir) =>\n qualifiedDefinitionPath(dir),\n ),\n plugins,\n sourcemap: true,\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n const outputs: {\n outputJs: OutputFile;\n outputJsMap?: OutputFile;\n directory: ComponentDirectory;\n }[] = [];\n for (const directory of componentDirectories) {\n const absInput = path.resolve(absWorkingDir, directory.definitionPath);\n const expectedOutputJs =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js\";\n const expectedOutputMap =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js.map\";\n const outputJs = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputJs,\n )[0];\n if (!outputJs) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `no JS found matching ${expectedOutputJs} in ${result.outputFiles.map((x) => x.path).toString()}`,\n });\n }\n const outputJsMap = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputMap,\n )[0];\n outputs.push({\n outputJs,\n outputJsMap,\n directory,\n });\n }\n\n const appBundles = outputs.filter(\n (out) => out.directory.path === rootComponentDirectory.path,\n );\n if (appBundles.length !== 1) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"found wrong number of app bundles\",\n });\n }\n const appBundle = appBundles[0];\n const componentBundles = outputs.filter(\n (out) => out.directory.path !== rootComponentDirectory.path,\n );\n\n const componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[] =\n componentBundles.map(({ directory, outputJs, outputJsMap }) => ({\n definitionPath: toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n ),\n definition: {\n path: path.relative(directory.path, outputJs.path),\n source: outputJs.text,\n sourceMap: outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: getDeps(\n rootComponentDirectory,\n dependencyGraph,\n directory.definitionPath,\n ),\n }));\n const appDeps = getDeps(\n rootComponentDirectory,\n dependencyGraph,\n appBundle.directory.definitionPath,\n );\n const appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls = {\n definition: {\n path: path.relative(rootComponentDirectory.path, appBundle.outputJs.path),\n source: appBundle.outputJs.text,\n sourceMap: appBundle.outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: appDeps,\n };\n return {\n appDefinitionSpecWithoutImpls,\n componentDefinitionSpecsWithoutImpls,\n };\n}\n\nexport async function bundleImplementations({\n ctx,\n rootComponentDirectory,\n componentDirectories,\n nodeExternalPackages,\n extraConditions,\n verbose = false,\n includeSourcesContent = false,\n}: {\n ctx: Context;\n rootComponentDirectory: ComponentDirectory;\n componentDirectories: ComponentDirectory[];\n nodeExternalPackages: string[];\n extraConditions: string[];\n verbose: boolean;\n includeSourcesContent?: boolean;\n}): Promise<{\n appImplementation: {\n schema: Bundle | null;\n functions: Bundle[];\n externalNodeDependencies: NodeDependency[];\n };\n componentImplementations: {\n schema: Bundle | null;\n functions: Bundle[];\n definitionPath: ComponentDefinitionPath;\n }[];\n}> {\n let appImplementation;\n const componentImplementations = [];\n\n // For --component-dir flag, skip bundling root implementations (no real code to bundle)\n const directoriesToBundle = rootComponentDirectory.syntheticComponentImport\n ? componentDirectories\n : [rootComponentDirectory, ...componentDirectories];\n\n for (const directory of directoriesToBundle) {\n const isRoot = directory.path === rootComponentDirectory.path;\n const resolvedPath = path.resolve(\n rootComponentDirectory.path,\n directory.path,\n );\n let schema;\n if (ctx.fs.exists(path.resolve(resolvedPath, \"schema.ts\"))) {\n schema =\n (await bundleSchema(ctx, resolvedPath, extraConditions))[0] || null;\n } else if (ctx.fs.exists(path.resolve(resolvedPath, \"schema.js\"))) {\n schema =\n (await bundleSchema(ctx, resolvedPath, extraConditions))[0] || null;\n } else {\n schema = null;\n }\n\n const entryPoints = await entryPointsByEnvironment(ctx, resolvedPath);\n const convexResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.isolate,\n generateSourceMaps: true,\n platform: \"browser\",\n extraConditions,\n includeSourcesContent,\n });\n\n if (convexResult.externalDependencies.size !== 0) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"external dependencies not supported\",\n });\n }\n const functions = convexResult.modules;\n if (isRoot) {\n if (verbose) {\n showSpinner(\"Bundling modules for Node.js runtime...\");\n }\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n\n const externalNodeDependencies: NodeDependency[] = [];\n for (const [\n moduleName,\n moduleVersion,\n ] of nodeResult.externalDependencies) {\n externalNodeDependencies.push({\n name: moduleName,\n version: moduleVersion,\n });\n }\n const authBundle = await bundleAuthConfig(ctx, resolvedPath);\n appImplementation = {\n schema,\n functions: functions.concat(nodeResult.modules).concat(authBundle),\n externalNodeDependencies,\n };\n } else {\n // Reject push if components have node bundles in non-root directories.\n if (directory.path !== rootComponentDirectory.path) {\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n if (nodeResult.modules.length > 0) {\n // TODO(ENG-7116) Remove error and bundle the component node actions when we are ready to support them.\n await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `\"use node\" directive is not supported in components. Remove it from the component at: ${resolvedPath}.`,\n });\n }\n }\n // definitionPath is the canonical form\n const definitionPath = toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n );\n componentImplementations.push({ definitionPath, schema, functions });\n }\n }\n\n if (!appImplementation) {\n // For --component-dir flag, we don't bundle root implementations so provide an empty one\n if (rootComponentDirectory.syntheticComponentImport) {\n appImplementation = {\n schema: null,\n functions: [],\n externalNodeDependencies: [],\n };\n } else {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"No app implementation found\",\n });\n }\n }\n\n return { appImplementation, componentImplementations };\n}\n\nasync function registerEsbuildReads(\n ctx: Context,\n absWorkingDir: string,\n metafile: Metafile,\n) {\n for (const [relPath, input] of Object.entries(metafile.inputs)) {\n if (\n // We rewrite these files so this integrity check isn't useful.\n path.basename(relPath).includes(\"convex.config\") ||\n // TODO: esbuild outputs paths prefixed with \"(disabled)\" when bundling our internal\n // udf-system package. The files do actually exist locally, though.\n relPath.indexOf(\"(disabled):\") !== -1 ||\n relPath.startsWith(\"wasm-binary:\") ||\n relPath.startsWith(\"wasm-stub:\")\n ) {\n continue;\n }\n const absPath = path.resolve(absWorkingDir, relPath);\n const st = ctx.fs.stat(absPath);\n if (st.size !== input.bytes) {\n // Consider this a transient error so we'll try again and hopefully\n // no files change right after esbuild next time.\n logWarning(\n `Bundled file ${absPath} changed right after esbuild invocation`,\n );\n return await ctx.crash({\n exitCode: 1,\n errorType: \"transient\",\n printedMessage: null,\n });\n }\n ctx.fs.registerPath(absPath, st);\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,gCAOO;AAEP,iBAIO;AACP,qBAAoE;AACpE,mBAA4B;AAK5B,qBAMO;AAGP,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;AAAA;AAAA;AAYhC,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AACF,GAGW;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,GAAG;AAC9D;AAAA;AAAA,MAEE,YAAAA,QAAK,SAAS,OAAO,EAAE,SAAS,eAAe;AAAA;AAAA,MAG/C,QAAQ,QAAQ,aAAa,MAAM,MACnC,QAAQ,WAAW,cAAc,KACjC,QAAQ,WAAW,YAAY;AAAA,MAC/B;AACA;AAAA,IACF;AACA,UAAM,UAAU,YAAAA,QAAK,QAAQ,eAAe,OAAO;AACnD,UAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AAC9B,QAAI,GAAG,SAAS,MAAM,OAAO;AAG3B;AAAA,QACE,gBAAgB,OAAO;AAAA,MACzB;AACA,aAAO,MAAM,IAAI,MAAM;AAAA,QACrB,UAAU;AAAA,QACV,WAAW;AAAA,QACX,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH;AACA,QAAI,GAAG,aAAa,SAAS,EAAE;AAAA,EACjC;AACF;",
4
+ "sourcesContent": ["import path from \"path\";\nimport {\n ComponentDirectory,\n ComponentDefinitionPath,\n buildComponentDirectory,\n isComponentDirectory,\n qualifiedDefinitionPath,\n toComponentDefinitionPath,\n} from \"./directoryStructure.js\";\nimport { Context } from \"../../../../bundler/context.js\";\nimport {\n logMessage,\n logWarning,\n showSpinner,\n} from \"../../../../bundler/log.js\";\nimport esbuild, { BuildOptions, Metafile, OutputFile, Plugin } from \"esbuild\";\nimport { chalkStderr } from \"chalk\";\nimport {\n AppDefinitionSpecWithoutImpls,\n ComponentDefinitionSpecWithoutImpls,\n} from \"../../config.js\";\nimport {\n Bundle,\n bundle,\n bundleAuthConfig,\n bundleSchema,\n entryPointsByEnvironment,\n} from \"../../../../bundler/index.js\";\nimport { NodeDependency } from \"../../deployApi/modules.js\";\n\nconst VIRTUAL_CONFIG_NAMESPACE = \"convex-virtual-config\";\nconst VIRTUAL_CONFIG_CONTENTS = `import { defineApp } from \"convex/server\";\\nconst app = defineApp();\\nexport default app;`;\n\n/**\n * An esbuild plugin to insert a virtual `convex.config.js` file into the bundle\n * when Convex project doesn't have one explicitly defined.\n *\n * This allows us to use the components push path even when the Convex project doesn't\n * have a config file defined.\n *\n * When importComponentPath is provided, the virtual config will import and use the\n * component found at that path.\n */\nfunction virtualConfig({\n rootComponentDirectory,\n importComponentPath,\n}: {\n rootComponentDirectory: ComponentDirectory;\n importComponentPath?: string;\n}): Plugin {\n // Empty config with no components\n let contents = VIRTUAL_CONFIG_CONTENTS;\n\n if (importComponentPath) {\n // Generate config that imports the specified component\n const relativeImport = path.relative(\n rootComponentDirectory.path,\n importComponentPath,\n );\n let normalizedImport = relativeImport\n .replace(/\\\\/g, \"/\")\n .replace(/\\.ts$/, \".js\");\n\n // We don't generate code for this synthetic root component so the name we\n // use for the component doesn't matter.\n contents = `import { defineApp } from \"convex/server\";\nimport component from \"${normalizedImport}\";\n\nconst app = defineApp();\napp.use(component, { name: \"exampleComponentInstance\" });\nexport default app;`;\n }\n\n return {\n name: `convex-virtual-config`,\n async setup(build) {\n const filter = pathToRegexFilter(rootComponentDirectory);\n build.onResolve({ filter }, async (args) => {\n return { path: args.path, namespace: VIRTUAL_CONFIG_NAMESPACE };\n });\n build.onLoad(\n { filter, namespace: VIRTUAL_CONFIG_NAMESPACE },\n async (_args) => {\n return {\n contents,\n resolveDir: rootComponentDirectory.path,\n };\n },\n );\n },\n };\n}\n\nfunction pathToRegexFilter(root: ComponentDirectory) {\n let path = qualifiedDefinitionPath(root);\n const escaped = path\n .replace(/\\\\/g, \"/\")\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n return new RegExp(`^${escaped}$`);\n}\n\n/**\n * An esbuild plugin to mark component definitions external or return a list of\n * all component definitions.\n *\n * By default this plugin runs in \"bundle\" mode and marks all imported component\n * definition files as external, not traversing further.\n *\n * If \"discover\" mode is specified it traverses the entire tree.\n */\nfunction componentPlugin({\n mode = \"bundle\",\n rootComponentDirectory,\n verbose,\n ctx,\n}: {\n mode: \"discover\" | \"bundle\";\n rootComponentDirectory: ComponentDirectory;\n verbose?: boolean;\n ctx: Context;\n}): Plugin {\n const components = new Map<string, ComponentDirectory>();\n return {\n name: `convex-${mode === \"discover\" ? \"discover-components\" : \"bundle-components\"}`,\n async setup(build) {\n // This regex can't be really precise since developers could import\n // \"convex.config\", \"convex.config.js\", \"convex.config.ts\", etc.\n build.onResolve({ filter: /.*convex.config.*/ }, async (args) => {\n verbose && logMessage(\"esbuild resolving import:\", args);\n if (\n args.namespace !== \"file\" &&\n args.namespace !== VIRTUAL_CONFIG_NAMESPACE\n ) {\n verbose && logMessage(\" Not a file or virtual config.\");\n return;\n }\n if (args.kind === \"entry-point\") {\n verbose && logMessage(\" -> Top-level entry-point.\");\n const componentDirectory = await buildComponentDirectory(\n ctx,\n path.resolve(args.path),\n );\n\n // No attempt to resolve args.path is made for entry points so they\n // must be relative or absolute file paths, not npm packages.\n // Whether we're bundling or discovering, we're done.\n if (components.get(args.path)) {\n // We always invoke esbuild in a try/catch.\n // eslint-disable-next-line no-restricted-syntax\n throw new Error(\n `Entry point component \"${args.path}\" already registered.`,\n );\n }\n components.set(args.path, componentDirectory);\n return;\n }\n\n const candidates = [args.path];\n const ext = path.extname(args.path);\n if (ext === \".js\") {\n candidates.push(args.path.slice(0, -\".js\".length) + \".ts\");\n }\n if (ext !== \".js\" && ext !== \".ts\") {\n candidates.push(args.path + \".js\");\n candidates.push(args.path + \".ts\");\n }\n let resolvedPath = undefined;\n for (const candidate of candidates) {\n const result = await build.resolve(candidate, {\n // We expect this to be \"import-statement\" but pass 'kind' through\n // to say honest to normal esbuild behavior.\n kind: args.kind,\n resolveDir: args.resolveDir,\n });\n if (result.path) {\n resolvedPath = result.path;\n break;\n }\n }\n if (resolvedPath === undefined) {\n verbose && logMessage(` -> ${args.path} not found.`);\n return;\n }\n\n const parentDir = path.dirname(resolvedPath);\n let imported = components.get(resolvedPath);\n if (!imported) {\n const isComponent = isComponentDirectory(ctx, parentDir, false);\n if (isComponent.kind !== \"ok\") {\n verbose && logMessage(\" -> Not a component:\", isComponent);\n return;\n }\n imported = isComponent.component;\n components.set(resolvedPath, imported);\n }\n\n verbose &&\n logMessage(\n \" -> Component import! Recording it.\",\n args.path,\n resolvedPath,\n );\n\n if (mode === \"discover\") {\n return {\n path: resolvedPath,\n };\n } else {\n // In bundle mode, transform external imports to use componentPaths:\n // import rateLimiter from \"convex_ratelimiter\";\n // => import rateLimiter from `_componentDeps/${base64('../node_modules/convex_ratelimiter')}`;\n\n // A componentPath is path from the root component to the directory\n // of the this component's definition file.\n const componentPath = toComponentDefinitionPath(\n rootComponentDirectory,\n imported,\n );\n const importPath = definitionImportPath(componentPath);\n return {\n path: importPath,\n external: true,\n };\n }\n });\n },\n };\n}\n\n/** The path on the deployment that identifier a component definition. */\nfunction definitionImportPath(componentPath: ComponentDefinitionPath): string {\n return `./_componentDeps/${Buffer.from(componentPath).toString(\"base64url\")}`;\n}\n\n// Share configuration between the component definition discovery and bundling passes.\nfunction sharedEsbuildOptions({\n liveComponentSources = false,\n}: {\n liveComponentSources?: boolean;\n}) {\n const options = {\n bundle: true,\n platform: \"browser\",\n format: \"esm\",\n target: \"esnext\",\n\n conditions: [\"convex\", \"module\"] as string[],\n\n // `false` is the default for splitting. It's simpler to evaluate these on\n // the server as a single file.\n // Splitting could be enabled for speed once the server supports it.\n splitting: false,\n\n // place output files in memory at their source locations\n write: false,\n outdir: path.parse(process.cwd()).root,\n outbase: path.parse(process.cwd()).root,\n\n minify: true, // Note that this implies NODE_ENV=\"production\".\n keepNames: true,\n\n metafile: true,\n } as const satisfies BuildOptions;\n\n // Link directly to component sources (usually .ts) in order to\n // skip the build step. This also causes codegen to run for components\n // loaded from npm packages.\n if (liveComponentSources) {\n options.conditions.push(\"@convex-dev/component-source\");\n }\n return options;\n}\n\n// Use the esbuild metafile to discover the dependency graph in which component\n// definitions are nodes.\nexport async function componentGraph(\n ctx: Context,\n absWorkingDir: string,\n rootComponentDirectory: ComponentDirectory,\n liveComponentSources: boolean,\n verbose: boolean = true,\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n if (\n rootComponentDirectory.isRootWithoutConfig &&\n !rootComponentDirectory.syntheticComponentImport\n ) {\n return {\n components: new Map([\n [rootComponentDirectory.path, rootComponentDirectory],\n ]),\n dependencyGraph: [],\n };\n }\n let result;\n try {\n result = await esbuild.build({\n absWorkingDir, // This is mostly useful for formatting error messages.\n entryPoints: [qualifiedDefinitionPath(rootComponentDirectory)],\n plugins: [\n componentPlugin({\n ctx,\n mode: \"discover\",\n verbose,\n rootComponentDirectory,\n }),\n ...(rootComponentDirectory.syntheticComponentImport\n ? [\n virtualConfig({\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }),\n ]\n : []),\n ],\n sourcemap: \"external\",\n sourcesContent: false,\n\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n if (rootComponentDirectory.syntheticComponentImport) {\n // Virtual configs appear in the metafile with a namespace prefix\n // and can't have ComponentDirectory objects built by reading the filesystem\n // so swap in this rootComponentDirectory.\n return await findComponentDependencies(ctx, result.metafile, {\n [`${VIRTUAL_CONFIG_NAMESPACE}:${qualifiedDefinitionPath(rootComponentDirectory)}`]:\n rootComponentDirectory,\n });\n }\n\n return await findComponentDependencies(ctx, result.metafile);\n}\n\n/**\n * Get dependencies of a ComponenDirectory as ComponentPaths.\n *\n * Component paths are paths relative to the root component.\n */\nexport function getDeps(\n rootComponent: ComponentDirectory,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n definitionPath: string,\n): ComponentDefinitionPath[] {\n return dependencyGraph\n .filter(\n ([importer, _imported]) => importer.definitionPath === definitionPath,\n )\n .map(([_importer, imported]) =>\n toComponentDefinitionPath(rootComponent, imported),\n );\n}\n\n/**\n * The returned dependency graph is an array of tuples of [importer, imported]\n *\n * This doesn't work on just any esbuild metafile because it assumes input\n * imports have not been transformed. We run it on the metafile produced by\n * the esbuild invocation that uses the component plugin in \"discover\" mode.\n *\n * @param inputOverrides - ComponentDirectory objects to be used for metafile.inputs\n * keys, in case they don't exist (namely virtual configs via esbuild plugin namespaces).\n */\nasync function findComponentDependencies(\n ctx: Context,\n metafile: Metafile,\n inputOverrides: Record<string, ComponentDirectory> = {},\n): Promise<{\n components: Map<string, ComponentDirectory>;\n dependencyGraph: [ComponentDirectory, ComponentDirectory][];\n}> {\n const { inputs } = metafile;\n\n const componentsByKey = new Map<string, ComponentDirectory>();\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n const override: ComponentDirectory | undefined = inputOverrides[inputPath];\n if (override) {\n componentsByKey.set(inputPath, override);\n } else {\n // Normal component - build from filesystem\n const component = await buildComponentDirectory(ctx, inputPath);\n componentsByKey.set(path.resolve(inputPath), component);\n }\n }\n\n const dependencyGraph: [ComponentDirectory, ComponentDirectory][] = [];\n\n for (const inputPath of Object.keys(inputs)) {\n if (!inputPath.includes(\".config.\")) continue;\n\n // For overridden inputs, use the original key; for normal components, use resolved path\n const importerKey =\n inputPath in inputOverrides ? inputPath : path.resolve(inputPath);\n\n const importer = componentsByKey.get(importerKey);\n if (!importer) continue;\n\n const { imports } = inputs[inputPath];\n const componentImports = imports.filter((imp) =>\n imp.path.includes(\".config.\"),\n );\n\n for (const imp of componentImports) {\n const imported = componentsByKey.get(path.resolve(imp.path));\n if (!imported) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `Didn't find ${path.resolve(imp.path)} in ${[...componentsByKey.keys()].toString()}`,\n });\n }\n\n // Grab the import specifier from the metafile (e.g. `@convex-dev/workpool/convex.config`) so\n // we can use it to import component APIs\n if (imp.original) {\n const importSpecifier = imp.original;\n const relativeSpecifier = importSpecifier.replace(\n /\\/convex\\.config.*$/,\n \"\",\n );\n\n imported.importSpecifier = relativeSpecifier;\n }\n\n dependencyGraph.push([importer, imported]);\n }\n }\n\n const components = new Map<string, ComponentDirectory>();\n for (const directory of componentsByKey.values()) {\n components.set(directory.path, directory);\n }\n\n return { components, dependencyGraph };\n}\n\n// NB: If a directory linked to is not a member of the passed\n// componentDirectories array then there will be external links\n// with no corresponding definition bundle.\n// That could be made to throw an error but maybe those are already available\n// on the Convex definition filesystem somehow, e.g. builtin components.\n/** Bundle the component definitions listed. */\nexport async function bundleDefinitions(\n ctx: Context,\n absWorkingDir: string,\n dependencyGraph: [ComponentDirectory, ComponentDirectory][],\n rootComponentDirectory: ComponentDirectory,\n componentDirectories: ComponentDirectory[],\n liveComponentSources: boolean,\n verbose: boolean = false,\n): Promise<{\n appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls;\n componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[];\n}> {\n let result;\n try {\n let plugins = [\n componentPlugin({\n ctx,\n mode: \"bundle\",\n verbose,\n rootComponentDirectory,\n }),\n ];\n if (\n rootComponentDirectory.syntheticComponentImport ||\n rootComponentDirectory.isRootWithoutConfig\n ) {\n // Use virtual config (either with a component import or empty)\n plugins.push(\n virtualConfig(\n rootComponentDirectory.syntheticComponentImport\n ? {\n rootComponentDirectory,\n importComponentPath:\n rootComponentDirectory.syntheticComponentImport,\n }\n : { rootComponentDirectory },\n ),\n );\n }\n result = await esbuild.build({\n absWorkingDir,\n entryPoints: componentDirectories.map((dir) =>\n qualifiedDefinitionPath(dir),\n ),\n plugins,\n sourcemap: true,\n ...sharedEsbuildOptions({ liveComponentSources }),\n });\n await registerEsbuildReads(ctx, absWorkingDir, result.metafile);\n } catch (err: any) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `esbuild failed: ${err}`,\n });\n }\n\n if (result.errors.length) {\n const message = result.errors.map((error) => error.text).join(\"\\n\");\n return await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: message,\n });\n }\n for (const warning of result.warnings) {\n logWarning(chalkStderr.yellow(`esbuild warning: ${warning.text}`));\n }\n\n const outputs: {\n outputJs: OutputFile;\n outputJsMap?: OutputFile;\n directory: ComponentDirectory;\n }[] = [];\n for (const directory of componentDirectories) {\n const absInput = path.resolve(absWorkingDir, directory.definitionPath);\n const expectedOutputJs =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js\";\n const expectedOutputMap =\n absInput.slice(0, absInput.lastIndexOf(\".\")) + \".js.map\";\n const outputJs = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputJs,\n )[0];\n if (!outputJs) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: `no JS found matching ${expectedOutputJs} in ${result.outputFiles.map((x) => x.path).toString()}`,\n });\n }\n const outputJsMap = result.outputFiles.filter(\n (outputFile) => outputFile.path === expectedOutputMap,\n )[0];\n outputs.push({\n outputJs,\n outputJsMap,\n directory,\n });\n }\n\n const appBundles = outputs.filter(\n (out) => out.directory.path === rootComponentDirectory.path,\n );\n if (appBundles.length !== 1) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"found wrong number of app bundles\",\n });\n }\n const appBundle = appBundles[0];\n const componentBundles = outputs.filter(\n (out) => out.directory.path !== rootComponentDirectory.path,\n );\n\n const componentDefinitionSpecsWithoutImpls: ComponentDefinitionSpecWithoutImpls[] =\n componentBundles.map(({ directory, outputJs, outputJsMap }) => ({\n definitionPath: toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n ),\n definition: {\n path: path.relative(directory.path, outputJs.path),\n source: outputJs.text,\n sourceMap: outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: getDeps(\n rootComponentDirectory,\n dependencyGraph,\n directory.definitionPath,\n ),\n }));\n const appDeps = getDeps(\n rootComponentDirectory,\n dependencyGraph,\n appBundle.directory.definitionPath,\n );\n const appDefinitionSpecWithoutImpls: AppDefinitionSpecWithoutImpls = {\n definition: {\n path: path.relative(rootComponentDirectory.path, appBundle.outputJs.path),\n source: appBundle.outputJs.text,\n sourceMap: appBundle.outputJsMap?.text,\n environment: \"isolate\" as const,\n },\n dependencies: appDeps,\n };\n return {\n appDefinitionSpecWithoutImpls,\n componentDefinitionSpecsWithoutImpls,\n };\n}\n\nexport async function bundleImplementations({\n ctx,\n rootComponentDirectory,\n componentDirectories,\n nodeExternalPackages,\n extraConditions,\n verbose = false,\n includeSourcesContent = false,\n}: {\n ctx: Context;\n rootComponentDirectory: ComponentDirectory;\n componentDirectories: ComponentDirectory[];\n nodeExternalPackages: string[];\n extraConditions: string[];\n verbose: boolean;\n includeSourcesContent?: boolean;\n}): Promise<{\n appImplementation: {\n schema: Bundle | null;\n functions: Bundle[];\n externalNodeDependencies: NodeDependency[];\n };\n componentImplementations: {\n schema: Bundle | null;\n functions: Bundle[];\n definitionPath: ComponentDefinitionPath;\n }[];\n buildDebugInfos: BuildDebugInfo[];\n}> {\n let appImplementation;\n const componentImplementations = [];\n const buildDebugInfos: BuildDebugInfo[] = [];\n\n // For --component-dir flag, skip bundling root implementations (no real code to bundle)\n const directoriesToBundle = rootComponentDirectory.syntheticComponentImport\n ? componentDirectories\n : [rootComponentDirectory, ...componentDirectories];\n\n for (const directory of directoriesToBundle) {\n const isRoot = directory.path === rootComponentDirectory.path;\n const resolvedPath = path.resolve(\n rootComponentDirectory.path,\n directory.path,\n );\n // definitionPath is the canonical form\n const definitionPath = toComponentDefinitionPath(\n rootComponentDirectory,\n directory,\n );\n let schema;\n if (\n ctx.fs.exists(path.resolve(resolvedPath, \"schema.ts\")) ||\n ctx.fs.exists(path.resolve(resolvedPath, \"schema.js\"))\n ) {\n const schemaResult = await bundleSchema(\n ctx,\n resolvedPath,\n extraConditions,\n );\n buildDebugInfos.push(\n buildDebugInfo(directory, definitionPath, \"schema\", schemaResult),\n );\n schema = schemaResult.modules[0] || null;\n } else {\n schema = null;\n }\n\n const entryPoints = await entryPointsByEnvironment(ctx, resolvedPath);\n const convexResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n metafile: Metafile | null;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.isolate,\n generateSourceMaps: true,\n platform: \"browser\",\n extraConditions,\n includeSourcesContent,\n });\n\n if (convexResult.externalDependencies.size !== 0) {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"external dependencies not supported\",\n });\n }\n buildDebugInfos.push(\n buildDebugInfo(directory, definitionPath, \"convex\", convexResult),\n );\n const functions = convexResult.modules;\n if (isRoot) {\n if (verbose) {\n showSpinner(\"Bundling modules for Node.js runtime...\");\n }\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n metafile: Metafile | null;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n buildDebugInfos.push(\n buildDebugInfo(directory, definitionPath, \"node\", nodeResult),\n );\n\n const externalNodeDependencies: NodeDependency[] = [];\n for (const [\n moduleName,\n moduleVersion,\n ] of nodeResult.externalDependencies) {\n externalNodeDependencies.push({\n name: moduleName,\n version: moduleVersion,\n });\n }\n const authResult = await bundleAuthConfig(ctx, resolvedPath);\n buildDebugInfos.push(\n buildDebugInfo(directory, definitionPath, \"auth\", authResult),\n );\n appImplementation = {\n schema,\n functions: functions\n .concat(nodeResult.modules)\n .concat(authResult.modules),\n externalNodeDependencies,\n };\n } else {\n // Reject push if components have node bundles in non-root directories.\n if (directory.path !== rootComponentDirectory.path) {\n const nodeResult: {\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n bundledModuleNames: Set<string>;\n } = await bundle({\n ctx,\n dir: resolvedPath,\n entryPoints: entryPoints.node,\n generateSourceMaps: true,\n platform: \"node\",\n chunksFolder: path.join(\"_deps\", \"node\"),\n externalPackagesAllowList: nodeExternalPackages,\n extraConditions,\n includeSourcesContent,\n });\n if (nodeResult.modules.length > 0) {\n // TODO(ENG-7116) Remove error and bundle the component node actions when we are ready to support them.\n await ctx.crash({\n exitCode: 1,\n errorType: \"invalid filesystem data\",\n printedMessage: `\"use node\" directive is not supported in components. Remove it from the component at: ${resolvedPath}.`,\n });\n }\n }\n componentImplementations.push({ definitionPath, schema, functions });\n }\n }\n\n if (!appImplementation) {\n // For --component-dir flag, we don't bundle root implementations so provide an empty one\n if (rootComponentDirectory.syntheticComponentImport) {\n appImplementation = {\n schema: null,\n functions: [],\n externalNodeDependencies: [],\n };\n } else {\n return await ctx.crash({\n exitCode: 1,\n errorType: \"fatal\",\n printedMessage: \"No app implementation found\",\n });\n }\n }\n\n return { appImplementation, componentImplementations, buildDebugInfos };\n}\n\n/**\n * Debug information for a build in a push.\n */\nexport type BuildDebugInfo = {\n directory: ComponentDirectory;\n definitionPath: ComponentDefinitionPath;\n kind: \"convex\" | \"node\" | \"schema\" | \"auth\";\n metafile: Metafile | null;\n modules: Bundle[];\n externalDependencies: Map<string, string>;\n};\n\nfunction buildDebugInfo(\n directory: ComponentDirectory,\n definitionPath: ComponentDefinitionPath,\n kind: BuildDebugInfo[\"kind\"],\n result: {\n modules: Bundle[];\n metafile: Metafile | null;\n externalDependencies?: Map<string, string>;\n },\n): BuildDebugInfo {\n return {\n directory,\n definitionPath,\n kind,\n metafile: result.metafile,\n modules: result.modules,\n externalDependencies: result.externalDependencies ?? new Map(),\n };\n}\n\nasync function registerEsbuildReads(\n ctx: Context,\n absWorkingDir: string,\n metafile: Metafile,\n) {\n for (const [relPath, input] of Object.entries(metafile.inputs)) {\n if (\n // We rewrite these files so this integrity check isn't useful.\n path.basename(relPath).includes(\"convex.config\") ||\n // TODO: esbuild outputs paths prefixed with \"(disabled)\" when bundling our internal\n // udf-system package. The files do actually exist locally, though.\n relPath.indexOf(\"(disabled):\") !== -1 ||\n relPath.startsWith(\"wasm-binary:\") ||\n relPath.startsWith(\"wasm-stub:\")\n ) {\n continue;\n }\n const absPath = path.resolve(absWorkingDir, relPath);\n const st = ctx.fs.stat(absPath);\n if (st.size !== input.bytes) {\n // Consider this a transient error so we'll try again and hopefully\n // no files change right after esbuild next time.\n logWarning(\n `Bundled file ${absPath} changed right after esbuild invocation`,\n );\n return await ctx.crash({\n exitCode: 1,\n errorType: \"transient\",\n printedMessage: null,\n });\n }\n ctx.fs.registerPath(absPath, st);\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,gCAOO;AAEP,iBAIO;AACP,qBAAoE;AACpE,mBAA4B;AAK5B,qBAMO;AAGP,MAAM,2BAA2B;AACjC,MAAM,0BAA0B;AAAA;AAAA;AAYhC,SAAS,cAAc;AAAA,EACrB;AAAA,EACA;AACF,GAGW;AAET,MAAI,WAAW;AAEf,MAAI,qBAAqB;AAEvB,UAAM,iBAAiB,YAAAA,QAAK;AAAA,MAC1B,uBAAuB;AAAA,MACvB;AAAA,IACF;AACA,QAAI,mBAAmB,eACpB,QAAQ,OAAO,GAAG,EAClB,QAAQ,SAAS,KAAK;AAIzB,eAAW;AAAA,yBACU,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKvC;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM,MAAM,OAAO;AACjB,YAAM,SAAS,kBAAkB,sBAAsB;AACvD,YAAM,UAAU,EAAE,OAAO,GAAG,OAAO,SAAS;AAC1C,eAAO,EAAE,MAAM,KAAK,MAAM,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,SAAS,KAAK,KAAK,OAAO,QAAQ,SAAS,MAAM,GAAG;AAC9D;AAAA;AAAA,MAEE,YAAAA,QAAK,SAAS,OAAO,EAAE,SAAS,eAAe;AAAA;AAAA,MAG/C,QAAQ,QAAQ,aAAa,MAAM,MACnC,QAAQ,WAAW,cAAc,KACjC,QAAQ,WAAW,YAAY;AAAA,MAC/B;AACA;AAAA,IACF;AACA,UAAM,UAAU,YAAAA,QAAK,QAAQ,eAAe,OAAO;AACnD,UAAM,KAAK,IAAI,GAAG,KAAK,OAAO;AAC9B,QAAI,GAAG,SAAS,MAAM,OAAO;AAG3B;AAAA,QACE,gBAAgB,OAAO;AAAA,MACzB;AACA,aAAO,MAAM,IAAI,MAAM;AAAA,QACrB,UAAU;AAAA,QACV,WAAW;AAAA,QACX,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH;AACA,QAAI,GAAG,aAAa,SAAS,EAAE;AAAA,EACjC;AACF;",
6
6
  "names": ["path", "esbuild"]
7
7
  }
@@ -53,6 +53,10 @@ var import_constants = require("./components/constants.js");
53
53
  var import_dashboard = require("./dashboard.js");
54
54
  var import_indexes = require("./indexes.js");
55
55
  var import_checkForLargeIndexDeletion = require("./checkForLargeIndexDeletion.js");
56
+ var import_checkForSlowSchemaValidation = require("./checkForSlowSchemaValidation.js");
57
+ var import_checkForLargeIndexBackfill = require("./checkForLargeIndexBackfill.js");
58
+ var import_schemaEvaluation = require("./schemaEvaluation.js");
59
+ var import_checkForStagedValidatorDeletion = require("./checkForStagedValidatorDeletion.js");
56
60
  var import_crypto = require("crypto");
57
61
  async function runCodegen(ctx, credentials, options) {
58
62
  await (0, import_utils.ensureHasConvexDependency)(ctx, "codegen");
@@ -84,7 +88,12 @@ async function runCodegen(ctx, credentials, options) {
84
88
  codegen: true,
85
89
  liveComponentSources: options.liveComponentSources,
86
90
  typecheckComponents: false,
87
- debugNodeApis: options.debugNodeApis
91
+ debugNodeApis: options.debugNodeApis,
92
+ // Code generation uses the source schema independently of deployment data.
93
+ largeIndexDeletionCheck: "no verification",
94
+ largeIndexBackfillCheck: "no verification",
95
+ stagedValidatorDeletionCheck: "no verification",
96
+ warnOnSlowSchemaValidation: false
88
97
  }
89
98
  );
90
99
  } else {
@@ -313,6 +322,11 @@ async function startComponentsPushAndCodegen(ctx, parentSpan, projectConfig, con
313
322
  return null;
314
323
  }
315
324
  logStartPushSizes(parentSpan, startPushRequest);
325
+ const schemaEvaluation = (0, import_schemaEvaluation.sharedSchemaEvaluation)(
326
+ ctx,
327
+ startPushRequest,
328
+ options
329
+ );
316
330
  if (options.largeIndexDeletionCheck !== "no verification") {
317
331
  await parentSpan.enterAsync(
318
332
  "checkForLargeIndexDeletion",
@@ -321,10 +335,51 @@ async function startComponentsPushAndCodegen(ctx, parentSpan, projectConfig, con
321
335
  span,
322
336
  request: startPushRequest,
323
337
  options,
338
+ schemaEvaluation,
324
339
  askForConfirmation: options.largeIndexDeletionCheck === "ask for confirmation"
325
340
  })
326
341
  );
327
342
  }
343
+ const largeIndexBackfillCheck = options.largeIndexBackfillCheck;
344
+ if (largeIndexBackfillCheck !== "no verification") {
345
+ await parentSpan.enterAsync(
346
+ "checkForLargeIndexBackfill",
347
+ (span) => (0, import_checkForLargeIndexBackfill.checkForLargeIndexBackfill)({
348
+ ctx,
349
+ span,
350
+ schemaEvaluation,
351
+ options,
352
+ // A dry run never blocks on a backfill, so it only reports.
353
+ mode: options.dryRun ? "warn" : largeIndexBackfillCheck
354
+ })
355
+ );
356
+ }
357
+ const stagedValidatorDeletionCheck = options.stagedValidatorDeletionCheck;
358
+ if (stagedValidatorDeletionCheck !== "no verification") {
359
+ await parentSpan.enterAsync(
360
+ "checkForStagedValidatorDeletion",
361
+ async (span) => {
362
+ const response = await schemaEvaluation(span);
363
+ await (0, import_checkForStagedValidatorDeletion.checkForStagedValidatorDeletion)({
364
+ ctx,
365
+ response,
366
+ askForConfirmation: stagedValidatorDeletionCheck === "ask for confirmation",
367
+ // A dry run previews the confirmation required by a real push.
368
+ dryRun: options.dryRun
369
+ });
370
+ }
371
+ );
372
+ }
373
+ if (options.warnOnSlowSchemaValidation && (options.dryRun || stagedValidatorDeletionCheck !== "no verification" || (0, import_schemaEvaluation.pushStagesValidators)(startPushRequest))) {
374
+ await parentSpan.enterAsync(
375
+ "checkForSlowSchemaValidation",
376
+ (span) => (0, import_checkForSlowSchemaValidation.checkForSlowSchemaValidation)({
377
+ span,
378
+ schemaEvaluation,
379
+ dryRun: options.dryRun
380
+ })
381
+ );
382
+ }
328
383
  (0, import_log.changeSpinner)("Uploading functions to Convex...");
329
384
  const startPushResponse = await parentSpan.enterAsync(
330
385
  "startPush",