MCPcopy
hub / github.com/blitz-js/blitz / validateQueryFn

Function validateQueryFn

packages/blitz-rpc/src/query/utils.ts:81–89  ·  view source on GitHub ↗
(
  queryFn: Resolver<TInput, TResult> | RpcClient<TInput, TResult>,
)

Source from the content-addressed store, hash-verified

79})()
80
81export const validateQueryFn = <TInput, TResult>(
82 queryFn: Resolver<TInput, TResult> | RpcClient<TInput, TResult>,
83) => {
84 if (isClient && !isRpcClient(queryFn) && isNotInUserTestEnvironment()) {
85 throw new Error(
86 `Either the file path to your resolver is incorrect (must be in a "queries" or "mutations" folder that isn't nested inside "pages" or "api") or you are trying to use Blitz's useQuery to fetch from third-party APIs (to do that, import useQuery directly from "@tanstack/react-query").`,
87 )
88 }
89}
90
91const sanitize =
92 (type: ResolverType) =>

Callers 2

utils.test.tsFile · 0.90
sanitizeFunction · 0.85

Calls 2

isRpcClientFunction · 0.85

Tested by

no test coverage detected