UNPKG

@openapi-qraft/react

Version:

OpenAPI client for React, providing type-safe requests and dynamic TanStack Query React Hooks via a modular, Proxy-based architecture.

19 lines (15 loc) 948 B
'use strict'; var composeInfiniteQueryKey = require('./composeInfiniteQueryKey.cjs'); var composeQueryKey = require('./composeQueryKey.cjs'); /** * Calls a query client method with parameters and options, * and automatically composes the `QueryKey` based on the schema and parameters. */ function callQueryClientMethodWithQueryKey(qraftOptions, queryClientMethod, schema, infinite, args) { const parameters = args[0]; const queryKey = Array.isArray(parameters) ? parameters : infinite ? composeInfiniteQueryKey.composeInfiniteQueryKey(schema, parameters) : composeQueryKey.composeQueryKey(schema, parameters); const queryClient = qraftOptions.queryClient; // @ts-expect-error - Too complex to type return queryClient[queryClientMethod](queryKey, ...args.slice(1, args.length)); } exports.callQueryClientMethodWithQueryKey = callQueryClientMethodWithQueryKey; //# sourceMappingURL=callQueryClientMethodWithQueryKey.cjs.map