convex 1.46.0 → 1.48.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -1
- package/dist/browser.bundle.js +7 -1
- package/dist/browser.bundle.js.map +2 -2
- package/dist/cjs/bundler/context.js +7 -5
- package/dist/cjs/bundler/context.js.map +2 -2
- package/dist/cjs/bundler/fs.js +47 -6
- package/dist/cjs/bundler/fs.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/account.js +237 -0
- package/dist/cjs/cli/account.js.map +7 -0
- package/dist/cjs/cli/codegen.js +0 -4
- package/dist/cjs/cli/codegen.js.map +2 -2
- package/dist/cjs/cli/configure.js +28 -6
- 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/deployKeyWarning.js +43 -0
- package/dist/cjs/cli/lib/deployKeyWarning.js.map +7 -0
- package/dist/cjs/cli/lib/deployment.js +2 -0
- package/dist/cjs/cli/lib/deployment.js.map +2 -2
- package/dist/cjs/cli/lib/deploymentSelection.js +27 -18
- package/dist/cjs/cli/lib/deploymentSelection.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/envvars.js +32 -0
- package/dist/cjs/cli/lib/envvars.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/fsUtils.js +1 -1
- package/dist/cjs/cli/lib/fsUtils.js.map +2 -2
- package/dist/cjs/cli/lib/generateDocs.js +1 -1
- package/dist/cjs/cli/lib/generateDocs.js.map +1 -1
- package/dist/cjs/cli/lib/indexes.js.map +1 -1
- package/dist/cjs/cli/lib/login.js +28 -4
- package/dist/cjs/cli/lib/login.js.map +2 -2
- package/dist/cjs/cli/lib/mcp/requestContext.js +5 -1
- package/dist/cjs/cli/lib/mcp/requestContext.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/profileManagement.js +196 -0
- package/dist/cjs/cli/lib/profileManagement.js.map +7 -0
- package/dist/cjs/cli/lib/profiles.js +333 -0
- package/dist/cjs/cli/lib/profiles.js.map +7 -0
- 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 +66 -27
- package/dist/cjs/cli/lib/utils/utils.js.map +2 -2
- package/dist/cjs/cli/login.js +213 -114
- package/dist/cjs/cli/login.js.map +3 -3
- package/dist/cjs/cli/logout.js +113 -12
- package/dist/cjs/cli/logout.js.map +3 -3
- package/dist/cjs/cli/mcp.js +43 -10
- package/dist/cjs/cli/mcp.js.map +3 -3
- package/dist/cjs/cli/program.js +2 -1
- package/dist/cjs/cli/program.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/context.d.ts +5 -0
- package/dist/cjs-types/bundler/context.d.ts.map +1 -1
- package/dist/cjs-types/bundler/fs.d.ts +7 -2
- package/dist/cjs-types/bundler/fs.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/account.d.ts +6 -0
- package/dist/cjs-types/cli/account.d.ts.map +1 -0
- 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/deployKeyWarning.d.ts +3 -0
- package/dist/cjs-types/cli/lib/deployKeyWarning.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/deployment.d.ts +2 -0
- package/dist/cjs-types/cli/lib/deployment.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deploymentSelection.d.ts +2 -1
- package/dist/cjs-types/cli/lib/deploymentSelection.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/envvars.d.ts +6 -0
- package/dist/cjs-types/cli/lib/envvars.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/fsUtils.d.ts +1 -0
- package/dist/cjs-types/cli/lib/fsUtils.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/login.d.ts +3 -1
- package/dist/cjs-types/cli/lib/login.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/mcp/requestContext.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/mcp/tools/insights.d.ts +2 -2
- package/dist/cjs-types/cli/lib/profileManagement.d.ts +10 -0
- package/dist/cjs-types/cli/lib/profileManagement.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/profiles.d.ts +59 -0
- package/dist/cjs-types/cli/lib/profiles.d.ts.map +1 -0
- 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 -2
- package/dist/cjs-types/cli/lib/utils/utils.d.ts.map +1 -1
- package/dist/cjs-types/cli/login.d.ts +21 -0
- package/dist/cjs-types/cli/login.d.ts.map +1 -1
- package/dist/cjs-types/cli/logout.d.ts +8 -1
- package/dist/cjs-types/cli/logout.d.ts.map +1 -1
- package/dist/cjs-types/cli/mcp.d.ts.map +1 -1
- package/dist/cjs-types/cli/program.d.ts.map +1 -1
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/cjs-types/index.d.ts.map +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 +4889 -2980
- package/dist/cli.bundle.cjs.map +4 -4
- package/dist/esm/bundler/context.js +7 -5
- package/dist/esm/bundler/context.js.map +2 -2
- package/dist/esm/bundler/fs.js +47 -6
- package/dist/esm/bundler/fs.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/account.js +221 -0
- package/dist/esm/cli/account.js.map +7 -0
- package/dist/esm/cli/codegen.js +0 -4
- package/dist/esm/cli/codegen.js.map +2 -2
- package/dist/esm/cli/configure.js +27 -6
- 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/deployKeyWarning.js +27 -0
- package/dist/esm/cli/lib/deployKeyWarning.js.map +7 -0
- package/dist/esm/cli/lib/deployment.js +2 -2
- package/dist/esm/cli/lib/deployment.js.map +2 -2
- package/dist/esm/cli/lib/deploymentSelection.js +35 -20
- package/dist/esm/cli/lib/deploymentSelection.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/envvars.js +35 -1
- package/dist/esm/cli/lib/envvars.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/fsUtils.js +1 -1
- package/dist/esm/cli/lib/fsUtils.js.map +2 -2
- package/dist/esm/cli/lib/generateDocs.js +1 -1
- package/dist/esm/cli/lib/generateDocs.js.map +1 -1
- package/dist/esm/cli/lib/indexes.js.map +1 -1
- package/dist/esm/cli/lib/login.js +36 -4
- package/dist/esm/cli/lib/login.js.map +2 -2
- package/dist/esm/cli/lib/mcp/requestContext.js +5 -1
- package/dist/esm/cli/lib/mcp/requestContext.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/profileManagement.js +179 -0
- package/dist/esm/cli/lib/profileManagement.js.map +7 -0
- package/dist/esm/cli/lib/profiles.js +288 -0
- package/dist/esm/cli/lib/profiles.js.map +7 -0
- 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 +63 -27
- package/dist/esm/cli/lib/utils/utils.js.map +2 -2
- package/dist/esm/cli/login.js +225 -112
- package/dist/esm/cli/login.js.map +3 -3
- package/dist/esm/cli/logout.js +110 -13
- package/dist/esm/cli/logout.js.map +2 -2
- package/dist/esm/cli/mcp.js +34 -10
- package/dist/esm/cli/mcp.js.map +2 -2
- package/dist/esm/cli/program.js +2 -1
- package/dist/esm/cli/program.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/context.d.ts +5 -0
- package/dist/esm-types/bundler/context.d.ts.map +1 -1
- package/dist/esm-types/bundler/fs.d.ts +7 -2
- package/dist/esm-types/bundler/fs.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/account.d.ts +6 -0
- package/dist/esm-types/cli/account.d.ts.map +1 -0
- 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/deployKeyWarning.d.ts +3 -0
- package/dist/esm-types/cli/lib/deployKeyWarning.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/deployment.d.ts +2 -0
- package/dist/esm-types/cli/lib/deployment.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deploymentSelection.d.ts +2 -1
- package/dist/esm-types/cli/lib/deploymentSelection.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/envvars.d.ts +6 -0
- package/dist/esm-types/cli/lib/envvars.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/fsUtils.d.ts +1 -0
- package/dist/esm-types/cli/lib/fsUtils.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/login.d.ts +3 -1
- package/dist/esm-types/cli/lib/login.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/mcp/requestContext.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/mcp/tools/insights.d.ts +2 -2
- package/dist/esm-types/cli/lib/profileManagement.d.ts +10 -0
- package/dist/esm-types/cli/lib/profileManagement.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/profiles.d.ts +59 -0
- package/dist/esm-types/cli/lib/profiles.d.ts.map +1 -0
- 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 -2
- package/dist/esm-types/cli/lib/utils/utils.d.ts.map +1 -1
- package/dist/esm-types/cli/login.d.ts +21 -0
- package/dist/esm-types/cli/login.d.ts.map +1 -1
- package/dist/esm-types/cli/logout.d.ts +8 -1
- package/dist/esm-types/cli/logout.d.ts.map +1 -1
- package/dist/esm-types/cli/mcp.d.ts.map +1 -1
- package/dist/esm-types/cli/program.d.ts.map +1 -1
- package/dist/esm-types/index.d.ts +1 -1
- package/dist/esm-types/index.d.ts.map +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/context.ts +9 -5
- package/src/bundler/fs.ts +54 -5
- package/src/bundler/index.ts +9 -4
- package/src/cli/account.ts +320 -0
- package/src/cli/codegen.ts +0 -2
- package/src/cli/configure.ts +45 -9
- 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/deployKeyWarning.ts +43 -0
- package/src/cli/lib/deployment.ts +2 -2
- package/src/cli/lib/deploymentSelection.ts +37 -18
- package/src/cli/lib/dev.ts +14 -0
- package/src/cli/lib/envvars.ts +43 -1
- package/src/cli/lib/formatValidationProgress.ts +35 -0
- package/src/cli/lib/fsUtils.ts +5 -2
- package/src/cli/lib/generateDocs.ts +1 -1
- package/src/cli/lib/indexes.ts +1 -1
- package/src/cli/lib/login.ts +47 -3
- package/src/cli/lib/mcp/requestContext.ts +7 -1
- package/src/cli/lib/mcp/tools/env.ts +17 -3
- package/src/cli/lib/profileManagement.ts +262 -0
- package/src/cli/lib/profiles.ts +398 -0
- 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 +83 -36
- package/src/cli/login.ts +293 -168
- package/src/cli/logout.ts +142 -17
- package/src/cli/mcp.ts +48 -11
- package/src/cli/program.ts +2 -0
- 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
|
@@ -45,6 +45,7 @@ export const CONVEX_DEPLOYMENT_ENV_VAR_NAME = "CONVEX_DEPLOYMENT";
|
|
|
45
45
|
export const CONVEX_SELF_HOSTED_URL_VAR_NAME = "CONVEX_SELF_HOSTED_URL";
|
|
46
46
|
export const CONVEX_SELF_HOSTED_ADMIN_KEY_VAR_NAME =
|
|
47
47
|
"CONVEX_SELF_HOSTED_ADMIN_KEY";
|
|
48
|
+
export const IGNORED_DEPLOY_KEY = "<ignore_deploy_key>";
|
|
48
49
|
const MAX_RETRIES = 6;
|
|
49
50
|
// After 3 retries, log a progress message that we're retrying the request
|
|
50
51
|
const RETRY_LOG_THRESHOLD = 3;
|
|
@@ -69,7 +70,7 @@ export async function processDeployKeyValue(
|
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
// Check for <ignore_deploy_key> sentinel
|
|
72
|
-
if (deployKey ===
|
|
73
|
+
if (deployKey === IGNORED_DEPLOY_KEY) {
|
|
73
74
|
return undefined;
|
|
74
75
|
}
|
|
75
76
|
|
|
@@ -96,9 +97,20 @@ export async function processDeployKeyValue(
|
|
|
96
97
|
export function readDeployKeyFromEnv(
|
|
97
98
|
getEnv: (name: string) => string | undefined | null,
|
|
98
99
|
): string | undefined {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
return readDeployKeyEnvVar(getEnv)?.value;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function readDeployKeyEnvVar(
|
|
104
|
+
getEnv: (name: string) => string | undefined | null,
|
|
105
|
+
): { name: string; value: string } | undefined {
|
|
106
|
+
for (const name of [
|
|
107
|
+
CONVEX_DEPLOY_KEY_ENV_VAR_NAME,
|
|
108
|
+
CONVEX_DEPLOYMENT_TOKEN_ENV_VAR_NAME,
|
|
109
|
+
]) {
|
|
110
|
+
const value = getEnv(name);
|
|
111
|
+
if (value) return { name, value };
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
102
114
|
}
|
|
103
115
|
|
|
104
116
|
// The prefix the backend's `require_operation` checks use when an identity
|
|
@@ -108,17 +120,9 @@ const PERMISSION_DENIED_MESSAGE_PREFIX =
|
|
|
108
120
|
"You do not have permission to perform this operation";
|
|
109
121
|
|
|
110
122
|
function deployKeyPermissionAdvice(): string | null {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
? CONVEX_DEPLOY_KEY_ENV_VAR_NAME
|
|
115
|
-
: process.env[CONVEX_DEPLOYMENT_TOKEN_ENV_VAR_NAME]
|
|
116
|
-
? CONVEX_DEPLOYMENT_TOKEN_ENV_VAR_NAME
|
|
117
|
-
: null;
|
|
118
|
-
if (envVarName === null) {
|
|
119
|
-
return null;
|
|
120
|
-
}
|
|
121
|
-
return `This is determined by the permissions granted to ${envVarName}.`;
|
|
123
|
+
const envVar = readDeployKeyEnvVar((name) => process.env[name]);
|
|
124
|
+
if (envVar === undefined || envVar.value === IGNORED_DEPLOY_KEY) return null;
|
|
125
|
+
return `This is determined by the permissions granted to ${envVar.name}.`;
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
/**
|
|
@@ -517,6 +521,23 @@ export async function selectRegionOrUseDefault(
|
|
|
517
521
|
return selectedRegionName;
|
|
518
522
|
}
|
|
519
523
|
|
|
524
|
+
// Mirrors the order of `REGION_PRESENTATION` in
|
|
525
|
+
// `npm-packages/dashboard/src/lib/regions.ts`, so both region pickers list
|
|
526
|
+
// regions in the same order.
|
|
527
|
+
const REGION_ORDER: string[] = [
|
|
528
|
+
"aws-us-east-1",
|
|
529
|
+
"aws-eu-west-1",
|
|
530
|
+
"aws-ca-central-1",
|
|
531
|
+
"aws-ap-southeast-2",
|
|
532
|
+
];
|
|
533
|
+
|
|
534
|
+
// Regions missing from `REGION_ORDER` (e.g. newly launched ones) go last, in
|
|
535
|
+
// server order, since `Array.prototype.sort` is stable.
|
|
536
|
+
function regionSortIndex(regionName: string): number {
|
|
537
|
+
const index = REGION_ORDER.indexOf(regionName);
|
|
538
|
+
return index === -1 ? REGION_ORDER.length : index;
|
|
539
|
+
}
|
|
540
|
+
|
|
520
541
|
export async function selectRegion(
|
|
521
542
|
ctx: Context,
|
|
522
543
|
teamId: number,
|
|
@@ -538,12 +559,7 @@ export async function selectRegion(
|
|
|
538
559
|
name: item.displayName,
|
|
539
560
|
value: item.name,
|
|
540
561
|
}))
|
|
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
|
-
});
|
|
562
|
+
.sort((a, b) => regionSortIndex(a.value) - regionSortIndex(b.value));
|
|
547
563
|
return await promptOptions(ctx, {
|
|
548
564
|
message: `Where should this ${deploymentType} deployment run?`,
|
|
549
565
|
suffix: `\n${chalkStderr.gray(
|
|
@@ -559,16 +575,18 @@ export async function hasProject(
|
|
|
559
575
|
projectSlug: string,
|
|
560
576
|
) {
|
|
561
577
|
try {
|
|
562
|
-
|
|
563
|
-
|
|
578
|
+
await typedPlatformClient(ctx, { throw: true }).GET(
|
|
579
|
+
"/teams/{team_id_or_slug}/projects/{project_slug}",
|
|
580
|
+
{
|
|
564
581
|
params: {
|
|
565
582
|
path: {
|
|
566
|
-
|
|
583
|
+
team_id_or_slug: teamSlug,
|
|
584
|
+
project_slug: projectSlug,
|
|
567
585
|
},
|
|
568
586
|
},
|
|
569
|
-
}
|
|
570
|
-
)
|
|
571
|
-
return
|
|
587
|
+
},
|
|
588
|
+
);
|
|
589
|
+
return true;
|
|
572
590
|
} catch {
|
|
573
591
|
return false;
|
|
574
592
|
}
|
|
@@ -581,19 +599,27 @@ export async function hasProjects(ctx: Context) {
|
|
|
581
599
|
export async function validateOrSelectProject(
|
|
582
600
|
ctx: Context,
|
|
583
601
|
projectSlug: string | undefined,
|
|
584
|
-
|
|
602
|
+
teamId: number,
|
|
585
603
|
singleProjectPrompt: string,
|
|
586
604
|
multiProjectPrompt: string,
|
|
587
605
|
): Promise<string | null> {
|
|
588
|
-
const projects: Project[] =
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
606
|
+
const projects: Project[] = [];
|
|
607
|
+
const client = typedPlatformClient(ctx);
|
|
608
|
+
let cursor: string | undefined;
|
|
609
|
+
do {
|
|
610
|
+
const { items, pagination } = (
|
|
611
|
+
await client.GET("/teams/{team_id}/projects", {
|
|
612
|
+
params: {
|
|
613
|
+
path: { team_id: teamId },
|
|
614
|
+
query: cursor === undefined ? {} : { cursor },
|
|
593
615
|
},
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
|
|
616
|
+
})
|
|
617
|
+
).data!;
|
|
618
|
+
projects.push(...items);
|
|
619
|
+
cursor = pagination.hasMore
|
|
620
|
+
? (pagination.nextCursor ?? undefined)
|
|
621
|
+
: undefined;
|
|
622
|
+
} while (cursor !== undefined);
|
|
597
623
|
if (projects.length === 0) {
|
|
598
624
|
return await ctx.crash({
|
|
599
625
|
exitCode: 1,
|
|
@@ -996,6 +1022,27 @@ export function formatSize(n: number): string {
|
|
|
996
1022
|
return `${formatted} ${BYTE_UNITS[unitIndex]}`;
|
|
997
1023
|
}
|
|
998
1024
|
|
|
1025
|
+
/**
|
|
1026
|
+
* Read an integer override from the environment, falling back to
|
|
1027
|
+
* `defaultValue` when the variable is unset. The whole value must be a
|
|
1028
|
+
* base-10 integer: `parseInt` would read a typo like `100_000` or `100k` as
|
|
1029
|
+
* 100 and silently move the threshold, so anything else is rejected with a
|
|
1030
|
+
* warning instead.
|
|
1031
|
+
*/
|
|
1032
|
+
export function integerFromEnv(envVar: string, defaultValue: number): number {
|
|
1033
|
+
const envValue = process.env[envVar];
|
|
1034
|
+
if (envValue === undefined) {
|
|
1035
|
+
return defaultValue;
|
|
1036
|
+
}
|
|
1037
|
+
if (!/^[+-]?\d+$/.test(envValue.trim())) {
|
|
1038
|
+
logWarning(
|
|
1039
|
+
`Ignoring ${envVar}=${JSON.stringify(envValue)}: expected an integer, using ${defaultValue}`,
|
|
1040
|
+
);
|
|
1041
|
+
return defaultValue;
|
|
1042
|
+
}
|
|
1043
|
+
return Number(envValue);
|
|
1044
|
+
}
|
|
1045
|
+
|
|
999
1046
|
export function formatDuration(ms: number): string {
|
|
1000
1047
|
const twoDigits = (n: number, unit: string) =>
|
|
1001
1048
|
`${n.toLocaleString("en-US", { maximumFractionDigits: 2 })}${unit}`;
|
package/src/cli/login.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Command, Option } from "@commander-js/extra-typings";
|
|
2
|
-
import * as dotenv from "dotenv";
|
|
3
2
|
import { BigBrainAuth, Context, oneoffContext } from "../bundler/context.js";
|
|
4
3
|
import { logFinishedStep, logMessage, logWarning } from "../bundler/log.js";
|
|
5
4
|
import {
|
|
@@ -21,12 +20,7 @@ import {
|
|
|
21
20
|
teamDashboardUrl,
|
|
22
21
|
} from "./lib/dashboard.js";
|
|
23
22
|
import { promptSearch, promptYesNo } from "./lib/utils/prompts.js";
|
|
24
|
-
import {
|
|
25
|
-
CONVEX_DEPLOY_KEY_ENV_VAR_NAME,
|
|
26
|
-
CONVEX_DEPLOYMENT_TOKEN_ENV_VAR_NAME,
|
|
27
|
-
ENV_VAR_FILE_PATH,
|
|
28
|
-
validateOrSelectTeam,
|
|
29
|
-
} from "./lib/utils/utils.js";
|
|
23
|
+
import { validateOrSelectTeam } from "./lib/utils/utils.js";
|
|
30
24
|
import {
|
|
31
25
|
selectProject,
|
|
32
26
|
updateEnvAndConfigForDeploymentSelection,
|
|
@@ -40,31 +34,24 @@ import {
|
|
|
40
34
|
removeAnonymousPrefix,
|
|
41
35
|
} from "./lib/deployment.js";
|
|
42
36
|
import {
|
|
43
|
-
readGlobalConfig,
|
|
44
37
|
globalConfigPath,
|
|
38
|
+
readGlobalConfig,
|
|
45
39
|
} from "./lib/utils/globalConfig.js";
|
|
46
40
|
import { getTeamsForUser } from "./lib/api.js";
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
if (dotenv.parse(ctx.fs.readUtf8File(file))[envVarName] === value) {
|
|
63
|
-
return file;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
41
|
+
import {
|
|
42
|
+
getProfileSelection,
|
|
43
|
+
initializeDefaultProfile,
|
|
44
|
+
legacyAuthForFirstProfile,
|
|
45
|
+
profileConfigPath,
|
|
46
|
+
readProfileAuth,
|
|
47
|
+
writeProfileCredentials,
|
|
48
|
+
} from "./lib/profiles.js";
|
|
49
|
+
import {
|
|
50
|
+
getDeployKeySource,
|
|
51
|
+
loadProjectEnvironmentVariables,
|
|
52
|
+
} from "./lib/envvars.js";
|
|
53
|
+
import { bindProfileToDirectory } from "./lib/profileManagement.js";
|
|
54
|
+
import { warnIfDeployKeyOverridesLogin } from "./lib/deployKeyWarning.js";
|
|
68
55
|
|
|
69
56
|
/**
|
|
70
57
|
* A project or deployment key in the environment outranks the account token for
|
|
@@ -84,11 +71,7 @@ async function reportDeployKeyInWorkingDirectory(
|
|
|
84
71
|
return;
|
|
85
72
|
}
|
|
86
73
|
const key = auth.kind === "projectKey" ? auth.projectKey : auth.deploymentKey;
|
|
87
|
-
const envVarName =
|
|
88
|
-
? CONVEX_DEPLOY_KEY_ENV_VAR_NAME
|
|
89
|
-
: CONVEX_DEPLOYMENT_TOKEN_ENV_VAR_NAME;
|
|
90
|
-
const envFile = deployKeyEnvFile(ctx, envVarName, key);
|
|
91
|
-
const source = envFile ?? "shell environment";
|
|
74
|
+
const { envVarName, source } = getDeployKeySource(key);
|
|
92
75
|
// Big Brain only strips a `project:`/`team:` prefix itself, so a deployment
|
|
93
76
|
// key authorizes only without its `dev:`/`prod:` prefix. Split on the first
|
|
94
77
|
// `|` like the server does, so a secret containing one survives.
|
|
@@ -100,149 +83,291 @@ async function reportDeployKeyInWorkingDirectory(
|
|
|
100
83
|
logWarning(`Working Directory: Invalid ${envVarName} in ${source}`);
|
|
101
84
|
}
|
|
102
85
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const ctx = await oneoffContext({
|
|
108
|
-
url: undefined,
|
|
109
|
-
adminKey: undefined,
|
|
110
|
-
envFile: undefined,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// `_updateBigBrainAuth` below replaces any deploy key in `ctx` with the
|
|
114
|
-
// account token, so read the deploy key first.
|
|
115
|
-
const auth = ctx.bigBrainAuth();
|
|
116
|
-
|
|
117
|
-
const globalConfig = readGlobalConfig(ctx);
|
|
118
|
-
if (globalConfig === null) {
|
|
119
|
-
logMessage(`No Convex account token found in: ${globalConfigPath()}`);
|
|
120
|
-
logMessage("Status: Not logged in");
|
|
121
|
-
await reportDeployKeyInWorkingDirectory(ctx, auth);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
logMessage(`Convex account token found in: ${globalConfigPath()}`);
|
|
125
|
-
|
|
126
|
-
const accessToken = globalConfig.accessToken;
|
|
127
|
-
if (!(await isAuthorizedHeader(ctx, `Bearer ${accessToken}`))) {
|
|
128
|
-
logMessage("Status: Not logged in");
|
|
129
|
-
await reportDeployKeyInWorkingDirectory(ctx, auth);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
logMessage("Status: Logged in");
|
|
134
|
-
// Describe the account, even if a deploy key outranks it for other commands.
|
|
135
|
-
ctx._updateBigBrainAuth({
|
|
136
|
-
kind: "accessToken",
|
|
137
|
-
header: `Bearer ${accessToken}`,
|
|
138
|
-
accessToken,
|
|
139
|
-
});
|
|
140
|
-
const teams = await getTeamsForUser(ctx);
|
|
141
|
-
logMessage(
|
|
142
|
-
`Teams: ${teams.length} team${teams.length === 1 ? "" : "s"} accessible`,
|
|
143
|
-
);
|
|
144
|
-
for (const team of teams) {
|
|
145
|
-
logMessage(` - ${team.name} (${team.slug})`);
|
|
146
|
-
}
|
|
147
|
-
await reportDeployKeyInWorkingDirectory(ctx, auth);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
export const login = new Command("login")
|
|
151
|
-
.description("Login to Convex")
|
|
152
|
-
.allowExcessArguments(false)
|
|
153
|
-
.option(
|
|
154
|
-
"--device-name <name>",
|
|
155
|
-
"Provide a name for the device being authorized",
|
|
156
|
-
)
|
|
157
|
-
.option(
|
|
158
|
-
"-f, --force",
|
|
159
|
-
"Proceed with login even if a valid access token already exists for this device",
|
|
160
|
-
)
|
|
161
|
-
.option(
|
|
162
|
-
"--no-open",
|
|
163
|
-
"Don't automatically open the login link in the default browser",
|
|
164
|
-
)
|
|
165
|
-
.addOption(
|
|
166
|
-
new Option(
|
|
167
|
-
"--login-flow <mode>",
|
|
168
|
-
`How to log in; defaults to guessing based on the environment.`,
|
|
86
|
+
function createLoginStatusCommand() {
|
|
87
|
+
return new Command("status")
|
|
88
|
+
.description(
|
|
89
|
+
"Check login status and list accessible teams. Exits with code 1 when not logged in.",
|
|
169
90
|
)
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
.addOption(new Option("--override-auth-url <url>").hideHelp())
|
|
177
|
-
.addOption(new Option("--override-auth-client <id>").hideHelp())
|
|
178
|
-
.addOption(new Option("--override-auth-username <username>").hideHelp())
|
|
179
|
-
.addOption(new Option("--override-auth-password <password>").hideHelp())
|
|
180
|
-
// Skip the auth provider login and directly use this access token
|
|
181
|
-
.addOption(new Option("--override-access-token <token>").hideHelp())
|
|
182
|
-
// Automatically accept opt ins without prompting
|
|
183
|
-
.addOption(new Option("--accept-opt-ins").hideHelp())
|
|
184
|
-
// Dump the access token from the auth provider and skip authorization with Convex
|
|
185
|
-
.addOption(new Option("--dump-access-token").hideHelp())
|
|
186
|
-
// Hidden option for tests to check if the user is logged in.
|
|
187
|
-
.addOption(new Option("--check-login").hideHelp())
|
|
188
|
-
// Redirect to Vercel SSO integration URL
|
|
189
|
-
.addOption(
|
|
190
|
-
new Option(
|
|
191
|
-
"--vercel",
|
|
192
|
-
"Redirect to Vercel SSO integration for login",
|
|
193
|
-
).hideHelp(),
|
|
194
|
-
)
|
|
195
|
-
// Override the Vercel URL slug (defaults to 'convex')
|
|
196
|
-
.addOption(new Option("--vercel-override <slug>").hideHelp())
|
|
197
|
-
.addCommand(loginStatus)
|
|
198
|
-
.addHelpCommand(false)
|
|
199
|
-
.action(async (options, cmd: Command) => {
|
|
200
|
-
const ctx = await oneoffContext({
|
|
201
|
-
url: undefined,
|
|
202
|
-
adminKey: undefined,
|
|
203
|
-
envFile: undefined,
|
|
204
|
-
});
|
|
205
|
-
if (
|
|
206
|
-
!options.force &&
|
|
207
|
-
(await checkAuthorization(ctx, !!options.acceptOptIns))
|
|
208
|
-
) {
|
|
209
|
-
logFinishedStep(
|
|
210
|
-
"This device has previously been authorized and is ready for use with Convex.",
|
|
211
|
-
);
|
|
212
|
-
await handleLinkingDeployments(ctx, {
|
|
213
|
-
interactive: !!options.linkDeployments,
|
|
91
|
+
.allowExcessArguments(false)
|
|
92
|
+
.action(async () => {
|
|
93
|
+
const ctx = await oneoffContext({
|
|
94
|
+
url: undefined,
|
|
95
|
+
adminKey: undefined,
|
|
96
|
+
envFile: undefined,
|
|
214
97
|
});
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
98
|
+
|
|
99
|
+
// Keep the directory's deploy key for separate reporting after selecting
|
|
100
|
+
// the account whose teams will be listed.
|
|
101
|
+
const auth = ctx.bigBrainAuth();
|
|
102
|
+
let accountAuth = auth?.kind === "accessToken" ? auth : null;
|
|
103
|
+
if (accountAuth === null) {
|
|
104
|
+
const profile = await getProfileSelection(ctx);
|
|
105
|
+
if (profile !== null) {
|
|
106
|
+
accountAuth = await readProfileAuth(ctx, profile);
|
|
107
|
+
} else {
|
|
108
|
+
const globalConfig = readGlobalConfig(ctx);
|
|
109
|
+
if (globalConfig !== null) {
|
|
110
|
+
accountAuth = {
|
|
111
|
+
kind: "accessToken",
|
|
112
|
+
accessToken: globalConfig.accessToken,
|
|
113
|
+
header: `Bearer ${globalConfig.accessToken}`,
|
|
114
|
+
profile: null,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (accountAuth === null) {
|
|
120
|
+
logMessage(`No Convex account token found in: ${globalConfigPath()}`);
|
|
121
|
+
logMessage("Status: Not logged in");
|
|
122
|
+
await reportDeployKeyInWorkingDirectory(ctx, auth);
|
|
123
|
+
return await ctx.crash({
|
|
221
124
|
exitCode: 1,
|
|
222
125
|
errorType: "fatal",
|
|
223
|
-
|
|
224
|
-
printedMessage: "You are not logged in.",
|
|
126
|
+
printedMessage: null,
|
|
225
127
|
});
|
|
226
128
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
129
|
+
warnIfDeployKeyOverridesLogin(ctx, true);
|
|
130
|
+
if (accountAuth.profile) {
|
|
131
|
+
logMessage(`Account: ${accountAuth.profile.name}`);
|
|
132
|
+
logMessage(`Selected by: ${accountAuth.profile.source}`);
|
|
133
|
+
logMessage(
|
|
134
|
+
`Convex account token found in: ${profileConfigPath(accountAuth.profile.name)}`,
|
|
135
|
+
);
|
|
136
|
+
} else if (process.env.CONVEX_OVERRIDE_ACCESS_TOKEN) {
|
|
137
|
+
logMessage("Using CONVEX_OVERRIDE_ACCESS_TOKEN from the environment");
|
|
138
|
+
} else {
|
|
139
|
+
logMessage(`Convex account token found in: ${globalConfigPath()}`);
|
|
140
|
+
}
|
|
233
141
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
142
|
+
if (!(await isAuthorizedHeader(ctx, accountAuth.header))) {
|
|
143
|
+
logMessage("Status: Not logged in");
|
|
144
|
+
await reportDeployKeyInWorkingDirectory(ctx, auth);
|
|
145
|
+
return await ctx.crash({
|
|
146
|
+
exitCode: 1,
|
|
147
|
+
errorType: "fatal",
|
|
148
|
+
printedMessage: null,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
241
151
|
|
|
242
|
-
|
|
243
|
-
|
|
152
|
+
logMessage("Status: Logged in");
|
|
153
|
+
ctx._updateBigBrainAuth(accountAuth);
|
|
154
|
+
const teams = await getTeamsForUser(ctx);
|
|
155
|
+
logMessage(
|
|
156
|
+
`Teams: ${teams.length} team${teams.length === 1 ? "" : "s"} accessible`,
|
|
157
|
+
);
|
|
158
|
+
for (const team of teams) {
|
|
159
|
+
logMessage(` - ${team.name} (${team.slug})`);
|
|
160
|
+
}
|
|
161
|
+
await reportDeployKeyInWorkingDirectory(ctx, auth);
|
|
244
162
|
});
|
|
245
|
-
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function createLoginCommand() {
|
|
166
|
+
return (
|
|
167
|
+
new Command("login")
|
|
168
|
+
.description("Login to Convex")
|
|
169
|
+
.allowExcessArguments(false)
|
|
170
|
+
.option("--account <name>", "Log in to a named account")
|
|
171
|
+
.option(
|
|
172
|
+
"--select",
|
|
173
|
+
"Select this account for this directory and its subdirectories",
|
|
174
|
+
)
|
|
175
|
+
.option(
|
|
176
|
+
"--device-name <name>",
|
|
177
|
+
"Provide a name for the device being authorized",
|
|
178
|
+
)
|
|
179
|
+
.option(
|
|
180
|
+
"-f, --force",
|
|
181
|
+
"Proceed with login even if a valid access token already exists for this device",
|
|
182
|
+
)
|
|
183
|
+
.option(
|
|
184
|
+
"--no-open",
|
|
185
|
+
"Don't automatically open the login link in the default browser",
|
|
186
|
+
)
|
|
187
|
+
.addOption(
|
|
188
|
+
new Option(
|
|
189
|
+
"--login-flow <mode>",
|
|
190
|
+
`How to log in; defaults to guessing based on the environment.`,
|
|
191
|
+
)
|
|
192
|
+
.choices(["paste", "auto", "poll"] as const)
|
|
193
|
+
.default("auto" as const),
|
|
194
|
+
)
|
|
195
|
+
.addOption(new Option("--link-deployments").hideHelp())
|
|
196
|
+
// These options are hidden from the help/usage message, but allow overriding settings for testing.
|
|
197
|
+
// Change the auth credentials with the auth provider
|
|
198
|
+
.addOption(new Option("--override-auth-url <url>").hideHelp())
|
|
199
|
+
.addOption(new Option("--override-auth-client <id>").hideHelp())
|
|
200
|
+
.addOption(new Option("--override-auth-username <username>").hideHelp())
|
|
201
|
+
.addOption(new Option("--override-auth-password <password>").hideHelp())
|
|
202
|
+
// Skip the auth provider login and directly use this access token
|
|
203
|
+
.addOption(new Option("--override-access-token <token>").hideHelp())
|
|
204
|
+
// Automatically accept opt ins without prompting
|
|
205
|
+
.addOption(new Option("--accept-opt-ins").hideHelp())
|
|
206
|
+
// Dump the access token from the auth provider and skip authorization with Convex
|
|
207
|
+
.addOption(new Option("--dump-access-token").hideHelp())
|
|
208
|
+
// Hidden option for tests to check if the user is logged in.
|
|
209
|
+
.addOption(new Option("--check-login").hideHelp())
|
|
210
|
+
// Redirect to Vercel SSO integration URL
|
|
211
|
+
.addOption(
|
|
212
|
+
new Option(
|
|
213
|
+
"--vercel",
|
|
214
|
+
"Redirect to Vercel SSO integration for login",
|
|
215
|
+
).hideHelp(),
|
|
216
|
+
)
|
|
217
|
+
// Override the Vercel URL slug (defaults to 'convex')
|
|
218
|
+
.addOption(new Option("--vercel-override <slug>").hideHelp())
|
|
219
|
+
.addCommand(createLoginStatusCommand())
|
|
220
|
+
.addHelpCommand(false)
|
|
221
|
+
.action(async (options, cmd: Command) => {
|
|
222
|
+
const ctx = await oneoffContext({
|
|
223
|
+
url: undefined,
|
|
224
|
+
adminKey: undefined,
|
|
225
|
+
envFile: undefined,
|
|
226
|
+
skipAuth: true,
|
|
227
|
+
});
|
|
228
|
+
const profile = await getProfileSelection(ctx, {
|
|
229
|
+
name: options.account,
|
|
230
|
+
});
|
|
231
|
+
if (options.select && profile === null) {
|
|
232
|
+
cmd.error("Pass --account <name> with --select to name this login.");
|
|
233
|
+
}
|
|
234
|
+
loadProjectEnvironmentVariables();
|
|
235
|
+
let namingLegacyAccount = false;
|
|
236
|
+
if (profile !== null) {
|
|
237
|
+
let auth = options.force
|
|
238
|
+
? null
|
|
239
|
+
: await readProfileAuth(ctx, profile, true);
|
|
240
|
+
if (
|
|
241
|
+
auth === null &&
|
|
242
|
+
!options.force &&
|
|
243
|
+
!options.overrideAccessToken &&
|
|
244
|
+
!options.overrideAuthUsername &&
|
|
245
|
+
!process.env.CONVEX_OVERRIDE_ACCESS_TOKEN
|
|
246
|
+
) {
|
|
247
|
+
auth = await legacyAuthForFirstProfile(ctx, profile);
|
|
248
|
+
namingLegacyAccount = auth !== null;
|
|
249
|
+
}
|
|
250
|
+
ctx._updateBigBrainAuth(auth);
|
|
251
|
+
} else {
|
|
252
|
+
const accessToken =
|
|
253
|
+
process.env.CONVEX_OVERRIDE_ACCESS_TOKEN ||
|
|
254
|
+
readGlobalConfig(ctx)?.accessToken;
|
|
255
|
+
ctx._updateBigBrainAuth(
|
|
256
|
+
accessToken
|
|
257
|
+
? {
|
|
258
|
+
kind: "accessToken",
|
|
259
|
+
accessToken,
|
|
260
|
+
header: `Bearer ${accessToken}`,
|
|
261
|
+
profile: null,
|
|
262
|
+
}
|
|
263
|
+
: null,
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
warnIfDeployKeyOverridesLogin(ctx, ctx.bigBrainAuth() !== null);
|
|
267
|
+
if (
|
|
268
|
+
!options.force &&
|
|
269
|
+
(await checkAuthorization(ctx, !!options.acceptOptIns))
|
|
270
|
+
) {
|
|
271
|
+
const auth = ctx.bigBrainAuth();
|
|
272
|
+
if (
|
|
273
|
+
namingLegacyAccount &&
|
|
274
|
+
profile !== null &&
|
|
275
|
+
auth?.kind === "accessToken"
|
|
276
|
+
) {
|
|
277
|
+
await writeProfileCredentials(
|
|
278
|
+
ctx,
|
|
279
|
+
profile.name,
|
|
280
|
+
auth.accessToken,
|
|
281
|
+
{},
|
|
282
|
+
null,
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
logFinishedStep(
|
|
286
|
+
profile !== null
|
|
287
|
+
? namingLegacyAccount
|
|
288
|
+
? `Saved account "${profile.name}" using your existing login.`
|
|
289
|
+
: `Account "${profile.name}" is already logged in.`
|
|
290
|
+
: "This device has previously been authorized and is ready for use with Convex.",
|
|
291
|
+
);
|
|
292
|
+
if (profile !== null && auth?.kind === "accessToken") {
|
|
293
|
+
await initializeDefaultProfile(
|
|
294
|
+
ctx,
|
|
295
|
+
profile,
|
|
296
|
+
namingLegacyAccount,
|
|
297
|
+
!!options.select,
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
if (options.select && profile !== null) {
|
|
301
|
+
if (!(await bindProfileToDirectory(ctx, profile.name))) {
|
|
302
|
+
return await ctx.crash({
|
|
303
|
+
exitCode: 1,
|
|
304
|
+
errorType: "fatal",
|
|
305
|
+
printedMessage: `Logged in as "${profile.name}", but the directory selection could not be changed.`,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
await handleLinkingDeployments(ctx, {
|
|
310
|
+
interactive: !!options.linkDeployments,
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (!options.force && options.checkLogin) {
|
|
315
|
+
const isLoggedIn = await checkAuthorization(
|
|
316
|
+
ctx,
|
|
317
|
+
!!options.acceptOptIns,
|
|
318
|
+
);
|
|
319
|
+
if (!isLoggedIn) {
|
|
320
|
+
return ctx.crash({
|
|
321
|
+
exitCode: 1,
|
|
322
|
+
errorType: "fatal",
|
|
323
|
+
errForSentry: "You are not logged in.",
|
|
324
|
+
printedMessage: "You are not logged in.",
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
if (!!options.overrideAuthUsername !== !!options.overrideAuthPassword) {
|
|
329
|
+
cmd.error(
|
|
330
|
+
"If overriding credentials, both username and password must be provided",
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
const uuid = loadUuidForAnonymousUser(ctx);
|
|
335
|
+
await performLogin(ctx, {
|
|
336
|
+
...options,
|
|
337
|
+
profile,
|
|
338
|
+
anonymousId: uuid,
|
|
339
|
+
vercel: options.vercel,
|
|
340
|
+
vercelOverride: options.vercelOverride,
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
const auth = ctx.bigBrainAuth();
|
|
344
|
+
if (profile !== null && auth?.kind === "accessToken") {
|
|
345
|
+
await initializeDefaultProfile(
|
|
346
|
+
ctx,
|
|
347
|
+
profile,
|
|
348
|
+
namingLegacyAccount,
|
|
349
|
+
!!options.select,
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
if (options.select && profile !== null) {
|
|
353
|
+
if (!(await bindProfileToDirectory(ctx, profile.name))) {
|
|
354
|
+
return await ctx.crash({
|
|
355
|
+
exitCode: 1,
|
|
356
|
+
errorType: "fatal",
|
|
357
|
+
printedMessage: `Logged in as "${profile.name}", but the directory selection could not be changed.`,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
warnIfDeployKeyOverridesLogin(ctx, true);
|
|
362
|
+
|
|
363
|
+
await handleLinkingDeployments(ctx, {
|
|
364
|
+
interactive: !!options.linkDeployments,
|
|
365
|
+
});
|
|
366
|
+
})
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
export const login = createLoginCommand();
|
|
246
371
|
|
|
247
372
|
async function handleLinkingDeployments(
|
|
248
373
|
ctx: Context,
|