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
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
StorageWriter,
|
|
7
7
|
} from "../storage.js";
|
|
8
8
|
import { version } from "../../index.js";
|
|
9
|
+
import { fromByteArray, toByteArray } from "../../values/base64.js";
|
|
9
10
|
import { performAsyncSyscall, performJsSyscall } from "./syscall.js";
|
|
10
11
|
import { validateArg } from "./validate.js";
|
|
11
12
|
|
|
@@ -45,6 +46,35 @@ export function setupStorageWriter(requestId: string): StorageWriter {
|
|
|
45
46
|
storageId,
|
|
46
47
|
});
|
|
47
48
|
},
|
|
49
|
+
store: async (blob: Blob, options?: { sha256?: string }) => {
|
|
50
|
+
if (!(blob instanceof Blob)) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
"store() expects a Blob. If you are trying to store a Request, `await request.blob()` will give you the correct input.",
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
const bytes = new Uint8Array(await blob.arrayBuffer());
|
|
56
|
+
return await performAsyncSyscall("1.0/storageStore", {
|
|
57
|
+
requestId,
|
|
58
|
+
version,
|
|
59
|
+
blob: fromByteArray(bytes),
|
|
60
|
+
contentType: blob.type,
|
|
61
|
+
sha256: options?.sha256,
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
get: async (storageId: FileStorageId) => {
|
|
65
|
+
const result: { blob: string; contentType: string | null } | null =
|
|
66
|
+
await performAsyncSyscall("1.0/storageGet", {
|
|
67
|
+
requestId,
|
|
68
|
+
version,
|
|
69
|
+
storageId,
|
|
70
|
+
});
|
|
71
|
+
if (result === null) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
return new Blob([toByteArray(result.blob)], {
|
|
75
|
+
type: result.contentType ?? "",
|
|
76
|
+
});
|
|
77
|
+
},
|
|
48
78
|
getUrl: reader.getUrl,
|
|
49
79
|
getMetadata: reader.getMetadata,
|
|
50
80
|
};
|
package/src/server/index.ts
CHANGED
|
@@ -103,7 +103,11 @@ export {
|
|
|
103
103
|
internalMutationGeneric,
|
|
104
104
|
internalQueryGeneric,
|
|
105
105
|
} from "./impl/registration_impl.js";
|
|
106
|
-
export {
|
|
106
|
+
export {
|
|
107
|
+
getServiceToken,
|
|
108
|
+
getServiceUrl,
|
|
109
|
+
type ServiceName,
|
|
110
|
+
} from "./impl/actions_impl.js";
|
|
107
111
|
export type {
|
|
108
112
|
TransactionMetric,
|
|
109
113
|
TransactionMetrics,
|
|
@@ -174,6 +178,7 @@ export {
|
|
|
174
178
|
export type {
|
|
175
179
|
ApiFromModules,
|
|
176
180
|
AnyApi,
|
|
181
|
+
FunctionReference_future,
|
|
177
182
|
FilterApi,
|
|
178
183
|
FunctionType,
|
|
179
184
|
FunctionReference,
|
package/src/server/meta.ts
CHANGED
|
@@ -26,6 +26,14 @@ export type TransactionMetrics = {
|
|
|
26
26
|
documentsWritten: TransactionMetric;
|
|
27
27
|
functionsScheduled: TransactionMetric;
|
|
28
28
|
scheduledFunctionArgsBytes: TransactionMetric;
|
|
29
|
+
/** @internal */
|
|
30
|
+
filesWritten: TransactionMetric;
|
|
31
|
+
/** @internal */
|
|
32
|
+
fileWriteBytes: TransactionMetric;
|
|
33
|
+
/** @internal */
|
|
34
|
+
filesRead: TransactionMetric;
|
|
35
|
+
/** @internal */
|
|
36
|
+
fileReadBytes: TransactionMetric;
|
|
29
37
|
};
|
|
30
38
|
|
|
31
39
|
/**
|
|
@@ -43,6 +51,14 @@ export interface TransactionLimits {
|
|
|
43
51
|
documentsWritten?: number;
|
|
44
52
|
functionsScheduled?: number;
|
|
45
53
|
scheduledFunctionArgsBytes?: number;
|
|
54
|
+
/** @internal */
|
|
55
|
+
filesWritten?: number;
|
|
56
|
+
/** @internal */
|
|
57
|
+
fileWriteBytes?: number;
|
|
58
|
+
/** @internal */
|
|
59
|
+
filesRead?: number;
|
|
60
|
+
/** @internal */
|
|
61
|
+
fileReadBytes?: number;
|
|
46
62
|
}
|
|
47
63
|
|
|
48
64
|
/**
|
|
@@ -130,9 +146,48 @@ export type RequestMetadata = {
|
|
|
130
146
|
* @public
|
|
131
147
|
*/
|
|
132
148
|
export interface QueryMeta {
|
|
149
|
+
/**
|
|
150
|
+
* Metadata about the currently executing Convex function.
|
|
151
|
+
*/
|
|
133
152
|
getFunctionMetadata(): Promise<FunctionMetadata>;
|
|
153
|
+
/**
|
|
154
|
+
* The remaining headroom for a transaction before hitting limits.
|
|
155
|
+
*
|
|
156
|
+
* See https://docs.convex.dev/production/state/limits
|
|
157
|
+
*/
|
|
134
158
|
getTransactionMetrics(): Promise<TransactionMetrics>;
|
|
159
|
+
/**
|
|
160
|
+
* Metadata about the deployment this function is running on.
|
|
161
|
+
*/
|
|
135
162
|
getDeploymentMetadata(): Promise<DeploymentMetadata>;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the timestamp of the database snapshot this transaction reads
|
|
165
|
+
* from, in nanoseconds.
|
|
166
|
+
*
|
|
167
|
+
* All commits at or before this timestamp are observable within the
|
|
168
|
+
* transaction, and no later commits are. The value is fixed for the
|
|
169
|
+
* lifetime of the transaction and shared with all nested `runMutation` and
|
|
170
|
+
* non-stale `runQuery` calls. If a nested query is called with
|
|
171
|
+
* `useStaleSnapshot: true`, then the nested query may in a future backend
|
|
172
|
+
* version choose an older snapshotTs.
|
|
173
|
+
*
|
|
174
|
+
* It is on the same clock as `db.vars.commitTs`: documents observable in
|
|
175
|
+
* this transaction have `commitTs` values at or before this timestamp, and
|
|
176
|
+
* no new documents will be written with a `commitTs` at or below this,
|
|
177
|
+
* including from the current transaction. When reading documents with an
|
|
178
|
+
* index in commitTs order, you can use this as an upper bound to prevent
|
|
179
|
+
* conflicting with racing inserts.
|
|
180
|
+
*
|
|
181
|
+
* Since the timestamp differs on every execution, calling this in a query
|
|
182
|
+
* limits caching of the query's result the same way `Date.now()` does.
|
|
183
|
+
*
|
|
184
|
+
* Note: this should not be compared to `_creationTime` or `Date.now()`, as
|
|
185
|
+
* those are based on wall-clock time rather than the database clock, and
|
|
186
|
+
* aren't guaranteed to follow commit order.
|
|
187
|
+
*
|
|
188
|
+
* Docs: https://docs.convex.dev/database/advanced/commit-timestamp
|
|
189
|
+
*/
|
|
190
|
+
getSnapshotTs(): bigint;
|
|
136
191
|
}
|
|
137
192
|
|
|
138
193
|
/**
|
|
@@ -141,6 +196,15 @@ export interface QueryMeta {
|
|
|
141
196
|
* @public
|
|
142
197
|
*/
|
|
143
198
|
export interface MutationMeta extends QueryMeta {
|
|
199
|
+
/**
|
|
200
|
+
* Metadata about the HTTP request that triggered the current function execution.
|
|
201
|
+
*
|
|
202
|
+
* `ip` and `userAgent` are `null` when the function was not triggered by an
|
|
203
|
+
* HTTP request (e.g. scheduled jobs or cron jobs).
|
|
204
|
+
*
|
|
205
|
+
* Functions called from within a function (i.e. using `runMutation`) will have
|
|
206
|
+
* the same request metadata as the parent function.
|
|
207
|
+
*/
|
|
144
208
|
getRequestMetadata(): Promise<RequestMetadata>;
|
|
145
209
|
}
|
|
146
210
|
|
|
@@ -150,7 +214,22 @@ export interface MutationMeta extends QueryMeta {
|
|
|
150
214
|
* @public
|
|
151
215
|
*/
|
|
152
216
|
export interface ActionMeta {
|
|
217
|
+
/**
|
|
218
|
+
* Metadata about the currently executing Convex function.
|
|
219
|
+
*/
|
|
153
220
|
getFunctionMetadata(): Promise<FunctionMetadata>;
|
|
221
|
+
/**
|
|
222
|
+
* Metadata about the deployment this function is running on.
|
|
223
|
+
*/
|
|
154
224
|
getDeploymentMetadata(): Promise<DeploymentMetadata>;
|
|
225
|
+
/**
|
|
226
|
+
* Metadata about the HTTP request that triggered the current function execution.
|
|
227
|
+
*
|
|
228
|
+
* `ip` and `userAgent` are `null` when the function was not triggered by an
|
|
229
|
+
* HTTP request (e.g. scheduled jobs or cron jobs).
|
|
230
|
+
*
|
|
231
|
+
* Functions called from within a function (i.e. using `runMutation` or
|
|
232
|
+
* `runAction`) will have the same request metadata as the parent function.
|
|
233
|
+
*/
|
|
155
234
|
getRequestMetadata(): Promise<RequestMetadata>;
|
|
156
235
|
}
|
|
@@ -16,10 +16,11 @@ import {
|
|
|
16
16
|
} from "./meta.js";
|
|
17
17
|
import {
|
|
18
18
|
ArgsAndOptions,
|
|
19
|
-
FunctionReference,
|
|
20
19
|
FunctionReturnType,
|
|
21
20
|
OptionalRestArgs,
|
|
22
21
|
ValidatorTypeToReturnType,
|
|
22
|
+
FunctionReference,
|
|
23
|
+
FunctionReference_future,
|
|
23
24
|
} from "../server/api.js";
|
|
24
25
|
import {
|
|
25
26
|
GenericValidator,
|
|
@@ -133,7 +134,11 @@ export interface GenericMutationCtx<DataModel extends GenericDataModel> {
|
|
|
133
134
|
* const user = await ctx.runQuery(internal.users.getUser, { userId });
|
|
134
135
|
* ```
|
|
135
136
|
*/
|
|
136
|
-
runQuery: <
|
|
137
|
+
runQuery: <
|
|
138
|
+
Query extends
|
|
139
|
+
| FunctionReference<"query", "public" | "internal">
|
|
140
|
+
| FunctionReference_future<"query", "public" | "internal">,
|
|
141
|
+
>(
|
|
137
142
|
query: Query,
|
|
138
143
|
...args: ArgsAndOptions<Query, AdvancedRunQueryOptions>
|
|
139
144
|
) => Promise<FunctionReturnType<Query>>;
|
|
@@ -149,7 +154,9 @@ export interface GenericMutationCtx<DataModel extends GenericDataModel> {
|
|
|
149
154
|
* validation, and creating a new isolated JS context.
|
|
150
155
|
*/
|
|
151
156
|
runMutation: <
|
|
152
|
-
Mutation extends
|
|
157
|
+
Mutation extends
|
|
158
|
+
| FunctionReference<"mutation", "public" | "internal">
|
|
159
|
+
| FunctionReference_future<"mutation", "public" | "internal">,
|
|
153
160
|
>(
|
|
154
161
|
mutation: Mutation,
|
|
155
162
|
...args: ArgsAndOptions<Mutation, { transactionLimits?: TransactionLimits }>
|
|
@@ -243,7 +250,11 @@ export interface GenericQueryCtx<DataModel extends GenericDataModel> {
|
|
|
243
250
|
* `runQuery` incurs overhead of running argument and return value validation,
|
|
244
251
|
* and creating a new isolated JS context.
|
|
245
252
|
*/
|
|
246
|
-
runQuery: <
|
|
253
|
+
runQuery: <
|
|
254
|
+
Query extends
|
|
255
|
+
| FunctionReference<"query", "public" | "internal">
|
|
256
|
+
| FunctionReference_future<"query", "public" | "internal">,
|
|
257
|
+
>(
|
|
247
258
|
query: Query,
|
|
248
259
|
...args: ArgsAndOptions<Query, { transactionLimits?: TransactionLimits }>
|
|
249
260
|
) => Promise<FunctionReturnType<Query>>;
|
|
@@ -326,7 +337,11 @@ export interface GenericActionCtx<DataModel extends GenericDataModel> {
|
|
|
326
337
|
* @param args - The arguments to the query function.
|
|
327
338
|
* @returns A promise of the query's result.
|
|
328
339
|
*/
|
|
329
|
-
runQuery<
|
|
340
|
+
runQuery<
|
|
341
|
+
Query extends
|
|
342
|
+
| FunctionReference<"query", "public" | "internal">
|
|
343
|
+
| FunctionReference_future<"query", "public" | "internal">,
|
|
344
|
+
>(
|
|
330
345
|
query: Query,
|
|
331
346
|
...args: OptionalRestArgs<Query>
|
|
332
347
|
): Promise<FunctionReturnType<Query>>;
|
|
@@ -347,7 +362,9 @@ export interface GenericActionCtx<DataModel extends GenericDataModel> {
|
|
|
347
362
|
* @returns A promise of the mutation's result.
|
|
348
363
|
*/
|
|
349
364
|
runMutation<
|
|
350
|
-
Mutation extends
|
|
365
|
+
Mutation extends
|
|
366
|
+
| FunctionReference<"mutation", "public" | "internal">
|
|
367
|
+
| FunctionReference_future<"mutation", "public" | "internal">,
|
|
351
368
|
>(
|
|
352
369
|
mutation: Mutation,
|
|
353
370
|
...args: OptionalRestArgs<Mutation>
|
|
@@ -369,7 +386,11 @@ export interface GenericActionCtx<DataModel extends GenericDataModel> {
|
|
|
369
386
|
* @param args - The arguments to the action function.
|
|
370
387
|
* @returns A promise of the action's result.
|
|
371
388
|
*/
|
|
372
|
-
runAction<
|
|
389
|
+
runAction<
|
|
390
|
+
Action extends
|
|
391
|
+
| FunctionReference<"action", "public" | "internal">
|
|
392
|
+
| FunctionReference_future<"action", "public" | "internal">,
|
|
393
|
+
>(
|
|
373
394
|
action: Action,
|
|
374
395
|
...args: OptionalRestArgs<Action>
|
|
375
396
|
): Promise<FunctionReturnType<Action>>;
|
|
@@ -1213,6 +1234,11 @@ export type HttpActionBuilder = (
|
|
|
1213
1234
|
) => PublicHttpAction;
|
|
1214
1235
|
|
|
1215
1236
|
export interface AdvancedRunQueryOptions {
|
|
1237
|
+
/**
|
|
1238
|
+
* Custom limits for a nested transaction. Each field specifies the absolute
|
|
1239
|
+
* maximum allowed for the nested function call. Values are capped at the
|
|
1240
|
+
* global transaction limits, so they can only lower limits, never raise them.
|
|
1241
|
+
*/
|
|
1216
1242
|
transactionLimits?: TransactionLimits;
|
|
1217
1243
|
/**
|
|
1218
1244
|
* Run a query on a recent snapshot of the database that is not guaranteed
|
|
@@ -1223,6 +1249,11 @@ export interface AdvancedRunQueryOptions {
|
|
|
1223
1249
|
* database read conflicts are expected, e.g. reading from an append-only
|
|
1224
1250
|
* table with immutable records where the only read conflicts are from
|
|
1225
1251
|
* concurrent appends.
|
|
1252
|
+
*
|
|
1253
|
+
* To determine the snapshot of the nested query, you can call
|
|
1254
|
+
* `ctx.meta.getSnapshotTs()` from within the stale snapshot query. To
|
|
1255
|
+
* compare to the parent mutation's snapshot timestamp, you can return that
|
|
1256
|
+
* value from the query and call `ctx.meta.getSnapshotTs()` from the parent.
|
|
1226
1257
|
*/
|
|
1227
1258
|
useStaleSnapshot?: boolean;
|
|
1228
1259
|
}
|
package/src/server/scheduler.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
FunctionReference,
|
|
3
|
+
FunctionReference_future,
|
|
4
|
+
OptionalRestArgs,
|
|
5
|
+
} from "../server/api.js";
|
|
2
6
|
import { Id } from "../values/value.js";
|
|
3
7
|
|
|
4
8
|
/**
|
|
@@ -13,6 +17,17 @@ export type SchedulableFunctionReference = FunctionReference<
|
|
|
13
17
|
"public" | "internal"
|
|
14
18
|
>;
|
|
15
19
|
|
|
20
|
+
// What the scheduling methods accept. This is kept separate from the exported
|
|
21
|
+
// `SchedulableFunctionReference` so that alias keeps describing a plain
|
|
22
|
+
// reference. Existing code depending on it can still forward it to anything
|
|
23
|
+
// typed with `FunctionReference` or read its `_args`. This alias is
|
|
24
|
+
// module-local so that a consumer's declaration file inlines it instead of
|
|
25
|
+
// importing it from a path that is not part of the package's public entry
|
|
26
|
+
// points.
|
|
27
|
+
type SchedulableFunctionReferenceCompat =
|
|
28
|
+
| SchedulableFunctionReference
|
|
29
|
+
| FunctionReference_future<"mutation" | "action", "public" | "internal">;
|
|
30
|
+
|
|
16
31
|
/**
|
|
17
32
|
* An interface to schedule Convex functions to run in the future.
|
|
18
33
|
*
|
|
@@ -78,13 +93,13 @@ export interface Scheduler {
|
|
|
78
93
|
* @param delayMs - Delay in milliseconds. Must be non-negative. If the delay
|
|
79
94
|
* is zero, the scheduled function will be due to execute immediately after the
|
|
80
95
|
* scheduling one completes.
|
|
81
|
-
* @param functionReference - A {@link FunctionReference}
|
|
82
|
-
* to schedule.
|
|
96
|
+
* @param functionReference - A {@link FunctionReference} or
|
|
97
|
+
* {@link FunctionReference_future} for the function to schedule.
|
|
83
98
|
* @param args - Arguments to call the scheduled functions with.
|
|
84
99
|
* @returns The ID of the scheduled function in the `_scheduled_functions`
|
|
85
100
|
* system table. Use this to cancel it later if needed.
|
|
86
101
|
**/
|
|
87
|
-
runAfter<FuncRef extends
|
|
102
|
+
runAfter<FuncRef extends SchedulableFunctionReferenceCompat>(
|
|
88
103
|
delayMs: number,
|
|
89
104
|
functionReference: FuncRef,
|
|
90
105
|
...args: OptionalRestArgs<FuncRef>
|
|
@@ -110,13 +125,13 @@ export interface Scheduler {
|
|
|
110
125
|
* If the timestamp is in the past, the scheduled function will be due to
|
|
111
126
|
* execute immediately after the scheduling one completes. The timestamp can't
|
|
112
127
|
* be more than five years in the past or more than five years in the future.
|
|
113
|
-
* @param functionReference - A {@link FunctionReference}
|
|
114
|
-
* to schedule.
|
|
128
|
+
* @param functionReference - A {@link FunctionReference} or
|
|
129
|
+
* {@link FunctionReference_future} for the function to schedule.
|
|
115
130
|
* @param args - Arguments to call the scheduled functions with.
|
|
116
131
|
* @returns The ID of the scheduled function in the `_scheduled_functions`
|
|
117
132
|
* system table.
|
|
118
133
|
**/
|
|
119
|
-
runAt<FuncRef extends
|
|
134
|
+
runAt<FuncRef extends SchedulableFunctionReferenceCompat>(
|
|
120
135
|
timestamp: number | Date,
|
|
121
136
|
functionReference: FuncRef,
|
|
122
137
|
...args: OptionalRestArgs<FuncRef>
|
package/src/server/schema.ts
CHANGED
|
@@ -204,6 +204,9 @@ export class TableDefinition<
|
|
|
204
204
|
private stagedVectorIndexes: VectorIndex[];
|
|
205
205
|
// The type of documents stored in this table.
|
|
206
206
|
validator: DocumentType;
|
|
207
|
+
// The proposed next validator for this table, validated against existing
|
|
208
|
+
// documents in the background while `validator` remains enforced.
|
|
209
|
+
private stagedValidator: Validator<any, any, any> | undefined;
|
|
207
210
|
|
|
208
211
|
/**
|
|
209
212
|
* @internal
|
|
@@ -557,6 +560,67 @@ export class TableDefinition<
|
|
|
557
560
|
return this;
|
|
558
561
|
}
|
|
559
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Stage changes to this table's document validator.
|
|
565
|
+
*
|
|
566
|
+
* Convex validates the staged validator against the table's existing
|
|
567
|
+
* documents in the background, while the validator passed to
|
|
568
|
+
* {@link defineTable} remains the one enforced on writes. Once
|
|
569
|
+
* the background validation succeeds, apply the staged changes
|
|
570
|
+
* and remove `.staged()`.
|
|
571
|
+
*
|
|
572
|
+
* For an object validator, pass only the fields to add or replace. Fields
|
|
573
|
+
* omitted from the changes keep their enforced validators.
|
|
574
|
+
* Set a field to `undefined` to remove it from the staged validator.
|
|
575
|
+
* For nested objects, you must specify the full object validator.
|
|
576
|
+
*
|
|
577
|
+
* ```ts
|
|
578
|
+
* defineTable({
|
|
579
|
+
* apple: v.string(),
|
|
580
|
+
* banana: v.number(),
|
|
581
|
+
* legacy: v.optional(v.string()),
|
|
582
|
+
* }).staged({
|
|
583
|
+
* banana: v.union(v.string(), v.number()),
|
|
584
|
+
* legacy: undefined,
|
|
585
|
+
* })
|
|
586
|
+
* ```
|
|
587
|
+
*
|
|
588
|
+
* See [Staged validators](https://docs.convex.dev/database/schemas#staged-validators).
|
|
589
|
+
*
|
|
590
|
+
* @param documentSchema - Field changes for a table defined as an object or
|
|
591
|
+
* `v.any()`, or a full schema validator specifying the proposed next document
|
|
592
|
+
* type. Use a full schema validator for a table defined as a union.
|
|
593
|
+
* @returns A {@link TableDefinition} with the staged validator attached.
|
|
594
|
+
*/
|
|
595
|
+
staged(
|
|
596
|
+
documentSchema:
|
|
597
|
+
| Validator<Record<string, any>, "required", any>
|
|
598
|
+
| Record<string, GenericValidator | undefined>,
|
|
599
|
+
): TableDefinition<DocumentType, Indexes, SearchIndexes, VectorIndexes> {
|
|
600
|
+
if (this.stagedValidator !== undefined) {
|
|
601
|
+
throw new Error("Table cannot have more than one staged validator.");
|
|
602
|
+
}
|
|
603
|
+
if (isValidator(documentSchema)) {
|
|
604
|
+
this.stagedValidator = documentSchema;
|
|
605
|
+
} else {
|
|
606
|
+
if (this.validator.kind !== "object" && this.validator.kind !== "any") {
|
|
607
|
+
throw new Error(
|
|
608
|
+
"Specifying top-level field changes is only supported for simple table definitions. For a table defined with a union or record validator, you must stage a fully defined object or union validator.",
|
|
609
|
+
);
|
|
610
|
+
}
|
|
611
|
+
const enforcedFields =
|
|
612
|
+
this.validator.kind === "object" ? this.validator.fields : {};
|
|
613
|
+
const fields: Record<string, GenericValidator> = Object.fromEntries(
|
|
614
|
+
Object.entries({ ...enforcedFields, ...documentSchema }).filter(
|
|
615
|
+
(entry): entry is [string, GenericValidator] =>
|
|
616
|
+
entry[1] !== undefined,
|
|
617
|
+
),
|
|
618
|
+
);
|
|
619
|
+
this.stagedValidator = v.object(fields);
|
|
620
|
+
}
|
|
621
|
+
return this.self();
|
|
622
|
+
}
|
|
623
|
+
|
|
560
624
|
/**
|
|
561
625
|
* Work around for https://github.com/microsoft/TypeScript/issues/57035
|
|
562
626
|
*/
|
|
@@ -582,6 +646,16 @@ export class TableDefinition<
|
|
|
582
646
|
);
|
|
583
647
|
}
|
|
584
648
|
|
|
649
|
+
let stagedDocumentType = undefined;
|
|
650
|
+
if (this.stagedValidator !== undefined) {
|
|
651
|
+
stagedDocumentType = this.stagedValidator.json;
|
|
652
|
+
if (typeof stagedDocumentType !== "object") {
|
|
653
|
+
throw new Error(
|
|
654
|
+
"Invalid staged validator: please make sure that the parameter of `.staged()` is valid (see https://docs.convex.dev/database/schemas)",
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
585
659
|
return {
|
|
586
660
|
indexes: this.indexes,
|
|
587
661
|
stagedDbIndexes: this.stagedDbIndexes,
|
|
@@ -590,6 +664,7 @@ export class TableDefinition<
|
|
|
590
664
|
vectorIndexes: this.vectorIndexes,
|
|
591
665
|
stagedVectorIndexes: this.stagedVectorIndexes,
|
|
592
666
|
documentType,
|
|
667
|
+
stagedDocumentType,
|
|
593
668
|
};
|
|
594
669
|
}
|
|
595
670
|
}
|
|
@@ -884,6 +959,7 @@ export class SchemaDefinition<
|
|
|
884
959
|
vectorIndexes,
|
|
885
960
|
stagedVectorIndexes,
|
|
886
961
|
documentType,
|
|
962
|
+
stagedDocumentType,
|
|
887
963
|
} = definition.export();
|
|
888
964
|
return {
|
|
889
965
|
tableName,
|
|
@@ -894,6 +970,7 @@ export class SchemaDefinition<
|
|
|
894
970
|
vectorIndexes,
|
|
895
971
|
stagedVectorIndexes,
|
|
896
972
|
documentType,
|
|
973
|
+
stagedDocumentType,
|
|
897
974
|
};
|
|
898
975
|
}),
|
|
899
976
|
schemaValidation: this.schemaValidation,
|
package/src/server/storage.ts
CHANGED
|
@@ -194,6 +194,23 @@ export interface StorageWriter extends StorageReader {
|
|
|
194
194
|
delete<T extends StorageId>(
|
|
195
195
|
storageId: T extends { __tableName: any } ? never : T,
|
|
196
196
|
): Promise<void>;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
// TODO: move `store` from StorageActionWriter to StorageWriter when mutation
|
|
202
|
+
// file storage access is ready for release
|
|
203
|
+
store(
|
|
204
|
+
blob: Blob,
|
|
205
|
+
options?: { sha256?: string },
|
|
206
|
+
): Promise<GenericId<"_storage">>;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @internal
|
|
210
|
+
*/
|
|
211
|
+
// TODO: move `get` from StorageActionWriter to StorageWriter when mutation
|
|
212
|
+
// file storage access is ready for release
|
|
213
|
+
get(storageId: GenericId<"_storage">): Promise<Blob | null>;
|
|
197
214
|
}
|
|
198
215
|
|
|
199
216
|
/**
|
package/src/values/validator.ts
CHANGED
|
@@ -28,7 +28,9 @@ import {
|
|
|
28
28
|
export type GenericValidator = Validator<any, any, any>;
|
|
29
29
|
|
|
30
30
|
export function isValidator(v: any): v is GenericValidator {
|
|
31
|
-
|
|
31
|
+
// Check for the literal `true` marker: a field map can contain a field
|
|
32
|
+
// *named* `isConvexValidator` whose value is a (truthy) validator object.
|
|
33
|
+
return v?.isConvexValidator === true;
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/**
|