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
package/src/server/query.test.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import { GenericId } from "../values/index.js";
|
|
3
|
-
import { test } from "vitest";
|
|
4
|
-
import { assert, Equals } from "../test/type_testing.js";
|
|
5
|
-
import { GenericDatabaseReader } from "./database.js";
|
|
6
|
-
import { SystemDataModel, SystemTableNames } from "./schema.js";
|
|
7
|
-
import { Id } from "../values/value.js";
|
|
8
|
-
import { TableNamesInDataModel } from "./data_model.js";
|
|
9
|
-
|
|
10
|
-
type Message = {
|
|
11
|
-
body: string;
|
|
12
|
-
_id: GenericId<"tableName">;
|
|
13
|
-
};
|
|
14
|
-
type DataModel = {
|
|
15
|
-
messages: {
|
|
16
|
-
document: Message;
|
|
17
|
-
fieldPaths: "body" | "_id";
|
|
18
|
-
indexes: {};
|
|
19
|
-
searchIndexes: {};
|
|
20
|
-
vectorIndexes: {};
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
type DB = GenericDatabaseReader<DataModel>;
|
|
24
|
-
test("collect returns the correct types", () => {
|
|
25
|
-
function collect(db: DB) {
|
|
26
|
-
return db.query("messages").collect();
|
|
27
|
-
}
|
|
28
|
-
type Result = ReturnType<typeof collect>;
|
|
29
|
-
type Expected = Promise<Message[]>;
|
|
30
|
-
assert<Equals<Result, Expected>>();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("take returns the correct types", () => {
|
|
34
|
-
function take(db: DB) {
|
|
35
|
-
return db.query("messages").take(5);
|
|
36
|
-
}
|
|
37
|
-
type Result = ReturnType<typeof take>;
|
|
38
|
-
type Expected = Promise<Message[]>;
|
|
39
|
-
assert<Equals<Result, Expected>>();
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test("first returns the correct types", () => {
|
|
43
|
-
function first(db: DB) {
|
|
44
|
-
return db.query("messages").first();
|
|
45
|
-
}
|
|
46
|
-
type Result = ReturnType<typeof first>;
|
|
47
|
-
type Expected = Promise<Message | null>;
|
|
48
|
-
assert<Equals<Result, Expected>>();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test("unique returns the correct types", () => {
|
|
52
|
-
function unique(db: DB) {
|
|
53
|
-
return db.query("messages").unique();
|
|
54
|
-
}
|
|
55
|
-
type Result = ReturnType<typeof unique>;
|
|
56
|
-
type Expected = Promise<Message | null>;
|
|
57
|
-
assert<Equals<Result, Expected>>();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test("fullTableScan returns the correct types", () => {
|
|
61
|
-
function fullTableScan(db: DB) {
|
|
62
|
-
return db.query("messages").fullTableScan().collect();
|
|
63
|
-
}
|
|
64
|
-
type Result = ReturnType<typeof fullTableScan>;
|
|
65
|
-
type Expected = Promise<Message[]>;
|
|
66
|
-
assert<Equals<Result, Expected>>();
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test("order and filter don't change the return type", () => {
|
|
70
|
-
function orderAndFilter(db: DB) {
|
|
71
|
-
return db
|
|
72
|
-
.query("messages")
|
|
73
|
-
.order("desc")
|
|
74
|
-
.filter((q) => q.eq(q.field("body"), "Hello"))
|
|
75
|
-
.collect();
|
|
76
|
-
}
|
|
77
|
-
type Result = ReturnType<typeof orderAndFilter>;
|
|
78
|
-
type Expected = Promise<Message[]>;
|
|
79
|
-
assert<Equals<Result, Expected>>();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("can query() from system tables", () => {
|
|
83
|
-
function collect(db: DB, tableName: SystemTableNames) {
|
|
84
|
-
return db.system.query(tableName).collect();
|
|
85
|
-
}
|
|
86
|
-
type Result = ReturnType<typeof collect>;
|
|
87
|
-
type Expected = Promise<SystemDataModel[SystemTableNames]["document"][]>;
|
|
88
|
-
assert<Equals<Result, Expected>>();
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("can get() from system tables", () => {
|
|
92
|
-
function get(db: DB, tableId: Id<SystemTableNames>) {
|
|
93
|
-
return db.system.get(tableId);
|
|
94
|
-
}
|
|
95
|
-
type Result = ReturnType<typeof get>;
|
|
96
|
-
type Expected = Promise<SystemDataModel[SystemTableNames]["document"] | null>;
|
|
97
|
-
assert<Equals<Result, Expected>>();
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
test("system-level database reader can only get() from system tables", () => {
|
|
101
|
-
function get(db: DB, tableId: Id<TableNamesInDataModel<DataModel>>) {
|
|
102
|
-
// @ts-expect-error We cannot query user tables from system GenericDatabaseReader
|
|
103
|
-
return db.system.get(tableId);
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test("system-level database reader can only query() from system tables", () => {
|
|
108
|
-
function collect(db: DB, tableName: TableNamesInDataModel<DataModel>) {
|
|
109
|
-
// @ts-expect-error We cannot query user tables from system GenericDatabaseReader
|
|
110
|
-
return db.system.query(tableName).collect();
|
|
111
|
-
}
|
|
112
|
-
});
|
|
@@ -1,589 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
import { test, describe, expect } from "vitest";
|
|
3
|
-
import { assert, assertFalse, Equals } from "../test/type_testing.js";
|
|
4
|
-
import { v } from "../values/validator.js";
|
|
5
|
-
import {
|
|
6
|
-
ActionBuilder,
|
|
7
|
-
ApiFromModules,
|
|
8
|
-
DefaultFunctionArgs,
|
|
9
|
-
GenericDataModel,
|
|
10
|
-
GenericMutationCtx,
|
|
11
|
-
GenericQueryCtx,
|
|
12
|
-
QueryBuilder,
|
|
13
|
-
actionGeneric,
|
|
14
|
-
mutationGeneric,
|
|
15
|
-
queryGeneric,
|
|
16
|
-
} from "./index.js";
|
|
17
|
-
import { EmptyObject, MutationBuilder } from "./registration.js";
|
|
18
|
-
|
|
19
|
-
describe("argument inference", () => {
|
|
20
|
-
// Test with mutation, but all the wrappers work the same way.
|
|
21
|
-
const mutation: MutationBuilder<any, "public"> = (() => {
|
|
22
|
-
// Intentional noop. We're only testing the type
|
|
23
|
-
}) as any;
|
|
24
|
-
|
|
25
|
-
const module = {
|
|
26
|
-
inlineNoArg: mutation(() => "result"),
|
|
27
|
-
inlineUntypedArg: mutation((_ctx, { _arg }) => "result"),
|
|
28
|
-
inlineTypedArg: mutation((_ctx, { _arg }: { _arg: string }) => "result"),
|
|
29
|
-
|
|
30
|
-
// There are unusual syntaxes.
|
|
31
|
-
inlineUntypedDefaultArg: mutation(
|
|
32
|
-
(_ctx, { _arg } = { _arg: 1 }) => "result",
|
|
33
|
-
),
|
|
34
|
-
inlineTypedDefaultArg: mutation(
|
|
35
|
-
// @ts-expect-error This syntax has never been allowed.
|
|
36
|
-
(_ctx, { _arg }: { _arg: string } = { _arg: "default" }) => "result",
|
|
37
|
-
),
|
|
38
|
-
inlineTypedOptionalDefaultArg: mutation(
|
|
39
|
-
(_ctx, { _arg }: { _arg?: string } = { _arg: "default" }) => "result",
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
configNoArg: mutation({
|
|
43
|
-
handler: () => "result",
|
|
44
|
-
}),
|
|
45
|
-
configValidatorNoArg: mutation({
|
|
46
|
-
args: {},
|
|
47
|
-
handler: () => "result",
|
|
48
|
-
}),
|
|
49
|
-
configUntypedArg: mutation({
|
|
50
|
-
handler: (_, { arg }) => {
|
|
51
|
-
assert<Equals<typeof arg, unknown>>;
|
|
52
|
-
return "result";
|
|
53
|
-
},
|
|
54
|
-
}),
|
|
55
|
-
configTypedArg: mutation({
|
|
56
|
-
handler: (_, { arg }: { arg: string }) => {
|
|
57
|
-
assert<Equals<typeof arg, string>>;
|
|
58
|
-
return "result";
|
|
59
|
-
},
|
|
60
|
-
}),
|
|
61
|
-
configOptionalValidatorUntypedArg: mutation({
|
|
62
|
-
args: {
|
|
63
|
-
arg: v.optional(v.string()),
|
|
64
|
-
},
|
|
65
|
-
handler: (_, { arg }) => {
|
|
66
|
-
assert<Equals<typeof arg, string | undefined>>;
|
|
67
|
-
return "result";
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
configValidatorUntypedArg: mutation({
|
|
71
|
-
args: {
|
|
72
|
-
arg: v.string(),
|
|
73
|
-
},
|
|
74
|
-
handler: (_, { arg }: { arg: string }) => {
|
|
75
|
-
assert<Equals<typeof arg, string>>;
|
|
76
|
-
return "result";
|
|
77
|
-
},
|
|
78
|
-
}),
|
|
79
|
-
configValidatorTypedArg: mutation({
|
|
80
|
-
args: {
|
|
81
|
-
arg: v.string(),
|
|
82
|
-
},
|
|
83
|
-
handler: (_, { arg }: { arg: string }) => {
|
|
84
|
-
assert<Equals<typeof arg, string>>;
|
|
85
|
-
return "result";
|
|
86
|
-
},
|
|
87
|
-
}),
|
|
88
|
-
configValidatorMismatchedTypedArg: mutation({
|
|
89
|
-
args: {
|
|
90
|
-
_arg: v.number(),
|
|
91
|
-
},
|
|
92
|
-
// @ts-expect-error The arg type mismatches
|
|
93
|
-
handler: (_, { _arg }: { _arg: string }) => {
|
|
94
|
-
return "result";
|
|
95
|
-
},
|
|
96
|
-
}),
|
|
97
|
-
configValidatorReturn: mutation({
|
|
98
|
-
args: {
|
|
99
|
-
_arg: v.number(),
|
|
100
|
-
},
|
|
101
|
-
returns: v.number(),
|
|
102
|
-
// @ts-expect-error The return type mismatches
|
|
103
|
-
handler: (_, { _arg }) => {
|
|
104
|
-
return "result";
|
|
105
|
-
},
|
|
106
|
-
}),
|
|
107
|
-
|
|
108
|
-
// These are unusual syntaxes. We'd like to break some of them.
|
|
109
|
-
// Let's document them here so it's clear when we do that.
|
|
110
|
-
configUntypedDefaultArg: mutation({
|
|
111
|
-
handler: (_, { arg } = { arg: "default" }) => {
|
|
112
|
-
assert<Equals<typeof arg, unknown>>;
|
|
113
|
-
return "result";
|
|
114
|
-
},
|
|
115
|
-
}),
|
|
116
|
-
configTypedDefaultArg: mutation({
|
|
117
|
-
// @ts-expect-error This syntax has never been allowed.
|
|
118
|
-
handler: (_, { arg }: { arg: string } = { arg: "default" }) => {
|
|
119
|
-
assert<Equals<typeof arg, string>>;
|
|
120
|
-
return "result";
|
|
121
|
-
},
|
|
122
|
-
}),
|
|
123
|
-
configTypedOptionalDefaultArg: mutation({
|
|
124
|
-
// This syntax is incidentally allowed, it is not supported.
|
|
125
|
-
handler: (_, { arg }: { arg?: string } = { arg: "default" }) => {
|
|
126
|
-
assert<Equals<typeof arg, string | undefined>>;
|
|
127
|
-
return "result";
|
|
128
|
-
},
|
|
129
|
-
}),
|
|
130
|
-
configValidatorUntypedDefaultArg: mutation({
|
|
131
|
-
args: {
|
|
132
|
-
arg: v.string(),
|
|
133
|
-
},
|
|
134
|
-
handler: (_, { arg } = { arg: "default" }) => {
|
|
135
|
-
assert<Equals<typeof arg, string>>;
|
|
136
|
-
return "result";
|
|
137
|
-
},
|
|
138
|
-
}),
|
|
139
|
-
configValidatorTypedDefaultArg: mutation({
|
|
140
|
-
args: {
|
|
141
|
-
arg: v.string(),
|
|
142
|
-
},
|
|
143
|
-
handler: (_, { arg }: { arg: string } = { arg: "default" }) => {
|
|
144
|
-
assert<Equals<typeof arg, string>>;
|
|
145
|
-
return "result";
|
|
146
|
-
},
|
|
147
|
-
}),
|
|
148
|
-
configValidatorTypedOptionalDefaultArg: mutation({
|
|
149
|
-
args: {
|
|
150
|
-
arg: v.string(),
|
|
151
|
-
},
|
|
152
|
-
handler: (_, { arg }: { arg?: string } = { arg: "default" }) => {
|
|
153
|
-
assert<Equals<typeof arg, string | undefined>>;
|
|
154
|
-
return "result";
|
|
155
|
-
},
|
|
156
|
-
}),
|
|
157
|
-
};
|
|
158
|
-
type API = ApiFromModules<{ module: typeof module }>;
|
|
159
|
-
|
|
160
|
-
test("inline with no arg", () => {
|
|
161
|
-
type Args = API["module"]["inlineNoArg"]["_args"];
|
|
162
|
-
assert<Equals<Args, EmptyObject>>();
|
|
163
|
-
type ReturnType = API["module"]["inlineNoArg"]["_returnType"];
|
|
164
|
-
assert<Equals<ReturnType, string>>();
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
test("inline with untyped arg", () => {
|
|
168
|
-
type Args = API["module"]["inlineUntypedArg"]["_args"];
|
|
169
|
-
type ExpectedArgs = DefaultFunctionArgs;
|
|
170
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
test("inline with typed arg", () => {
|
|
174
|
-
type Args = API["module"]["inlineTypedArg"]["_args"];
|
|
175
|
-
type ExpectedArgs = { _arg: string };
|
|
176
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// This is not a very useful type (allows any key) but let's
|
|
180
|
-
// test it so we know if it's changing.
|
|
181
|
-
test("inline with untyped arg with default value", () => {
|
|
182
|
-
type Args = API["module"]["inlineUntypedDefaultArg"]["_args"];
|
|
183
|
-
type ExpectedArgs = DefaultFunctionArgs | EmptyObject;
|
|
184
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
// This syntax is a type error where it is defined so it falls back.
|
|
188
|
-
test("inline with typed arg with default value", () => {
|
|
189
|
-
type Args = API["module"]["inlineTypedDefaultArg"]["_args"];
|
|
190
|
-
type ExpectedArgs = Record<string, unknown>;
|
|
191
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// This is not a very useful type (allows any key) but add let's
|
|
195
|
-
// test it so we know if it's changing.
|
|
196
|
-
test("inline with typed arg with optional default value", () => {
|
|
197
|
-
type Args = API["module"]["inlineTypedOptionalDefaultArg"]["_args"];
|
|
198
|
-
type ExpectedArgs = DefaultFunctionArgs | EmptyObject;
|
|
199
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
test("config with no arg", () => {
|
|
203
|
-
type Args = API["module"]["configNoArg"]["_args"];
|
|
204
|
-
type ExpectedArgs = EmptyObject;
|
|
205
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
test("config with no arg and validator", () => {
|
|
209
|
-
type Args = API["module"]["configValidatorNoArg"]["_args"];
|
|
210
|
-
type ExpectedArgs = {};
|
|
211
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
test("config with untyped arg", () => {
|
|
215
|
-
type Args = API["module"]["configUntypedArg"]["_args"];
|
|
216
|
-
type ExpectedArgs = DefaultFunctionArgs;
|
|
217
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
test("config with typed arg", () => {
|
|
221
|
-
type Args = API["module"]["configTypedArg"]["_args"];
|
|
222
|
-
type ExpectedArgs = { arg: string };
|
|
223
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
test("config with untyped arg and validator", () => {
|
|
227
|
-
type Args = API["module"]["configValidatorUntypedArg"]["_args"];
|
|
228
|
-
type ExpectedArgs = { arg: string };
|
|
229
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
test("config with untyped arg and optional validator", () => {
|
|
233
|
-
type Args = API["module"]["configOptionalValidatorUntypedArg"]["_args"];
|
|
234
|
-
type ExpectedArgs = { arg?: string };
|
|
235
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
test("config with typed arg and validator", () => {
|
|
239
|
-
type Args = API["module"]["configValidatorTypedArg"]["_args"];
|
|
240
|
-
type ExpectedArgs = { arg: string };
|
|
241
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
test("config with untyped arg and a default", () => {
|
|
245
|
-
type Args = API["module"]["configUntypedDefaultArg"]["_args"];
|
|
246
|
-
// This is not a very useful type
|
|
247
|
-
type ExpectedArgs = DefaultFunctionArgs | EmptyObject;
|
|
248
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
test("config with typed arg and a default", () => {
|
|
252
|
-
type Args = API["module"]["configTypedDefaultArg"]["_args"];
|
|
253
|
-
// This is a type error at the definition site so this is the fallback.
|
|
254
|
-
type ExpectedArgs = Record<string, unknown>;
|
|
255
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
256
|
-
});
|
|
257
|
-
|
|
258
|
-
test("config with typed optional arg and a default", () => {
|
|
259
|
-
type Args = API["module"]["configTypedOptionalDefaultArg"]["_args"];
|
|
260
|
-
// This is not a very useful type
|
|
261
|
-
type ExpectedArgs = DefaultFunctionArgs | EmptyObject;
|
|
262
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
test("config with untyped arg and a validator and a default", () => {
|
|
266
|
-
type Args = API["module"]["configValidatorUntypedDefaultArg"]["_args"];
|
|
267
|
-
type ExpectedArgs = { arg: string };
|
|
268
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
269
|
-
});
|
|
270
|
-
|
|
271
|
-
test("config with typed arg and a validator and a default", () => {
|
|
272
|
-
type Args = API["module"]["configValidatorTypedDefaultArg"]["_args"];
|
|
273
|
-
type ExpectedArgs = { arg: string };
|
|
274
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
test("config with typed optional arg and a validator and a default", () => {
|
|
278
|
-
type Args =
|
|
279
|
-
API["module"]["configValidatorTypedOptionalDefaultArg"]["_args"];
|
|
280
|
-
type ExpectedArgs = { arg: string };
|
|
281
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
282
|
-
});
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
describe("argument inference 2: args and validators", () => {
|
|
286
|
-
// Test with mutation, but all the wrappers work the same way.
|
|
287
|
-
const mutation: MutationBuilder<any, "public"> = (() => {
|
|
288
|
-
// Intentional noop. We're only testing the type
|
|
289
|
-
}) as any;
|
|
290
|
-
|
|
291
|
-
const module = {
|
|
292
|
-
argsSubtypeOfArgsValidator: mutation({
|
|
293
|
-
args: { foo: v.string() },
|
|
294
|
-
handler: (_, { foo }: { foo: string | number }) => 1,
|
|
295
|
-
}),
|
|
296
|
-
argsSupertypeOfArgsValidator: mutation({
|
|
297
|
-
args: { foo: v.union(v.string(), v.number()) },
|
|
298
|
-
handler: (_, { foo }: { foo: string }) => 1,
|
|
299
|
-
}),
|
|
300
|
-
argsPartiallyIntersectArgsValidator: mutation({
|
|
301
|
-
args: { foo: v.union(v.string(), v.number()) },
|
|
302
|
-
// @ts-expect-error when neither type is a subtype of the other, error
|
|
303
|
-
handler: (_, { foo }: { foo: string | Array<number> }) => 1,
|
|
304
|
-
}),
|
|
305
|
-
argsDontIntersectArgsValidator: mutation({
|
|
306
|
-
args: { foo: v.string() },
|
|
307
|
-
// @ts-expect-error when neither type is a subtype of the other, error
|
|
308
|
-
handler: (_, { foo }: { foo: number }) => 1,
|
|
309
|
-
}),
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
type API = ApiFromModules<{ module: typeof module }>;
|
|
313
|
-
|
|
314
|
-
// If the validator is more specific, that's the type that will be used.
|
|
315
|
-
// That seems right.
|
|
316
|
-
test("Handler args are a subtype of args validator", () => {
|
|
317
|
-
type Args = API["module"]["argsSubtypeOfArgsValidator"]["_args"];
|
|
318
|
-
assert<Equals<Args, { foo: string }>>();
|
|
319
|
-
});
|
|
320
|
-
// If the argument type is more specific, that's the type used.
|
|
321
|
-
// It would be nice to change this. If the validator type
|
|
322
|
-
// could entirely determine the inferred type on the client
|
|
323
|
-
// then you could skip the function for inference!
|
|
324
|
-
test("Handler args are a supertype of args validator", () => {
|
|
325
|
-
type Args = API["module"]["argsSupertypeOfArgsValidator"]["_args"];
|
|
326
|
-
assert<Equals<Args, { foo: string }>>();
|
|
327
|
-
});
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
describe("argument inference 3: outputs and validators", () => {
|
|
331
|
-
// Test with mutation, but all the wrappers work the same way.
|
|
332
|
-
const mutation: MutationBuilder<any, "public"> = (() => {
|
|
333
|
-
// Intentional noop. We're only testing the type
|
|
334
|
-
}) as any;
|
|
335
|
-
|
|
336
|
-
const module = {
|
|
337
|
-
returnSubtypeOfReturnsValidator: mutation({
|
|
338
|
-
returns: v.string(),
|
|
339
|
-
handler: (_) => "a" as const,
|
|
340
|
-
}),
|
|
341
|
-
returnSupertypeOfReturnsValidator: mutation({
|
|
342
|
-
returns: v.literal("a"),
|
|
343
|
-
// @ts-expect-error when return value is not a subtype of validator, error
|
|
344
|
-
handler: (_) => "b" as "b" | "a",
|
|
345
|
-
}),
|
|
346
|
-
returnPartiallyIntersectReturnsValidator: mutation({
|
|
347
|
-
returns: v.union(v.literal("a"), v.literal("b")),
|
|
348
|
-
// @ts-expect-error when return value is not a subtype of validator, error
|
|
349
|
-
handler: (_) => "b" as "b" | "c",
|
|
350
|
-
}),
|
|
351
|
-
returnDoesntIntersectReturnsValidator: mutation({
|
|
352
|
-
returns: v.literal("a"),
|
|
353
|
-
// @ts-expect-error when neither type is a subtype of the other, error
|
|
354
|
-
handler: (_) => "b" as const,
|
|
355
|
-
}),
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
type API = ApiFromModules<{ module: typeof module }>;
|
|
359
|
-
|
|
360
|
-
// Output validators seem to work about right.
|
|
361
|
-
test("Handler return value is a subtype of returns validator", () => {
|
|
362
|
-
type ReturnType =
|
|
363
|
-
API["module"]["returnSubtypeOfReturnsValidator"]["_returnType"];
|
|
364
|
-
assert<Equals<ReturnType, "a">>();
|
|
365
|
-
});
|
|
366
|
-
test("Handler return value is a supertype of returns validator", () => {
|
|
367
|
-
type ReturnType =
|
|
368
|
-
API["module"]["returnSupertypeOfReturnsValidator"]["_returnType"];
|
|
369
|
-
assert<Equals<ReturnType, any>>();
|
|
370
|
-
});
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
describe("argument and return value validators can be objects or validators", () => {
|
|
374
|
-
// Test with mutation, we aim for all the wrappers work the same way.
|
|
375
|
-
const mutation: MutationBuilder<any, "public"> = mutationGeneric;
|
|
376
|
-
const query: QueryBuilder<any, "public"> = queryGeneric;
|
|
377
|
-
const action: ActionBuilder<any, "public"> = actionGeneric;
|
|
378
|
-
|
|
379
|
-
const module = {
|
|
380
|
-
configArgsObject: mutation({
|
|
381
|
-
args: {
|
|
382
|
-
arg: v.string(),
|
|
383
|
-
},
|
|
384
|
-
handler: (_, args) => {
|
|
385
|
-
assert<Equals<(typeof args)["arg"], string>>;
|
|
386
|
-
return "result";
|
|
387
|
-
},
|
|
388
|
-
}),
|
|
389
|
-
configArgsValidatorIsNotSupported: mutation({
|
|
390
|
-
args: v.object({
|
|
391
|
-
arg: v.string(),
|
|
392
|
-
}),
|
|
393
|
-
handler: (_, args) => {
|
|
394
|
-
assert<Equals<(typeof args)["arg"], string>>;
|
|
395
|
-
return "result";
|
|
396
|
-
},
|
|
397
|
-
}),
|
|
398
|
-
configOutputObject: mutation({
|
|
399
|
-
returns: {
|
|
400
|
-
arg: v.string(),
|
|
401
|
-
},
|
|
402
|
-
handler: () => {
|
|
403
|
-
return { arg: "result" };
|
|
404
|
-
},
|
|
405
|
-
}),
|
|
406
|
-
configOutputValidator: mutation({
|
|
407
|
-
returns: v.object({
|
|
408
|
-
arg: v.string(),
|
|
409
|
-
}),
|
|
410
|
-
handler: () => {
|
|
411
|
-
return { arg: "result" };
|
|
412
|
-
},
|
|
413
|
-
}),
|
|
414
|
-
|
|
415
|
-
// test queries and actions just a bit too
|
|
416
|
-
q1: query({
|
|
417
|
-
args: v.object({
|
|
418
|
-
arg: v.string(),
|
|
419
|
-
}),
|
|
420
|
-
returns: { arg: v.string() },
|
|
421
|
-
handler: (_, { arg }) => {
|
|
422
|
-
return { arg: arg };
|
|
423
|
-
},
|
|
424
|
-
}),
|
|
425
|
-
|
|
426
|
-
a1: action({
|
|
427
|
-
args: v.object({
|
|
428
|
-
arg: v.string(),
|
|
429
|
-
}),
|
|
430
|
-
returns: { arg: v.string() },
|
|
431
|
-
handler: (_, { arg }) => {
|
|
432
|
-
return { arg: arg };
|
|
433
|
-
},
|
|
434
|
-
}),
|
|
435
|
-
|
|
436
|
-
queryAsync: query({
|
|
437
|
-
args: v.object({
|
|
438
|
-
arg: v.string(),
|
|
439
|
-
}),
|
|
440
|
-
returns: { arg: v.string() },
|
|
441
|
-
handler: async (_, { arg }) => {
|
|
442
|
-
return { arg: arg };
|
|
443
|
-
},
|
|
444
|
-
}),
|
|
445
|
-
|
|
446
|
-
mutationAsync: mutation({
|
|
447
|
-
args: v.object({
|
|
448
|
-
arg: v.string(),
|
|
449
|
-
}),
|
|
450
|
-
returns: { arg: v.string() },
|
|
451
|
-
handler: async (_, { arg }) => {
|
|
452
|
-
return { arg: arg };
|
|
453
|
-
},
|
|
454
|
-
}),
|
|
455
|
-
|
|
456
|
-
actionAsync: action({
|
|
457
|
-
args: v.object({
|
|
458
|
-
arg: v.string(),
|
|
459
|
-
}),
|
|
460
|
-
returns: { arg: v.string() },
|
|
461
|
-
handler: async (_, { arg }) => {
|
|
462
|
-
return { arg: arg };
|
|
463
|
-
},
|
|
464
|
-
}),
|
|
465
|
-
|
|
466
|
-
// This is syntx that we no longer want to support when typechecking because they result in undefined behavior.
|
|
467
|
-
mutationNoOptionalValidators: mutation({
|
|
468
|
-
// @ts-expect-error Optional validators are not supported at the top level
|
|
469
|
-
args: v.optional(v.string()),
|
|
470
|
-
// @ts-expect-error Optional validators are not supported at the top level
|
|
471
|
-
returns: v.optional(v.string()),
|
|
472
|
-
handler: () => {
|
|
473
|
-
return "result";
|
|
474
|
-
},
|
|
475
|
-
}),
|
|
476
|
-
queryNoOptionalValidators: query({
|
|
477
|
-
// @ts-expect-error Optional validators are not supported at the top level
|
|
478
|
-
args: v.optional(v.string()),
|
|
479
|
-
// @ts-expect-error Optional validators are not supported at the top level
|
|
480
|
-
returns: v.optional(v.string()),
|
|
481
|
-
handler: () => {
|
|
482
|
-
return "result";
|
|
483
|
-
},
|
|
484
|
-
}),
|
|
485
|
-
actionNoOptionalValidators: action({
|
|
486
|
-
// @ts-expect-error Optional validators are not supported at the top level
|
|
487
|
-
args: v.optional(v.string()),
|
|
488
|
-
// @ts-expect-error Optional validators are not supported at the top level
|
|
489
|
-
returns: v.optional(v.string()),
|
|
490
|
-
handler: () => {
|
|
491
|
-
return "result";
|
|
492
|
-
},
|
|
493
|
-
}),
|
|
494
|
-
};
|
|
495
|
-
type API = ApiFromModules<{ module: typeof module }>;
|
|
496
|
-
|
|
497
|
-
const expectedArgsExport = {
|
|
498
|
-
type: "object",
|
|
499
|
-
value: {
|
|
500
|
-
arg: {
|
|
501
|
-
fieldType: {
|
|
502
|
-
type: "string",
|
|
503
|
-
},
|
|
504
|
-
optional: false,
|
|
505
|
-
},
|
|
506
|
-
},
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
const expectedReturnsExport = {
|
|
510
|
-
type: "object",
|
|
511
|
-
value: {
|
|
512
|
-
arg: {
|
|
513
|
-
fieldType: {
|
|
514
|
-
type: "string",
|
|
515
|
-
},
|
|
516
|
-
optional: false,
|
|
517
|
-
},
|
|
518
|
-
},
|
|
519
|
-
};
|
|
520
|
-
|
|
521
|
-
test("config with args validator", () => {
|
|
522
|
-
type Args = API["module"]["configArgsObject"]["_args"];
|
|
523
|
-
type ExpectedArgs = { arg: string };
|
|
524
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
525
|
-
const argsString = module.configArgsObject.exportArgs();
|
|
526
|
-
expect(JSON.parse(argsString)).toEqual(expectedArgsExport);
|
|
527
|
-
});
|
|
528
|
-
|
|
529
|
-
test("config with args object", () => {
|
|
530
|
-
type Args = API["module"]["configArgsValidatorIsNotSupported"]["_args"];
|
|
531
|
-
type ExpectedArgs = { arg: string };
|
|
532
|
-
assert<Equals<Args, ExpectedArgs>>;
|
|
533
|
-
const argsString = module.configArgsObject.exportArgs();
|
|
534
|
-
expect(JSON.parse(argsString)).toEqual(expectedArgsExport);
|
|
535
|
-
});
|
|
536
|
-
|
|
537
|
-
test("config with output validator", () => {
|
|
538
|
-
type ReturnType = API["module"]["configOutputObject"]["_returnType"];
|
|
539
|
-
type Expected = { arg: string };
|
|
540
|
-
assert<Equals<ReturnType, Expected>>;
|
|
541
|
-
const returnString = module.configOutputObject.exportReturns();
|
|
542
|
-
expect(JSON.parse(returnString)).toEqual(expectedReturnsExport);
|
|
543
|
-
});
|
|
544
|
-
|
|
545
|
-
test("config with output object", () => {
|
|
546
|
-
type ReturnType = API["module"]["configOutputValidator"]["_returnType"];
|
|
547
|
-
type Expected = { arg: string };
|
|
548
|
-
assert<Equals<ReturnType, Expected>>;
|
|
549
|
-
const returnString = module.configOutputValidator.exportReturns();
|
|
550
|
-
expect(JSON.parse(returnString)).toEqual(expectedReturnsExport);
|
|
551
|
-
});
|
|
552
|
-
|
|
553
|
-
test("queries", () => {
|
|
554
|
-
type ReturnType = API["module"]["q1"]["_returnType"];
|
|
555
|
-
type Expected = { arg: string };
|
|
556
|
-
assert<Equals<ReturnType, Expected>>;
|
|
557
|
-
const returnString = module.configOutputValidator.exportReturns();
|
|
558
|
-
expect(JSON.parse(returnString)).toEqual(expectedReturnsExport);
|
|
559
|
-
});
|
|
560
|
-
|
|
561
|
-
test("actions", () => {
|
|
562
|
-
type ReturnType = API["module"]["configOutputValidator"]["_returnType"];
|
|
563
|
-
type Expected = { arg: string };
|
|
564
|
-
assert<Equals<ReturnType, Expected>>;
|
|
565
|
-
const returnString = module.configOutputValidator.exportReturns();
|
|
566
|
-
expect(JSON.parse(returnString)).toEqual(expectedReturnsExport);
|
|
567
|
-
});
|
|
568
|
-
});
|
|
569
|
-
|
|
570
|
-
describe("useStaleSnapshot availability", () => {
|
|
571
|
-
type MutationRunQueryOptions = NonNullable<
|
|
572
|
-
Parameters<GenericMutationCtx<GenericDataModel>["runQuery"]>[2]
|
|
573
|
-
>;
|
|
574
|
-
type QueryRunQueryOptions = NonNullable<
|
|
575
|
-
Parameters<GenericQueryCtx<GenericDataModel>["runQuery"]>[2]
|
|
576
|
-
>;
|
|
577
|
-
|
|
578
|
-
test("available on mutation ctx runQuery options", () => {
|
|
579
|
-
assert<
|
|
580
|
-
"useStaleSnapshot" extends keyof MutationRunQueryOptions ? true : false
|
|
581
|
-
>();
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
test("not available on query ctx runQuery options", () => {
|
|
585
|
-
assertFalse<
|
|
586
|
-
"useStaleSnapshot" extends keyof QueryRunQueryOptions ? true : false
|
|
587
|
-
>();
|
|
588
|
-
});
|
|
589
|
-
});
|