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.
- package/CHANGELOG.md +105 -6
- package/dist/browser.bundle.js +7 -1
- package/dist/browser.bundle.js.map +2 -2
- package/dist/cjs/browser/http_client.js.map +2 -2
- package/dist/cjs/browser/query_options.js.map +2 -2
- package/dist/cjs/browser/simple_client.js.map +2 -2
- package/dist/cjs/browser/sync/optimistic_updates.js.map +1 -1
- package/dist/cjs/browser/sync/optimistic_updates_impl.js.map +2 -2
- package/dist/cjs/bundler/index.js +5 -4
- package/dist/cjs/bundler/index.js.map +2 -2
- package/dist/cjs/cli/codegen.js +0 -2
- package/dist/cjs/cli/codegen.js.map +2 -2
- package/dist/cjs/cli/configure.js +13 -4
- package/dist/cjs/cli/configure.js.map +2 -2
- package/dist/cjs/cli/deploy.js +28 -2
- package/dist/cjs/cli/deploy.js.map +2 -2
- package/dist/cjs/cli/deploymentSelect.js +2 -2
- package/dist/cjs/cli/deploymentSelect.js.map +2 -2
- package/dist/cjs/cli/dev.js +6 -0
- package/dist/cjs/cli/dev.js.map +2 -2
- package/dist/cjs/cli/docs.js +3 -36
- package/dist/cjs/cli/docs.js.map +2 -2
- package/dist/cjs/cli/env.js +10 -5
- package/dist/cjs/cli/env.js.map +2 -2
- package/dist/cjs/cli/envDefault.js +7 -2
- package/dist/cjs/cli/envDefault.js.map +2 -2
- package/dist/cjs/cli/generatedApi.js.map +1 -1
- package/dist/cjs/cli/lib/api.js +2 -0
- package/dist/cjs/cli/lib/api.js.map +2 -2
- package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js +113 -0
- package/dist/cjs/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
- package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js +100 -70
- package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
- package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js +126 -0
- package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js.map +7 -0
- package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js +90 -0
- package/dist/cjs/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
- package/dist/cjs/cli/lib/codegen.js.map +2 -2
- package/dist/cjs/cli/lib/command.js +2 -1
- package/dist/cjs/cli/lib/command.js.map +2 -2
- package/dist/cjs/cli/lib/components/definition/bundle.js +37 -11
- package/dist/cjs/cli/lib/components/definition/bundle.js.map +2 -2
- package/dist/cjs/cli/lib/components.js +56 -1
- package/dist/cjs/cli/lib/components.js.map +2 -2
- package/dist/cjs/cli/lib/config.js +56 -17
- package/dist/cjs/cli/lib/config.js.map +2 -2
- package/dist/cjs/cli/lib/deploy2.js +32 -3
- package/dist/cjs/cli/lib/deploy2.js.map +2 -2
- package/dist/cjs/cli/lib/deployApi/evaluateSchema.js +101 -0
- package/dist/cjs/cli/lib/deployApi/evaluateSchema.js.map +7 -0
- package/dist/cjs/cli/lib/deployApi/finishPush.js +1 -0
- package/dist/cjs/cli/lib/deployApi/finishPush.js.map +2 -2
- package/dist/cjs/cli/lib/deployApi/startPush.js +1 -1
- package/dist/cjs/cli/lib/deployApi/startPush.js.map +2 -2
- package/dist/cjs/cli/lib/dev.js +6 -0
- package/dist/cjs/cli/lib/dev.js.map +2 -2
- package/dist/cjs/cli/lib/formatValidationProgress.js +47 -0
- package/dist/cjs/cli/lib/formatValidationProgress.js.map +7 -0
- package/dist/cjs/cli/lib/generatedFunctionLogsApi.js.map +1 -1
- package/dist/cjs/cli/lib/indexes.js.map +1 -1
- package/dist/cjs/cli/lib/localDeployment/run.js +30 -1
- package/dist/cjs/cli/lib/localDeployment/run.js.map +2 -2
- package/dist/cjs/cli/lib/localDeployment/upgrade.js +6 -5
- package/dist/cjs/cli/lib/localDeployment/upgrade.js.map +2 -2
- package/dist/cjs/cli/lib/localDeployment/utils.js +5 -1
- package/dist/cjs/cli/lib/localDeployment/utils.js.map +2 -2
- package/dist/cjs/cli/lib/mcp/tools/env.js +10 -3
- package/dist/cjs/cli/lib/mcp/tools/env.js.map +2 -2
- package/dist/cjs/cli/lib/run.js +5 -0
- package/dist/cjs/cli/lib/run.js.map +2 -2
- package/dist/cjs/cli/lib/schemaEvaluation.js +62 -0
- package/dist/cjs/cli/lib/schemaEvaluation.js.map +7 -0
- package/dist/cjs/cli/lib/usageLimits.js +4 -2
- package/dist/cjs/cli/lib/usageLimits.js.map +2 -2
- package/dist/cjs/cli/lib/utils/mutex.js +9 -24
- package/dist/cjs/cli/lib/utils/mutex.js.map +2 -2
- package/dist/cjs/cli/lib/utils/utils.js +84 -47
- package/dist/cjs/cli/lib/utils/utils.js.map +2 -2
- package/dist/cjs/cli/projectCreate.js +1 -1
- package/dist/cjs/cli/projectCreate.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/nextjs/index.js.map +2 -2
- package/dist/cjs/react/client.js.map +2 -2
- package/dist/cjs/react/hydration.js.map +2 -2
- package/dist/cjs/react/queries_observer.js.map +2 -2
- package/dist/cjs/react/use_paginated_query2.js.map +2 -2
- package/dist/cjs/react/use_queries.js.map +2 -2
- package/dist/cjs/server/api.js.map +2 -2
- package/dist/cjs/server/components/index.js.map +2 -2
- package/dist/cjs/server/cron.js +10 -10
- package/dist/cjs/server/cron.js.map +2 -2
- package/dist/cjs/server/impl/actions_impl.js +8 -3
- package/dist/cjs/server/impl/actions_impl.js.map +2 -2
- package/dist/cjs/server/impl/meta_impl.js +8 -2
- package/dist/cjs/server/impl/meta_impl.js.map +2 -2
- package/dist/cjs/server/impl/scheduler_impl.js.map +2 -2
- package/dist/cjs/server/impl/storage_impl.js +29 -0
- package/dist/cjs/server/impl/storage_impl.js.map +2 -2
- package/dist/cjs/server/index.js +1 -0
- package/dist/cjs/server/index.js.map +2 -2
- package/dist/cjs/server/meta.js.map +1 -1
- package/dist/cjs/server/registration.js.map +1 -1
- package/dist/cjs/server/scheduler.js.map +1 -1
- package/dist/cjs/server/schema.js +72 -3
- package/dist/cjs/server/schema.js.map +2 -2
- package/dist/cjs/server/storage.js.map +1 -1
- package/dist/cjs/values/validator.js +1 -1
- package/dist/cjs/values/validator.js.map +2 -2
- package/dist/cjs/values/validators.js +82 -26
- package/dist/cjs/values/validators.js.map +2 -2
- package/dist/cjs/values/value.js +6 -0
- package/dist/cjs/values/value.js.map +2 -2
- package/dist/cjs-types/browser/http_client.d.ts +5 -5
- package/dist/cjs-types/browser/http_client.d.ts.map +1 -1
- package/dist/cjs-types/browser/query_options.d.ts +2 -2
- package/dist/cjs-types/browser/query_options.d.ts.map +1 -1
- package/dist/cjs-types/browser/simple_client.d.ts +6 -6
- package/dist/cjs-types/browser/simple_client.d.ts.map +1 -1
- package/dist/cjs-types/browser/sync/optimistic_updates.d.ts +4 -4
- package/dist/cjs-types/browser/sync/optimistic_updates.d.ts.map +1 -1
- package/dist/cjs-types/browser/sync/optimistic_updates_impl.d.ts.map +1 -1
- package/dist/cjs-types/bundler/index.d.ts +9 -2
- package/dist/cjs-types/bundler/index.d.ts.map +1 -1
- package/dist/cjs-types/cli/codegen.d.ts.map +1 -1
- package/dist/cjs-types/cli/configure.d.ts +6 -0
- package/dist/cjs-types/cli/configure.d.ts.map +1 -1
- package/dist/cjs-types/cli/deploy.d.ts +2 -0
- package/dist/cjs-types/cli/deploy.d.ts.map +1 -1
- package/dist/cjs-types/cli/deploymentCreate.d.ts +6 -6
- package/dist/cjs-types/cli/deploymentSelect.d.ts.map +1 -1
- package/dist/cjs-types/cli/dev.d.ts +1 -0
- package/dist/cjs-types/cli/dev.d.ts.map +1 -1
- package/dist/cjs-types/cli/docs.d.ts.map +1 -1
- package/dist/cjs-types/cli/env.d.ts.map +1 -1
- package/dist/cjs-types/cli/envDefault.d.ts.map +1 -1
- package/dist/cjs-types/cli/generatedApi.d.ts +1 -1
- package/dist/cjs-types/cli/generatedApi.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/api.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
- package/dist/cjs-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts +25 -6
- package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts +8 -0
- package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
- package/dist/cjs-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/codegen.d.ts +0 -2
- package/dist/cjs-types/cli/lib/codegen.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/command.d.ts +2 -0
- package/dist/cjs-types/cli/lib/command.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts +13 -0
- package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/components.d.ts +5 -0
- package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/config.d.ts +2 -1
- package/dist/cjs-types/cli/lib/config.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deploy2.d.ts +8 -0
- package/dist/cjs-types/cli/lib/deploy2.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts +897 -0
- package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/deployApi/finishPush.d.ts +1 -2
- package/dist/cjs-types/cli/lib/deployApi/finishPush.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/dev.d.ts +1 -0
- package/dist/cjs-types/cli/lib/dev.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/formatValidationProgress.d.ts +8 -0
- package/dist/cjs-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts +2 -0
- package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/run.d.ts +2 -0
- package/dist/cjs-types/cli/lib/localDeployment/run.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts +1 -0
- package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/mcp/tools/env.d.ts +8 -5
- package/dist/cjs-types/cli/lib/mcp/tools/env.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/run.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts +33 -0
- package/dist/cjs-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/usageLimits.d.ts +1 -1
- package/dist/cjs-types/cli/lib/usageLimits.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/utils/mutex.d.ts +1 -3
- package/dist/cjs-types/cli/lib/utils/mutex.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/utils/utils.d.ts +15 -7
- package/dist/cjs-types/cli/lib/utils/utils.d.ts.map +1 -1
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/cjs-types/nextjs/index.d.ts +6 -6
- package/dist/cjs-types/nextjs/index.d.ts.map +1 -1
- package/dist/cjs-types/react/client.d.ts +15 -15
- package/dist/cjs-types/react/client.d.ts.map +1 -1
- package/dist/cjs-types/react/hydration.d.ts +3 -3
- package/dist/cjs-types/react/hydration.d.ts.map +1 -1
- package/dist/cjs-types/react/queries_observer.d.ts +9 -9
- package/dist/cjs-types/react/queries_observer.d.ts.map +1 -1
- package/dist/cjs-types/react/use_paginated_query2.d.ts.map +1 -1
- package/dist/cjs-types/react/use_queries.d.ts +14 -6
- package/dist/cjs-types/react/use_queries.d.ts.map +1 -1
- package/dist/cjs-types/server/api.d.ts +157 -7
- package/dist/cjs-types/server/api.d.ts.map +1 -1
- package/dist/cjs-types/server/components/index.d.ts +2 -2
- package/dist/cjs-types/server/components/index.d.ts.map +1 -1
- package/dist/cjs-types/server/cron.d.ts +21 -20
- package/dist/cjs-types/server/cron.d.ts.map +1 -1
- package/dist/cjs-types/server/impl/actions_impl.d.ts +22 -7
- package/dist/cjs-types/server/impl/actions_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/impl/meta_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/impl/scheduler_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/impl/storage_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/index.d.ts +2 -2
- package/dist/cjs-types/server/index.d.ts.map +1 -1
- package/dist/cjs-types/server/meta.d.ts +63 -0
- package/dist/cjs-types/server/meta.d.ts.map +1 -1
- package/dist/cjs-types/server/registration.d.ts +17 -7
- package/dist/cjs-types/server/registration.d.ts.map +1 -1
- package/dist/cjs-types/server/scheduler.d.ts +9 -7
- package/dist/cjs-types/server/scheduler.d.ts.map +1 -1
- package/dist/cjs-types/server/schema.d.ts +34 -0
- package/dist/cjs-types/server/schema.d.ts.map +1 -1
- package/dist/cjs-types/server/storage.d.ts.map +1 -1
- package/dist/cjs-types/values/validator.d.ts.map +1 -1
- package/dist/cjs-types/values/validators.d.ts +30 -0
- package/dist/cjs-types/values/validators.d.ts.map +1 -1
- package/dist/cjs-types/values/value.d.ts.map +1 -1
- package/dist/cli.bundle.cjs +2728 -1627
- package/dist/cli.bundle.cjs.map +4 -4
- package/dist/esm/browser/http_client.js.map +2 -2
- package/dist/esm/browser/query_options.js.map +2 -2
- package/dist/esm/browser/simple_client.js.map +2 -2
- package/dist/esm/browser/sync/optimistic_updates_impl.js.map +2 -2
- package/dist/esm/bundler/index.js +5 -4
- package/dist/esm/bundler/index.js.map +2 -2
- package/dist/esm/cli/codegen.js +0 -2
- package/dist/esm/cli/codegen.js.map +2 -2
- package/dist/esm/cli/configure.js +12 -4
- package/dist/esm/cli/configure.js.map +2 -2
- package/dist/esm/cli/deploy.js +28 -2
- package/dist/esm/cli/deploy.js.map +2 -2
- package/dist/esm/cli/deploymentSelect.js +6 -3
- package/dist/esm/cli/deploymentSelect.js.map +2 -2
- package/dist/esm/cli/dev.js +6 -0
- package/dist/esm/cli/dev.js.map +2 -2
- package/dist/esm/cli/docs.js +3 -43
- package/dist/esm/cli/docs.js.map +2 -2
- package/dist/esm/cli/env.js +11 -6
- package/dist/esm/cli/env.js.map +2 -2
- package/dist/esm/cli/envDefault.js +7 -2
- package/dist/esm/cli/envDefault.js.map +2 -2
- package/dist/esm/cli/lib/api.js +2 -0
- package/dist/esm/cli/lib/api.js.map +2 -2
- package/dist/esm/cli/lib/checkForLargeIndexBackfill.js +95 -0
- package/dist/esm/cli/lib/checkForLargeIndexBackfill.js.map +7 -0
- package/dist/esm/cli/lib/checkForLargeIndexDeletion.js +98 -69
- package/dist/esm/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
- package/dist/esm/cli/lib/checkForSlowSchemaValidation.js +107 -0
- package/dist/esm/cli/lib/checkForSlowSchemaValidation.js.map +7 -0
- package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js +68 -0
- package/dist/esm/cli/lib/checkForStagedValidatorDeletion.js.map +7 -0
- package/dist/esm/cli/lib/codegen.js.map +2 -2
- package/dist/esm/cli/lib/command.js +2 -1
- package/dist/esm/cli/lib/command.js.map +2 -2
- package/dist/esm/cli/lib/components/definition/bundle.js +37 -11
- package/dist/esm/cli/lib/components/definition/bundle.js.map +2 -2
- package/dist/esm/cli/lib/components.js +63 -1
- package/dist/esm/cli/lib/components.js.map +2 -2
- package/dist/esm/cli/lib/config.js +55 -17
- package/dist/esm/cli/lib/config.js.map +2 -2
- package/dist/esm/cli/lib/deploy2.js +33 -3
- package/dist/esm/cli/lib/deploy2.js.map +2 -2
- package/dist/esm/cli/lib/deployApi/evaluateSchema.js +72 -0
- package/dist/esm/cli/lib/deployApi/evaluateSchema.js.map +7 -0
- package/dist/esm/cli/lib/deployApi/finishPush.js +1 -1
- package/dist/esm/cli/lib/deployApi/finishPush.js.map +2 -2
- package/dist/esm/cli/lib/deployApi/startPush.js +1 -1
- package/dist/esm/cli/lib/deployApi/startPush.js.map +2 -2
- package/dist/esm/cli/lib/dev.js +6 -0
- package/dist/esm/cli/lib/dev.js.map +2 -2
- package/dist/esm/cli/lib/formatValidationProgress.js +24 -0
- package/dist/esm/cli/lib/formatValidationProgress.js.map +7 -0
- package/dist/esm/cli/lib/indexes.js.map +1 -1
- package/dist/esm/cli/lib/localDeployment/run.js +30 -2
- package/dist/esm/cli/lib/localDeployment/run.js.map +2 -2
- package/dist/esm/cli/lib/localDeployment/upgrade.js +4 -3
- package/dist/esm/cli/lib/localDeployment/upgrade.js.map +2 -2
- package/dist/esm/cli/lib/localDeployment/utils.js +3 -0
- package/dist/esm/cli/lib/localDeployment/utils.js.map +2 -2
- package/dist/esm/cli/lib/mcp/tools/env.js +10 -3
- package/dist/esm/cli/lib/mcp/tools/env.js.map +2 -2
- package/dist/esm/cli/lib/run.js +5 -0
- package/dist/esm/cli/lib/run.js.map +2 -2
- package/dist/esm/cli/lib/schemaEvaluation.js +39 -0
- package/dist/esm/cli/lib/schemaEvaluation.js.map +7 -0
- package/dist/esm/cli/lib/usageLimits.js +4 -2
- package/dist/esm/cli/lib/usageLimits.js.map +2 -2
- package/dist/esm/cli/lib/utils/mutex.js +9 -24
- package/dist/esm/cli/lib/utils/mutex.js.map +2 -2
- package/dist/esm/cli/lib/utils/utils.js +84 -49
- package/dist/esm/cli/lib/utils/utils.js.map +2 -2
- package/dist/esm/cli/projectCreate.js +1 -1
- package/dist/esm/cli/projectCreate.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/nextjs/index.js.map +2 -2
- package/dist/esm/react/client.js.map +2 -2
- package/dist/esm/react/hydration.js +3 -1
- package/dist/esm/react/hydration.js.map +2 -2
- package/dist/esm/react/queries_observer.js +3 -1
- package/dist/esm/react/queries_observer.js.map +2 -2
- package/dist/esm/react/use_paginated_query2.js +3 -1
- package/dist/esm/react/use_paginated_query2.js.map +2 -2
- package/dist/esm/react/use_queries.js.map +2 -2
- package/dist/esm/server/api.js.map +2 -2
- package/dist/esm/server/components/index.js.map +2 -2
- package/dist/esm/server/cron.js +13 -11
- package/dist/esm/server/cron.js.map +2 -2
- package/dist/esm/server/impl/actions_impl.js +7 -3
- package/dist/esm/server/impl/actions_impl.js.map +2 -2
- package/dist/esm/server/impl/meta_impl.js +9 -3
- package/dist/esm/server/impl/meta_impl.js.map +2 -2
- package/dist/esm/server/impl/scheduler_impl.js.map +2 -2
- package/dist/esm/server/impl/storage_impl.js +29 -0
- package/dist/esm/server/impl/storage_impl.js.map +2 -2
- package/dist/esm/server/index.js +4 -1
- package/dist/esm/server/index.js.map +2 -2
- package/dist/esm/server/schema.js +72 -3
- package/dist/esm/server/schema.js.map +2 -2
- package/dist/esm/values/validator.js +1 -1
- package/dist/esm/values/validator.js.map +2 -2
- package/dist/esm/values/validators.js +82 -26
- package/dist/esm/values/validators.js.map +2 -2
- package/dist/esm/values/value.js +6 -0
- package/dist/esm/values/value.js.map +2 -2
- package/dist/esm-types/browser/http_client.d.ts +5 -5
- package/dist/esm-types/browser/http_client.d.ts.map +1 -1
- package/dist/esm-types/browser/query_options.d.ts +2 -2
- package/dist/esm-types/browser/query_options.d.ts.map +1 -1
- package/dist/esm-types/browser/simple_client.d.ts +6 -6
- package/dist/esm-types/browser/simple_client.d.ts.map +1 -1
- package/dist/esm-types/browser/sync/optimistic_updates.d.ts +4 -4
- package/dist/esm-types/browser/sync/optimistic_updates.d.ts.map +1 -1
- package/dist/esm-types/browser/sync/optimistic_updates_impl.d.ts.map +1 -1
- package/dist/esm-types/bundler/index.d.ts +9 -2
- package/dist/esm-types/bundler/index.d.ts.map +1 -1
- package/dist/esm-types/cli/codegen.d.ts.map +1 -1
- package/dist/esm-types/cli/configure.d.ts +6 -0
- package/dist/esm-types/cli/configure.d.ts.map +1 -1
- package/dist/esm-types/cli/deploy.d.ts +2 -0
- package/dist/esm-types/cli/deploy.d.ts.map +1 -1
- package/dist/esm-types/cli/deploymentCreate.d.ts +6 -6
- package/dist/esm-types/cli/deploymentSelect.d.ts.map +1 -1
- package/dist/esm-types/cli/dev.d.ts +1 -0
- package/dist/esm-types/cli/dev.d.ts.map +1 -1
- package/dist/esm-types/cli/docs.d.ts.map +1 -1
- package/dist/esm-types/cli/env.d.ts.map +1 -1
- package/dist/esm-types/cli/envDefault.d.ts.map +1 -1
- package/dist/esm-types/cli/generatedApi.d.ts +1 -1
- package/dist/esm-types/cli/generatedApi.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/api.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts +30 -0
- package/dist/esm-types/cli/lib/checkForLargeIndexBackfill.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts +25 -6
- package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts +8 -0
- package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts +17 -0
- package/dist/esm-types/cli/lib/checkForStagedValidatorDeletion.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/codegen.d.ts +0 -2
- package/dist/esm-types/cli/lib/codegen.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/command.d.ts +2 -0
- package/dist/esm-types/cli/lib/command.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/components/definition/bundle.d.ts +13 -0
- package/dist/esm-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/components.d.ts +5 -0
- package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/config.d.ts +2 -1
- package/dist/esm-types/cli/lib/config.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deploy2.d.ts +8 -0
- package/dist/esm-types/cli/lib/deploy2.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts +897 -0
- package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/deployApi/finishPush.d.ts +1 -2
- package/dist/esm-types/cli/lib/deployApi/finishPush.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/dev.d.ts +1 -0
- package/dist/esm-types/cli/lib/dev.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/formatValidationProgress.d.ts +8 -0
- package/dist/esm-types/cli/lib/formatValidationProgress.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts +2 -0
- package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/run.d.ts +2 -0
- package/dist/esm-types/cli/lib/localDeployment/run.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/utils.d.ts +1 -0
- package/dist/esm-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/mcp/tools/env.d.ts +8 -5
- package/dist/esm-types/cli/lib/mcp/tools/env.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/run.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/schemaEvaluation.d.ts +33 -0
- package/dist/esm-types/cli/lib/schemaEvaluation.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/usageLimits.d.ts +1 -1
- package/dist/esm-types/cli/lib/usageLimits.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/utils/mutex.d.ts +1 -3
- package/dist/esm-types/cli/lib/utils/mutex.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/utils/utils.d.ts +15 -7
- package/dist/esm-types/cli/lib/utils/utils.d.ts.map +1 -1
- package/dist/esm-types/index.d.ts +1 -1
- package/dist/esm-types/nextjs/index.d.ts +6 -6
- package/dist/esm-types/nextjs/index.d.ts.map +1 -1
- package/dist/esm-types/react/client.d.ts +15 -15
- package/dist/esm-types/react/client.d.ts.map +1 -1
- package/dist/esm-types/react/hydration.d.ts +3 -3
- package/dist/esm-types/react/hydration.d.ts.map +1 -1
- package/dist/esm-types/react/queries_observer.d.ts +9 -9
- package/dist/esm-types/react/queries_observer.d.ts.map +1 -1
- package/dist/esm-types/react/use_paginated_query2.d.ts.map +1 -1
- package/dist/esm-types/react/use_queries.d.ts +14 -6
- package/dist/esm-types/react/use_queries.d.ts.map +1 -1
- package/dist/esm-types/server/api.d.ts +157 -7
- package/dist/esm-types/server/api.d.ts.map +1 -1
- package/dist/esm-types/server/components/index.d.ts +2 -2
- package/dist/esm-types/server/components/index.d.ts.map +1 -1
- package/dist/esm-types/server/cron.d.ts +21 -20
- package/dist/esm-types/server/cron.d.ts.map +1 -1
- package/dist/esm-types/server/impl/actions_impl.d.ts +22 -7
- package/dist/esm-types/server/impl/actions_impl.d.ts.map +1 -1
- package/dist/esm-types/server/impl/meta_impl.d.ts.map +1 -1
- package/dist/esm-types/server/impl/scheduler_impl.d.ts.map +1 -1
- package/dist/esm-types/server/impl/storage_impl.d.ts.map +1 -1
- package/dist/esm-types/server/index.d.ts +2 -2
- package/dist/esm-types/server/index.d.ts.map +1 -1
- package/dist/esm-types/server/meta.d.ts +63 -0
- package/dist/esm-types/server/meta.d.ts.map +1 -1
- package/dist/esm-types/server/registration.d.ts +17 -7
- package/dist/esm-types/server/registration.d.ts.map +1 -1
- package/dist/esm-types/server/scheduler.d.ts +9 -7
- package/dist/esm-types/server/scheduler.d.ts.map +1 -1
- package/dist/esm-types/server/schema.d.ts +34 -0
- package/dist/esm-types/server/schema.d.ts.map +1 -1
- package/dist/esm-types/server/storage.d.ts.map +1 -1
- package/dist/esm-types/values/validator.d.ts.map +1 -1
- package/dist/esm-types/values/validators.d.ts +30 -0
- package/dist/esm-types/values/validators.d.ts.map +1 -1
- package/dist/esm-types/values/value.d.ts.map +1 -1
- package/dist/react.bundle.js +7 -1
- package/dist/react.bundle.js.map +2 -2
- package/package.json +9 -9
- package/schemas/convex.schema.json +5 -5
- package/src/browser/http_client.ts +43 -10
- package/src/browser/query_options.ts +11 -5
- package/src/browser/simple_client.ts +35 -14
- package/src/browser/sync/optimistic_updates.ts +17 -4
- package/src/browser/sync/optimistic_updates_impl.ts +17 -4
- package/src/bundler/index.ts +9 -4
- package/src/cli/codegen.ts +0 -1
- package/src/cli/configure.ts +27 -7
- package/src/cli/deploy.ts +37 -5
- package/src/cli/deploymentSelect.ts +7 -4
- package/src/cli/dev.ts +9 -0
- package/src/cli/docs.ts +3 -44
- package/src/cli/env.ts +12 -6
- package/src/cli/envDefault.ts +8 -2
- package/src/cli/generatedApi.ts +1 -1
- package/src/cli/lib/api.ts +5 -1
- package/src/cli/lib/checkForLargeIndexBackfill.ts +173 -0
- package/src/cli/lib/checkForLargeIndexDeletion.ts +150 -91
- package/src/cli/lib/checkForSlowSchemaValidation.ts +141 -0
- package/src/cli/lib/checkForStagedValidatorDeletion.ts +104 -0
- package/src/cli/lib/codegen.ts +0 -2
- package/src/cli/lib/command.ts +3 -0
- package/src/cli/lib/components/definition/bundle.ts +68 -14
- package/src/cli/lib/components.ts +84 -0
- package/src/cli/lib/config.ts +85 -18
- package/src/cli/lib/deploy2.ts +66 -2
- package/src/cli/lib/deployApi/evaluateSchema.ts +97 -0
- package/src/cli/lib/deployApi/finishPush.ts +1 -1
- package/src/cli/lib/deployApi/startPush.ts +1 -1
- package/src/cli/lib/dev.ts +15 -0
- package/src/cli/lib/formatValidationProgress.ts +35 -0
- package/src/cli/lib/generatedFunctionLogsApi.ts +2 -0
- package/src/cli/lib/indexes.ts +1 -1
- package/src/cli/lib/localDeployment/run.ts +44 -2
- package/src/cli/lib/localDeployment/upgrade.ts +4 -6
- package/src/cli/lib/localDeployment/utils.ts +6 -0
- package/src/cli/lib/mcp/tools/env.ts +17 -3
- package/src/cli/lib/run.ts +3 -0
- package/src/cli/lib/schemaEvaluation.ts +88 -0
- package/src/cli/lib/usageLimits.ts +2 -0
- package/src/cli/lib/utils/mutex.ts +9 -27
- package/src/cli/lib/utils/utils.ts +127 -56
- package/src/cli/projectCreate.ts +1 -1
- package/src/index.ts +1 -1
- package/src/nextjs/index.ts +19 -8
- package/src/react/client.ts +73 -30
- package/src/react/hydration.tsx +14 -6
- package/src/react/queries_observer.ts +19 -16
- package/src/react/use_paginated_query2.ts +10 -6
- package/src/react/use_queries.ts +23 -7
- package/src/server/api.ts +220 -14
- package/src/server/components/index.ts +4 -6
- package/src/server/cron.ts +34 -24
- package/src/server/impl/actions_impl.ts +39 -10
- package/src/server/impl/meta_impl.ts +8 -1
- package/src/server/impl/scheduler_impl.ts +13 -6
- package/src/server/impl/storage_impl.ts +30 -0
- package/src/server/index.ts +6 -1
- package/src/server/meta.ts +79 -0
- package/src/server/registration.ts +38 -7
- package/src/server/scheduler.ts +22 -7
- package/src/server/schema.ts +77 -0
- package/src/server/storage.ts +17 -0
- package/src/values/validator.ts +3 -1
- package/src/values/validators.ts +85 -27
- package/src/values/value.ts +9 -5
package/src/cli/projectCreate.ts
CHANGED
|
@@ -64,7 +64,7 @@ async function runProjectCreate(
|
|
|
64
64
|
logMessage(
|
|
65
65
|
chalkStderr.gray(
|
|
66
66
|
`Next, add a deployment with ` +
|
|
67
|
-
`\`npx convex deployment create ${team.slug}:${projectSlug}:dev --type dev\` ` +
|
|
67
|
+
`\`npx convex deployment create ${team.slug}:${projectSlug}:dev/my-feature --type dev --select\` ` +
|
|
68
68
|
`(pass \`--region us\` to choose a region).`,
|
|
69
69
|
),
|
|
70
70
|
);
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.47.0";
|
package/src/nextjs/index.ts
CHANGED
|
@@ -48,9 +48,10 @@ import { validateDeploymentUrl } from "../common/index.js";
|
|
|
48
48
|
import { Preloaded } from "../react/index.js";
|
|
49
49
|
import {
|
|
50
50
|
ArgsAndOptions,
|
|
51
|
-
FunctionReference,
|
|
52
51
|
FunctionReturnType,
|
|
53
52
|
getFunctionName,
|
|
53
|
+
FunctionReference,
|
|
54
|
+
FunctionReference_future,
|
|
54
55
|
} from "../server/index.js";
|
|
55
56
|
import { convexToJson, jsonToConvex } from "../values/index.js";
|
|
56
57
|
|
|
@@ -98,7 +99,9 @@ export type NextjsOptions = {
|
|
|
98
99
|
* @param options - A {@link NextjsOptions} options object for the query.
|
|
99
100
|
* @returns A promise of the `Preloaded` payload.
|
|
100
101
|
*/
|
|
101
|
-
export async function preloadQuery<
|
|
102
|
+
export async function preloadQuery<
|
|
103
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
104
|
+
>(
|
|
102
105
|
query: Query,
|
|
103
106
|
...args: ArgsAndOptions<Query, NextjsOptions>
|
|
104
107
|
): Promise<Preloaded<Query>> {
|
|
@@ -117,9 +120,9 @@ export async function preloadQuery<Query extends FunctionReference<"query">>(
|
|
|
117
120
|
* @param preloaded - The `Preloaded` payload returned by {@link preloadQuery}.
|
|
118
121
|
* @returns The query result.
|
|
119
122
|
*/
|
|
120
|
-
export function preloadedQueryResult<
|
|
121
|
-
|
|
122
|
-
): FunctionReturnType<Query> {
|
|
123
|
+
export function preloadedQueryResult<
|
|
124
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
125
|
+
>(preloaded: Preloaded<Query>): FunctionReturnType<Query> {
|
|
123
126
|
return jsonToConvex(preloaded._valueJSON);
|
|
124
127
|
}
|
|
125
128
|
|
|
@@ -133,7 +136,9 @@ export function preloadedQueryResult<Query extends FunctionReference<"query">>(
|
|
|
133
136
|
* @param options - A {@link NextjsOptions} options object for the query.
|
|
134
137
|
* @returns A promise of the query's result.
|
|
135
138
|
*/
|
|
136
|
-
export async function fetchQuery<
|
|
139
|
+
export async function fetchQuery<
|
|
140
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
141
|
+
>(
|
|
137
142
|
query: Query,
|
|
138
143
|
...args: ArgsAndOptions<Query, NextjsOptions>
|
|
139
144
|
): Promise<FunctionReturnType<Query>> {
|
|
@@ -153,7 +158,9 @@ export async function fetchQuery<Query extends FunctionReference<"query">>(
|
|
|
153
158
|
* @returns A promise of the mutation's result.
|
|
154
159
|
*/
|
|
155
160
|
export async function fetchMutation<
|
|
156
|
-
Mutation extends
|
|
161
|
+
Mutation extends
|
|
162
|
+
| FunctionReference<"mutation">
|
|
163
|
+
| FunctionReference_future<"mutation">,
|
|
157
164
|
>(
|
|
158
165
|
mutation: Mutation,
|
|
159
166
|
...args: ArgsAndOptions<Mutation, NextjsOptions>
|
|
@@ -173,7 +180,11 @@ export async function fetchMutation<
|
|
|
173
180
|
* @param options - A {@link NextjsOptions} options object for the action.
|
|
174
181
|
* @returns A promise of the action's result.
|
|
175
182
|
*/
|
|
176
|
-
export async function fetchAction<
|
|
183
|
+
export async function fetchAction<
|
|
184
|
+
Action extends
|
|
185
|
+
| FunctionReference<"action">
|
|
186
|
+
| FunctionReference_future<"action">,
|
|
187
|
+
>(
|
|
177
188
|
action: Action,
|
|
178
189
|
...args: ArgsAndOptions<Action, NextjsOptions>
|
|
179
190
|
): Promise<FunctionReturnType<Action>> {
|
package/src/react/client.ts
CHANGED
|
@@ -21,11 +21,12 @@ import { parseArgs } from "../common/index.js";
|
|
|
21
21
|
import {
|
|
22
22
|
ArgsAndOptions,
|
|
23
23
|
FunctionArgs,
|
|
24
|
-
FunctionReference,
|
|
25
24
|
FunctionReturnType,
|
|
26
25
|
OptionalRestArgs,
|
|
27
26
|
getFunctionName,
|
|
28
27
|
makeFunctionReference,
|
|
28
|
+
FunctionReference,
|
|
29
|
+
FunctionReference_future,
|
|
29
30
|
} from "../server/api.js";
|
|
30
31
|
import { EmptyObject } from "../server/registration.js";
|
|
31
32
|
import {
|
|
@@ -55,7 +56,11 @@ if (typeof React === "undefined") {
|
|
|
55
56
|
*
|
|
56
57
|
* @public
|
|
57
58
|
*/
|
|
58
|
-
export interface ReactMutation<
|
|
59
|
+
export interface ReactMutation<
|
|
60
|
+
Mutation extends
|
|
61
|
+
| FunctionReference<"mutation">
|
|
62
|
+
| FunctionReference_future<"mutation">,
|
|
63
|
+
> {
|
|
59
64
|
/**
|
|
60
65
|
* Execute the mutation on the server, returning a `Promise` of its return value.
|
|
61
66
|
*
|
|
@@ -95,7 +100,9 @@ export interface ReactMutation<Mutation extends FunctionReference<"mutation">> {
|
|
|
95
100
|
|
|
96
101
|
// Exported only for testing.
|
|
97
102
|
export function createMutation(
|
|
98
|
-
mutationReference:
|
|
103
|
+
mutationReference:
|
|
104
|
+
| FunctionReference<"mutation">
|
|
105
|
+
| FunctionReference_future<"mutation">,
|
|
99
106
|
client: ConvexReactClient,
|
|
100
107
|
update?: OptimisticUpdate<any>,
|
|
101
108
|
): ReactMutation<any> {
|
|
@@ -126,7 +133,11 @@ export function createMutation(
|
|
|
126
133
|
*
|
|
127
134
|
* @public
|
|
128
135
|
*/
|
|
129
|
-
export interface ReactAction<
|
|
136
|
+
export interface ReactAction<
|
|
137
|
+
Action extends
|
|
138
|
+
| FunctionReference<"action">
|
|
139
|
+
| FunctionReference_future<"action">,
|
|
140
|
+
> {
|
|
130
141
|
/**
|
|
131
142
|
* Execute the function on the server, returning a `Promise` of its return value.
|
|
132
143
|
*
|
|
@@ -138,7 +149,9 @@ export interface ReactAction<Action extends FunctionReference<"action">> {
|
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
function createAction(
|
|
141
|
-
actionReference:
|
|
152
|
+
actionReference:
|
|
153
|
+
| FunctionReference<"action">
|
|
154
|
+
| FunctionReference_future<"action">,
|
|
142
155
|
client: ConvexReactClient,
|
|
143
156
|
): ReactAction<any> {
|
|
144
157
|
return function (args?: Record<string, Value>): Promise<unknown> {
|
|
@@ -481,7 +494,11 @@ export class ConvexReactClient {
|
|
|
481
494
|
*
|
|
482
495
|
* @returns The {@link Watch} object.
|
|
483
496
|
*/
|
|
484
|
-
watchQuery<
|
|
497
|
+
watchQuery<
|
|
498
|
+
Query extends
|
|
499
|
+
| FunctionReference<"query">
|
|
500
|
+
| FunctionReference_future<"query">,
|
|
501
|
+
>(
|
|
485
502
|
query: Query,
|
|
486
503
|
...argsAndOptions: ArgsAndOptions<Query, WatchQueryOptions>
|
|
487
504
|
): Watch<FunctionReturnType<Query>> {
|
|
@@ -557,9 +574,11 @@ export class ConvexReactClient {
|
|
|
557
574
|
* @param queryOptions - A query (function reference from an api object) and its args, plus
|
|
558
575
|
* an optional extendSubscriptionFor for how long to subscribe to the query.
|
|
559
576
|
*/
|
|
560
|
-
prewarmQuery<
|
|
561
|
-
|
|
562
|
-
|
|
577
|
+
prewarmQuery<
|
|
578
|
+
Query extends
|
|
579
|
+
| FunctionReference<"query">
|
|
580
|
+
| FunctionReference_future<"query">,
|
|
581
|
+
>(queryOptions: QueryOptions<Query> & { extendSubscriptionFor?: number }) {
|
|
563
582
|
const extendSubscriptionFor =
|
|
564
583
|
queryOptions.extendSubscriptionFor ?? DEFAULT_EXTEND_SUBSCRIPTION_FOR;
|
|
565
584
|
const watch = this.watchQuery(queryOptions.query, queryOptions.args || {});
|
|
@@ -584,9 +603,13 @@ export class ConvexReactClient {
|
|
|
584
603
|
*
|
|
585
604
|
* @internal
|
|
586
605
|
*/
|
|
587
|
-
watchPaginatedQuery<
|
|
606
|
+
watchPaginatedQuery<
|
|
607
|
+
Query extends
|
|
608
|
+
| FunctionReference<"query">
|
|
609
|
+
| FunctionReference_future<"query">,
|
|
610
|
+
>(
|
|
588
611
|
query: Query,
|
|
589
|
-
args: Query
|
|
612
|
+
args: FunctionArgs<Query>,
|
|
590
613
|
options: WatchPaginatedQueryOptions,
|
|
591
614
|
): PaginatedWatch<FunctionReturnType<Query>> {
|
|
592
615
|
const name = getFunctionName(query);
|
|
@@ -634,7 +657,11 @@ export class ConvexReactClient {
|
|
|
634
657
|
* @param options - A {@link MutationOptions} options object for the mutation.
|
|
635
658
|
* @returns A promise of the mutation's result.
|
|
636
659
|
*/
|
|
637
|
-
mutation<
|
|
660
|
+
mutation<
|
|
661
|
+
Mutation extends
|
|
662
|
+
| FunctionReference<"mutation">
|
|
663
|
+
| FunctionReference_future<"mutation">,
|
|
664
|
+
>(
|
|
638
665
|
mutation: Mutation,
|
|
639
666
|
...argsAndOptions: ArgsAndOptions<
|
|
640
667
|
Mutation,
|
|
@@ -655,7 +682,11 @@ export class ConvexReactClient {
|
|
|
655
682
|
* the arguments will be `{}`.
|
|
656
683
|
* @returns A promise of the action's result.
|
|
657
684
|
*/
|
|
658
|
-
action<
|
|
685
|
+
action<
|
|
686
|
+
Action extends
|
|
687
|
+
| FunctionReference<"action">
|
|
688
|
+
| FunctionReference_future<"action">,
|
|
689
|
+
>(
|
|
659
690
|
action: Action,
|
|
660
691
|
...args: OptionalRestArgs<Action>
|
|
661
692
|
): Promise<FunctionReturnType<Action>> {
|
|
@@ -675,7 +706,11 @@ export class ConvexReactClient {
|
|
|
675
706
|
* the arguments will be `{}`.
|
|
676
707
|
* @returns A promise of the query's result.
|
|
677
708
|
*/
|
|
678
|
-
query<
|
|
709
|
+
query<
|
|
710
|
+
Query extends
|
|
711
|
+
| FunctionReference<"query">
|
|
712
|
+
| FunctionReference_future<"query">,
|
|
713
|
+
>(
|
|
679
714
|
query: Query,
|
|
680
715
|
...args: OptionalRestArgs<Query>
|
|
681
716
|
): Promise<FunctionReturnType<Query>> {
|
|
@@ -815,10 +850,12 @@ export const ConvexProvider: React.FC<{
|
|
|
815
850
|
);
|
|
816
851
|
};
|
|
817
852
|
|
|
818
|
-
export type OptionalRestArgsOrSkip<
|
|
819
|
-
FuncRef
|
|
853
|
+
export type OptionalRestArgsOrSkip<
|
|
854
|
+
FuncRef extends FunctionReference<any> | FunctionReference_future<any>,
|
|
855
|
+
> =
|
|
856
|
+
FunctionArgs<FuncRef> extends EmptyObject
|
|
820
857
|
? [args?: EmptyObject | "skip"]
|
|
821
|
-
: [args: FuncRef
|
|
858
|
+
: [args: FunctionArgs<FuncRef> | "skip"];
|
|
822
859
|
|
|
823
860
|
/**
|
|
824
861
|
* Result returned by object-form {@link useQuery_experimental}.
|
|
@@ -831,7 +868,7 @@ export type UseQueryResult<QueryResult, ThrowOnError extends boolean = false> =
|
|
|
831
868
|
| (ThrowOnError extends true ? never : { status: "error"; error: Error });
|
|
832
869
|
|
|
833
870
|
type UseQueryOptions<
|
|
834
|
-
Query extends FunctionReference<"query">,
|
|
871
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
835
872
|
ThrowOnError extends boolean,
|
|
836
873
|
> = {
|
|
837
874
|
query: Query;
|
|
@@ -882,10 +919,12 @@ type UseQueryOptions<
|
|
|
882
919
|
* @see https://docs.convex.dev/client/react#fetching-data
|
|
883
920
|
* @public
|
|
884
921
|
*/
|
|
885
|
-
export function useQuery<
|
|
922
|
+
export function useQuery<
|
|
923
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
924
|
+
>(
|
|
886
925
|
query: Query,
|
|
887
926
|
...args: OptionalRestArgsOrSkip<Query>
|
|
888
|
-
): Query
|
|
927
|
+
): FunctionReturnType<Query> | undefined {
|
|
889
928
|
const skip = args[0] === "skip";
|
|
890
929
|
const argsObject = args[0] === "skip" ? {} : parseArgs(args[0]);
|
|
891
930
|
const queryReference =
|
|
@@ -947,18 +986,18 @@ export function useQuery<Query extends FunctionReference<"query">>(
|
|
|
947
986
|
* @public
|
|
948
987
|
*/
|
|
949
988
|
export function useQuery_experimental<
|
|
950
|
-
Query extends FunctionReference<"query">,
|
|
989
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
951
990
|
ThrowOnError extends boolean = false,
|
|
952
991
|
>(
|
|
953
992
|
options: UseQueryOptions<Query, ThrowOnError>,
|
|
954
|
-
): UseQueryResult<Query
|
|
993
|
+
): UseQueryResult<FunctionReturnType<Query>, ThrowOnError>;
|
|
955
994
|
|
|
956
995
|
export function useQuery_experimental<
|
|
957
|
-
Query extends FunctionReference<"query">,
|
|
996
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
958
997
|
ThrowOnError extends boolean = false,
|
|
959
998
|
>(
|
|
960
999
|
options: UseQueryOptions<Query, ThrowOnError>,
|
|
961
|
-
): UseQueryResult<Query
|
|
1000
|
+
): UseQueryResult<FunctionReturnType<Query>, false> {
|
|
962
1001
|
const throwOnError = options.throwOnError ?? false;
|
|
963
1002
|
const queryReference =
|
|
964
1003
|
typeof options.query === "string"
|
|
@@ -1042,9 +1081,11 @@ export function useQuery_experimental<
|
|
|
1042
1081
|
* @see https://docs.convex.dev/client/react#editing-data
|
|
1043
1082
|
* @public
|
|
1044
1083
|
*/
|
|
1045
|
-
export function useMutation<
|
|
1046
|
-
|
|
1047
|
-
|
|
1084
|
+
export function useMutation<
|
|
1085
|
+
Mutation extends
|
|
1086
|
+
| FunctionReference<"mutation">
|
|
1087
|
+
| FunctionReference_future<"mutation">,
|
|
1088
|
+
>(mutation: Mutation): ReactMutation<Mutation> {
|
|
1048
1089
|
const mutationReference =
|
|
1049
1090
|
typeof mutation === "string"
|
|
1050
1091
|
? makeFunctionReference<"mutation", any, any>(mutation)
|
|
@@ -1111,9 +1152,11 @@ export function useMutation<Mutation extends FunctionReference<"mutation">>(
|
|
|
1111
1152
|
* @see https://docs.convex.dev/functions/actions#calling-actions-from-clients
|
|
1112
1153
|
* @public
|
|
1113
1154
|
*/
|
|
1114
|
-
export function useAction<
|
|
1115
|
-
|
|
1116
|
-
|
|
1155
|
+
export function useAction<
|
|
1156
|
+
Action extends
|
|
1157
|
+
| FunctionReference<"action">
|
|
1158
|
+
| FunctionReference_future<"action">,
|
|
1159
|
+
>(action: Action): ReactAction<Action> {
|
|
1117
1160
|
const convex = useContext(ConvexContext);
|
|
1118
1161
|
const actionReference =
|
|
1119
1162
|
typeof action === "string"
|
package/src/react/hydration.tsx
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useQuery } from "../react/client.js";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
FunctionArgs,
|
|
5
|
+
FunctionReturnType,
|
|
6
|
+
makeFunctionReference,
|
|
7
|
+
FunctionReference,
|
|
8
|
+
FunctionReference_future,
|
|
9
|
+
} from "../server/api.js";
|
|
4
10
|
import { jsonToConvex } from "../values/index.js";
|
|
5
11
|
|
|
6
12
|
/**
|
|
@@ -9,7 +15,9 @@ import { jsonToConvex } from "../values/index.js";
|
|
|
9
15
|
*
|
|
10
16
|
* @public
|
|
11
17
|
*/
|
|
12
|
-
export type Preloaded<
|
|
18
|
+
export type Preloaded<
|
|
19
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
20
|
+
> = {
|
|
13
21
|
__type: Query;
|
|
14
22
|
_name: string;
|
|
15
23
|
_argsJSON: string;
|
|
@@ -31,13 +39,13 @@ export type Preloaded<Query extends FunctionReference<"query">> = {
|
|
|
31
39
|
*
|
|
32
40
|
* @public
|
|
33
41
|
*/
|
|
34
|
-
export function usePreloadedQuery<
|
|
35
|
-
|
|
36
|
-
): Query
|
|
42
|
+
export function usePreloadedQuery<
|
|
43
|
+
Query extends FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
44
|
+
>(preloadedQuery: Preloaded<Query>): FunctionReturnType<Query> {
|
|
37
45
|
const args = useMemo(
|
|
38
46
|
() => jsonToConvex(preloadedQuery._argsJSON),
|
|
39
47
|
[preloadedQuery._argsJSON],
|
|
40
|
-
) as Query
|
|
48
|
+
) as FunctionArgs<Query>;
|
|
41
49
|
const preloadedResult = useMemo(
|
|
42
50
|
() => jsonToConvex(preloadedQuery._valueJSON),
|
|
43
51
|
[preloadedQuery._valueJSON],
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import { convexToJson, Value } from "../values/index.js";
|
|
2
2
|
import { PaginatedWatch, Watch } from "./client.js";
|
|
3
3
|
import { QueryJournal } from "../browser/sync/protocol.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
getFunctionName,
|
|
6
|
+
FunctionReference,
|
|
7
|
+
FunctionReference_future,
|
|
8
|
+
} from "../server/api.js";
|
|
6
9
|
import { PaginatedQueryResult } from "../browser/sync/pagination.js";
|
|
7
10
|
import { SubscribeToPaginatedQueryOptions } from "../browser/sync/paginated_query_client.js";
|
|
8
11
|
|
|
9
12
|
type Identifier = string;
|
|
10
13
|
|
|
14
|
+
type RequestForQueriesCompat = Record<
|
|
15
|
+
Identifier,
|
|
16
|
+
{
|
|
17
|
+
query: FunctionReference<"query"> | FunctionReference_future<"query">;
|
|
18
|
+
args: Record<string, Value>;
|
|
19
|
+
paginationOptions?: SubscribeToPaginatedQueryOptions;
|
|
20
|
+
}
|
|
21
|
+
>;
|
|
22
|
+
|
|
11
23
|
type QueryInfo = {
|
|
12
|
-
query: FunctionReference<"query">;
|
|
24
|
+
query: FunctionReference<"query"> | FunctionReference_future<"query">;
|
|
13
25
|
args: Record<string, Value>;
|
|
14
26
|
watch: Watch<Value> | PaginatedWatch<Value>;
|
|
15
27
|
unsubscribe: () => void;
|
|
@@ -18,7 +30,7 @@ type QueryInfo = {
|
|
|
18
30
|
|
|
19
31
|
export interface CreateWatch {
|
|
20
32
|
(
|
|
21
|
-
query: FunctionReference<"query">,
|
|
33
|
+
query: FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
22
34
|
args: Record<string, Value>,
|
|
23
35
|
options: {
|
|
24
36
|
journal?: QueryJournal;
|
|
@@ -44,16 +56,7 @@ export class QueriesObserver {
|
|
|
44
56
|
this.listeners = new Set();
|
|
45
57
|
}
|
|
46
58
|
|
|
47
|
-
setQueries(
|
|
48
|
-
newQueries: Record<
|
|
49
|
-
Identifier,
|
|
50
|
-
{
|
|
51
|
-
query: FunctionReference<"query">;
|
|
52
|
-
args: Record<string, Value>;
|
|
53
|
-
paginationOptions?: SubscribeToPaginatedQueryOptions;
|
|
54
|
-
}
|
|
55
|
-
>,
|
|
56
|
-
) {
|
|
59
|
+
setQueries(newQueries: RequestForQueriesCompat) {
|
|
57
60
|
// Add the new queries before unsubscribing from the old ones so that
|
|
58
61
|
// the deduping in the `ConvexReactClient` can help if there are duplicates.
|
|
59
62
|
for (const identifier of Object.keys(newQueries)) {
|
|
@@ -107,7 +110,7 @@ export class QueriesObserver {
|
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
getLocalResults(
|
|
110
|
-
queries:
|
|
113
|
+
queries: RequestForQueriesCompat,
|
|
111
114
|
): Record<
|
|
112
115
|
Identifier,
|
|
113
116
|
Value | undefined | Error | PaginatedQueryResult<Value>
|
|
@@ -173,7 +176,7 @@ export class QueriesObserver {
|
|
|
173
176
|
|
|
174
177
|
private addQuery(
|
|
175
178
|
identifier: Identifier,
|
|
176
|
-
query: FunctionReference<"query">,
|
|
179
|
+
query: FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
177
180
|
args: Record<string, Value>,
|
|
178
181
|
{
|
|
179
182
|
paginationOptions,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
FunctionReference,
|
|
5
|
+
FunctionReturnType,
|
|
6
|
+
getFunctionName,
|
|
7
|
+
} from "../server/api.js";
|
|
4
8
|
import {
|
|
5
9
|
PaginatedQueryReference,
|
|
6
10
|
PaginatedQueryArgs,
|
|
@@ -255,7 +259,7 @@ export function usePaginatedQuery_experimental<
|
|
|
255
259
|
throw new Error("Why is it missing?");
|
|
256
260
|
}
|
|
257
261
|
const internalResult = {
|
|
258
|
-
results: [] as Query["
|
|
262
|
+
results: [] as FunctionReturnType<Query>["page"],
|
|
259
263
|
status: "LoadingFirstPage" as const,
|
|
260
264
|
isLoading: true as const,
|
|
261
265
|
loadMore: function skipNOP(_numItems: number) {
|
|
@@ -270,7 +274,7 @@ export function usePaginatedQuery_experimental<
|
|
|
270
274
|
return internalResult as unknown as UsePaginatedQueryReturnType<Query>;
|
|
271
275
|
}
|
|
272
276
|
const result = resultsObject.paginatedQuery as
|
|
273
|
-
| PaginatedQueryResult<Query["
|
|
277
|
+
| PaginatedQueryResult<FunctionReturnType<Query>["page"][number]>
|
|
274
278
|
| Error;
|
|
275
279
|
|
|
276
280
|
// TODO this is a weird mix of responsibilities:
|
|
@@ -279,7 +283,7 @@ export function usePaginatedQuery_experimental<
|
|
|
279
283
|
// It comes back to why we'd ever get undefined when asking about a query; have we not yet called subscribe for it?
|
|
280
284
|
if (result === undefined) {
|
|
281
285
|
const internalResult = {
|
|
282
|
-
results: [] as Query["
|
|
286
|
+
results: [] as FunctionReturnType<Query>["page"],
|
|
283
287
|
loadMore: () => false,
|
|
284
288
|
isLoading: true as const,
|
|
285
289
|
status: "LoadingFirstPage" as const,
|
|
@@ -313,7 +317,7 @@ export function usePaginatedQuery_experimental<
|
|
|
313
317
|
);
|
|
314
318
|
setState(createInitialState);
|
|
315
319
|
const internalResult = {
|
|
316
|
-
results: [] as Query["
|
|
320
|
+
results: [] as FunctionReturnType<Query>["page"],
|
|
317
321
|
loadMore: () => false,
|
|
318
322
|
isLoading: true as const,
|
|
319
323
|
status: "LoadingFirstPage" as const,
|
|
@@ -329,7 +333,7 @@ export function usePaginatedQuery_experimental<
|
|
|
329
333
|
throw result;
|
|
330
334
|
}
|
|
331
335
|
const internalResult = {
|
|
332
|
-
results: [] as Query["
|
|
336
|
+
results: [] as FunctionReturnType<Query>["page"],
|
|
333
337
|
loadMore: () => false,
|
|
334
338
|
isLoading: false as const,
|
|
335
339
|
status: "Error" as const,
|
package/src/react/use_queries.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { useConvex } from "./client.js";
|
|
|
4
4
|
import { CreateWatch, QueriesObserver } from "./queries_observer.js";
|
|
5
5
|
import { useSubscription } from "./use_subscription.js";
|
|
6
6
|
import { QueryJournal } from "../browser/index.js";
|
|
7
|
-
import { FunctionReference } from "../server/api.js";
|
|
7
|
+
import { FunctionReference, FunctionReference_future } from "../server/api.js";
|
|
8
8
|
import { SubscribeToPaginatedQueryOptions } from "../browser/sync/paginated_query_client.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,9 +15,10 @@ import { SubscribeToPaginatedQueryOptions } from "../browser/sync/paginated_quer
|
|
|
15
15
|
* of queries without violating the rules of React hooks.
|
|
16
16
|
*
|
|
17
17
|
* This hook accepts an object whose keys are identifiers for each query and the
|
|
18
|
-
* values are objects of
|
|
19
|
-
* `query
|
|
20
|
-
* the
|
|
18
|
+
* values are objects of
|
|
19
|
+
* `{ query: FunctionReference | FunctionReference_future, args: Record<string, Value> }`.
|
|
20
|
+
* The `query` is a reference to the Convex query function to load, and the
|
|
21
|
+
* `args` are the arguments to that function.
|
|
21
22
|
*
|
|
22
23
|
* The hook returns an object that maps each identifier to the result of the query,
|
|
23
24
|
* `undefined` if the query is still loading, or an instance of `Error` if the query
|
|
@@ -59,7 +60,7 @@ import { SubscribeToPaginatedQueryOptions } from "../browser/sync/paginated_quer
|
|
|
59
60
|
* @public
|
|
60
61
|
*/
|
|
61
62
|
export function useQueries(
|
|
62
|
-
queries:
|
|
63
|
+
queries: RequestForQueriesCompat,
|
|
63
64
|
): Record<string, any | undefined | Error> {
|
|
64
65
|
const convex = useConvex();
|
|
65
66
|
if (convex === undefined) {
|
|
@@ -73,7 +74,7 @@ export function useQueries(
|
|
|
73
74
|
}
|
|
74
75
|
const createWatch = useMemo(() => {
|
|
75
76
|
return (
|
|
76
|
-
query: FunctionReference<"query">,
|
|
77
|
+
query: FunctionReference<"query"> | FunctionReference_future<"query">,
|
|
77
78
|
args: Record<string, Value>,
|
|
78
79
|
{
|
|
79
80
|
journal,
|
|
@@ -97,7 +98,7 @@ export function useQueries(
|
|
|
97
98
|
* Internal version of `useQueries` that is exported for testing.
|
|
98
99
|
*/
|
|
99
100
|
export function useQueriesHelper(
|
|
100
|
-
queries:
|
|
101
|
+
queries: RequestForQueriesCompat,
|
|
101
102
|
createWatch: CreateWatch,
|
|
102
103
|
): Record<string, any | undefined | Error> {
|
|
103
104
|
const [observer] = useState(() => new QueriesObserver(createWatch));
|
|
@@ -143,3 +144,18 @@ export type RequestForQueries = Record<
|
|
|
143
144
|
paginationOptions?: SubscribeToPaginatedQueryOptions;
|
|
144
145
|
}
|
|
145
146
|
>;
|
|
147
|
+
|
|
148
|
+
// The `queries` parameter of `useQueries`: `RequestForQueries` with `query`
|
|
149
|
+
// also accepting a `FunctionReference_future`. The exported type stays a plain
|
|
150
|
+
// reference so that code reading a `query` out of one gets a
|
|
151
|
+
// `FunctionReference` it can forward anywhere. Module-local so that a
|
|
152
|
+
// consumer's declaration file inlines it rather than importing it from a path
|
|
153
|
+
// outside the package's public entry points.
|
|
154
|
+
type RequestForQueriesCompat = Record<
|
|
155
|
+
string,
|
|
156
|
+
{
|
|
157
|
+
query: FunctionReference<"query"> | FunctionReference_future<"query">;
|
|
158
|
+
args: Record<string, Value>;
|
|
159
|
+
paginationOptions?: SubscribeToPaginatedQueryOptions;
|
|
160
|
+
}
|
|
161
|
+
>;
|