
Security News
PHP Foundation Says Chainguard Broke Security Embargo Ahead of Emergency Patches
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.
@cratestack/adapter-tanstack-query
Advanced tools
Generic TanStack Query option builders (query/mutation) over CrateStack's generated TypeScript RPC client.
Generic TanStack Query option builders over CrateStack's generated
TypeScript RPC client (transport rpc schemas), for hand-written query/mutation hooks that don't
go through the fully-generated use{Model}Query/use{Model}Mutation hooks
(cratestack generate-typescript's own rpc-react-query.ts.j2 output) — e.g. calling a
procedure the generated hooks don't cover yet, or using vue-query/solid-query/svelte-query
instead of @tanstack/react-query.
Framework-agnostic: everything here is typed against @tanstack/query-core, which every TanStack
Query framework binding builds on.
import { rpcQueryOptions, rpcMutationOptions, isRpcErrorCode } from "@cratestack/adapter-tanstack-query";
import { useQuery, useMutation } from "@tanstack/react-query";
import { client } from "./generated/client"; // your project's generated client instance
function useWidget(id: number) {
return useQuery({
...rpcQueryOptions(client.runtime, "model.Widget.get", { id }),
retry: (failureCount, error) => !isRpcErrorCode(error, "not_found") && failureCount < 3,
});
}
function useCreateOrder() {
return useMutation(rpcMutationOptions(client.runtime, "model.Order.create"));
}
rpcQueryOptions/rpcMutationOptions take an RpcCaller — any object with a
call<I, O>(opId, input, options?) method, which is exactly the shape of a generated client's
public .runtime field (CratestackRpcRuntime). Requests issued this way go through the same
links chain (@cratestack/link-batch, @cratestack/link-logger, etc.) as every other call on
that runtime.
BigInt fieldsA BigInt field of a generated client is a bigint (ADR 0019), and TanStack Query hashes a
query key with JSON.stringify, which throws on one ("Do not know how to serialize a BigInt").
rpcQueryKey, and so rpcQueryOptions, stores every bigint in the input, at any depth, as its
canonical decimal string: the same text the client sends on the wire. Two different values are two
keys (2n ** 53n and 2n ** 53n + 1n stay apart, where a number would round them together) and
the same value is the same key. The request itself still gets the real bigint; the generated
runtime encodes it.
useQuery(rpcQueryOptions(client.runtime, "model.Counter.get", { id: 9007199254740993n }));
// Build the key you invalidate with through the same function: a hand-written
// key holding a raw bigint neither hashes nor matches the stored one.
queryClient.invalidateQueries({
queryKey: rpcQueryKey("model.Counter.get", { id: 9007199254740993n }),
});
FAQs
Generic TanStack Query option builders (query/mutation) over CrateStack's generated TypeScript RPC client.
The npm package @cratestack/adapter-tanstack-query receives a total of 41 weekly downloads. As such, @cratestack/adapter-tanstack-query popularity was classified as not popular.
We found that @cratestack/adapter-tanstack-query demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
The PHP Foundation says Chainguard broke a security embargo ahead of critical RCE patches, as leaks disrupted the coordinated release.

Security News
PHP releases emergency patches for two critical RCE vulnerabilities as agencies urge organizations to take unpatched sites offline.

Threat Research
/Security News
A supply chain attack compromised LiteLLM 1.107.0 on PyPI and Docker, spreading malware that steals cloud credentials, developer secrets, and AI provider keys.