convex 1.44.0 → 1.45.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 +13 -0
- package/dist/browser.bundle.js +1 -1
- package/dist/browser.bundle.js.map +1 -1
- package/dist/cjs/cli/convexExport.js +1 -1
- package/dist/cjs/cli/convexExport.js.map +1 -1
- package/dist/cjs/cli/index.js +2 -32
- package/dist/cjs/cli/index.js.map +2 -2
- package/dist/cjs/cli/lib/api.js +11 -5
- package/dist/cjs/cli/lib/api.js.map +2 -2
- package/dist/cjs/cli/lib/convexExport.js +12 -1
- package/dist/cjs/cli/lib/convexExport.js.map +2 -2
- package/dist/cjs/cli/lib/dashboard.js.map +2 -2
- package/dist/cjs/cli/lib/generatedFunctionLogsApi.js.map +1 -1
- package/dist/cjs/cli/lib/indexes.js +1 -1
- package/dist/cjs/cli/lib/indexes.js.map +1 -1
- package/dist/cjs/cli/lib/localDeployment/upgrade.js +23 -188
- package/dist/cjs/cli/lib/localDeployment/upgrade.js.map +3 -3
- package/dist/cjs/cli/lib/mcp/tools/index.js.map +1 -1
- package/dist/cjs/cli/mcp.js +76 -69
- package/dist/cjs/cli/mcp.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/impl/actions_impl.js.map +2 -2
- package/dist/cjs/server/index.js.map +2 -2
- package/dist/cjs-types/cli/lib/api.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/convexExport.d.ts +1 -0
- package/dist/cjs-types/cli/lib/convexExport.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/dashboard.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts +2 -0
- package/dist/cjs-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/upgrade.d.ts +2 -0
- package/dist/cjs-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/mcp/tools/index.d.ts +1 -1
- package/dist/cjs-types/cli/lib/mcp/tools/index.d.ts.map +1 -1
- package/dist/cjs-types/cli/mcp.d.ts +3 -0
- package/dist/cjs-types/cli/mcp.d.ts.map +1 -1
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/cjs-types/server/impl/actions_impl.d.ts +14 -0
- package/dist/cjs-types/server/impl/actions_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/index.d.ts +1 -0
- package/dist/cjs-types/server/index.d.ts.map +1 -1
- package/dist/cli.bundle.cjs +31210 -25495
- package/dist/cli.bundle.cjs.map +4 -4
- package/dist/esm/cli/convexExport.js +1 -1
- package/dist/esm/cli/convexExport.js.map +1 -1
- package/dist/esm/cli/index.js +2 -32
- package/dist/esm/cli/index.js.map +2 -2
- package/dist/esm/cli/lib/api.js +11 -5
- package/dist/esm/cli/lib/api.js.map +2 -2
- package/dist/esm/cli/lib/convexExport.js +16 -3
- package/dist/esm/cli/lib/convexExport.js.map +2 -2
- package/dist/esm/cli/lib/dashboard.js.map +2 -2
- package/dist/esm/cli/lib/indexes.js +1 -1
- package/dist/esm/cli/lib/indexes.js.map +1 -1
- package/dist/esm/cli/lib/localDeployment/upgrade.js +22 -190
- package/dist/esm/cli/lib/localDeployment/upgrade.js.map +2 -2
- package/dist/esm/cli/lib/mcp/tools/index.js.map +1 -1
- package/dist/esm/cli/mcp.js +75 -72
- package/dist/esm/cli/mcp.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/impl/actions_impl.js.map +2 -2
- package/dist/esm/server/index.js.map +2 -2
- package/dist/esm-types/cli/lib/api.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/convexExport.d.ts +1 -0
- package/dist/esm-types/cli/lib/convexExport.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/dashboard.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts +2 -0
- package/dist/esm-types/cli/lib/generatedFunctionLogsApi.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/upgrade.d.ts +2 -0
- package/dist/esm-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/mcp/tools/index.d.ts +1 -1
- package/dist/esm-types/cli/lib/mcp/tools/index.d.ts.map +1 -1
- package/dist/esm-types/cli/mcp.d.ts +3 -0
- package/dist/esm-types/cli/mcp.d.ts.map +1 -1
- package/dist/esm-types/index.d.ts +1 -1
- package/dist/esm-types/server/impl/actions_impl.d.ts +14 -0
- package/dist/esm-types/server/impl/actions_impl.d.ts.map +1 -1
- package/dist/esm-types/server/index.d.ts +1 -0
- package/dist/esm-types/server/index.d.ts.map +1 -1
- package/dist/react.bundle.js +1 -1
- package/dist/react.bundle.js.map +1 -1
- package/package.json +3 -3
- package/src/cli/convexExport.ts +1 -1
- package/src/cli/index.ts +2 -35
- package/src/cli/lib/api.ts +11 -5
- package/src/cli/lib/convexExport.ts +21 -0
- package/src/cli/lib/dashboard.ts +2 -0
- package/src/cli/lib/generatedFunctionLogsApi.ts +2 -0
- package/src/cli/lib/indexes.ts +1 -1
- package/src/cli/lib/localDeployment/upgrade.ts +34 -207
- package/src/cli/lib/mcp/tools/index.ts +1 -1
- package/src/cli/mcp.ts +91 -77
- package/src/index.ts +1 -1
- package/src/server/impl/actions_impl.ts +3 -1
- package/src/server/index.ts +0 -3
- package/dist/cjs-types/browser/http_client.test.d.ts +0 -2
- package/dist/cjs-types/browser/http_client.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/query_options.test.d.ts +0 -2
- package/dist/cjs-types/browser/query_options.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/simple_client.test.d.ts +0 -2
- package/dist/cjs-types/browser/simple_client.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/client.test.d.ts +0 -5
- package/dist/cjs-types/browser/sync/client.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/client_node.test.d.ts +0 -2
- package/dist/cjs-types/browser/sync/client_node.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/client_node_test_helpers.d.ts +0 -44
- package/dist/cjs-types/browser/sync/client_node_test_helpers.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/local_state.test.d.ts +0 -2
- package/dist/cjs-types/browser/sync/local_state.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/optimistic_query_set.test.d.ts +0 -2
- package/dist/cjs-types/browser/sync/optimistic_query_set.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/paginated_query_client.test.d.ts +0 -2
- package/dist/cjs-types/browser/sync/paginated_query_client.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/protocol.test.d.ts +0 -5
- package/dist/cjs-types/browser/sync/protocol.test.d.ts.map +0 -1
- package/dist/cjs-types/browser/sync/request_manager.test.d.ts +0 -2
- package/dist/cjs-types/browser/sync/request_manager.test.d.ts.map +0 -1
- package/dist/cjs-types/bundler/fs.test.d.ts +0 -2
- package/dist/cjs-types/bundler/fs.test.d.ts.map +0 -1
- package/dist/cjs-types/bundler/index.test.d.ts +0 -2
- package/dist/cjs-types/bundler/index.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/codegen_templates/api.test.d.ts +0 -2
- package/dist/cjs-types/cli/codegen_templates/api.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/codegen_templates/common.test.d.ts +0 -2
- package/dist/cjs-types/cli/codegen_templates/common.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/codegen_templates/templates.test.d.ts +0 -2
- package/dist/cjs-types/cli/codegen_templates/templates.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/codegen_templates/validator_helpers.test.d.ts +0 -2
- package/dist/cjs-types/cli/codegen_templates/validator_helpers.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/configure.test.d.ts +0 -2
- package/dist/cjs-types/cli/configure.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/deploymentCreate.test.d.ts +0 -2
- package/dist/cjs-types/cli/deploymentCreate.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/deploymentSelect.test.d.ts +0 -2
- package/dist/cjs-types/cli/deploymentSelect.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/deploymentSelection.test.d.ts +0 -2
- package/dist/cjs-types/cli/deploymentSelection.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/deploymentToken.test.d.ts +0 -2
- package/dist/cjs-types/cli/deploymentToken.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/dev.test.d.ts +0 -2
- package/dist/cjs-types/cli/dev.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/envDefault.test.d.ts +0 -2
- package/dist/cjs-types/cli/envDefault.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/agentsmd.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/agentsmd.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/claudemd.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/claudemd.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/guidelinesmd.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/index.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/index.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/integration.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/integration.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/prompt.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/prompt.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/state.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/state.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/aiFiles/utils.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/aiFiles/utils.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/codegen.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/codegen.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/components.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/components.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/config.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/config.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/deployment.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/deployment.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/deploymentSelector.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/deploymentSelector.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/env.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/env.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/expiration.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/expiration.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/extractDeploymentNameForWorkOS.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/extractDeploymentNameForWorkOS.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/formatEnvValueForDotfile.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/formatEnvValueForDotfile.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/formatTargetedDeployment.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/formatTargetedDeployment.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/fsUtils.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/fsUtils.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/generateDocs.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/generateDocs.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/indexes.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/indexes.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/localDeployment/run.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/localDeployment/run.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/localDeployment/secrets.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/localDeployment/secrets.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/run.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/run.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/runTestFunction.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/runTestFunction.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/typecheck.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/typecheck.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/updates.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/updates.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/utils/hash.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/utils/hash.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/utils/utils.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/utils/utils.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/versionApi.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/versionApi.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/workos/environmentApi.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/workos/environmentApi.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/lib/workos/workos.test.d.ts +0 -2
- package/dist/cjs-types/cli/lib/workos/workos.test.d.ts.map +0 -1
- package/dist/cjs-types/cli/login.test.d.ts +0 -2
- package/dist/cjs-types/cli/login.test.d.ts.map +0 -1
- package/dist/cjs-types/common/index.test.d.ts +0 -2
- package/dist/cjs-types/common/index.test.d.ts.map +0 -1
- package/dist/cjs-types/nextjs/nextjs.test.d.ts +0 -2
- package/dist/cjs-types/nextjs/nextjs.test.d.ts.map +0 -1
- package/dist/cjs-types/react/ConvexAuthState.test.d.ts +0 -2
- package/dist/cjs-types/react/ConvexAuthState.test.d.ts.map +0 -1
- package/dist/cjs-types/react/auth_helpers.test.d.ts +0 -2
- package/dist/cjs-types/react/auth_helpers.test.d.ts.map +0 -1
- package/dist/cjs-types/react/auth_websocket.test.d.ts +0 -2
- package/dist/cjs-types/react/auth_websocket.test.d.ts.map +0 -1
- package/dist/cjs-types/react/client.test.d.ts +0 -2
- package/dist/cjs-types/react/client.test.d.ts.map +0 -1
- package/dist/cjs-types/react/client_provided_base_client.test.d.ts +0 -2
- package/dist/cjs-types/react/client_provided_base_client.test.d.ts.map +0 -1
- package/dist/cjs-types/react/queries_observer.test.d.ts +0 -2
- package/dist/cjs-types/react/queries_observer.test.d.ts.map +0 -1
- package/dist/cjs-types/react/react_node.test.d.ts +0 -2
- package/dist/cjs-types/react/react_node.test.d.ts.map +0 -1
- package/dist/cjs-types/react/use_paginated_query.test.d.ts +0 -2
- package/dist/cjs-types/react/use_paginated_query.test.d.ts.map +0 -1
- package/dist/cjs-types/react/use_queries.test.d.ts +0 -5
- package/dist/cjs-types/react/use_queries.test.d.ts.map +0 -1
- package/dist/cjs-types/react/use_query.test.d.ts +0 -5
- package/dist/cjs-types/react/use_query.test.d.ts.map +0 -1
- package/dist/cjs-types/react/use_query_object_options.test.d.ts +0 -5
- package/dist/cjs-types/react/use_query_object_options.test.d.ts.map +0 -1
- package/dist/cjs-types/react/use_query_result.test.d.ts +0 -5
- package/dist/cjs-types/react/use_query_result.test.d.ts.map +0 -1
- package/dist/cjs-types/react-auth0/ConvexProviderWithAuth0.test.d.ts +0 -2
- package/dist/cjs-types/react-auth0/ConvexProviderWithAuth0.test.d.ts.map +0 -1
- package/dist/cjs-types/react-clerk/ConvexProviderWithClerk.test.d.ts +0 -2
- package/dist/cjs-types/react-clerk/ConvexProviderWithClerk.test.d.ts.map +0 -1
- package/dist/cjs-types/server/api.intersect.test.d.ts +0 -2
- package/dist/cjs-types/server/api.intersect.test.d.ts.map +0 -1
- package/dist/cjs-types/server/api.test.d.ts +0 -2
- package/dist/cjs-types/server/api.test.d.ts.map +0 -1
- package/dist/cjs-types/server/audit_logging.test.d.ts +0 -2
- package/dist/cjs-types/server/audit_logging.test.d.ts.map +0 -1
- package/dist/cjs-types/server/components/index.test.d.ts +0 -2
- package/dist/cjs-types/server/components/index.test.d.ts.map +0 -1
- package/dist/cjs-types/server/cron.test.d.ts +0 -2
- package/dist/cjs-types/server/cron.test.d.ts.map +0 -1
- package/dist/cjs-types/server/data_model.test.d.ts +0 -2
- package/dist/cjs-types/server/data_model.test.d.ts.map +0 -1
- package/dist/cjs-types/server/database.test.d.ts +0 -2
- package/dist/cjs-types/server/database.test.d.ts.map +0 -1
- package/dist/cjs-types/server/database_api.test.d.ts +0 -2
- package/dist/cjs-types/server/database_api.test.d.ts.map +0 -1
- package/dist/cjs-types/server/filter_builder.test.d.ts +0 -2
- package/dist/cjs-types/server/filter_builder.test.d.ts.map +0 -1
- package/dist/cjs-types/server/impl/actions_impl.test.d.ts +0 -2
- package/dist/cjs-types/server/impl/actions_impl.test.d.ts.map +0 -1
- package/dist/cjs-types/server/impl/filter_builder_impl.test.d.ts +0 -2
- package/dist/cjs-types/server/impl/filter_builder_impl.test.d.ts.map +0 -1
- package/dist/cjs-types/server/impl/query_impl.test.d.ts +0 -2
- package/dist/cjs-types/server/impl/query_impl.test.d.ts.map +0 -1
- package/dist/cjs-types/server/pagination.test.d.ts +0 -2
- package/dist/cjs-types/server/pagination.test.d.ts.map +0 -1
- package/dist/cjs-types/server/query.test.d.ts +0 -2
- package/dist/cjs-types/server/query.test.d.ts.map +0 -1
- package/dist/cjs-types/server/registration.test.d.ts +0 -2
- package/dist/cjs-types/server/registration.test.d.ts.map +0 -1
- package/dist/cjs-types/server/router.test.d.ts +0 -2
- package/dist/cjs-types/server/router.test.d.ts.map +0 -1
- package/dist/cjs-types/server/scheduler.test.d.ts +0 -2
- package/dist/cjs-types/server/scheduler.test.d.ts.map +0 -1
- package/dist/cjs-types/server/schema.test.d.ts +0 -2
- package/dist/cjs-types/server/schema.test.d.ts.map +0 -1
- package/dist/cjs-types/test/fake_watch.d.ts +0 -16
- package/dist/cjs-types/test/fake_watch.d.ts.map +0 -1
- package/dist/cjs-types/test/type_testing.d.ts +0 -9
- package/dist/cjs-types/test/type_testing.d.ts.map +0 -1
- package/dist/cjs-types/type_utils.test.d.ts +0 -2
- package/dist/cjs-types/type_utils.test.d.ts.map +0 -1
- package/dist/cjs-types/values/size.test.d.ts +0 -2
- package/dist/cjs-types/values/size.test.d.ts.map +0 -1
- package/dist/cjs-types/values/validator.test.d.ts +0 -2
- package/dist/cjs-types/values/validator.test.d.ts.map +0 -1
- package/dist/cjs-types/values/value.test.d.ts +0 -2
- package/dist/cjs-types/values/value.test.d.ts.map +0 -1
- package/dist/esm-types/browser/http_client.test.d.ts +0 -2
- package/dist/esm-types/browser/http_client.test.d.ts.map +0 -1
- package/dist/esm-types/browser/query_options.test.d.ts +0 -2
- package/dist/esm-types/browser/query_options.test.d.ts.map +0 -1
- package/dist/esm-types/browser/simple_client.test.d.ts +0 -2
- package/dist/esm-types/browser/simple_client.test.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/client.test.d.ts +0 -5
- package/dist/esm-types/browser/sync/client.test.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/client_node.test.d.ts +0 -2
- package/dist/esm-types/browser/sync/client_node.test.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/client_node_test_helpers.d.ts +0 -44
- package/dist/esm-types/browser/sync/client_node_test_helpers.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/local_state.test.d.ts +0 -2
- package/dist/esm-types/browser/sync/local_state.test.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/optimistic_query_set.test.d.ts +0 -2
- package/dist/esm-types/browser/sync/optimistic_query_set.test.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/paginated_query_client.test.d.ts +0 -2
- package/dist/esm-types/browser/sync/paginated_query_client.test.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/protocol.test.d.ts +0 -5
- package/dist/esm-types/browser/sync/protocol.test.d.ts.map +0 -1
- package/dist/esm-types/browser/sync/request_manager.test.d.ts +0 -2
- package/dist/esm-types/browser/sync/request_manager.test.d.ts.map +0 -1
- package/dist/esm-types/bundler/fs.test.d.ts +0 -2
- package/dist/esm-types/bundler/fs.test.d.ts.map +0 -1
- package/dist/esm-types/bundler/index.test.d.ts +0 -2
- package/dist/esm-types/bundler/index.test.d.ts.map +0 -1
- package/dist/esm-types/cli/codegen_templates/api.test.d.ts +0 -2
- package/dist/esm-types/cli/codegen_templates/api.test.d.ts.map +0 -1
- package/dist/esm-types/cli/codegen_templates/common.test.d.ts +0 -2
- package/dist/esm-types/cli/codegen_templates/common.test.d.ts.map +0 -1
- package/dist/esm-types/cli/codegen_templates/templates.test.d.ts +0 -2
- package/dist/esm-types/cli/codegen_templates/templates.test.d.ts.map +0 -1
- package/dist/esm-types/cli/codegen_templates/validator_helpers.test.d.ts +0 -2
- package/dist/esm-types/cli/codegen_templates/validator_helpers.test.d.ts.map +0 -1
- package/dist/esm-types/cli/configure.test.d.ts +0 -2
- package/dist/esm-types/cli/configure.test.d.ts.map +0 -1
- package/dist/esm-types/cli/deploymentCreate.test.d.ts +0 -2
- package/dist/esm-types/cli/deploymentCreate.test.d.ts.map +0 -1
- package/dist/esm-types/cli/deploymentSelect.test.d.ts +0 -2
- package/dist/esm-types/cli/deploymentSelect.test.d.ts.map +0 -1
- package/dist/esm-types/cli/deploymentSelection.test.d.ts +0 -2
- package/dist/esm-types/cli/deploymentSelection.test.d.ts.map +0 -1
- package/dist/esm-types/cli/deploymentToken.test.d.ts +0 -2
- package/dist/esm-types/cli/deploymentToken.test.d.ts.map +0 -1
- package/dist/esm-types/cli/dev.test.d.ts +0 -2
- package/dist/esm-types/cli/dev.test.d.ts.map +0 -1
- package/dist/esm-types/cli/envDefault.test.d.ts +0 -2
- package/dist/esm-types/cli/envDefault.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/agentsmd.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/agentsmd.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/claudemd.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/claudemd.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/guidelinesmd.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/index.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/index.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/integration.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/integration.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/prompt.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/prompt.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/state.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/state.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/aiFiles/utils.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/aiFiles/utils.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/codegen.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/codegen.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/components.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/components.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/config.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/config.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/deployment.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/deployment.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/deploymentSelector.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/deploymentSelector.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/env.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/env.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/expiration.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/expiration.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/extractDeploymentNameForWorkOS.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/extractDeploymentNameForWorkOS.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/formatEnvValueForDotfile.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/formatEnvValueForDotfile.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/formatTargetedDeployment.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/formatTargetedDeployment.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/fsUtils.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/fsUtils.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/generateDocs.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/generateDocs.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/indexes.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/indexes.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/localDeployment/run.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/localDeployment/run.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/localDeployment/secrets.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/localDeployment/secrets.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/run.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/run.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/runTestFunction.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/runTestFunction.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/typecheck.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/typecheck.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/updates.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/updates.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/utils/hash.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/utils/hash.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/utils/utils.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/utils/utils.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/versionApi.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/versionApi.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/workos/environmentApi.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/workos/environmentApi.test.d.ts.map +0 -1
- package/dist/esm-types/cli/lib/workos/workos.test.d.ts +0 -2
- package/dist/esm-types/cli/lib/workos/workos.test.d.ts.map +0 -1
- package/dist/esm-types/cli/login.test.d.ts +0 -2
- package/dist/esm-types/cli/login.test.d.ts.map +0 -1
- package/dist/esm-types/common/index.test.d.ts +0 -2
- package/dist/esm-types/common/index.test.d.ts.map +0 -1
- package/dist/esm-types/nextjs/nextjs.test.d.ts +0 -2
- package/dist/esm-types/nextjs/nextjs.test.d.ts.map +0 -1
- package/dist/esm-types/react/ConvexAuthState.test.d.ts +0 -2
- package/dist/esm-types/react/ConvexAuthState.test.d.ts.map +0 -1
- package/dist/esm-types/react/auth_helpers.test.d.ts +0 -2
- package/dist/esm-types/react/auth_helpers.test.d.ts.map +0 -1
- package/dist/esm-types/react/auth_websocket.test.d.ts +0 -2
- package/dist/esm-types/react/auth_websocket.test.d.ts.map +0 -1
- package/dist/esm-types/react/client.test.d.ts +0 -2
- package/dist/esm-types/react/client.test.d.ts.map +0 -1
- package/dist/esm-types/react/client_provided_base_client.test.d.ts +0 -2
- package/dist/esm-types/react/client_provided_base_client.test.d.ts.map +0 -1
- package/dist/esm-types/react/queries_observer.test.d.ts +0 -2
- package/dist/esm-types/react/queries_observer.test.d.ts.map +0 -1
- package/dist/esm-types/react/react_node.test.d.ts +0 -2
- package/dist/esm-types/react/react_node.test.d.ts.map +0 -1
- package/dist/esm-types/react/use_paginated_query.test.d.ts +0 -2
- package/dist/esm-types/react/use_paginated_query.test.d.ts.map +0 -1
- package/dist/esm-types/react/use_queries.test.d.ts +0 -5
- package/dist/esm-types/react/use_queries.test.d.ts.map +0 -1
- package/dist/esm-types/react/use_query.test.d.ts +0 -5
- package/dist/esm-types/react/use_query.test.d.ts.map +0 -1
- package/dist/esm-types/react/use_query_object_options.test.d.ts +0 -5
- package/dist/esm-types/react/use_query_object_options.test.d.ts.map +0 -1
- package/dist/esm-types/react/use_query_result.test.d.ts +0 -5
- package/dist/esm-types/react/use_query_result.test.d.ts.map +0 -1
- package/dist/esm-types/react-auth0/ConvexProviderWithAuth0.test.d.ts +0 -2
- package/dist/esm-types/react-auth0/ConvexProviderWithAuth0.test.d.ts.map +0 -1
- package/dist/esm-types/react-clerk/ConvexProviderWithClerk.test.d.ts +0 -2
- package/dist/esm-types/react-clerk/ConvexProviderWithClerk.test.d.ts.map +0 -1
- package/dist/esm-types/server/api.intersect.test.d.ts +0 -2
- package/dist/esm-types/server/api.intersect.test.d.ts.map +0 -1
- package/dist/esm-types/server/api.test.d.ts +0 -2
- package/dist/esm-types/server/api.test.d.ts.map +0 -1
- package/dist/esm-types/server/audit_logging.test.d.ts +0 -2
- package/dist/esm-types/server/audit_logging.test.d.ts.map +0 -1
- package/dist/esm-types/server/components/index.test.d.ts +0 -2
- package/dist/esm-types/server/components/index.test.d.ts.map +0 -1
- package/dist/esm-types/server/cron.test.d.ts +0 -2
- package/dist/esm-types/server/cron.test.d.ts.map +0 -1
- package/dist/esm-types/server/data_model.test.d.ts +0 -2
- package/dist/esm-types/server/data_model.test.d.ts.map +0 -1
- package/dist/esm-types/server/database.test.d.ts +0 -2
- package/dist/esm-types/server/database.test.d.ts.map +0 -1
- package/dist/esm-types/server/database_api.test.d.ts +0 -2
- package/dist/esm-types/server/database_api.test.d.ts.map +0 -1
- package/dist/esm-types/server/filter_builder.test.d.ts +0 -2
- package/dist/esm-types/server/filter_builder.test.d.ts.map +0 -1
- package/dist/esm-types/server/impl/actions_impl.test.d.ts +0 -2
- package/dist/esm-types/server/impl/actions_impl.test.d.ts.map +0 -1
- package/dist/esm-types/server/impl/filter_builder_impl.test.d.ts +0 -2
- package/dist/esm-types/server/impl/filter_builder_impl.test.d.ts.map +0 -1
- package/dist/esm-types/server/impl/query_impl.test.d.ts +0 -2
- package/dist/esm-types/server/impl/query_impl.test.d.ts.map +0 -1
- package/dist/esm-types/server/pagination.test.d.ts +0 -2
- package/dist/esm-types/server/pagination.test.d.ts.map +0 -1
- package/dist/esm-types/server/query.test.d.ts +0 -2
- package/dist/esm-types/server/query.test.d.ts.map +0 -1
- package/dist/esm-types/server/registration.test.d.ts +0 -2
- package/dist/esm-types/server/registration.test.d.ts.map +0 -1
- package/dist/esm-types/server/router.test.d.ts +0 -2
- package/dist/esm-types/server/router.test.d.ts.map +0 -1
- package/dist/esm-types/server/scheduler.test.d.ts +0 -2
- package/dist/esm-types/server/scheduler.test.d.ts.map +0 -1
- package/dist/esm-types/server/schema.test.d.ts +0 -2
- package/dist/esm-types/server/schema.test.d.ts.map +0 -1
- package/dist/esm-types/test/fake_watch.d.ts +0 -16
- package/dist/esm-types/test/fake_watch.d.ts.map +0 -1
- package/dist/esm-types/test/type_testing.d.ts +0 -9
- package/dist/esm-types/test/type_testing.d.ts.map +0 -1
- package/dist/esm-types/type_utils.test.d.ts +0 -2
- package/dist/esm-types/type_utils.test.d.ts.map +0 -1
- package/dist/esm-types/values/size.test.d.ts +0 -2
- package/dist/esm-types/values/size.test.d.ts.map +0 -1
- package/dist/esm-types/values/validator.test.d.ts +0 -2
- package/dist/esm-types/values/validator.test.d.ts.map +0 -1
- package/dist/esm-types/values/value.test.d.ts +0 -2
- package/dist/esm-types/values/value.test.d.ts.map +0 -1
- package/src/browser/http_client.test.ts +0 -202
- package/src/browser/query_options.test.ts +0 -43
- package/src/browser/simple_client.test.ts +0 -104
- package/src/browser/sync/client.test.ts +0 -44
- package/src/browser/sync/client_node.test.ts +0 -1207
- package/src/browser/sync/client_node_test_helpers.ts +0 -200
- package/src/browser/sync/local_state.test.ts +0 -128
- package/src/browser/sync/optimistic_query_set.test.ts +0 -253
- package/src/browser/sync/paginated_query_client.test.ts +0 -597
- package/src/browser/sync/protocol.test.ts +0 -14
- package/src/browser/sync/request_manager.test.ts +0 -273
- package/src/bundler/fs.test.ts +0 -86
- package/src/bundler/index.test.ts +0 -210
- package/src/bundler/test_fixtures/js/project01/bar.js +0 -4
- package/src/bundler/test_fixtures/js/project01/file with spaces.js +0 -1
- package/src/bundler/test_fixtures/js/project01/foo.js +0 -9
- package/src/bundler/test_fixtures/js/project_with_https/https.js +0 -9
- package/src/bundler/test_fixtures/js/project_with_https_not_at_top_level/default.js +0 -3
- package/src/bundler/test_fixtures/js/project_with_https_not_at_top_level/more_code/https.js +0 -5
- package/src/bundler/test_fixtures/js/project_with_https_without_router/https.js +0 -1
- package/src/bundler/test_fixtures/js/project_with_node_shims/uses_node_shims.js +0 -4
- package/src/cli/codegen_templates/api.test.ts +0 -18
- package/src/cli/codegen_templates/common.test.ts +0 -52
- package/src/cli/codegen_templates/templates.test.ts +0 -16
- package/src/cli/codegen_templates/validator_helpers.test.ts +0 -31
- package/src/cli/configure.test.ts +0 -138
- package/src/cli/deploymentCreate.test.ts +0 -1376
- package/src/cli/deploymentSelect.test.ts +0 -1291
- package/src/cli/deploymentSelection.test.ts +0 -2546
- package/src/cli/deploymentToken.test.ts +0 -397
- package/src/cli/dev.test.ts +0 -157
- package/src/cli/envDefault.test.ts +0 -495
- package/src/cli/lib/__snapshots__/formatTargetedDeployment.test.ts.snap +0 -94
- package/src/cli/lib/aiFiles/agentsmd.test.ts +0 -133
- package/src/cli/lib/aiFiles/claudemd.test.ts +0 -92
- package/src/cli/lib/aiFiles/guidelinesmd.test.ts +0 -50
- package/src/cli/lib/aiFiles/index.test.ts +0 -986
- package/src/cli/lib/aiFiles/integration.test.ts +0 -692
- package/src/cli/lib/aiFiles/prompt.test.ts +0 -202
- package/src/cli/lib/aiFiles/state.test.ts +0 -305
- package/src/cli/lib/aiFiles/utils.test.ts +0 -50
- package/src/cli/lib/codegen.test.ts +0 -49
- package/src/cli/lib/components.test.ts +0 -227
- package/src/cli/lib/config.test.ts +0 -1026
- package/src/cli/lib/deployment.test.ts +0 -85
- package/src/cli/lib/deploymentSelector.test.ts +0 -107
- package/src/cli/lib/env.test.ts +0 -60
- package/src/cli/lib/expiration.test.ts +0 -159
- package/src/cli/lib/extractDeploymentNameForWorkOS.test.ts +0 -30
- package/src/cli/lib/formatEnvValueForDotfile.test.ts +0 -294
- package/src/cli/lib/formatTargetedDeployment.test.ts +0 -281
- package/src/cli/lib/fsUtils.test.ts +0 -67
- package/src/cli/lib/generateDocs.test.ts +0 -326
- package/src/cli/lib/indexes.test.ts +0 -77
- package/src/cli/lib/localDeployment/run.test.ts +0 -104
- package/src/cli/lib/localDeployment/secrets.test.ts +0 -53
- package/src/cli/lib/run.test.ts +0 -54
- package/src/cli/lib/runTestFunction.test.ts +0 -84
- package/src/cli/lib/typecheck.test.ts +0 -71
- package/src/cli/lib/updates.test.ts +0 -157
- package/src/cli/lib/utils/hash.test.ts +0 -25
- package/src/cli/lib/utils/utils.test.ts +0 -340
- package/src/cli/lib/versionApi.test.ts +0 -471
- package/src/cli/lib/workos/environmentApi.test.ts +0 -107
- package/src/cli/lib/workos/workos.test.ts +0 -242
- package/src/cli/login.test.ts +0 -261
- package/src/common/README.md +0 -2
- package/src/common/index.test.ts +0 -35
- package/src/nextjs/nextjs.test.tsx +0 -94
- package/src/react/ConvexAuthState.test.tsx +0 -702
- package/src/react/auth_helpers.test.tsx +0 -45
- package/src/react/auth_websocket.test.tsx +0 -1177
- package/src/react/client.test.tsx +0 -261
- package/src/react/client_provided_base_client.test.tsx +0 -174
- package/src/react/queries_observer.test.ts +0 -176
- package/src/react/react_node.test.ts +0 -78
- package/src/react/use_paginated_query.test.tsx +0 -1420
- package/src/react/use_queries.test.ts +0 -140
- package/src/react/use_query.test.ts +0 -71
- package/src/react/use_query_object_options.test.ts +0 -51
- package/src/react/use_query_result.test.ts +0 -75
- package/src/react-auth0/ConvexProviderWithAuth0.test.tsx +0 -17
- package/src/react-clerk/ConvexProviderWithClerk.test.tsx +0 -18
- package/src/server/README.md +0 -15
- package/src/server/api.intersect.test.ts +0 -109
- package/src/server/api.test.ts +0 -447
- package/src/server/audit_logging.test.ts +0 -131
- package/src/server/components/index.test.ts +0 -48
- package/src/server/cron.test.ts +0 -58
- package/src/server/data_model.test.ts +0 -221
- package/src/server/database.test.ts +0 -184
- package/src/server/database_api.test.ts +0 -439
- package/src/server/filter_builder.test.ts +0 -102
- package/src/server/impl/actions_impl.test.ts +0 -59
- package/src/server/impl/filter_builder_impl.test.ts +0 -13
- package/src/server/impl/query_impl.test.ts +0 -46
- package/src/server/pagination.test.ts +0 -49
- package/src/server/query.test.ts +0 -112
- package/src/server/registration.test.ts +0 -589
- package/src/server/router.test.ts +0 -148
- package/src/server/scheduler.test.ts +0 -31
- package/src/server/schema.test.ts +0 -1081
- package/src/test/fake_watch.ts +0 -54
- package/src/test/type_testing.ts +0 -21
- package/src/type_utils.test.ts +0 -62
- package/src/values/size.test.ts +0 -95
- package/src/values/validator.test.ts +0 -619
- package/src/values/value.test.ts +0 -232
- package/src/vendor/README.md +0 -18
- package/src/vendor/jwt-decode/README.md +0 -1
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
import { test, expect, beforeEach, vi } from "vitest";
|
|
2
|
-
import { RequestManager } from "./request_manager.js";
|
|
3
|
-
import { Long } from "../../vendor/long.js";
|
|
4
|
-
import { ActionRequest, MutationRequest } from "./protocol.js";
|
|
5
|
-
import { instantiateDefaultLogger } from "../logging.js";
|
|
6
|
-
|
|
7
|
-
let requestManager: RequestManager;
|
|
8
|
-
let markConnectionStateDirty: ReturnType<typeof vi.fn<() => void>>;
|
|
9
|
-
|
|
10
|
-
beforeEach(() => {
|
|
11
|
-
markConnectionStateDirty = vi.fn<() => void>();
|
|
12
|
-
requestManager = new RequestManager(
|
|
13
|
-
instantiateDefaultLogger({ verbose: false }),
|
|
14
|
-
markConnectionStateDirty,
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test("hasIncompleteRequests", () => {
|
|
19
|
-
// Starts false.
|
|
20
|
-
expect(requestManager.hasIncompleteRequests()).toBe(false);
|
|
21
|
-
|
|
22
|
-
// When we request a mutation it becomes true.
|
|
23
|
-
let message: MutationRequest = {
|
|
24
|
-
type: "Mutation",
|
|
25
|
-
requestId: 0,
|
|
26
|
-
udfPath: "myMutation",
|
|
27
|
-
args: [],
|
|
28
|
-
};
|
|
29
|
-
let _ = requestManager.request(message, true);
|
|
30
|
-
expect(requestManager.hasIncompleteRequests()).toBe(true);
|
|
31
|
-
|
|
32
|
-
// Request a second mutation and receive the first's response.
|
|
33
|
-
// Should still have an outstanding mutation.
|
|
34
|
-
message = {
|
|
35
|
-
type: "Mutation",
|
|
36
|
-
requestId: 1,
|
|
37
|
-
udfPath: "myMutation",
|
|
38
|
-
args: [],
|
|
39
|
-
};
|
|
40
|
-
_ = requestManager.request(message, true);
|
|
41
|
-
requestManager.onResponse({
|
|
42
|
-
type: "MutationResponse",
|
|
43
|
-
requestId: 0,
|
|
44
|
-
success: true,
|
|
45
|
-
result: null,
|
|
46
|
-
ts: Long.fromNumber(0),
|
|
47
|
-
logLines: [],
|
|
48
|
-
});
|
|
49
|
-
expect(requestManager.hasIncompleteRequests()).toBe(true);
|
|
50
|
-
|
|
51
|
-
// When the second response comes back we no longer have any outstanding mutations.
|
|
52
|
-
requestManager.onResponse({
|
|
53
|
-
type: "MutationResponse",
|
|
54
|
-
requestId: 1,
|
|
55
|
-
success: true,
|
|
56
|
-
result: null,
|
|
57
|
-
ts: Long.fromNumber(0),
|
|
58
|
-
logLines: [],
|
|
59
|
-
});
|
|
60
|
-
expect(requestManager.hasIncompleteRequests()).toBe(false);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* A test that simulates a WebSocket disconnection half-way through the mutation
|
|
65
|
-
* flow.
|
|
66
|
-
*/
|
|
67
|
-
test("mutation retries", async () => {
|
|
68
|
-
// Request a mutation.
|
|
69
|
-
const message: MutationRequest = {
|
|
70
|
-
type: "Mutation",
|
|
71
|
-
requestId: 0,
|
|
72
|
-
udfPath: "myMutation",
|
|
73
|
-
args: [],
|
|
74
|
-
};
|
|
75
|
-
const mutationRequest = requestManager.request(message, true);
|
|
76
|
-
|
|
77
|
-
// Receive the response.
|
|
78
|
-
requestManager.onResponse({
|
|
79
|
-
type: "MutationResponse",
|
|
80
|
-
requestId: 0,
|
|
81
|
-
success: true,
|
|
82
|
-
result: null,
|
|
83
|
-
ts: Long.fromNumber(0),
|
|
84
|
-
logLines: [],
|
|
85
|
-
});
|
|
86
|
-
expect(requestManager.hasSyncedPastLastReconnect()).toBe(true);
|
|
87
|
-
|
|
88
|
-
// Pretend that we become disconnected and reconnect.
|
|
89
|
-
// We should request the mutation because we haven't transitioned past the
|
|
90
|
-
// timestamp the mutation was committed at yet.
|
|
91
|
-
expect(requestManager.restart()).toEqual([message]);
|
|
92
|
-
expect(requestManager.hasSyncedPastLastReconnect()).toBe(false);
|
|
93
|
-
|
|
94
|
-
// Receive another response (because we restarted and requested it again)
|
|
95
|
-
requestManager.onResponse({
|
|
96
|
-
type: "MutationResponse",
|
|
97
|
-
requestId: 0,
|
|
98
|
-
success: true,
|
|
99
|
-
result: null,
|
|
100
|
-
ts: Long.fromNumber(0),
|
|
101
|
-
logLines: [],
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// Transition to ts=1
|
|
105
|
-
requestManager.removeCompleted(Long.fromNumber(1));
|
|
106
|
-
expect(requestManager.hasSyncedPastLastReconnect()).toBe(true);
|
|
107
|
-
|
|
108
|
-
// Return the result of the mutation now that we've transitioned past the
|
|
109
|
-
// mutation timestamp.
|
|
110
|
-
const result = await mutationRequest;
|
|
111
|
-
expect(result).toEqual({ success: true, value: null, logLines: [] });
|
|
112
|
-
|
|
113
|
-
// The if we restart now, the mutation should no longer be re-requested.
|
|
114
|
-
expect(requestManager.restart()).toEqual([]);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Another disconnection test
|
|
119
|
-
*
|
|
120
|
-
* This time upon reconnect we transition past the mutation immediately when we
|
|
121
|
-
* reconnect (before getting the second response).
|
|
122
|
-
*/
|
|
123
|
-
test("mutation retries with transition", async () => {
|
|
124
|
-
// Request a mutation.
|
|
125
|
-
const message: MutationRequest = {
|
|
126
|
-
type: "Mutation",
|
|
127
|
-
requestId: 0,
|
|
128
|
-
udfPath: "myMutation",
|
|
129
|
-
args: [],
|
|
130
|
-
};
|
|
131
|
-
const mutationRequest = requestManager.request(message, true);
|
|
132
|
-
|
|
133
|
-
// Receive the response.
|
|
134
|
-
requestManager.onResponse({
|
|
135
|
-
type: "MutationResponse",
|
|
136
|
-
requestId: 0,
|
|
137
|
-
success: true,
|
|
138
|
-
result: null,
|
|
139
|
-
ts: Long.fromNumber(0),
|
|
140
|
-
logLines: [],
|
|
141
|
-
});
|
|
142
|
-
expect(requestManager.hasSyncedPastLastReconnect()).toBe(true);
|
|
143
|
-
|
|
144
|
-
// Pretend that we become disconnected and reconnect.
|
|
145
|
-
// We should request the mutation because we haven't transitioned past the
|
|
146
|
-
// timestamp the mutation was committed at yet.
|
|
147
|
-
expect(requestManager.restart()).toEqual([message]);
|
|
148
|
-
expect(requestManager.hasSyncedPastLastReconnect()).toBe(false);
|
|
149
|
-
|
|
150
|
-
// Transition to ts=1
|
|
151
|
-
requestManager.removeCompleted(Long.fromNumber(1));
|
|
152
|
-
expect(requestManager.hasSyncedPastLastReconnect()).toBe(true);
|
|
153
|
-
|
|
154
|
-
// Return the result of the mutation now that we've transitioned past the
|
|
155
|
-
// mutation timestamp.
|
|
156
|
-
const result = await mutationRequest;
|
|
157
|
-
expect(result).toEqual({ success: true, value: null, logLines: [] });
|
|
158
|
-
|
|
159
|
-
// The if we restart now, the mutation should no longer be re-requested because
|
|
160
|
-
// we've already observed it.
|
|
161
|
-
expect(requestManager.restart()).toEqual([]);
|
|
162
|
-
expect(requestManager.hasSyncedPastLastReconnect()).toBe(true);
|
|
163
|
-
|
|
164
|
-
// Receive another response (because we requested it again).
|
|
165
|
-
// This response just needs to not crash the client.
|
|
166
|
-
requestManager.onResponse({
|
|
167
|
-
type: "MutationResponse",
|
|
168
|
-
requestId: 0,
|
|
169
|
-
success: true,
|
|
170
|
-
result: null,
|
|
171
|
-
ts: Long.fromNumber(0),
|
|
172
|
-
logLines: [],
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* A test that simulates a WebSocket disconnection half-way through the action
|
|
178
|
-
* flow. Makes sure the action doe not get retried.
|
|
179
|
-
*/
|
|
180
|
-
test("actions are retried only if unsent", async () => {
|
|
181
|
-
// Request a mutation.
|
|
182
|
-
const message1: ActionRequest = {
|
|
183
|
-
type: "Action",
|
|
184
|
-
requestId: 0,
|
|
185
|
-
udfPath: "myAction1",
|
|
186
|
-
args: [],
|
|
187
|
-
};
|
|
188
|
-
const actionRequest1 = requestManager.request(message1, true);
|
|
189
|
-
const message2: ActionRequest = {
|
|
190
|
-
type: "Action",
|
|
191
|
-
requestId: 1,
|
|
192
|
-
udfPath: "myAction2",
|
|
193
|
-
args: [],
|
|
194
|
-
};
|
|
195
|
-
const actionRequest2 = requestManager.request(message2, false);
|
|
196
|
-
|
|
197
|
-
// Pretend that we become disconnected and reconnect.
|
|
198
|
-
// We should only resend message2.
|
|
199
|
-
expect(requestManager.restart()).toEqual([message2]);
|
|
200
|
-
|
|
201
|
-
// The sent action promise should resolve with an error.
|
|
202
|
-
const result = await actionRequest1;
|
|
203
|
-
expect(result).toEqual({
|
|
204
|
-
success: false,
|
|
205
|
-
errorMessage: "Connection lost while action was in flight",
|
|
206
|
-
logLines: [],
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
// If we reconnect again, we should not retry anything. The second promise
|
|
210
|
-
// should also resolve with an error.
|
|
211
|
-
expect(requestManager.restart()).toEqual([]);
|
|
212
|
-
const result2 = await actionRequest2;
|
|
213
|
-
expect(result2).toEqual({
|
|
214
|
-
success: false,
|
|
215
|
-
errorMessage: "Connection lost while action was in flight",
|
|
216
|
-
logLines: [],
|
|
217
|
-
});
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
test("markConnectionStateDirty is called on state changes", () => {
|
|
221
|
-
expect(markConnectionStateDirty).toHaveBeenCalledTimes(0);
|
|
222
|
-
|
|
223
|
-
// Adding a request should trigger the callback
|
|
224
|
-
const message: MutationRequest = {
|
|
225
|
-
type: "Mutation",
|
|
226
|
-
requestId: 0,
|
|
227
|
-
udfPath: "myMutation",
|
|
228
|
-
args: [],
|
|
229
|
-
};
|
|
230
|
-
void requestManager.request(message, true);
|
|
231
|
-
expect(markConnectionStateDirty).toHaveBeenCalledTimes(1);
|
|
232
|
-
|
|
233
|
-
// Response for actions triggers callback immediately, but mutations need to complete
|
|
234
|
-
const actionMessage: ActionRequest = {
|
|
235
|
-
type: "Action",
|
|
236
|
-
requestId: 1,
|
|
237
|
-
udfPath: "myAction",
|
|
238
|
-
args: [],
|
|
239
|
-
};
|
|
240
|
-
void requestManager.request(actionMessage, true);
|
|
241
|
-
expect(markConnectionStateDirty).toHaveBeenCalledTimes(2);
|
|
242
|
-
|
|
243
|
-
// Action response should trigger callback
|
|
244
|
-
requestManager.onResponse({
|
|
245
|
-
type: "ActionResponse",
|
|
246
|
-
requestId: 1,
|
|
247
|
-
success: true,
|
|
248
|
-
result: null,
|
|
249
|
-
logLines: [],
|
|
250
|
-
});
|
|
251
|
-
expect(markConnectionStateDirty).toHaveBeenCalledTimes(3);
|
|
252
|
-
|
|
253
|
-
// First make a mutation response that gets completed
|
|
254
|
-
requestManager.onResponse({
|
|
255
|
-
type: "MutationResponse",
|
|
256
|
-
requestId: 0,
|
|
257
|
-
success: true,
|
|
258
|
-
result: null,
|
|
259
|
-
ts: Long.fromNumber(0),
|
|
260
|
-
logLines: [],
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
// removeCompleted should trigger the callback when mutations complete
|
|
264
|
-
markConnectionStateDirty.mockClear();
|
|
265
|
-
const completedRequests = requestManager.removeCompleted(Long.fromNumber(1));
|
|
266
|
-
expect(completedRequests.size).toBe(1);
|
|
267
|
-
expect(markConnectionStateDirty).toHaveBeenCalledTimes(1);
|
|
268
|
-
|
|
269
|
-
// restart should trigger the callback
|
|
270
|
-
markConnectionStateDirty.mockClear();
|
|
271
|
-
requestManager.restart();
|
|
272
|
-
expect(markConnectionStateDirty).toHaveBeenCalledTimes(1);
|
|
273
|
-
});
|
package/src/bundler/fs.test.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { test, expect } from "vitest";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import os from "os";
|
|
4
|
-
import path from "path";
|
|
5
|
-
import { nodeFs } from "./fs.js";
|
|
6
|
-
|
|
7
|
-
test("nodeFs filesystem operations behave as expected", async () => {
|
|
8
|
-
const tmpdir = fs.mkdtempSync(`${os.tmpdir()}${path.sep}`);
|
|
9
|
-
try {
|
|
10
|
-
const parentDirPath = path.join(tmpdir, "testdir");
|
|
11
|
-
const dirPath = path.join(parentDirPath, "nestedDir");
|
|
12
|
-
const filePath = path.join(dirPath, "text.txt");
|
|
13
|
-
|
|
14
|
-
// Test making and listing directories.
|
|
15
|
-
try {
|
|
16
|
-
nodeFs.mkdir(dirPath);
|
|
17
|
-
throw new Error(
|
|
18
|
-
"Expected `mkdir` to fail because the containing directory doesn't exist yet.",
|
|
19
|
-
);
|
|
20
|
-
} catch (e: any) {
|
|
21
|
-
expect(e.code).toEqual("ENOENT");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
nodeFs.mkdir(parentDirPath);
|
|
25
|
-
nodeFs.mkdir(dirPath);
|
|
26
|
-
try {
|
|
27
|
-
nodeFs.mkdir(dirPath);
|
|
28
|
-
throw new Error("Expected `mkdir` to fail without allowExisting");
|
|
29
|
-
} catch (e: any) {
|
|
30
|
-
expect(e.code).toEqual("EEXIST");
|
|
31
|
-
}
|
|
32
|
-
nodeFs.mkdir(dirPath, { allowExisting: true });
|
|
33
|
-
|
|
34
|
-
const dirEntries = nodeFs.listDir(parentDirPath);
|
|
35
|
-
expect(dirEntries).toHaveLength(1);
|
|
36
|
-
expect(dirEntries[0].name).toEqual("nestedDir");
|
|
37
|
-
|
|
38
|
-
const nestedEntries = nodeFs.listDir(dirPath);
|
|
39
|
-
expect(nestedEntries).toHaveLength(0);
|
|
40
|
-
|
|
41
|
-
// Test file based methods for nonexistent paths.
|
|
42
|
-
expect(nodeFs.exists(filePath)).toEqual(false);
|
|
43
|
-
try {
|
|
44
|
-
nodeFs.stat(filePath);
|
|
45
|
-
throw new Error("Expected `stat` to fail for nonexistent paths");
|
|
46
|
-
} catch (e: any) {
|
|
47
|
-
expect(e.code).toEqual("ENOENT");
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
nodeFs.readUtf8File(filePath);
|
|
51
|
-
throw new Error("Expected `readUtf8File` to fail for nonexistent paths");
|
|
52
|
-
} catch (e: any) {
|
|
53
|
-
expect(e.code).toEqual("ENOENT");
|
|
54
|
-
}
|
|
55
|
-
try {
|
|
56
|
-
nodeFs.access(filePath);
|
|
57
|
-
throw new Error("Expected `access` to fail for nonexistent paths");
|
|
58
|
-
} catch (e: any) {
|
|
59
|
-
expect(e.code).toEqual("ENOENT");
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Test creating a file and accessing it.
|
|
63
|
-
const message = "it's trompo o'clock";
|
|
64
|
-
nodeFs.writeUtf8File(filePath, message);
|
|
65
|
-
expect(nodeFs.exists(filePath)).toEqual(true);
|
|
66
|
-
nodeFs.stat(filePath);
|
|
67
|
-
expect(nodeFs.readUtf8File(filePath)).toEqual(message);
|
|
68
|
-
nodeFs.access(filePath);
|
|
69
|
-
|
|
70
|
-
// Test unlinking a file and directory.
|
|
71
|
-
try {
|
|
72
|
-
nodeFs.unlink(dirPath);
|
|
73
|
-
throw new Error("Expected `unlink` to fail on a directory");
|
|
74
|
-
} catch (e: any) {
|
|
75
|
-
if (os.platform() === "linux") {
|
|
76
|
-
expect(e.code).toEqual("EISDIR");
|
|
77
|
-
} else {
|
|
78
|
-
expect(e.code).toEqual("EPERM");
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
nodeFs.unlink(filePath);
|
|
82
|
-
expect(nodeFs.exists(filePath)).toEqual(false);
|
|
83
|
-
} finally {
|
|
84
|
-
fs.rmSync(tmpdir, { recursive: true });
|
|
85
|
-
}
|
|
86
|
-
});
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { expect, test, afterEach, vi } from "vitest";
|
|
2
|
-
import { oneoffContext } from "./context.js";
|
|
3
|
-
|
|
4
|
-
// Although these tests are run as ESM by ts-lint, this file is built as both
|
|
5
|
-
// CJS and ESM by TypeScript so normal recipes like `__dirname` for getting the
|
|
6
|
-
// script directory don't work.
|
|
7
|
-
const dirname = "src/bundler";
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
bundle,
|
|
11
|
-
doesImportConvexHttpRouter,
|
|
12
|
-
entryPoints,
|
|
13
|
-
entryPointsByEnvironment,
|
|
14
|
-
useNodeDirectiveRegex,
|
|
15
|
-
mustBeIsolate,
|
|
16
|
-
} from "./index.js";
|
|
17
|
-
|
|
18
|
-
const sorted = <T>(arr: T[], key: (el: T) => any): T[] => {
|
|
19
|
-
const newArr = [...arr];
|
|
20
|
-
const cmp = (a: T, b: T) => {
|
|
21
|
-
if (key(a) < key(b)) return -1;
|
|
22
|
-
if (key(a) > key(b)) return 1;
|
|
23
|
-
return 0;
|
|
24
|
-
};
|
|
25
|
-
return newArr.sort(cmp);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const getDefaultCtx = async () => {
|
|
29
|
-
return await oneoffContext({
|
|
30
|
-
url: undefined,
|
|
31
|
-
adminKey: undefined,
|
|
32
|
-
envFile: undefined,
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
afterEach(() => {
|
|
37
|
-
vi.resetAllMocks();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test("bundle function is present", () => {
|
|
41
|
-
expect(typeof bundle).toEqual("function");
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
test("bundle finds JavaScript functions", async () => {
|
|
45
|
-
const fixtureDir = dirname + "/test_fixtures/js/project01";
|
|
46
|
-
const ctx = await getDefaultCtx();
|
|
47
|
-
const entryPoints = await entryPointsByEnvironment(ctx, fixtureDir);
|
|
48
|
-
const bundles = sorted(
|
|
49
|
-
(
|
|
50
|
-
await bundle({
|
|
51
|
-
ctx,
|
|
52
|
-
dir: fixtureDir,
|
|
53
|
-
entryPoints: entryPoints.isolate,
|
|
54
|
-
generateSourceMaps: false,
|
|
55
|
-
platform: "browser",
|
|
56
|
-
})
|
|
57
|
-
).modules,
|
|
58
|
-
(b) => b.path,
|
|
59
|
-
).filter((bundle) => !bundle.path.includes("_deps"));
|
|
60
|
-
expect(bundles).toHaveLength(2);
|
|
61
|
-
expect(bundles[0].path).toEqual("bar.js");
|
|
62
|
-
expect(bundles[1].path).toEqual("foo.js");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test("bundle resolves node async_hooks shim", async () => {
|
|
66
|
-
const fixtureDir = dirname + "/test_fixtures/js/project_with_node_shims";
|
|
67
|
-
const ctx = await getDefaultCtx();
|
|
68
|
-
const entryPoints = await entryPointsByEnvironment(ctx, fixtureDir);
|
|
69
|
-
const bundles = sorted(
|
|
70
|
-
(
|
|
71
|
-
await bundle({
|
|
72
|
-
ctx,
|
|
73
|
-
dir: fixtureDir,
|
|
74
|
-
entryPoints: entryPoints.isolate,
|
|
75
|
-
generateSourceMaps: false,
|
|
76
|
-
platform: "browser",
|
|
77
|
-
})
|
|
78
|
-
).modules,
|
|
79
|
-
(b) => b.path,
|
|
80
|
-
).filter((bundle) => !bundle.path.includes("_deps"));
|
|
81
|
-
|
|
82
|
-
expect(bundles).toHaveLength(1);
|
|
83
|
-
expect(bundles[0].path).toEqual("uses_node_shims.js");
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test("returns true when simple import httpRouter found", async () => {
|
|
87
|
-
const result = await doesImportConvexHttpRouter(`
|
|
88
|
-
import { httpRouter } from "convex/server";
|
|
89
|
-
|
|
90
|
-
export const val = 1;
|
|
91
|
-
`);
|
|
92
|
-
expect(result).toBeTruthy();
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
test("returns false when httpRouter is not imported", async () => {
|
|
96
|
-
const result = await doesImportConvexHttpRouter(`
|
|
97
|
-
export const val = 1;
|
|
98
|
-
`);
|
|
99
|
-
expect(result).toBeFalsy();
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
test("returns true when multiline import httpRouter found", async () => {
|
|
103
|
-
const result = await doesImportConvexHttpRouter(`
|
|
104
|
-
import {
|
|
105
|
-
httpRouter
|
|
106
|
-
} from "convex/server";
|
|
107
|
-
|
|
108
|
-
export const val = 1;
|
|
109
|
-
`);
|
|
110
|
-
expect(result).toBeTruthy();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
test("returns true when httpRouter is imported with alias", async () => {
|
|
114
|
-
const result = await doesImportConvexHttpRouter(`
|
|
115
|
-
import { httpRouter as router } from "convex/server";
|
|
116
|
-
|
|
117
|
-
export const val = 1;
|
|
118
|
-
`);
|
|
119
|
-
expect(result).toBeTruthy();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
test("returns true when httpRouter is imported with alias and multiline", async () => {
|
|
123
|
-
const result = await doesImportConvexHttpRouter(`
|
|
124
|
-
import {
|
|
125
|
-
httpRouter as router
|
|
126
|
-
} from "convex/server";
|
|
127
|
-
|
|
128
|
-
export const val = 1;
|
|
129
|
-
`);
|
|
130
|
-
expect(result).toBeTruthy();
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
test("returns true when multiple imports and httpRouter is imported", async () => {
|
|
134
|
-
const result = await doesImportConvexHttpRouter(`
|
|
135
|
-
import { cronJobs, httpRouter } from "convex/server";
|
|
136
|
-
|
|
137
|
-
export const val = 1;
|
|
138
|
-
`);
|
|
139
|
-
expect(result).toBeTruthy();
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
test("bundle warns about https.js|ts at top level", async () => {
|
|
143
|
-
const fixtureDir = dirname + "/test_fixtures/js/project_with_https";
|
|
144
|
-
const logSpy = vi.spyOn(process.stderr, "write");
|
|
145
|
-
await entryPoints(await getDefaultCtx(), fixtureDir);
|
|
146
|
-
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining("https"));
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
test("bundle does not warn about https.js|ts which is not at top level", async () => {
|
|
150
|
-
const fixtureDir =
|
|
151
|
-
dirname + "/test_fixtures/js/project_with_https_not_at_top_level";
|
|
152
|
-
const logSpy = vi.spyOn(process.stderr, "write");
|
|
153
|
-
await entryPoints(await getDefaultCtx(), fixtureDir);
|
|
154
|
-
expect(logSpy).toHaveBeenCalledTimes(0);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
test("bundle does not warn about https.js|ts which does not import httpRouter", async () => {
|
|
158
|
-
const fixtureDir =
|
|
159
|
-
dirname + "/test_fixtures/js/project_with_https_without_router";
|
|
160
|
-
const logSpy = vi.spyOn(process.stderr, "write");
|
|
161
|
-
await entryPoints(await getDefaultCtx(), fixtureDir);
|
|
162
|
-
expect(logSpy).toHaveBeenCalledTimes(0);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
test("use node regex", () => {
|
|
166
|
-
// Double quotes
|
|
167
|
-
expect('"use node";').toMatch(useNodeDirectiveRegex);
|
|
168
|
-
// Single quotes
|
|
169
|
-
expect("'use node';").toMatch(useNodeDirectiveRegex);
|
|
170
|
-
// No semi column
|
|
171
|
-
expect('"use node"').toMatch(useNodeDirectiveRegex);
|
|
172
|
-
expect("'use node'").toMatch(useNodeDirectiveRegex);
|
|
173
|
-
// Extra spaces
|
|
174
|
-
expect(' "use node" ').toMatch(useNodeDirectiveRegex);
|
|
175
|
-
expect(" 'use node' ").toMatch(useNodeDirectiveRegex);
|
|
176
|
-
|
|
177
|
-
// Nothing
|
|
178
|
-
expect("").not.toMatch(useNodeDirectiveRegex);
|
|
179
|
-
// No quotes
|
|
180
|
-
expect("use node").not.toMatch(useNodeDirectiveRegex);
|
|
181
|
-
// In a comment
|
|
182
|
-
expect('// "use node";').not.toMatch(useNodeDirectiveRegex);
|
|
183
|
-
// Typo
|
|
184
|
-
expect('"use nod";').not.toMatch(useNodeDirectiveRegex);
|
|
185
|
-
// Extra quotes
|
|
186
|
-
expect('""use node"";').not.toMatch(useNodeDirectiveRegex);
|
|
187
|
-
expect("''use node'';").not.toMatch(useNodeDirectiveRegex);
|
|
188
|
-
// Extra semi colons
|
|
189
|
-
expect('"use node";;;').not.toMatch(useNodeDirectiveRegex);
|
|
190
|
-
// Twice
|
|
191
|
-
expect('"use node";"use node";').not.toMatch(useNodeDirectiveRegex);
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
test("must use isolate", () => {
|
|
195
|
-
expect(mustBeIsolate("http.js")).toBeTruthy();
|
|
196
|
-
expect(mustBeIsolate("http.mjs")).toBeTruthy();
|
|
197
|
-
expect(mustBeIsolate("http.ts")).toBeTruthy();
|
|
198
|
-
expect(mustBeIsolate("crons.js")).toBeTruthy();
|
|
199
|
-
expect(mustBeIsolate("crons.cjs")).toBeTruthy();
|
|
200
|
-
expect(mustBeIsolate("crons.ts")).toBeTruthy();
|
|
201
|
-
expect(mustBeIsolate("schema.js")).toBeTruthy();
|
|
202
|
-
expect(mustBeIsolate("schema.jsx")).toBeTruthy();
|
|
203
|
-
expect(mustBeIsolate("schema.ts")).toBeTruthy();
|
|
204
|
-
expect(mustBeIsolate("schema.js")).toBeTruthy();
|
|
205
|
-
|
|
206
|
-
expect(mustBeIsolate("http.sample.js")).not.toBeTruthy();
|
|
207
|
-
expect(mustBeIsolate("https.js")).not.toBeTruthy();
|
|
208
|
-
expect(mustBeIsolate("schema2.js")).not.toBeTruthy();
|
|
209
|
-
expect(mustBeIsolate("schema/http.js")).not.toBeTruthy();
|
|
210
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const a = null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const val = 1;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { test, expect } from "vitest";
|
|
2
|
-
import { importPath, moduleIdentifier } from "./api.js";
|
|
3
|
-
|
|
4
|
-
test("importPath", () => {
|
|
5
|
-
expect(importPath("foo.ts")).toEqual("foo");
|
|
6
|
-
expect(importPath("foo.tsx")).toEqual("foo");
|
|
7
|
-
expect(importPath("foo\\bar.ts")).toEqual("foo/bar");
|
|
8
|
-
expect(importPath("foo/bar.ts")).toEqual("foo/bar");
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test("moduleIdentifier", () => {
|
|
12
|
-
expect(moduleIdentifier("foo.ts")).toEqual("foo");
|
|
13
|
-
// This mapping is ambiguous! This is a codegen implementation detail so
|
|
14
|
-
// this can be changed without requiring changes beyond running codegen.
|
|
15
|
-
expect(moduleIdentifier("foo/bar.ts")).toEqual("foo_bar");
|
|
16
|
-
expect(moduleIdentifier("foo_bar.ts")).toEqual("foo_bar");
|
|
17
|
-
expect(moduleIdentifier("foo-bar.ts")).toEqual("foo_bar");
|
|
18
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "vitest";
|
|
2
|
-
import { compareModulePaths } from "./common.js";
|
|
3
|
-
|
|
4
|
-
describe("compareModulePaths", () => {
|
|
5
|
-
test("matches default sort order for forward slash paths", () => {
|
|
6
|
-
const paths = ["fooBaz.ts", "foo/bar.ts", "foo.ts"];
|
|
7
|
-
expect([...paths].sort(compareModulePaths)).toEqual([...paths].sort());
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test("orders Windows paths identically to their POSIX equivalents", () => {
|
|
11
|
-
const posixPaths = ["fooBaz.ts", "foo/bar.ts", "foo.ts"];
|
|
12
|
-
const windowsPaths = posixPaths.map((p) => p.replace(/\//g, "\\"));
|
|
13
|
-
|
|
14
|
-
const sortedPosix = [...posixPaths].sort(compareModulePaths);
|
|
15
|
-
const sortedWindows = [...windowsPaths].sort(compareModulePaths);
|
|
16
|
-
|
|
17
|
-
expect(sortedPosix).toEqual(["foo.ts", "foo/bar.ts", "fooBaz.ts"]);
|
|
18
|
-
expect(sortedWindows.map((p) => p.replace(/\\/g, "/"))).toEqual(
|
|
19
|
-
sortedPosix,
|
|
20
|
-
);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("default sort diverges on this input, demonstrating the bug", () => {
|
|
24
|
-
// "/" (0x2F) sorts before letters while "\" (0x5C) sorts after them,
|
|
25
|
-
// so the OS-native forms of the same file set sort differently.
|
|
26
|
-
const windowsPaths = ["fooBaz.ts", "foo\\bar.ts", "foo.ts"];
|
|
27
|
-
expect([...windowsPaths].sort()).toEqual([
|
|
28
|
-
"foo.ts",
|
|
29
|
-
"fooBaz.ts",
|
|
30
|
-
"foo\\bar.ts",
|
|
31
|
-
]);
|
|
32
|
-
expect([...windowsPaths].sort(compareModulePaths)).toEqual([
|
|
33
|
-
"foo.ts",
|
|
34
|
-
"foo\\bar.ts",
|
|
35
|
-
"fooBaz.ts",
|
|
36
|
-
]);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("sorts nested directories before longer sibling file names", () => {
|
|
40
|
-
const paths = ["a/b/c.ts", "aZ.ts", "a.ts", "a/b.ts"];
|
|
41
|
-
expect([...paths].sort(compareModulePaths)).toEqual([
|
|
42
|
-
"a.ts",
|
|
43
|
-
"a/b.ts",
|
|
44
|
-
"a/b/c.ts",
|
|
45
|
-
"aZ.ts",
|
|
46
|
-
]);
|
|
47
|
-
const windows = paths.map((p) => p.replace(/\//g, "\\"));
|
|
48
|
-
expect(
|
|
49
|
-
[...windows].sort(compareModulePaths).map((p) => p.replace(/\\/g, "/")),
|
|
50
|
-
).toEqual(["a.ts", "a/b.ts", "a/b/c.ts", "aZ.ts"]);
|
|
51
|
-
});
|
|
52
|
-
});
|