convex 1.46.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 +58 -1
- package/dist/browser.bundle.js +7 -1
- package/dist/browser.bundle.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 -4
- 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 +27 -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/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 +36 -47
- package/dist/cjs/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
- package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js +58 -39
- package/dist/cjs/cli/lib/checkForSlowSchemaValidation.js.map +2 -2
- 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 +48 -5
- 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 +3 -1
- package/dist/cjs/cli/lib/deploy2.js.map +2 -2
- package/dist/cjs/cli/lib/deployApi/evaluateSchema.js +30 -2
- package/dist/cjs/cli/lib/deployApi/evaluateSchema.js.map +2 -2
- package/dist/cjs/cli/lib/dev.js +5 -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/indexes.js.map +1 -1
- 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 +4 -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 +48 -18
- 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/server/impl/actions_impl.js +8 -3
- package/dist/cjs/server/impl/actions_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/schema.js +34 -12
- package/dist/cjs/server/schema.js.map +2 -2
- package/dist/cjs/server/storage.js.map +1 -1
- package/dist/cjs/values/validators.js +1 -1
- 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/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/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 +5 -7
- package/dist/cjs-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts +4 -10
- package/dist/cjs-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -1
- 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 -3
- 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 +4 -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 +2 -0
- package/dist/cjs-types/cli/lib/deploy2.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.d.ts +460 -16
- package/dist/cjs-types/cli/lib/deployApi/evaluateSchema.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/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 +10 -2
- 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/server/impl/actions_impl.d.ts +18 -3
- package/dist/cjs-types/server/impl/actions_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 +1 -1
- 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 +10 -0
- package/dist/cjs-types/server/registration.d.ts.map +1 -1
- package/dist/cjs-types/server/schema.d.ts +33 -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/value.d.ts.map +1 -1
- package/dist/cli.bundle.cjs +2935 -2048
- package/dist/cli.bundle.cjs.map +4 -4
- package/dist/esm/bundler/index.js +5 -4
- package/dist/esm/bundler/index.js.map +2 -2
- package/dist/esm/cli/codegen.js +0 -4
- 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 +27 -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/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 +37 -48
- package/dist/esm/cli/lib/checkForLargeIndexDeletion.js.map +2 -2
- package/dist/esm/cli/lib/checkForSlowSchemaValidation.js +63 -41
- package/dist/esm/cli/lib/checkForSlowSchemaValidation.js.map +2 -2
- 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 +55 -5
- 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 +3 -1
- package/dist/esm/cli/lib/deploy2.js.map +2 -2
- package/dist/esm/cli/lib/deployApi/evaluateSchema.js +28 -2
- package/dist/esm/cli/lib/deployApi/evaluateSchema.js.map +2 -2
- package/dist/esm/cli/lib/dev.js +5 -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/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 +4 -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 +47 -18
- 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/server/impl/actions_impl.js +7 -3
- package/dist/esm/server/impl/actions_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 +34 -12
- package/dist/esm/server/schema.js.map +2 -2
- package/dist/esm/values/validators.js +1 -1
- 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/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/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 +5 -7
- package/dist/esm-types/cli/lib/checkForLargeIndexDeletion.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts +4 -10
- package/dist/esm-types/cli/lib/checkForSlowSchemaValidation.d.ts.map +1 -1
- 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 -3
- 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 +4 -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 +2 -0
- package/dist/esm-types/cli/lib/deploy2.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deployApi/evaluateSchema.d.ts +460 -16
- package/dist/esm-types/cli/lib/deployApi/evaluateSchema.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/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 +10 -2
- 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/server/impl/actions_impl.d.ts +18 -3
- package/dist/esm-types/server/impl/actions_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 +1 -1
- 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 +10 -0
- package/dist/esm-types/server/registration.d.ts.map +1 -1
- package/dist/esm-types/server/schema.d.ts +33 -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/value.d.ts.map +1 -1
- package/dist/react.bundle.js +7 -1
- package/dist/react.bundle.js.map +2 -2
- package/package.json +5 -5
- package/schemas/convex.schema.json +5 -5
- package/src/bundler/index.ts +9 -4
- package/src/cli/codegen.ts +0 -2
- package/src/cli/configure.ts +27 -7
- package/src/cli/deploy.ts +36 -5
- package/src/cli/deploymentSelect.ts +7 -4
- package/src/cli/dev.ts +9 -0
- 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 +45 -58
- package/src/cli/lib/checkForSlowSchemaValidation.ts +76 -65
- package/src/cli/lib/checkForStagedValidatorDeletion.ts +104 -0
- package/src/cli/lib/codegen.ts +0 -3
- package/src/cli/lib/command.ts +3 -0
- package/src/cli/lib/components/definition/bundle.ts +68 -14
- package/src/cli/lib/components.ts +71 -4
- package/src/cli/lib/config.ts +85 -18
- package/src/cli/lib/deploy2.ts +10 -1
- package/src/cli/lib/deployApi/evaluateSchema.ts +35 -0
- package/src/cli/lib/dev.ts +14 -0
- package/src/cli/lib/formatValidationProgress.ts +35 -0
- package/src/cli/lib/indexes.ts +1 -1
- package/src/cli/lib/mcp/tools/env.ts +17 -3
- package/src/cli/lib/run.ts +2 -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 +64 -21
- package/src/cli/projectCreate.ts +1 -1
- package/src/index.ts +1 -1
- package/src/server/impl/actions_impl.ts +26 -6
- package/src/server/impl/storage_impl.ts +30 -0
- package/src/server/index.ts +5 -1
- package/src/server/meta.ts +56 -2
- package/src/server/registration.ts +10 -0
- package/src/server/schema.ts +37 -15
- package/src/server/storage.ts +17 -0
- package/src/values/validators.ts +1 -1
- package/src/values/value.ts +9 -5
|
@@ -517,6 +517,23 @@ export async function selectRegionOrUseDefault(
|
|
|
517
517
|
return selectedRegionName;
|
|
518
518
|
}
|
|
519
519
|
|
|
520
|
+
// Mirrors the order of `REGION_PRESENTATION` in
|
|
521
|
+
// `npm-packages/dashboard/src/lib/regions.ts`, so both region pickers list
|
|
522
|
+
// regions in the same order.
|
|
523
|
+
const REGION_ORDER: string[] = [
|
|
524
|
+
"aws-us-east-1",
|
|
525
|
+
"aws-eu-west-1",
|
|
526
|
+
"aws-ca-central-1",
|
|
527
|
+
"aws-ap-southeast-2",
|
|
528
|
+
];
|
|
529
|
+
|
|
530
|
+
// Regions missing from `REGION_ORDER` (e.g. newly launched ones) go last, in
|
|
531
|
+
// server order, since `Array.prototype.sort` is stable.
|
|
532
|
+
function regionSortIndex(regionName: string): number {
|
|
533
|
+
const index = REGION_ORDER.indexOf(regionName);
|
|
534
|
+
return index === -1 ? REGION_ORDER.length : index;
|
|
535
|
+
}
|
|
536
|
+
|
|
520
537
|
export async function selectRegion(
|
|
521
538
|
ctx: Context,
|
|
522
539
|
teamId: number,
|
|
@@ -538,12 +555,7 @@ export async function selectRegion(
|
|
|
538
555
|
name: item.displayName,
|
|
539
556
|
value: item.name,
|
|
540
557
|
}))
|
|
541
|
-
.sort((a, b) =>
|
|
542
|
-
// Show US region first if it exists
|
|
543
|
-
if (a.value === "aws-us-east-1") return -1;
|
|
544
|
-
if (b.value === "aws-us-east-1") return 1;
|
|
545
|
-
return 0;
|
|
546
|
-
});
|
|
558
|
+
.sort((a, b) => regionSortIndex(a.value) - regionSortIndex(b.value));
|
|
547
559
|
return await promptOptions(ctx, {
|
|
548
560
|
message: `Where should this ${deploymentType} deployment run?`,
|
|
549
561
|
suffix: `\n${chalkStderr.gray(
|
|
@@ -559,16 +571,18 @@ export async function hasProject(
|
|
|
559
571
|
projectSlug: string,
|
|
560
572
|
) {
|
|
561
573
|
try {
|
|
562
|
-
|
|
563
|
-
|
|
574
|
+
await typedPlatformClient(ctx, { throw: true }).GET(
|
|
575
|
+
"/teams/{team_id_or_slug}/projects/{project_slug}",
|
|
576
|
+
{
|
|
564
577
|
params: {
|
|
565
578
|
path: {
|
|
566
|
-
|
|
579
|
+
team_id_or_slug: teamSlug,
|
|
580
|
+
project_slug: projectSlug,
|
|
567
581
|
},
|
|
568
582
|
},
|
|
569
|
-
}
|
|
570
|
-
)
|
|
571
|
-
return
|
|
583
|
+
},
|
|
584
|
+
);
|
|
585
|
+
return true;
|
|
572
586
|
} catch {
|
|
573
587
|
return false;
|
|
574
588
|
}
|
|
@@ -581,19 +595,27 @@ export async function hasProjects(ctx: Context) {
|
|
|
581
595
|
export async function validateOrSelectProject(
|
|
582
596
|
ctx: Context,
|
|
583
597
|
projectSlug: string | undefined,
|
|
584
|
-
|
|
598
|
+
teamId: number,
|
|
585
599
|
singleProjectPrompt: string,
|
|
586
600
|
multiProjectPrompt: string,
|
|
587
601
|
): Promise<string | null> {
|
|
588
|
-
const projects: Project[] =
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
602
|
+
const projects: Project[] = [];
|
|
603
|
+
const client = typedPlatformClient(ctx);
|
|
604
|
+
let cursor: string | undefined;
|
|
605
|
+
do {
|
|
606
|
+
const { items, pagination } = (
|
|
607
|
+
await client.GET("/teams/{team_id}/projects", {
|
|
608
|
+
params: {
|
|
609
|
+
path: { team_id: teamId },
|
|
610
|
+
query: cursor === undefined ? {} : { cursor },
|
|
593
611
|
},
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
612
|
+
})
|
|
613
|
+
).data!;
|
|
614
|
+
projects.push(...items);
|
|
615
|
+
cursor = pagination.hasMore
|
|
616
|
+
? (pagination.nextCursor ?? undefined)
|
|
617
|
+
: undefined;
|
|
618
|
+
} while (cursor !== undefined);
|
|
597
619
|
if (projects.length === 0) {
|
|
598
620
|
return await ctx.crash({
|
|
599
621
|
exitCode: 1,
|
|
@@ -996,6 +1018,27 @@ export function formatSize(n: number): string {
|
|
|
996
1018
|
return `${formatted} ${BYTE_UNITS[unitIndex]}`;
|
|
997
1019
|
}
|
|
998
1020
|
|
|
1021
|
+
/**
|
|
1022
|
+
* Read an integer override from the environment, falling back to
|
|
1023
|
+
* `defaultValue` when the variable is unset. The whole value must be a
|
|
1024
|
+
* base-10 integer: `parseInt` would read a typo like `100_000` or `100k` as
|
|
1025
|
+
* 100 and silently move the threshold, so anything else is rejected with a
|
|
1026
|
+
* warning instead.
|
|
1027
|
+
*/
|
|
1028
|
+
export function integerFromEnv(envVar: string, defaultValue: number): number {
|
|
1029
|
+
const envValue = process.env[envVar];
|
|
1030
|
+
if (envValue === undefined) {
|
|
1031
|
+
return defaultValue;
|
|
1032
|
+
}
|
|
1033
|
+
if (!/^[+-]?\d+$/.test(envValue.trim())) {
|
|
1034
|
+
logWarning(
|
|
1035
|
+
`Ignoring ${envVar}=${JSON.stringify(envValue)}: expected an integer, using ${defaultValue}`,
|
|
1036
|
+
);
|
|
1037
|
+
return defaultValue;
|
|
1038
|
+
}
|
|
1039
|
+
return Number(envValue);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
999
1042
|
export function formatDuration(ms: number): string {
|
|
1000
1043
|
const twoDigits = (n: number, unit: string) =>
|
|
1001
1044
|
`${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}${unit}`;
|
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";
|
|
@@ -64,26 +64,46 @@ export function setupActionCalls(requestId: string) {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* A Convex-managed service. The backend decides which names it accepts; this
|
|
69
|
+
* type lists the ones the current release knows about.
|
|
70
|
+
*/
|
|
71
|
+
export type ServiceName = "ai-gateway";
|
|
72
|
+
|
|
67
73
|
/**
|
|
68
74
|
* Get a short-lived credential for calling a Convex-managed service.
|
|
69
75
|
*
|
|
70
76
|
* This function can only be called while an action is running. The credential
|
|
71
77
|
* is scoped to the current deployment and should be sent as a bearer token.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
78
|
+
* The action runtime caches and refreshes credentials as needed, so call
|
|
79
|
+
* this function whenever making a service request.
|
|
74
80
|
*
|
|
75
81
|
* @param service - The service the credential may access.
|
|
76
82
|
* @returns A JWT to send as `Authorization: Bearer <token>`. Keep it inside
|
|
77
83
|
* the action: don't return it to clients or store it in environment
|
|
78
84
|
* variables.
|
|
79
85
|
*/
|
|
80
|
-
export async function getServiceToken(service:
|
|
86
|
+
export async function getServiceToken(service: ServiceName): Promise<string> {
|
|
81
87
|
validateArg(service, 1, "getServiceToken", "service");
|
|
82
|
-
if (service !== "ai-gateway") {
|
|
83
|
-
throw new Error(`Unsupported service "${String(service)}"`);
|
|
84
|
-
}
|
|
85
88
|
return await performAsyncSyscall("1.0/createServiceToken", {
|
|
86
89
|
service,
|
|
87
90
|
version,
|
|
88
91
|
});
|
|
89
92
|
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the base URL of a Convex-managed service.
|
|
96
|
+
*
|
|
97
|
+
* This function can only be called while an action is running. Pair it with
|
|
98
|
+
* {@link getServiceToken} to reach the service.
|
|
99
|
+
*
|
|
100
|
+
* @param service - The service to address.
|
|
101
|
+
* @returns The service's origin, without a trailing slash.
|
|
102
|
+
*/
|
|
103
|
+
export async function getServiceUrl(service: ServiceName): Promise<string> {
|
|
104
|
+
validateArg(service, 1, "getServiceUrl", "service");
|
|
105
|
+
return await performAsyncSyscall("1.0/getServiceUrl", {
|
|
106
|
+
service,
|
|
107
|
+
version,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
@@ -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,
|
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,18 +146,30 @@ 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>;
|
|
136
163
|
/**
|
|
137
|
-
* @internal
|
|
138
164
|
* Returns the timestamp of the database snapshot this transaction reads
|
|
139
165
|
* from, in nanoseconds.
|
|
140
166
|
*
|
|
141
167
|
* All commits at or before this timestamp are observable within the
|
|
142
168
|
* transaction, and no later commits are. The value is fixed for the
|
|
143
169
|
* lifetime of the transaction and shared with all nested `runMutation` and
|
|
144
|
-
* `runQuery` calls.
|
|
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.
|
|
145
173
|
*
|
|
146
174
|
* It is on the same clock as `db.vars.commitTs`: documents observable in
|
|
147
175
|
* this transaction have `commitTs` values at or before this timestamp, and
|
|
@@ -156,6 +184,8 @@ export interface QueryMeta {
|
|
|
156
184
|
* Note: this should not be compared to `_creationTime` or `Date.now()`, as
|
|
157
185
|
* those are based on wall-clock time rather than the database clock, and
|
|
158
186
|
* aren't guaranteed to follow commit order.
|
|
187
|
+
*
|
|
188
|
+
* Docs: https://docs.convex.dev/database/advanced/commit-timestamp
|
|
159
189
|
*/
|
|
160
190
|
getSnapshotTs(): bigint;
|
|
161
191
|
}
|
|
@@ -166,6 +196,15 @@ export interface QueryMeta {
|
|
|
166
196
|
* @public
|
|
167
197
|
*/
|
|
168
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
|
+
*/
|
|
169
208
|
getRequestMetadata(): Promise<RequestMetadata>;
|
|
170
209
|
}
|
|
171
210
|
|
|
@@ -175,7 +214,22 @@ export interface MutationMeta extends QueryMeta {
|
|
|
175
214
|
* @public
|
|
176
215
|
*/
|
|
177
216
|
export interface ActionMeta {
|
|
217
|
+
/**
|
|
218
|
+
* Metadata about the currently executing Convex function.
|
|
219
|
+
*/
|
|
178
220
|
getFunctionMetadata(): Promise<FunctionMetadata>;
|
|
221
|
+
/**
|
|
222
|
+
* Metadata about the deployment this function is running on.
|
|
223
|
+
*/
|
|
179
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
|
+
*/
|
|
180
234
|
getRequestMetadata(): Promise<RequestMetadata>;
|
|
181
235
|
}
|
|
@@ -1234,6 +1234,11 @@ export type HttpActionBuilder = (
|
|
|
1234
1234
|
) => PublicHttpAction;
|
|
1235
1235
|
|
|
1236
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
|
+
*/
|
|
1237
1242
|
transactionLimits?: TransactionLimits;
|
|
1238
1243
|
/**
|
|
1239
1244
|
* Run a query on a recent snapshot of the database that is not guaranteed
|
|
@@ -1244,6 +1249,11 @@ export interface AdvancedRunQueryOptions {
|
|
|
1244
1249
|
* database read conflicts are expected, e.g. reading from an append-only
|
|
1245
1250
|
* table with immutable records where the only read conflicts are from
|
|
1246
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.
|
|
1247
1257
|
*/
|
|
1248
1258
|
useStaleSnapshot?: boolean;
|
|
1249
1259
|
}
|
package/src/server/schema.ts
CHANGED
|
@@ -561,41 +561,63 @@ export class TableDefinition<
|
|
|
561
561
|
}
|
|
562
562
|
|
|
563
563
|
/**
|
|
564
|
-
* Stage
|
|
564
|
+
* Stage changes to this table's document validator.
|
|
565
565
|
*
|
|
566
566
|
* Convex validates the staged validator against the table's existing
|
|
567
567
|
* documents in the background, while the validator passed to
|
|
568
|
-
* {@link defineTable} remains the one enforced on
|
|
569
|
-
* the background validation succeeds,
|
|
570
|
-
*
|
|
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.
|
|
571
576
|
*
|
|
572
577
|
* ```ts
|
|
573
578
|
* defineTable({
|
|
574
|
-
*
|
|
579
|
+
* apple: v.string(),
|
|
580
|
+
* banana: v.number(),
|
|
581
|
+
* legacy: v.optional(v.string()),
|
|
575
582
|
* }).staged({
|
|
576
|
-
*
|
|
583
|
+
* banana: v.union(v.string(), v.number()),
|
|
584
|
+
* legacy: undefined,
|
|
577
585
|
* })
|
|
578
586
|
* ```
|
|
579
587
|
*
|
|
580
|
-
*
|
|
588
|
+
* See [Staged validators](https://docs.convex.dev/database/schemas#staged-validators).
|
|
581
589
|
*
|
|
582
|
-
* @param documentSchema -
|
|
583
|
-
*
|
|
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.
|
|
584
593
|
* @returns A {@link TableDefinition} with the staged validator attached.
|
|
585
|
-
*
|
|
586
|
-
* @internal
|
|
587
594
|
*/
|
|
588
595
|
staged(
|
|
589
596
|
documentSchema:
|
|
590
597
|
| Validator<Record<string, any>, "required", any>
|
|
591
|
-
| Record<string, GenericValidator>,
|
|
598
|
+
| Record<string, GenericValidator | undefined>,
|
|
592
599
|
): TableDefinition<DocumentType, Indexes, SearchIndexes, VectorIndexes> {
|
|
593
600
|
if (this.stagedValidator !== undefined) {
|
|
594
601
|
throw new Error("Table cannot have more than one staged validator.");
|
|
595
602
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
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
|
+
}
|
|
599
621
|
return this.self();
|
|
600
622
|
}
|
|
601
623
|
|
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/validators.ts
CHANGED
|
@@ -641,7 +641,7 @@ export class VRecord<
|
|
|
641
641
|
throw new Error("Record validator cannot have optional values");
|
|
642
642
|
}
|
|
643
643
|
if (!key.isConvexValidator || !value.isConvexValidator) {
|
|
644
|
-
throw new Error("Key and value of v.record()
|
|
644
|
+
throw new Error("Key and value of v.record() must be validators");
|
|
645
645
|
}
|
|
646
646
|
this.key = key;
|
|
647
647
|
this.value = value;
|
package/src/values/value.ts
CHANGED
|
@@ -311,13 +311,17 @@ const MAX_VALUE_FOR_ERROR_LEN = 16384;
|
|
|
311
311
|
export function stringifyValueForError(value: any) {
|
|
312
312
|
const str = JSON.stringify(value, (_key, value) => {
|
|
313
313
|
if (value === undefined) {
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
// We deal with `undefined` specifically because it's the most common.
|
|
317
|
-
// Ideally we'd use a pretty-printing library that prints `undefined`
|
|
318
|
-
// (no quotes), but it might not be worth the bundle size cost.
|
|
314
|
+
// JSON.stringify omits undefined object properties and converts undefined
|
|
315
|
+
// array elements to null. Preserve them in error messages.
|
|
319
316
|
return "undefined";
|
|
320
317
|
}
|
|
318
|
+
if (typeof value === "function") {
|
|
319
|
+
// A fixed placeholder also works for functions with custom string coercion.
|
|
320
|
+
return "[Function]";
|
|
321
|
+
}
|
|
322
|
+
if (typeof value === "symbol") {
|
|
323
|
+
return String(value);
|
|
324
|
+
}
|
|
321
325
|
if (typeof value === "bigint") {
|
|
322
326
|
// `JSON.stringify` throws on bigints by default.
|
|
323
327
|
return `${value.toString()}n`;
|