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
|
@@ -11,9 +11,12 @@ import { formatIndex } from "./indexes.js";
|
|
|
11
11
|
import { promptYesNo } from "./utils/prompts.js";
|
|
12
12
|
import { Span } from "./tracing.js";
|
|
13
13
|
import { StartPushRequest } from "./deployApi/startPush.js";
|
|
14
|
-
import { evaluatePush
|
|
14
|
+
import { evaluatePush } from "./deploy2.js";
|
|
15
15
|
import { DeveloperIndexConfig } from "./deployApi/finishPush.js";
|
|
16
|
+
import { EvaluateSchemaResponse } from "./deployApi/evaluateSchema.js";
|
|
16
17
|
import { runSystemQuery } from "./run.js";
|
|
18
|
+
import { SchemaEvaluation } from "./schemaEvaluation.js";
|
|
19
|
+
import { integerFromEnv } from "./utils/utils.js";
|
|
17
20
|
|
|
18
21
|
const MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING = 100_000;
|
|
19
22
|
|
|
@@ -37,24 +40,35 @@ export async function checkForLargeIndexDeletion({
|
|
|
37
40
|
span,
|
|
38
41
|
request,
|
|
39
42
|
options,
|
|
43
|
+
schemaEvaluation,
|
|
40
44
|
askForConfirmation,
|
|
41
45
|
}: {
|
|
42
46
|
ctx: Context;
|
|
43
47
|
span: Span;
|
|
44
48
|
request: StartPushRequest;
|
|
45
49
|
options: CheckOptions;
|
|
50
|
+
schemaEvaluation: SchemaEvaluation;
|
|
46
51
|
askForConfirmation: boolean;
|
|
47
52
|
}): Promise<void> {
|
|
48
53
|
changeSpinner("Verifying that the push isn’t deleting large indexes...");
|
|
49
54
|
|
|
50
|
-
const
|
|
51
|
-
|
|
55
|
+
const schemaEvaluationResponse = await schemaEvaluation(span);
|
|
56
|
+
let deletedIndexes: DeletedIndex[];
|
|
57
|
+
if (schemaEvaluationResponse !== null) {
|
|
58
|
+
deletedIndexes = deletedIndexesFromSchemaEvaluation(
|
|
59
|
+
schemaEvaluationResponse,
|
|
60
|
+
);
|
|
61
|
+
} else {
|
|
62
|
+
logVerbose(
|
|
63
|
+
"Schema evaluation unavailable, sizing deleted indexes per table",
|
|
64
|
+
);
|
|
65
|
+
deletedIndexes = await deletedIndexesFromTableSizes({
|
|
52
66
|
ctx,
|
|
53
67
|
span,
|
|
54
68
|
request,
|
|
55
69
|
options,
|
|
56
|
-
})
|
|
57
|
-
|
|
70
|
+
});
|
|
71
|
+
}
|
|
58
72
|
|
|
59
73
|
if (deletedIndexes.length === 0) {
|
|
60
74
|
logFinishedStep("No indexes are deleted by this push");
|
|
@@ -84,9 +98,11 @@ The documents that are in the index won’t be deleted, but the index will need
|
|
|
84
98
|
to be backfilled again if you want to restore it later.
|
|
85
99
|
`);
|
|
86
100
|
|
|
101
|
+
// Either --skip-large-indexes-check or its deletion-only predecessor
|
|
102
|
+
// --allow-deleting-large-indexes gets here, so name neither.
|
|
87
103
|
if (!askForConfirmation) {
|
|
88
104
|
logFinishedStep(
|
|
89
|
-
"Proceeding with push since
|
|
105
|
+
"Proceeding with push since deleting large indexes was allowed by flag",
|
|
90
106
|
);
|
|
91
107
|
return;
|
|
92
108
|
}
|
|
@@ -97,7 +113,7 @@ to be backfilled again if you want to restore it later.
|
|
|
97
113
|
errorType: "fatal",
|
|
98
114
|
printedMessage: `To confirm the push:
|
|
99
115
|
• run the deploy command in an ${chalkStderr.bold("interactive terminal")}
|
|
100
|
-
• or run the deploy command with the ${chalkStderr.bold("--
|
|
116
|
+
• or run the deploy command with the ${chalkStderr.bold("--skip-large-indexes-check")} flag`,
|
|
101
117
|
});
|
|
102
118
|
}
|
|
103
119
|
|
|
@@ -120,49 +136,24 @@ to be backfilled again if you want to restore it later.
|
|
|
120
136
|
|
|
121
137
|
// Preferred source: one schema evaluation reports every dropped index
|
|
122
138
|
// together with its table's document count, requiring only the
|
|
123
|
-
// `deployment:deploy` permission the push itself needs.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
request,
|
|
142
|
-
options,
|
|
143
|
-
/* bestEffort */ true,
|
|
144
|
-
);
|
|
145
|
-
return Object.entries(response.componentSchemaEvaluations).flatMap(
|
|
146
|
-
([componentPath, prediction]) =>
|
|
147
|
-
prediction.indexes
|
|
148
|
-
.filter((index) => index.change === "dropped")
|
|
149
|
-
.map((index) => ({
|
|
150
|
-
componentPath,
|
|
151
|
-
index,
|
|
152
|
-
documentsCount: index.numDocs,
|
|
153
|
-
replacedBy:
|
|
154
|
-
prediction.indexes.find(
|
|
155
|
-
(other) =>
|
|
156
|
-
other.change === "added" && other.name === index.name,
|
|
157
|
-
) ?? null,
|
|
158
|
-
})),
|
|
159
|
-
);
|
|
160
|
-
} catch (error: unknown) {
|
|
161
|
-
logVerbose(
|
|
162
|
-
`Schema evaluation unavailable, sizing deleted indexes per table: ${error instanceof Error ? error.message : String(error)}`,
|
|
163
|
-
);
|
|
164
|
-
return null;
|
|
165
|
-
}
|
|
139
|
+
// `deployment:deploy` permission the push itself needs.
|
|
140
|
+
export function deletedIndexesFromSchemaEvaluation(
|
|
141
|
+
response: EvaluateSchemaResponse,
|
|
142
|
+
): DeletedIndex[] {
|
|
143
|
+
return Object.entries(response.componentSchemaEvaluations).flatMap(
|
|
144
|
+
([componentPath, prediction]) =>
|
|
145
|
+
prediction.indexes
|
|
146
|
+
.filter((index) => index.change === "dropped")
|
|
147
|
+
.map((index) => ({
|
|
148
|
+
componentPath,
|
|
149
|
+
index,
|
|
150
|
+
documentsCount: index.numDocs,
|
|
151
|
+
replacedBy:
|
|
152
|
+
prediction.indexes.find(
|
|
153
|
+
(other) => other.change === "added" && other.name === index.name,
|
|
154
|
+
) ?? null,
|
|
155
|
+
})),
|
|
156
|
+
);
|
|
166
157
|
}
|
|
167
158
|
|
|
168
159
|
// Fallback for deployments without `evaluate_schema`: diff indexes with
|
|
@@ -268,12 +259,8 @@ function getTableName(index: DeveloperIndexConfig) {
|
|
|
268
259
|
}
|
|
269
260
|
|
|
270
261
|
function minDocumentsForIndexDeleteWarning(): number {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
return parsed;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING;
|
|
262
|
+
return integerFromEnv(
|
|
263
|
+
"CONVEX_MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING",
|
|
264
|
+
MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING,
|
|
265
|
+
);
|
|
279
266
|
}
|
|
@@ -1,41 +1,36 @@
|
|
|
1
1
|
import { chalkStderr } from "chalk";
|
|
2
|
-
import {
|
|
3
|
-
import { logMessage, logVerbose } from "../../bundler/log.js";
|
|
2
|
+
import { logMessage } from "../../bundler/log.js";
|
|
4
3
|
import { Span } from "./tracing.js";
|
|
5
|
-
import { StartPushRequest } from "./deployApi/startPush.js";
|
|
6
4
|
import {
|
|
7
5
|
EvaluateSchemaResponse,
|
|
8
6
|
TablePrediction,
|
|
9
7
|
} from "./deployApi/evaluateSchema.js";
|
|
10
|
-
import {
|
|
11
|
-
import { formatSize } from "./utils/utils.js";
|
|
8
|
+
import { SchemaEvaluation } from "./schemaEvaluation.js";
|
|
9
|
+
import { formatSize, integerFromEnv } from "./utils/utils.js";
|
|
10
|
+
import {
|
|
11
|
+
formatDiscardedStagedValidator,
|
|
12
|
+
formatValidationProgress,
|
|
13
|
+
} from "./formatValidationProgress.js";
|
|
12
14
|
|
|
13
15
|
const MIN_BYTES_FOR_SCHEMA_WALK_WARNING = 1 << 27; // 128 MiB
|
|
14
16
|
|
|
15
17
|
export async function checkForSlowSchemaValidation({
|
|
16
|
-
ctx,
|
|
17
18
|
span,
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
schemaEvaluation,
|
|
20
|
+
dryRun,
|
|
20
21
|
}: {
|
|
21
|
-
ctx: Context;
|
|
22
22
|
span: Span;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
url: string;
|
|
26
|
-
deploymentName: string | null;
|
|
27
|
-
adminKey: string;
|
|
28
|
-
};
|
|
23
|
+
schemaEvaluation: SchemaEvaluation;
|
|
24
|
+
dryRun: boolean;
|
|
29
25
|
}): Promise<void> {
|
|
30
|
-
const response = await
|
|
31
|
-
ctx,
|
|
32
|
-
span,
|
|
33
|
-
request,
|
|
34
|
-
options,
|
|
35
|
-
});
|
|
26
|
+
const response = await schemaEvaluation(span);
|
|
36
27
|
if (response === null) {
|
|
37
28
|
return;
|
|
38
29
|
}
|
|
30
|
+
reportStagedValidators(response);
|
|
31
|
+
if (!dryRun) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
39
34
|
|
|
40
35
|
const walkedTables = Object.entries(
|
|
41
36
|
response.componentSchemaEvaluations,
|
|
@@ -56,6 +51,9 @@ export async function checkForSlowSchemaValidation({
|
|
|
56
51
|
return;
|
|
57
52
|
}
|
|
58
53
|
|
|
54
|
+
const shouldSuggestStaging = walkedTables.some(
|
|
55
|
+
({ table }) => !table.canSkipAfterStagedValidation,
|
|
56
|
+
);
|
|
59
57
|
logMessage(`⚠️ This schema change requires checking every document in the following ${walkedTables.length === 1 ? "table" : "tables"} against your new schema, totaling ${chalkStderr.yellowBright(formatSize(totalBytes))}. This deploy may take a while:
|
|
60
58
|
|
|
61
59
|
${walkedTables
|
|
@@ -63,45 +61,58 @@ ${walkedTables
|
|
|
63
61
|
formatWalkedTable({ componentPath, table }),
|
|
64
62
|
)
|
|
65
63
|
.join("\n")}
|
|
66
|
-
|
|
64
|
+
${
|
|
65
|
+
shouldSuggestStaging
|
|
66
|
+
? `\nTip: stage the new validator (\`defineTable({...}).staged({...})\`) to validate it in the background without blocking deploys.`
|
|
67
|
+
: ""
|
|
68
|
+
}`);
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
request,
|
|
80
|
-
options,
|
|
81
|
-
}: {
|
|
82
|
-
ctx: Context;
|
|
83
|
-
span: Span;
|
|
84
|
-
request: StartPushRequest;
|
|
85
|
-
options: {
|
|
86
|
-
url: string;
|
|
87
|
-
deploymentName: string | null;
|
|
88
|
-
adminKey: string;
|
|
89
|
-
};
|
|
90
|
-
}): Promise<EvaluateSchemaResponse | null> {
|
|
91
|
-
try {
|
|
92
|
-
return await evaluateSchema(
|
|
93
|
-
ctx,
|
|
94
|
-
span,
|
|
95
|
-
request,
|
|
96
|
-
options,
|
|
97
|
-
/* bestEffort */ true,
|
|
98
|
-
);
|
|
99
|
-
} catch (error: unknown) {
|
|
100
|
-
logVerbose(
|
|
101
|
-
`Skipping slow schema validation check: ${error instanceof Error ? error.message : String(error)}`,
|
|
71
|
+
// The prediction includes staged validators from active and in-flight schemas.
|
|
72
|
+
function reportStagedValidators(response: EvaluateSchemaResponse) {
|
|
73
|
+
const stagedTables = Object.entries(
|
|
74
|
+
response.componentSchemaEvaluations,
|
|
75
|
+
).flatMap(([componentPath, prediction]) => {
|
|
76
|
+
const discarded = new Map(
|
|
77
|
+
(prediction.discardedStagedValidators ?? []).map((validator) => [
|
|
78
|
+
validator.tableName,
|
|
79
|
+
validator,
|
|
80
|
+
]),
|
|
102
81
|
);
|
|
103
|
-
return
|
|
82
|
+
return prediction.tables
|
|
83
|
+
.filter((table) => table.staged !== undefined)
|
|
84
|
+
.map((table) => ({
|
|
85
|
+
componentPath,
|
|
86
|
+
table,
|
|
87
|
+
discarded: discarded.get(table.name),
|
|
88
|
+
}));
|
|
89
|
+
});
|
|
90
|
+
if (stagedTables.length === 0) {
|
|
91
|
+
return;
|
|
104
92
|
}
|
|
93
|
+
const lines = stagedTables.map(({ componentPath, table, discarded }) => {
|
|
94
|
+
const componentPrefix =
|
|
95
|
+
componentPath !== "" ? `${chalkStderr.gray(componentPath)}: ` : "";
|
|
96
|
+
// The state describes the validator this push discards, so advertising
|
|
97
|
+
// it as ready to promote would contradict the unstaging warning.
|
|
98
|
+
if (discarded !== undefined) {
|
|
99
|
+
return ` ${componentPrefix}${table.name}: ${formatDiscardedStagedValidator(discarded)}`;
|
|
100
|
+
}
|
|
101
|
+
const staged = table.staged!;
|
|
102
|
+
switch (staged.state) {
|
|
103
|
+
case "pending": {
|
|
104
|
+
return ` ${componentPrefix}${table.name}: validating in the background (${formatValidationProgress(staged)})`;
|
|
105
|
+
}
|
|
106
|
+
case "valid":
|
|
107
|
+
// `supersetOfStagedValidated` means this push already promotes it.
|
|
108
|
+
return table.outcome === "supersetOfStagedValidated"
|
|
109
|
+
? ` ${componentPrefix}${table.name}: ${chalkStderr.green("validated")}. This deploy applies the staged schema without scanning the table.`
|
|
110
|
+
: ` ${componentPrefix}${table.name}: ${chalkStderr.green("validated")}. Safe to apply the staged schema changes and deploy.`;
|
|
111
|
+
case "failed":
|
|
112
|
+
return ` ${componentPrefix}${table.name}: ${chalkStderr.red("failed")}: ${staged.error}${chalkStderr.gray(" (fix the offending documents and redeploy to revalidate)")}`;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
logMessage(`Staged schema validation status:\n${lines.join("\n")}\n`);
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
function formatWalkedTable({
|
|
@@ -115,16 +126,16 @@ function formatWalkedTable({
|
|
|
115
126
|
componentPath !== "" ? `${chalkStderr.gray(componentPath)}: ` : "";
|
|
116
127
|
const docsFormatted = `${table.numDocs.toLocaleString()} documents, `;
|
|
117
128
|
const sizeFormatted = formatSize(table.sizeBytes);
|
|
118
|
-
|
|
129
|
+
let stagedNote = "";
|
|
130
|
+
if (table.staged?.state === "pending" && table.canSkipAfterStagedValidation) {
|
|
131
|
+
stagedNote = `. Staged schema validation in progress. Wait for validation to complete before deploying with the staged changes. Deploying now will block on a full table revalidation scan.`;
|
|
132
|
+
}
|
|
133
|
+
return ` ${componentPrefix}${table.name} (${docsFormatted}${sizeFormatted})${stagedNote}`;
|
|
119
134
|
}
|
|
120
135
|
|
|
121
136
|
function minBytesForSchemaWalkWarning(): number {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return parsed;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return MIN_BYTES_FOR_SCHEMA_WALK_WARNING;
|
|
137
|
+
return integerFromEnv(
|
|
138
|
+
"CONVEX_MIN_BYTES_FOR_SCHEMA_WALK_WARNING",
|
|
139
|
+
MIN_BYTES_FOR_SCHEMA_WALK_WARNING,
|
|
140
|
+
);
|
|
130
141
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { chalkStderr } from "chalk";
|
|
2
|
+
import { Context } from "../../bundler/context.js";
|
|
3
|
+
import { logFinishedStep, logMessage, stopSpinner } from "../../bundler/log.js";
|
|
4
|
+
import { promptYesNo } from "./utils/prompts.js";
|
|
5
|
+
import {
|
|
6
|
+
DiscardedStagedValidator,
|
|
7
|
+
EvaluateSchemaResponse,
|
|
8
|
+
} from "./deployApi/evaluateSchema.js";
|
|
9
|
+
import { formatDiscardedStagedValidator } from "./formatValidationProgress.js";
|
|
10
|
+
|
|
11
|
+
export type StagedValidatorDeletionCheck =
|
|
12
|
+
| "ask for confirmation"
|
|
13
|
+
| "has confirmation"
|
|
14
|
+
| "no verification";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Confirm before discarding pending or successful staged validation. Unstaging
|
|
18
|
+
* stops write-time checks, so restaging requires a fresh scan.
|
|
19
|
+
*
|
|
20
|
+
* A dry run only reports what the push would discard, so `--dry-run` previews
|
|
21
|
+
* the confirmation the real push will ask for.
|
|
22
|
+
*/
|
|
23
|
+
export async function checkForStagedValidatorDeletion({
|
|
24
|
+
ctx,
|
|
25
|
+
response,
|
|
26
|
+
askForConfirmation,
|
|
27
|
+
dryRun = false,
|
|
28
|
+
}: {
|
|
29
|
+
ctx: Context;
|
|
30
|
+
response: EvaluateSchemaResponse | null;
|
|
31
|
+
askForConfirmation: boolean;
|
|
32
|
+
dryRun?: boolean;
|
|
33
|
+
}): Promise<void> {
|
|
34
|
+
// `sharedSchemaEvaluation` has already logged why evaluation failed.
|
|
35
|
+
if (response === null) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const discarded = Object.entries(response.componentSchemaEvaluations).flatMap(
|
|
39
|
+
([componentPath, prediction]) =>
|
|
40
|
+
(prediction.discardedStagedValidators ?? []).map((validator) => ({
|
|
41
|
+
componentPath,
|
|
42
|
+
validator,
|
|
43
|
+
})),
|
|
44
|
+
);
|
|
45
|
+
if (discarded.length === 0) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
logMessage(`\u26a0\ufe0f This push ${chalkStderr.bold(dryRun ? "would discard" : "discards")} staged schema validation for the following ${discarded.length === 1 ? "table" : "tables"}:
|
|
50
|
+
|
|
51
|
+
${discarded.map(formatDiscarded).join("\n")}
|
|
52
|
+
|
|
53
|
+
A discarded staged validator restarts validation from zero if staged again.
|
|
54
|
+
`);
|
|
55
|
+
|
|
56
|
+
if (dryRun) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!askForConfirmation) {
|
|
61
|
+
logFinishedStep(
|
|
62
|
+
"Proceeding with push since --allow-unstaging-schema is set",
|
|
63
|
+
);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!process.stdin.isTTY) {
|
|
68
|
+
return ctx.crash({
|
|
69
|
+
exitCode: 1,
|
|
70
|
+
errorType: "fatal",
|
|
71
|
+
printedMessage: `To confirm the push:
|
|
72
|
+
\u2022 run the deploy command in an ${chalkStderr.bold("interactive terminal")}
|
|
73
|
+
\u2022 or run the deploy command with the ${chalkStderr.bold("--allow-unstaging-schema")} flag`,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
stopSpinner();
|
|
78
|
+
if (
|
|
79
|
+
!(await promptYesNo(ctx, {
|
|
80
|
+
message: `Discard staged validation for ${discarded.length === 1 ? "this table" : "these tables"}?`,
|
|
81
|
+
default: false,
|
|
82
|
+
}))
|
|
83
|
+
) {
|
|
84
|
+
return ctx.crash({
|
|
85
|
+
exitCode: 1,
|
|
86
|
+
errorType: "fatal",
|
|
87
|
+
printedMessage: `Canceling push`,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
logFinishedStep("Proceeding with push.");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function formatDiscarded({
|
|
95
|
+
componentPath,
|
|
96
|
+
validator,
|
|
97
|
+
}: {
|
|
98
|
+
componentPath: string;
|
|
99
|
+
validator: DiscardedStagedValidator;
|
|
100
|
+
}): string {
|
|
101
|
+
const componentPrefix =
|
|
102
|
+
componentPath !== "" ? `${chalkStderr.gray(componentPath)}:` : "";
|
|
103
|
+
return `\u26d4 ${componentPrefix}${validator.tableName}: ${formatDiscardedStagedValidator(validator)}`;
|
|
104
|
+
}
|
package/src/cli/lib/codegen.ts
CHANGED
|
@@ -46,7 +46,6 @@ import {
|
|
|
46
46
|
rootComponentApiCJS,
|
|
47
47
|
} from "../codegen_templates/component_api.js";
|
|
48
48
|
import { functionsDir } from "./utils/utils.js";
|
|
49
|
-
import { LargeIndexDeletionCheck } from "./indexes.js";
|
|
50
49
|
|
|
51
50
|
const PRESERVED_GENERATED_ENTRIES = new Set(["ai"]);
|
|
52
51
|
|
|
@@ -81,8 +80,6 @@ export type CodegenOptions = {
|
|
|
81
80
|
liveComponentSources: boolean;
|
|
82
81
|
debugNodeApis: boolean;
|
|
83
82
|
systemUdfs: boolean;
|
|
84
|
-
largeIndexDeletionCheck: LargeIndexDeletionCheck;
|
|
85
|
-
warnOnSlowSchemaValidation: boolean;
|
|
86
83
|
codegenOnlyThisComponent?: string | undefined;
|
|
87
84
|
};
|
|
88
85
|
|
package/src/cli/lib/command.ts
CHANGED
|
@@ -260,6 +260,7 @@ export async function normalizeDevOptions(
|
|
|
260
260
|
debugNodeApis?: boolean;
|
|
261
261
|
liveComponentSources?: boolean;
|
|
262
262
|
pushAllModules?: boolean;
|
|
263
|
+
allowUnstagingSchema?: boolean;
|
|
263
264
|
while?: string;
|
|
264
265
|
},
|
|
265
266
|
): Promise<{
|
|
@@ -279,6 +280,7 @@ export async function normalizeDevOptions(
|
|
|
279
280
|
debugNodeApis: boolean;
|
|
280
281
|
liveComponentSources: boolean;
|
|
281
282
|
pushAllModules: boolean;
|
|
283
|
+
allowUnstagingSchema: boolean;
|
|
282
284
|
}> {
|
|
283
285
|
if (cmdOptions.runComponent && !cmdOptions.run) {
|
|
284
286
|
return await ctx.crash({
|
|
@@ -332,6 +334,7 @@ export async function normalizeDevOptions(
|
|
|
332
334
|
debugNodeApis: !!cmdOptions.debugNodeApis,
|
|
333
335
|
liveComponentSources: !!cmdOptions.liveComponentSources,
|
|
334
336
|
pushAllModules: !!cmdOptions.pushAllModules,
|
|
337
|
+
allowUnstagingSchema: !!cmdOptions.allowUnstagingSchema,
|
|
335
338
|
};
|
|
336
339
|
}
|
|
337
340
|
|
|
@@ -645,9 +645,11 @@ export async function bundleImplementations({
|
|
|
645
645
|
functions: Bundle[];
|
|
646
646
|
definitionPath: ComponentDefinitionPath;
|
|
647
647
|
}[];
|
|
648
|
+
buildDebugInfos: BuildDebugInfo[];
|
|
648
649
|
}> {
|
|
649
650
|
let appImplementation;
|
|
650
651
|
const componentImplementations = [];
|
|
652
|
+
const buildDebugInfos: BuildDebugInfo[] = [];
|
|
651
653
|
|
|
652
654
|
// For --component-dir flag, skip bundling root implementations (no real code to bundle)
|
|
653
655
|
const directoriesToBundle = rootComponentDirectory.syntheticComponentImport
|
|
@@ -660,13 +662,25 @@ export async function bundleImplementations({
|
|
|
660
662
|
rootComponentDirectory.path,
|
|
661
663
|
directory.path,
|
|
662
664
|
);
|
|
665
|
+
// definitionPath is the canonical form
|
|
666
|
+
const definitionPath = toComponentDefinitionPath(
|
|
667
|
+
rootComponentDirectory,
|
|
668
|
+
directory,
|
|
669
|
+
);
|
|
663
670
|
let schema;
|
|
664
|
-
if (
|
|
665
|
-
schema
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
671
|
+
if (
|
|
672
|
+
ctx.fs.exists(path.resolve(resolvedPath, "schema.ts")) ||
|
|
673
|
+
ctx.fs.exists(path.resolve(resolvedPath, "schema.js"))
|
|
674
|
+
) {
|
|
675
|
+
const schemaResult = await bundleSchema(
|
|
676
|
+
ctx,
|
|
677
|
+
resolvedPath,
|
|
678
|
+
extraConditions,
|
|
679
|
+
);
|
|
680
|
+
buildDebugInfos.push(
|
|
681
|
+
buildDebugInfo(directory, definitionPath, "schema", schemaResult),
|
|
682
|
+
);
|
|
683
|
+
schema = schemaResult.modules[0] || null;
|
|
670
684
|
} else {
|
|
671
685
|
schema = null;
|
|
672
686
|
}
|
|
@@ -676,6 +690,7 @@ export async function bundleImplementations({
|
|
|
676
690
|
modules: Bundle[];
|
|
677
691
|
externalDependencies: Map<string, string>;
|
|
678
692
|
bundledModuleNames: Set<string>;
|
|
693
|
+
metafile: Metafile | null;
|
|
679
694
|
} = await bundle({
|
|
680
695
|
ctx,
|
|
681
696
|
dir: resolvedPath,
|
|
@@ -693,6 +708,9 @@ export async function bundleImplementations({
|
|
|
693
708
|
printedMessage: "external dependencies not supported",
|
|
694
709
|
});
|
|
695
710
|
}
|
|
711
|
+
buildDebugInfos.push(
|
|
712
|
+
buildDebugInfo(directory, definitionPath, "convex", convexResult),
|
|
713
|
+
);
|
|
696
714
|
const functions = convexResult.modules;
|
|
697
715
|
if (isRoot) {
|
|
698
716
|
if (verbose) {
|
|
@@ -702,6 +720,7 @@ export async function bundleImplementations({
|
|
|
702
720
|
modules: Bundle[];
|
|
703
721
|
externalDependencies: Map<string, string>;
|
|
704
722
|
bundledModuleNames: Set<string>;
|
|
723
|
+
metafile: Metafile | null;
|
|
705
724
|
} = await bundle({
|
|
706
725
|
ctx,
|
|
707
726
|
dir: resolvedPath,
|
|
@@ -713,6 +732,9 @@ export async function bundleImplementations({
|
|
|
713
732
|
extraConditions,
|
|
714
733
|
includeSourcesContent,
|
|
715
734
|
});
|
|
735
|
+
buildDebugInfos.push(
|
|
736
|
+
buildDebugInfo(directory, definitionPath, "node", nodeResult),
|
|
737
|
+
);
|
|
716
738
|
|
|
717
739
|
const externalNodeDependencies: NodeDependency[] = [];
|
|
718
740
|
for (const [
|
|
@@ -724,10 +746,15 @@ export async function bundleImplementations({
|
|
|
724
746
|
version: moduleVersion,
|
|
725
747
|
});
|
|
726
748
|
}
|
|
727
|
-
const
|
|
749
|
+
const authResult = await bundleAuthConfig(ctx, resolvedPath);
|
|
750
|
+
buildDebugInfos.push(
|
|
751
|
+
buildDebugInfo(directory, definitionPath, "auth", authResult),
|
|
752
|
+
);
|
|
728
753
|
appImplementation = {
|
|
729
754
|
schema,
|
|
730
|
-
functions: functions
|
|
755
|
+
functions: functions
|
|
756
|
+
.concat(nodeResult.modules)
|
|
757
|
+
.concat(authResult.modules),
|
|
731
758
|
externalNodeDependencies,
|
|
732
759
|
};
|
|
733
760
|
} else {
|
|
@@ -757,11 +784,6 @@ export async function bundleImplementations({
|
|
|
757
784
|
});
|
|
758
785
|
}
|
|
759
786
|
}
|
|
760
|
-
// definitionPath is the canonical form
|
|
761
|
-
const definitionPath = toComponentDefinitionPath(
|
|
762
|
-
rootComponentDirectory,
|
|
763
|
-
directory,
|
|
764
|
-
);
|
|
765
787
|
componentImplementations.push({ definitionPath, schema, functions });
|
|
766
788
|
}
|
|
767
789
|
}
|
|
@@ -783,7 +805,39 @@ export async function bundleImplementations({
|
|
|
783
805
|
}
|
|
784
806
|
}
|
|
785
807
|
|
|
786
|
-
return { appImplementation, componentImplementations };
|
|
808
|
+
return { appImplementation, componentImplementations, buildDebugInfos };
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Debug information for a build in a push.
|
|
813
|
+
*/
|
|
814
|
+
export type BuildDebugInfo = {
|
|
815
|
+
directory: ComponentDirectory;
|
|
816
|
+
definitionPath: ComponentDefinitionPath;
|
|
817
|
+
kind: "convex" | "node" | "schema" | "auth";
|
|
818
|
+
metafile: Metafile | null;
|
|
819
|
+
modules: Bundle[];
|
|
820
|
+
externalDependencies: Map<string, string>;
|
|
821
|
+
};
|
|
822
|
+
|
|
823
|
+
function buildDebugInfo(
|
|
824
|
+
directory: ComponentDirectory,
|
|
825
|
+
definitionPath: ComponentDefinitionPath,
|
|
826
|
+
kind: BuildDebugInfo["kind"],
|
|
827
|
+
result: {
|
|
828
|
+
modules: Bundle[];
|
|
829
|
+
metafile: Metafile | null;
|
|
830
|
+
externalDependencies?: Map<string, string>;
|
|
831
|
+
},
|
|
832
|
+
): BuildDebugInfo {
|
|
833
|
+
return {
|
|
834
|
+
directory,
|
|
835
|
+
definitionPath,
|
|
836
|
+
kind,
|
|
837
|
+
metafile: result.metafile,
|
|
838
|
+
modules: result.modules,
|
|
839
|
+
externalDependencies: result.externalDependencies ?? new Map(),
|
|
840
|
+
};
|
|
787
841
|
}
|
|
788
842
|
|
|
789
843
|
async function registerEsbuildReads(
|